Commit Graph

1 Commits

Author SHA1 Message Date
Makoto Kato
91af9cea10 Bug 1424450 - Don't set selection on ClearStyle. r=masayuki
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
2018-04-18 16:13:24 +09:00