Title: [199150] trunk
Revision
199150
Author
[email protected]
Date
2016-04-06 22:19:52 -0700 (Wed, 06 Apr 2016)

Log Message

REGRESSION (r188591): thingiverse.com direct messaging UI is not rendered properly
https://bugs.webkit.org/show_bug.cgi?id=156241
<rdar://problem/25262213>

Reviewed by Simon Fraser.

Source/WebCore:

When creating a CoreText font with a size of 0, the CoreText docs say that it will
interpret this as a missing argument, and create a font of size 12 instead. However,
this doesn't cause a problem (at least on this particular website) because we will
use CGFontGetGlyphAdvancesForStyle(), which gets scaled by the supplied font
size (which is 0). However, if you turn on text-rendering: optimizeLegibility, we
will use CTFontGetAdvancesForGlyphs() instead, which does not scale by the font size.
The solution is to detect this case, and force the advance to 0.

Test: fast/text/zero-sized-fonts.html

* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformWidthForGlyph):

LayoutTests:

* fast/text/zero-sized-fonts-expected.txt: Added.
* fast/text/zero-sized-fonts.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199149 => 199150)


--- trunk/LayoutTests/ChangeLog	2016-04-07 04:59:55 UTC (rev 199149)
+++ trunk/LayoutTests/ChangeLog	2016-04-07 05:19:52 UTC (rev 199150)
@@ -1,3 +1,14 @@
+2016-04-06  Myles C. Maxfield  <[email protected]>
+
+        REGRESSION (r188591): thingiverse.com direct messaging UI is not rendered properly
+        https://bugs.webkit.org/show_bug.cgi?id=156241
+        <rdar://problem/25262213>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/zero-sized-fonts-expected.txt: Added.
+        * fast/text/zero-sized-fonts.html: Added.
+
 2016-04-06  Matt Baker  <[email protected]>
 
         Web Inspector: Improve filtering in OpenResourceDialog

Added: trunk/LayoutTests/fast/text/zero-sized-fonts-expected.txt (0 => 199150)


--- trunk/LayoutTests/fast/text/zero-sized-fonts-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/zero-sized-fonts-expected.txt	2016-04-07 05:19:52 UTC (rev 199150)
@@ -0,0 +1,6 @@
+PASS document.getElementById('sample').getBoundingClientRect().height < 30 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This test makes sure that 0-sized fonts have 0-sized advances. The green rectangle below's height should be less than 30 pixels.
+ 
Property changes on: trunk/LayoutTests/fast/text/zero-sized-fonts-expected.txt
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/text/zero-sized-fonts.html (0 => 199150)


--- trunk/LayoutTests/fast/text/zero-sized-fonts.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/zero-sized-fonts.html	2016-04-07 05:19:52 UTC (rev 199150)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body style="text-rendering: optimizeLegibility;">
+This test makes sure that 0-sized fonts have 0-sized advances. The green rectangle below's height should be less than 30 pixels.
+<div id="sample" style="font-size: 0; width: 970px; background: green;"><div style="display: inline-block; width: 320px; height: 20px; font-size: 16px; background: green;"></div> <div style="display: inline-block; width: 648px; height: 10px; font-size: 16px; background: green;"></div></div>
+<script>
+shouldBeTrue("document.getElementById('sample').getBoundingClientRect().height < 30");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (199149 => 199150)


--- trunk/Source/WebCore/ChangeLog	2016-04-07 04:59:55 UTC (rev 199149)
+++ trunk/Source/WebCore/ChangeLog	2016-04-07 05:19:52 UTC (rev 199150)
@@ -1,5 +1,26 @@
 2016-04-06  Myles C. Maxfield  <[email protected]>
 
+        REGRESSION (r188591): thingiverse.com direct messaging UI is not rendered properly
+        https://bugs.webkit.org/show_bug.cgi?id=156241
+        <rdar://problem/25262213>
+
+        Reviewed by Simon Fraser.
+
+        When creating a CoreText font with a size of 0, the CoreText docs say that it will
+        interpret this as a missing argument, and create a font of size 12 instead. However,
+        this doesn't cause a problem (at least on this particular website) because we will
+        use CGFontGetGlyphAdvancesForStyle(), which gets scaled by the supplied font 
+        size (which is 0). However, if you turn on text-rendering: optimizeLegibility, we
+        will use CTFontGetAdvancesForGlyphs() instead, which does not scale by the font size.
+        The solution is to detect this case, and force the advance to 0.
+
+        Test: fast/text/zero-sized-fonts.html
+
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::platformWidthForGlyph):
+
+2016-04-06  Myles C. Maxfield  <[email protected]>
+
         Rename MidpointState to WhitespaceCollapsingState
         https://bugs.webkit.org/show_bug.cgi?id=156304
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (199149 => 199150)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2016-04-07 04:59:55 UTC (rev 199149)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2016-04-07 05:19:52 UTC (rev 199150)
@@ -694,7 +694,7 @@
             LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize);
             advance.width = 0;
         }
-    } else if (!populatedAdvance)
+    } else if (!populatedAdvance && platformData().m_size)
         CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontOrientationHorizontal : kCTFontOrientationVertical, &glyph, &advance, 1);
 
     return advance.width + m_syntheticBoldOffset;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to