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

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementRareData.cpp

Issue 2005593002: Initial ResizeObserver implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to master: Vector<WeakMember> no longer ok. 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/dom/ElementRareData.h" 31 #include "core/dom/ElementRareData.h"
32 32
33 #include "core/css/cssom/InlineStylePropertyMap.h" 33 #include "core/css/cssom/InlineStylePropertyMap.h"
34 #include "core/dom/CompositorProxiedPropertySet.h" 34 #include "core/dom/CompositorProxiedPropertySet.h"
35 #include "core/observer/ResizeObservation.h"
36 #include "core/observer/ResizeObserver.h"
35 #include "core/style/ComputedStyle.h" 37 #include "core/style/ComputedStyle.h"
36 38
37 namespace blink { 39 namespace blink {
38 40
39 struct SameSizeAsElementRareData : NodeRareData { 41 struct SameSizeAsElementRareData : NodeRareData {
40 short indices[1]; 42 short indices[1];
41 LayoutSize sizeForResizing; 43 LayoutSize sizeForResizing;
42 IntSize scrollOffset; 44 IntSize scrollOffset;
43 void* pointers[10]; 45 void* pointers[10];
44 Member<void*> persistentMember[3]; 46 Member<void*> persistentMember[4];
45 }; 47 };
46 48
47 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement) 49 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement)
48 { 50 {
49 if (!m_cssomWrapper) 51 if (!m_cssomWrapper)
50 m_cssomWrapper = new InlineCSSStyleDeclaration(ownerElement); 52 m_cssomWrapper = new InlineCSSStyleDeclaration(ownerElement);
51 return *m_cssomWrapper; 53 return *m_cssomWrapper;
52 } 54 }
53 55
54 InlineStylePropertyMap& ElementRareData::ensureInlineStylePropertyMap(Element* o wnerElement) 56 InlineStylePropertyMap& ElementRareData::ensureInlineStylePropertyMap(Element* o wnerElement)
55 { 57 {
56 if (!m_cssomMapWrapper) { 58 if (!m_cssomMapWrapper) {
57 m_cssomMapWrapper = new InlineStylePropertyMap(ownerElement); 59 m_cssomMapWrapper = new InlineStylePropertyMap(ownerElement);
58 } 60 }
59 return *m_cssomMapWrapper; 61 return *m_cssomMapWrapper;
60 } 62 }
61 63
62 AttrNodeList& ElementRareData::ensureAttrNodeList() 64 AttrNodeList& ElementRareData::ensureAttrNodeList()
63 { 65 {
64 if (!m_attrNodeList) 66 if (!m_attrNodeList)
65 m_attrNodeList = new AttrNodeList; 67 m_attrNodeList = new AttrNodeList;
66 return *m_attrNodeList; 68 return *m_attrNodeList;
67 } 69 }
68 70
71 ElementRareData::ResizeObserverDataMap& ElementRareData::ensureResizeObserverDat a()
72 {
73 if (!m_resizeObserverData)
74 m_resizeObserverData = new HeapHashMap<Member<ResizeObserver>, Member<Re sizeObservation>>();
75 return *m_resizeObserverData;
76 }
77
69 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData) 78 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData)
70 { 79 {
71 visitor->trace(m_dataset); 80 visitor->trace(m_dataset);
72 visitor->trace(m_classList); 81 visitor->trace(m_classList);
73 visitor->trace(m_shadow); 82 visitor->trace(m_shadow);
74 visitor->trace(m_attributeMap); 83 visitor->trace(m_attributeMap);
75 visitor->trace(m_attrNodeList); 84 visitor->trace(m_attrNodeList);
76 visitor->trace(m_elementAnimations); 85 visitor->trace(m_elementAnimations);
77 visitor->trace(m_cssomWrapper); 86 visitor->trace(m_cssomWrapper);
78 visitor->trace(m_cssomMapWrapper); 87 visitor->trace(m_cssomMapWrapper);
79 visitor->trace(m_pseudoElementData); 88 visitor->trace(m_pseudoElementData);
80 visitor->trace(m_customElementDefinition); 89 visitor->trace(m_customElementDefinition);
81 visitor->trace(m_intersectionObserverData); 90 visitor->trace(m_intersectionObserverData);
91 visitor->trace(m_resizeObserverData);
82 NodeRareData::traceAfterDispatch(visitor); 92 NodeRareData::traceAfterDispatch(visitor);
83 } 93 }
84 94
85 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(ElementRareData) 95 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(ElementRareData)
86 { 96 {
87 if (m_attrNodeList.get()) { 97 if (m_attrNodeList.get()) {
88 for (auto& attr : *m_attrNodeList) { 98 for (auto& attr : *m_attrNodeList) {
89 visitor->traceWrappers(attr); 99 visitor->traceWrappers(attr);
90 } 100 }
91 } 101 }
92 visitor->traceWrappers(m_shadow); 102 visitor->traceWrappers(m_shadow);
93 visitor->traceWrappers(m_attributeMap); 103 visitor->traceWrappers(m_attributeMap);
94 visitor->traceWrappers(m_dataset); 104 visitor->traceWrappers(m_dataset);
95 visitor->traceWrappers(m_classList); 105 visitor->traceWrappers(m_classList);
96 visitor->traceWrappers(m_intersectionObserverData); 106 visitor->traceWrappers(m_intersectionObserverData);
97 NodeRareData::traceWrappersAfterDispatch(visitor); 107 NodeRareData::traceWrappersAfterDispatch(visitor);
98 } 108 }
99 109
100 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small"); 110 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small");
101 111
102 } // namespace blink 112 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698