Title: [138299] trunk/Source/WebCore
Revision
138299
Author
an...@apple.com
Date
2012-12-20 14:13:16 -0800 (Thu, 20 Dec 2012)

Log Message

Font description not synchronized correctly on orientation affecting property changes
https://bugs.webkit.org/show_bug.cgi?id=105533

Reviewed by Enrica Casucci.

In StyleResolver checkForOrientationChange() function checks if the new computed orientation differs from the parent
orientation and updates the style's font description only if it does. This is not correct as equal values do not guarantee
the new font description is actually up to date. We can leave the function with the computed orientation and the font
description still out of sync.
        
Fix by bailing out fast only if the font description is already in sync.
        
No layout test yet, verified with a test app.

* css/StyleResolver.cpp:
(WebCore::checkForOrientationChange):
(WebCore::StyleResolver::updateFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138298 => 138299)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 22:12:40 UTC (rev 138298)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 22:13:16 UTC (rev 138299)
@@ -1,3 +1,23 @@
+2012-12-20  Antti Koivisto  <an...@apple.com>
+
+        Font description not synchronized correctly on orientation affecting property changes
+        https://bugs.webkit.org/show_bug.cgi?id=105533
+
+        Reviewed by Enrica Casucci.
+
+        In StyleResolver checkForOrientationChange() function checks if the new computed orientation differs from the parent
+        orientation and updates the style's font description only if it does. This is not correct as equal values do not guarantee
+        the new font description is actually up to date. We can leave the function with the computed orientation and the font
+        description still out of sync.
+        
+        Fix by bailing out fast only if the font description is already in sync.
+        
+        No layout test yet, verified with a test app.
+
+        * css/StyleResolver.cpp:
+        (WebCore::checkForOrientationChange):
+        (WebCore::StyleResolver::updateFont):
+
 2012-12-20  Ryan Sleevi  <rsle...@chromium.org>
 
         window.crypto.getRandomValues should return the input ArrayBufferView

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (138298 => 138299)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-12-20 22:12:40 UTC (rev 138298)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-12-20 22:13:16 UTC (rev 138299)
@@ -2151,23 +2151,19 @@
     return false;
 }
 
-static void checkForOrientationChange(RenderStyle* style, const RenderStyle* parentStyle)
+static void checkForOrientationChange(RenderStyle* style)
 {
-    FontOrientation childFontOrientation;
-    NonCJKGlyphOrientation childGlyphOrientation;
-    getFontAndGlyphOrientation(style, childFontOrientation, childGlyphOrientation);
+    FontOrientation fontOrientation;
+    NonCJKGlyphOrientation glyphOrientation;
+    getFontAndGlyphOrientation(style, fontOrientation, glyphOrientation);
 
-    FontOrientation parentFontOrientation;
-    NonCJKGlyphOrientation parentGlyphOrientation;
-    getFontAndGlyphOrientation(parentStyle, parentFontOrientation, parentGlyphOrientation);
-
-    if (childFontOrientation == parentFontOrientation && childGlyphOrientation == parentGlyphOrientation)
+    const FontDescription& fontDescription = style->fontDescription();
+    if (fontDescription.orientation() == fontOrientation && fontDescription.nonCJKGlyphOrientation() == glyphOrientation)
         return;
 
-    const FontDescription& childFont = style->fontDescription();
-    FontDescription newFontDescription(childFont);
-    newFontDescription.setNonCJKGlyphOrientation(childGlyphOrientation);
-    newFontDescription.setOrientation(childFontOrientation);
+    FontDescription newFontDescription(fontDescription);
+    newFontDescription.setNonCJKGlyphOrientation(glyphOrientation);
+    newFontDescription.setOrientation(fontOrientation);
     style->setFontDescription(newFontDescription);
 }
 
@@ -2179,7 +2175,7 @@
     checkForTextSizeAdjust();
     checkForGenericFamilyChange(style(), m_parentStyle);
     checkForZoomChange(style(), m_parentStyle);
-    checkForOrientationChange(style(), m_parentStyle);
+    checkForOrientationChange(style());
     m_style->font().update(m_fontSelector);
     m_fontDirty = false;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to