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

Unified Diff: third_party/WebKit/Source/core/dom/ElementRareData.h

Issue 1943803002: Move PseudoElements storage to their own object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/ElementRareData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/ElementRareData.h
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h
index f5570bb1d8ff1455c4704b53a5d1adf632199c24..6ab989fd8ef8534f8ac14eb6d2d7fa9a56d7e396 100644
--- a/third_party/WebKit/Source/core/dom/ElementRareData.h
+++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -31,6 +31,7 @@
#include "core/dom/NodeIntersectionObserverData.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/PseudoElement.h"
+#include "core/dom/PseudoElementData.h"
#include "core/dom/custom/V0CustomElementDefinition.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/html/ClassList.h"
@@ -163,10 +164,7 @@ private:
RefPtr<ComputedStyle> m_computedStyle;
Member<V0CustomElementDefinition> m_customElementDefinition;
- Member<PseudoElement> m_generatedBefore;
- Member<PseudoElement> m_generatedAfter;
- Member<PseudoElement> m_generatedFirstLetter;
- Member<PseudoElement> m_backdrop;
+ Member<PseudoElementData> m_pseudoElementData;
explicit ElementRareData(LayoutObject*);
};
@@ -187,67 +185,34 @@ inline ElementRareData::ElementRareData(LayoutObject* layoutObject)
inline ElementRareData::~ElementRareData()
{
- DCHECK(!m_generatedBefore);
- DCHECK(!m_generatedAfter);
- DCHECK(!m_generatedFirstLetter);
- DCHECK(!m_backdrop);
+ DCHECK(!m_pseudoElementData);
}
inline bool ElementRareData::hasPseudoElements() const
{
- return m_generatedBefore || m_generatedAfter || m_backdrop || m_generatedFirstLetter;
+ return (m_pseudoElementData && m_pseudoElementData->hasPseudoElements());
}
inline void ElementRareData::clearPseudoElements()
{
- setPseudoElement(PseudoIdBefore, nullptr);
- setPseudoElement(PseudoIdAfter, nullptr);
- setPseudoElement(PseudoIdBackdrop, nullptr);
- setPseudoElement(PseudoIdFirstLetter, nullptr);
+ if (m_pseudoElementData) {
+ m_pseudoElementData->clearPseudoElements();
+ m_pseudoElementData.clear();
+ }
}
inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PseudoElement* element)
{
- switch (pseudoId) {
- case PseudoIdBefore:
- if (m_generatedBefore)
- m_generatedBefore->dispose();
- m_generatedBefore = element;
- break;
- case PseudoIdAfter:
- if (m_generatedAfter)
- m_generatedAfter->dispose();
- m_generatedAfter = element;
- break;
- case PseudoIdBackdrop:
- if (m_backdrop)
- m_backdrop->dispose();
- m_backdrop = element;
- break;
- case PseudoIdFirstLetter:
- if (m_generatedFirstLetter)
- m_generatedFirstLetter->dispose();
- m_generatedFirstLetter = element;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
+ if (!m_pseudoElementData)
+ m_pseudoElementData = PseudoElementData::create();
+ m_pseudoElementData->setPseudoElement(pseudoId, element);
}
inline PseudoElement* ElementRareData::pseudoElement(PseudoId pseudoId) const
{
- switch (pseudoId) {
- case PseudoIdBefore:
- return m_generatedBefore.get();
- case PseudoIdAfter:
- return m_generatedAfter.get();
- case PseudoIdBackdrop:
- return m_backdrop.get();
- case PseudoIdFirstLetter:
- return m_generatedFirstLetter.get();
- default:
- return 0;
- }
+ if (!m_pseudoElementData)
+ return nullptr;
+ return m_pseudoElementData->pseudoElement(pseudoId);
}
inline void ElementRareData::incrementCompositorProxiedProperties(uint32_t properties)
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/ElementRareData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698