Commit Graph
114 Commits
Author SHA1 Message Date
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Hiroyuki Ikezoe 3133ec1e57 Bug 1837436 - Make WantAsync() return true for non default overscroll-behavior scroll containers. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D275711
2026-03-06 07:23:22 +00:00
Serban Stanca 55cf627f17 Revert "Bug 1837436 - Respect overscroll-behavior on overflow:hidden scroll container. r=dlrobertson,layout-reviewers,emilio" for causing wpt failures in overscroll-behavior-without-overflow.html.
This reverts commit e00e849717.

This reverts commit 46d161f9d9.
2026-03-06 05:49:51 +00:00
Hiroyuki Ikezoe 46d161f9d9 Bug 1837436 - Make WantAsync() return true for non default overscroll-behavior scroll containers. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D275711
2026-03-06 04:16:13 +00:00
Timothy Nikkel 51cc426eea Bug 2008698. Don't hold an entry in the AsyncScrollsWithAnchorHashmap hash table while we can modify the hashtable elsewhere. r=hiro,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D278067
2026-01-08 04:43:10 +00:00
Lando d2c9637c10 Bug 2003843, 2004833: apply code formatting via Lando
# ignore-this-changeset
2025-12-12 00:13:35 +00:00
Timothy Nikkel 1cc7bc843d Bug 2004833. Use scroll-linked-effects code for anchor pos scrolling we can't represent as async scrolling to improve experience. r=hiro,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275542
2025-12-12 00:13:20 +00:00
Timothy Nikkel 4ccd058d0f Bug 2003843. Handle the transform case and one-axis case of async scrolling with CSS anchor pos. r=hiro,layout-reviewers
If we have an anchor that is transformed, then if we assign the ASR of the anchor to the anchored content, that means the anchored content will get the same spatial node in web render as the anchor, that means web render will draw it as if it is also transformed. This is not correct. In order to not render incorrectly in this case we disable async scrolling with the anchor in this case. It will still scroll with the anchor, just without the benefit of async scrolling (ie the main thread updates it).

In order to avoid this we keep track on the nsDisplayListBuilder whether a frame async scrolls with its anchor or not. We don't try to do any tracking outside of painting. This seems okay because outside of painting we only use this information for activating display ports, and async scrolling with the anchor only inserts more frames in the ASR/async scrollable frame ancestor chain. We clear the information on the nsDisplayListBuilder after every frame. RDL is already disabled when anchor pos async scroll is happening so we don't have to worry about any invalidations.

This then requires an extra walk of the same frames that ActivateDisplayportOnASRAncestors will walk over later. And further, we might have to recurse if we have chained anchors and walk them again. Minimizing this walk seems too complicated. Chained anchors shouldn't be common, if we are walking these frames they should be in the cpu's cache.

