Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't skip past auto-height flexboxes in quirks mode. #15325

Merged
merged 1 commit into from Feb 27, 2019

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Feb 11, 2019

This is essentially a reland of
https://chromium-review.googlesource.com/c/chromium/src/+/1052768/

Quirky flexbox behavior really shouldn't be necessary, since flexbox was
invented over a decade after quirky browsers were on the street.

Replace css3/flexbox/percentage-sizes-quirks.html with a copy of
percentage-sizes.html, except that it's in quirks mode.

Need to remove
external/wpt/css/css-flexbox/percentage-heights-quirks-node.html now,
since that test expects special behavior in quirks mode, which is
exactly what this CL is removing. This makes us behave like Edge and
Firefox.

The root problem, as far as the DCHECK failure in bug 841276 is
concerned, though, is that LayoutVideo is a very unsuitable container
for pretty much anything (because it's not a LayoutBlock, let alone
LayoutBlockFlow). By default we end up with the following layout tree
for a VIDEO element:

LayoutVideo VIDEO
LayoutFlexibleBox (relative positioned) DIV
LayoutBlockFlow DIV
LayoutFlexibleBox DIV

See the testcase. The VIDEO there is fixed-positioned, and it also has
another fixed-positioned ancestor (regular block otherwise). When
attempting to locate the right ancestor (descendant of VIDEO) in the
testcase to register a percentage height descendant, we don't see the
LayoutVideo object at all on our way up the tree (because it's not
LayoutBlock). So the percentage height descendant is incorrectly
registered with the outer fixed positioned block. This confuses the
layout machinery, so that when re-laying out the outer fixed positioned
block (see the testcase), we mark the inner flexbox for layout, since
it's a percentage height descendant. But we never get down there, since
the containing VIDEO element isn't going to require layout. Thus we'll
fail DCHECKs that require the entire tree to be clean after layout.

Bug: 841276, 531783
Change-Id: If7d62ff37d3176b8ee51cdf9b7d2e02d75c3dc02
Reviewed-on: https://chromium-review.googlesource.com/c/1459643
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631184}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

@gsnedders
Copy link
Member

@mstensho can you file a bug on the quirks spec, given it looks like it requires this behaviour (that apparently only Blink (and WebKit?) has).

@mstensho
Copy link
Contributor

@gsnedders https://chromium-review.googlesource.com/c/chromium/src/+/1459643 will make Blink behave like EdgeHTML and Gecko, and no longer like WebKit.

But yeah... good point, time to agree on something here. :)
So I just filed whatwg/quirks#39

This is essentially a reland of
https://chromium-review.googlesource.com/c/chromium/src/+/1052768/

Quirky flexbox behavior really shouldn't be necessary, since flexbox was
invented over a decade after quirky browsers were on the street.

Replace css3/flexbox/percentage-sizes-quirks.html with a copy of
percentage-sizes.html, except that it's in quirks mode.

Need to remove
external/wpt/css/css-flexbox/percentage-heights-quirks-node.html now,
since that test expects special behavior in quirks mode, which is
exactly what this CL is removing. This makes us behave like Edge and
Firefox.

The root problem, as far as the DCHECK failure in bug 841276 is
concerned, though, is that LayoutVideo is a very unsuitable container
for pretty much anything (because it's not a LayoutBlock, let alone
LayoutBlockFlow). By default we end up with the following layout tree
for a VIDEO element:

  LayoutVideo                               VIDEO
    LayoutFlexibleBox (relative positioned) DIV
      LayoutBlockFlow                       DIV
      LayoutFlexibleBox                     DIV

See the testcase. The VIDEO there is fixed-positioned, and it also has
another fixed-positioned ancestor (regular block otherwise). When
attempting to locate the right ancestor (descendant of VIDEO) in the
testcase to register a percentage height descendant, we don't see the
LayoutVideo object at all on our way up the tree (because it's not
LayoutBlock). So the percentage height descendant is incorrectly
registered with the outer fixed positioned block. This confuses the
layout machinery, so that when re-laying out the outer fixed positioned
block (see the testcase), we mark the inner flexbox for layout, since
it's a percentage height descendant. But we never get down there, since
the containing VIDEO element isn't going to require layout. Thus we'll
fail DCHECKs that require the entire tree to be clean after layout.

Bug: 841276, 531783
Change-Id: If7d62ff37d3176b8ee51cdf9b7d2e02d75c3dc02
Reviewed-on: https://chromium-review.googlesource.com/c/1459643
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631184}
@KyleJu
Copy link
Contributor

KyleJu commented Feb 15, 2019

Flaky tests on Firefox:

/css/css-flexbox/quirks-auto-block-size-with-percentage-item.html

Subtest Results Messages
OK
#container 1 FAIL: 2/10, PASS: 8/10 assert_equals: \n<div id="container" style="width:200px; height:456px;">\n <div style="display:flex; background:blue;" data-expected-height="100">\n <img style="width:100px; height: 50%;" src="support/1x1-green.png" data-expected-height="100">\n <div style="width: 50px; height: 100%; background: red;" data-expected-height="0"></div>\n </div>\n</div>\nheight expected 100 but got 0

Unstable results

Test Subtest Results Messages
/css/css-flexbox/quirks-auto-block-size-with-percentage-item.html #container 1 FAIL: 2/10, PASS: 8/10 assert_equals: \n<div id="container" style="width:200px; height:456px;">\n <div style="display:flex; background:blue;" data-expected-height="100">\n <img style="width:100px; height: 50%;" src="support/1x1-green.png" data-expected-height="100">\n <div style="width: 50px; height: 100%; background: red;" data-expected-height="0"></div>\n </div>\n</div>\nheight expected 100 but got 0

@gsnedders
Copy link
Member

I wonder if waiting for the image to load would make this stable in Firefox? It shouldn't, but…

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 2942173 into master Feb 27, 2019
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-1459643 branch February 27, 2019 13:16
zcorpan added a commit to whatwg/quirks that referenced this pull request Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants