Added: trunk/LayoutTests/fast/regions/no-split-line-box.html (0 => 95571)
--- trunk/LayoutTests/fast/regions/no-split-line-box.html (rev 0)
+++ trunk/LayoutTests/fast/regions/no-split-line-box.html 2011-09-20 21:59:44 UTC (rev 95571)
@@ -0,0 +1,54 @@
+<!--
+ Each of the two regions should only display two line boxes in this test.
+ The buggy behavior splits the third line box between the first and second region.
+ -->
+<script type="text/_javascript_" charset="utf-8" src=""
+
+<style type="text/css">
+ .article{
+ -webkit-flow: "thread";
+ line-height:14px;
+ }
+ .region{
+ content:-webkit-from-flow("thread");
+ width:4em;
+ height:35px; /*2.5x line height*/
+ background-color:lightgray;
+ }
+ .divider{
+ width:4em;
+ height:10px;
+ }
+ .description{
+ color:blue;
+ }
+</style>
+
+<div id="test">
+ <div class="region"></div>
+ <div class="divider"></div>
+ <div id="secondRegion" class="region"></div>
+ <div class="article">
+ mnopqr mnopqr <span id="testSpan">m</span>nopqr mnopqr mnopqr mnopqr
+ </div>
+ <p class="description">The two regions on either side of the divider should each have two text lines.</p>
+ <p class="description">There should be no text line split between the regions.</p>
+ <p class="description">The top left corner of the third text line should be in the top left corner of the second region.</p>
+</div>
+<div id="result"></div>
+
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText(true);
+
+ var testElement = document.getElementById("testSpan")
+ var testRect = testElement.getBoundingClientRect();
+ var regionElement = document.getElementById("secondRegion")
+ var regionRect = regionElement.getBoundingClientRect();
+ var resultString = assertTopLeftMatch (regionRect, testRect);
+
+ if (window.layoutTestController)
+ document.getElementById("test").innerText="";
+ var resultDiv = document.getElementById("result");
+ resultDiv.innerText = resultString;
+</script>
Modified: trunk/LayoutTests/fast/regions/resources/helper.js (95570 => 95571)
--- trunk/LayoutTests/fast/regions/resources/helper.js 2011-09-20 21:47:07 UTC (rev 95570)
+++ trunk/LayoutTests/fast/regions/resources/helper.js 2011-09-20 21:59:44 UTC (rev 95571)
@@ -4,16 +4,19 @@
return window.location.hash == "#debug";
}
-function rectToArray(rect) {
+function rectToArray(rect)
+{
return [rect.top, rect.left, rect.bottom, rect.right, rect.width, rect.height];
}
-function areEqualNumbers(actual, expected, tolerance) {
+function areEqualNumbers(actual, expected, tolerance)
+{
var diff = Math.abs(actual - expected);
return diff <= tolerance;
}
-function areEqualRects(r1, r2, tolerance) {
+function areEqualRects(r1, r2, tolerance)
+{
if (r1.length != r2.length)
return false;
@@ -24,7 +27,24 @@
return true;
}
-function assertEqualRects(results, name, actualRect, expectedRect, tolerance) {
+function assertTopLeftMatch (r1, r2, tolerance)
+{
+ if (sameTopLeft(r1, r2, tolerance))
+ return "PASS";
+ return "FAIL. Expected top left points to match, but got ("+ r1.top + "," + r1.left + ") and ("+ r2.top + "," + r2.left + ")";
+}
+
+function sameTopLeft(r1, r2, tolerance)
+{
+ if (tolerance === undefined)
+ tolerance = 0;
+ if ( areEqualNumbers(r1.top, r2.top, tolerance) && areEqualNumbers(r1.left, r2.left, tolerance) )
+ return true;
+ return false;
+}
+
+function assertEqualRects(results, name, actualRect, expectedRect, tolerance)
+{
if (areEqualRects(actualRect, expectedRect, tolerance))
return;
@@ -50,7 +70,8 @@
return !results.length;
}
-function assertRectContains(results, name, containerRect, insideRect, tolerance) {
+function assertRectContains(results, name, containerRect, insideRect, tolerance)
+{
// make the container rect bigger with tolerance
var left = containerRect.left - tolerance;
var right = containerRect.right + tolerance;
@@ -63,7 +84,8 @@
return pass;
}
-function addPageLevelDebugBox(rect, color) {
+function addPageLevelDebugBox(rect, color)
+{
var el = document.createElement("div");
el.style.position = "absolute";
el.style.left = rect.left + "px";