Title: [173476] trunk/Source/WebCore
Revision
173476
Author
[email protected]
Date
2014-09-10 11:58:05 -0700 (Wed, 10 Sep 2014)

Log Message

Laying out a TextRun using an SVG font is O(n^2)
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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173475 => 173476)


--- trunk/Source/WebCore/ChangeLog	2014-09-10 18:15:29 UTC (rev 173475)
+++ trunk/Source/WebCore/ChangeLog	2014-09-10 18:58:05 UTC (rev 173476)
@@ -1,3 +1,21 @@
+2014-09-10  Myles C. Maxfield  <[email protected]>
+
+        Laying out a TextRun using an SVG font is O(n^2)
+        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.
+
 2014-09-10  [email protected]  <[email protected]>
 
         [Curl] Optimization; avoid reallocating string many times.

Modified: trunk/Source/WebCore/platform/graphics/Font.h (173475 => 173476)


--- trunk/Source/WebCore/platform/graphics/Font.h	2014-09-10 18:15:29 UTC (rev 173475)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2014-09-10 18:58:05 UTC (rev 173476)
@@ -268,9 +268,9 @@
     }
 
     FontSelector* fontSelector() const;
-    static inline bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
-    static inline bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; }
-    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; }
+    static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
+    static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; }
+    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; }
     static bool canReceiveTextEmphasis(UChar32 c);
 
     static inline UChar normalizeSpaces(UChar character)

Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (173475 => 173476)


--- trunk/Source/WebCore/svg/SVGFontData.cpp	2014-09-10 18:15:29 UTC (rev 173475)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp	2014-09-10 18:58:05 UTC (rev 173476)
@@ -286,13 +286,10 @@
 {
     if (normalizedSpacesStringCache.length() == static_cast<unsigned>(run.charactersLength()))
         return;
-    if (run.is8Bit()) {
-        normalizedSpacesStringCache = String(run.data8(0), run.charactersLength());
-        normalizedSpacesStringCache = Font::normalizeSpaces(normalizedSpacesStringCache.characters8(), normalizedSpacesStringCache.length());
-    } else {
-        normalizedSpacesStringCache = String(run.data16(0), run.charactersLength());
-        normalizedSpacesStringCache = Font::normalizeSpaces(normalizedSpacesStringCache.characters16(), normalizedSpacesStringCache.length());
-    }
+    if (run.is8Bit())
+        normalizedSpacesStringCache = Font::normalizeSpaces(run.characters8(), run.charactersLength());
+    else
+        normalizedSpacesStringCache = Font::normalizeSpaces(run.characters16(), run.charactersLength());
     if (mirror)
         normalizedSpacesStringCache = createStringWithMirroredCharacters(normalizedSpacesStringCache);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to