Title: [172504] trunk
Revision
172504
Author
mmaxfi...@apple.com
Date
2014-08-12 16:13:18 -0700 (Tue, 12 Aug 2014)

Log Message

Fonts forced to use non synthetic italics might be laid out with the incorrect baseline
https://bugs.webkit.org/show_bug.cgi?id=135403

Reviewed by Darin Adler.

Source/WebCore:

When italics is specified on a font, and the font isn't coming from the cache, we ask
the SimpleFontData to provide a non-synthetic-italic version of itself. Our current
implementation doesn't preserve whether or not the SimpleFontData includes vertical
glyphs (glyphs that are not rotated when drawn in the vertical writing mode), which
determines which baseline we use to lay out the text. By passing "false" to
the isTextOrientationFallback argument to SimpleFontData::create(), we preserve this
hasVerticalGlyphs flag.

Test: fast/text/international/synthesized-italic-vertical-latin-double.html

* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::nonSyntheticItalicFontData):
* testing/Internals.cpp:
(WebCore::Internals::invalidateFontCache): Add "invalidateFontCache" to window.internals.
* testing/Internals.h: Ditto.
* testing/Internals.idl: Ditto.

LayoutTests:

Laying out the same string twice (where there is a cache collision) should be rendered
the same as laying out similar strings (where there is no cache collision).

* fast/text/international/synthesized-italic-vertical-latin-double-expected.html: Added.
* fast/text/international/synthesized-italic-vertical-latin-double.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172503 => 172504)


--- trunk/LayoutTests/ChangeLog	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/LayoutTests/ChangeLog	2014-08-12 23:13:18 UTC (rev 172504)
@@ -1,3 +1,16 @@
+2014-08-12  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Fonts forced to use non synthetic italics might be laid out with the incorrect baseline
+        https://bugs.webkit.org/show_bug.cgi?id=135403
+
+        Reviewed by Darin Adler.
+
+        Laying out the same string twice (where there is a cache collision) should be rendered
+        the same as laying out similar strings (where there is no cache collision).
+
+        * fast/text/international/synthesized-italic-vertical-latin-double-expected.html: Added.
+        * fast/text/international/synthesized-italic-vertical-latin-double.html: Added.
+
 2014-08-12  Renata Hodovan  <rhodovan.u-sze...@partner.samsung.com>
 
         Make sure that begin time cannot be greater than SMILTime::indefiniteValue unintentionally.

Added: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html (0 => 172504)


--- trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html	2014-08-12 23:13:18 UTC (rev 172504)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="UTF-8">
+  <style>
+    html {
+        -webkit-writing-mode: vertical-lr;
+    }
+    p {
+        font-size: 30px;
+        font-style: italic;
+    }
+  </style>
+</head>
+<body>
+    <script>
+        if (window.internals)
+            window.internals.invalidateFontCache();
+    </script>
+    <p style="color: white;">ABC丹</p>
+    <p>ABC羽</p>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html (0 => 172504)


--- trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html	2014-08-12 23:13:18 UTC (rev 172504)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="UTF-8">
+  <style>
+    html {
+        -webkit-writing-mode: vertical-lr;
+    }
+    p {
+        font-size: 30px;
+        font-style: italic;
+    }
+  </style>
+</head>
+<body>
+    <script>
+        if (window.internals)
+            window.internals.invalidateFontCache();
+    </script>
+    <p style="color: white;">ABC丹羽 亮介</p>
+    <p>ABC羽</p>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (172503 => 172504)


--- trunk/Source/WebCore/ChangeLog	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/Source/WebCore/ChangeLog	2014-08-12 23:13:18 UTC (rev 172504)
@@ -1,3 +1,27 @@
+2014-08-12  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Fonts forced to use non synthetic italics might be laid out with the incorrect baseline
+        https://bugs.webkit.org/show_bug.cgi?id=135403
+
+        Reviewed by Darin Adler.
+
+        When italics is specified on a font, and the font isn't coming from the cache, we ask
+        the SimpleFontData to provide a non-synthetic-italic version of itself. Our current
+        implementation doesn't preserve whether or not the SimpleFontData includes vertical
+        glyphs (glyphs that are not rotated when drawn in the vertical writing mode), which
+        determines which baseline we use to lay out the text. By passing "false" to
+        the isTextOrientationFallback argument to SimpleFontData::create(), we preserve this
+        hasVerticalGlyphs flag.
+
+        Test: fast/text/international/synthesized-italic-vertical-latin-double.html
+
+        * platform/graphics/SimpleFontData.cpp:
+        (WebCore::SimpleFontData::nonSyntheticItalicFontData):
+        * testing/Internals.cpp:
+        (WebCore::Internals::invalidateFontCache): Add "invalidateFontCache" to window.internals.
+        * testing/Internals.h: Ditto.
+        * testing/Internals.idl: Ditto.
+
 2014-08-12  Peyton Randolph  <prando...@apple.com>
 
         Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture.

Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp (172503 => 172504)


--- trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp	2014-08-12 23:13:18 UTC (rev 172504)
@@ -242,7 +242,7 @@
 #if PLATFORM(COCOA)
         nonSyntheticItalicFontPlatformData.m_syntheticOblique = false;
 #endif
-        m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont(), false, true);
+        m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont());
     }
     return m_derivedFontData->nonSyntheticItalic;
 }

Modified: trunk/Source/WebCore/testing/Internals.cpp (172503 => 172504)


--- trunk/Source/WebCore/testing/Internals.cpp	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/Source/WebCore/testing/Internals.cpp	2014-08-12 23:13:18 UTC (rev 172504)
@@ -47,6 +47,7 @@
 #include "Element.h"
 #include "EventHandler.h"
 #include "ExceptionCode.h"
+#include "FontCache.h"
 #include "FormController.h"
 #include "FrameLoader.h"
 #include "FrameView.h"
@@ -818,6 +819,11 @@
     document->frame()->editor().setMarkedTextMatchesAreHighlighted(flag);
 }
 
+void Internals::invalidateFontCache()
+{
+    fontCache().invalidate();
+}
+
 void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
 {
     Document* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (172503 => 172504)


--- trunk/Source/WebCore/testing/Internals.h	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/Source/WebCore/testing/Internals.h	2014-08-12 23:13:18 UTC (rev 172504)
@@ -134,6 +134,8 @@
     void addTextMatchMarker(const Range*, bool isActive);
     void setMarkedTextMatchesAreHighlighted(bool, ExceptionCode&);
 
+    void invalidateFontCache();
+
     void setScrollViewPosition(long x, long y, ExceptionCode&);
     void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }
     void setPagination(const String& mode, int gap, int pageLength, ExceptionCode&);

Modified: trunk/Source/WebCore/testing/Internals.idl (172503 => 172504)


--- trunk/Source/WebCore/testing/Internals.idl	2014-08-12 23:11:19 UTC (rev 172503)
+++ trunk/Source/WebCore/testing/Internals.idl	2014-08-12 23:13:18 UTC (rev 172504)
@@ -84,6 +84,8 @@
     void addTextMatchMarker(Range range, boolean isActive);
     [RaisesException] void setMarkedTextMatchesAreHighlighted(boolean flag);
 
+    void invalidateFontCache();
+
     [RaisesException] void setScrollViewPosition(long x, long y);
 
     [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to