Title: [127142] trunk
Revision
127142
Author
[email protected]
Date
2012-08-30 08:26:22 -0700 (Thu, 30 Aug 2012)

Log Message

Web Inspector: Some urls in CSS stylesheets cause errors when generating Computed Styles HTML
https://bugs.webkit.org/show_bug.cgi?id=95427

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Pass the parent StylesSidebarPane into ComputedStylePropertiesSection to avoid referencing an undefined field.
Avoid duplicating the parent pane by externally setting the |data| field on style property sections.

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
(WebInspector.StylesSidebarPane.prototype.addBlankSection):
(WebInspector.StylePropertiesSection.prototype.get pane):
(WebInspector.ComputedStylePropertiesSection):
(WebInspector.ComputedStylePropertiesSection.prototype.get pane):
(WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
(WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL):

LayoutTests:

* inspector/styles/inject-stylesheet-expected.txt:
* inspector/styles/inject-stylesheet.html:
* platform/chromium/inspector/styles/inject-stylesheet-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127141 => 127142)


--- trunk/LayoutTests/ChangeLog	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/LayoutTests/ChangeLog	2012-08-30 15:26:22 UTC (rev 127142)
@@ -1,3 +1,14 @@
+2012-08-30  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: Some urls in CSS stylesheets cause errors when generating Computed Styles HTML
+        https://bugs.webkit.org/show_bug.cgi?id=95427
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/styles/inject-stylesheet-expected.txt:
+        * inspector/styles/inject-stylesheet.html:
+        * platform/chromium/inspector/styles/inject-stylesheet-expected.txt:
+
 2012-08-30  Keishi Hattori  <[email protected]>
 
         Tick marks don't match thumb when applying padding or border to input type=range

Modified: trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt (127141 => 127142)


--- trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt	2012-08-30 15:26:22 UTC (rev 127142)
@@ -4,6 +4,27 @@
 
 Main frame style:
 [expanded] 
+-webkit-background-clip: border-box;
+-webkit-background-origin: padding-box;
+-webkit-background-size: auto;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
+    #main - url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) user stylesheet
+background-attachment: scroll;
+    #main - initial inject-stylesheet.html:5
+background-clip: border-box;
+    #main - initial inject-stylesheet.html:5
+background-color: blue;
+    #main - blue inject-stylesheet.html:5
+background-image: none;
+    #main - initial inject-stylesheet.html:5
+background-origin: padding-box;
+    #main - initial inject-stylesheet.html:5
+background-size: auto;
+    #main - initial inject-stylesheet.html:5
+color: red;
+    #main - red user stylesheet
+display: block;
+    div - block user agent stylesheet
 
 [expanded] 
 element.style  { ()
@@ -27,6 +48,7 @@
 [expanded] 
 #main  { (user stylesheet)
 color: red;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
 
 [expanded] 
 div  { (user agent stylesheet)
@@ -35,6 +57,37 @@
 
 iframe style:
 [expanded] 
+-webkit-background-clip: border-box;
+-webkit-background-origin: padding-box;
+-webkit-background-size: auto;
+background-attachment: scroll;
+    body - initial inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - initial user stylesheet
+background-clip: border-box;
+    body - initial inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - initial user stylesheet
+background-color: green;
+    body - green inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - red user stylesheet
+background-image: none;
+    body - initial inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - initial user stylesheet
+background-origin: padding-box;
+    body - initial inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - initial user stylesheet
+background-size: auto;
+    body - initial inject-stylesheet-iframe-data.html:4
+    /-- overloaded --/ #iframebody - initial user stylesheet
+display: block;
+    body - block user agent stylesheet
+margin-bottom: 8px;
+    body - 8px user agent stylesheet
+margin-left: 8px;
+    body - 8px user agent stylesheet
+margin-right: 8px;
+    body - 8px user agent stylesheet
+margin-top: 8px;
+    body - 8px user agent stylesheet
 
 [expanded] 
 element.style  { ()

Modified: trunk/LayoutTests/inspector/styles/inject-stylesheet.html (127141 => 127142)


--- trunk/LayoutTests/inspector/styles/inject-stylesheet.html	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/LayoutTests/inspector/styles/inject-stylesheet.html	2012-08-30 15:26:22 UTC (rev 127142)
@@ -11,7 +11,7 @@
 
 function injectStyleSheet()
 {
-    var styleSheet = "#main { color: red }  #iframeBody { background: red }";
+    var styleSheet = "#main { color: red; -webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) }  #iframeBody { background: red }";
     if (window.testRunner)
         window.testRunner.addUserStyleSheet(styleSheet, true);
 }
@@ -25,12 +25,11 @@
 
 function test()
 {
-
     InspectorTest.evaluateInPage("injectStyleSheet()", init);
 
     function init()
     {
-        InspectorTest.selectNodeAndWaitForStyles("main", step0);
+        InspectorTest.selectNodeAndWaitForStylesWithComputed("main", step0);
     }
 
     function step0()

Modified: trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt (127141 => 127142)


--- trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt	2012-08-30 15:26:22 UTC (rev 127142)
@@ -4,6 +4,27 @@
 
 Main frame style:
 [expanded] 
+-webkit-background-clip: border-box;
+-webkit-background-origin: padding-box;
+-webkit-background-size: auto;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
+    #main - url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) user stylesheet
+background-attachment: scroll;
+    #main - initial inject-stylesheet.html:5
+background-clip: border-box;
+    #main - initial inject-stylesheet.html:5
+background-color: blue;
+    #main - blue inject-stylesheet.html:5
+background-image: none;
+    #main - initial inject-stylesheet.html:5
+background-origin: padding-box;
+    #main - initial inject-stylesheet.html:5
+background-size: auto;
+    #main - initial inject-stylesheet.html:5
+color: red;
+    #main - red user stylesheet
+display: block;
+    div - block user agent stylesheet
 
 [expanded] 
 element.style  { ()
@@ -27,6 +48,7 @@
 [expanded] 
 #main  { (user stylesheet)
 color: red;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
 
 [expanded] 
 div  { (user agent stylesheet)
@@ -35,6 +57,37 @@
 
 iframe style:
 [expanded] 
+-webkit-background-clip: border-box;
+-webkit-background-origin: padding-box;
+-webkit-background-size: auto;
+background-attachment: scroll;
+    #iframebody - initial user stylesheet
+    /-- overloaded --/ body - initial inject-stylesheet-iframe-data.html:4
+background-clip: border-box;
+    #iframebody - initial user stylesheet
+    /-- overloaded --/ body - initial inject-stylesheet-iframe-data.html:4
+background-color: red;
+    #iframebody - red user stylesheet
+    /-- overloaded --/ body - green inject-stylesheet-iframe-data.html:4
+background-image: none;
+    #iframebody - initial user stylesheet
+    /-- overloaded --/ body - initial inject-stylesheet-iframe-data.html:4
+background-origin: padding-box;
+    #iframebody - initial user stylesheet
+    /-- overloaded --/ body - initial inject-stylesheet-iframe-data.html:4
+background-size: auto;
+    #iframebody - initial user stylesheet
+    /-- overloaded --/ body - initial inject-stylesheet-iframe-data.html:4
+display: block;
+    body - block user agent stylesheet
+margin-bottom: 8px;
+    body - 8px user agent stylesheet
+margin-left: 8px;
+    body - 8px user agent stylesheet
+margin-right: 8px;
+    body - 8px user agent stylesheet
+margin-top: 8px;
+    body - 8px user agent stylesheet
 
 [expanded] 
 element.style  { ()

Modified: trunk/Source/WebCore/ChangeLog (127141 => 127142)


--- trunk/Source/WebCore/ChangeLog	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/Source/WebCore/ChangeLog	2012-08-30 15:26:22 UTC (rev 127142)
@@ -1,3 +1,22 @@
+2012-08-30  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: Some urls in CSS stylesheets cause errors when generating Computed Styles HTML
+        https://bugs.webkit.org/show_bug.cgi?id=95427
+
+        Reviewed by Vsevolod Vlasov.
+
+        Pass the parent StylesSidebarPane into ComputedStylePropertiesSection to avoid referencing an undefined field.
+        Avoid duplicating the parent pane by externally setting the |data| field on style property sections.
+
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
+        (WebInspector.StylesSidebarPane.prototype.addBlankSection):
+        (WebInspector.StylePropertiesSection.prototype.get pane):
+        (WebInspector.ComputedStylePropertiesSection):
+        (WebInspector.ComputedStylePropertiesSection.prototype.get pane):
+        (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
+        (WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL):
+
 2012-08-30  Keishi Hattori  <[email protected]>
 
         Tick marks don't match thumb when applying padding or border to input type=range

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (127141 => 127142)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-08-30 15:06:47 UTC (rev 127141)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-08-30 15:26:22 UTC (rev 127142)
@@ -597,10 +597,9 @@
                 editable = true;
 
             if (computedStyle)
-                var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties);
+                var section = new WebInspector.ComputedStylePropertiesSection(this, styleRule, usedProperties);
             else
                 var section = new WebInspector.StylePropertiesSection(this, styleRule, editable, styleRule.isInherited, lastWasSeparator);
-            section.pane = this;
             section.expanded = true;
 
             if (computedStyle) {
@@ -669,7 +668,6 @@
     addBlankSection: function()
     {
         var blankSection = new WebInspector.BlankStylePropertiesSection(this, this.node ? this.node.appropriateSelectorFor(true) : "");
-        blankSection.pane = this;
 
         var elementStyleSection = this.sections[0][1];
         this._sectionsContainer.insertBefore(blankSection.element, elementStyleSection.element.nextSibling);
@@ -934,6 +932,11 @@
 }
 
 WebInspector.StylePropertiesSection.prototype = {
+    get pane()
+    {
+        return this._parentPane;
+    },
+
     collapse: function(dontRememberState)
     {
         // Overriding with empty body.
@@ -1317,12 +1320,16 @@
 /**
  * @constructor
  * @extends {WebInspector.PropertiesSection}
+ * @param {!WebInspector.StylesSidebarPane} parentPane
+ * @param {!Object} styleRule
+ * @param {!Object.<string, boolean>} usedProperties
  */
-WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties)
+WebInspector.ComputedStylePropertiesSection = function(parentPane, styleRule, usedProperties)
 {
     WebInspector.PropertiesSection.call(this, "");
     this.headerElement.addStyleClass("hidden");
     this.element.className = "styles-section monospace first-styles-section read-only computed-style";
+    this._parentPane = parentPane;
     this.styleRule = styleRule;
     this._usedProperties = usedProperties;
     this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
@@ -1332,6 +1339,11 @@
 }
 
 WebInspector.ComputedStylePropertiesSection.prototype = {
+    get pane()
+    {
+        return this._parentPane;
+    },
+
     collapse: function(dontRememberState)
     {
         // Overriding with empty body.
@@ -1376,7 +1388,7 @@
         for (var i = 0; i < uniqueProperties.length; ++i) {
             var property = uniqueProperties[i];
             var inherited = this._isPropertyInherited(property.name);
-            var item = new WebInspector.StylePropertyTreeElement(this, null, this.styleRule, style, property, false, inherited, false);
+            var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, false, inherited, false);
             this.propertiesTreeOutline.appendChild(item);
             this._propertyTreeElements[property.name] = item;
         }
@@ -1694,8 +1706,8 @@
                 container.appendChild(document.createTextNode("url("));
                 if (self._styleRule.sourceURL)
                     hrefUrl = WebInspector.ParsedURL.completeURL(self._styleRule.sourceURL, hrefUrl);
-                else if (this._parentPane.node)
-                    hrefUrl = this._parentPane.node.resolveURL(hrefUrl);
+                else if (self._parentPane.node)
+                    hrefUrl = self._parentPane.node.resolveURL(hrefUrl);
                 var hasResource = !!WebInspector.resourceForURL(hrefUrl);
                 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI.
                 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl, url, undefined, !hasResource));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to