Commit Graph
196 Commits
Author SHA1 Message Date
Sean Feng 3149d939df Bug 1906388 - Ensure dragend uses the same target as dragstart r=masayuki,dom-core
Since this issue is too obvious, I am not even sure I am doing the right
thing. This looks like it should be discovered years ago....

As far as I can tell from the spec, dragstart and dragend use the same node
as the target, but it's not always the same node in Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D215827
2024-07-16 14:53:18 +00:00
Ting-Yu Lin b7e4c25991 Bug 1150182 - Use strong-typed CSSIntSize instead of nsIntSize for canvas sizes. r=gfx-reviewers,layout-reviewers,emilio,nical
Canvas uses CSS pixels, so this patch encodes the information into the type
system. Some painting code still uses unknown sizes, so we need to use
`CSSIntSize::FromUnknownSize` and `ToUnknownSize()` to convert them.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D216463
2024-07-15 15:20:11 +00:00
Otto Länd ee85122101 Bug 1893119: apply code formatting via Lando
# ignore-this-changeset
2024-07-04 07:52:52 +00:00
David P 48b66f76d5 Bug 1893119: Part 22 - Make nsIDragService::StartDragSession return the nsIDragSession r=rkraesig,win-reviewers,gstoll,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D212298
2024-07-04 07:48:12 +00:00
David P e844cdeed5 Bug 1893119: Part 21 - Separate nsIDragService and nsIDragSession implementations r=gstoll,geckoview-reviewers,rkraesig,win-reviewers,m_kato
Split the class inheritance trees for nsIDragService and nsIDragSession.
Remember that, before the start of this patch series, the inheritance
diagram was:

nsDragService -> nsBaseDragService -> nsIDragService + nsIDragSession

and the only instance was a singleton.  We switched it to:

nsDragService -> nsDragSession -> nsBaseDragService -> nsIDragService + nsBaseDragSession -> nsIDragSession

and maintained the singleton.  This allowed us to allow us to move things to
the new classes without breaking behavior.  We are done with that,
so we can now change the inheritance to its final form:

nsDragService -> nsBaseDragService -> nsIDragService

nsDragSession -> nsBaseDragSession -> nsIDragSession

Of course, we also need to properly construct and release the
nsIDragSessions (formerly part of the singleton), so that is done here as
well.  That happens in nsBaseDrag[Service|Session] for parent process drags
and in nsDrag[Service|Session]Proxy for content.  This is all fairly
straightforward, except in the case of gtk, where we need to change
some callback behavior.

Differential Revision: https://phabricator.services.mozilla.com/D211084
2024-07-04 07:48:11 +00:00
David P 5c77b63f65 Bug 1893119: Part 20 - Move EndDragSession from nsIDragService to nsIDragSession r=gstoll,rkraesig,win-reviewers,geckoview-reviewers,m_kato
This is a straightforward move.  It does take the liberty of breaking out an
EndDragSessionImpl method, which will be needed later.

Differential Revision: https://phabricator.services.mozilla.com/D211083
2024-07-04 07:48:11 +00:00
David Parks 447704fe80 Bug 1893119: Part 18 - Copy/Move MaybeAddBrowser, RemoveAllBrowsers and MustUpdateDataTransfer from nsIDragService to nsIDragSession r=geckoview-reviewers,gstoll,m_kato
MustUpdateDataTransfer is a simple function that makes more sense on
nsIDragSession.

MaybeAddBrowser records BrowserParents for processes with existing drag
sessions.  There may be such processes before the parent process
even has a drag session, so they cannot be tied to drag sessions.  We tie
them to the drag service, until the service creates a drag session in
the process, at which point we move them to the drag session.  Since
the session and service are still the same object and each now has methods
with these names, we leave part of session's implementation commented out
so that we run correctly instead of looping infinitely.  The code is
exposed when the objects separate later in the patch series.

Finally, the implementation of TakeSessionBrowserListFromService currently
amounts to a nop, but it will have substace when the service and session
are separated.

