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

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/bounds-calc.html

Issue 2169273004: Switch all LayoutTests to use new accessibility relative bounding box API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix absolute bounds in AXInlineTextBox::elementRect Created 4 years, 4 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
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 4
5 <!-- 5 <!--
6 This is a test of the new (June 2016) bounds calculation code, 6 This is a test of the new (June 2016) bounds calculation code,
7 in which every node in the accessibility tree specifies its 7 in which every node in the accessibility tree specifies its
8 bounding box and optional matrix transform relative to an 8 bounding box and optional matrix transform relative to an
9 ancestor object in the tree. 9 ancestor object in the tree.
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 var bounds = element.getBoundingClientRect(); 59 var bounds = element.getBoundingClientRect();
60 var axObject = accessibilityController.accessibleElementById(id); 60 var axObject = accessibilityController.accessibleElementById(id);
61 61
62 // Due to rounding we won't get identical bounds as getBoundingClientRect(), 62 // Due to rounding we won't get identical bounds as getBoundingClientRect(),
63 // so allow the test to pass if we're within 1 pixel. The test examples 63 // so allow the test to pass if we're within 1 pixel. The test examples
64 // deliberately have borders, margins, and padding larger than 1 pixel to 64 // deliberately have borders, margins, and padding larger than 1 pixel to
65 // ensure that this epsilon is not masking more serious errors. 65 // ensure that this epsilon is not masking more serious errors.
66 var epsilon = 1; 66 var epsilon = 1;
67 67
68 assert_approx_equals(axObject.boundsX, bounds.left, epsilon, id + " left"); 68 assert_approx_equals(axObject.boundsX, bounds.left, epsilon, id + " left");
69 assert_approx_equals(axObject.boundsY, bounds.top, epsilon, id + " left"); 69 assert_approx_equals(axObject.boundsY, bounds.top, epsilon, id + " top");
70 assert_approx_equals(axObject.boundsWidth, bounds.width, epsilon, id + " lef t"); 70 assert_approx_equals(axObject.boundsWidth, bounds.width, epsilon, id + " wid th");
71 assert_approx_equals(axObject.boundsHeight, bounds.height, epsilon, id + " l eft"); 71 assert_approx_equals(axObject.boundsHeight, bounds.height, epsilon, id + " h eight");
72 } 72 }
73 73
74 function assertStaticTextChildDOMRectSameAsAXRect(id) { 74 function assertStaticTextChildDOMRectSameAsAXRect(id) {
75 var element = document.getElementById(id); 75 var element = document.getElementById(id);
76 var axObject = accessibilityController.accessibleElementById(id); 76 var axObject = accessibilityController.accessibleElementById(id);
77 var text = element.firstChild; 77 var text = element.firstChild;
78 var axText = axObject.childAtIndex(0); 78 var axText = axObject.childAtIndex(0);
79 assert_equals(text.nodeType, Node.TEXT_NODE, id + " firstChild nodeType"); 79 assert_equals(text.nodeType, Node.TEXT_NODE, id + " firstChild nodeType");
80 assert_equals(axText.role, "AXRole: AXStaticText", id + " AX first child rol e"); 80 assert_equals(axText.role, "AXRole: AXStaticText", id + " AX first child rol e");
81 var range = document.createRange(); 81 var range = document.createRange();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 assertOffsetContainerIs("div6a", "container6a", true); 237 assertOffsetContainerIs("div6a", "container6a", true);
238 assertOffsetContainerIs("div6b", "container6a", false); 238 assertOffsetContainerIs("div6b", "container6a", false);
239 assertOffsetContainerIs("div6b", "container6b", false); 239 assertOffsetContainerIs("div6b", "container6b", false);
240 240
241 assertOffsetContainerIs("div6c", "container6b", true); 241 assertOffsetContainerIs("div6c", "container6b", true);
242 assertOffsetContainerIs("div6d", "container6a", false); 242 assertOffsetContainerIs("div6d", "container6a", false);
243 assertOffsetContainerIs("div6d", "container6b", false); 243 assertOffsetContainerIs("div6d", "container6b", false);
244 }, "Container must be an ancestor in both the AX tree and layout tree."); 244 }, "Container must be an ancestor in both the AX tree and layout tree.");
245 </script> 245 </script>
246 246
247 <div id="container7" class="container" role="group"
248 style="position: absolute; left: 600px; top: 20px; border: 3px solid #eee; margin: 5px; padding: 7px;">
249 <span id="span7" role="group">
250 Before
251 <div style="width: 100px; height: 100px;">Block</div>
252 After
253 </span>
254 </div>
255
256 <script>
257 test(function(t) {
258 assertHasTransform("container7", false);
259 assertHasTransform("span7", false);
260 assertDOMRectSameAsAXRect("span7");
261 }, "Test spans inside of absolute-positioned container");
262 </script>
263
247 <script> 264 <script>
248 if (window.testRunner) 265 if (window.testRunner)
249 document.body.className = "hideAllContainers"; 266 document.body.className = "hideAllContainers";
250 </script> 267 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698