Commit Graph

582 Commits

Author SHA1 Message Date
Henri Sivonen
b8a4f383ac Bug 1621903 - Avoid reading mActiveWindow from a content process in RaiseWindow in test mode. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D66194
2020-03-17 10:53:24 +00:00
Henri Sivonen
dcd0c75524 Bug 1620174 - Avoid reading mActiveWindow from a content process in RaiseWindow. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D66193
2020-03-11 15:10:33 +00:00
Henri Sivonen
3cb377fed7 Bug 1620172 - Use GetActiveBrowsingContext for full screen auto-exit. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D66009
2020-03-11 16:00:45 +00:00
Henri Sivonen
4b59a62d30 Bug 1620946 - Indicate content-process use of mActiveWindow in comments. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D65951
2020-03-11 15:10:21 +00:00
Henri Sivonen
6faf631e19 Bug 1615548 - Blur OOP iframes when focus moves to chrome. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D65090
2020-03-11 15:10:19 +00:00
Emilio Cobos Álvarez
0489e594e6 Bug 1621203 - Don't use IsEqualNode in nsFocusManager. r=smaug
There's no reason to.

Differential Revision: https://phabricator.services.mozilla.com/D66192
2020-03-10 11:30:51 +00:00
Timothy Nikkel
fe6b2ae8c1 Bug 1616373. Handle the browsing context housing the active window moving to a different content process. r=hsivonen
My understanding of the problem is as follows. We create the main content document, first it is about:blank in a content process. When the bug happens the about:blank document has WindowRaised called on it and this makes it the active window, and then it tells the parent process that it is the active browsing context (via SendSetActiveBrowsingContext). When the bug doesn't happen this doesn't happen, perhaps because we navigate away from about:blank before it can happen.

So the browsing context navigates to the new document and it gets moved to a different content process. BrowsingContextGroup::EnsureSubscribed is called, if the parent process got told of the active document above then we call SendSetupFocusedAndActive (if it didn't then the active browsing context remains null and so it doesn't call SendSetupFocusedAndActive). When the child gets RecvSetupFocusedAndActive it calls SetActiveBrowsingContextFromOtherProcess on the focus manager.

nsFocusManager::WindowRaised is called for the new document, we bail early because of this line

https://searchfox.org/mozilla-central/rev/d5b34cc8872177d3ee071e06f787c2a14268595b/dom/base/nsFocusManager.cpp#661

because we are the browsing context that was set from another process. And so we fail to make the Focus call at the end of that function. So mFocusedWindow remains null in the child process.

The nsFocusManager::WindowShown call that happens for every new document load thus does not do anything because this line

https://searchfox.org/mozilla-central/rev/d5b34cc8872177d3ee071e06f787c2a14268595b/dom/base/nsFocusManager.cpp#906

always fails because mFocusedWindow is null and it never changes.

Differential Revision: https://phabricator.services.mozilla.com/D65302
2020-03-05 03:27:57 +00:00
Henri Sivonen
bbb6a2ab81 Bug 1618798 - Remove nsIFocusManager::SetActiveWindow and JS callers thereof. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D64948
2020-03-04 07:42:00 +00:00
Henri Sivonen
825c84d559 Bug 1618803 - Remove nsFocusManager::SetActiveWindowWithCallerType. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D64727
2020-03-02 09:52:58 +00:00
Emilio Cobos Álvarez
4049bcb1bd Bug 1617600 - Prototype :focus-visible behind a flag. r=smaug
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.

This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.

Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.

Differential Revision: https://phabricator.services.mozilla.com/D63861
2020-02-26 14:16:20 +00:00
Noemi Erli
475bded625 Backed out 3 changesets (bug 1617600) for causing wpt failures in focus-visible-009.html CLOSED TREE
Backed out changeset 73d1a5e10337 (bug 1617600)
Backed out changeset b722714830cd (bug 1617600)
Backed out changeset 45464d926bf0 (bug 1617600)
2020-02-26 01:46:31 +02:00
Kris Maglione
232ff37e9f Bug 1535617: Part 2 - Clear weak references for most cycle collected objects on unlink. r=mccr8
This covers most cycle collected objects which support weak references, but
not the ones which inherit from a cycle collected class and don't do any cycle
collection on their own.

Differential Revision: https://phabricator.services.mozilla.com/D63962
2020-02-25 19:44:39 +00:00
Emilio Cobos Álvarez
77340c7537 Bug 1617600 - Prototype :focus-visible behind a flag. r=smaug
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.

This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.

Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.

