Commit graph

398 commits

Author SHA1 Message Date
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
Butkovits Atila
125116c312 Backed out 8 changesets (bug 1539884) for causing build bustages at Document.cpp. CLOSED TREE
Backed out changeset ad65ce9208ce (bug 1539884)
Backed out changeset 15d728ef97ca (bug 1539884)
Backed out changeset de9e2829d42a (bug 1539884)
Backed out changeset a8cfa2201751 (bug 1539884)
Backed out changeset ca21c5838f37 (bug 1539884)
Backed out changeset 3d3019f61b5a (bug 1539884)
Backed out changeset ca7c808621d6 (bug 1539884)
Backed out changeset 57068a40f3c9 (bug 1539884)
2021-12-16 08:12:15 +02:00
Kagami Sascha Rosylight
15e845564d Bug 1539884 - Part 4: Mark nsContentUtils::MaybeFireNodeRemoved as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D133904
2021-12-16 02:58:45 +00:00
Masayuki Nakano
6123f0e0d8 Bug 1741148 - part 5: Make nsINode::CompareDocumentPosition() and nsContentUtils::PositionIsBefore() treat offset in DOM node with Maybe<uint32_t> r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D131338
2021-12-09 12:26:43 +00:00
Masayuki Nakano
8cddf2911a Bug 1741148 - part 4: Add nsINode::ComputeIndexInParentNode() and nsINode::ComputeIndexInParentContent() r=smaug
Some callers of `nsINode::ComputeIndexOf()` do not use its parent node except
calling it.  These tiny methods make such callers simpler.

Differential Revision: https://phabricator.services.mozilla.com/D131337
2021-12-09 12:03:00 +00:00
Masayuki Nakano
3816ca9546 Bug 1741148 - part 3: Make users of nsINode::ComputeIndexOf_Deprecated() use nsINode::ComputeIndexOf() if the result is not set to int32_t nor return as int32_t r=smaug
This patch fixes only the cases if the result of `ComputeIndexOf_Deprecated()`
is used as unsigned integer with implicit or explicit cast.

Differential Revision: https://phabricator.services.mozilla.com/D131336
2021-12-09 11:55:36 +00:00
Masayuki Nakano
fb2940808f Bug 1741148 - part 2: Re-implement nsINode::ComputeIndexOf as returning Maybe<uint32_t> rather than int32_t r=smaug
Offset in a node is declared as "unsigned long" by the standards and we don't
limit node can have less than `INT32_MAX`.  So it should return `uint32_t`, but
it also needs to represent the case of "not found".  For consistency with some
other APIs like `nsContentUtils::ComparePoints`, using `Maybe` must be a good
style rather than `Result<uint32_t, bool>`.

This patch fixes the callers in assertions for example.

Differential Revision: https://phabricator.services.mozilla.com/D131335
2021-12-09 09:21:52 +00:00
Masayuki Nakano
f2baf0d9ab Bug 1741148 - part 1: Rename nsINode::ComputeIndexOf to ComputeIndexOf_Deprecated r=smaug
It's hard to fix some callers.  Therefore, in this bug, we should fix only
simple cases.  Therefore, we should rename existing API first.

Differential Revision: https://phabricator.services.mozilla.com/D131334
2021-12-09 08:32:30 +00:00
Masayuki Nakano
c19aa5aaa5 Bug 1740853 - part 1: Make nsContentUtils::ComparePoints take uint32_t for offset in DOM nodes r=smaug
They are defined as "unsigned long" by the standards.  So we should use
`uint32_t` rather than `int32_t` with the methods.  However, layout code
uses `int32_t` a lot for representing the offset.  Therefore, this patch
adds `*_FixOffset1` etc for the cases which cannot fix easily in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D131110
2021-12-09 07:51:45 +00:00
Masayuki Nakano
71fc64caea Bug 1735745 - Make SelectionChangeEventDispatcher dispatch select event and selectchange event only when there may be corresponding event listeners r=smaug
`select` event on text controls now dispatched immediately before
`selectionchange`.  However, it needs to create `AsyncEventDispatcher` for
each.  This cost may not be expensive, but they are called really a lot even
if there is no corresponding event listener.

