Title: [270932] trunk/Source
Revision
270932
Author
[email protected]
Date
2020-12-17 03:18:41 -0800 (Thu, 17 Dec 2020)

Log Message

Make FontCascade::CodePath an enum class
https://bugs.webkit.org/show_bug.cgi?id=219947

Patch by Rob Buis <[email protected]> on 2020-12-17
Reviewed by Alex Christensen.

Source/WebCore:

Make FontCascade::CodePath an enum class. Besides the
usual enum class benefits, one additional nice thing
is that it removed the need for the "Complex" ifdef.

* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFontAndText):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuring):
* platform/graphics/ComplexTextController.cpp:
(WebCore::TextLayout::isNeeded):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::layoutText const):
(WebCore::FontCascade::displayListForTextRun const):
(WebCore::FontCascade::widthOfTextRange const):
(WebCore::FontCascade::width const):
(WebCore::FontCascade::widthForSimpleText const):
(WebCore::FontCascade::adjustSelectionRectForText const):
(WebCore::FontCascade::offsetForPosition const):
(WebCore::FontCascade::codePath const):
(WebCore::FontCascade::characterRangeCodePath):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::characterRangeCodePath):
* platform/win/WebCoreTextRenderer.cpp:
(WebCore::WebCoreSetAlwaysUsesComplexTextCodePath):
(WebCore::WebCoreAlwaysUsesComplexTextCodePath):
* rendering/RenderText.cpp:
(WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
(WebCore::RenderText::computeCanUseSimpleFontCodePath const):
* rendering/svg/SVGTextMetricsBuilder.cpp:
(WebCore::SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer):

Source/WebKit:

Adapt to enum class change.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setAlwaysUsesComplexTextCodePath):

Source/WebKitLegacy/mac:

Adapt to enum class change.

* WebView/WebView.mm:
(+[WebView _setAlwaysUsesComplexTextCodePath:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270931 => 270932)


--- trunk/Source/WebCore/ChangeLog	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/ChangeLog	2020-12-17 11:18:41 UTC (rev 270932)
@@ -1,5 +1,43 @@
 2020-12-17  Rob Buis  <[email protected]>
 
+        Make FontCascade::CodePath an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=219947
+
+        Reviewed by Alex Christensen.
+
+        Make FontCascade::CodePath an enum class. Besides the
+        usual enum class benefits, one additional nice thing
+        is that it removed the need for the "Complex" ifdef.
+
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::canUseForFontAndText):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::canUseSimplifiedTextMeasuring):
+        * platform/graphics/ComplexTextController.cpp:
+        (WebCore::TextLayout::isNeeded):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::layoutText const):
+        (WebCore::FontCascade::displayListForTextRun const):
+        (WebCore::FontCascade::widthOfTextRange const):
+        (WebCore::FontCascade::width const):
+        (WebCore::FontCascade::widthForSimpleText const):
+        (WebCore::FontCascade::adjustSelectionRectForText const):
+        (WebCore::FontCascade::offsetForPosition const):
+        (WebCore::FontCascade::codePath const):
+        (WebCore::FontCascade::characterRangeCodePath):
+        * platform/graphics/FontCascade.h:
+        (WebCore::FontCascade::characterRangeCodePath):
+        * platform/win/WebCoreTextRenderer.cpp:
+        (WebCore::WebCoreSetAlwaysUsesComplexTextCodePath):
+        (WebCore::WebCoreAlwaysUsesComplexTextCodePath):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
+        (WebCore::RenderText::computeCanUseSimpleFontCodePath const):
+        * rendering/svg/SVGTextMetricsBuilder.cpp:
+        (WebCore::SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer):
+
+2020-12-17  Rob Buis  <[email protected]>
+
         Make MixedContentChecker stateless
         https://bugs.webkit.org/show_bug.cgi?id=219771
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (270931 => 270932)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -498,7 +498,7 @@
         } else {
             WebCore::TextRun run(String(textRenderer.text()));
             run.setCharacterScanForCodePath(false);
-            if (style.fontCascade().codePath(run) != FontCascade::Simple)
+            if (style.fontCascade().codePath(run) != FontCascade::CodePath::Simple)
                 SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);
         }
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (270931 => 270932)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -98,7 +98,7 @@
 
 static bool canUseSimplifiedTextMeasuring(const StringView& content, const FontCascade& font, bool whitespaceIsCollapsed)
 {
-    if (font.codePath(TextRun(content)) == FontCascade::Complex)
+    if (font.codePath(TextRun(content)) == FontCascade::CodePath::Complex)
         return false;
 
     if (font.wordSpacing() || font.letterSpacing())

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (270931 => 270932)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -49,7 +49,7 @@
     static bool isNeeded(RenderText& text, const FontCascade& font)
     {
         TextRun run = RenderBlock::constructTextRun(text, text.style());
-        return font.codePath(run) == FontCascade::Complex;
+        return font.codePath(run) == FontCascade::CodePath::Complex;
     }
 
     TextLayout(RenderText& text, const FontCascade& font, float xPos)

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (270931 => 270932)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -67,7 +67,7 @@
     return set.get().contains(family);
 }
 