Differential Revision: https://phabricator.services.mozilla.com/D63861
2020-02-25 17:58:28 +00:00
Henri Sivonen
0bb6ff45eb Bug 1556627 - Make nsFocusManager::SetFocus work in Fission. r=NeilDeakin,farre,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D55651
2020-02-18 13:30:04 +00:00
Edgar Chen
399eabe086 Bug 1604140 - Part 2: Should skip the shadow host we started on in frame traversal; r=smaug
The original check, `currentContent != startContent`, is to skip the element we started on in frame traversal.
This would happen for instance on a scrollable element, where frame traversal could return the element again.

However, in shadow dom case, the frame traversal may start on a redirected shadow host, where `startContent` is still the original start element.

Differential Revision: https://phabricator.services.mozilla.com/D61566
2020-02-13 10:05:07 +00:00
Edgar Chen
4816bd8355 Bug 1604140 - Part 1: Fix focus trap within shadow DOM when host is scrollable; r=smaug
The checks for `*TopLevelScopeOwner` are to skip the scope that we have already checked.
But when the shadow host is scrollable, we will traverse anonymous children for the scroll frame first in frame traversal and `oldTopLevelScopeOwner` will be reset.
Then we don't realize that we have already checked the host's scope.

Differential Revision: https://phabricator.services.mozilla.com/D60923
2020-02-17 15:59:52 +00:00
Simon Giesecke
9bcfd47601 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-13 14:38:48 +00:00
Csoregi Natalia
61e5ab9538 Backed out 3 changesets (bug 1604140) for multiple failures. CLOSED TREE
Backed out changeset 59fc63dfa309 (bug 1604140)
Backed out changeset cc54269377f2 (bug 1604140)
Backed out changeset 8897a2187a95 (bug 1604140)
2020-02-13 11:55:36 +02:00
Edgar Chen
73b47462f6 Bug 1604140 - Part 2: Should skip the shadow host we started on in frame traversal; r=smaug
The original check, `currentContent != startContent`, is to skip the element we started on in frame traversal.
This would happen for instance on a scrollable element, where frame traversal could return the element again.

However, in shadow dom case, the frame traversal may start on a redirected shadow host, where `startContent` is still the original start element.

Differential Revision: https://phabricator.services.mozilla.com/D61566
2020-02-13 00:16:47 +00:00
Edgar Chen
f716970b50 Bug 1604140 - Part 1: Fix focus trap within shadow DOM when host is scrollable; r=smaug
The checks for `*TopLevelScopeOwner` are to skip the scope that we have already checked.
But when the shadow host is scrollable, we will traverse anonymous children for the scroll frame first in frame traversal and `oldTopLevelScopeOwner` will be reset.
Then we don't realize that we have already checked the host's scope.

Differential Revision: https://phabricator.services.mozilla.com/D60923
2020-02-07 14:38:46 +00:00
Emilio Cobos Álvarez
3e5a2bb756 Bug 1614224 - Fix <dialog> focus wrap-around, and add tests for it. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62490
2020-02-12 18:10:22 +00:00
shindli
6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
d45525793f Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-12 17:24:41 +00:00
Cosmin Sabou
6dafbf3156 Backed out 1 changesets (bug 1614224) for mochitest failures on test_focus_dialog.xhtml. CLOSED TREE
Backed out changeset 4ae1a60a9e21 (bug 1614224)
2020-02-12 04:42:03 +02:00
Emilio Cobos Álvarez
4dbc88a0d2 Bug 1614224 - Fix <dialog> focus wrap-around, and add tests for it. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62490
2020-02-12 00:11:37 +00:00
Hiroyuki Ikezoe
940afd5668 Bug 1611561 - Fix the return value of the callback of CallOnAllRemoteChildren in nsFocusManager::ActivateOrDeactivate. r=smaug
I somehow made this mistake in https://hg.mozilla.org/mozilla-central/rev/0703637be2acb26954dab524c5b957e4b5189b50.

Differential Revision: https://phabricator.services.mozilla.com/D61097
2020-01-28 08:16:25 +00:00
Emilio Cobos Álvarez
5aad5fdc2e Bug 1574322 - We may wrap around when looking into what to focus if the start content is in shadow DOM. r=smaug
This was missing a check and as a result we were hanging. The simplified setup
is as follows:

<dialog>
  #shadow-root
    <panel>
      <!-- nothing focusable here -->

And chrome code calling advanceFocusIntoSubtree with <panel> as the start
content.

We first try starting at <panel>, then from the root. It's in this second try
where we fail to find anything into the <panel> subtree, but we don't realize we
wrapped around and should stop.

I think we should really look into unifying the shadow dom and non-shadow dom
focus code, these bugs are somewhat nasty :/

