Move inline style logic from ElementAttributeData to StyledElement.
<http://webkit.org/b/102120>
Reviewed by Antti Koivisto.
Source/WebCore:
Move all the logic dealing with element inline style from ElementAttributeData to StyledElement.
No difference in behavior, just making ElementAttributeData dumber.
* css/StylePropertySet.cpp:
* css/StylePropertySet.h:
(WebCore::StylePropertySet::hasCSSOMWrapper):
(WebCore::StylePropertySet::cssStyleDeclaration):
Added as complements to ensureCSSStyleDeclaration() for the case where we don't want
to instantiate a CSSOM wrapper unnecessarily.
* dom/StyledElement.h:
(WebCore::StyledElement::inlineStyle):
* dom/ElementAttributeData.cpp:
(WebCore::ImmutableElementAttributeData::ImmutableElementAttributeData):
(WebCore::MutableElementAttributeData::MutableElementAttributeData):
(WebCore::ElementAttributeData::reportMemoryUsage):
* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::inlineStyle):
(ElementAttributeData):
Renamed m_inlineStyleDecl to m_inlineStyle. Finally.
* dom/StyledElement.cpp:
(WebCore::StyledElement::~StyledElement):
Detach the CSSOM wrapper from the inline style if there is one.
(WebCore::StyledElement::ensureMutableInlineStyle):
(WebCore::StyledElement::style):
Renamed ensureInlineStyle() to ensureMutableInlineStyle() since that's what it
actually does. Update call sites accordingly.
(WebCore::StyledElement::inlineStyleCSSOMWrapper):
Added helper to get the CSSOM wrapper for the element's inline style if there is one.
(WebCore::StyledElement::styleAttributeChanged):
Do the work to parse/update/replace the inline style attribute here instead of
in an ElementAttributeData method.
(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::removeInlineStyleProperty):
(WebCore::StyledElement::removeAllInlineStyleProperties):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
* html/canvas/CanvasStyle.cpp:
(WebCore::currentColor):
s/ensureInlineStyle/ensureMutableInlineStyle/
Source/WebKit/qt:
* Api/qwebelement.cpp:
(QWebElement::styleProperty):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h
index 533f170..8334521 100644
--- a/Source/WebCore/dom/StyledElement.h
+++ b/Source/WebCore/dom/StyledElement.h
@@ -40,8 +40,8 @@
virtual const StylePropertySet* additionalPresentationAttributeStyle() { return 0; }
void invalidateStyleAttribute();
- const StylePropertySet* inlineStyle() const { return attributeData() ? attributeData()->inlineStyle() : 0; }
- StylePropertySet* ensureInlineStyle() { return mutableAttributeData()->ensureMutableInlineStyle(this); }
+ const StylePropertySet* inlineStyle() const { return attributeData() ? attributeData()->m_inlineStyle.get() : 0; }
+ StylePropertySet* ensureMutableInlineStyle();
// Unlike StylePropertySet setters, these implement invalidation.
bool setInlineStyleProperty(CSSPropertyID, int identifier, bool important = false);
@@ -77,6 +77,7 @@
private:
virtual void updateStyleAttribute() const;
void inlineStyleChanged();
+ PropertySetCSSStyleDeclaration* inlineStyleCSSOMWrapper();
void makePresentationAttributeCacheKey(PresentationAttributeCacheKey&) const;
void rebuildPresentationAttributeStyle();