Skip to content

Define the correct rect for Take Screenshot #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

gsnedders
Copy link
Member

@gsnedders gsnedders commented Dec 5, 2017

@zcorpan is this the right way to do this with what we have defined in CSSOM View? (please wait for him or someone else who understands CSSOM View better to comment!)


Preview | Diff

@zcorpan
Copy link
Member

zcorpan commented Dec 6, 2017

Do I understand correctly that you want to get the rectangle of the top-level viewport?

What you have is basically scrollX, scrollY, innerWidth, innerHeight, yes?

Looking at https://w3c.github.io/webdriver/webdriver-spec.html#screen-capture it's not super-clear to me if the coordinate space it's expecting is the same as cssom-view uses for scrollX et al. Note "relative to the initial containing block origin" -- IIRC that is intended to match up with coordinate space for absolute positioning. This becomes interesting with dir=rtl (or vertical writing modes), where scrolling left from default scroll position makes scrollX negative.

Here's a test to play around with http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5607

Also see https://lists.w3.org/Archives/Public/www-style/2014Apr/0438.html for information on interop problems to watch out for.

So... what to do. Figure out what coordinate space the screenshotter is expecting, then figure out how to get that rectangle, and test with rtl/vertical.

Hope that helps :)

@gsnedders
Copy link
Member Author

What you have is basically scrollX, scrollY, innerWidth, innerHeight, yes?

innerWidth/Height include the scrollbars, which we don't want to.

@andreastt
Copy link
Member

Closing and reopening to trigger pr-preview.

@andreastt andreastt closed this Dec 21, 2017
@andreastt andreastt reopened this Dec 21, 2017
Copy link
Contributor

@shs96c shs96c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there associated tests for this change? I can't see any for "screen_capture" in WPT, but maybe they're in a different directory.

<li><p>Let <var>root rect</var> be the <a>current top-level browsing context</a>’s
<a>document element</a>’s <a>rectangle</a>.
<li><p>Let <var>window</var> be the <a>associated window</a>
of the <a>current browsing context</a>’s <a>active document</a>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original wording of this captured the visible contents of the OS window. Would current top level browser context be more in keeping with the spirit of this?

@gsnedders
Copy link
Member Author

Closing this in favour of just an issue (#1251), because I don't really know what the right thing here is, nor have the time to better understand it.

@gsnedders gsnedders closed this Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants