Commit Graph
89 Commits
Author SHA1 Message Date
Hiroyuki Ikezoe 4a9694dee4 Bug 1977511 - Use ScrollContainerFrame::UseOverlayScrollbars in ResizeObserver and ScrollbarAreaToExcludeFromCompositionBoundsFor. r=layout-reviewers,emilio
Most of the remaining call sites of nsPresContext::UseOverlayScrollbars
for scrollbar parts' frames will be replaced by a new function in the
next change.

Differential Revision: https://phabricator.services.mozilla.com/D281570
2026-03-27 04:32:14 +00:00
Cosmin Sabou a2d880fc9b Revert "Bug 1977511, Bug 2026430 - Guard mScrollbarActivity access with WeakFrame. r=emilio,layout-reviewers"
This reverts commit 0bc649e1df.

Revert "Bug 1977511 - Handle `::-webkit-scrollbar { display:none }` as if it's `scrollbar-width: none`. r=layout-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit fe392b1cd5.

Revert "Bug 1977511 - Add reftests for ::-webkit-scrollbar. r=layout-reviewers,emilio"

This reverts commit 1b6d4641c7.

Revert "Bug 1977511 - Disable overlay scrollbars if there's any non-zero width and height defined in ::-webkit-scrollbar. r=layout-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit 926eea5a10.

Revert "Bug 1977511 - Resolve ::-webkit-scrollbar pseudo element styles soon after the scroll container style was set. r=layout-reviewers,devtools-reviewers,firefox-style-system-reviewers,nchevobbe,emilio"

This reverts commit 8164020c76.

Revert "Bug 1977511 - Introduce nsLayoutUtils::UseOverlayScrollbars and use it in proper places instead of nsPresContext::UseOverlayScrollbars. r=layout-reviewers,emilio"

This reverts commit 8856d35471.

Revert "Bug 1977511 - Use ScrollContainerFrame::UseOverlayScrollbars in ResizeObserver and ScrollbarAreaToExcludeFromCompositionBoundsFor. r=layout-reviewers,emilio"

This reverts commit 5baba0ed09.
2026-03-27 02:33:00 +00:00
Hiroyuki Ikezoe 5baba0ed09 Bug 1977511 - Use ScrollContainerFrame::UseOverlayScrollbars in ResizeObserver and ScrollbarAreaToExcludeFromCompositionBoundsFor. r=layout-reviewers,emilio
Most of the remaining call sites of nsPresContext::UseOverlayScrollbars
for scrollbar parts' frames will be replaced by a new function in the
next change.

Differential Revision: https://phabricator.services.mozilla.com/D281570
2026-03-27 01:56:54 +00:00
Atila Butkovits a6cb0e6249 Revert "Bug 1977511 - Handle ::-webkit-scrollbar { display:none } as if it's scrollbar-width: none. r=layout-reviewers,firefox-style-system-reviewers,emilio" for causing a top crash in bug 2026487.
This reverts commit e7e66a8471.

Revert "Bug 1977511 - Add reftests for ::-webkit-scrollbar. r=layout-reviewers,emilio"

This reverts commit 1ef6a456dc.

Revert "Bug 1977511 - Disable overlay scrollbars if there's any non-zero width and height defined in ::-webkit-scrollbar. r=layout-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit 904febaca7.

Revert "Bug 1977511 - Resolve ::-webkit-scrollbar pseudo element styles soon after the scroll container style was set. r=layout-reviewers,devtools-reviewers,firefox-style-system-reviewers,nchevobbe,emilio"

This reverts commit b8f0d32cfb.

Revert "Bug 1977511 - Introduce nsLayoutUtils::UseOverlayScrollbars and use it in proper places instead of nsPresContext::UseOverlayScrollbars. r=layout-reviewers,emilio"

This reverts commit 0694ea2bf8.

Revert "Bug 1977511 - Use ScrollContainerFrame::UseOverlayScrollbars in ResizeObserver and ScrollbarAreaToExcludeFromCompositionBoundsFor. r=layout-reviewers,emilio"

This reverts commit 19303dead1.
2026-03-26 08:05:45 +00:00
Hiroyuki Ikezoe 19303dead1 Bug 1977511 - Use ScrollContainerFrame::UseOverlayScrollbars in ResizeObserver and ScrollbarAreaToExcludeFromCompositionBoundsFor. r=layout-reviewers,emilio
Most of the remaining call sites of nsPresContext::UseOverlayScrollbars
for scrollbar parts' frames will be replaced by a new function in the
next change.

Differential Revision: https://phabricator.services.mozilla.com/D281570
2026-03-25 15:43:19 +00:00
Leo TenenbaumandVincent Hilla 945274bbfc Bug 1819581 - Implement auto-sizes for lazy-loaded images. r=edgar,layout-reviewers,firefox-style-system-reviewers,emilio,vhilla
Co-authored-by: Vincent Hilla <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D281911
2026-03-20 15:37:13 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Emilio Cobos Álvarez 2b6a071f9a Bug 1967762 - Fix and test resizeobserver interaction with CSS zoom. r=jfkthame,layout-reviewers,dshin
The device pixel border-box size shouldn't be unzoomed.