Differential Revision: https://phabricator.services.mozilla.com/D211081
2024-07-04 07:48:10 +00:00
David P 19861d5e8d Bug 1893119: Part 17 - Pass the widget to StartDragSession r=gstoll,rkraesig,win-reviewers,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D211080
2024-07-04 07:48:10 +00:00
David P c32e8a504a Bug 1893119: Part 16 - Make nsBaseDragService weakly remember PBrowsers instead of PContents r=nika,win-reviewers,rkraesig
nsBaseDragService keeps track of the processes that might need to cancel a drag with EndDragSession and this is technically correct since the drag session is a singleton in the child process, but this series of patches changes those sessions to be per-PuppetWidget/BrowserChild.  This allows content processes to distinguish which of its browsers is engaged in a drag.

Differential Revision: https://phabricator.services.mozilla.com/D211062
2024-07-04 07:48:09 +00:00
David P 808c72fba0 Bug 1893119: Part 15 - Give StartDragSessionForTests a window to start the drag session on r=gstoll,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D211079
2024-07-04 07:48:09 +00:00
David Parks f62a3a2577 Bug 1893119: Part 14 - Move SetDragEndPoint from nsBaseDragService to nsIDragSession r=gstoll,rkraesig,win-reviewers,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D211078
2024-07-04 07:48:08 +00:00
David Parks 88e30b7141 Bug 1893119: Part 13 - Move FireDragEventAtSource from nsIDragService to nsIDragSession r=gstoll,rkraesig,win-reviewers,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D211077
2024-07-04 07:48:08 +00:00
David P 3b7651c8d7 Bug 1893119: Part 12 - Move DragMoved from nsIDragService to nsIDragSession r=gstoll,rkraesig,win-reviewers,spohl
Differential Revision: https://phabricator.services.mozilla.com/D211076
2024-07-04 07:48:07 +00:00
David Parks a3af715796 Bug 1893119: Part 11 - Add widget to nsIDragService::InvokeDragSession and friends r=gstoll,rkraesig
This also moves InvokeDragSession from an IDL to a private one.

Differential Revision: https://phabricator.services.mozilla.com/D211075
2024-07-04 07:48:07 +00:00
David P c407e9dcea Bug 1893119: Part 10 - Move MaybeEditorDeletedSourceNode from nsIDragService to nsIDragSession r=gstoll,masayuki
MaybeEditorDeletedSourceNode was defined on nsIDragService but is more appropriately defined on nsIDragSession.  This was not an issue previously since those were the same object.

Differential Revision: https://phabricator.services.mozilla.com/D211074
2024-07-04 07:48:06 +00:00
David P 102bafa7f7 Bug 1893119: Part 9 - Move additional parts of nsIDragService to nsIDragSession r=gstoll,rkraesig,geckoview-reviewers,win-reviewers,m_kato
Moving additional methods and fields.  No substantive changes.

Differential Revision: https://phabricator.services.mozilla.com/D211073
2024-07-04 07:48:06 +00:00
David P 9f2046bb92 Bug 1893119: Part 8 - Prepare for nsBaseDragSession to be broken out of nsBaseDragService r=gstoll,rkraesig,win-reviewers,geckoview-reviewers,m_kato
Creates the nsBaseDragSession class and moves nsIDragSession's methods and data
into it.  This patch also does this for each platform-specific nsDragService
and the nsDragServiceProxy.  The result is that the drag service and drag
session are still one object in both the main and child processes, and the
inheritance diagram for each platform implementation goes from its present
from:

nsDragService -> nsBaseDragService -> nsIDragService + nsIDragSession

to:

nsDragService -> nsDragSession -> nsBaseDragService -> nsIDragService + nsBaseDragSession -> nsIDragSession

(and similar for the nsDragServiceProxy).

At the end of this patch series, the objects will be separated and the
inheritance diagram will be as expected:

nsDragService -> nsBaseDragService -> nsIDragService

nsDragSession -> nsBaseDragSession -> nsIDragSession

There are no substantive changes here -- it's essentially all cut
and paste to prepare to smoothly sever the unwanted inheritance.

