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

Changeset 243637 in webkit


Ignore:
Timestamp:
Mar 28, 2019, 7:26:47 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

FontFace constructor throws an exception when there is a name which starts with a number
https://bugs.webkit.org/show_bug.cgi?id=196232
<rdar://problem/49293978>

Reviewed by Ryosuke Niwa.

Source/WebCore:

We were technically following the spec, but Chrome and Firefox are both consistent and it was making a website break.
This is just a short-term fix until the underlying https://bugs.webkit.org/show_bug.cgi?id=196381 is fixed.

Test: fast/text/font-face-family.html

  • css/FontFace.cpp:

(WebCore::FontFace::setFamily):

LayoutTests:

  • fast/text/font-face-family-expected.txt: Added.
  • fast/text/font-face-family.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243635 r243637  
     12019-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFace constructor throws an exception when there is a name which starts with a number
     4        https://bugs.webkit.org/show_bug.cgi?id=196232
     5        <rdar://problem/49293978>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * fast/text/font-face-family-expected.txt: Added.
     10        * fast/text/font-face-family.html: Added.
     11
    1122019-03-28  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r243636 r243637  
     12019-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFace constructor throws an exception when there is a name which starts with a number
     4        https://bugs.webkit.org/show_bug.cgi?id=196232
     5        <rdar://problem/49293978>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        We were technically following the spec, but Chrome and Firefox are both consistent and it was making a website break.
     10        This is just a short-term fix until the underlying https://bugs.webkit.org/show_bug.cgi?id=196381 is fixed.
     11
     12        Test: fast/text/font-face-family.html
     13
     14        * css/FontFace.cpp:
     15        (WebCore::FontFace::setFamily):
     16
    1172019-03-28  Justin Fan  <justin_fan@apple.com>
    218
  • trunk/Source/WebCore/css/FontFace.cpp

    r243163 r243637  
    154154        return Exception { SyntaxError };
    155155
    156     bool success = false;
    157     if (auto value = parseString(family, CSSPropertyFontFamily))
    158         success = m_backing->setFamilies(*value);
     156    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=196381 Don't use a list here.
     157    // See consumeFontFamilyDescriptor() in CSSPropertyParser.cpp for why we're using it.
     158    auto list = CSSValueList::createCommaSeparated();
     159    list->append(CSSValuePool::singleton().createFontFamilyValue(family));
     160    bool success = m_backing->setFamilies(list);
    159161    if (!success)
    160162        return Exception { SyntaxError };
     
    294296{
    295297    m_backing->updateStyleIfNeeded();
     298
     299    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=196381 This is only here because CSSFontFace erroneously uses a list of values instead of a single value.
     300    // See consumeFontFamilyDescriptor() in CSSPropertyParser.cpp.
     301    if (m_backing->families()->length() == 1) {
     302        if (m_backing->families()->item(0)) {
     303            auto& item = *m_backing->families()->item(0);
     304            if (item.isPrimitiveValue()) {
     305                auto& primitiveValue = downcast<CSSPrimitiveValue>(item);
     306                if (primitiveValue.isFontFamily()) {
     307                    auto& fontFamily = primitiveValue.fontFamily();
     308                    return fontFamily.familyName;
     309                }
     310            }
     311        }
     312    }
    296313    return m_backing->families()->cssText();
    297314}
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r243318 r243637  
    10881088static RefPtr<CSSValueList> consumeFontFamilyDescriptor(CSSParserTokenRange& range)
    10891089{
    1090     // FIXME-NEWPARSER: For compatibility with the old parser, we have to make
     1090    // FIXME-NEWPARSER: https://bugs.webkit.org/show_bug.cgi?id=196381 For compatibility with the old parser, we have to make
    10911091    // a list here, even though the list always contains only a single family name.
    10921092    // Once the old parser is gone, we can delete this function, make the caller
Note: See TracChangeset for help on using the changeset viewer.