Changeset 201906 in webkit
- Timestamp:
- Jun 9, 2016 10:24:46 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201904 r201906 1 2016-06-09 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r201887. 4 https://bugs.webkit.org/show_bug.cgi?id=158610 5 6 This change caused LayoutTest crashes under GuardMalloc and 7 ASan (Requested by ryanhaddad on #webkit). 8 9 Reverted changeset: 10 11 "Deleting a CSSOM style rule invalidates any previously-added 12 FontFaces" 13 https://bugs.webkit.org/show_bug.cgi?id=158450 14 http://trac.webkit.org/changeset/201887 15 1 16 2016-06-09 Zalan Bujtas <zalan@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r201903 r201906 1 2016-06-09 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r201887. 4 https://bugs.webkit.org/show_bug.cgi?id=158610 5 6 This change caused LayoutTest crashes under GuardMalloc and 7 ASan (Requested by ryanhaddad on #webkit). 8 9 Reverted changeset: 10 11 "Deleting a CSSOM style rule invalidates any previously-added 12 FontFaces" 13 https://bugs.webkit.org/show_bug.cgi?id=158450 14 http://trac.webkit.org/changeset/201887 15 1 16 2016-06-09 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebCore/css/CSSFontFace.cpp
r201887 r201906 95 95 , m_wrapper(wrapper ? wrapper->createWeakPtr() : WeakPtr<FontFace>()) 96 96 , m_isLocalFallback(isLocalFallback) 97 , m_mayBePurged(!wrapper)98 97 { 99 98 } … … 114 113 RefPtr<CSSValueList> oldFamilies = m_families; 115 114 m_families = &familyList; 116 117 if (m_cssConnection)118 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontFamily, &family);119 115 120 116 iterateClients(m_clients, [&](Client& client) { … … 147 143 if (auto mask = calculateStyleMask(style)) { 148 144 m_traitsMask = static_cast<FontTraitsMask>((static_cast<unsigned>(m_traitsMask) & (~FontStyleMask)) | mask.value()); 149 150 if (m_cssConnection)151 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontStyle, &style);152 145 153 146 iterateClients(m_clients, [&](Client& client) { … … 200 193 m_traitsMask = static_cast<FontTraitsMask>((static_cast<unsigned>(m_traitsMask) & (~FontWeightMask)) | mask.value()); 201 194 202 if (m_cssConnection)203 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontWeight, &weight);204 205 195 iterateClients(m_clients, [&](Client& client) { 206 196 client.fontPropertyChanged(*this); … … 225 215 } 226 216 227 if (m_cssConnection)228 m_cssConnection->mutableProperties().setProperty(CSSPropertyUnicodeRange, &unicodeRange);229 230 217 iterateClients(m_clients, [&](Client& client) { 231 218 client.fontPropertyChanged(*this); … … 244 231 m_variantSettings.contextualAlternates = ligatures.contextualAlternates; 245 232 246 if (m_cssConnection)247 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantLigatures, &variantLigatures);248 249 233 iterateClients(m_clients, [&](Client& client) { 250 234 client.fontPropertyChanged(*this); … … 261 245 m_variantSettings.position = downcast<CSSPrimitiveValue>(variantPosition); 262 246 263 if (m_cssConnection)264 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantPosition, &variantPosition);265 266 247 iterateClients(m_clients, [&](Client& client) { 267 248 client.fontPropertyChanged(*this); … … 277 258 278 259 m_variantSettings.caps = downcast<CSSPrimitiveValue>(variantCaps); 279 280 if (m_cssConnection)281 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantCaps, &variantCaps);282 260 283 261 iterateClients(m_clients, [&](Client& client) { … … 298 276 m_variantSettings.numericSlashedZero = numeric.slashedZero; 299 277 300 if (m_cssConnection)301 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantNumeric, &variantNumeric);302 303 278 iterateClients(m_clients, [&](Client& client) { 304 279 client.fontPropertyChanged(*this); … … 314 289 315 290 m_variantSettings.alternates = downcast<CSSPrimitiveValue>(variantAlternates); 316 317 if (m_cssConnection)318 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantAlternates, &variantAlternates);319 291 320 292 iterateClients(m_clients, [&](Client& client) { … … 332 304 m_variantSettings.eastAsianWidth = eastAsian.width; 333 305 m_variantSettings.eastAsianRuby = eastAsian.ruby; 334 335 if (m_cssConnection)336 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontVariantEastAsian, &variantEastAsian);337 306 338 307 iterateClients(m_clients, [&](Client& client) { … … 363 332 m_featureSettings = WTFMove(settings); 364 333 365 if (m_cssConnection)366 m_cssConnection->mutableProperties().setProperty(CSSPropertyFontFeatureSettings, &featureSettings);367 368 334 iterateClients(m_clients, [&](Client& client) { 369 335 client.fontPropertyChanged(*this); … … 416 382 } 417 383 418 void CSSFontFace::initializeWrapper() 419 { 384 Ref<FontFace> CSSFontFace::wrapper() 385 { 386 if (m_wrapper) 387 return Ref<FontFace>(*m_wrapper.get()); 388 389 Ref<FontFace> wrapper = FontFace::create(*this); 420 390 switch (m_status) { 421 391 case Status::Pending: 422 392 break; 423 393 case Status::Loading: 424 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Loading);394 wrapper->fontStateChanged(*this, Status::Pending, Status::Loading); 425 395 break; 426 396 case Status::TimedOut: 427 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Loading);428 m_wrapper->fontStateChanged(*this, Status::Loading, Status::TimedOut);397 wrapper->fontStateChanged(*this, Status::Pending, Status::Loading); 398 wrapper->fontStateChanged(*this, Status::Loading, Status::TimedOut); 429 399 break; 430 400 case Status::Success: 431 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Loading);432 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Success);401 wrapper->fontStateChanged(*this, Status::Pending, Status::Loading); 402 wrapper->fontStateChanged(*this, Status::Pending, Status::Success); 433 403 break; 434 404 case Status::Failure: 435 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Loading); 436 m_wrapper->fontStateChanged(*this, Status::Pending, Status::Failure); 437 break; 438 } 439 } 440 441 Ref<FontFace> CSSFontFace::wrapper() 442 { 443 if (m_wrapper) 444 return *m_wrapper.get(); 445 446 auto wrapper = FontFace::create(*this); 405 wrapper->fontStateChanged(*this, Status::Pending, Status::Loading); 406 wrapper->fontStateChanged(*this, Status::Pending, Status::Failure); 407 break; 408 } 447 409 m_wrapper = wrapper->createWeakPtr(); 448 initializeWrapper();449 m_mayBePurged = false;450 410 return wrapper; 451 }452 453 void CSSFontFace::setWrapper(FontFace& newWrapper)454 {455 m_wrapper = newWrapper.createWeakPtr();456 initializeWrapper();457 411 } 458 412 … … 599 553 } 600 554 601 bool CSSFontFace::purgeable() const602 {603 return cssConnection() && m_mayBePurged;604 }605 606 void CSSFontFace::updateStyleIfNeeded()607 {608 if (m_fontSelector && m_fontSelector->document())609 m_fontSelector->document()->updateStyleIfNeeded();610 }611 612 555 #if ENABLE(SVG_FONTS) 613 556 bool CSSFontFace::hasSVGFontFaceSource() const -
trunk/Source/WebCore/css/CSSFontFace.h
r201887 r201906 136 136 // We don't guarantee that the FontFace wrapper will be the same every time you ask for it. 137 137 Ref<FontFace> wrapper(); 138 void setWrapper(FontFace&);139 FontFace* existingWrapper() { return m_wrapper.get(); }140 138 141 139 bool webFontsShouldAlwaysFallBack() const; 142 143 bool purgeable() const;144 145 void updateStyleIfNeeded();146 140 147 141 #if ENABLE(SVG_FONTS) … … 155 149 void setStatus(Status); 156 150 void notifyClientsOfFontPropertyChange(); 157 158 void initializeWrapper();159 151 160 152 void fontLoadEventOccurred(); … … 175 167 bool m_isLocalFallback { false }; 176 168 bool m_sourcesPopulated { false }; 177 bool m_mayBePurged { true };178 169 }; 179 170 -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r201887 r201906 96 96 } 97 97 98 void CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered(const String& familyName) 99 { 100 if (m_locallyInstalledFacesLookupTable.contains(familyName)) 101 return; 98 void CSSFontFaceSet::registerLocalFontFacesForFamily(const String& familyName) 99 { 100 ASSERT(!m_locallyInstalledFacesLookupTable.contains(familyName)); 102 101 103 102 Vector<FontTraitsMask> traitsMasks = FontCache::singleton().getTraitsInFamily(familyName); … … 162 161 // m_locallyInstalledFontFaces grows without bound, eventually encorporating every font installed on the system. 163 162 // This is by design. 164 ensureLocalFontFacesForFamilyRegistered(familyName);163 registerLocalFontFacesForFamily(familyName); 165 164 familyFontFaces = { }; 166 165 } … … 189 188 if (face.status() == CSSFontFace::Status::Loading || face.status() == CSSFontFace::Status::TimedOut) 190 189 incrementActiveCount(); 191 192 if (face.cssConnection()) {193 auto addResult = m_constituentCSSConnections.add(face.cssConnection(), &face);194 ASSERT_UNUSED(addResult, addResult.isNewEntry);195 }196 190 } 197 191 … … 229 223 removeFromFacesLookupTable(face, *face.families()); 230 224 231 if (face.cssConnection()) {232 bool removed = m_constituentCSSConnections.remove(face.cssConnection());233 ASSERT_UNUSED(removed, removed);234 }235 236 225 for (size_t i = 0; i < m_faces.size(); ++i) { 237 226 if (m_faces[i].ptr() == &face) { … … 248 237 } 249 238 250 CSSFontFace* CSSFontFaceSet::lookupByCSSConnection(StyleRuleFontFace& target)251 {252 return m_constituentCSSConnections.get(&target);253 }254 255 void CSSFontFaceSet::purge()256 {257 Vector<std::reference_wrapper<CSSFontFace>> toRemove;258 for (auto& face : m_faces) {259 if (face->purgeable())260 toRemove.append(face.get());261 }262 263 for (auto& item : toRemove)264 remove(item.get());265 }266 267 239 void CSSFontFaceSet::clear() 268 240 { … … 273 245 m_locallyInstalledFacesLookupTable.clear(); 274 246 m_cache.clear(); 275 m_constituentCSSConnections.clear();276 247 m_facesPartitionIndex = 0; 277 248 m_status = Status::Loaded; -
trunk/Source/WebCore/css/CSSFontFaceSet.h
r201887 r201906 61 61 void add(CSSFontFace&); 62 62 void remove(const CSSFontFace&); 63 void purge();64 63 void clear(); 65 64 CSSFontFace& operator[](size_t i); 66 67 CSSFontFace* lookupByCSSConnection(StyleRuleFontFace&);68 65 69 66 bool check(const String& font, const String& text, ExceptionCode&); … … 95 92 void fontPropertyChanged(CSSFontFace&, CSSValueList* oldFamilies = nullptr) override; 96 93 97 void ensureLocalFontFacesForFamilyRegistered(const String&);94 void registerLocalFontFacesForFamily(const String&); 98 95 99 96 static String familyNameFromPrimitive(const CSSPrimitiveValue&); … … 104 101 HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_locallyInstalledFacesLookupTable; 105 102 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, ASCIICaseInsensitiveHash> m_cache; 106 HashMap<StyleRuleFontFace*, CSSFontFace*> m_constituentCSSConnections;107 103 size_t m_facesPartitionIndex { 0 }; // All entries in m_faces before this index are CSS-connected. 108 104 Status m_status { Status::Loaded }; -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r201887 r201906 46 46 #include "Font.h" 47 47 #include "FontCache.h" 48 #include "FontFace.h"49 48 #include "FontFaceSet.h" 50 49 #include "FontSelectorClient.h" … … 103 102 { 104 103 m_buildIsUnderway = true; 105 m_stagingArea.clear();106 m_cssFontFaceSet->purge();107 104 ++m_version; 108 109 m_cssConnectionsPossiblyToRemove.clear();110 m_cssConnectionsEncounteredDuringBuild.clear();111 for (size_t i = 0; i < m_cssFontFaceSet->faceCount(); ++i) {112 CSSFontFace& face = m_cssFontFaceSet.get()[i];113 if (face.cssConnection())114 m_cssConnectionsPossiblyToRemove.add(&face);115 }116 105 } 117 106 … … 123 112 m_buildIsUnderway = false; 124 113 125 // Some font faces weren't re-added during the build process. 126 for (auto& face : m_cssConnectionsPossiblyToRemove) { 127 auto* connection = face->cssConnection(); 128 ASSERT(connection); 129 if (!m_cssConnectionsEncounteredDuringBuild.contains(connection)) 130 m_cssFontFaceSet->remove(*face); 131 } 114 m_cssFontFaceSet->clear(); 132 115 133 116 for (auto& item : m_stagingArea) … … 139 122 { 140 123 if (m_buildIsUnderway) { 141 m_cssConnectionsEncounteredDuringBuild.add(&fontFaceRule);142 124 m_stagingArea.append({fontFaceRule, isInitiatingElementInUserAgentShadowTree}); 143 125 return; … … 205 187 if (fontFace->allSourcesFailed()) 206 188 return; 207 208 if (RefPtr<CSSFontFace> existingFace = m_cssFontFaceSet->lookupByCSSConnection(fontFaceRule)) {209 m_cssFontFaceSet->remove(*existingFace);210 if (auto* existingWrapper = existingFace->existingWrapper())211 existingWrapper->adopt(fontFace.get());212 }213 189 214 190 m_cssFontFaceSet->add(fontFace.get()); -
trunk/Source/WebCore/css/CSSFontSelector.h
r201887 r201906 106 106 107 107 Vector<CachedResourceHandle<CachedFont>> m_fontsToBeginLoading; 108 HashSet<RefPtr<CSSFontFace>> m_cssConnectionsPossiblyToRemove;109 HashSet<RefPtr<StyleRuleFontFace>> m_cssConnectionsEncounteredDuringBuild;110 108 Timer m_beginLoadingTimer; 111 109 -
trunk/Source/WebCore/css/FontFace.cpp
r201887 r201906 271 271 String FontFace::family() const 272 272 { 273 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();274 273 return m_backing->families()->cssText(); 275 274 } … … 277 276 String FontFace::style() const 278 277 { 279 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();280 278 switch (m_backing->traitsMask() & FontStyleMask) { 281 279 case FontStyleNormalMask: … … 290 288 String FontFace::weight() const 291 289 { 292 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();293 290 switch (m_backing->traitsMask() & FontWeightMask) { 294 291 case FontWeight100Mask: … … 322 319 String FontFace::unicodeRange() const 323 320 { 324 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();325 321 if (!m_backing->ranges().size()) 326 322 return "U+0-10FFFF"; … … 333 329 String FontFace::variant() const 334 330 { 335 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();336 331 return computeFontVariant(m_backing->variantSettings())->cssText(); 337 332 } … … 339 334 String FontFace::featureSettings() const 340 335 { 341 const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();342 336 if (!m_backing->featureSettings().size()) 343 337 return "normal"; … … 364 358 ASSERT_NOT_REACHED(); 365 359 return LoadStatus::Error; 366 }367 368 void FontFace::adopt(CSSFontFace& newFace)369 {370 m_promise = Nullopt;371 m_backing->removeClient(*this);372 m_backing = newFace;373 m_backing->addClient(*this);374 newFace.setWrapper(*this);375 360 } 376 361 -
trunk/Source/WebCore/css/FontFace.h
r201887 r201906 70 70 void registerLoaded(Promise&&); 71 71 72 void adopt(CSSFontFace&);73 74 72 void load(); 75 73
Note: See TracChangeset
for help on using the changeset viewer.