Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 2536453002: Rename some functions about layout locations (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 DCHECK(!inlineBox); 276 DCHECK(!inlineBox);
277 277
278 if (extraWidthToEndOfLine) 278 if (extraWidthToEndOfLine)
279 *extraWidthToEndOfLine = LayoutUnit(); 279 *extraWidthToEndOfLine = LayoutUnit();
280 280
281 LayoutRect caretRect = 281 LayoutRect caretRect =
282 localCaretRectForEmptyElement(borderAndPaddingWidth(), LayoutUnit()); 282 localCaretRectForEmptyElement(borderAndPaddingWidth(), LayoutUnit());
283 283
284 if (InlineBox* firstBox = firstLineBox()) 284 if (InlineBox* firstBox = firstLineBox())
285 caretRect.moveBy(firstBox->topLeft()); 285 caretRect.moveBy(firstBox->location());
286 286
287 return caretRect; 287 return caretRect;
288 } 288 }
289 289
290 void LayoutInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) { 290 void LayoutInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) {
291 // Any table-part dom child of an inline element has anonymous wrappers in the 291 // Any table-part dom child of an inline element has anonymous wrappers in the
292 // layout tree so we need to climb up to the enclosing anonymous table wrapper 292 // layout tree so we need to climb up to the enclosing anonymous table wrapper
293 // and add the new child before that. 293 // and add the new child before that.
294 // TODO(rhogan): If newChild is a table part we want to insert it into the 294 // TODO(rhogan): If newChild is a table part we want to insert it into the
295 // same table as beforeChild. 295 // same table as beforeChild.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 const LayoutPoint& paintOffset) const { 602 const LayoutPoint& paintOffset) const {
603 InlinePainter(*this).paint(paintInfo, paintOffset); 603 InlinePainter(*this).paint(paintInfo, paintOffset);
604 } 604 }
605 605
606 template <typename GeneratorContext> 606 template <typename GeneratorContext>
607 void LayoutInline::generateLineBoxRects(GeneratorContext& yield) const { 607 void LayoutInline::generateLineBoxRects(GeneratorContext& yield) const {
608 if (!alwaysCreateLineBoxes()) { 608 if (!alwaysCreateLineBoxes()) {
609 generateCulledLineBoxRects(yield, this); 609 generateCulledLineBoxRects(yield, this);
610 } else if (InlineFlowBox* curr = firstLineBox()) { 610 } else if (InlineFlowBox* curr = firstLineBox()) {
611 for (; curr; curr = curr->nextLineBox()) 611 for (; curr; curr = curr->nextLineBox())
612 yield(LayoutRect(curr->topLeft(), curr->size())); 612 yield(LayoutRect(curr->location(), curr->size()));
613 } 613 }
614 } 614 }
615 615
616 static inline void computeItemTopHeight(const LayoutInline* container, 616 static inline void computeItemTopHeight(const LayoutInline* container,
617 const RootInlineBox& rootBox, 617 const RootInlineBox& rootBox,
618 LayoutUnit* top, 618 LayoutUnit* top,
619 LayoutUnit* height) { 619 LayoutUnit* height) {
620 bool firstLine = rootBox.isFirstLineStyle(); 620 bool firstLine = rootBox.isFirstLineStyle();
621 const SimpleFontData* fontData = 621 const SimpleFontData* fontData =
622 rootBox.getLineLayoutItem().style(firstLine)->font().primaryFont(); 622 rootBox.getLineLayoutItem().style(firstLine)->font().primaryFont();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 777
778 void LayoutInline::absoluteQuadsForSelf(Vector<FloatQuad>& quads) const { 778 void LayoutInline::absoluteQuadsForSelf(Vector<FloatQuad>& quads) const {
779 AbsoluteQuadsGeneratorContext context(this, quads); 779 AbsoluteQuadsGeneratorContext context(this, quads);
780 generateLineBoxRects(context); 780 generateLineBoxRects(context);
781 if (quads.isEmpty()) 781 if (quads.isEmpty())
782 context(FloatRect()); 782 context(FloatRect());
783 } 783 }
784 784
785 LayoutPoint LayoutInline::firstLineBoxTopLeft() const { 785 LayoutPoint LayoutInline::firstLineBoxTopLeft() const {
786 if (InlineBox* firstBox = firstLineBoxIncludingCulling()) 786 if (InlineBox* firstBox = firstLineBoxIncludingCulling())
787 return firstBox->topLeft(); 787 return firstBox->location();
788 return LayoutPoint(); 788 return LayoutPoint();
789 } 789 }
790 790
791 LayoutUnit LayoutInline::offsetLeft(const Element* parent) const { 791 LayoutUnit LayoutInline::offsetLeft(const Element* parent) const {
792 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).x(); 792 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).x();
793 } 793 }
794 794
795 LayoutUnit LayoutInline::offsetTop(const Element* parent) const { 795 LayoutUnit LayoutInline::offsetTop(const Element* parent) const {
796 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).y(); 796 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).y();
797 } 797 }
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1512 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1513 } 1513 }
1514 1514
1515 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1515 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1516 LayoutRect LayoutInline::debugRect() const { 1516 LayoutRect LayoutInline::debugRect() const {
1517 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1517 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1518 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1518 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1519 } 1519 }
1520 1520
1521 } // namespace blink 1521 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698