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

Unified Diff: Source/core/rendering/InlineTextBox.cpp

Issue 699683002: Continue with InlineBox float->LayoutUnit migration. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nit Created 6 years, 1 month 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
« no previous file with comments | « Source/core/rendering/InlineTextBox.h ('k') | Source/core/rendering/RootInlineBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/InlineTextBox.cpp
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 91d7ad6af6cfa751f936b35ea7715cd7dd9b8674..b89f6708de9431053285e06f5d755bffb527bc7f 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -206,12 +206,12 @@ LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos)
bool respectHyphen = ePos == m_len && hasHyphen();
TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charactersWithHyphen : 0);
- FloatPoint startingPoint = FloatPoint(logicalLeft(), selTop.toFloat());
+ FloatPointWillBeLayoutPoint startingPoint = FloatPointWillBeLayoutPoint(logicalLeft(), selTop.toFloat());
LayoutRect r;
if (sPos || ePos != static_cast<int>(m_len))
r = enclosingIntRect(font.selectionRectForText(textRun, startingPoint, selHeight, sPos, ePos));
else // Avoid computing the font width when the entire line box is selected as an optimization.
- r = enclosingIntRect(FloatRect(startingPoint, FloatSize(m_logicalWidth, selHeight.toFloat())));
+ r = enclosingIntRect(FloatRectWillBeLayoutRect(startingPoint, FloatSizeWillBeLayoutSize(m_logicalWidth, selHeight.toFloat())));
LayoutUnit logicalWidth = r.width();
if (r.x() > logicalRight())
@@ -248,7 +248,7 @@ void InlineTextBox::attachLine()
renderer().attachTextBox(this);
}
-float InlineTextBox::placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox)
+FloatWillBeLayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR, FloatWillBeLayoutUnit visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLayoutUnit ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool& foundBox)
{
if (foundBox) {
m_truncation = cFullTruncation;
@@ -256,7 +256,7 @@ float InlineTextBox::placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, flo
}
// For LTR this is the left edge of the box, for RTL, the right edge in parent coordinates.
- float ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWidth : visibleLeftEdge + ellipsisWidth;
+ FloatWillBeLayoutUnit ellipsisX = flowIsLTR ? visibleRightEdge - ellipsisWidth : visibleLeftEdge + ellipsisWidth;
// Criteria for full truncation:
// LTR: the left edge of the ellipsis is to the left of our text run.
@@ -299,7 +299,7 @@ float InlineTextBox::placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, flo
// 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.
- float widthOfVisibleText = renderer().width(m_start, offset, textPos(), flowIsLTR ? LTR : RTL, isFirstLineStyle());
+ FloatWillBeLayoutUnit widthOfVisibleText = renderer().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
@@ -326,9 +326,9 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
if (isLineBreak())
return false;
- FloatPoint boxOrigin = locationIncludingFlipping();
+ FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(accumulatedOffset);
- FloatRect rect(boxOrigin, size());
+ FloatRectWillBeLayoutRect rect(boxOrigin, size());
if (m_truncation != cFullTruncation && visibleToHitTestRequest(request) && locationInContainer.intersects(rect)) {
renderer().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)));
if (!result.addNodeToRectBasedTestResult(renderer().node(), request, locationInContainer, rect))
@@ -383,12 +383,12 @@ void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) const
ePos = std::min(endPos - m_start, (int)m_len);
}
-void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font, bool grammar)
+void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPointWillBeLayoutPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font, bool grammar)
{
InlineTextBoxPainter(*this).paintDocumentMarker(pt, boxOrigin, marker, style, font, grammar);
}
-void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font)
+void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPointWillBeLayoutPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font)
{
InlineTextBoxPainter(*this).paintTextMatchMarker(pt, boxOrigin, marker, style, font);
}
@@ -403,7 +403,7 @@ int InlineTextBox::caretMaxOffset() const
return m_start + m_len;
}
-float InlineTextBox::textPos() const
+FloatWillBeLayoutUnit InlineTextBox::textPos() const
{
// When computing the width of a text run, RenderBlock::computeInlineDirectionPositionsForLine() doesn't include the actual offset
// from the containing block edge in its measurement. textPos() should be consistent so the text are rendered in the same width.
@@ -412,7 +412,7 @@ float InlineTextBox::textPos() const
return logicalLeft() - root().logicalLeft();
}
-int InlineTextBox::offsetForPosition(float lineOffset, bool includePartialGlyphs) const
+int InlineTextBox::offsetForPosition(FloatWillBeLayoutUnit lineOffset, bool includePartialGlyphs) const
{
if (isLineBreak())
return 0;
@@ -430,7 +430,7 @@ int InlineTextBox::offsetForPosition(float lineOffset, bool includePartialGlyphs
return font.offsetForPosition(constructTextRun(style, font), lineOffset - logicalLeft(), includePartialGlyphs);
}
-float InlineTextBox::positionForOffset(int offset) const
+FloatWillBeLayoutUnit InlineTextBox::positionForOffset(int offset) const
{
ASSERT(offset >= m_start);
ASSERT(offset <= m_start + m_len);
@@ -474,7 +474,7 @@ bool InlineTextBox::containsCaretOffset(int offset) const
return true;
}
-void InlineTextBox::characterWidths(Vector<float>& widths) const
+void InlineTextBox::characterWidths(Vector<FloatWillBeLayoutUnit>& widths) const
{
FontCachePurgePreventer fontCachePurgePreventer;
@@ -484,7 +484,7 @@ void InlineTextBox::characterWidths(Vector<float>& widths) const
TextRun textRun = constructTextRun(styleToUse, font);
SimpleShaper shaper(&font, textRun);
- float lastWidth = 0;
+ FloatWillBeLayoutUnit lastWidth = 0;
widths.resize(m_len);
for (unsigned i = 0; i < m_len; i++) {
shaper.advance(i + 1);
« no previous file with comments | « Source/core/rendering/InlineTextBox.h ('k') | Source/core/rendering/RootInlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698