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

Remove references to unit of related similar-origin browsing contexts #448

Merged
merged 6 commits into from
Sep 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ urlPrefix: https://html.spec.whatwg.org/multipage/
urlPrefix: dom.html
url: #the-document-object; type:dfn; text: Document
urlPrefix: browsers.html
type: dfn; text: unit of related similar-origin browsing contexts
type: dfn; text: browsing context
type: dfn; text: top-level browsing context
type: dfn; text: nested browsing contexts
type: dfn; text: browsing context container
type: dfn; text: browsing context scope origin
type: dfn; text: fully active
urlPrefix: webappapis.html;
type: dfn; text: report the exception
Expand All @@ -49,6 +49,7 @@ urlPrefix: https://heycam.github.io/webidl/
text: SyntaxError
urlPrefix: #dfn-; type:dfn; text: throw
urlPrefix: #idl-; type:interface; text: double
urlPrefix: #idl-; type:interface; text: undefined
url: #hierarchyrequesterror; type: exception; text: HierarchyRequestError
urlPrefix: https://drafts.csswg.org/css-box/
url: #containing-block; type: dfn; text: containing block
Expand Down Expand Up @@ -278,9 +279,9 @@ interface IntersectionObserver {
::
Offsets applied to the <a>root intersection rectangle</a>,
effectively growing or shrinking the box that is used to calculate intersections.
Note that {{IntersectionObserver/rootMargin}} is only applied
for <a>targets</a> which belong to the same <a>unit of related similar-origin browsing contexts</a>
as the <a>intersection root</a>.
Note that for <a>implicit root</a> observers,
{{IntersectionObserver/rootMargin}} is only applied
for <a>targets</a> which have a <a>browsing context scope origin</a>.

On getting, return the result of serializing the elements of {{[[rootMargin]]}}
space-separated, where pixel lengths serialize as the numeric value followed by "px",
Expand Down Expand Up @@ -323,8 +324,9 @@ is the rectangle we'll use to check against the targets.
<dd>it's the result of running the {{Element/getBoundingClientRect()}} algorithm on the <a>intersection root</a>.
</dl>

For any <a>target</a> which belongs to the same <a>unit of related similar-origin browsing contexts</a>
as the <a>intersection root</a>,
If the <a>intersection root</a> is not the <a>implicit root</a>,
or when calculating the <a>intersection root</a> for
a <a>target</a> which has a <a>browsing context scope origin</a>,
Copy link

Choose a reason for hiding this comment

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

This disjunction doesn't seem quite right. By my reading, anything which isn't an implicit root will pass this predicate, and thus get its rectangle expanded.

I think the intention is something like

For any target which has a browsing context scope origin and is not an implicit root

?

Copy link
Collaborator Author

@szager-chromium szager-chromium Sep 14, 2020

Choose a reason for hiding this comment

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

No, I think my language is correct. We want the union of:

  • explicit-root observers
  • implicit-root observers with a target that has a browsing context origin scope

Those are indeed the cases where the root margin should be applied. The reasoning is:

  • For explicit root observers, the target and root elements must be in the same document, so there is no security issue, and we should always apply root margin.

  • For implicit root observers, we only want to apply root margin when the document containing the target and all of its browsing context ancestors have the same origin.

the rectangle is then expanded
according to the offsets in the {{IntersectionObserver}}’s {{[[rootMargin]]}} slot
in a manner similar to CSS's 'margin' property,
Expand Down Expand Up @@ -426,9 +428,9 @@ dictionary IntersectionObserverEntryInit {
1 if the {{IntersectionObserverEntry/isIntersecting}} is true, and 0 if not.
: <dfn>rootBounds</dfn>
::
If {{IntersectionObserverEntry/target}} belongs to the same
<a>unit of related similar-origin browsing contexts</a>
as the <a>intersection root</a>,
If the {{IntersectionObserver}} is not an <a>implicit root</a> observer,
or if the {{IntersectionObserverEntry/target}} has a
<a>browsing context scope origin</a>,
this will be the <a>root intersection rectangle</a>.
Otherwise, this will be <code>null</code>.
Note that if the target is in a different <a>browsing context</a> than the <a>intersection root</a>,
Expand Down