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

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: Update generic test expectations 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 for (Node* node = ParentOrShadowHostNode(); 746 for (Node* node = ParentOrShadowHostNode();
747 node && !node->ChildNeedsStyleInvalidation(); 747 node && !node->ChildNeedsStyleInvalidation();
748 node = node->ParentOrShadowHostNode()) 748 node = node->ParentOrShadowHostNode())
749 node->SetChildNeedsStyleInvalidation(); 749 node->SetChildNeedsStyleInvalidation();
750 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); 750 GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
751 } 751 }
752 752
753 void Node::MarkAncestorsWithChildNeedsDistributionRecalc() { 753 void Node::MarkAncestorsWithChildNeedsDistributionRecalc() {
754 ScriptForbiddenScope forbid_script_during_raw_iteration; 754 ScriptForbiddenScope forbid_script_during_raw_iteration;
755 for (Node* node = this; node && !node->ChildNeedsDistributionRecalc(); 755 for (Node* node = this; node && !node->ChildNeedsDistributionRecalc();
756 node = node->ParentOrShadowHostNode()) 756 node = node->ParentOrShadowHostNode()) {
757 node->SetChildNeedsDistributionRecalc(); 757 node->SetChildNeedsDistributionRecalc();
758 }
758 GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); 759 GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
759 } 760 }
760 761
761 inline void Node::SetStyleChange(StyleChangeType change_type) { 762 inline void Node::SetStyleChange(StyleChangeType change_type) {
762 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type; 763 node_flags_ = (node_flags_ & ~kStyleChangeMask) | change_type;
763 } 764 }
764 765
765 void Node::MarkAncestorsWithChildNeedsStyleRecalc() { 766 void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
766 for (ContainerNode* p = ParentOrShadowHostNode(); 767 for (ContainerNode* p = ParentOrShadowHostNode();
767 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode()) 768 p && !p->ChildNeedsStyleRecalc(); p = p->ParentOrShadowHostNode())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 Node* Node::FocusDelegate() { 822 Node* Node::FocusDelegate() {
822 return this; 823 return this;
823 } 824 }
824 825
825 bool Node::ShouldHaveFocusAppearance() const { 826 bool Node::ShouldHaveFocusAppearance() const {
826 DCHECK(IsFocused()); 827 DCHECK(IsFocused());
827 return true; 828 return true;
828 } 829 }
829 830
830 bool Node::IsInert() const { 831 bool Node::IsInert() const {
832 if (!CanParticipateInFlatTree())
833 return true;
834
835 if (!isConnected())
836 return true;
837
838 DCHECK(!ChildNeedsDistributionRecalc());
esprehn 2017/05/12 21:16:54 This assert should be inside FlatTreeTraversal pro
aboxhall 2017/05/18 01:30:49 Acknowledged.
839
831 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog(); 840 const HTMLDialogElement* dialog = GetDocument().ActiveModalDialog();
832 if (dialog && this != GetDocument() && 841 if (dialog && this != GetDocument() &&
833 (!CanParticipateInFlatTree() || 842 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)) {
834 !FlatTreeTraversal::ContainsIncludingPseudoElement(*dialog, *this)))
835 return true; 843 return true;
844 }
845
846 if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
847 const Element* element = this->IsElementNode()
848 ? ToElement(this)
849 : FlatTreeTraversal::ParentElement(*this);
850 while (element) {
851 if (element->hasAttribute(HTMLNames::inertAttr))
852 return true;
853 element = FlatTreeTraversal::ParentElement(*element);
854 }
855 }
836 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert(); 856 return GetDocument().LocalOwner() && GetDocument().LocalOwner()->IsInert();
esprehn 2017/05/12 21:16:54 This won't work in OOPIF, it means out of process
aboxhall 2017/05/18 01:30:49 Acknowledged.
837 } 857 }
838 858
839 unsigned Node::NodeIndex() const { 859 unsigned Node::NodeIndex() const {
840 const Node* temp_node = previousSibling(); 860 const Node* temp_node = previousSibling();
841 unsigned count = 0; 861 unsigned count = 0;
842 for (count = 0; temp_node; count++) 862 for (count = 0; temp_node; count++)
843 temp_node = temp_node->previousSibling(); 863 temp_node = temp_node->previousSibling();
844 return count; 864 return count;
845 } 865 }
846 866
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 if (node) { 2613 if (node) {
2594 std::stringstream stream; 2614 std::stringstream stream;
2595 node->PrintNodePathTo(stream); 2615 node->PrintNodePathTo(stream);
2596 LOG(INFO) << stream.str(); 2616 LOG(INFO) << stream.str();
2597 } else { 2617 } else {
2598 LOG(INFO) << "Cannot showNodePath for <null>"; 2618 LOG(INFO) << "Cannot showNodePath for <null>";
2599 } 2619 }
2600 } 2620 }
2601 2621
2602 #endif 2622 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698