Commit Graph

5403 Commits

Author SHA1 Message Date
Masayuki Nakano
004c690a96 Bug 1463985 - part 15: Rename EditSubAction::makeList to EditSubAction::eCreateOrChangeList r=m_kato
MozReview-Commit-ID: 4Mkh3Mfm6fY

--HG--
extra : rebase_source : 5509f3f2e05ce4fe25965ca69334309a9109a791
2018-05-28 22:36:19 +09:00
Masayuki Nakano
54321db367 Bug 1463985 - part 14: Rename EditSubAction::insertBreak to EditSubAction::eInsertParagraphSeparator r=m_kato
MozReview-Commit-ID: DhEzqhLxMme

--HG--
extra : rebase_source : 87e482478b881ba9c9fbc99562fce5e5a576e0ab
2018-05-28 22:27:47 +09:00
Masayuki Nakano
f24da5be63 Bug 1463985 - part 13: Rename EditSubAction::setText to EditSubAction::eSetText r=m_kato
MozReview-Commit-ID: A4DF3fX9IV6

--HG--
extra : rebase_source : d89acbacb9f17a599ee5b1c1387fd08f42cac3b6
2018-05-28 22:20:43 +09:00
Masayuki Nakano
b539d189c1 Bug 1463985 - part 12: Rename EditSubAction::outputText to EditSubAction::eComputeTextToOutput r=m_kato
MozReview-Commit-ID: ItJi2rKv6Pw

--HG--
extra : rebase_source : 3c0bea9a8cdfd74b3f65d504d32d63746afe82cd
2018-05-28 22:09:55 +09:00
Masayuki Nakano
9fa1c953b2 Bug 1463985 - part 11: Rename EditSubAction::setTextProperty and EditSubAction::removeTextProperty to EditSubAction::eSetTextProperty and EditSubAction::eRemoveTextProperty r=m_kato
There may be better name for them though.

MozReview-Commit-ID: KxwziJArh84

--HG--
extra : rebase_source : 3af1c052c62f244bbbeaef65ff3b203d35d88ef4
2018-05-28 22:05:10 +09:00
Masayuki Nakano
cbdd1207ab Bug 1463985 - part 10: Rename EditSubAction::deleteSelection to EditSubAction::eDeleteSelectedContent r=m_kato
MozReview-Commit-ID: 8LNY42KnyDf

--HG--
extra : rebase_source : 7778c0ff7c3da1c5070d0e5acf607665ff8efd4f
2018-05-28 21:49:56 +09:00
Masayuki Nakano
99a921d037 Bug 1463985 - part 9: Rename EditSubAction::insertIMEText to EditSubAction::eInsertTextComingFromIME r=m_kato
MozReview-Commit-ID: 1TmryMStB7H

--HG--
extra : rebase_source : 33dea12fe1ce0d5b9ea9ee13681949f288056d2a
2018-05-28 21:44:39 +09:00
Masayuki Nakano
63f1437458 Bug 1463985 - part 8: Rename EditSubAction::insertText to EditSubAction::eInsertText r=m_kato
MozReview-Commit-ID: Bd7GMng3T1T

--HG--
extra : rebase_source : a7e1774282c69b38add45faa993682d98e976d6b
2018-05-28 21:36:47 +09:00
Masayuki Nakano
204a55a114 Bug 1463985 - part 7: Rename EditSubAction::eDeleteText to EditSubAction::deleteText r=m_kato
And the odd number assign does not make sense anymore.  So, removes it.

MozReview-Commit-ID: JSyMNcrNhpP

--HG--
extra : rebase_source : efdb31d94d0fcae50cd72b5ee0d27041a454887a
2018-05-28 21:29:14 +09:00
Masayuki Nakano
52bba9f895 Bug 1463985 - part 6: Rename EditSubAction::splitNode and EditSubAction::joinNode to EditSubAction::eSplitNode and EditSubAction::eJoinNodes r=m_kato
MozReview-Commit-ID: Lk0UKyzWK8d

