`currentColor` computes to the same colour on all elements, even if 'color' is inheri...
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Mar 2015 03:10:48 +0000 (03:10 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Mar 2015 03:10:48 +0000 (03:10 +0000)
commitc01e30b3a59a2d40c27d2bd72b1a75e25ab43f63
treec04d4558ec24da90e1ba7990d7d5d4e9b8e75697
parente2b7547238967eb3aa74ae2562d13e7c106fbf67
`currentColor` computes to the same colour on all elements, even if 'color' is inherited differently
https://bugs.webkit.org/show_bug.cgi?id=133420

Reviewed by Darin Adler.

Source/WebCore:

When resolving a style with the help of the property cache, we were
completely ignoring currentColor.

Since you can set currentColor on properties that are not inherited,
those properties would just be copied from the cached style, which
may have a completely different inherited color.

This pacth fixes the issue by preventing any MatchResult from hitting
the cache if it contains any non-inherited property that would require
resolution by the cache:
-Using the inherit value.
-Using the currentColor value.

Tests: fast/css/currentColor-on-before-after-pseudo-elements.html
       fast/css/currentColor-style-update-reftest.html
       fast/css/currentColor-value-style-update.html

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::addElementStyleProperties):
(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchUserRules):
(WebCore::ElementRuleCollector::matchUARules):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchResult::addMatchedProperties):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::styleForPage):
(WebCore::StyleResolver::findFromMatchedPropertiesCache):
(WebCore::StyleResolver::addToMatchedPropertiesCache):
(WebCore::extractDirectionAndWritingMode):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::CascadedProperties::addStyleProperties):
(WebCore::StyleResolver::CascadedProperties::addMatches):
* css/StyleResolver.h:
(WebCore::StyleResolver::MatchResult::matchedProperties):

LayoutTests:

* fast/css/currentColor-on-before-after-pseudo-elements-expected.html: Added.
* fast/css/currentColor-on-before-after-pseudo-elements.html: Added.
* fast/css/currentColor-style-update-reftest-expected.html: Added.
* fast/css/currentColor-style-update-reftest.html: Added.
* fast/css/currentColor-value-style-update-expected.txt: Added.
* fast/css/currentColor-value-style-update.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements-expected.html [new file with mode: 0644]
LayoutTests/fast/css/currentColor-on-before-after-pseudo-elements.html [new file with mode: 0644]
LayoutTests/fast/css/currentColor-style-update-reftest-expected.html [new file with mode: 0644]
LayoutTests/fast/css/currentColor-style-update-reftest.html [new file with mode: 0644]
LayoutTests/fast/css/currentColor-value-style-update-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/currentColor-value-style-update.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/ElementRuleCollector.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h