Commit Graph

10152 Commits

Author SHA1 Message Date
Sonia Singla
5f5c9fd7f2 Bug 1659267 - Remove usages of -moz-user-select across the Firefox codebase. r=emilio,marionette-reviewers,geckoview-reviewers,preferences-reviewers,whimboo,agi
Differential Revision: https://phabricator.services.mozilla.com/D87499
2020-08-18 23:37:51 +00:00
Masayuki Nakano
3da9fc2299 Bug 1658534 - part 2: Avoid infinite recursive calls at removing an invisible <br> element r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D86910
2020-08-18 07:26:02 +00:00
Masayuki Nakano
e21079f1fd Bug 1658534 - part 1: Split the removing invisible <br> element part off from HTMLEditor::HandleDeleteCollapsedSelectionAtAtomicContent() r=m_kato
Depends on D86886

Differential Revision: https://phabricator.services.mozilla.com/D86909
2020-08-18 05:35:39 +00:00
Masayuki Nakano
d550a723f8 Bug 1658472 - part 6: Make some utility methods for AutoInclusiveAncestorBlockElementsJoiner r=m_kato
This patch changes the behavior in the following 2 points:
* When both content is in same block element, won't return error
* When `<hr>` element has block children accidentally, this solves its container

The former case must not change actual behavior because
`AutoBlockElementsJoiner` is used with content nodes which are in different
blocks.

Differential Revision: https://phabricator.services.mozilla.com/D86886
2020-08-17 10:57:47 +00:00
Masayuki Nakano
909288b9a6 Bug 1658472 - part 5: Split AutoInclusiveAncestorBlockElementsJoiner::Run() to computation part and touching the DOM tree part r=m_kato
Depends on D86884

Differential Revision: https://phabricator.services.mozilla.com/D86885
2020-08-17 10:51:44 +00:00
Masayuki Nakano
5d03594318 Bug 1658472 - part 4: Make AutoInclusiveAncestorBlockElementsJoiner store new list element tag name with its member r=m_kato
Depends on D86883

Differential Revision: https://phabricator.services.mozilla.com/D86884
2020-08-17 10:24:13 +00:00
Masayuki Nakano
3e0a1d8d61 Bug 1658472 - part 3: Make AutoInclusiveAncestorBlockElementsJoiner store left block element and right block element as its members r=m_kato
Depends on D86882

Differential Revision: https://phabricator.services.mozilla.com/D86883
2020-08-17 09:54:49 +00:00
Masayuki Nakano
3496851ec0 Bug 1658472 - part 2: Make AutoInclusiveAncestorBlockElementsJoiner store left content and right content at construction r=m_kato
Depends on D86881

Differential Revision: https://phabricator.services.mozilla.com/D86882
2020-08-17 09:34:11 +00:00
Masayuki Nakano
1a08039730 Bug 1658472 - part 1: Move HTMLEditor::TryToJoinBlocksWithTransaction() into new nested class of AutoBlockElementsJoiner r=m_kato
Now all users of the method is methods of `AutoBlockElementsJoiner`.
Therefore, we can move it into the nested class.  And for splitting the
method in the following patch, it should be a nested class of
`AutoBlockElementJoiner`.

Depends on D86791

Differential Revision: https://phabricator.services.mozilla.com/D86881
2020-08-17 09:22:19 +00:00
Masayuki Nakano
33a78c310f Bug 1655392 - part 6: Split the text deletion part of start and/or end of range off from HandleDeleteNonCollapsedRanges r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D86791
2020-08-17 00:26:24 +00:00
Masayuki Nakano
21d81f986c Bug 1655392 - part 5: Split the part removing contents in each range off from HandleDeleteNonCollapsedRanges() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D86790
2020-08-16 04:33:39 +00:00
Masayuki Nakano
9d1482c813 Bug 1655392 - part 4: Give independent mode and handler for the next block of AutoBlockElementsJoiner::HandleDeleteNonCollapsedRanges() r=m_kato
And now, `HTMLEditor::JoinNodesDeepWithTransaction()` is used only by
`AutoBlockElementsJoiner`.  Therefore, this patch moves it to the
stack only class.

Differential Revision: https://phabricator.services.mozilla.com/D86789
2020-08-16 04:20:38 +00:00
Masayuki Nakano
aa3497a28e Bug 1655392 - part 3: Give independent mode and handler for first case of AutoBlockElementsJoiner::HandleDeleteNonCollapsedRanges() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D86788
2020-08-13 11:54:21 +00:00
Masayuki Nakano
fa6c54cc66 Bug 1655392 - part 2: Make AutoBlockElementsJoiner::PrepareToDeleteNonCollapsedRange() initialize mLeftContent and mRightContent with inclusive ancestor block elements of start and end of first range r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D86787
2020-08-13 11:17:24 +00:00
Masayuki Nakano
7d56bc1b36 Bug 1655392 - part 1: Move some part of HTMLEditor::HandleDeleteNonCollapsedRanges() to AutoBlockElementsJoiner r=m_kato
For making the following review easier, this patch just moves some part of
`HandleDeleteNonCollapsedRanges()` into `AutoBlockElementJoiner`.

