Changeset 142042 in webkit
- Timestamp:
- Feb 6, 2013 3:08:59 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142034 r142042 1 2013-02-06 Levi Weintraub <leviw@chromium.org> 2 3 Negative text indents can break RenderBlock's inline maximum preferred width calculation 4 https://bugs.webkit.org/show_bug.cgi?id=108973 5 6 Reviewed by Emil A Eklund. 7 8 * fast/css/negative-text-indent-in-inline-block-expected.html: Added. 9 * fast/css/negative-text-indent-in-inline-block.html: Added. 10 1 11 2013-02-06 Zan Dobersek <zdobersek@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r142033 r142042 1 2013-02-06 Levi Weintraub <leviw@chromium.org> 2 3 Negative text indents can break RenderBlock's inline maximum preferred width calculation 4 https://bugs.webkit.org/show_bug.cgi?id=108973 5 6 Reviewed by Emil A Eklund. 7 8 Change two quirks about to how we calculate a block's inline preferred width with 9 text-indent. 10 11 First, re-use text-indent that's first applied to floats on text that follows it. 12 This matches Layout, as otherwise we can prematurely wrap text when there's a negative 13 margin on a block starting with a float. This also matches FireFox. 14 15 Second, correct how the max preferred width is calculated in the presence of a negative 16 text-indent. If the text-indent is more negative than the first text line break, we 17 update the value to be the remainder. Previously, we added this remaining negative value 18 to subsequent minimum and maximum preferred width calculations (until the remainder was 19 gone). This is wrong for the max preferred width, as we're adding the negative value more 20 than once, and leads to a max preferred width that's smaller than our line. 21 22 Test: fast/css/negative-text-indent-in-inline-block.html 23 24 * rendering/RenderBlock.cpp: 25 (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): 26 1 27 2013-02-06 Mark Lam <mark.lam@apple.com> 2 28 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r142015 r142042 5871 5871 5872 5872 InlineMinMaxIterator childIterator(this); 5873 bool addedTextIndent = false; // Only gets added in once. 5873 5874 // Only gets added to the max preffered width once. 5875 bool addedTextIndent = false; 5876 // Signals the text indent was more negative than the min preferred width 5877 bool hasRemainingNegativeTextIndent = false; 5878 5874 5879 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view()); 5875 5880 RenderObject* prevFloat = 0; … … 5977 5982 // Add in text-indent. This is added in only once. 5978 5983 LayoutUnit ti = 0; 5979 if (!addedTextIndent ) {5984 if (!addedTextIndent && !child->isFloating()) { 5980 5985 ti = textIndent; 5981 5986 childMin += ti.ceilToFloat(); … … 6057 6062 // Add in text-indent. This is added in only once. 6058 6063 float ti = 0; 6059 if (!addedTextIndent ) {6064 if (!addedTextIndent || hasRemainingNegativeTextIndent) { 6060 6065 ti = textIndent.ceilToFloat(); 6066 childMin += ti; 6067 beginMin += ti; 6061 6068 6062 childMin += ti; 6063 childMax += ti; 6064 beginMin += ti; 6065 beginMax += ti; 6069 // It the text indent negative and larger than the child minimum, we re-use the remainder 6070 // in future minimum calculations, but using the negative value again on the maximum 6071 // will lead to under-counting the max pref width. 6072 if (!addedTextIndent) { 6073 childMax += ti; 6074 beginMax += ti; 6075 addedTextIndent = true; 6076 } 6066 6077 6067 if (childMin < 0) 6078 if (childMin < 0) { 6068 6079 textIndent = childMin; 6069 else6070 addedTextIndent = true;6080 hasRemainingNegativeTextIndent = true; 6081 } 6071 6082 } 6072 6083
Note: See TracChangeset
for help on using the changeset viewer.