Title: [157575] trunk/Source/WebCore
Revision
157575
Author
[email protected]
Date
2013-10-17 08:17:23 -0700 (Thu, 17 Oct 2013)

Log Message

StyleRuleFoo::mutableProperties() should return a reference.
<https://webkit.org/b/122962>

The mutableProperties() functions always return objects, so make
them return MutableStylePropertySet&.

Also tweaked the StyleRuleCSSStyleDeclaration constructor to take
references to both the properties and the owner rule since both
are required.

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157574 => 157575)


--- trunk/Source/WebCore/ChangeLog	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/ChangeLog	2013-10-17 15:17:23 UTC (rev 157575)
@@ -1,3 +1,17 @@
+2013-10-17  Andreas Kling  <[email protected]>
+
+        StyleRuleFoo::mutableProperties() should return a reference.
+        <https://webkit.org/b/122962>
+
+        The mutableProperties() functions always return objects, so make
+        them return MutableStylePropertySet&.
+
+        Also tweaked the StyleRuleCSSStyleDeclaration constructor to take
+        references to both the properties and the owner rule since both
+        are required.
+
+        Reviewed by Antti Koivisto.
+
 2013-10-17  Hans Muller  <[email protected]>
 
         [CSS Shapes] Improve the performance of image valued shapes with large shape-margins

Modified: trunk/Source/WebCore/css/CSSFontFaceRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/CSSFontFaceRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -44,7 +44,7 @@
 CSSStyleDeclaration* CSSFontFaceRule::style()
 {
     if (!m_propertiesCSSOMWrapper)
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_fontFaceRule->mutableProperties(), *this);
     return m_propertiesCSSOMWrapper.get();
 }
 

Modified: trunk/Source/WebCore/css/CSSPageRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/CSSPageRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/CSSPageRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -49,7 +49,7 @@
 CSSStyleDeclaration* CSSPageRule::style()
 {
     if (!m_propertiesCSSOMWrapper)
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_pageRule->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_pageRule->mutableProperties(), *this);
     return m_propertiesCSSOMWrapper.get();
 }
 

Modified: trunk/Source/WebCore/css/CSSStyleRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/CSSStyleRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/CSSStyleRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -61,7 +61,7 @@
 CSSStyleDeclaration* CSSStyleRule::style()
 {
     if (!m_propertiesCSSOMWrapper) {
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleRule->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleRule->mutableProperties(), *this);
     }
     return m_propertiesCSSOMWrapper.get();
 }

Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -295,10 +295,10 @@
     return m_propertySet->mutableCopy();
 }
     
-StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertySet* propertySet, CSSRule* parentRule)
-    : PropertySetCSSStyleDeclaration(propertySet)
+StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertySet& propertySet, CSSRule& parentRule)
+    : PropertySetCSSStyleDeclaration(&propertySet)
     , m_refCount(1)
-    , m_parentRule(parentRule) 
+    , m_parentRule(&parentRule)
 {
     m_propertySet->ref();
 }
@@ -341,11 +341,10 @@
     return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
 }
 
-void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet* propertySet)
+void StyleRuleCSSStyleDeclaration::reattach(MutableStylePropertySet& propertySet)
 {
-    ASSERT(propertySet);
     m_propertySet->deref();
-    m_propertySet = propertySet;
+    m_propertySet = &propertySet;
     m_propertySet->ref();
 }
 

Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (157574 => 157575)


--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h	2013-10-17 15:17:23 UTC (rev 157575)
@@ -84,7 +84,7 @@
 class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration
 {
 public:
-    static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertySet* propertySet, CSSRule* parentRule)
+    static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertySet& propertySet, CSSRule& parentRule)
     {
         return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule));
     }
@@ -95,10 +95,10 @@
     virtual void ref() OVERRIDE;
     virtual void deref() OVERRIDE;
 
-    void reattach(MutableStylePropertySet*);
+    void reattach(MutableStylePropertySet&);
 
 private:
-    StyleRuleCSSStyleDeclaration(MutableStylePropertySet*, CSSRule*);
+    StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule&);
 
     virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
 

Modified: trunk/Source/WebCore/css/StyleRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/StyleRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -249,11 +249,11 @@
 {
 }
 
-MutableStylePropertySet* StyleRule::mutableProperties()
+MutableStylePropertySet& StyleRule::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 
 PassRefPtr<StyleRule> StyleRule::create(int sourceLine, const Vector<const CSSSelector*>& selectors, PassRef<StylePropertySet> properties)
@@ -310,11 +310,11 @@
 {
 }
 
-MutableStylePropertySet* StyleRulePage::mutableProperties()
+MutableStylePropertySet& StyleRulePage::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 
 StyleRuleFontFace::StyleRuleFontFace(PassRef<StylePropertySet> properties)
@@ -333,11 +333,11 @@
 {
 }
 
-MutableStylePropertySet* StyleRuleFontFace::mutableProperties()
+MutableStylePropertySet& StyleRuleFontFace::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 
 StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase> >& adoptRule)
@@ -425,11 +425,11 @@
 {
 }
 
-MutableStylePropertySet* StyleRuleViewport::mutableProperties()
+MutableStylePropertySet& StyleRuleViewport::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 #endif // ENABLE(CSS_DEVICE_ADAPTATION)
 
