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

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: Created 4 years, 7 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 23 matching lines...) Expand all
34 #include "core/dom/CompositorProxiedPropertySet.h" 34 #include "core/dom/CompositorProxiedPropertySet.h"
35 #include "core/style/ComputedStyle.h" 35 #include "core/style/ComputedStyle.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 struct SameSizeAsElementRareData : NodeRareData { 39 struct SameSizeAsElementRareData : NodeRareData {
40 short indices[1]; 40 short indices[1];
41 LayoutSize sizeForResizing; 41 LayoutSize sizeForResizing;
42 IntSize scrollOffset; 42 IntSize scrollOffset;
43 void* pointers[10]; 43 void* pointers[10];
44 Member<void*> persistentMember[3]; 44 Member<void*> persistentMember[4];
45 }; 45 };
46 46
47 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement) 47 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement)
48 { 48 {
49 if (!m_cssomWrapper) 49 if (!m_cssomWrapper)
50 m_cssomWrapper = new InlineCSSStyleDeclaration(ownerElement); 50 m_cssomWrapper = new InlineCSSStyleDeclaration(ownerElement);
51 return *m_cssomWrapper; 51 return *m_cssomWrapper;
52 } 52 }
53 53
54 InlineStylePropertyMap& ElementRareData::ensureInlineStylePropertyMap(Element* o wnerElement) 54 InlineStylePropertyMap& ElementRareData::ensureInlineStylePropertyMap(Element* o wnerElement)
55 { 55 {
56 if (!m_cssomMapWrapper) { 56 if (!m_cssomMapWrapper) {
57 m_cssomMapWrapper = new InlineStylePropertyMap(ownerElement); 57 m_cssomMapWrapper = new InlineStylePropertyMap(ownerElement);
58 } 58 }
59 return *m_cssomMapWrapper; 59 return *m_cssomMapWrapper;
60 } 60 }
61 61
62 AttrNodeList& ElementRareData::ensureAttrNodeList() 62 AttrNodeList& ElementRareData::ensureAttrNodeList()
63 { 63 {
64 if (!m_attrNodeList) 64 if (!m_attrNodeList)
65 m_attrNodeList = new AttrNodeList; 65 m_attrNodeList = new AttrNodeList;
66 return *m_attrNodeList; 66 return *m_attrNodeList;
67 } 67 }
68 68
69 ResizeObservationSet& ElementRareData::ensureResizeObserverData()
70 {
71 if (!m_resizeObserverData)
72 m_resizeObserverData = new ResizeObservationSet();
73 return *m_resizeObserverData;
74 }
75
69 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData) 76 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData)
70 { 77 {
71 visitor->trace(m_dataset); 78 visitor->trace(m_dataset);
72 visitor->trace(m_classList); 79 visitor->trace(m_classList);
73 visitor->trace(m_shadow); 80 visitor->trace(m_shadow);
74 visitor->trace(m_attributeMap); 81 visitor->trace(m_attributeMap);
75 visitor->trace(m_attrNodeList); 82 visitor->trace(m_attrNodeList);
76 visitor->trace(m_elementAnimations); 83 visitor->trace(m_elementAnimations);
77 visitor->trace(m_cssomWrapper); 84 visitor->trace(m_cssomWrapper);
78 visitor->trace(m_cssomMapWrapper); 85 visitor->trace(m_cssomMapWrapper);
79 visitor->trace(m_pseudoElementData); 86 visitor->trace(m_pseudoElementData);
80 visitor->trace(m_customElementDefinition); 87 visitor->trace(m_customElementDefinition);
81 visitor->trace(m_intersectionObserverData); 88 visitor->trace(m_intersectionObserverData);
89 visitor->trace(m_resizeObserverData);
82 NodeRareData::traceAfterDispatch(visitor); 90 NodeRareData::traceAfterDispatch(visitor);
83 } 91 }
84 92
85 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(ElementRareData) 93 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(ElementRareData)
86 { 94 {
87 visitor->traceWrappers(m_attributeMap); 95 visitor->traceWrappers(m_attributeMap);
88 visitor->traceWrappers(m_dataset); 96 visitor->traceWrappers(m_dataset);
89 visitor->traceWrappers(m_classList); 97 visitor->traceWrappers(m_classList);
90 NodeRareData::traceWrappersAfterDispatch(visitor); 98 NodeRareData::traceWrappersAfterDispatch(visitor);
91 } 99 }
92 100
93 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small"); 101 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small");
94 102
95 } // namespace blink 103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698