Commit Graph
72 Commits
Author SHA1 Message Date
keithamus bc09bf7036 Bug 1888776 - Add invoke defaults for dialog elements r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D206185
2024-05-24 09:48:49 +00:00
Emilio Cobos Álvarez bf22d33f87 Bug 1895208 - Refactor IsFocusable checks to take flags rather than bool arguments. r=smaug
This doesn't change behavior on its own, but it's likely we want to make
the tab focusability more complicated in bug 1895184, and this will make
changes to this area less painful.

Differential Revision: https://phabricator.services.mozilla.com/D209525
2024-05-06 21:54:37 +00:00
Emilio Cobos Álvarez 7506fc5879 Bug 1881011 - Refactor UnbindFromTree to take a context argument. r=smaug
Much like BindToTree.

This will be useful because I need to pass more information through
UnbindFromTree() to speed up dir=auto for bug 1874040.

Differential Revision: https://phabricator.services.mozilla.com/D202215
2024-02-20 15:05:40 +00:00
keithamus d5efc74a38 Bug 1878708 - Dialogs HideAllPopoversUntil nearest popover, not document. r=smaug
Given some markup like:

```html
<div id=popover popover>
  <button id="openDialog">Open Dialog</button>
  <dialog id=dialog>
    I'm a dialog!
  </dialog>
</div>
<button id="openPopover">Open Popover</button>
<button>I do nothing!</button>
```

With some JS like

```js
openDialog.onclick = () => {
  dialog.showModal();
}

openPopover.onclick = () => {
  popover.showPopover();
}
```

Clicking the "Open Popover" button followed by the "Open Dialog" button results in both the Dialog and Popover being hidden, however the dialog will still be open as modal, rendering the whole page inert, nothing is clickable and there seems to be no way to undo this (unless you use a CloseWatcher gesture such as the Esc key - if you have one available on your device).

It is expected that the popover should not close the dialog, as it causes the invisible Modal Dialog to make the whole page inert, and it is very difficult for users (and developers) to discover how to undo this action (pressing escape).

This was reported in https://github.com/whatwg/html/issues/9998, and WhatWG resolved to fix this, which in https://github.com/whatwg/html/pull/10116.

Differential Revision: https://phabricator.services.mozilla.com/D200686
2024-02-05 23:58:42 +00:00
Sandor Molnar bcd3a8272c Bug 1856109 - Fix build bustages on dom/html/HTMLDialogElement.cpp CLOSED TREE 2023-10-31 17:02:36 +02:00
Sean Feng 9b35d1887e Bug 1856109 - Allow <dialog> to move back to previously focused element even if they are in different BC r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190957
2023-10-31 13:55:05 +00:00
Natalia Csoregi 61ef694005 Backed out changeset 630864299a19 (bug 1856109) for causing Bug 1861451. CLOSED TREE 2023-10-27 17:19:52 +03:00
Ziran Sun 5fc0e2fb86 Bug 1858912 - Refine popover focusing steps to follow the specs. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190917
2023-10-27 13:02:17 +00:00
Sean Feng f278c53cd9 Bug 1856109 - Allow <dialog> to move back to previously focused element even if they are in different BC r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190957
2023-10-26 13:48:11 +00:00
Emilio Cobos Álvarez d02e297b2d Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Sean Feng 5b22ce2910 Bug 1811129 - Implement the new dialog initial focus algorithm r=emilio
The main changes of the new algorithm are

* Make the dialog focusing steps look at sequentially focusable elements instead of any focusable element.
* Make the dialog element itself get focus if it has the autofocus attribute set.
* Make the dialog element itself get focus as a fallback instead of focus being "reset" to the body element.

Spec PR (merged): https://github.com/whatwg/html/pull/8199

Differential Revision: https://phabricator.services.mozilla.com/D181263
2023-08-02 13:35:47 +00:00
Gregory Pappas 853e673a0f Bug 1842974 - Remove dom.dialog_element.enabled pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183711
2023-07-17 10:02:53 +00:00
Norisz Fay 984233a612 Backed out changeset cbf5ea1b17d2 (bug 1811129) for causing failures on modal-dialog-backdrop-opacity.html CLOSED TREE 2023-07-06 20:28:17 +03:00
Sean Feng c57066bb2b Bug 1811129 - Implement the new dialog initial focus algorithm r=emilio
The main changes of the new algorithm are

* Make the dialog focusing steps look at sequentially focusable elements instead of any focusable element.
* Make the dialog element itself get focus if it has the autofocus attribute set.
* Make the dialog element itself get focus as a fallback instead of focus being "reset" to the body element.

