Commit Graph
721 Commits
Author SHA1 Message Date
Leo Tenenbaum 404ff20a36 Bug 2040958 - Composed text input for EditContext. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D304908
2026-06-11 13:48:04 +00:00
Sandor Molnar cf650a4d4d Revert "Bug 2040958 - Composed text input for EditContext. r=masayuki" for causing build bustages @ EditContext.cpp
This reverts commit 96dc5eded0.
2026-06-11 13:17:11 +00:00
Leo Tenenbaum 96dc5eded0 Bug 2040958 - Composed text input for EditContext. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D304908
2026-06-11 13:02:35 +00:00
Leo Tenenbaum c1581027a1 Bug 2040956 - Implement EditContext text deletion. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D302361
2026-06-02 14:16:23 +00:00
Leo Tenenbaum 6fd98b6963 Bug 2039944 - EditContext non-composed text insertion. r=masayuki,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D300797
2026-05-20 20:15:19 +00:00
agoloman 38b46ea44d Revert "Bug 2039944 - EditContext non-composed text insertion. r=masayuki,webidl,smaug" for causing build bustages @HTMLEditSubActionHandler.cpp.
This reverts commit bb35dbdb26.
2026-05-20 17:32:07 +00:00
Leo Tenenbaum bb35dbdb26 Bug 2039944 - EditContext non-composed text insertion. r=masayuki,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D300797
2026-05-20 17:03:15 +00:00
serge-sans-paille 62627e28fd Bug 2027651 - Enforce evaluation order of arguments to prevent invalid std::move r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D290808
2026-03-31 07:07:37 +00:00
Sylvestre Ledru 9f5cc05eee Bug 2023419 - Remove Emacs/Vim modelines from editor/ r=masayuki
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287844
2026-03-16 12:52:41 +00:00
Norisz Fay a86d829321 Revert "Bug 2012637 - part 9: Add a Firefox Source Docs documentation page for TreeKind and notable issues r=smaug,dom-core" as requested by dev
This reverts commit 88008cd8ca.

Revert "Bug 2012637 - part 8: Make `nsContentUtils::ComparePoints` handle `TreeKind::Flat` and `TreeKind::FlatForSelection` correctly r=smaug,dom-core"

This reverts commit 73e6f6587b.

Revert "Bug 2012637 - part 7: Make `RangeUtils::CompareNodeToRangeBoundaries()` use `nsContentUtils::ComparePoints` with valid point in the tree r=smaug"

This reverts commit 6985d5e80f.

Revert "Bug 2012637 - part 6: Make `nsRange::CutContents()` convert the range boundaries to the ones in the DOM before comparing r=smaug"

This reverts commit 73b585af3d.

Revert "Bug 2012637 - part 5: Delete the default template parameter of `nsContentUtils::ComparePoints` and relatives r=smaug,dom-core"

This reverts commit 1a7f24e5b5.

Revert "Bug 2012637 - part 4: Make `nsContentUtils` use `nsIContent` for taking a child node as a parameter r=smaug"

This reverts commit a6ea8d6824.

Revert "Bug 2012637 - part 3: Add template `nsINode` API which can switch to call API from `TreeKind` r=smaug,dom-core,webidl"

This reverts commit a4211e9df0.

Revert "Bug 2012637 - part 2: Add `TreeKind::FlatForSelection` and change the template parameter of `ChildIteratorBase` to `TreeKind` r=smaug,dom-core"

This reverts commit 0241749ee7.

Revert "Bug 2012637 - part 1: Make `ChildIterBase` template class to re-implement `FlattenedChildIterator` for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio"

This reverts commit 9e71cb77fb.
2026-03-13 02:52:45 +00:00
Masayuki Nakano 1a7f24e5b5 Bug 2012637 - part 5: Delete the default template parameter of nsContentUtils::ComparePoints and relatives r=smaug,dom-core
They accept any kind of points even if it does not match with the
template parameter's `TreeKind` because the caller wants to check the
relation in different kind of tree.  Therefore, any callers need to
consider the `TreeKind` more carefully and clarify the `TreeKind` makes
developers easier to find a bug.

