Commit 4b6c23a8 authored by kojii@chromium.org's avatar kojii@chromium.org

Add a test of getBoundingClientRect() when white-space:pre for complex scripts

At one point the caret was placed at an incorrect position for complex
scripts. This was caused by advances and/or bounds calculation was
incorrect when white-space:pre is applied to a text run of complex
scripts.

It was fixed in later patches. This CL adds a test for the failure to
prevent it happening again.

BUG=513994

Review URL: https://codereview.chromium.org/1303673005

git-svn-id: svn://svn.chromium.org/blink/trunk@200878 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1a7a20c1
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
#container {
font-size: 25px;
}
</style>
<div id="container">
<div>شییش ی ی ی ی ی</div>
<div style="white-space:pre">شییش ی ی ی ی ی</div>
</div>
<script>
runTests();
function runTests() {
var expectedNode = container.firstElementChild.firstChild;
var targetNode = container.lastElementChild.firstChild;
for (var i = 0; i < expectedNode.length; i++) {
test(function () {
assert_equals(getX(targetNode, i), getX(expectedNode, i));
}, "Index " + i);
}
if (window.testRunner)
container.style.display = "none";
}
function getX(node, offset) {
var range = document.createRange();
range.setStart(node, offset);
range.setEnd(node, offset + 1);
var bounds = range.getBoundingClientRect();
return bounds.left;
}
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment