Fonts forced to use non synthetic italics might be laid out with the incorrect baseline
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Aug 2014 23:13:18 +0000 (23:13 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Aug 2014 23:13:18 +0000 (23:13 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172504 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html [new file with mode: 0644]
LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/SimpleFontData.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 7481bbe3ba59da4c004023e504b1354b6d391bee..8c88f5cb9edcf71997605f1d4c81793da8e6b0ee 100644 (file)
@@ -1,3 +1,16 @@
+2014-08-12  Myles C. Maxfield  <mmaxfield@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-szeged@partner.samsung.com>
 
         Make sure that begin time cannot be greater than SMILTime::indefiniteValue unintentionally.
diff --git a/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html b/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double-expected.html
new file mode 100644 (file)
index 0000000..69454f8
--- /dev/null
@@ -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>
diff --git a/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html b/LayoutTests/fast/text/international/synthesized-italic-vertical-latin-double.html
new file mode 100644 (file)
index 0000000..4bcdbbe
--- /dev/null
@@ -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>
index 5992a7a6bbfd9cac502651ba6ae71f12f72b3f4c..a1d687422140905bf062d5494da644d5b3fe8c62 100644 (file)
@@ -1,3 +1,27 @@
+2014-08-12  Myles C. Maxfield  <mmaxfield@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  <prandolph@apple.com>
 
         Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture.
index 2cbc3b8e2c4075adcaa79da97ad4509c4709b6fa..94174148a38387921d8d974cadc6cdd8f3115a4f 100644 (file)
@@ -242,7 +242,7 @@ PassRefPtr<SimpleFontData> SimpleFontData::nonSyntheticItalicFontData() const
 #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;
 }
index 8c200664d945d1e45a4f0cbde03a9983f72dc6ca..39243da4383f53ce93299b7ff72b7f1470f622a4 100644 (file)
@@ -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 @@ void Internals::setMarkedTextMatchesAreHighlighted(bool flag, ExceptionCode& ec)
     document->frame()->editor().setMarkedTextMatchesAreHighlighted(flag);
 }
 
+void Internals::invalidateFontCache()
+{
+    fontCache().invalidate();
+}
+
 void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
 {
     Document* document = contextDocument();
index 0ea12c44b124bf52b06c4da1e98244d462c7f81e..fba81595343c434d37dd808046c13c908942fe0c 100644 (file)
@@ -134,6 +134,8 @@ public:
     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&);
index d784737c68f963a2bf61471ee4dd244f7a082a34..ea9609603f90c18ea8145e5a125bf31ec15793a6 100644 (file)
@@ -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);