We have to create yet another function that walks over ASRs (ShouldAsyncScrollWithAnchorNotCached), because we need to check each individual frame that is walked for being transformed (the existing users don't need this level of granularity).

Since it's only a bit more code this patch also fixes bug 2003845, which exists because ASRs can only scroll in both axis, but anchor pos sometimes only scrolls in one axis with its anchor. If we encounter this case, and a scroll frame for which this would actually make a difference we disable async scroll as well.

Differential Revision: https://phabricator.services.mozilla.com/D275453
2025-12-12 00:13:17 +00:00
Alexandru Marc 3611b9aebd Revert (Bug 2004833, Bug 2003843) for causing non-unified build bustages @ nsIFrame
This reverts commit 21344205d1.

Revert "Bug 2003843. Handle the transform case and one-axis case of async scrolling with CSS anchor pos. r=hiro,layout-reviewers"

This reverts commit c1b9aa572b.
2025-12-11 23:55:34 +00:00
Timothy Nikkel 21344205d1 Bug 2004833. Use scroll-linked-effects code for anchor pos scrolling we can't represent as async scrolling to improve experience. r=hiro,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D275542
2025-12-11 22:24:50 +00:00
Timothy Nikkel c1b9aa572b Bug 2003843. Handle the transform case and one-axis case of async scrolling with CSS anchor pos. r=hiro,layout-reviewers
If we have an anchor that is transformed, then if we assign the ASR of the anchor to the anchored content, that means the anchored content will get the same spatial node in web render as the anchor, that means web render will draw it as if it is also transformed. This is not correct. In order to not render incorrectly in this case we disable async scrolling with the anchor in this case. It will still scroll with the anchor, just without the benefit of async scrolling (ie the main thread updates it).

In order to avoid this we keep track on the nsDisplayListBuilder whether a frame async scrolls with its anchor or not. We don't try to do any tracking outside of painting. This seems okay because outside of painting we only use this information for activating display ports, and async scrolling with the anchor only inserts more frames in the ASR/async scrollable frame ancestor chain. We clear the information on the nsDisplayListBuilder after every frame. RDL is already disabled when anchor pos async scroll is happening so we don't have to worry about any invalidations.

This then requires an extra walk of the same frames that ActivateDisplayportOnASRAncestors will walk over later. And further, we might have to recurse if we have chained anchors and walk them again. Minimizing this walk seems too complicated. Chained anchors shouldn't be common, if we are walking these frames they should be in the cpu's cache.

We have to create yet another function that walks over ASRs (ShouldAsyncScrollWithAnchorNotCached), because we need to check each individual frame that is walked for being transformed (the existing users don't need this level of granularity).

Since it's only a bit more code this patch also fixes bug 2003845, which exists because ASRs can only scroll in both axis, but anchor pos sometimes only scrolls in one axis with its anchor. If we encounter this case, and a scroll frame for which this would actually make a difference we disable async scroll as well.

Differential Revision: https://phabricator.services.mozilla.com/D275453
2025-12-11 22:24:47 +00:00
Timothy Nikkel ed0af44645 Bug 2004600. Change how iteration is done by OneStepInASRChain/GetASRAncestorFrame to fix a bug where sticky frames can be skipped over. r=botond,hiro,layout-reviewers
The bug we are trying to fix is that OneStepInASRChain will always walk to the parent after it's while loop walking the anchor chain, potentially missing a sticky asr at the end of the anchor chain. But we can't just return the end of the anchor chain because we want to only consider it for sticky ASRs, not scroll ASRs. So we need to change these functions so that we can express that with the return value. So we change OneStepInASRChain and GetASRAncestorFrame to operate on FrameAndASRKind.

Differential Revision: https://phabricator.services.mozilla.com/D275376
2025-12-09 08:41:23 +00:00
Timothy Nikkel 1b1577cc4a Bug 2004591. Move to nsLayoutUtils::GetASRAncestorFrame to DisplayPortUtils and separate it from GetNearestScrollableOrOverflowClipFrame in nsLayoutUtils. r=hiro,layout-reviewers
I want to make a bug fix that changes the return type of GetASRAncestorFrame and OneStepInASRChain to (ASRKind, frame) so that the relation of scroll and sticky ASRs can better be represented in these functions. Trying to shoe horn all these different behaviour into one function is getting kind of complicated.

I also took the opportunity to move OneStepInAsyncScrollableAncestorChain, OneStepInASRChain, and GetASRAncestorFrame into the same place in DisplayPortUtils by ActivateDisplayportOnASRAncestors so that all this similar code is in the same place.

Differential Revision: https://phabricator.services.mozilla.com/D275373
2025-12-08 04:50:13 +00:00
Lando 5d654d5821 Bug 1988030, 1988032: apply code formatting via Lando
# ignore-this-changeset
2025-11-26 13:58:38 +00:00
Timothy Nikkel 827aa14e00 Bug 1988030. Create a function that activates and creates ASRs for scrollframes of the anchor of anchored content. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,botond,emilio
This is the most complicated and intricate patch in this series.

We want to assign the ASR of the anchor to the anchored content. But there is no painting relationship between them. Meaning that BuildDisplayList for the anchor might be called before or after BuildDisplayList for the anchored content.

If BuildDisplayList is called for the anchor before the anchored content we want to make sure that any scroll frames containing the anchor are activated. This is easy on desktop as all scroll frames that want it are activated. But on android we don't do that yet. That's where bug 1995759 comes in to activate all scroll frames when anchor pos is used.

If BuildDisplayList is called for the anchor after the anchored content then we want to activate any scroll frames containing the anchor during the BuildDisplayList call for the anchored content. That's one of the main things that this patch does. We create a new function DecideScrollableLayerEnsureDisplayport that always set a minimal display port to do that for us (it's a simplified version of DecideScrollableLayer).

Then we use our knowledge that the anchor is in the containing block of the anchored content to walk the scroll frame ancestors of the anchor until we reach the anchored content's containing block. Once we've collected all the scroll frames we can create the ASR structs.

Differential Revision: https://phabricator.services.mozilla.com/D271806
2025-11-26 13:58:07 +00:00
Timothy Nikkel 1d3aea8286 Bug 1988030. Allow passing a limit ancestor to DisplayPortUtils::OneStepInASRChain that we don't walk past. r=hiro,layout-reviewers
With CSS anchor pos we know that the anchor is in the containing block of the anchored content. We use that to limit a walk up the frame tree in subsequent patches and make the computation simpler. So we need OneStepInASRChain to obey that limit too.

Differential Revision: https://phabricator.services.mozilla.com/D271804
2025-11-26 13:58:04 +00:00
Timothy Nikkel 5b42ac4317 Bug 1988030. Create nsLayoutUtils::GetASRAncestorFrame and OneStepInASRChain that walks only scroll frames that are currently async scrollable in the ASR order. r=botond,hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio
In subsequent patches we need to match the ASR tree which is different from the "async scrollable ancestor chain", so we need these functions.

WantAsyncScroll and mWillBuildScrollableLayer are completely independent of each other, ie it's possible to have all four combinations of them being true/false.

ASR's don't walked from fixed pos to root scroll frame, that behaviour is for other reasons that don't apply to ASRs.

Differential Revision: https://phabricator.services.mozilla.com/D271805
2025-11-26 13:58:02 +00:00
Timothy Nikkel 3a7c8be81f Bug 1988030. Adjust DisplayPortUtils::OneStepInAsyncScrollableAncestorChain to be CSS anchor pos aware. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio
We want to assign the ASR of the anchor to the anchored content. That means we are changing the ASR chain so we need to adjust the functions that walk the async scrollable ancestors chain. In this patch we adjust DisplayPortUtils::OneStepInAsyncScrollableAncestorChain.

Differential Revision: https://phabricator.services.mozilla.com/D271802
2025-11-26 13:57:59 +00:00
Alexandru Marc b75b0abc10 Revert (Bug 1988032, Bug 1988030) for causing build bustages @ DisplayPortUtils.cpp
This reverts commit 8244ecad8b.

Revert "Bug 1988032. Disable RDL if are there active CSS anchor pos. r=layout-reviewers,emilio"

This reverts commit 9063b3c208.

Revert "Bug 1988032. Don't async scroll with anchors if there is an active view transition. r=layout-reviewers,emilio"

This reverts commit 472901d513.

Revert "Bug 1988030. Detect and reject an anchor that is outside of the positioned frame's containing block. r=layout-reviewers,emilio"

This reverts commit 237e8563f6.

Revert "Bug 1988032. Add a pref to control async scroll of CSS anchor positioned content. r=layout-reviewers,hiro"

This reverts commit 98d14e2dc8.

Revert "Bug 1988032. Add some basic anchor pos plus async scroll reftests. r=hiro,layout-reviewers"

This reverts commit 7165d46e3b.

Revert "Bug 1988032. Assign the ASR of the anchor to the anchored content. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio"

This reverts commit cb45424f42.

Revert "Bug 1988030. Create a function that activates and creates ASRs for scrollframes of the anchor of anchored content. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,botond,emilio"

This reverts commit 1816a3d49c.

Revert "Bug 1988030. Allow passing a limit ancestor to DisplayPortUtils::OneStepInASRChain that we don't walk past. r=hiro,layout-reviewers"

This reverts commit 7cd59a61c6.

Revert "Bug 1988030. Create nsLayoutUtils::GetASRAncestorFrame and OneStepInASRChain that walks only scroll frames that are currently async scrollable in the ASR order. r=botond,hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio"

This reverts commit e53645f574.

Revert "Bug 1988030. Adjust DisplayPortUtils::OneStepInAsyncScrollableAncestorChain to be CSS anchor pos aware. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio"

This reverts commit e7619a7efc.

Revert "Bug 1988030. Adjust nsLayoutUtils::GetAsyncScrollableAncestorFrame to be CSS anchor pos aware. r=layout-reviewers,layout-anchor-positioning-reviewers,hiro,emilio"

This reverts commit 537725a5c4.
2025-11-26 13:41:25 +00:00
Timothy Nikkel 1816a3d49c Bug 1988030. Create a function that activates and creates ASRs for scrollframes of the anchor of anchored content. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,botond,emilio
This is the most complicated and intricate patch in this series.

We want to assign the ASR of the anchor to the anchored content. But there is no painting relationship between them. Meaning that BuildDisplayList for the anchor might be called before or after BuildDisplayList for the anchored content.

If BuildDisplayList is called for the anchor before the anchored content we want to make sure that any scroll frames containing the anchor are activated. This is easy on desktop as all scroll frames that want it are activated. But on android we don't do that yet. That's where bug 1995759 comes in to activate all scroll frames when anchor pos is used.

If BuildDisplayList is called for the anchor after the anchored content then we want to activate any scroll frames containing the anchor during the BuildDisplayList call for the anchored content. That's one of the main things that this patch does. We create a new function DecideScrollableLayerEnsureDisplayport that always set a minimal display port to do that for us (it's a simplified version of DecideScrollableLayer).