--HG--
extra : rebase_source : 3bc062c85da2ca8d7e9f9ca072c478135b3850fc
2018-05-28 21:25:20 +09:00
Masayuki Nakano
db6dc253e0 Bug 1463985 - part 5: Rename EditSubAction::deleteNode to EditSubAction::eDeleteNode r=m_kato
MozReview-Commit-ID: 1K5bdzvNUaF

--HG--
extra : rebase_source : a7347e953cfe8f4419f9982794a4d693af303220
2018-05-28 21:19:34 +09:00
Masayuki Nakano
32dc755297 Bug 1463985 - part 4: Rename EditSubAction::insertNode and EditSubAction::createNode to EditSubAction::eInsertNode and EditSubAction::eCreateNode r=m_kato
Although, there might be no reason to have those edit sub-actions separately.

MozReview-Commit-ID: BaaNCqfk4V4

--HG--
extra : rebase_source : 061bc85c85489b6b2617e05bd91254667ddedb1a
2018-05-28 21:16:44 +09:00
Masayuki Nakano
5de95ff37e Bug 1463985 - part 3: Rename EditSubAction::undo and EditSubAction::redo to EditSubAction::eUndo and EditSubAction::eRedo r=m_kato
MozReview-Commit-ID: 3eNlmFimFlu

--HG--
extra : rebase_source : 3ed271141f5161ca48cd39882fa6290b1d45946c
2018-05-28 20:36:06 +09:00
Masayuki Nakano
82c12dc72d Bug 1463985 - part 2: Rename EditSubAction::none to EditSubAction::eNone r=m_kato
MozReview-Commit-ID: 4wJyaNS1P1y

--HG--
extra : rebase_source : 169e2faffa25ed42875c8dccb5c49ae5aaa54ebb
2018-05-28 20:29:34 +09:00
Masayuki Nakano
99341a9445 Bug 1463985 - part 1: Rename EditAction to EditSubAction and related stuff r=m_kato
When we implement InputEvent.inputType, we need to set a stack class to record
which edit action is currently handled.  However, currently, we call smaller
jobs as edit action.  For example, when user types a character at selecting
some characters, then, EditAction::deleteSelection is performed first, then,
EditAction::insertText is performed.  However, for the InputEvent.inputType,
we need inserText information.  So, for making new enum EditAction, we need
to rename current EditAction to EditSubAction.

And also this renames related stuff:

EditorBase::mIsInEditAction -> EditorBase::mIsInEditSubAction
EditorBase::IsInEditAction() -> EditorBase::IsInEditSubAction()
EditorBase::mAction -> EditorBase::mTopLevelEditSubAction
TextEditRules::mTheAction -> TextEditRules::mTopLevelEditSubAction
EditorBase::StartOperation() ->
  EditorBase::OnStartToHandleTopLevelEditSubAction()
EditorBase::EndOperation() ->
  EditorBase::OnEndHandlingTopLevelEditSubAction()
AutoRules -> AutoTopLevelEditSubActionNotifier
RulesInfo -> EditSubActionInfo

MozReview-Commit-ID: cvSkPUjFm1

--HG--
extra : rebase_source : baf527a3e353b7a8ebe9a46be2243b059c500234
2018-05-28 20:12:34 +09:00
Boris Zbarsky
931b9e37ad Bug 1455676 part 10. Remove use of nsIDOMNode from remaining xpidl. r=qdot 2018-05-29 22:58:49 -04:00
Boris Zbarsky
c73f664888 Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki 2018-05-24 13:18:34 -04:00
Boris Zbarsky
0f8f7f6fba Bug 1463981 part 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki 2018-05-24 13:18:34 -04:00
Masayuki Nakano
11ae2207cf Bug 1463327 - part 4: Add comments to explain which kind of methods should be public methods r=m_kato
MozReview-Commit-ID: 6l8ZiMWEYCI

