Commit Graph

66 Commits

Author SHA1 Message Date
Oriol Brufau
7493b76cf3 Bug 1792217 - Let last remembered size take all fragments into account regardless of pref. r=emilio
ResizeObserver only handles multiple fragments when the preference
dom.resize_observer.support_fragments is true.
That's because this experimental behavior may have compat problems.

But the last remembered size uses an internal ResizeObserver,
so changing the signature of the callback is not a problem.

Differential Revision: https://phabricator.services.mozilla.com/D158034
2022-09-23 23:41:34 +00:00
Oriol Brufau
ae8d86c50e Bug 1792210 - Use for loop in ResizeObserver's CalculateBoxSize. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158029
2022-09-23 18:14:09 +00:00
Martin Robinson
009354aed9 Bug 1791760 - Move GetContainSizeAxes to nsIFrame r=emilio
This will allow this function to eventually return an appropriate value
depending on whether or not content is skipped via `content-visibility:
auto`. This change also starts looking directly at whether
content-visibility is skipping content or not, which should make it
compatible with a future `content-visibility: auto` implementation.

Differential Revision: https://phabricator.services.mozilla.com/D157831
2022-09-22 12:11:09 +00:00
Oriol Brufau
0ddbfd082d Bug 1791402 - Take all fragments into account for last remembered size. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157659
2022-09-21 20:19:56 +00:00
Oriol Brufau
2466518cd9 Bug 1791375 - Handle multiple fragments in ResizeObserver. r=emilio
As per CSSWG resolution: https://github.com/w3c/csswg-drafts/issues/3673

Some details are not clear, so implement it behind a pref, disabled by
default.

Differential Revision: https://phabricator.services.mozilla.com/D157641
2022-09-21 20:19:55 +00:00
Oriol Brufau
aee231b036 Bug 1791375 - Switch ResizeObserver APIs to using an array of sizes. r=emilio
This is in preparation of supporting multiple fragments, since we should
track each fragment size separately.

This patch should have no observable effect.

Differential Revision: https://phabricator.services.mozilla.com/D157640
2022-09-21 20:19:55 +00:00
Oriol Brufau
c4ed5b3ceb Bug 1791375 - Switch ResizeObserver APIs from gfx::Size to LogicalPixelSize. r=emilio
This is in preparation of supporting multiple fragments, since we want
to track the logical sizes, and fragments might potentially have
different writing modes (but not sure if it can happen in practice).

This patch should have no observable effect.

Differential Revision: https://phabricator.services.mozilla.com/D157639
2022-09-21 20:19:54 +00:00
Oriol Brufau
1d524db5df Bug 1791371 - Remove unnecessary WritingMode parameter for ResizeObservation. r=emilio
The writing mode doesn't matter since mLastReportedSize is initialized
to the same value for both axes.

This patch should have no observable effect.

Differential Revision: https://phabricator.services.mozilla.com/D157633
2022-09-19 16:36:44 +00:00
Martin Robinson
d6b19e86ff Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D157306
2022-09-15 20:32:27 +00:00
Martin Robinson
bac483e3ac Bug 1790631: Elements skipped via content-visibility should not trigger ResizeObserver r=emilio
Do not collect elements skipped via `content-visibility` when gathering
active ResizeObserverObservations. This will mean that these elements
will not trigger ResizeObserver callbacks until their content is no
longer skipped by `content-visibility`.

Differential Revision: https://phabricator.services.mozilla.com/D157244
2022-09-14 21:52:50 +00:00
Oriol Brufau
6c521c6766 Bug 1789754 - Don't record last remembered size for non-replaced inlines. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157020
2022-09-10 13:26:12 +00:00
Olli Pettay
048bd344c4 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
David Shin
08fc6a37e8 Bug 1785305: Set Resize Observer's last reported size to -1x-1 initially. r=emilio
It used to be 0x0, but changed per the CSSWG resolution:
https://github.com/w3c/csswg-drafts/issues/3664
Sits behind pref `dom.resize_observer.last_reported_size_invalid`.

Differential Revision: https://phabricator.services.mozilla.com/D155710
2022-08-30 17:05:56 +00:00
Oriol Brufau
82f0d6bf01 Bug 1784577 - Add logic for updating the last remembered size. r=emilio
Depends on D154575

Differential Revision: https://phabricator.services.mozilla.com/D152642
2022-08-21 23:27:22 +00:00
Oriol Brufau
1712e3695a Bug 1781046 - Add internal ResizeObserver for last remembered size. r=emilio
In a follow-up, it will take care of updating the last remembered size
as described in https://drafts.csswg.org/css-sizing-4/#last-remembered

Differential Revision: https://phabricator.services.mozilla.com/D154325
2022-08-12 15:06:43 +00:00
Oriol Brufau
35b0a2d5c4 Bug 1781046 - Make ResizeObserver::mCallback Variant. r=emilio
So that it can accept a callback function implemented in C++.

Analogous to what D61436 did for DOMIntersectionObserver.

Differential Revision: https://phabricator.services.mozilla.com/D154324
2022-08-12 15:06:42 +00:00
Cosmin Sabou
4195b1acdc Backed out 6 changesets (bug 1781046, bug 1784575) for pressumably causing Bug 1784591 and Bug 1784625. a=backout
Backed out changeset 84e0f04d939c (bug 1781046)
Backed out changeset 84228a1b82da (bug 1781046)
Backed out changeset a0574f6e88e1 (bug 1781046)
Backed out changeset 6dc8a407aa1f (bug 1781046)
Backed out changeset a3724891b9c9 (bug 1781046)
Backed out changeset 617f9a8b7512 (bug 1784575)
2022-08-19 23:37:15 +03:00
Oriol Brufau
eaa7bf5309 Bug 1781046 - Add internal ResizeObserver for last remembered size. r=emilio
In a follow-up, it will take care of updating the last remembered size
as described in https://drafts.csswg.org/css-sizing-4/#last-remembered

Differential Revision: https://phabricator.services.mozilla.com/D154325
2022-08-12 15:06:43 +00:00
Oriol Brufau
d89d19a97b Bug 1781046 - Make ResizeObserver::mCallback Variant. r=emilio
So that it can accept a callback function implemented in C++.

Analogous to what D61436 did for DOMIntersectionObserver.

Differential Revision: https://phabricator.services.mozilla.com/D154324
2022-08-12 15:06:42 +00:00
David Shin
26d1bbeafe Bug 1565557: ResizeObserver for SVG elements with CSS layout boxes use the layout boxes. r=emilio
As per the CSSWG resolution here: https://github.com/w3c/csswg-drafts/issues/4032
Previously, any and all SVG elements used its SVG object bounding box. Now, SVG
elements that have their own CSS layout box use them. These match the following
CSS rules: `svg:root, *:not(svg|*) > svg, svg|foreignObject > svg`

Differential Revision: https://phabricator.services.mozilla.com/D154246
2022-08-11 15:45:34 +00:00
Emilio Cobos Álvarez
2bc04ca6f4 Bug 1781268 - Clean up ResizeObserver error handling. r=Oriol
unobserve() never throws. observe() only threw on a case which should
never be reached (an already unlinked observer). We can assert and
return instead.

Differential Revision: https://phabricator.services.mozilla.com/D152769
2022-07-26 15:30:19 +00:00
David Shin
ef921cbe2d Bug 1774135 - ResizeObserver: Take subpixel snapping into account when reporting devicePixelContentBoxSize. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D151549
2022-07-15 17:45:36 +00:00
Emilio Cobos Álvarez
bbed19c82e Bug 1764977 - Downgrade an assertion that can break with very large sizes.
Differential Revision: https://phabricator.services.mozilla.com/D144005
2022-04-19 13:47:55 +00:00
Emilio Cobos Álvarez
a8ad1231ad Bug 1757443 - Correctly account for padding in ResizeObserver content-box size for scrollable frames. r=boris,layout-reviewers
See test.

