Commit Graph

6122 Commits

Author SHA1 Message Date
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
Masayuki Nakano
b9ab4d13e9 Bug 1574852 - part 67-2: Rename variables in HTMLEditRules::WillDeleteSelection() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44452

--HG--
extra : moz-landing-system : lando
2019-09-05 13:16:12 +00:00
Masayuki Nakano
ce5e7d1651 Bug 1574852 - part 67-1: Make HTMLEditRules::WillDeleteSelection() return EditActionResult` r=m_kato
Before moving the largest method in our tree, we should split it.  This is
first preparation of that.

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

--HG--
extra : moz-landing-system : lando
2019-09-05 13:37:42 +00:00
Masayuki Nakano
0382baf2fe Bug 1574852 - part 66: Move HTMLEditRules::ExpandSelectionForDelete() to HTMLEditor r=m_kato
And this patch makes the new method do not touch `Selection`, instead, return
new `StaticRange`.  Although the creation cost may make damage to the
performance but let's keep using `StaticRange` for now.  There should be
a stack only class which have 2 `RangeBoundaryBase` or `EditorDOMPointBase`.

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

--HG--
extra : moz-landing-system : lando
2019-09-05 07:25:51 +00:00
Masayuki Nakano
ff5055d6e2 Bug 1574852 - part 65: Move TextEditRules::CheckBidiLevelForDeletion() to EditorBase r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44204

--HG--
extra : moz-landing-system : lando
2019-09-05 02:21:26 +00:00
Masayuki Nakano
656648d70f Bug 1574852 - part 64: Move HTMLEditRules::MaybeDeleteTopMostEmptyAncestor() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44203

--HG--
extra : moz-landing-system : lando
2019-09-05 01:30:37 +00:00
Masayuki Nakano
c6648a62df Bug 1574852 - part 63: Move HTMLEditRules::GetGoodSelPointForNode() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44202

--HG--
extra : moz-landing-system : lando
2019-09-05 01:14:24 +00:00
Masayuki Nakano
d2ce733c6a Bug 1574852 - part 62: Move HTMLEditRules::TryToJoinBlocksWithTransaction() to HTMLEditor r=m_kato
Additionally, `WSRunObject::ScrabBlockBoundary()` and
`WSRunObject::PreparetToJoinBlocks()` are used only the it.  Therefore, we
can clean them up.

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

--HG--
extra : moz-landing-system : lando
2019-09-04 08:43:12 +00:00
Masayuki Nakano
e0847a6b6d Bug 1574852 - part 61: Move HTMLEditRules::MoveBlock() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44200

--HG--
extra : moz-landing-system : lando
2019-09-04 05:00:11 +00:00
Masayuki Nakano
e06533766b Bug 1574852 - part 60: Move HTMLEditRules::MoveNodeSmart() and HTMLEditRules::MoveContents() to HTMLEditor r=m_kato
Making them return next insertion point with `nsresult` makes the callers
easier to understand.  Therefore, this patch declares `MoveNodeResult` class
newly and make them use it.

And also we can get rid of the case of setting `*aInOutDestOffset` to -1
because it's a hacky case of `HTMLEditRules::MoveBlock()`.  If we keep it,
`MoveNodeSmart()` needs to compute new insertion point with different logic.
Therefore, this patch makes `HTMLEditRules::MoveBlock()` adjust new insertion
point with checking its argument.

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

--HG--
extra : moz-landing-system : lando
2019-09-04 03:32:26 +00:00
Masayuki Nakano
9c8bc82f51 Bug 1574852 - part 59: Move HTMLEditRules::JoinNearestEditableNodesWithTransaction() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44198

--HG--
extra : moz-landing-system : lando
2019-09-04 00:18:18 +00:00
Masayuki Nakano
e9b4c8468b Bug 1574852 - part 58: Move HTMLEditRules::CheckForInvisibleBR() to HTMLEditor r=m_kato
This is defined as too complicated than what it does actually since there
was not `EditorDOMPointBase`.

If given point's offset is `0`, returns `nullptr`.  If `aWhere` is
`BRLocation::blockEnd`, treats `aOffset` is length of `aBlock`.  Otherwise,
using given point.  Then, if the `WSRun` start reason is `br`, returns the
start reason node.  This means that this method just retrieves invisible
`<br>` element if it starts `WSRun` at given point.

Now, callers can specify end of block with `EditorDOMPointBase::SetToEndOf()`
easier.  Therefore, we can make it take only an `EditorDOMPointBase` instance.

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

--HG--
extra : moz-landing-system : lando
2019-09-03 10:31:41 +00:00
Masayuki Nakano
e1d468e330 Bug 1574852 - part 57: Move HTMLEditRules::DeleteNodeIfCollapsedText() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44196

--HG--
extra : moz-landing-system : lando
2019-09-03 09:57:28 +00:00