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

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: Logspammy WIP Created 3 years, 7 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 Node* Node::FocusDelegate() { 821 Node* Node::FocusDelegate() {
822 return this; 822 return this;
823 } 823 }
824 824
825 bool Node::ShouldHaveFocusAppearance() const { 825 bool Node::ShouldHaveFocusAppearance() const {
826 DCHECK(IsFocused()); 826 DCHECK(IsFocused());
827 return true; 827 return true;
828 } 828 }
829 829
830 bool Node::IsInert() const { 830 bool Node::IsInert() const {
831 if (!CanParticipateInFlatTree())
832 return true;
833
834 DCHECK(!ChildNeedsDistributionRecalc());
835
831 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog(); 836 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog();
832 if (dialog && this != GetDocument() && 837 if (dialog && this != GetDocument() &&
833 (!CanParticipateInFlatTree() || 838 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)) {
834 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)))
835 return true; 839 return true;
840 }
841
842 if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
843 const Element* element = this->IsElementNode()
844 ? ToElement(this)
845 : FlatTreeTraversal::ParentElement(*this);
846 while (element) {
847 if (element->hasAttribute(HTMLNames::inertAttr))
848 return true;
849 element = FlatTreeTraversal::ParentElement(*element);
850 }
851 }
836 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert(); 852 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert();
dmazzoni 2017/05/08 06:06:09 I just realized this only walks local frames, so i
837 } 853 }
838 854
839 unsigned Node::NodeIndex() const { 855 unsigned Node::NodeIndex() const {
840 const Node* temp_node = previousSibling(); 856 const Node* temp_node = previousSibling();
841 unsigned count = 0; 857 unsigned count = 0;
842 for (count = 0; temp_node; count++) 858 for (count = 0; temp_node; count++)
843 temp_node = temp_node->previousSibling(); 859 temp_node = temp_node->previousSibling();
844 return count; 860 return count;
845 } 861 }
846 862
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 if (node) { 2609 if (node) {
2594 std::stringstream stream; 2610 std::stringstream stream;
2595 node->PrintNodePathTo(stream); 2611 node->PrintNodePathTo(stream);
2596 LOG(INFO) << stream.str(); 2612 LOG(INFO) << stream.str();
2597 } else { 2613 } else {
2598 LOG(INFO) << "Cannot showNodePath for <null>"; 2614 LOG(INFO) << "Cannot showNodePath for <null>";
2599 } 2615 }
2600 } 2616 }
2601 2617
2602 #endif 2618 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698