Commit graph

1314 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
c8ac345ec7 Bug 1769774 - Stop tracking painted PresShells. r=mstange
After bug 1730284 we don't use it for throttling iframes, so the only
remaining use the test-only nsIDOMWindowUtils.paintCount. None of the
tests using it rely on the empty transaction case, so we should be able
to just remove this.

Differential Revision: https://phabricator.services.mozilla.com/D146589
2022-05-27 11:12:19 +00:00
Masayuki Nakano
77df1d2c4c Bug 1680611 - part 10: Mark nsFocusManager::Flush*() and their callers in nsFocusManager r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147069
2022-05-26 04:37:21 +00:00
Cristian Tuns
a089bcae5b Backed out changeset ad9f67e4e822 (bug 1769774) for causing build bustages after backout of Bug 1730284 CLOSED TREE 2022-05-25 16:10:08 -04:00
Emilio Cobos Álvarez
7789efcab7 Bug 1769774 - Stop tracking painted PresShells. r=mstange
After bug 1730284 we don't use it for throttling iframes, so the only
remaining use the test-only nsIDOMWindowUtils.paintCount. None of the
tests using it rely on the empty transaction case, so we should be able
to just remove this.

Differential Revision: https://phabricator.services.mozilla.com/D146589
2022-05-25 17:55:17 +00:00
Emilio Cobos Álvarez
7184afff2f Bug 1738380 - Draw backgrounds of iframes with mismatched embedder color schemes. r=jwatt
In the future we might want to (also?) propagate the
prefers-color-scheme on the iframe like we do for the content/chrome
boundary / top browsing contexts, see:

 * https://github.com/w3c/csswg-drafts/issues/4772
 * https://github.com/w3c/csswg-drafts/issues/7213

Differential Revision: https://phabricator.services.mozilla.com/D146162
2022-05-20 15:20:34 +00:00
Glenn Watson
cebe610723 Bug 1768983 - Add prim flag for checkerboarding backgrounds r=gfx-reviewers,lsalzman
Although not needed right now (checkerboarding backgrounds get
a slice anyway due to being a different scroll root), this will
be important for the upcoming work to make backdrop filter
roots implicit. This allows WR to know when slicing up a content
slice if the prim is relevant to the backdrop root.

Differential Revision: https://phabricator.services.mozilla.com/D146145
2022-05-15 21:54:25 +00:00
Hiroyuki Ikezoe
a457a5cfbb Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 12:25:15 +00:00
Norisz Fay
ce587cb281 Backed out 3 changesets (bug 1766805) for causing build bustage on AsyncPanZoomController.cpp CLOSED TREE
Backed out changeset e35a130f2bce (bug 1766805)
Backed out changeset 9f9e2030fbc1 (bug 1766805)
Backed out changeset 898bd12a5da8 (bug 1766805)
2022-05-12 13:42:36 +03:00
Hiroyuki Ikezoe
098b8bc1a5 Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 07:45:59 +00:00
Emilio Cobos Álvarez
c9e3177022 Bug 1768157 - Remove kSelectPopupList. r=jwatt
It's unused since bug 1744009 at least, so no behavior change.

Depends on D145714

Differential Revision: https://phabricator.services.mozilla.com/D145715
2022-05-06 15:46:49 +00:00
Hiroyuki Ikezoe
64bbee7d38 Bug 1765895 - Make presshellId start from 1 rather than 0. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D144351
2022-04-22 02:06:12 +00:00
Emilio Cobos Álvarez
7de4ce1232 Bug 1763743 - Don't bail out from PresShell::DoScrollContentIntoView if there are no in-document scrollable ancestors. r=hiro
There are cases where we want to scroll across documents (like
scrollIntoView), and bailing out for those is incorrect. This
usually can't happen because in HTML documents we always have a root
scroll frame, but for fixed positioned elements it can happen, as those
are not parented to it.

This came up in https://github.com/w3c/csswg-drafts/issues/5492, and
fixes the only case where Firefox and Safari differ (C).

ScrollFrameRectIntoView knows how to deal with non-scroll-frames, and
takes care of jumping across documents if necessary, so passing the root
frame is fine. We only needed to walk out the parent chain to be able to
accumulate all our continuation bounds relative to the same frame.

In practice the bail out code should now be unreachable. Add an
assertion to that effect.

Tests for this are already upstream in WPT, and pass with this patch,
see:

 * https://github.com/web-platform-tests/wpt/pull/33572
 * https://github.com/web-platform-tests/wpt/pull/33633