Therefore, this patch makes `nsPIDOMWindow` and `EventListenerManager` have
`MayHave*EventListeners` flag separately for each, and makes
`SelectionChangeEventDispatcher` does not try to do create
`AsyncEventDispatcher` when there is no corresponding event listener.

Differential Revision: https://phabricator.services.mozilla.com/D131750
2021-11-25 07:09:23 +00:00
Masayuki Nakano
334e34f0a9 Bug 1740416 - Make HTMLEditor::HandleInsertParagraphInParagraph() call WhiteSpaceVisibilityKeeper::PrepareToSplitBlockElement() before splitting a text node r=m_kato,smaug
It does the following things when caret is collapsed in a text node in a `<p>`
or `<div>` element.

1. Split the text node containing caret to insert `<br>` element
2. Insert `<br>` element after it
3. Split ancestor elements which inclusive descendants of the `<p>` or `<div>`
4. Delete the `<br>` element if unnecessary from the left paragraph

#3 and #4 are performed by `HTMLEditor::SplitParagraph()` and it calls
`WhiteSpaceVisibilityKeeper::PrepareToSplitBlockElement()` correctly before
splitting the block.  However, in the case (caret is at middle of a text node),
the text has already been split to 2 nodes because of #1.  Therefore, it fails
to handle to keep the white-space visibility.

So that I believe that the root cause of this bug is, the method does much
complicated things which are required, and doing the redundant things will
eat memory space due to undo transactions.  However, for now, I'd like to fix
this with a simple patch which just call the preparation method before splitting
the text node because I'd like to uplift this if it'd be approved (Note that
this is not a recent regression, the root cause was created by bug 92686 which
was fixed in 17 years ago:
<https://searchfox.org/mozilla-central/commit/2e66280faef73e9be218e00758d4eb738395ac83>,
but must be annoying bug for users who see this frequently).

The new WPTs are pass in Chrome.

Differential Revision: https://phabricator.services.mozilla.com/D130950
2021-11-12 22:13:51 +00:00
Emilio Cobos Álvarez
bd406d8841 Bug 1740230 - Allow matches() / querySelector() / etc on chrome docs to access chrome-only selectors. r=boris
Without this some tests fail with the previous patch because code like:

  https://searchfox.org/mozilla-central/rev/267682a8f45221bf0bfe999d4a0239706a43bc56/browser/base/content/browser-gestureSupport.js#651

starts throwing. Unfortunately I had missed that on my try run, because
the error message didn't include that exception (it seemed like an
intermittent browser-chrome failure instead).

We could expose a ChromeOnly API for this, but this seems better. This
fixes it trivially, and also removes the "no url data" situation from
the selector parser, which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D130818
2021-11-10 12:56:35 +00:00
Butkovits Atila
3a33d047e8 Backed out 2 changesets (bug 1740230) for causing build bustages.
Backed out changeset ba8e644ee9d2 (bug 1740230)
Backed out changeset 180d03015fd1 (bug 1740230)
2021-11-10 02:12:26 +02:00
Emilio Cobos Álvarez
620bd78775 Bug 1740230 - Allow matches() / querySelector() / etc on Chrome docs to access chrome-only selectors. r=boris
Without this some tests fail with the previous patch because code like:

  https://searchfox.org/mozilla-central/rev/267682a8f45221bf0bfe999d4a0239706a43bc56/browser/base/content/browser-gestureSupport.js#651

starts throwing. Unfortunately I had missed that on my try run, because
the error message didn't include that exception (it seemed like an
intermittent browser-chrome failure instead).

We could expose a ChromeOnly API for this, but this seems better. This
fixes it trivially, and also removes the "no url data" situation from
the selector parser, which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D130818
2021-11-09 23:28:48 +00:00
Edgar Chen
e3d4695e4f Bug 1556354 - Part 3: Merge LifecycleCallback*Args; r=smaug
To make adding new callback a bit easier.

