Граф коммитов

30 Коммитов

Автор SHA1 Сообщение Дата
Boris Zbarsky 9525cabcc3 Bug 1432186 part 15. Remove nsIDOMNode::HasChildNodes. r=mccr8
MozReview-Commit-ID: GFc2sv4E7b2
2018-01-29 23:10:51 -05:00
Masayuki Nakano b2a3e52b16 Bug 1430021 - part 1: Move |RefPtr<TextEditRules> mRules| from TextEditor to EditorBase r=m_kato
For calling some methods of mRules from EditorBase, let's move mRules member
from TextEditor to EditorBase.

Unfortunately, TextEditRules.h depends on EditAction which is declared in
EditorBase.h and that caused unnecessary include hell of EditorBase.h.  So,
let's move it to an independent header file.

MozReview-Commit-ID: 5HiSZLP9WHH

--HG--
extra : rebase_source : 3e2c40385a6f3d6d1e03ef4e213434383bb37d5f
2018-01-12 19:01:04 +09:00
Chris Peterson 37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Masayuki Nakano 6b577ea0fa Bug 1423835 - part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild() r=m_kato
Different from RangeBoundaryBase, EditorDOMPointBase can store only child node.
I.e., mOffset may be invalid until its Offset() is called.  So,
GetChildAtOffset() isn't good name.  It should be just GetChild().

Similarly, GetNextSiblingOfChildAtOffset() and
GetPreviousSiblingOfChildAtOffset() should be renamed to GetNextSiblingOfChild()
and GetPreviousSiblingOfChild().

MozReview-Commit-ID: WpkPmDwkrL

--HG--
extra : rebase_source : 2be1fcbee129f4c96e9b166be5a924845340708f
2017-12-07 19:08:56 +09:00
Masayuki Nakano c06378ebc9 Bug 1413181 - part 13: HTMLEditRules::MaybeSplitAncestorsForInsert() should be able to return a DOM point in text node r=m_kato
HTMLEditRules::MaybeSplitAncestorsForInsert() may be called with a point in a
text and it needs to return given split point as is.  Additionally, the given
point may be in a text node.  So, it may not be represented with an
nsCOMPtr<nsIContent>.

Therefore, we need to add new member, EditorDOMPoint, to SplitNodeResult and
when MaybeSplitAncestorsForInsert() needs to return the given point as is,
it should use it.

Note that if the methods which return SplitNodeResult split some nodes actually,
the left node and/or the right node may be removed from the DOM tree.  In this
case, EditorDOMPoint cannot store such orphan node.  Therefore, we cannot
make mNextNode nor mPreviousNode EditorDOMPoint.

MozReview-Commit-ID: LwH8RZzkrmT

--HG--
extra : rebase_source : a5ae2328bef3d887c0bf4e1b9c4a4247b93a4ac0
2017-11-19 11:05:26 +09:00
Masayuki Nakano 419273aff1 Bug 1413181 - part 10: Redesign EditorBase::SplitNodeDeep() r=m_kato
First of all, this patches fixes a bug of EditorBase::CreateNode().  It takes
|EditorRawDOMPoint&| but it should be |const EditorRawDOMPoint&| for making
callers can specify temporary instances.

Next, this patch creates |SplitNodeResult| stack class for result of
EditorBase::SplitNodeDeep().  SplitNodeDeep() needs to return previous node
and next node of split point.  They are called as left node and right node,
but these calls are really different term usage.  Therefore, this patch names:

aOutLeftNode -> SplitNodeResult::GetPreviousNode()
aOutRightNode -> SplitNodeResult::GetNextNode()

and also declares SplitNodeResult::GetLeftNode() and
SplitNodeResult::GetRightNode() which are same meaning as left/right node of
other splitting methods.

Additionally, of course, this patch makes SplitNodeDeep() use
|const EditorRawDOMPoint&| to receive the start point of right node.

MozReview-Commit-ID: FnJpeKgtzm4

--HG--
extra : rebase_source : 3829e5528ef837b13fed305e0df1dbbf00e02a07
2017-11-16 12:09:57 +09:00
Masayuki Nakano 365f79c262 Bug 1414713 - EditorUtils::IsDescendantOf() should take EditorDOMPoint and EditorRawDOMPoint as out param r=catalinb,m_kato
EditorUtils::IsDescendantOf() current takes a pointer to offset or a pointer to
child content if the caller needs to know the child of the most ancestor node.

However, some callers should get a child as EditorDOMPoint or EditorRawDOMPoint.
Then, they can be used for some editor methods which need to take child node
for performance optimization.

This patch makes EditorUtils::IsDescendantOf() as only two overloads.  One takes
pointer to EditorRawDOMPoint as optional out argument.  The other takes pointer
to EditorDOMPoint as an out param.

Additionally, this creates new constructor of AutoTrackDOMPoint for making it
can treat EditorDOMPoint directly.

MozReview-Commit-ID: IsAGTUvKI19

--HG--
extra : rebase_source : 97469a21b974c6a1dd515ab472bbc4a88c1899c8
2017-11-06 17:01:33 +09:00
Masayuki Nakano 8b6c211c36 Bug 1408544 - part 1: Reimplement EditorDOMPoint as a subclass of RangeBoundary r=catalinb,m_kato
A lot of methods in editor returns a child offset with an out param when it
returns its container and offset in the container.  This is ugly hack for
performance of nsINode::IndexOf().  However, there are a lot of regression
since the relation between offset and child node can be broken really easily.

So, we should make EditorDOMPoint as a subclass of RangeBoundary and manage
a set of container, reference child and its offset in it (e.g.,
SetNextSibling() added by this patch).

Note that RangeBoundary's performance is not good for temporary use if we set
a point with offset, it immediately retrieves mRef.  The following patch will
improve this performance.

MozReview-Commit-ID: 7mcJ1P1OjVr

--HG--
rename : editor/libeditor/EditorUtils.h => editor/libeditor/EditorDOMPoint.h
extra : rebase_source : 785094fcfc592d9e5b48cbc36ed225dbb8bb4111
2017-11-01 14:41:03 +09:00
Nicholas Nethercote d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Ehsan Akhgari b174b2306a Bug 1392867 follow-up: Document that the aChild argument won't get AddRef'ed
DONTBUILD
2017-08-24 18:39:24 -04:00
Ehsan Akhgari 07f926500c Bug 1392867 - Part 1: Add an overload of EditorUtils::IsDescendantOf() which returns an nsIContent* out argument for the child node found instead of its index in the parent; r=masayuki 2017-08-23 01:00:07 -04:00
Masayuki Nakano e1a21d5a3e Bug 1387317 - part5: AutoPlaceHolderBatch should take EditorBase instead of nsIEditor r=m_kato
AutoPlaceHolderBatch can take EditorBase class and its inherited class, AutoEditBatch, can be removed if we implement other constructor which doesn't take transaction name.

Additionally, nsIEditor::(Begin|End)PlaceHolderTransaction() are referred only by AutoPlaceHolderBatch.  Therefore, they can be non-public methods and removed from nsIEditor interface.

Note that this patch also repalces "PlaceHolder" with "Placeholder" since it's a word.

MozReview-Commit-ID: 5dw3kcX3bOx

--HG--
extra : rebase_source : e926cc1c2ebea70eb08e43778a8b52912b559b7b
2017-08-14 14:56:39 +09:00
Makoto Kato db293de97e Bug 1375131 - Part 1. Store ranges before using on loop. r=masayuki
This crash occurs that range is nullptr.

DeleteNonTableElements will update selection and range, so we shouldn't use range count before modifying selection.  So we should save range data for loop.

MozReview-Commit-ID: C9c4TZqRvUc

--HG--
extra : rebase_source : cbadc6d6d82e1c904c20309f2e82f2b6c2f438e7
2017-06-27 17:34:18 -07:00
Masayuki Nakano c5fbe1617e Bug 1374207 - part3: Editor classes should use concrete classes instead of nsI*Editor r=m_kato
HTMLEditor inherits some interface classes.  Therefore, CachedWeakPtr is confused at ambiguous conversion from HTMLEditor to nsISupports.  Therefore, this patch adds second parameter to the template class.

MozReview-Commit-ID: KGSYJHfp1L5

--HG--
extra : rebase_source : 7189372c4c06218c3040701196eac51ded85d3fa
2017-06-22 15:02:59 +09:00
Masayuki Nakano e8b4d6d5fe Bug 1316302 part.3 Create EditActionResult class for making the methods which return nsresult, handled and canceled with out params r=smaug
In a lot of places, edit action handlers and their helper methods return nsresult and aHandled and aCanceled with out params.  However, the out params cause the code complicated since:

* it's not unclear if the method will overwrite aHandled and aCanceled value.
* callers need to create temporary variable event if some of them are not necessary.

