Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: Source/core/css/SelectorChecker.cpp

Issue 1329523002: Revert of document.querySelector[All]() should check selector context (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 026f4f9f9a40b923e146a551342791cecf866859..3dff0a3c6d52688f3f4a8310b1ce0c1dbf2cc49a 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -960,9 +960,9 @@
case CSSSelector::PseudoScope:
if (m_mode == SharingRules)
return true;
- if (context.scope == element.document())
- return element == element.document().documentElement();
- return context.scope == element;
+ if (context.scope)
+ return context.scope == element;
+ return element == element.document().documentElement();
case CSSSelector::PseudoUnresolved:
return element.isUnresolvedCustomElement();
case CSSSelector::PseudoHost:
@@ -1050,6 +1050,8 @@
if (m_mode == SharingRules)
return true;
// :host only matches a shadow host when :host is in a shadow tree of the shadow host.
+ if (!context.scope)
+ return false;
const ContainerNode* shadowHost = context.scope->shadowHost();
if (!shadowHost || shadowHost != element)
return false;

Powered by Google App Engine
This is Rietveld 408576698