Title: [211836] trunk
Revision
211836
Author
mmaxfi...@apple.com
Date
2017-02-07 13:37:44 -0800 (Tue, 07 Feb 2017)

Log Message

[Win] [GTK] [EFL] Compile (but don't use, yet) the platform-independent piece of ComplexTextController
https://bugs.webkit.org/show_bug.cgi?id=167927

Reviewed by Brent Fulgham.

Source/WebCore:

This patch simply moves some functions around to enable the Win, GTK, and EFL ports to compile the
platform-independent pieces of ComplexTextController. Those parts of ComplexTextController have
some dependencies which were previously only available on the Cocoa ports; however, those
dependencies are easily created or moved from elsewhere. The next step is to populate the
ComplexTextController::collectComplexTextRunsForCharacters() function for DirectWrite and HarfBuzz.
Once that is done, UniscribeController and HarfBuzzShaper can be deleted.

Adds ComplexTextController TestWebKitAPI tests to the Win and GTK ports.

* CMakeLists.txt: Everyone can compile the platform-independent piece of ComplexTextController.
* PlatformEfl.cmake: Add the HarfBuzz-specific piece.
* PlatformGTK.cmake: Ditto.
* PlatformWin.cmake: Add the DirectWrite-specific piece.
* platform/graphics/ComplexTextController.cpp:
(WebCore::TextLayoutDeleter::operator()): ComplexTextController shouldn't be enabled yet for Win,
GTK, or EFL.
(WebCore::FontCascade::createLayout): Ditto.
(WebCore::FontCascade::width): Ditto.
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved shared code to the shared
file.
* platform/graphics/Font.cpp:
(WebCore::Font::noSynthesizableFeaturesFont): Default implementation for other ports.
(WebCore::Font::variantCapsSupportsCharacterForSynthesis): Ditto.
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence): Ditto.
(WebCore::FontCascade::drawEmphasisMarksForComplexText): Ditto.
(WebCore::FontCascade::createLayout): Deleted. Moved to ComplexTextController.
(WebCore::TextLayoutDeleter::operator()): Deleted. Ditto.
* platform/graphics/FontCascade.h: fontForCombiningCharacterSequence() should exist on all ports.
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Ditto.
* platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Added.
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
HarfBuzz-specific piece of ComplexTextController.
* platform/graphics/mac/ComplexTextControllerCoreText.mm: Moved constructors to shared file.
* platform/graphics/win/ComplexTextControllerDirectWrite.cpp: Added.
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
Direct Write-specific piece of ComplexTextController.
* platform/graphics/win/FontWin.cpp:
(WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.

Tools:

Enable ComplexTextController API tests on the Win and GTK ports.

* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/PlatformWin.cmake:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (211835 => 211836)


--- trunk/Source/WebCore/CMakeLists.txt	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-02-07 21:37:44 UTC (rev 211836)
@@ -2169,6 +2169,7 @@
 
     platform/graphics/BitmapImage.cpp
     platform/graphics/Color.cpp
+    platform/graphics/ComplexTextController.cpp
     platform/graphics/CrossfadeGeneratedImage.cpp
     platform/graphics/DisplayRefreshMonitorClient.cpp
     platform/graphics/ExtendedColor.cpp

Modified: trunk/Source/WebCore/ChangeLog (211835 => 211836)


--- trunk/Source/WebCore/ChangeLog	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/ChangeLog	2017-02-07 21:37:44 UTC (rev 211836)
@@ -1,3 +1,53 @@
+2017-02-07  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Win] [GTK] [EFL] Compile (but don't use, yet) the platform-independent piece of ComplexTextController
+        https://bugs.webkit.org/show_bug.cgi?id=167927
+
+        Reviewed by Brent Fulgham.
+
+        This patch simply moves some functions around to enable the Win, GTK, and EFL ports to compile the
+        platform-independent pieces of ComplexTextController. Those parts of ComplexTextController have
+        some dependencies which were previously only available on the Cocoa ports; however, those
+        dependencies are easily created or moved from elsewhere. The next step is to populate the
+        ComplexTextController::collectComplexTextRunsForCharacters() function for DirectWrite and HarfBuzz.
+        Once that is done, UniscribeController and HarfBuzzShaper can be deleted.
+
+        Adds ComplexTextController TestWebKitAPI tests to the Win and GTK ports.
+
+        * CMakeLists.txt: Everyone can compile the platform-independent piece of ComplexTextController.
+        * PlatformEfl.cmake: Add the HarfBuzz-specific piece.
+        * PlatformGTK.cmake: Ditto.
+        * PlatformWin.cmake: Add the DirectWrite-specific piece.
+        * platform/graphics/ComplexTextController.cpp:
+        (WebCore::TextLayoutDeleter::operator()): ComplexTextController shouldn't be enabled yet for Win,
+        GTK, or EFL.
+        (WebCore::FontCascade::createLayout): Ditto.
+        (WebCore::FontCascade::width): Ditto.
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved shared code to the shared
+        file.
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::noSynthesizableFeaturesFont): Default implementation for other ports.
+        (WebCore::Font::variantCapsSupportsCharacterForSynthesis): Ditto.
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::fontForCombiningCharacterSequence): Ditto.
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText): Ditto.
+        (WebCore::FontCascade::createLayout): Deleted. Moved to ComplexTextController.
+        (WebCore::TextLayoutDeleter::operator()): Deleted. Ditto.
+        * platform/graphics/FontCascade.h: fontForCombiningCharacterSequence() should exist on all ports.
+        * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Ditto.
+        * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Added.
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
+        HarfBuzz-specific piece of ComplexTextController.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm: Moved constructors to shared file.
+        * platform/graphics/win/ComplexTextControllerDirectWrite.cpp: Added.
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
+        Direct Write-specific piece of ComplexTextController.
+        * platform/graphics/win/FontWin.cpp:
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
+
 2017-02-07  Alex Christensen  <achristen...@webkit.org>
 
         Revert r166597

