Commit Graph
14 Commits
Author SHA1 Message Date
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
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
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 d9e52c123e Bug 1998077 - part 2: Add WSType::EmptyInlineContainerElement r=m_kato
An empty inline container element such as `<span></span>` has 2
meanings, if it's visible with specified style, e.g., has non-zero
padding, it should be treated like a replaced element like `<img>`.
However, if it's invisible, it should be treated as `Comment` or
empty `Text`.  Therefore, the scanner users need a special handling for
them in some cases.  So, it should be identified with the new `WSType`.

Unfortunately, neither
`HTMLEditUtils::IsInclusiveAncestorCSSDisplayNone` nor
`HTMLEditUtils::IsVisibleElementEvenIfLeafNode` is testable within
GTest because it does not have layout information.

Differential Revision: https://phabricator.services.mozilla.com/D277519
2026-01-13 05:27:38 +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 4a5d93d631 Bug 1998077 - part 2: Add WSType::EmptyInlineContainerElement r=m_kato
An empty inline container element such as `<span></span>` has 2
meanings, if it's visible with specified style, e.g., has non-zero
padding, it should be treated like a replaced element like `<img>`.
However, if it's invisible, it should be treated as `Comment` or
empty `Text`.  Therefore, the scanner users need a special handling for
them in some cases.  So, it should be identified with the new `WSType`.

Unfortunately, neither
`HTMLEditUtils::IsInclusiveAncestorCSSDisplayNone` nor
`HTMLEditUtils::IsVisibleElementEvenIfLeafNode` is testable within
GTest because it does not have layout information.

Differential Revision: https://phabricator.services.mozilla.com/D277519
2026-01-07 01:12:43 +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 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
Masayuki Nakano 7d8e5d6bf4 Bug 1978485 - part 7: Make AutoInsertLineBreakHandler::InsertLinefeed use Scan(Previous|InclusiveNext)VisibleNodeOrBlockBoundaryFrom r=m_kato
It should not refer the start/end reason content.

Differential Revision: https://phabricator.services.mozilla.com/D258349
2025-07-30 02:54:19 +00:00
Masayuki Nakano 37de891c4b Bug 1974913 - part 4: Make AutoInsertParagraphHandler and AutoInsertLineBreakHandler use shared helper methods to make the handler body smaller r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D255727
2025-07-08 01:31:32 +00:00
Masayuki Nakano 3fd9c0773b Bug 1974913 - part 1: Make insertParagraph and insertLineBreak handlers be stack only classes r=m_kato
For allowing to create helper methods and share more data between
helper methods without adding a lot of arguments to each method,
they should be stack only class.

Differential Revision: https://phabricator.services.mozilla.com/D255724
2025-07-08 01:31:23 +00:00
Masayuki Nakano 4422352e4d Bug 1974913 - part 0: Copy HTMLEditSubActionHandler.cpp first r=m_kato
Git does not track file copies but Git may keep the per line history if
they detect a file copy.  So, this might help to Git the per line
history of insert paragraph command handler and insert line break
command handler.

Differential Revision: https://phabricator.services.mozilla.com/D255723
2025-07-08 01:31:20 +00:00