Title: [165046] trunk/Source/WebCore
Revision
165046
Author
[email protected]
Date
2014-03-04 02:48:48 -0800 (Tue, 04 Mar 2014)

Log Message

Don't synchronize attributes in reflect setters when we don't need to
https://bugs.webkit.org/show_bug.cgi?id=129662

Reviewed by Andreas Kling.

The vast majority of attributes don't need synchronization. Avoid calling synchronizeAttribute in setters
for those content attributes generated by "Reflect" keyword in IDL.

* bindings/scripts/CodeGenerator.pm:
(SetterExpression):
* dom/Element.cpp:
(WebCore::Element::setAttributeWithoutSynchronization): Added.
* dom/Element.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165045 => 165046)


--- trunk/Source/WebCore/ChangeLog	2014-03-04 10:28:38 UTC (rev 165045)
+++ trunk/Source/WebCore/ChangeLog	2014-03-04 10:48:48 UTC (rev 165046)
@@ -1,3 +1,19 @@
+2014-03-04  Ryosuke Niwa  <[email protected]>
+
+        Don't synchronize attributes in reflect setters when we don't need to
+        https://bugs.webkit.org/show_bug.cgi?id=129662
+
+        Reviewed by Andreas Kling.
+
+        The vast majority of attributes don't need synchronization. Avoid calling synchronizeAttribute in setters
+        for those content attributes generated by "Reflect" keyword in IDL.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (SetterExpression):
+        * dom/Element.cpp:
+        (WebCore::Element::setAttributeWithoutSynchronization): Added.
+        * dom/Element.h:
+
 2014-03-04  Andreas Kling  <[email protected]>
 
         Remove Document::idAttributeName().

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (165045 => 165046)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2014-03-04 10:28:38 UTC (rev 165045)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2014-03-04 10:48:48 UTC (rev 165046)
@@ -593,15 +593,19 @@
         return ("set" . $generator->WK_ucfirst($generator->AttributeNameForGetterAndSetter($attribute)));
     }
 
+    my $attributeType = $attribute->signature->type;
+
     my $functionName;
-    if ($attribute->signature->type eq "boolean") {
+    if ($attributeType eq "boolean") {
         $functionName = "setBooleanAttribute";
-    } elsif ($attribute->signature->type eq "long") {
+    } elsif ($attributeType eq "long") {
         $functionName = "setIntegralAttribute";
-    } elsif ($attribute->signature->type eq "unsigned long") {
+    } elsif ($attributeType eq "unsigned long") {
         $functionName = "setUnsignedIntegralAttribute";
+    } elsif ($generator->IsSVGAnimatedType($attributeType)) {
+        $functionName = "setAttribute";
     } else {
-        $functionName = "setAttribute";
+        $functionName = "setAttributeWithoutSynchronization";
     }
 
     return ($functionName, $contentAttributeName);

Modified: trunk/Source/WebCore/dom/Element.cpp (165045 => 165046)


--- trunk/Source/WebCore/dom/Element.cpp	2014-03-04 10:28:38 UTC (rev 165045)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-03-04 10:48:48 UTC (rev 165046)
@@ -1007,6 +1007,12 @@
     setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute);
 }
 
+void Element::setAttributeWithoutSynchronization(const QualifiedName& name, const AtomicString& value)
+{
+    unsigned index = elementData() ? elementData()->findAttributeIndexByName(name) : ElementData::attributeNotFound;
+    setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute);
+}
+
 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const AtomicString& value)
 {
     unsigned index = elementData() ? elementData()->findAttributeIndexByName(name) : ElementData::attributeNotFound;
@@ -2054,7 +2060,7 @@
 
 void Element::setPseudo(const AtomicString& value)
 {
-    setAttribute(pseudoAttr, value);
+    setAttributeWithoutSynchronization(pseudoAttr, value);
 }
 
 LayoutSize Element::minimumSizeForResizing() const

Modified: trunk/Source/WebCore/dom/Element.h (165045 => 165046)


--- trunk/Source/WebCore/dom/Element.h	2014-03-04 10:28:38 UTC (rev 165045)
+++ trunk/Source/WebCore/dom/Element.h	2014-03-04 10:48:48 UTC (rev 165046)
@@ -144,6 +144,7 @@
     bool hasAttribute(const QualifiedName&) const;
     const AtomicString& getAttribute(const QualifiedName&) const;
     void setAttribute(const QualifiedName&, const AtomicString& value);
+    void setAttributeWithoutSynchronization(const QualifiedName&, const AtomicString& value);
     void setSynchronizedLazyAttribute(const QualifiedName&, const AtomicString& value);
     bool removeAttribute(const QualifiedName&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to