Then we use our knowledge that the anchor is in the containing block of the anchored content to walk the scroll frame ancestors of the anchor until we reach the anchored content's containing block. Once we've collected all the scroll frames we can create the ASR structs.

Differential Revision: https://phabricator.services.mozilla.com/D271806
2025-11-26 13:07:23 +00:00
Timothy Nikkel 7cd59a61c6 Bug 1988030. Allow passing a limit ancestor to DisplayPortUtils::OneStepInASRChain that we don't walk past. r=hiro,layout-reviewers
With CSS anchor pos we know that the anchor is in the containing block of the anchored content. We use that to limit a walk up the frame tree in subsequent patches and make the computation simpler. So we need OneStepInASRChain to obey that limit too.

Differential Revision: https://phabricator.services.mozilla.com/D271804
2025-11-26 13:07:20 +00:00
Timothy Nikkel e53645f574 Bug 1988030. Create nsLayoutUtils::GetASRAncestorFrame and OneStepInASRChain that walks only scroll frames that are currently async scrollable in the ASR order. r=botond,hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio
In subsequent patches we need to match the ASR tree which is different from the "async scrollable ancestor chain", so we need these functions.

WantAsyncScroll and mWillBuildScrollableLayer are completely independent of each other, ie it's possible to have all four combinations of them being true/false.

ASR's don't walked from fixed pos to root scroll frame, that behaviour is for other reasons that don't apply to ASRs.

Differential Revision: https://phabricator.services.mozilla.com/D271805
2025-11-26 13:07:18 +00:00
Timothy Nikkel e7619a7efc Bug 1988030. Adjust DisplayPortUtils::OneStepInAsyncScrollableAncestorChain to be CSS anchor pos aware. r=hiro,layout-reviewers,layout-anchor-positioning-reviewers,emilio
We want to assign the ASR of the anchor to the anchored content. That means we are changing the ASR chain so we need to adjust the functions that walk the async scrollable ancestors chain. In this patch we adjust DisplayPortUtils::OneStepInAsyncScrollableAncestorChain.

Differential Revision: https://phabricator.services.mozilla.com/D271802
2025-11-26 13:07:15 +00:00
Timothy Nikkel ecbb808717 Bug 1998812. OneStepInAsyncScrollableAncestorChain should stop at menu popups like GetAsyncScrollableAncestorFrame. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D271696
2025-11-11 05:05:31 +00:00
Timothy Nikkel ec13ac6239 Bug 1998812. Make the same fix to OneStepInAsyncScrollableAncestorChain that bug 1995752 did for GetAsyncScrollableAncestorFrame. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D271695
2025-11-11 05:05:29 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Timothy Nikkel 35b47211b6 Bug 1971516. Avoid re-allocating display port base rect every time we set it. r=hiro
Calling SetProperty is the property exists actually destroys the existing property value and allocates a new one, so we should avoid it. I saw this show up in a profile (althought as a small percent).

