Commit Graph
104 Commits
Author SHA1 Message Date
Nishu Sheth 99a94b4894 Bug 1717071 - Allow copying URLs from iOS devices and pasting them into Firefox on MacOS, using Apple's "Universal Clipboard" feature r=mac-reviewers,masayuki,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D276492
2026-03-24 02:24:00 +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 50be9669c0 Bug 1977386 - Make HTMLEditor related code treat the cases that "\n" is not a preformatted line break but is not collapsible white-space r=m_kato
There is a case that "\n" is not a preformatted line break, but it's
rendered as a non-collapsible white-space.  Therefore, for checking
whether a "\n" is a collapsible white-space,
`EditorUtils::IsWhiteSpacePreformatted` should be used instead of
`EditorUtils::IsNewLinePreformatted`.

Differential Revision: https://phabricator.services.mozilla.com/D257458
2025-07-18 05:15:52 +00:00
Masayuki Nakano b67e405f29 Bug 1926483 - part 4: Make WSRunScanner::Scan(InclusiveNext|Previous)VisibleNodeOrBlockBoundary take WSRunScanner::Scan and ancestor limiter r=m_kato
Note that this removes a lot of `aEditingHost` params.  This may cause odd
behavior if editing host is changed by a legacy mutation event listener.
However, it'll be completely deleted soon and even if we meet some regressions,
we can just restore the param to set `aAncestorLimiter`.

Differential Revision: https://phabricator.services.mozilla.com/D233794
2025-01-24 05:00:48 +00:00
Butkovits Atila 173aee505b Backed out 5 changesets (bug 1926483) for causing failures at WSRunScanner.h. CLOSED TREE
Backed out changeset fa4c36cef1c5 (bug 1926483)
Backed out changeset 24bdcd7af3e0 (bug 1926483)
Backed out changeset 1df51ca968f8 (bug 1926483)
Backed out changeset 7aceecb585e4 (bug 1926483)
Backed out changeset 41b040b374a2 (bug 1926483)
2025-01-23 07:35:22 +02:00
Masayuki Nakano 8e2501c776 Bug 1926483 - part 4: Make WSRunScanner::Scan(InclusiveNext|Previous)VisibleNodeOrBlockBoundary take WSRunScanner::Scan and ancestor limiter r=m_kato
Note that this removes a lot of `aEditingHost` params.  This may cause odd
behavior if editing host is changed by a legacy mutation event listener.
However, it'll be completely deleted soon and even if we meet some regressions,
we can just restore the param to set `aAncestorLimiter`.

Differential Revision: https://phabricator.services.mozilla.com/D233794
2025-01-23 05:01:57 +00:00
Masayuki Nakano 292bfa0f37 Bug 1930564 - Make MoveNodeResult inherit EditActionResult r=m_kato
Currently `MoveNodeResult` inherits only `CaretPoint` and has some members which
are same as `EditActionResult`.  I'd like to add `DeleteRangeResult` which will
inherit both `CaretPoint` and `EditActionResult`.  So, for making it work with
`MoveNodeResult`, it's nicer to make `MoveNodeResult` inherits
`EditActionResult`.

Differential Revision: https://phabricator.services.mozilla.com/D228629
2024-11-14 00:56:52 +00:00
Jonathan Kew ba9032e630 Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-26 09:40:02 +00:00
Cristian Tuns b0886adb5c Backed out 4 changesets (bug 1758391, bug 1852478) for causing build bustages in UseCounterMetrics.cpp CLOSED TREE
Backed out changeset fe673f87d86a (bug 1852478)
Backed out changeset d466ccbd1aad (bug 1852478)
Backed out changeset c0fa98fec39a (bug 1758391)
Backed out changeset 04d322f23fd0 (bug 1852478)
2024-01-25 18:29:39 -05:00
Jonathan Kew 87225af2ba Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-25 22:20:05 +00:00
Narcis Beleuzu 756ec5ce4b Backed out 4 changesets (bug 1758391, bug 1852478) for failures on test_animation-type-longhand.html . CLOSED TREE
Backed out changeset d6a8b0b97282 (bug 1852478)
Backed out changeset fef9fcec3afc (bug 1852478)
Backed out changeset 01711557e2bf (bug 1758391)
Backed out changeset 8c8a01dbca12 (bug 1852478)
2024-01-22 16:37:15 +02:00
Jonathan Kew 63f8c995be Bug 1852478 - Convert CSS white-space into a shorthand that expands to white-space-collapse and text-wrap-mode longhands. r=firefox-style-system-reviewers,emilio
Note that although this builds, it would (by itself) result in some test breakage;
this is resolved in the following patches that build on this.

