Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/inline-text-bounds-for-range-br.html

Issue 2372823002: Fix a case where the accessible bounding box of an inline text box was wrong. (Closed)
Patch Set: Fix bug in bounds calc uncovered by windows test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4
5 <p id="paragraph">Line 1<br>Line 2</p>
6
7 <script>
8 test(function(t) {
9 // Due to rounding we won't get identical bounds as getBoundingClientRect(),
10 // so allow the test to pass if we're within 1 pixel.
11 var epsilon = 1;
12
13 var axParagraph = accessibilityController.accessibleElementById("paragraph") ;
14 var axStaticText1 = axParagraph.childAtIndex(0);
15 eval("var axTextBounds1 = " + axStaticText1.boundsForRange(0, 6));
16
17 var paragraph = document.getElementById("paragraph");
18 var range = new Range();
19 range.setStart(paragraph.firstChild, 0);
20 range.setEnd(paragraph.firstChild, 6);
21 var rangeBounds = range.getBoundingClientRect();
22
23 assert_approx_equals(axTextBounds1.x, rangeBounds.left, epsilon, "Line 1 lef t");
24 assert_approx_equals(axTextBounds1.y, rangeBounds.top, epsilon, "Line 1 top" );
25 assert_approx_equals(axTextBounds1.width, rangeBounds.width, epsilon, "Line 1 width");
26 assert_approx_equals(axTextBounds1.height, rangeBounds.height, epsilon, "Lin e 1 height");
27
28 var axStaticText2 = axParagraph.childAtIndex(2);
29 eval("var axTextBounds2 = " + axStaticText2.boundsForRange(0, 6));
30 range.setStart(paragraph.lastChild, 0);
31 range.setEnd(paragraph.lastChild, 6);
32 rangeBounds = range.getBoundingClientRect();
33
34 assert_approx_equals(axTextBounds2.x, rangeBounds.left, epsilon, "Line 2 lef t");
35 assert_approx_equals(axTextBounds2.y, rangeBounds.top, epsilon, "Line 2 top" );
36 assert_approx_equals(axTextBounds2.width, rangeBounds.width, epsilon, "Line 2 width");
37 assert_approx_equals(axTextBounds2.height, rangeBounds.height, epsilon, "Lin e 2 height");
38 }, "Check bounds of inline text boxes after line breaks");
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698