Spec PR (merged): https://github.com/whatwg/html/pull/8199

Differential Revision: https://phabricator.services.mozilla.com/D181263
2023-07-06 15:33:33 +00:00
Ziran Sun 57898e14ae Bug 1835464 - Check dialog is modal flag instead of open attribute in 'check popover validity' algorithm. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D181089
2023-06-20 08:49:32 +00:00
Cathie Chen 0bb97e3d56 Bug 1836057 - Popover: Use dialog initial focus for dialog popovers, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D179580
2023-06-01 18:16:53 +00:00
Ziran Sun c1241f9987 Bug 1834519 - Don't throw when popovers/dialogs are in requested state. r=emilio
Update to be in line with spec discussions at
https://github.com/whatwg/html/pull/9142

Differential Revision: https://phabricator.services.mozilla.com/D178782
2023-05-25 08:35:29 +00:00
Ziran Sun a716d1e6ed Bug 1831057 - Handle conflict interactions between popover, modal dialog and fullscreen. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177003
2023-05-17 18:49:45 +00:00
Stanca Serban 95ee09b30b Backed out changeset e1a398764f9e (bug 1831057) for causing wpt failures in popover-top-layer-combinations.html. 2023-05-12 15:39:38 +03:00
Ziran Sun 5bff97d750 Bug 1831057 - Handle conflict interactions between popover, modal dialog and fullscreen. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177003
2023-05-12 08:00:26 +00:00
Ziran Sun a1e6bb46ed Bug 1829318 - Throw exception when calling dialog.show() on an open popover. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D176141
2023-04-28 14:17:51 +00:00
Cathie Chen b3a9e14892 Bug 1823897 - Implement popover focusing steps, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173714
2023-03-28 16:01:25 +00:00
Sean Feng 88af473516 Bug 1809561 - Check IsInProcess() before calling SameOriginWithTop() for <dialog> r=smaug
Looks like in an edge case, this method could be called on a
out-of-process browsing context.

Differential Revision: https://phabricator.services.mozilla.com/D171766
2023-03-07 14:26:14 +00:00
Sean Feng 3630c2abf3 Bug 1741936 - Implement focus delegate algorithm r=emilio
Spec: https://html.spec.whatwg.org/multipage/interaction.html#focus-delegate

Differential Revision: https://phabricator.services.mozilla.com/D153689
2022-10-14 01:20:08 +00:00
Emilio Cobos Álvarez c72c6c699f Bug 1771150 - Make fullscreen modal. r=smaug
As per https://github.com/w3c/csswg-drafts/issues/7311.

Differential Revision: https://phabricator.services.mozilla.com/D150335
2022-07-06 00:16:28 +00:00
Noemi Erli d0804517c7 Backed out changeset 8a9bae22cf24 (bug 1771150) for causing failures in browser_fullscreen_warning.js and test_pointerlock-api.html CLOSED TREE 2022-06-27 17:27:11 +03:00
Emilio Cobos Álvarez 76a4994d7c Bug 1771150 - Make fullscreen modal. r=smaug
As per https://github.com/w3c/csswg-drafts/issues/7311.

Differential Revision: https://phabricator.services.mozilla.com/D150335
2022-06-27 10:57:34 +00:00
Emilio Cobos Álvarez 1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Masayuki Nakano 60e856a8ab Bug 1680611 - part 8: Mark nsFocusManager::Blur and its callers in nsFocusManager as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147067
2022-05-26 04:37:20 +00:00
Emilio Cobos Álvarez e51b1c04e0 Bug 1771137 - Cleanup a bit top layer code. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D147282
2022-05-25 13:07:19 +00:00
Emilio Cobos Álvarez 3ab2050fc5 Bug 1743082 - Only clear focus for modal dialog. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D134964
2022-01-03 19:31:57 +00:00
Olli Pettay 7e08a9c5f4 Bug 1740971, use a raw pointer for fast iteration, r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D131085
2021-11-15 13:13:47 +00:00
Sean Feng 1d5b97f1cd Bug 1709233 - Fix a null pointer crash in HTMLDialogElement::StorePreviouslyFocusedElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D114256
2021-05-04 18:39:04 +00:00
Sean Feng eeab40a6f4 Bug 1660271 - Move the focus to the previously focused element when <dialog> is closed r=smaug
This change is based on the latest changes for the <dialog> element in
https://github.com/whatwg/html/pull/6531, such that closing
<dialog> should move the focus to the previously focused element.

Differential Revision: https://phabricator.services.mozilla.com/D109726
2021-04-29 19:35:23 +00:00
Emilio Cobos Álvarez 04db73dffd Bug 1699402 - Minor cleanup in HTMLDialogElement focusing steps. r=sefeng
This shouldn't change behavior, but I wrote this while looking at
bug 1699259 (which didn't use this code after all) and I think it's ok.

Differential Revision: https://phabricator.services.mozilla.com/D108927
2021-03-18 15:14:13 +00:00
Razvan Maries 8849293e8c Backed out changeset 0c3bb21d00d4 (bug 1675857) for multiple wpt perma failures at HTMLDialogElement. CLOSED TREE 2020-12-09 01:25:42 +02:00
Sean Feng 6e5dec8864 Bug 1675857 - Update <dialog> internal styles for spec alignment r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D99146
2020-12-08 22:29:44 +00:00
Simon Giesecke 46908cfb51 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
Sylvestre Ledru 68b806d604 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru 8f709b39e8 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Andi-Bogdan Postelnicu 08d36e9f46 Bug 1671641 - Make dom/html buildable outside of unified-build environment. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D94945
2020-10-28 12:24:01 +00:00
Edgar Chen ed7c6f194b Bug 1667081 - Part 1: Replace usage of nsIFocusManager with nsFocusManager; r=hsivonen
This patch is bascially done by:
perl -p -i -e "s/nsIFocusManager\* /nsFocusManager* /g;" $( find . -name *.cpp )
perl -p -i -e "s/nsCOMPtr<nsIFocusManager>/RefPtr<nsFocusManager>/g;" $( find . -name *.cpp )

Differential Revision: https://phabricator.services.mozilla.com/D91287
2020-09-29 07:21:09 +00:00
Bogdan Tara 65af1066d4 Backed out 9 changesets (bug 1667081) for assertion failure on nsFocusManager CLOSED TREE
Backed out changeset 156ab3eba505 (bug 1667081)
Backed out changeset 2e37f347082c (bug 1667081)
Backed out changeset 8f59cef879ae (bug 1667081)
Backed out changeset 1298ff140218 (bug 1667081)
Backed out changeset 91342c822425 (bug 1667081)
Backed out changeset aafb1878c590 (bug 1667081)
Backed out changeset 2252e975f0d7 (bug 1667081)
Backed out changeset c3bac5f407d2 (bug 1667081)
Backed out changeset b1e6e81396ae (bug 1667081)
2020-09-28 20:02:52 +03:00
Edgar Chen 0d9571517d Bug 1667081 - Part 1: Replace usage of nsIFocusManager with nsFocusManager; r=hsivonen
This patch is bascially done by:
perl -p -i -e "s/nsIFocusManager\* /nsFocusManager* /g;" $( find . -name *.cpp )
perl -p -i -e "s/nsCOMPtr<nsIFocusManager>/RefPtr<nsFocusManager>/g;" $( find . -name *.cpp )

Differential Revision: https://phabricator.services.mozilla.com/D91287
2020-09-28 14:04:12 +00:00
Sean Feng a230dc3241 Bug 1200896 - Make the document blocked by the topmost element in the top layer r=emilio
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

Depends on D86392

Differential Revision: https://phabricator.services.mozilla.com/D86227
2020-08-17 15:41:19 +00:00
Mihai Alexandru Michis 74951e33d2 Backed out 3 changesets (Bug 1200896) for causing Bug 1659042.
CLOSED TREE

Backed out changeset 17df14f0b129 (bug 1200896)
Backed out changeset 5d9e9bd12cd2 (bug 1200896)
Backed out changeset 7f016de8d52f (bug 1200896)
2020-08-14 09:06:45 +03:00
Sean Feng 7cf70f6198 Bug 1200896 - Make the document blocked by the topmost element in the top layer r=emilio
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

Differential Revision: https://phabricator.services.mozilla.com/D86227
2020-08-13 19:05:37 +00:00
Razvan Maries cdcf06d37c Backed out 2 changesets (bug 1200896) for perma failures on browser_pioneer_ui.js. CLOSED TREE
Backed out changeset c7ae88fd1bd7 (bug 1200896)
Backed out changeset 8b57f059e63e (bug 1200896)
2020-08-10 23:08:04 +03:00
Sean Feng f6c41cd617 Bug 1200896 - Make the document blocked by the topmost element in the top layer r=emilio
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

Differential Revision: https://phabricator.services.mozilla.com/D86227
2020-08-10 18:20:51 +00:00