No one uses outputToStream even if c-c and BlueGriffon. We should remove this.
MozReview-Commit-ID: LEUtfc89DBe
--HG--
extra : rebase_source : f0c5aa918f577ca8a285afd2414fe3da6545fefc
No one uses postCreate from script even if c-c and BlueGriffon. So we should
devirtualize this
MozReview-Commit-ID: D3FKVEvG7Go
--HG--
extra : rebase_source : 9915a93ea8ae18bee251507a4c94fe66c0f03d0f
No one uses syncRealTimeSpell from script even if c-c and BlueGriffon. So
we should devirtualize this
MozReview-Commit-ID: AoOb165dOFa
--HG--
extra : rebase_source : e1a9dcdfa6cfe6c918a06a2738c38a6cb9441a1d
HTMLEditor::InsertElementAtSelection() doesn't check if selection is in
native anonymous subtree. Therefore, it could insert element into <input>
element etc.
This patch adds new API to EditorDOMPointBase to compute ancestor point which
is not in native-anonymous subtree and make
HTMLEditor::GetBetterInsertionPointFor() use it to not return point in any
native-anonymous subtrees.
Like this adds new comments into the method, we should optimize the method
since it may create a lot of transactions and dispatch a lot of mutation
events.
MozReview-Commit-ID: FknJfu6QCjS
--HG--
extra : rebase_source : 39dc110b1101134f7c704e64dbff89171fe50e47
According to existing comments, TextEditor::TypedText() and
HTMLEditor::TypedText() are intentional bottleneck to debug. However, only
for that purpose, it and its internal methods are made virtual. This really
doesn't make sense.
So, this patch creates TextEditor::OnInputText() for callers of TypedText()
with non-empty string, TextEditor::OnInputParagraphSeparator() for callers
of TypedText() with eTypeBreak (Enter key or insertParagraphSeparator),
HTMLEditor::OnInputLineBreak() for callers of TypedText() with eTypeBR
(Shift + Enter or insertLineBreak). Additionally, this creates internal
non-virtual methods for XPCOM methods which are used as internal methods of
TypedText(). One is InsertTextAsAction() for nsIPlatintextEditor.insertText().
the other is InsertParagraphSeparator() for nsIPlaintextEditor.insertLineBreak().
Although those new methods are not have "WithTransaction" postfix, they must
be clearer they'll use transactions since user input and actions should be
undo-able.
MozReview-Commit-ID: AmOkMqovIKA
--HG--
extra : rebase_source : 9c0f4b25fa2a36ad2f3394f72eb290824c31d82a
TextEditor::CreateBR() is just a wrapper of TextEditor::CreateBRImpl() for
automatically retrieving Selection of the editor.
And TextEditor::CreateBRImpl() should be renamed to
TextEditor::InsertBrElementWithTransaction() for making it clearer what
it does.
MozReview-Commit-ID: D8sjVdLrVrd
--HG--
extra : rebase_source : f269f5c3ce598d221d7263c111475dab0dd5f19f
Similar to EditorBase::ReplaceContainerWithTransaction(),
EditorBase::InsertContainerAbove() may set an attribute to newly created element
if it's specified. However, for avoiding the null check, let's make them
as references rather than pointers and treat nsGkAtoms::_empty as nullptr for
making the code safer.
This patch removes "Above" from the method name since it's redundant.
"Insert" sounds like inserting a node, and "Container" means to keep existing
children with new element in EditorBase.
MozReview-Commit-ID: 6EnkKHynYSP
--HG--
extra : rebase_source : d4b4c1a611c46a0f4d86389aab3331af565199d2
This patch renames EditorBase::MoveNode() to
EditorBase::MoveNodeWithTransaction() and redesign its parameters including
replacing a set of container node and offset in it to EditorDOMPointBase.
However, it takes magic number -1 as meaning end of the container.
Therefore, this patch adds MoveNodeToEndWithTransaction() for keeping the
callers simple.
MozReview-Commit-ID: BeTq5c7GQNN
--HG--
extra : rebase_source : b3a617a5a1a493cb0fcbefe2d9a9708b0257b1a8
The parameters of EditorBase::ReplaceContainer() are complicated. For example,
if it's specified as cloning all attributes, aAttribute and aValue are ignored
because CloneAttributes() removes all existing attributes but ReplaceContainer()
sets attributes before calling CloneAttributes(). This method has 3 modes:
1. Just replaces aOldContainer with new element.
2. #1 and clones all attributes from aOldContainer to the new element.
3. #1 and sets aAttribute of the new element to aValue.
Therefore, this patch creates 3 inline wrappers of the renamed method.
MozReview-Commit-ID: IsPu2uZuU8f
--HG--
extra : rebase_source : 02a23f48a91e0c9558126552a4c8d4b12c8b76bc
First, EditorBase::DeleteSelection() is never used since
TextEditor::DeleteSelection() overrides it but does not call it. So, this patch
makes EditorBase::DeleteSelection() only returns NS_ERROR_NOT_IMPLEMENTED.
Next, EditorBase::DeleteSelectionImpl() actually removes content for
TextEditor::DeleteSelection(). So, it should be named as
DeleteSelectionWithTransaction(). However, it'll be done in the following
patch. On the other hand, its callers are EditorBase::HandleKeyPressEvent()
and EditorBase::DeleteSelectionAndPrepareToCreateNode(). Fortunately, they
can be moved to TextEditor simply. Therefore this patch moves the methods
to TextEditor for making related methods in a place.
Then, we can make the implementation of nsIEditor::TextEditor() as a non-virtual
method, TextEditor::DeleteSelectionAsAction().
MozReview-Commit-ID: KXFDhW3G9lA
--HG--
extra : rebase_source : 15986979279b2cae3b61cda1bf6bf3d9e4987f3f
EditorBase::SplitNodeImpl() is called by SplitNodeTransaction::DoTransaction()
for actually splitting a node. However, "WithoutTransaction" postfix is really
redundant. Perhaps, just naming DoSplitNode() is better since "Impl" isn't
unclear and not useful if somebody wants to use it as a utility method and
there has already been EditorBase::SplitNode() which is an override of
nsIEditor::SplitNode(). It must not be good to use same name for different
purpose (EditorBase::SplitNode() creates a transaction).
MozReview-Commit-ID: Akjeyp52vVv
--HG--
extra : rebase_source : dcb29cec2749431b59068b670b68e5cd61b18588
This patch renames:
EditorBase::SplitNode() -> EditorBase::SplitNodeWithTransaction()
EditorBase::SplitNodeDeep() -> EditorBase::SplitNodeDeepWithTransaction()
HTMLEditRules::MaybeSplitAncestorsForInsert() ->
HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction()
Note it might be that some callers of those methods should be renamed too.
However, we should do it in follow up bug after landing those patches since
we can investigate it with searchfox.org after landing patches.
MozReview-Commit-ID: FfxCfaI85z5
--HG--
extra : rebase_source : 143960de45791c72dbf4d436f65e55452b4f7b10
EditorBase::CreateNode() creates an element node with transaction. I.e., it's
undoable. So, if somebody would use this method as a helper method for changing
the DOM tree, that would cause unexpected undoable transaction. So, we should
make the method name clearer to avoid such bug.
MozReview-Commit-ID: GZsOGBfqog
--HG--
extra : rebase_source : 8b7539a680ee88f3557acb0837fe1a021d842323
So, this patch replaces the setter with non-virtual method and removing the
getter since where is already non-virtual getter method.
MozReview-Commit-ID: Is19Yriz8t8
--HG--
extra : rebase_source : bb2f49f380ddb2e2f96e8690effd8d47d24ae0ae
This crash is that HTMLEditor::ClearStyle returns nullptr for aNode even if
successful.
When current start node and offset isn't within ancestor limiter,
HTMLEditor::ClearStyle will return nullptr for split node even if successful.
Because SplitNodeTransation returns error since Selection::Collapse is failed.
Then, SplitNodeDeep in HTMLEditor::SplitStyleAvovePoint returns error. But
this error is ignored. So node will becomes null even if successful.
CreateStyleForInsertText will set new selection when there is split node, so
we shouldn't set selection on ClearStyle.
Also, InsertNodeTransation is ignored for error when Collapse is failed, but
SplitNodeTransaction isn't ignored. We should create a rule when collapse is
failed on transaction.
And at feature, we shouldn't set selection in CreateStyleForInsertText, and
then, it should return new insertion point for InsertText instead of setting
new selection.
MozReview-Commit-ID: BRKWLqTfrvC
--HG--
extra : rebase_source : 2cd025e9d40688f643a843b39512dccc2bb7c4a2
This patch goes through and changes a bunch of places in our tree which mention
this bug to use the new feature, making the methods more strongly typed.
There are probably more places in tree which could be changed, but I didn't try
to find them.
It is unnecessary to get PresShell for nsStyleText, so we can return bool
instead of nsresult and can change it to static method.
MozReview-Commit-ID: LGrdcaJuLO
--HG--
extra : rebase_source : bb6b6d990741c7b478e9699ae84cc6b89a765bf7
Bug 768765 isn't enough for fix. Since Selection::GetAnchorFocusRange can
return nullptr, we should consider this condition.
And I cannot reproduce this using crash test, so I add mochitest for this.
MozReview-Commit-ID: 8Ei5YBIBuWv
--HG--
extra : rebase_source : cd11517f73179d949479716a83baec0e1f492eca
This is regression of bug 1423835.
When I fixed the bug, I accidentally changed the result of
HTMLEditRules::JoinNodesSmart() to use new API. However, it was simple
misunderstand. The original code sets the initial value of result to
{ aRightNode - aLeftNode.Length() } but I understood it as
{ aRightNode - aRightNode.Length() }. Therefore, this patch backs out the
patch only for this line.
MozReview-Commit-ID: 5rD7YFij8v
--HG--
extra : rebase_source : c11770892ab7416b9bf5d3329fc8b7b413387747
This method is not a virtual call, and also looks nicer.
This patch was mostly generated by a Python script, but I manually
cleaned up the code in a few places where statements didn't need to be
split across multiple lines any more.
MozReview-Commit-ID: 8JExxqSRc59
--HG--
extra : rebase_source : df6330a89e8d65dfe7a6fda0c8cb9f9732302efc
We should not use nsIDOMDocument if unnecessary. Because it needs QI to access
nsIDocument.
MozReview-Commit-ID: CMF3tmvBTB9
--HG--
extra : rebase_source : e832023be8d59a2c1e01bd423e6f058b0708dfe9
Also switch the XPCOM-y version of EventTarget::AddEventListner to a
Nullable<bool> for aWantsUntrusted.
The three-arg overload of AddEventListener in ContentFrameMessageManager was
never called, so all the AddEventListener overloads there are not needed.
MozReview-Commit-ID: 4IhqHmPVWzE
We can't have a null content in
ScrollbarActivity::StopListeningForScrollAreaEvents, because only viewport
frames have a null GetContent().
MozReview-Commit-ID: 9iAg0ivVqqG
For nsCSSAnonBoxes.cpp, nsCSSPseudoElements.cpp, nsDirectoryService.cpp, the
corresponding .h file includes nsStaticAtom.h. For the other files in this
patch, nsStaticAtom.h is not needed at all.
MozReview-Commit-ID: IpMmbXwZHhu
--HG--
extra : rebase_source : 46d0a6b40a41ee233adad7c205cf907fa27de34a
This is a simple bug of internal API of HTMLEditor. HTMLEditor::GetBlock()
tries to retrieve nearest ancestor block node (including itself) of a node.
HTMLEditor::GetBlock() may have ancestor limiter typically it's active
editing host to prevent to modify editing host or its ancestor accidentally.
However, it forgets to call HTMLEditor::GetBlockNodeParent() with the given
ancestor limit node. Therefore, if editing host is an inline element and
its parent is a block element, the editing host is split accidentally.
MozReview-Commit-ID: Ermmxdnk4KB
--HG--
extra : rebase_source : c9b57c5bb28cd63b6f16702317f7ddb7fb5a26f6
To reduce QI, I would like to replace nsIDOMNode with nsINode. And some
parameters in *DataTransder.cpp's methods is unused (it uses as nullptr),
so we should remove these parameters.
Also nsIDOMNodeList is unused now, so we should remove this including.
MozReview-Commit-ID: 1QTIkxDazjJ
--HG--
extra : rebase_source : 3961e897fcaa96975facc822821f1e223cab358d