Differential Revision: https://phabricator.services.mozilla.com/D281308
2026-03-12 03:01:54 +00:00
Masayuki Nakano 2d3ea834cd Bug 2021180 - Make HTMLEditor not delete unnecessary preformatted linefeed when inserting content before it r=m_kato
Although for making the further processing simpler and faster, we always
delete the following invisible things when modifying the preceding
content. However, `www.icloud.com/notes` users the invisible
preformatted linefeed as anchor for the post-processing of inserting
text. Therefore, this patch makes the inserting content handlers stop
deleting preformatted linefeed. However, for minimizing the risk, this
does not make them stop deleting unnecessary `<br>` elements.

Note that different from padding `<br>` element, the invisible
preformatted linefeed appears as a line break in the flattened text
content for IME. Therefore, preserving the linefeed makes IME not
receive unexpected deletion of a line break. It might be better for IME.

Interestingly, the other browsers delete padding linefeed if it's a
padding for current empty block. It seems that they do it before
inserting content. However, this patch does not do that. Perhaps, we
should write a method to prepare to insert content and share it wider
in a follow up bug (bug 2021218).

Differential Revision: https://phabricator.services.mozilla.com/D286202
2026-03-08 23:32:29 +00:00
Masayuki Nakano 6d8a5fa56a Bug 2019689 - Make the insertText handler of HTMLEditor remove unnecessary line break first r=m_kato
X (Twitter) expects that when the user typing text, the last mutation is
a character data change or a `Text` node addition. However, it's
removing a padding `<br>` on Gecko. Therefore, they fail to handle it
if user inputs a Unicode character when the editor is empty.

Although it's a bug of X, but they don't maintain actively. Therefore,
we cannot hope they will fix bug 2012342 so that we need to fix this
with changing the handling order.

Differential Revision: https://phabricator.services.mozilla.com/D285465
2026-03-06 13:24:39 +00:00
Masayuki Nakano cb42ef186c Bug 1996500 - part 4: Make the other parts of HTMLEditor use the new APIs r=m_kato
This simplifies a lot position about inserting new padding line break
for the last empty line and each behavior is improved by the new API.

Differential Revision: https://phabricator.services.mozilla.com/D284965
2026-03-04 06:59:55 +00:00
Masayuki Nakano d670a975c9 Bug 1996500 - part 1: Make HTMLEditUtils have APIs for handling unnecessary line breaks r=m_kato
Perhaps, we should stop using "visible" from the API names because
some API users use the methods while modifying the DOM.  Therefore, the
new APIs explain the position of a line break or whether it's
significant or unnecessary from the layout point of view.

This patch adds API to check a line break position which may return
following/preceding block boundary's element and to scan following
block boundary with ignoring unnecessary line break which is done in
some places with calling
`WSRunScanner::ScanInclusiveNextVisibleNodeOrBlockBoundary()` twice.

Additionally, making the extant internal API mainly `HTMLEditUtils`
use the new API to do the correct handling.

Note that this makes `HTMLEditUtils::GetLeafNodeType` return `Ignore`
if the caller does not want invisible things and the node is in
`display:none` element.  This change is required to keep passing some
tests whose editing host is `display:inline` and it's followed by
invisible text like `<script>`.

Differential Revision: https://phabricator.services.mozilla.com/D284962
2026-03-04 06:59:46 +00:00
Masayuki Nakano 71f6752f79 Bug 1982458 - part 1: Clean up the trackers r=m_kato
The `AutoTrackDOMPoint` constructor which takes `nsCOMPtr<nsINode>&` and
`uint32_t` is not used anymore. Thus, we can get rid of the mode.

And `FlushAndStopTracking()` should be replaced with
`Flush(StopTracking::Yes)` and align the relatives to use the same
API style.

Differential Revision: https://phabricator.services.mozilla.com/D283634
2026-02-19 13:43:33 +00:00
Masayuki Nakano 4fa12d7518 Bug 2009323 - part 1: Make RangeBoundaryBase have some factory methods which take only a child node r=jjaschke,dom-core
`RangeBoundaryBase` allows to be initialized with invalid data for
allowing the users to use it as a validator.  However, this is bad,
and now it supports 2 tree kinds.  So, the users need to be familiar
with the relation of a child node and its parent and its offset when
they use `TreeKind::Flat`.  For making it easier to use, this patch
adds some new factory methods which automatically computes proper
parent/offset for a node with the `TreeKind`.

Differential Revision: https://phabricator.services.mozilla.com/D279306
2026-01-25 23:20:51 +00:00
agoloman 83e701e107 Revert "Bug 2009323 - part 2: Make RangeBoundaryBase disallow invalid DOM point at creation when pointing to a child node r=jjaschke,dom-core" for causing conflicts when backing out Bug 2009323.
This reverts commit 5728aae19d.

Revert "Bug 2009323 - part 1: Make `RangeBoundaryBase` have some factory methods which take only a child node r=jjaschke,dom-core"

This reverts commit 41c5bea4d5.
2026-01-23 14:51:12 +00:00
Masayuki Nakano 41c5bea4d5 Bug 2009323 - part 1: Make RangeBoundaryBase have some factory methods which take only a child node r=jjaschke,dom-core
`RangeBoundaryBase` allows to be initialized with invalid data for
allowing the users to use it as a validator.  However, this is bad,
and now it supports 2 tree kinds.  So, the users need to be familiar
with the relation of a child node and its parent and its offset when
they use `TreeKind::Flat`.  For making it easier to use, this patch
adds some new factory methods which automatically computes proper
parent/offset for a node with the `TreeKind`.

Differential Revision: https://phabricator.services.mozilla.com/D279306
2026-01-23 05:14:49 +00:00
Masayuki Nakano 91fa81075a Bug 1998077 - part 7: Reimplement HTMLEditUtils::GetInclusiveDeepestFirstChildWhichHasOneChild with LeafNodeOptions r=m_kato
Similarly, we can implement it with `LeafNodeOptions` to ignore
unnecessary nodes.  Then, we can get rid of `WalkTreeOption` and
`WalkTreeOptions` completely.

Differential Revision: https://phabricator.services.mozilla.com/D277524
2026-01-13 05:27:53 +00:00
Masayuki Nakano 80e02f4320 Bug 1998077 - part 6: Reimplement HTMLEditUtils::Get(First|Last)Child() and HTMLEditUtils::Get(Next|Previous)Sibling() with LeafNodeOptions r=m_kato
`WalkTreeOptions` is similar to `LeafNodeOptions` and it's hard to
maintain both of them.  Additionally, `LeafNodeOptions` can specify
which type of leaf nodes should be ignored at scanning.  Therefore,
`LeafNodeOptions` can be used for them.

Differential Revision: https://phabricator.services.mozilla.com/D277523
2026-01-13 05:27:50 +00:00
Masayuki Nakano b289a47a35 Bug 1998077 - part 5: Replace the remaining HTMLEditUtils::Get(Next|Previous)Content() with new ones based on Get(Next|Previous)LeafNodeOr(Next|Previous)BlockElement() r=m_kato
`HTMLEditUtils::GetNextContent()` and
`HTMLEditUtils::GetPreviousContent()` are wrappers of
`HTMLEditUtils::GetAdjacentContent()` and
`HTMLEditUtils::GetAdjacentLeafContent()`.  The behavior is similar to
`HTMLEditUtils::GetNextLeafContentOrNextBlockElement()` or
`HTMLEditUtils::GetPreviousLeafContentOrPreviousBlockElement()` but
they won't stop at block inclusive ancestor or a block sibling of an
inclusive ancestor.  Therefore, we can get rid of them and use the new
and better implementation.

Differential Revision: https://phabricator.services.mozilla.com/D277522
2026-01-13 05:27:47 +00:00
Masayuki Nakano 7060a5965e Bug 1998077 - part 4: Replace some callers of HTMLEditUtils::Get(Next|Previous)Content() with HTMLEditUtils::Get(Next|Previous)LeafContentOr(Next|Previous)BlockElement() r=m_kato
`HTMLEditUtils::Get(Next|Previous)Content()` returns a next/previous
leaf content or next/previous block element if
`WalkTreeOption::StopAtBlockBoundary` is specified.  That's the same
as `HTMLEditUtils::Get(Next|Previous)LeafContentOr(Next|Previous)BlockElement()`.

Differential Revision: https://phabricator.services.mozilla.com/D277521
2026-01-13 05:27:44 +00:00
Masayuki Nakano 1afcba4cc6 Bug 1998077 - part 3: Add new options to ignore empty/invisible leaf nodes r=m_kato
This adds some options which ignore some types of inline elements.

For example, `IgnoreAnyEmptyInlineContainers` is useful to scan previous
or next editable point because Chrome ignores empty inline elements when
deleting from next to an inline element.

`IgnoreInvisibleInlineVoidElements` is useful to scan invisible line
break from end of a block or checking a line break is invisible because
visible inline element makes a line after the last line break. E.g.,
```html
<div>ABC<br><span></span></div>
```
This shows only one line. However,
```html
<div>ABC<br><span style="border:1px solid"></span></div>
```
This shows 2 lines in the `<div>`.