I don't think this is observable from the web because this second iteration
happens from here:

 * https://searchfox.org/mozilla-central/rev/220a3bd6063fcbe5ca50e88dcabdc7dee0aca448/dom/base/nsFocusManager.cpp#2916

And in the web case we'd hit the TabToTreeOwner call above...

Differential Revision: https://phabricator.services.mozilla.com/D61075
2020-01-28 08:12:18 +00:00
pbz
a7ba1df9c0 Bug 1432856 - Added console logging for DOM fullscreen leave on window raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55813
2020-01-16 14:39:02 +00:00
pbz
bceea407c5 Bug 1432856 - Added prefs for DOM fullscreen leave on window open or raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55812
2020-01-16 14:38:48 +00:00
pbz
9ca53ea171 Bug 1432856 - Extended focus methods in Window.webidl, Client.webidl and Element.webidl to pass CallerType. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55811
2020-01-16 14:38:40 +00:00
pbz
80773f0b0b Bug 1432856 - Leave DOM fullscreen on window raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55810
2020-01-16 14:38:21 +00:00
Emilio Cobos Álvarez
0534b20fd6 Bug 981248 - Rewrite <input type=number> to avoid an anonymous input. r=masayuki,surkov,jwatt,ntim,jfkthame,smaug
Instead, subclass nsTextControlFrame. This simplifies the code and avoids
correctness issues.

I kept the localization functionality though it is not spec compliant. But I
filed a bug to remove it in a followup.

Differential Revision: https://phabricator.services.mozilla.com/D57193
2020-01-14 19:01:05 +00:00
Mihai Alexandru Michis
b51ee7e327 Backed out 2 changesets (bug 981248) for causing multiple failures.
CLOSED TREE

Backed out changeset 7a96708cc8b7 (bug 981248)
Backed out changeset 1eace7bd28d9 (bug 981248)
2020-01-14 19:28:17 +02:00
Emilio Cobos Álvarez
c442c1b9ab Bug 981248 - Rewrite <input type=number> to avoid an anonymous input. r=masayuki,surkov,jwatt,ntim,jfkthame,smaug
Instead, subclass nsTextControlFrame. This simplifies the code and avoids
correctness issues.

I kept the localization functionality though it is not spec compliant. But I
filed a bug to remove it in a followup.

Differential Revision: https://phabricator.services.mozilla.com/D57193
2020-01-14 15:05:22 +00:00
Edgar Chen
d297478add Bug 1607223 - Part 4: Avoid performing check of next tabbable content on the first element of shadow dom duplicatedly; r=smaug
See https://bugzilla.mozilla.org/show_bug.cgi?id=1607223#c1 for the details.

Differential Revision: https://phabricator.services.mozilla.com/D58876
2020-01-07 18:36:25 +00:00
Edgar Chen
4ba9e5dd06 Bug 1607223 - Part 3: Simplify the logic of handling *topLevelScopeOwner; r=smaug
This patch contains three changes, but we just simpliy the logic, the result is the same,

1). s/oldTopLevelScopeOwner/currentTopLevelScopeOwner/
We can use either `oldTopLevelScopeOwner` or `currentTopLevelScopeOwner` in if-check, they point to the same element at that point.
Using `currentTopLevelScopeOwner` is clearer given that it is updated in the if-block.

2). remove else-block
We run into this else-block when `aForward && oldTopLevelScopeOwner == currentContent`,
so  `oldTopLevelScopeOwner`, `currentTopLevelScopeOwner` and `currentContent` all point to the same element.
It is not necessary to set `currentTopLevelScopeOwner` to `currentContent` again.

3). s/IsHostOrSlot(currentTopLevelScopeOwner)/currentTopLevelScopeOwner/
After above two changes, `currentTopLevelScopeOwner` is always set to result of `GetTopLevelScopeOwner(currentContent)`,
so we don't need `IsHostOrSlot()` checks. And there is an asserion in `HostOrSlotTabIndexValue()` to ensure it is either a host or slot.

Differential Revision: https://phabricator.services.mozilla.com/D58810
2020-01-07 15:31:08 +00:00
Edgar Chen
3bd8c1382e Bug 1607223 - Part 2: Fix GetTopLevelScopeOwner; r=smaug
Currently if we call `GetTopLevelScopeOwner` with a <slot> which is in top-level-scope, e.g. `<body><slot></slot></body>`.
It returns <slot> itself, but it should returns `nullptr` per design.

