-
Notifications
You must be signed in to change notification settings - Fork 522
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
Allow the 'root' argument to be a Document. #411
Conversation
index.bs
Outdated
|
||
<dt>If the <a>intersection root</a> has an overflow clip, | ||
<dt>If the <a>intersection root</a> is a {{document}}, | ||
<dd>it's the size of the {{document}}'s viewport. |
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.
Where is "the document's viewport" defined? Is it defined for documents that are not in a browsing context or are not fully active?
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.
This is sort of intentionally vague. The existing spec says this:
"If the intersection root is the implicit root, it [the root intersection rectangle] is the viewport’s size."
Elsewhere it mentions "the viewport of the document" and "viewport of the nested browsing context". It also says this in a highlighted note:
"Root intersection rectangle is not affected by pinch zoom and will report the unadjusted viewport, consistent with the intent of pinch zooming (to act like a magnifying glass and NOT change layout.)"
However, all of that text is likely to change with the resolution of this issue:
The intention here is to use "viewport" in a way that is consistent with existing usage in the spec, until the above issue is resolved.
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 understand all that, but the implicit root, being the active document of a toplevel browsing context, always has at least some concept of a viewport. If there's some random document involved (e.g. an XHR responseXML document, or a document from an iframe that is now removed from the DOM or whatever), there may be no concept of a viewport at all. #95 does not cover that, as far as I can tell.
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.
The only spec language I could find that defines browser viewport is this unhelpful bit:
https://drafts.csswg.org/css2/visuren.html#viewport
But I'm not sure it's necessary to determine what the browser viewport of a detached document is, since the "Update the rendering" steps in the HTML event loop -- which is where IntersectionObserver runs -- only applies to fully active (connected) documents:
https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model
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.
Aha. It might be good in the loop to assert that all documents we encounter are fully active. Those might still not have a sane viewport (e.g. if their embedding iframe is display:none), but at least it cuts down on the cases that need to be considered.
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.
OK, I added some language there to clarify that the root document must be fully active at this step in processing.
PTAL
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.
This looks reasonable to me, thank you.
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.
@bzbarsky Would you mind clicking the "approved" button...
@bzbarsky If you could take another look at this soon-ish, that would be helpful. We're hoping to ship this behavior in the next branch of chromium, which will happen next week. Thanks |
Issue #372
Closes #???
The following tasks have been completed:
Implementation commitment:
Preview | Diff