Title: [211308] trunk
Revision
211308
Author
mmaxfi...@apple.com
Date
2017-01-27 15:56:58 -0800 (Fri, 27 Jan 2017)

Log Message

[Cocoa] Prepare ComplexTextController for unit testing
https://bugs.webkit.org/show_bug.cgi?id=167493

Reviewed by Simon Fraser.

Addressing post-review comments from Simon Fraser.

Source/WebCore:

* platform/graphics/FontCascade.h:
* platform/graphics/mac/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::createForTesting):
* platform/graphics/mac/ComplexTextControllerCoreText.h:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):

Tools:

* TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211307 => 211308)


--- trunk/Source/WebCore/ChangeLog	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Source/WebCore/ChangeLog	2017-01-27 23:56:58 UTC (rev 211308)
@@ -1,3 +1,18 @@
+2017-01-27  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Prepare ComplexTextController for unit testing
+        https://bugs.webkit.org/show_bug.cgi?id=167493
+
+        Reviewed by Simon Fraser.
+
+        Addressing post-review comments from Simon Fraser.
+
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/mac/ComplexTextController.h:
+        (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
+        * platform/graphics/mac/ComplexTextControllerCoreText.h:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+
 2017-01-27  Simon Fraser  <simon.fra...@apple.com>
 
         Element with a backdrop-filter and a mask may not correctly mask the backdrop

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (211307 => 211308)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-01-27 23:56:58 UTC (rev 211308)
@@ -129,7 +129,7 @@
     int pixelSize() const { return fontDescription().computedPixelSize(); }
     float size() const { return fontDescription().computedSize(); }
 
-    WEBCORE_EXPORT void update(RefPtr<FontSelector>&&) const;
+    WEBCORE_EXPORT void update(RefPtr<FontSelector>&& = nullptr) const;
 
     enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
     WEBCORE_EXPORT float drawText(GraphicsContext&, const TextRun&, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h (211307 => 211308)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h	2017-01-27 23:56:58 UTC (rev 211308)
@@ -91,7 +91,7 @@
             return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr));
         }
 
-        static Ref<ComplexTextRun> createForTesting(Vector<CGSize> advances, Vector<CGPoint> origins, Vector<CGGlyph> glyphs, Vector<CFIndex> stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
+        static Ref<ComplexTextRun> createForTesting(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
         {
             return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, runRange, ltr));
         }
@@ -127,7 +127,7 @@
     private:
         ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
         ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
-        WEBCORE_EXPORT ComplexTextRun(Vector<CGSize> advances, Vector<CGPoint> origins, Vector<CGGlyph> glyphs, Vector<CFIndex> stringIndices, CGSize initialAdvance, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr);
+        WEBCORE_EXPORT ComplexTextRun(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr);
 
         Vector<CGSize, 64> m_baseAdvancesVector;
         Vector<CGPoint, 64> m_glyphOrigins;

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


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2017-01-27 23:56:58 UTC (rev 211308)
@@ -183,7 +183,7 @@
 }
 
 
-ComplexTextController::ComplexTextRun::ComplexTextRun(Vector<CGSize> advances, Vector<CGPoint> origins, Vector<CGGlyph> glyphs, Vector<CFIndex> stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
+ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector<CGSize>& advances, const Vector<CGPoint>& origins, const Vector<CGGlyph>& glyphs, const Vector<CFIndex>& stringIndices, CGSize initialAdvance, const Font& font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
     : m_baseAdvancesVector(advances)
     , m_glyphOrigins(origins)
     , m_glyphsVector(glyphs)

Modified: trunk/Tools/ChangeLog (211307 => 211308)


--- trunk/Tools/ChangeLog	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Tools/ChangeLog	2017-01-27 23:56:58 UTC (rev 211308)
@@ -3,6 +3,18 @@
         [Cocoa] Prepare ComplexTextController for unit testing
         https://bugs.webkit.org/show_bug.cgi?id=167493
 
+        Reviewed by Simon Fraser.
+
+        Addressing post-review comments from Simon Fraser.
+
+        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2017-01-27  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Prepare ComplexTextController for unit testing
+        https://bugs.webkit.org/show_bug.cgi?id=167493
+
         Reviewed by Dean Jackson.
 
         Create four unit tests.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (211307 => 211308)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2017-01-27 23:43:33 UTC (rev 211307)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2017-01-27 23:56:58 UTC (rev 211308)
@@ -51,7 +51,7 @@
     description.setOneFamily("Times");
     description.setComputedSize(80);
     FontCascade font(description);
-    font.update(nullptr);
+    font.update();
     auto spaceWidth = font.primaryFont().spaceWidth();
 
 #if USE_LAYOUT_SPECIFIC_ADVANCES
@@ -67,8 +67,8 @@
     UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b, 0x20 };
     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
     TextRun textRun(StringView(characters, charactersLength));
-    Ref<ComplexTextController::ComplexTextRun> run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
-    Ref<ComplexTextController::ComplexTextRun> run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
+    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
+    auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
     Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
     runs.append(WTFMove(run1));
     runs.append(WTFMove(run2));
@@ -102,7 +102,7 @@
     description.setOneFamily("Times");
     description.setComputedSize(80);
     FontCascade font(description);
-    font.update(nullptr);
+    font.update();
 
 #if USE_LAYOUT_SPECIFIC_ADVANCES
     Vector<CGSize> advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
@@ -117,7 +117,7 @@
     UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b };
     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
     TextRun textRun(StringView(characters, charactersLength));
-    Ref<ComplexTextController::ComplexTextRun> run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
+    auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
     Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
@@ -149,7 +149,7 @@
     description.setOneFamily("LucidaGrande");
     description.setComputedSize(80);
     FontCascade font(description);
-    font.update(nullptr);
+    font.update();
     auto spaceWidth = font.primaryFont().spaceWidth();
 
 #if USE_LAYOUT_SPECIFIC_ADVANCES
@@ -165,8 +165,8 @@
     UChar characters[] = { 0x20, 0x61, 0x20e3 };
     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
     TextRun textRun(StringView(characters, charactersLength));
-    Ref<ComplexTextController::ComplexTextRun> run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
-    Ref<ComplexTextController::ComplexTextRun> run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
+    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
+    auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
     Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
     runs.append(WTFMove(run1));
     runs.append(WTFMove(run2));
@@ -196,7 +196,7 @@
     description.setOneFamily("LucidaGrande");
     description.setComputedSize(80);
     FontCascade font(description);
-    font.update(nullptr);
+    font.update();
 
 #if USE_LAYOUT_SPECIFIC_ADVANCES
     Vector<CGSize> advances = { CGSizeMake(76.347656, 0.000000), CGSizeMake(0.000000, 0.000000) };
@@ -211,7 +211,7 @@
     UChar characters[] = { 0x61, 0x20e3 };
     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
     TextRun textRun(StringView(characters, charactersLength));
-    Ref<ComplexTextController::ComplexTextRun> run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
+    auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
     Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
     runs.append(WTFMove(run));
     ComplexTextController controller(font, textRun, runs);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to