Commit Graph

24 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
45787fc53f Bug 1454241: Remove nsINode::eDATA_NODE. r=bz
MozReview-Commit-ID: 6HQDAwiGgIo
2018-04-20 03:58:00 +02:00
Boris Zbarsky
b06aa7e061 Bug 1446533 part 1. Rename nsGenericDOMDataNode to CharacterData. r=mystor
This is not renaming the files yet; that will be a separate changeset.

MozReview-Commit-ID: 5TxkEiQlaKF
2018-03-19 15:18:06 -04:00
Adrian Wielgosik
3c2cc07d2d Bug 1379891 - remove nsPIEditorTransaction interface, GetTxnDescription methods. r=m_kato,masayuki
MozReview-Commit-ID: 4NLeMrrqIv5
2018-01-14 16:01:41 +01:00
Masayuki Nakano
e376af4b27 Bug 1425412 - part 12: Create factory methods for DeleteRangeTransaction, EditAggregateTransaction and PlaceholderTransaction for consistency with the other transaction classes r=m_kato
Although, we don't need factory methods for DeleteRangeTransaction,
EditAggregateTransaction nor PlaceholderTransaction, for consistency with the
other transaction classes, they should have factory methods for making easier
to write the code.

For not making the performance slow down, they should be inline methods.

MozReview-Commit-ID: 7jl5yZNFYmP

--HG--
extra : rebase_source : 7cd5b5e268a670b3c8855407cc72dec12d34d8ff
2017-12-18 18:08:43 +09:00
Masayuki Nakano
015555162f Bug 1425412 - part 6: Create DeleteNodeTransaction::MaybeCreate() and remove EditorBaseTransaction::CreateTxnForDeleteNode() r=m_kato
EditorBaseTransaction::CreateTxnForDeleteNode() just hides what it does.
Instead, let's create a factory method, DeleteNodeTransaction::MaybeCreate()
for making callers clearer.

MozReview-Commit-ID: 8WUYN0BjKSU

--HG--
extra : rebase_source : e0ff8b8434b720dc124c770cd7371d84b949ca8d
2017-12-15 21:24:33 +09:00
Masayuki Nakano
6b8e286ddc Bug 1425412 - part 5: Create some factory methods of DeleteTextTransaction and remove EditorBase::CreateTxnForDeleteText() and EditorBase::CreateTxnForDeleteCharacter() r=m_kato
DeleteTextTransaction should have 3 factory methods.  One is, simply to create
an instance with a pair of offset and length.  The others are, to create an
instance for deleting a previous or next character at offset.

The former was EditorBase::CreateTxnForDeleteText() and the latter was
EditorBase::CreateTxnForDeleteCharacter(), but this patch creates
DeleteTextTransaction::MaybeCreate() for the former,
DeleteTextTransaction::MaybeCreateForPreviousCharacter() and
DeleteTextTransaction::MaybeCreateForNextCharacter() for the latter.

MozReview-Commit-ID: DFELbmAJDo3

--HG--
extra : rebase_source : 1600984c704b460e1cc09777b81df2906c154cce
2017-12-15 20:43:26 +09:00
Masayuki Nakano
7c53b094a1 Bug 1415414 - Make DeleteRangeTransaction::CreateTxnsToDeleteBetween() and DeleteRangeTransaction::CreateTxnsToDeleteContent() use RawRangeBoundary as their arguments r=m_kato
By the fix of bug 1407352, DeleteRangeTransaction::CreateTxnsToDeleteBetween()
starts to use child node instead of a set of container node and offset in it.
However, this is ugly and using RawRangeBoundary may reduce computing offset
more.  So, they should use RawRangeBoundary to refer delete points.

MozReview-Commit-ID: pwDHOxpz0E

--HG--
extra : rebase_source : 3871ba4fa3cfb174d5dac57822ae69c40a305323
2017-11-08 15:01:23 +09:00
Ehsan Akhgari
959b55b795 Bug 1407352 - Avoid calling GetChildAt() in DeleteRangeTransaction::CreateTxnsToDeleteBetween(); r=masayuki 2017-10-11 01:49:55 -04:00
Masayuki Nakano
33d778a999 Bug 1377989 - part12: Rename local variables, |endParent| which is set to start container of nsRange to |endContainer| r=smaug
This does NOT change variable names like |endNode| because it's not odd and somebody use it for nsINode and endContent for nsIContent.  So, changing them needs more work.

