Title: [153605] branches/safari-537-branch/Source/WebCore

Diff

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (153604 => 153605)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-08-01 20:56:42 UTC (rev 153604)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-08-01 21:01:36 UTC (rev 153605)
@@ -1,3 +1,31 @@
+2013-08-01  Lucas Forschler  <[email protected]>
+
+        Merge r153494
+
+    2013-07-30  Andreas Kling  <[email protected]>
+
+            Inactive style sheets should not trigger style recalc when loaded.
+            <http://webkit.org/b/119236>
+            <rdar://problem/14588132>
+
+            Reviewed by Antti Koivisto.
+
+            Style sheets that are either alternate sheets or are excluded by their media query should not trigger
+            a full style recalc when they finish loading, since the end result will not be observably different.
+
+            The sheets are still inspectable through document.styleSheets.
+
+            Changed enums from Blocking/NonBlocking to ActiveSheet/InactiveSheet to clarify what's going on.
+
+            * html/HTMLLinkElement.h:
+            * html/HTMLLinkElement.cpp:
+            (WebCore::HTMLLinkElement::HTMLLinkElement):
+            (WebCore::HTMLLinkElement::setDisabledState):
+            (WebCore::HTMLLinkElement::process):
+            (WebCore::HTMLLinkElement::startLoadingDynamicSheet):
+            (WebCore::HTMLLinkElement::addPendingSheet):
+            (WebCore::HTMLLinkElement::removePendingSheet):
+
 2013-08-01  Beth Dakin  <[email protected]>
 
         <rdar://problem/14616729> REGRESSION (r144350): Overflow bounding boxes are way 

Modified: branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.cpp (153604 => 153605)


--- branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.cpp	2013-08-01 20:56:42 UTC (rev 153604)
+++ branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.cpp	2013-08-01 21:01:36 UTC (rev 153605)
@@ -71,7 +71,7 @@
     , m_isInShadowTree(false)
     , m_firedLoad(false)
     , m_loadedSheet(false)
-    , m_pendingSheetType(None)
+    , m_pendingSheetType(Unknown)
 {
     ASSERT(hasTagName(linkTag));
 }
@@ -109,7 +109,7 @@
 
             // Check #2: An alternate sheet becomes enabled while it is still loading.
             if (m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript)
-                addPendingSheet(Blocking);
+                addPendingSheet(ActiveSheet);
 
             // Check #3: A main sheet becomes enabled while it was still loading and
             // after it was disabled via script. It takes really terrible code to make this
@@ -117,7 +117,7 @@
             // virtualplastic.net, which manages to do about 12 enable/disables on only 3
             // sheets. :)
             if (!m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
-                addPendingSheet(Blocking);
+                addPendingSheet(ActiveSheet);
 
             // If the sheet is already loading just bail.
             return;
@@ -212,11 +212,11 @@
 
         // Don't hold up render tree construction and script execution on stylesheets
         // that are not needed for the rendering at the moment.
-        bool blocking = mediaQueryMatches && !isAlternate();
-        addPendingSheet(blocking ? Blocking : NonBlocking);
+        bool isActive = mediaQueryMatches && !isAlternate();
+        addPendingSheet(isActive ? ActiveSheet : InactiveSheet);
 
         // Load stylesheets that are not needed for the rendering immediately with low priority.
-        ResourceLoadPriority priority = blocking ? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow;
+        ResourceLoadPriority priority = isActive ? ResourceLoadPriorityUnresolved : ResourceLoadPriorityVeryLow;
         CachedResourceRequest request(ResourceRequest(document()->completeURL(url)), charset, priority);
         request.setInitiator(this);
         m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(request);
@@ -383,9 +383,9 @@
 
 void HTMLLinkElement::startLoadingDynamicSheet()
 {
-    // We don't support multiple blocking sheets.
-    ASSERT(m_pendingSheetType < Blocking);
-    addPendingSheet(Blocking);
+    // We don't support multiple active sheets.
+    ASSERT(m_pendingSheetType < ActiveSheet);
+    addPendingSheet(ActiveSheet);
 }
 
 bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const
@@ -448,7 +448,7 @@
         return;
     m_pendingSheetType = type;
 
-    if (m_pendingSheetType == NonBlocking)
+    if (m_pendingSheetType == InactiveSheet)
         return;
     document()->styleSheetCollection()->addPendingSheet();
 }
@@ -456,13 +456,14 @@
 void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType notification)
 {
     PendingSheetType type = m_pendingSheetType;
-    m_pendingSheetType = None;
+    m_pendingSheetType = Unknown;
 
-    if (type == None)
+    if (type == Unknown)
         return;
-    if (type == NonBlocking) {
-        // Document::removePendingSheet() triggers the style selector recalc for blocking sheets.
-        document()->styleResolverChanged(RecalcStyleImmediately);
+
+    if (type == InactiveSheet) {
+        // Document just needs to know about the sheet for exposure through document.styleSheets
+        document()->styleSheetCollection()->updateActiveStyleSheets(DocumentStyleSheetCollection::OptimizedUpdate);
         return;
     }
 

Modified: branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.h (153604 => 153605)


--- branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.h	2013-08-01 20:56:42 UTC (rev 153604)
+++ branches/safari-537-branch/Source/WebCore/html/HTMLLinkElement.h	2013-08-01 21:01:36 UTC (rev 153605)
@@ -102,8 +102,8 @@
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
     virtual void finishParsingChildren();
-    
-    enum PendingSheetType { None, NonBlocking, Blocking };
+
+    enum PendingSheetType { Unknown, ActiveSheet, InactiveSheet };
     void addPendingSheet(PendingSheetType);
 
     enum RemovePendingSheetNotificationType {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to