-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Force layout of elements used in animations #9150
Conversation
@@ -624,6 +624,39 @@ export class Resources { | |||
} | |||
|
|||
/** | |||
* Requires the layout of the specified element or top-level sub-elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, so in
<amp-selector>
<amp-layout>
<amp-img>
resource.requireLayout(ampSelectorComponent);
won't layout and wait for <amp-img>
because it is not top level? Is there a reason to restrict to top-level sub components (instead of drawing the line at where ownership
of sub-components is assumed by parent)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(we chatted offline about this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We currently do not have an option to do recursive filtering well enough. But such a use case is also somewhat rare in animations. I'll follow up on this and see if we can find a way to do this right for all cases.
src/service/resources-impl.js
Outdated
} | ||
} | ||
if (resource.isDisplayed()) { | ||
promises.push(resource.loadedOnce()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be movable inside the other if( resource.isDisplayed() )
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Made me realize it was a slight bug - the first isDisplayed
/measure
should have been inside the promise. Fixed now.
Closes #7921.