MozReview-Commit-ID: 22imUltlu5R

--HG--
extra : rebase_source : 6c93069d0586b37c5084eaa71861085c01da7a7d
2017-07-12 00:08:37 +09:00
Masayuki Nakano
3fd54e5d5f Bug 1377989 - part11: Rename local variables, |startParent| which is set to start container of nsRange to |startContainer| r=smaug
This does NOT change variable names like |startNode| because it's not odd and somebody use it for nsINode and startContent for nsIContent.  So, changing them needs more work.

MozReview-Commit-ID: H19pTDprRuT

--HG--
extra : rebase_source : 7a7454ac14da48a597ff19a50c863d04dcaddd6e
2017-07-12 00:02:14 +09:00
Masayuki Nakano
4ee17d1b8c Bug 1377989 - part2: Rename nsRange::GetEndParent() to nsRange::GetEndContainer() r=smaug
MozReview-Commit-ID: K4qPjtZ62yO

--HG--
extra : rebase_source : 8653db98b9bd70c77a6aac8d906f401f0222c58a
2017-07-11 21:11:37 +09:00
Masayuki Nakano
2f2ce53be5 Bug 1377989 - part1: Rename nsRange::GetStartParent() to nsRange::GetStartContainer() r=smaug
Web standards use "Container" instead of "Parent".  So, nsRange shouldn't use "Parent" for its members and methods.

MozReview-Commit-ID: Ho6N0diuWtE

--HG--
extra : rebase_source : ee4eb7068a68b118c7fe98e9e9e7fa9c9e7f13e2
2017-07-11 20:53:04 +09:00
Boris Zbarsky
15cb86a93f Bug 1349940. DeleteRangeTransaction should not keep its range alive longer than it needs to. r=masayuki, a=kwierso
MozReview-Commit-ID: 283P59EDFPW
2017-03-24 16:07:11 -04:00
Masayuki Nakano
e877ded333 Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug
Edit transactions should store their editor instance with strong reference and they should be released at destroying the editor.

MozReview-Commit-ID: D67KU8WFxyo

--HG--
extra : rebase_source : 28c8a37498cad9f2e308eb4416cef76cf395bb9c
2017-03-21 19:00:36 +09:00
Masayuki Nakano
566c4af32a Bug 1345690 part.3 Rename DeleteTextTransaction::Init() to DeleteTextTransaction::CanDoIt() since it does not initialize anything and just checking if the text node is editable r=m_kato
MozReview-Commit-ID: EyqHjHF3Q8G

--HG--
extra : rebase_source : 8004a067bf7fb8aedef8dc67d9ebb72ce5f89755
2017-03-10 13:38:28 +09:00
Masayuki Nakano
22a5d6332f Bug 1345690 part.2 Make the constructor of DeleteRangeTransaction initialize all members instead of Init() r=m_kato
Similar to DeleteNodeTransaction, DeleteRangeTransaction should take all necessary information as its arguments.  However, different from DeleteNodeTransaction, this doesn't need to implement CanDoIt() since nobody checks the state.

MozReview-Commit-ID: 2Z9fNtGeJ9c

--HG--
extra : rebase_source : fe3f75126a8975a0edb00a6c0709134b0a0f4d87
2017-03-09 11:19:39 +09:00
Masayuki Nakano
579b4d1fcb Bug 1345690 part.1 Make the constructor of DeleteNodeTransaction initialize all necessary members instead of Init() r=m_kato
I'd like to make mNodeToDelete an owning-non-null member, but it's not cycle collector aware.  Therefore, this patch only changes mEditorBase from pointer to reference.

MozReview-Commit-ID: H3wxmN1t92s

