Commit graph

709 commits

Author SHA1 Message Date
Sean Feng
bf4aca77b5 Bug 1739154 - Fix a bug where focus delegate step may be run when it shouldn't be r=emilio
According to the spec, focus delegate step should be run unless
the focus target is a shadow-including-ancestor of the current focus.
Our code didn't do this correctly.

Differential Revision: https://phabricator.services.mozilla.com/D138072
2022-02-08 01:04:23 +00:00
Kagami Sascha Rosylight
3467779e0f Bug 1697256 - Check docshell existence in SetFocusInner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D111950
2022-01-21 21:49:39 +00:00
Sandor Molnar
b044550138 Backed out changeset a428c4aa428e (bug 1697256) for causing crashtest failures in dom/base/crashtests/1697256.html CLOSED TREE 2022-01-21 20:20:17 +02:00
Kagami Sascha Rosylight
d3f9e54186 Bug 1697256 - Check docshell existence in SetFocusInner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D111950
2022-01-21 16:31:36 +00:00
Emilio Cobos Álvarez
d95d7abddc Bug 1735076 - Use ProgrammaticFocusFlags from nsXULCommandDispatcher. r=smaug
Relevant calls are here:

  https://searchfox.org/mozilla-central/rev/21a9b72545da06681db97c4b3a2a6be761f4aae5/toolkit/content/widgets/button.js#42-68

This makes sure to set the FLAG_BYKEY properly if needed, instead of passing
down raw flags to nsFocusManager. Clean up a bit while at it.

Let me know if you want a test for this, but we have tests for programmatic
focus and :focus-visible already, so my gut feeling is that testing this
particular XUL-specific change is not super-worth-it...

Differential Revision: https://phabricator.services.mozilla.com/D133690
2021-12-23 18:34:05 +00:00
Kagami Sascha Rosylight
c5662e876e Bug 1539884 - Part 37: Add strong references for arguments in callers r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134475
2021-12-23 16:27:26 +00:00
Noemi Erli
70d14084ab Backed out changeset 93b9da069dde (bug 1735076) for causing failures in browser_searchbar_openpopup.js CLOSED TREE 2021-12-21 21:53:42 +02:00
Emilio Cobos Álvarez
4a513d4585 Bug 1735076 - Use ProgrammaticFocusFlags from nsXULCommandDispatcher. r=smaug
Relevant calls are here:

  https://searchfox.org/mozilla-central/rev/21a9b72545da06681db97c4b3a2a6be761f4aae5/toolkit/content/widgets/button.js#42-68

This makes sure to set the FLAG_BYKEY properly if needed, instead of passing
down raw flags to nsFocusManager. Clean up a bit while at it.

Let me know if you want a test for this, but we have tests for programmatic
focus and :focus-visible already, so my gut feeling is that testing this
particular XUL-specific change is not super-worth-it...

Differential Revision: https://phabricator.services.mozilla.com/D133690
2021-12-21 18:22:30 +00:00
Kagami Sascha Rosylight
b9a3803727 Bug 1539884 - Part 5: Mark Focus*Event::Run as CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Depends on D133914

Differential Revision: https://phabricator.services.mozilla.com/D133915
2021-12-16 17:17:06 +00:00
Butkovits Atila
125116c312 Backed out 8 changesets (bug 1539884) for causing build bustages at Document.cpp. CLOSED TREE
Backed out changeset ad65ce9208ce (bug 1539884)
Backed out changeset 15d728ef97ca (bug 1539884)
Backed out changeset de9e2829d42a (bug 1539884)
Backed out changeset a8cfa2201751 (bug 1539884)
Backed out changeset ca21c5838f37 (bug 1539884)
Backed out changeset 3d3019f61b5a (bug 1539884)
Backed out changeset ca7c808621d6 (bug 1539884)
Backed out changeset 57068a40f3c9 (bug 1539884)
2021-12-16 08:12:15 +02:00
Kagami Sascha Rosylight
778444dbf6 Bug 1539884 - Part 5: Mark Focus*Event::Run as CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Depends on D133914

Differential Revision: https://phabricator.services.mozilla.com/D133915
2021-12-16 02:58:45 +00:00
Masayuki Nakano
3816ca9546 Bug 1741148 - part 3: Make users of nsINode::ComputeIndexOf_Deprecated() use nsINode::ComputeIndexOf() if the result is not set to int32_t nor return as int32_t r=smaug
This patch fixes only the cases if the result of `ComputeIndexOf_Deprecated()`
is used as unsigned integer with implicit or explicit cast.

Differential Revision: https://phabricator.services.mozilla.com/D131336
2021-12-09 11:55:36 +00:00
Masayuki Nakano
f2baf0d9ab Bug 1741148 - part 1: Rename nsINode::ComputeIndexOf to ComputeIndexOf_Deprecated r=smaug
It's hard to fix some callers.  Therefore, in this bug, we should fix only
simple cases.  Therefore, we should rename existing API first.

Differential Revision: https://phabricator.services.mozilla.com/D131334
2021-12-09 08:32:30 +00:00
Mike Hommey
8e411675ac 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
Masayuki Nakano
c84dfd928f Bug 1455514 - part 2: Add accessors and static helper methods to retrieve nsPIDOMWindowInner, nsPIDOMWindowOuter and nsPIWindowRoot r=smaug
Similar to the previous patch, there are a lot of QI from `EventTarget` to
window interfaces.  This patch adds them, but unfortunately,
`nsPIDOMWindowInner` and `nsPIDOMWindowOuter` do not inherit `EventTarget`
directly, and they are in a public header instead of their concrete classes
(`nsGlobalWindowInner` and `nsGlobalWindowOuter`).  So we cannot cast them
in `nsPIDOMWindow.h`, and it causes it's impossible to use the macros added
by the previous patch.

Differential Revision: https://phabricator.services.mozilla.com/D129782
2021-11-02 13:03:43 +00:00
Masayuki Nakano
4341d6fb0c Bug 1455514 - part 1: Add accessors and static helper methods to retrieve nsINode or its concrete classes from EventTarget r=smaug
Currently, checking whether an `EventTarget` is `nsINode` (or its concrete
classes) or not requires a QI, but it's expensive and used a lot while we
handle each event.  Therefore, it'd be nicer for creating a virtual method,
`EventTarget::IsNode()` and use it for the check.

If trying to convert `EventTarget` to a concrete class, it may require two
virtual method calls.  I'm not sure whether it's cheaper than a QI, but at
least, it won't depend on the UUID check order of `QueryInterface()` when
multiple interfaces are implemented.

Differential Revision: https://phabricator.services.mozilla.com/D129781
2021-11-02 13:03:43 +00:00
Emilio Cobos Álvarez
26b46103f4 Bug 1737020 - Update delegatesFocus to use its shadow tree rather than the flat tree. r=smaug,sefeng
This behavior is much more reasonable and aligns with developers
expectations better, see https://github.com/whatwg/html/issues/7207.

Differential Revision: https://phabricator.services.mozilla.com/D129146
2021-10-21 16:09:00 +00:00
Masayuki Nakano
25a3c48305 Bug 1732845 - Add nsINode::IsInDesignMode() to check whether the node is directly in design mode r=smaug
There are a lot of check of `Document`'s editable state **with** comments. This
means that it's unclear for developers that only `Document` node is editable in
design mode.

Additionally, there are some points which use composed document rather than
uncomposed document even though the raw API uses uncomposed document. Comparing
with the other browsers, checking uncomposed document is compatible behavior,
i.e., nodes in shadow trees are not editable unless `contenteditable`.

Therefore, `nsINode` should have a method to check whether it's in design mode
or not.

Note that it may be called with a node in UA widget.  Therefore, this patch
adds new checks if it's in UA widget subtree or native anonymous subtree,
checking whether it's in design mode with its host.

Differential Revision: https://phabricator.services.mozilla.com/D126764
2021-10-12 03:14:43 +00:00
Daniel Holbert
ed93bd5007 Bug 1733465 part 2: Modernize nsViewManager::GetRootWidget() to use already_AddRefed return value, instead of requiring getter_AddRefs at callsite. r=tnikkel
This patch shouldn't change behavior at all.

This patch replaces a manual NS_ADDREF call with typesafe code that manages the
reference count for us.  This reduces repeated boilerplate code, in the
implementation as well as the callsites.

Differential Revision: https://phabricator.services.mozilla.com/D127179
2021-10-01 20:38:09 +00:00
Sandor Molnar
325902a5b7 Backed out 5 changesets (bug 1733465) for causing android build bustages in android/SessionAccessibility.cpp. CLOSED TREE
Backed out changeset 4c5b28b66740 (bug 1733465)
Backed out changeset 3db0452b185c (bug 1733465)
Backed out changeset d7460c9c6acb (bug 1733465)
Backed out changeset 3cee3f595e45 (bug 1733465)
Backed out changeset 267d5fc92f12 (bug 1733465)
2021-10-01 19:13:59 +03:00
Daniel Holbert
5b203843bc Bug 1733465 part 2: Modernize nsViewManager::GetWidget() to use already_AddRefed return value, instead of requiring getter_AddRefs at callsite. r=tnikkel
This patch shouldn't change behavior at all.

This patch replaces a manual NS_ADDREF call with typesafe code that manages the
reference count for us.  This reduces repeated boilerplate code, in the
implementation as well as the callsites.

Differential Revision: https://phabricator.services.mozilla.com/D127179
2021-10-01 14:37:05 +00:00
Karl Tomlinson
2eca6f32f6 Bug 1733301 generate action ID for focusmanager.testmode WindowRaised() at time of call r=hsivonen
for consistency with OS-triggered calls
https://searchfox.org/mozilla-central/rev/b022ae1fc071ad7a29f64f281bc19b7b093df538/xpfe/appshell/AppWindow.cpp#3005
and so that interleaved element-focus actions don't make the active toplevel
window change notification (and its associated content window focus changes)
stale.

Differential Revision: https://phabricator.services.mozilla.com/D127029
2021-09-30 06:48:37 +00:00
Peter Van der Beken
24ff2ec352 Bug 1720990 - Clear mActiveBrowsingContextInContent when a page goes into the BFCache. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D123941
2021-09-13 16:57:15 +00:00
Sean Feng
86de9dbadd Bug 1413836 - Implement the focusing steps for delegatesFocus r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123862
2021-09-07 15:01:36 +00:00
Marian-Vasile Laza
62d525db78 Backed out changeset 9bc536ff95be (bug 1720990) for causing bc failures on browser_bfcache_copycommand.js. CLOSED TREE 2021-09-07 12:52:54 +03:00
Peter Van der Beken
1887defe4a Bug 1720990 - Clear mActiveBrowsingContextInContent when a page goes into the BFCache. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D123941
2021-09-07 08:49:26 +00:00
Cosmin Sabou
efbb4a2760 Backed out 8 changesets (bug 1413836) for delegatesFocus related wpt failures. CLOSED TREE
Backed out changeset 53c86681259e (bug 1413836)
Backed out changeset dc6a694146fd (bug 1413836)
Backed out changeset ae89d15d28eb (bug 1413836)
Backed out changeset 979fef259e32 (bug 1413836)
Backed out changeset d829be6f2813 (bug 1413836)
Backed out changeset c1d1d4b5ab74 (bug 1413836)
Backed out changeset 19e3256ea07c (bug 1413836)
Backed out changeset dc8d5d9533e4 (bug 1413836)
2021-09-03 20:48:24 +03:00
Sean Feng
70937ca42d Bug 1413836 - Implement the focusing steps for delegatesFocus r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123862
2021-09-03 13:32:27 +00:00
Sean Feng
b6ab38886a Bug 1724816 - Check the focused window still persists after MoveCaretToFocus r=smaug
In nsFocusManager::UpdateCaret, the focused window has a null check
at the beginning of the function. However, this isn't enough because
MoveCaretToFocus can possibly run scripts as well, and the scripts
may clear the focused window.

This patch adds a null check after the usage of MoveCaretToFocus.

Differential Revision: https://phabricator.services.mozilla.com/D122750
2021-08-16 18:51:26 +00:00
Andi-Bogdan Postelnicu
f07c975367 Bug 1519636 - Reformat recent changes to the Google coding style. r=necko-reviewers,emilio
Updated with clang-format version 12.0.0 (taskcluster-FZRqPXamQIOU_i4hF0cAcg)

Differential Revision: https://phabricator.services.mozilla.com/D117905
2021-06-17 11:00:22 +00:00
Henri Sivonen
3e40a36745 Bug 1713624 - Null out mFocusedWindow when receiving OOP focused BrowsingContext. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D117156
2021-06-09 15:08:36 +00:00
Henri Sivonen
fed8756f39 Bug 1681983 - Adjust a comment in nsFocusManager for Fission. r=NeilDeakin DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D116215
2021-06-09 14:45:05 +00:00
Brindusan Cristian
f1c800c956 Backed out changeset 5d7dec65aced (bug 1681983) for causing mochitest failures in test_focus.xhtml.
CLOSED TREE
2021-06-08 00:41:59 +03:00
Henri Sivonen
9b5990ba79 Bug 1681983 - Make SetFocusedWindowWithCallerType not call ClearFocus. r=NeilDeakin
No test, because the expectation is that this code is not actually exercised anyway.

