Title: [123618] trunk
Revision
123618
Author
pfeld...@chromium.org
Date
2012-07-25 08:05:40 -0700 (Wed, 25 Jul 2012)

Log Message

Web Inspector: disabling property should remove "overriden" decoration from overriden UA shorthand.
https://bugs.webkit.org/show_bug.cgi?id=92253

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Bug fix with a test and more compilation markup.

Test: inspector/styles/styles-disable-then-enable-overriden-ua.html

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylePropertiesSection.prototype.update):
(WebInspector.StylePropertyTreeElement):
(WebInspector.StylePropertyTreeElement.prototype):

LayoutTests:

* inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt: Added.
* inspector/styles/styles-disable-then-enable-overriden-ua.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123617 => 123618)


--- trunk/LayoutTests/ChangeLog	2012-07-25 14:59:36 UTC (rev 123617)
+++ trunk/LayoutTests/ChangeLog	2012-07-25 15:05:40 UTC (rev 123618)
@@ -1,3 +1,13 @@
+2012-07-25  Pavel Feldman  <pfeld...@chromium.org>
+
+        Web Inspector: disabling property should remove "overriden" decoration from overriden UA shorthand.
+        https://bugs.webkit.org/show_bug.cgi?id=92253
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt: Added.
+        * inspector/styles/styles-disable-then-enable-overriden-ua.html: Added.
+
 2012-07-25  Caio Marcelo de Oliveira Filho  <caio.olive...@openbossa.org>
 
         [Qt] css2.1/t040* rebaseline after new test fonts

Added: trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt (0 => 123618)


--- trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt	2012-07-25 15:05:40 UTC (rev 123618)
@@ -0,0 +1,48 @@
+Tests that disabling shorthand removes the "overriden" mark from the UA shorthand it overrides.
+
+Before disable
+[expanded] 
+element.style  { ()
+margin: 10px;
+
+======== Matched CSS Rules ========
+[expanded] 
+#container  { (user stylesheet)
+/-- overloaded --/ margin: 8px;
+
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+After disable
+[expanded] 
+element.style  { ()
+/-- overloaded --/ /-- disabled --/ margin: 10px;
+
+======== Matched CSS Rules ========
+[expanded] 
+#container  { (user stylesheet)
+margin: 8px;
+
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+After enable
+[expanded] 
+element.style  { ()
+margin: 10px;
+
+======== Matched CSS Rules ========
+[expanded] 
+#container  { (user stylesheet)
+/-- overloaded --/ margin: 8px;
+
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+
Property changes on: trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html (0 => 123618)


--- trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html	2012-07-25 15:05:40 UTC (rev 123618)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src=""
+<script src=""
+
+<script>
+
+function injectStyleSheet()
+{
+    var styleSheet = "#container { margin: 8px }";
+    if (window.testRunner)
+        window.testRunner.addUserStyleSheet(styleSheet, true);
+}
+
+function test()
+{
+    InspectorTest.evaluateInPage("injectStyleSheet()", step1);
+    function step1()
+    {
+        InspectorTest.selectNodeAndWaitForStyles("container", step2);
+    }
+
+    function step2()
+    {
+        InspectorTest.addResult("Before disable");
+        InspectorTest.dumpSelectedElementStyles(true, false, true);
+        InspectorTest.toggleStyleProperty("margin", false);
+        InspectorTest.waitForStyles("container", step3);
+    }
+
+    function step3()
+    {
+        InspectorTest.addResult("After disable");
+        InspectorTest.dumpSelectedElementStyles(true, false, true);
+        InspectorTest.toggleStyleProperty("margin", true);
+        InspectorTest.waitForStyles("container", step4);
+    }
+
+    function step4()
+    {
+        InspectorTest.addResult("After enable");
+        InspectorTest.dumpSelectedElementStyles(true, false, true);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+
+<body _onload_="runTest()" id="body-id">
+<p>
+Tests that disabling shorthand removes the "overriden" mark from the UA shorthand it overrides.
+</p>
+
+<div id="container" style="margin: 10px"></div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (123617 => 123618)


--- trunk/Source/WebCore/ChangeLog	2012-07-25 14:59:36 UTC (rev 123617)
+++ trunk/Source/WebCore/ChangeLog	2012-07-25 15:05:40 UTC (rev 123618)
@@ -1,3 +1,19 @@
+2012-07-25  Pavel Feldman  <pfeld...@chromium.org>
+
+        Web Inspector: disabling property should remove "overriden" decoration from overriden UA shorthand.
+        https://bugs.webkit.org/show_bug.cgi?id=92253
+
+        Reviewed by Vsevolod Vlasov.
+
+        Bug fix with a test and more compilation markup.
+
+        Test: inspector/styles/styles-disable-then-enable-overriden-ua.html
+
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertiesSection.prototype.update):
+        (WebInspector.StylePropertyTreeElement):
+        (WebInspector.StylePropertyTreeElement.prototype):
+
 2012-07-25  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Improve ObjectPropertiesSection UI by adding a tooltip for the value.

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


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-07-25 14:59:36 UTC (rev 123617)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-07-25 15:05:40 UTC (rev 123618)
@@ -1055,7 +1055,7 @@
         } else {
             var child = this.propertiesTreeOutline.children[0];
             while (child) {
-                child.overloaded = this.isPropertyOverloaded(child.name);
+                child.overloaded = this.isPropertyOverloaded(child.name, child.isShorthand);
                 child = child.traverseNextTreeElement(false, null, true);
             }
         }
@@ -1530,21 +1530,28 @@
 /**
  * @constructor
  * @extends {TreeElement}
+ * @param {WebInspector.StylePropertiesSection|WebInspector.ComputedStylePropertiesSection} section
  * @param {?WebInspector.StylesSidebarPane} parentPane
+ * @param {Object} styleRule
+ * @param {WebInspector.CSSStyleDeclaration} style
+ * @param {WebInspector.CSSProperty} property
+ * @param {boolean} isShorthand
+ * @param {boolean} inherited
+ * @param {boolean} overloaded
  */
-WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, shorthand, inherited, overloaded)
+WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, isShorthand, inherited, overloaded)
 {
     this.section = section;
     this._parentPane = parentPane;
     this._styleRule = styleRule;
     this.style = style;
     this.property = property;
-    this.shorthand = shorthand;
+    this.isShorthand = isShorthand;
     this._inherited = inherited;
     this._overloaded = overloaded;
 
     // Pass an empty title, the title gets made later in onattach.
-    TreeElement.call(this, "", null, shorthand);
+    TreeElement.call(this, "", null, isShorthand);
 
     this.selectable = false;
 }
@@ -1986,7 +1993,7 @@
     onpopulate: function()
     {
         // Only populate once and if this property is a shorthand.
-        if (this.children.length || !this.shorthand)
+        if (this.children.length || !this.isShorthand)
             return;
 
         var longhandProperties = this.style.longhandProperties(this.name);
@@ -1999,7 +2006,7 @@
             }
 
             var liveProperty = this.style.getLiveProperty(name);
-            var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded);
+            var item = new WebInspector.StylePropertyTreeElement(this.section, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded);
             this.appendChild(item);
         }
     },
@@ -2046,7 +2053,7 @@
     startEditing: function(selectElement)
     {
         // FIXME: we don't allow editing of longhand properties under a shorthand right now.
-        if (this.parent.shorthand)
+        if (this.parent.isShorthand)
             return;
 
         if (selectElement === this._expandElement)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to