Differential Revision: https://phabricator.services.mozilla.com/D86786
2020-08-13 10:12:13 +00:00
Mihai Alexandru Michis
fb644eda26 Backed out changeset 5838f8b581ed (bug 1647536) for causing failures in browser_active_mediasession_among_tabs.js
CLOSED TREE
2020-08-14 19:42:51 +03:00
Chris Fronk
8770c8a332 Bug 1647536 - Support ref counted pointers in nsDeque r=froydnj
Adds a new specialization of nsDeque, nsRefPtrDeque for use with
reference counted pointers.

Differential Revision: https://phabricator.services.mozilla.com/D84766
2020-08-14 15:19:48 +00:00
Mirko Brodesser
21078a7903 Bug 1652557: don't skip test_bug767684.html when xorigin iframes and fission are enabled. r=masayuki
The test failed neither locally nor on try, hence enabling it again.

Differential Revision: https://phabricator.services.mozilla.com/D86706
2020-08-12 02:02:49 +00:00
Masayuki Nakano
220db95ff0 Bug 1657269 - part 2: Make HTMLEditor::HandleDeleteSelectionInternal() take AutoRangeArray instead of referring Selection ranges r=m_kato
Now, only when deleting table cell contents, `HandleDeleteSelectionInternal()`
depends on `Selection`.  However, this can be moved to `HandleDeleteSelection()`
because recursive callers expects `Selection` is collapsed by its previous job.

Differential Revision: https://phabricator.services.mozilla.com/D86183
2020-08-11 09:35:42 +00:00
Masayuki Nakano
d5ed562a13 Bug 1657269 - part 1: Move EditorBase::ExtendSelectionForDelete() into AutoRangeArray r=m_kato
This patch moves `EditorBase::ExtendSelectionForDelete()` into `AutoRangeArray`
and make it stop modifying `Selection`.

The method extends anchor-focus range with `nsFrameSelection` and it refers
bidi information in it too.  Therefore, it needs to be called before modifying
anchor-focus range of `Selection`.  Unfortunately, this makes the code messy,
but for now, we should take this.  In the future, we should make the API of
`nsFrameSelection` free from `Selection`.

Differential Revision: https://phabricator.services.mozilla.com/D86182
2020-08-11 06:11:10 +00:00
Masayuki Nakano
0b7819addd Bug 1657270 - part 5: Guarantee that AutoEmptyBlockAncestorDeleter did nothing if it returns "not handled" or an error at the caller r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85999
2020-08-11 05:04:33 +00:00
Masayuki Nakano
76b257fb0f Bug 1657270 - part 4: Split caret computation part off from AutoEmptyBlockAncestorDeleter::Run() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85998
2020-08-11 05:04:08 +00:00
Masayuki Nakano
087c7979ab Bug 1657270 - part 3: Split <br> element insertion part for empty list element off from AutoEmptyBlockAncestorDeleter::Run() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85997
2020-08-11 04:35:05 +00:00
Masayuki Nakano
d76fe99f0d Bug 1657270 - part 2: Split AutoEmptyBlockAncestorDeleter::Run() to scanning the target part and touching the DOM tree part r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85996
2020-08-11 02:02:31 +00:00
Masayuki Nakano
42c32fd19a Bug 1657270 - part 1: Move HTMLEditor::MaybeDeleteTopMostEmptyAncestor() into new stack only class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85995
2020-08-11 02:02:19 +00:00
Edgar Chen
ad6affb211 Bug 1658176 - Make mochitest tests with xorigin and fission enabled report assertion properly; r=kmag DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D86516
2020-08-10 20:48:13 +00:00
Dorel Luca
c243829674 Backed out 5 changesets (bug 1623764) for WPT failures in /editing/run/forwarddelete.html. CLOSED TREE
Backed out changeset 838b1a256f25 (bug 1623764)
Backed out changeset 00911e3c92c3 (bug 1623764)
Backed out changeset 5f7d278953d7 (bug 1623764)
Backed out changeset 0059379a3c29 (bug 1623764)
Backed out changeset 6e3a9276ec41 (bug 1623764)
2020-08-10 09:07:48 +03:00
Kagami Sascha Rosylight
a371405cd9 Bug 1623764 - Part 5: Prevent test failure by subpixel difference r=emilio
The failures already have been there: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3d6cc94f2db7a2e55f41405ef0575102637e0633&selectedTaskRun=ZUj4QROIQo6nGympvvqvjA.0