Differential Revision: https://phabricator.services.mozilla.com/D143250
2022-04-20 08:29:51 +00:00
Daniel Holbert
20ee8c001c Bug 1764902: Add missing ifdef guard around initialization of diagnostic variable 'mAllocatedPointers'. r=jfkthame
Also, remove unnecessary/implied "#ifdef" in code-comment alongside #endif a
few lines below, for consistency with the similar code-comment that I'm adding
in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D143846
2022-04-15 21:42:03 +00:00
Daniel Holbert
c3ca004372 Bug 1759396 part 2: Use fallible allocation when inserting into PresShell::mAllocatedPointers, to avert OOMs in builds with diagnostic assertions. r=emilio
If allocation fails, we'll now just discard the entire contents of
mAllocatedPointers and stop using it going forward.

See the documentation alongside the mAllocatedPointers declaration (in this
patch) for more details.

Differential Revision: https://phabricator.services.mozilla.com/D143416
2022-04-12 23:57:07 +00:00
Daniel Holbert
abcfa0df24 Bug 1759396 part 1: Manage PresShell::mAllocatedPointers using a UniquePtr rather than as a direct member-variable. r=emilio
This patch doesn't change behavior.  As of this patch, this variable gets
instantiated immediately (in the PresShell constructor) and is never null, so
no logic/beheavior has changed.

This lays the groundwork for the next patch, which will add one case where this
variable does get nulled out (and add logic to handle that).

