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

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: esprehn comments round 2 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const HTMLDialogElement* dialog = document().activeModalDialog(); 777 const HTMLDialogElement* dialog = document().activeModalDialog();
778 if (dialog && this != document() && 778 if (dialog && this != document() &&
779 (!canParticipateInFlatTree() || 779 (!canParticipateInFlatTree() ||
780 !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this))) 780 !FlatTreeTraversal::containsIncludingPseudoElement(*dialog, *this)))
781 return true; 781 return true;
782
783 if (RuntimeEnabledFeatures::inertAttributeEnabled()) {
784 const Node* node = this;
785 do {
786 if (node->isElementNode() &&
787 toElement(node)->hasAttribute(HTMLNames::inertAttr))
esprehn 2017/02/15 02:15:00 we often do using HTMLNames, that's actually at th
aboxhall 2017/02/15 04:01:32 Done.
788 return true;
789 node = FlatTreeTraversal::parentElement(*node);
790 } while (node);
791 }
792
782 return document().localOwner() && document().localOwner()->isInert(); 793 return document().localOwner() && document().localOwner()->isInert();
783 } 794 }
784 795
785 unsigned Node::nodeIndex() const { 796 unsigned Node::nodeIndex() const {
786 const Node* tempNode = previousSibling(); 797 const Node* tempNode = previousSibling();
787 unsigned count = 0; 798 unsigned count = 0;
788 for (count = 0; tempNode; count++) 799 for (count = 0; tempNode; count++)
789 tempNode = tempNode->previousSibling(); 800 tempNode = tempNode->previousSibling();
790 return count; 801 return count;
791 } 802 }
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 if (node) { 2577 if (node) {
2567 std::stringstream stream; 2578 std::stringstream stream;
2568 node->printNodePathTo(stream); 2579 node->printNodePathTo(stream);
2569 LOG(INFO) << stream.str(); 2580 LOG(INFO) << stream.str();
2570 } else { 2581 } else {
2571 LOG(INFO) << "Cannot showNodePath for <null>"; 2582 LOG(INFO) << "Cannot showNodePath for <null>";
2572 } 2583 }
2573 } 2584 }
2574 2585
2575 #endif 2586 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698