Differential Revision: https://phabricator.services.mozilla.com/D198790
2024-01-22 12:57:54 +00:00
Masayuki Nakano a9321b697e Bug 1864334 - Make nsIFrame::MovingCaretToEventPointAllowedIfSecondaryButtonEvent check whether the right click point is in a selection range first r=emilio
This is a simple mistake of the previous patch. The code path is originally for
a left click handling.  Therefore, there is no check whether the click point is
in a selection range because in that case, left click should collapse selection.
However, the selection should not be collapse when it's a right click in a
selection range because the context menu target is the selection range.

The `ui.mouse.right_click.collapse_selection.stop_if_non_collapsed_selection`
pref is set to `true` by default.  Therefore, the existence of a non-collapsed
selection has hidden this bug.  However, if it's set to `false`, this always
happens.  Additionally, editor does not set ancestor limiter of selection if the
root element is editable [1].  I think that we can now remove this special path,
but it's risky.  Therefore, this patch just adds the new check into the method.

1. https://searchfox.org/mozilla-central/rev/ce4599d3d4e20e34cb6db68f255c3dff1aec246b/editor/libeditor/EditorBase.cpp#5448,5450-5451

Differential Revision: https://phabricator.services.mozilla.com/D193529
2023-11-16 01:26:24 +00:00
Masayuki Nakano 689ebd31f7 Bug 1815639 - part 12: Make AutoDeleteRangesHandler::HandleDeleteHRElement() stop touching Selection r=m_kato
Depends on D169757

Differential Revision: https://phabricator.services.mozilla.com/D169758
2023-02-21 11:19:10 +00:00
Neil Deakin 21426e24f4 Bug 1776879, replace text/unicode for clipboard and drag and drop and use text/plain directly, r=edgar,mak,stransky,geckoview-reviewers,extension-reviewers,zombie,m_kato
Most usage is a straight replacement but gtk needs extra changes as it transfers plain text in UTF8 natively and needs to be converted into UTF16, and Windows uses single-byte characters for RTF and CF_HTML formats so we preserve this.

Differential Revision: https://phabricator.services.mozilla.com/D158587
2023-02-01 23:30:55 +00:00
Masayuki Nakano 292a13ec19 Bug 1792386 - part 1: Make HTMLEditor::SetInlinePropertiesAsSubAction extend and/or shrink range smarter r=m_kato
Blink's behavior is better than Gecko.  That is, when selected range crosses
an inline element boundary, Blink shrinks selected range to select only
children, but Gecko extends selected range to cover all inline parents around
the range.  E.g., when setting `abc[<i>def]</i>ghi` to `<b>`, Chrome changes it
to `abc<i><b>def</b></i>ghi`, but Gecko changes it to `abc<b><i>def</i></b>ghi`.
The Gecko's behavior is odd especially when `abc<i>[def]</i>ghi` since user
does not select the `<i>`, but Gecko wraps it in new `<b>`.

However, if the range contains an inline element entirely, e.g.,
`abc[<i>def</i>]ghi`, Chrome changes it to `abc<b><i>def</i></b>ghi` without
shrinking the range.  This is reasonable too.

On the other hand, there is a case that browsers need to extend the range.
That is an parent inline element has the style of what we're setting a range to.
E.g., `abc<span style="background-color: red"><b>[def]</b></span>ghi`, user
wants to update the style attribute of the `<span>` element rather than wrapping
the selected text node with new `<span>` element in the `<b>`.  Therefore,
if shrunken range starts from very beginning of a node or ends at very end of
a node and the inline parents have same style, we need extend the range to wrap
it.  (Note that Gecko deletes same styles in range with
`HTMLEditor::RemoveStyleInside`.  Therefore, wrapping most distant inline
element makes Gecko works as expected.)

Finally, if the containers of range boundaries are not same one, we should
extend the range to save the number of creating element.  E.g.,
`<span>[abc</span> <span>def]</span>` should become
`<b><span>abc</span> <span>def</span>` rather than
`<span><b>abc</b></span><b> </b><span><b>def</b></span>`.

Note that the new expected failures are caused by the difference of selection
range after applying the style.  That should be fixed by the following patch.