--HG--
extra : rebase_source : 024625012c917b17710016b91db10bfbaace2134
2018-05-22 20:15:05 +09:00
Masayuki Nakano
d40825b1e4 Bug 1463327 - part 3: Change scope of some methods of HTMLEditor which won't be called by non-helper classes of editing to protected r=m_kato
HTMLEditor has 2 type of public methods.  One is rue-public methods.  I.e.,
they should be able to be called by anybody.  E.g., command handlers, event
listeners, or JS via nsIEditor interface.  The other is semi-public methods.
They are not called by the above examples but called by other classes which
are helper classes to handle edit actions.  E.g., TextEditRules, HTMLEditRules,
HTMLEditUtils, CSSEditUtils and Transaction classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make HTMLEditor have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in HTMLEditor.h
(except removes BlockTransformationType since it's unused and replaces
ResizingRequestID with new enum class ResizeAt since normal enum isn't hit by
searchfox.org).

MozReview-Commit-ID: 7PC8E8vD7w2

--HG--
extra : rebase_source : 13f51565f2b89ab816ba529af18ee88193a9c932
2018-05-22 18:28:50 +09:00
Masayuki Nakano
f615160008 Bug 1463327 - part 2: Change scope of some methods of TextEditor which won't be called by non-helper classes of editing to protected r=m_kato
TextEditor has 2 type of public methods.  One is true-public methods.  I.e.,
they should be able to be called by anybody.  E.g., command handlers, event
listeners, or JS via nsIEditor interface.  The other is semi-public methods.
 They are not called by the above examples but called by other classes which
are helper classes to handle edit actions.  E.g., TextEditRules, HTMLEditRules,
HTMLEditUtils, CSSEditUtils and Transaction classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make TextEditor have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in TextEditor.h.

MozReview-Commit-ID: Db3H6d1V8IU

--HG--
extra : rebase_source : d928a6bb378d02944c5a207de83211c33bb63613
2018-05-22 16:40:44 +09:00
Masayuki Nakano
40ab33fe29 Bug 1463327 - part 1: Change scope of some methods of EditorBase which won't be called by non-helper classes of editing to protected r=m_kato
EditorBase (and other editor classes) have 2 type of public methods.  One is
true-public methods.  I.e., they should be able to be called by anybody.
E.g., command handlers, event listeners, or JS via nsIEditor interface.
The other is semi-public methods.  They are not called by the above examples
but called by other classes which are helper classes to handle edit actions.
E.g., TextEditRules, HTMLEditRules, HTMLEditUtils, CSSEditUtils and Transaction
classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make EditorBase have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in EditorBase.h
(except removes GetName() since there is no body of this method and removes
IterDirection since it's unused).

MozReview-Commit-ID: HBseKLL6pxx

--HG--
extra : rebase_source : 2251ff659d831d01a6778d38f4e2714fcf2d6ef4
2018-05-22 16:08:43 +09:00
Masayuki Nakano
6099476d10 Bug 1460509 - part 84: Make HTMLEditRules::GetNodesFromPoint() use IgnoredErrorResult instead of ErrorResult r=m_kato
HTMLEditRules::GetNodesFromPoint() uses ErrorResult only for checking in
debug build.  So, it should use IgnoredErrorResult instead.

MozReview-Commit-ID: 5roQI03A0kF

--HG--
extra : rebase_source : 5f54dc18635653d214b22520f4747a00258d9d9b
2018-05-22 23:22:27 +09:00
Masayuki Nakano
ddb1f08834 Bug 1460509 - part 83: Make HTMLEditRules::InsertBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Kuga8LvWfaM

--HG--
extra : rebase_source : 8e3e855268a5bddf069a8cfbb869eb64074188fb
2018-05-18 12:41:53 +09:00
Masayuki Nakano
ec1146f4c4 Bug 1460509 - part 82: Refine comments of TextEditRules.h and HTMLEditRules.h r=m_kato
This patch adds new rules of TextEditRules and HTMLEditRules about
NS_ERROR_EDITOR_DESTROYED.

Additionally, this patch moves some method explanation in each .cpp file to .h
file.

MozReview-Commit-ID: JqZFrWyrND8

--HG--
extra : rebase_source : d86385d9c26bb23adae1eca3b1be1a868c20e353
2018-05-18 12:38:32 +09:00
Masayuki Nakano
7bbdd6b2f2 Bug 1460509 - part 81: Make HTMLEditRules::WillDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: IPN1GMQYGeY

--HG--
extra : rebase_source : 97bd6e6d9e925a66c2f9f4dfb2678bc4e33aed42
2018-05-18 00:43:52 +09:00
Masayuki Nakano
c7127dda7f Bug 1460509 - part 80: Make HTMLEditRules::DeleteNodeIfCollapsedText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: C8ZNGlKJXlq

--HG--
extra : rebase_source : 17bd0b929b6339c2736514c28a354b21c45143b6
2018-05-18 00:31:20 +09:00
Masayuki Nakano
7e3a011a75 Bug 1460509 - part 79: Make HTMLEditRules::TryToJoinBlocksWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: BdoIrAYckNe

--HG--
extra : rebase_source : 182d41eb20fbc3e4088b3fcb76347154e0e88df6
2018-05-18 00:22:43 +09:00
Masayuki Nakano
17eab7beeb Bug 1460509 - part 78: Make HTMLEditRules::MoveBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7RKXiYaH2l0

--HG--
extra : rebase_source : 8c30c66fbd9e20382aa0c26f868b9b5099c212da
2018-05-18 00:08:58 +09:00
Masayuki Nakano
c66a577ca5 Bug 1460509 - part 77: Make HTMLEditRules::MoveNodeSmart() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: D9mgBt2ftuz

--HG--
extra : rebase_source : 1286eddebb2f26ab22223825f13d82e0f6d051cb
2018-05-18 00:02:00 +09:00
Masayuki Nakano
2250135c6b Bug 1460509 - part 76: Mark HTMLEditRules::MoveContents() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: gBAssBJfrF

--HG--
extra : rebase_source : 20b4dac757f1991c95d16885726b38d01c238a92
2018-05-17 23:52:47 +09:00
Masayuki Nakano
ddf4765c0a Bug 1460509 - part 75: Make HTMLEditRules::DeleteNonTableElements() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 9SIBECF8s1R

--HG--
extra : rebase_source : 5087d948f1f7bb64c9f202976bc85719fa6ddab4
2018-05-17 23:46:00 +09:00
Masayuki Nakano
0f41ff01e6 Bug 1460509 - part 74: Make HTMLEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: E3LGBAbaw7N

--HG--
extra : rebase_source : 2075312aad4062341272f95df2f19975c1b3779b
2018-05-17 23:21:52 +09:00
Masayuki Nakano
1f5ce6791d Bug 1460509 - part 73: Make HTMLEditRules::WillMakeList() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 6qTXENBW8tV

--HG--
extra : rebase_source : d4dcf5a10b2e9b735ee4a10fcc5faeefc3ab8c3c
2018-05-17 20:51:56 +09:00
Masayuki Nakano
a982f9c53c Bug 1460509 - part 72: Mark HTMLEditRules::WillRemoveList() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
Additionally, it creates AutoSelectionRestorer.  So, this patch adds
CanHandleEditAction() check after its caller since even if it returns
NS_OK, the editor might have been gone.

MozReview-Commit-ID: BgIbpHFFPE1

--HG--
extra : rebase_source : 010befdb34f8269f6f7fc24d1ae13eba4575aa69
2018-05-17 20:27:53 +09:00
Masayuki Nakano
c14d405f26 Bug 1460509 - part 71: Mark HTMLEditRules::WillMakeDefListItem() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: LrLmebLbwWm

--HG--
extra : rebase_source : 71c24de0975d74d5c843e9aa4074936ebbf166f2
2018-05-17 20:18:49 +09:00
Masayuki Nakano
f176f48d03 Bug 1460509 - part 70: Mark HTMLEditRules::WillMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 6mfoqUWync8

--HG--
extra : rebase_source : 39e601c8acea5fbb340727e833147a4148eb23e1
2018-05-17 20:01:19 +09:00
Masayuki Nakano
bb332ddad7 Bug 1460509 - part 69: Make HTMLEditRules::MakeBasicBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Gfnai2runLs

--HG--
extra : rebase_source : c207efa5d39a1b24077f61e61c14e951b5d6870b
2018-05-17 19:56:41 +09:00
Masayuki Nakano
b0c954a103 Bug 1460509 - part 68: Mark HTMLEditRules::DidMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 5ZxF0ArbnLU

--HG--
extra : rebase_source : 08b22aebdadbadaecbca446998b898e20f25726a
2018-05-17 19:05:26 +09:00
Masayuki Nakano
93cbe764ca Bug 1460509 - part 67: Mark HTMLEditRules::WillIndent() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 3lP4jp2nOQy

--HG--
extra : rebase_source : d59d4d56370266f454b498811cb82d346636e244
2018-05-17 18:34:00 +09:00
Masayuki Nakano
c46d6b402b Bug 1460509 - part 66: Make HTMLEditRules::WillCSSIndent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: nnnC5VDpk8

--HG--
extra : rebase_source : e7086f18ef64883b384b1823f9f2145c80629967
2018-05-17 18:27:35 +09:00
Masayuki Nakano
ba826bb7b6 Bug 1460509 - part 65: Make HTMLEditRules::WillHTMLIndent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 2jZh8GtC7BA

--HG--
extra : rebase_source : e0fe459ce72d2123dde811445193508c81b27102
2018-05-17 18:14:01 +09:00
Masayuki Nakano
0829b9a5a2 Bug 1460509 - part 64: Make HTMLEditRules::WillOutdent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch creates a new method, OutdentAroundSelection(), to check if
restoring Selection with AutoSelectionRestorer causes destroying the editor.
However, this does NOT change any logic in the new method except changing some
else-if blocks to if blocks with early-return style.

MozReview-Commit-ID: JMIo4kUOkwx

--HG--
extra : rebase_source : 0d628ebb866d7b63f8b78e6d701c27378a82dfb6
2018-05-17 17:57:09 +09:00
Masayuki Nakano
ea6085a0ab Bug 1460509 - part 63: Make HTMLEditRules::RemovePartOfBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to SplitRangeOffFromBlockAndRemoveMiddleContainer()
for making the name explain what it does.

MozReview-Commit-ID: 546dnCeoGOV

--HG--
extra : rebase_source : 7f0762cfa377a07d28342a1092ad0a7ee70fa108
2018-05-17 17:13:04 +09:00
Masayuki Nakano
7abbb58773 Bug 1460509 - part 62: Make HTMLEditRules::OutdentPartOfBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7IkBuQ6Tr3P

--HG--
extra : rebase_source : 603ff14905ccbd8242e6d6b1b6262e4e8fdda8d3
2018-05-17 16:53:18 +09:00
Masayuki Nakano
e0bed56f18 Bug 1460509 - part 61: Make HTMLEditRules::SplitBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to SplitRangeOffFromBlock() for making the name
explain what it does since "split" is used as splitting to two nodes widely
in editor.

MozReview-Commit-ID: GrRu5sI4yrP

--HG--
extra : rebase_source : 3ec27bce3769af518d3f1c317559fd89d379c539
2018-05-17 16:28:52 +09:00
Masayuki Nakano
100d1a3de0 Bug 1460509 - part 60: Make HTMLEditRules::ConvertListType() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 1xbR3f73NR1

--HG--
extra : rebase_source : 0a755c0fff5634513194c735dbb91061241abf9f
2018-05-17 14:28:47 +09:00
Masayuki Nakano
d24790beb0 Bug 1460509 - part 59: Make HTMLEditRules::CreateStyleForInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: GsBcGxfJhbb

--HG--
extra : rebase_source : 2be90309491187294d173c494b8da36257558cd0
2018-05-16 15:36:20 +09:00
Masayuki Nakano
72f5a20b04 Bug 1460509 - part 58: Make HTMLEditRules::WillAlign() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: L6rjqZABqsI

--HG--
extra : rebase_source : 068aa7391b6a7de21cb819bad8f62fe5053691b3
2018-05-16 15:23:52 +09:00
Masayuki Nakano
c97adaf670 Bug 1460509 - part 57: Mark HTMLEditRules::AlignInnerBlocks() as MOZ_MUST_USE since it may cause destroying the editor r=m_kato
MozReview-Commit-ID: 8hBJPn1shZu

--HG--
extra : rebase_source : 2df70cd07015fa0895a5d7540c1179107088a8e2
2018-05-16 14:54:33 +09:00