... but they only fail inside a job "geckoview-test-verify" and the job even does not always runs the test. It makes hard to track the initial failure, so this patch just allows subpixel difference.

Differential Revision: https://phabricator.services.mozilla.com/D86486
2020-08-10 01:46:26 +00:00
Kagami Sascha Rosylight
ddbb369d71 Bug 1623764 - Part 4: Stop at hard linebreaks when eat_space_to_next_word r=emilio,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85923
2020-08-09 12:58:27 +00:00
Masayuki Nakano
5b78d2b3c1 Bug 1657052 - Make HTMLEditor::HandleDeleteAroundCollapsedSelection() take ranges to delete instead of retrieving them via Selection r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85965
2020-08-07 06:13:00 +00:00
Masayuki Nakano
4588958dcb Bug 1656799 - part 5: Make HTMLEditor::GetRangeExtendedToIncludeInvisibleNodes() directly extend given range r=m_kato
Creation cost of `nsRange` is expensive, and it's only user,
`HTMLEditor::HandleDeleteNonCollapsedRanges()` wants to extend the range.
Therefore, we can make it directly extend the given range.

Differential Revision: https://phabricator.services.mozilla.com/D85849
2020-08-07 06:12:17 +00:00
Masayuki Nakano
6346ed0316 Bug 1656799 - part 4: Make HTMLEditor::HandleDeleteNonCollapsedSelection() take ranges to delete instead of retrieving it via Selection r=m_kato
Depends on D85847

Differential Revision: https://phabricator.services.mozilla.com/D85848
2020-08-07 05:53:16 +00:00
Masayuki Nakano
3397c35fa4 Bug 1656799 - part 3: Make WhiteSpaceVisibilityKeeper::PrepareToDeleteRange() not track EditorDOMPoints r=m_kato
It may be faster to use `AutoTrackDOMRange` directly.  Therefore, current
`WhiteSpaceVisibilityKeeper::PrepareToDeleteRange()` should be renamed to
`WhiteSpaceVisibilityKeeper::PrepareToDeleteRangeAndTrackPoints()` and
we should make `HTMLEditor::HandleDeleteNonCollapsedSelection()` track
the range by itself.

Depends on D85846

Differential Revision: https://phabricator.services.mozilla.com/D85847
2020-08-06 08:07:39 +00:00
Masayuki Nakano
0ada126b2a Bug 1656799 - part 2: Create range tracker r=m_kato
There is only `AutoTrackDOMPoint`, but
`HTMLEditor::HandleDeleteNonCollapsedSelection()` requires to tack pairs of
DOM points, i.e., requires to track ranges.  For making the code simpler,
we should have range tracker too.

Depends on D85845

Differential Revision: https://phabricator.services.mozilla.com/D85846
2020-08-08 02:57:16 +00:00
Masayuki Nakano
93ff6864bb Bug 1656799 - part 1: Make HTMLEditor::HandleDeleteNonCollapsedSelection() store selection ranges with AutoRangeArray first r=m_kato
Depends on D85686

Differential Revision: https://phabricator.services.mozilla.com/D85845
2020-08-06 07:03:55 +00:00
Cosmin Sabou
1fd1260b5e Backed out 4 changesets (bug 1623764) for mochitest failures on test_movement_by_characters.html. CLOSED TREE
Backed out changeset f927522d89bc (bug 1623764)
Backed out changeset c100eb8ae430 (bug 1623764)
Backed out changeset 1147ded16458 (bug 1623764)
Backed out changeset 7af572ec5edf (bug 1623764)
2020-08-06 08:09:42 +03:00
Kagami Sascha Rosylight
0f2d254487 Bug 1623764 - Part 4: Stop at hard linebreaks when eat_space_to_next_word r=emilio,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85923
2020-08-06 01:18:52 +00:00
Masayuki Nakano
e12a28bb16 Bug 1656430 - part 3: Create EditorBase::DeleteRangesWithTransaction() r=m_kato
This patch makes `EditorBase::DeleteSelectionWithTransaction()` a wrapper of
`EditorBase::DeleteRangesWithTransaction()`.

Differential Revision: https://phabricator.services.mozilla.com/D85686
2020-08-05 07:13:40 +00:00
Masayuki Nakano
65db771e7f Bug 1656430 - part 2: Add AutoRangeArray for alternative class of Selection r=m_kato
This new class will be used for treating selection ranges without modifying
it temporarily.

