Commit graph

1330 commits

Author SHA1 Message Date
Cristian Tuns
b39b0d3b9d Backed out changeset ef564358a7e8 (bug 1778983) for causing wpt failures in CSSTransition-canceling.tentative.html CLOSED TREE 2022-07-12 07:48:51 -04:00
Emilio Cobos Álvarez
b8d58c68d0 Bug 1777135 - Part 1: make nsPresContext::DefaultBackgroundColor account for default-background color-scheme. r=dholbert
And remove one unused caller.

This might change behavior of some selection contrast checks and backplating
which will potentially use the right background-color after this patch. The
next patch ensures this is also accounted for for scrollbars.

Unfortunately selection contrast checks are non-trivial to test because we only
do the contrast check with system colors, and we'd need a default selection
color close to the highlight color to do this.

Differential Revision: https://phabricator.services.mozilla.com/D151017
2022-07-12 09:51:47 +00:00
Emilio Cobos Álvarez
c4ef579d53 Bug 1778983 - Remove useless ProcessPendingRestyles call. r=boris
That was about XBL constructors being able to run script. But XBL is
gone and this should just be wasted work.

I want to land this in preparation for container queries substantially
changing the model here.

Differential Revision: https://phabricator.services.mozilla.com/D151495
2022-07-12 09:45:39 +00:00
Julien Wajsberg
f2cc927a5c Bug 1777473 - Rename the frame label for PresShell::Destroy and expose to javascript developers r=emilio
The existing frame label was reusing the function name, but we already
have it when using native stacks. Renaming it to a more understandable
name should make it easier for our javascript developers users without
impairing gecko developers.

Differential Revision: https://phabricator.services.mozilla.com/D150976
2022-07-06 14:02:05 +00:00
Hiroyuki Ikezoe
77f616cdaf Bug 1530253 - Trigger re-snap on reflows and in RecomputePosition. r=botond,emilio
The basic machinery to trigger re-snap is same as what scroll anchoring does,
queueing a triggering request and flush the queued requests after reflows
finished.

Depends on D148862

Differential Revision: https://phabricator.services.mozilla.com/D148863
2022-07-01 01:35:32 +00:00
Nika Layzell
8f236832ff Bug 1758115 - Part 2: Streamline locking, initialization and shutdown for TimelineConsumers, r=smaug
The current implementation of TimelineConsumers contains some unnecessary
complexity due to how it is initialized as a singleton, and the need for it to
be initialized and used in a threadsafe way. This patch attempts to simplify it
by making all members static, and removing the need to explicitly observe
shutdown for cleanup.

In addition, this approach avoids the risk of the type being accessed from
off-main-thread during initialization or shutdown.

Depends on D150442

Differential Revision: https://phabricator.services.mozilla.com/D150443
2022-06-29 15:01:51 +00:00
Emilio Cobos Álvarez
5fd43eaab3 Bug 1776157 - Don't force chrome frames to be opaque. r=dholbert
It causes unnecessary flashes in some cases, like the sidebar which
intentionally loads about:blank.

Differential Revision: https://phabricator.services.mozilla.com/D150096
2022-06-24 00:04:18 +00:00
Jeff Muizelaar
3847a14838 Bug 1774849 - Always use sync decoding during reftests. r=aosmond
nsImageGeometryMixin is used to redraw images with sync decoding.  Without it,
if we paint an image with non-sync decoding, we won't know that it will be
drawn differently with sync decoding and so don't have a mechanism to include
it in the invalid region.

Currently the main situation where we draw images with non-sync decoding and
then with sync decoding is during reftests. If we unconditionally use sync
decoding during reftests we don't have to worry about the situation where we
switch. This will let us resolve the problems associated with nsImageGeometryMixin.

Differential Revision: https://phabricator.services.mozilla.com/D149657
2022-06-22 18:50:35 +00:00
Daniel Holbert
92b1de01bb Bug 1774879 part 3: Add 'const' to local var ComputedStyle pointers that we pass to DetermineBackgroundColor and IsTransparent (which now accept const). r=emilio
This patch does not affect behavior; it's just a const-correctness fix.

Differential Revision: https://phabricator.services.mozilla.com/D149676
2022-06-18 00:45:20 +00:00
Iulian Moraru
b9b91b3bba Backed out changeset ea2c1cabc853 (bug 1774849) for causing crashtest failures on 944353.jpg. 2022-06-17 22:56:46 +03:00
Jeff Muizelaar
e2ab641934 Bug 1774849 - Always use sync decoding during reftests. r=aosmond
nsImageGeometryMixin is used to redraw images with sync decoding.  Without it,
if we paint an image with non-sync decoding, we won't know that it will be
drawn differently with sync decoding and so don't have a mechanism to include
it in the invalid region.

Currently the main situation where we draw images with non-sync decoding and
then with sync decoding is during reftests. If we unconditionally use sync
decoding during reftests we don't have to worry about the situation where we
switch. This will let us resolve the problems associated with nsImageGeometryMixin.

Differential Revision: https://phabricator.services.mozilla.com/D149657
2022-06-17 18:57:07 +00:00
Mirko Brodesser
8d922ea417 Bug 1744524: part 1) Add JS code for the "Paste" menupopup to handle ClipboardReadTextPaste events created from the C++ side. r=edgar,Gijs
Implements showing a "Paste" popup at the last mouse position (which
overlapped the browser window) when a certain custom event is received.
Creating and dispatchting that event is implemented in one of the
following parts.

Differential Revision: https://phabricator.services.mozilla.com/D135333
2022-06-16 14:43:40 +00:00
Hiroyuki Ikezoe
20c48b14ce Bug 1771830 - Apply scroll snap in ScrollToShowRect in PresShell.cpp. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D147708
2022-06-08 02:49:56 +00:00
Emilio Cobos Álvarez
12bd84f0c5 Bug 1773070 - While at it rename ContentStateChanged to ElementStateChanged, and make it take elements. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148553
2022-06-07 23:09:54 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Jonathan Kew
f117f58e47 Bug 1771609 - patch 3 - Remove nsAutoLineIterator, as it no longer serves any useful purpose since the iterator is owned by the target frame. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D147579
2022-06-03 22:05:36 +00:00
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