Differential Revision: https://phabricator.services.mozilla.com/D211072
2024-07-04 07:48:06 +00:00
David Parks 2d44d1a9db Bug 1893119: Part 1 - Add widget/window parameter to nsIDragService::GetCurrentSession r=gstoll
We will need this to get the correct drag session in content when there are
multiple choices, and as a sanity check elsewhere.

Differential Revision: https://phabricator.services.mozilla.com/D215033
2024-07-04 07:48:03 +00:00
David P d3564fe920 Bug 1886604: Part 1: Add JS-scriptable MockDragService r=win-reviewers,edgar,rkraesig
Introduces MockDragService as a subclass/implementation of nsBaseDragService.
This class is based on the Windows implementation of nsBaseDragService.  The
service is created with a MockDragServiceController that JS can use to
initiate drag events that would normally come from the system.  Native
drag-and-drop is not permitted in automation because it puts the browser into
a state where, if anything goes wrong (e.g. a test failure), it cannot be
killed without manual intervention.  This allows us to avoid that limitation
while still testing most of the browser's drag-and-drop behavior, including
the (substantial and complex) nsBaseDragService base-class that is common to
all platforms.

Differential Revision: https://phabricator.services.mozilla.com/D205640
2024-07-04 01:03:33 +00:00
Fatih 4e77f4c796 Bug 1871789 - Spoof mozInputSource and mozPressure for RFP. r=tjr,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D209543
2024-05-16 19:43:12 +00:00
Emilio Cobos Álvarez 85dd27bb14 Bug 1896586 - Remove FlushType::Display check from PresShell::NeedFlush. r=smaug
PresShell doesn't do anything different if it gets called with
FlushType::Display vs FlushType::Layout. It should be fine to just pass
FlushType::Layout where appropriate and remove the redundant check.

Differential Revision: https://phabricator.services.mozilla.com/D210274
2024-05-14 21:17:17 +00:00
Edgar Chen 546880ae4d Bug 1867636 - Rename nsITransferable::requestingPrincipal; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D207272
2024-04-18 10:06:07 +00:00
Edgar Chen 1e1e4b863b Bug 1881257 - Reset mSourceTopWindowContext when drag session end; r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D203103
2024-03-03 12:27:13 +00:00
Makoto Kato 8c7a39e69f Bug 1586471 - Part 3. Allow to drop data from external application on GeckoView. r=dom-core,geckoview-reviewers,amejiamarmol,edgar
The dropped item is set on drop event handler in Android. Current
Gecko's implementation caches dropped item as `DataTransfer` when any
drag events are fired. It will works on desktop platform, but doesn't
on GeckoView. Even if drop item is set by handling drop event,
`DataTransfer`'s cache isn't refreshed.

So if drop event is received, we re-fill DataTransfer on GeckoView.

Differential Revision: https://phabricator.services.mozilla.com/D197331
2024-01-28 07:49:53 +00:00
Makoto Kato d6e3af6a30 Bug 1586471 - Part 1. Handle WidgetDragEvent by DispatchInputEvent. r=botond
Main thread and APZ controller thread are different on GeckoView. Some
drag events cannot be converted to InputData and aren't handled by APZ.

So we need consider drag events more for GeckoView.

Differential Revision: https://phabricator.services.mozilla.com/D197329
2024-01-28 07:49:53 +00:00
Edgar Chen b33a91a4e2 Bug 1851041 - Part 2: Add some log in DragService for debugging; r=rkraesig,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D189625
2023-10-06 21:23:45 +00:00
Natalia Csoregi 3706a617b6 Backed out 3 changesets (bug 1851041) for causing bustage on nsClipboard.cpp. CLOSED TREE
Backed out changeset 5cb270a4e6b6 (bug 1851041)
Backed out changeset f6e5e427d8e8 (bug 1851041)
Backed out changeset 7c7228999e18 (bug 1851041)
2023-10-05 23:59:45 +03:00
Edgar Chen 7c11d58d7f Bug 1851041 - Part 2: Add some log in DragService for debugging; r=rkraesig,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D189625
2023-10-05 18:46:13 +00:00
Mathew Hodson 28aa899942 Bug 1564391 - Rename internal uses of mozInputSource. r=emilio,pip-reviewers,tabbrowser-reviewers,dao,kpatenio
This allows us to deprecate `mozInputSource` for the Web while
avoiding console warnings for internal uses, which now use the
ChromeOnly `inputSource` attribute.

Differential Revision: https://phabricator.services.mozilla.com/D183643
2023-07-26 09:27:45 +00:00
Emilio Cobos Álvarez c195031050 Bug 1825825 - Simplify NAC setup. r=smaug
Make all UA widgets also NAC.

Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.

This is important because two callers depend on this difference:

 * The style system, since we still want to match content rules from
   stylesheets in the UA widget. We also match user rules, which is a
   bit sketchy, but that was the previous behavior, will file a
   follow-up for that.

 * The reflector code, since we want the scope for UA widgets to not
   include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
   got it wrong.

After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.

Differential Revision: https://phabricator.services.mozilla.com/D174310
2023-04-05 09:19:15 +00:00
Emilio Cobos Álvarez 4476ce0a2d Bug 1824986 - Use element more in popup manager code. r=mstange
We know these are elements, take advantage of that.

Depends on D173836

Differential Revision: https://phabricator.services.mozilla.com/D173837
2023-03-28 14:33:19 +00:00
Masayuki Nakano bac7c8c19a Bug 1820972 - Make nsBaseDragService::FireDragEventAtSource update mSourceNode if it's disconnected while HTMLEditor deletes selection caused by a drag operation r=edgar
The source node is typically a text node, and it may be editable by
`contenteditable` or `designMode`.  In that case, the source node may be removed
during the DnD session even without tricky JS code.  In this case, Blink and
WebKit updates the source node to dispatch `dragend` to the editing host.
This behavior does not conform to the standardized DnD behavior, however,
this is reasonable for editor apps which want to listen to events in editing
host or window/document for footprint and/or performance reason.  Therefore,
we should follow their behavior.

Differential Revision: https://phabricator.services.mozilla.com/D172091
2023-03-16 06:37:18 +00:00
Jonathan Kew e2c069db1f Bug 1815404 - Replace most uses of gfxContext::CreateOrNull with stack-allocated contexts. r=gfx-reviewers,lsalzman
Depends on D170370

Differential Revision: https://phabricator.services.mozilla.com/D170371
2023-02-21 07:28:25 +00:00
Jonathan Kew e998377ebb Bug 1815404 - Remove refcounting from gfxContext. r=gfx-reviewers,lsalzman
Depends on D170367

Differential Revision: https://phabricator.services.mozilla.com/D170369
2023-02-21 07:28:24 +00:00
Edgar Chen fa0263159b Bug 1809122 - Track top-level window context in DragSession; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D169121
2023-02-13 18:44:04 +00:00
Emilio Cobos Álvarez 39ff190814 Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin,stransky
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-24 15:43:49 +00:00
Iulian Moraru 38911deaa3 Backed out changeset f9a25f51a254 (bug 1811487) for causing bc failures related to PanelMultiView. CLOSED TREE 2023-01-23 21:11:43 +02:00
Emilio Cobos Álvarez 5002945f2b Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-23 16:15:00 +00:00
Butkovits Atila 48e5be2ff6 Backed out 2 changesets (bug 1811487) for causing failures at browser_PanelMultiView_keyboard.js. CLOSED TREE
Backed out changeset 88c5316c2183 (bug 1811487)
Backed out changeset 6350911c1c8d (bug 1811487)
2023-01-23 16:18:50 +02:00
Emilio Cobos Álvarez 06c43f1502 Bug 1811487 - Clean-up popup hide / rollup APIs. r=cmartin
I'm about to extend them for bug 1811486, where I want to force in some
cases the rolled up popups to hide synchronously. These APIs use a ton
of boolean arguments that make them error prone, so refactor them a bit
to use strongly typed enums and flags.

Differential Revision: https://phabricator.services.mozilla.com/D167381
2023-01-23 11:58:25 +00:00
Neil Deakin 4c89285d06 Bug 1777149, ensure the dropEffect is being set correctly when a drop ends in a different process, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D153979
2022-08-10 23:55:08 +00:00
Emilio Cobos Álvarez 893e093b01 Bug 1779598 - Stop passing around Maybe<SVGImageContext>. r=aosmond
All its members are optional, so we can just use it as a plain struct
rather than Maybe<> all around, which simplifies the code and prevents
silly bugs like bug 1779592.

