RESOLVED FIXED 80394
CSS 2.1 failure: margin-collapse-clear-012 fails
https://bugs.webkit.org/show_bug.cgi?id=80394
Summary CSS 2.1 failure: margin-collapse-clear-012 fails
Robert Hogan
Reported 2012-03-06 00:35:41 PST
At least one issue revealed by this test is that the top-margin of a child does not contribute height to the parent when computing clearance.
Attachments
Reduction (778 bytes, text/html)
2012-03-06 00:36 PST, Robert Hogan
no flags
Corrected Reduction (821 bytes, text/html)
2012-03-06 05:10 PST, Robert Hogan
no flags
Patch (115.97 KB, patch)
2012-05-07 09:18 PDT, Robert Hogan
no flags
Patch (114.33 KB, patch)
2012-07-02 11:35 PDT, Robert Hogan
no flags
Patch (120.84 KB, patch)
2012-07-22 09:34 PDT, Robert Hogan
no flags
Patch (124.58 KB, patch)
2012-07-22 12:19 PDT, Robert Hogan
no flags
Patch (128.07 KB, patch)
2012-08-24 12:42 PDT, Robert Hogan
no flags
Archive of layout-test-results from gce-cr-linux-03 (640.23 KB, application/zip)
2012-08-24 13:44 PDT, WebKit Review Bot
no flags
Patch (128.11 KB, patch)
2012-08-24 14:36 PDT, Robert Hogan
no flags
Patch (129.33 KB, patch)
2012-08-29 10:48 PDT, Robert Hogan
no flags
Patch (128.37 KB, patch)
2012-08-29 11:38 PDT, Robert Hogan
hyatt: review+
Robert Hogan
Comment 1 2012-03-06 00:36:16 PST
Created attachment 130316 [details] Reduction
Robert Hogan
Comment 2 2012-03-06 05:10:41 PST
Created attachment 130359 [details] Corrected Reduction
Robert Hogan
Comment 3 2012-03-07 01:13:43 PST
When a self-collapsing block has margin-top and needs to clear a float, the clearance calculated is the height of the float minus the margin-top and this should get added to the height of the parent. If the element has a margin-bottom (and it's the last element in the block) then this needs to get added to the height of the parent. At the moment, the clearance calculated for a self-collapsing block is the top of the block minus its bottom margin and this is what gets added to the height of the parent in clearFloatsIfNeeded(). The bottom margin of the last block is not getting added to the height of the parent.
Robert Hogan
Comment 4 2012-05-07 09:18:29 PDT
Dave Hyatt
Comment 5 2012-05-21 11:03:08 PDT
Comment on attachment 140536 [details] Patch Looks like you have an incorrect rendering in http://trac.webkit.org/browser/trunk/LayoutTests/platform/chromium-linux/fast/block/margin-collapse/empty-clear-blocks-expected.png#L0 Also, it makes no sense to me that you'd only remove the block-inside-inline version of a test (025.html), which should be the same as the normal block version of the test.
Robert Hogan
Comment 6 2012-07-02 11:35:35 PDT
Robert Hogan
Comment 7 2012-07-22 09:34:35 PDT
Robert Hogan
Comment 8 2012-07-22 12:19:02 PDT
Dave Hyatt
Comment 9 2012-08-22 14:09:42 PDT
Comment on attachment 153702 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153702&action=review > Source/WebCore/rendering/RenderBlock.cpp:2061 > + marginInfo.setCanCollapseMarginAfterWithChildren(false); This line seems wrong to me. What if another sibling is encountered? You've permanently turned off collapsing the parent with the child. If another normal block child comes along after this self-collapsing one, you'll mess up because you set this bit, won't you? That's the reason for the lookahead to figure out if we're really at the bottom of the block.. the lookahead you removed. Basically to fix the bug it seems like all you had to fix was the setLogicalHeight line, no? The other code was fine.
Robert Hogan
Comment 10 2012-08-24 12:42:43 PDT
Robert Hogan
Comment 11 2012-08-24 12:47:27 PDT
(In reply to comment #9) > (From update of attachment 153702 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=153702&action=review > > > Source/WebCore/rendering/RenderBlock.cpp:2061 > > + marginInfo.setCanCollapseMarginAfterWithChildren(false); > > This line seems wrong to me. What if another sibling is encountered? You've permanently turned off collapsing the parent with the child. If another normal block child comes along after this self-collapsing one, you'll mess up because you set this bit, won't you? Indeed I will - I've fixed this and added a test - margin-collapse-top-margin-clearance-with-sibling.html. > > That's the reason for the lookahead to figure out if we're really at the bottom of the block.. the lookahead you removed. > > Basically to fix the bug it seems like all you had to fix was the setLogicalHeight line, no? The other code was fine. No I still have to fix the other code and collapse the margins of the self-collapsing block together and with any subsequent self-collapsing blocks, but avoid collapsing them with the parent if no normal block child intervenes.
WebKit Review Bot
Comment 12 2012-08-24 13:44:26 PDT
Comment on attachment 160478 [details] Patch Attachment 160478 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13592317 New failing tests: fast/css/margin-collapse-013-reduction.html fast/css/margin-collapse-top-margin-clearance.html
WebKit Review Bot
Comment 13 2012-08-24 13:44:29 PDT
Created attachment 160495 [details] Archive of layout-test-results from gce-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Robert Hogan
Comment 14 2012-08-24 14:36:01 PDT
Dave Hyatt
Comment 15 2012-08-27 13:32:04 PDT
Comment on attachment 160500 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=160500&action=review Couple of comments: > Source/WebCore/rendering/RenderBlock.cpp:2059 > + bool wouldCollapseMarginsWithParent = true; Minor optimization, but it seems like you could initialize this to canCollapseMarginAfterWithChildren. That way if the bit is already set to false, you won't waste time doing the lookahead. > Source/WebCore/rendering/RenderBlock.cpp:2089 > + LayoutUnit logicalTop = yPos + heightIncrease; > + // After margin collapsing, one of our floats may now intrude into the child. > + if (containsFloats() && child->isRenderBlock() && lowestFloatLogicalBottom() > logicalTop) > + toRenderBlock(child)->addIntrudingFloats(this, logicalLeftOffsetForContent(), logicalTop); I'm not following this change. It doesn't seem like it should be necessary.
Robert Hogan
Comment 16 2012-08-27 14:17:25 PDT
Comment on attachment 160500 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=160500&action=review >> Source/WebCore/rendering/RenderBlock.cpp:2089 >> + toRenderBlock(child)->addIntrudingFloats(this, logicalLeftOffsetForContent(), logicalTop); > > I'm not following this change. It doesn't seem like it should be necessary. The new clearance calculation combined with margin-collapsing can result in the child moving up past the bottom of the lowest float. If that happens it will need to avoid it. This is tested in the third paragraph of 'empty-clear-blocks.html' below - without it the text overlaps the float rather than avoiding it and moving to the right.
Robert Hogan
Comment 17 2012-08-29 10:48:38 PDT
Robert Hogan
Comment 18 2012-08-29 11:38:48 PDT
Dave Hyatt
Comment 19 2012-08-29 12:01:38 PDT
Comment on attachment 161276 [details] Patch r=me
Robert Hogan
Comment 20 2012-08-30 11:15:44 PDT
Jessie Berlin
Comment 21 2012-08-30 14:27:31 PDT
(In reply to comment #20) > Committed r127163: <http://trac.webkit.org/changeset/127163> This started causing failures on Apple Mountain Lion http://build.webkit.org/results/Apple%20MountainLion%20Release%20WK1%20(Tests)/r127166%20(431)/results.html I know you added a line to the platform/mac/TestExpectations file, but you said you expected IMAGE+TEXT, whereas the actual result is only TEXT. Was that a mistake?
Jessie Berlin
Comment 22 2012-08-30 14:39:10 PDT
(In reply to comment #21) > (In reply to comment #20) > > Committed r127163: <http://trac.webkit.org/changeset/127163> > > This started causing failures on Apple Mountain Lion > > http://build.webkit.org/results/Apple%20MountainLion%20Release%20WK1%20(Tests)/r127166%20(431)/results.html > > I know you added a line to the platform/mac/TestExpectations file, but you said you expected IMAGE+TEXT, whereas the actual result is only TEXT. Was that a mistake? Changed to expect only TEXT in order to get the bots greener. Let me know if this was in error. http://trac.webkit.org/changeset/127192
Note You need to log in before you can comment on or make changes to this bug.