Граф коммитов

345 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez 6755393273 Bug 1765714 - Move Wayland popup bounds check to LayoutPopup(). r=stransky
It is the right place to do it, otherwise we don't have the guarantee of
it invalidating ancestor sizes or anything.

It's also what we invalidate in WaylandPopupPropagateChangesToLayout().

We otherwise do not have the guarantee of SetPopupPosition running
before or after layout, if sizes do not change. That caused the popup
size to remain big, which caused a resize loop.

Differential Revision: https://phabricator.services.mozilla.com/D144314
2022-04-22 08:44:58 +00:00
stransky 9cac822f97 Bug 1761435 [Wayland] Store only move-to-rect popup size r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D142048
2022-03-28 10:13:40 +00:00
stransky 588b7423e7 Bug 1760276 [Wayland] Fix loop in popup move-to-rect resizes r=emilio
Use mMoveToRectPopupRect popup constrains in nsMenuPopupFrame::SetPopupPosition only and make it pernament.
In such setup works as screen size constraints.

Don't call SetPopupPosition from move-to-rect callback and let layout code to handle that.

Remove MoveToRectPopupRectClear() as it's not needed, we keep mMoveToRectPopupRect
in nsMenuPopupFrame as well as we keep screen sizes there.

Differential Revision: https://phabricator.services.mozilla.com/D141602
2022-03-25 11:15:39 +00:00
Norisz Fay d29d98d869 Backed out 3 changesets (bug 1760276) for causing build bustages on nsMenuPopupFrame.cpp CLOSED TREE
Backed out changeset e98dce4c58db (bug 1760276)
Backed out changeset 3d351d90db7b (bug 1760276)
Backed out changeset e8e0571ab13b (bug 1760276)
2022-03-25 12:02:18 +02:00
stransky 0226068db9 Bug 1760276 [Wayland] Fix loop in popup move-to-rect resizes r=emilio
Use mMoveToRectPopupRect popup constrains in nsMenuPopupFrame::SetPopupPosition only and make it pernament.
In such setup works as screen size constraints.

Don't call SetPopupPosition from move-to-rect callback and let layout code to handle that.

Remove MoveToRectPopupRectClear() as it's not needed, we keep mMoveToRectPopupRect
in nsMenuPopupFrame as well as we keep screen sizes there.

Differential Revision: https://phabricator.services.mozilla.com/D141602
2022-03-25 09:33:18 +00:00
stransky 19c39f9ec2 Bug 1760172 [Wayland] Rename PreferredPopupRect to MoveToRectPopupRect r=emilio
Rename PreferredPopupRect* methods/attributes to MoveToRectPopupRect* ones as it holds info about coordinates received from move-to-rect popup placement done by Wayland compositor.

Differential Revision: https://phabricator.services.mozilla.com/D141425
2022-03-22 20:04:54 +00:00
Emilio Cobos Álvarez cff9bc48a3 Bug 1757996 - Improve context menu handling on Wayland. r=stransky
What caused the issue was that nsMenuPopupFrame::MoveTo didn't account
for the change in bug 312891. But our context menu / popup positioning
code can be much simpler if we account for the context menu offset
before-hand as an extra horizontal / vertical margin in all directions.

Then we don't need to special-case it at all.

Differential Revision: https://phabricator.services.mozilla.com/D140263
2022-03-04 11:45:41 +00:00
Noemi Erli d69b2997c4 Backed out changeset 86a8141f5590 (bug 1757996) for causing failures in test_popup_attribute.xhtml CLOSED TREE 2022-03-04 13:27:43 +02:00
Emilio Cobos Álvarez 9c57b41359 Bug 1757996 - Improve context menu handling on Wayland. r=stransky
What caused the issue was that nsMenuPopupFrame::MoveTo didn't account
for the change in bug 312891. But our context menu / popup positioning
code can be much simpler if we account for the context menu offset
before-hand as an extra horizontal / vertical margin in all directions.

Then we don't need to special-case it at all.

Differential Revision: https://phabricator.services.mozilla.com/D140263
2022-03-04 10:31:32 +00:00
stransky 52970abaec Bug 1755521 - Don't lose track of anchor rect width on popup position change. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D138827
2022-03-02 12:33:27 +00:00
stransky 88a2067f30 Bug 1755521 Store SizedToPopup attribute to use in nsMenuPopupFrame::MoveTo() to avoid unwanted popup resize r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D139944
2022-03-02 10:27:54 +00:00
Emilio Cobos Álvarez a8d5f9838a Bug 312891 - Right align RTL context menus on non-Wayland platforms. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D139484
2022-03-01 11:58:22 +00:00
Emilio Cobos Álvarez a0014f1385 Bug 1757106 - Fix early-out in nsMenuPopupFrame::MoveTo to account for margins. r=stransky
This was also broken.

Differential Revision: https://phabricator.services.mozilla.com/D139670
2022-03-01 01:11:20 +00:00
Emilio Cobos Álvarez 4b49d8b1fa Bug 1757106 - Clean up menu popup rect handling. r=stransky
Store preferred rect in dev pixels, which simplifies a bit other calculations,
and ensures that the nsMenuPopupFrame code accounts for zoom etc.

Use existing conversion methods for GDK <-> Device <-> CSS conversions.

Differential Revision: https://phabricator.services.mozilla.com/D139623
2022-03-01 01:06:37 +00:00
Emilio Cobos Álvarez 8fbe4e5c08 Bug 1750487 - Fix weird full-zoom handling for unanchored popups in nsMenuPopupFrame positioning. r=mstange
I don't see why ever mScreenRect would deal with zoom-less coordinates.
I _suspect_ this might have been accounting for screenX/Y not dealing
with zoom in the past, but that was fixed (not long ago, actually) in
bug 1753836.

Also, browser.xhtml never has zoom. I haven't seen this causing problems
in practice in non-Wayland platforms, but I think it's the right thing
to do and the code as is is extremely confusing, since other places
applying screen rects and context menu offsets treat them as real CSS
pixels:

  https://searchfox.org/mozilla-central/rev/73a8000b0c0eb527faef01ea17c6d2398622a386/layout/xul/nsMenuPopupFrame.cpp#2407-2411

So I don't think this changes behavior in practice in non-wayland
platforms given we never have full zoom in browser.xhtml and we mostly
hit this code path for context menus, but given the above I think it's
simpler and more correct.

Depends on D139670

Differential Revision: https://phabricator.services.mozilla.com/D139671
2022-02-25 00:35:51 +00:00
Gijs Kruitbosch 25603b04b3 Bug 1749032 - fix C++ consumers of nsISound to access it as a service, r=NeilDeakin
Depends on D136481

Differential Revision: https://phabricator.services.mozilla.com/D136482
2022-01-24 12:09:59 +00:00
Cristian Tuns 263078f4c0 Backed out changeset e7b991987ae5 (bug 1742797) for causing bug 1748808 CLOSED TREE 2022-01-07 02:32:44 -05:00
Hiroyuki Ikezoe a74d5debf3 Bug 1742797 - Discard WebRender resources when popup hides. r=Gijs,emilio
The browser test in this change was originally written by Gijs.

Differential Revision: https://phabricator.services.mozilla.com/D134444
2022-01-06 02:51:38 +00:00
Noemi Erli e560c5d324 Backed out changeset 14f484747a66 (bug 1742797) for causing failures in nsMenuPopupFrame.cpp CLOSED TREE 2022-01-06 00:49:35 +02:00
Hiroyuki Ikezoe bd03f6e7ce Bug 1742797 - Discard WebRender resources when popup hides. r=Gijs,emilio
The browser test in this change was originally written by Gijs.

Differential Revision: https://phabricator.services.mozilla.com/D134444
2022-01-05 21:24:20 +00:00
Kagami Sascha Rosylight 75b68c1ab1 Bug 1539884 - Part 28: Mark nsXULPopupShownEvent::Run as CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134406
2021-12-23 16:27:23 +00:00
Emilio Cobos Álvarez f80de802b1 Bug 1746310 - Remove nsMenuPopupFrame::GenerateFrames and related code. r=tnikkel
The root of the problem is that nsMenuPopupFrame::GenerateFrames calls
into frame construction without making sure that styles are clean. So it
was pretty much working by chance, sorta.

I was going to fix this by adding the necessary flushes before calling
GenerateFrames, but on closer inspection, the front-end has effectively
already implemented this optimization by only generating the relevant
DOM on popupShowing:

  https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/toolkit/content/widgets/menupopup.js#87-91

And for menulists on creation:

  https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/toolkit/content/widgets/menupopup.js#151

After bug 1714846 we even destroy frames as needed, for panels.

So I think all of this complexity is unwarranted, and if we need some of
it we should implement it in the front-end like bug 1714846 did, and I'd
rather do this than flushing styles and so on.

There's one tweak I had to do to an nsPlaceholderFrame assertion. The
reason is that now the nsMenuPopupFrames do get their
NS_FRAME_FIRST_REFLOW bit cleared here:

  https://searchfox.org/mozilla-central/rev/bd25b1ca76dd5d323ffc69557f6cf759ba76ba23/layout/xul/nsMenuPopupFrame.cpp#557

Because the IsLeaf() condition here is no longer true:

  https://searchfox.org/mozilla-central/rev/bd25b1ca76dd5d323ffc69557f6cf759ba76ba23/layout/xul/nsMenuPopupFrame.cpp#532

It doesn't change anything though, because this condition never holded
for popups consistently.

Differential Revision: https://phabricator.services.mozilla.com/D134331
2021-12-23 12:55:34 +00:00
Emilio Cobos Álvarez 8c41302730 Bug 1744749 - Silence a non-fatal assertion that can happen when creating webext panels. r=layout-reviewers,boris
This is drive-by but I hit this assert consistently when running
browser/components/extensions/test/browser/browser_ext_popup_background.js
locally.

The assert was wrong when we're recreating the widget, it is expected that
we've already constructed frames for its contents.

Depends on D133771

Differential Revision: https://phabricator.services.mozilla.com/D133772
2021-12-16 14:56:33 +00:00
Emilio Cobos Álvarez f44b6d79db Bug 1736675 - Make sure to only override color-scheme on widgets if the color-scheme property says so. r=mstange
So that when the system changes appearance we respect that automatically.

Differential Revision: https://phabricator.services.mozilla.com/D128924
2021-10-19 19:22:35 +00:00
Gijs Kruitbosch 73383ab243 Bug 1366818, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D122785
2021-10-13 08:57:35 +00:00
Emilio Cobos Álvarez 7bc118e08e Bug 1732829 - Propagate popup position / size change after widget moves, not before. r=hiro
Bug 1696718 landed a fix to propagate the position change from layout.
However that's not correct, because the widget isn't resized until
nsView::ProcessPendingUpdatesForView is resized (and even that in some
platforms it might be async).

So the right place to propagate the position change is in
nsXULPopupManager (which we call into from the view system which listens
itself to the widget).

Let's try to enable the test for that bug everywhere with this fixed.

Differential Revision: https://phabricator.services.mozilla.com/D127801
2021-10-10 18:53:07 +00:00
Emilio Cobos Álvarez 9ac5bbff6d Bug 1734716 - Make macOS menupopups follow color-scheme. r=mstange,mac-reviewers
They were following the global appearance of the window.

Differential Revision: https://phabricator.services.mozilla.com/D127931
2021-10-08 16:28:29 +00:00
Emilio Cobos Álvarez 9fbc18ca4c Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 17:00:36 +00:00
Butkovits Atila 4d927c1fb4 Backed out 4 changesets (bug 1733384) for causing failures at browser_windowPrompt.js. CLOSED TREE
Backed out changeset fa609fadac26 (bug 1733384)
Backed out changeset dd1936d9fe17 (bug 1733384)
Backed out changeset 1a073e40ab1a (bug 1733384)
Backed out changeset 65708a4c708f (bug 1733384)
2021-10-07 17:52:51 +03:00
Emilio Cobos Álvarez bfdd0fcc77 Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 11:47:34 +00:00
Emilio Cobos Álvarez a64efcd48e Bug 1727709 - Simplify nsMenuPopupFrame mouse transparent handling. r=stransky
Make sure it's always in sync with the style.

Keeping a boolean field was useful when we didn't handle dynamic changes
to it, but now we do it's just redundant, and could cause correctness
issues.

Differential Revision: https://phabricator.services.mozilla.com/D124081
2021-09-01 19:24:39 +00:00
stransky 957f603c7e Bug 1708709 Use appunits for mScreenRect to avoid rounding errors, r=emilio
We have to use wayland to position popup windows and we need to propagate the modified
position (if happens) back to nsView. The mScreenRect in the nsMenuPopupFrame is in the CSS units
and that produce rounding error when font scale factor is not 1. To fix that we will use appunits
for the mScreenRect.

Differential Revision: https://phabricator.services.mozilla.com/D114577
2021-09-01 13:02:51 +00:00
Emilio Cobos Álvarez e8ca9c45d5 Bug 1725604 - Work around a GTK bug where wayland input regions get lost. r=stransky
Depends on D122610

Differential Revision: https://phabricator.services.mozilla.com/D122611
2021-08-23 12:10:43 +00:00
Emilio Cobos Álvarez d5d7725e5f Bug 1725604 - Drive-by cleanups. r=stransky
Depends on D122584

Differential Revision: https://phabricator.services.mozilla.com/D122610
2021-08-23 12:10:43 +00:00
stransky 50cee5c326 Bug 1718727 [Wayland] Don't constrain popup size by screen size on Wayland, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D122102
2021-08-11 06:37:07 +00:00
Alexandru Michis 326297bd47 Backed out changeset e41bfdf79fb8 (bug 1665476) for causing windows mochitest failures in test_windowminmaxsize.xhtml
CLOSED TREE
2021-08-02 02:14:52 +03:00
Emilio Cobos Álvarez 275707a51b Bug 1665476 - Remove nsRootBoxFrame to unify background propagation between XUL and non-XUL documents. r=layout-reviewers,mats
It's unused on mozilla-central, and Thunderbird can just use the canvas
frame as regular (X)HTML documents, so just use a canvas frame instead
of an nsRootBoxFrame for XUL as well.

nsRootBoxFrame was needed because of various XUL-specific things like
tooltips and so on lived there. But with the move away from XUL, that
functionality has been added to nsCanvasFrame already, behind a
principal check instead.

This also allows simplifying our background propagation setup, which was
only half-working for XUL documents (this bug is a consequence of that).

With this, most of the callers of nsCSSRendering::IsCanvasFrame can go.
They're only two of the frames that would return true for that that
actually paint backgrounds (nsCanvasFrame and nsRootBoxFrame), so the
codepaths in display list building and painting can just check
frame->IsCanvasFrame() instead.

The remaining caller to that function is
nsContainerFrame::SyncWindowProperties, and the change is also legit, in
the sense that the only thing SyncWindowProperties() really cares about
is propagating the max/min-width constraints from the root element's
style to the view/widget, and the only frame that would return true from
IsCanvasFrame and have a view is the viewport frame which is the root of
the frame tree.

Differential Revision: https://phabricator.services.mozilla.com/D90846
2021-08-01 21:57:28 +00:00
stransky 0c67eb1ded Bug 1661516 [Wayland] Don't use context menu shift in nsMenuPopupFrame::SetPopupPosition(), r=jhorak
- Clear mAdjustOffsetForContextMenu at nsMenuPopupFrame when running on Wayland and use move-to-rect to produce the offset.
- Implement nsWindow::WaylandPopupIsContextMenu()
- Use mBonuds directly in NativeMoveResizeWaylandPopupCallback() instead of Gtk query.
- Add some more loggin and code polishing.

Differential Revision: https://phabricator.services.mozilla.com/D117283
2021-06-14 18:01:04 +00:00
Butkovits Atila a129011aae Backed out changeset 27149a6f3ca9 (bug 1661516) for causing build bustages on nsMenuPopupFrame.cpp. CLOSED TREE 2021-06-14 17:59:09 +03:00
stransky 4da0695dac Bug 1661516 [Wayland] Don't use context menu shift in nsMenuPopupFrame::SetPopupPosition(), r=jhorak
- Clear mAdjustOffsetForContextMenu at nsMenuPopupFrame when running on Wayland and use move-to-rect to produce the offset.
- Implement nsWindow::WaylandPopupIsContextMenu()
- Use mBonuds directly in NativeMoveResizeWaylandPopupCallback() instead of Gtk query.
- Add some more loggin and code polishing.

Differential Revision: https://phabricator.services.mozilla.com/D117283
2021-06-14 14:32:09 +00:00
Emilio Cobos Álvarez 8fb52356f4 Bug 1708303 - Fix scroll-margin implementation. r=hiro
So that margin is not included in the rect for visibility calculations,
and padding and margin are accounted properly on them.

Differential Revision: https://phabricator.services.mozilla.com/D113853
2021-05-06 00:54:14 +00:00
Markus Stange d7174dbb18 Bug 1703927 - Never update nsView visibility for menupopups that are shown as non-native menus. r=tnikkel
Now that nsMenuPopupFrame considers itself open while the native menu is shown,
it may try to open its non-native widget if layout happens to run while the
native menu is shown.
This check prevents that.

Differential Revision: https://phabricator.services.mozilla.com/D111326
2021-04-08 20:59:43 +00:00
Markus Stange fa0e157963 Bug 1703702 - Add nsMenuPopupFrame::IsNativeMenu(). r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D111188
2021-04-08 02:50:48 +00:00
Markus Stange 2b151aeae0 Bug 1703333 - Make the popup state reflect reality for native context menus. r=tnikkel
This fixes tests which query popupElement.state.
Only the "root" menupopup is updated; the state for submenus is still always "closed".

Depends on D110973

Differential Revision: https://phabricator.services.mozilla.com/D110974
2021-04-06 22:34:52 +00:00
Neil Deakin f625b71d78 Bug 1700148, add an appearance type that forces a dropshadow on menus on Windows, and uses SetWindowRgn to clip the popup to the border radius, r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D109833
2021-04-01 00:13:09 +00:00
Markus Stange c4d150d967 Bug 1702041 - Clear document.popupNode when a native menu closes. r=tnikkel
This is what non-native menus do. document.popupNode is a very awkward API; it's
global state that gets updated from multiple places and which is hard to reason
about.
For that reason, I think it's safest to stick closely to what non-native menus
are doing. I'm not aware of any user-facing breakage that this patch fixes.

Differential Revision: https://phabricator.services.mozilla.com/D110303
2021-03-31 17:41:56 +00:00
Markus Stange f1c0cd2be5 Bug 1702041 - Move NativeMenu management out of nsMenuPopupFrame and into nsXULPopupManager. r=tnikkel
This is more in line with how non-native popups are managed. The popup manager
knows about everything and is the source of any state changes, and it updates
the nsMenuPopupFrame when necessary.
Concretely, this change makes these two upcoming changes easier:
 - "Rolling up" native context menus. The popup manager is the nsIRollupListener.
 - Returning something sensible from nsXULPopupManager::GetLastTriggerNode while
   a native context menu is open.

Differential Revision: https://phabricator.services.mozilla.com/D110300
2021-03-31 17:41:55 +00:00
Markus Stange b7f729bf73 Bug 1700706 - Clear active and capturing content before opening native menus. r=tnikkel
This is copied from the nsMenuPopupFrame::ShowPopup just a few lines below.
The native menu consumes mouseup events so we need to clear :active and capturing content just before opening the menu.

Differential Revision: https://phabricator.services.mozilla.com/D109672
2021-03-24 23:51:05 +00:00
Markus Stange f92e83a7db Bug 1698997 - Make nsXULPopupManager::ShowPopupAtScreen open a native context menu, if preffed on. r=tnikkel
This is macOS only and behind the prefs widget.macos.native-context-menus and
browser.proton.contextmenus.enabled .

The big design question here is: Where do we put the fork in the road? How much
should the existing non-native popup management machinery know about the state
of the native menu? Which parts of the non-native state should a) reflect the
true native state, b) enter a special "handled natively" state, or c) lie?

This patch picks the following approach:

 - The nsMenuPopupFrame of the root menupopup knows about the native menu; it
   keeps it alive in its new mNativeMenu field.
 - If the context menu has submenus, i.e. nested <menupopup> elements, the
   nsMenuPopupFrames for those nested menupopups do not know anything about the
   native menu.
 - The mPopupState of natively-handled nsMenuPopupFrames is ePopupClosed.
 - XULPopupElement::GetState, which queries the frame's mPopupState, also
   returns "closed". This might cause problems in the future.
 - The XUL popup manager's mPopups "menu chain" does not know about any open
   native menus.
 - The rollup widget also does not know about the native popup.

I've chosen to use ePopupClosed for native menus for the following reasons:
 1. While mirroring / updating the state for the root menu would be doable
    without too much trouble, it would be much more annoying to do the same for
    nested menupopups of submenus. So if submenus will be ePopupClosed, it's
    consistent for the root menu to also be ePopupClosed.
 2. nsXULPopupManager has assertions (for example in MayShowPopup) that make
    sure that the menu popup frame's mPopupState is consistent with the XUL
    popup manager's mPopups menu chain. Keeping the two both "closed" is the
    easiest way to achieve consistency.

Unless there are grave concerns with this approach, I suggest we go with it for
now and see what trouble arises.

Differential Revision: https://phabricator.services.mozilla.com/D109183
2021-03-23 14:38:29 +00:00
Hiroyuki Ikezoe 9a4563134c Bug 1696718 - Propagate popup window position update to descendants documents. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D108559
2021-03-18 03:11:23 +00:00