Title: [129273] trunk
Revision
129273
Author
[email protected]
Date
2012-09-21 16:35:07 -0700 (Fri, 21 Sep 2012)

Log Message

[Chromium] Use OpenTypeVerticalData on Linux
https://bugs.webkit.org/show_bug.cgi?id=97277

Reviewed by Tony Chang.

Source/WebCore:

Remove HarfBuzz dependency from GlyphPageTreeNodeSkia. Use OpenTypeVerticalData instead.

No new tests. Rebaselined existing tests.

* WebCore.gyp/WebCore.gyp: Added OpenTypeTypes.h and OpenTypeVerticalData.(cpp|h) for linux and android.
* platform/graphics/FontCache.cpp:
Inserted a space between > and > in typedef of FontVerticalDataCache so that making some compilers happy.
(WebCore):
* platform/graphics/SimpleFontData.h:
(SimpleFontData): Moved declaration of m_verticalData to avoid compile warnings.
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
(WebCore):
(WebCore::FontPlatformData::verticalData): Added.
(WebCore::FontPlatformData::openTypeTable): Added.
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:
(WebCore):
(FontPlatformData):
* platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: Removed substituteWithVerticalGlyphs().
(WebCore::GlyphPage::fill):

Source/WebKit/chromium:

* features.gypi: Enable OPENTYPE_VERTICAL on linux and android.

LayoutTests:

Rebaselined vertical writing test expectations.

* platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png:
* platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png:
* platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png:
* platform/chromium-linux/fast/dynamic/text-combine-expected.png:
* platform/chromium-linux/fast/repaint/japanese-rl-selection-repaint-expected.png:
* platform/chromium-linux/fast/text/international/text-spliced-font-expected.png:
* platform/chromium-linux/fast/writing-mode/Kusa-Makura-background-canvas-expected.png:
* platform/chromium-linux/fast/writing-mode/border-vertical-lr-expected.png:
* platform/chromium-linux/fast/writing-mode/japanese-lr-selection-expected.png:
* platform/chromium-linux/fast/writing-mode/japanese-lr-text-expected.png:
* platform/chromium-linux/fast/writing-mode/japanese-rl-selection-expected.png:
* platform/chromium-linux/fast/writing-mode/japanese-rl-text-expected.png:
* platform/chromium-linux/fast/writing-mode/japanese-rl-text-with-broken-font-expected.png:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129272 => 129273)


--- trunk/LayoutTests/ChangeLog	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/LayoutTests/ChangeLog	2012-09-21 23:35:07 UTC (rev 129273)
@@ -1,3 +1,31 @@
+2012-09-21  Kenichi Ishibashi  <[email protected]>
+
+        [Chromium] Use OpenTypeVerticalData on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=97277
+
+        Reviewed by Tony Chang.
+
+        Rebaselined vertical writing test expectations.
+
+        * platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png:
+        * platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png:
+        * platform/chromium-linux/fast/dynamic/text-combine-expected.png:
+        * platform/chromium-linux/fast/repaint/japanese-rl-selection-repaint-expected.png:
+        * platform/chromium-linux/fast/text/international/text-spliced-font-expected.png:
+        * platform/chromium-linux/fast/writing-mode/Kusa-Makura-background-canvas-expected.png:
+        * platform/chromium-linux/fast/writing-mode/border-vertical-lr-expected.png:
+        * platform/chromium-linux/fast/writing-mode/japanese-lr-selection-expected.png:
+        * platform/chromium-linux/fast/writing-mode/japanese-lr-text-expected.png:
+        * platform/chromium-linux/fast/writing-mode/japanese-rl-selection-expected.png:
+        * platform/chromium-linux/fast/writing-mode/japanese-rl-text-expected.png:
+        * platform/chromium-linux/fast/writing-mode/japanese-rl-text-with-broken-font-expected.png:
+
 2012-09-21  Benjamin Poulain  <[email protected]>
 
         Skip fast/dom/Geolocation/disconnected-frame.html until the assertion is fixed

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/dynamic/text-combine-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/repaint/japanese-rl-selection-repaint-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/text/international/text-spliced-font-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/Kusa-Makura-background-canvas-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/border-vertical-lr-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/japanese-lr-selection-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/japanese-lr-text-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/japanese-rl-selection-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/japanese-rl-text-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/writing-mode/japanese-rl-text-with-broken-font-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (129272 => 129273)


