Title: [92164] trunk/Source/WebCore
Revision
92164
Author
[email protected]
Date
2011-08-01 18:42:08 -0700 (Mon, 01 Aug 2011)

Log Message

Don't set m_fontDirty when setting zoom unless zoom has actually changed
https://bugs.webkit.org/show_bug.cgi?id=65092

Reviewed by Darin Adler.

No new tests as no functionality changed - this is an optimization that
should be logically equivalent to the current code.

The intent here is to avoid setting m_fontDirty unless the fornt information is actually dirty.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::styleForDocument):
(WebCore::CSSStyleSelector::applyProperty):
Use setZoom and setEffectiveZoom wrapper functions.
* css/CSSStyleSelector.h:
(WebCore::CSSStyleSelector::setZoom):
Wrapper for m_style->setZoom() that automatically updates m_fontDirty.
(WebCore::CSSStyleSelector::setEffectiveZoom):
Wrapper for m_style->setEffectiveZoom that automatically updates m_fontDirty.
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::ensurePropertyMap):
Use
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::setZoom):
Return true only if underlying values change.
(WebCore::InheritedFlags::setZoomWithoutReturnValue):
Return void to match function pointer type where required.
(WebCore::InheritedFlags::setEffectiveZoom):
Return true only if underlying values change.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92163 => 92164)


--- trunk/Source/WebCore/ChangeLog	2011-08-02 01:37:46 UTC (rev 92163)
+++ trunk/Source/WebCore/ChangeLog	2011-08-02 01:42:08 UTC (rev 92164)
@@ -1,3 +1,35 @@
+2011-08-01  Luke Macpherson   <[email protected]>
+
+        Don't set m_fontDirty when setting zoom unless zoom has actually changed
+        https://bugs.webkit.org/show_bug.cgi?id=65092
+
+        Reviewed by Darin Adler.
+
+        No new tests as no functionality changed - this is an optimization that
+        should be logically equivalent to the current code.
+
+        The intent here is to avoid setting m_fontDirty unless the fornt information is actually dirty.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForDocument):
+        (WebCore::CSSStyleSelector::applyProperty):
+        Use setZoom and setEffectiveZoom wrapper functions.
+        * css/CSSStyleSelector.h:
+        (WebCore::CSSStyleSelector::setZoom):
+        Wrapper for m_style->setZoom() that automatically updates m_fontDirty.
+        (WebCore::CSSStyleSelector::setEffectiveZoom):
+        Wrapper for m_style->setEffectiveZoom that automatically updates m_fontDirty.
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::ensurePropertyMap):
+        Use 
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::setZoom):
+        Return true only if underlying values change.
+        (WebCore::InheritedFlags::setZoomWithoutReturnValue):
+        Return void to match function pointer type where required.
+        (WebCore::InheritedFlags::setEffectiveZoom):
+        Return true only if underlying values change.
+
 2011-08-01  Jean-luc Brouillet  <[email protected]>
 
         Removing old source files in gyp files that slow build

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (92163 => 92164)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-02 01:37:46 UTC (rev 92163)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-02 01:42:08 UTC (rev 92164)
@@ -4276,31 +4276,26 @@
     {
         // Reset the zoom in effect before we do anything.  This allows the setZoom method to accurately compute a new
         // zoom in effect.
-        m_style->setEffectiveZoom(m_parentStyle ? m_parentStyle->effectiveZoom() : RenderStyle::initialZoom());
-        
-        // Now we can handle inherit and initial.
-        HANDLE_INHERIT_AND_INITIAL(zoom, Zoom)
-        
-        // Handle normal/reset, numbers and percentages.
-        int type = primitiveValue->primitiveType();
-        if (primitiveValue->getIdent() == CSSValueNormal)
-            m_style->setZoom(RenderStyle::initialZoom());
+        setEffectiveZoom(m_parentStyle ? m_parentStyle->effectiveZoom() : RenderStyle::initialZoom());
+
+        if (isInherit)
+            setZoom(m_parentStyle->zoom());
+        else if (isInitial || primitiveValue->getIdent() == CSSValueNormal)
+            setZoom(RenderStyle::initialZoom());
         else if (primitiveValue->getIdent() == CSSValueReset) {
-            m_style->setEffectiveZoom(RenderStyle::initialZoom());
-            m_style->setZoom(RenderStyle::initialZoom());
+            setEffectiveZoom(RenderStyle::initialZoom());
+            setZoom(RenderStyle::initialZoom());
         } else if (primitiveValue->getIdent() == CSSValueDocument) {
             float docZoom = m_checker.m_document->renderer()->style()->zoom();
-            m_style->setEffectiveZoom(docZoom);
-            m_style->setZoom(docZoom);
-        } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) {
+            setEffectiveZoom(docZoom);
+            setZoom(docZoom);
+        } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE) {
             if (primitiveValue->getFloatValue())
-                m_style->setZoom(primitiveValue->getFloatValue() / 100.0f);
-        } else if (type == CSSPrimitiveValue::CSS_NUMBER) {
+                setZoom(primitiveValue->getFloatValue() / 100.0f);
+        } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) {
             if (primitiveValue->getFloatValue())
-                m_style->setZoom(primitiveValue->getFloatValue());
+                setZoom(primitiveValue->getFloatValue());
         }
