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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2902133002: Revert of "Implement the inert attribute" (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 for (Node* node = ParentOrShadowHostNode(); 748 for (Node* node = ParentOrShadowHostNode();
749 node && !node->ChildNeedsStyleInvalidation(); 749 node && !node->ChildNeedsStyleInvalidation();
750 node = node->ParentOrShadowHostNode()) 750 node = node->ParentOrShadowHostNode())
751 node->SetChildNeedsStyleInvalidation(); 751 node->SetChildNeedsStyleInvalidation();
752 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); 752 GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
753 } 753 }
754 754
755 void Node::MarkAncestorsWithChildNeedsDistributionRecalc() { 755 void Node::MarkAncestorsWithChildNeedsDistributionRecalc() {
756 ScriptForbiddenScope forbid_script_during_raw_iteration; 756 ScriptForbiddenScope forbid_script_during_raw_iteration;
757 for (Node* node = this; node && !node->ChildNeedsDistributionRecalc(); 757 for (Node* node = this; node && !node->ChildNeedsDistributionRecalc();
758 node = node->ParentOrShadowHostNode()) { 758 node = node->ParentOrShadowHostNode())
759 node->SetChildNeedsDistributionRecalc(); 759 node->SetChildNeedsDistributionRecalc();
760 }
761 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); 760 GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
762 } 761 }
763 762
764 inline void Node::SetStyleChange(StyleChangeType change_type) { 763 inline void Node::SetStyleChange(StyleChangeType change_type) {
765 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type; 764 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type;
766 } 765 }
767 766
768 void Node::MarkAncestorsWithChildNeedsStyleRecalc() { 767 void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
769 for (ContainerNode* p = ParentOrShadowHostNode(); 768 for (ContainerNode* p = ParentOrShadowHostNode();
770 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode()) 769 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 Node* Node::FocusDelegate() { 841 Node* Node::FocusDelegate() {
843 return this; 842 return this;
844 } 843 }
845 844
846 bool Node::ShouldHaveFocusAppearance() const { 845 bool Node::ShouldHaveFocusAppearance() const {
847 DCHECK(IsFocused()); 846 DCHECK(IsFocused());
848 return true; 847 return true;
849 } 848 }
850 849
851 bool Node::IsInert() const { 850 bool Node::IsInert() const {
852 if (!isConnected() || !CanParticipateInFlatTree())
853 return true;
854
855 DCHECK(!ChildNeedsDistributionRecalc());
856
857 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog(); 851 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog();
858 if (dialog && this != GetDocument() && 852 if (dialog && this != GetDocument() &&
859 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)) { 853 (!CanParticipateInFlatTree() ||
854 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)))
860 return true; 855 return true;
861 }
862
863 if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
864 const Element* element = this->IsElementNode()
865 ? ToElement(this)
866 : FlatTreeTraversal::ParentElement(*this);
867 while (element) {
868 if (element->hasAttribute(HTMLNames::inertAttr))
869 return true;
870 element = FlatTreeTraversal::ParentElement(*element);
871 }
872 }
873 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert(); 856 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert();
874 } 857 }
875 858
876 unsigned Node::NodeIndex() const { 859 unsigned Node::NodeIndex() const {
877 const Node* temp_node = previousSibling(); 860 const Node* temp_node = previousSibling();
878 unsigned count = 0; 861 unsigned count = 0;
879 for (count = 0; temp_node; count++) 862 for (count = 0; temp_node; count++)
880 temp_node = temp_node->previousSibling(); 863 temp_node = temp_node->previousSibling();
881 return count; 864 return count;
882 } 865 }
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 if (node) { 2641 if (node) {
2659 std::stringstream stream; 2642 std::stringstream stream;
2660 node->PrintNodePathTo(stream); 2643 node->PrintNodePathTo(stream);
2661 LOG(INFO) << stream.str(); 2644 LOG(INFO) << stream.str();
2662 } else { 2645 } else {
2663 LOG(INFO) << "Cannot showNodePath for <null>"; 2646 LOG(INFO) << "Cannot showNodePath for <null>";
2664 } 2647 }
2665 } 2648 }
2666 2649
2667 #endif 2650 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698