Commit graph

445 commits

Author SHA1 Message Date
Stanca Serban
c69cbb70a3 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
8c1befaa95 Bug 1712140 - Part 3: Add support for parsing and building Declarative ShadowDOMs. r=dom-core,webidl,saschanaz,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D193675
2023-11-30 23:17:15 +00:00
Olli Pettay
69b34cf0ad Bug 1843477, mark some classes being main thread only, r=mccr8
Depends on D187148

Differential Revision: https://phabricator.services.mozilla.com/D188958
2023-09-26 12:36:21 +00:00
Cosmin Sabou
baf8a5cf23 Backed out 6 changesets (bug 1843477) for causing hazards failures. CLOSED TREE
Backed out changeset 64b093aa12a9 (bug 1843477)
Backed out changeset bdcd84c938d1 (bug 1843477)
Backed out changeset 05c882dd0d9a (bug 1843477)
Backed out changeset 1de814e5820d (bug 1843477)
Backed out changeset 6a0e19a60a5d (bug 1843477)
Backed out changeset 48942aff586f (bug 1843477)
2023-09-26 05:32:28 +03:00
Olli Pettay
91d30ae3a7 Bug 1843477, mark some classes being main thread only, r=mccr8
Depends on D187148

Differential Revision: https://phabricator.services.mozilla.com/D188958
2023-09-25 21:09:01 +00:00
Olli Pettay
fe6ec03ab9 Bug 1843473 - Don't dispatch DOMActivate if there are no listeners for it, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D186473
2023-08-18 06:01:16 +00:00
Peter Van der Beken
9fba1d5220 Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre
Differential Revision: https://phabricator.services.mozilla.com/D184973
2023-08-02 20:41:48 +00:00
Sandor Molnar
aa6a466e90 Backed out 2 changesets (bug 1843035) for causing assertion failures in dom/html/nsGenericHTMLElement.cpp CLOSED TREE
Backed out changeset d44bf85938f0 (bug 1843035)
Backed out changeset 238e99b4449c (bug 1843035)
2023-07-18 17:30:09 +03:00
Mirko Brodesser
ce75e797f8 Bug 1843035: part 2) Assert correctness of popover attribute state at all relevant callers of GetPopoverAttributeState(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183477
2023-07-18 08:57:26 +00:00
Adam Vandolder
edc499ff75 Bug 1685333 - Support adoption of document fragment nodes across documents. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D177215
2023-07-13 14:02:46 +00:00
Emilio Cobos Álvarez
cea323d30e Bug 1837816 - Make selector cache not tied to a document. r=media-playback-reviewers,karlt,mstange
It doesn't really need to.

Differential Revision: https://phabricator.services.mozilla.com/D180591
2023-06-16 17:20:42 +00:00
Emilio Cobos Álvarez
a0aaf3999a Bug 1472169 - Notify of appends from CloneAndAdopt clone path. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D180314
2023-06-12 11:06:01 +00:00
Jan-Niklas Jaeschke
bfe0baa6d6 Bug 1828469, part 2: Moved some logic from nsRange to AbstractRange to support StaticRanges in custom highlights. r=masayuki
With this change, Selections are also registered into StaticRanges,
ultimately making them visible to `nsINode::IsSelected()`,
which is necessary to paint them.

Differential Revision: https://phabricator.services.mozilla.com/D175784
2023-05-31 08:23:45 +00:00
Mirko Brodesser
d1b6593b65 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
Noemi Erli
61ed1c4c8c Backed out 3 changesets (bug 1828469) for causing assertion in RangeBoundary.h
Backed out changeset ab92a12ba6ea (bug 1828469)
Backed out changeset 217801294c41 (bug 1828469)
Backed out changeset c78c717e4ec9 (bug 1828469)
2023-05-23 12:10:12 +03:00
Jan-Niklas Jaeschke
0bf8a22c8f Bug 1828469, part 2: Moved some logic from nsRange to AbstractRange to support StaticRanges in custom highlights. r=masayuki
With this change, Selections are also registered into StaticRanges,
ultimately making them visible to `nsINode::IsSelected()`,
which is necessary to paint them.

Differential Revision: https://phabricator.services.mozilla.com/D175784
2023-05-23 06:53:32 +00:00
Alexander Surkov
9e7e7094d5 Bug 1821732 - GetTopmostClickedPopover fails to return a popover, r=emilio
Temporary auto popover list variable is freed while it's used for mozilla::Reversed, thus
GetTopmostClickedPopover comparisment fails.

Differential Revision: https://phabricator.services.mozilla.com/D178209
2023-05-17 00:47:53 +00:00
Masayuki Nakano
45d0d4e574 Bug 1829570 - part 1: Create a static method version of AsyncEventDispatcher::RunDOMEventWhenSafe r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D176486
2023-05-15 01:07:29 +00:00
Emilio Cobos Álvarez
1c967006ab Bug 1831539 - Remove HasBoxFFI. r=boris
HasBoxFFI and HasArcFFI aren't great, see bug 1831242 as for examples of
why.

HasArcFFI requires a bit more care, but HasBoxFFI doesn't give us much
benefit. Instead use the same type in the FFI boundary.

Differential Revision: https://phabricator.services.mozilla.com/D177252
2023-05-09 11:07:26 +00:00
Jan-Niklas Jaeschke
cffddeed9d Bug 1830542: Avoid unnecessary allocation when registering Selections in nsRanges. r=smaug
`nsRange`s need to keep track of all `Selection` instances they are in, while maintaining an as-small-as-possible memory footprint.

The approach of using a linked list to store the selection pointers led to a performance regression
because of the necessary allocations of the selection wrapper class.

Since the `AutoTArray` has an identical size, the list can easily be replaced.

Differential Revision: https://phabricator.services.mozilla.com/D176908
2023-05-03 10:03:29 +00:00
Alexander Surkov
042441bd22 Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-18 19:50:52 +00:00
Emilio Cobos Álvarez
8b5b7ad998 Bug 1827856 - Remove nativeAnonymousChildList observers. r=smaug,credential-management-reviewers,devtools-reviewers,sgalich,nchevobbe
You let me know if this seems appealing to you :)