-        
-        m_fontDirty = true;
         return;
     }
 // shorthand properties

Modified: trunk/Source/WebCore/css/CSSStyleSelector.h (92163 => 92164)


--- trunk/Source/WebCore/css/CSSStyleSelector.h	2011-08-02 01:37:46 UTC (rev 92163)
+++ trunk/Source/WebCore/css/CSSStyleSelector.h	2011-08-02 01:42:08 UTC (rev 92164)
@@ -116,6 +116,8 @@
         FontDescription fontDescription() { return style()->fontDescription(); }
         FontDescription parentFontDescription() {return parentStyle()->fontDescription(); }
         void setFontDescription(FontDescription fontDescription) { m_fontDirty |= style()->setFontDescription(fontDescription); }
+        void setZoom(float f) { m_fontDirty |= style()->setZoom(f); }
+        void setEffectiveZoom(float f) { m_fontDirty |= style()->setEffectiveZoom(f); }
 
     private:
         void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO);

Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (92163 => 92164)


--- trunk/Source/WebCore/page/animation/AnimationBase.cpp	2011-08-02 01:37:46 UTC (rev 92163)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp	2011-08-02 01:42:08 UTC (rev 92164)
@@ -741,7 +741,7 @@
         gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius));
         gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius));
         gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility));
-        gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoom));
+        gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue));
 
         gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip));
         

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (92163 => 92164)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-02 01:37:46 UTC (rev 92163)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-02 01:42:08 UTC (rev 92164)
@@ -945,8 +945,9 @@
     void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
     void setDirection(TextDirection v) { inherited_flags._direction = v; }
     void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
-    void setZoom(float f) { SET_VAR(visual, m_zoom, f); setEffectiveZoom(effectiveZoom() * zoom()); }
-    void setEffectiveZoom(float f) { SET_VAR(rareInheritedData, m_effectiveZoom, f) }
+    bool setZoom(float);
+    void setZoomWithoutReturnValue(float f) { setZoom(f); }
+    bool setEffectiveZoom(float);
     void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
 
     void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
@@ -1431,6 +1432,23 @@
     return value / style->effectiveZoom();
 }
 
+inline bool RenderStyle::setZoom(float f)
+{
+    if (compareEqual(visual->m_zoom, f))
+        return false;
+    visual.access()->m_zoom = f;
+    setEffectiveZoom(effectiveZoom() * zoom());
+    return true;
+}
+
+inline bool RenderStyle::setEffectiveZoom(float f)
+{
+    if (compareEqual(rareInheritedData->m_effectiveZoom, f))
+        return false;
+    rareInheritedData.access()->m_effectiveZoom = f;
+    return true;
+}
+
 } // namespace WebCore
 
 #endif // RenderStyle_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to