Changeset 209217 in webkit


Ignore:
Timestamp:
Dec 1, 2016 2:54:52 PM (7 years ago)
Author:
hyatt@apple.com
Message:

[CSS Parser] Only allow a single font-family in @font-face
https://bugs.webkit.org/show_bug.cgi?id=165278

Reviewed by Zalan Bujtas.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeFontFamilyDescriptor):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209206 r209217  
     12016-12-01  Dave Hyatt  <hyatt@apple.com>
     2
     3        [CSS Parser] Only allow a single font-family in @font-face
     4        https://bugs.webkit.org/show_bug.cgi?id=165278
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * css/parser/CSSPropertyParser.cpp:
     9        (WebCore::consumeFontFamilyDescriptor):
     10        (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
     11
    1122016-12-01  Beth Dakin  <bdakin@apple.com>
    213
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r209199 r209217  
    921921        }
    922922    } while (consumeCommaIncludingWhitespace(range));
     923    return list;
     924}
     925
     926static RefPtr<CSSValueList> consumeFontFamilyDescriptor(CSSParserTokenRange& range)
     927{
     928    // FIXME-NEWPARSER: For compatibility with the old parser, we have to make
     929    // a list here, even though the list always contains only a single family name.
     930    // Once the old parser is gone, we can delete this function, make the caller
     931    // use consumeFamilyName instead, and then patch the @font-face code to
     932    // not expect a list with a single name in it.
     933    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
     934    RefPtr<CSSValue> parsedValue = consumeFamilyName(range);
     935    if (parsedValue)
     936        list->append(parsedValue.releaseNonNull());
     937   
     938    if (!range.atEnd() || !list->length())
     939        return nullptr;
     940
    923941    return list;
    924942}
     
    40774095    switch (propId) {
    40784096    case CSSPropertyFontFamily:
    4079         parsedValue = consumeFontFamily(m_range);
     4097        parsedValue = consumeFontFamilyDescriptor(m_range);
    40804098        break;
    40814099    case CSSPropertySrc: // This is a list of urls or local references.
Note: See TracChangeset for help on using the changeset viewer.