Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html

Issue 13871003: Fixing getComputedStyle to return pixel values for left / right / top / bottom (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing a const issue. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html
diff --git a/LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html b/LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html
index 582f1a039731afc08759c4f99c55d6346c51be36..629de20509d96681d1ac59972caa2ef4b26508c9 100644
--- a/LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html
+++ b/LayoutTests/fast/css/getComputedStyle/computed-style-negative-top.html
@@ -2,15 +2,61 @@
function test() {
if (window.testRunner)
testRunner.dumpAsText();
- var style = document.defaultView.getComputedStyle(document.getElementById("test"), "");
var result = document.getElementById("result");
+
+ var style = document.defaultView.getComputedStyle(document.getElementById("test1"), "");
+ testStyle("Without not height", style, result);
+ var style = document.defaultView.getComputedStyle(document.getElementById("test2"), "");
+ testStyle("Without height:100%;", style, result);
+ var style = document.defaultView.getComputedStyle(document.getElementById("test3"), "");
+ testStyle("Without height:auto;", style, result);
+}
+
+function testStyle(name, style, result) {
+ result.appendChild(document.createTextNode(name));
+ result.appendChild(document.createElement('br'));
+
if (style.top == "-1px")
- result.appendChild(document.createTextNode("Test succeeded! Top is " + style.top + "."));
+ result.appendChild(document.createTextNode("Test succeeded! top is " + style.top + "."));
+ else
+ result.appendChild(document.createTextNode("Test failed! top is " + style.top + "."));
+
+ result.appendChild(document.createElement('br'));
+
+ if (style.left == "-2px")
+ result.appendChild(document.createTextNode("Test succeeded! left is " + style.left + "."));
+ else
+ result.appendChild(document.createTextNode("Test failed! left is " + style.left + "."));
+
+ result.appendChild(document.createElement('br'));
+
+ if (style.bottom == "1px")
+ result.appendChild(document.createTextNode("Test succeeded! bottom is " + style.bottom + "."));
+ else
+ result.appendChild(document.createTextNode("Test failed! bottom is " + style.bottom + "."));
+
+ result.appendChild(document.createElement('br'));
+
+ if (style.right == "2px")
+ result.appendChild(document.createTextNode("Test succeeded! right is " + style.right + "."));
else
- result.appendChild(document.createTextNode("Test failed! Top is " + style.top + "."));
+ result.appendChild(document.createTextNode("Test failed! right is " + style.right + "."));
+
+ result.appendChild(document.createElement('br'));
+ result.appendChild(document.createTextNode(style.width + " * " + style.height));
+ result.appendChild(document.createElement('br'));
+ result.appendChild(document.createElement('br'));
}
</script>
<body onload="test()">
-<div id="test" style="position:relative; top:-1px"></div>
+<div id="testContainer1" style="width: 100px; height: 200px;">
+<div id="test1" style="position:relative; top:-1px; left:-2px;"></div>
+</div>
+<div id="testContainer2" style="width: 100px; height: 200px;">
+<div id="test2" style="position:relative; top:-1px; left:-2px; height:100%;"></div>
+</div>
+<div id="testContainer3" style="width: 100px; height: 200px;">
+<div id="test3" style="position:relative; top:-1px; left:-2px; height:auto;"></div>
+</div>
<div id="result"></div>
</body>

Powered by Google App Engine
This is Rietveld 408576698