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.h

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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-2011, 2014 Apple Inc. All rights reserved. 5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 TreeScope& containingTreeScope() const 471 TreeScope& containingTreeScope() const
472 { 472 {
473 DCHECK(isInTreeScope()); 473 DCHECK(isInTreeScope());
474 return *m_treeScope; 474 return *m_treeScope;
475 } 475 }
476 476
477 bool inActiveDocument() const; 477 bool inActiveDocument() const;
478 478
479 // Returns true if this node is associated with a shadow-including document and is in its associated document's 479 // Returns true if this node is connected to a document, false otherwise.
480 // node tree, false otherwise. 480 // See https://dom.spec.whatwg.org/#connected for the definition.
481 bool inShadowIncludingDocument() const 481 bool isConnected() const { return getFlag(IsConnectedFlag); }
482 { 482
483 return getFlag(InDocumentFlag);
484 }
485 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } 483 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); }
486 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } 484 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(IsConnect edFlag | IsInShadowTreeFlag)); }
487 485
488 ElementShadow* parentElementShadow() const; 486 ElementShadow* parentElementShadow() const;
489 bool isInV1ShadowTree() const; 487 bool isInV1ShadowTree() const;
490 bool isInV0ShadowTree() const; 488 bool isInV0ShadowTree() const;
491 bool isChildOfV1ShadowHost() const; 489 bool isChildOfV1ShadowHost() const;
492 bool isChildOfV0ShadowHost() const; 490 bool isChildOfV0ShadowHost() const;
493 ShadowRoot* v1ShadowRootOfParent() const; 491 ShadowRoot* v1ShadowRootOfParent() const;
494 492
495 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; } 493 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; }
496 virtual bool childTypeAllowed(NodeType) const { return false; } 494 virtual bool childTypeAllowed(NodeType) const { return false; }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 562
565 // ------------------------------------------------------------------------- ---- 563 // ------------------------------------------------------------------------- ----
566 // Notification of document structure changes (see ContainerNode.h for more notification methods) 564 // Notification of document structure changes (see ContainerNode.h for more notification methods)
567 // 565 //
568 // At first, WebKit notifies the node that it has been inserted into the doc ument. This is called during document parsing, and also 566 // At first, WebKit notifies the node that it has been inserted into the doc ument. This is called during document parsing, and also
569 // when a node is added through the DOM methods insertBefore(), appendChild( ) or replaceChild(). The call happens _after_ the node has been added to the tre e. 567 // when a node is added through the DOM methods insertBefore(), appendChild( ) or replaceChild(). The call happens _after_ the node has been added to the tre e.
570 // This is similar to the DOMNodeInsertedIntoDocument DOM event, but does no t require the overhead of event 568 // This is similar to the DOMNodeInsertedIntoDocument DOM event, but does no t require the overhead of event
571 // dispatching. 569 // dispatching.
572 // 570 //
573 // WebKit notifies this callback regardless if the subtree of the node is a document tree or a floating subtree. 571 // WebKit notifies this callback regardless if the subtree of the node is a document tree or a floating subtree.
574 // Implementation can determine the type of subtree by seeing insertionPoint ->inShadowIncludingDocument(). 572 // Implementation can determine the type of subtree by seeing insertionPoint ->isConnected().
575 // For a performance reason, notifications are delivered only to ContainerNo de subclasses if the insertionPoint is out of document. 573 // For a performance reason, notifications are delivered only to ContainerNo de subclasses if the insertionPoint is out of document.
576 // 574 //
577 // There are another callback named didNotifySubtreeInsertionsToDocument(), which is called after all the descendant is notified, 575 // There are another callback named didNotifySubtreeInsertionsToDocument(), which is called after all the descendant is notified,
578 // if this node was inserted into the document tree. Only a few subclasses a ctually need this. To utilize this, the node should 576 // if this node was inserted into the document tree. Only a few subclasses a ctually need this. To utilize this, the node should
579 // return InsertionShouldCallDidNotifySubtreeInsertions from insertedInto(). 577 // return InsertionShouldCallDidNotifySubtreeInsertions from insertedInto().
580 // 578 //
581 enum InsertionNotificationRequest { 579 enum InsertionNotificationRequest {
582 InsertionDone, 580 InsertionDone,
583 InsertionShouldCallDidNotifySubtreeInsertions 581 InsertionShouldCallDidNotifySubtreeInsertions
584 }; 582 };
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 701
704 // Changes based on if the element should be treated like a link, 702 // Changes based on if the element should be treated like a link,
705 // ex. When setting the href attribute on an <a>. 703 // ex. When setting the href attribute on an <a>.
706 IsLinkFlag = 1 << 8, 704 IsLinkFlag = 1 << 8,
707 705
708 // Changes based on :hover, :active and :focus state. 706 // Changes based on :hover, :active and :focus state.
709 IsUserActionElementFlag = 1 << 9, 707 IsUserActionElementFlag = 1 << 9,
710 708
711 // Tree state flags. These change when the element is added/removed 709 // Tree state flags. These change when the element is added/removed
712 // from a DOM tree. 710 // from a DOM tree.
713 InDocumentFlag = 1 << 10, 711 IsConnectedFlag = 1 << 10,
714 IsInShadowTreeFlag = 1 << 11, 712 IsInShadowTreeFlag = 1 << 11,
715 713
716 // Set by the parser when the children are done parsing. 714 // Set by the parser when the children are done parsing.
717 IsFinishedParsingChildrenFlag = 1 << 12, 715 IsFinishedParsingChildrenFlag = 1 << 12,
718 716
719 // Flags related to recalcStyle. 717 // Flags related to recalcStyle.
720 SVGFilterNeedsLayerUpdateFlag = 1 << 13, 718 SVGFilterNeedsLayerUpdateFlag = 1 << 13,
721 HasCustomStyleCallbacksFlag = 1 << 14, 719 HasCustomStyleCallbacksFlag = 1 << 14,
722 ChildNeedsStyleInvalidationFlag = 1 << 15, 720 ChildNeedsStyleInvalidationFlag = 1 << 15,
723 NeedsStyleInvalidationFlag = 1 << 16, 721 NeedsStyleInvalidationFlag = 1 << 16,
(...skipping 26 matching lines...) Expand all
750 protected: 748 protected:
751 enum ConstructionType { 749 enum ConstructionType {
752 CreateOther = DefaultNodeFlags, 750 CreateOther = DefaultNodeFlags,
753 CreateText = DefaultNodeFlags | IsTextFlag, 751 CreateText = DefaultNodeFlags | IsTextFlag,
754 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsConta inerFlag, 752 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsConta inerFlag,
755 CreateElement = CreateContainer | IsElementFlag, 753 CreateElement = CreateContainer | IsElementFlag,
756 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, 754 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag,
757 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, 755 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,
758 CreateHTMLElement = CreateElement | IsHTMLFlag, 756 CreateHTMLElement = CreateElement | IsHTMLFlag,
759 CreateSVGElement = CreateElement | IsSVGFlag, 757 CreateSVGElement = CreateElement | IsSVGFlag,
760 CreateDocument = CreateContainer | InDocumentFlag, 758 CreateDocument = CreateContainer | IsConnectedFlag,
761 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, 759 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag,
762 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, 760 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag,
763 }; 761 };
764 762
765 Node(TreeScope*, ConstructionType); 763 Node(TreeScope*, ConstructionType);
766 764
767 virtual void didMoveToNewDocument(Document& oldDocument); 765 virtual void didMoveToNewDocument(Document& oldDocument);
768 766
769 void addedEventListener(const AtomicString& eventType, RegisteredEventListen er&) override; 767 void addedEventListener(const AtomicString& eventType, RegisteredEventListen er&) override;
770 void removedEventListener(const AtomicString& eventType, const RegisteredEve ntListener&) override; 768 void removedEventListener(const AtomicString& eventType, const RegisteredEve ntListener&) override;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } // namespace blink 920 } // namespace blink
923 921
924 #ifndef NDEBUG 922 #ifndef NDEBUG
925 // Outside the WebCore namespace for ease of invocation from gdb. 923 // Outside the WebCore namespace for ease of invocation from gdb.
926 void showNode(const blink::Node*); 924 void showNode(const blink::Node*);
927 void showTree(const blink::Node*); 925 void showTree(const blink::Node*);
928 void showNodePath(const blink::Node*); 926 void showNodePath(const blink::Node*);
929 #endif 927 #endif
930 928
931 #endif // Node_h 929 #endif // Node_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698