-FontCascade::CodePath FontCascade::s_codePath = Auto;
+FontCascade::CodePath FontCascade::s_codePath = CodePath::Auto;
 
 // ============================================================================================
 // FontCascade Implementation (Cross-Platform Portion)
@@ -287,7 +287,7 @@
 
 GlyphBuffer FontCascade::layoutText(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, ForTextEmphasisOrNot forTextEmphasis) const
 {
-    if (codePathToUse != Complex)
+    if (codePathToUse != CodePath::Complex)
         return layoutSimpleText(run, from, to, forTextEmphasis);
 
     return layoutComplexText(run, from, to, forTextEmphasis);
@@ -331,8 +331,8 @@
     
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
     CodePath codePathToUse = codePath(run);
-    if (codePathToUse != Complex && (enableKerning() || requiresShaping()) && (from || destination != run.length()))
-        codePathToUse = Complex;
+    if (codePathToUse != CodePath::Complex && (enableKerning() || requiresShaping()) && (from || destination != run.length()))
+        codePathToUse = CodePath::Complex;
 
     auto glyphBuffer = layoutText(codePathToUse, run, from, destination);
     glyphBuffer.flatten();
@@ -363,7 +363,7 @@
     float totalWidth = 0;
 
     auto codePathToUse = codePath(run);
-    if (codePathToUse == Complex) {
+    if (codePathToUse == CodePath::Complex) {
         ComplexTextController complexIterator(*this, run, false, fallbackFonts);
         complexIterator.advance(from, nullptr, IncludePartialGlyphs, fallbackFonts);
         offsetBeforeRange = complexIterator.runWidthSoFar();
@@ -398,12 +398,12 @@
         return 0;
 
     CodePath codePathToUse = codePath(run);
-    if (codePathToUse != Complex) {
+    if (codePathToUse != CodePath::Complex) {
         // The complex path is more restrictive about returning fallback fonts than the simple path, so we need an explicit test to make their behaviors match.
         if (!canReturnFallbackFontsForComplexText())
             fallbackFonts = nullptr;
         // The simple path can optimize the case where glyph overflow is not observable.
-        if (codePathToUse != SimpleWithGlyphOverflow && (glyphOverflow && !glyphOverflow->computeBounds))
+        if (codePathToUse != CodePath::SimpleWithGlyphOverflow && (glyphOverflow && !glyphOverflow->computeBounds))
             glyphOverflow = nullptr;
     }
 
@@ -417,7 +417,7 @@
         fallbackFonts = &localFallbackFonts;
 
     float result;
-    if (codePathToUse == Complex)
+    if (codePathToUse == CodePath::Complex)
         result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow);
     else
         result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow);
@@ -431,7 +431,7 @@
 {
     if (text.isNull() || text.isEmpty())
         return 0;
-    ASSERT(codePath(TextRun(text)) != FontCascade::Complex);
+    ASSERT(codePath(TextRun(text)) != CodePath::Complex);
     float* cacheEntry = m_fonts->widthCache().add(text, std::numeric_limits<float>::quiet_NaN());
     if (cacheEntry && !std::isnan(*cacheEntry))
         return *cacheEntry;
@@ -546,7 +546,7 @@
 void FontCascade::adjustSelectionRectForText(const TextRun& run, LayoutRect& selectionRect, unsigned from, Optional<unsigned> to) const
 {
     unsigned destination = to.valueOr(run.length());
-    if (codePath(run, from, to) != Complex)
+    if (codePath(run, from, to) != CodePath::Complex)
         return adjustSelectionRectForSimpleText(run, selectionRect, from, destination);
 
     return adjustSelectionRectForComplexText(run, selectionRect, from, destination);
@@ -554,7 +554,7 @@
 
 int FontCascade::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const
 {
-    if (codePath(run, x) != Complex)
+    if (codePath(run, x) != CodePath::Complex)
         return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
 
     return offsetForPositionForComplexText(run, x, includePartialGlyphs);
@@ -614,13 +614,13 @@
 
 FontCascade::CodePath FontCascade::codePath(const TextRun& run, Optional<unsigned> from, Optional<unsigned> to) const
 {
-    if (s_codePath != Auto)
+    if (s_codePath != CodePath::Auto)
         return s_codePath;
 
 #if !USE(FREETYPE)
     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
     if ((enableKerning() || requiresShaping()) && (from.valueOr(0) || to.valueOr(run.length()) != run.length()))
-        return Complex;
+        return CodePath::Complex;
 #else
     UNUSED_PARAM(from);
     UNUSED_PARAM(to);
@@ -630,19 +630,19 @@
     // Because Font::applyTransforms() doesn't know which features to enable/disable in the simple code path, it can't properly handle feature or variant settings.
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=150791: @font-face features should also cause this to be complex.
     if (m_fontDescription.featureSettings().size() > 0 || !m_fontDescription.variantSettings().isAllNormal())
-        return Complex;
+        return CodePath::Complex;
 
 #else
 
     if (run.length() > 1 && (enableKerning() || requiresShaping()))
-        return Complex;
+        return CodePath::Complex;
 #endif
 
     if (!run.characterScanForCodePath())
-        return Simple;
+        return CodePath::Simple;
 
     if (run.is8Bit())
-        return Simple;
+        return CodePath::Simple;
 
     // Start from 0 since drawing and highlighting also measure the characters before run->from.
     return characterRangeCodePath(run.characters16(), run.length());
@@ -655,28 +655,28 @@
     // are not 'combining', but still need to go to the complex path.
     // Alternatively, we may as well consider binary search over a sorted
     // list of ranges.
-    CodePath result = Simple;
+    CodePath result = CodePath::Simple;
     bool previousCharacterIsEmojiGroupCandidate = false;
     for (unsigned i = 0; i < len; i++) {
         const UChar c = characters[i];
         if (c == zeroWidthJoiner && previousCharacterIsEmojiGroupCandidate)
-            return Complex;
+            return CodePath::Complex;
         
         previousCharacterIsEmojiGroupCandidate = false;
         if (c < 0x2E5) // U+02E5 through U+02E9 (Modifier Letters : Tone letters)  
             continue;
         if (c <= 0x2E9) 
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x300) // U+0300 through U+036F Combining diacritical marks
             continue;
         if (c <= 0x36F)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha
             continue;
         if (c <= 0x05CF)
-            return Complex;
+            return CodePath::Complex;
 
         // U+0600 through U+109F Arabic, Syriac, Thaana, NKo, Samaritan, Mandaic,
         // Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, 
@@ -684,7 +684,7 @@
         if (c < 0x0600) 
             continue;
         if (c <= 0x109F)
-            return Complex;
+            return CodePath::Complex;
 
         // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose;
         // Modern Korean will be precomposed as a result of step A)
@@ -691,41 +691,41 @@
         if (c < 0x1100)
             continue;
         if (c <= 0x11FF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x135D) // U+135D through U+135F Ethiopic combining marks
             continue;
         if (c <= 0x135F)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x1700) // U+1780 through U+18AF Tagalog, Hanunoo, Buhid, Taghanwa,Khmer, Mongolian
             continue;
         if (c <= 0x18AF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0)
             continue;
         if (c <= 0x194F)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x1980) // U+1980 through U+19DF New Tai Lue
             continue;
         if (c <= 0x19DF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x1A00) // U+1A00 through U+1CFF Buginese, Tai Tham, Balinese, Batak, Lepcha, Vedic
             continue;
         if (c <= 0x1CFF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x1DC0) // U+1DC0 through U+1DFF Comining diacritical mark supplement
             continue;
         if (c <= 0x1DFF)
-            return Complex;
+            return CodePath::Complex;
 
         // U+1E00 through U+2000 characters with diacritics and stacked diacritics
         if (c <= 0x2000) {
-            result = SimpleWithGlyphOverflow;
+            result = CodePath::SimpleWithGlyphOverflow;
             continue;
         }
 
@@ -732,37 +732,37 @@
         if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols
             continue;
         if (c <= 0x20FF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x26F9)
             continue;
         if (c < 0x26FA)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x2CEF) // U+2CEF through U+2CF1 Combining marks for Coptic
             continue;
         if (c <= 0x2CF1)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x302A) // U+302A through U+302F Ideographic and Hangul Tone marks
             continue;
         if (c <= 0x302F)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0x3099)
             continue;
         if (c < 0x309D)
-            return Complex; // KATAKANA-HIRAGANA (SEMI-)VOICED SOUND MARKS require character composition
+            return CodePath::Complex; // KATAKANA-HIRAGANA (SEMI-)VOICED SOUND MARKS require character composition
 
         if (c < 0xA67C) // U+A67C through U+A67D Combining marks for old Cyrillic
             continue;
         if (c <= 0xA67D)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0xA6F0) // U+A6F0 through U+A6F1 Combining mark for Bamum
             continue;
         if (c <= 0xA6F1)
-            return Complex;
+            return CodePath::Complex;
 
         // U+A800 through U+ABFF Nagri, Phags-pa, Saurashtra, Devanagari Extended,
         // Hangul Jamo Ext. A, Javanese, Myanmar Extended A, Tai Viet, Meetei Mayek,
@@ -769,12 +769,12 @@
         if (c < 0xA800) 
             continue;
         if (c <= 0xABFF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0xD7B0) // U+D7B0 through U+D7FF Hangul Jamo Ext. B
             continue;
         if (c <= 0xD7FF)
-            return Complex;
+            return CodePath::Complex;
 
         if (c <= 0xDBFF) {
             // High surrogate
@@ -791,66 +791,66 @@
             if (supplementaryCharacter < 0x10A00)
                 continue;
             if (supplementaryCharacter < 0x10A60) // Kharoshthi
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11000)
                 continue;
             if (supplementaryCharacter < 0x11080) // Brahmi
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x110D0) // Kaithi
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11100)
                 continue;
             if (supplementaryCharacter < 0x11150) // Chakma
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11180) // Mahajani
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x111E0) // Sharada
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11200)
                 continue;
             if (supplementaryCharacter < 0x11250) // Khojki
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x112B0)
                 continue;
             if (supplementaryCharacter < 0x11300) // Khudawadi
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11380) // Grantha
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11400)
                 continue;
             if (supplementaryCharacter < 0x11480) // Newa
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x114E0) // Tirhuta
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11580)
                 continue;
             if (supplementaryCharacter < 0x11600) // Siddham
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11660) // Modi
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11680)
                 continue;
             if (supplementaryCharacter < 0x116D0) // Takri
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11700)
                 continue;
             if (supplementaryCharacter < 0x11C00) // Ahom, Dogra, Dives Akuru, Nandinagari, Zanabazar Square, Soyombo, Warang Citi, Pau Cin Hau
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11C70) // Bhaiksuki
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x11CC0) // Marchen
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x1E900)
                 continue;
             if (supplementaryCharacter < 0x1E960) // Adlam
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0x1F1E6) // U+1F1E6 through U+1F1FF Regional Indicator Symbols
                 continue;
             if (supplementaryCharacter <= 0x1F1FF)
