mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 829363 - Make :scope match style scope roots. r=bzbarsky
This commit is contained in:
parent
397c611222
commit
39a2dac253
@ -49,3 +49,6 @@
|
||||
HTTP(..) == scoped-style-font-face.html scoped-style-font-face-ref.html
|
||||
== scoped-style-keyframes.html scoped-style-keyframes-ref.html
|
||||
pref(layout.css.supports-rule.enabled,true) == scoped-style-supports.html scoped-style-supports-ref.html
|
||||
== scoped-style-pseudo-001.html scoped-style-pseudo-001-ref.html
|
||||
== scoped-style-pseudo-002.html scoped-style-pseudo-002-ref.html
|
||||
== scoped-style-pseudo-003.html scoped-style-pseudo-003-ref.html
|
||||
|
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p style="color: green">Second</p>
|
||||
<p>Third</p>
|
||||
</body>
|
11
layout/reftests/scoped-style/scoped-style-pseudo-001.html
Normal file
11
layout/reftests/scoped-style/scoped-style-pseudo-001.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p>
|
||||
<style scoped>
|
||||
:scope { color: green }
|
||||
</style>
|
||||
Second
|
||||
</p>
|
||||
<p>Third</p>
|
||||
</body>
|
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p style="color: green">
|
||||
<div style="border: 2px solid black">Second</div>
|
||||
</p>
|
||||
<p>Third</p>
|
||||
</body>
|
16
layout/reftests/scoped-style/scoped-style-pseudo-002.html
Normal file
16
layout/reftests/scoped-style/scoped-style-pseudo-002.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p>
|
||||
<style scoped>
|
||||
:scope { color: green }
|
||||
</style>
|
||||
<div>
|
||||
<style scoped>
|
||||
:scope { border: 2px solid black }
|
||||
</style>
|
||||
Second
|
||||
</div>
|
||||
</p>
|
||||
<p>Third</p>
|
||||
</body>
|
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p><span>Second</span></p>
|
||||
<p>Third</p>
|
||||
</body>
|
11
layout/reftests/scoped-style/scoped-style-pseudo-003.html
Normal file
11
layout/reftests/scoped-style/scoped-style-pseudo-003.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<p>First</p>
|
||||
<p>
|
||||
<style scoped>
|
||||
p :scope { color: red }
|
||||
</style>
|
||||
<span>Second</span>
|
||||
</p>
|
||||
<p>Third</p>
|
||||
</body>
|
@ -2030,7 +2030,18 @@ static bool SelectorMatches(Element* aElement,
|
||||
break;
|
||||
|
||||
case nsCSSPseudoClasses::ePseudoClass_scope:
|
||||
if (aTreeMatchContext.HasSpecifiedScope()) {
|
||||
if (aTreeMatchContext.mForScopedStyle) {
|
||||
if (aTreeMatchContext.mCurrentStyleScope) {
|
||||
// If mCurrentStyleScope is null, aElement must be the style
|
||||
// scope root. This is because the PopStyleScopeForSelectorMatching
|
||||
// call in SelectorMatchesTree sets mCurrentStyleScope to null
|
||||
// as soon as we visit the style scope element, and we won't
|
||||
// progress further up the tree after this call to
|
||||
// SelectorMatches. Thus if mCurrentStyleScope is still set,
|
||||
// we know the selector does not match.
|
||||
return false;
|
||||
}
|
||||
} else if (aTreeMatchContext.HasSpecifiedScope()) {
|
||||
if (!aTreeMatchContext.IsScopeElement(aElement)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -159,8 +159,8 @@ struct NS_STACK_CLASS TreeMatchContext {
|
||||
|
||||
bool PopStyleScopeForSelectorMatching(mozilla::dom::Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(mForScopedStyle, "only call PopScopeForSelectorMatching when "
|
||||
"mForScopedStyle is true");
|
||||
NS_ASSERTION(mForScopedStyle, "only call PopStyleScopeForSelectorMatching "
|
||||
"when mForScopedStyle is true");
|
||||
|
||||
if (!mCurrentStyleScope) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user