Modified: trunk/Source/WebCore/PlatformEfl.cmake (211835 => 211836)


--- trunk/Source/WebCore/PlatformEfl.cmake	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/PlatformEfl.cmake	2017-02-07 21:37:44 UTC (rev 211836)
@@ -138,6 +138,7 @@
 
     platform/graphics/gstreamer/ImageGStreamerCairo.cpp
 
+    platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
     platform/graphics/harfbuzz/HarfBuzzFace.cpp
     platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
     platform/graphics/harfbuzz/HarfBuzzShaper.cpp

Modified: trunk/Source/WebCore/PlatformGTK.cmake (211835 => 211836)


--- trunk/Source/WebCore/PlatformGTK.cmake	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2017-02-07 21:37:44 UTC (rev 211836)
@@ -119,6 +119,7 @@
 
     platform/graphics/gstreamer/ImageGStreamerCairo.cpp
 
+    platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
     platform/graphics/harfbuzz/HarfBuzzFace.cpp
     platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
     platform/graphics/harfbuzz/HarfBuzzShaper.cpp

Modified: trunk/Source/WebCore/PlatformWin.cmake (211835 => 211836)


--- trunk/Source/WebCore/PlatformWin.cmake	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/PlatformWin.cmake	2017-02-07 21:37:44 UTC (rev 211836)
@@ -86,6 +86,7 @@
     platform/graphics/opentype/OpenTypeUtilities.cpp
 
     platform/graphics/win/ColorDirect2D.cpp
+    platform/graphics/win/ComplexTextControllerDirectWrite.cpp
     platform/graphics/win/DIBPixelData.cpp
     platform/graphics/win/FloatPointDirect2D.cpp
     platform/graphics/win/FloatRectDirect2D.cpp

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -92,19 +92,39 @@
 
 void TextLayoutDeleter::operator()(TextLayout* layout) const
 {
+#if PLATFORM(COCOA)
     delete layout;
+#else
+    ASSERT_UNUSED(layout, !layout);
+#endif
 }
 
 std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText& text, float xPos, bool collapseWhiteSpace) const
 {
+#if PLATFORM(COCOA)
     if (!collapseWhiteSpace || !TextLayout::isNeeded(text, *this))
         return nullptr;
     return std::unique_ptr<TextLayout, TextLayoutDeleter>(new TextLayout(text, *this, xPos));
+#else
+    UNUSED_PARAM(text);
+    UNUSED_PARAM(xPos);
+    UNUSED_PARAM(collapseWhiteSpace);
+    return nullptr;
+#endif
 }
 
 float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
 {
+#if PLATFORM(COCOA)
     return layout.width(from, len, fallbackFonts);
+#else
+    UNUSED_PARAM(layout);
+    UNUSED_PARAM(from);
+    UNUSED_PARAM(len);
+    UNUSED_PARAM(fallbackFonts);
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
 }
 
 void ComplexTextController::computeExpansionOpportunity()
@@ -703,7 +723,6 @@
         const CGGlyph* glyphs = complexTextRun.glyphs();
         const FloatSize* advances = complexTextRun.baseAdvances();
 
