Commit Graph

9980 Commits

Author SHA1 Message Date
Masayuki Nakano
ec9ecbc50f Bug 1647556 - part 3-3: Implement the other complicated case of GetInvisibleLeadingWhiteSpaceRange() r=m_kato
Different from `GetInvisibleTrailingWhiteSpaceRange()`, it always returns
the range even if it's collapsed (i.e., there is no leading white-space).

Differential Revision: https://phabricator.services.mozilla.com/D82274
2020-07-07 09:21:27 +00:00
Masayuki Nakano
abb2c132b1 Bug 1647556 - part 3-2: Implement complicated case of GetInvisibleTrailingWhiteSpaceRange() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82273
2020-07-07 07:39:20 +00:00
Masayuki Nakano
0ed0d74c18 Bug 1647556 - part 3-1: Add API to WSRunScanner::TextFragmentData to get range of invisible leading or trailing white-spaces r=m_kato
One of the `WSFragment`users' purpose is, they remove invisible white-spaces
when there are.  So, `TextFragmentData` should have API to retrieve the
ranges and use them for initializing `WSFragment` which represents leading
or trailing white-spaces.  For making this patch smaller as far as possible,
these APIs implements only the case when there is no NBSP.

For result of the new API, this creates a template class, `EditorDOMRangeBase`,
whose boundary type is `EditorDOMPointBase`.  Its methods are named from
`nsRange`'s same methods.

Differential Revision: https://phabricator.services.mozilla.com/D82272
2020-07-07 05:31:34 +00:00
Masayuki Nakano
3d01ff0123 Bug 1647556 - part 2: Create WSRunScanner::TextFragmentData class for the alternative of WSFragments r=m_kato
This patch just creates new stack only class and make it initializes
`WSRunScanner::mFragments` instead of `WSRunScanner`.

Differential Revision: https://phabricator.services.mozilla.com/D82270
2020-07-06 16:21:27 +00:00
Masayuki Nakano
a639ed9828 Bug 1647556 - part 1: Get rid of WSRunScanner::InitializeWithSingleFragment() r=m_kato
For making easier to understand the contents of `WSRunScanner::mFragments`,
we should stop using `InitializeWithSingleFragment()` for now because it's
designed for doing same things a lot, but used only by 2 users and they set
different parameters so that it does not do same things for the callers.

Depends on D82268

Differential Revision: https://phabricator.services.mozilla.com/D82269
2020-07-06 10:33:06 +00:00
Sylvestre Ledru
caf785c695 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D82178
2020-07-04 09:38:43 +00:00
Mirko Brodesser
324ad8b2e7 Bug 1649121: part 17) Correct style for previous commit. r=masayuki
Separate commit to reduce possibility for typos.

Differential Revision: https://phabricator.services.mozilla.com/D82148
2020-07-03 09:55:37 +00:00
Mirko Brodesser
91f0344d40 Bug 1649121: part 16) Factor getting new caret point out of DoInsertHTMLWithContext. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D82147
2020-07-03 09:55:11 +00:00
Mirko Brodesser
f5d347f5a7 Bug 1649121: part 15) Declare IsVisibleBRElement const. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D82009
2020-07-03 09:25:25 +00:00
Mirko Brodesser
17833bb634 Bug 1649121: part 14) Rename local variables mostAncestorTableRelatedElement, maybeTableRelatedElement. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D82008
2020-07-03 09:25:22 +00:00
Mirko Brodesser
e79ae100d0 Bug 1649121: part 13) Rename GetMostAncestorListOrTableElement. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81994
2020-07-03 09:27:45 +00:00
Mirko Brodesser
72ae1c4c1f Bug 1649121: part 12) Remove duplicated code in IsReplaceableListElement. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81993
2020-07-03 09:25:18 +00:00
Mirko Brodesser
bb175a0e82 Bug 1649121: part 11) Factor some functionality of GetMostAncestorListOrTableElement out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81849
2020-07-03 09:26:19 +00:00
Mirko Brodesser
aec19fc27a Bug 1649121: part 10) Rename CollectTopMostChildNodesCompletelyInRange to CollectTopMostChildContentsCompletelyInRange. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81848
2020-07-02 11:53:03 +00:00
Masayuki Nakano
2c83c27c9c Bug 1644903 - Make nsINode::InsertBefore() callers call ErrorResult::WouldReportJSException() when inserting node may be in another document r=m_kato
`nsINode::InsertBefore()` removes inserting node from a document if it's in
a document including different document.  In this case, `UpdateReflectorGlobal`
in BindingUtils.cpp calls `ErrorResult::MightThrowJSException()`, but editor
never throws exception with `ErrorResult`.  Therefore, editor needs to call
`ErrorResult::WouldReportJSException()` explicitly if the inserting node may
be in another document.

As far as I checked, it can happen only when undoing or redoing a transaction.
Therefore, this patch touches only transaction classes.

Depends on D81683

