Commit Graph

1034 Commits

Author SHA1 Message Date
Mirko Brodesser
91080ecb36 Bug 1907928: part 3) Implement reporting violations for sink type mismatches for Element.insertAdjacentHTML. r=tschuster,smaug,peterv
Differential Revision: https://phabricator.services.mozilla.com/D217442
2024-09-02 13:58:25 +00:00
Mirko Brodesser
9c0b5753f8 Bug 1913077: part 2) Add TrustedHTML to Element.insertAdjacentHTML. r=smaug,peterv
For a potential performance-improvement see
<https://phabricator.services.mozilla.com/D216304>'s description.

Differential Revision: https://phabricator.services.mozilla.com/D216170
2024-09-02 10:41:17 +00:00
Emilio Cobos Álvarez
a012cd6770 Bug 1906475 - Improve scroll{Width,Height} implementation for overflow: visible frames. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D218782
2024-08-15 15:02:00 +00:00
Masayuki Nakano
528d09c312 Bug 1904279 - Get rid of dom.w3c_pointer_events.dispatch_click_as_pointer_event pref r=smaug,pip-reviewers,search-reviewers,devtools-reviewers,urlbar-reviewers,nchevobbe,dao,jteow,mconley
Keep supporting the pref makes a lot of `click`, `auxclick` and `contextmenu`
event creators complicated (and look messy).  So, let's delete it as soon as
possible.

Differential Revision: https://phabricator.services.mozilla.com/D217225
2024-07-30 06:49:42 +00:00
Sean Feng
0742a41fa7 Bug 1874756 - Simplify and reduce the number of hashtable lookups for LCP implementation r=emilio
Two changes are introduced:

* LCP has a hashtable called `ContentIdentifiersForLCP` to store
(element, image) pairs to avoid processing the same pair multiple
times. Instead of using weak pointers for elements, this patch changes
it to use raw pointers for better performance. Also, makes the
hashtable to use element alone as the key, so that the entry
can be quickly removed when nsINode::LastRelease is called.

* Another change to make imgRequestProxy stores the
timestamps for LCP, so we can create LCP entries when the size
is available, instead of creating one temporarily and updating it
later. This allows us to eliminate a hashtable called
`mImageLCPEntryMap` for better performance.

Differential Revision: https://phabricator.services.mozilla.com/D214315
2024-07-23 20:42:40 +00:00
Olli Pettay
72f9ff5818 Bug 1856460, rename nsContentUtils::HasMutationListeners, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D215845
2024-07-08 20:39:43 +00:00
Emilio Cobos Álvarez
e132baba5a Bug 1905675 - Clean up IntersectionObserver set-up. r=smaug
UpdateIntersectionObservation takes some time (see profile in blocked
bug). It it needs to do multiple hashmap lookups unnecessarily.

We can store the observation state in the IntersectionObserver object
and remove the bespoke intersectionobserverlist property, using
BindObject / UnbindObject to keep stuff alive, like ResizeObserver and
MutationObserver do.

Differential Revision: https://phabricator.services.mozilla.com/D215370
2024-07-02 19:08:06 +00:00
Masayuki Nakano
e1fd41420f Bug 1675847 - part 3: Make ePointerClick event dispatchers and handlers use WidgetPointerEvent r=smaug,search-reviewers,devtools-reviewers,nchevobbe,jteow
This patch makes the all `ePointerClick` event dispatcher in C++ code use
`WidgetPointerEvent` instead of `WidgetMouseEvent`.

Then, this patch also makes the all `click` event dispatcher in chrome code use
`PointerEvent` instead of `MouseEvent`.  For detecting wrong trusted event
dispatching of `click` event, this patch adds assertion into `MouseEvent`.
Therefore, all chrome test dispatchers also changed to use `PointerEvent`.

Finally, this patch includes a change of a WPT.  That checks the `pointerId`
caused by executing an access key.  In this case, the value should be `-1`
rather than the default value `0` because Pointer Event spec defines so for
synthetic pointer events caused by non-pointing devices [1].  Chrome also
sets it to `-1` and fails [2].  Therefore, the new assertion will pass on both
Firefox and Chrome.

1. https://w3c.github.io/pointerevents/#dom-pointerevent-pointerid
2. https://wpt.fyi/results/uievents/interface/keyboard-accesskey-click-event.html?run_id=5087897523060736&run_id=5136270464647168&run_id=5163620816388096&run_id=5201281304231936

Differential Revision: https://phabricator.services.mozilla.com/D213001
2024-06-14 00:18:47 +00:00
Masayuki Nakano
fb5048e05b Bug 1675847 - part 1: Rename eMouseClick and eMouseAuxClick r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D212999
2024-06-14 00:18:46 +00:00
Ting-Yu Lin
5cd68a11de Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.

Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.

Differential Revision: https://phabricator.services.mozilla.com/D211496
2024-05-30 06:32:21 +00:00
Ting-Yu Lin
14aebc5bf9 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-30 06:32:17 +00:00
Sebastian Hengst
bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin
5d5204f810 Bug 1896516 Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio
Also, in EventStateManager, convert `ComputeScrollTarget()` and
`ComputeScrollTargetAndMayAdjustWheelEvent()` to return `ScrollContainerFrame*`
so that we can drop more unnecessarily `do_QueryFrame`.

Due to removing `nsIScrollableFrame` forward declaration in DOM headers, we have
to add `nsIScrollableFrame` forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove `nsIScrollableFrame` under layout/.

Differential Revision: https://phabricator.services.mozilla.com/D211496
2024-05-28 04:46:20 +00:00
Ting-Yu Lin
6f6e711315 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-28 04:46:16 +00:00
Tom Schuster
c223046d21 Bug 1835157 - Ignore target names which contain both newline and < characters. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D210480
2024-05-24 08:09:36 +00:00
Fatih
4e77f4c796 Bug 1871789 - Spoof mozInputSource and mozPressure for RFP. r=tjr,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D209543
2024-05-16 19:43:12 +00:00
Adam Vandolder
a47cef74ff Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-15 16:40:21 +00:00
Tamas Szentpeteri
2b8d8ca135 Backed out 2 changesets (bug 1890428) for causing wpt failures on idlharness.https.html. CLOSED TREE
Backed out changeset 1954ce9669b8 (bug 1890428)
Backed out changeset 3e45e3d15eed (bug 1890428)
2024-05-15 11:19:46 +03:00
Adam Vandolder
a54c0a7578 Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-15 03:01:19 +00:00
Cristian Tuns
badab1c1b7 Backed out 2 changesets (bug 1890428) for causing failures in idlharness.window.html?exclude=Node CLOSED TREE
Backed out changeset f9cf0740eef2 (bug 1890428)
Backed out changeset 37e2a10a9022 (bug 1890428)
2024-05-14 19:42:37 -04:00
Adam Vandolder
35af9c2203 Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-14 16:43:28 +00:00
Ting-Yu Lin
5604d30ede Bug 1488080 Part 1 - Convert GetAllInFlowRects flags to EnumSet. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D209096
2024-05-03 18:42:41 +00:00
Sean Feng
af64dc7f02 Bug 1881097 - Ensure nsContentUtils::IsPointInSelection works for point in selection that crosses the boundary r=smaug
Ths patch introduces a new class called `CrossShadowBoundaryRange` to
make cross shadow boundary range related stuff can be isolated into a
single class.

It also tweaks a few functions along the call stack, the goal here
is to make sure nsContentUtils::IsPointInSelection can detect points
in ShadowDOM selection.

There's an additional change to `SelectionUtils.sys.mjs` to make sure
the correct context menu items are displayed when the current selection
crosses the boundary.

Differential Revision: https://phabricator.services.mozilla.com/D204080
2024-04-15 13:09:08 +00:00
Vincent Hilla
8cd8ba4bdf Bug 1873738 - Make non-html elements have a directionality. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D204384
2024-03-26 12:54:25 +00:00
Sean Feng
84c6bd5b1f Bug 1867058 - Part 7: Reset the CrossBoundaryRange when nodes becomes shadow host r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D195307
2024-03-25 13:40:58 +00:00
pstanciu
bcc6e01718 Backed out 12 changesets (bug 1867058) for causing bustages on AbstractRange.cpp
Backed out changeset 6254c9c51033 (bug 1867058)
Backed out changeset 2ad556d56736 (bug 1867058)
Backed out changeset a8bc41291ab3 (bug 1867058)
Backed out changeset c30869c03a70 (bug 1867058)
Backed out changeset 39c5816dff6b (bug 1867058)
Backed out changeset 42e226158dc9 (bug 1867058)
Backed out changeset 67bb7158a09f (bug 1867058)
Backed out changeset 7b5a689dc7fd (bug 1867058)
Backed out changeset 3cf108eb13a6 (bug 1867058)
Backed out changeset 8efda4cce80c (bug 1867058)
Backed out changeset 0837e15babab (bug 1867058)
Backed out changeset 8ce7972ea4df (bug 1867058)
2024-03-23 02:24:26 +02:00
Sean Feng
ad7cdbbd0e Bug 1867058 - Part 7: Reset the CrossBoundaryRange when nodes becomes shadow host r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D195307
2024-03-22 17:05:50 +00:00
Emilio Cobos Álvarez
747332792a Bug 1880189 - Implement Element.currentCSSZoom. r=webidl,layout-reviewers,dshin,smaug
As per https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom

Differential Revision: https://phabricator.services.mozilla.com/D205214
2024-03-20 21:55:52 +00:00
Adam Vandolder
ff13a04474 Bug 1876885 - Implement modified behaviour for doubly-attached declarative shadow roots. r=dom-core,peterv
Differential Revision: https://phabricator.services.mozilla.com/D200026
2024-03-18 15:36:56 +00:00
Emilio Cobos Álvarez
1c20c25eda Bug 232598 - Return null for unset attributes in XUL. r=smaug,devtools-reviewers,omc-reviewers,zombie,nchevobbe,settings-reviewers,application-update-reviewers,credential-management-reviewers,mossop,aminomancer,bytesized,issammani,sessionstore-reviewers,dao
I just got bit by this in bug 1873833, let's just fix it. There isn't
all that much stuff depending on it anymore.

Differential Revision: https://phabricator.services.mozilla.com/D204496
2024-03-18 09:15:07 +00:00
Emilio Cobos Álvarez
1bdeaab503 Bug 1885521 - Use GetWidgetScreen to get Element.screen. r=stransky
So that we get the right screen on Wayland, where ScreenForRect is not
really reliable.

This makes mismatched screen sizes and resolutions work better. In
particular, this matches what window.screen returns.

Differential Revision: https://phabricator.services.mozilla.com/D204753
2024-03-16 15:52:06 +00:00
Eitan Isaacson
55275793f7 Bug 1883996 - P2: Add ariaActiveDescendantElement to ARIAMixin and implement. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D203850
2024-03-12 20:32:16 +00:00
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