Mostly automatic via:

  rg -l 'SVGImageContext' . | xargs sed -i 's/Maybe<SVGImageContext>/SVGImageContext/g'

With trivial build fixes.

Not intended to change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151846
2022-07-14 16:03:25 +00:00
Emilio Cobos Álvarez df848b8114 Bug 1767944 - Fix drag image coordinates after bug 1753836. r=tnikkel
The existing code was relying on the drag event coordinates being
already unscaled by the zoom, which bug 1753836 fixed.

This simplifies the relevant code and fixes the bug.

Differential Revision: https://phabricator.services.mozilla.com/D145578
2022-05-05 12:10:08 +00:00
Emilio Cobos Álvarez 069f63d2b3 Bug 1767165 - Fix dragend coordinates in child processes after bug 1756241. r=tnikkel
Bug 1756241 changed nsDragService::mDragEndPoint to be relative to the
window. I didn't realize, but that point is passed as-is to child
widgets. Changing the widget event to actually have a widget made the
point be interpreted as widget-relative (which is correct in the parent
process, but not in the child process). Account for this and fix the
mDragEndPoint documentation while at it.

Differential Revision: https://phabricator.services.mozilla.com/D145182
2022-05-02 10:09:41 +00:00
Emilio Cobos Álvarez 81ca7ca7af Bug 1756241 - Make Windows DragService have the same coordinate system as all other drag and mouse events. r=tnikkel
Passing the widget makes sure that in mixed dpi situations the pixels match
that of all other events.

The windows code was working around this by storing CSS pixels directly, but
with that tweak it's no longer needed.

Chances are I need to undo similarish workarounds on other platforms like
https://searchfox.org/mozilla-central/rev/caad7a563d267a8a06ed8c7222b21df91625f5ac/widget/gtk/nsDragService.cpp#2110,
will test there.

Differential Revision: https://phabricator.services.mozilla.com/D139243
2022-02-22 19:06:58 +00:00
Mike Hommey b9b2736d16 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
Neil Deakin 78cc48328e Bug 1727176, use window contexts for the drag and drop source, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123520
2021-08-31 00:58:34 +00:00
Masayuki Nakano 78f53525c3 Bug 1665550 - part 3: Make nsTextControlFrame set the source node and selection of drag session to new ones when it's reframed r=smaug
When `nsTextControlFrame` is reframed, `TextEditor`, anonymous `<div>`, its
`Text` and the independent `Selection`s are deleted temporarily and recreated
them.

If users are dragging text in `<input>` or `<textarea>`, the drag session's
source node is set to the anonymous text node in the element and the selection
is set to the independent selection.  So, if the element is reframed during a
drag, the source node is disconnected from the document and `EndDragSession`
failed to dispatch `eDragEnd` event.

Therefore, this patch makes `nsTextControlFrame` replaces the source node and
selection when it's recreated and only when the drag session's original source
node was in the text control element.  For checking which text control had the
anonymous text node, this patch makes `nsTextControlFrame` replaces source
node with the `<input>` or `<textarea>` element when the frame is destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D119487
2021-07-14 01:20:19 +00:00
Hiroyuki Ikezoe 3fb868fce9 Bug 1700245 - Split PresShell::ClearMouseCapture into two functions, one takes nsIFrame, the other takes no argument. r=tnikkel
Depends on D119067

Differential Revision: https://phabricator.services.mozilla.com/D119068
2021-07-06 08:58:55 +00:00
Emilio Cobos Álvarez 49bdf16db5 Bug 941356 - Fix start offset of transformed drag images. r=botond
I'm not sure whether we should deal with ancestor scales and such. There
seemed to be a discussion about that in D77436 but dealing with
partially-3d-transformed content sounds like a massive pain. For now
this fixes the start point, which is a progression.

Differential Revision: https://phabricator.services.mozilla.com/D106896
2021-03-04 10:56:22 +00:00