Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> | 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 #include "core/animation/ElementAnimations.h" | 25 #include "core/animation/ElementAnimations.h" |
| 26 #include "core/css/cssom/InlineStylePropertyMap.h" | 26 #include "core/css/cssom/InlineStylePropertyMap.h" |
| 27 #include "core/dom/Attr.h" | 27 #include "core/dom/Attr.h" |
| 28 #include "core/dom/CompositorProxiedPropertySet.h" | 28 #include "core/dom/CompositorProxiedPropertySet.h" |
| 29 #include "core/dom/DatasetDOMStringMap.h" | 29 #include "core/dom/DatasetDOMStringMap.h" |
| 30 #include "core/dom/NamedNodeMap.h" | 30 #include "core/dom/NamedNodeMap.h" |
| 31 #include "core/dom/NodeIntersectionObserverData.h" | 31 #include "core/dom/NodeIntersectionObserverData.h" |
| 32 #include "core/dom/NodeRareData.h" | 32 #include "core/dom/NodeRareData.h" |
| 33 #include "core/dom/PseudoElement.h" | 33 #include "core/dom/PseudoElement.h" |
| 34 #include "core/dom/PseudoElementData.h" | |
| 34 #include "core/dom/custom/V0CustomElementDefinition.h" | 35 #include "core/dom/custom/V0CustomElementDefinition.h" |
| 35 #include "core/dom/shadow/ElementShadow.h" | 36 #include "core/dom/shadow/ElementShadow.h" |
| 36 #include "core/html/ClassList.h" | 37 #include "core/html/ClassList.h" |
| 37 #include "core/style/StyleInheritedData.h" | 38 #include "core/style/StyleInheritedData.h" |
| 38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 39 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
| 40 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 Member<InlineCSSStyleDeclaration> m_cssomWrapper; | 157 Member<InlineCSSStyleDeclaration> m_cssomWrapper; |
| 157 Member<InlineStylePropertyMap> m_cssomMapWrapper; | 158 Member<InlineStylePropertyMap> m_cssomMapWrapper; |
| 158 OwnPtr<CompositorProxiedPropertySet> m_proxiedProperties; | 159 OwnPtr<CompositorProxiedPropertySet> m_proxiedProperties; |
| 159 | 160 |
| 160 Member<ElementAnimations> m_elementAnimations; | 161 Member<ElementAnimations> m_elementAnimations; |
| 161 Member<NodeIntersectionObserverData> m_intersectionObserverData; | 162 Member<NodeIntersectionObserverData> m_intersectionObserverData; |
| 162 | 163 |
| 163 RefPtr<ComputedStyle> m_computedStyle; | 164 RefPtr<ComputedStyle> m_computedStyle; |
| 164 Member<V0CustomElementDefinition> m_customElementDefinition; | 165 Member<V0CustomElementDefinition> m_customElementDefinition; |
| 165 | 166 |
| 166 Member<PseudoElement> m_generatedBefore; | 167 Member<PseudoElementData> m_pseudoElementData; |
| 167 Member<PseudoElement> m_generatedAfter; | |
| 168 Member<PseudoElement> m_generatedFirstLetter; | |
| 169 Member<PseudoElement> m_backdrop; | |
| 170 | 168 |
| 171 explicit ElementRareData(LayoutObject*); | 169 explicit ElementRareData(LayoutObject*); |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 inline LayoutSize defaultMinimumSizeForResizing() | 172 inline LayoutSize defaultMinimumSizeForResizing() |
| 175 { | 173 { |
| 176 return LayoutSize(LayoutUnit::max(), LayoutUnit::max()); | 174 return LayoutSize(LayoutUnit::max(), LayoutUnit::max()); |
| 177 } | 175 } |
| 178 | 176 |
| 179 inline ElementRareData::ElementRareData(LayoutObject* layoutObject) | 177 inline ElementRareData::ElementRareData(LayoutObject* layoutObject) |
| 180 : NodeRareData(layoutObject) | 178 : NodeRareData(layoutObject) |
| 181 , m_tabindex(0) | 179 , m_tabindex(0) |
| 182 , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) | 180 , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) |
| 183 , m_classList(nullptr) | 181 , m_classList(nullptr) |
| 184 { | 182 { |
| 185 m_isElementRareData = true; | 183 m_isElementRareData = true; |
| 186 } | 184 } |
| 187 | 185 |
| 188 inline ElementRareData::~ElementRareData() | 186 inline ElementRareData::~ElementRareData() |
| 189 { | 187 { |
| 190 DCHECK(!m_generatedBefore); | 188 DCHECK(!m_pseudoElementData); |
| 191 DCHECK(!m_generatedAfter); | |
| 192 DCHECK(!m_generatedFirstLetter); | |
| 193 DCHECK(!m_backdrop); | |
| 194 } | 189 } |
| 195 | 190 |
| 196 inline bool ElementRareData::hasPseudoElements() const | 191 inline bool ElementRareData::hasPseudoElements() const |
| 197 { | 192 { |
| 198 return m_generatedBefore || m_generatedAfter || m_backdrop || m_generatedFir stLetter; | 193 return (m_pseudoElementData && m_pseudoElementData->hasPseudoElements()); |
| 199 } | 194 } |
| 200 | 195 |
| 201 inline void ElementRareData::clearPseudoElements() | 196 inline void ElementRareData::clearPseudoElements() |
| 202 { | 197 { |
| 203 setPseudoElement(PseudoIdBefore, nullptr); | 198 m_pseudoElementData.clear(); |
|
sof
2016/05/06 05:22:15
Make this
if (m_pseudoElementData) {
m_ps
ramya.v
2016/05/06 06:16:06
Done.
| |
| 204 setPseudoElement(PseudoIdAfter, nullptr); | |
| 205 setPseudoElement(PseudoIdBackdrop, nullptr); | |
| 206 setPseudoElement(PseudoIdFirstLetter, nullptr); | |
| 207 } | 199 } |
| 208 | 200 |
| 209 inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PseudoElement* element) | 201 inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PseudoElement* element) |
| 210 { | 202 { |
| 211 switch (pseudoId) { | 203 if (!m_pseudoElementData) |
| 212 case PseudoIdBefore: | 204 m_pseudoElementData = PseudoElementData::create(); |
| 213 if (m_generatedBefore) | 205 m_pseudoElementData->setPseudoElement(pseudoId, element); |
| 214 m_generatedBefore->dispose(); | |
| 215 m_generatedBefore = element; | |
| 216 break; | |
| 217 case PseudoIdAfter: | |
| 218 if (m_generatedAfter) | |
| 219 m_generatedAfter->dispose(); | |
| 220 m_generatedAfter = element; | |
| 221 break; | |
| 222 case PseudoIdBackdrop: | |
| 223 if (m_backdrop) | |
| 224 m_backdrop->dispose(); | |
| 225 m_backdrop = element; | |
| 226 break; | |
| 227 case PseudoIdFirstLetter: | |
| 228 if (m_generatedFirstLetter) | |
| 229 m_generatedFirstLetter->dispose(); | |
| 230 m_generatedFirstLetter = element; | |
| 231 break; | |
| 232 default: | |
| 233 ASSERT_NOT_REACHED(); | |
| 234 } | |
| 235 } | 206 } |
| 236 | 207 |
| 237 inline PseudoElement* ElementRareData::pseudoElement(PseudoId pseudoId) const | 208 inline PseudoElement* ElementRareData::pseudoElement(PseudoId pseudoId) const |
| 238 { | 209 { |
| 239 switch (pseudoId) { | 210 if (!m_pseudoElementData) |
| 240 case PseudoIdBefore: | 211 return nullptr; |
| 241 return m_generatedBefore.get(); | 212 return m_pseudoElementData->pseudoElement(pseudoId); |
| 242 case PseudoIdAfter: | |
| 243 return m_generatedAfter.get(); | |
| 244 case PseudoIdBackdrop: | |
| 245 return m_backdrop.get(); | |
| 246 case PseudoIdFirstLetter: | |
| 247 return m_generatedFirstLetter.get(); | |
| 248 default: | |
| 249 return 0; | |
| 250 } | |
| 251 } | 213 } |
| 252 | 214 |
| 253 inline void ElementRareData::incrementCompositorProxiedProperties(uint32_t prope rties) | 215 inline void ElementRareData::incrementCompositorProxiedProperties(uint32_t prope rties) |
| 254 { | 216 { |
| 255 ensureCompositorProxiedPropertySet().increment(properties); | 217 ensureCompositorProxiedPropertySet().increment(properties); |
| 256 } | 218 } |
| 257 | 219 |
| 258 inline void ElementRareData::decrementCompositorProxiedProperties(uint32_t prope rties) | 220 inline void ElementRareData::decrementCompositorProxiedProperties(uint32_t prope rties) |
| 259 { | 221 { |
| 260 m_proxiedProperties->decrement(properties); | 222 m_proxiedProperties->decrement(properties); |
| 261 if (m_proxiedProperties->isEmpty()) | 223 if (m_proxiedProperties->isEmpty()) |
| 262 clearCompositorProxiedPropertySet(); | 224 clearCompositorProxiedPropertySet(); |
| 263 } | 225 } |
| 264 | 226 |
| 265 inline CompositorProxiedPropertySet& ElementRareData::ensureCompositorProxiedPro pertySet() | 227 inline CompositorProxiedPropertySet& ElementRareData::ensureCompositorProxiedPro pertySet() |
| 266 { | 228 { |
| 267 if (!m_proxiedProperties) | 229 if (!m_proxiedProperties) |
| 268 m_proxiedProperties = CompositorProxiedPropertySet::create(); | 230 m_proxiedProperties = CompositorProxiedPropertySet::create(); |
| 269 return *m_proxiedProperties; | 231 return *m_proxiedProperties; |
| 270 } | 232 } |
| 271 | 233 |
| 272 } // namespace blink | 234 } // namespace blink |
| 273 | 235 |
| 274 #endif // ElementRareData_h | 236 #endif // ElementRareData_h |
| OLD | NEW |