RESOLVED FIXED 101803
REGRESSION(r121789): Text not wrapping in presence of floating objects
https://bugs.webkit.org/show_bug.cgi?id=101803
Summary REGRESSION(r121789): Text not wrapping in presence of floating objects
Julien Chaffraix
Reported 2012-11-09 14:50:59 PST
Created attachment 173378 [details] Reduction After r121789, the text is not wrapping properly on the attached page and thus overflows its containing block. This seems caused by a combination of floats and a line layout, where the line is offset a bit from the adjacent float.
Attachments
Reduction (560 bytes, text/html)
2012-11-09 14:50 PST, Julien Chaffraix
no flags
Patch (8.34 KB, patch)
2012-11-12 12:32 PST, Robert Hogan
no flags
A test case with a big inline box (619 bytes, text/html)
2012-11-12 13:39 PST, Andrei Bucur
no flags
Patch (36.48 KB, patch)
2012-11-19 12:36 PST, Robert Hogan
no flags
Patch (36.55 KB, patch)
2012-11-20 00:02 PST, Robert Hogan
no flags
Patch (36.49 KB, patch)
2012-11-21 23:25 PST, Robert Hogan
no flags
Patch (43.81 KB, patch)
2012-11-26 12:23 PST, Robert Hogan
no flags
Patch (37.87 KB, patch)
2012-11-29 13:47 PST, Robert Hogan
no flags
Patch (37.89 KB, patch)
2012-12-06 10:51 PST, Robert Hogan
no flags
Patch (40.88 KB, patch)
2012-12-08 02:53 PST, Robert Hogan
no flags
Patch (40.66 KB, patch)
2012-12-08 03:26 PST, Robert Hogan
no flags
Patch (38.38 KB, patch)
2012-12-08 11:52 PST, Robert Hogan
no flags
Robert Hogan
Comment 1 2012-11-12 12:32:29 PST
Eric Seidel (no email)
Comment 2 2012-11-12 12:38:31 PST
Eric Seidel (no email)
Comment 3 2012-11-12 12:39:15 PST
Does this have a perf impact?
EFL EWS Bot
Comment 4 2012-11-12 12:45:38 PST
Dave Hyatt
Comment 5 2012-11-12 12:48:11 PST
Comment on attachment 173687 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=173687&action=review r- > Source/WebCore/rendering/RenderBlockLineLayout.cpp:142 > - return logicalHeight; > + return block->lineHeight(true, block->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); It's a little weird that you ignore line-box-contain values that might have indicated the block's line-height should be ignored. I don't have a really good solution if that is the case, however, since I'm not sure what we want to do in that situation. We can either leave this alone with a FIXME, or we can decide that if the block is excluded we return 0 instead. I'm leaning towards returning 0. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:145 > if (lineBox->firstChild() && lineBox->firstChild()->renderer() && lineBox->firstChild()->renderer()->isRenderBlock()) > - logicalHeight = toRenderBlock(lineBox->firstChild()->renderer())->logicalHeight(); > - else > - logicalHeight = lineBox->height(); > - return logicalHeight; > + return toRenderBlock(lineBox->firstChild()->renderer())->logicalHeight(); This just looks all wrong to me. I don't understand any of it. Neither the original code nor the new code look right to me.
Dave Hyatt
Comment 6 2012-11-12 13:25:58 PST
I think you should just use the block line height and cut out the inline block checking for now. Also, you need to handle line-box-contain values that exclude block (just use 0 in that case), and I think if you're not in strict mode, you should just use 0 too, since otherwise you'll mess up the quirks mode cases where images have their descent removed.
Andrei Bucur
Comment 7 2012-11-12 13:39:42 PST
Created attachment 173709 [details] A test case with a big inline box
Robert Hogan
Comment 8 2012-11-19 12:36:37 PST
WebKit Review Bot
Comment 9 2012-11-19 16:30:35 PST
Comment on attachment 175025 [details] Patch Attachment 175025 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14894360 New failing tests: css2.1/20110323/floats-wrap-top-below-inline-001r.htm
Build Bot
Comment 10 2012-11-19 23:04:42 PST
Comment on attachment 175025 [details] Patch Attachment 175025 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14907496 New failing tests: fast/block/float/floats-offset-inline-block-strict-lineheight.html css2.1/20110323/floats-wrap-top-below-inline-001r.htm fast/block/float/floats-offset-image-strict-lineheight.html fast/block/float/floats-offset-image-strict.html
Robert Hogan
Comment 11 2012-11-20 00:02:17 PST
Build Bot
Comment 12 2012-11-20 01:59:25 PST
Comment on attachment 175163 [details] Patch Attachment 175163 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14901536 New failing tests: fast/block/float/floats-offset-inline-block-strict-lineheight.html fast/block/float/floats-offset-image-strict-lineheight.html fast/block/float/floats-offset-image-strict.html
Robert Hogan
Comment 13 2012-11-21 23:25:26 PST
Dave Hyatt
Comment 14 2012-11-26 11:38:29 PST
Comment on attachment 175597 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175597&action=review r- > Source/WebCore/rendering/RenderBlockLineLayout.cpp:140 > + if (block->document()->inQuirksMode() && replacedHeight) > + return replacedHeight; I think this replaced stuff needs work. I'd prefer we just get the simplest fix in first. For now, let's just change this to: if (!block->document()->inNoQuirksMode()) return 0; Note that the descent clipping for replaced elements happens even in LimitedQuirksMode, so you need to specifically target NoQuirksMode only. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:950 > + if (!previousObject && r->m_object->isReplaced()) { > + RenderBox* renderBox = toRenderBox(r->m_object); > + LayoutUnit lineLogicalHeight = logicalHeightForLine(this, firstLine, renderBox->logicalHeight()); > + logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight); > + logicalRight = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight); > +#if ENABLE(CSS_EXCLUSIONS) > + if (exclusionShapeInsideInfo && exclusionShapeInsideInfo->hasSegments()) { > + logicalLeft = max<float>(roundToInt(exclusionShapeInsideInfo->segments()[0].logicalLeft), logicalLeft); > + logicalRight = min<float>(floorToInt(exclusionShapeInsideInfo->segments()[0].logicalRight), logicalRight); > + } > +#endif > + availableLogicalWidth = logicalRight - logicalLeft; > + } Just cut this for now. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:2500 > + if (atStart) > + width.updateAvailableWidth(replacedBox->logicalHeight()); Just drop this for now. Let's figure out the replaced element handling in a separate patch.
Robert Hogan
Comment 15 2012-11-26 12:23:01 PST
Build Bot
Comment 16 2012-11-26 13:11:06 PST
Comment on attachment 176044 [details] Patch Attachment 176044 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14980895 New failing tests: css1/formatting_model/floating_elements.html fast/block/float/010.html fast/block/float/independent-align-positioning.html
WebKit Review Bot
Comment 17 2012-11-26 14:16:25 PST
Comment on attachment 176044 [details] Patch Attachment 176044 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14985841 New failing tests: css1/formatting_model/floating_elements.html fast/text/atsui-small-caps-punctuation-size.html
Robert Hogan
Comment 18 2012-11-29 13:47:00 PST
Dave Hyatt
Comment 19 2012-12-05 11:16:27 PST
Comment on attachment 176809 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=176809&action=review Just one question. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:140 > + if (block->document()->inQuirksMode() && replacedHeight) > + return replacedHeight; Why only in quirks mode? Lines still grow to accommodate replaced elements in all modes. I'm not really understanding this part. Note the difference between NoQuirksMode and the other two modes is that in NoQuirksMode, baseline-aligned images still have descent. Even if your heuristic isn't good enough to account for this descent, the replacedHeight is still relevant in all modes.
Robert Hogan
Comment 20 2012-12-05 11:26:11 PST
(In reply to comment #19) > (From update of attachment 176809 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=176809&action=review > > Just one question. > > > Source/WebCore/rendering/RenderBlockLineLayout.cpp:140 > > + if (block->document()->inQuirksMode() && replacedHeight) > > + return replacedHeight; > > Why only in quirks mode? Lines still grow to accommodate replaced elements in all modes. I'm not really understanding this part. > > Note the difference between NoQuirksMode and the other two modes is that in NoQuirksMode, baseline-aligned images still have descent. Even if your heuristic isn't good enough to account for this descent, the replacedHeight is still relevant in all modes. That's right - in the other modes I can just take the maximum of the line-height or replacedHeight. It's only in quirks mode that the descent is ignored completely like this - and I've just realized you asked me to change this to !block->document()->inNoQuirksMode()
Robert Hogan
Comment 21 2012-12-06 10:51:31 PST
Robert Hogan
Comment 22 2012-12-08 02:53:14 PST
Build Bot
Comment 23 2012-12-08 03:13:20 PST
Robert Hogan
Comment 24 2012-12-08 03:26:34 PST
Build Bot
Comment 25 2012-12-08 04:37:51 PST
Robert Hogan
Comment 26 2012-12-08 11:52:50 PST
Dave Hyatt
Comment 27 2012-12-10 12:33:11 PST
Comment on attachment 178370 [details] Patch r=me
WebKit Review Bot
Comment 28 2012-12-11 10:15:19 PST
Comment on attachment 178370 [details] Patch Clearing flags on attachment: 178370 Committed r137331: <http://trac.webkit.org/changeset/137331>
WebKit Review Bot
Comment 29 2012-12-11 10:15:24 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 30 2013-02-26 13:42:32 PST
This patch broke the layout of http://www.usspotemkin.com
Andy Estes
Comment 31 2013-02-26 13:54:27 PST
(In reply to comment #30) > This patch broke the layout of http://www.usspotemkin.com Filed https://bugs.webkit.org/show_bug.cgi?id=110910 to track this.
Note You need to log in before you can comment on or make changes to this bug.