inlineTableEditingEnabled and refreshInlineTableEditingUI are used by
bluegriffon, but other methods aren't used by m-c, c-c and bluegriffon.
So I would like to remove these methods. Then we can clean up
DoInlineTableEditingAction.
MozReview-Commit-ID: 3R0bJDU5vqv
--HG--
extra : rebase_source : 74c7615613bba65326069929cb53c3ea48f2e9a4
extra : amend_source : a1ac9af3de50daa0cbfd98e2790afa402d9932ef
mozInlineSpellChecker listens to only DidSplitNode() and DidJoinNodes().
So, EditorBase should call them directly rather than treating it as an
nsIEditActionListener since its runtime cost becomes really cheaper.
Different from EditorSpellCheck, nobody creates instance of
nsIInlineSpellChecker. So, we can now stop supporting createInstance() for it
in chrome JS and should do this since EditorBase cannot support multiple
mozInlineSpellChecker instances without nsIEditActionListener interface.
Therefore, this patch removes the entry from factory.
MozReview-Commit-ID: W1CLdsJaaB
--HG--
extra : rebase_source : 2319999e4b1fc8978386c49236d5d24d78d86047
Currently, first edit action listener is always TextServicesDocument for
EditorBase::mInlineSpellChecker if spell check is enabled and it requires
only DidDeleteNode() and DidJoinNodes(). So, in most cases, EditorBase
should call only them to avoid running redundant for loops for
nsIEditActionListener methods.
This patch makes that EditorBase::AddEditActionListener() and
RemoveEditActionListener() check whether coming nsIEditActionListener is
TextServicesDocument for mInlineSpellChecker. If so, EditorBase should
store it as reference to TextServicesDocument. And when edit action occurs,
its DidDeleteNode() and DidJoinNodes() should be called directly.
Unfortunately, this patch makes TextServiceDocument's maintaining rules
complicated. However, it must be really rare case to add new edit action
listener because it's really old component.
Note that EditorSpellCheck may be created multiple instances for an editor
from chrome JS. Therefore, we need to keep TextServicesDocument being
derived from nsIEditActionListener because in such case, TextServicesDocument
for other EditorSpellCheck instances should be supported via
nsIEditActionListener even though such case makes EditorBase slower.
MozReview-Commit-ID: KtlXsBCOzKL
--HG--
extra : rebase_source : 6827ed09a028f2049fd7afba2f5116d092bd14e5
EditorBase::mInlineSpellChecker is always an instance of mozInlineSpellChecker.
Fortunately, it's easy to expose mozInlineSpellChecker.h. So, making EditorBase
store it as mozInlineSpellChecker directly, EditorBase can access any of
mozInlineSpellChecker, EditorSpellCheck, mozSpellChecker and
TextServicesDocument with new accessors created by following patch.
MozReview-Commit-ID: 2oyS5tPeQcg
--HG--
extra : rebase_source : a9ce2e4dbceff7ca800d34d60d56eba184298677
Most nsIEditActionListener::Will*() are not implemented, except
WillDeleteText() and WillDeleteSelection() which are implemented by
FinderHighlighter. So, we can get rid of the other Will*() from it.
This patch removes a lot of unnecessary virtual calls and copy of strong
pointers to edit action listeners of EditorBase.
MozReview-Commit-ID: EsqI2tZoBG1
--HG--
extra : rebase_source : cf78eb8d33b12ca65177b0676f6e45d02e7c0688
HTMLEditRules implements only some of nsIEditActionListener and this is always
first edit action listener. So, if we make EditorBase treat HTMLEditRules
directly before notifying edit action listeners, we can save a lot of runtime
cost (virtual calls especially unnecessary, copying array of edit action
listeners with strong pointer, redundant QIs), although the code becomes not
beautiful.
Perhaps, we should do same thing to nsTextServicesDocument and
mozInlineSpellChecker in other bugs.
MozReview-Commit-ID: Eveaxj398f2
--HG--
extra : rebase_source : 0b7b66ba1002e08591e8d95ef68b216e7ce1f93b
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
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