Title: [107715] trunk
Revision
107715
Author
[email protected]
Date
2012-02-14 10:44:58 -0800 (Tue, 14 Feb 2012)

Log Message

Source/WebCore: Don't include CachedResources that haven't downloaded when populating the Web Inspector on load.

https://webkit.org/b/78447
rdar://problem/10843542

Reviewed by Brian Weinstein.

Test: inspector/protocol/page-agent.html

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResourcesForFrame): Skip CachedFonts and CachedImages that
return true for stillNeedsLoad.
* loader/cache/CachedFont.h:
(WebCore::CachedFont::stillNeedsLoad): Added.

LayoutTests: Updated test results to exclude CachedResources that haven't downloaded.

https://webkit.org/b/78447
rdar://problem/10843542

Reviewed by Brian Weinstein.

* inspector/protocol/page-agent-expected.txt: Updated. There is now only one font list
in the resources, when there was incorrectly two being listed. Only the font being used
is the one that downloaded and is listed now.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107714 => 107715)


--- trunk/LayoutTests/ChangeLog	2012-02-14 18:44:47 UTC (rev 107714)
+++ trunk/LayoutTests/ChangeLog	2012-02-14 18:44:58 UTC (rev 107715)
@@ -1,5 +1,18 @@
 2012-02-14  Timothy Hatcher  <[email protected]>
 
+        Updated test results to exclude CachedResources that haven't downloaded.
+
+        https://webkit.org/b/78447
+        rdar://problem/10843542
+
+        Reviewed by Brian Weinstein.
+
+        * inspector/protocol/page-agent-expected.txt: Updated. There is now only one font list
+        in the resources, when there was incorrectly two being listed. Only the font being used
+        is the one that downloaded and is listed now.
+
+2012-02-14  Timothy Hatcher  <[email protected]>
+
         Test for Web Inspector: include failed and canceled in FrameResourceTree.
 
         https://webkit.org/b/78445

Modified: trunk/LayoutTests/inspector/protocol/page-agent-expected.txt (107714 => 107715)


--- trunk/LayoutTests/inspector/protocol/page-agent-expected.txt	2012-02-14 18:44:47 UTC (rev 107714)
+++ trunk/LayoutTests/inspector/protocol/page-agent-expected.txt	2012-02-14 18:44:58 UTC (rev 107715)
@@ -77,11 +77,6 @@
                 }
                 {
                     url : <string>
-                    type : "Font"
-                    mimeType : ""
-                }
-                {
-                    url : <string>
                     type : "Script"
                     mimeType : "text/_javascript_"
                 }

Modified: trunk/Source/WebCore/ChangeLog (107714 => 107715)


--- trunk/Source/WebCore/ChangeLog	2012-02-14 18:44:47 UTC (rev 107714)
+++ trunk/Source/WebCore/ChangeLog	2012-02-14 18:44:58 UTC (rev 107715)
@@ -1,5 +1,22 @@
 2012-02-12  Timothy Hatcher  <[email protected]>
 
+        Don't include CachedResources that haven't downloaded when populating the Web Inspector on load.
+
+        https://webkit.org/b/78447
+        rdar://problem/10843542
+
+        Reviewed by Brian Weinstein.
+
+        Test: inspector/protocol/page-agent.html
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::cachedResourcesForFrame): Skip CachedFonts and CachedImages that
+        return true for stillNeedsLoad.
+        * loader/cache/CachedFont.h:
+        (WebCore::CachedFont::stillNeedsLoad): Added.
+
+2012-02-12  Timothy Hatcher  <[email protected]>
+
         Web Inspector: include failed and canceled in FrameResourceTree.
 
         https://webkit.org/b/78445

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (107714 => 107715)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-02-14 18:44:47 UTC (rev 107714)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-02-14 18:44:58 UTC (rev 107715)
@@ -36,6 +36,8 @@
 
 #include "Base64.h"
 #include "CachedCSSStyleSheet.h"
+#include "CachedFont.h"
+#include "CachedImage.h"
 #include "CachedResource.h"
 #include "CachedResourceLoader.h"
 #include "CachedScript.h"
@@ -394,9 +396,28 @@
 
     const CachedResourceLoader::DocumentResourceMap& allResources = frame->document()->cachedResourceLoader()->allCachedResources();
     CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
-    for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
-        result.append(it->second.get());
+    for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
+        CachedResource* cachedResource = it->second.get();
 
+        switch (cachedResource->type()) {
+        case CachedResource::ImageResource:
+            // Skip images that were not auto loaded (images disabled in the user agent).
+            if (static_cast<CachedImage*>(cachedResource)->stillNeedsLoad())
+                continue;
+            break;
+        case CachedResource::FontResource:
+            // Skip fonts that were referenced in CSS but never used/downloaded.
+            if (static_cast<CachedFont*>(cachedResource)->stillNeedsLoad())
+                continue;
+            break;
+        default:
+            // All other CachedResource types download immediately.
+            break;
+        }
+
+        result.append(cachedResource);
+    }
+
     return result;
 }
 

Modified: trunk/Source/WebCore/loader/cache/CachedFont.h (107714 => 107715)


--- trunk/Source/WebCore/loader/cache/CachedFont.h	2012-02-14 18:44:47 UTC (rev 107714)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h	2012-02-14 18:44:58 UTC (rev 107715)
@@ -60,6 +60,7 @@
     void checkNotify();
 
     void beginLoadIfNeeded(CachedResourceLoader* dl);
+    bool stillNeedsLoad() const { return !m_loadInitiated; }
 
     bool ensureCustomFontData();
     FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to