Title: [107261] trunk/Source/WebCore
- Revision
- 107261
- Author
- [email protected]
- Date
- 2012-02-09 10:56:40 -0800 (Thu, 09 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,
lang and xml:lang.) 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 since we already know they
have the same tagQName().
Altogether this knocks off 8-9ms 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 (107260 => 107261)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 18:38:06 UTC (rev 107260)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 18:56:40 UTC (rev 107261)
@@ -1,3 +1,24 @@
+2012-02-09 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,
+ lang and xml:lang.) 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 since we already know they
+ have the same tagQName().
+
+ Altogether this knocks off 8-9ms worth of samples per cycle of the "Moz" page cycler test.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::canShareStyleWithControl):
+ (WebCore::CSSStyleSelector::canShareStyleWithElement):
+ (WebCore::isCommonAttributeSelectorAttribute):
+
2012-02-09 Mike Lawther <[email protected]>
CSS3 calc() - remove mod
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (107260 => 107261)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-02-09 18:38:06 UTC (rev 107260)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2012-02-09 18:56:40 UTC (rev 107261)
@@ -1190,6 +1190,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;
}
@@ -1235,10 +1242,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())
@@ -1249,42 +1252,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().
@@ -1303,14 +1285,21 @@
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->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;
}
@@ -2173,7 +2162,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