Changeset 133292 in webkit
- Timestamp:
- Nov 2, 2012 6:55:23 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r133287 r133292 1 2012-11-02 Arpita Bahuguna <arpitabahuguna@gmail.com> 2 3 Regression r130057: Improper preferred width calculation when an inline replaced object, wrapped in an inline flow, follows some text. 4 https://bugs.webkit.org/show_bug.cgi?id=99442 5 6 Reviewed by Levi Weintraub. 7 8 * fast/block/block-with-inline-replaced-child-following-text-expected.txt: Added. 9 * fast/block/block-with-inline-replaced-child-following-text.html: Added. 10 Test added for verifying the width of the inline-block when an inline replaced 11 object follows some text object which does not end in a whitespace. 12 13 The correct width of our containing box in this case should be 94px which is 14 determined by the min-width of our text (using ahem font) which is 64px + 15 the padding - 30px. 16 17 Prior to this fix, the trailing end-width from the text (64px) would be carried 18 onto the next line containing the inline replaced object. This would then make 19 that line's width as 64px (end width of text) + 30 px (padding) + 50px (width 20 of our image object) making it 144px in total. This would then incorrectly 21 define the width of our containing box. 22 1 23 2012-11-02 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 24 -
trunk/Source/WebCore/ChangeLog
r133291 r133292 1 2012-11-02 Arpita Bahuguna <arpitabahuguna@gmail.com> 2 3 Regression r130057: Improper preferred width calculation when an inline replaced object, wrapped in an inline flow, follows some text. 4 https://bugs.webkit.org/show_bug.cgi?id=99442 5 6 Reviewed by Levi Weintraub. 7 8 Extra width is displayed after an inline replaced object that follows some 9 text (not ending in a whitespace) within an inline-block. This is due to 10 the end width (endMin) of the text object being carried forward (via inlineMin) 11 and added onto the next line containing the inline replaced object. 12 13 This was caused as a regression to, or rather became apparent post the fix 14 http://trac.webkit.org/changeset/130057 which fixed the block's preferred 15 width when a renderInline with width contained an inline replaced object. 16 17 Test: fast/block/block-with-inline-replaced-child-following-text.html 18 19 * rendering/RenderBlock.cpp: 20 (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): 21 Introduced another flag (shouldBreakLineAfterText) which is set when 22 our current Text line (object) does not end in a whitespace, thereby 23 implying that there could be more text following, for which the end width 24 needs to be carried forward onto the next line. 25 26 In case the following object instead turns out to be an Inline Replaced 27 object, we should terminate our previous line and reset this extra width. 28 This is now being handled by checking for the shouldBreakLineAfterText 29 flag while processing Inline Replaced objects. 30 31 Once set, shouldBreakLineAfterText shall be reset only if we get another 32 Text object that ends in a whitespace, signifying the termination of 33 that text line. For all other cases, we persist with this flag through 34 the block's inline contents. 35 1 36 2012-11-02 Eugene Klyuchnikov <eustas.bug@gmail.com> 2 37 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r132753 r133292 5793 5793 RenderObject* prevFloat = 0; 5794 5794 bool isPrevChildInlineFlow = false; 5795 bool shouldBreakLineAfterText = false; 5795 5796 while (RenderObject* child = childIterator.next()) { 5796 5797 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : … … 5881 5882 5882 5883 bool canBreakReplacedElement = !child->isImage() || allowImagesToBreak; 5883 if ((canBreakReplacedElement && (autoWrap || oldAutoWrap) && !isPrevChildInlineFlow) || clearPreviousFloat) {5884 if ((canBreakReplacedElement && (autoWrap || oldAutoWrap) && (!isPrevChildInlineFlow || shouldBreakLineAfterText)) || clearPreviousFloat) { 5884 5885 updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin); 5885 5886 inlineMin = 0; … … 5908 5909 inlineMax += max<float>(0, childMax); 5909 5910 5910 if (!autoWrap || !canBreakReplacedElement || isPrevChildInlineFlow) {5911 if (!autoWrap || !canBreakReplacedElement || (isPrevChildInlineFlow && !shouldBreakLineAfterText)) { 5911 5912 if (child->isFloating()) 5912 5913 updatePreferredWidth(m_minPreferredLogicalWidth, childMin); … … 6012 6013 updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin); 6013 6014 inlineMin = 0; 6015 shouldBreakLineAfterText = false; 6014 6016 } else { 6015 6017 updatePreferredWidth(m_minPreferredLogicalWidth, inlineMin); 6016 6018 inlineMin = endMin; 6019 shouldBreakLineAfterText = true; 6017 6020 } 6018 6021 }
Note: See TracChangeset
for help on using the changeset viewer.