Commit Graph
204 Commits
Author SHA1 Message Date
Daniel Holbert b9c26953f1 Bug 2044510: Pass already_AddRefed types by-value instead of by rvalue reference, in dom/base/. r=dom-core-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D304358
2026-06-05 21:06:35 +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 968fc5a645 Bug 2015924 - Centralize lazyload checks, and observe only while in document. r=smaug
Now that stuff is a bit more complex and that we're adding media lazy
loading, factor the observer management down to Element.

Make UnbindContext more parallel to BindContext while at it. This
allows the new calls to work regardless of whether they get called
before or after the base class's Bind/UnbindFromTree, which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D282723
2026-02-11 15:14:46 +00:00
David Shin c207b037eb Bug 2013975: Ensure that IntersectionObserver's descendant check takes continuations into account. r=layout-reviewers,emilio
`IntersectionObserver` makes sure that the observed target is a descendant of
the intersection root in the containing block chain [1]. Containing blocks
derive from boxes, which may consist of fragments [2] - So we should check
against all fragments.

[1]: https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo
[2]: https://drafts.csswg.org/css-display/#intro

Differential Revision: https://phabricator.services.mozilla.com/D281538
2026-02-03 00:34:42 +00:00
Emilio Cobos Álvarez b14ddfa78f Bug 2013439 - Use in-flow-rect-union for root frame too. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D281107
2026-01-30 21:45:59 +00:00
Emilio Cobos Álvarez 9ded204d1d Bug 1864794 - Use scrollMargin for image lazy loading. r=keithamus
Differential Revision: https://phabricator.services.mozilla.com/D277782
2026-01-03 12:25:56 +00:00
Emilio Cobos Álvarez cb259a9996 Bug 1999100 - Don't clip overflow by default on replaced images. r=jwatt
This implements overflow-clip-box: <visual-box>, and uses it to allow
overflow on replaced elements.

Differential Revision: https://phabricator.services.mozilla.com/D274759
2025-12-10 09:40:55 +00:00
Serban Stanca 29933f495e Revert "Bug 1999100 - Don't clip overflow by default on replaced images. r=jwatt" for causing wpt failures in multicol-on-broken-image-alt-text.html.
This reverts commit ab74c24e55.
2025-12-10 01:38:55 +00:00
Emilio Cobos Álvarez ab74c24e55 Bug 1999100 - Don't clip overflow by default on replaced images. r=jwatt
This implements overflow-clip-box: <visual-box>, and uses it to allow
overflow on replaced elements.

Differential Revision: https://phabricator.services.mozilla.com/D274759
2025-12-09 22:22:14 +00:00
Sandor Molnar df1dba1932 Revert "Bug 1999100 - Don't clip overflow by default on replaced images. r=jwatt" for causing multiple failures
This reverts commit c95e29f358.
2025-12-08 15:46:13 +00:00
Emilio Cobos Álvarez c95e29f358 Bug 1999100 - Don't clip overflow by default on replaced images. r=jwatt
This implements overflow-clip-box: <visual-box>, and uses it to allow
overflow on replaced elements.

Differential Revision: https://phabricator.services.mozilla.com/D274759
2025-12-08 13:13:55 +00:00
Jan Varga b314d21751 Bug 1998365 - Rename nsCSSPropertyID to NonCustomCSSPropertyId and normalize ID naming; r=emilio,firefox-style-system-reviewers,layout-reviewers
nsCSSPropertyID only enumerates non custom properties, but the name suggests
otherwise. (eCSSPropertyExtra_variable only signals a custom property and does
not carry the custom name.) This mismatch has been confusing and also blocks
renaming AnimatedPropertyID to CSSPropertyId.

This patch renames nsCSSPropertyID to NonCustomCSSPropertyId to make the non
custom scope explicit. It also normalizes identifier naming (aPropID ->
aPropId, mID -> mId, etc.) for consistency.

No behavior changes intended.

Potential follow-ups:
- Move the enum to the mozilla namespace.
- Convert the enum to an enum class.
- Rename nsCSSPropertyIDSet.

Differential Revision: https://phabricator.services.mozilla.com/D271443
2025-11-12 06:11:29 +00:00
Emilio Cobos Álvarez cb0e9ab3be Bug 1991410 - Don't apply intersection root rect clip to targets inside popups. r=tnikkel,layout-reviewers
Since they don't get clipped by the viewport.

Differential Revision: https://phabricator.services.mozilla.com/D266983
2025-10-01 15:25:47 +00:00
Narcis Beleuzu 77092b1d35 Revert "Bug 1991410 - Don't apply intersection root rect clip to targets inside popups. r=tnikkel,layout-reviewers" for causing failures on /test_largemenu.html
This reverts commit a2b278de91.
2025-10-01 13:08:59 +00:00
Emilio Cobos Álvarez a2b278de91 Bug 1991410 - Don't apply intersection root rect clip to targets inside popups. r=tnikkel,layout-reviewers
Since they don't get clipped by the viewport.

Differential Revision: https://phabricator.services.mozilla.com/D266983
2025-10-01 12:10:51 +00:00
Masayuki Nakano ee7ef731c9 Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio
The found frame may be covered by another frame.  However, current
implementation may use the covered frame as the target if it's the
nearest frame from the click/touch point.

A frame is covered by another frame means that web apps try to prevent
the users to click/tap the frame.  Therefore, current behavior may make
it possible to click/tap an element which is tried to hidden.  Thus,
current behavior may be not expected by both the web app developers and
the users.

This patch uses a part of intersection observer to get clipped border
box of a candidate frame.  So, if the frame is clipped by the
containers, the hidden region becomes not clickable/touchable.

NOTE: This backouts D67521 which is the patch for the test.  If the
resolution is not 1.0, it's fine to skip the midpoint tests on Android
because it's tested on the desktop platforms within the decimal world.

Differential Revision: https://phabricator.services.mozilla.com/D261223
2025-09-16 00:09:07 +00:00
Narcis Beleuzu 684357a96b Revert "Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio" for causing failures on test_event_target_radius.html
This reverts commit 884f38e5c4.
2025-09-09 07:53:38 +00:00
Masayuki Nakano 884f38e5c4 Bug 1983191 - Make PositionedEventTargeting use the nearest point in the frame region r=smaug,dom-core,layout-reviewers,emilio
The found frame may be covered by another frame.  However, current
implementation may use the covered frame as the target if it's the
nearest frame from the click/touch point.

A frame is covered by another frame means that web apps try to prevent
the users to click/tap the frame.  Therefore, current behavior may make
it possible to click/tap an element which is tried to hidden.  Thus,
current behavior may be not expected by both the web app developers and
the users.

This patch uses a part of intersection observer to get clipped border
box of a candidate frame.  So, if the frame is clipped by the
containers, the hidden region becomes not clickable/touchable.

Differential Revision: https://phabricator.services.mozilla.com/D261223
2025-09-09 06:29:30 +00:00
Emilio Cobos Álvarez 0123e62301 Bug 1984635 - Fix IntersectionObserver implicit root behavior on OOP iframes. r=layout-reviewers,dshin
aRootBounds is meaningless in that case, since it's the top level
viewport bounds, not the iframe's viewport bounds (which might be a lot
taller).

Differential Revision: https://phabricator.services.mozilla.com/D262575
2025-08-26 15:31:15 +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
Keith Cirkel b4008054a9 Bug 1971717 - Apply scrollMargin on rootBounds when input is implicit root r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D253477
2025-06-12 12:56:47 +00:00
Keith Cirkel a6c640c3ca Bug 1860030 - Implement scrollMargin for IntersectionObserver r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D252330
2025-06-04 09:56:12 +00:00
Keith Cirkel 9bf203f0ad Bug 1965030 - Add spec reference comments to IntersectionObserver code r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D248277
2025-05-08 10:54:13 +00:00
Steven Novaryo 59aed180b6 Bug 1946679 - Expose and rename style::value::specified::gecko::IntersectionObserverRootMargin. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D237514
2025-02-18 09:54:14 +00:00
Emilio Cobos Álvarez 1c4eb92d25 Bug 1917458 - Factor out remote effects update. r=mstange
No behavior change, just moving code around for the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D222095
2024-09-15 21:50:00 +00:00
Emilio Cobos Álvarez 0b3521ccca Bug 1891335 - Compute EffectInfo updates at IntersectionObserver time. r=smaug,hiro
What goes on here is that there's a couple of unfortunate style change
sequences which end up making us not do the EffectsInfo dance correctly.

