+2011-09-20 Alan Stearns <stearns@adobe.com>
+
+ [CSSRegions] Need test case for 66198 (sliced line box rendering)
+ https://bugs.webkit.org/show_bug.cgi?id=68257
+
+ Reviewed by David Hyatt.
+
+ * fast/regions/resources/helper.js:
+ (assertTopLeftMatch):
+ (sameTopLeft):
+ * fast/regions/no-split-line-box-expected.txt: Added.
+ * fast/regions/no-split-line-box.html: Added.
+
2011-09-20 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=68314
--- /dev/null
+<!--
+ 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="resources/helper.js"></script>
+
+<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>
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;
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;
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;
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";