Commit Graph

1002 Commits

Author SHA1 Message Date
Peter Van der Beken
9e9199880e Bug 1640839 - Stop generating a sentinel value at the end of WebIDL enums. r=mccr8,jgilbert,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D201344
2024-03-02 07:50:25 +00:00
Natalia Csoregi
10b9ceb789 Backed out 13 changesets (bug 1640839) for causing bustage on Element.cpp CLOSED TREE
Backed out changeset 179ceb82c9e5 (bug 1640839)
Backed out changeset 73f498a821f0 (bug 1640839)
Backed out changeset dc2d3d0e0365 (bug 1640839)
Backed out changeset ddc989ac0509 (bug 1640839)
Backed out changeset e595bb3feea8 (bug 1640839)
Backed out changeset c85aca04e27f (bug 1640839)
Backed out changeset 98e8e3a4047a (bug 1640839)
Backed out changeset 59ef180517db (bug 1640839)
Backed out changeset af2f5e293662 (bug 1640839)
Backed out changeset 89aa6d9dc598 (bug 1640839)
Backed out changeset 67b722a722f9 (bug 1640839)
Backed out changeset 24a9665c6ced (bug 1640839)
Backed out changeset d93f199385e9 (bug 1640839)
2024-03-01 18:23:08 +02:00
Peter Van der Beken
e0fa109cb0 Bug 1640839 - Stop generating a sentinel value at the end of WebIDL enums. r=mccr8,jgilbert,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D201344
2024-03-01 14:31:15 +00:00
Frédéric Wang
ea8819b5ee Bug 1880928 - Remove last remembered size observer, handle it in Document::DetermineProximityToViewportAndNotifyResizeObservers. r=emilio,layout-reviewers
The CSS Box Sizing specification indicates that last remembered sizes
are recorded "at the time that ResizeObserver events are determined and
delivered" [1].

In bug 1807253, we changed the implementation of when proximity to the
viewport of `content-visibility: auto` nodes are determined and of when
resize observations are broadcast, in order to align with the latest
version of the HTML specification [2]. We continue to use an internal
`Document::mLastRememberedSizeObserver` to update last remembered sizes
but it has been causing issues (e.g. bug 1867090 and bug 1880928) and
could be replaced by a direct update before broadcasting resize
observations.

This is what the current patch is doing. The elements currently observed
by `Document::mLastRememberedSizeObserver` are now stored on a
`Document::mElementsWithLastRememberedSize` hashset and a new function
`Document::UpdateLastRememberedSizes` is called before broadcasting
resize observations, and peforms the work of `LastRememberedSizeCallback`
and of `CalculateBoxSize` (with `aBox=Content_box`).

The only behavior change is in the `while(true)` loop from
`DetermineProximityToViewportAndNotifyResizeObservers`: at each step
we update the last remember sizes for elements of arbitrary depth, and
don't use these depths for calculating `shallowestTargetDepth`. This is
fine, since our `LastRememberedSizeCallback` only records current box
sizes without causing significant side effects (e.g. execution of
JavaScript code) that may require a relayout.

[1] https://drafts.csswg.org/css-sizing-4/#last-remembered
[2] https://html.spec.whatwg.org/#update-the-rendering

Differential Revision: https://phabricator.services.mozilla.com/D202571
2024-02-29 08:50:55 +00:00
Cathie Chen
7859d6112f Bug 1879340 - Add potentially render blocking, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D201095
2024-02-24 18:12:35 +00:00
Emilio Cobos Álvarez
18f7b60591 Bug 1874040 - Simplify dir=auto implementation. r=smaug
Make sure to do no work on insertions if the dir=auto element has
already the right strong directionality, but record that the node might
be the one impacting the dir=auto resolution.

Also get some node flags back.

Differential Revision: https://phabricator.services.mozilla.com/D202071
2024-02-21 12:23:48 +00:00
James Teh
421fc7b6f3 Bug 1879255 part 3: Notify accessibility about changes to explicitly set attr-elements. r=smaug,eeejay
Accessibility needs to keep track of changes to explicitly set attr-elements.
Since the popovertarget content attribute is "" for any explicitly set attr-element, we won't always get attribute change notifications for the content attribute when .popoverTargetElement is set.
For example, if e1's popovertarget content attribute is absent and you set e1.popoverTargetElement to e2, the popovertarget content attribute will be "".
If you later set e1.popoverTargetElement to e3, there won't be a notification for the content attribute change, since it remains "".
Even if there were, it might occur before the element has changed, which means we can't detect any relevant state changes there; e.g. mPrevStateBits.
To deal with this, we now have DOM notify accessibility before and after the explicitly set attr-element is changed.
Within DocAccessible, this is treated like any other attribute change, but the notification methods get called consistently and at the appropriate time.

Differential Revision: https://phabricator.services.mozilla.com/D201662
2024-02-21 00:05:21 +00:00
James Teh
893e35ea14 Bug 1879255 part 1: Add Element::GetExplicitlySetAttrElement. r=smaug
This will be needed by accessibility for two reasons:

1. Accessibility will need to keep track of explicitly set attr-elements even if they aren't a descendant of any of the refering element's shadow-including ancestors. Accessibility will enforce that restriction itself before using the attr-element.
2. Accessibility will need to be able to distinguish between an attr-associated element obtained from an explicitly set attr-element vs derived using an id string in the content attribute. There are other ways to do this, but they are somewhat ugly.

Differential Revision: https://phabricator.services.mozilla.com/D201660
2024-02-21 00:05:20 +00:00
Emilio Cobos Álvarez
9b561b6f99 Bug 1881075 - Fix popovertarget attribute update steps. r=zsun
See https://github.com/whatwg/html/issues/10150. Per spec these run even
if the attribute doesn't change.

Differential Revision: https://phabricator.services.mozilla.com/D202240
2024-02-20 18:52: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
Ziran Sun
021e5f2541 Bug 1879001 - Remove the popovertarget attribute or set it to an invalid value should clear the explicitly set attr-element. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D201711
2024-02-16 21:51:24 +00:00
Emilio Cobos Álvarez
e86d2410c5 Bug 1874488 - Make Element.{client,scroll} APIs zoom aware. r=saschanaz,TYLin
Also extend scroll-zoom to cover scroll{Top,Left,To,By}, since that was
completely untested.

Differential Revision: https://phabricator.services.mozilla.com/D200029
2024-02-08 11:13:01 +00:00
Emilio Cobos Álvarez
b5a4cd1ace Bug 1874488 - Refactor some scroll APIs to use shared code. r=TYLin,webidl,smaug
This makes the next patch simpler too. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D200916
2024-02-08 11:13:00 +00:00
Emilio Cobos Álvarez
573df9d987 Bug 1874488 - Guarantee that Element::GetScrollFrame returns a frame if it returns a scrollframe. r=TYLin
This the "body propagated to root" case to also set aFrame.

This doesn't change behavior for current callers, but would be useful to
simplify the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D200915
2024-02-08 11:13:00 +00:00
Iulian Moraru
c048517fd7 Backed out 3 changesets (bug 1874488) for causing multiple failures. CLOSED TREE
Backed out changeset 467c5213a79a (bug 1874488)
Backed out changeset 13da2be03857 (bug 1874488)
Backed out changeset 974683909782 (bug 1874488)
2024-02-08 01:29:54 +02:00
Emilio Cobos Álvarez
2345fd916a Bug 1874488 - Make Element.{client,scroll} APIs zoom aware. r=saschanaz,TYLin
Also extend scroll-zoom to cover scroll{Top,Left,To,By}, since that was
completely untested.

Differential Revision: https://phabricator.services.mozilla.com/D200029
2024-02-07 21:30:36 +00:00
Emilio Cobos Álvarez
2241dc7d89 Bug 1874488 - Refactor some scroll APIs to use shared code. r=TYLin,webidl,smaug
This makes the next patch simpler too. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D200916
2024-02-07 21:30:35 +00:00
Emilio Cobos Álvarez
5a1201acfd Bug 1874488 - Guarantee that Element::GetScrollFrame returns a frame if it returns a scrollframe. r=TYLin
This the "body propagated to root" case to also set aFrame.

This doesn't change behavior for current callers, but would be useful to
simplify the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D200915
2024-02-07 21:30:35 +00:00
Cathie Chen
d8224880f1 Bug 1878888 - Add the runtime flag and parsing for the blocking attribute, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D200810
2024-02-07 17:06:56 +00:00
Emilio Cobos Álvarez
a0f699ef4d Bug 1878900 - Simplify AnchorAreaFormRelValues. r=dom-core,edgar
Having a base class with a single static member doesn't buy us much, and
actually MSVC-compatible compilers don't optimize empty base classes out
(plus the empty base is at the end so it might even take space on Linux
and macOS, untested).

Just put the values in Element.h / Element.cpp which is the common base
class of the relevant elements.

Differential Revision: https://phabricator.services.mozilla.com/D200825
2024-02-06 16:47:38 +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
Emilio Cobos Álvarez
18df088553 Bug 1876745 - Factor out scroll{Width,Height} logic. r=dholbert
No behavior change, just clean-up.

Differential Revision: https://phabricator.services.mozilla.com/D199861
2024-01-29 21:32:12 +00:00
Hiroyuki Ikezoe
28aff19c85 Bug 1875011 - Rename GetScrollPositionCSSPixels to GetRoundedScrollPositionCSSPixels. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D198766
2024-01-17 06:27:05 +00:00
Emilio Cobos Álvarez
bc8e14504e Bug 1856156 - Make Directionality an enum class. r=smaug
A bit neater this way.

Differential Revision: https://phabricator.services.mozilla.com/D198590
2024-01-15 19:35:44 +00:00
Narcis Beleuzu
daaf82679b Backed out changeset 5431daa798c7 (bug 1871424) for causing Bug 1873472 2024-01-12 11:52:07 +02:00
Edgar Chen
1526bae510 Bug 1871424 - Make input checkbox/radio in link element work again; r=vhilla,dom-core
The root cause of issue is that the link elements have not yet adopted the
activation behavior defined in the specification. This patch add a hacky way to
avoid link elements perform activation behavior if it has a child input element
which will perform activation behavior. This patch introduces new flags instead of
reusing the exiting ones, allowing us to uplift this patch more safely.

Differential Revision: https://phabricator.services.mozilla.com/D197393
2024-01-02 15:52:25 +00:00
Jihye Hong
035ffcaef0 Bug 1859852 - Add options to check for content-visibility: auto to element.checkVisibility() r=emilio
This patch adds `contentVisibilityAuto` as well as alternative names `opacityProperty` and `visibilityProperty` for deprecated options.

Related spec edit: https://github.com/w3c/csswg-drafts/pull/9549/files

authored-by: Frédéric Wang <fwang@igalia.com>