Depends on D164521

Differential Revision: https://phabricator.services.mozilla.com/D164522
2022-12-20 00:19:41 +00:00
Masayuki Nakano e1670faf93 Bug 1793694 - part 5: Move EditorUtils::MaskString to TextEditor r=m_kato
It's the only method which is used outside of the editor module.  Therefore,
we can stop exposing `EditorUtils.h` later.

Depends on D158634

Differential Revision: https://phabricator.services.mozilla.com/D158635
2022-10-12 02:44:19 +00:00
Masayuki Nakano 509b1295d4 Bug 1792654 - Make CreateNodeResultBase, MoveNodeResult, SplitNodeResult and SplitRangeOffResult handle caret point with a common base class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158335
2022-10-04 21:36:57 +00:00
Masayuki Nakano 767307c38d Bug 1791501 - Use EditActionResult as ok type of mozilla::Result r=m_kato
Any callers do not refer "ignored", "handled" and "cancel" state without
checking whether the method returns error or not.  Therefore, error state
can be (and should be) managed by `mozilla::Result`'s error state.

Perhaps, it should store a caret position later because deletion handlers
of `HTMLEditor` use it, but update `Selection` immediately.

Differential Revision: https://phabricator.services.mozilla.com/D158080
2022-09-28 07:21:37 +00:00
Masayuki Nakano f1a20cf34a Bug 1791223 - Use MoveNodeResult as the ok type of mozilla::Result r=m_kato
Unfortunately, it's hard to split this (and similar) patch because we need to
touch `MoveNodeResult` itself for making it available as the ok type of
`Result`.  However, I guess that it's not so hard to investigate regression
point if something would be found later because `MoveNodeResult` is mainly
used by deletion which is the most complicated part of `HTMLEditor`, but
`MoveNodeResult` is used only in a few cases.

Differential Revision: https://phabricator.services.mozilla.com/D157574
2022-09-26 00:56:46 +00:00
Masayuki Nakano bbb312974a Bug 1782911 - part 3: Make HTMLEditor always move first line of right block only when the blocks have different white-space style r=m_kato
Gecko just joins 2 blocks when editable block parents are same element, e.g.,
both are `<div>`.  However, Chrome and Safari moves only first line of the
right block into the left block, and Gecko does it when both blocks are
different elements.

Ideally, we should take same behavior as Chrome and Safari because it's
reasonable for both compatibility with the other browsers and consistency
when both blocks are different but has same style, then we don't need to
maintain different behavior paths.

However, doing it for all elements are too risky because right block will be
merged into left block if right block has no line break.  On the other hand,
without doing it, preserving `white-space` is really hard because we need to
maintain the both paths.

Therefore, I'd like to change the behavior only when both blocks have different
`white-space` styles.  Usually, web apps do not change `white-space` for each
block, so I think that this is safer than doing this in all elements,
additionally, we can revert the behavior easy since this patch is really small.

Differential Revision: https://phabricator.services.mozilla.com/D157412
2022-09-25 12:49:43 +00:00
Masayuki Nakano 830bd376e2 Bug 1783402 - part 3: Make result of unsafe getter methods of EditorDOMPointBase templated r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D153842
2022-08-09 01:43:24 +00:00
Masayuki Nakano 276855fa75 Bug 1775381 - Move AutoRangeArray from EditorUtils.h to its own header and cpp file r=m_kato
Depends on D152982

Differential Revision: https://phabricator.services.mozilla.com/D153063
2022-08-04 05:39:16 +00:00
Masayuki Nakano 57a26a77d2 Bug 1774704 - part 4-4: Make HTMLEditor::ChangeSelectedHardLinesToList stop setting TopLevelEditSubActionData::mNewBlockElement r=m_kato
With taking an `AutoRangeArray` which is initialized with `Selection`, it can
restore selection and check if it's collapsed and if collapsed in the expected
list element.  Then, its caller can apply the returned range to `Selection`
because it's an edit sub-action handler.

Differential Revision: https://phabricator.services.mozilla.com/D152969
2022-08-04 02:28:11 +00:00
Masayuki Nakano 6695e277a9 Bug 1774704 - part 4-1: Move HTMLEditor::GetParentListElementAtSelection into AutoRangeArray r=m_kato
It oddly retrieve an ancestor list element which contains one range in the
selection ranges.  So, working it with `AutoRangeArray` which is initialized
with `Selection` makes `HTMLEditor` smaller...

