DOM Attribute tests on Dromaeo spends 2.7% of time in hasSelectorForAttribute
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2012 16:00:06 +0000 (16:00 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2012 16:00:06 +0000 (16:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75569

Reviewed by Andreas Kling.

Check needsStyleRecalc() first to avoid unnecessary hash lookups.

* dom/Element.cpp:
(WebCore::Element::recalcStyleIfNeededAfterAttributeChanged):

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp

index e76583d14b4b73ccd24cd7d8cffed47e7008399e..636e77662e27e08e022edae6be862556cec9e355 100644 (file)
@@ -1,3 +1,15 @@
+2012-01-05  Ryosuke Niwa  <rniwa@webkit.org>
+
+        DOM Attribute tests on Dromaeo spends 2.7% of time in hasSelectorForAttribute
+        https://bugs.webkit.org/show_bug.cgi?id=75569
+
+        Reviewed by Andreas Kling.
+
+        Check needsStyleRecalc() first to avoid unnecessary hash lookups.
+
+        * dom/Element.cpp:
+        (WebCore::Element::recalcStyleIfNeededAfterAttributeChanged):
+
 2012-01-05  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
 
         [EFL] Replace alloca to C++ new placement.
index f6c70a55060b1f92a226094d25085d3655bbfb28..0999596917e74d048d15cc1340569397e209ca53 100644 (file)
@@ -706,6 +706,9 @@ void Element::updateAfterAttributeChanged(Attribute* attr)
     
 void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr)
 {
+    if (needsStyleRecalc())
+        return;
+
     if (document()->attached() && document()->styleSelector()->hasSelectorForAttribute(attr->name().localName()))
         setNeedsStyleRecalc();
 }