Skip to content
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

Inabox: Support layers #17823

Merged
merged 2 commits into from Sep 1, 2018
Merged

Conversation

jridgewell
Copy link
Contributor

@jridgewell jridgewell commented Aug 31, 2018

Layers returns scroll relative layout boxes.

Fixes #17825

Layers returns scroll relative layout boxes.
@@ -177,9 +180,14 @@ export class ViewportBindingInabox {
/** @override */
getLayoutRect(el) {
const b = el./*OK*/getBoundingClientRect();
let {left, top} = b;
if (this.useLayers_) {
left -= this.viewportRect_.left;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you explain why do we offset with viewportRect?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, is layer's coordinate system relative to viewport instead of doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Layer’s rects should exactly match getBoundingClientRect (with rounding) in every circumstance.

In this case, we need to factor in that the is relative to a viewport in a parent document.

@jridgewell jridgewell merged commit 89c1783 into ampproject:master Sep 1, 2018
@jridgewell jridgewell deleted the inabox-layers branch September 6, 2018 01:41
@jridgewell jridgewell added this to TODO in Layers via automation Sep 6, 2018
@jridgewell jridgewell moved this from TODO to Done in Layers Sep 6, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
* Inabox: Support layers

Layers returns scroll relative layout boxes.

* Add import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Layers
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants