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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 Node* Node::focusDelegate() { 767 Node* Node::focusDelegate() {
768 return this; 768 return this;
769 } 769 }
770 770
771 bool Node::shouldHaveFocusAppearance() const { 771 bool Node::shouldHaveFocusAppearance() const {
772 DCHECK(isFocused()); 772 DCHECK(isFocused());
773 return true; 773 return true;
774 } 774 }
775 775
776 bool Node::isInert() const { 776 bool Node::isInert() const {
777 if (!canParticipateInFlatTree())
778 return true;
779
780 // TODO(aboxhall): figure out whether to un-const all callers,
781 // or to call updateDistribution() from call sites.
782 const_cast<Node*>(this)->updateDistribution();
783
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
777 const HTMLDialogElement* dialog = document().activeModalDialog(); 784 const HTMLDialogElement* dialog = document().activeModalDialog();
778 if (dialog && this != document() && 785 if (dialog && this != document() &&
779 (!canParticipateInFlatTree() || 786 !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this)) {
780 !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this)))
781 return true; 787 return true;
788 }
789
790 if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
791 const Element* element = this->isElementNode()
792 ? toElement(this)
793 : FlatTreeTraversal::parentElement(*this);
794 while (element) {
795 if (element->hasAttribute(inertAttr))
796 return true;
797 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::
798 }
799 }
800
782 return document().localOwner() && document().localOwner()->isInert(); 801 return document().localOwner() && document().localOwner()->isInert();
783 } 802 }
784 803
785 unsigned Node::nodeIndex() const { 804 unsigned Node::nodeIndex() const {
786 const Node* tempNode = previousSibling(); 805 const Node* tempNode = previousSibling();
787 unsigned count = 0; 806 unsigned count = 0;
788 for (count = 0; tempNode; count++) 807 for (count = 0; tempNode; count++)
789 tempNode = tempNode->previousSibling(); 808 tempNode = tempNode->previousSibling();
790 return count; 809 return count;
791 } 810 }
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 if (node) { 2585 if (node) {
2567 std::stringstream stream; 2586 std::stringstream stream;
2568 node->printNodePathTo(stream); 2587 node->printNodePathTo(stream);
2569 LOG(INFO) << stream.str(); 2588 LOG(INFO) << stream.str();
2570 } else { 2589 } else {
2571 LOG(INFO) << "Cannot showNodePath for <null>"; 2590 LOG(INFO) << "Cannot showNodePath for <null>";
2572 } 2591 }
2573 } 2592 }
2574 2593
2575 #endif 2594 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698