Differential Revision: https://phabricator.services.mozilla.com/D141398
2022-03-18 02:20:01 +00:00
Emilio Cobos Álvarez
9ba188df39 Bug 1733042 - Use scrollport size rather than content-box size of scrollframes. r=boris
I don't really feel our behavior is particularly less correct than
Chromium since in our implementation an scrolling element has two boxes
rather than one, but in the interest of interop, and given developers
find it useful, it seems worth doing this.

Differential Revision: https://phabricator.services.mozilla.com/D139551
2022-02-24 17:00:35 +00:00
Butkovits Atila
797bc378d0 Backed out changeset 9784a06a9b54 (bug 1733042) for causing Android wpt failures at scrollbars.html. CLOSED TREE 2022-02-24 17:08:44 +02:00
Emilio Cobos Álvarez
852c92bef0 Bug 1733042 - Use scrollport size rather than content-box size of scrollframes. r=boris
I don't really feel our behavior is particularly less correct than
Chromium since in our implementation an scrolling element has two boxes
rather than one, but in the interest of interop, and given developers
find it useful, it seems worth doing this.

Differential Revision: https://phabricator.services.mozilla.com/D139551
2022-02-24 12:13:08 +00:00
Butkovits Atila
5d6155039d Backed out changeset 623c4391875a (bug 1733042) for causing wpt failures at scrollbars.html. CLOSED TREE 2022-02-24 09:07:26 +02:00
Emilio Cobos Álvarez
47e90e9061 Bug 1733042 - Use scrollport size rather than content-box size of scrollframes. r=boris
I don't really feel our behavior is particularly less correct than
Chromium since in our implementation an scrolling element has two boxes
rather than one, but in the interest of interop, and given developers
find it useful, it seems worth doing this.

Differential Revision: https://phabricator.services.mozilla.com/D139551
2022-02-23 23:58:41 +00:00
Emilio Cobos Álvarez
5481ccb748 Bug 1754579 - Don't keep so much alive when returning DOMRects & co. r=smaug
We keep the parent alive for wrapping. It's unnecessary to keep alive
the individual element / range / etc. Pass the relevant global /
document.

Differential Revision: https://phabricator.services.mozilla.com/D138357
2022-02-10 00:38:45 +00:00
Boris Chiou
c108083168 Bug 1587973 - Part 4: Rename GetTargetSize with CalculateBoxSize. r=emilio
Use the same name as the spec title for better readability:
https://www.w3.org/TR/resize-observer-1/#calculate-box-size

Differential Revision: https://phabricator.services.mozilla.com/D121158
2021-08-10 21:03:31 +00:00
Boris Chiou
83303355be Bug 1587973 - Part 3: Support device-pixel-content-box for ResizeObserver. r=emilio
This patch implements device-pixel-content-box for ResizeObserver.
GetTargetSize() returns CSS pixels for {border|content}-box, or device
pixels for device-pixel-content-box. We round the device pixel to
integral based on the spec,
https://drafts.csswg.org/resize-observer/#calculate-box-size.
And then we compare the current calculated box sizes and the last updated one
in IsActive().

Besides, the current wpts only use zoom property to verify this, but zoom
property is non-standard and we doesn't supports it, so now we only test the
getter functions for device-pixel-content-box and the subpixel snapping
algorithm (e.g. devicepixel.html) for Gecko in wpts.

Differential Revision: https://phabricator.services.mozilla.com/D120776
2021-08-10 21:03:31 +00:00
Boris Chiou
f095067d64 Bug 1587973 - Part 2: Introduce LogicalPixelSize for ResizeObserver. r=emilio
LogicalPixelSize is a variant of LogicalSize but it stores pixel values
in floating-point. Now we store LogicalPixelSize in ResizeObservation and
ResizeObserverSize. This makes us easier to introduce device-pixel-content-box.