This patch rewrites the helper methods of HTMLEditRules::WillDeleteSelection() with it.

MozReview-Commit-ID: CJv75KdOdXf

--HG--
extra : rebase_source : 708d378bdd0ddc4ae984de9294525b01a829b0b7
2016-11-18 17:59:23 +09:00
Masayuki Nakano 7f30e926b8 Bug 1260651 part.60 editor/libeditor should export some headers which are required by other modules and other modules shouldn't use local include for them r=mccr8
MozReview-Commit-ID: FZSExwkHH2B
2016-07-08 14:03:31 +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 28ebbbd99b Bug 1260651 part.13 Rename nsAutoPlaceHolderBatch to mozilla::AutoPlaceHolderBatch r=mccr8
MozReview-Commit-ID: E8IlZjFSFRU
2016-06-23 18:51:19 +09:00
Masayuki Nakano 59116ec004 Bug 1260651 part.12 Rename nsAutoEditBatch to mozilla::AutoEditBatch r=mccr8
MozReview-Commit-ID: 2hoz88UAS6w
2016-06-23 18:46:58 +09:00
Masayuki Nakano 647af800b3 Bug 1260651 part.11 Rename nsAutoSelectionReset to mozilla::AutoSelectionRestorer r=mccr8
MozReview-Commit-ID: LA4ou7vnVXG
2016-07-07 13:27:31 +09:00
Masayuki Nakano 04f769e958 Bug 1260651 part.10 Rename nsAutoRules to mozilla::AutoRules r=mccr8
MozReview-Commit-ID: u3MVijmoBv
2016-06-23 18:15:42 +09:00
Masayuki Nakano 6e4532ff79 Bug 1260651 part.9 Rename nsAutoTxnsConserveSelection to mozilla::AutoTransactionsConserveSelection r=mccr8
MozReview-Commit-ID: JEJkPY36vfF
2016-06-23 18:01:23 +09:00
Masayuki Nakano 7f703927e1 Bug 1260651 part.8 Rename nsAutoUpdateViewBatch to mozilla::AutoUpdateViewBatch r=mccr8
MozReview-Commit-ID: GsisMrwLlET
2016-07-07 13:09:51 +09:00
Masayuki Nakano 7796d97cfc Bug 1260651 part.7 Rename nsBoolDomIterFunctor to mozilla::BoolDomIterFunctor r=mccr8
MozReview-Commit-ID: EFQMDbDMLmT
2016-06-23 17:39:47 +09:00
Masayuki Nakano 111252de4a Bug 1260651 part.6 Rename nsDOMIterator to mozilla::DOMIterator r=mccr8
MozReview-Commit-ID: 6wBVUivS4xY
2016-06-23 17:30:39 +09:00
Masayuki Nakano 2997e5fed4 Bug 1260651 part.5 Rename nsDOMSubtreeIterator to mozilla::DOMSubtreeIterator r=mccr8
MozReview-Commit-ID: EGb5Lx4teaS
2016-06-23 17:25:03 +09:00
Masayuki Nakano 009f9d9992 Bug 1260651 part.4 Rename nsTrivialFunctor to mozilla::TrivialFunctor r=mccr8
MozReview-Commit-ID: B37mZ5otKHU
2016-06-23 17:19:35 +09:00
Masayuki Nakano caafdafcc5 Bug 1260651 part.3 Rename DOMPoint to mozilla::EditorDOMPoint because same name class is used in other modules widely r=mccr8
MozReview-Commit-ID: 9ZyVTv7veuK
2016-06-23 17:13:03 +09:00
Masayuki Nakano c4605a4cb2 Bug 1260651 part.2 Rename nsEditorHookUtils to mozilla::EditorHookUtils r=mccr8
MozReview-Commit-ID: 1BRj1wcBljc
2016-06-23 16:59:15 +09:00
Masayuki Nakano 9771fba160 Bug 1260651 part.1 Rename nsEditorUtils to mozilla::EditorUtils (and their files too) r=mccr8
MozReview-Commit-ID: 7Z48LHQBRo7

--HG--
rename : editor/libeditor/nsEditorUtils.cpp => editor/libeditor/EditorUtils.cpp
rename : editor/libeditor/nsEditorUtils.h => editor/libeditor/EditorUtils.h
extra : rebase_source : e53301378ab6001cdb126c5cc8742b7cadfbbccc
extra : source : 0147a9c79800924614157f1fa74cda3b9397f688
2016-07-07 11:49:42 +09:00