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

Unified Diff: third_party/WebKit/Source/core/layout/line/LineWidth.h

Issue 1995103002: Represent lines using LayoutUnit in LineWidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: w/LayoutTest Created 4 years, 7 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/LineWidth.h
diff --git a/third_party/WebKit/Source/core/layout/line/LineWidth.h b/third_party/WebKit/Source/core/layout/line/LineWidth.h
index 6f18faae32b95f220bfc9be723da3f6ec77a9adb..5f63846aa0adc2ffb398a4b3cb1a5daaa26c61d3 100644
--- a/third_party/WebKit/Source/core/layout/line/LineWidth.h
+++ b/third_party/WebKit/Source/core/layout/line/LineWidth.h
@@ -50,7 +50,10 @@ public:
bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_availableWidth + LayoutUnit::epsilon()); }
bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const
{
- return currentWidth() - (whitespaceTreatment == ExcludeWhitespace ? trailingWhitespaceWidth() : 0) + extra <= (m_availableWidth + LayoutUnit::epsilon());
+ LayoutUnit w = LayoutUnit::fromFloatFloor(currentWidth() + extra);
+ if (whitespaceTreatment == ExcludeWhitespace)
+ w -= LayoutUnit::fromFloatCeil(trailingWhitespaceWidth());
+ return w <= m_availableWidth;
}
// Note that m_uncommittedWidth may not be LayoutUnit-snapped at this point. Because
@@ -77,7 +80,7 @@ public:
private:
void computeAvailableWidthFromLeftAndRight();
- void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, const float& newLineLeft, const float& newLineRight);
+ void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, const LayoutUnit& newLineLeft, const LayoutUnit& newLineRight);
void wrapNextToShapeOutside(bool isFirstLine);
LineLayoutBlockFlow m_block;
@@ -85,9 +88,9 @@ private:
float m_committedWidth;
float m_overhangWidth; // The amount by which |m_availableWidth| has been inflated to account for possible contraction due to ruby overhang.
float m_trailingWhitespaceWidth;
- float m_left;
- float m_right;
- float m_availableWidth;
+ LayoutUnit m_left;
+ LayoutUnit m_right;
+ LayoutUnit m_availableWidth;
bool m_isFirstLine;
IndentTextOrNot m_indentText;
};

Powered by Google App Engine
This is Rietveld 408576698