Use underlying property set to refcount PropertySetCSSStyleDeclaration
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2012 18:22:24 +0000 (18:22 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2012 18:22:24 +0000 (18:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78257

Reviewed by Andreas Kling.

Clean up the PropertySetCSSStyleDeclaration refcounting. PropertySetCSSStyleDeclaration now
forwards the ref/deref to the underlying StylePropertySet.

Also made CSSComputedStyleDeclaration construction use the standard create() pattern.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::ref):
(WebCore):
(WebCore::CSSComputedStyleDeclaration::deref):
* css/CSSComputedStyleDeclaration.h:
(WebCore::CSSComputedStyleDeclaration::create):
(CSSComputedStyleDeclaration):
(WebCore):
* css/CSSStyleDeclaration.h:
(CSSStyleDeclaration):
* css/StylePropertySet.cpp:
(WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration):
(WebCore):
(WebCore::StylePropertySet::~StylePropertySet):
(WebCore::StylePropertySet::ensureCSSStyleDeclaration):
(WebCore::PropertySetCSSStyleDeclaration::makeMutable):
* css/StylePropertySet.h:
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::highestEmbeddingAncestor):
(WebCore::ApplyStyleCommand::computedFontSize):
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::init):
(WebCore::EditingStyle::removeStyleAddedByNode):
(WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
(WebCore::EditingStyle::triStateOfStyle):
(WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode):
(WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
(WebCore::backgroundColorInEffect):
* editing/Editor.cpp:
(WebCore::Editor::textDirectionForSelection):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getComputedStyleForNode):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getComputedStyle):
* svg/SVGAnimateElement.cpp:
(WebCore::getPropertyValue):
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::baseValueFor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.h
Source/WebCore/css/CSSStyleDeclaration.h
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StylePropertySet.h
Source/WebCore/dom/Position.cpp
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/svg/SVGAnimateElement.cpp
Source/WebCore/svg/animation/SMILTimeContainer.cpp
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/Api/qwebelement.cpp
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index 370aa72..e17490b 100644 (file)
@@ -1,3 +1,56 @@
+2012-02-09  Antti Koivisto  <antti@apple.com>
+
+        Use underlying property set to refcount PropertySetCSSStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=78257
+
+        Reviewed by Andreas Kling.
+
+        Clean up the PropertySetCSSStyleDeclaration refcounting. PropertySetCSSStyleDeclaration now
+        forwards the ref/deref to the underlying StylePropertySet.
+
+        Also made CSSComputedStyleDeclaration construction use the standard create() pattern.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::ref):
+        (WebCore):
+        (WebCore::CSSComputedStyleDeclaration::deref):
+        * css/CSSComputedStyleDeclaration.h:
+        (WebCore::CSSComputedStyleDeclaration::create):
+        (CSSComputedStyleDeclaration):
+        (WebCore):
+        * css/CSSStyleDeclaration.h:
+        (CSSStyleDeclaration):
+        * css/StylePropertySet.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration):
+        (WebCore):
+        (WebCore::StylePropertySet::~StylePropertySet):
+        (WebCore::StylePropertySet::ensureCSSStyleDeclaration):
+        (WebCore::PropertySetCSSStyleDeclaration::makeMutable):
+        * css/StylePropertySet.h:
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
+        (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
+        (WebCore::highestEmbeddingAncestor):
+        (WebCore::ApplyStyleCommand::computedFontSize):
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::init):
+        (WebCore::EditingStyle::removeStyleAddedByNode):
+        (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
+        (WebCore::EditingStyle::triStateOfStyle):
+        (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode):
+        (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
+        (WebCore::backgroundColorInEffect):
+        * editing/Editor.cpp:
+        (WebCore::Editor::textDirectionForSelection):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::getComputedStyleForNode):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::getComputedStyle):
+        * svg/SVGAnimateElement.cpp:
+        (WebCore::getPropertyValue):
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::baseValueFor):
+
 2012-02-10  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [TextPrompt] TAB should complete suggestions up to their common prefix in Console
index d839c53..4cfff6e 100644 (file)
@@ -519,7 +519,7 @@ __ZN7WebCore16ScriptController18windowScriptObjectEv
 __ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKN3WTF6StringEb
 __ZN7WebCore16ScriptController21processingUserGestureEv
 __ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE
-__ZN7WebCore16StylePropertySet5derefEv
+__ZN7WebCore16StylePropertySetD1Ev
 __ZN7WebCore16ThreadGlobalData10staticDataE
 __ZN7WebCore16ThreadGlobalDataC1Ev
 __ZN7WebCore16ThreadGlobalDataD1Ev
