9559 Commits

Author SHA1 Message Date
Masayuki Nakano
af80a20e09 Bug 1574852 - part 107: Get rid of TextEditRules::GetTextNodeAroundSelectionStartContainer() since nobody uses it r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45490

--HG--
extra : moz-landing-system : lando
2019-09-13 03:39:13 +00:00
Masayuki Nakano
438470f81e Bug 1574852 - part 106-2: Move calling DeleteSelectionWithTransaction() and HTMLEditor specific post handling into HandleDeleteSelection() from TextEditor::DeleteSelectionAsSubAction() r=m_kato
In `TextEditor::HandleDeleteSelection()`, we have only one path of returning
`EditActionIgnored()`.  Therefore, it should call
`DeleteSelectionWithTransaction()` directly.

On the other hand, it's not clear in `HTMLEditor::HandleDeleteSelection()`
since it may be called recursively by its helper methods.  Therefore,
this patch creates `HTMLEditor::HandleDeleteSelectionInternal()` for the
recursive calls and makes `HTMLEditor::HandleDeleteSelection()` call
`DeleteSelectionWithTransaction()` if nobody handled it and to the
`HTMLEditor` specific post-process in it.

Differential Revision: https://phabricator.services.mozilla.com/D45301

--HG--
extra : moz-landing-system : lando
2019-09-13 03:20:04 +00:00
Masayuki Nakano
053579099d Bug 1574852 - part 106-1: Move TextEditRules::WillDeleteSelection() and TextEditRules::DeleteSelectionWithTransaction() to TextEditor and make HTMLEditor::HandleDeleteSelection() override the former r=m_kato
`TextEditor::DeleteSelectionAsSubAction()` starts to handle all
"delete selection" sub-actions (i.e., even if the instance is `HTMLEditor`).
Therefore, `TextEditRules::WillDeleteSelection()` should be renamed to
`TextEditor::HandleDeleteSelection()` and we need to make it virtual.

Differential Revision: https://phabricator.services.mozilla.com/D45300

--HG--
extra : moz-landing-system : lando
2019-09-13 02:49:43 +00:00
Masayuki Nakano
72fa9d1512 Bug 1574852 - part 105: Get rid of TextEditRules::WillSetProperty() and TextEditRules::WillRemoveProperty() r=m_kato
Oddly, they are used only by `HTMLEditor`, but implemented by `TextEditRules`.
They cancels when the editor is in plaintext mode.  So, actual things are
implemented by each caller.  This patch cleans them up too.

Differential Revision: https://phabricator.services.mozilla.com/D45299