Differential Revision: https://phabricator.services.mozilla.com/D251858
2025-05-31 18:18:05 +00:00
Ting-Yu Lin 5cd68a11de Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.

Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.

Differential Revision: https://phabricator.services.mozilla.com/D211496
2024-05-30 06:32:21 +00:00
Sebastian Hengst bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin 5d5204f810 Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.

Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.

Differential Revision: https://phabricator.services.mozilla.com/D211496
2024-05-28 04:46:20 +00:00
Frédéric Wang 85bb4cfc81 Bug 1880928 - Make ResizeObserver::mCallback a ResizeObserverCallback again. r=Oriol
Essentially reverting D154324 since we no longer need it to accept
internal callback functions.

Differential Revision: https://phabricator.services.mozilla.com/D202555
2024-02-29 08:50:57 +00:00
Frédéric Wang ea8819b5ee Bug 1880928 - Remove last remembered size observer, handle it in Document::DetermineProximityToViewportAndNotifyResizeObservers. r=emilio,layout-reviewers
The CSS Box Sizing specification indicates that last remembered sizes
are recorded "at the time that ResizeObserver events are determined and
delivered" [1].

In bug 1807253, we changed the implementation of when proximity to the
viewport of `content-visibility: auto` nodes are determined and of when
resize observations are broadcast, in order to align with the latest
version of the HTML specification [2]. We continue to use an internal
`Document::mLastRememberedSizeObserver` to update last remembered sizes
but it has been causing issues (e.g. bug 1867090 and bug 1880928) and
could be replaced by a direct update before broadcasting resize
observations.

This is what the current patch is doing. The elements currently observed
by `Document::mLastRememberedSizeObserver` are now stored on a
`Document::mElementsWithLastRememberedSize` hashset and a new function
`Document::UpdateLastRememberedSizes` is called before broadcasting
resize observations, and peforms the work of `LastRememberedSizeCallback`
and of `CalculateBoxSize` (with `aBox=Content_box`).

The only behavior change is in the `while(true)` loop from
`DetermineProximityToViewportAndNotifyResizeObservers`: at each step
we update the last remember sizes for elements of arbitrary depth, and
don't use these depths for calculating `shallowestTargetDepth`. This is
fine, since our `LastRememberedSizeCallback` only records current box
sizes without causing significant side effects (e.g. execution of
JavaScript code) that may require a relayout.

[1] https://drafts.csswg.org/css-sizing-4/#last-remembered
[2] https://html.spec.whatwg.org/#update-the-rendering

Differential Revision: https://phabricator.services.mozilla.com/D202571
2024-02-29 08:50:55 +00:00
Frederic Wang d696aeae2b Bug 1867090 - Don't deliver resize loop error notification for internal Last Remembered Size observer. r=emilio
This fixes regression from bug 1866894.
Also revert some code used to worked these undesired errors.

Differential Revision: https://phabricator.services.mozilla.com/D194876
2023-11-29 09:06:49 +00:00
Frederic Wang ddfb81b48e Bug 1807253 - unreliable timing for content-visibility:auto, r=emilio
Rewrite implementation of content-visibility: auto as defined in
https://github.com/w3c/csswg-drafts/issues/8542

Differential Revision: https://phabricator.services.mozilla.com/D170394
2023-11-27 08:26:46 +00:00
Emilio Cobos Álvarez c27730d3df Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
Gregory Pappas a96316eb4c Bug 1849934 - Remove dom.resize_observer.last_reported_size_invalid pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191572
2023-10-23 12:23:40 +00:00
Rob Buis c90ca1b9f3 Bug 1835813 - support contain-intrinsic-size: auto none r=Oriol,emilio,devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D182462
2023-07-11 18:23:26 +00:00
Iulian Moraru 3232c8d777 Backed out changeset e1b5dd2da037 (bug 1835813) for causing multiple failures. 2023-07-05 16:34:47 +03:00
Rob Buis f9438324f2 Bug 1835813 - support contain-intrinsic-size: auto none r=Oriol,emilio
Differential Revision: https://phabricator.services.mozilla.com/D182462
2023-07-05 11:48:16 +00:00
Andrew McCreight 188ac80e29 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +00:00
Oriol Brufau 8db8fdc72e Bug 1800955 - Update last remembered size when element is not skipping contents. r=emilio
Previously it was only updated when the element didn't have size
containment, but this could result in non-stable size when combining
'content-visibility: auto' and 'contain: size'.

Test auto-012.html is still failing since 'content-visibility: auto' has
not been implemented yet.

Differential Revision: https://phabricator.services.mozilla.com/D162254
2022-11-17 14:54:43 +00:00
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