Additionally, renaming the existing `LeafNodeType` values for making
them easier to understand.

Differential Revision: https://phabricator.services.mozilla.com/D277520
2026-01-13 05:27:41 +00:00
Sandor Molnar b77ea8700f Revert "Bug 1998077 - part 7: Reimplement HTMLEditUtils::GetInclusiveDeepestFirstChildWhichHasOneChild with LeafNodeOptions r=m_kato" for causing build bustages @ WSRunScanner.cpp
This reverts commit 5ccf392dce.

Revert "Bug 1998077 - part 6: Reimplement `HTMLEditUtils::Get(First|Last)Child()` and `HTMLEditUtils::Get(Next|Previous)Sibling()` with `LeafNodeOptions` r=m_kato"

This reverts commit 12eb928cb5.

Revert "Bug 1998077 - part 5: Replace the remaining `HTMLEditUtils::Get(Next|Previous)Content()` with new ones based on `Get(Next|Previous)LeafNodeOr(Next|Previous)BlockElement()` r=m_kato"

This reverts commit 58b4243d10.

Revert "Bug 1998077 - part 4: Replace some callers of `HTMLEditUtils::Get(Next|Previous)Content()` with `HTMLEditUtils::Get(Next|Previous)LeafContentOr(Next|Previous)BlockElement()` r=m_kato"

This reverts commit dd46967eb4.

Revert "Bug 1998077 - part 3: Add new options to ignore empty/invisible leaf nodes r=m_kato"

This reverts commit ca50a4a628.

Revert "Bug 1998077 - part 2: Add `WSType::EmptyInlineContainerElement` r=m_kato"

This reverts commit 4a5d93d631.

Revert "Bug 1998077 - part 1: Make `HTMLEditUtils::IsVisibleElementEvenIfLeafNode` work better if primary frame is available r=m_kato"

This reverts commit b42dc9d35f.
2026-01-07 06:15:59 +00:00
Masayuki Nakano 5ccf392dce Bug 1998077 - part 7: Reimplement HTMLEditUtils::GetInclusiveDeepestFirstChildWhichHasOneChild with LeafNodeOptions r=m_kato
Similarly, we can implement it with `LeafNodeOptions` to ignore
unnecessary nodes.  Then, we can get rid of `WalkTreeOption` and
`WalkTreeOptions` completely.

Differential Revision: https://phabricator.services.mozilla.com/D277524
2026-01-07 01:12:57 +00:00
Masayuki Nakano 12eb928cb5 Bug 1998077 - part 6: Reimplement HTMLEditUtils::Get(First|Last)Child() and HTMLEditUtils::Get(Next|Previous)Sibling() with LeafNodeOptions r=m_kato
`WalkTreeOptions` is similar to `LeafNodeOptions` and it's hard to
maintain both of them.  Additionally, `LeafNodeOptions` can specify
which type of leaf nodes should be ignored at scanning.  Therefore,
`LeafNodeOptions` can be used for them.

Differential Revision: https://phabricator.services.mozilla.com/D277523
2026-01-07 01:12:54 +00:00
Masayuki Nakano 58b4243d10 Bug 1998077 - part 5: Replace the remaining HTMLEditUtils::Get(Next|Previous)Content() with new ones based on Get(Next|Previous)LeafNodeOr(Next|Previous)BlockElement() r=m_kato
`HTMLEditUtils::GetNextContent()` and
`HTMLEditUtils::GetPreviousContent()` are wrappers of
`HTMLEditUtils::GetAdjacentContent()` and
`HTMLEditUtils::GetAdjacentLeafContent()`.  The behavior is similar to
`HTMLEditUtils::GetNextLeafContentOrNextBlockElement()` or
`HTMLEditUtils::GetPreviousLeafContentOrPreviousBlockElement()` but
they won't stop at block inclusive ancestor or a block sibling of an
inclusive ancestor.  Therefore, we can get rid of them and use the new
and better implementation.