Differential Revision: https://phabricator.services.mozilla.com/D196007
2023-12-12 12:39:23 +00:00
Adam Vandolder
9175984175 Bug 1712140 - Part 4: Add parseHTMLUnsafe and setHTMLUnsafe methods. r=dom-core,webidl,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193676
2023-12-07 21:27:10 +00:00
Adam Vandolder
483e2a2383 Bug 1712140 - Part 2: Allow ShadowRoots to be clonable and declarative. r=webidl,emilio,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193674
2023-12-07 21:27:09 +00:00
Iulian Moraru
8d186a8450 Backed out 6 changesets (bug 1712140) for causing sanitizer failures on nsHtml5TreeBuilder.cpp. CLOSED TREE
Backed out changeset b374469160e9 (bug 1712140)
Backed out changeset dfc44cccff32 (bug 1712140)
Backed out changeset 3a35e1401130 (bug 1712140)
Backed out changeset a93481858c38 (bug 1712140)
Backed out changeset a861fd445f56 (bug 1712140)
Backed out changeset dc1dc389f2dc (bug 1712140)
2023-12-07 08:16:23 +02:00
Adam Vandolder
355580f7c5 Bug 1712140 - Part 4: Add parseHTMLUnsafe and setHTMLUnsafe methods. r=dom-core,webidl,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193676
2023-12-06 22:50:50 +00:00
Adam Vandolder
2353e195dc Bug 1712140 - Part 2: Allow ShadowRoots to be clonable and declarative. r=webidl,emilio,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193674
2023-12-06 22:50:49 +00:00
Stanca Serban
34d35a19ee Backed out 6 changesets (bug 1712140) for causing Linux related wpt failures in nsHtml5TreeBuilder.cpp. CLOSED TREE
Backed out changeset 3d799b386f3e (bug 1712140)
Backed out changeset 2ed53d545d6d (bug 1712140)
Backed out changeset 6f50077df42a (bug 1712140)
Backed out changeset e7c5449482f9 (bug 1712140)
Backed out changeset 5490dad148ef (bug 1712140)
Backed out changeset 50828058065e (bug 1712140)
2023-12-06 00:18:38 +02:00
Adam Vandolder
22752a3a0a Bug 1712140 - Part 4: Add parseHTMLUnsafe and setHTMLUnsafe methods. r=dom-core,webidl,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193676
2023-12-05 18:18:17 +00:00
Adam Vandolder
86ef8d220d Bug 1712140 - Part 2: Allow ShadowRoots to be clonable and declarative. r=webidl,emilio,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193674
2023-12-05 18:18:16 +00:00
Masayuki Nakano
fc0a220bac Bug 1863759 - Make IMEStateManager recreate IMEContentObserver if the active one is not observing editable content of focused element r=smaug,m_kato
The test case is a special case that changes focused element from a text control
to an editing host.  Therefore, without a focus change, focused editor is
changed from a `TextEditor` to `HTMLEditor`.  At this time, `IMEContentObserver`
needs to switch the observing target from the anonymous content if `<input>` to
children of it.

However, the editable content becomes completely changed without a focus change
in the DOM.  Therefore, `IMEStateManager` needs to synthesize a fake focus move
for IME.  Therefore, this patch make `IMEStateManager` recreate
`IMEContentObserver` if active one is not observing editable content for the
focused element under "current" conditions at checking it.  (When
`IMEContentObserver` is being destroyed, it sends "blur" notification to IME
and the new `IMEContentObserver` instance posts "focus" notification with
all editable content data.  I.e., recreating `IMEContentObserver` generates
a fake focus move from IME point of view.)

Additionally, there is the opposite case, that is, editing host of an `<input>`
whose type is not a text control may become a text control.  Therefore, this
adds new WPTs to check the handler is the text editor for the text control or
the HTML editor.  The tests passed on Firefox and Chrome at least.

FYI: I guess that in this case, we need to kick `focus` event listener of the
`HTMLEditor`, but anyway, users cannot change the content because it's the
case that an atomic content is the editing host.  Therefore, I don't touch
about that in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D193262
2023-12-05 02:33:18 +00:00
Iulian Moraru
80baabd575 Backed out 6 changesets (bug 1712140) for causing wpt failures on declarative-shadow-dom-opt-in.html.
Backed out changeset 78e3a33470ae (bug 1712140)
Backed out changeset 8601fce480ef (bug 1712140)
Backed out changeset 4d2749962c5f (bug 1712140)
Backed out changeset b65511d17150 (bug 1712140)
Backed out changeset 8ae1f766f1f9 (bug 1712140)
Backed out changeset 4ffe7a6ad366 (bug 1712140)
2023-12-04 22:30:04 +02:00
Adam Vandolder
1dce51d395 Bug 1712140 - Part 4: Add parseHTMLUnsafe and setHTMLUnsafe methods. r=dom-core,webidl,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193676
2023-12-04 17:35:49 +00:00
Adam Vandolder
699de11e10 Bug 1712140 - Part 2: Allow ShadowRoots to be clonable and declarative. r=webidl,emilio,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193674
2023-12-04 17:35:48 +00:00
Stanca Serban
3fa8347485 Backed out 6 changesets (bug 1712140) for causing wpt failures in declarative-shadow-dom-opt-in.html.
Backed out changeset 554a46ed8046 (bug 1712140)
Backed out changeset 14ebbfca2e84 (bug 1712140)
Backed out changeset 98dd5766dd46 (bug 1712140)
Backed out changeset 4241a7241a9b (bug 1712140)
Backed out changeset 59ee434d503e (bug 1712140)
Backed out changeset ff3bb42f91d1 (bug 1712140)
2023-12-01 03:26:27 +02:00
Adam Vandolder
451614f805 Bug 1712140 - Part 4: Add parseHTMLUnsafe and setHTMLUnsafe methods. r=dom-core,webidl,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193676
2023-11-30 23:17:15 +00:00
Adam Vandolder
4f990cf528 Bug 1712140 - Part 2: Allow ShadowRoots to be clonable and declarative. r=webidl,emilio,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193674
2023-11-30 23:17:15 +00:00
Stanca Serban
8d6a9ece7a Backed out 3 changesets (bug 1851970) for causing mochitests failures in browser_aboutNetError_csp_iframe.js.
Backed out changeset a2536c6c6c23 (bug 1851970)
Backed out changeset 23ddc229d1a1 (bug 1851970)
Backed out changeset b99a620a535c (bug 1851970)
2023-11-28 18:43:55 +02:00
Vincent Hilla
4a2ca2ff09 Bug 1851970 - Part 2: Activation behavior method for links. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D183991
2023-11-28 14:09:02 +00:00
Tom Schuster
3889192065 Bug 1864838 - Update our Sanitizer to the new proposed WebIDL. r=emilio,freddyb
The new proposed WebIDL is at https://github.com/WICG/sanitizer-api/issues/181#issuecomment-1761270913.
Sadly we don't have a real spec for this yet. Luckily this is mostly
just a renaming. The biggest change is that every <element> in elements: now has a list of allowed and removed attributes.

Differential Revision: https://phabricator.services.mozilla.com/D193642
2023-11-28 11:04:03 +00:00
Emilio Cobos Álvarez
c27730d3df Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
keithamus
2c3b3f4d43 Bug 1861466 - Add CustomStateSet and :state() pseudo. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D191988
2023-11-08 13:38:02 +00:00
CanadaHonk
aa654b839c Bug 1622090 - Implement loading=lazy for <iframe> r=emilio
Initial implementation for <iframe loading=lazy>

Also cleaned up some image lazy loading to be generalised
(sharing an intersection observer and some enums/funcs in Element).

Unimplemented details:
 - Window load should not wait for in view lazy loading iframes.
   Unplanned for this patch and ship for now.
   (Chromium fail, WebKit pass)

We also pass some other WPTs other engines do not too already too.
Also added a WPT to ensure using parse-time base URI for lazy -> eager iframes.

Differential Revision: https://phabricator.services.mozilla.com/D190662
2023-10-18 14:13:29 +00:00
Jan Varga
272327b326 Bug 1855134 - Move existing MOZ_TRY macros to a dedicated header file; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D189226
2023-09-28 20:46:07 +00:00
Valentin Gosu
cdd5195292 Bug 1848694 - Remove/avoid global references to nsIIOService r=mccr8,necko-reviewers,kershaw
This patch removes the static pointer to nsIIOService in nsContentUtils,
replacing it to calls to mozilla::components::IO::Service.

It also makes nsScriptSecurityManager::sIOService a StaticRefPtr.

Differential Revision: https://phabricator.services.mozilla.com/D188714
2023-09-22 12:49:44 +00:00