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

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeRareData.h

Issue 1962953002: Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs to remove redundant ComputedStyle members Created 4 years, 6 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) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #ifndef NodeRareData_h 22 #ifndef NodeRareData_h
23 #define NodeRareData_h 23 #define NodeRareData_h
24 24
25 #include "core/dom/MutationObserverRegistration.h" 25 #include "core/dom/MutationObserverRegistration.h"
26 #include "core/dom/NodeListsNodeData.h" 26 #include "core/dom/NodeListsNodeData.h"
27 #include "core/style/ComputedStyle.h"
27 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
28 #include "wtf/HashSet.h" 29 #include "wtf/HashSet.h"
29 #include "wtf/OwnPtr.h" 30 #include "wtf/OwnPtr.h"
30 #include "wtf/PassOwnPtr.h" 31 #include "wtf/PassOwnPtr.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class NodeMutationObserverData final : public GarbageCollected<NodeMutationObser verData> { 35 class NodeMutationObserverData final : public GarbageCollected<NodeMutationObser verData> {
35 WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); 36 WTF_MAKE_NONCOPYABLE(NodeMutationObserverData);
36 public: 37 public:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 bool hasElementFlag(ElementFlags mask) const { return m_elementFlags & mask; } 99 bool hasElementFlag(ElementFlags mask) const { return m_elementFlags & mask; }
99 void setElementFlag(ElementFlags mask, bool value) { m_elementFlags = (m_ele mentFlags & ~mask) | (-(int32_t)value & mask); } 100 void setElementFlag(ElementFlags mask, bool value) { m_elementFlags = (m_ele mentFlags & ~mask) | (-(int32_t)value & mask); }
100 void clearElementFlag(ElementFlags mask) { m_elementFlags &= ~mask; } 101 void clearElementFlag(ElementFlags mask) { m_elementFlags &= ~mask; }
101 102
102 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return m_restyleFlags & mask; } 103 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return m_restyleFlags & mask; }
103 void setRestyleFlag(DynamicRestyleFlags mask) { m_restyleFlags |= mask; RELE ASE_ASSERT(m_restyleFlags); } 104 void setRestyleFlag(DynamicRestyleFlags mask) { m_restyleFlags |= mask; RELE ASE_ASSERT(m_restyleFlags); }
104 bool hasRestyleFlags() const { return m_restyleFlags; } 105 bool hasRestyleFlags() const { return m_restyleFlags; }
105 void clearRestyleFlags() { m_restyleFlags = 0; } 106 void clearRestyleFlags() { m_restyleFlags = 0; }
106 107
108 CORE_EXPORT ComputedStyle* computedStyle() const;
109 void setComputedStyle(PassRefPtr<ComputedStyle>);
110
107 enum { 111 enum {
108 ConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames. 112 ConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames.
109 }; 113 };
110 114
111 DECLARE_TRACE(); 115 DECLARE_TRACE();
112 116
113 DECLARE_TRACE_AFTER_DISPATCH(); 117 DECLARE_TRACE_AFTER_DISPATCH();
114 void finalizeGarbageCollectedObject(); 118 void finalizeGarbageCollectedObject();
115 119
116 DECLARE_TRACE_WRAPPERS(); 120 DECLARE_TRACE_WRAPPERS();
117 DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH(); 121 DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH();
118 122
119 protected: 123 protected:
120 explicit NodeRareData(LayoutObject* layoutObject) 124 explicit NodeRareData(LayoutObject* layoutObject)
121 : NodeRareDataBase(layoutObject) 125 : NodeRareDataBase(layoutObject)
126 , m_computedStyle(nullptr)
122 , m_connectedFrameCount(0) 127 , m_connectedFrameCount(0)
123 , m_elementFlags(0) 128 , m_elementFlags(0)
124 , m_restyleFlags(0) 129 , m_restyleFlags(0)
125 , m_isElementRareData(false) 130 , m_isElementRareData(false)
126 { } 131 { }
127 132
128 private: 133 private:
129 Member<NodeListsNodeData> m_nodeLists; 134 Member<NodeListsNodeData> m_nodeLists;
130 Member<NodeMutationObserverData> m_mutationObserverData; 135 Member<NodeMutationObserverData> m_mutationObserverData;
136 RefPtr<ComputedStyle> m_computedStyle;
131 137
132 unsigned m_connectedFrameCount : ConnectedFrameCountBits; 138 unsigned m_connectedFrameCount : ConnectedFrameCountBits;
133 unsigned m_elementFlags : NumberOfElementFlags; 139 unsigned m_elementFlags : NumberOfElementFlags;
134 unsigned m_restyleFlags : NumberOfDynamicRestyleFlags; 140 unsigned m_restyleFlags : NumberOfDynamicRestyleFlags;
135 protected: 141 protected:
136 unsigned m_isElementRareData : 1; 142 unsigned m_isElementRareData : 1;
137 }; 143 };
138 144
139 } // namespace blink 145 } // namespace blink
140 146
141 #endif // NodeRareData_h 147 #endif // NodeRareData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698