This is the right thing to do. If the compositor still hasn't sent
BrowserChild its visible position, then we should just be
non-intersecting, not carry on with the root document state.
Fix the test to not be racy, as the layout / positioning of the iframe
is async with Fission / Chromium site isolation enabled.
Differential Revision: https://phabricator.services.mozilla.com/D92240
This patch fixes two issues, described below:
First, the GetTopLevelDocument function was looking at the browsing
context tree. It should look at the window context tree, as looking at
the browsing context tree means that if you're in a discarded or
about-to-get-discarded document, you can end up with a document from a
different tree. Computing intersections between those of course makes no
sense and triggers the assertion we're enabling.
Second, this patch fixes an issue when you have fission enabled, and a
setup such as:
A1 -> B1 -> A2
If you try to use IntersectionObserver from A2 with the implicit root,
we'd end up with:
* rootRect: A1's root scrollport rect (this is fine, because it's only
used to compute the root margin and bounds and so on, not
to compute geometry).
* rootFrame: A1's root scroll frame (this is _not_ fine, see below).
Then, we'd try to map rects from A2's target to A1's viewport, and we
can't really do that sensibly with the existing nsLayoutUtils functions,
because we're not accounting for all the OOP iframe transforms that may
be going on. This also triggers the assertion that this patch enables in
same-origin-grand-child-iframe.sub.html.
To fix it, for the A2 case, use the same code that we have for other OOP
iframes. The test tweaks fails with fission enabled without the patch
(because we don't account for the OOP iframe clip).
Differential Revision: https://phabricator.services.mozilla.com/D92089
The abstract observer base classes are moved to a separate header file
nsRefreshObservers.h and the includes are adjusted accordingly.
Some method implementations are moved to the corresponding implementation files
to avoid the need to include the nsRefreshDriver.h file in the header.
Differential Revision: https://phabricator.services.mozilla.com/D85764
This does the same thing that getBoundingClientRect() does, which is
what the spec asks for, and thus fixes the intersection ratio for split
inlines where the first continuation is empty for example.
Differential Revision: https://phabricator.services.mozilla.com/D85385
I gave up writing crash tests for this since it's quite hard to destroy
an OOP iframe during processing IntersectionObserver's update step in the
OOP process.
Differential Revision: https://phabricator.services.mozilla.com/D65417
--HG--
extra : moz-landing-system : lando
We don't really need to wait till we have an inner window, really.
The mOwner is only used to create a reflector, and we don't even want to expose
this observer to script, so we could leave it null if we wanted.
Differential Revision: https://phabricator.services.mozilla.com/D65369
--HG--
extra : moz-landing-system : lando
The callsite in DOMIntersectionObserver did end up throwing a RangeError, as the
spec requires, because in the end we just used the exception code to determine
the kind of exception to throw, but was misleading about what it was doing.
Differential Revision: https://phabricator.services.mozilla.com/D64175
--HG--
extra : moz-landing-system : lando
Though with this initial implementation, we do create an IntersectionObserver
only for the root document in each processes, once we found issues on this
model, we can create an IntersectionObserver in each _document_.
Depends on D61437
Differential Revision: https://phabricator.services.mozilla.com/D61438
--HG--
extra : moz-landing-system : lando
So that it can accept a callback function implemented in C++ for lazy-loading.
Depends on D61435
Differential Revision: https://phabricator.services.mozilla.com/D61436
--HG--
extra : moz-landing-system : lando
This patch is generated via:
1. Manually modify gfx/2d/Types.h
2. Run the following script and clang-format.
```
function rename() {
echo "Renaming $1 to $2"
rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}
rename "NS_FOR_CSS_SIDES\(side\)" "for (const auto side : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(s\)" "for (const auto s : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(i\)" "for (const auto i : mozilla::AllPhysicalSides())"
rename "NS_FOR_CSS_SIDES\(ix\)" "for (const auto ix : mozilla::AllPhysicalSides())"
```
Differential Revision: https://phabricator.services.mozilla.com/D61250
--HG--
extra : moz-landing-system : lando
Initially this was going to be a simple cleanup: Remove some useless namespaces
here and there and so on, remove `using` statements from the header and so on.
But unfortunately, DOMIntersectionObserver.h (which is included in Element.h,
unnecessarily) ended up exposing `Element` unnamespaced to a lot of code, so I
had to fix that.
Differential Revision: https://phabricator.services.mozilla.com/D55316
--HG--
extra : moz-landing-system : lando
This would've made my life a lot easier. There's a couple things that don't
match the spec that I've left as comments.
Differential Revision: https://phabricator.services.mozilla.com/D31151
--HG--
extra : moz-landing-system : lando
Using the BrowsingUsing parent chain is able to avoid 1) obtaining a wrong
root in cross-process documents and also avoid 2) not being able to obtain
the proper root in same-origin documents in the case where there is a
cross-process document in between the top level document and the same-origin
documents.
dom/base/test/test_intersectionobservers.html is a test of case 1).
testing/web-platform/tests/intersection-observer/same-origin-grand-child-iframe.sub.html
is a test case of case 2).
Differential Revision: https://phabricator.services.mozilla.com/D46432
--HG--
extra : moz-landing-system : lando
Just trying to make it slightly nicer. Probably should get a function to get the
root target document frame.
Will file a bug for fission since I _suspect_ fission is going to do something
about IntersectionObserver.
Depends on D31149
Differential Revision: https://phabricator.services.mozilla.com/D31150
--HG--
extra : moz-landing-system : lando
There's nothing here that should be mutating us (and if there was we'd be hosed
already given the amount of weak pointers we keep around), so this is nicer.
Depends on D31148
Differential Revision: https://phabricator.services.mozilla.com/D31149
--HG--
extra : moz-landing-system : lando
Should've no behavior change given the spec issue, but it should read nicer.
Differential Revision: https://phabricator.services.mozilla.com/D31148
--HG--
extra : moz-landing-system : lando
targetFrame is modified during the intersection computation loop, so it's not
the viewport you want if there are scrollframes around.
The test is the same as iframe-no-root.html but with a wrapping scroller which
triggers this bug.
This code is quite subtle, so will refactor and clean it up in a followup.
Differential Revision: https://phabricator.services.mozilla.com/D31147
--HG--
extra : moz-landing-system : lando
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.
Additonally, "shell" is unclear ("docshell" vs. "presshell"). Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.
Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.
Differential Revision: https://phabricator.services.mozilla.com/D25338
--HG--
extra : moz-landing-system : lando
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.
Additonally, "shell" is unclear ("docshell" vs. "presshell"). Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.
Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.
Differential Revision: https://phabricator.services.mozilla.com/D25338
--HG--
extra : moz-landing-system : lando