Index: LayoutTests/fast/multicol/image-inside-nested-blocks-with-border.html |
diff --git a/LayoutTests/fast/multicol/image-inside-nested-blocks-with-border.html b/LayoutTests/fast/multicol/image-inside-nested-blocks-with-border.html |
index 1153403d31a52c0784b147cb1041ced2a5856cca..5f494aab9fc826e9371e1a282b61787761c9cdbf 100644 |
--- a/LayoutTests/fast/multicol/image-inside-nested-blocks-with-border.html |
+++ b/LayoutTests/fast/multicol/image-inside-nested-blocks-with-border.html |
@@ -1,44 +1,25 @@ |
-<html> |
-<body> |
-<div id="tests" style="-webkit-column-count:2; -webkit-column-gap:0; column-count:2; column-gap:0; column-fill:auto; height:300px; width:600px;"> |
-<div style="height:280px"></div> |
-<div id="f1" style="border:5px solid black; float:left"> |
-<img style="display:block;width:140px;height:80px;"> |
-</div> |
-</div> |
-<div id="result"></div> |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
<script> |
+ description("Test that getBoundingClientRect works as expected on a float in the second column"); |
+</script> |
+<body> |
+ <div id="multicol" style="-webkit-column-count:2; -webkit-column-gap:0; column-fill:auto; height:300px; width:600px;"> |
+ <div style="height:280px;"></div> |
+ <div id="f1" style="border:5px solid black; float:left;"> |
+ <img style="display:block; width:140px; height:80px;"> |
+ </div> |
+ </div> |
+ <script> |
function floatOffset(float) |
{ |
- var parentRect = document.getElementById('tests').getBoundingClientRect(); |
+ var parentRect = document.getElementById("multicol").getBoundingClientRect(); |
var rect = float.getBoundingClientRect(); |
- return { width: rect.left - parentRect.left, height: rect.top - parentRect.top }; |
- } |
- |
- var tests = [ |
- ["f1", 300, 0] |
- ]; |
- |
- var test; |
- var failures = 0; |
- while (test = tests.shift()) { |
- var float = document.getElementById(test[0]); |
- var result = floatOffset(float); |
- var passed = result.width === test[1] && result.height === test[2] |
- float.style.backgroundColor = passed ? "green" : "red"; |
- if (!passed) |
- failures++ |
+ return { left: rect.left - parentRect.left, top: rect.top - parentRect.top }; |
} |
- if (window.testRunner) { |
- testRunner.dumpAsText(); |
- document.getElementById("tests").style.display = "none"; |
- } |
- |
- document.getElementById("result").innerText = failures ? "FAIL: " + failures + " cases failed" : "PASS"; |
-</script> |
- |
- |
- |
+ var result = floatOffset(document.getElementById("f1")); |
+ shouldBe("result.left", "300"); |
+ shouldBe("result.top", "0"); |
+ </script> |
</body> |
-</html> |