| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2014 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 #if COMPILER(MSVC) | 118 #if COMPILER(MSVC) |
| 119 #pragma warning(push) | 119 #pragma warning(push) |
| 120 #pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" war
ning | 120 #pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" war
ning |
| 121 #endif | 121 #endif |
| 122 | 122 |
| 123 // SharableElementData is managed by ElementDataCache and is produced by | 123 // SharableElementData is managed by ElementDataCache and is produced by |
| 124 // the parser during page load for elements that have identical attributes. This | 124 // the parser during page load for elements that have identical attributes. This |
| 125 // is a memory optimization since it's very common for many elements to have | 125 // is a memory optimization since it's very common for many elements to have |
| 126 // duplicate sets of attributes (ex. the same classes). | 126 // duplicate sets of attributes (ex. the same classes). |
| 127 class ShareableElementData FINAL : public ElementData { | 127 class ShareableElementData final : public ElementData { |
| 128 public: | 128 public: |
| 129 static PassRefPtrWillBeRawPtr<ShareableElementData> createWithAttributes(con
st Vector<Attribute>&); | 129 static PassRefPtrWillBeRawPtr<ShareableElementData> createWithAttributes(con
st Vector<Attribute>&); |
| 130 | 130 |
| 131 explicit ShareableElementData(const Vector<Attribute>&); | 131 explicit ShareableElementData(const Vector<Attribute>&); |
| 132 explicit ShareableElementData(const UniqueElementData&); | 132 explicit ShareableElementData(const UniqueElementData&); |
| 133 ~ShareableElementData(); | 133 ~ShareableElementData(); |
| 134 | 134 |
| 135 void traceAfterDispatch(Visitor* visitor) { ElementData::traceAfterDispatch(
visitor); } | 135 void traceAfterDispatch(Visitor* visitor) { ElementData::traceAfterDispatch(
visitor); } |
| 136 | 136 |
| 137 // Add support for placement new as ShareableElementData is not allocated | 137 // Add support for placement new as ShareableElementData is not allocated |
| (...skipping 16 matching lines...) Expand all Loading... |
| 154 #if COMPILER(MSVC) | 154 #if COMPILER(MSVC) |
| 155 #pragma warning(pop) | 155 #pragma warning(pop) |
| 156 #endif | 156 #endif |
| 157 | 157 |
| 158 // UniqueElementData is created when an element needs to mutate its attributes | 158 // UniqueElementData is created when an element needs to mutate its attributes |
| 159 // or gains presentation attribute style (ex. width="10"). It does not need to | 159 // or gains presentation attribute style (ex. width="10"). It does not need to |
| 160 // be created to fill in values in the ElementData that are derived from | 160 // be created to fill in values in the ElementData that are derived from |
| 161 // attributes. For example populating the m_inlineStyle from the style attribute | 161 // attributes. For example populating the m_inlineStyle from the style attribute |
| 162 // doesn't require a UniqueElementData as all elements with the same style | 162 // doesn't require a UniqueElementData as all elements with the same style |
| 163 // attribute will have the same inline style. | 163 // attribute will have the same inline style. |
| 164 class UniqueElementData FINAL : public ElementData { | 164 class UniqueElementData final : public ElementData { |
| 165 public: | 165 public: |
| 166 static PassRefPtrWillBeRawPtr<UniqueElementData> create(); | 166 static PassRefPtrWillBeRawPtr<UniqueElementData> create(); |
| 167 PassRefPtrWillBeRawPtr<ShareableElementData> makeShareableCopy() const; | 167 PassRefPtrWillBeRawPtr<ShareableElementData> makeShareableCopy() const; |
| 168 | 168 |
| 169 MutableAttributeCollection attributes(); | 169 MutableAttributeCollection attributes(); |
| 170 AttributeCollection attributes() const; | 170 AttributeCollection attributes() const; |
| 171 | 171 |
| 172 UniqueElementData(); | 172 UniqueElementData(); |
| 173 explicit UniqueElementData(const ShareableElementData&); | 173 explicit UniqueElementData(const ShareableElementData&); |
| 174 explicit UniqueElementData(const UniqueElementData&); | 174 explicit UniqueElementData(const UniqueElementData&); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 inline MutableAttributeCollection UniqueElementData::attributes() | 221 inline MutableAttributeCollection UniqueElementData::attributes() |
| 222 { | 222 { |
| 223 return MutableAttributeCollection(m_attributeVector); | 223 return MutableAttributeCollection(m_attributeVector); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| 227 | 227 |
| 228 #endif // ElementData_h | 228 #endif // ElementData_h |
| OLD | NEW |