Differential Revision: https://phabricator.services.mozilla.com/D85685
2020-08-05 06:45:37 +00:00
Masayuki Nakano
9c3084ace7 Bug 1656430 - part 1: Rename AutoRangeArray to AutoSelectionRangeArray r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85684
2020-08-05 01:37:26 +00:00
Masayuki Nakano
25994d720f Bug 1656432 - part 3: Get rid of nsIEditActionListener::WillDeleteSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85683
2020-08-04 15:01:18 +00:00
Masayuki Nakano
d68f059017 Bug 1656432 - part 1: Create nsIEditActionListener::WillDeleteRanges() r=m_kato
Currently, `nsIEditActionListener::WillDeleteSelection()` notifies
`FinderHighliter` of deleting selection ranges.  But it's referred only
the ranges, not selection object itself and editor shouldn't modify
`Selection` as far as possible for reducing the runtime cost.

Therefore, it should be replaced with this new API.  Then,
`EditorBase::WillDeleteSelectionWithTransaction()` can be rewritten as
`EditorBase::WillDeleteRangesWithTransaction()` later.

Differential Revision: https://phabricator.services.mozilla.com/D85681
2020-08-04 14:59:03 +00:00
Masayuki Nakano
4a9059edde Bug 1655389 - part 3: Split the case deleting <br> element off from AutoBlockElementsJoiner::HandleDeleteCollapsedSelectionAtOtherBlockBoundary() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85578
2020-08-05 05:08:21 +00:00
Masayuki Nakano
4d84607c7e Bug 1655389 - part 2: Move recursive call in AutoBlockElementsJoiner::HandleDeleteCollapsedSelectionAtCurrentBlockBoundary() to HTMLEditor::HandleDeleteAroundCollapsedSelection() r=m_kato
The recursive call is not safe.  We should do it more carefully.  For now,
we should not hide the recursive call into the leaf handler.

Differential Revision: https://phabricator.services.mozilla.com/D85573
2020-08-04 12:14:33 +00:00
Masayuki Nakano
2323c386e9 Bug 1655389 - part 1: Move HTMLEditor::HandleDeleteCollapsedSelectionAtCurrentBlockBoundary() into AutoBlockElementJoiner r=m_kato
Same as the patch for bug 1655391, this patch splits the method to 2 parts.
One is to consider content nodes to join or a `<br>` element to delete instead.

Note that this patch changes the behavior a little.  That is, when the other
block is not editable, it throws an exception here:
https://searchfox.org/mozilla-central/rev/56bb74ea8e04bdac57c33cbe9b54d889b9262ade/editor/libeditor/HTMLEditSubActionHandler.cpp#3124

But it should just cancel the edit action.  Therefore, some tests in
BrowserScope are fixed by this patch.  I.e., result of DOM tree in the
situation isn't changed, but stops throwing unnecessary exception.

Differential Revision: https://phabricator.services.mozilla.com/D85569
2020-08-04 11:42:55 +00:00
Masayuki Nakano
804e3ce7de Bug 1655391 - Make new stack only class handle deletion at current block boundary r=m_kato
This patch creates new stack only class, `HTMLEditor::AutoBlockElementsJoiner`
and splits `HTMLEditor::HandleDeleteCollapsedSelectionAtCurrentBlockBoundary()`
to considering the content nodes to be joined part and doing join the nodes
part.

Differential Revision: https://phabricator.services.mozilla.com/D85567
2020-08-04 03:01:21 +00:00
Butkovits Atila
7a09391039 Backed out changeset 2e7e9d83e56b (bug 1655391) for bustage at HTMLEditor. CLOSED TREE 2020-08-03 14:54:27 +03:00
Masayuki Nakano
04fa88ff17 Bug 1655391 - Make new stack only class handle deletion at current block boundary r=m_kato
This patch creates new stack only class, `HTMLEditor::AutoBlockElementsJoiner`
and splits `HTMLEditor::HandleDeleteCollapsedSelectionAtCurrentBlockBoundary()`
to considering the content nodes to be joined part and doing join the nodes
part.

Differential Revision: https://phabricator.services.mozilla.com/D85567
2020-08-03 09:52:38 +00:00
Sonia Singla
34ac1b2de3 Bug 1656292 - Enable remaining ESLint rules on editor/libeditor/tests/*.xhtml files. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85450
2020-07-31 23:58:46 +00:00
Masayuki Nakano
8147272ea7 Bug 1655706 - part 3-2: Move AutoTransactionsConserveSelection in HTMLEditor::TryToJoinBlocksWithTransaction() into each WhiteSpaceVisibilityKeeper method r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D85534
2020-08-03 08:25:33 +00:00