OLD | NEW |
---|---|
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 10 matching lines...) Expand all Loading... | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 /* STATIC_ASSERT_STRUCT_SIZES_EQUAL | |
32 | |
33 Compile-time assert that a struct has the expected size. The old way to do t his is: | |
34 | |
35 static_assert(sizeof(StructWithSameSize) == sizeof(Struct)), "Wrong size!"); | |
36 | |
37 However, static_assert will not emit the actual sizes of the structs in quest ion, and | |
38 there is no way to use an interpolated string in the error message. By contr ast, | |
39 STATIC_ASSERT_STRUCT_SIZES_EQUAL will ensure that the actual sizes of the com pared structs | |
40 will appear in the compiler error output. | |
41 */ | |
esprehn
2015/12/12 00:14:13
this comment belongs with that macro, not in Eleme
szager1
2015/12/16 19:15:34
This was meant for a separate patch, removing it f
| |
42 | |
31 #include "config.h" | 43 #include "config.h" |
32 #include "core/dom/ElementRareData.h" | 44 #include "core/dom/ElementRareData.h" |
33 | |
34 #include "core/dom/CompositorProxiedPropertySet.h" | 45 #include "core/dom/CompositorProxiedPropertySet.h" |
46 #include "core/dom/IntersectionObservation.h" | |
35 #include "core/style/ComputedStyle.h" | 47 #include "core/style/ComputedStyle.h" |
36 | 48 |
37 namespace blink { | 49 namespace blink { |
38 | 50 |
39 struct SameSizeAsElementRareData : NodeRareData { | 51 struct SameSizeAsElementRareData : NodeRareData { |
40 short indices[1]; | 52 short indices[1]; |
41 LayoutSize sizeForResizing; | 53 LayoutSize sizeForResizing; |
42 IntSize scrollOffset; | 54 IntSize scrollOffset; |
43 void* pointers[13]; | 55 void* pointers[14]; |
44 PersistentWillBeMember<void*> member[1]; | 56 PersistentWillBeMember<void*> member[3]; |
45 }; | 57 }; |
46 | 58 |
47 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement) | 59 CSSStyleDeclaration& ElementRareData::ensureInlineCSSStyleDeclaration(Element* o wnerElement) |
48 { | 60 { |
49 if (!m_cssomWrapper) | 61 if (!m_cssomWrapper) |
50 m_cssomWrapper = adoptPtrWillBeNoop(new InlineCSSStyleDeclaration(ownerE lement)); | 62 m_cssomWrapper = adoptPtrWillBeNoop(new InlineCSSStyleDeclaration(ownerE lement)); |
51 return *m_cssomWrapper; | 63 return *m_cssomWrapper; |
52 } | 64 } |
53 | 65 |
54 AttrNodeList& ElementRareData::ensureAttrNodeList() | 66 AttrNodeList& ElementRareData::ensureAttrNodeList() |
55 { | 67 { |
56 if (!m_attrNodeList) | 68 if (!m_attrNodeList) |
57 m_attrNodeList = adoptPtrWillBeNoop(new AttrNodeList); | 69 m_attrNodeList = adoptPtrWillBeNoop(new AttrNodeList); |
58 return *m_attrNodeList; | 70 return *m_attrNodeList; |
59 } | 71 } |
60 | 72 |
61 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData) | 73 DEFINE_TRACE_AFTER_DISPATCH(ElementRareData) |
62 { | 74 { |
63 visitor->trace(m_dataset); | 75 visitor->trace(m_dataset); |
64 visitor->trace(m_classList); | 76 visitor->trace(m_classList); |
65 visitor->trace(m_shadow); | 77 visitor->trace(m_shadow); |
66 visitor->trace(m_attributeMap); | 78 visitor->trace(m_attributeMap); |
67 #if ENABLE(OILPAN) | 79 #if ENABLE(OILPAN) |
68 visitor->trace(m_attrNodeList); | 80 visitor->trace(m_attrNodeList); |
69 #endif | 81 #endif |
70 visitor->trace(m_elementAnimations); | 82 visitor->trace(m_elementAnimations); |
71 visitor->trace(m_cssomWrapper); | 83 visitor->trace(m_cssomWrapper); |
84 visitor->trace(m_weakPointerFactory); | |
72 visitor->trace(m_customElementDefinition); | 85 visitor->trace(m_customElementDefinition); |
73 visitor->trace(m_generatedBefore); | 86 visitor->trace(m_generatedBefore); |
74 visitor->trace(m_generatedAfter); | 87 visitor->trace(m_generatedAfter); |
75 visitor->trace(m_generatedFirstLetter); | 88 visitor->trace(m_generatedFirstLetter); |
76 visitor->trace(m_backdrop); | 89 visitor->trace(m_backdrop); |
90 visitor->trace(m_intersectionObservers); | |
91 visitor->trace(m_intersectionObservations); | |
77 NodeRareData::traceAfterDispatch(visitor); | 92 NodeRareData::traceAfterDispatch(visitor); |
78 } | 93 } |
79 | 94 |
80 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small"); | 95 static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "Ele mentRareData should stay small"); |
81 | 96 |
82 } // namespace blink | 97 } // namespace blink |
OLD | NEW |