Changeset 254323 in webkit


Ignore:
Timestamp:
Jan 9, 2020 7:50:58 PM (4 years ago)
Author:
Fujii Hironori
Message:

[Win] Use ComplexTextController instead of UniscribeController
https://bugs.webkit.org/show_bug.cgi?id=204884

Reviewed by Brent Fulgham.

Source/WebCore:

UniscribeController doesn't support surrogate pairs and has
rendering glitches of partially selected a combining character.

Remove UniscribeController, and use ComplexTextController by
implementing collectComplexTextRunsForCharacters with Uniscribe.

Covered by existing tests.

  • PlatformWin.cmake:
  • platform/graphics/ComplexTextController.cpp:

(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Deleted.

  • platform/graphics/FontCascade.cpp:

(WebCore::FontCascade::widthOfTextRange const):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const):
(WebCore::FontCascade::drawGlyphBuffer const):
(WebCore::FontCascade::floatWidthForComplexText const):
(WebCore::FontCascade::adjustSelectionRectForComplexText const):
(WebCore::FontCascade::offsetForPositionForComplexText const):

  • platform/graphics/win/ComplexTextControllerUniscribe.cpp: Added.

(WebCore::shapeByUniscribe):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

  • platform/graphics/win/FontCGWin.cpp:
  • platform/graphics/win/FontCascadeDirect2D.cpp:
  • platform/graphics/win/FontWin.cpp:

(WebCore::FontCascade::adjustSelectionRectForComplexText const): Deleted.
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Deleted.
(WebCore::FontCascade::floatWidthForComplexText const): Deleted.
(WebCore::FontCascade::offsetForPositionForComplexText const): Deleted.

  • platform/graphics/win/UniscribeController.cpp: Removed.
  • platform/graphics/win/UniscribeController.h: Removed.

Tools:

  • TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp: Enabled these tests for PLATFORM(WIN).

LayoutTests:

  • platform/win/TestExpectations:
  • platform/win/fast/text/justify-ideograph-complex-expected.txt: Rebaselined.
  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
1 added
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254322 r254323  
     12020-01-09  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Win] Use ComplexTextController instead of UniscribeController
     4        https://bugs.webkit.org/show_bug.cgi?id=204884
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * platform/win/TestExpectations:
     9        * platform/win/fast/text/justify-ideograph-complex-expected.txt: Rebaselined.
     10        * platform/wincairo/TestExpectations:
     11
    1122020-01-09  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/platform/win/TestExpectations

    r254127 r254323  
    29652965
    29662966webkit.org/b/152009 fast/canvas/canvas-too-large-to-draw.html [ Skip ]
     2967
     2968fast/text/arabic-zwj-and-zwnj.html [ ImageOnlyFailure ]
    29672969
    29682970################################################################################
     
    34273429fast/text/emoji-single-parent-family-2.html [ ImageOnlyFailure ]
    34283430fast/text/emoji-single-parent-family.html [ ImageOnlyFailure ]
     3431fast/text/emoji-with-joiner.html [ Failure ]
    34293432http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html [ ImageOnlyFailure ]
    34303433mathml/presentation/non-bmp-operators-stretching.html [ ImageOnlyFailure ]
     
    45084511webkit.org/b/205273 imported/blink/fast/sub-pixel/negative-composited-offset.html [ Pass ImageOnlyFailure ]
    45094512
     4513webkit.org/b/205487 fast/text/selection-in-initial-advance-region.html [ Failure ]
     4514webkit.org/b/205485 fast/text/stale-TextLayout-from-first-line.html [ ImageOnlyFailure ]
     4515
    45104516webkit.org/b/205855 http/wpt/css/css-highlight-api/highlight-text-across-elements.html [ ImageOnlyFailure ]
    45114517webkit.org/b/205855 http/wpt/css/css-highlight-api/highlight-text-cascade.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/win/fast/text/justify-ideograph-complex-expected.txt

    r149090 r254323  
    1717      RenderBlock {P} at (0,129) size 550x45
    1818        RenderText {#text} at (0,0) size 550x45
    19           text run at (0,0) width 550: "EA Mobile \x{7684} Worldwide Studios \x{526F}\x{7E3D}\x{88C1} Travis Boatman \x{6307}\x{51FA}\x{FF1A}\x{300C}App Store \x{4E0D}\x{50C5}\x{5FB9}\x{5E95}\x{6539}\x{8B8A}\x{4E86}\x{884C}\x{52D5}\x{904A}\x{6232}"
    20           text run at (0,15) width 550: "\x{7522}\x{696D}\x{7684}\x{751F}\x{614B}\x{FF0C}\x{800C}\x{4E14}\x{9084}\x{5728}\x{6301}\x{7E8C}\x{6F14}\x{9032}\x{3002}\x{6709}\x{4E86}\x{5168}\x{7403} 5 \x{5343}\x{591A}\x{842C}\x{7684} iPhone \x{548C} iPod touch \x{5BA2}\x{6236}\x{70BA}\x{57FA}\x{790E}\x{FF0C}App Store"
     19          text run at (0,0) width 550: "EA Mobile \x{7684} Worldwide Studios \x{526F}\x{7E3D}\x{88C1} Travis Boatman \x{6307}\x{51FA}\x{FF1A}\x{300C}App Store \x{4E0D}\x{50C5}\x{5FB9}\x{5E95}\x{6539}\x{8B8A}\x{4E86}\x{884C}\x{52D5}\x{904A}"
     20          text run at (0,15) width 550: "\x{6232}\x{7522}\x{696D}\x{7684}\x{751F}\x{614B}\x{FF0C}\x{800C}\x{4E14}\x{9084}\x{5728}\x{6301}\x{7E8C}\x{6F14}\x{9032}\x{3002}\x{6709}\x{4E86}\x{5168}\x{7403} 5 \x{5343}\x{591A}\x{842C}\x{7684} iPhone \x{548C} iPod touch \x{5BA2}\x{6236}\x{70BA}\x{57FA}\x{790E}\x{FF0C}App Store"
    2121          text run at (0,30) width 301: "\x{8B93}\x{6211}\x{5011}\x{80FD}\x{5920}\x{958B}\x{767C}\x{53D7}\x{5230}\x{5EE3}\x{5927}\x{7684}\x{5BA2}\x{6236}\x{559C}\x{611B}\x{7684}\x{9AD8}\x{54C1}\x{8CEA} EA \x{904A}\x{6232}\x{3002}\x{300D}"
    2222      RenderBlock {P} at (0,186) size 550x45
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r254190 r254323  
    830830imported/blink/fast/dom/Window/open-window-features-fuzz.html [ Pass Timeout ]
    831831
     832webkit.org/b/205487 fast/text/selection-in-initial-advance-region.html [ Failure ]
     833webkit.org/b/205485 fast/text/stale-TextLayout-from-first-line.html [ ImageOnlyFailure ]
     834
    832835#//////////////////////////////////////////////////////////////////////////////////////////
    833836# http
     
    11201123
    11211124webkit.org/b/117322 fast/css/text-indent-first-line-006.html [ ImageOnlyFailure ]
    1122 webkit.org/b/117322 fast/css/word-spacing-characters-complex-text.html [ ImageOnlyFailure ]
    11231125fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html [ Pass Timeout ]
    11241126webkit.org/b/136484 fast/css-generated-content/initial-letter-basic.html [ Pass Failure ]
     
    17201722fast/text/ellipsis-text-rtl.html [ ImageOnlyFailure ]
    17211723fast/text/emoji-overlap.html [ ImageOnlyFailure ]
    1722 fast/text/emoji-single-parent-family-2.html [ ImageOnlyFailure ]
    1723 fast/text/emoji-single-parent-family.html [ ImageOnlyFailure ]
    17241724fast/text/emoji-variation-selector.html [ ImageOnlyFailure ]
    17251725fast/text/emoji-with-joiner.html [ Failure ]
     
    17281728fast/text/fallback-language-han-2.html [ ImageOnlyFailure ]
    17291729fast/text/fallback-traits-fixup.html [ Failure ]
    1730 fast/text/fitzpatrick-combination.html [ ImageOnlyFailure ]
    17311730fast/text/font-cursive-italic-cjk.html [ ImageOnlyFailure ]
    17321731fast/text/font-kerning.html [ ImageOnlyFailure ]
     
    17581757fast/text/justify-ideograph-vertical.html [ Failure ]
    17591758fast/text/justify-nbsp.html [ Failure ]
    1760 fast/text/kerning-with-TextLayout.html [ ImageOnlyFailure ]
    17611759fast/text/khmer-lao-font.html [ Failure ]
    17621760fast/text/line-break-between-text-nodes-latin1.html [ ImageOnlyFailure ]
     
    17861784fast/text/soft-hyphen-min-preferred-width.html [ ImageOnlyFailure ]
    17871785fast/text/space-width.html [ ImageOnlyFailure ]
    1788 fast/text/stale-TextLayout-from-first-line.html [ ImageOnlyFailure ]
    17891786fast/text/svg-font-face-with-kerning.html [ Failure ]
    17901787fast/text/synthetic-bold-transformed.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r254322 r254323  
     12020-01-09  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Win] Use ComplexTextController instead of UniscribeController
     4        https://bugs.webkit.org/show_bug.cgi?id=204884
     5
     6        Reviewed by Brent Fulgham.
     7
     8        UniscribeController doesn't support surrogate pairs and has
     9        rendering glitches of partially selected a combining character.
     10
     11        Remove UniscribeController, and use ComplexTextController by
     12        implementing `collectComplexTextRunsForCharacters` with Uniscribe.
     13
     14        Covered by existing tests.
     15
     16        * PlatformWin.cmake:
     17        * platform/graphics/ComplexTextController.cpp:
     18        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Deleted.
     19        * platform/graphics/FontCascade.cpp:
     20        (WebCore::FontCascade::widthOfTextRange const):
     21        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const):
     22        (WebCore::FontCascade::drawGlyphBuffer const):
     23        (WebCore::FontCascade::floatWidthForComplexText const):
     24        (WebCore::FontCascade::adjustSelectionRectForComplexText const):
     25        (WebCore::FontCascade::offsetForPositionForComplexText const):
     26        * platform/graphics/win/ComplexTextControllerUniscribe.cpp: Added.
     27        (WebCore::shapeByUniscribe):
     28        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
     29        * platform/graphics/win/FontCGWin.cpp:
     30        * platform/graphics/win/FontCascadeDirect2D.cpp:
     31        * platform/graphics/win/FontWin.cpp:
     32        (WebCore::FontCascade::adjustSelectionRectForComplexText const): Deleted.
     33        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Deleted.
     34        (WebCore::FontCascade::floatWidthForComplexText const): Deleted.
     35        (WebCore::FontCascade::offsetForPositionForComplexText const): Deleted.
     36        * platform/graphics/win/UniscribeController.cpp: Removed.
     37        * platform/graphics/win/UniscribeController.h: Removed.
     38
    1392020-01-09  Chris Dumez  <cdumez@apple.com>
    240
  • trunk/Source/WebCore/PlatformWin.cmake

    r254064 r254323  
    5151    platform/graphics/win/ColorDirect2D.cpp
    5252    platform/graphics/win/ComplexTextControllerDirectWrite.cpp
     53    platform/graphics/win/ComplexTextControllerUniscribe.cpp
    5354    platform/graphics/win/DIBPixelData.cpp
    5455    platform/graphics/win/FloatPointDirect2D.cpp
     
    6970    platform/graphics/win/TransformationMatrixDirect2D.cpp
    7071    platform/graphics/win/TransformationMatrixWin.cpp
    71     platform/graphics/win/UniscribeController.cpp
    7272
    7373    platform/network/win/DownloadBundleWin.cpp
  • trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp

    r254114 r254323  
    4343
    4444namespace WebCore {
    45 
    46 #if PLATFORM(WIN) && !USE(DIRECT2D)
    47 
    48 class TextLayout {
    49 };
    50 
    51 void TextLayoutDeleter::operator()(TextLayout*) const
    52 {
    53 }
    54 
    55 std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText&, float, bool) const
    56 {
    57     return nullptr;
    58 }
    59 
    60 float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const Font*>*)
    61 {
    62     ASSERT_NOT_REACHED();
    63     return 0;
    64 }
    65 
    66 void ComplexTextController::collectComplexTextRunsForCharacters(const UChar*, unsigned, unsigned, const Font*)
    67 {
    68     ASSERT_NOT_REACHED();
    69 }
    70 
    71 #else
    7245
    7346class TextLayout {
     
    907880}
    908881
    909 #endif
    910 
    911882} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r253916 r254323  
    4242#include <wtf/text/StringBuilder.h>
    4343
    44 #if PLATFORM(WIN) && !USE(DIRECT2D)
    45 #include "UniscribeController.h"
    46 #endif
    47 
    4844namespace WebCore {
    4945
     
    351347    auto codePathToUse = codePath(run);
    352348    if (codePathToUse == Complex) {
    353 #if PLATFORM(WIN) && !USE(DIRECT2D)
    354         UniscribeController it(this, run);
    355         it.advance(from);
    356         offsetBeforeRange = it.runWidthSoFar();
    357         it.advance(to);
    358         offsetAfterRange = it.runWidthSoFar();
    359         it.advance(to);
    360         totalWidth = it.runWidthSoFar();
    361 #else
    362349        ComplexTextController complexIterator(*this, run, false, fallbackFonts);
    363350        complexIterator.advance(from, nullptr, IncludePartialGlyphs, fallbackFonts);
     
    367354        complexIterator.advance(run.length(), nullptr, IncludePartialGlyphs, fallbackFonts);
    368355        totalWidth = complexIterator.runWidthSoFar();
    369 #endif
    370356    } else {
    371357        WidthIterator simpleIterator(this, run, fallbackFonts);
     
    13981384}
    13991385
    1400 #if !PLATFORM(WIN) || USE(DIRECT2D)
    14011386float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
    14021387{
     
    14281413    return initialAdvance;
    14291414}
    1430 #endif
    14311415
    14321416void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext& context, const TextRun& run, const AtomString& mark, const FloatPoint& point, unsigned from, unsigned to) const
     
    14531437    // Draw each contiguous run of glyphs that use the same font data.
    14541438    const Font* fontData = glyphBuffer.fontAt(0);
    1455 #if PLATFORM(WIN)
    1456     FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height());
    1457 #else
    1458     // FIXME: Why do we subtract the initial advance's height but not its width???
    1459     // We should use the line above from Windows instead.
    14601439    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
    1461 #endif
    14621440    float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
    14631441    float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
     
    15461524}
    15471525
    1548 #if !PLATFORM(WIN) || USE(DIRECT2D)
    15491526float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    15501527{
     
    15581535    return controller.totalWidth();
    15591536}
    1560 #endif
    15611537
    15621538void FontCascade::adjustSelectionRectForSimpleText(const TextRun& run, LayoutRect& selectionRect, unsigned from, unsigned to) const
     
    15791555}
    15801556
    1581 #if !PLATFORM(WIN) || USE(DIRECT2D)
    15821557void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, unsigned from, unsigned to) const
    15831558{
     
    15941569    selectionRect.setWidth(LayoutUnit::fromFloatCeil(afterWidth - beforeWidth));
    15951570}
    1596 #endif
    15971571
    15981572int FontCascade::offsetForPositionForSimpleText(const TextRun& run, float x, bool includePartialGlyphs) const
     
    16391613}
    16401614
    1641 #if !PLATFORM(WIN) || USE(DIRECT2D)
    16421615int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
    16431616{
     
    16451618    return controller.offsetForPosition(x, includePartialGlyphs);
    16461619}
    1647 #endif
    16481620
    16491621#if !PLATFORM(COCOA) && !USE(HARFBUZZ)
  • trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp

    r238253 r254323  
    3535#include "GraphicsContext.h"
    3636#include "IntRect.h"
    37 #include "UniscribeController.h"
    3837#include "WebCoreTextRenderer.h"
    3938#include <pal/spi/cg/CoreGraphicsSPI.h>
  • trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp

    r248748 r254323  
    3838#include "IntRect.h"
    3939#include "PlatformContextDirect2D.h"
    40 #include "UniscribeController.h"
    4140#include "WebCoreTextRenderer.h"
    4241#include <d2d1.h>
  • trunk/Source/WebCore/platform/graphics/win/FontWin.cpp

    r251900 r254323  
    3636#include <wtf/MathExtras.h>
    3737
    38 #if !USE(DIRECT2D)
    39 #include "UniscribeController.h"
    40 #endif
    41 
    4238namespace WebCore {
    4339
     
    5248}
    5349
    54 #if !USE(DIRECT2D)
    55 
    56 void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, unsigned from, unsigned to) const
    57 {
    58     UniscribeController it(this, run);
    59     it.advance(from);
    60     float beforeWidth = it.runWidthSoFar();
    61     it.advance(to);
    62     float afterWidth = it.runWidthSoFar();
    63 
    64     if (run.rtl()) {
    65         it.advance(run.length());
    66         selectionRect.move(it.runWidthSoFar() - afterWidth, 0);
    67     } else
    68         selectionRect.move(beforeWidth, 0);
    69     selectionRect.setWidth(afterWidth - beforeWidth);
    7050}
    71 
    72 float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
    73 {
    74     if (forTextEmphasis) {
    75         // FIXME: Add forTextEmphasis paremeter to UniscribeController and use it.
    76         LOG_ERROR("Not implemented for text emphasis.");
    77         return 0;
    78     }
    79 
    80     UniscribeController controller(this, run);
    81     controller.advance(from);
    82     float beforeWidth = controller.runWidthSoFar();
    83     controller.advance(to, &glyphBuffer);
    84 
    85     if (glyphBuffer.isEmpty())
    86         return 0;
    87 
    88     float afterWidth = controller.runWidthSoFar();
    89 
    90     if (run.rtl()) {
    91         controller.advance(run.length());
    92         return controller.runWidthSoFar() - afterWidth;
    93     }
    94     return beforeWidth;
    95 }
    96 
    97 float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
    98 {
    99     UniscribeController controller(this, run, fallbackFonts);
    100     controller.advance(run.length());
    101     if (glyphOverflow) {
    102         glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
    103         glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0  : fontMetrics().descent()));
    104         glyphOverflow->left = std::max<int>(0, ceilf(-controller.minGlyphBoundingBoxX()));
    105         glyphOverflow->right = std::max<int>(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.runWidthSoFar()));
    106     }
    107     return controller.runWidthSoFar();
    108 }
    109 
    110 int FontCascade::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
    111 {
    112     // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
    113     // to FontCascade::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
    114     int x = static_cast<int>(xFloat);
    115 
    116     UniscribeController controller(this, run);
    117     return controller.offsetForPosition(x, includePartialGlyphs);
    118 }
    119 
    120 #endif
    121 
    122 }
  • trunk/Tools/ChangeLog

    r254318 r254323  
     12020-01-09  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Win] Use ComplexTextController instead of UniscribeController
     4        https://bugs.webkit.org/show_bug.cgi?id=204884
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp: Enabled these tests for PLATFORM(WIN).
     9
    1102020-01-09  David Kilzer  <ddkilzer@apple.com>
    211
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

    r234808 r254323  
    2626#include "config.h"
    2727
    28 #if !PLATFORM(WIN)
    29 
    3028#include <JavaScriptCore/InitializeThreading.h>
    3129#include <WebCore/ComplexTextController.h>
     
    368366
    369367}
    370 
    371 #endif
Note: See TracChangeset for help on using the changeset viewer.