-        bool lastRun = runIndex + 1 == runCount;
         float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
         const UChar* cp = complexTextRun.characters();
         FloatPoint glyphOrigin;
@@ -720,14 +739,6 @@
                     isMonotonic = false;
             }
             UChar ch = *(cp + characterIndex);
-            bool lastGlyph = lastRun && i + 1 == glyphCount;
-            UChar nextCh;
-            if (lastGlyph)
-                nextCh = ' ';
-            else if (i + 1 < glyphCount)
-                nextCh = *(cp + complexTextRun.indexAt(i + 1));
-            else
-                nextCh = *(m_complexTextRuns[runIndex + 1]->characters() + m_complexTextRuns[runIndex + 1]->indexAt(0));
 
             bool treatAsSpace = FontCascade::treatAsSpace(ch);
             CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
@@ -830,4 +841,51 @@
     m_totalWidth += widthSinceLastCommit;
 }
 
+// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
+// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
+ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+    : m_font(font)
+    , m_characters(characters)
+    , m_stringLength(stringLength)
+    , m_indexBegin(indexBegin)
+    , m_indexEnd(indexEnd)
+    , m_stringLocation(stringLocation)
+    , m_isLTR(ltr)
+{
+    auto runLengthInCodeUnits = m_indexEnd - m_indexBegin;
+    m_coreTextIndices.reserveInitialCapacity(runLengthInCodeUnits);
+    unsigned r = m_indexBegin;
+    while (r < m_indexEnd) {
+        m_coreTextIndices.uncheckedAppend(r);
+        UChar32 character;
+        U16_NEXT(m_characters, r, m_stringLength, character);
+    }
+    m_glyphCount = m_coreTextIndices.size();
+    if (!ltr) {
+        for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
+            std::swap(m_coreTextIndices[r], m_coreTextIndices[end]);
+    }
+
+    // Synthesize a run of missing glyphs.
+    m_glyphs.fill(0, m_glyphCount);
+    m_baseAdvances.fill(FloatSize(m_font.widthForGlyph(0), 0), m_glyphCount);
+}
+
+ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+    : m_baseAdvances(advances)
+    , m_glyphOrigins(origins)
+    , m_glyphs(glyphs)
+    , m_coreTextIndices(stringIndices)
+    , m_initialAdvance(initialAdvance)
+    , m_font(font)
+    , m_characters(characters)
+    , m_stringLength(stringLength)
+    , m_indexBegin(indexBegin)
+    , m_indexEnd(indexEnd)
+    , m_glyphCount(glyphs.size())
+    , m_stringLocation(stringLocation)
+    , m_isLTR(ltr)
+{
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.h (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2017-02-07 21:37:44 UTC (rev 211836)
@@ -195,7 +195,9 @@
     Vector<unsigned, 16> m_runIndices;
     Vector<unsigned, 16> m_glyphCountFromStartToIndex;
 
+#if PLATFORM(COCOA)
     Vector<RetainPtr<CTLineRef>> m_coreTextLines;
+#endif
 
     Vector<String> m_stringsFor8BitRuns;
 

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -292,9 +292,9 @@
     return m_derivedFontData->smallCaps.get();
 }
 
-#if PLATFORM(COCOA)
 const Font& Font::noSynthesizableFeaturesFont() const
 {
+#if PLATFORM(COCOA)
     if (!m_derivedFontData)
         m_derivedFontData = std::make_unique<DerivedFonts>(isCustomFont());
     if (!m_derivedFontData->noSynthesizableFeatures)
@@ -301,8 +301,10 @@
         m_derivedFontData->noSynthesizableFeatures = createFontWithoutSynthesizableFeatures();
     ASSERT(m_derivedFontData->noSynthesizableFeatures != this);
     return *m_derivedFontData->noSynthesizableFeatures;
+#else
+    return *this;
+#endif
 }
-#endif
 
 const Font* Font::emphasisMarkFont(const FontDescription& fontDescription) const
 {
@@ -505,4 +507,11 @@
     }
 }
 
+#if !PLATFORM(COCOA)
+bool Font::variantCapsSupportsCharacterForSynthesis(FontVariantCaps, UChar32) const
+{
+    return false;
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -431,25 +431,6 @@
     return m_fonts->glyphDataForCharacter(c, m_fontDescription, variant);
 }
 
-#if !PLATFORM(COCOA)
-
-std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText&, float, bool) const
-{
-    return nullptr;
-}
-
-void TextLayoutDeleter::operator()(TextLayout*) const
-{
-}
-
-float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*)
-{
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-#endif
-
 static const char* fontFamiliesWithInvalidCharWidth[] = {
     "American Typewriter",
     "Arial Hebrew",
@@ -1468,5 +1449,30 @@
     return offset;
 }
 
+#if !PLATFORM(COCOA)
+// FIXME: Unify this with the macOS and iOS implementation.
+const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length) const
+{
+    UChar32 baseCharacter;
+    size_t baseCharacterLength = 0;
+    U16_NEXT(characters, baseCharacterLength, length, baseCharacter);
+    GlyphData baseCharacterGlyphData = glyphDataForCharacter(baseCharacter, false, NormalVariant);
 
+    if (!baseCharacterGlyphData.glyph)
+        return nullptr;
+    return baseCharacterGlyphData.font;
 }
+#endif
+
+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, unsigned to) const
+{
+    GlyphBuffer glyphBuffer;
+    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
+
+    if (glyphBuffer.isEmpty())
+        return;
+
+    drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+}
+
+}

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-02-07 21:37:44 UTC (rev 211836)
@@ -184,10 +184,8 @@
     const Font& primaryFont() const;
     const FontRanges& fallbackRangesAt(unsigned) const;
     GlyphData glyphDataForCharacter(UChar32, bool mirror, FontVariant = AutoVariant) const;
-    
-#if PLATFORM(COCOA)
+
     const Font* fontForCombiningCharacterSequence(const UChar*, size_t length) const;
-#endif
 
     static bool isCJKIdeograph(UChar32);
     static bool isCJKIdeographOrSymbol(UChar32);

Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -52,11 +52,6 @@
     return 0;
 }
 
-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, unsigned /* from */, unsigned /* to */) const
-{
-    notImplemented();
-}
-
 bool FontCascade::canReturnFallbackFontsForComplexText()
 {
     return false;

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2017-02-07 21:37:44 UTC (rev 211836)
@@ -531,17 +531,6 @@
     return initialAdvance;
 }
 
-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, unsigned to) const
-{
-    GlyphBuffer glyphBuffer;
-    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
-
-    if (glyphBuffer.isEmpty())
-        return;
-
-    drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
-}
-
 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     ComplexTextController controller(*this, run, true, fallbackFonts);
@@ -560,6 +549,7 @@
     return controller.offsetForPosition(x, includePartialGlyphs);
 }
 
