comm-central and bluegriffon don't use mosueDown, mouseUp and mouseMove in
nsIHTMLObjectResizer, so we should remove these methods from this interface.
MozReview-Commit-ID: BnSkkH7f0xc
--HG--
extra : rebase_source : 40811e1a0b714e3ef30fd9ac5e4f840241de3780
AutoMoveNodeSelNotify doesn't allow container is null. So we should reject
that parent of moving node is null.
MozReview-Commit-ID: DGNCicLJxuK
--HG--
extra : rebase_source : eea203f16d0296c74d0727f34b6ddc5c165f9092
This crashtest case hits assertion in SelAdjInsertNode due to invalid offset
point. So we check whether this is valid.
Also, SelAdjCreateNode and SelAdjInsertNode should use EditorRawDOMPoint to avoid offset calculation and check valid offset.
MozReview-Commit-ID: A1kaKEzc36e
--HG--
extra : rebase_source : c46843fdd6e9e18f49b9cedb008cda6cf3436811
This crash occurs when CreateNode returns nullptr that is error. So we should
check whether this method is failure.
MozReview-Commit-ID: 9jDOnEYSurG
--HG--
extra : rebase_source : a7f2f9797267befe99f7f794c524efdf7bf331c0
c-c and bluegriffon don't use this method, so let's remove it to clean up.
MozReview-Commit-ID: BC5Ooy2Jlb9
--HG--
extra : rebase_source : 86e49ef864d5c78049673924c385e6cdbd0cb215
Some methods in CSSEditUtils are unused now, so let's remove it.
MozReview-Commit-ID: H4HiqL6hW9K
--HG--
extra : rebase_source : 80e10ba5e6de5fcc5032dc2e08fa84bf26e80795
Actually, PopItem uses nsString to store attribute name. And when using it,
it converts to nsAtom by NS_Atomize and compare by nsString.
To reduce calculation of atom and string compare, we should store atom directly.
MozReview-Commit-ID: 8OB02mgMg1r
--HG--
extra : rebase_source : 9861217804acac52106a89cad75e08bd547080ad
extra : histedit_source : 2b9f01cf29b1b09dd07fc771ff94a06be4d94f31
WSRunObject::ConvertToNBSP() inserts an NBSP, then, removes following ASCII
whitespaces. When inserting an NBSP, mutation observer may change the
text node. In this case, it shouldn't keep working on removing ASCII
whitespaces because it may causes unexpected result.
This patch also renames ConvertToNBSP() and GetAsciiWSBounds() to
InsertNBSPAndRemoveFollowingASCIIWhitespaces() and
GetASCIIWhitespacesBounds() for making their jobs clearer.
MozReview-Commit-ID: TVy9fEKL6p
--HG--
extra : rebase_source : f0bce124055a86caca57334f06c75a46098f69ac
nsIEditRules is a super class of only mozilla::TextEditRules and not scriptable.
So, we can get rid of it.
This patch merges RulesInfo with TextRulesInfo and name new class is RulesInfo
for minimizing the code change.
Additionally, adds two methods AsHTMLEditRules() and its const version.
They make existing cast code safer.
MozReview-Commit-ID: KwWH3ADj3Bv
--HG--
extra : rebase_source : 4517bdc95b530530e9756e07c4b6cce78c002073
HTMLEditRules::IsEmptyBlock() won't return error in most cases. Additionally,
HTMLEditRules::WillInsertBreak() doesn't check it. So, just returning bool
is simpler.
MozReview-Commit-ID: 5DfRv7lIyuS
--HG--
extra : rebase_source : 8b430d88a92fd5830a0b9f1bc1d46ac31e45c12c
Despite of its name, HTMLEditor::IsVisTextNode() returns true with its out
argument when the given text node is empty. And although it returns nsresult,
it's almost always NS_OK because it returns error only when the editor isn't
usual condition.
So, it should return bool and true when the given text node is visible.
This patch separates the method. One is for checking the node with frames,
called IsInVisibleTextFrames(). The other is for checking it only with
its text, called IsVisibleTextNode().
MozReview-Commit-ID: EdQmkOxfNxO
--HG--
extra : rebase_source : ad9d42f6c8a8e17145f0ca92cd5c02994f8a6b37
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
This patch creates factory methods for ChangeStyleTransaction and removes
CSSEditUtils::CreateCSSPropertyTxn().
MozReview-Commit-ID: 1h8ZAj2PP5O
--HG--
extra : rebase_source : 3da3070ad179bac1aadbfc6984b4c2922a052ec0
This patch creates factory methods for AddStyleSheetTransaction and
RemoveStyleSheetTransaction, and removes EditorBase::CreateTxnForAddStyleSheet()
and EditorBase::CreateTxnForRemoveStyleSheet() instead.
MozReview-Commit-ID: 6dnZctDtNik
--HG--
extra : rebase_source : 43eaadbde06e4a0b061ea8136e12ffeccfaf5592
This patch creates two factory methods of ChangeAttributeTransaction. One is
for setting an attribute to specific value. The other is for removing an
attribute. So, EditorBase::CreateTxnForSetAttribute() and
EditorBase::CreateTxnForRemoveAttribute() are unnecessary anymore.
MozReview-Commit-ID: 2fEVd3pDXsf
--HG--
extra : rebase_source : 674005a5b9fc623999a0f51dc8697027970f06c9
EditorBase::CreateTxnForJoinNode() just hides what it does.
For making the caller clearer, let's create a factory method,
JoinNodeTransaction::MaybeCreate().
MozReview-Commit-ID: 8vADXdzMeuV
--HG--
extra : rebase_source : 6a281aff11bfa019c292d26cadd0cd29da12753f
SplitNodeTransaction::Create() just hides what it does. For making its caller
clearer, let's create a factory method, SplitNodeTransaction::Create().
MozReview-Commit-ID: KDiC8dDrLuQ
--HG--
extra : rebase_source : ac04544e10644b8a73375fb2b786e0bc86eb56ae
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
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
EditorBase::CreateTxnForComposition() just hides what it does. For its caller,
creating a factory method, CompositionTransaction::Create(), is clearer what
it does.
Additionally, capsuling the creation in CompositionTransaction class can make
the text node information in TextComposition updated automatically. So, now,
it might be better to update them in DoTransaction() because there is a lag
between creating the transaction and calling DoTransaction(). However, this
patch doesn't want to change any existing behavior. So, this doesn't fix this
issue.
MozReview-Commit-ID: K8ci7ytwh1u
--HG--
extra : rebase_source : d468a0fc997c99f78f7eb46451082e7f1e052890
EditorBase::CreateTxnForCreateElement() just hides what it does. Let's make
the caller what it does with creating CreateElementTransaction::Create().
MozReview-Commit-ID: DYcfQV6KiUZ
--HG--
extra : rebase_source : d3f31b8db92bd3b2af464c66e064dd7b21018960
EditorBase::CreateTxnForInsertNode() just hides what it does. Let's create
InsertNodeTransaction::Create() and make the caller clearer.
MozReview-Commit-ID: 2J2WV73cdsm
--HG--
extra : rebase_source : 15b6391aee5beca4401e7c7a4ee8bf350a7590fd
EditorBase::CreateTxnForInsertText() just hides what it exactly does.
Rewriting it with a static factory method, InsertTextTransaction::Create()
should be clearer for its caller.
MozReview-Commit-ID: Er7Zlhtbnb0
--HG--
extra : rebase_source : 9dc71b3baab839f61153b96806fac5baae5d46cb
The only caller is HTMLEditor::IsEmptyNodeImpl(). So, we can get rid of it.
MozReview-Commit-ID: GTJiXwSCrwM
--HG--
extra : rebase_source : a44b277547d0641f244ff363f5cde8ae44b13eda
mInlineEditedCell for inline table editor is still nsIDOMElement. To avoid QI
and virtual call, we should replace it with Element.
MozReview-Commit-ID: 76yfQJxwm9d
--HG--
extra : rebase_source : e89de17faa20d16a8823e1016b6ba8a6f78993b6
Most arguments of the constructor of CompositionTransaction are now stored by
EditorBase::mComposition. So, making it take TextComposition reduces the
number of its arguments.
Note that this patch doesn't make it retrieve TextComposition with
EditorBase::GetComposition() for guaranteeing that the editor has non-nullptr
mComposition.
MozReview-Commit-ID: 3O5wL52UBUy
--HG--
extra : rebase_source : 7f48465ef3f2f040e8c526fb7837060ecb6c9147
EditorBase stores a text node, offset in it and length in it of composition
string directly. However, this wastes memory space if user never uses IME
or user only sometimes uses IME. Additionally, storing all data in
TextComposition is better than current design when other classes like
CompositionTransaction wants some information of both EditorBase and
TextComposition.
This patch moves those 3 members from EditorBase to TextComposition.
MozReview-Commit-ID: 4N7wmGGfxmt
--HG--
extra : rebase_source : bd7cb37fe9631b959ec21da40c20751fec269dca
nsIEditorSpellCheck still uses wstring. We should replace it with AString
to avoid additional memory allocation.
MozReview-Commit-ID: H4jKY2tylqg
--HG--
extra : rebase_source : c1f0325eb2efbfb07f53514b96121a5ceb58efd4
HTMLEditRules::StandardBreakImpl() should take |const EditorDOMPoint&| to
specify where a new <br> element inserted before.
Additionally, we should rename it to InsertBRElement().
MozReview-Commit-ID: 4BR7xGFFrpk
--HG--
extra : rebase_source : 873af2c4167227a570878fe03d6dec61dffe9528
TextEditRules has some wrappers of TextEditor::CreateBR(). Also they should
take |const EditorRawDOMPoint&| to specify the insertion point of new <br>
element.
Additionally, this patch makes them just return add-refed Element instead of
nsresult. So, we can get rid of out param from it.
MozReview-Commit-ID: 3wfKGaTM89c
--HG--
extra : rebase_source : 47f0d89bc16f0858c7141b2035164adb9105493c
TextEditor::CreateBR() should take |const EditorRawDOMPoint&| to specify the
insertion point instead of a set of container node and offset in it.
MozReview-Commit-ID: 4PrWzwmIgfD
--HG--
extra : rebase_source : c509907002693f3b77cd00bf77cfd0f26704fd65
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
EditorDOMPointBase::Container() may return nullptr. So, it should be renamed
to GetContainer().
Then, the method name becomes longer and a lot of callers access the result
directly. So, there should be following methods to make the callers shorter:
- GetContainerAsContent() to return the container as nsIContent*.
- GetContainerAsElement() to return the container as dom::Element*.
- GetContainerAsText() to return the container as dom::Text.
- GetContainerAsDOMNode() to return the container as nsIDOMNode*.
- CanContainerHaveChildren() to check if the container can have child nodes.
- IsInDataNode() to check if the point is in a data node including text node.
- IsInTextNode() to check if the point is in a text node.
- IsContainerHTMLElement() to check if the container is specific HTML element.
- IsContainerAnyOfHTMLElements() to check if the container is one of the
specified HTML elements.
MozReview-Commit-ID: LkN2WBbCPj0
--HG--
extra : rebase_source : 9da1e70d4c74f7ad573e244cf6c7b21a0c7b4410
Editor code sometimes sets a DOM point to end of a node. In this case, we
need to write |Set(node, node->Length())|. So, it should have
|void SetToEndOf(const nsINode* aContainer)| for making meaning of the code
clearer.
MozReview-Commit-ID: 91shMCD2d84
--HG--
extra : rebase_source : 3401af50aabc1b677deeae664e8c56506182d28c