Differential Revision: https://phabricator.services.mozilla.com/D129190
2021-10-25 14:28:05 +00:00
Andrew McCreight
8c5d7e5ee8 Bug 1736707, part 1 - Get rid of nsContentUtils::NameSpaceManager(). r=peterv
Call nsNameSpaceManager::GetInstance() instead.

Differential Revision: https://phabricator.services.mozilla.com/D129033
2021-10-22 16:15:57 +00:00
Masayuki Nakano
25a3c48305 Bug 1732845 - Add nsINode::IsInDesignMode() to check whether the node is directly in design mode r=smaug
There are a lot of check of `Document`'s editable state **with** comments. This
means that it's unclear for developers that only `Document` node is editable in
design mode.

Additionally, there are some points which use composed document rather than
uncomposed document even though the raw API uses uncomposed document. Comparing
with the other browsers, checking uncomposed document is compatible behavior,
i.e., nodes in shadow trees are not editable unless `contenteditable`.

Therefore, `nsINode` should have a method to check whether it's in design mode
or not.

Note that it may be called with a node in UA widget.  Therefore, this patch
adds new checks if it's in UA widget subtree or native anonymous subtree,
checking whether it's in design mode with its host.

Differential Revision: https://phabricator.services.mozilla.com/D126764
2021-10-12 03:14:43 +00:00
Edgar Chen
9e31c6d5f6 Bug 1556351 - Part 9: Implement FACE upgrade; r=smaug
ElementInternal implements nsIFormControl and QueryInterface HTMLElement to a
nsIFormControl would return its associated ElementInternal instead.

Differential Revision: https://phabricator.services.mozilla.com/D125211
2021-10-04 20:51:28 +00:00
Edgar Chen
495e0b741d Bug 1556351 - Part 5: Make nsGenericHTMLFormControlElement implement nsIFormControl; r=smaug
nsGenericHTMLFormElement doesn't implement nsIFormControl now as HTMLElement would
inherit it to be able to be added into HTMLFormElement and HTMLFieldSetElement and
support some common form feature.

So some places that call the nsIFormControl method on nsGenericHTMLFormElement
directly would need to queryInterface it to nsIFormControl first, this should be
fine as those places are not in a hot path.

Differential Revision: https://phabricator.services.mozilla.com/D124788
2021-10-04 20:51:27 +00:00
Sean Feng
2aa145db40 Bug 1705141 - Implement imperative slotting API r=smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D119444
2021-07-20 18:06:25 +00:00
Edgar Chen
1ebbd60592 Bug 1685421 - Part 2: Stop using NS_ERROR_DOM_HIERARCHY_REQUEST_ERR in nsINode; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113344
2021-06-02 13:43:39 +00:00
Simon Giesecke
4803e61816 Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 17:56:46 +00:00
Csoregi Natalia
f54ee076ae Backed out 13 changesets (bug 708901, bug 1184468) for causing build bustage on GeckoViewHistory.cpp. CLOSED TREE
Backed out changeset b1e4c01e63b8 (bug 708901)
Backed out changeset 37b52cce83c0 (bug 708901)
Backed out changeset eee75f33f060 (bug 708901)
Backed out changeset 479bf64c7986 (bug 708901)
Backed out changeset 15a8fb94d15d (bug 708901)
Backed out changeset be31ccd9a61d (bug 708901)
Backed out changeset fc54f4eaedd5 (bug 708901)
Backed out changeset 03c3a56c3d13 (bug 708901)
Backed out changeset 73f11d3c1298 (bug 708901)
Backed out changeset aed22fd80893 (bug 708901)
Backed out changeset 74d8249fbe7e (bug 708901)
Backed out changeset acb725eb3c1d (bug 1184468)
Backed out changeset 70f3ea6efec4 (bug 1184468)
2021-03-24 19:26:20 +02:00
Simon Giesecke
82e566bfca Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 16:58:58 +00:00
Gerald Squelart
2416d881e2 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
Simon Giesecke
d4f7649e81 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D104203
2021-02-09 18:19:39 +00:00
Edgar Chen
7330687550 Bug 1221868 - Correct the document check for appending a document fragment node; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101339
2021-01-11 15:01:09 +00:00
Sean Feng
57394dfeed Bug 1646604 - Fix cross docGroup node adoption may not correctly keep the arena alive r=smaug
We use nsINode::Adopt to store the arenas to a hashtable to keep them
alive, however this method is not guaranteed to be called, so it
may cause arenas to be disposed before all nodes are destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D101042
2021-01-08 00:24:53 +00:00
Emilio Cobos Álvarez
7d03492002 Bug 1682988 - Use UTF8String for querySelector and similar OM methods. r=heycam
This has no observable behavior change because we were converting to
UTF-8 in ParseSelectorList.

