diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-10-11 12:52:34 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-10-11 12:52:34 +0000 |
commit | df53e96c81594b2123ca83848d4a388b1af7aa46 (patch) | |
tree | 9cb627c55ceaee9e4b96df3a3d00b7ea7160b81c /third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html | |
parent | 0e91e0f56eccb3dc31a71688a7c22c260c450c88 (diff) | |
download | chromium_src-df53e96c81594b2123ca83848d4a388b1af7aa46.zip chromium_src-df53e96c81594b2123ca83848d4a388b1af7aa46.tar.gz chromium_src-df53e96c81594b2123ca83848d4a388b1af7aa46.tar.bz2 |
REGRESSION (r96393): In some cases, generated content is never shown
https://bugs.webkit.org/show_bug.cgi?id=88196
Patch by Arpita Bahuguna <arpitabahuguna@gmail.com> on 2012-10-11
Reviewed by Antti Koivisto.
Source/WebCore:
Elements with style specified from an attribute selector in conjunction
with a pseudo-element should not take on the shared style of their
previous matching sibling (if any).
The problem here is that an attribute selector appended by a pseudo-element
does not return any matched rules for the call (matchesRuleSet(m_uncommonAttributeRuleSet.get()))
in StyleResolver::locateSharedStyle().
This is because of the way pseudo-elements are handled in
SelectorChecker::checkSelector(). For a pseudo-element selector we check
for the condition (!context.elementStyle && m_mode == ResolvingStyle) and
since for this particular flow the SelectorChecker mode is set to ResolvingStyle
and since the current element's style is still not available we fail this
initial check and return SelectorFailsLocally from checkSelector(). This is
incorrect behavior since the element does have an attribute selector specified
for it.
Have thus introduced another enum value: SharingRules for SelectorChecker's Mode.
SelectorChecker's mode should be set to SharingRules before making the
call to collectMatchingRules() and then reset (back to ResolvingStyle) thereafter.
Existing Mode value: CollectingRules although appropriate cannot be used in this
scenario because we also don't want to set any value to dynamicPseudo for this flow.
Test: fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkSelector):
Added additional check for SelectorChecker's mode: SharingRules when
trying to match for the pseudo-element selector.
* css/SelectorChecker.h:
Added SharingRules to Mode enum.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet):
(WebCore::StyleResolver::locateSharedStyle):
* css/StyleResolver.h:
(StyleResolver):
Renamed matchesRuleSet() to a more descriptive styleSharingCandidateMatchesRuleSet().
Also, setting the SelectorChecker's mode to SharingRules before calling
on collectMatchingRules() from styleSharingCandidateMatchesRuleSet().
LayoutTests:
* fast/selectors/style-sharing-attribute-selector-with-pseudo-element-expected.html: Added.
* fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html: Added.
Ref test added for verifying that the attribute selector style, when specified
in conjucntion with pseudo-elements, is applied to the corresponding element.
git-svn-id: svn://svn.chromium.org/blink/trunk@131047 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html b/third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html new file mode 100644 index 0000000..556005a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/selectors/style-sharing-attribute-selector-with-pseudo-element.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<style> +[myatt]:after { + content: attr(myatt); +} +[myatt]:before { + content: 'Second paragraph'; +} +</style> +</head> +<body> +<div>Test for Bugzilla <a href="https://bugs.webkit.org/show_bug.cgi?id=88196">Bug 88196</a>: REGRESSION (r96393): In some cases, generated content is never shown</div> +<div>Elements with style specified from attribute selectors in conjunction with pseudo-elements should not take on the shared style of their previous matching sibling (if any).</div> +<p>First paragraph.</p> +<p myatt=":before and :after content."> with </p> +</body> +</html> + |