-                return Complex;
+                return CodePath::Complex;
 
             if (isEmojiFitzpatrickModifier(supplementaryCharacter))
-                return Complex;
+                return CodePath::Complex;
             if (isEmojiGroupCandidate(supplementaryCharacter)) {
                 previousCharacterIsEmojiGroupCandidate = true;
                 continue;
@@ -859,11 +859,11 @@
             if (supplementaryCharacter < 0xE0000)
                 continue;
             if (supplementaryCharacter < 0xE0080) // Tags
-                return Complex;
+                return CodePath::Complex;
             if (supplementaryCharacter < 0xE0100) // U+E0100 through U+E01EF Unicode variation selectors.
                 continue;
             if (supplementaryCharacter <= 0xE01EF)
-                return Complex;
+                return CodePath::Complex;
 
             // FIXME: Check for Brahmi (U+11000 block), Kaithi (U+11080 block) and other complex scripts
             // in plane 1 or higher.
@@ -874,12 +874,12 @@
         if (c < 0xFE00) // U+FE00 through U+FE0F Unicode variation selectors
             continue;
         if (c <= 0xFE0F)
-            return Complex;
+            return CodePath::Complex;
 
         if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks
             continue;
         if (c <= 0xFE2F)
-            return Complex;
+            return CodePath::Complex;
     }
     return result;
 }

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (270931 => 270932)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-12-17 11:18:41 UTC (rev 270932)
@@ -34,12 +34,6 @@
 #include <wtf/WeakPtr.h>
 #include <wtf/unicode/CharacterNames.h>
 
-// "X11/X.h" defines Complex to 0 and conflicts
-// with Complex value in CodePath enum.
-#ifdef Complex
-#undef Complex
-#endif
-
 namespace WebCore {
 
 class GraphicsContext;
@@ -189,9 +183,9 @@
 
     static bool isSubpixelAntialiasingAvailable();
 
-    enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow };
+    enum class CodePath : uint8_t { Auto, Simple, Complex, SimpleWithGlyphOverflow };
     CodePath codePath(const TextRun&, Optional<unsigned> from = WTF::nullopt, Optional<unsigned> to = WTF::nullopt) const;
