Commit ef50a96d authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Make all elements query test helpers return the client's top and left

These test helpers return an element's getBoundingClientRect width and
height only. Include the DOMRect .top and .left as well [1].

[1] Useful for table mode + touch event testing, should be the same as
W3C DOMRect .x and .y values. Would prefer those, but closure does not
define them [2] whereas the W3C DOM specs do.

[2] Filed https://github.com/google/closure-compiler/issues/3140

Bug: 839243
Change-Id: I0cce0e4a121fd7bca49645d09e98d013fbf920f0
Reviewed-on: https://chromium-review.googlesource.com/c/1325270
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606322}
parent 2278b7f5
...@@ -48,13 +48,17 @@ function extractElementInfo(element, contentWindow, opt_styleNames) { ...@@ -48,13 +48,17 @@ function extractElementInfo(element, contentWindow, opt_styleNames) {
} }
result.styles = styles; result.styles = styles;
// These attributes are set when element is img or canvas.
// These attributes are set when element is <img> or <canvas>.
result.imageWidth = Number(element.width); result.imageWidth = Number(element.width);
result.imageHeight = Number(element.height); result.imageHeight = Number(element.height);
// These attributes are set in any element. // These attributes are set in any element.
result.renderedWidth = size.width; result.renderedWidth = size.width;
result.renderedHeight = size.height; result.renderedHeight = size.height;
result.renderedTop = size.top;
result.renderedLeft = size.left;
return result; return result;
} }
......
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