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

Changeset 276210 in webkit


Ignore:
Timestamp:
Apr 17, 2021, 3:40:08 PM (5 years ago)
Author:
Chris Lord
Message:

Create local copy of CSSParserContext in CSSPropertyParserWorkerSafe
https://bugs.webkit.org/show_bug.cgi?id=224675

Reviewed by Darin Adler.

Make sure to hold a copy of the CSSParserContext in
CSSPropertyParserWorkerSafe functions as CSSParserImpl only takes a
reference.

  • css/parser/CSSParserWorkerSafe.cpp:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r276209 r276210  
     12021-04-17  Chris Lord  <clord@igalia.com>
     2
     3        Create local copy of CSSParserContext in CSSPropertyParserWorkerSafe
     4        https://bugs.webkit.org/show_bug.cgi?id=224675
     5
     6        Reviewed by Darin Adler.
     7
     8        Make sure to hold a copy of the CSSParserContext in
     9        CSSPropertyParserWorkerSafe functions as CSSParserImpl only takes a
     10        reference.
     11
     12        * css/parser/CSSParserWorkerSafe.cpp:
     13
    1142021-04-17  Tyler Wilcock  <twilco.o@protonmail.com>
    215
  • trunk/Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp

    r276017 r276210  
    6969}
    7070
    71 static CSSParserContext parserContext(ScriptExecutionContext& context)
    72 {
    73     if (!is<Document>(context))
    74         return HTMLStandardMode;
    75     return downcast<Document>(context).inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode;
     71static CSSParserMode parserMode(ScriptExecutionContext& context)
     72{
     73    return (is<Document>(context) && downcast<Document>(context).inQuirksMode()) ? HTMLQuirksMode : HTMLStandardMode;
    7674}
    7775
     
    9290RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceStyle(const String& string, ScriptExecutionContext& context)
    9391{
    94     CSSParserImpl parser(parserContext(context), string);
     92    CSSParserContext parserContext(parserMode(context));
     93    CSSParserImpl parser(parserContext, string);
    9594    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    9695    range.consumeWhitespace();
     
    9998    auto parsedValue =
    10099#if ENABLE(VARIATION_FONTS)
    101         CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange(range, parser.context().mode, context.cssValuePool());
     100        CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange(range, parserContext.mode, context.cssValuePool());
    102101#else
    103         CSSPropertyParserHelpersWorkerSafe::consumeFontStyle(range, parser.context().mode, context.cssValuePool());
     102        CSSPropertyParserHelpersWorkerSafe::consumeFontStyle(range, parserContext.mode, context.cssValuePool());
    104103#endif
    105104    if (!parsedValue || !range.atEnd())
     
    111110RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceWeight(const String& string, ScriptExecutionContext& context)
    112111{
    113     CSSParserImpl parser(parserContext(context), string);
     112    CSSParserContext parserContext(parserMode(context));
     113    CSSParserImpl parser(parserContext, string);
    114114    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    115115    range.consumeWhitespace();
     
    130130RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceStretch(const String& string, ScriptExecutionContext& context)
    131131{
    132     CSSParserImpl parser(parserContext(context), string);
     132    CSSParserContext parserContext(parserMode(context));
     133    CSSParserImpl parser(parserContext, string);
    133134    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    134135    range.consumeWhitespace();
     
    149150RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceUnicodeRange(const String& string, ScriptExecutionContext& context)
    150151{
    151     CSSParserImpl parser(parserContext(context), string);
     152    CSSParserContext parserContext(parserMode(context));
     153    CSSParserImpl parser(parserContext, string);
    152154    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    153155    range.consumeWhitespace();
     
    163165RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceFeatureSettings(const String& string, ScriptExecutionContext& context)
    164166{
    165     CSSParserImpl parser(parserContext(context), string);
     167    CSSParserContext parserContext(parserMode(context));
     168    CSSParserImpl parser(parserContext, string);
    166169    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    167170    range.consumeWhitespace();
     
    177180RefPtr<CSSValue> CSSPropertyParserWorkerSafe::parseFontFaceDisplay(const String& string, ScriptExecutionContext& context)
    178181{
    179     CSSParserImpl parser(parserContext(context), string);
     182    CSSParserContext parserContext(parserMode(context));
     183    CSSParserImpl parser(parserContext, string);
    180184    CSSParserTokenRange range = parser.tokenizer()->tokenRange();
    181185    range.consumeWhitespace();
Note: See TracChangeset for help on using the changeset viewer.