-    static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simple; }
+    static CodePath characterRangeCodePath(const LChar*, unsigned) { return CodePath::Simple; }
     static CodePath characterRangeCodePath(const UChar*, unsigned len);
 
     bool primaryFontIsSystemFont() const;

Modified: trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp (270931 => 270932)


--- trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -106,12 +106,12 @@
 
 void WebCoreSetAlwaysUsesComplexTextCodePath(bool complex)
 {
-    FontCascade::setCodePath(complex ? FontCascade::Complex : FontCascade::Auto);
+    FontCascade::setCodePath(complex ? FontCascade::CodePath::Complex : FontCascade::CodePath::Auto);
 }
 
 bool WebCoreAlwaysUsesComplexTextCodePath()
 {
-    return FontCascade::codePath() == FontCascade::Complex;
+    return FontCascade::codePath() == FontCascade::CodePath::Complex;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (270931 => 270932)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -1432,7 +1432,7 @@
     // Additional check on the font codepath.
     TextRun run(m_text);
     run.setCharacterScanForCodePath(false);
-    if (font.codePath(run) != FontCascade::Simple)
+    if (font.codePath(run) != FontCascade::CodePath::Simple)
         return false;
 
     auto whitespaceIsCollapsed = style().collapseWhiteSpace();
@@ -1763,7 +1763,7 @@
 {
     if (m_isAllASCII || text().is8Bit())
         return true;
-    return FontCascade::characterRangeCodePath(text().characters16(), length()) == FontCascade::Simple;
+    return FontCascade::characterRangeCodePath(text().characters16(), length()) == FontCascade::CodePath::Simple;
 }
 
 void RenderText::momentarilyRevealLastTypedCharacter(unsigned offsetAfterLastTypedCharacter)

Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp (270931 => 270932)


--- trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -100,7 +100,7 @@
 
     const FontCascade& scaledFont = text.scaledFont();
     m_run = SVGTextMetrics::constructTextRun(text);
-    m_isComplexText = scaledFont.codePath(m_run) == FontCascade::Complex;
+    m_isComplexText = scaledFont.codePath(m_run) == FontCascade::CodePath::Complex;
 
     if (m_isComplexText)
         m_simpleWidthIterator = nullptr;

Modified: trunk/Source/WebKit/ChangeLog (270931 => 270932)


--- trunk/Source/WebKit/ChangeLog	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebKit/ChangeLog	2020-12-17 11:18:41 UTC (rev 270932)
@@ -1,3 +1,15 @@
+2020-12-17  Rob Buis  <[email protected]>
+
+        Make FontCascade::CodePath an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=219947
+
+        Reviewed by Alex Christensen.
+
+        Adapt to enum class change.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::setAlwaysUsesComplexTextCodePath):
+
 2020-12-16  Peng Liu  <[email protected]>
 
         [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (270931 => 270932)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-12-17 11:18:41 UTC (rev 270932)
@@ -655,7 +655,7 @@
 
 void WebProcess::setAlwaysUsesComplexTextCodePath(bool alwaysUseComplexText)
 {
-    WebCore::FontCascade::setCodePath(alwaysUseComplexText ? WebCore::FontCascade::Complex : WebCore::FontCascade::Auto);
+    WebCore::FontCascade::setCodePath(alwaysUseComplexText ? WebCore::FontCascade::CodePath::Complex : WebCore::FontCascade::CodePath::Auto);
 }
 
 void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (270931 => 270932)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-12-17 11:18:41 UTC (rev 270932)
@@ -1,3 +1,15 @@
+2020-12-17  Rob Buis  <[email protected]>
+
+        Make FontCascade::CodePath an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=219947
+
+        Reviewed by Alex Christensen.
+
+        Adapt to enum class change.
+
+        * WebView/WebView.mm:
+        (+[WebView _setAlwaysUsesComplexTextCodePath:]):
+
 2020-12-14  Chris Dumez  <[email protected]>
 
         Unreviewed, reverting r270768.

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (270931 => 270932)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-12-17 11:13:58 UTC (rev 270931)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-12-17 11:18:41 UTC (rev 270932)
@@ -2221,7 +2221,7 @@
 
 + (void)_setAlwaysUsesComplexTextCodePath:(BOOL)f
 {
-    WebCore::FontCascade::setCodePath(f ? WebCore::FontCascade::Complex : WebCore::FontCascade::Auto);
+    WebCore::FontCascade::setCodePath(f ? WebCore::FontCascade::CodePath::Complex : WebCore::FontCascade::CodePath::Auto);
 }
 
 + (BOOL)canCloseAllWebViews
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to