Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Aug 2006 04:54:55 +0000 (04:54 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Aug 2006 04:54:55 +0000 (04:54 +0000)
        - omit the margin and padding boxes for display types where they are ignored
        - use CSS instead of properties for table spacing and padding as suggested by Tim H.

        * WebInspector/webInspector/inspector.css: Added rules for spacing and padding.
        Added rules that hide the margin and padding boxes (borders and all but the center cell)
        when the hide attribute is present.
        * WebInspector/webInspector/inspector.html: Added classes for the rules above.
        Removed cellpadding and cellspacing attributes.
        * WebInspector/webInspector/inspector.js: Added code to hide/show the margin and
        padding boxes based on the display type.

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

WebKit/ChangeLog
WebKit/WebInspector/webInspector/inspector.css
WebKit/WebInspector/webInspector/inspector.html
WebKit/WebInspector/webInspector/inspector.js

index 926883d..844ac0a 100644 (file)
@@ -1,3 +1,18 @@
+2006-07-31  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - omit the margin and padding boxes for display types where they are ignored
+        - use CSS instead of properties for table spacing and padding as suggested by Tim H.
+
+        * WebInspector/webInspector/inspector.css: Added rules for spacing and padding.
+        Added rules that hide the margin and padding boxes (borders and all but the center cell)
+        when the hide attribute is present.
+        * WebInspector/webInspector/inspector.html: Added classes for the rules above.
+        Removed cellpadding and cellspacing attributes.
+        * WebInspector/webInspector/inspector.js: Added code to hide/show the margin and
+        padding boxes based on the display type.
+
 2006-07-31  Duncan Wilcox  <duncan@mclink.it>
 
         Reviewed by Darin.
index 87e4ac3..6710c6d 100644 (file)
@@ -876,9 +876,14 @@ button.toggle.right {
     color: rgb(255,255,180);
 }
 
+.boxModelTable {
+    border-spacing: 0px;
+}
+
 .boxModelTable td {
     text-align: center;
     min-width: 10px;
+    padding: 0px;
 }
 
 .boxModelTable .horizontalCell {
@@ -921,3 +926,11 @@ button.toggle.right {
     text-align: center;
     margin-top: 40%;
 }
+
+#marginBoxTable[hide], #paddingBoxTable[hide] {
+    border: 0px
+}
+
+#marginBoxTable[hide] .marginBox, #paddingBoxTable[hide] .paddingBox {
+    display: none
+}
index e995960..4b7d1bc 100644 (file)
@@ -109,24 +109,29 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     </div>
     <div id="metricsPane" class="pane" style="display: none">
         <div id="noMetrics" style="display: none">No metrics</div>
-        <table class="boxModelTable" id="marginBoxTable" cellpadding=0 cellspacing=0>
-            <tr><td valign="top"><div style="position:relative"><div class="boxModelLabel">margin</div></div></td><td id="margin-top"></td><td></td></tr>
-            <tr><td class="horizontalCell" id="margin-left"></td><td>
-                <table class="boxModelTable" id="borderBoxTable" cellpadding=0 cellspacing=0>
-                    <tr><td valign="top"><div style="position:relative"><div class="boxModelLabel">border</div></div></td><td id="border-top"></td><td></td></tr>
+        <table class="boxModelTable" id="marginBoxTable">
+            <tr class="marginBox">
+                <td valign="top"><div style="position:relative"><div class="boxModelLabel">margin</div></div></td>
+                <td id="margin-top"></td><td></td></tr>
+            <tr><td class="marginBox horizontalCell" id="margin-left"></td><td>
+                <table class="boxModelTable" id="borderBoxTable">
+                    <tr><td valign="top"><div style="position:relative"><div class="boxModelLabel">border</div></div></td>
+                        <td id="border-top"></td><td></td></tr>
                     <tr><td class="horizontalCell" id="border-left"></td><td>
-                        <table class="boxModelTable" id="paddingBoxTable" cellpadding=0 cellspacing=0>
-                            <tr><td valign="top"><div style="position:relative"><div class="boxModelLabel">padding</div></div></td><td id="padding-top"></td><td></td></tr>
-                            <tr><td class="horizontalCell" id="padding-left"></td><td>
-                                <div id="content"></div></div>
-                            </td><td class="horizontalCell" id="padding-right"></td></tr>
-                            <tr><td></td><td id="padding-bottom"></td><td></td></tr>
+                        <table class="boxModelTable" id="paddingBoxTable">
+                            <tr class="paddingBox">
+                                <td valign="top"><div style="position:relative"><div class="boxModelLabel">padding</div></div></td>
+                                <td id="padding-top"></td><td></td></tr>
+                            <tr><td class="paddingBox horizontalCell" id="padding-left"></td><td>
+                                <div id="content"></div>
+                            </td><td class="paddingBox horizontalCell" id="padding-right"></td></tr>
+                            <tr class="paddingBox"><td></td><td id="padding-bottom"></td><td></td></tr>
                         </table>
                     </td><td class="horizontalCell" id="border-right"></td></tr>
                     <tr><td></td><td id="border-bottom"></td><td></td></tr>
                 </table>
-            </td><td class="horizontalCell" id="margin-right"></td></tr>
-            <tr><td></td><td id="margin-bottom"></td><td></td></tr>
+            </td><td class="marginBox horizontalCell" id="margin-right"></td></tr>
+            <tr class="marginBox"><td></td><td id="margin-bottom"></td><td></td></tr>
         </table>
     </div>
     <div id="propertiesPane" class="pane" style="display: none">
index 7f5328c..f841f35 100644 (file)
@@ -140,6 +140,27 @@ var valueNickname = {
     "rgba(0, 0, 0, 0)": "transparent",
 };
 
+// Display types for which margin is ignored.
+var noMarginDisplayType = {
+    "table-cell": "no",
+    "table-column": "no",
+    "table-column-group": "no",
+    "table-footer-group": "no",
+    "table-header-group": "no",
+    "table-row": "no",
+    "table-row-group": "no",
+};
+
+// Display types for which padding is ignored.
+var noPaddingDisplayType = {
+    "table-column": "no",
+    "table-column-group": "no",
+    "table-footer-group": "no",
+    "table-header-group": "no",
+    "table-row": "no",
+    "table-row-group": "no",
+};
+
 function setUpScrollbar(id)
 {
     var bar = new AppleVerticalScrollbar(document.getElementById(id));
@@ -823,6 +844,16 @@ function updateMetricsPane()
         + " \u00D7 "
         + style.getPropertyValue("height").replace(/px$/, "");
     document.getElementById("content").textContent = size;
+
+    if (noMarginDisplayType[style.display] == "no")
+        document.getElementById("marginBoxTable").setAttribute("hide", "yes");
+    else
+        document.getElementById("marginBoxTable").removeAttribute("hide");
+
+    if (noPaddingDisplayType[style.display] == "no")
+        document.getElementById("paddingBoxTable").setAttribute("hide", "yes");
+    else
+        document.getElementById("paddingBoxTable").removeAttribute("hide");
 }
 
 function updatePropertiesPane()