StyledElement: Tidy up copyNonAttributeProperties().
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 15:19:57 +0000 (15:19 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 15:19:57 +0000 (15:19 +0000)
<http://webkit.org/b/73501>

Reviewed by Antti Koivisto.

* css/CSSStyleDeclaration.h:

    Made CSSStyleDeclaration non-copyable.

* css/CSSMutableStyleDeclaration.h:
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::copyPropertiesFrom):

    copyPropertiesAndStrictnessFrom() redone as copyPropertiesFrom()
    since we can copy the strictness bit using existing accessors.

* dom/StyledElement.cpp:
(WebCore::StyledElement::copyNonAttributeProperties):

    Use copyPropertiesFrom() and copy the strictness bit to the new
    inline style using the dedicated accessors. Also added some
    assertions for good measure.

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSMutableStyleDeclaration.cpp
Source/WebCore/css/CSSMutableStyleDeclaration.h
Source/WebCore/css/CSSStyleDeclaration.h
Source/WebCore/dom/StyledElement.cpp

index 5648bc893abcef08171ab49225a682be9d16ad1e..537e8d076fad8ba84ac945e3fd4c1b048d1aa7b8 100644 (file)
@@ -1,3 +1,28 @@
+2011-11-30  Andreas Kling  <kling@webkit.org>
+
+        StyledElement: Tidy up copyNonAttributeProperties().
+        <http://webkit.org/b/73501>
+
+        Reviewed by Antti Koivisto.
+
+        * css/CSSStyleDeclaration.h:
+
+            Made CSSStyleDeclaration non-copyable.
+
+        * css/CSSMutableStyleDeclaration.h:
+        * css/CSSMutableStyleDeclaration.cpp:
+        (WebCore::CSSMutableStyleDeclaration::copyPropertiesFrom):
+
+            copyPropertiesAndStrictnessFrom() redone as copyPropertiesFrom()
+            since we can copy the strictness bit using existing accessors.
+
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::copyNonAttributeProperties):
+
+            Use copyPropertiesFrom() and copy the strictness bit to the new
+            inline style using the dedicated accessors. Also added some
+            assertions for good measure.
+
 2011-12-01  Kentaro Hara  <haraken@chromium.org>
 
         run-bindings-tests is failing on Gtk/Qt/SnowLeopard/Lion bots
index 916d2f5c3c472df57bbf24180e96a03f49a6b9f2..46509a0934be51a8b6d69947f3d57610fc72bed3 100644 (file)
@@ -151,11 +151,10 @@ CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration()
 {
 }
 
-void CSSMutableStyleDeclaration::copyPropertiesAndStrictnessFrom(const CSSMutableStyleDeclaration& other)
+void CSSMutableStyleDeclaration::copyPropertiesFrom(const CSSMutableStyleDeclaration& other)
 {
     ASSERT(!m_iteratorCount);
     m_properties = other.m_properties;
-    m_strictParsing = other.m_strictParsing;
 }
 
 String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const
index db3e25f64364db48aedbf79a1d21dc20fefa4dbb..9163eea34ce10e4fe01eba0c2c11d10c190df762 100644 (file)
@@ -77,7 +77,7 @@ public:
     }
 
     // Used by StyledElement::copyNonAttributeProperties().
-    void copyPropertiesAndStrictnessFrom(const CSSMutableStyleDeclaration&);
+    void copyPropertiesFrom(const CSSMutableStyleDeclaration&);
 
     typedef CSSMutableStyleDeclarationConstIterator const_iterator;
 
index 7fb6d6d063fc60820fc49a8ca7e89ba7240772b0..a4e85d87b20bc17331688dec5a78ebf4466466fd 100644 (file)
@@ -34,6 +34,7 @@ class CSSValue;
 typedef int ExceptionCode;
 
 class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> {
+    WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration);
 public:
     virtual ~CSSStyleDeclaration() { }
 
index dbb4ec2a74df975bd81c797db491bdb6060cc18b..f2dff66db152d250fba61dbe72d9d75e9776a1cb 100644 (file)
@@ -427,13 +427,19 @@ unsigned MappedAttributeHash::hash(const MappedAttributeKey& key)
     return hasher.hash();
 }
 
-void StyledElement::copyNonAttributeProperties(const Element *sourceElement)
+void StyledElement::copyNonAttributeProperties(const ElementsourceElement)
 {
+    ASSERT(sourceElement);
+    ASSERT(sourceElement->isStyledElement());
+
     const StyledElement* source = static_cast<const StyledElement*>(sourceElement);
-    if (!source->m_inlineStyleDecl)
+    if (!source->inlineStyleDecl())
         return;
 
-    getInlineStyleDecl()->copyPropertiesAndStrictnessFrom(*source->m_inlineStyleDecl);
+    CSSInlineStyleDeclaration* inlineStyle = getInlineStyleDecl();
+    inlineStyle->copyPropertiesFrom(*source->inlineStyleDecl());
+    inlineStyle->setStrictParsing(source->inlineStyleDecl()->useStrictParsing());
+
     setIsStyleAttributeValid(source->isStyleAttributeValid());
     setIsSynchronizingStyleAttribute(source->isSynchronizingStyleAttribute());