Title: [135542] trunk/Source/WebCore
- Revision
- 135542
- Author
- [email protected]
- Date
- 2012-11-22 14:31:07 -0800 (Thu, 22 Nov 2012)
Log Message
Style sharing: Remove O(n^2) presentation attribute checks that never found anything anyway.
<http://webkit.org/b/103019>
Reviewed by Ojan Vafai.
Rely on the global presentation attribute cache and remove the slow-path code that compares
the full StylePropertySets for attribute-derived style.
There are virtually no cases of logically equivalent presentation attribute styles that don't
already share the same memory address. (Zero hits on Apple and Chromium PLT content.)
* css/StyleResolver.cpp:
(WebCore::haveIdenticalStyleAffectingAttributes):
(WebCore::StyleResolver::canShareStyleWithElement):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135541 => 135542)
--- trunk/Source/WebCore/ChangeLog 2012-11-22 22:30:02 UTC (rev 135541)
+++ trunk/Source/WebCore/ChangeLog 2012-11-22 22:31:07 UTC (rev 135542)
@@ -1,3 +1,19 @@
+2012-11-22 Andreas Kling <[email protected]>
+
+ Style sharing: Remove O(n^2) presentation attribute checks that never found anything anyway.
+ <http://webkit.org/b/103019>
+
+ Reviewed by Ojan Vafai.
+
+ Rely on the global presentation attribute cache and remove the slow-path code that compares
+ the full StylePropertySets for attribute-derived style.
+ There are virtually no cases of logically equivalent presentation attribute styles that don't
+ already share the same memory address. (Zero hits on Apple and Chromium PLT content.)
+
+ * css/StyleResolver.cpp:
+ (WebCore::haveIdenticalStyleAffectingAttributes):
+ (WebCore::StyleResolver::canShareStyleWithElement):
+
2012-11-22 Pavel Feldman <[email protected]>
Web Inspector: evaluate on hover regressed with the editor change
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (135541 => 135542)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-11-22 22:30:02 UTC (rev 135541)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-11-22 22:31:07 UTC (rev 135542)
@@ -1115,32 +1115,6 @@
return true;
}
-// This function makes some assumptions that only make sense for attribute styles (we only compare CSSProperty::id() and CSSProperty::value().)
-static inline bool attributeStylesEqual(const StylePropertySet* a, const StylePropertySet* b)
-{
- if (a == b)
- return true;
- if (a->propertyCount() != b->propertyCount())
- return false;
- unsigned propertyCount = a->propertyCount();
- for (unsigned i = 0; i < propertyCount; ++i) {
- StylePropertySet::PropertyReference aProperty = a->propertyAt(i);
- unsigned j;
- for (j = 0; j < propertyCount; ++j) {
- StylePropertySet::PropertyReference bProperty = b->propertyAt(j);
- if (aProperty.id() != bProperty.id())
- continue;
- // We could get a few more hits by comparing cssText() here, but that gets expensive quickly.
- if (aProperty.value() != bProperty.value())
- return false;
- break;
- }
- if (j == propertyCount)
- return false;
- }
- return true;
-}
-
static inline bool elementHasDirectionAuto(Element* element)
{
// FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
@@ -1167,7 +1141,7 @@
return false;
}
- if (a->presentationAttributeStyle() && !attributeStylesEqual(a->presentationAttributeStyle(), b->presentationAttributeStyle()))
+ if (a->presentationAttributeStyle() != b->presentationAttributeStyle())
return false;
#if ENABLE(PROGRESS_ELEMENT)
@@ -1200,12 +1174,6 @@
if (element->isSVGElement() && static_cast<SVGElement*>(element)->animatedSMILStyleProperties())
return false;
#endif
- if (!!element->presentationAttributeStyle() != !!m_styledElement->presentationAttributeStyle())
- return false;
- const StylePropertySet* additionalPresentationAttributeStyleA = element->additionalPresentationAttributeStyle();
- const StylePropertySet* additionalPresentationAttributeStyleB = m_styledElement->additionalPresentationAttributeStyle();
- if (!additionalPresentationAttributeStyleA != !additionalPresentationAttributeStyleB)
- return false;
if (element->isLink() != m_element->isLink())
return false;
if (style->affectedByUncommonAttributeSelectors())
@@ -1220,9 +1188,10 @@
return false;
if (element == element->document()->cssTarget())
return false;
-
if (!haveIdenticalStyleAffectingAttributes(element, m_styledElement))
return false;
+ if (element->additionalPresentationAttributeStyle() != m_styledElement->additionalPresentationAttributeStyle())
+ return false;
if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl()))
return false;
@@ -1261,9 +1230,6 @@
if (elementHasDirectionAuto(element))
return false;
- if (additionalPresentationAttributeStyleA && !attributeStylesEqual(additionalPresentationAttributeStyleA, additionalPresentationAttributeStyleB))
- return false;
-
if (element->isLink() && m_elementLinkState != style->insideLink())
return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes