CSSComputedStyleDeclaration::getPropertyCSSValue() triggering unnecessary relayouts and style recalcs
https://bugs.webkit.org/show_bug.cgi?id=97760

Reviewed by Andreas Kling.

Currently getPropertyCSSValue() (which is also used to implement the more common getPropertyValue()) 
calls Document::updateLayoutIgnorePendingStylesheets() unconditionally. However only a few properties 
are actually layout dependent, making many of these relayouts unnecessary. Moreover, triggering full 
style recalc is also often unnecessary as the current node may already have valid style even if some 
other parts of the tree require recalc.
        
- Only trigger relayouts for layout dependent properties.
- Trigger style recalc only if the style of the current element or its ancestors is dirty.
        
This is a significant (several percent) progression on some real world web content based page loading
benchmarks.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::isLayoutDependentProperty):
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/StyleResolver.h:
(WebCore::StyleResolver::hasViewportDependentMediaQueries):
* dom/Document.cpp:
(WebCore::Document::hasPendingStyleRecalc):
        
    Renamed for consistency.

(WebCore::Document::hasPendingForcedStyleRecalc):
(WebCore):
* dom/Document.h:
(Document):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp
index 404025f..da87a52 100644
--- a/Source/WebCore/rendering/RenderImage.cpp
+++ b/Source/WebCore/rendering/RenderImage.cpp
@@ -173,7 +173,7 @@
 
     // Set image dimensions, taking into account the size of the alt text.
     if (m_imageResource->errorOccurred()) {
-        if (!m_altText.isEmpty() && document()->isPendingStyleRecalc()) {
+        if (!m_altText.isEmpty() && document()->hasPendingStyleRecalc()) {
             ASSERT(node());
             if (node()) {
                 m_needsToSetSizeForAltText = true;