index b29d9a0..bc09ddd 100644 (file)
@@ -979,6 +979,7 @@ static PassRefPtr<CSSValue> createLineBoxContainValue(CSSValuePool* cssValuePool
 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
     : m_node(n)
     , m_allowVisitedStyle(allowVisitedStyle)
+    , m_refCount(1)
 {
     unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
     m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
@@ -989,6 +990,18 @@ CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
 {
 }
 
+void CSSComputedStyleDeclaration::ref()
+{
+    ++m_refCount;
+}
+
+void CSSComputedStyleDeclaration::deref()
+{
+    ASSERT(m_refCount);
+    if (!--m_refCount)
+        delete this;
+}
+
 String CSSComputedStyleDeclaration::cssText() const
 {
     String result("");
index 2c504ac..de44941 100644 (file)
@@ -47,9 +47,15 @@ enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
 
 class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
 public:
-    friend PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node>, bool allowVisitedStyle, const String& pseudoElementName);
+    static PassRefPtr<CSSComputedStyleDeclaration> create(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String())
+    {
+        return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName));
+    }
     virtual ~CSSComputedStyleDeclaration();
 
+    virtual void ref() OVERRIDE;
+    virtual void deref() OVERRIDE;
+
     PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
     String getPropertyValue(int propertyID) const;
     bool getPropertyPriority(int propertyID) const;
@@ -109,13 +115,9 @@ private:
     RefPtr<Node> m_node;
     PseudoId m_pseudoElementSpecifier;
     bool m_allowVisitedStyle;
+    unsigned m_refCount;
 };
 
-inline PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node> node,  bool allowVisitedStyle = false, const String& pseudoElementName = String())
-{
-    return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName));
-}
-
 } // namespace WebCore
 
 #endif // CSSComputedStyleDeclaration_h
index e5e7cb9..50bcef2 100644 (file)
@@ -35,11 +35,14 @@ class StyledElement;
 
 typedef int ExceptionCode;
 
-class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> {
-    WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration);
+class CSSStyleDeclaration {
+    WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); WTF_MAKE_FAST_ALLOCATED;
 public:
     virtual ~CSSStyleDeclaration() { }
 
+    virtual void ref() = 0;
+    virtual void deref() = 0;
+
     virtual CSSRule* parentRule() const = 0;
     virtual String cssText() const = 0;
     virtual void setCssText(const String&, ExceptionCode&) = 0;
@@ -64,7 +67,7 @@ public:
 
     virtual bool cssPropertyMatches(const CSSProperty*) const = 0;
     virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
+
 #ifndef NDEBUG
     void showStyle();
 #endif
index 11ec771..870e3af 100644 (file)
@@ -47,17 +47,15 @@ namespace WebCore {
 
 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration {
 public:
-    static PassRefPtr<PropertySetCSSStyleDeclaration> create(PassRefPtr<StylePropertySet> propertySet)
-    {
-        return adoptRef(new PropertySetCSSStyleDeclaration(propertySet)); 
-    }
+    PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySet(propertySet) { }
 
 private:
-    PropertySetCSSStyleDeclaration(PassRefPtr<StylePropertySet> propertySet) : m_propertySet(propertySet) { }
-    
+    virtual void ref() OVERRIDE { m_propertySet->ref(); }
+    virtual void deref() OVERRIDE { m_propertySet->deref(); }
+
     virtual CSSRule* parentRule() const OVERRIDE;
     virtual unsigned length() const OVERRIDE;
-    virtual String item(unsigned index) const;
+    virtual String item(unsigned index) const OVERRIDE;
     virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) OVERRIDE;
     virtual String getPropertyValue(const String& propertyName) OVERRIDE;
     virtual String getPropertyPriority(const String& propertyName) OVERRIDE;
@@ -66,7 +64,7 @@ private:
     virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) OVERRIDE;
     virtual String removeProperty(const String& propertyName, ExceptionCode&) OVERRIDE;
     virtual String cssText() const OVERRIDE;
-    virtual void setCssText(const String&, ExceptionCode&);
+    virtual void setCssText(const String&, ExceptionCode&) OVERRIDE;
     virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) OVERRIDE;
     virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE;
     virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE;
@@ -76,7 +74,7 @@ private:
     virtual PassRefPtr<StylePropertySet> copy() const OVERRIDE;
     virtual PassRefPtr<StylePropertySet> makeMutable() OVERRIDE;
     
-    RefPtr<StylePropertySet> m_propertySet;
+    StylePropertySet* m_propertySet;
 };
 
 namespace {
@@ -228,18 +226,7 @@ StylePropertySet::StylePropertySet(StyledElement* parentElement, bool isInlineSt
 
 StylePropertySet::~StylePropertySet()
 {
-}
-
-void StylePropertySet::deref()
-{
-    if (derefBase()) {
-        delete this;
-        return;
-    }
-    // StylePropertySet and CSSStyleDeclaration ref each other. When we have a declaration and
-    // our refcount drops to one we know it is the only thing keeping us alive.
-    if (m_cssStyleDeclaration && hasOneRef())
-        m_cssStyleDeclaration.clear();
+    
 }
 
 CSSStyleSheet* StylePropertySet::contextStyleSheet() const
@@ -1130,7 +1117,7 @@ PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const int* se
 CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() const
 {
     if (!m_cssStyleDeclaration)
-        m_cssStyleDeclaration = PropertySetCSSStyleDeclaration::create(const_cast<StylePropertySet*>(this));
+        m_cssStyleDeclaration = adoptPtr(new PropertySetCSSStyleDeclaration(const_cast<StylePropertySet*>(this)));
     return m_cssStyleDeclaration.get();
 }
 
@@ -1253,9 +1240,6 @@ PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const
 
 PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable()
 {
-    ASSERT(m_propertySet->m_cssStyleDeclaration == this || (!m_propertySet->m_cssStyleDeclaration && m_propertySet->hasOneRef()));
-    if (!m_propertySet->m_cssStyleDeclaration)
-        m_propertySet->m_cssStyleDeclaration = this;
     return m_propertySet;
 }
 
index a61b376..402bd94 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 class PropertySetCSSStyleDeclaration;
 class StyledElement;
 
-class StylePropertySet : public WTF::RefCountedBase {
+class StylePropertySet : public RefCounted<StylePropertySet> {
 public:
     ~StylePropertySet();
 
@@ -63,8 +63,6 @@ public:
         return adoptRef(new StylePropertySet(element, /*isInlineStyle*/ false));
     }
 
-    void deref();
-
     unsigned propertyCount() const { return m_properties.size(); }
     bool isEmpty() const { return m_properties.isEmpty(); }
     const CSSProperty& propertyAt(unsigned index) const { return m_properties[index]; }
@@ -169,7 +167,7 @@ private:
         StyledElement* element;
     } m_parent;
     
-    mutable RefPtr<PropertySetCSSStyleDeclaration> m_cssStyleDeclaration;
+    mutable OwnPtr<PropertySetCSSStyleDeclaration> m_cssStyleDeclaration;
     
     friend class PropertySetCSSStyleDeclaration;
 };
index fed0494..0825da4 100644 (file)
@@ -283,7 +283,7 @@ PassRefPtr<CSSComputedStyleDeclaration> Position::computedStyle() const
     Element* elem = element();
     if (!elem)
         return 0;
-    return WebCore::computedStyle(elem);
+    return CSSComputedStyleDeclaration::create(elem);
 }
 
 Position Position::previous(PositionMoveType moveType) const
index 1adde10..505ccca 100644 (file)
@@ -444,7 +444,7 @@ HTMLElement* ApplyStyleCommand::splitAncestorsWithUnicodeBidi(Node* node, bool b
     Node* nextHighestAncestorWithUnicodeBidi = 0;
     int highestAncestorUnicodeBidi = 0;
     for (Node* n = node->parentNode(); n != block; n = n->parentNode()) {
-        int unicodeBidi = getIdentifierValue(computedStyle(n).get(), CSSPropertyUnicodeBidi);
+        int unicodeBidi = getIdentifierValue(CSSComputedStyleDeclaration::create(n).get(), CSSPropertyUnicodeBidi);
         if (unicodeBidi && unicodeBidi != CSSValueNormal) {
             highestAncestorUnicodeBidi = unicodeBidi;
             nextHighestAncestorWithUnicodeBidi = highestAncestorWithUnicodeBidi;
@@ -496,7 +496,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp
             continue;
 
         StyledElement* element = static_cast<StyledElement*>(n);
-        int unicodeBidi = getIdentifierValue(computedStyle(element).get(), CSSPropertyUnicodeBidi);
+        int unicodeBidi = getIdentifierValue(CSSComputedStyleDeclaration::create(element).get(), CSSPropertyUnicodeBidi);
         if (!unicodeBidi || unicodeBidi == CSSValueNormal)
             continue;
 
@@ -522,7 +522,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp
 static Node* highestEmbeddingAncestor(Node* startNode, Node* enclosingNode)
 {
     for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) {
-        if (n->isHTMLElement() && getIdentifierValue(computedStyle(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed)
+        if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed)
             return n;
     }
 
@@ -1410,7 +1410,7 @@ float ApplyStyleCommand::computedFontSize(Node* node)
     if (!node)
         return 0;
 
-    RefPtr<CSSComputedStyleDeclaration> style = computedStyle(node);
+    RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(node);
     if (!style)
         return 0;
 
index 98224f2..57f2316 100644 (file)
@@ -378,7 +378,7 @@ void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude)
     else if (isTabSpanNode(node))
         node = node->parentNode();
 
-    RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = computedStyle(node);
+    RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = CSSComputedStyleDeclaration::create(node);
     m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copy() : editingStyleFromComputedStyle(computedStyleAtPosition);
 
     if (propertiesToInclude == EditingPropertiesInEffect) {
@@ -558,8 +558,8 @@ void EditingStyle::removeStyleAddedByNode(Node* node)
 {
     if (!node || !node->parentNode())
         return;
-    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
-    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
+    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingProperties);
+    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(CSSComputedStyleDeclaration::create(node), AllEditingProperties);
     nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration());
     m_mutableStyle->removeEquivalentProperties(nodeStyle->ensureCSSStyleDeclaration());
 }
@@ -569,8 +569,8 @@ void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node)
     if (!node || !node->parentNode() || !m_mutableStyle)
         return;
 
-    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties);
-    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties);
+    RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingProperties);
+    RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(CSSComputedStyleDeclaration::create(node), AllEditingProperties);
     nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration());
 
     unsigned propertyCount = nodeStyle->propertyCount();
@@ -641,7 +641,7 @@ TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
 
     TriState state = FalseTriState;
     for (Node* node = selection.start().deprecatedNode(); node; node = node->traverseNextNode()) {
-        RefPtr<CSSComputedStyleDeclaration> nodeStyle = computedStyle(node);
+        RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDeclaration::create(node);
         if (nodeStyle) {
             TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
             if (node == selection.start().deprecatedNode())
@@ -813,7 +813,7 @@ bool EditingStyle::extractConflictingImplicitStyleOfAttributes(HTMLElement* elem
 
 bool EditingStyle::styleIsPresentInComputedStyleOfNode(Node* node) const
 {
-    return !m_mutableStyle || getPropertiesNotIn(m_mutableStyle.get(), computedStyle(node).get())->isEmpty();
+    return !m_mutableStyle || getPropertiesNotIn(m_mutableStyle.get(), CSSComputedStyleDeclaration::create(node).get())->isEmpty();
 }
 
 bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* element)
@@ -1061,7 +1061,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element)
     // The property value, if it's a percentage, may not reflect the actual computed value.  
     // For example: style="height: 1%; overflow: visible;" in quirksmode
     // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot copy/paste fidelity problem
-    RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = computedStyle(element);
+    RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = CSSComputedStyleDeclaration::create(element);
     RefPtr<StylePropertySet> fromComputedStyle = StylePropertySet::create();
     {
         unsigned propertyCount = m_mutableStyle->propertyCount();
@@ -1487,7 +1487,7 @@ bool hasTransparentBackgroundColor(StylePropertySet* style)
 PassRefPtr<CSSValue> backgroundColorInEffect(Node* node)
 {
     for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
-        RefPtr<CSSComputedStyleDeclaration> ancestorStyle = computedStyle(ancestor);
+        RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDeclaration::create(ancestor);
         if (!hasTransparentBackgroundColor(ancestorStyle.get()))
             return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor);
     }
index 97b1533..60591de 100644 (file)
@@ -521,7 +521,7 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe
             if (!n->isStyledElement())
                 continue;
 
-            RefPtr<CSSComputedStyleDeclaration> style = computedStyle(n);
+            RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(n);
             RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnicodeBidi);
             if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
                 continue;
@@ -551,7 +551,7 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe
         if (!node->isStyledElement())
             continue;
 
-        RefPtr<CSSComputedStyleDeclaration> style = computedStyle(node);
+        RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(node);
         RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropertyUnicodeBidi);
         if (!unicodeBidi || !unicodeBidi->isPrimitiveValue())
             continue;
index a1c7e9b..27bb2ba 100644 (file)
@@ -560,7 +560,7 @@ void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no
 
     recalcStyleForPseudoStateIfNeeded(element, forcedPseudoClasses ? forcedPseudoClasses->get() : 0);
 
-    RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(element, true);
+    RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSComputedStyleDeclaration::create(element, true);
     RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), computedStyleInfo, 0);
     style = inspectorStyle->buildArrayForComputedStyle();
 }
index 2597f86..8ef0d2c 100644 (file)
@@ -1321,7 +1321,7 @@ PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const
     if (!elt)
         return 0;
 
-    return computedStyle(elt, false, pseudoElt);
+    return CSSComputedStyleDeclaration::create(elt, false, pseudoElt);
 }
 
 PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const String& pseudoElement, bool authorOnly) const
index c819e1e..09ca845 100644 (file)
@@ -59,7 +59,7 @@ SVGAnimateElement::~SVGAnimateElement()
 static inline void getPropertyValue(SVGElement* svgParent, const QualifiedName& attributeName, String& value)
 {
     ASSERT(svgParent->isStyled());
-    value = computedStyle(svgParent)->getPropertyValue(cssPropertyID(attributeName.localName()));
+    value = CSSComputedStyleDeclaration::create(svgParent)->getPropertyValue(cssPropertyID(attributeName.localName()));
 }
 
 static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
index 82369e9..f9cea86 100644 (file)
@@ -221,7 +221,7 @@ String SMILTimeContainer::baseValueFor(ElementAttributePair key)
     ASSERT(attributeName != anyQName());
     String baseValue;
     if (SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName))
-        baseValue = computedStyle(targetElement)->getPropertyValue(cssPropertyID(attributeName.localName()));
+        baseValue = CSSComputedStyleDeclaration::create(targetElement)->getPropertyValue(cssPropertyID(attributeName.localName()));
     else
         baseValue = targetElement->getAttribute(attributeName);
     m_savedBaseValues.add(key, baseValue);
index 4525cba..38fab55 100644 (file)
@@ -6414,7 +6414,7 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity
         return JSValueMakeUndefined(context);
     JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue));
     Element* element = jsElement->impl();
-    RefPtr<CSSComputedStyleDeclaration> style = computedStyle(element, true);
+    RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(element, true);
     return toRef(exec, toJS(exec, jsElement->globalObject(), style.get()));
 }
 
index 178c70e..40c69f4 100644 (file)
@@ -882,7 +882,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str
 
         int propID = cssPropertyID(name);
 
-        RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element, true);
+        RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(m_element, true);
         if (!propID || !style)
             return QString();
 
index f94d445..535c85d 100644 (file)
@@ -1566,7 +1566,7 @@ static bool isClickableElement(Element* element, RefPtr<NodeList> list)
     ExceptionCode ec = 0;
     return isClickable
         || element->webkitMatchesSelector("a,*:link,*:visited,*[role=button],button,input,select,label", ec)
-        || computedStyle(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer";
+        || CSSComputedStyleDeclaration::create(element)->getPropertyValue(cssPropertyID("cursor")) == "pointer";
 }
 
 static bool isValidFrameOwner(Element* element)
index 90254ae..f006706 100644 (file)
@@ -635,7 +635,7 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe
     if (!webElement)
         return res;
 
-    RefPtr<WebCore::CSSComputedStyleDeclaration> computedStyleDeclaration = computedStyle(webElement, true);
+    RefPtr<WebCore::CSSComputedStyleDeclaration> computedStyleDeclaration = CSSComputedStyleDeclaration::create(webElement, true);
     CSSStyleDeclaration* style = static_cast<WebCore::CSSStyleDeclaration*>(computedStyleDeclaration.get());
     for (unsigned i = 0; i < style->length(); i++) {
         QString name = style->item(i);
index b358836..20f31b3 100644 (file)
@@ -1590,7 +1590,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
 
                 styleSheet += QString::fromLatin1(getPropertyName(property));
                 styleSheet += QLatin1Char(':');
-                styleSheet += computedStyle(element)->getPropertyValue(property);
+                styleSheet += CSSComputedStyleDeclaration::create(element)->getPropertyValue(property);
                 styleSheet += QLatin1Char(';');
             }
 
index a829fe4..ac869fb 100644 (file)
@@ -650,7 +650,7 @@ JSValueRef WebFrame::computedStyleIncludingVisitedInfo(JSObjectRef element)
     if (!toJS(element)->inherits(&JSElement::s_info))
         return JSValueMakeUndefined(toRef(exec));
 
-    RefPtr<CSSComputedStyleDeclaration> style = computedStyle(static_cast<JSElement*>(toJS(element))->impl(), true);
+    RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(static_cast<JSElement*>(toJS(element))->impl(), true);
 
     JSLock lock(SilenceAssertionsOnly);
     return toRef(exec, toJS(exec, globalObject, style.get()));