Skip to content

Conversation

@cdaringe
Copy link
Contributor

@cdaringe cdaringe commented Nov 8, 2017

problem statement

  • element screenshot capture doesn't work when elements are outside of the original viewport

solution

  • use absolute coordinates

discussion

closes #1304 & #1315

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@cdaringe
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@JoelEinbinder
Copy link
Contributor

This looks good, but I am debating whether or not this is a bug in the protocol, and that Page.captureScreenshot should speak the same language as getBoundingClientRect

@cdaringe
Copy link
Contributor Author

mmm, interesting. fair.

  • Page.captureScreenshot in the protocol expects a Viewport object. this seems correct. it locates and defines a rectangle relative to the document.
  • getBoundingClientRect is paired to the corresponding browser method, and returns a DOMRect, which also seems correct for its use case. it's x & y are relative to the current viewport.

the only thing i'm seeing as a viable change is expanding the Viewport protocol to be relative or absolute positioning aware. however, i dont think they could use the exact same format w/out breaking backwards compatibility--one is relative, one is absolute. thoughts?

Copy link
Contributor

@aslushnikov aslushnikov left a comment

Choose a reason for hiding this comment

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

This looks good, but I am debating whether or not this is a bug in the protocol, and that Page.captureScreenshot should speak the same language as getBoundingClientRect

We might want to change it in protocol, but it is not critical for now.

Thanks for the PR!

@aslushnikov aslushnikov merged commit b0b2219 into puppeteer:master Nov 11, 2017
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