Differential Revision: https://phabricator.services.mozilla.com/D116215
2021-06-07 17:42:21 +00:00
Sandor Molnar
f54d590b19 Backed out changeset a385ad897612 (bug 1681983) for causing reftest failures. CLOSED TREE 2021-06-03 17:48:07 +03:00
Henri Sivonen
5ecf096b95 Bug 1681983 - Make SetFocusedWindowWithCallerType speculatively more Fission-aware. r=NeilDeakin
No test, because the expectation is that this code is not actually exercised anyway.

Differential Revision: https://phabricator.services.mozilla.com/D116215
2021-06-03 13:40:09 +00:00
Edgar Chen
2d24105bd2 Bug 1712038 - Exit fullscreen only when the focus change will raise the window; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D116182
2021-05-28 20:42:32 +00:00
Emilio Cobos Álvarez
2314b37da7 Bug 1712724 - Don't trigger select on programmatic focus during keyboard events. r=smaug
Depends on D115900

Differential Revision: https://phabricator.services.mozilla.com/D115901
2021-05-26 11:21:44 +00:00
Emilio Cobos Álvarez
d289bd695b Bug 1712724 - Cleanup focus method mask usage. r=smaug
No behavior change, since `GetLastFocusMethod` is only checked by `HTMLInputElement.cpp` / `nsGlobalWindowInner.cpp` for FLAG_BYKEY, and some JS code for `FLAG_BYMOUSE`.

But this makes the next patch more straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D115900
2021-05-26 11:21:44 +00:00
Alexandru Michis
1df3b4b4d2 Backed out 3 changesets (bug 1712724) for causing mochitests without e10s failures in test_focus.xhtml
CLOSED TREE

Backed out changeset 61d8ca98120b (bug 1712724)
Backed out changeset 46b1d60b6b6b (bug 1712724)
Backed out changeset 36504d508b34 (bug 1712724)
2021-05-26 08:18:02 +03:00
Emilio Cobos Álvarez
ef6415ef1f Bug 1712724 - Don't trigger select on programmatic focus during keyboard events. r=smaug
Depends on D115900

Differential Revision: https://phabricator.services.mozilla.com/D115901
2021-05-25 22:29:02 +00:00
Emilio Cobos Álvarez
8dea5d3fa5 Bug 1712724 - Cleanup focus method mask usage. r=smaug
No behavior change, since `GetLastFocusMethod` is only checked by `HTMLInputElement.cpp` / `nsGlobalWindowInner.cpp` for FLAG_BYKEY, and some JS code for `FLAG_BYMOUSE`.

But this makes the next patch more straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D115900
2021-05-25 22:29:01 +00:00
Emilio Cobos Álvarez
bdb1583dff Bug 1711057 - Consider programmatic focus during keyboard input as key focus. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D115137
2021-05-17 13:46:50 +00:00
Edgar Chen
a3ff3d48aa Bug 1709200 - Rename nsContentUtils::GetRootDocument to GetInProcessSubtreeRootDocument; r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D114177
2021-05-05 09:42:20 +00:00
Henri Sivonen
ffad9ff507 Bug 1708632 - Apply reviewbot formatting to focus logging. r=edgar
Apply reviewbot's formatting changes to bug 1696323.

Differential Revision: https://phabricator.services.mozilla.com/D113915
2021-04-30 09:04:22 +00:00
Henri Sivonen
2ea7308888 Bug 1696323 - Return early when attempting to focus a remote iframe whose BrowsingContext is already the focused one. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D112534
2021-04-29 12:51:39 +00:00
imoraru
6349660632 Backed out changeset 12893215ed66 (bug 1696323) for OS X build bustages on BrowserBridgeChild.cpp. CLOSED TREE 2021-04-29 13:09:17 +03:00
Henri Sivonen
e56b92eb66 Bug 1696323 - Return early when attempting to focus a remote iframe whose BrowsingContext is already the focused one. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D112534
2021-04-29 09:43:53 +00:00
smolnar
b870a28dcc Backed out changeset 1abffab5d5e9 (bug 1697256) for causing reftest failures in crashtests/1697256. CLOSED TREE 2021-04-14 15:25:49 +03:00
Kagami Sascha Rosylight
4f93853004 Bug 1697256 - Check docshell existence in SetFocusInner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D111950
2021-04-14 11:02:16 +00:00