Title: [93218] trunk/Source/WebCore
Revision
93218
Author
macpher...@chromium.org
Date
2011-08-17 10:45:40 -0700 (Wed, 17 Aug 2011)

Log Message

Only set m_fontDirty if TextSizeAdjust is actually changed.
https://bugs.webkit.org/show_bug.cgi?id=66022

Reviewed by Darin Adler.

No new tests. Refactoring only.

Reduces instances where the font information is dirtied to save recalculation where it is not necessary.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
Call new setTextSizeAdjust function.
* css/CSSStyleSelector.h:
(WebCore::CSSStyleSelector::setTextSizeAdjust):
Add wrapper for RenderStyle::setTextSizeAdjust() that automatically updates m_fontDirty.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setTextSizeAdjust):
Make setTextSizeAdjust return true if the unlderlying value was changed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93217 => 93218)


--- trunk/Source/WebCore/ChangeLog	2011-08-17 17:45:05 UTC (rev 93217)
+++ trunk/Source/WebCore/ChangeLog	2011-08-17 17:45:40 UTC (rev 93218)
@@ -1,3 +1,24 @@
+2011-08-17  Luke Macpherson   <macpher...@chromium.org>
+
+        Only set m_fontDirty if TextSizeAdjust is actually changed.
+        https://bugs.webkit.org/show_bug.cgi?id=66022
+
+        Reviewed by Darin Adler.
+
+        No new tests. Refactoring only.
+
+        Reduces instances where the font information is dirtied to save recalculation where it is not necessary.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        Call new setTextSizeAdjust function.
+        * css/CSSStyleSelector.h:
+        (WebCore::CSSStyleSelector::setTextSizeAdjust):
+        Add wrapper for RenderStyle::setTextSizeAdjust() that automatically updates m_fontDirty.
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setTextSizeAdjust):
+        Make setTextSizeAdjust return true if the unlderlying value was changed.
+
 2011-08-17  Kenichi Ishibashi  <ba...@chromium.org>
 
         [Chromium] Crash in HarfbuzzFace::~HarfbuzzFace

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (93217 => 93218)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-17 17:45:05 UTC (rev 93217)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-17 17:45:40 UTC (rev 93218)
@@ -4747,9 +4747,9 @@
         return;
     case CSSPropertyWebkitTextSizeAdjust: {
         HANDLE_INHERIT_AND_INITIAL(textSizeAdjust, TextSizeAdjust)
-        if (!primitiveValue || !primitiveValue->getIdent()) return;
-        m_style->setTextSizeAdjust(primitiveValue->getIdent() == CSSValueAuto);
-        m_fontDirty = true;
+        if (!primitiveValue || !primitiveValue->getIdent())
+            return;
+        setTextSizeAdjust(primitiveValue->getIdent() == CSSValueAuto);
         return;
     }
     case CSSPropertyWebkitTextSecurity:

Modified: trunk/Source/WebCore/css/CSSStyleSelector.h (93217 => 93218)


--- trunk/Source/WebCore/css/CSSStyleSelector.h	2011-08-17 17:45:05 UTC (rev 93217)
+++ trunk/Source/WebCore/css/CSSStyleSelector.h	2011-08-17 17:45:40 UTC (rev 93218)
@@ -118,6 +118,7 @@
         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); }
+        void setTextSizeAdjust(bool b) { m_fontDirty |= style()->setTextSizeAdjust(b); }
 
     private:
         void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO);

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (93217 => 93218)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-17 17:45:05 UTC (rev 93217)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-17 17:45:40 UTC (rev 93218)
@@ -1149,7 +1149,7 @@
 
     void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
     void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
-    void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); }
+    bool setTextSizeAdjust(bool);
     void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
 
 #if ENABLE(SVG)
@@ -1441,6 +1441,14 @@
     return true;
 }
 
+inline bool RenderStyle::setTextSizeAdjust(bool b)
+{
+    if (compareEqual(rareInheritedData->textSizeAdjust, b))
+        return false;
+    rareInheritedData.access()->textSizeAdjust = b;
+    return true;
+}
+
 } // namespace WebCore
 
 #endif // RenderStyle_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to