Differential Revision: https://phabricator.services.mozilla.com/D253322
2025-06-12 01:09:12 +00:00
Hiroyuki Ikezoe 7ffcfacad0 Bug 1729811 - Make GetDisplayportAlignmentMultiplier function continuous rather than descrete. r=tnikkel
With the change, displayport size now monotonic increasing depending on
the composition size.

Differential Revision: https://phabricator.services.mozilla.com/D245181
2025-05-30 11:11:36 +00:00
Alexandru Marc 053c2efc4e Revert "Bug 1729811 - Make GetDisplayportAlignmentMultiplier function continuous rather than descrete. r=tnikkel" for causing gtest failures @ APZCPanningTester
This reverts commit 34d737f6d2.
2025-05-29 09:30:25 +00:00
Hiroyuki Ikezoe 34d737f6d2 Bug 1729811 - Make GetDisplayportAlignmentMultiplier function continuous rather than descrete. r=tnikkel
With the change, displayport size now monotonic increasing depending on
the composition size.

Differential Revision: https://phabricator.services.mozilla.com/D245181
2025-05-29 08:29:41 +00:00
Timothy Nikkel 52a4fe76a4 Bug 1966348. When walking the async scrollable ancestor chain make sure to walk from fixed position to root scroll frame. r=botond
This is what GetAsyncScrollableAncestorFrame does.

Differential Revision: https://phabricator.services.mozilla.com/D250131
2025-05-28 11:24:42 +00:00
Timothy Nikkel e711d00dc6 Bug 1961722. Make SetZeroMarginDisplayPortOnAsyncScrollableAncestors follow the parent chain like all other related code. r=botond
In https://hg-edge.mozilla.org/integration/autoland/rev/4681951d59b7 from bug 1379458 we made GetAsyncScrollableAncestorFrame no longer follow from oof to placeholder as part of a larger change moving away from following placeholders. However SetZeroMarginDisplayPortOnAsyncScrollableAncestors uses GetAsyncScrollableAncestorFrame but still has a GetParentOrPlaceholderForCrossDoc call in it. Looking at all the callers of SetZeroMarginDisplayPortOnAsyncScrollableAncestors they all set a display port on the passed in frame and then call SetZeroMarginDisplayPortOnAsyncScrollableAncestors so it does not seem like they would want some kind of special behaviour here, ie following the normal paint chain looks the what we want here like everywhere else.

I also checked the other GetParentOrPlaceholder calls, they don't seem to suffer from this problem (ie they seem fine).

Differential Revision: https://phabricator.services.mozilla.com/D246168
2025-05-28 11:24:38 +00:00
Cristina Horotan ca0bd4918b Revert "Bug 1961722. Make SetZeroMarginDisplayPortOnAsyncScrollableAncestors follow the parent chain like all other related code. r=botond" on request
This reverts commit a69867dc79.
2025-05-24 10:22:21 +00:00
Timothy Nikkel a69867dc79 Bug 1961722. Make SetZeroMarginDisplayPortOnAsyncScrollableAncestors follow the parent chain like all other related code. r=botond
In https://hg-edge.mozilla.org/integration/autoland/rev/4681951d59b7 from bug 1379458 we made GetAsyncScrollableAncestorFrame no longer follow from oof to placeholder as part of a larger change moving away from following placeholders. However SetZeroMarginDisplayPortOnAsyncScrollableAncestors uses GetAsyncScrollableAncestorFrame but still has a GetParentOrPlaceholderForCrossDoc call in it. Looking at all the callers of SetZeroMarginDisplayPortOnAsyncScrollableAncestors they all set a display port on the passed in frame and then call SetZeroMarginDisplayPortOnAsyncScrollableAncestors so it does not seem like they would want some kind of special behaviour here, ie following the normal paint chain looks the what we want here like everywhere else.

I also checked the other GetParentOrPlaceholder calls, they don't seem to suffer from this problem (ie they seem fine).

Differential Revision: https://phabricator.services.mozilla.com/D246168
2025-05-05 09:44:15 +00:00
Timothy Nikkel 6113108228 Bug 1936189. Only do -moz-subtree-hidden-only-visually checks in the parent process. r=layout-reviewers,emilio
This is a chrome only css property (so it could still be used in a UA sheet that is applied to a content document) that was created solely to tabs/xul decks in a fashion that is more like the rest of css/html. And it still only has that single use in our tree. A UA sheet applying this property to content it doesn't control doesn't seem like it could be very useful.

