slot doesn't work as a flex container
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Nov 2016 19:53:25 +0000 (19:53 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Nov 2016 19:53:25 +0000 (19:53 +0000)
commit6f84e039cc177d9bdd9e48934e3e535b56e1c0cb
tree65f168a257bed2eff9dc5fba78951d83fc6569f8
parent9cd1d6eabfeac0c8c00a863103fa30c0fc8eaaf0
slot doesn't work as a flex container
https://bugs.webkit.org/show_bug.cgi?id=160740
<rdar://problem/28605080>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/shadow-dom/css-scoping-slot-flex.html

The style adjustment for flex children needs to be based on their parent box style rather
than the composed tree parent. This can be different when display:contents is involved.

* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::styleForElement):

    Optionally provide parent box style so we can do adjustments based on it when computing style for rendering.

(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::equivalentBlockDisplay):

    Avoid boolean parameters.

(WebCore::StyleResolver::adjustRenderStyle):

    Do the display:contents adjustment first and treat 'content' like 'none' later'. We never want to override
    'contents' with adjustments.
    Use parent box style for flex/grid adjustments instead of the DOM parent style.

* css/StyleResolver.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::computeStyleInRegion):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):

    Call with parent box style.

(WebCore::Style::TreeResolver::parentBoxStyle):

    Find the parent box style if any.

* style/StyleTreeResolver.h:
* svg/SVGElementRareData.h:
(WebCore::SVGElementRareData::overrideComputedStyle):

LayoutTests:

* fast/shadow-dom/css-scoping-slot-flex-expected.html: Added.
* fast/shadow-dom/css-scoping-slot-flex.html: Added.
* fast/shadow-dom/slot-crash-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@208743 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/css-scoping-slot-flex-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/css-scoping-slot-flex.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/slot-crash-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/MediaQueryMatcher.cpp
Source/WebCore/css/StyleMedia.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/rendering/RenderNamedFlowFragment.cpp
Source/WebCore/style/StyleTreeResolver.cpp
Source/WebCore/style/StyleTreeResolver.h
Source/WebCore/svg/SVGElementRareData.h