Closed Bug 1154525 Opened 9 years ago Closed 9 years ago

Make HTMLElement.size and HTMLElement.location to use marionette.rect internally

Categories

(Testing :: Marionette Client and Harness, defect)

defect
Not set
normal

Tracking

(firefox40 fixed)

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: automatedtester, Assigned: ato)

References

Details

(Keywords: pi-marionette-client)

Attachments

(1 file, 1 obsolete file)

size and location have been deprecated and are due for removal. We need to update the python tests to use HTMLElement.rect instead
Assignee: nobody → ato
OS: Mac OS X → All
Hardware: x86 → All
Attached file MozReview Request: bz://1154525/ato (obsolete) —
/r/7207 - Bug 1154525: Make HTMLElement#location and #size use #rect internally

Pull down this commit:

hg pull -r d0f18163b3bcf7e3a9d5698953e244b718013258 https://reviewboard-hg.mozilla.org/gecko/
Attachment #8594010 - Flags: review?(dburns)
Component: Gaia::UI Tests → Marionette
Product: Firefox OS → Testing
Summary: Update all usage of HTMLElement.size and HTMLElement.location to use marionette.rect → Make HTMLElement.size and HTMLElement.location to use marionette.rect internally
dburns: I'm sorry I misread this bug as making them use rect internally, but I only realised after I'd pushed my patch.  Refiled your original bug as bug 1155746.
Status: NEW → ASSIGNED
Comment on attachment 8594010 [details]
MozReview Request: bz://1154525/ato

/r/7207 - Bug 1154525: Make HTMLElement#location and #size use #rect internally

Pull down this commit:

hg pull -r d0f18163b3bcf7e3a9d5698953e244b718013258 https://reviewboard-hg.mozilla.org/gecko/
Attachment #8594010 - Flags: review?(cmanchester)
Comment on attachment 8594010 [details]
MozReview Request: bz://1154525/ato

https://reviewboard.mozilla.org/r/7205/#review6145

::: testing/marionette/driver/marionette_driver/marionette.py:153
(Diff revision 1)
> +        return {"x": rect.x, "y": rect.y}

In the listener's getElementLocation I see:

    let el = elementManager.getKnownElement(msg.json.id, curFrame);
    let rect = el.getBoundingClientRect();

    let location = {};
    location.x = rect.left;
    location.y = rect.top;
    
but getElementRect has:

    let el = elementManager.getKnownElement(id, curFrame);
    let clientRect = el.getBoundingClientRect();
    return {
        x: clientRect.x + curFrame.pageXOffset,
        y: clientRect.y  + curFrame.pageYOffset,
        width: clientRect.width,
        height: clientRect.height
    };

from documentation of getBoundingClientRect, this means location used to be relative to the viewport but is now relative to the document. Is that intended?
Attachment #8594010 - Flags: review?(cmanchester)
https://reviewboard.mozilla.org/r/7205/#review6195

> In the listener's getElementLocation I see:
> 
>     let el = elementManager.getKnownElement(msg.json.id, curFrame);
>     let rect = el.getBoundingClientRect();
> 
>     let location = {};
>     location.x = rect.left;
>     location.y = rect.top;
>     
> but getElementRect has:
> 
>     let el = elementManager.getKnownElement(id, curFrame);
>     let clientRect = el.getBoundingClientRect();
>     return {
>         x: clientRect.x + curFrame.pageXOffset,
>         y: clientRect.y  + curFrame.pageYOffset,
>         width: clientRect.width,
>         height: clientRect.height
>     };
> 
> from documentation of getBoundingClientRect, this means location used to be relative to the viewport but is now relative to the document. Is that intended?

Well spotted, sir!  I didn't catch this.

Although the [specification isn't entirely clear on this](https://w3c.github.io/webdriver/webdriver-spec.html#elementrect-getelementrect) I think `getElementLocation` has been wrong all along.  An element's position should be relative to the document, and not the viewport.

I also think this is what Selenium does, but that's also not quite clear from the API documentation.

The question then is if we have test code which relies on this for calculations.  I'll do a full try run to verify.

Thanks again for the thorough review!
Attachment #8594010 - Flags: review?(dburns)
Attachment #8594010 - Flags: review?(cmanchester)
Comment on attachment 8594010 [details]
MozReview Request: bz://1154525/ato

https://reviewboard.mozilla.org/r/7205/#review6217

::: testing/marionette/driver/marionette_driver/marionette.py:158
(Diff revision 1)
> +        

Whitespace added.
Attachment #8594010 - Flags: review?(cmanchester)
https://hg.mozilla.org/mozilla-central/rev/768d5fb8b227
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Attachment #8594010 - Attachment is obsolete: true
Attachment #8620045 - Flags: review+
Product: Testing → Remote Protocol

Moving bugs for Marionette client due to component changes.

Component: Marionette → Marionette Client and Harness
Product: Remote Protocol → Testing
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: