-
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 Report zero visibility for zero size element #30105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -872,7 +872,6 @@ export class VisibilityManagerForDoc extends VisibilityManager { | |
Number(intersection.width), | ||
Number(intersection.height) | ||
); | ||
// TODO(#29618): Remove after ampim investigation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any more cleanup needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We need to move all the related error logs. |
||
let {boundingClientRect} = change; | ||
boundingClientRect = | ||
boundingClientRect && | ||
|
@@ -892,7 +891,6 @@ export class VisibilityManagerForDoc extends VisibilityManager { | |
} | ||
|
||
/** | ||
* TODO(#29618): Clean up boundingClientRect after ampim investigation | ||
* @param {!Element} target | ||
* @param {number} intersectionRatio | ||
* @param {!../../../src/layout-rect.LayoutRectDef} intersectionRect | ||
|
@@ -905,9 +903,16 @@ export class VisibilityManagerForDoc extends VisibilityManager { | |
intersectionRect, | ||
boundingClientRect | ||
) { | ||
intersectionRatio = Math.min(Math.max(intersectionRatio, 0), 1); | ||
const id = getElementId(target); | ||
const trackedElement = this.trackedElements_[id]; | ||
if (boundingClientRect.width < 1 || boundingClientRect.height < 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be collapsed with the declaration above? if (width<1 || height<1) {
// Set intersectionRatio to 0 when the element is not visible.
// Use < 1 because the width/height can be a double values.
intersectionRatio = 0;
} else {
intersectionRatio = Math.min(Math.max(intersectionRatio, 0), 1);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
// Set intersectionRatio to 0 when the element is not visible. | ||
// Use < 1 because the width/height can | ||
// be a double value on high resolution screen | ||
intersectionRatio = 0; | ||
} else { | ||
intersectionRatio = Math.min(Math.max(intersectionRatio, 0), 1); | ||
} | ||
if (trackedElement) { | ||
trackedElement.intersectionRatio = intersectionRatio; | ||
trackedElement.intersectionRect = intersectionRect; | ||
|
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.
Nice check!