+// FIXME: Use this on all ports.
 const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length) const
 {
     UChar32 baseCharacter;

Added: trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp (0 => 211836)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -0,0 +1,36 @@
+/*
+* Copyright (C) 2017 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "ComplexTextController.h"
+
+namespace WebCore {
+
+void ComplexTextController::collectComplexTextRunsForCharacters(const UChar*, unsigned, unsigned, const Font*)
+{
+    // FIXME: Implement this.
+    ASSERT_NOT_REACHED();
+}
+
+}

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2017-02-07 21:37:44 UTC (rev 211836)
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-
 #include "ComplexTextController.h"
 
 #include "CoreTextSPI.h"
@@ -165,54 +164,6 @@
     }
 }
 
-// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
-// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
-ComplexTextController::ComplexTextRun::ComplexTextRun(const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
-    : m_font(font)
-    , m_characters(characters)
-    , m_stringLength(stringLength)
-    , m_indexBegin(indexBegin)
-    , m_indexEnd(indexEnd)
-    , m_stringLocation(stringLocation)
-    , m_isLTR(ltr)
-{
-    auto runLengthInCodeUnits = m_indexEnd - m_indexBegin;
-    m_coreTextIndices.reserveInitialCapacity(runLengthInCodeUnits);
-    unsigned r = m_indexBegin;
-    while (r < m_indexEnd) {
-        m_coreTextIndices.uncheckedAppend(r);
-        UChar32 character;
-        U16_NEXT(m_characters, r, m_stringLength, character);
-    }
-    m_glyphCount = m_coreTextIndices.size();
-    if (!ltr) {
-        for (unsigned r = 0, end = m_glyphCount - 1; r < m_glyphCount / 2; ++r, --end)
-            std::swap(m_coreTextIndices[r], m_coreTextIndices[end]);
-    }
-
-    // Synthesize a run of missing glyphs.
-    m_glyphs.fill(0, m_glyphCount);
-    m_baseAdvances.fill(FloatSize(m_font.widthForGlyph(0), 0), m_glyphCount);
-}
-
-
-ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
-    : m_baseAdvances(advances)
-    , m_glyphOrigins(origins)
-    , m_glyphs(glyphs)
-    , m_coreTextIndices(stringIndices)
-    , m_initialAdvance(initialAdvance)
-    , m_font(font)
-    , m_characters(characters)
-    , m_stringLength(stringLength)
-    , m_indexBegin(indexBegin)
-    , m_indexEnd(indexEnd)
-    , m_glyphCount(glyphs.size())
-    , m_stringLocation(stringLocation)
-    , m_isLTR(ltr)
-{
-}
-
 struct ProviderInfo {
     const UChar* cp;
     unsigned length;

Added: trunk/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp (0 => 211836)


--- trunk/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -0,0 +1,36 @@
+/*
+* Copyright (C) 2017 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "ComplexTextController.h"
+
+namespace WebCore {
+
+void ComplexTextController::collectComplexTextRunsForCharacters(const UChar*, unsigned, unsigned, const Font*)
+{
+    // FIXME: Implement this.
+    ASSERT_NOT_REACHED();
+}
+
+}

Modified: trunk/Source/WebCore/platform/graphics/win/FontWin.cpp (211835 => 211836)


--- trunk/Source/WebCore/platform/graphics/win/FontWin.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Source/WebCore/platform/graphics/win/FontWin.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -91,17 +91,6 @@
     return beforeWidth;
 }
 
-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, unsigned to) const
-{
-    GlyphBuffer glyphBuffer;
-    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
-
-    if (glyphBuffer.isEmpty())
-        return;
-
-    drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
-}
-
 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
 {
     UniscribeController controller(this, run, fallbackFonts);

Modified: trunk/Tools/ChangeLog (211835 => 211836)


--- trunk/Tools/ChangeLog	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Tools/ChangeLog	2017-02-07 21:37:44 UTC (rev 211836)
@@ -1,3 +1,15 @@
+2017-02-07  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Win] [GTK] [EFL] Compile (but don't use, yet) the platform-independent piece of ComplexTextController
+        https://bugs.webkit.org/show_bug.cgi?id=167927
+
+        Reviewed by Brent Fulgham.
+
+        Enable ComplexTextController API tests on the Win and GTK ports.
+
+        * TestWebKitAPI/PlatformGTK.cmake:
+        * TestWebKitAPI/PlatformWin.cmake:
+
 2017-02-07  Jonathan Bedard  <jbed...@apple.com>
 
         File index appended to previous file in svn-create-patch with SVN 1.9

Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (211835 => 211836)


--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2017-02-07 21:37:44 UTC (rev 211836)
@@ -131,6 +131,7 @@
     ${test_main_SOURCES}
     ${TESTWEBKITAPI_DIR}/TestsController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/CSSParser.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WebCore/ComplexTextController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FileSystem.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp

Modified: trunk/Tools/TestWebKitAPI/PlatformWin.cmake (211835 => 211836)


--- trunk/Tools/TestWebKitAPI/PlatformWin.cmake	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Tools/TestWebKitAPI/PlatformWin.cmake	2017-02-07 21:37:44 UTC (rev 211836)
@@ -46,6 +46,7 @@
     ${TESTWEBKITAPI_DIR}/TestsController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/AffineTransform.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/CalculationValue.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WebCore/ComplexTextController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/CSSParser.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FloatRect.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WebCore/FloatPoint.cpp

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (211835 => 211836)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2017-02-07 21:29:50 UTC (rev 211835)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2017-02-07 21:37:44 UTC (rev 211836)
@@ -74,7 +74,7 @@
     runs.append(WTFMove(run2));
     ComplexTextController controller(font, textRun, runs);
 
-    CGFloat totalWidth = 0;
+    float totalWidth = 0;
     for (size_t i = 1; i < advances.size(); ++i)
         totalWidth += advances[i].width();
     EXPECT_NEAR(controller.totalWidth(), spaceWidth + totalWidth, 0.0001);
@@ -123,7 +123,7 @@
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
 
-    CGFloat totalWidth = 0;
+    float totalWidth = 0;
     for (size_t i = 1; i < advances.size(); ++i)
         totalWidth += advances[i].width();
     EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
@@ -258,7 +258,7 @@
     runs.append(WTFMove(run3));
     ComplexTextController controller(font, textRun, runs);
 
-    CGFloat totalWidth = 14.0397830018083 + 12.0 + 43.8119349005425;
+    float totalWidth = 14.0397830018083 + 12.0 + 43.8119349005425;
     EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
@@ -298,7 +298,7 @@
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
 
-    CGFloat totalWidth = 100 + 24;
+    float totalWidth = 100 + 24;
     EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
     GlyphBuffer glyphBuffer;
     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to