Changeset 281845 in webkit
- Timestamp:
- Sep 1, 2021, 2:38:09 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r281842 r281845 1 2021-09-01 Myles C. Maxfield <mmaxfield@apple.com> 2 3 document.fonts.size needs to update style so it doesn't return stale values 4 https://bugs.webkit.org/show_bug.cgi?id=229644 5 6 Reviewed by Darin Adler. 7 8 * web-platform-tests/css/css-font-loading/fontfaceset-update-after-stylesheet-change-expected.txt: 9 1 10 2021-09-01 Myles C. Maxfield <mmaxfield@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-update-after-stylesheet-change-expected.txt
r281836 r281845 1 1 2 FAIL fontfaceset-update-after-stylesheet-change assert_equals: expected 0 but got 1 2 PASS fontfaceset-update-after-stylesheet-change 3 3 -
trunk/Source/WebCore/ChangeLog
r281842 r281845 1 2021-09-01 Myles C. Maxfield <mmaxfield@apple.com> 2 3 document.fonts.size needs to update style so it doesn't return stale values 4 https://bugs.webkit.org/show_bug.cgi?id=229644 5 6 Reviewed by Darin Adler. 7 8 Currently, we only update style inside the document::fonts() call. 9 This isn't correct because content can save the results of document.fonts, 10 do some work, then ask for its size. 11 12 Test: web-platform-tests/css/css-font-loading/fontfaceset-update-after-stylesheet-change.html 13 14 * css/CSSFontFace.cpp: 15 (WebCore::CSSFontFace::updateStyleIfNeeded): 16 * css/CSSFontFace.h: 17 * css/CSSFontFaceSet.cpp: 18 (WebCore::CSSFontFaceSet::updateStyleIfNeeded): 19 * css/CSSFontFaceSet.h: 20 * css/CSSFontSelector.cpp: 21 (WebCore::CSSFontSelector::updateStyleIfNeeded): 22 (WebCore::CSSFontSelector::fontStyleUpdateNeeded): Deleted. 23 * css/CSSFontSelector.h: 24 * css/FontFaceSet.cpp: 25 (WebCore::FontFaceSet::size): 26 (WebCore::FontFaceSet::size const): Deleted. 27 * css/FontFaceSet.h: 28 * dom/Document.cpp: 29 (WebCore::Document::fonts): 30 1 31 2021-09-01 Myles C. Maxfield <mmaxfield@apple.com> 2 32 -
trunk/Source/WebCore/css/CSSFontFace.cpp
r278466 r281845 700 700 { 701 701 iterateClients(m_clients, [&](Client& client) { 702 client. fontStyleUpdateNeeded(*this);702 client.updateStyleIfNeeded(*this); 703 703 }); 704 704 } -
trunk/Source/WebCore/css/CSSFontFace.h
r278466 r281845 126 126 virtual void fontStateChanged(CSSFontFace&, Status /*oldState*/, Status /*newState*/) { } 127 127 virtual void fontPropertyChanged(CSSFontFace&, CSSValueList* /*oldFamilies*/ = nullptr) { } 128 virtual void fontStyleUpdateNeeded(CSSFontFace&) { }128 virtual void updateStyleIfNeeded(CSSFontFace&) { } 129 129 virtual void ref() = 0; 130 130 virtual void deref() = 0; -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r281648 r281845 104 104 } 105 105 106 // Calling updateStyleIfNeeded() might delete |this|. 107 void CSSFontFaceSet::updateStyleIfNeeded() 108 { 109 if (m_owningFontSelector) 110 m_owningFontSelector->updateStyleIfNeeded(); 111 } 112 106 113 void CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered(const String& familyName) 107 114 { -
trunk/Source/WebCore/css/CSSFontFaceSet.h
r281842 r281845 58 58 void addFontEventClient(const FontEventClient&); 59 59 60 // Calling updateStyleIfNeeded() might delete |this|. 61 void updateStyleIfNeeded(); 62 60 63 bool hasFace(const CSSFontFace&) const; 61 64 size_t faceCount() const { return m_faces.size(); } … … 85 88 void ref() final { RefCounted::ref(); } 86 89 void deref() final { RefCounted::deref(); } 90 // FIXME: Should this be implemented? 91 void updateStyleIfNeeded(CSSFontFace&) final { } 87 92 88 93 private: -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r278466 r281845 270 270 } 271 271 272 void CSSFontSelector:: fontStyleUpdateNeeded(CSSFontFace&)272 void CSSFontSelector::updateStyleIfNeeded() 273 273 { 274 274 if (is<Document>(m_context.get())) 275 275 downcast<Document>(*m_context).updateStyleIfNeeded(); 276 } 277 278 void CSSFontSelector::updateStyleIfNeeded(CSSFontFace&) 279 { 280 updateStyleIfNeeded(); 276 281 } 277 282 -
trunk/Source/WebCore/css/CSSFontSelector.h
r278253 r281845 90 90 void loadPendingFonts(); 91 91 92 void updateStyleIfNeeded(); 93 92 94 // CSSFontFace::Client needs to be able to be held in a RefPtr. 93 95 void ref() final { FontSelector::ref(); } … … 105 107 // CSSFontFace::Client 106 108 void fontLoaded(CSSFontFace&) final; 107 void fontStyleUpdateNeeded(CSSFontFace&) final;109 void updateStyleIfNeeded(CSSFontFace&) final; 108 110 109 111 void fontModified(); -
trunk/Source/WebCore/css/FontFaceSet.cpp
r281842 r281845 111 111 } 112 112 113 size_t FontFaceSet::size() const 114 { 115 return m_backing->faceCount(); 113 size_t FontFaceSet::size() 114 { 115 auto protect = m_backing; 116 protect->updateStyleIfNeeded(); 117 return protect->faceCount(); 116 118 } 117 119 -
trunk/Source/WebCore/css/FontFaceSet.h
r274143 r281845 47 47 48 48 bool has(FontFace&) const; 49 size_t size() const;49 size_t size(); 50 50 FontFaceSet& add(FontFace&); 51 51 bool remove(FontFace&); -
trunk/Source/WebCore/dom/Document.cpp
r281839 r281845 7445 7445 Ref<FontFaceSet> Document::fonts() 7446 7446 { 7447 updateStyleIfNeeded(); 7447 updateStyleIfNeeded(); // FIXME: This is unnecessary. Instead, the actual accessors in the FontFaceSet need to update style. 7448 7448 return fontSelector().fontFaceSet(); 7449 7449 }
Note:
See TracChangeset
for help on using the changeset viewer.