Differential Revision: https://phabricator.services.mozilla.com/D277522
2026-01-07 01:12:52 +00:00
Masayuki Nakano dd46967eb4 Bug 1998077 - part 4: Replace some callers of HTMLEditUtils::Get(Next|Previous)Content() with HTMLEditUtils::Get(Next|Previous)LeafContentOr(Next|Previous)BlockElement() r=m_kato
`HTMLEditUtils::Get(Next|Previous)Content()` returns a next/previous
leaf content or next/previous block element if
`WalkTreeOption::StopAtBlockBoundary` is specified.  That's the same
as `HTMLEditUtils::Get(Next|Previous)LeafContentOr(Next|Previous)BlockElement()`.

Differential Revision: https://phabricator.services.mozilla.com/D277521
2026-01-07 01:12:49 +00:00
Masayuki Nakano ca50a4a628 Bug 1998077 - part 3: Add new options to ignore empty/invisible leaf nodes r=m_kato
This adds some options which ignore some types of inline elements.

For example, `IgnoreAnyEmptyInlineContainers` is useful to scan previous
or next editable point because Chrome ignores empty inline elements when
deleting from next to an inline element.

`IgnoreInvisibleInlineVoidElements` is useful to scan invisible line
break from end of a block or checking a line break is invisible because
visible inline element makes a line after the last line break. E.g.,
```html
<div>ABC<br><span></span></div>
```
This shows only one line. However,
```html
<div>ABC<br><span style="border:1px solid"></span></div>
```
This shows 2 lines in the `<div>`.

Additionally, renaming the existing `LeafNodeType` values for making
them easier to understand.

Differential Revision: https://phabricator.services.mozilla.com/D277520
2026-01-07 01:12:46 +00:00
Masayuki Nakano bd3adf2837 Bug 2003973 - Make HTMLEditor check whether selection is in a replaced or a void element stricter r=m_kato
Currently, we do something special only for `<select>`, `<option>`
and `<optgroup>`.  However, we should treat replaced elements and
void elements more consistently.

This patch adds new `HTMLEditUtils` methods to check them easier and
stricter and get the root node of them because DOM API can make invalid
tree even in a void element.

Then, we should handle insertions before the replaced or the void
element if selection range is collapsed in it. However, deletion should
not be handled for that if the range is completely in such element.
Additionally, if range boundary is in such element, we should adjust
the range not to include such element since it's not fully selected
so that shouldn't be deleted nor replaced.  These rules are basically
compatible with Chrome.

Finally, if such element is completely hidden, such elements should be
deleted silently with deleting surrounding content if collapsed next to
one.  However, this does not work well with a `Backspace` key press even
after applying this patch.

Finally, some tests of `editing-around-select-element.tentative.html`
start failing.  The reason is, this patch makes the surrounding block
boundary of `<select>` with adjusting the selection range and that makes
`<select>` moved into another parent.  At this time, the `<select>`
gets `style="white-space: nowrap"`.  I'm not sure where did this but
not a critical failures.  Therefore, this patch contains this
regression.

Differential Revision: https://phabricator.services.mozilla.com/D275170
2025-12-12 07:08:20 +00:00
Masayuki Nakano 71a528f921 Bug 1998288 - Make HTMLWithContextInserter::InsertContents stop touching Selection r=m_kato
The method touches `Selection` in its `for` loops and that appear in
the reported profile in bug 1997834.  Therefore, it should stop touching
the `Selection`, and its only caller should update `Selection` instead.

Additionally, this rewrites entire the method to make it simpler and
not use variables in the wide scopes.  That makes it easier to
understand.  However, except in some edge cases, this does not change
the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D271362
2025-11-15 00:30:29 +00:00
Masayuki Nakano 6983335537 Bug 1996501 - part 2: Make WSRunScanner take an EnumSet instead of a set of Scan and BlockInlineCheck r=m_kato
It's not required explicitly to specify
`BlockInlineCheck::UseComputedDisplayStyle` and
`BlockInlineCheck::UseComputedDisplayOutsideStyle` to `WSRunScanner`
too.  And it should take an `EnumSet` for making it easier to maintain
the class in the future.