--- trunk/Source/WebCore/ChangeLog	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/ChangeLog	2012-09-21 23:35:07 UTC (rev 129273)
@@ -1,3 +1,30 @@
+2012-09-21  Kenichi Ishibashi  <[email protected]>
+
+        [Chromium] Use OpenTypeVerticalData on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=97277
+
+        Reviewed by Tony Chang.
+
+        Remove HarfBuzz dependency from GlyphPageTreeNodeSkia. Use OpenTypeVerticalData instead.
+
+        No new tests. Rebaselined existing tests.
+
+        * WebCore.gyp/WebCore.gyp: Added OpenTypeTypes.h and OpenTypeVerticalData.(cpp|h) for linux and android.
+        * platform/graphics/FontCache.cpp:
+        Inserted a space between > and > in typedef of FontVerticalDataCache so that making some compilers happy.
+        (WebCore):
+        * platform/graphics/SimpleFontData.h:
+        (SimpleFontData): Moved declaration of m_verticalData to avoid compile warnings.
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
+        (WebCore):
+        (WebCore::FontPlatformData::verticalData): Added.
+        (WebCore::FontPlatformData::openTypeTable): Added.
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:
+        (WebCore):
+        (FontPlatformData):
+        * platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: Removed substituteWithVerticalGlyphs().
+        (WebCore::GlyphPage::fill):
+
 2012-09-21  Jeremy Apthorp  <[email protected]>
 
         Crash in WebCore::Document::fullScreenChangeDelayTimerFired

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (129272 => 129273)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-09-21 23:35:07 UTC (rev 129273)
@@ -1667,6 +1667,8 @@
             ['include', 'platform/graphics/harfbuzz/FontPlatformDataHarfBuzz\\.cpp$'],
             ['include', 'platform/graphics/harfbuzz/HarfBuzzSkia\\.cpp$'],
             ['include', 'platform/graphics/harfbuzz/HarfBuzzShaperBase\\.(cpp|h)$'],
+            ['include', 'platform/graphics/opentype/OpenTypeTypes\\.h$'],
+            ['include', 'platform/graphics/opentype/OpenTypeVerticalData\\.(cpp|h)$'],
             ['include', 'platform/graphics/skia/SimpleFontDataSkia\\.cpp$'],
           ],
         }, { # use_x11==0
@@ -1885,6 +1887,8 @@
             ['include', 'platform/graphics/harfbuzz/FontPlatformDataHarfBuzz\\.cpp$'],
             ['include', 'platform/graphics/harfbuzz/HarfBuzzSkia\\.cpp$'],
             ['include', 'platform/graphics/harfbuzz/HarfBuzzShaperBase\\.cpp$'],
+            ['include', 'platform/graphics/opentype/OpenTypeTypes\\.h$'],
+            ['include', 'platform/graphics/opentype/OpenTypeVerticalData\\.(cpp|h)$'],
             ['exclude', 'platform/graphics/skia/FontCacheSkia\\.cpp$'],
             ['include', 'platform/graphics/skia/SimpleFontDataSkia\\.cpp$'],
           ],

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (129272 => 129273)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2012-09-21 23:35:07 UTC (rev 129273)
@@ -229,7 +229,7 @@
 }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-typedef HashMap<FontCache::FontFileKey, OwnPtr<OpenTypeVerticalData>> FontVerticalDataCache;
+typedef HashMap<FontCache::FontFileKey, OwnPtr<OpenTypeVerticalData> > FontVerticalDataCache;
 
 FontVerticalDataCache& fontVerticalDataCacheInstance()
 {

Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (129272 => 129273)


--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2012-09-21 23:35:07 UTC (rev 129273)
@@ -229,9 +229,6 @@
 
     mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap;
     mutable GlyphMetricsMap<float> m_glyphToWidthMap;
-#if ENABLE(OPENTYPE_VERTICAL)
-    const OpenTypeVerticalData* m_verticalData;
-#endif
 
     bool m_treatAsFixedPitch;
     bool m_isCustomFont;  // Whether or not we are custom font loaded via @font-face
@@ -239,6 +236,9 @@
     
     bool m_isTextOrientationFallback;
     bool m_isBrokenIdeographFallback;
+#if ENABLE(OPENTYPE_VERTICAL)
+    const OpenTypeVerticalData* m_verticalData;
+#endif
     bool m_hasVerticalGlyphs;
     
     Glyph m_spaceGlyph;

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp (129272 => 129273)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-09-21 23:35:07 UTC (rev 129273)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "FontPlatformDataHarfBuzz.h"
 
+#include "FontCache.h"
 #include "NotImplemented.h"
 #include "SkAdvancedTypefaceMetrics.h"
 #include "SkFontHost.h"
@@ -341,4 +342,34 @@
         m_style.useSubpixelRendering = useSkiaSubpixelRendering;
 }
 
