Bug 152831

Summary: Enable selector filtering for shadow trees
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: rniwa, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
simon.fraser: review+, buildbot: commit-queue-
Archive of layout-test-results from ews115 for mac-yosemite
none
patch
none
patch simon.fraser: review+

Description Antti Koivisto 2016-01-07 06:51:50 PST
Selector filtering doesn't currently work in shadow trees making style resolve slow.
Comment 1 Antti Koivisto 2016-01-07 07:36:43 PST
Created attachment 268451 [details]
patch
Comment 2 Build Bot 2016-01-07 08:37:40 PST
Comment on attachment 268451 [details]
patch

Attachment 268451 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/662739

Number of test failures exceeded the failure limit.
Comment 3 Build Bot 2016-01-07 08:37:45 PST
Created attachment 268453 [details]
Archive of layout-test-results from ews115 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 4 Simon Fraser (smfr) 2016-01-07 09:10:21 PST
Comment on attachment 268451 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268451&action=review

> Source/WebCore/css/RuleSet.cpp:229
> +            // FIXME: Custom pseudo elements are handled but the shadow tree's selector filter. It doesn't know about the main DOM.
> +            ruleData.disableSelectorFiltering();

The first part is not a complete sentence.

> Source/WebCore/css/SelectorFilter.cpp:57
> +bool SelectorFilter::parentStackIsConsistent(const ContainerNode* parentNode) const

Is it valid for parentNode to be null in this function?

> Source/WebCore/style/StyleTreeResolver.cpp:441
> +        SelectorFilterParentPusher parentPusher(m_selectorFilter, slot);
> +        parentPusher.push();

In other stack-based classes like this, the constructor would push by default, unless some argument told it not to.
Comment 5 Antti Koivisto 2016-01-07 09:47:25 PST
Created attachment 268459 [details]
patch
Comment 6 Antti Koivisto 2016-01-07 10:14:29 PST
Created attachment 268463 [details]
patch
Comment 7 Antti Koivisto 2016-01-07 10:15:10 PST
> Is it valid for parentNode to be null in this function?

Seems so, in some edge cases. Debug bot failures were about that actually.

> In other stack-based classes like this, the constructor would push by
> default, unless some argument told it not to.

Implemented this.
Comment 8 Antti Koivisto 2016-01-08 01:07:01 PST
https://trac.webkit.org/r194762