Changeset 211308 in webkit


Ignore:
Timestamp:
Jan 27, 2017 3:56:58 PM (7 years ago)
Author:
mmaxfield@apple.com
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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r211305 r211308  
     12017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] Prepare ComplexTextController for unit testing
     4        https://bugs.webkit.org/show_bug.cgi?id=167493
     5
     6        Reviewed by Simon Fraser.
     7
     8        Addressing post-review comments from Simon Fraser.
     9
     10        * platform/graphics/FontCascade.h:
     11        * platform/graphics/mac/ComplexTextController.h:
     12        (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
     13        * platform/graphics/mac/ComplexTextControllerCoreText.h:
     14        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
     15
    1162017-01-27  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/Source/WebCore/platform/graphics/FontCascade.h

    r211294 r211308  
    130130    float size() const { return fontDescription().computedSize(); }
    131131
    132     WEBCORE_EXPORT void update(RefPtr<FontSelector>&&) const;
     132    WEBCORE_EXPORT void update(RefPtr<FontSelector>&& = nullptr) const;
    133133
    134134    enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r211294 r211308  
    9292        }
    9393
    94         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)
     94        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)
    9595        {
    9696            return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, runRange, ltr));
     
    128128        ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
    129129        ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
    130         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);
     130        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);
    131131
    132132        Vector<CGSize, 64> m_baseAdvancesVector;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

    r211294 r211308  
    184184
    185185
    186 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)
     186ComplexTextController::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)
    187187    : m_baseAdvancesVector(advances)
    188188    , m_glyphOrigins(origins)
  • trunk/Tools/ChangeLog

    r211294 r211308  
     12017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Cocoa] Prepare ComplexTextController for unit testing
     4        https://bugs.webkit.org/show_bug.cgi?id=167493
     5
     6        Reviewed by Simon Fraser.
     7
     8        Addressing post-review comments from Simon Fraser.
     9
     10        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
     11        (TestWebKitAPI::TEST_F):
     12
    1132017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

    r211294 r211308  
    5252    description.setComputedSize(80);
    5353    FontCascade font(description);
    54     font.update(nullptr);
     54    font.update();
    5555    auto spaceWidth = font.primaryFont().spaceWidth();
    5656
     
    6868    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    6969    TextRun textRun(StringView(characters, charactersLength));
    70     Ref<ComplexTextController::ComplexTextRun> run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
    71     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);
     70    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
     71    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);
    7272    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    7373    runs.append(WTFMove(run1));
     
    103103    description.setComputedSize(80);
    104104    FontCascade font(description);
    105     font.update(nullptr);
     105    font.update();
    106106
    107107#if USE_LAYOUT_SPECIFIC_ADVANCES
     
    118118    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    119119    TextRun textRun(StringView(characters, charactersLength));
    120     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);
     120    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);
    121121    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    122122    runs.append(WTFMove(run));
     
    150150    description.setComputedSize(80);
    151151    FontCascade font(description);
    152     font.update(nullptr);
     152    font.update();
    153153    auto spaceWidth = font.primaryFont().spaceWidth();
    154154
     
    166166    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    167167    TextRun textRun(StringView(characters, charactersLength));
    168     Ref<ComplexTextController::ComplexTextRun> run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
    169     Ref<ComplexTextController::ComplexTextRun> run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
     168    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
     169    auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
    170170    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    171171    runs.append(WTFMove(run1));
     
    197197    description.setComputedSize(80);
    198198    FontCascade font(description);
    199     font.update(nullptr);
     199    font.update();
    200200
    201201#if USE_LAYOUT_SPECIFIC_ADVANCES
     
    212212    size_t charactersLength = WTF_ARRAY_LENGTH(characters);
    213213    TextRun textRun(StringView(characters, charactersLength));
    214     Ref<ComplexTextController::ComplexTextRun> run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
     214    auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
    215215    Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
    216216    runs.append(WTFMove(run));
Note: See TracChangeset for help on using the changeset viewer.