--HG--
extra : rebase_source : ca9984b47c9d242f82e395773a9a7f534e60c022
2017-03-10 13:23:40 +09:00
Makoto Kato
054bbb8432 Bug 1332984 - Clean up usage of nsIDOMCharacterData into editor. r=masayuki
Some uses nsIDOMCharacterData to get the attribute of text node.  But, by using Text object, we don't need nsIDOMCharacter.  So we should use Text object instead of nsIDOMCharacterData instead if possible.

MozReview-Commit-ID: 1cwTUcecFj3

--HG--
extra : rebase_source : 2b3745c1aa71ccaca7def3d10e9ad655b4987991
2017-01-23 14:14:30 +09:00
Masayuki Nakano
2773c4d0ef Bug 1310618 Replace nsresult variables |res| with |rv| under editor/ r=Ehsan
In our coding rules, variable names of nsresult should be rv.  Indeed, when you see |rv| in the code, you must assume that its type if nsresult.

However, a lot of code under editor/ uses |res| for the variables of nsresult.  Let's replace |res| with |rv|.

And this patch improves following points:

1. When |rv| is set in both |if| and |else| block and they are check outside of them, this moves the check into each |if| and |else| block because even if the failure is notified with warning, you cannot see which case was performed and failed.  This change makes it clear.

2. When |return rv;| returns non-error code because |rv| is checked with NS_ENSURE_SUCCESS() immediately before, setting replacing it with |return NS_OK;| is clearer.

3. Move declaration of |nsresult rv| into smaller scope as far as possible.  This prevents setting rv to unexpected value and easier to check its value at reading the code.

MozReview-Commit-ID: 9MAqj7sFey3

--HG--
extra : rebase_source : 0fd316b851ea616b3a95d8c1afc111ff55e11993
2016-10-19 18:09:33 +09:00
Masayuki Nakano
f382711dc3 Bug 1260651 part.59 Rename nsEditor to mozilla::EditorBase (and also their file names) r=mccr8
This patch also renames:

EditorInputEventDispatcher -> mozilla::EditorInputEventDispatcher

And some variable names are renamed from aEditor or mEditor to aEditorBase or mEditorBase for making their types clearer.

MozReview-Commit-ID: 2FCXWpLMn8e

--HG--
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/EditorBase.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/EditorBase.h
2016-07-08 13:10:13 +09:00
Masayuki Nakano
452819e0f2 Bug 1260651 part.39 Rename nsRangeUpdater to mozilla::RangeUpdater r=mccr8
MozReview-Commit-ID: 8xPhGbSSOjx
2016-06-24 15:01:40 +09:00
Masayuki Nakano
68abedfd73 Bug 1260651 part.30 Rename EditAggregateTxn to mozilla::EditAggregateTransaction (and their files too) r=mccr8
MozReview-Commit-ID: TPiBS0eEI4

--HG--
rename : editor/libeditor/EditAggregateTxn.cpp => editor/libeditor/EditAggregateTransaction.cpp
rename : editor/libeditor/EditAggregateTxn.h => editor/libeditor/EditAggregateTransaction.h
2016-07-07 17:11:30 +09:00
Masayuki Nakano
c893a72e05 Bug 1260651 part.22 Rename mozilla::dom::DeleteTextTxn to mozilla::DeleteTextTransaction (and their files too) r=mccr8
MozReview-Commit-ID: 6WNiA7N3a9Y

--HG--
rename : editor/libeditor/DeleteTextTxn.cpp => editor/libeditor/DeleteTextTransaction.cpp
rename : editor/libeditor/DeleteTextTxn.h => editor/libeditor/DeleteTextTransaction.h
2016-07-07 15:20:22 +09:00
Masayuki Nakano
aab723f475 Bug 1260651 part.21 Rename DeleteRangeTxn to mozilla::DeleteRangeTransaction (and their files too) r=mccr8
MozReview-Commit-ID: IYFkzr95E6U

--HG--
rename : editor/libeditor/DeleteRangeTxn.cpp => editor/libeditor/DeleteRangeTransaction.cpp
rename : editor/libeditor/DeleteRangeTxn.h => editor/libeditor/DeleteRangeTransaction.h
2016-07-07 14:56:53 +09:00