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

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp Created 4 years, 10 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/line/InlineTextBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
index fb93be43746409a6babc98e3f46274720db9babc..291052767c8fcded0377a0c665990596d33e24b6 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -256,7 +256,7 @@ LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const
height = selHeight;
if (hasWrappedSelectionNewline()) {
if (!isLeftToRightDirection())
- topPoint.setX(topPoint.x() - newlineSpaceWidth());
+ topPoint.setX(LayoutUnit(topPoint.x() - newlineSpaceWidth()));
width += newlineSpaceWidth();
}
} else {
@@ -359,7 +359,7 @@ LayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR, LayoutUnit visibleLef
// If we got here that means that we were only partially truncated and we need to return the pixel offset at which
// to place the ellipsis.
- LayoutUnit widthOfVisibleText = lineLayoutItem().width(m_start, offset, textPos(), flowIsLTR ? LTR : RTL, isFirstLineStyle());
+ LayoutUnit widthOfVisibleText(lineLayoutItem().width(m_start, offset, textPos(), flowIsLTR ? LTR : RTL, isFirstLineStyle()));
// The ellipsis needs to be placed just after the last visible character.
// Where "after" is defined by the flow directionality, not the inline
@@ -506,7 +506,7 @@ LayoutUnit InlineTextBox::positionForOffset(int offset) const
int from = !isLeftToRightDirection() ? offset - m_start : 0;
int to = !isLeftToRightDirection() ? m_len : offset - m_start;
// FIXME: Do we need to add rightBearing here?
- return font.selectionRectForText(constructTextRun(styleToUse, font), IntPoint(logicalLeft(), 0), 0, from, to).maxX();
+ return LayoutUnit(font.selectionRectForText(constructTextRun(styleToUse, font), IntPoint(logicalLeft(), 0), 0, from, to).maxX());
}
bool InlineTextBox::containsCaretOffset(int offset) const
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp ('k') | third_party/WebKit/Source/core/layout/line/LineWidth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698