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

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

Issue 2026073002: Restore epsilon tolerance in LineWidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/sub-pixel/button-span-wrap-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 30 matching lines...) Expand all
41 41
42 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace }; 42 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace };
43 43
44 class LineWidth { 44 class LineWidth {
45 STACK_ALLOCATED(); 45 STACK_ALLOCATED();
46 public: 46 public:
47 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot); 47 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot);
48 48
49 bool fitsOnLine() const 49 bool fitsOnLine() const
50 { 50 {
51 return LayoutUnit::fromFloatFloor(currentWidth()) <= m_availableWidth; 51 return LayoutUnit::fromFloatFloor(currentWidth()) <= m_availableWidth + LayoutUnit::epsilon();
52 } 52 }
53 bool fitsOnLine(float extra) const 53 bool fitsOnLine(float extra) const
54 { 54 {
55 float totalWidth = currentWidth() + extra; 55 float totalWidth = currentWidth() + extra;
56 return LayoutUnit::fromFloatFloor(totalWidth) <= m_availableWidth; 56 return LayoutUnit::fromFloatFloor(totalWidth) <= m_availableWidth + Layo utUnit::epsilon();
57 } 57 }
58 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const 58 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const
59 { 59 {
60 LayoutUnit w = LayoutUnit::fromFloatFloor(currentWidth() + extra); 60 LayoutUnit w = LayoutUnit::fromFloatFloor(currentWidth() + extra);
61 if (whitespaceTreatment == ExcludeWhitespace) 61 if (whitespaceTreatment == ExcludeWhitespace)
62 w -= LayoutUnit::fromFloatCeil(trailingWhitespaceWidth()); 62 w -= LayoutUnit::fromFloatCeil(trailingWhitespaceWidth());
63 return w <= m_availableWidth; 63 return w <= m_availableWidth;
64 } 64 }
65 65
66 // Note that m_uncommittedWidth may not be LayoutUnit-snapped at this point. Because 66 // Note that m_uncommittedWidth may not be LayoutUnit-snapped at this point. Because
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 LayoutUnit m_left; 98 LayoutUnit m_left;
99 LayoutUnit m_right; 99 LayoutUnit m_right;
100 LayoutUnit m_availableWidth; 100 LayoutUnit m_availableWidth;
101 bool m_isFirstLine; 101 bool m_isFirstLine;
102 IndentTextOrNot m_indentText; 102 IndentTextOrNot m_indentText;
103 }; 103 };
104 104
105 } // namespace blink 105 } // namespace blink
106 106
107 #endif // LineWidth_h 107 #endif // LineWidth_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/sub-pixel/button-span-wrap-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698