Commit Graph

616 Commits

Author SHA1 Message Date
Ziran Sun
1202bb6338 Bug 1833570 - Change popover invoker type from boolean to Element. r=emilio
The invoker type is currently implemented as boolean as suggested at
https://github.com/whatwg/html/issues/9168. This issue is now closed and
has been fixed at https://github.com/whatwg/html/pull/9171.

This patch is to be follow above discussions and implement popover invoker
type as element.

Differential Revision: https://phabricator.services.mozilla.com/D178287
2023-05-29 07:21:22 +00:00
Mirko Brodesser
d4623da157 Bug 1831081: when the popover attribute changed, update the popover attribute state before hiding the popover. r=emilio
Moreover, simplify the code to match the spec more closely.

Differential Revision: https://phabricator.services.mozilla.com/D178906
2023-05-25 07:24:42 +00:00
Cosmin Sabou
f429c7dc71 Backed out 3 changesets (bug 675943) for causing wpt unexpected passes.
Backed out changeset 56d084bfc8b8 (bug 675943)
Backed out changeset 8f514549a81c (bug 675943)
Backed out changeset 33fabcece85d (bug 675943)
2023-05-24 14:43:06 +03:00
Mirko Brodesser
896dabd637 Bug 1834493: part 1) Rename PopoverState to PopoverAttributeState. r=emilio
Less confusing.

Differential Revision: https://phabricator.services.mozilla.com/D178770
2023-05-24 10:48:04 +00:00
Vincent Hilla
f1572f7fbe Bug 675943 - Part 3: Clean up after implementing dirname. r=edgar
Depends on D178164

Differential Revision: https://phabricator.services.mozilla.com/D178278
2023-05-24 08:04:52 +00:00
Mirko Brodesser
cf38c14ae0 Bug 1831097: declare HTMLElement's togglePopover argument force optional. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177377
2023-05-23 14:26:57 +00:00
Mirko Brodesser
fc3cdd2109 Bug 1832033: change CheckPopoverValidity to match spec more closely. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177486
2023-05-23 14:26:57 +00:00
Mirko Brodesser
e9b0ef70f5 Bug 1833333: return the canonical keyword in popover IDL's getter steps. r=emilio
Covered by the sub-test at
<https://searchfox.org/mozilla-central/rev/f60cf6bfa8bd096efd9bb3a445364f5a0f32897a/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html#100,102>.
Verified locally that it passes with the patch and failed without it.
The whole test
(https://searchfox.org/mozilla-central/rev/f60cf6bfa8bd096efd9bb3a445364f5a0f32897a/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html#120)
still fails at a later stage, hence the meta data isn't changed.

Differential Revision: https://phabricator.services.mozilla.com/D178182
2023-05-18 07:53:05 +00:00
Masayuki Nakano
a5dafe4e4c Bug 1822860 - Make elements handle space key only when it's focused r=emilio
When a focused editable element which is in an element having some default
actions for some keyboard events, keyboard events should be handled only by the
editor associated to the focused editable element.  Therefore,
`nsGenericHTMLElement::HandleKeyboardActivation` should check whether the
element has focus.

Note that if elements having default actions for keyboard events is a focused
editing host, Chrome makes the element handle keyboard events instead of
their builtin editor.  For compatibility with them, let's follow the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D177757
2023-05-16 01:29:11 +00:00
Mirko Brodesser
3e7ce94963 Bug 1828674: part 2) Set a popover's state to auto when the corresponding attribute value is the empty string. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177764
2023-05-15 12:55:11 +00:00
Norisz Fay
8532634c79 Backed out 2 changesets (bug 1828674) for causing build bustage on nsGenericHTMLElement.cpp CLOSED TREE
Backed out changeset 40ab13fb03c1 (bug 1828674)
Backed out changeset 1f7322b59dfb (bug 1828674)
2023-05-15 15:22:29 +03:00
Mirko Brodesser
b1c5e3a9d6 Bug 1828674: part 2) Set a popover's state to auto when the corresponding attribute value is the empty string. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177764
2023-05-15 09:44:58 +00:00
Butkovits Atila
a878a17e69 Backed out 2 changesets (bug 1828674) as requested by dev. CLOSED TREE
Backed out changeset ccfe4902760f (bug 1828674)
Backed out changeset a526004408c1 (bug 1828674)
2023-05-15 12:18:22 +03:00
Mirko Brodesser
e92b7249ed Bug 1828674: part 2) Set a popover's state to auto when the corresponding attribute value is the empty string. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D177764
2023-05-15 08:15:08 +00:00
Stanca Serban
bab9ce8f6d Backed out changeset fcef8c68028c (bug 1822860) for causing wpt failures in focus-tabindex-event.html. CLOSED TREE 2023-05-12 15:43:19 +03:00
Masayuki Nakano
e09a83649b Bug 1822860 - Make elements handle space key only when it's focused r=emilio
When a focused editable element which is in an element having some default
actions for some keyboard events, keyboard events should be handled only by the
editor associated to the focused editable element.  Therefore,
`nsGenericHTMLElement::HandleKeyboardActivation` should check whether the
element has focus.

