[WIN] Fix tests for text with initial advances
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 05:11:38 +0000 (05:11 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 05:11:38 +0000 (05:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188099

Reviewed by Darin Adler.

Fixup after r234318.

Tests: fast/text/complex-first-glyph-with-initial-advance.html
       fast/text/initial-advance-in-intermediate-run-complex.html

* platform/graphics/ComplexTextController.cpp:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::drawGlyphBuffer const):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ComplexTextController.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

index 96d494d..aa22ed8 100644 (file)
@@ -1,3 +1,19 @@
+2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [WIN] Fix tests for text with initial advances
+        https://bugs.webkit.org/show_bug.cgi?id=188099
+
+        Reviewed by Darin Adler.
+
+        Fixup after r234318.
+
+        Tests: fast/text/complex-first-glyph-with-initial-advance.html
+               fast/text/initial-advance-in-intermediate-run-complex.html
+
+        * platform/graphics/ComplexTextController.cpp:
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::drawGlyphBuffer const):
+
 2018-07-31  Alex Christensen  <achristensen@webkit.org>
 
         REGRESSION (r231107): MoviStar+ launches to a blank black screen
index 2e2bbbe..0b0f494 100644 (file)
 
 namespace WebCore {
 
+#if PLATFORM(WIN)
+
+class TextLayout {
+};
+
+void TextLayoutDeleter::operator()(TextLayout*) const
+{
+}
+
+std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText&, float, bool) const
+{
+    return nullptr;
+}
+
+float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*)
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+#else
+
 class TextLayout {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -86,39 +108,19 @@ private:
 
 void TextLayoutDeleter::operator()(TextLayout* layout) const
 {
-#if !PLATFORM(WIN)
     delete layout;
-#else
-    ASSERT_UNUSED(layout, !layout);
-#endif
 }
 
 std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText& text, float xPos, bool collapseWhiteSpace) const
 {
-#if !PLATFORM(WIN)
     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(WIN)
     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()
@@ -885,4 +887,6 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<FloatSize>& a
 {
 }
 
+#endif
+
 } // namespace WebCore
index 9327894..5ccc2e9 100644 (file)
@@ -1432,8 +1432,13 @@ void FontCascade::drawGlyphBuffer(GraphicsContext& context, const GlyphBuffer& g
 {
     // Draw each contiguous run of glyphs that use the same font data.
     const Font* fontData = glyphBuffer.fontAt(0);
+#if PLATFORM(WIN)
+    FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());
+#else
     // FIXME: Why do we subtract the initial advance's height but not its width???
+    // We should use the line above from Windows instead.
     FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
+#endif
     float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
     float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
     unsigned lastFrom = 0;
index 7595fe2..9d2127f 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "config.h"
 
+#if !PLATFORM(WIN)
+
 #include <JavaScriptCore/InitializeThreading.h>
 #include <WebCore/ComplexTextController.h>
 #include <WebCore/FontCascade.h>
@@ -365,3 +367,5 @@ TEST_F(ComplexTextControllerTest, TotalWidthWithJustification)
 }
 
 }
+
+#endif