This reverts commit 88008cd8ca.
Revert "Bug 2012637 - part 8: Make `nsContentUtils::ComparePoints` handle `TreeKind::Flat` and `TreeKind::FlatForSelection` correctly r=smaug,dom-core"
This reverts commit 73e6f6587b.
Revert "Bug 2012637 - part 7: Make `RangeUtils::CompareNodeToRangeBoundaries()` use `nsContentUtils::ComparePoints` with valid point in the tree r=smaug"
This reverts commit 6985d5e80f.
Revert "Bug 2012637 - part 6: Make `nsRange::CutContents()` convert the range boundaries to the ones in the DOM before comparing r=smaug"
This reverts commit 73b585af3d.
Revert "Bug 2012637 - part 5: Delete the default template parameter of `nsContentUtils::ComparePoints` and relatives r=smaug,dom-core"
This reverts commit 1a7f24e5b5.
Revert "Bug 2012637 - part 4: Make `nsContentUtils` use `nsIContent` for taking a child node as a parameter r=smaug"
This reverts commit a6ea8d6824.
Revert "Bug 2012637 - part 3: Add template `nsINode` API which can switch to call API from `TreeKind` r=smaug,dom-core,webidl"
This reverts commit a4211e9df0.
Revert "Bug 2012637 - part 2: Add `TreeKind::FlatForSelection` and change the template parameter of `ChildIteratorBase` to `TreeKind` r=smaug,dom-core"
This reverts commit 0241749ee7.
Revert "Bug 2012637 - part 1: Make `ChildIterBase` template class to re-implement `FlattenedChildIterator` for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio"
This reverts commit 9e71cb77fb.
This will make the main patch simpler. However, some of them do not
support `TreeKind::ShadowIncludingDOM` because it's unclear what
should return as a parent node of a child of `ShadowRoot`, what should
return as a child node of a shadow host. To avoid the developers to use
them on wrong assumptions, this patch makes the users use `DOM`, `Flat`
or `FlatForSelection` explicitly.
Differential Revision: https://phabricator.services.mozilla.com/D281305
There's still a ton of things that can be cleaned up after this, but
this setup is nicer.
For now, editor keeps getting set-up / torn down on BindToFrame. Seems
all that could be untangled, but step by step.
The preview stuff and placeholder can just be created on demand now,
rather than requiring frame reconstruction.
Also, nsSearchControlFrame and co no longer do anything of interest, so
move the still relevant bits elsewhere and remove them.
test_bug1248459.html is removed because it messes with the editor
selection using SpecialPowers, in a way such that it crosses shadow
boundaries, and messes up the selected state triggering debug asserts.
test_focus_docnav.xhtml now triggers a different code-path because of
the shadow root (rather than the frame tree traversal). Keep it working
for now by replacing it with something that isn't a shadow root.
Differential Revision: https://phabricator.services.mozilla.com/D282953
We always want to user aync notifications. The filtering controls how we draw if we use a pre-existing surface that has the wrong size, but in this case that is unlikely to happen due to the sync decode flag, but it would make the most sense if it did. We should update this to use best practices in case this code gets copied (which is exactly how this issue came up).
Differential Revision: https://phabricator.services.mozilla.com/D278253
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
Most callers of nsViewManager::GetRootWidget have a pres shell around
and don't need to care about views.
This is in preparation for bug 1994942, where we'll disconnect subdocs
from the view tree (and thus the view manager will not have the ability
to get a root widget).
Differential Revision: https://phabricator.services.mozilla.com/D269019
This reverts commit 0062ee7423.
Revert "Bug 1983375 - part 1: Define `MOZ_LOG_ONLY_DEBUG` and variants in `Logging.h` and sort it out `GetBoolName` for making it more generic r=emilio,padenot"
This reverts commit b61fa4819b.
We are making changes to many files. Very huge chunk of the changes are just renaming CSP -> PolicyContainer. Part 1 and part 2 are solely separated as frontend and backend. The unfortunate thing is, I mistakenly placed IDL changes in part 1, and many of those IDL changes affect frontend code too. I'm sorry for this inconvinience and hard to review patch(es).
(FWIW before this rewrite we had another patch stack. It is 25 patches and I believe isn't as comprehensive as this one. It also didn't replace CSP's inheritance but was copied alongside with CSP, but we decided to change our method and make policy conttainer contain CSP and copy it around after some discussion and reviews)
Differential Revision: https://phabricator.services.mozilla.com/D249248
This reverts commit 6b55918734.
Revert "Bug 1670200 - Part 2: Refactor test_drag_image_file.html test; r=tschuster"
This reverts commit bc6921f5e7.
Revert "Bug 1670200 - Part 1: Add log to dump flavors in nsITransferable for drag session; r=handyman"
This reverts commit 412b8cc3d6.
`screenX`, `screenY`, `clientX`, `clientY`, `x`, `y`, `offsetX` and `offsetY`
are now `double`. This patch makes the event classes aware of DOM events.
Currently, Chrome allows fractional values only for pointer events whose type
is not `click`, `auxclick` nor `contextmenu` (this exception is defined by the
Pointer Events spec). Therefore, this patch follows them.
I'm not sure about the untrusted events of non-pointer events, `click`,
`auxclick` and `contextmenu`. Chrome does check whether it's trusted or not
before applying `std::floor` or `std::round` at getter methods (I think that
using `std::round` in `offsetX` and `offsetY` is their bug at least for
untrusted events). This patch follows them for now but has a pref to allow
for all untrusted events.
Finally, for aligning to Chrome, this patch makes `click`, `auxclick` and
`contextmneu` keep using integer coordinates because it's recommended by the
Pointer Events spec.
Note that this changes the logic in `Event::GetPageCoords`. It rounded the
client point and scroll point before adding them. Similarly,
`Event::GetOffsetCoords` too. It rounded the client point before transforming
it. Therefore, in strictly speaking, this changes the behavior of other events
which keep returning integer coordinates. However, I don't see any issues in
our CI. So, for making the code simpler, let's use it and once we got some
regression reports caused by this, let's make them take additional param to
round the points to integer done in the traditional code.
Differential Revision: https://phabricator.services.mozilla.com/D222728
This patch makes the following patch simpler. Therefore, this patch just cast
`double` coordinates to `int32_t` points at initializing untrusted events.
Therefore, this does not change any behavior.
Differential Revision: https://phabricator.services.mozilla.com/D222727
getURIForDropEvent delegates to getURIForBrowsingContext -- the ground truth for
CA URIs.
This also adds a check that getURIForDropEvent is correctly called in CA tests.
We do not yet test that it returns the right value -- that is future work.
Differential Revision: https://phabricator.services.mozilla.com/D222192
Sends OOP drop events to content analysis for approval before sending them to
the DOM. It intercepts drop events at the browser level and sends them to CA
before calling stopPropagation and preventDefault on them. (CA also presents a
modal dialog over the tab.) The drag session then ends as usual in the parent
process but remains open on the related browser in the process where it would be
sent to the DOM while the drop is being analyzed. While CA runs, the browser
dispatches an eQueryDropTargetHittest event to locate the drop target while the
event screen coordinates are still valid. When CA is complete, a drop or
dragexit event is sent to the drop target (drop if it was approved by CA). Calls
to EndDragSession are delayed during this.
Differential Revision: https://phabricator.services.mozilla.com/D219201
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
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
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
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
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
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
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