Bug 157789

Summary: Cascading order for !important properties in ::slotted and ::host rules is incorrect
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 148695    
Attachments:
Description Flags
patch
buildbot: commit-queue-
Archive of layout-test-results from ews101 for mac-yosemite
none
patch
none
patch kling: review+

Description Antti Koivisto 2016-05-17 02:58:23 PDT
https://drafts.csswg.org/css-scoping-1/#shadow-cascading

"When comparing two declarations that have different tree contexts, then for normal rules the declaration earlier in the shadow-including tree order wins, and for important rules the declaration coming later in the shadow-including tree order wins."
Comment 1 Radar WebKit Bug Importer 2016-05-17 02:59:04 PDT
<rdar://problem/26318781>
Comment 2 Antti Koivisto 2016-05-17 03:22:14 PDT
Created attachment 279109 [details]
patch
Comment 3 Build Bot 2016-05-17 04:26:49 PDT
Comment on attachment 279109 [details]
patch

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

Number of test failures exceeded the failure limit.
Comment 4 Build Bot 2016-05-17 04:26:52 PDT
Created attachment 279111 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Antti Koivisto 2016-05-17 07:13:23 PDT
Created attachment 279118 [details]
patch
Comment 6 Antti Koivisto 2016-05-17 07:47:31 PDT
Created attachment 279122 [details]
patch
Comment 7 Andreas Kling 2016-05-17 12:31:32 PDT
Comment on attachment 279122 [details]
patch

r=me
Comment 8 Ryosuke Niwa 2016-05-17 12:32:49 PDT
Comment on attachment 279122 [details]
patch

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

> Source/WebCore/css/StyleResolver.cpp:2414
> +static bool hasImportantProperties(const StyleProperties& properties)
> +{
> +    for (unsigned i = 0, count = properties.propertyCount(); i < count; ++i) {
> +        if (properties.propertyAt(i).isImportant())
> +            return true;
> +    }
> +    return false;
> +}

It seems a bit inefficient to call propertyAt just to find an important property.
Can we add a new helper method on StyleProperty instead?
Comment 9 Antti Koivisto 2016-05-18 02:00:39 PDT
https://trac.webkit.org/r201073