Web Inspector: disabling property should remove "overriden" decoration from overriden...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jul 2012 15:05:40 +0000 (15:05 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jul 2012 15:05:40 +0000 (15:05 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123618 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt [new file with mode: 0644]
LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/StylesSidebarPane.js

index 0d93852..9820d71 100644 (file)
@@ -1,3 +1,13 @@
+2012-07-25  Pavel Feldman  <pfeldman@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.oliveira@openbossa.org>
 
         [Qt] css2.1/t040* rebaseline after new test fonts
diff --git a/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt b/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua-expected.txt
new file mode 100644 (file)
index 0000000..efb2e52
--- /dev/null
@@ -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;
+
+
+
diff --git a/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html b/LayoutTests/inspector/styles/styles-disable-then-enable-overriden-ua.html
new file mode 100644 (file)
index 0000000..d8de600
--- /dev/null
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+
+<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>
index 5fd05cc..b5f6201 100644 (file)
@@ -1,3 +1,19 @@
+2012-07-25  Pavel Feldman  <pfeldman@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  <vsevik@chromium.org>
 
         Web Inspector: Improve ObjectPropertiesSection UI by adding a tooltip for the value.
index 8195f74..1f98b0b 100644 (file)
@@ -1055,7 +1055,7 @@ WebInspector.StylePropertiesSection.prototype = {
         } 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 @@ WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.Styl
 /**
  * @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 @@ WebInspector.StylePropertyTreeElement.prototype = {
     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 @@ WebInspector.StylePropertyTreeElement.prototype = {
             }
 
             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 @@ WebInspector.StylePropertyTreeElement.prototype = {
     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)