Differential Revision: https://phabricator.services.mozilla.com/D152966
2022-08-04 01:50:28 +00:00
Masayuki Nakano 71dde570e5 Bug 1770877 - part 25: Make HTMLEditor::FormatBlockContainerWithTransaction stop touching Selection directly r=m_kato
This patch makes it take `AutoRangeArray` and it can save a snapshot of the
ranges and restore it like `AutoSelectionRestorer`.

For accessing `HTMLEditor::RangeUpdaterRef` for clearing the saved ranges,
`AutoRangeArray` needs to store `HTMLEditor`.  Therefore, its constructors
and the destructor cannot be inlined in the header due to the include-hell.

Differential Revision: https://phabricator.services.mozilla.com/D149089
2022-06-21 05:58:45 +00:00
Masayuki Nakano fe2186dd7f Bug 1770877 - part 22: Move HTMLEditor::CollectEditTargetNodes into AutoRangeArray r=m_kato
And also this moves `HTMLEditor::CollectChildren` to `HTMLEditUtils`.

Differential Revision: https://phabricator.services.mozilla.com/D149086
2022-06-21 01:19:25 +00:00
Masayuki Nakano b788c06be9 Bug 1770877 - part 20: Move HTMLEditor::SplitTextNodesAtRangeEnd and HTMLEditor::SplitParentInlineElementsAtRangeEdges into AutoRangeArray r=m_kato
Although they update the DOM tree with transactions, but for making `HTMLEditor`
smaller, and the following patches makes the related code simpler, we need to
move them into `AutoRangeArray`.

Differential Revision: https://phabricator.services.mozilla.com/D149084
2022-06-20 23:45:02 +00:00
Masayuki Nakano 4f89f0e183 Bug 1770877 - part 15: Implement equivalent of HTMLEditor::GetSelectionRangesExtendedToHardLineStartAndEnd r=m_kato
It's always work with `Selection` ranges.  Then, it should be treated within
`AutoRangeArray` which can be initialized with `Selection` ranges automatically.
Then, we can making `HTMLEditor` simpler.

