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 */ |
| 42 |
31 #include "config.h" | 43 #include "config.h" |
32 #include "core/dom/ElementRareData.h" | 44 #include "core/dom/ElementRareData.h" |
33 | 45 #include "core/dom/IntersectionObservation.h" |
34 #include "core/style/ComputedStyle.h" | 46 #include "core/style/ComputedStyle.h" |
35 | 47 |
36 namespace blink { | 48 namespace blink { |
37 | 49 |
38 struct SameSizeAsElementRareData : NodeRareData { | 50 struct SameSizeAsElementRareData : NodeRareData { |
39 short indices[2]; | 51 short indices[2]; |
40 LayoutSize sizeForResizing; | 52 LayoutSize sizeForResizing; |
41 IntSize scrollOffset; | 53 IntSize scrollOffset; |
42 void* pointer; | 54 void* pointer; |
43 RawPtrWillBeMember<void*> willbeMember[11]; | 55 RawPtrWillBeMember<void*> willbeMember[12]; |
44 PersistentWillBeMember<void*> persistent[1]; | 56 PersistentWillBeMember<void*> persistent[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 |