Differential Revision: https://phabricator.services.mozilla.com/D121155
2021-08-10 21:03:31 +00:00
Boris Chiou
78ad157195 Bug 1587973 - Part 1: Use CSS pixels or device pixels in ResizeObserverSize. r=emilio
We will introduce device-pixel-content-box, which is in device-pixel
domain. Therefore, we convert the app units into CSS/device pixel when creating
ResizeObserverSize.

Differential Revision: https://phabricator.services.mozilla.com/D121016
2021-08-10 21:03:30 +00:00
Boris Chiou
d77bcd6eee Bug 1689099 - Schedule resize observers for the whole browsing context tree. r=emilio
It's possible to observe an element in the iframe while the
ResizeObserver object lives in the outer document, so we have to make
sure we also schedule the observer for all documents in the same
BrowsingContext tree.

Differential Revision: https://phabricator.services.mozilla.com/D119843
2021-08-09 19:48:13 +00:00
Boris Chiou
99c15723fc Bug 1599176 - Use sequence for borderBoxSize and contentBoxSize in ResizeObserverEntry. r=smaug,dholbert
Based on the spec, we should use FrozenArray for these two attributes.
However, we don't support FrozenArray in Gecko now, so use sequence.

spec: https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface

Differential Revision: https://phabricator.services.mozilla.com/D120276
2021-07-20 20:45:17 +00:00
Emilio Cobos Álvarez
06a3944b59 Bug 1717620 - ResizeObserverController shouldn't need to keep observers alive. r=smaug
The observers take care of unregistering when they need to. Instead,
make the ResizeObservation keep the element alive just like
nsMutationReceiver keeps the mutation observer alive.

Differential Revision: https://phabricator.services.mozilla.com/D118477
2021-07-09 09:29:18 +00:00
Marian-Vasile Laza
d04e4e8e73 Backed out changeset 5a4f865e6d5d (bug 1717620) for causing crashes in Bug 1718286. a=backout DONTBUILD 2021-06-26 00:37:43 +03:00
Emilio Cobos Álvarez
c90a335086 Bug 1717620 - ResizeObserverController shouldn't need to keep observers alive. r=smaug
The observers take care of unregistering when they need to. Instead,
make the ResizeObservation keep the element alive just like
nsMutationReceiver keeps the mutation observer alive.

Differential Revision: https://phabricator.services.mozilla.com/D118477
2021-06-24 15:01:05 +00:00
Simon Giesecke
7c075f27d9 Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Simon Giesecke
9d60f9c227 Bug 1691894 - Simplify uses of WithEntryHandle that only use OrInsert(With) by using GetOrInsertWith. r=xpcom-reviewers,necko-reviewers,jgilbert,nika
Differential Revision: https://phabricator.services.mozilla.com/D104676
2021-02-22 12:07:46 +00:00
Simon Giesecke
62523ac1b9 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D104203
2021-02-09 18:19:39 +00:00
Sylvestre Ledru
68b806d604 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
a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
8f709b39e8 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
longsonr
ba1943ecf8 Bug 1259861 - Move everything else into the mozilla namespace in layout/svg r=dholbert
Also: adjust include paths to be consistent for usages of various SVG headers,
and remove unused SVG includes (mostly for "utils" classes),
and drop stray "ns" from already-renamed SVG classes in various code comments.

Differential Revision: https://phabricator.services.mozilla.com/D83140
2020-07-11 02:20:20 +00:00
Simon Giesecke
9bcfd47601 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-13 14:38:48 +00:00
shindli
6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
d45525793f Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-12 17:24:41 +00:00
Emilio Cobos Álvarez
78ba15443d Bug 1599518 - Deregister ResizeObserver properly from disconnect(). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D54923
2019-11-27 17:52:17 +00:00