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

Changeset 282240 in webkit


Ignore:
Timestamp:
Sep 9, 2021, 2:57:32 PM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r281648. rdar://problem/82944435

REGRESSION(r256659): We try to remove fonts from the CSSFontFace which were never added
​https://bugs.webkit.org/show_bug.cgi?id=229535
<rdar://problem/78857440>

Reviewed by Darin Adler.

After r256659, asking for a failed CSSFontFace's families() returns nullopt. It's possible to add
a failed font to a CSSFontFaceSet (of course). When we do that, we recognize the font is failed
and don't update our internal data structures, because there's no need to - we can't do anything
useful with a failed font.

If you _then_ try to remove the font from the CSSFontFace, we don't call families(), but instead
just pull out the raw m_families member, and look in our internal data structures for it, but we
don't find it, because it was never added.

  • css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::addToFacesLookupTable): (WebCore::CSSFontFaceSet::removeFromFacesLookupTable):

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@281648 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/WebCore/ChangeLog

    r282227 r282240  
     12021-09-09  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r281648. rdar://problem/82944435
     4
     5    REGRESSION(r256659): We try to remove fonts from the CSSFontFace which were never added
     6    https://bugs.webkit.org/show_bug.cgi?id=229535
     7    <rdar://problem/78857440>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    After r256659, asking for a failed CSSFontFace's families() returns nullopt. It's possible to add
     12    a failed font to a CSSFontFaceSet (of course). When we do that, we recognize the font is failed
     13    and don't update our internal data structures, because there's no need to - we can't do anything
     14    useful with a failed font.
     15   
     16    If you _then_ try to remove the font from the CSSFontFace, we don't call families(), but instead
     17    just pull out the raw m_families member, and look in our internal data structures for it, but we
     18    don't find it, because it was never added.
     19   
     20    * css/CSSFontFaceSet.cpp:
     21    (WebCore::CSSFontFaceSet::addToFacesLookupTable):
     22    (WebCore::CSSFontFaceSet::removeFromFacesLookupTable):
     23   
     24    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     25
     26    2021-08-26  Myles C. Maxfield  <mmaxfield@apple.com>
     27
     28            REGRESSION(r256659): We try to remove fonts from the CSSFontFace which were never added
     29            https://bugs.webkit.org/show_bug.cgi?id=229535
     30            <rdar://problem/78857440>
     31
     32            Reviewed by Darin Adler.
     33
     34            After r256659, asking for a failed CSSFontFace's families() returns nullopt. It's possible to add
     35            a failed font to a CSSFontFaceSet (of course). When we do that, we recognize the font is failed
     36            and don't update our internal data structures, because there's no need to - we can't do anything
     37            useful with a failed font.
     38
     39            If you _then_ try to remove the font from the CSSFontFace, we don't call families(), but instead
     40            just pull out the raw m_families member, and look in our internal data structures for it, but we
     41            don't find it, because it was never added.
     42
     43            * css/CSSFontFaceSet.cpp:
     44            (WebCore::CSSFontFaceSet::addToFacesLookupTable):
     45            (WebCore::CSSFontFaceSet::removeFromFacesLookupTable):
     46
    1472021-09-09  Russell Epstein  <repstein@apple.com>
    248
  • branches/safari-612-branch/Source/WebCore/css/CSSFontFaceSet.cpp

    r278466 r282240  
    163163void CSSFontFaceSet::addToFacesLookupTable(CSSFontFace& face)
    164164{
    165     if (!face.families())
     165    if (!face.families()) {
     166        // If the font has failed, there's no point in actually adding it to m_facesLookupTable,
     167        // because no font requests can actually use it for anything. So, let's just ... not add it.
    166168        return;
     169    }
    167170    auto families = face.families().value();
    168171
    … …  
    221224
    222225        auto iterator = m_facesLookupTable.find(familyName);
    223         ASSERT(iterator != m_facesLookupTable.end());
     226        if (iterator == m_facesLookupTable.end()) {
     227            // The font may have failed even before addToFacesLookupTable() was called on it,
     228            // which means we never added it (because there's no point in adding a failed font).
     229            // So, if it was never added, removing it is free! Woohoo!
     230            return;
     231        }
    224232        bool found = false;
    225233        for (size_t i = 0; i < iterator->value.size(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.