Differential Revision: https://phabricator.services.mozilla.com/D175382
2023-04-18 14:58:34 +00:00
Butkovits Atila
fdef98b00c Backed out changeset 241b4b54e654 (bug 1824374) for causing failures at popover-invoking-attribute.html. 2023-04-17 23:44:22 +03:00
Alexander Surkov
f4b740a32f Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-17 18:10:13 +00:00
Cosmin Sabou
cf995cf1bc Backed out changeset d030d5dc991d (bug 1824374) for causing popover related wpt failures. 2023-04-15 20:05:46 +03:00
Alexander Surkov
f57acd035f Bug 1824374 - implement popover activation behavior, r=emilio
See https://html.spec.whatwg.org/#the-input-element:popover-target-attribute-activation-behavior

Differential Revision: https://phabricator.services.mozilla.com/D175485
2023-04-15 13:55:51 +00:00
Ziran Sun
6ae795cc23 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
Olli Pettay
ce96f3bd14 Bug 1826603 - Don't dispatch transition events if there are no listeners, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D174829
2023-04-06 09:09:33 +00:00
Emilio Cobos Álvarez
641fa20731 Bug 1825825 - Simplify NAC setup. r=smaug
Make all UA widgets also NAC.

Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.

This is important because two callers depend on this difference:

 * The style system, since we still want to match content rules from
   stylesheets in the UA widget. We also match user rules, which is a
   bit sketchy, but that was the previous behavior, will file a
   follow-up for that.

 * The reflector code, since we want the scope for UA widgets to not
   include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
   got it wrong.

After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.

Differential Revision: https://phabricator.services.mozilla.com/D174310
2023-04-05 09:19:15 +00:00
Alexander Surkov
7702f29b64 Bug 1821732 - implement get popover target alg, r=emilio
See https://html.spec.whatwg.org/multipage/popover.html#popover-target-element

Differential Revision: https://phabricator.services.mozilla.com/D174318
2023-04-03 13:22:05 +00:00
Alexander Surkov
366fa1626d Bug 1823757 - implement attr associated element, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173337
2023-03-30 16:15:52 +00:00
Alexander Surkov
0e303cdba9 Bug 1821732 - implement the topmost clicked popover algorithm, r=emilio
See https://html.spec.whatwg.org/multipage/popover.html#topmost-clicked-popover spec.
In support of popover light dismiss, see
https://html.spec.whatwg.org/multipage/popover.html#popover-light-dismiss