Differential Revision: https://phabricator.services.mozilla.com/D99961
2020-12-23 05:42:00 +00:00
Emilio Cobos Álvarez
628415287c Bug 1682159 - Do a minor cleanup of the Element clone code. r=edgar
Depends on D99632

Differential Revision: https://phabricator.services.mozilla.com/D99633
2020-12-16 07:54:10 +00:00
smolnar
78271aa3ec Backed out 2 changesets (bug 1669933, bug 1682159) because failures were not from wptsync , for failing print reftest animations-print.html CLOSED TREE
Backed out changeset 7e9cf639b261 (bug 1669933)
Backed out changeset bee3e0399e0d (bug 1682159)
2020-12-15 01:46:51 +02:00
Emilio Cobos Álvarez
e5e7d5aa3a Bug 1682159 - Do a minor cleanup of the Element clone code. r=edgar
Depends on D99632

Differential Revision: https://phabricator.services.mozilla.com/D99633
2020-12-14 12:47:04 +00:00
Emilio Cobos Álvarez
b68e90741f Bug 1682159 - Copy defined state to static clones. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D99632
2020-12-14 12:48:23 +00:00
Simon Giesecke
7499023887 Bug 1673931 - Avoid including DebuggerNotificationBinding.h from header files. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D97611
2020-12-10 11:09:32 +00:00
Simon Giesecke
e21b3c5809 Bug 1673931 - Move ElementCallbackType from Document.h to CustomElementRegistry.h.
Differential Revision: https://phabricator.services.mozilla.com/D95184

Depends on D95048
2020-11-23 16:08:11 +00:00
Simon Giesecke
fbfebfdada Bug 1673931 - Resolve Document/Element cycle. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95045

Depends on D94869
2020-11-23 16:07:21 +00:00
Simon Giesecke
971b645fe3 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
Masayuki Nakano
235177bdeb Bug 1623918 - part 1: Make nsINode::GetTextEditorRootContent() handle TextControlElement after stopping climbing the DOM tree up r=smaug
It was designed for retrieving associated `TextEditor` and its root content
(anonymous `<div>` element) if the node is in native anonymous subtree in a
text editor or if the node itself is a `TextControlElement`.  Additionally,
`TextControlElement` cannot be nested.  Therefore, it can stop climbing up the
DOM tree when it meets a `TextControlElement`.

Then, we can rewrite this without a loop implemented by itself.  Instead,
it can use `GetClosestNativeAnonymousSubtreeRootParent()` when the node is
in native anonymous subtree.  Otherwise, it just needs to check whether it's
a `TextControlElement` or not.  Therefore, we can make it stop using
`InclusiveAncestorsOfType`.

Finally, it calls `TextControlElement::GetTextEditor()` which is marked as
`MOZ_CAN_RUN_SCRIPT`.  And I think that it may cause running selection
listeners (mutation event listeners won't run because changes occur only in
the native anonymous subtree).  Therefore, we should mark all callers of
it with `MOZ_CAN_RUN_SCRIPT` later.