Twitter uses (maybe didn't use to, which would explain the regression) a
visibility: hidden, out-of-flow iframe for a bit (which we correctly
throttle). But then they switch to an in-flow, visible, zero-height
iframe. That we should _not_ throttle. However, we end up not getting to
the display list code at all, because nsBlockFrame decides that we don't
need to descend into an empty line[1].

It seems less error prone to re-use the IntersectionObserver timing and
computation to determine whether the iframe is visible. That completely
matches in-process iframes, too.

Removing the empty frame border and putting them on an empty line in
dom/base/test/test_bug1639328.html is enough to reproduce the issue
without this patch.

[1]: https://searchfox.org/mozilla-central/rev/fe2743c6c5c708061c7f6504b26958fcc815bb4a/layout/generic/nsBlockFrame.cpp#7569-7579

Differential Revision: https://phabricator.services.mozilla.com/D207479
2024-09-06 16:04:57 +00:00
Stanca Serban d05e0c1dd0 Backed out changeset 80db8b7ff2af (bug 1891335) for causing mochitests failures in test_bug1639328.html. 2024-09-06 00:22:51 +03:00
Emilio Cobos Álvarez f20aebf2fc Bug 1891335 - Compute EffectInfo updates at IntersectionObserver time. r=smaug,hiro
What goes on here is that there's a couple of unfortunate style change
sequences which end up making us not do the EffectsInfo dance correctly.

Twitter uses (maybe didn't use to, which would explain the regression) a
visibility: hidden, out-of-flow iframe for a bit (which we correctly
throttle). But then they switch to an in-flow, visible, zero-height
iframe. That we should _not_ throttle. However, we end up not getting to
the display list code at all, because nsBlockFrame decides that we don't
need to descend into an empty line[1].

It seems less error prone to re-use the IntersectionObserver timing and
computation to determine whether the iframe is visible. That completely
matches in-process iframes, too.

Removing the empty frame border and putting them on an empty line in
dom/base/test/test_bug1639328.html is enough to reproduce the issue
without this patch.

[1]: https://searchfox.org/mozilla-central/rev/fe2743c6c5c708061c7f6504b26958fcc815bb4a/layout/generic/nsBlockFrame.cpp#7569-7579

Differential Revision: https://phabricator.services.mozilla.com/D207479
2024-09-05 17:16:12 +00:00
Emilio Cobos Álvarez bb2400428b Bug 1076583 - Make src attribute not load sync. r=smaug,extension-reviewers,devtools-reviewers,robwu,nchevobbe
This fixes src loads to be consistent with srcset/picture loads, modulo
the special synchronous case in the spec
(https://html.spec.whatwg.org/#update-the-image-data step 7), which
requires src loads to be sync if the image is available.

We now avoid triggering the load from the parser consistently for src /
srcset / picture, and unify the codepath with BindToTree. That should
avoid some useless task allocations.

Only the sync load code-path needs a script runner (mostly to deal with
anonymous content like the video poster <img> and such, but it also
helps not trigger sync loads at unexpected times like on adoption).

About the HTMLImageElement::Complete() getter change, we need to also
return false if there's an existing load task. That is the proposal in
https://github.com/whatwg/html/issues/4884, and prevents some failures
in the-img-element/{update-src-complete,img.complete}.html WPTs. It
technically changes our behavior on .srcset changes, but it makes it
consistent with .src changes and other browsers, so seems fine.

There are a couple regressions in CSP tests and the networkEvent stubs,
but these are really a pre-existing issue. What happens is that, since
the loads are now async, CSP can't figure out the script that triggered
the load anymore. I need to look if there's an easy way to propagate
that information in the image load tasks, but this is trivially
reproducible by changing these tests to use srcset rather than src.

The rest of the test changes are as expected: either new passes, or
expected test changes from this.

Differential Revision: https://phabricator.services.mozilla.com/D215519
2024-08-05 12:23:44 +00:00
Emilio Cobos Álvarez 9b231b189e Bug 1788504 - Account for current dynamic toolbar state in IntersectionObserver. r=emilio
Chrome uses bimodal layout viewport for IntersectionObserver;

a) While the dynamic toolbar is visible, Chrome uses the layout viewport
   (which doesn't include the dynamic toolbar area)
b) While the dynamic toolbar is completely hidden, Chrome uses the layout
  viewport + the height that the dynamic toolbar was originally occupied.

In this change we align the behavior with Chrome's behavior.

Differential Revision: https://phabricator.services.mozilla.com/D212920
2024-07-18 07:08:16 +00:00
Emilio Cobos Álvarez e132baba5a Bug 1905675 - Clean up IntersectionObserver set-up. r=smaug
UpdateIntersectionObservation takes some time (see profile in blocked
bug). It it needs to do multiple hashmap lookups unnecessarily.

We can store the observation state in the IntersectionObserver object
and remove the bespoke intersectionobserverlist property, using
BindObject / UnbindObject to keep stuff alive, like ResizeObserver and
MutationObserver do.

Differential Revision: https://phabricator.services.mozilla.com/D215370
2024-07-02 19:08:06 +00:00
Ting-Yu Lin 8d546a2fd5 Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-30 17:58:25 +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
Ting-Yu Lin 9ff564d485 Bug 1896516 Part 7 - Remove PresShell::GetRootScrollFrameAsScrollable(). r=layout-reviewers,emilio
`PresShell::GetRootScrollFrameAsScrollable()` is equivalent to
`PresShell::GetRootScrollContainerFrame()`.

In ScrollContainerFrame.h, `DecideScrollableLayer()` has two versions, one has
four parameters, and the other has five parameters with the fifth parameter
`aDirtyRectHasBeenOverriden` having a default value `nullptr`. When we switch
the caller from `nsIScrollableFrame` to `ScrollContainerFrame`, we need to
remove the default value for the fifth parameter to avoid ambiguity.

Differential Revision: https://phabricator.services.mozilla.com/D211494
2024-05-30 06:32:20 +00:00
Ting-Yu Lin 14aebc5bf9 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-30 06:32:17 +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
Sebastian Hengst 18041c50bb Backed out 2 changesets (bug 1899345) for conflicting with backout of bug 1896516
Backed out changeset b96c165e9ab4 (bug 1899345)
Backed out changeset 01a540f73690 (bug 1899345)
2024-05-29 11:21:39 +02:00
Ting-Yu Lin 5644682c09 Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-29 05:10:38 +00:00
Stanca Serban 60109eeb45 Backed out 2 changesets (bug 1899345) for causing android build bustages in ScrollContainerFrame.cpp. CLOSED TREE
Backed out changeset ccb2ccbef46e (bug 1899345)
Backed out changeset 6f66d112b450 (bug 1899345)
2024-05-29 03:49:38 +03:00
Ting-Yu Lin 940c33226a Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-29 00:17:58 +00: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
Ting-Yu Lin 5ac7609fac Bug 1896516 Part 7 - Remove PresShell::GetRootScrollFrameAsScrollable(). r=layout-reviewers,emilio
`PresShell::GetRootScrollFrameAsScrollable()` is equivalent to
`PresShell::GetRootScrollContainerFrame()`.

In ScrollContainerFrame.h, `DecideScrollableLayer()` has two versions, one has
four parameters, and the other has five parameters with the fifth parameter
`aDirtyRectHasBeenOverriden` having a default value `nullptr`. When we switch
the caller from `nsIScrollableFrame` to `ScrollContainerFrame`, we need to
remove the default value for the fifth parameter to avoid ambiguity.

Differential Revision: https://phabricator.services.mozilla.com/D211494
2024-05-28 04:46:19 +00:00
Ting-Yu Lin 6f6e711315 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-28 04:46:16 +00:00
Ting-Yu Lin 27bb908f13 Bug 1824877 Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame. r=dholbert
Also, change the ScrollContainerFrame::GetFrameName() to return
"ScrollContainer" instead of "HTMLScroll".

Differential Revision: https://phabricator.services.mozilla.com/D210233
2024-05-15 17:50:48 +00:00
Ting-Yu Lin 5604d30ede Bug 1488080 Part 1 - Convert GetAllInFlowRects flags to EnumSet. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D209096
2024-05-03 18:42:41 +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
Natalia Csoregi 9e23519bf8 Backed out changeset 20a5c1f3b35e (bug 1807253) for causing failures on content-visibility-continuations-crash.html. CLOSED TREE 2023-11-22 16:12:27 +02:00
Frederic Wang 28dfc50a7f 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-22 13:00:36 +00:00
Cathie Chen 4f18bf0a7a Bug 1668136 - Set visible the content relevancy of an element with content-visibility:auto if its descendant is called scrollIntoView, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D186943
2023-11-03 15:37:29 +00:00
Sean Feng 2d6e584e05 Bug 1722322 - Implement LargestContentfulPaint r=emilio
Spec: https://w3c.github.io/largest-contentful-paint

Differential Revision: https://phabricator.services.mozilla.com/D151079
2023-11-02 20:53:36 +00:00