⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286637 in webkit


Ignore:
Timestamp:
Dec 7, 2021, 6:11:05 PM (5 years ago)
Author:
Cameron McCormack
Message:

Remove expandAroundIdeographs static variables
https://bugs.webkit.org/show_bug.cgi?id=233750

Reviewed by Myles Maxfield.

With OffscreenCanvas, we can call into
ComplexTextController::adjustGlyphsAndAdvances,
FontCascade::expansionOpportunityCountInternal, and
WidthIterator::calculateAdditionalWidth from worker threads.
These all have a static variable variable with an initializer
that calls FontCascade::canExpandAroundIdeographsInComplexText,
and such initializers are not safe under -fno-threadsafe-statics.

canExpandAroundIdeographsInComplexText is a simple enough function in
all ports (it just returns a constant bool) that it's not worth caching
the result in a static.

  • platform/graphics/ComplexTextController.cpp:

(WebCore::ComplexTextController::adjustGlyphsAndAdvances):

  • platform/graphics/FontCascade.cpp:

(WebCore::FontCascade::expansionOpportunityCountInternal):

  • platform/graphics/WidthIterator.cpp:

(WebCore::WidthIterator::calculateAdditionalWidth const):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286634 r286637  
     12021-12-07  Cameron McCormack  <heycam@apple.com>
     2
     3        Remove expandAroundIdeographs static variables
     4        https://bugs.webkit.org/show_bug.cgi?id=233750
     5
     6        Reviewed by Myles Maxfield.
     7
     8        With OffscreenCanvas, we can call into
     9        ComplexTextController::adjustGlyphsAndAdvances,
     10        FontCascade::expansionOpportunityCountInternal, and
     11        WidthIterator::calculateAdditionalWidth from worker threads.
     12        These all have a static variable variable with an initializer
     13        that calls FontCascade::canExpandAroundIdeographsInComplexText,
     14        and such initializers are not safe under -fno-threadsafe-statics.
     15
     16        canExpandAroundIdeographsInComplexText is a simple enough function in
     17        all ports (it just returns a constant bool) that it's not worth caching
     18        the result in a static.
     19
     20        * platform/graphics/ComplexTextController.cpp:
     21        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
     22        * platform/graphics/FontCascade.cpp:
     23        (WebCore::FontCascade::expansionOpportunityCountInternal):
     24        * platform/graphics/WidthIterator.cpp:
     25        (WebCore::WidthIterator::calculateAdditionalWidth const):
     26
    1272021-12-07  Cameron McCormack  <heycam@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp

    r285009 r286637  
    753753                    forbidRightExpansion = m_run.ltr() ? isLastCharacter : isFirstCharacter;
    754754                // Handle justification and word-spacing.
    755                 static bool expandAroundIdeographs = FontCascade::canExpandAroundIdeographsInComplexText();
    756                 bool ideograph = expandAroundIdeographs && FontCascade::isCJKIdeographOrSymbol(ch);
     755                bool ideograph = FontCascade::canExpandAroundIdeographsInComplexText() && FontCascade::isCJKIdeographOrSymbol(ch);
    757756                if (treatAsSpace || ideograph || forceLeftExpansion || forceRightExpansion) {
    758757                    // Distribute the run's total expansion evenly over all expansion opportunities in the run.
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r286625 r286637  
    10021002std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const UChar* characters, unsigned length, TextDirection direction, ExpansionBehavior expansionBehavior)
    10031003{
    1004     static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText();
    10051004    unsigned count = 0;
    10061005    bool isAfterExpansion = (expansionBehavior & LeftExpansionMask) == ForbidLeftExpansion;
     
    10211020                i++;
    10221021            }
    1023             if (expandAroundIdeographs && isCJKIdeographOrSymbol(character)) {
     1022            if (canExpandAroundIdeographsInComplexText() && isCJKIdeographOrSymbol(character)) {
    10241023                if (!isAfterExpansion)
    10251024                    count++;
     
    10421041                i--;
    10431042            }
    1044             if (expandAroundIdeographs && isCJKIdeographOrSymbol(character)) {
     1043            if (canExpandAroundIdeographsInComplexText() && isCJKIdeographOrSymbol(character)) {
    10451044                if (!isAfterExpansion)
    10461045                    count++;
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r286139 r286637  
    391391            bool forbidRightExpansion = isRightmostCharacter && (m_run.expansionBehavior() & RightExpansionMask) == ForbidRightExpansion;
    392392
    393             static const bool expandAroundIdeographs = FontCascade::canExpandAroundIdeographsInComplexText();
    394             bool isIdeograph = expandAroundIdeographs && FontCascade::isCJKIdeographOrSymbol(character);
     393            bool isIdeograph = FontCascade::canExpandAroundIdeographsInComplexText() && FontCascade::isCJKIdeographOrSymbol(character);
    395394
    396395            if (treatAsSpace || isIdeograph || forceLeftExpansion || forceRightExpansion) {
Note: See TracChangeset for help on using the changeset viewer.