--HG--
extra : moz-landing-system : lando
2019-09-12 09:13:00 +00:00
Masayuki Nakano
f521a40385 Bug 1574852 - part 104: Move TextEditRules::WillInsertText() to TextEditor and make HTMLEditor::WillInsertText() override it r=m_kato
And also this patch moves `TextEditRules::HandleNewLines()` and
`TextEditRules::DontEchoPassword()` to `TextEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D45298

--HG--
extra : moz-landing-system : lando
2019-09-13 02:40:09 +00:00
Masayuki Nakano
d0bf28c6cc Bug 1574852 - part 103: Move TextEditRules::WillInsertLineBreak() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45297

--HG--
extra : moz-landing-system : lando
2019-09-12 08:03:57 +00:00
Masayuki Nakano
80be9ab956 Bug 1574852 - part 102: Move TextEditRules::TruncateInsertionIfNeeded() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45296

--HG--
extra : moz-landing-system : lando
2019-09-12 07:48:29 +00:00
Masayuki Nakano
d0e7a72d94 Bug 1574852 - part 101: Move HTMLEditRules::DidDeleteSelection() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45295

--HG--
extra : moz-landing-system : lando
2019-09-12 07:27:30 +00:00
Masayuki Nakano
45ef18ee30 Bug 1574852 - part 100: Get rid of TextEditRules::DidDeleteSelection() r=m_kato
There are only 3 callers and it does simple but different 2 things.  One of
the callers is `HTMLEditRules::DidDeleteSelection()` so that if same things
are done by `TextEditor::DeleteSelectionAsSubAction()`, it does not need to
duplicate the code.  Therefore, we need to duplicate the code into
`TextEditor::DeleteSelectionAsSubAction()` and `TextEditRules::WillSetText()`.
Then, `TextEditRules::WillSetText()` can avoid accessing `Selection` since
it still grabs the modified text node.

Note that only when it's called by `TextEditRules::DidDoAction()`,
`AutoTransactionsConserveSelection` has been set.  However, neither
`DeleteNodeWithTransaction()` nor `DeleteNodeTransaction::DoTransaction()`
changes `Selection`.  Therefore, it hasn't do anything.  So, we can remove
it right now.

Differential Revision: https://phabricator.services.mozilla.com/D45294

--HG--
extra : moz-landing-system : lando
2019-09-12 06:51:26 +00:00
Masayuki Nakano
d87ff4830d Bug 1574852 - part 99: Move HTMLEditRules::WillRelativeChangeZIndex() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45293

--HG--
extra : moz-landing-system : lando
2019-09-12 06:20:49 +00:00
Masayuki Nakano
fee93a3a4d Bug 1574852 - part 98: Move HTMLEditRules::WillAbsolutePosition() and HTMLEditRules::WillRemoveAbsolutePosition() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45292

--HG--
extra : moz-landing-system : lando
2019-09-12 05:45:13 +00:00
Masayuki Nakano
878bbf3cb8 Bug 1574852 - part 97: Move HTMLEditRules::PrepareToMakeElementAbsolutePosition() to HTMLEditor r=m_kato
Only caller of it is `WillRemoveAbsolutePosition()` and it always sets
`*aHandled` to true before calling it.  Therefore, it does not need to take
it as an argument.

Differential Revision: https://phabricator.services.mozilla.com/D45291

--HG--
extra : moz-landing-system : lando
2019-09-12 04:07:30 +00:00
Masayuki Nakano
8b9c4d3ad1 Bug 1574852 - part 96: Merge HTMLEditRules::DidAbsolutePosition() with HTMLEditRules::WillAbsolutePosition() r=m_kato
Oddly, absolute position is handled as following steps.
1. `WillAbsolutePosition()` calls `PrepareToMakeElementAbsolutePosition()`
   to consider the target element.
2. Set TopLevelEditSubActionData::mNewBlockElement to it.
3. `DidAbsolutePosition()` makes it absolute-positioned.

So that, all of them can be done in `WillAbsolutePosition()` like other
edit sub-action handling.

Differential Revision: https://phabricator.services.mozilla.com/D45290

--HG--
extra : moz-landing-system : lando
2019-09-12 01:54:28 +00:00
Masayuki Nakano
d5f8e358d2 Bug 1574852 - part 95: Move HTMLEditRules::AfterEditInner() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44799

--HG--
extra : moz-landing-system : lando
2019-09-11 10:39:38 +00:00
Masayuki Nakano
821d89d488 Bug 1574852 - part 94: Move HTMLEditRules::PinSelectionToNewBlock() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44798

--HG--
extra : moz-landing-system : lando
2019-09-11 09:44:39 +00:00
Masayuki Nakano
e3bcdb2d3c Bug 1574852 - part 93: Move HTMLEditRules::CheckInterlinePosition() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44797

--HG--
extra : moz-landing-system : lando
2019-09-11 01:07:27 +00:00
Masayuki Nakano
875a9d4d05 Bug 1574852 - part 92: Move HTMLEditRules::RemoveEmptyNodesInChangedRange() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44796

--HG--
extra : moz-landing-system : lando
2019-09-10 04:46:55 +00:00
Masayuki Nakano
9ab5c8f493 Bug 1574852 - part 91: Move HTMLEditRules::InsertBRElementToEmptyListItemsAndTableCellsInRange() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44795

--HG--
extra : moz-landing-system : lando
2019-09-10 04:32:21 +00:00
Masayuki Nakano
24f1d9a9b3 Bug 1574852 - part 90: Move HTMLEditRules::ConfirmSelectionInBody() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44794

--HG--
extra : moz-landing-system : lando
2019-09-10 03:52:44 +00:00
Masayuki Nakano
a2c5d981ee Bug 1574852 - part 89: Move HTMLEditRules::AdjustSelection() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44793

--HG--
extra : moz-landing-system : lando
2019-09-10 03:38:04 +00:00
Masayuki Nakano
9a7cb5f3c8 Bug 1574852 - part 88: Move HTMLEditRules::FindNearEditableNode() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44792

--HG--
extra : moz-landing-system : lando
2019-09-09 10:09:38 +00:00
Masayuki Nakano
a8504046a4 Bug 1574852 - part 87: Move HTMLEditRules::SelectionEndpointInNode() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44791

--HG--
extra : moz-landing-system : lando
2019-09-09 05:21:04 +00:00
Masayuki Nakano
b1ead5a6f3 Bug 1574852 - part 86: Move HTMLEditRules::WillAlign() and HTMLEditRules::AlignContentsAtSelection() to HTMLEditor r=m_kato
And also this splits large 2 blocks of
`HTMLEditRules::AlignContentsAtSelection()` to 2 methods.

Differential Revision: https://phabricator.services.mozilla.com/D44790

--HG--
extra : moz-landing-system : lando
2019-09-09 04:57:50 +00:00
Masayuki Nakano
04e8f93b98 Bug 1574852 - part 85: Move HTMLEditRules::AlignBlock() to HTMLEditor r=m_kato
With guaranteeing the argument element type with `MOZ_ASSERT()`, we can
make it really simpler.

Differential Revision: https://phabricator.services.mozilla.com/D44789

--HG--
extra : moz-landing-system : lando
2019-09-09 02:48:56 +00:00
Masayuki Nakano
85fb6afdf7 Bug 1574852 - part 84: Move HTMLEditRules::RemoveAlignment() to HTMLEditor r=m_kato
And also this patch removes unnecessary declarations in `HTMLEditRules.h`.

Differential Revision: https://phabricator.services.mozilla.com/D44788

--HG--
extra : moz-landing-system : lando
2019-09-09 10:47:47 +00:00
Masayuki Nakano
2bc7658314 Bug 1574852 - part 83: Move HTMLEditRules::MakeSureElemStartsOrEndsOnCR() to HTMLEditor r=m_kato
`HTMLEditRules::MakeSureElemStartsOrEndsOnCR()` is unclear what it does.
And fortunately, its job is simple if we split it to each mode.  Therefore,
this patch splits it to `EnsureHardLineBeginsWithFirstChildOf()` and
`EnsureHardLineEndsWithLastChildOf()`.  Finally, the batch caller of them,
`HTMLEditRules::MakeSureElemStartsAndEndsOnCR()` is removed since directly
calling both of them is clearer.

Differential Revision: https://phabricator.services.mozilla.com/D44787

--HG--
extra : moz-landing-system : lando
2019-09-09 10:47:08 +00:00
Masayuki Nakano
d87e610645 Bug 1574852 - part 82: Move HTMLEditRules::MakeTransitionList() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44786

--HG--
extra : moz-landing-system : lando
2019-09-09 10:46:17 +00:00
Masayuki Nakano
fe64aaca55 Bug 1574852 - part 81: Move HTMLEditRules::AlignInnerBlocks() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44785

--HG--
extra : moz-landing-system : lando
2019-09-08 05:29:24 +00:00
Masayuki Nakano
31f29e011e Bug 1574852 - part 80: Move HTMLEditRules::AlignBlockContents() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44784

--HG--
extra : moz-landing-system : lando
2019-09-08 05:28:56 +00:00
Masayuki Nakano
c7ac0cebe5 Bug 1574852 - part 79: Make HTMLEditor::IndentAsAction() and HTMLEditor::OutdentAsAction() call specific AsSubAction() methods instead of WillDoAction() and DidDoAction() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44783

--HG--
extra : moz-landing-system : lando
2019-09-08 05:12:43 +00:00
Masayuki Nakano
13e63d57ea Bug 1574852 - part 78: Move HTMLEditRules::WillOutdent() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44782

--HG--
extra : moz-landing-system : lando
2019-09-08 05:05:38 +00:00
Masayuki Nakano
183c471149 Bug 1574852 - part 77: Move HTMLEditRules::WillIndent(), HTMLEditRules::WillHTMLIndent() and HTMLEditRules::WillCSSIndent() to HTMLEditor r=m_kato
The caller of `HTMLEditRules::WillDoAction()` is shared with "outdent".
Therefore, this patch is a preparation of makes `HTMLEditor` stop calling it.

Be aware, `HTMLEditRules::WillIndent()` won't cancel the action, and also
always handles the action unless editor has already been destroyed.  Therefore,
we can remove the dead code in `HTMLEditor::IndentOrOutdentAsSubAction()`
right now.

Differential Revision: https://phabricator.services.mozilla.com/D44781

--HG--
extra : moz-landing-system : lando
2019-09-08 04:35:52 +00:00
Masayuki Nakano
67f54f71f8 Bug 1574852 - part 76: Move HTMLEditRules::OutdentAroundSelection() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44780

--HG--
extra : moz-landing-system : lando
2019-09-08 04:03:06 +00:00
Masayuki Nakano
a322625816 Bug 1574852 - part 75: Move HTMLEditRules::OutdentPartOfBlock() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44779

--HG--
extra : moz-landing-system : lando
2019-09-08 03:23:16 +00:00
Masayuki Nakano
d64c6562b7 Bug 1574852 - part 74: Move HTMLEditRules::IndentAroundSelectionWithHTML() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44778

--HG--
extra : moz-landing-system : lando
2019-09-08 03:05:46 +00:00
Masayuki Nakano
9ff1becd88 Bug 1574852 - part 73: Move HTMLEditRules::IndentAroundSelectionWithCSS() to HTMLEditor r=m_kato
And also this patch fixes unexpected behavior change by bug 1460509:
https://searchfox.org/mozilla-central/diff/d5d67de86f23655fcccc7bbcf4423bb75148fd34/editor/libeditor/HTMLEditRules.cpp#4466

Differential Revision: https://phabricator.services.mozilla.com/D44777

--HG--
extra : moz-landing-system : lando
2019-09-06 12:57:56 +00:00
Masayuki Nakano
07dae7f820 Bug 1574852 - part 72: Move HTMLEditRules::ChangeMarginStart() to HTMLEditor and get rid of its wrappers r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44465

--HG--
extra : moz-landing-system : lando
2019-09-06 08:51:36 +00:00
Masayuki Nakano
de7cc1a3a0 Bug 1574852 - part 71: Move HTMLEditRules::WillRemoveList() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44464

--HG--
extra : moz-landing-system : lando
2019-09-06 06:01:57 +00:00
Masayuki Nakano
cfd3ee7e70 Bug 1574852 - part 70: Move HTMLEditRules::RemoveListStructur() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44463

--HG--
extra : moz-landing-system : lando
2019-09-06 05:46:15 +00:00
Geoff Brown
56ca134785 Bug 1579272 - Cleanup obviously fennec-centric test annotations; r=bc
Remove test manifest annotations that specifically target fennec,
or likely target the android 4.3 emulator.

Differential Revision: https://phabricator.services.mozilla.com/D45018

--HG--
extra : moz-landing-system : lando
2019-09-06 16:51:10 +00:00
Masayuki Nakano
e6a72f86be Bug 1574852 - part 69: Move HTMLEditRules::PopListItem() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44462

--HG--
extra : moz-landing-system : lando
2019-09-06 04:51:51 +00:00
Masayuki Nakano
c4c3b160eb Bug 1574852 - part 68: Make HTMLEditRules::GetDefinitionListItemTypes() to a stack class r=m_kato
It scans children and returns whether `<dt>` and `<dd>` are found or not.
So, we can make it a stack class and makes caller pick the necessary value
with getter methods.

Differential Revision: https://phabricator.services.mozilla.com/D44461

--HG--
extra : moz-landing-system : lando
2019-09-06 04:32:36 +00:00
Masayuki Nakano
f213a8f6d0 Bug 1574852 - part 67-10: Move HTMLEditRules::WillDeleteSelection() and related methods to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44460

--HG--
extra : moz-landing-system : lando
2019-09-06 04:31:38 +00:00
Masayuki Nakano
23c21f055e Bug 1574852 - part 67-9: Make next early return-style code work without AutoTrackDOMPoint r=m_kato
The next simple case is using early-return style and does not refer modified
`firstRangeStart` nor `firstRangeEnd` so that it can do same thing without
`AutoTrackDOMPoint`.

Then, there is remaining the complicated case.  We cannot split it anymore.

Note that we should not split `HandleDeleteNonCollapsedSelection()` anymore
because as you know, it does not make sense.  It checks only first range
and consider how to treat all ranges.  We should split it after we investigate
deeper with writing new WPT.

Differential Revision: https://phabricator.services.mozilla.com/D44459

--HG--
extra : moz-landing-system : lando
2019-09-06 03:46:03 +00:00
Masayuki Nakano
7c0f0f1a19 Bug 1574852 - part 67-8: Make next simple deletion code use early-return style r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44458

--HG--
extra : moz-landing-system : lando
2019-09-06 02:59:57 +00:00
Masayuki Nakano
07dea9b716 Bug 1574852 - part 67-7: Make early-return style for first simple deletion case of HTMLEditRules::HandleDeleteNonCollapsedSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44457

--HG--
extra : moz-landing-system : lando
2019-09-06 01:49:57 +00:00
Masayuki Nakano
3e4575061a Bug 1574852 - part 67-6: Split the last common part of HTMLEditRules::HandleDeleteNonCollapsedSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44456

--HG--
extra : moz-landing-system : lando
2019-09-06 01:44:00 +00:00
Masayuki Nakano
05db7b82d5 Bug 1574852 - part 67-5: Rewrite HTMLEditRules::HandleDeleteNonCollapsedSelection() with EditorDOMPoint r=m_kato
Before splitting the method, we should make it use `EditorDOMPoint` to
treat selection edges.

Differential Revision: https://phabricator.services.mozilla.com/D44455

--HG--
extra : moz-landing-system : lando
2019-09-06 00:59:32 +00:00
Masayuki Nakano
1a4a5cb8b9 Bug 1574852 - part 67-4: Split HTMLEditRules::HandleDeleteAroundCollapsedSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44454

--HG--
extra : moz-landing-system : lando
2019-09-05 13:38:07 +00:00
Masayuki Nakano
f3b99207af Bug 1574852 - part 67-3: Split HTMLEditRules::WillDeleteSelection() to 3 methods r=m_kato
First, we can split it with 3 parts:
1. preparation with current selection part.
2. handling deletion with collapsed selection part.
3. handling deletion with non-collapsed selection part.
The first should leave in `WillDeleteSelection()`, but the others should be
moved to independent methods.

With this change, we need to fix an odd case when there is no visible node
and `GetFirstSelectedTableCellElement()` returned error due to crossing
the method boundary.  The method returns error only when there is no selection
ranges.  In such case, we cannot handle deletion of current selection anyway.
So, it must not be a problem to handle the error immediately after calling
`GetFirstSelectedTableCellElement()`.  Note that this shouldn't occur in
normal cases since `WillDoAction()` checks it before calling
`WillDeleteSelection()`.

Differential Revision: https://phabricator.services.mozilla.com/D44453

--HG--
extra : moz-landing-system : lando
2019-09-05 13:37:57 +00:00