Changeset 173476 in webkit


Ignore:
Timestamp:
Sep 10, 2014 11:58:05 AM (10 years ago)
Author:
mmaxfield@apple.com
Message:

Laying out a TextRun using an SVG font is O(n2)
https://bugs.webkit.org/show_bug.cgi?id=136584

Reviewed by Darin Adler.

Addressing post-commit review from Darin.

No new tests.

  • platform/graphics/Font.h:

(WebCore::Font::treatAsSpace): Un-inline.
(WebCore::Font::treatAsZeroWidthSpace): Ditto.
(WebCore::Font::treatAsZeroWidthSpaceInComplexScript): Ditto.

  • svg/SVGFontData.cpp:

(WebCore::computeNormalizedSpaces): Avoid unnecessary copy.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r173474 r173476  
     12014-09-10  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Laying out a TextRun using an SVG font is O(n^2)
     4        https://bugs.webkit.org/show_bug.cgi?id=136584
     5
     6        Reviewed by Darin Adler.
     7
     8        Addressing post-commit review from Darin.
     9
     10        No new tests.
     11
     12        * platform/graphics/Font.h:
     13        (WebCore::Font::treatAsSpace): Un-inline.
     14        (WebCore::Font::treatAsZeroWidthSpace): Ditto.
     15        (WebCore::Font::treatAsZeroWidthSpaceInComplexScript): Ditto.
     16        * svg/SVGFontData.cpp:
     17        (WebCore::computeNormalizedSpaces): Avoid unnecessary copy.
     18
    1192014-09-10  peavo@outlook.com  <peavo@outlook.com>
    220
  • trunk/Source/WebCore/platform/graphics/Font.h

    r173349 r173476  
    269269
    270270    FontSelector* fontSelector() const;
    271     static inline bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
    272     static inline bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; }
    273     static inline bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpace || c == objectReplacementCharacter; }
     271    static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
     272    static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; }
     273    static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpace || c == objectReplacementCharacter; }
    274274    static bool canReceiveTextEmphasis(UChar32 c);
    275275
  • trunk/Source/WebCore/svg/SVGFontData.cpp

    r173349 r173476  
    287287    if (normalizedSpacesStringCache.length() == static_cast<unsigned>(run.charactersLength()))
    288288        return;
    289     if (run.is8Bit()) {
    290         normalizedSpacesStringCache = String(run.data8(0), run.charactersLength());
    291         normalizedSpacesStringCache = Font::normalizeSpaces(normalizedSpacesStringCache.characters8(), normalizedSpacesStringCache.length());
    292     } else {
    293         normalizedSpacesStringCache = String(run.data16(0), run.charactersLength());
    294         normalizedSpacesStringCache = Font::normalizeSpaces(normalizedSpacesStringCache.characters16(), normalizedSpacesStringCache.length());
    295     }
     289    if (run.is8Bit())
     290        normalizedSpacesStringCache = Font::normalizeSpaces(run.characters8(), run.charactersLength());
     291    else
     292        normalizedSpacesStringCache = Font::normalizeSpaces(run.characters16(), run.charactersLength());
    296293    if (mirror)
    297294        normalizedSpacesStringCache = createStringWithMirroredCharacters(normalizedSpacesStringCache);
Note: See TracChangeset for help on using the changeset viewer.