Commit 98dd4e48 authored by tasak@google.com's avatar tasak@google.com

Rename :ancestor to :host-context.

The :host-context() functional pseudo-class tests whether there is an ancestor, outside the shadow tree,
which matches a particular selector. Its syntax is:

   :host-context( <compound-selector> )

Spec link: http://drafts.csswg.org/css-scoping/#host-selector

BUG=354287
TEST=no new tests because just renaming.

Review URL: https://codereview.chromium.org/210813003

git-svn-id: svn://svn.chromium.org/blink/trunk@170016 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 096eaf88
...@@ -17,7 +17,7 @@ PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" ...@@ -17,7 +17,7 @@ PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:host in a shadow tree should match its shadow host. :host in a shadow tree should match its shadow host.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
:host with :ancestor in a shadow tree should match its shadow host. :host with :host-context in a shadow tree should match its shadow host.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
:host takes simple selectors and matches when one of the simple selectors matches. :host takes simple selectors and matches when one of the simple selectors matches.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
......
...@@ -127,13 +127,13 @@ backgroundColorShouldBe('host', 'rgb(0, 128, 0)'); ...@@ -127,13 +127,13 @@ backgroundColorShouldBe('host', 'rgb(0, 128, 0)');
cleanUp(); cleanUp();
debug(':host with :ancestor in a shadow tree should match its shadow host.'); debug(':host with :host-context in a shadow tree should match its shadow host.');
sandbox.appendChild( sandbox.appendChild(
createDOM('div', {'id': 'host', 'class': 'foobar'}, createDOM('div', {'id': 'host', 'class': 'foobar'},
createShadowRoot( createShadowRoot(
createDOM('style', {}, createDOM('style', {},
document.createTextNode(':host(:ancestor(body.mytheme)) { background-color: green; }')), document.createTextNode(':host(:host-context(body.mytheme)) { background-color: green; }')),
createDOM('div', {}, createDOM('div', {},
document.createTextNode('Hello'))))); document.createTextNode('Hello')))));
......
Test that :ancestor(:first-child) is re-evaluated when :first-child changes. Test that :host-context(:first-child) is re-evaluated when :first-child changes.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</div> </div>
<script> <script>
description("Test that :ancestor(:first-child) is re-evaluated when :first-child changes."); description("Test that :host-context(:first-child) is re-evaluated when :first-child changes.");
var test = document.getElementById("test"); var test = document.getElementById("test");
var first = document.getElementById("first"); var first = document.getElementById("first");
...@@ -16,7 +16,7 @@ first.appendChild( ...@@ -16,7 +16,7 @@ first.appendChild(
createDOM("div", {"id": "host"}, createDOM("div", {"id": "host"},
createShadowRoot( createShadowRoot(
createDOM('style', {}, createDOM('style', {},
document.createTextNode(":ancestor(#first:first-child) { background-color: red; }")), document.createTextNode(":host-context(#first:first-child) { background-color: red; }")),
createDOM('div', {}, createDOM('div', {},
document.createTextNode("You should see no red."))))); document.createTextNode("You should see no red.")))));
......
Test whether :ancestor matches a shadow host correctly. Test whether :host-context matches a shadow host correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
:ancestor out of shadow tree should not match any shadow hosts. :host-context out of shadow tree should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor with * should not match any shadow hosts. :host-context with * should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor with tag selector should not match any shadow hosts. :host-context with tag selector should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor with class selector should not match any shadow hosts. :host-context with class selector should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor with id selector should not match any shadow hosts. :host-context with id selector should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor with attribute selector should not match any shadow hosts. :host-context with attribute selector should not match any shadow hosts.
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
:ancestor in a shadow tree should match its shadow host. :host-context in a shadow tree should match its shadow host.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
:ancestor with :host in a shadow tree should match its shadow host. :host-context with :host in a shadow tree should match its shadow host.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
:ancestor takes simple selectors and matches when one of the simple selectors matches. :host-context takes simple selectors and matches when one of the simple selectors matches.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
:ancestor matches a shadow host in just a nested shadow tree, not all enclosing shadow trees. :host-context matches a shadow host in just a nested shadow tree, not all enclosing shadow trees.
PASS backgroundColorOf('host1') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host1') is "rgba(0, 0, 0, 0)"
PASS backgroundColorOf('host1/host2') is "rgb(0, 128, 0)" PASS backgroundColorOf('host1/host2') is "rgb(0, 128, 0)"
:ancestor matches based on a composed tree. :host-context matches based on a composed tree.
PASS backgroundColorOf('host/target') is "rgb(0, 128, 0)" PASS backgroundColorOf('host/target') is "rgb(0, 128, 0)"
:ancestor matches based on a composed tree when having multiple shadow roots. :host-context matches based on a composed tree when having multiple shadow roots.
PASS backgroundColorOf('host/targetA') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host/targetA') is "rgba(0, 0, 0, 0)"
PASS backgroundColorOf('host/targetB') is "rgb(0, 128, 0)" PASS backgroundColorOf('host/targetB') is "rgb(0, 128, 0)"
PASS backgroundColorOf('host/targetC') is "rgb(0, 128, 0)" PASS backgroundColorOf('host/targetC') is "rgb(0, 128, 0)"
:ancestor is updated when its matched ancestor changes className or id. :host-context is updated when its matched ancestor changes className or id.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)" PASS backgroundColorOf('host') is "rgba(0, 0, 0, 0)"
Compare :ancestor with :ancestor. Compare :host-context with :host-context.
PASS backgroundColorOf('host') is "rgb(0, 128, 0)" PASS backgroundColorOf('host') is "rgb(0, 128, 0)"
PASS backgroundColorOf('host') is "rgb(255, 0, 0)" PASS backgroundColorOf('host') is "rgb(255, 0, 0)"
PASS backgroundColorOf('host/target') is "rgb(0, 128, 0)" PASS backgroundColorOf('host/target') is "rgb(0, 128, 0)"
......
...@@ -24,10 +24,10 @@ PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span").length ...@@ -24,10 +24,10 @@ PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span").length
PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[0].id is "not-top" PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[0].id is "not-top"
PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[1].id is "top" PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[1].id is "top"
PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[2].id is "inner-host" PASS fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[2].id is "inner-host"
PASS fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span").length is 3 PASS fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span").length is 3
PASS fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[0].id is "not-top" PASS fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[0].id is "not-top"
PASS fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[1].id is "top" PASS fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[1].id is "top"
PASS fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[2].id is "inner-host" PASS fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[2].id is "inner-host"
PASS barHost.querySelectorAll("#bar-host /shadow/ span").length is 1 PASS barHost.querySelectorAll("#bar-host /shadow/ span").length is 1
PASS barHost.querySelectorAll("#bar-host /shadow/ span")[0].id is "nested" PASS barHost.querySelectorAll("#bar-host /shadow/ span")[0].id is "nested"
PASS barHost.querySelectorAll(":host :scope span").length is 1 PASS barHost.querySelectorAll(":host :scope span").length is 1
...@@ -40,10 +40,10 @@ PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span").length ...@@ -40,10 +40,10 @@ PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span").length
PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span")[0].id is "nested" PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span")[0].id is "nested"
PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span").length is 1 PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span").length is 1
PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span")[0].id is "nested" PASS barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span")[0].id is "nested"
PASS barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /shadow/ span").length is 1 PASS barShadowRoot.querySelectorAll(":host-context(div#foo-host) /shadow/ span").length is 1
PASS barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /shadow/ span")[0].id is "nested" PASS barShadowRoot.querySelectorAll(":host-context(div#foo-host) /shadow/ span")[0].id is "nested"
PASS barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /deep/ span").length is 1 PASS barShadowRoot.querySelectorAll(":host-context(div#foo-host) /deep/ span").length is 1
PASS barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /deep/ span")[0].id is "nested" PASS barShadowRoot.querySelectorAll(":host-context(div#foo-host) /deep/ span")[0].id is "nested"
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -55,11 +55,11 @@ shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[0] ...@@ -55,11 +55,11 @@ shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[0]
shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[1].id', '"top"'); shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[1].id', '"top"');
shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[2].id', '"inner-host"'); shouldBe('fooShadowRoot.querySelectorAll(":host(div#foo-host) /shadow/ span")[2].id', '"inner-host"');
// :ancestor in foo's shadow tree can match div#foo-host. // :host-context in foo's shadow tree can match div#foo-host.
shouldBe('fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span").length', '3'); shouldBe('fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span").length', '3');
shouldBe('fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[0].id', '"not-top"'); shouldBe('fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[0].id', '"not-top"');
shouldBe('fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[1].id', '"top"'); shouldBe('fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[1].id', '"top"');
shouldBe('fooShadowRoot.querySelectorAll(":ancestor(body) /shadow/ span")[2].id', '"inner-host"'); shouldBe('fooShadowRoot.querySelectorAll(":host-context(body) /shadow/ span")[2].id', '"inner-host"');
var barHost = fooShadowRoot.getElementById('bar-host'); var barHost = fooShadowRoot.getElementById('bar-host');
shouldBe('barHost.querySelectorAll("#bar-host /shadow/ span").length', '1'); shouldBe('barHost.querySelectorAll("#bar-host /shadow/ span").length', '1');
...@@ -78,10 +78,10 @@ shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span")[0] ...@@ -78,10 +78,10 @@ shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /shadow/ span")[0]
shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span").length', '1'); shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span").length', '1');
shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span")[0].id', '"nested"'); shouldBe('barShadowRoot.querySelectorAll(":host(div#bar-host) /deep/ span")[0].id', '"nested"');
shouldBe('barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /shadow/ span").length', '1'); shouldBe('barShadowRoot.querySelectorAll(":host-context(div#foo-host) /shadow/ span").length', '1');
shouldBe('barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /shadow/ span")[0].id', '"nested"'); shouldBe('barShadowRoot.querySelectorAll(":host-context(div#foo-host) /shadow/ span")[0].id', '"nested"');
shouldBe('barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /deep/ span").length', '1'); shouldBe('barShadowRoot.querySelectorAll(":host-context(div#foo-host) /deep/ span").length', '1');
shouldBe('barShadowRoot.querySelectorAll(":ancestor(div#foo-host) /deep/ span")[0].id', '"nested"'); shouldBe('barShadowRoot.querySelectorAll(":host-context(div#foo-host) /deep/ span")[0].id', '"nested"');
</script> </script>
</html> </html>
...@@ -116,7 +116,7 @@ static inline bool isCSSTokenAString(int yytype) ...@@ -116,7 +116,7 @@ static inline bool isCSSTokenAString(int yytype)
case FUNCTION: case FUNCTION:
case ANYFUNCTION: case ANYFUNCTION:
case HOSTFUNCTION: case HOSTFUNCTION:
case ANCESTORFUNCTION: case HOSTCONTEXTFUNCTION:
case NOTFUNCTION: case NOTFUNCTION:
case CALCFUNCTION: case CALCFUNCTION:
case MINFUNCTION: case MINFUNCTION:
...@@ -267,7 +267,7 @@ inline static CSSParserValue makeIdentValue(CSSParserString string) ...@@ -267,7 +267,7 @@ inline static CSSParserValue makeIdentValue(CSSParserString string)
%token <string> MINFUNCTION %token <string> MINFUNCTION
%token <string> MAXFUNCTION %token <string> MAXFUNCTION
%token <string> HOSTFUNCTION %token <string> HOSTFUNCTION
%token <string> ANCESTORFUNCTION %token <string> HOSTCONTEXTFUNCTION
%token <string> UNICODERANGE %token <string> UNICODERANGE
...@@ -1481,27 +1481,27 @@ pseudo: ...@@ -1481,27 +1481,27 @@ pseudo:
| ':' HOSTFUNCTION selector_recovery closing_parenthesis { | ':' HOSTFUNCTION selector_recovery closing_parenthesis {
YYERROR; YYERROR;
} }
| ':' ANCESTORFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis { // used by :host-context()
| ':' HOSTCONTEXTFUNCTION maybe_space simple_selector_list maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector(); $$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass); $$->setMatch(CSSSelector::PseudoClass);
$$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4)); $$->adoptSelectorVector(*parser->sinkFloatingSelectorVector($4));
parser->tokenToLowerCase($2); parser->tokenToLowerCase($2);
$$->setValue($2); $$->setValue($2);
CSSSelector::PseudoType type = $$->pseudoType(); CSSSelector::PseudoType type = $$->pseudoType();
if (type != CSSSelector::PseudoAncestor) if (type != CSSSelector::PseudoHostContext)
YYERROR; YYERROR;
} }
// used by :ancestor() | ':' HOSTCONTEXTFUNCTION maybe_space closing_parenthesis {
| ':' ANCESTORFUNCTION maybe_space closing_parenthesis {
$$ = parser->createFloatingSelector(); $$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass); $$->setMatch(CSSSelector::PseudoClass);
parser->tokenToLowerCase($2); parser->tokenToLowerCase($2);
$$->setValue($2.atomicSubstring(0, $2.length() - 1)); $$->setValue($2.atomicSubstring(0, $2.length() - 1));
CSSSelector::PseudoType type = $$->pseudoType(); CSSSelector::PseudoType type = $$->pseudoType();
if (type != CSSSelector::PseudoAncestor) if (type != CSSSelector::PseudoHostContext)
YYERROR; YYERROR;
} }
| ':' ANCESTORFUNCTION selector_recovery closing_parenthesis { | ':' HOSTCONTEXTFUNCTION selector_recovery closing_parenthesis {
YYERROR; YYERROR;
} }
; ;
......
...@@ -261,7 +261,7 @@ bool CSSParserSelector::hasHostPseudoSelector() const ...@@ -261,7 +261,7 @@ bool CSSParserSelector::hasHostPseudoSelector() const
{ {
CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); CSSParserSelector* selector = const_cast<CSSParserSelector*>(this);
do { do {
if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseudoType() == CSSSelector::PseudoAncestor) if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseudoType() == CSSSelector::PseudoHostContext)
return true; return true;
} while ((selector = selector->tagHistory())); } while ((selector = selector->tagHistory()));
return false; return false;
......
...@@ -100,7 +100,7 @@ inline unsigned CSSSelector::specificityForOneSelector() const ...@@ -100,7 +100,7 @@ inline unsigned CSSSelector::specificityForOneSelector() const
case Id: case Id:
return 0x10000; return 0x10000;
case PseudoClass: case PseudoClass:
if (pseudoType() == PseudoHost || pseudoType() == PseudoAncestor) if (pseudoType() == PseudoHost || pseudoType() == PseudoHostContext)
return 0; return 0;
// fall through. // fall through.
case Exact: case Exact:
...@@ -254,7 +254,7 @@ PseudoId CSSSelector::pseudoId(PseudoType type) ...@@ -254,7 +254,7 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
case PseudoUnresolved: case PseudoUnresolved:
case PseudoContent: case PseudoContent:
case PseudoHost: case PseudoHost:
case PseudoAncestor: case PseudoHostContext:
case PseudoFullScreen: case PseudoFullScreen:
case PseudoFullScreenDocument: case PseudoFullScreenDocument:
case PseudoFullScreenAncestor: case PseudoFullScreenAncestor:
...@@ -354,8 +354,8 @@ const static NameToPseudoStruct pseudoTypeMap[] = { ...@@ -354,8 +354,8 @@ const static NameToPseudoStruct pseudoTypeMap[] = {
{"unresolved", CSSSelector::PseudoUnresolved}, {"unresolved", CSSSelector::PseudoUnresolved},
{"host", CSSSelector::PseudoHost}, {"host", CSSSelector::PseudoHost},
{"host(", CSSSelector::PseudoHost}, {"host(", CSSSelector::PseudoHost},
{"ancestor", CSSSelector::PseudoAncestor}, {"host-context", CSSSelector::PseudoHostContext},
{"ancestor(", CSSSelector::PseudoAncestor}, {"host-context(", CSSSelector::PseudoHostContext},
{"content", CSSSelector::PseudoContent}, {"content", CSSSelector::PseudoContent},
}; };
...@@ -520,7 +520,7 @@ void CSSSelector::extractPseudoType() const ...@@ -520,7 +520,7 @@ void CSSSelector::extractPseudoType() const
case PseudoFutureCue: case PseudoFutureCue:
case PseudoPastCue: case PseudoPastCue:
case PseudoHost: case PseudoHost:
case PseudoAncestor: case PseudoHostContext:
case PseudoUnresolved: case PseudoUnresolved:
break; break;
case PseudoFirstPage: case PseudoFirstPage:
...@@ -621,7 +621,7 @@ String CSSSelector::selectorText(const String& rightSide) const ...@@ -621,7 +621,7 @@ String CSSSelector::selectorText(const String& rightSide) const
break; break;
} }
case PseudoHost: case PseudoHost:
case PseudoAncestor: { case PseudoHostContext: {
if (cs->selectorList()) { if (cs->selectorList()) {
const CSSSelector* firstSubSelector = cs->selectorList()->first(); const CSSSelector* firstSubSelector = cs->selectorList()->first();
for (const CSSSelector* subSelector = firstSubSelector; subSelector; subSelector = CSSSelectorList::next(*subSelector)) { for (const CSSSelector* subSelector = firstSubSelector; subSelector; subSelector = CSSSelectorList::next(*subSelector)) {
...@@ -773,7 +773,7 @@ static bool validateSubSelector(const CSSSelector* selector) ...@@ -773,7 +773,7 @@ static bool validateSubSelector(const CSSSelector* selector)
case CSSSelector::PseudoLastOfType: case CSSSelector::PseudoLastOfType:
case CSSSelector::PseudoOnlyOfType: case CSSSelector::PseudoOnlyOfType:
case CSSSelector::PseudoHost: case CSSSelector::PseudoHost:
case CSSSelector::PseudoAncestor: case CSSSelector::PseudoHostContext:
return true; return true;
default: default:
return false; return false;
......
...@@ -218,7 +218,7 @@ namespace WebCore { ...@@ -218,7 +218,7 @@ namespace WebCore {
PseudoUnresolved, PseudoUnresolved,
PseudoContent, PseudoContent,
PseudoHost, PseudoHost,
PseudoAncestor PseudoHostContext
}; };
enum OptionalPseudoTypeRequirements { enum OptionalPseudoTypeRequirements {
...@@ -387,7 +387,7 @@ inline bool CSSSelector::isCustomPseudoElement() const ...@@ -387,7 +387,7 @@ inline bool CSSSelector::isCustomPseudoElement() const
inline bool CSSSelector::isHostPseudoClass() const inline bool CSSSelector::isHostPseudoClass() const
{ {
return m_match == PseudoClass && (m_pseudoType == PseudoHost || m_pseudoType == PseudoAncestor); return m_match == PseudoClass && (m_pseudoType == PseudoHost || m_pseudoType == PseudoHostContext);
} }
inline bool CSSSelector::isSiblingSelector() const inline bool CSSSelector::isSiblingSelector() const
......
...@@ -727,8 +727,8 @@ inline bool CSSTokenizer::detectFunctionTypeToken(int length) ...@@ -727,8 +727,8 @@ inline bool CSSTokenizer::detectFunctionTypeToken(int length)
m_token = HOSTFUNCTION; m_token = HOSTFUNCTION;
return true; return true;
} }
CASE("ancestor") { CASE("host-context") {
m_token = ANCESTORFUNCTION; m_token = HOSTCONTEXTFUNCTION;
return true; return true;
} }
CASE("nth-child") { CASE("nth-child") {
......
...@@ -872,7 +872,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib ...@@ -872,7 +872,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break; break;
case CSSSelector::PseudoHost: case CSSSelector::PseudoHost:
case CSSSelector::PseudoAncestor: case CSSSelector::PseudoHostContext:
{ {
// :host only matches a shadow host when :host is in a shadow tree of the shadow host. // :host only matches a shadow host when :host is in a shadow tree of the shadow host.
if (!context.scope) if (!context.scope)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment