Commit graph

103 commits

Author SHA1 Message Date
Simon Giesecke
5bfbb2a572 Bug 1673931 - Avoid including Document.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95046

Depends on D95045
2020-11-23 16:07:43 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Sylvestre Ledru
fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Emilio Cobos Álvarez
4936f05266 Bug 1670327 - Fix more IntersectionObserver issues. r=hiro
Two spec issues here.

https://github.com/w3c/IntersectionObserver/issues/457: I think this is
just a spec bug and I've made us match other browsers, but since the
tests don't match the spec for now I've added them as .tentative.html

https://github.com/w3c/IntersectionObserver/issues/456: I've aligned
with WebKit here. There was a (disabled) test for this which tests
chrome behavior and which after this patch shouldn't be flaky. This is
what was causing the assertion.

Differential Revision: https://phabricator.services.mozilla.com/D93166
2020-10-12 10:58:35 +00:00
Mihai Alexandru Michis
b60d04ec78 Backed out changeset a083e04138aa (bug 1670327) for causing wpt failures in intersection-observer/root-margin.html
CLOSED TREE
2020-10-12 13:35:28 +03:00
Emilio Cobos Álvarez
6259946a20 Bug 1670327 - Fix more IntersectionObserver issues. r=hiro
Two spec issues here.

https://github.com/w3c/IntersectionObserver/issues/457: I think this is
just a spec bug and I've made us match other browsers, but since the
tests don't match the spec for now I've added them as .tentative.html

https://github.com/w3c/IntersectionObserver/issues/456: I've aligned
with WebKit here. There was a (disabled) test for this which tests
chrome behavior and which after this patch shouldn't be flaky. This is
what was causing the assertion.

Differential Revision: https://phabricator.services.mozilla.com/D93166
2020-10-12 09:52:22 +00:00
Emilio Cobos Álvarez
92a6857dd2 Bug 1668784 - Return empty oop iframe metrics rather than no metrics for OOP iframes that we still haven't positioned and such. r=hiro
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
2020-10-02 21:30:37 +00:00
Emilio Cobos Álvarez
584d9d8e68 Bug 1668156 - Fix some IntersectionObserver edge cases, and enable the assertion for good. r=hiro
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
2020-10-01 22:41:55 +00:00
Simon Giesecke
1e6ec7ec86 Bug 1656117 - Reduce include dependencies on nsRefreshDriver.h. r=mstange
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
2020-08-04 21:17:50 +00:00
Simon Giesecke
96f3e7e019 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-04 11:27:07 +00:00
Noemi Erli
381fca9783 Backed out 4 changesets (bug 1654992, bug 1654991) for causing timeous in mask-opacity-1e.html
Backed out changeset 11f0f54c6e0a (bug 1654992)
Backed out changeset a353dd5b3f08 (bug 1654991)
Backed out changeset 6a7964ba549f (bug 1654991)
Backed out changeset cf3bfb91d98c (bug 1654991)
2020-08-03 22:09:36 +03:00
Simon Giesecke
032d2ac9d3 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-03 14:54:18 +00:00
Emilio Cobos Álvarez
e7efd73f94 Bug 1581876 - Fix IntersectionObserver's rect to include all continuations. r=mstange
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
2020-07-30 19:43:35 +00:00
Sylvestre Ledru
63be8d152d Bug 1519636 - Reformat recent changes to the Google coding style r=necko-reviewers,dragana
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D77580
2020-05-30 09:55:27 +00:00
Emilio Cobos Álvarez
c6bcab8a5c Bug 1611204 - Fix IntersectionObserverEntry.isIntersecting to match other browsers. r=mstange
Note that no browser matches the spec (see
https://github.com/w3c/IntersectionObserver/issues/432), but that our
behavior is reasonably close to them. So do this to match them.

Differential Revision: https://phabricator.services.mozilla.com/D76603
2020-05-28 10:38:51 +00:00
Razvan Maries
42c461fb61 Backed out changeset 0dba60796753 (bug 1611204) for perma failures on isIntersecting-threshold.html. CLOSED TREE 2020-05-28 05:33:20 +03:00
Emilio Cobos Álvarez
42b26c66a8 Bug 1611204 - Fix IntersectionObserverEntry.isIntersecting to match other browsers. r=mstange
Note that no browser matches the spec (see
https://github.com/w3c/IntersectionObserver/issues/432), but that our
behavior is reasonably close to them. So do this to match them.

Differential Revision: https://phabricator.services.mozilla.com/D76603
2020-05-28 01:10:35 +00:00
Hiroyuki Ikezoe
974267b082 Bug 1635941 - Drop debug printf. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D74141
2020-05-06 21:21:46 +00:00
Hiroyuki Ikezoe
df5af7007e Bug 1634943 - Move animation related stuff in nsDisplayList.cpp into AnimationInfo class. r=boris
Depends on D73573

Differential Revision: https://phabricator.services.mozilla.com/D73574
2020-05-06 01:42:05 +00:00
Simon Giesecke
f458cd246a Bug 1626570 - Improve handling of copying arrays in dom/base/. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73625
2020-05-05 10:08:02 +00:00
Boris Zbarsky
c878a8bb26 Bug 1619112 part 2. Pass char literals instead of char16_t literals into ErrorResult throwing methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D65538

--HG--
extra : moz-landing-system : lando
2020-03-06 21:04:58 +00:00
Hiroyuki Ikezoe
367473435d Bug 1619857 - Early return from GetOopIframeMetrics in cases where either the presshell or the docshell is being destroyed. r=emilio
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
2020-03-05 01:56:48 +00:00
Emilio Cobos Álvarez
6974cefbeb Bug 1619858 - Minimal cleanup of the image lazy loading code. r=hiro
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
2020-03-04 21:34:20 +00:00
Boris Zbarsky
9d69c2d87d Bug 1617972. Add a table that stores the exception type of DOM errors. r=peterv
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
2020-03-03 15:47:22 +00:00
Frederic Wang
f70d494fe7 Bug 1617154 - [intersection-observer] Accept a Document as an explicit root. r=emilio,bzbarsky
This patch allows users to specify a Document as an explicit root of an
intersection observer. For rationale, see the intent-to thread:
https://groups.google.com/forum/#!topic/mozilla.dev.platform/64nDLTAZGzY

It is implemented under a preference option enabled in Nightly:
dom.IntersectionObserverExplicitDocumentRoot.enabled
When disabled, the current TypeError exception is preserved so that
people can continue to feature detect the support.

The enhancement is tested by and enabled for the following test:
https://w3c-test.org/intersection-observer/document-scrolling-element-root.html

Differential Revision: https://phabricator.services.mozilla.com/D63766

--HG--
extra : moz-landing-system : lando
2020-03-03 12:25:30 +00:00
Emilio Cobos Álvarez
b6a0b062af Bug 1618601 - Make lazy-load margin configurable. r=hiro
But keep it being zero by default.

Depends on D64611

Differential Revision: https://phabricator.services.mozilla.com/D64612

--HG--
extra : moz-landing-system : lando
2020-02-27 21:14:43 +00:00
Emilio Cobos Álvarez
7dbe3f32c3 Bug 1615609 - Rename nsRefreshDriver::IntersectionObservationAdded. r=hiro
The existing name is wrong since recently.

Differential Revision: https://phabricator.services.mozilla.com/D62922

--HG--
extra : moz-landing-system : lando
2020-02-15 07:23:51 +00:00
Mihai Alexandru Michis
7a12252825 Backed out changeset 93c88e36d8ea (bug 1615609) for causing bustages in DOMIntersectionObserver.cpp
CLOSED TREE
2020-02-15 03:17:43 +02:00
Emilio Cobos Álvarez
bb6f2791e3 Bug 1615609 - Rename nsRefreshDriver::IntersectionObservationAdded. r=hiro
The existing name is wrong since recently.

Differential Revision: https://phabricator.services.mozilla.com/D62922

--HG--
extra : moz-landing-system : lando
2020-02-14 21:16:06 +00:00
Hiroyuki Ikezoe
8398acfafe Bug 1542784 - Implement lazy loading for images. r=emilio,hsivonen
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
2020-02-12 21:31:48 +00:00
Hiroyuki Ikezoe
878e272a90 Bug 1542784 - Make DOMIntersectionObserver::mCallback Variant. r=emilio,bzbarsky
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
2020-02-12 21:29:19 +00:00
Hiroyuki Ikezoe
b9fb72c857 Bug 1599795 - Make IntersectionObserver work in fission world. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61938

--HG--
extra : moz-landing-system : lando
2020-02-11 03:59:14 +00:00
Ting-Yu Lin
c81d3e5f5f Bug 1610670 - Add AllPhysicalSides() to support range-based for loops. r=mats
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
2020-02-04 03:28:27 +00:00
Boris Zbarsky
5cd4320f78 Bug 1612007. Add convenience methods for throwing various spec-defined DOMExceptions on ErrorResult. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D61202

--HG--
extra : moz-landing-system : lando
2020-01-29 09:09:11 +00:00
Emilio Cobos Álvarez
2261c719d0 Bug 1608931 - Ensure we tick the refresh driver at least once after calling IntersectionObserver.observe. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D60015

--HG--
extra : moz-landing-system : lando
2020-01-21 23:21:32 +00:00
Emilio Cobos Álvarez
3c12d374bc Bug 1600362 - Cleanup IntersectionObserver. r=smaug
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
2019-11-29 20:39:36 +00:00
Emilio Cobos Álvarez
edaf23ca5b Bug 1551716 - Factor out some intersection observer code, and add spec quotes. r=mstange
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
2019-11-22 22:36:27 +00:00
Geoff Lankow
3e41bcb779 Bug 1580462 - Follow-up: include a missing header file. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D50435

--HG--
extra : moz-landing-system : lando
2019-10-24 07:32:23 +00:00
Boris Zbarsky
417c6749c3 Bug 1581276. Require a message arg to ThrowDOMException. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D46250

--HG--
extra : moz-landing-system : lando
2019-09-20 02:17:01 +00:00
Hiroyuki Ikezoe
42cf2e1cb4 Bug 1581974 - Change DOMIntersectionObserver::Update to use the BrowsingContext parent chain. r=jwatt
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
2019-09-20 04:59:56 +00:00
Emilio Cobos Álvarez
88b5840556 Bug 1553673 - Round intersection observer percentage margins with NSToCoordRound rather than the default rounder. r=dholbert
The default rounder floors percentages instead of rounding, which can cause
subtle issues.

This is generally desirable for most lengths, AIUI, so that pages don't cause
undesired overflow when using percentage widths and such, but for the
intersection observer root margin, it can cause some annoyance as the percentage
going negative may cause the root rect to be negatively sized and report no
intersection.

This also seems to match Blink[1], though it goes back to the initial
implementation of IntersectionObserver.rootMargin[2].

[1]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc?l=52&rcl=8671a050dd117b730bffbad5838f218fcc024845
[2]: c88a8ad4f1

Differential Revision: https://phabricator.services.mozilla.com/D32873

--HG--
extra : moz-landing-system : lando
2019-06-11 19:16:46 +00:00
Emilio Cobos Álvarez
bbc403524a Bug 1551716 - Deindent some IntersectionObserver code. r=mstange
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
2019-05-15 17:34:30 +00:00
Emilio Cobos Álvarez
415558991d Bug 1551716 - Use ranged-for loop in DOMIntersectionObserver. r=mstange
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
2019-05-15 17:33:45 +00:00
Emilio Cobos Álvarez
4d7db14635 Bug 1551716 - Simplify the cross-origin check in IntersectionObserver. r=mstange
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
2019-05-15 17:32:28 +00:00
Emilio Cobos Álvarez
097c6e63b1 Bug 1505471 - Map intersection observer rects to the right viewport. r=mstange
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
2019-05-15 17:29:33 +00:00
Masayuki Nakano
de2d589e58 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
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
2019-03-29 15:12:47 +00:00
Dorel Luca
5a0fa68b78 Backed out 3 changesets (bug 1540015) for build bustage. CLOSED TREE
Backed out changeset 7b71c9da0214 (bug 1540015)
Backed out changeset 5723ddbc5c44 (bug 1540015)
Backed out changeset 9561d2c36fa5 (bug 1540015)
2019-03-29 16:14:26 +02:00
Masayuki Nakano
9273f25ce2 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
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
2019-03-29 13:09:26 +00:00