Title: [215737] trunk
Revision
215737
Author
mmaxfi...@apple.com
Date
2017-04-25 09:35:39 -0700 (Tue, 25 Apr 2017)

Log Message

Add performance test for FontCache::systemFallbackForCharacters()
https://bugs.webkit.org/show_bug.cgi?id=170842

Reviewed by Tim Horton.

PerformanceTests:

* Layout/word-joiner.html: Added.

Source/WebCore:

No new tests because there is no behavior change.

* platform/graphics/FontCascade.h:
(WebCore::FontCascade::treatAsZeroWidthSpace):
(WebCore::FontCascade::treatAsZeroWidthSpaceInComplexScript): Deleted.
* platform/graphics/WidthCache.h:
(WebCore::WidthCache::add):
(WebCore::WidthCache::addSlowCase):

Source/WTF:

* wtf/unicode/CharacterNames.h:

Modified Paths

Added Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (215736 => 215737)


--- trunk/PerformanceTests/ChangeLog	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/PerformanceTests/ChangeLog	2017-04-25 16:35:39 UTC (rev 215737)
@@ -1,3 +1,12 @@
+2017-04-25  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Add performance test for FontCache::systemFallbackForCharacters()
+        https://bugs.webkit.org/show_bug.cgi?id=170842
+
+        Reviewed by Tim Horton.
+
+        * Layout/word-joiner.html: Added.
+
 2017-04-24  Saam Barati  <sbar...@apple.com>
 
         Add ML to ARES6

Added: trunk/PerformanceTests/Layout/word-joiner.html (0 => 215737)


--- trunk/PerformanceTests/Layout/word-joiner.html	                        (rev 0)
+++ trunk/PerformanceTests/Layout/word-joiner.html	2017-04-25 16:35:39 UTC (rev 215737)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+    <pre id="log"></pre>
+    <div id="target" style="width: 300px; display: none; font-family: 'Zapfino';">
+    </div>
+    <script>
+        var target = document.getElementById("target");
+        var style = target.style;
+        var locales = ["ar", "hy", "as", "iu", "ab", "hi", "am", "ka", "el", "gu", "pa", "ko", "ko", "he", "kn", "ja", "km", "lo", "aa", "ml", "my", "or", "si", "ta", "te", "dv", "th", "bo", "zh_hk", "ii"];
+
+        for (var i = 0; i < locales.length; ++i) {
+            var span = document.createElement("span");
+            span.className = "tester";
+            var joiner = document.createTextNode(String.fromCharCode(0x2060));
+            span.appendChild(joiner);
+            target.appendChild(span);
+        }
+
+        function updateLanguages() {
+            if (window.internals)
+                internals.invalidateFontCache();
+            var testers = document.getElementsByClassName("tester");
+            for (var i = 0; i < testers.length; ++i) {
+                testers[i].lang = locales[i];
+            }
+        }
+
+        updateLanguages();
+
+        function test() {
+            style.display = "block";
+            updateLanguages();
+            var testers = document.getElementsByClassName("tester");
+            testers[testers.length - 1].getClientRects();
+            style.display = "none";
+        }
+
+        PerfTestRunner.measureRunsPerSecond({ run: test });
+    </script>
+</body>
+</html>

Modified: trunk/Source/WTF/ChangeLog (215736 => 215737)


--- trunk/Source/WTF/ChangeLog	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/Source/WTF/ChangeLog	2017-04-25 16:35:39 UTC (rev 215737)
@@ -1,3 +1,12 @@
+2017-04-25  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Add performance test for FontCache::systemFallbackForCharacters()
+        https://bugs.webkit.org/show_bug.cgi?id=170842
+
+        Reviewed by Tim Horton.
+
+        * wtf/unicode/CharacterNames.h:
+
 2017-04-24  Andy VanWagoner  <thetalecraf...@gmail.com>
 
         Clean up ICU headers

Modified: trunk/Source/WTF/wtf/unicode/CharacterNames.h (215736 => 215737)