Differential Revision: https://phabricator.services.mozilla.com/D143411
2022-04-12 23:57:06 +00:00
Martin Robinson
2893cfed87 Bug 1762407 - Do not scroll content with content-visibility: hidden ancestors into view r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D142563
2022-04-07 10:38:27 +00:00
Ryan VanderMeulen
b9254aeca4 Bug 1762393 - Fix --disable-accessibility bustage in PresShell.cpp. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D142552
2022-03-31 17:14:53 +00:00
Emilio Cobos Álvarez
ea070a59f9 Bug 277178 - Move focus to a fragment identifier (#fragment) if it's focusable. r=smaug
Co-authored-by: Takeshi Kurosawa <taken.spc@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D141824
2022-03-30 18:01:48 +00:00
Matteo Ruello
09684f492a Bug 1756529 - Honor general.smoothScroll.[line|page|other] for keyboard scrolls with MSD physics r=botond,hiro
Differential Revision: https://phabricator.services.mozilla.com/D140090
2022-03-22 04:16:32 +00:00
Julien Wajsberg
830ac30ee4 Bug 1752861 - [profiler] Rename and expose to JS some existing frame labels as well as adding a few r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D140389
2022-03-11 09:18:30 +00:00
Iulian Moraru
6df286bfe3 Backed out changeset 58f10ceb16ba (bug 1756529) for causing mochitest failures on test_group_keyboard.html. CLOSED TREE 2022-03-10 06:25:37 +02:00
Matteo Ruello
44f4c447d2 Bug 1756529 - Honor general.smoothScroll.[line|page|other] for keyboard scrolls with MSD physics r=botond,hiro
Differential Revision: https://phabricator.services.mozilla.com/D140090
2022-03-10 03:13:02 +00:00
Jan Varga
4b0b18b972 Bug 1757577 - Fix non-unified-build bustage in layout/base/PresShell.cpp; r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D139949
2022-03-04 12:40:23 +00:00
Timothy Nikkel
22b5bfa1de Bug 1756762. When the root scroll frame is destroyed, reset the visual viewport offset on it's presshell. r=botond
The regular scroll position restoration code will restore it.

Specifically, in ScrollFrameHelper::SaveState

https://searchfox.org/mozilla-central/rev/44ae61c5eeb150cb77b6b8511ceee7ddd6892cb7/layout/generic/nsGfxScrollFrame.cpp#7376

we store the visual viewport offset. ScrollFrameHelper::ScrollToRestoredPosition will try to restore both the layout scroll offset and the visual viewport offset by calling ScrollToWithOrigin (which leads to ScrollToImpl) and PresShell::ScrollToVisual respectively.

I observed the following sequence of events when running gfx/layers/apz/test/mochitest/browser_test_background_tab_load_scroll.js in one of the cases that it fails for me locally.

-ScrollFrameHelper::NotifyApzTransaction is called after sending a transaction to webrender, this sets mAllowScrollOriginDowngrade = true.
-the scroll frame is destroyed and re-created (I'm not sure why this destroy and re-create happened, I didn't investigate), we call SaveState and RestoreState. So now mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true.
-the test calls ScrollBy, so we get a call to ScrollToImpl with aOrigin == Relative
-aOrigin gets changed to Other here https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#2979
-the code just below that determines that it is not a downgrade, so we update mLastScrollOrigin to Other (not a change) and set mAllowScrollOriginDowngrade = false
-ScrollFrameHelper::NotifyApzTransaction is _not_ called (probably because we are in a background tab), so mAllowScrollOriginDowngrade remains false
-the scroll frame is now at position 20000 and the visual viewport offset (stored on the presshell) is also 20000.
-the scroll frame is destroyed and re-created (this one I investigated, it's because the font subsystem has finished loading and asks for a global reconstruct https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/base/PresShell.cpp#9830), we call SaveState and RestoreState. So mLastScrollOrigin == Other, and mAllowScrollOriginDowngrade == true (the same values.
-we get a call to ScrollToRestoredPosition for the newly re-created scroll frame, we are trying to scroll from the current layout scroll position of 0 to the one we had before destruction and re-creation (20000). The visual viewport offset that is stored on the presshell has not been affected, it is still 20000.
-this gets to ScrollToImpl and with aOrigin == Restore
-we arrive at https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3000 and Restore is a downgrade from Other, and mAllowScrollOriginDowngrade is false so we do not change mLastScrollOrigin (still Other) and mAllowScrollOriginDowngrade remains false
-we arrive at the code in ScrollToImpl that updates the visual viewport offset on the presshell https://searchfox.org/mozilla-central/rev/9b0bdcc37419e6765223358a31a4a54d62e1cd97/layout/generic/nsGfxScrollFrame.cpp#3232
-mLastScrollOrigin is Other, which can clobber apz, so we enter the if and add the difference between the before/after layout scroll position from this ScrollToImpl call (20000-0 = 20000) to the visual viewport offset (20000), getting 40000, which gets clamped to the max ~38000.
-and now the layout scroll position and the visual viewport offset have been detached when they shouldn't be.

If we reset the visual viewport offset when the scroll frame is destroyed we avoid the problem here.

Differential Revision: https://phabricator.services.mozilla.com/D139792
2022-03-01 01:51:27 +00:00
Timothy Nikkel
ed30449176 Bug 1753881. If the visual viewport offset hasn't been set on the presshell return the layout scroll position. r=botond
Because that is the correct value.

Differential Revision: https://phabricator.services.mozilla.com/D139472
2022-02-27 13:09:27 +00:00
Miko Mynttinen
017d02d0ff Bug 1714584 - Part 2: Remove nsDisplayList::RemoveBottom() r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138153
2022-02-22 23:42:18 +00:00
Miko Mynttinen
ddec6eef59 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 23:42:18 +00:00
Norisz Fay
2121660ce9 Backed out 2 changesets (bug 1714584) per devs request for causing crashes a=backout
Backed out changeset 3baead3e079b (bug 1714584)
Backed out changeset a2da895a58ce (bug 1714584)
2022-02-22 16:41:57 +02:00
Miko Mynttinen
0bd7fc8c56 Bug 1714584 - Part 2: Remove nsDisplayList::RemoveBottom() r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138153
2022-02-22 00:44:25 +00:00
Miko Mynttinen
28474c7ad2 Bug 1714584 - Part 1: Decouple nsDisplayList internal list from nsDisplayItems r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138152
2022-02-22 00:44:25 +00:00
Miko Mynttinen
ad4c9a454d Bug 1722346 - Only append to the end/top of the display list r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D137894
2022-02-21 16:50:22 +00:00
Timothy Nikkel
d8a1ca407e Bug 1754437. Optimize FindViewContaining to avoid calling IsVisibleConsideringAncestors more often. r=emilio
Calling IsActive is quick, IsVisibleConsideringAncestors is not so quick.

If IsActive is false then that almost certainly means we'd hit the "not in the selected box of a deck frame" case in IsVisibleConsideringAncestors at

https://searchfox.org/mozilla-central/rev/b697834e78a3ef7613e2fa57c07624b1d9d1c909/layout/generic/nsIFrame.cpp#412

Differential Revision: https://phabricator.services.mozilla.com/D138291
2022-02-15 08:34:14 +00:00
Timothy Nikkel
d06a79ae14 Bug 1754436. Use nsXULPopupManager's list of visible popups to greatly speed up FindFloatingViewContaining. r=emilio
We only have to iterate over the open popups list (which is usually 0 or single digits) instead of every view.

Now that comboboxes definitely cannot create views, only xul menu popups can be floating popups.

Differential Revision: https://phabricator.services.mozilla.com/D138290
2022-02-13 08:18:45 +00:00
Nicklas Boman
ff6b6326b3 Bug 1725363 - Replace PL_strcasecmp with nsCRT::strcasecmp layout/ r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D129075
2022-01-26 09:57:46 +00:00
Noemi Erli
d795783f6e Backed out changeset 8739b71b8bd9 (bug 1740499) as requested by smaug 2022-01-20 22:21:32 +02:00
Emilio Cobos Álvarez
9db1237953 Bug 1750330 - Move global LookAndFeel changes to mozilla::LookAndFeel. r=mstange
So that the changes don't get lost when there's no PresShell in the
process.

Differential Revision: https://phabricator.services.mozilla.com/D136155
2022-01-17 16:34:11 +00:00
Olli Pettay
7751829b62 Bug 1740499, don't unsuppress so aggressively r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D134915
2022-01-17 11:16:26 +00:00
Timothy Nikkel
97ff865eba Bug 1749004. Call CancelManagedPostRefreshObservers after frame tree is destroyed. r=emilio
nsPresContest::RegisterManagedPostRefreshObserver still lets us add a managed post refresh observer until the mPresShell pointer on the prescontent is nulled out. That means that between the call to CancelManagedPostRefreshObservers and mPresContext->DetachPresShell() (which nulls out the mPresShell pointer on the prescontext) in PresShell::Destroy we can add a managed post refresh observer that will never get removed. Notably, destroying the frame tree happens between these two calls.

So move the CancelManagedPostRefreshObservers call to happen right after we null out the mPresShell pointer on the prescontext.

In bug 1737503 I want to add a managed post refresh observer when we destroy a subdocument frame (it's only interested in the recreate frames case not the destruction case, but not an easy way to tell them apart afaik), so it triggers this bug. The patch and test I have for that bug exercise this scenario.

Differential Revision: https://phabricator.services.mozilla.com/D135340
2022-01-12 12:59:44 +00:00
Emilio Cobos Álvarez
66f45bff6a Bug 1747927 - Minor ImageTracker cleanup. r=tnikkel
Don't bother going through the approximately visible image frames if the
locking state doesn't change.

Differential Revision: https://phabricator.services.mozilla.com/D134961
2022-01-04 13:30:18 +00:00
Emilio Cobos Álvarez
fac07284a9 Bug 1745869 - Grant 1s of activity to hidden OOPIF iframes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D134804
2022-01-02 12:39:38 +00:00
Narcis Beleuzu
5125801679 Backed out 2 changesets (bug 1745869) for bc failures on browser_hidden_iframe.js . CLOSED TREE
Backed out changeset e2dd2ff842fa (bug 1745869)
Backed out changeset 0d2bf1bbda4f (bug 1745869)
2021-12-31 00:27:32 +02:00
Emilio Cobos Álvarez
340752fa3d Bug 1745869 - Undo a change that unintentionally subtly changes behavior (makes one test fuzzy).
MANUAL PUSH: Trivial orange fix CLOSED TREE.
2021-12-30 19:28:16 +01:00
Emilio Cobos Álvarez
918836b8f6 Bug 1745869 - Grant 1s of activity to hidden OOPIF iframes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D134804
2021-12-30 15:14:22 +00:00
Kagami Sascha Rosylight
c5662e876e Bug 1539884 - Part 37: Add strong references for arguments in callers r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134475
2021-12-23 16:27:26 +00:00
Emilio Cobos Álvarez
a6fb6742a0 Bug 1744749 - Add an API to get the real canvas background color. r=jwatt
Extensions are using getComputedStyle(body).backgroundColor, which is
wrong at multiple levels.

The one that matters for this bug is that it is not color-scheme aware.

Depends on D133770

Differential Revision: https://phabricator.services.mozilla.com/D133771
2021-12-16 14:56:32 +00:00
Markus Stange
73365a9d4a Bug 987030 - Remove unused mDelayedPaintTimer. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D134001
2021-12-16 11:40:28 +00:00
Emilio Cobos Álvarez
66891aabb4 Bug 1744749 - Clean-up IsTransparentContainerElement. r=layout-reviewers,boris
No behavior change (you can't have an in-process frame container and a
BrowserChild at the same time), but avoids some needless refcounting
overhead and makes it simpler to follow.

Differential Revision: https://phabricator.services.mozilla.com/D133770
2021-12-16 11:09:09 +00:00
Timothy Nikkel
ff409060a7 Bug 1707983. Refresh zoom constraints from UIResolutionChanged notification because it gets called when we swap docshells and get a new APZC tree manager. r=botond
I guess we need to do this every time we get a new APZC tree manager (because that is where the zoom constraints map/cache is stored). I'm not sure how to detect that or if there are other cases we haven't covered.

Differential Revision: https://phabricator.services.mozilla.com/D113608
2021-12-09 10:06:57 +00:00
Masayuki Nakano
82e2013683 Bug 1735446 - part 4: Make Selection::GetRangeAt() take uint32_t instead of int32_t r=smaug
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
2021-12-09 07:35:09 +00:00
Mike Hommey
8e411675ac Bug 1744877 - Remove --disable-xul. r=Gijs
Building with --disable-xul has been busted since _at least_ bug
1082579, for more than 7 years (I didn't try to track that down
further). It's time to recognize that the option serves no purpose.

Differential Revision: https://phabricator.services.mozilla.com/D133161
2021-12-08 21:37:11 +00:00