Differential Revision: https://phabricator.services.mozilla.com/D270117
2025-10-31 05:05:10 +00:00
serge-sans-paille 7662b3abdc Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 19:36:01 +00:00
Cristina Horotan 8a1b1970b7 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing Gtest failures on AlreadyAddRefed.h
This reverts commit e98adca292.
2025-10-21 16:16:29 +00:00
serge-sans-paille e98adca292 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 15:05:17 +00:00
Cristina Horotan aab924e90d Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing build bustage at nsBrowserApp.cpp
This reverts commit fd0ffa193c.
2025-10-21 10:44:13 +00:00
serge-sans-paille fd0ffa193c Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 09:44:11 +00:00
Narcis Beleuzu e1e6bbb1c9 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing bustages on Document.cpp
This reverts commit b23c15e927.
2025-10-21 06:34:58 +00:00
serge-sans-paille b23c15e927 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 06:01:36 +00:00
Masayuki Nakano 5c667a6c58 Bug 1752093 - Make HTMLEditUtils::Is*() take const nsIContent& as far as possible r=m_kato
In the historical reason, some of them still take `nsINode*`.  In these
days, converting from `nsINode` to `nsIContent` or `Element` is faster
than before and most callers already use `nsIContent`.  Therefore, we
should make them take `const nsIContent&`.

Only some methods, allowing callers use pointer makes them simpler.
Therefore, only some methods have overloads which take
`const nsIContent*` instead.

Differential Revision: https://phabricator.services.mozilla.com/D265525
2025-09-30 01:31:25 +00:00
Cristina Horotan 8bdbf9625e Revert "Bug 1752093 - Make HTMLEditUtils::Is*() take const nsIContent& as far as possible r=m_kato" for causing assertion in nsINode.h
This reverts commit d7a3d6e49b.
2025-09-26 06:41:47 +00:00
Masayuki Nakano d7a3d6e49b Bug 1752093 - Make HTMLEditUtils::Is*() take const nsIContent& as far as possible r=m_kato
In the historical reason, some of them still take `nsINode*`.  In these
days, converting from `nsINode` to `nsIContent` or `Element` is faster
than before and most callers already use `nsIContent`.  Therefore, we
should make them take `const nsIContent&`.

Only some methods, allowing callers use pointer makes them simpler.
Therefore, only some methods have overloads which take
`const nsIContent*` instead.

Differential Revision: https://phabricator.services.mozilla.com/D265525
2025-09-26 01:07:57 +00:00
Masayuki Nakano a27e993972 Bug 769207 - part 13: Get rid of MutationEvent r=smaug,dom-core,webidl
Differential Revision: https://phabricator.services.mozilla.com/D263064
2025-09-08 00:28:20 +00:00
Masayuki Nakano 2e2cb7cb9a Bug 769207 - part 12: Get rid of DOMNodeRemoved event r=smaug,dom-core,devtools-reviewers,toolkit-telemetry-reviewers,janerik,bomsy
Unfortunately, we need to keep dispatching `devtoolschildremoved` event
to the DevTools.  Therefore, this patch renames the `DOMNodeRemoved`
event dispatcher and related methods.

Differential Revision: https://phabricator.services.mozilla.com/D263063
2025-09-08 00:28:16 +00:00
Masayuki Nakano a170eeb9ec Bug 769207 - part 11: Get rid of DOMSubtreeModified event r=smaug,dom-core,devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D263062
2025-09-08 00:28:12 +00:00
Masayuki Nakano 98cdc0abc0 Bug 769207 - part 10: Get rid of DOMNodeInsertedIntoDocument and DOMNodeRemovedFromDocument events r=smaug,dom-core,devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D263061
2025-09-08 00:28:08 +00:00
Masayuki Nakano 8df2318860 Bug 769207 - part 7: Get rid of DOMCharacterDataModified event r=smaug,dom-core,devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D263058
2025-09-08 00:27:56 +00:00
Masayuki Nakano 60b1fae7d8 Bug 1973655 - part 2: Make HTMLEditorMutationObserver.cpp r=m_kato
This also renames `OnDocumentModified()` to
`RunOrScheduleOnModifyDocument()` because the name is usually confused
with `OnModifyDocument().

Differential Revision: https://phabricator.services.mozilla.com/D260588
2025-08-22 10:58:39 +00:00
Cristina Horotan 377e3caa70 Revert "Bug 1973655 - part 3: Add logging code of mutation via HTMLEditor r=m_kato,smaug,dom-core" for causing buuld bustages on HTMLEditorMutationObserver.cpp
This reverts commit 73d1ab198c.

Revert "Bug 1973655 - part 2: Make `HTMLEditorMutationObserver.cpp` r=m_kato"

This reverts commit 8603a23c33.

Revert "Bug 1973655 - part 1: Make the editor module not call DOM API to modify the DOM directly r=m_kato"

This reverts commit a8abe8d84c.
2025-08-22 08:01:45 +00:00