@@ -452,11 +452,11 @@
 {
 }
 
-MutableStylePropertySet* StyleRuleFilter::mutableProperties()
+MutableStylePropertySet& StyleRuleFilter::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 
 #endif // ENABLE(CSS_SHADERS)

Modified: trunk/Source/WebCore/css/StyleRule.h (157574 => 157575)


--- trunk/Source/WebCore/css/StyleRule.h	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/StyleRule.h	2013-10-17 15:17:23 UTC (rev 157575)
@@ -127,7 +127,7 @@
 
     const CSSSelectorList& selectorList() const { return m_selectorList; }
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
     
     void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
     void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
@@ -162,7 +162,7 @@
     ~StyleRuleFontFace();
 
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
 
     PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFontFace(*this)); }
 
@@ -182,7 +182,7 @@
 
     const CSSSelector* selector() const { return m_selectorList.first(); }    
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
 
     void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
     void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
@@ -293,7 +293,7 @@
     ~StyleRuleViewport();
 
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
 
     PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleViewport(*this)); }
 
@@ -338,7 +338,7 @@
     const String& filterName() const { return m_filterName; }
 
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
 
     PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilter(*this)); }
 

Modified: trunk/Source/WebCore/css/ViewportStyleResolver.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/ViewportStyleResolver.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/ViewportStyleResolver.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -54,18 +54,18 @@
 
 void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule)
 {
-    StylePropertySet* propertySet = viewportRule->mutableProperties();
+    StylePropertySet& propertySet = viewportRule->mutableProperties();
 
-    unsigned propertyCount = propertySet->propertyCount();
+    unsigned propertyCount = propertySet.propertyCount();
     if (!propertyCount)
         return;
 
     if (!m_propertySet) {
-        m_propertySet = propertySet->mutableCopy();
+        m_propertySet = propertySet.mutableCopy();
         return;
     }
 
-    m_propertySet->mergeAndOverrideOnConflict(*propertySet);
+    m_propertySet->mergeAndOverrideOnConflict(propertySet);
 }
 
 void ViewportStyleResolver::clearDocument()

Modified: trunk/Source/WebCore/css/WebKitCSSFilterRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/WebKitCSSFilterRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/WebKitCSSFilterRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -54,7 +54,7 @@
 CSSStyleDeclaration* WebKitCSSFilterRule::style()
 {
     if (!m_propertiesCSSOMWrapper)
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_filterRule->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_filterRule->mutableProperties(), *this);
     return m_propertiesCSSOMWrapper.get();
 }
 

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -42,11 +42,11 @@
 {
 }
 
-MutableStylePropertySet* StyleKeyframe::mutableProperties()
+MutableStylePropertySet& StyleKeyframe::mutableProperties()
 {
     if (!m_properties->isMutable())
         m_properties = m_properties->mutableCopy();
-    return &static_cast<MutableStylePropertySet&>(m_properties.get());
+    return static_cast<MutableStylePropertySet&>(m_properties.get());
 }
 
 /* static */
@@ -108,7 +108,7 @@
 CSSStyleDeclaration* WebKitCSSKeyframeRule::style()
 {
     if (!m_propertiesCSSOMWrapper)
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), *this);
     return m_propertiesCSSOMWrapper.get();
 }
 

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h (157574 => 157575)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h	2013-10-17 15:17:23 UTC (rev 157575)
@@ -50,7 +50,7 @@
     void getKeys(Vector<double>& keys) const   { parseKeyString(m_key, keys); }
     
     const StylePropertySet& properties() const { return m_properties.get(); }
-    MutableStylePropertySet* mutableProperties();
+    MutableStylePropertySet& mutableProperties();
     
     String cssText() const;
 

Modified: trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp (157574 => 157575)


--- trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/css/WebKitCSSViewportRule.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -55,7 +55,7 @@
 CSSStyleDeclaration* WebKitCSSViewportRule::style()
 {
     if (!m_propertiesCSSOMWrapper)
-        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_viewportRule->mutableProperties(), this);
+        m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_viewportRule->mutableProperties(), *this);
 
     return m_propertiesCSSOMWrapper.get();
 }

Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (157574 => 157575)


--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2013-10-17 14:45:47 UTC (rev 157574)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2013-10-17 15:17:23 UTC (rev 157575)
@@ -65,7 +65,7 @@
 {    
     CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name);
     if (propId > 0) {
-        m_fontFaceRule->mutableProperties()->setProperty(propId, value, false);
+        m_fontFaceRule->mutableProperties().setProperty(propId, value, false);
         rebuildFontFace();
         return;
     }
@@ -248,7 +248,7 @@
         return;
 
     // Parse in-memory CSS rules
-    m_fontFaceRule->mutableProperties()->addParsedProperty(CSSProperty(CSSPropertySrc, list));
+    m_fontFaceRule->mutableProperties().addParsedProperty(CSSProperty(CSSPropertySrc, list));
 
     if (describesParentFont) {    
         // Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves.
@@ -285,7 +285,7 @@
     if (rootParent.inDocument()) {
         m_fontElement = 0;
         document().accessSVGExtensions()->unregisterSVGFontFaceElement(this);
-        m_fontFaceRule->mutableProperties()->clear();
+        m_fontFaceRule->mutableProperties().clear();
 
         document().styleResolverChanged(DeferRecalcStyle);
     } else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to