Differential Revision: https://phabricator.services.mozilla.com/D173991
2023-03-30 15:56:49 +00:00
Alexander Surkov
430e56024c Bug 1821732 - implement nearest invlusive target popover for invoker alg, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173539
2023-03-27 16:12:53 +00:00
Alexander Surkov
19fd43ac10 Bug 1821732 - implement the nearest inclusive open popover algorithm, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D173043
2023-03-21 02:21:28 +00:00
Emilio Cobos Álvarez
01a41fb486 Bug 1820280 - Be consistent for which URIs we expose chrome rules. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D171640
2023-03-07 20:22:23 +00:00
Jan-Niklas Jaeschke
ebf3cd6240 Bug 1808565, part 1: Adapt Selection to support StaticRanges. r=webidl,saschanaz,masayuki,smaug
This change is necessary to support the [CSS Highlight API](https://drafts.csswg.org/css-highlight-api-1/),
which uses `Selection` internally.

To replace `nsRange` with `AbstractRange`, some sections needed to be
adapted since `nsRange`-specific features were used.
Therefore, some methods (such as `GetRangeAt()`) may only be called if
the `Selection` is *not* of type `SelectionType::eHighlight`,
as it (per spec) returns an `nsRange`.
These methods will now `MOZ_ASSERT` if called for a highlight selection.
Additional methods are implemented which return `AbstractRange`
instead and are safe to be called for every selection type.

This commit also improves support of highlight features:
- Invalidation of highlight ranges: adding/removing Ranges in-place instead of
  removing and re-adding the Selection object associated with the highlight.
- Ranges are only associated with the Selection that shares the same Document
- Fixed minor IDL issue

Differential Revision: https://phabricator.services.mozilla.com/D170582
2023-03-03 14:59:47 +00:00
Masayuki Nakano
0df404cf45 Bug 1810406 - Make IMEContentObserver initialize its root element with the anonymous <div> if the editor is a TextEditor r=smaug
Although I cannot reproduce the bug in mochitest with
`nsIDOMWindowUtils.sendQueryContentEvent`, one of the problem in the web site
is, the frame of `<textarea>` is reframed at typing something.  Then, retrieving
computed style causes a flush **before** new `TextEditor` is recreated and
re-initialize `IMEContentObserver` with new anonymous contents.  At this time,
`IMEContentObserver` gets shadow root or document element from start container
of the first selection range which is in the text node in the anonymous `<div>`
instead of the anonymous `<div>` here:
https://searchfox.org/mozilla-central/rev/01d7150d99c3c175300560d33dcdeea3f6b7eb29/dom/events/IMEContentObserver.cpp#272,277-279

The reason is, `nsFrameSelection` has not been set to the independent selection
for the text control because `EditorBase::InitializeSelection` has not been
called via a call of `PostCreate` and of course, the selection ancestor limiter
has not been reset yet.
https://searchfox.org/mozilla-central/rev/01d7150d99c3c175300560d33dcdeea3f6b7eb29/editor/libeditor/EditorBase.cpp#5204,5212

Therefore, `nsINode::GetSelectionRootContent` crosses the native anonymous
subtree boundary and return a parent node of the text control because here
does not work as expected.
https://searchfox.org/mozilla-central/rev/01d7150d99c3c175300560d33dcdeea3f6b7eb29/dom/base/nsINode.cpp#583-593

`IMEContentObserver` should use `EditorBase::GetRoot()` instead of referring
`Selection` because it's stabler in any situation at that time.

Differential Revision: https://phabricator.services.mozilla.com/D170032
2023-02-21 22:51:42 +00:00
Jan-Niklas Jaeschke
2243494a74 Bug 1810403: Allow nsRanges to be in multiple Selections. r=masayuki
The Custom Highlight API allows a use case where a `Range` of a `Highlight`
is also used as `Selection`. Due to the decision to use the `Selection` mechanism
to display `Highlight`s, a `Range` can be part of several `Selection`s.
Since the `Range` has a pointer to its associated `Selection`
to notify about changes, this must be adapted to allow several `Selections`.

As a tradeoff of performance and memory usage, the `Selection`s are stored
as `mozilla::LinkedList`. A helper class `mozilla::SelectionListWrapper`
was implemented to allow `Selection`s to be in multiple of these lists
and without having to be derived from `LinkedListElement<T>`.

To simplify usage of the list, the use case  "does this range belong to Selection x?"
is wrapped into the convenience method`IsInSelection(Selection&)`;
The method previously named like this was renamed to `IsInAnySelection()`
to be named more precisely.

Registering and unregistering of the closest common inclusive ancestor
of the `Range` is done when the first `Selection` is registered and
the last `Selection` is unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D169597
2023-02-21 12:25:28 +00:00
Emilio Cobos Álvarez
6c32b964cd Bug 1807003 - Centralize animation data in slots. r=smaug,firefox-animation-reviewers,boris
This should both be faster and simpler. Also will allow us in the future
to animate more pseudos without having to add a gazillion properties.

I think we should try to clear more stuff (maybe the whole animation
data) on unbind, but that's a bit tangential.

Differential Revision: https://phabricator.services.mozilla.com/D169860
2023-02-15 14:12:33 +00:00
Olli Pettay
0c62f41091 Bug 1816242 - Optimize nsRange::ContentRemoved in some common cases, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D169549
2023-02-13 13:42:00 +00:00
Olli Pettay
e8b7bce992 Bug 1799354, replaceChildren should fire DOMNodeRemoved when needed (and not assert about 'Want to fire DOMNodeRemoved event, but it's not safe'), r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D161682
2022-11-16 20:29:53 +00:00
Olli Pettay
4aff70800a Bug 1799354 - MutationRecord missing for Element.replaceChildren, r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D161548
2022-11-16 20:29:52 +00:00
Jan-Niklas Jaeschke
4265f72859 Bug 1777925: Replaced MutationObserver array container type with linked list. r=smaug
Deletion of mutation observers from a list resulted in O(n^2) behavior and could lead to massive freezes.
This is resolved by using a LinkedList instead, reducing complexity to O(n).

A safely iterable doubly linked list was implemented based on `mozilla::DoublyLinkedList`,
allowing to insert and remove elements while iterating the list.

Due to the nature of `mozilla::DoublyLinkedList`, every Mutation Observer now inherits `mozilla::DoublyLinkedListElement<T>`.
This implies that a Mutation Observer can only be part of one DoublyLinkedList.
This conflicts with some Mutation Observers, which are being added to multiple `nsINode`s.
To continue supporting this, new MutationObserver base classes `nsMultiMutationObserver` and `nsStubMultiMutationObserver` are introduced,
which create `MutationObserverWrapper` objects each time they are added to a `nsINode`.
The wrapper objects forward every call to the actual observer.

Differential Revision: https://phabricator.services.mozilla.com/D157031
2022-09-21 11:31:44 +00:00
Nika Layzell
7ced96212e Bug 1778211 - Reject xpidl CDATA containing 'virtual', r=xpcom-reviewers,necko-reviewers,mccr8,dragana
We'll probably want to do something more accurate in the future with a
custom clang static analysis pass which validates that XPIDL interfaces
have the expected vtable and struct layout, however doing so would be
more involved than the string matching done in this patch.

In addition to checking for extra virtual methods, we'll likely also
want to check for data members on interfaces, and reject them unless the
class is marked as `[builtinclass]` in addition to some other attribute
which we'll need to add to prevent them from being implemented in Rust
(as c++ data members will not be reflected by the rust macro).

There were 2 instances of a comment which contained the word 'virtual'
within a CDATA block. These comments were moved out of the CDATA block
to avoid triggering the error.

Differential Revision: https://phabricator.services.mozilla.com/D151068
2022-07-06 14:53:06 +00:00
Martin Robinson
cac491e1fd Bug 1477524 - Update quotes and counters to work trough the flattened tree r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146693
2022-05-26 16:12:46 +00:00
Norisz Fay
28db98ade1 Backed out changeset ce66cc2cbb95 (bug 1477524) for causing build bustages on nsCounterManager.cpp CLOSED TREE 2022-05-26 15:24:40 +03:00
Martin Robinson
786890b5c4 Bug 1477524 - Update quotes and counters to work trough the flattened tree r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146693
2022-05-26 11:15:16 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Emilio Cobos Álvarez
42b3b10f8a Bug 1709790 - Implement HTMLElement.outerText. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D136240
2022-01-19 12:49:29 +00:00
Kagami Sascha Rosylight
48afe2ea6e Bug 1539884 - Part 4: Mark nsContentUtils::MaybeFireNodeRemoved as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D133904
2021-12-16 17:17:05 +00:00