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

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

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move flat tree checks up to the top of isInert Created 3 years, 10 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: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 7a5eca1ad8e04ddf27f1747d56fa9275aeb5f0f8..8914c2624ff508f3ab30e25e6d3f57c02852d931 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -774,11 +774,30 @@ bool Node::shouldHaveFocusAppearance() const {
}
bool Node::isInert() const {
+ if (!canParticipateInFlatTree())
+ return true;
+
+ // TODO(aboxhall): figure out whether to un-const all callers,
+ // or to call updateDistribution() from call sites.
+ const_cast<Node*>(this)->updateDistribution();
+
hayato 2017/02/16 05:52:54 I guess Node::isInert() has a lot of (internal) ca
esprehn 2017/02/16 06:08:12 We should avoid adding more of these ForBindings c
hayato 2017/02/16 06:25:55 Yeah, I am not a fan of adding "XXXBindng" in gene
esprehn 2017/02/16 06:46:54 isInert() itself walks up the tree, so doing it in
aboxhall 2017/02/27 19:33:19 I'm not sure where we ended up on this. Does this
const HTMLDialogElement* dialog = document().activeModalDialog();
if (dialog && this != document() &&
- (!canParticipateInFlatTree() ||
- !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this)))
+ !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this)) {
return true;
+ }
+
+ if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
+ const Element* element = this->isElementNode()
+ ? toElement(this)
+ : FlatTreeTraversal::parentElement(*this);
+ while (element) {
+ if (element->hasAttribute(inertAttr))
+ return true;
+ element = FlatTreeTraversal::parentElement(*element);
hayato 2017/02/16 05:52:54 Now we are exposing Node::isInert to WebIDL. That
esprehn 2017/02/16 06:08:12 The thing exposed to idl is a boolean attribute, i
hayato 2017/02/16 06:25:55 Ah, I thought that node.inert is using this Node::
+ }
+ }
+
return document().localOwner() && document().localOwner()->isInert();
}

Powered by Google App Engine
This is Rietveld 408576698