Differential Revision: https://phabricator.services.mozilla.com/D81684
2020-07-01 13:13:13 +00:00
Masayuki Nakano
66545f5913 Bug 1648564 - Make WSRunScanner::GetFirstASCIIWhiteSpacePointCollapsedTo() and WSRunScanner::GetEndOfCollapsibleASCIIWhiteSpaces() not return point in empty text node r=m_kato
Although their callers may want to remove empty text nodes around white-space
sequence, but for now, we should make them not return empty text node because
the former's name means so, and the latter should behave similarly for
consistency.

Differential Revision: https://phabricator.services.mozilla.com/D81683
2020-07-02 08:30:25 +00:00
Simon Giesecke
9364b353d4 Bug 1648010 - Remove NS_NAMED_LITERAL_CSTRING and NS_NAMED_LITERAL_STRING macros. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80631
2020-07-01 08:42:31 +00:00
Simon Giesecke
e3c223da3e Bug 1648010 - Fix uses of NS_LITERAL_STRING with C string literals. r=geckoview-reviewers,agi,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80861
2020-07-01 08:34:12 +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
Mirko Brodesser
fb374f2e74 Bug 1649121: part 9) Simplify GetMostAncestorListOrTableElement. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81547
2020-06-30 13:13:12 +00:00
Mirko Brodesser
4477882999 Bug 1649121: part 8) Rename CollectListAndTableRelatedElementsAt to CollectTableAndAnyListElementsOfInclusiveAncestorsAt. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81546
2020-06-30 13:13:04 +00:00
Mirko Brodesser
a533835579 Bug 1649121: part 7) Rename HTMLEditUtils::IsList to HTMLEditUtils::IsAnyListElement. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81545
2020-06-30 13:12:56 +00:00
Mirko Brodesser
a30c22f525 Bug 1649121: part 6) Rename HTMLEditUtils::IsTableElementButNotTable to HTMLEditUtils::IsAnyTableElementButNotTable. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81544
2020-06-30 13:12:49 +00:00
Mirko Brodesser
7fe5d9f63c Bug 1649121: part 5) Declare HTMLEditor::GetBetterInsertionPointFor const. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81543
2020-06-30 13:12:47 +00:00
Mirko Brodesser
592ca1c3b6 Bug 1649121: part 4) Rename HTMLEditUtils::IsTableElement to HTMLEditUtils::IsAnyTableElement. r=masayuki
The old name was misleading.

Differential Revision: https://phabricator.services.mozilla.com/D81542
2020-06-30 13:12:39 +00:00
Mirko Brodesser
2937ae1381 Bug 1649121: part 3) Declare some methods in HTMLEditor static. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81541
2020-06-30 13:12:31 +00:00
Mirko Brodesser
f52a74862a Bug 1649121: part 2) Factor moving start and end of out CreateDOMFragmentForPaste. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81540
2020-06-30 13:12:29 +00:00
Mirko Brodesser
9ae430ad1a Bug 1649121: part 1) Add some documentation to HTMLEditor::CreateDOMFragmentFromPaste. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D81539
2020-06-30 13:12:16 +00:00
Chris Fronk
6f84249b41 Bug 1337953 - Make nsDeque templated on pointer type r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79629
2020-06-25 02:39:23 +00:00
Masayuki Nakano
a240090dfd Bug 1646325 - part 4: Make WSRunScanner create WSFragment when it's needed r=m_kato
In most methods of `WSRunScanner`, `WSFragment`s are never used.  Therefore,
this patch makes them created when they are necessary.

Depends on D80315

Differential Revision: https://phabricator.services.mozilla.com/D80638
2020-06-24 08:37:26 +00:00
Masayuki Nakano
5ef63f4bd4 Bug 1646325 - part 3: Make WSFragment non-double-linked-list r=m_kato
Now, `WSFragment` is managed by `AutoTArray` so that it does not need to
be double-linked-list.

Differential Revision: https://phabricator.services.mozilla.com/D80315
2020-06-24 03:43:05 +00:00
Masayuki Nakano
69d6f854ee Bug 1646325 - part 2: Manage WSFragments with array r=m_kato
`WSFragment` is created at least one instance, and at most 3 instances per
`WSRunScanner` instance.  They can be managed with `AutoTArray` simpler and
we can avoid heap allocation with this approach.

Differential Revision: https://phabricator.services.mozilla.com/D80314
2020-06-24 03:00:07 +00:00
Masayuki Nakano
379f838107 Bug 1646325 - part 1-3: Rewrite remaining part of WSRunScanner::GetRuns() with early-return style r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D80313
2020-06-24 01:22:45 +00:00
Masayuki Nakano
cc4a5ebe14 Bug 1646325 - part 1-2: Rewrite the new if block in WSRunScanner::GetRuns() with early-return style r=m_kato
Depends on D80311

Differential Revision: https://phabricator.services.mozilla.com/D80312
2020-06-23 05:13:58 +00:00
Masayuki Nakano
86e3ff72ea Bug 1646325 - part 1-1: Make WSRunScanner::GetRuns() handle the case not starting from hard line break first r=m_kato
Part 1-* rewrite `WSRunScanner::GetRuns()` with early-return style, but it's
hard to review if changing it with a patch.

This just swaps the `if` and `else` block because the `else` block is
shorter than the `if` block.

Depends on D79973

Differential Revision: https://phabricator.services.mozilla.com/D80311
2020-06-23 04:46:20 +00:00
Butkovits Atila
7916df7f02 Backed out changeset 5614bcd268d1 (bug 1337953) for bustage at FuzzyLayer.cpp. CLOSED TREE 2020-06-23 11:01:37 +03:00
Chris Fronk
cea9cef934 Bug 1337953 - Make nsDeque templated on pointer type r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79629
2020-06-23 00:58:13 +00:00
Masayuki Nakano
fcdef2c8b9 Bug 1646890 - Add automated test for bug 1645983 r=m_kato
This patch adds new test which is based on actual scenario in
Gmail composer.

Differential Revision: https://phabricator.services.mozilla.com/D80310
2020-06-22 14:48:47 +00:00
Masayuki Nakano
6b7588bbe2 Bug 1646296 - part 8: Make stack only classes to group start/end boundary information of WSRunScanner r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D79973
2020-06-22 14:48:15 +00:00
Kagami Sascha Rosylight
166f2891a2 Bug 1643464 - Part 1: Rename eLeft/eRight to ePrimary/eSecondary r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80331
2020-06-19 18:02:41 +00:00
tkhan
6ccabd4784 Bug 1602668 - M(1) manifest and test changes. r=kmag,karlt,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D70362
2020-06-22 19:09:49 +00:00
Masayuki Nakano
8243db7082 Bug 1646296 - part 7: Make WSRunScanner::InitializeRange*() template methods r=m_kato
Depends on D79971

Differential Revision: https://phabricator.services.mozilla.com/D79972
2020-06-22 08:12:37 +00:00
Masayuki Nakano
196304c105 Bug 1646296 - part 6: Make WSRunScanner::InitializeRange*() stop using the loops which are rarely run twice and more r=m_kato
With the previous patches, we know that the loops in
`WSRunScanner::InitializeRangeStart()` and `WSRunScanner::InitializeRangeEnd()`
rarely run twice and more.  Therefore, we can make use recursive calls instead
of the loop.

Depends on D79970

Differential Revision: https://phabricator.services.mozilla.com/D79971
2020-06-22 06:05:16 +00:00
Masayuki Nakano
c1be8ae82a Bug 1646296 - part 5: Make the last else block in the loops of WSRunScanner::InitializeRange*() handled before the text node case r=m_kato
Similar to the previous patch, this patch moves the last `else` block of
the loops in `WSRunScanner::InitializeRangeStart()` and
`WSRunScanner::InitializeRangeEnd()` to before the text node handling case.
This makes that clearer that the loops are continued only when text node
has no text or only white-spaces.

Depends on D79969

Differential Revision: https://phabricator.services.mozilla.com/D79970
2020-06-22 02:40:41 +00:00
Masayuki Nakano
7666461289 Bug 1646296 - part 4: Make the loops in WSRunScanner::InitializeRange*() handle topmost else block first r=m_kato
Their topmost `else` blocks mean there is no visible content before/after the
point.  In this case, the initialization is simpler.  So, they should be
handled first, and make the other blocks outdented.

Depends on D79966

Differential Revision: https://phabricator.services.mozilla.com/D79969
2020-06-22 02:11:30 +00:00
Masayuki Nakano
0847d6a6c2 Bug 1646296 - part 3: Create helper methods of WSRunScanner::InitializeRange*() to scan a text node r=m_kato
There are duplicated code in both `WSRunScanner::InitializeRangeStart()`
and `WSRunScanner::InitializeRangeEnd()`.  They scan text node to store
first and last NBSP positions and initialize start/end with found visible
character position.  This patch makes the loop clearer.

Depends on D79965

Differential Revision: https://phabricator.services.mozilla.com/D79966
2020-06-19 09:25:35 +00:00
Kagami Sascha Rosylight
f424c247ba Bug 1640276 - Part 11: Mark nsINode as const in IsPointInSelection() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80177
2020-06-19 00:58:40 +00:00
Masayuki Nakano
abe7626ff4 Bug 1646296 - part 2: Split WSRunScanner::GetWSNodes() r=m_kato
Despite the name, it stores range of white-space sequence and/or start/end
reason.  Initializing start and end are completely independent.  Therefore,
we can move them into independent methods.

Depends on D79964

Differential Revision: https://phabricator.services.mozilla.com/D79965
2020-06-18 07:20:54 +00:00
Masayuki Nakano
a852a50071 Bug 1646296 - part 1: Make WSRunScanner::FindNearestRun() return const WSFragment* instead of WSFragment* r=m_kato
The result should never be modified so that it should return `const`-pointer.

Differential Revision: https://phabricator.services.mozilla.com/D79964
2020-06-18 06:02:47 +00:00
Gijs Kruitbosch
222e2d1158 Bug 1644863 - fix trailing whitespace in cross-tree tests, r=emilio,marionette-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D79202
2020-06-17 22:45:31 +00:00