Changeset 153494 in webkit
- Timestamp:
- Jul 30, 2013, 2:32:54 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r153493 r153494 1 2013-07-30 Andreas Kling <akling@apple.com> 2 3 Inactive style sheets should not trigger style recalc when loaded. 4 <http://webkit.org/b/119236> 5 <rdar://problem/14588132> 6 7 Reviewed by Antti Koivisto. 8 9 Style sheets that are either alternate sheets or are excluded by their media query should not trigger 10 a full style recalc when they finish loading, since the end result will not be observably different. 11 12 The sheets are still inspectable through document.styleSheets. 13 14 Changed enums from Blocking/NonBlocking to ActiveSheet/InactiveSheet to clarify what's going on. 15 16 * html/HTMLLinkElement.h: 17 * html/HTMLLinkElement.cpp: 18 (WebCore::HTMLLinkElement::HTMLLinkElement): 19 (WebCore::HTMLLinkElement::setDisabledState): 20 (WebCore::HTMLLinkElement::process): 21 (WebCore::HTMLLinkElement::startLoadingDynamicSheet): 22 (WebCore::HTMLLinkElement::addPendingSheet): 23 (WebCore::HTMLLinkElement::removePendingSheet): 24 1 25 2013-07-30 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r150356 r153494 72 72 , m_firedLoad(false) 73 73 , m_loadedSheet(false) 74 , m_pendingSheetType( None)74 , m_pendingSheetType(Unknown) 75 75 { 76 76 ASSERT(hasTagName(linkTag)); … … 110 110 // Check #2: An alternate sheet becomes enabled while it is still loading. 111 111 if (m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript) 112 addPendingSheet( Blocking);112 addPendingSheet(ActiveSheet); 113 113 114 114 // Check #3: A main sheet becomes enabled while it was still loading and … … 118 118 // sheets. :) 119 119 if (!m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled) 120 addPendingSheet( Blocking);120 addPendingSheet(ActiveSheet); 121 121 122 122 // If the sheet is already loading just bail. … … 213 213 // Don't hold up render tree construction and script execution on stylesheets 214 214 // that are not needed for the rendering at the moment. 215 bool blocking= mediaQueryMatches && !isAlternate();216 addPendingSheet( blocking ? Blocking : NonBlocking);215 bool isActive = mediaQueryMatches && !isAlternate(); 216 addPendingSheet(isActive ? ActiveSheet : InactiveSheet); 217 217 218 218 // Load stylesheets that are not needed for the rendering immediately with low priority. 219 ResourceLoadPriority priority = blocking? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow;219 ResourceLoadPriority priority = isActive ? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow; 220 220 CachedResourceRequest request(ResourceRequest(document()->completeURL(url)), charset, priority); 221 221 request.setInitiator(this); … … 384 384 void HTMLLinkElement::startLoadingDynamicSheet() 385 385 { 386 // We don't support multiple blockingsheets.387 ASSERT(m_pendingSheetType < Blocking);388 addPendingSheet( Blocking);386 // We don't support multiple active sheets. 387 ASSERT(m_pendingSheetType < ActiveSheet); 388 addPendingSheet(ActiveSheet); 389 389 } 390 390 … … 449 449 m_pendingSheetType = type; 450 450 451 if (m_pendingSheetType == NonBlocking)451 if (m_pendingSheetType == InactiveSheet) 452 452 return; 453 453 document()->styleSheetCollection()->addPendingSheet(); … … 457 457 { 458 458 PendingSheetType type = m_pendingSheetType; 459 m_pendingSheetType = None; 460 461 if (type == None) 462 return; 463 if (type == NonBlocking) { 464 // Document::removePendingSheet() triggers the style selector recalc for blocking sheets. 465 document()->styleResolverChanged(RecalcStyleImmediately); 459 m_pendingSheetType = Unknown; 460 461 if (type == Unknown) 462 return; 463 464 if (type == InactiveSheet) { 465 // Document just needs to know about the sheet for exposure through document.styleSheets 466 document()->styleSheetCollection()->updateActiveStyleSheets(DocumentStyleSheetCollection::OptimizedUpdate); 466 467 return; 467 468 } -
trunk/Source/WebCore/html/HTMLLinkElement.h
r151947 r153494 102 102 103 103 virtual void finishParsingChildren(); 104 105 enum PendingSheetType { None, NonBlocking, Blocking};104 105 enum PendingSheetType { Unknown, ActiveSheet, InactiveSheet }; 106 106 void addPendingSheet(PendingSheetType); 107 107
Note:
See TracChangeset
for help on using the changeset viewer.