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

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2821303005: [selectors4] Use common ancestor strategy for :focus-within (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index 3de58c2b8b065a3bc08c1e1f237b27374c12ecc8..5b66c1f31e9eccb69e19d331c67170047c010f59 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1044,7 +1044,9 @@ void ContainerNode::FocusWithinStateChanged() {
ToElement(this)->PseudoStateChanged(CSSSelector::kPseudoFocusWithin);
}
-void ContainerNode::SetFocused(bool received, WebFocusType focus_type) {
+void ContainerNode::SetFocused(bool received,
+ WebFocusType focus_type,
+ Node* common_ancestor) {
// Recurse up author shadow trees to mark shadow hosts if it matches :focus.
// TODO(kochi): Handle UA shadows which marks multiple nodes as focused such
// as <input type="date"> the same way as author shadow.
@@ -1070,7 +1072,7 @@ void ContainerNode::SetFocused(bool received, WebFocusType focus_type) {
FocusStateChanged();
UpdateDistribution();
- for (ContainerNode* node = this; node;
+ for (ContainerNode* node = this; node && node != common_ancestor;
node = FlatTreeTraversal::Parent(*node)) {
node->SetHasFocusWithin(received);
node->FocusWithinStateChanged();
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698