Title: [101665] trunk/Source/WebCore
Revision
101665
Author
[email protected]
Date
2011-12-01 07:19:57 -0800 (Thu, 01 Dec 2011)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101664 => 101665)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 15:10:04 UTC (rev 101664)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 15:19:57 UTC (rev 101665)
@@ -1,3 +1,28 @@
+2011-11-30  Andreas Kling  <[email protected]>
+
+        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  <[email protected]>
 
         run-bindings-tests is failing on Gtk/Qt/SnowLeopard/Lion bots

Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (101664 => 101665)


--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp	2011-12-01 15:10:04 UTC (rev 101664)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp	2011-12-01 15:19:57 UTC (rev 101665)
@@ -151,11 +151,10 @@
 {
 }
 
-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

Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h (101664 => 101665)


--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h	2011-12-01 15:10:04 UTC (rev 101664)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h	2011-12-01 15:19:57 UTC (rev 101665)
@@ -77,7 +77,7 @@
     }
 
     // Used by StyledElement::copyNonAttributeProperties().
-    void copyPropertiesAndStrictnessFrom(const CSSMutableStyleDeclaration&);
+    void copyPropertiesFrom(const CSSMutableStyleDeclaration&);
 
     typedef CSSMutableStyleDeclarationConstIterator const_iterator;
 

Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (101664 => 101665)


--- trunk/Source/WebCore/css/CSSStyleDeclaration.h	2011-12-01 15:10:04 UTC (rev 101664)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h	2011-12-01 15:19:57 UTC (rev 101665)
@@ -34,6 +34,7 @@
 typedef int ExceptionCode;
 
 class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> {
+    WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration);
 public:
     virtual ~CSSStyleDeclaration() { }
 

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (101664 => 101665)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2011-12-01 15:10:04 UTC (rev 101664)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2011-12-01 15:19:57 UTC (rev 101665)
@@ -427,13 +427,19 @@
     return hasher.hash();
 }
 
-void StyledElement::copyNonAttributeProperties(const Element *sourceElement)
+void StyledElement::copyNonAttributeProperties(const Element* sourceElement)
 {
+    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());
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to