Even those these checks are simple they are relatively costly because we check them on every frame and when we are traversing the frame tree (for display list building or setting a displayport) we are often memory bound, so pulling in another bit of otherwise cold memory for a rare style struct makes us wait for loading more memory and pushes more useful stuff out of caches. The parent process check remains very quick as verified by profiling.

Differential Revision: https://phabricator.services.mozilla.com/D231648
2025-04-08 00:26:08 +00:00
Hiroyuki Ikezoe bb2eff348f Bug 1682629 - Enable apz for Panel/Menu popups. r=botond,emilio
Differential Revision: https://phabricator.services.mozilla.com/D230880
2024-12-17 07:40:31 +00:00
Hiroyuki Ikezoe 423585c371 Bug 1936957 - Avoid a redundant GetProperty(nsGkAtoms::DisplayPortMargins) call in HasNonMinimalNonZeroDisplayPort. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D232024
2024-12-13 07:54:00 +00:00
Timothy Nikkel a5ec118f77 Bug 1936288. Avoid getting the display port another time in ScrollContainerFrame::BuildDisplayList. r=hiro
This sometimes shows up in profiles, so avoid getting the displayport when we have that info already.

Differential Revision: https://phabricator.services.mozilla.com/D231686
2024-12-12 08:11:14 +00:00
Alexandru Marc a090fc9187 Backed out changeset 5f819082a015 (bug 1936189) for causing reftest failures @ native-theme/470711-1.xhtml CLOSED TREE 2024-12-11 14:59:54 +02:00
Timothy Nikkel 8c283349ba Bug 1936189. Only do -moz-subtree-hidden-only-visually checks in the parent process. r=layout-reviewers,emilio
This is a chrome only css property (so it could still be used in a UA sheet that is applied to a content document) that was created solely to tabs/xul decks in a fashion that is more like the rest of css/html. And it still only has that single use in our tree. A UA sheet applying this property to content it doesn't control doesn't seem like it could be very useful.

Even those these checks are simple they are relatively costly because we check them on every frame and when we are traversing the frame tree (for display list building or setting a displayport) we are often memory bound, so pulling in another bit of otherwise cold memory for a rare style struct makes us wait for loading more memory and pushes more useful stuff out of caches. The parent process check remains very quick as verified by profiling.

Differential Revision: https://phabricator.services.mozilla.com/D231648
2024-12-11 09:35:37 +00:00
Ting-Yu Lin 5cdee429ce Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-30 06:32:22 +00:00
Ting-Yu Lin 76523f97b1 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-30 06:32:20 +00:00
Ting-Yu Lin 19542ed32d Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-30 06:32:18 +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
Ting-Yu Lin 37e9b779f9 Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-28 04:46:20 +00:00
Ting-Yu Lin 16b24f6c41 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-28 04:46:18 +00:00
Ting-Yu Lin 7e7ff289d4 Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-28 04:46:17 +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 4f688de577 Bug 1824877 Part 6 - Rename IsScrollContainer() to IsScrollContainerOrSubclass(). r=dholbert
This is to avoid confusion with `IsScrollContainerFrame()` introduced in Part 3.

A note to performance concern:

We've used `IsScrollContainerOrSubclass()` in bug 1873414 to avoid expensive
`nsIScrollableFrame* sf = do_QueryFrame()`. Per [1], casting from `nsIFrame*` to
`nsIScrollableFrame*` has no fast path.

Ideally, `ScrollContainerFrame* sf = do_QueryFrame()` should be fast, and we can
use it to implement `IsScrollContainerOrSubclass()` like
`IsImageFrameOrSubclass()`. However, in this patch, I intend to keep the
performance metrics unchanged.

Remove `GetAsScrollContainer()` since it's only used in `MOZ_ASSERT`, and I'm
planning to remove `nsIScrollableFrame` in bug 1896516.

[1] https://searchfox.org/mozilla-central/rev/dd6e430c1bc2db90d9b3b1dd7e5215b4edc4d51a/layout/generic/nsQueryFrame.h#117-121

Differential Revision: https://phabricator.services.mozilla.com/D210395
2024-05-15 17:50:50 +00:00