Title: [107551] trunk/Source/WebCore
- Revision
- 107551
- Author
- [email protected]
- Date
- 2012-02-13 02:09:49 -0800 (Mon, 13 Feb 2012)
Log Message
Avoid unnecessary work when evaluating style sharing candidates.
<http://webkit.org/b/78220>
Reviewed by Antti Koivisto.
Do the cheap checks (bitfields, pointers) before calling virtuals and doing hash lookups.
Remove comparison of attributes that are reflected in the attribute styles (cellpadding.)
Moved comparison of "type" and "readonly" attributes into the more specific
canShareStyleWithControl() since they are only relevant for input elements. Don't bother
calling isFormControlElement() on both elements as they already have the same tagQName().
Altogether this knocks off ~8ms worth of samples per cycle of the "Moz" page cycler test.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::canShareStyleWithControl):
(WebCore::CSSStyleSelector::canShareStyleWithElement):
(WebCore::isCommonAttributeSelectorAttribute):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107550 => 107551)
--- trunk/Source/WebCore/ChangeLog 2012-02-13 10:08:57 UTC (rev 107550)
+++ trunk/Source/WebCore/ChangeLog 2012-02-13 10:09:49 UTC (rev 107551)
@@ -1,3 +1,23 @@
+2012-02-13 Andreas Kling <[email protected]>
+
+ Avoid unnecessary work when evaluating style sharing candidates.
+ <http://webkit.org/b/78220>
+
+ Reviewed by Antti Koivisto.
+
+ Do the cheap checks (bitfields, pointers) before calling virtuals and doing hash lookups.
+ Remove comparison of attributes that are reflected in the attribute styles (cellpadding.)
+ Moved comparison of "type" and "readonly" attributes into the more specific
+ canShareStyleWithControl() since they are only relevant for input elements. Don't bother
+ calling isFormControlElement() on both elements as they already have the same tagQName().
+
+ Altogether this knocks off ~8ms worth of samples per cycle of the "Moz" page cycler test.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::canShareStyleWithControl):
+ (WebCore::CSSStyleSelector::canShareStyleWithElement):
+ (WebCore::isCommonAttributeSelectorAttribute):
+
2012-02-13 Arko Saha <[email protected]>
<summary> is not keyboard accessible.
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (107550 => 107551)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-02-13 10:08:57 UTC (rev 107550)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-02-13 10:09:49 UTC (rev 107551)
@@ -1189,6 +1189,13 @@
return false;
}
+ if (element->fastGetAttribute(typeAttr) != m_element->fastGetAttribute(typeAttr))
+ return false;
+
+ if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr))
+ return false;
+
+
return true;
}
@@ -1234,10 +1241,6 @@
return false;
if (!!element->attributeStyle() != !!m_styledElement->attributeStyle())
return false;
- StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle();
- StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle();
- if (!additionalAttributeStyleA != !additionalAttributeStyleB)
- return false;
if (element->isLink() != m_element->isLink())
return false;
if (style->affectedByUncommonAttributeSelectors())
@@ -1248,42 +1251,21 @@
return false;
if (element->focused() != m_element->focused())
return false;
- if (element->shadowPseudoId() != m_element->shadowPseudoId())
- return false;
if (element == element->document()->cssTarget())
return false;
if (m_element == m_element->document()->cssTarget())
return false;
- if (element->getAttribute(typeAttr) != m_element->getAttribute(typeAttr))
+ if (style->transitions() || style->animations())
return false;
- if (element->fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr))
+ if (element->isLink() && m_elementLinkState != style->insideLink())
return false;
- if (element->fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr))
+ if (element->shadowPseudoId() != m_element->shadowPseudoId())
return false;
- if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr))
- return false;
- if (element->fastGetAttribute(cellpaddingAttr) != m_element->fastGetAttribute(cellpaddingAttr))
- return false;
-
if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl()))
return false;
-
-#if ENABLE(STYLE_SCOPED)
- if (element->hasScopedHTMLStyleChild())
+ if (m_element->isFormControlElement() && !canShareStyleWithControl(element))
return false;
-#endif
- bool isControl = element->isFormControlElement();
-
- if (isControl != m_element->isFormControlElement())
- return false;
-
- if (isControl && !canShareStyleWithControl(element))
- return false;
-
- if (style->transitions() || style->animations())
- return false;
-
#if USE(ACCELERATED_COMPOSITING)
// Turn off style sharing for elements that can gain layers for reasons outside of the style system.
// See comments in RenderObject::setStyle().
@@ -1302,14 +1284,26 @@
if (element->hasClass() && m_element->getAttribute(classAttr) != element->getAttribute(classAttr))
return false;
+ StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle();
+ StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle();
+ if (!additionalAttributeStyleA != !additionalAttributeStyleB)
+ return false;
+
+ if (element->fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr))
+ return false;
+ if (element->fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr))
+ return false;
+
if (element->attributeStyle() && !attributeStylesEqual(element->attributeStyle(), m_styledElement->attributeStyle()))
return false;
if (additionalAttributeStyleA && !attributeStylesEqual(additionalAttributeStyleA, additionalAttributeStyleB))
return false;
- if (element->isLink() && m_elementLinkState != style->insideLink())
+#if ENABLE(STYLE_SCOPED)
+ if (element->hasScopedHTMLStyleChild())
return false;
+#endif
return true;
}
@@ -2172,7 +2166,7 @@
static inline bool isCommonAttributeSelectorAttribute(const QualifiedName& attribute)
{
- // These are explicitly tested for equality in canShareStyleWithElement.
+ // These are explicitly tested for equality in canShareStyleWithControl.
return attribute == typeAttr || attribute == readonlyAttr;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes