-
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
Modify restrictions for in-viewport expansion #25880
Conversation
(parent.getLayoutWidth && parent.getLayoutWidth()) || | ||
parent./*OK*/ getBoundingClientRect().width; | ||
let cumulativeWidth = widthDiff; | ||
for (let i = 0; i < parent.childElementCount; i++) { |
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.
What if this is a structure like this:
super-parent
/ \
kind-of-useless-parent actual-sibling
|
resizing-element
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.
I don't think this should be an issue. <resizing-element>
will never grow wider than <kind-of-useless-parent>
, so the invariant that width(<kind-of-useless-parent>
) + width(<actual-sibling>
) <= width(viewport
) should hold.
Ok. I'm ok with this change, but please wait for @jridgewell to review as well. |
938fe34
to
912cceb
Compare
state.resize = true; | ||
}, | ||
mutate: state => { | ||
if (state.resize) { |
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 overflowCallback
be called?
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.
If I'm reading the code right, I don't think it's relevant in this case as there's no overflow element.
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.
Discussed with Dima; realized callback is necessary & added.
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.
Attempting to rubber stamp bundle size change.
Thanks, all! |
Flexible ad slot expansion was launched earlier this year in August. The new behavior enables large creatives to be rendered within smaller ad slots, necessarily requiring the runtime to expand the slot element at render-time. As preparation for the launch, we made a slight change to AMP’s no-reflow policy, to allow in-viewport expansion if the following criteria hold:
These conditions, however, are too restrictive to allow in-viewport expansion in many cases, resulting in cropped ad slots that load within the viewport. This PR will modify the criteria for in-viewport expansion to the following:
This should result in many fewer cropped ad slots, without introducing any risk of reflow.