Changeset 281951 in webkit


Ignore:
Timestamp:
Sep 2, 2021 1:41:18 PM (11 months ago)
Author:
mmaxfield@apple.com
Message:

FontFaceSet.add() needs to throw when called on a CSS-connected font
https://bugs.webkit.org/show_bug.cgi?id=229641

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected-expected.txt:

Source/WebCore:

https://drafts.csswg.org/css-font-loading-3/#dom-fontfaceset-add
"2. If font is CSS-connected, throw an InvalidModificationError exception and exit this algorithm immediately."

Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected.html

  • css/FontFaceSet.cpp:

(WebCore::FontFaceSet::add): Deleted.

  • css/FontFaceSet.h:

LayoutTests:

  • fast/text/font-face-set-document-expected.txt:
  • fast/text/font-face-set-document.html:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r281948 r281951  
     12021-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFaceSet.add() needs to throw when called on a CSS-connected font
     4        https://bugs.webkit.org/show_bug.cgi?id=229641
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/text/font-face-set-document-expected.txt:
     9        * fast/text/font-face-set-document.html:
     10
    1112021-09-02  Peng Liu  <peng.liu6@apple.com>
    212
  • trunk/LayoutTests/fast/text/font-face-set-document-expected.txt

    r203092 r281951  
    55PASS object.value.family is "MyFont2"
    66PASS object.done is true
    7 PASS fontFaceSet.size is 2
    8 PASS object.done is false
    9 PASS object.value.family is "MyFont1"
     7PASS fontFaceSet.add(document.fonts.keys().next().value) threw exception InvalidModificationError:  The object can not be modified in this way..
     8PASS fontFaceSet.size is 1
    109PASS object.done is false
    1110PASS object.value.family is "MyFont2"
  • trunk/LayoutTests/fast/text/font-face-set-document.html

    r203092 r281951  
    3636var fontFaceSet = new FontFaceSet([]);
    3737fontFaceSet.add(new FontFace("MyFont2", "url(\"asdf\")", {}));
    38 fontFaceSet.add(document.fonts.keys().next().value);
    39 shouldBe("fontFaceSet.size", "2");
     38shouldThrow("fontFaceSet.add(document.fonts.keys().next().value)");
     39shouldBe("fontFaceSet.size", "1");
    4040iterator = fontFaceSet.keys();
    41 object = iterator.next();
    42 shouldBeFalse("object.done");
    43 shouldBeEqualToString("object.value.family", "MyFont1");
    4441object = iterator.next();
    4542shouldBeFalse("object.done");
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r281941 r281951  
     12021-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFaceSet.add() needs to throw when called on a CSS-connected font
     4        https://bugs.webkit.org/show_bug.cgi?id=229641
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected-expected.txt:
     9
    1102021-09-02  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected-expected.txt

    r281836 r281951  
    11
    2 FAIL fontfaceset-add-css-connected assert_throws_dom: function "function () { fontFaceSet.add(font); }" did not throw
     2PASS fontfaceset-add-css-connected
    33
  • trunk/Source/WebCore/ChangeLog

    r281950 r281951  
     12021-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        FontFaceSet.add() needs to throw when called on a CSS-connected font
     4        https://bugs.webkit.org/show_bug.cgi?id=229641
     5
     6        Reviewed by Simon Fraser.
     7
     8        https://drafts.csswg.org/css-font-loading-3/#dom-fontfaceset-add
     9        "2. If font is CSS-connected, throw an InvalidModificationError exception and exit this algorithm immediately."
     10
     11        Test: imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected.html
     12
     13        * css/FontFaceSet.cpp:
     14        (WebCore::FontFaceSet::add): Deleted.
     15        * css/FontFaceSet.h:
     16
    1172021-09-02  David Kilzer  <ddkilzer@apple.com>
    218
  • trunk/Source/WebCore/css/FontFaceSet.cpp

    r281845 r281951  
    118118}
    119119
    120 FontFaceSet& FontFaceSet::add(FontFace& face)
    121 {
    122     if (!m_backing->hasFace(face.backing()))
    123         m_backing->add(face.backing());
     120ExceptionOr<FontFaceSet&> FontFaceSet::add(FontFace& face)
     121{
     122    if (m_backing->hasFace(face.backing()))
     123        return *this;
     124    if (face.backing().cssConnection())
     125        return Exception(InvalidModificationError);
     126    m_backing->add(face.backing());
    124127    return *this;
    125128}
  • trunk/Source/WebCore/css/FontFaceSet.h

    r281845 r281951  
    4848    bool has(FontFace&) const;
    4949    size_t size();
    50     FontFaceSet& add(FontFace&);
     50    ExceptionOr<FontFaceSet&> add(FontFace&);
    5151    bool remove(FontFace&);
    5252    void clear();
Note: See TracChangeset for help on using the changeset viewer.