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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutInline.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index 51843d184d292bb7dad71ca025c1079df842a50f..d724d25e4d6d37093bef457f1943b25f8de0b358 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -243,7 +243,7 @@ LayoutRect LayoutInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e
ASSERT_UNUSED(inlineBox, !inlineBox);
if (extraWidthToEndOfLine)
- *extraWidthToEndOfLine = 0;
+ *extraWidthToEndOfLine = LayoutUnit();
LayoutRect caretRect = localCaretRectForEmptyElement(borderAndPaddingWidth(), 0);
@@ -564,10 +564,13 @@ void LayoutInline::generateCulledLineBoxRects(GeneratorContext& yield, const Lay
RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root();
int logicalTop = rootBox.logicalTop() + (rootBox.lineLayoutItem().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
int logicalHeight = container->style(rootBox.isFirstLineStyle())->font().fontMetrics().height();
- if (isHorizontal)
- yield(LayoutRect(currBox->inlineBoxWrapper()->x() - currBox->marginLeft(), logicalTop, currBox->size().width() + currBox->marginWidth(), logicalHeight));
- else
- yield(LayoutRect(logicalTop, currBox->inlineBoxWrapper()->y() - currBox->marginTop(), logicalHeight, currBox->size().height() + currBox->marginHeight()));
+ if (isHorizontal) {
+ yield(LayoutRect(LayoutUnit(currBox->inlineBoxWrapper()->x() - currBox->marginLeft()), LayoutUnit(logicalTop),
+ LayoutUnit(currBox->size().width() + currBox->marginWidth()), LayoutUnit(logicalHeight)));
+ } else {
+ yield(LayoutRect(LayoutUnit(logicalTop), LayoutUnit(currBox->inlineBoxWrapper()->y() - currBox->marginTop()),
+ LayoutUnit(logicalHeight), currBox->size().height() + currBox->marginHeight()));
+ }
}
} else if (curr->isLayoutInline()) {
// If the child doesn't need line boxes either, then we can recur.
@@ -580,15 +583,15 @@ void LayoutInline::generateCulledLineBoxRects(GeneratorContext& yield, const Lay
int logicalTop = rootBox.logicalTop() + (rootBox.lineLayoutItem().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent());
int logicalHeight = container->style(rootBox.isFirstLineStyle())->font().fontMetrics().height();
if (isHorizontal) {
- yield(LayoutRect(childLine->x() - childLine->marginLogicalLeft(),
- logicalTop,
- childLine->logicalWidth() + childLine->marginLogicalLeft() + childLine->marginLogicalRight(),
- logicalHeight));
+ yield(LayoutRect(LayoutUnit(childLine->x() - childLine->marginLogicalLeft()),
+ LayoutUnit(logicalTop),
+ LayoutUnit(childLine->logicalWidth() + childLine->marginLogicalLeft() + childLine->marginLogicalRight()),
+ LayoutUnit(logicalHeight)));
} else {
- yield(LayoutRect(logicalTop,
- childLine->y() - childLine->marginLogicalLeft(),
- logicalHeight,
- childLine->logicalWidth() + childLine->marginLogicalLeft() + childLine->marginLogicalRight()));
+ yield(LayoutRect(LayoutUnit(logicalTop),
+ LayoutUnit(childLine->y() - childLine->marginLogicalLeft()),
+ LayoutUnit(logicalHeight),
+ LayoutUnit(childLine->logicalWidth() + childLine->marginLogicalLeft() + childLine->marginLogicalRight())));
}
}
}
@@ -875,8 +878,8 @@ IntRect LayoutInline::linesBoundingBox() const
ASSERT(!firstLineBox() == !lastLineBox()); // Either both are null or both exist.
if (firstLineBox() && lastLineBox()) {
// Return the width of the minimal left side and the maximal right side.
- LayoutUnit logicalLeftSide = 0;
- LayoutUnit logicalRightSide = 0;
+ LayoutUnit logicalLeftSide;
+ LayoutUnit logicalRightSide;
for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
if (curr == firstLineBox() || curr->logicalLeft() < logicalLeftSide)
logicalLeftSide = curr->logicalLeft();
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | third_party/WebKit/Source/core/layout/LayoutListMarker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698