Note tha this tries to make it get editing host when the corresponding
public method is called (after dispatched `beforeinput` event if handling a
users' operation).  However, as commented in
`HTMLEditor::SetParagraphFormatAsAction`, it breaks a tricky crash test.
Therefore, only the format block path computes it after the preparation.

Differential Revision: https://phabricator.services.mozilla.com/D149079
2022-06-17 21:28:36 +00:00
Masayuki Nakano 1dc206c8bc Bug 1770877 - part 14: Make AutoRangeArray::CreateRangeWrappingStartAndEndLinesContainingBoundaries use a static method which sets existing nsRange instance r=m_kato
For making extending the range to wrap the lines containing start and end
boundaries of each range of `AutoRangeArray::mRanges`, we need a method which
updates existing `nsRange` instances rather than creating new one.

Differential Revision: https://phabricator.services.mozilla.com/D149078
2022-06-17 08:41:02 +00:00
Masayuki Nakano fbef891380 Bug 1770877 - part 13: Move HTMLEditor::CreateRangeExtendedToHardLineStartAndEnd into AutoRangeArray r=m_kato
This patch makes them take `const Element& aEditingHost` so that this patch
becomes bigger than what this patch does.

Differential Revision: https://phabricator.services.mozilla.com/D149077
2022-06-17 08:23:20 +00:00
Masayuki Nakano 48706b3a98 Bug 1770877 - part 11: Move HTMLEditor::GetCurrentHardLineStartPoint and HTMLEditor::GetCurrentHardLineEndPoint r=m_kato
Similar to the previous patch, you must feel odd to move the methods.  They
will be static methods in the `EditorUtils.cpp` file later.

Differential Revision: https://phabricator.services.mozilla.com/D149075
2022-06-17 07:33:56 +00:00
Masayuki Nakano 85bb52a638 Bug 1770877 - part 10: Move HTMLEditor::SelectBRElementIfCollapsedInEmptyBlock to AutoRangeArray r=m_kato
This must make you feel odd. However, this is a separate patch for making easier
to review the following patches.  This will be a private member of
`AutoRangeArray`.

Differential Revision: https://phabricator.services.mozilla.com/D149074
2022-06-17 05:43:02 +00:00
Masayuki Nakano 28cad0d918 Bug 1771809 - Make HTMLEditor::AutoDeleteRangesHandler::HandleDeleteNonCollapsedRanges check if handling range is still editable r=m_kato
In the testcase, editing host is removed when first node removing, but
`HTMLEditor::Destroyed()` still returns `false`.  So, ideally, we should add
a check of editing host validity in `Destroyed()`, but for now, we should make
the method check whether the handling range is still editable after running
each transaction.

Depends on D147723

Differential Revision: https://phabricator.services.mozilla.com/D147724
2022-06-01 05:52:15 +00:00
Masayuki Nakano 71411e3fb4 Bug 1771448 - part 4: Rename HTMLEditor::GetActiveEditingHost to ComputeEditingHost r=m_kato
It's currently computes the corresponding editing host from the focus node of
`Selection` with climbing up the DOM tree.  So, it does not just return a stored
element.  Therefore, some callers use it multiple times.  For avoiding it, we
should rename it to explain that it computes the editing host.

Note that I think that we should make it takes a node to compute editing host
without `Selection` for solving the case of no selection ranges.  Therefore,
I don't like to include more information into the name.

Differential Revision: https://phabricator.services.mozilla.com/D147504
2022-05-31 03:41:01 +00:00
Emilio Cobos Álvarez e48bb99524 Bug 1771564 - Constify ComputedStyle usage in nsComputedDOMStyle. r=dholbert
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.

Doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D147555
2022-05-28 01:04:24 +00:00
Masayuki Nakano bfaa50661a Bug 1766355 - part 2: Make MoveNodeResult method names alinging to Result r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D146398
2022-05-20 08:28:08 +00:00
Masayuki Nakano 3d3f447b52 Bug 1762115 - part 1: Make HTMLEditor::HandleInsertBRElement stop touching Selection directly r=m_kato
The strategy of this patch and most following patches is, returning candidate
caret position with `CreateNodeResultBase`, and make each caller choose whether
it updates `Selection` immediately, put it off until exiting from a loop, or
just ignore.

This patch makes `HTMLEditor::HandleInsertBRElement` return
`CreateElementResult` and makes its callers handle selection as same as the
method does.

And note that I've not realized that `NS_FAILED` and `NS_SUCCEEDED` include
`MOZ_(UN)LIKELY`.  Therefore, they don't need to be wrapped with them.  And
also `NS_WARN_IF` has it too (but it's not in opt build, see bug 1765909).
On the other hand, neither `Result::isErr` nor `Result::isOk` has them
(bug 1765916).  Therefore, except in the case of `Result`, this and following
patches will remove unnecessary `MOZ_(UN)LIKELY` from editor.

Differential Revision: https://phabricator.services.mozilla.com/D144644
2022-05-02 22:48:23 +00:00
Masayuki Nakano 54bb966fad Bug 1765018 - part 7: Make some methods which return an instance (not reference) of EditorDOMPointBase be template methods r=m_kato
For avoiding to use `To<EditorDOMPoint>()` etc from temporary object, such
methods should be templated.

Differential Revision: https://phabricator.services.mozilla.com/D143884
2022-04-20 23:58:04 +00:00
Masayuki Nakano 90a36f5bcc Bug 1765018 - part 3: Make EditorBase::FindBetterInsertionPoint be a template method r=m_kato
To avoid the unnecessary conversion between `EditorDOMPoint` and
`EditorRawDOMPoint`, it should be a template method which can take/return either
`EditorDOMPoint` or `EditorRawDOMPoint`.

Differential Revision: https://phabricator.services.mozilla.com/D143880
2022-04-20 23:41:28 +00:00
Masayuki Nakano cd80bdce17 Bug 1765018 - part 1: Get rid of implicit conversion between EditorDOMPointBase instances r=m_kato
The implicit copy constructors and `operator=` makes it harder to realize
that implicit conversion wastes the runtime cost.  Therefore, this patch
replaces them with a template method to convert the `EditorDOMPointBase` type.

Differential Revision: https://phabricator.services.mozilla.com/D143878
2022-04-20 22:41:02 +00:00
Masayuki Nakano daf79ccd1e Bug 1735446 - part 4: Make Selection::GetRangeAt() take uint32_t instead of int32_t r=smaug
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
2021-12-09 07:35:09 +00:00
Masayuki Nakano ba7e54426e Bug 1734507 - Make TextEditor guarantee that ranges to delete are in the text node r=saschanaz
Our internal code can touch internal `Selection` object of `<input>` and
`<textarea>`, thus, selection ranges in them may be not in the text node.
Therefore, we should make `TextEditor` instance try to shrink the deleting
ranges into the text node first.

In a followup bug (perhaps, bug 1734846), we should split the deletion code into
`TextEditor` and `HTMLEditor` for making the code simpler and never regressed.

Differential Revision: https://phabricator.services.mozilla.com/D133181
2021-12-08 21:37:22 +00:00
Masayuki Nakano 542deb379a Bug 1739526 - Move some trivial classes defined in EditorUtils.h but used only by HTMEditor or its helper classes to `HTMLEditHelpers.h" r=m_kato
I'd like to split utilities for all editors and only for `HTMLEditor`.

This moves some trivial classes into new `HTMLEditHelpers.h`.  Perhaps, it's
better if we can move them into `HTMLEditUtils.h`, but it has too many inline
method definitions so that adding new classes into it makes it much bigger.

Depends on D130349

Differential Revision: https://phabricator.services.mozilla.com/D130425
2021-11-05 14:10:49 +00:00
Masayuki Nakano 685412cb0a Bug 1734771 - part 3: Make AppendString() and AppendSubString() take const Text& instead of Text* r=m_kato
Depends on D128139

Differential Revision: https://phabricator.services.mozilla.com/D128140
2021-10-12 15:02:38 +00:00
Masayuki Nakano f52e6f2a32 Bug 1724650 - part 3: Make GetEndOfCollapsibleASCIIWhiteSpaces and GetFirstASCIIWhiteSpacePointCollapsedTo treat preformatted linefeed characters correctly r=m_kato
If `white-space` is `pre-line`, only linefeed characters are preformatted, but
white-spaces are collapsible.  And if collapsible white-spaces follow or
are followed by a preformatted linefeed, they are removed.  Therefore,
these methods need to scan following or preceding white-spaces of first
linefeed if the caller wants to delete.  Unless doing it, the removed
white-spaces would become visible due to no linefeed character containing
sequence.

Differential Revision: https://phabricator.services.mozilla.com/D124557
2021-09-10 04:04:28 +00:00
Masayuki Nakano 27991feb1f Bug 1727844 - part 4: Add API to check whether a char is collapsible or not r=m_kato
This patch adds `EditorUtils::IsNewLinePreformatted()` to check whether a
linefeed character is collapsible or not.

Then, a lot of users of `EditorDOMPointBase::Is*CharASCIISpace()` and
`EditorDOMPointBase::Is*CharASCIISpaceOrNBSP()` should check whether the
white-space at the point is collapsible or not.  Therefore, this patch adds
`Is*CharCollapsibleASCIISpace()` and `Is*CharCollapsibleASCIISpaceOrNBSP()`
too.

Then, makes such callers use the new API instead.

Differential Revision: https://phabricator.services.mozilla.com/D123871
2021-08-31 17:37:41 +00:00
Masayuki Nakano 0eae59bebd Bug 1727844 - part 3: Rename EditorUtils::IsContentPreformatted() to IsWhiteSpacePreformatted() r=m_kato
The method returns false even if linefeed characters are preformatted.
So, it should be renamed to explain what it does clearer.

And this renames `TextFragmentData::mIsPreformatted` and its accessors too.

Differential Revision: https://phabricator.services.mozilla.com/D123870
2021-08-31 17:37:41 +00:00
Emilio Cobos Álvarez 6c9d03dd32 Bug 1723921 - Cleanup nsComputedDOMStyle and related APIs. r=layout-reviewers,jfkthame
This will make implementing the new behavior behind a pref
really straight-forward, and is generally nicer.

Depends on D121858

Differential Revision: https://phabricator.services.mozilla.com/D121705
2021-08-07 09:47:15 +00:00
Masayuki Nakano 780fbf11f8 Bug 1714914 - Make editor classes treat offset in parent node as uint32_t r=m_kato
It should be treated as `uint32_t` since DOM API does so.  However, there are
some exceptions:

* Result of `nsINode::ComputeIndexOf()`
* Result of `nsAString` methods

They return `-1` as not found, and anyway, they cannot treat large integer
than `INT32_MAX`.  Therefore, this patch does not touch around them.

Differential Revision: https://phabricator.services.mozilla.com/D118933
2021-06-30 07:07:28 +00:00