--- trunk/Source/WTF/wtf/unicode/CharacterNames.h	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/Source/WTF/wtf/unicode/CharacterNames.h	2017-04-25 16:35:39 UTC (rev 215737)
@@ -92,6 +92,7 @@
 const UChar whiteCircle = 0x25CB;
 const UChar whiteSesameDot = 0xFE46;
 const UChar whiteUpPointingTriangle = 0x25B3;
+const UChar wordJoiner = 0x2060;
 const UChar yenSign = 0x00A5;
 const UChar zeroWidthJoiner = 0x200D;
 const UChar zeroWidthNoBreakSpace = 0xFEFF;
@@ -154,6 +155,7 @@
 using WTF::Unicode::whiteCircle;
 using WTF::Unicode::whiteSesameDot;
 using WTF::Unicode::whiteUpPointingTriangle;
+using WTF::Unicode::wordJoiner;
 using WTF::Unicode::yenSign;
 using WTF::Unicode::zeroWidthJoiner;
 using WTF::Unicode::zeroWidthNoBreakSpace;

Modified: trunk/Source/WebCore/ChangeLog (215736 => 215737)


--- trunk/Source/WebCore/ChangeLog	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/Source/WebCore/ChangeLog	2017-04-25 16:35:39 UTC (rev 215737)
@@ -1,3 +1,19 @@
+2017-04-25  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Add performance test for FontCache::systemFallbackForCharacters()
+        https://bugs.webkit.org/show_bug.cgi?id=170842
+
+        Reviewed by Tim Horton.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/FontCascade.h:
+        (WebCore::FontCascade::treatAsZeroWidthSpace):
+        (WebCore::FontCascade::treatAsZeroWidthSpaceInComplexScript): Deleted.
+        * platform/graphics/WidthCache.h:
+        (WebCore::WidthCache::add):
+        (WebCore::WidthCache::addSlowCase):
+
 2017-04-25  Chris Dumez  <cdu...@apple.com>
 
         Content-Disposition header filename is ignored when 'download' attribute is specified in HTML

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (215736 => 215737)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2017-04-25 16:35:39 UTC (rev 215737)
@@ -261,8 +261,7 @@
 
     FontSelector* fontSelector() const;
     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 treatAsZeroWidthSpace(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 || c == zeroWidthNonJoiner || c == zeroWidthJoiner; }
     static bool canReceiveTextEmphasis(UChar32);
 
     static inline UChar normalizeSpaces(UChar character)

Modified: trunk/Source/WebCore/platform/graphics/WidthCache.h (215736 => 215737)


--- trunk/Source/WebCore/platform/graphics/WidthCache.h	2017-04-25 16:29:25 UTC (rev 215736)
+++ trunk/Source/WebCore/platform/graphics/WidthCache.h	2017-04-25 16:35:39 UTC (rev 215737)
@@ -140,22 +140,22 @@
             return nullptr;
         // The width cache is not really profitable unless we're doing expensive glyph transformations.
         if (!hasKerningOrLigatures)
-            return 0;
+            return nullptr;
         // Word spacing and letter spacing can change the width of a word.
         if (hasWordSpacingOrLetterSpacing)
-            return 0;
+            return nullptr;
         // Since this is just a width cache, we don't have enough information to satisfy glyph queries.
         if (glyphOverflow)
-            return 0;
+            return nullptr;
         // If we allow tabs and a tab occurs inside a word, the width of the word varies based on its position on the line.
         if (run.allowTabs())
-            return 0;
+            return nullptr;
         if (static_cast<unsigned>(run.length()) > SmallStringKey::capacity())
-            return 0;
+            return nullptr;
 
         if (m_countdown > 0) {
             --m_countdown;
-            return 0;
+            return nullptr;
         }
 
         return addSlowCase(run.text(), entry);
@@ -207,7 +207,7 @@
         // No need to be fancy: we're just trying to avoid pathological growth.
         m_singleCharMap.clear();
         m_map.clear();
-        return 0;
+        return nullptr;
     }
 
     typedef HashMap<SmallStringKey, float, SmallStringKeyHash, SmallStringKeyHashTraits> Map;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to