Commit graph

127 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
287ac727e1 Bug 1789179 - Remove unused members from PendingPopup. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D156388
2022-09-05 11:58:59 +00:00
Emilio Cobos Álvarez
fb6380190c Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-30 09:30:27 +00:00
Sandor Molnar
9d7f9853a2 Backed out changeset bb1d2a4a5570 (bug 1786525) for causing build bustages in xpfe/appshell/AppWindow.cpp CLOSED TREE 2022-08-30 01:26:00 +03:00
Emilio Cobos Álvarez
cf74fba975 Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-29 21:47:34 +00:00
Emilio Cobos Álvarez
00f06ad611 Bug 1786515 - Remove dead nsXULPopupManager::EnableRollup. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D155386
2022-08-23 21:54:25 +00:00
Emilio Cobos Álvarez
e6f78c41b6 Bug 1772840 - Fix zoom handling in nsXULTooltipListener. r=mstange
If the tooltip node and the target node are in different documents, we'd
use the tooltip's CSS-to-dev-pixel scale to convert.

This is basically bug 1756323 but for XUL, I thought we wouldn't have
cross-document zoom like that but apparently I was wrong...

Differential Revision: https://phabricator.services.mozilla.com/D148402
2022-06-07 18:59:31 +00:00
Karl Tomlinson
b0862b31cc Bug 1771278 - remove unused nsIRollupListener::NotifyGeometryChange() r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D147408
2022-05-26 21:04:26 +00:00
Masayuki Nakano
971efcf6d8 Bug 1770684 - Mark IMEStateManager::SetIMEState and its callers in IMEStateManager as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147071
2022-05-26 04:37:21 +00:00
Emilio Cobos Álvarez
0e94643a7d Bug 1755165 - Check MayShowMenu synchronously in async OpenMenu. r=NeilDeakin
This preserves the previous behavior, though arguably we shouldn't call OpenMenu
to begin with if the menu has been rolled up.

Differential Revision: https://phabricator.services.mozilla.com/D138637
2022-02-14 23:40:57 +00:00
Emilio Cobos Álvarez
dc4988bbd0 Bug 1729805 - Make async OpenMenu simpler/sound. r=NeilDeakin,mstange
There's only one caller of it and it's not sound: The runnable captures a
raw frame pointer etc. Instead, just do a dispatch to the main thread
and call OpenMenu there. This simplifies the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D131082
2022-01-25 21:40:22 +00:00
Kagami Sascha Rosylight
f5525de4f5 Bug 1539884 - Part 30: Mark nsXULPopupManager::FirePopupShowingEvent as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134413
2021-12-23 16:27:23 +00:00
Kagami Sascha Rosylight
f6ccacc17d Bug 1539884 - Part 29: Mark nsXULPopupManager::HidePopupCallback as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134407
2021-12-23 16:27:23 +00:00
criss
d68f0e9684 Backed out changeset 5c921d8e51bd (bug 1741089) for causing mochitest failures on test_bug557987.xhtml . CLOSED TREE 2021-11-16 18:27:45 +02:00
Emilio Cobos Álvarez
3cf56f8e1f Bug 1741089 - Make async OpenMenu simpler/sound. r=mstange
There's only one caller of it and it's not sound: The runnable captures a
raw frame pointer etc. Instead, just do a dispatch to the main thread
and call OpenMenu there. This simplifies the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D131082
2021-11-16 15:43:38 +00:00
Neil Deakin
25c196780b Bug 1717684, remove the popupRangeParent and popupRangeOffset properties in document and just use the cached event in the PendingPopup, r=emilio
This also limits computing the range properties to only the context menu cases that need them rather than all popups.

Differential Revision: https://phabricator.services.mozilla.com/D120132
2021-07-22 19:50:10 +00:00
Neil Deakin
90e36968fc Bug 1717684, use a single temporary object that gets passed to the popup showing methods instead of setting a number of fields and relying on them being cleared after the popup is shown, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D120131
2021-07-22 19:50:10 +00:00
Kartikaya Gupta
9020180bb9 Bug 1714884 - Have the Rollup method take a strongly-typed int point. r=emilio
Depends on D116948

Differential Revision: https://phabricator.services.mozilla.com/D116949
2021-06-07 01:01:10 +00:00
Neil Deakin
0b4418c6a7 Bug 1696214, use moveToAnchor to position the tab and places tooltips so that the close and mute button tooltips appear correctly, r=jaws
This involves changing moveToAnchor to be allowed while the popup is showing. This change allows the buttons within the tab to use the normal algorithm for determining the tooltip position. This also fixes bug 1695900 so that tooltips for items in bookmarks menus also appear offset as well. Only the main tab and bookmarks on the toolbar appear aligned with the button's bottom edge.

Differential Revision: https://phabricator.services.mozilla.com/D115558
2021-05-31 13:07:35 +00:00
Markus Stange
d9b559d1d8 Bug 1705120 - When a menu item in a native menu is activated, hide and close any non-native menus at the right times. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D114441
2021-05-07 17:00:22 +00:00
Markus Stange
e40e07a3c6 Bug 1705120 - Factor out another part of this function into a new function called HideOpenMenusBeforeExecutingMenu(). r=harry
Differential Revision: https://phabricator.services.mozilla.com/D114440
2021-05-07 17:00:21 +00:00
Markus Stange
0350405261 Bug 1705120 - Add OnNativeMenuWillActivateItem observer method for NativeMenu::Observer and call it at the right times. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D114435
2021-05-07 17:00:21 +00:00
Markus Stange
a70e89dbac Bug 1704879 - Allow specifying the command event's button field in XULPopupElement.activateItem. r=emilio
Depends on D111956

Differential Revision: https://phabricator.services.mozilla.com/D111979
2021-04-20 22:13:24 +00:00
Markus Stange
1ec4d9e9cb Bug 1704948 - Forward mouse button to menuitem command event. r=smaug,robwu
Differential Revision: https://phabricator.services.mozilla.com/D111956
2021-04-20 17:44:16 +00:00
Markus Stange
1dce4bced0 Bug 1704554 - Store native submenu opening state on the popup manager and return it from XULPopupElement::GetState. r=tnikkel
This fix makes the following tests pass with native context menus:
 - browser/base/content/test/contextMenu/browser_contextmenu_iframe.js
 - browser/base/content/test/contextMenu/browser_contextmenu_linkopen.js

Depends on D112274

Differential Revision: https://phabricator.services.mozilla.com/D112275
2021-04-16 16:18:29 +00:00
Markus Stange
1807ef4020 Bug 1704554 - Make XULPopupElement::GetState go through the popup manager. r=tnikkel
Depends on D112273

Differential Revision: https://phabricator.services.mozilla.com/D112274
2021-04-16 16:18:29 +00:00
Markus Stange
45feb2e517 Bug 1704554 - Allow NativeMenu::Observer to listen for submenu state changes. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D112273
2021-04-16 16:18:29 +00:00
Narcis Beleuzu
daa77699e2 Backed out 7 changesets (bug 1704948, bug 1704879) for bc failures on browser_ext_menus_capture_secondary_click.js
Backed out changeset 02705918c4bf (bug 1704879)
Backed out changeset 79945b876a1d (bug 1704879)
Backed out changeset eb725de20b11 (bug 1704948)
Backed out changeset 454597ac2ba3 (bug 1704948)
Backed out changeset a43a8ef206ea (bug 1704948)
Backed out changeset 2369e321069e (bug 1704948)
Backed out changeset bdf396edd692 (bug 1704948)
2021-04-15 03:30:52 +03:00
Markus Stange
9e9970605b Bug 1704879 - Allow specifying the command event's button field in XULPopupElement.activateItem. r=emilio
Depends on D111956

Differential Revision: https://phabricator.services.mozilla.com/D111979
2021-04-14 22:24:31 +00:00
Markus Stange
ac179ed1ba Bug 1704948 - Forward mouse button to menuitem command event. r=smaug,robwu
Differential Revision: https://phabricator.services.mozilla.com/D111956
2021-04-14 21:23:28 +00:00
Markus Stange
d60b8c5380 Bug 1704212 - Move part of nsXULElement::OpenMenu into a new method called nsXULPopupManager::HideMenu. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D111660
2021-04-13 02:52:41 +00:00
Markus Stange
b4750b7fb3 Bug 1704209 - Make XULPopupElement.activateItem work for native menus. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D111521
2021-04-13 02:52:41 +00:00
Markus Stange
911942152b Bug 1704206 - Use mozilla::Modifiers in nsXULMenuCommandEvent. r=tnikkel
Depends on D111515

Differential Revision: https://phabricator.services.mozilla.com/D111516
2021-04-12 00:32:18 +00:00
Markus Stange
4907497098 Bug 1704127 - Factor out part of BeginShowingPopup into a new FirePopupShowingEvent method. r=tnikkel
Depends on D111500

Differential Revision: https://phabricator.services.mozilla.com/D111501
2021-04-10 01:26:24 +00:00
Markus Stange
43398e2c77 Bug 1704127 - Rename FirePopupShowingEvent to BeginShowingPopup. r=tnikkel
Depends on D111499

Differential Revision: https://phabricator.services.mozilla.com/D111500
2021-04-10 01:26:24 +00:00
Markus Stange
c5ebc0cf2d Bug 1704127 - Use NS_NewRunnableFunction instead of a custom nsXULPopupShowingEvent class. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D111499
2021-04-10 01:26:23 +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
Markus Stange
0f7b1e78d8 Bug 1702041 - Call NativeMenu::Close() before firing the contextmenu event. r=harry
This is more in line with how non-native menus operate.
In these profiles, you can see the popuphiding / popuphidden events being
dispatched before we enter the contextmenu event.
Before patch: https://share.firefox.dev/39pbqbb
After patch: https://share.firefox.dev/2PCXx1Z

Differential Revision: https://phabricator.services.mozilla.com/D110302
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
Jared Wein
5810ee434c Bug 1665390 - Style bookmarks toolbar and tabs toolbar tooltips. r=NeilDeakin,ntim
Differential Revision: https://phabricator.services.mozilla.com/D104257
2021-02-25 20:47:54 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Emilio Cobos Álvarez
78ce42a419 Bug 1666497 - Fix various issues with anchored popups. r=NeilDeakin
The patch in bug 1666497 (which makes regular <window>-based XUL
documents with other the XHTML-based ones) uncovers an issue in the
anchored popup tests, which starts timing out.

The underlying issue is that it changes the reflow order from popups in
XUL-only documents with respect to their anchors. Note that Firefox
already uses the "broken" code, because we moved to xhtml and
browser.xhtml doesn't use a XUL <window> anymore.

Since we reflow now the popup _after_ the anchor rather than before, we
don't need to rely on CheckForAnchorChange() to deal with changes. This
means that we need to notify on the positioning changes that happen
during reflow though.

We should be able to simplify a bit the CheckForAnchorChange() stuff
now, but it also takes care of hiding popups and such so I don't plan to
do it on this bug to minimize risk.

Differential Revision: https://phabricator.services.mozilla.com/D91012
2020-10-06 16:28:33 +00:00
Narcis Beleuzu
55d91af3b8 Backed out 2 changesets (bug 1666497, bug 1489259) for bc failure on browser_appmenu.js
Backed out changeset aa49cdc20ff4 (bug 1489259)
Backed out changeset 368f054779b2 (bug 1666497)
2020-10-05 21:38:08 +03:00
Emilio Cobos Álvarez
13f858ff1a Bug 1666497 - Fix various issues with anchored popups. r=NeilDeakin
The patch in bug 1666497 (which makes regular <window>-based XUL
documents with other the XHTML-based ones) uncovers an issue in the
anchored popup tests, which starts timing out.

