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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Fullscreen.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 class NodeRareData; 70 class NodeRareData;
71 class PlatformGestureEvent; 71 class PlatformGestureEvent;
72 class PlatformKeyboardEvent; 72 class PlatformKeyboardEvent;
73 class PlatformMouseEvent; 73 class PlatformMouseEvent;
74 class PlatformWheelEvent; 74 class PlatformWheelEvent;
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 LayoutObject;
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 using StaticNodeList = StaticNodeTypeList<Node>; 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,
96 SubtreeStyleChange = 2 << nodeStyleChangeShift, 96 SubtreeStyleChange = 2 << nodeStyleChangeShift,
97 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, 97 NeedsReattachStyleChange = 3 << nodeStyleChangeShift,
98 }; 98 };
99 99
100 class NodeRareDataBase { 100 class NodeRareDataBase {
101 public: 101 public:
102 RenderObject* renderer() const { return m_renderer; } 102 LayoutObject* renderer() const { return m_renderer; }
103 void setRenderer(RenderObject* renderer) { m_renderer = renderer; } 103 void setRenderer(LayoutObject* renderer) { m_renderer = renderer; }
104 104
105 protected: 105 protected:
106 NodeRareDataBase(RenderObject* renderer) 106 NodeRareDataBase(LayoutObject* renderer)
107 : m_renderer(renderer) 107 : m_renderer(renderer)
108 { } 108 { }
109 109
110 protected: 110 protected:
111 // Oilpan: This member is traced in NodeRareData. 111 // Oilpan: This member is traced in NodeRareData.
112 // FIXME: Can we add traceAfterDispatch and finalizeGarbageCollectedObject 112 // FIXME: Can we add traceAfterDispatch and finalizeGarbageCollectedObject
113 // to NodeRareDataBase, and make m_renderer Member<>? 113 // to NodeRareDataBase, and make m_renderer Member<>?
114 RenderObject* m_renderer; 114 LayoutObject* m_renderer;
115 }; 115 };
116 116
117 class Node; 117 class Node;
118 WILL_NOT_BE_EAGERLY_TRACED_CLASS(Node); 118 WILL_NOT_BE_EAGERLY_TRACED_CLASS(Node);
119 119
120 #if ENABLE(OILPAN) 120 #if ENABLE(OILPAN)
121 #define NODE_BASE_CLASSES public EventTarget 121 #define NODE_BASE_CLASSES public EventTarget
122 #else 122 #else
123 // TreeShared should be the last to pack TreeShared::m_refCount and 123 // TreeShared should be the last to pack TreeShared::m_refCount and
124 // Node::m_nodeFlags on 64bit platforms. 124 // Node::m_nodeFlags on 64bit platforms.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 virtual int maxCharacterOffset() const; 497 virtual int maxCharacterOffset() const;
498 498
499 // Whether or not a selection can be started in this object 499 // Whether or not a selection can be started in this object
500 virtual bool canStartSelection() const; 500 virtual bool canStartSelection() const;
501 501
502 // ------------------------------------------------------------------------- ---- 502 // ------------------------------------------------------------------------- ----
503 // Integration with rendering tree 503 // Integration with rendering tree
504 504
505 // As renderer() includes a branch you should avoid calling it repeatedly in hot code paths. 505 // As renderer() includes a branch you should avoid calling it repeatedly in hot code paths.
506 // Note that if a Node has a renderer, it's parentNode is guaranteed to have one as well. 506 // Note that if a Node has a renderer, it's parentNode is guaranteed to have one as well.
507 RenderObject* renderer() const { return hasRareData() ? m_data.m_rareData->r enderer() : m_data.m_renderer; }; 507 LayoutObject* renderer() const { return hasRareData() ? m_data.m_rareData->r enderer() : m_data.m_renderer; };
508 void setRenderer(RenderObject* renderer) 508 void setRenderer(LayoutObject* renderer)
509 { 509 {
510 if (hasRareData()) 510 if (hasRareData())
511 m_data.m_rareData->setRenderer(renderer); 511 m_data.m_rareData->setRenderer(renderer);
512 else 512 else
513 m_data.m_renderer = renderer; 513 m_data.m_renderer = renderer;
514 } 514 }
515 515
516 // Use these two methods with caution. 516 // Use these two methods with caution.
517 RenderBox* renderBox() const; 517 RenderBox* renderBox() const;
518 RenderBoxModelObject* renderBoxModelObject() const; 518 RenderBoxModelObject* renderBoxModelObject() const;
519 519
520 struct AttachContext { 520 struct AttachContext {
521 RenderStyle* resolvedStyle; 521 RenderStyle* resolvedStyle;
522 bool performingReattach; 522 bool performingReattach;
523 523
524 AttachContext() : resolvedStyle(nullptr), performingReattach(false) { } 524 AttachContext() : resolvedStyle(nullptr), performingReattach(false) { }
525 }; 525 };
526 526
527 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an 527 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an
528 // appropriate RenderObject which will be inserted into the tree (except whe n the style has display: none). This 528 // appropriate LayoutObject which will be inserted into the tree (except whe n the style has display: none). This
529 // makes the node visible in the FrameView. 529 // makes the node visible in the FrameView.
530 virtual void attach(const AttachContext& = AttachContext()); 530 virtual void attach(const AttachContext& = AttachContext());
531 531
532 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove 532 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove
533 // the node's rendering object from the rendering tree and delete it. 533 // the node's rendering object from the rendering tree and delete it.
534 virtual void detach(const AttachContext& = AttachContext()); 534 virtual void detach(const AttachContext& = AttachContext());
535 535
536 #if ENABLE(ASSERT) 536 #if ENABLE(ASSERT)
537 bool inDetach() const; 537 bool inDetach() const;
538 #endif 538 #endif
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi entMutationObserverRegistry(); 814 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi entMutationObserverRegistry();
815 815
816 uint32_t m_nodeFlags; 816 uint32_t m_nodeFlags;
817 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode; 817 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode;
818 RawPtrWillBeMember<TreeScope> m_treeScope; 818 RawPtrWillBeMember<TreeScope> m_treeScope;
819 RawPtrWillBeMember<Node> m_previous; 819 RawPtrWillBeMember<Node> m_previous;
820 RawPtrWillBeMember<Node> m_next; 820 RawPtrWillBeMember<Node> m_next;
821 // When a node has rare data we move the renderer into the rare data. 821 // When a node has rare data we move the renderer into the rare data.
822 union DataUnion { 822 union DataUnion {
823 DataUnion() : m_renderer(nullptr) { } 823 DataUnion() : m_renderer(nullptr) { }
824 RenderObject* m_renderer; 824 LayoutObject* m_renderer;
825 NodeRareDataBase* m_rareData; 825 NodeRareDataBase* m_rareData;
826 } m_data; 826 } m_data;
827 }; 827 };
828 828
829 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) 829 inline void Node::setParentOrShadowHostNode(ContainerNode* parent)
830 { 830 {
831 ASSERT(isMainThread()); 831 ASSERT(isMainThread());
832 m_parentOrShadowHostNode = parent; 832 m_parentOrShadowHostNode = parent;
833 } 833 }
834 834
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } // namespace blink 903 } // namespace blink
904 904
905 #ifndef NDEBUG 905 #ifndef NDEBUG
906 // Outside the WebCore namespace for ease of invocation from gdb. 906 // Outside the WebCore namespace for ease of invocation from gdb.
907 void showNode(const blink::Node*); 907 void showNode(const blink::Node*);
908 void showTree(const blink::Node*); 908 void showTree(const blink::Node*);
909 void showNodePath(const blink::Node*); 909 void showNodePath(const blink::Node*);
910 #endif 910 #endif
911 911
912 #endif // Node_h 912 #endif // Node_h
OLDNEW
« no previous file with comments | « Source/core/dom/Fullscreen.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698