10 <script src=
"../../resources/testharness.js"></script>
11 <script src=
"../../resources/testharnessreport.js"></script>
12 <div id=
"container" contenteditable=
"true">
13 <p><span style=
"font-size:24px">Caret navigation using up arrow key does not work
</span></p>
16 var p
= document
.getElementsByTagName("p")[0];
17 var selection
= window
.getSelection();
19 testMoveByLineWithPaddingTop("0");
20 testMoveByLineWithPaddingTop("4pt");
21 testMoveByLineWithPaddingTop("4.8pt");
23 function testMoveByLineWithPaddingTop(paddingTop
) {
25 p
.style
.paddingTop
= paddingTop
;
26 var textNode
= document
.getElementsByTagName("span")[0].firstChild
;
27 selection
.collapse(textNode
, 1); // avoid line-top not to be bothered by affinity
28 var beforeRect
= selection
.getRangeAt(0).getClientRects()[0];
30 selection
.modify("move", "forward", "line");
31 var forwardRect
= selection
.getRangeAt(0).getClientRects()[0];
32 assert_greater_than(forwardRect
.top
, beforeRect
.top
, "move forward by line");
34 selection
.modify("move", "backward", "line");
35 var backwardRect
= selection
.getRangeAt(0).getClientRects()[0];
36 assert_equals(backwardRect
.top
, beforeRect
.top
, "move backward by line");
37 }, "padding-top=" + paddingTop
);
40 if (window
.testRunner
)
41 container
.style
.display
= "none";