The underlying issue is that it changes the reflow order from popups in
XUL-only documents with respect to their anchors. Note that Firefox
already uses the "broken" code, because we moved to xhtml and
browser.xhtml doesn't use a XUL <window> anymore.

Since we reflow now the popup _after_ the anchor rather than before, we
don't need to rely on CheckForAnchorChange() to deal with changes. This
means that we need to notify on the positioning changes that happen
during reflow though.

We should be able to simplify a bit the CheckForAnchorChange() stuff
now, but it also takes care of hiding popups and such so I don't plan to
do it on this bug to minimize risk.

Differential Revision: https://phabricator.services.mozilla.com/D91012
2020-10-05 13:34:59 +00:00
Csoregi Natalia
231777144e Backed out changeset 1b76f477b19c (bug 1666497) for unexpected reflow failures. CLOSED TREE 2020-10-03 00:50:15 +03:00
Emilio Cobos Álvarez
43e7bad0b6 Bug 1666497 - Fix various issues with anchored popups. r=NeilDeakin
The patch in bug 1666497 (which makes regular <window>-based XUL
documents with other the XHTML-based ones) uncovers an issue in the
anchored popup tests, which starts timing out.

The underlying issue is that it changes the reflow order from popups in
XUL-only documents with respect to their anchors. Note that Firefox
already uses the "broken" code, because we moved to xhtml and
browser.xhtml doesn't use a XUL <window> anymore.

Since we reflow now the popup _after_ the anchor rather than before, we
don't need to rely on CheckForAnchorChange() to deal with changes. This
means that we need to notify on the positioning changes that happen
during reflow though.

We should be able to simplify a bit the CheckForAnchorChange() stuff
now, but it also takes care of hiding popups and such so I don't plan to
do it on this bug to minimize risk.

Differential Revision: https://phabricator.services.mozilla.com/D91012
2020-10-02 14:33:14 +00:00
Simon Giesecke
9350e6b741 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

Differential Revision: https://phabricator.services.mozilla.com/D62604

--HG--
extra : moz-landing-system : lando
2020-02-20 11:40:14 +00:00
Dorel Luca
d5f9df8ee1 Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
Backed out changeset fd177b40b561 (bug 1613985)
Backed out changeset fb6d62b7f28d (bug 1613985)
2020-02-19 22:22:41 +02:00
Simon Giesecke
59b23375c0 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

Differential Revision: https://phabricator.services.mozilla.com/D62604

--HG--
extra : moz-landing-system : lando
2020-02-19 18:05:38 +00:00
Emilio Cobos Álvarez
a25126cd0d Bug 1611181 - Make direction use an enum class. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D60857

--HG--
extra : moz-landing-system : lando
2020-01-24 11:46:14 +00:00
Masayuki Nakano
527b3ff65b Bug 1609338 - Optimize usage and implementation of UIEvent::GetRangeParent() and UIEvent::RangeOffset() r=smaug
`UIEvent::GetRangeParent()` retrieves `nsIContent` instance but it needs to
return `already_AddRefed<nsINode>` because of a WebIDL method.  However,
`nsIContent` is better type in C++ code.  Therefore, this patch renames it
to `UIEvent::GetRangeParentContent()` and makes new `UIEvent::GetRangeParent()`
and just call it.

Additionally, some callers call `UIEvent::RangeOffset()` too, but that means
that they compute same things twice because both of them use
`nsLayoutUtils::GetContainerAndOffsetAtEvent()` with same input arguments.
Thus, `UIEvent::GetRangeParentContent()` should also return offset with optional
out argument.  (Note that this does not make `RangeOffset()` use
`GetRangeParentContent()` because using out parameter for range parent causes
unnecessary computation cost for `RangeOffset()`.)

Therefore, finally, `UIEvent::GetRangeParentContent()` becomes also an alias of
raw method `UIEvent::GetRangeParentContentAndOffset()` which also returns offset
with out argument.

Differential Revision: https://phabricator.services.mozilla.com/D60095

--HG--
extra : moz-landing-system : lando
2020-01-17 01:23:12 +00:00