Differential Revision: https://phabricator.services.mozilla.com/D92728
2020-10-09 02:36:30 +00:00
Narcis Beleuzu
c163b394ef Backed out 2 changesets (bug 1623918) for crashtest failure on 1623918.html CLOSED TREE
Backed out changeset 519ca1b069e5 (bug 1623918)
Backed out changeset d8a09a5fea47 (bug 1623918)
2020-10-08 12:06:58 +03:00
Masayuki Nakano
a28cbd4f31 Bug 1623918 - part 1: Make nsINode::GetTextEditorRootContent() handle TextControlElement after stopping climbing the DOM tree up r=smaug
It was designed for retrieving associated `TextEditor` and its root content
(anonymous `<div>` element) if the node is in native anonymous subtree in a
text editor or if the node itself is a `TextControlElement`.  Additionally,
`TextControlElement` cannot be nested.  Therefore, it can stop climbing up the
DOM tree when it meets a `TextControlElement`.

Then, we can rewrite this without a loop implemented by itself.  Instead,
it can use `GetClosestNativeAnonymousSubtreeRootParent()` when the node is
in native anonymous subtree.  Otherwise, it just needs to check whether it's
a `TextControlElement` or not.  Therefore, we can make it stop using
`InclusiveAncestorsOfType`.

Finally, it calls `TextControlElement::GetTextEditor()` which is marked as
`MOZ_CAN_RUN_SCRIPT`.  And I think that it may cause running selection
listeners (mutation event listeners won't run because changes occur only in
the native anonymous subtree).  Therefore, we should mark all callers of
it with `MOZ_CAN_RUN_SCRIPT` later.

Differential Revision: https://phabricator.services.mozilla.com/D92728
2020-10-08 03:55:29 +00:00
Emilio Cobos Álvarez
0f14258fc2 Bug 1667510 - Make UA widgets in print documents more static. r=smaug
This ensures that styles from UA widgets apply. Turns out they look
pretty much right without them, but there's a bug in nsDateTimeBoxFrame
where we rely on the styles in order for the baseline to be sensible.

Differential Revision: https://phabricator.services.mozilla.com/D91616
2020-09-29 10:31:48 +00:00
Bogdan Tara
ee2b75d56b Backed out changeset 482bd861c745 (bug 1667510) for causing mochitest leaks CLOSED TREE 2020-09-29 01:35:24 +03:00
Emilio Cobos Álvarez
d2429334ba Bug 1667510 - Make UA widgets in print documents more static. r=smaug
This ensures that styles from UA widgets apply. Turns out they look
pretty much right without them, but there's a bug in nsDateTimeBoxFrame
where we rely on the styles in order for the baseline to be sensible.

Differential Revision: https://phabricator.services.mozilla.com/D91616
2020-09-28 18:29:28 +00:00
Emilio Cobos Álvarez
54b5a9f5f5 Bug 1659457 - Do clone xml-pretty-printer's UA widget. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D87714
2020-08-20 11:29:45 +00:00
Emilio Cobos Álvarez
4af1306128 Bug 1658469 - Don't clone UA widgets for printing. r=smaug
We run the widget initialization code regardless on bind, and some of it
doesn't deal with shadow roots being already populated.

Differential Revision: https://phabricator.services.mozilla.com/D86952
2020-08-14 16:27:49 +00:00
Simon Giesecke
1cd5c68592 Bug 1652002 - Remove some unnecessary includes from BindingUtils.h. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D83098
2020-07-15 15:34:49 +00:00
longsonr
875f5e88ac Bug 1259861 - Move everything else into the mozilla namespace in layout/svg r=dholbert
Also: adjust include paths to be consistent for usages of various SVG headers,
and remove unused SVG includes (mostly for "utils" classes),
and drop stray "ns" from already-renamed SVG classes in various code comments.

Differential Revision: https://phabricator.services.mozilla.com/D83140
2020-07-11 02:20:20 +00:00
Simon Giesecke
cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00