WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-167927-20170207103105.patch (text/plain), 28.92 KB, created by
Myles C. Maxfield
on 2017-02-07 10:33:29 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2017-02-07 10:33:29 PST
Size:
28.92 KB
patch
obsolete
>Subversion Revision: 211818 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8256d9cad5b3410652beacb44064043b4fc6e2c6..a376aec3630e677555c49297da820e0fcf38ecfa 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,53 @@ >+2017-02-07 Myles C. Maxfield <mmaxfield@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 NOBODY (OOPS!). >+ >+ 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 Yusuke Suzuki <utatane.tea@gmail.com> > > Unreviewed, manual roll out of r211777 >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 5b991e70e9da86a1d354d364e3dea14f59bcfa56..c7f4be08891474e316b50b430379e368b36f2030 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -2166,6 +2166,7 @@ set(WebCore_SOURCES > > platform/graphics/BitmapImage.cpp > platform/graphics/Color.cpp >+ platform/graphics/ComplexTextController.cpp > platform/graphics/CrossfadeGeneratedImage.cpp > platform/graphics/DisplayRefreshMonitorClient.cpp > platform/graphics/ExtendedColor.cpp >diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake >index 1f0e1035ad4ad2e1e3f0b1725a2acecee3c80c99..50ab723670f5858d24a5c6c0ff05e261ba13efd6 100644 >--- a/Source/WebCore/PlatformEfl.cmake >+++ b/Source/WebCore/PlatformEfl.cmake >@@ -138,6 +138,7 @@ list(APPEND WebCore_SOURCES > > 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 >diff --git a/Source/WebCore/PlatformGTK.cmake b/Source/WebCore/PlatformGTK.cmake >index c0bcd2a48ea71967b120a4e04f1e6a9e746867e5..a7ceeb8dbc736efc0fd899e6df226bdf1fbd4c2f 100644 >--- a/Source/WebCore/PlatformGTK.cmake >+++ b/Source/WebCore/PlatformGTK.cmake >@@ -119,6 +119,7 @@ list(APPEND WebCore_SOURCES > > 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 >diff --git a/Source/WebCore/PlatformWin.cmake b/Source/WebCore/PlatformWin.cmake >index fd48cc178a35152821d2af1d040a48b5fe06e9fc..3b5b40b39d011ef3a052da8757440bc5848c0104 100644 >--- a/Source/WebCore/PlatformWin.cmake >+++ b/Source/WebCore/PlatformWin.cmake >@@ -86,6 +86,7 @@ list(APPEND WebCore_SOURCES > 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 >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index dd9f3cacdc34b04a4181f7b29007b583683bdcc7..22dc12434da3f28d20acc696e59dc2b44dbc38e7 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -92,19 +92,39 @@ private: > > 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() >@@ -721,13 +741,6 @@ void ComplexTextController::adjustGlyphsAndAdvances() > } > 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 +843,52 @@ void ComplexTextController::adjustGlyphsAndAdvances() > 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 >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.h b/Source/WebCore/platform/graphics/ComplexTextController.h >index 09aba55c4d2550e9af1bbdae72dd60671ea5b4a5..169d891b23989f0b1a609dcf15ea11596f478638 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.h >+++ b/Source/WebCore/platform/graphics/ComplexTextController.h >@@ -195,7 +195,9 @@ private: > Vector<unsigned, 16> m_runIndices; > Vector<unsigned, 16> m_glyphCountFromStartToIndex; > >+#if PLATFORM(COCOA) > Vector<RetainPtr<CTLineRef>> m_coreTextLines; >+#endif > > Vector<String> m_stringsFor8BitRuns; > >diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp >index c9ac4dd617dc578c4ee439378f82a269bb148057..3071a9c9ccec51348468a3b62321ea0e0ee2b24e 100644 >--- a/Source/WebCore/platform/graphics/Font.cpp >+++ b/Source/WebCore/platform/graphics/Font.cpp >@@ -293,6 +293,7 @@ const Font* Font::smallCapsFont(const FontDescription& fontDescription) const > } > > #if PLATFORM(COCOA) >+ > const Font& Font::noSynthesizableFeaturesFont() const > { > if (!m_derivedFontData) >@@ -302,6 +303,14 @@ const Font& Font::noSynthesizableFeaturesFont() const > ASSERT(m_derivedFontData->noSynthesizableFeatures != this); > return *m_derivedFontData->noSynthesizableFeatures; > } >+ >+#else >+ >+const Font& Font::noSynthesizableFeaturesFont() const >+{ >+ return *this; >+} >+ > #endif > > const Font* Font::emphasisMarkFont(const FontDescription& fontDescription) const >@@ -505,4 +514,11 @@ void Font::removeFromSystemFallbackCache() > } > } > >+#if !PLATFORM(COCOA) >+bool Font::variantCapsSupportsCharacterForSynthesis(FontVariantCaps, UChar32) const >+{ >+ return false; >+} >+#endif >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/FontCascade.cpp b/Source/WebCore/platform/graphics/FontCascade.cpp >index 6ac86f863c1efc864066edb65c37c3ca509a50ad..f7bfdfa510d0dd55274c2ade4f2b103d841dddc3 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.cpp >+++ b/Source/WebCore/platform/graphics/FontCascade.cpp >@@ -431,25 +431,6 @@ GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontVariant > 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 @@ int FontCascade::offsetForPositionForSimpleText(const TextRun& run, float x, boo > 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())); >+} > > } >diff --git a/Source/WebCore/platform/graphics/FontCascade.h b/Source/WebCore/platform/graphics/FontCascade.h >index bc7a1187ec600cab5a05143b39e035a76871d828..92d878620609e9969ff95e5bde737ea939970c2d 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.h >+++ b/Source/WebCore/platform/graphics/FontCascade.h >@@ -184,10 +184,8 @@ public: > 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); >diff --git a/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp b/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp >index 08bae3808488454ad738672c3e28845c84bfd033..cc37d7d5814183f8a1ac6d85499ccb466a0485ba 100644 >--- a/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp >+++ b/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp >@@ -52,11 +52,6 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > 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; >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >index acab113d3887f66db61ffda47dcdf7ed1dae03bd..834f714442da249e71ca2a0d642b918fe9fc1364 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >@@ -531,17 +531,6 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > 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 @@ int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bo > return controller.offsetForPosition(x, includePartialGlyphs); > } > >+// FIXME: Use this on all ports. > const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characters, size_t length) const > { > UChar32 baseCharacter; >diff --git a/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..e97f9c204d1c65078ad762eff3bf06c61b8db1b9 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp >@@ -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(); >+} >+ >+} >diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >index 24bf27ecd4aedb9a0981a321b19f39bd0184943a..e959d28802aef98af89b525b0b8ce5094fe52d8d 100644 >--- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >+++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >@@ -23,7 +23,6 @@ > */ > > #include "config.h" >- > #include "ComplexTextController.h" > > #include "CoreTextSPI.h" >@@ -165,54 +164,6 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font > } > } > >-// 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; >diff --git a/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp b/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..e97f9c204d1c65078ad762eff3bf06c61b8db1b9 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/win/ComplexTextControllerDirectWrite.cpp >@@ -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(); >+} >+ >+} >diff --git a/Source/WebCore/platform/graphics/win/FontWin.cpp b/Source/WebCore/platform/graphics/win/FontWin.cpp >index 21d32edbf95880129990fa55c8e964fe44037912..120e5011249a6af1cb31c3b9488a345828d4f145 100644 >--- a/Source/WebCore/platform/graphics/win/FontWin.cpp >+++ b/Source/WebCore/platform/graphics/win/FontWin.cpp >@@ -91,17 +91,6 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > 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); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 5646028033b5a6b79da8d79a8816d0ef0ed4e321..4b43acc491634467852664f18e064cfaf21e174e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,15 @@ >+2017-02-07 Myles C. Maxfield <mmaxfield@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 NOBODY (OOPS!). >+ >+ Enable ComplexTextController API tests on the Win and GTK ports. >+ >+ * TestWebKitAPI/PlatformGTK.cmake: >+ * TestWebKitAPI/PlatformWin.cmake: >+ > 2017-02-07 Olivier Blin <olivier.blin@softathome.com> > > [webkitdirs] remove unused host_processor variable in determineArchitecture() >diff --git a/Tools/TestWebKitAPI/PlatformGTK.cmake b/Tools/TestWebKitAPI/PlatformGTK.cmake >index cff96765ae9735fe5de6d88d9cc2d075a3495a66..ffc72f291112608b78941d66b1c64d4e675fa2e2 100644 >--- a/Tools/TestWebKitAPI/PlatformGTK.cmake >+++ b/Tools/TestWebKitAPI/PlatformGTK.cmake >@@ -131,6 +131,7 @@ add_executable(TestWebCore > ${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 >diff --git a/Tools/TestWebKitAPI/PlatformWin.cmake b/Tools/TestWebKitAPI/PlatformWin.cmake >index 194ca8ff34afd0bb16cb377f477a4f02a464189c..7b1019c3e45a47eb7133cf3bf3748ee6226f1349 100644 >--- a/Tools/TestWebKitAPI/PlatformWin.cmake >+++ b/Tools/TestWebKitAPI/PlatformWin.cmake >@@ -46,6 +46,7 @@ set(TestWebCoreLib_SOURCES > ${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 >diff --git a/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp b/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp >index c6b7ddc7005c8f833836c256a3bad898c03819d3..1871a46725358b04031662f69c905243004b1c8e 100644 >--- a/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp >@@ -74,7 +74,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceWithLeftRunInRTL) > 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 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceInRTL) > 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 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceInRTLNoOrigins) > 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 @@ TEST_F(ComplexTextControllerTest, LeadingExpansion) > 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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 167927
:
300795
|
300796
|
300819
|
300821