Title: [133315] trunk/Source/WebCore
Revision
133315
Author
o...@chromium.org
Date
2012-11-02 10:54:02 -0700 (Fri, 02 Nov 2012)

Log Message

Move m_element checks out of canShareStyle into locateSharedStyle
https://bugs.webkit.org/show_bug.cgi?id=101070

Reviewed by Darin Adler.

Can shareStyleWithElement is called for each sibling as we look for a
shareElement. locateSharedStyle is called once for the element we're
trying to find a style for. Checks that only depend on the latter
element should, thus be in locateSharedStyle.

No new tests. There should be no change in behavior, except possibly
a performance improvement in some cases.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithElement):
(WebCore::StyleResolver::locateSharedStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (133314 => 133315)


--- trunk/Source/WebCore/ChangeLog	2012-11-02 17:46:55 UTC (rev 133314)
+++ trunk/Source/WebCore/ChangeLog	2012-11-02 17:54:02 UTC (rev 133315)
@@ -1,3 +1,22 @@
+2012-11-02  Ojan Vafai  <o...@chromium.org>
+
+        Move m_element checks out of canShareStyle into locateSharedStyle
+        https://bugs.webkit.org/show_bug.cgi?id=101070
+
+        Reviewed by Darin Adler.
+
+        Can shareStyleWithElement is called for each sibling as we look for a
+        shareElement. locateSharedStyle is called once for the element we're
+        trying to find a style for. Checks that only depend on the latter
+        element should, thus be in locateSharedStyle.
+
+        No new tests. There should be no change in behavior, except possibly
+        a performance improvement in some cases.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::canShareStyleWithElement):
+        (WebCore::StyleResolver::locateSharedStyle):
+
 2012-11-02  Kentaro Hara  <hara...@chromium.org>
 
         [V8] Add ASSERT() to guarantee that we don't store NULL pointers to V8 internal fields

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (133314 => 133315)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-02 17:46:55 UTC (rev 133314)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-02 17:54:02 UTC (rev 133315)
@@ -1199,8 +1199,6 @@
         return false;
     if (element == element->document()->cssTarget())
         return false;
-    if (m_element == m_element->document()->cssTarget())
-        return false;
     if (element->fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr))
         return false;
     if (element->fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr))
@@ -1216,9 +1214,7 @@
 
 #if ENABLE(PROGRESS_ELEMENT)
     if (element->hasTagName(progressTag)) {
-        if (!m_element->hasTagName(progressTag))
-            return false;
-
+        ASSERT(!m_element->hasTagName(progressTag));
         HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
         HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
         if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
@@ -1255,7 +1251,7 @@
         return false;
 #endif
 
-    if (elementHasDirectionAuto(element) || elementHasDirectionAuto(m_element))
+    if (elementHasDirectionAuto(element))
         return false;
 
     if (element->hasClass()) {
@@ -1321,6 +1317,10 @@
         return 0;
     if (m_styledElement->hasScopedHTMLStyleChild())
         return 0;
+    if (m_element == m_element->document()->cssTarget())
+        return 0;
+    if (elementHasDirectionAuto(m_element))
+        return 0;
 
     // Check previous siblings and their cousins.
     unsigned count = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to