Note that if elements having default actions for keyboard events is a focused
editing host, Chrome makes the element handle keyboard events instead of
their builtin editor.  For compatibility with them, let's follow the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D177757
2023-05-12 08:57:48 +00:00
Mirko Brodesser
1d9dba104c Bug 1829660: pass true for aFireEvents and defer hiding the popover and updating the popover states. r=emilio
Pass `true` for `aFireEvents` to match the spec.
Defer hiding the popover because it may run script, which is forbidden,
because `SetAttrAndNotify` runs with a script blocker
(`mozAutoDocUpdate`).

Updated test expectations:
  The assertion count increased because
  <https://searchfox.org/mozilla-central/rev/4e6970cd336f1b642c0be6c9b697b4db5f7b6aeb/dom/base/Document.cpp#14948-14949>
  is violated more often, which was violated before. No new
  `NS_ASSERTION`s are violated.

  "[Changing a popover from auto to manual (via attr), and then auto during 'beforetoggle' works]
     expected: FAIL" still fails because
     <https://searchfox.org/mozilla-central/rev/4e6970cd336f1b642c0be6c9b697b4db5f7b6aeb/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html#334>
     is violated, which is unrelated to this change.
  Other instances of
  <https://searchfox.org/mozilla-central/rev/4e6970cd336f1b642c0be6c9b697b4db5f7b6aeb/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html#339>
  still fail too, but the general mechanism of firing events seems to
  work. Therefore it seems reasonable to investigate the remaining
  failures in bug 1816851.

Differential Revision: https://phabricator.services.mozilla.com/D176660
2023-05-08 14:08:37 +00:00
Cathie Chen
d1a28011c6 Bug 1825808 - Popover: Complete ShowPopover and HidePopover, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175395
2023-05-02 11:29:20 +00:00
Edgar Chen
bce9491bb2 Bug 1827019 - Reset mFieldset after unlink; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176356
2023-04-27 21:48:43 +00:00
Butkovits Atila
8618eaf1cd Backed out changeset 4fd18988ada9 (bug 1825808) for causing failures at popover-open-overflow-display.html. CLOSED TREE 2023-04-27 23:36:17 +03:00
Cathie Chen
cdb42d1bb6 Bug 1825808 - Popover: Complete ShowPopover and HidePopover, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175395
2023-04-27 17:49:06 +00:00
Mirko Brodesser
440749064c Bug 1830031: split nsGenericHTMLElement::HandleFocusAfterHidingPopover. r=emilio
To achieve `MOZ_CAN_RUN_SCRIPT`-correctness.

Bonus: avoids a call of `do_QueryReferent`.

Differential Revision: https://phabricator.services.mozilla.com/D176521
2023-04-26 12:12:26 +00:00
Cathie Chen
2ac097f4c0 Bug 1828969 - Popover: Check the popover's document in showPopover, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175935
2023-04-26 10:25:21 +00:00
Emilio Cobos Álvarez
c1c1e7460b Bug 1829225 - Make BeforeSetAttr take the parsed nsAttrValue. r=smaug
ParseAttribute ideally would be const (see bug 1829138), but the SVG and
SMIL code is rather messy. Still, now that BeforeSetAttr can't really
fail, swapping the order of ParseAttribute and BeforeSetAttr shouldn't
really change behavior.

Sorry for the extra `virtual` keyword removal and such. I had to do this
one by hand unlike the dependent bugs, and I went a bit drive-by, lmk if
you want me to split those changes.

Differential Revision: https://phabricator.services.mozilla.com/D176086
2023-04-21 09:25:17 +00:00
Emilio Cobos Álvarez
ded1458b5b Bug 1829189 - Make OnAttrSetButNotChanged and AfterSetAttr infallible. r=smaug
Same rg + sed shenanigans as the first patch.

There were two that could fail, both due to OOM:

 * HTMLInputElement::AfterSetAttr: If we fail (only in the type=range
   case) we end up with an old value without it being clamped by
   min/max/step.

 * HTMLBodyElement::AfterSetAttr: If we fail we won't peek up the
   DocShell's frame margins and styling could be incorrect.

That seems better than having to deal with broken states after we've
already set the attribute.

Depends on D176069

Differential Revision: https://phabricator.services.mozilla.com/D176070
2023-04-21 08:56:27 +00:00
Emilio Cobos Álvarez
c881eb2941 Bug 1829189 - Make BeforeSetAttr infallible. r=smaug
rg BeforeSetAttr -l | xargs sed -i 's/nsresult BeforeSetAttr/void BeforeSetAttr/g'
  rg ::BeforeSetAttr -l | xargs sed -i 's/nsresult \(.*\)::BeforeSetAttr/void \1::BeforeSetAttr/g'

Plus trivial fixes, plus clang-format.

The only meaningful changes are in nsXULElement::BeforeSetAttr. Two
things could fail:

chromemargin: I removed it because we don't use the parsed attribute any
other place than here:

  https://searchfox.org/mozilla-central/rev/31f5847a4494b3646edabbdd7ea39cb88509afe2/dom/xul/ChromeObserver.cpp#136

And that deals just fine with it not being parsed.

usercontextid: We have a debug assertion that we don't dynamically change it.
I kept it but I don't think it's worth failing to set the attribute on release for that

Differential Revision: https://phabricator.services.mozilla.com/D176069
2023-04-21 08:56:27 +00:00
Ziran Sun
e298c0c1bf Bug 1824350 - Implement queue a popover toggle event task for Popover. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173820
2023-04-18 13:51:23 +00:00
Alexander Surkov
3ce742bba0 Bug 1826793 - implement popover invoker, r=emilio
See https://html.spec.whatwg.org/multipage/popover.html#popover-invoker

Differential Revision: https://phabricator.services.mozilla.com/D175265
2023-04-17 14:17:06 +00:00
Mirko Brodesser
416354f51f Bug 1825807: part 1) Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'. r=emilio
See https://github.com/whatwg/html/pull/9077.

Differential Revision: https://phabricator.services.mozilla.com/D175223
2023-04-17 12:18:03 +00:00
Noemi Erli
e678f2a1e8 Backed out 2 changesets (bug 1825807) for causing failures in /browser_parsable_css.js CLOSED TREE
Backed out changeset 454a01f16f5b (bug 1825807)
Backed out changeset a82344255795 (bug 1825807)
2023-04-13 12:24:41 +03:00
Mirko Brodesser
48fff64d5f Bug 1825807: part 1) Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'. r=emilio
See https://github.com/whatwg/html/pull/9077.

Differential Revision: https://phabricator.services.mozilla.com/D175223
2023-04-13 07:43:57 +00:00
Ziran Sun
c1e04912b6 Bug 1826793 - Implement popover target attribute activation behavior step. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D174902
2023-04-11 21:18:37 +00:00
Alexander Surkov
50bc93b884 Bug 1823757 - use parsed atoms for popovertarget attribute, r=emilio
Use parsed atoms to store popovertarget attributes as more effective mechanism to search for ID match in attr associated elements implementation. Followup from D173337.

Differential Revision: https://phabricator.services.mozilla.com/D174786
2023-04-11 18:35:51 +00:00
Natalia Csoregi
64f264b62e Backed out changeset 96da9dcee2b0 (bug 1823757) for causing failures on popover-invoking-attribute.html. CLOSED TREE 2023-04-11 09:43:08 +03:00
Alexander Surkov
be39f08c40 Bug 1823757 - use parsed atoms for popovertarget attribute, r=emilio
Use parsed atoms to store popovertarget attributes as more effective mechanism to search for ID match in attr associated elements implementation. Followup from D173337.

Differential Revision: https://phabricator.services.mozilla.com/D174786
2023-04-11 00:53:28 +00:00
Cosmin Sabou
67393d958e Backed out changeset 93a5b0a259ae (bug 1823757) for causing Atom related wpt failures. 2023-04-07 00:39:17 +03:00
Alexander Surkov
a9708c7096 Bug 1823757 - use parsed atoms for popovertarget attribute, r=emilio
Use parsed atoms to store popovertarget attributes as more effective mechanism to search for ID match in attr associated elements implementation. Followup from D173337.

Differential Revision: https://phabricator.services.mozilla.com/D174786
2023-04-06 18:48:03 +00:00
Cathie Chen
e2659521ea Bug 1824823 - Popover: manage focus and previously focused element, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173758
2023-04-06 16:10:53 +00:00
Alexander Surkov
409e66eacc Bug 1823757 implement PopoverInvokerElement::popoverTargetElement, r=emilio
See https://html.spec.whatwg.org/multipage/popover.html#dom-popovertargetelement

Differential Revision: https://phabricator.services.mozilla.com/D174259
2023-04-03 13:21:36 +00:00
Cathie Chen
5d487ab6c1 Bug 1823060 - Popover: when the attribute is null or empty, it shouldn't match popover='auto'. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172897
2023-03-29 12:17:59 +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
Ziran Sun
c37cf867a0 Bug 1824668 - Make sure "beforetoggle" event is not fired for element removal. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173672
2023-03-27 12:04:58 +00:00
Ziran Sun
9c19f8c0f9 Bug 1823359 - Implement beforetoggle event for popover. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D172993
2023-03-24 21:09:11 +00:00
Iulian Moraru
efdd46c8e3 Backed out changeset 241d9f6e2457 (bug 1823359) for causing wpt failures on popover-light-dismiss.html. CLOSED TREE 2023-03-24 21:11:32 +02:00
Ziran Sun
1e1c6abd7f Bug 1823359 - Implement beforetoggle event for popover. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D172993
2023-03-24 16:29:48 +00:00
Norisz Fay
f676bc8290 Backed out changeset adc083051939 (bug 1823359) for causing wpt failures on popover-light-dismiss.html 2023-03-24 01:50:20 +02:00
Ziran Sun
3ec778d668 Bug 1823359 - Implement beforetoggle event for popover. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D172993
2023-03-23 19:04:20 +00:00
Alexander Surkov
10903d04a8 Bug 1823757 - add PopoverInvokerElement interface r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173180
2023-03-23 13:23:25 +00:00
Csoregi Natalia
5d087970e3 Backed out changeset d567ffebf337 (bug 1823359) for causing failures on popover-light-dismiss.html. CLOSED TREE 2023-03-22 18:19:46 +02:00
Ziran Sun
d850704d67 Bug 1823359 - Implement beforetoggle event for popover. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D172993
2023-03-22 13:18:32 +00:00