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

Side by Side Diff: Source/core/dom/Node.h

Issue 674553002: Move parts of core/dom to C++11 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Windows shut up when I just try following the style guide Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/Node.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-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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 class QualifiedName; 75 class QualifiedName;
76 class RadioNodeList; 76 class RadioNodeList;
77 class RegisteredEventListener; 77 class RegisteredEventListener;
78 class RenderBox; 78 class RenderBox;
79 class RenderBoxModelObject; 79 class RenderBoxModelObject;
80 class RenderObject; 80 class RenderObject;
81 class RenderStyle; 81 class RenderStyle;
82 class SVGQualifiedName; 82 class SVGQualifiedName;
83 class ShadowRoot; 83 class ShadowRoot;
84 template <typename NodeType> class StaticNodeTypeList; 84 template <typename NodeType> class StaticNodeTypeList;
85 typedef StaticNodeTypeList<Node> StaticNodeList; 85 using StaticNodeList = StaticNodeTypeList<Node>;
86 class TagCollection; 86 class TagCollection;
87 class Text; 87 class Text;
88 class TouchEvent; 88 class TouchEvent;
89 class WeakNodeMap; 89 class WeakNodeMap;
90 90
91 const int nodeStyleChangeShift = 19; 91 const int nodeStyleChangeShift = 19;
92 92
93 enum StyleChangeType { 93 enum StyleChangeType {
94 NoStyleChange = 0, 94 NoStyleChange = 0,
95 LocalStyleChange = 1 << nodeStyleChangeShift, 95 LocalStyleChange = 1 << nodeStyleChangeShift,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 bool isTreeScope() const; 271 bool isTreeScope() const;
272 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } 272 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
273 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } 273 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }
274 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } 274 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); }
275 275
276 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); } 276 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); }
277 277
278 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChi ldNodesFlag); } 278 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChi ldNodesFlag); }
279 void setHasSyntheticAttrChildNodes(bool flag) { setFlag(flag, HasSyntheticAt trChildNodesFlag); } 279 void setHasSyntheticAttrChildNodes(bool flag) { setFlag(flag, HasSyntheticAt trChildNodesFlag); }
280 280
281 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret urns 0. 281 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret urns nullptr.
282 Element* shadowHost() const; 282 Element* shadowHost() const;
283 ShadowRoot* containingShadowRoot() const; 283 ShadowRoot* containingShadowRoot() const;
284 ShadowRoot* youngestShadowRoot() const; 284 ShadowRoot* youngestShadowRoot() const;
285 285
286 // Returns 0, a child of ShadowRoot, or a legacy shadow root. 286 // Returns nullptr, a child of ShadowRoot, or a legacy shadow root.
287 Node* nonBoundaryShadowTreeRootNode(); 287 Node* nonBoundaryShadowTreeRootNode();
288 288
289 // Node's parent, shadow tree host. 289 // Node's parent, shadow tree host.
290 ContainerNode* parentOrShadowHostNode() const; 290 ContainerNode* parentOrShadowHostNode() const;
291 Element* parentOrShadowHostElement() const; 291 Element* parentOrShadowHostElement() const;
292 void setParentOrShadowHostNode(ContainerNode*); 292 void setParentOrShadowHostNode(ContainerNode*);
293 293
294 // Knows about all kinds of hosts. 294 // Knows about all kinds of hosts.
295 ContainerNode* parentOrShadowHostOrTemplateHostNode() const; 295 ContainerNode* parentOrShadowHostOrTemplateHostNode() const;
296 296
297 // Returns the parent node, but 0 if the parent node is a ShadowRoot. 297 // Returns the parent node, but nullptr if the parent node is a ShadowRoot.
298 ContainerNode* nonShadowBoundaryParentNode() const; 298 ContainerNode* nonShadowBoundaryParentNode() const;
299 299
300 bool selfOrAncestorHasDirAutoAttribute() const { return getFlag(SelfOrAncest orHasDirAutoFlag); } 300 bool selfOrAncestorHasDirAutoAttribute() const { return getFlag(SelfOrAncest orHasDirAutoFlag); }
301 void setSelfOrAncestorHasDirAutoAttribute(bool flag) { setFlag(flag, SelfOrA ncestorHasDirAutoFlag); } 301 void setSelfOrAncestorHasDirAutoAttribute(bool flag) { setFlag(flag, SelfOrA ncestorHasDirAutoFlag); }
302 302
303 // Returns the enclosing event parent Element (or self) that, when clicked, would trigger a navigation. 303 // Returns the enclosing event parent Element (or self) that, when clicked, would trigger a navigation.
304 Element* enclosingLinkEventParentOrSelf(); 304 Element* enclosingLinkEventParentOrSelf();
305 305
306 // These low-level calls give the caller responsibility for maintaining the integrity of the tree. 306 // These low-level calls give the caller responsibility for maintaining the integrity of the tree.
307 void setPreviousSibling(Node* previous) { m_previous = previous; } 307 void setPreviousSibling(Node* previous) { m_previous = previous; }
308 void setNextSibling(Node* next) { m_next = next; } 308 void setNextSibling(Node* next) { m_next = next; }
309 309
310 virtual bool canContainRangeEndPoint() const { return false; } 310 virtual bool canContainRangeEndPoint() const { return false; }
311 311
312 // FIXME: These two functions belong in editing -- "atomic node" is an editi ng concept. 312 // FIXME: These two functions belong in editing -- "atomic node" is an editi ng concept.
313 Node* previousNodeConsideringAtomicNodes() const; 313 Node* previousNodeConsideringAtomicNodes() const;
314 Node* nextNodeConsideringAtomicNodes() const; 314 Node* nextNodeConsideringAtomicNodes() const;
315 315
316 // Returns the next leaf node or 0 if there are no more. 316 // Returns the next leaf node or nullptr if there are no more.
317 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its l eaf nodes. 317 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its l eaf nodes.
318 // Uses an editing-specific concept of what a leaf node is, and should proba bly be moved 318 // Uses an editing-specific concept of what a leaf node is, and should proba bly be moved
319 // out of the Node class into an editing-specific source file. 319 // out of the Node class into an editing-specific source file.
320 Node* nextLeafNode() const; 320 Node* nextLeafNode() const;
321 321
322 // Returns the previous leaf node or 0 if there are no more. 322 // Returns the previous leaf node or nullptr if there are no more.
323 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its l eaf nodes. 323 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its l eaf nodes.
324 // Uses an editing-specific concept of what a leaf node is, and should proba bly be moved 324 // Uses an editing-specific concept of what a leaf node is, and should proba bly be moved
325 // out of the Node class into an editing-specific source file. 325 // out of the Node class into an editing-specific source file.
326 Node* previousLeafNode() const; 326 Node* previousLeafNode() const;
327 327
328 bool isRootEditableElement() const; 328 bool isRootEditableElement() const;
329 Element* rootEditableElement() const; 329 Element* rootEditableElement() const;
330 Element* rootEditableElement(EditableType) const; 330 Element* rootEditableElement(EditableType) const;
331 331
332 // For <link> and <style> elements. 332 // For <link> and <style> elements.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 503
504 // Use these two methods with caution. 504 // Use these two methods with caution.
505 RenderBox* renderBox() const; 505 RenderBox* renderBox() const;
506 RenderBoxModelObject* renderBoxModelObject() const; 506 RenderBoxModelObject* renderBoxModelObject() const;
507 507
508 struct AttachContext { 508 struct AttachContext {
509 RenderStyle* resolvedStyle; 509 RenderStyle* resolvedStyle;
510 bool performingReattach; 510 bool performingReattach;
511 511
512 AttachContext() : resolvedStyle(0), performingReattach(false) { } 512 AttachContext() : resolvedStyle(nullptr), performingReattach(false) { }
513 }; 513 };
514 514
515 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an 515 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an
516 // appropriate RenderObject which will be inserted into the tree (except whe n the style has display: none). This 516 // appropriate RenderObject which will be inserted into the tree (except whe n the style has display: none). This
517 // makes the node visible in the FrameView. 517 // makes the node visible in the FrameView.
518 virtual void attach(const AttachContext& = AttachContext()); 518 virtual void attach(const AttachContext& = AttachContext());
519 519
520 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove 520 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove
521 // the node's rendering object from the rendering tree and delete it. 521 // the node's rendering object from the rendering tree and delete it.
522 virtual void detach(const AttachContext& = AttachContext()); 522 virtual void detach(const AttachContext& = AttachContext());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 virtual const AtomicString& interfaceName() const override; 599 virtual const AtomicString& interfaceName() const override;
600 virtual ExecutionContext* executionContext() const override final; 600 virtual ExecutionContext* executionContext() const override final;
601 601
602 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) override; 602 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) override;
603 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E ventListener>, bool useCapture = false) override; 603 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E ventListener>, bool useCapture = false) override;
604 virtual void removeAllEventListeners() override; 604 virtual void removeAllEventListeners() override;
605 void removeAllEventListenersRecursively(); 605 void removeAllEventListenersRecursively();
606 606
607 // Handlers to do/undo actions on the target node before an event is dispatc hed to it and after the event 607 // Handlers to do/undo actions on the target node before an event is dispatc hed to it and after the event
608 // has been dispatched. The data pointer is handed back by the preDispatch and passed to postDispatch. 608 // has been dispatched. The data pointer is handed back by the preDispatch and passed to postDispatch.
609 virtual void* preDispatchEventHandler(Event*) { return 0; } 609 virtual void* preDispatchEventHandler(Event*) { return nullptr; }
610 virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/) { } 610 virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/) { }
611 611
612 using EventTarget::dispatchEvent; 612 using EventTarget::dispatchEvent;
613 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override; 613 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override;
614 614
615 void dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event>); 615 void dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event>);
616 void dispatchScopedEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispatc hMediator>); 616 void dispatchScopedEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispatc hMediator>);
617 617
618 virtual void handleLocalEvents(Event*); 618 virtual void handleLocalEvents(Event*);
619 619
620 void dispatchSubtreeModifiedEvent(); 620 void dispatchSubtreeModifiedEvent();
621 bool dispatchDOMActivateEvent(int detail, PassRefPtrWillBeRawPtr<Event> unde rlyingEvent); 621 bool dispatchDOMActivateEvent(int detail, PassRefPtrWillBeRawPtr<Event> unde rlyingEvent);
622 622
623 bool dispatchKeyEvent(const PlatformKeyboardEvent&); 623 bool dispatchKeyEvent(const PlatformKeyboardEvent&);
624 bool dispatchWheelEvent(const PlatformWheelEvent&); 624 bool dispatchWheelEvent(const PlatformWheelEvent&);
625 bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& event Type, int clickCount = 0, Node* relatedTarget = 0); 625 bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& event Type, int clickCount = 0, Node* relatedTarget = nullptr);
626 bool dispatchGestureEvent(const PlatformGestureEvent&); 626 bool dispatchGestureEvent(const PlatformGestureEvent&);
627 bool dispatchTouchEvent(PassRefPtrWillBeRawPtr<TouchEvent>); 627 bool dispatchTouchEvent(PassRefPtrWillBeRawPtr<TouchEvent>);
628 628
629 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEvent Options = SendNoEvents); 629 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEvent Options = SendNoEvents);
630 630
631 void dispatchInputEvent(); 631 void dispatchInputEvent();
632 632
633 // Perform the default action for an event. 633 // Perform the default action for an event.
634 virtual void defaultEventHandler(Event*); 634 virtual void defaultEventHandler(Event*);
635 virtual void willCallDefaultEventHandler(const Event&); 635 virtual void willCallDefaultEventHandler(const Event&);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const; 787 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const;
788 bool isEditableToAccessibility(EditableLevel) const; 788 bool isEditableToAccessibility(EditableLevel) const;
789 789
790 bool isUserActionElementActive() const; 790 bool isUserActionElementActive() const;
791 bool isUserActionElementInActiveChain() const; 791 bool isUserActionElementInActiveChain() const;
792 bool isUserActionElementHovered() const; 792 bool isUserActionElementHovered() const;
793 bool isUserActionElementFocused() const; 793 bool isUserActionElementFocused() const;
794 794
795 void setStyleChange(StyleChangeType); 795 void setStyleChange(StyleChangeType);
796 796
797 virtual RenderStyle* nonRendererStyle() const { return 0; } 797 virtual RenderStyle* nonRendererStyle() const { return nullptr; }
798 798
799 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO); 799 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO);
800 800
801 void trackForDebugging(); 801 void trackForDebugging();
802 802
803 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* mutatio nObserverRegistry(); 803 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* mutatio nObserverRegistry();
804 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi entMutationObserverRegistry(); 804 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi entMutationObserverRegistry();
805 805
806 uint32_t m_nodeFlags; 806 uint32_t m_nodeFlags;
807 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode; 807 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode;
808 RawPtrWillBeMember<TreeScope> m_treeScope; 808 RawPtrWillBeMember<TreeScope> m_treeScope;
809 RawPtrWillBeMember<Node> m_previous; 809 RawPtrWillBeMember<Node> m_previous;
810 RawPtrWillBeMember<Node> m_next; 810 RawPtrWillBeMember<Node> m_next;
811 // When a node has rare data we move the renderer into the rare data. 811 // When a node has rare data we move the renderer into the rare data.
812 union DataUnion { 812 union DataUnion {
813 DataUnion() : m_renderer(0) { } 813 DataUnion() : m_renderer(nullptr) { }
814 RenderObject* m_renderer; 814 RenderObject* m_renderer;
815 NodeRareDataBase* m_rareData; 815 NodeRareDataBase* m_rareData;
816 } m_data; 816 } m_data;
817 }; 817 };
818 818
819 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) 819 inline void Node::setParentOrShadowHostNode(ContainerNode* parent)
820 { 820 {
821 ASSERT(isMainThread()); 821 ASSERT(isMainThread());
822 m_parentOrShadowHostNode = parent; 822 m_parentOrShadowHostNode = parent;
823 } 823 }
824 824
825 inline ContainerNode* Node::parentOrShadowHostNode() const 825 inline ContainerNode* Node::parentOrShadowHostNode() const
826 { 826 {
827 ASSERT(isMainThread()); 827 ASSERT(isMainThread());
828 return m_parentOrShadowHostNode; 828 return m_parentOrShadowHostNode;
829 } 829 }
830 830
831 inline ContainerNode* Node::parentNode() const 831 inline ContainerNode* Node::parentNode() const
832 { 832 {
833 return isShadowRoot() ? 0 : parentOrShadowHostNode(); 833 return isShadowRoot() ? nullptr : parentOrShadowHostNode();
834 } 834 }
835 835
836 inline void Node::lazyReattachIfAttached() 836 inline void Node::lazyReattachIfAttached()
837 { 837 {
838 if (styleChangeType() == NeedsReattachStyleChange) 838 if (styleChangeType() == NeedsReattachStyleChange)
839 return; 839 return;
840 if (!inActiveDocument()) 840 if (!inActiveDocument())
841 return; 841 return;
842 842
843 AttachContext context; 843 AttachContext context;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 } // namespace blink 886 } // namespace blink
887 887
888 #ifndef NDEBUG 888 #ifndef NDEBUG
889 // Outside the WebCore namespace for ease of invocation from gdb. 889 // Outside the WebCore namespace for ease of invocation from gdb.
890 void showNode(const blink::Node*); 890 void showNode(const blink::Node*);
891 void showTree(const blink::Node*); 891 void showTree(const blink::Node*);
892 void showNodePath(const blink::Node*); 892 void showNodePath(const blink::Node*);
893 #endif 893 #endif
894 894
895 #endif // Node_h 895 #endif // Node_h
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698