Differential Revision: https://phabricator.services.mozilla.com/D58805
2020-01-07 12:42:58 +00:00
Edgar Chen
a3d9db5357 Bug 1607223 - Part 1: Update the comment of FindOwner and rename function name to FindScopeOwner; r=smaug
After bug 1544826, `FindOwner` returns only shadow host or slot, update the
comment and rename it to `FindScopeOwner` to reflect the current behavior.

Differential Revision: https://phabricator.services.mozilla.com/D58578
2020-01-07 11:37:26 +00:00
Emilio Cobos Álvarez
1278d10333 Bug 1595435 - Allow content to steal focus from a cross-origin iframe. r=masayuki
This matches other browsers.

Keep the restriction just to chrome nodes, and in that case, avoid getting into
the broken state, which is what causes the issue. I'm not sure if this even
matters anymore given e10s but...

Differential Revision: https://phabricator.services.mozilla.com/D57475
2019-12-25 06:50:25 +00:00
Hiroyuki Ikezoe
e16b1cf1f5 Bug 1596317 - Use CallState for nsContentUtils::CallOnAllRemoteChildren. r=smaug
`true` -> `CallState::Stop`
`false` -> `CallState::Continue`

Differential Revision: https://phabricator.services.mozilla.com/D57436
2019-12-19 07:58:27 +00:00
Hiroyuki Ikezoe
5d1059e664 Bug 1596317 - Change the function pointer argument of nsContentUtils::CallOnAllRemoteChildren to std::function. r=smaug
We are going to introduce a new function in Document in this commit series,
which enumerates all child documents regardless of whether it's in the same
process, in content processes or in out-of-process iframes. The function takes
std::functions, but I don't have any good ideas to convert lambda functions with
capturing variables to function pointer.

Differential Revision: https://phabricator.services.mozilla.com/D57434
2019-12-19 07:57:57 +00:00
Bogdan Tara
e59c8c65fb Backed out 7 changesets (bug 1596317) for causing build bustages CLOSED TREE
Backed out changeset 0d3208fcb948 (bug 1596317)
Backed out changeset fe5554dc4115 (bug 1596317)
Backed out changeset 019de59cbc93 (bug 1596317)
Backed out changeset f4851472b087 (bug 1596317)
Backed out changeset a984cf515db8 (bug 1596317)
Backed out changeset d0da5bf9b4d4 (bug 1596317)
Backed out changeset abe5f2030dd9 (bug 1596317)
2019-12-19 06:49:39 +02:00
Hiroyuki Ikezoe
412bdf8188 Bug 1596317 - Use CallState for nsContentUtils::CallOnAllRemoteChildren. r=smaug
`true` -> `CallState::Stop`
`false` -> `CallState::Continue`

Differential Revision: https://phabricator.services.mozilla.com/D57436
2019-12-19 03:36:35 +00:00
Hiroyuki Ikezoe
65d3d20f75 Bug 1596317 - Change the function pointer argument of nsContentUtils::CallOnAllRemoteChildren to std::function. r=smaug
We are going to introduce a new function in Document in this commit series,
which enumerates all child documents regardless of whether it's in the same
process, in content processes or in out-of-process iframes. The function takes
std::functions, but I don't have any good ideas to convert lambda functions with
capturing variables to function pointer.

Differential Revision: https://phabricator.services.mozilla.com/D57434
2019-12-19 03:35:59 +00:00
Oana Pop Rus
2fa2ebf69d Backed out 7 changesets (bug 1432856) for build bustages failures in nsWindow.h on a CLOSED TREE
Backed out changeset 3d08c3cce533 (bug 1432856)
Backed out changeset 49d03dd89b17 (bug 1432856)
Backed out changeset 62fc84c8ce99 (bug 1432856)
Backed out changeset a8a4fa63f5b2 (bug 1432856)
Backed out changeset c81f3d5b9bf3 (bug 1432856)
Backed out changeset 8351a8b1d96a (bug 1432856)
Backed out changeset a303b775a51b (bug 1432856)
2019-12-16 23:53:35 +02:00
pbz
9b95ca979c Bug 1432856 - Added console logging for DOM fullscreen leave on window open or raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55813
2019-12-16 21:07:37 +00:00
pbz
fda1d6a250 Bug 1432856 - Added prefs for DOM fullscreen leave on window open or raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55812
2019-12-16 21:07:33 +00:00
pbz
29a2e0c4e4 Bug 1432856 - Extended focus methods in Window.webidl, Client.webidl and Element.webidl to pass CallerType. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55811
2019-12-16 21:06:11 +00:00
pbz
ac21824244 Bug 1432856 - Leave DOM fullscreen on window raise. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D55810
2019-12-16 21:03:18 +00:00
Gabriele Svelto
eb403b8785 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442
2019-12-06 09:24:56 +00:00