+#if ENABLE(OPENTYPE_VERTICAL)
+static SkFontTableTag reverseByteOrder(uint32_t tableTag)
+{
+    return (tableTag >> 24) | ((tableTag >> 8) & 0xff00) | ((tableTag & 0xff00) << 8) | ((tableTag & 0xff) << 24);
+}
+
+const OpenTypeVerticalData* FontPlatformData::verticalData() const
+{
+    if (!uniqueID())
+        return 0;
+    return fontCache()->getVerticalData(uniqueID(), *this);
+}
+
+PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
+{
+    RefPtr<SharedBuffer> buffer;
+    if (!uniqueID())
+        return buffer.release();
+
+    SkFontTableTag tag = reverseByteOrder(table);
+    const size_t tableSize = SkFontHost::GetTableSize(uniqueID(), tag);
+    if (tableSize) {
+        Vector<char> tableBuffer(tableSize);
+        SkFontHost::GetTableData(uniqueID(), tag, 0, tableSize, &tableBuffer[0]);
+        buffer = SharedBuffer::adoptVector(tableBuffer);
+    }
+    return buffer.release();
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h (129272 => 129273)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-09-21 23:35:07 UTC (rev 129273)
@@ -33,6 +33,7 @@
 
 #include "FontOrientation.h"
 #include "FontRenderStyle.h"
+#include "SharedBuffer.h"
 #include "SkPaint.h"
 #include "TextOrientation.h"
 #include <wtf/Forward.h>
@@ -46,6 +47,7 @@
 namespace WebCore {
 
 class FontDescription;
+class OpenTypeVerticalData;
 
 #if USE(HARFBUZZ_NG)
 class HarfBuzzNGFace;
@@ -102,6 +104,11 @@
     FontPlatformData& operator=(const FontPlatformData&);
     bool isHashTableDeletedValue() const { return m_typeface == hashTableDeletedFontValue(); }
 
+#if ENABLE(OPENTYPE_VERTICAL)
+    const OpenTypeVerticalData* verticalData() const;
+    PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
+#endif
+
 #ifndef NDEBUG
     String description() const;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp (129272 => 129273)


--- trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp	2012-09-21 23:35:07 UTC (rev 129273)
@@ -32,60 +32,14 @@
 #include "GlyphPageTreeNode.h"
 
 #include "Font.h"
-#if !USE(HARFBUZZ_NG)
-#include "HarfBuzzSkia.h"
-#else
-#include "NotImplemented.h"
-#endif
 #include "SimpleFontData.h"
 
 #include "SkTemplates.h"
 #include "SkPaint.h"
 #include "SkUtils.h"
 
-#if !USE(HARFBUZZ_NG)
-extern "C" {
-#include "harfbuzz-shaper.h"
-}
-#endif
-
 namespace WebCore {
 
-static int substituteWithVerticalGlyphs(const SimpleFontData* fontData, uint16_t* glyphs, unsigned bufferLength)
-{
-#if USE(HARFBUZZ_NG)
-    notImplemented();
-    return 0xFFFF;
-#else
-    HB_FaceRec_* hbFace = fontData->platformData().harfbuzzFace()->face();
-    if (!hbFace->gsub) {
-        // if there is no GSUB table, treat it as not covered
-        return 0Xffff;
-    }
-
-    HB_Buffer buffer;
-    hb_buffer_new(&buffer);
-    for (unsigned i = 0; i < bufferLength; ++i)
-        hb_buffer_add_glyph(buffer, glyphs[i], 0, i);
-
-    HB_UShort scriptIndex;
-    HB_UShort featureIndex;
-
-    HB_GSUB_Select_Script(hbFace->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &scriptIndex);
-    HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'e', 'r', 't'), scriptIndex, 0xffff, &featureIndex);
-    HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1);
-    HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'r', 't', '2'), scriptIndex, 0xffff, &featureIndex);
-    HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1);
-
-    int error = HB_GSUB_Apply_String(hbFace->gsub, buffer);
-    if (!error) {
-        for (unsigned i = 0; i < bufferLength; ++i)
-            glyphs[i] = static_cast<Glyph>(buffer->out_string[i].gindex);
-    }
-    return error;
-#endif
-}
-
 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     if (SkUTF16_IsHighSurrogate(buffer[bufferLength-1])) {
@@ -106,15 +60,6 @@
         return false;
     }
 
-    if (fontData->hasVerticalGlyphs()) {
-        for (unsigned i = 0; i < bufferLength; ++i) {
-            if (!Font::isCJKIdeograph(buffer[i])) {
-                substituteWithVerticalGlyphs(fontData, glyphs, length);
-                break;
-            }
-        }
-    }
-
     unsigned allGlyphs = 0; // track if any of the glyphIDs are non-zero
     for (unsigned i = 0; i < length; i++) {
         setGlyphDataForIndex(offset + i, glyphs[i], glyphs[i] ? fontData : NULL);

Modified: trunk/Source/WebKit/chromium/ChangeLog (129272 => 129273)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-21 23:35:07 UTC (rev 129273)
@@ -1,3 +1,12 @@
+2012-09-21  Kenichi Ishibashi  <[email protected]>
+
+        [Chromium] Use OpenTypeVerticalData on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=97277
+
+        Reviewed by Tony Chang.
+
+        * features.gypi: Enable OPENTYPE_VERTICAL on linux and android.
+
 2012-09-21  Dirk Pranke  <[email protected]>
 
         Roll Chromium DEPS to r158095 to pick up typo fix in test_expectations.txt

Modified: trunk/Source/WebKit/chromium/features.gypi (129272 => 129273)


--- trunk/Source/WebKit/chromium/features.gypi	2012-09-21 23:29:30 UTC (rev 129272)
+++ trunk/Source/WebKit/chromium/features.gypi	2012-09-21 23:35:07 UTC (rev 129273)
@@ -203,7 +203,7 @@
           'WTF_USE_WEBAUDIO_FFMPEG=1',
         ],
       }],
-      ['OS=="win"', {
+      ['OS=="win" or use_x11==1', {
         'feature_defines': [
           'ENABLE_OPENTYPE_VERTICAL=1',
         ],
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to