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

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

Issue 1995083003: Change LineWidth::fitsOnLine comparison logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: w/TestExpectations 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..48f81fa9aa09ea3d4273c72b7ce3e993b5d02eaf 100644
--- a/third_party/WebKit/Source/core/layout/line/LineWidth.h
+++ b/third_party/WebKit/Source/core/layout/line/LineWidth.h
@@ -46,8 +46,15 @@ class LineWidth {
public:
LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot);
- bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + LayoutUnit::epsilon()); }
- bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_availableWidth + LayoutUnit::epsilon()); }
+ bool fitsOnLine() const
+ {
+ return LayoutUnit::fromFloatFloor(currentWidth()) <= m_availableWidth;
+ }
+ bool fitsOnLine(float extra) const
+ {
+ float totalWidth = currentWidth() + extra;
+ return LayoutUnit::fromFloatFloor(totalWidth) <= m_availableWidth;
+ }
bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const
{
return currentWidth() - (whitespaceTreatment == ExcludeWhitespace ? trailingWhitespaceWidth() : 0) + extra <= (m_availableWidth + LayoutUnit::epsilon());
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698