Commit Graph

5366 Commits

Author SHA1 Message Date
Masayuki Nakano
bb332ddad7 Bug 1460509 - part 69: Make HTMLEditRules::MakeBasicBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Gfnai2runLs

--HG--
extra : rebase_source : c207efa5d39a1b24077f61e61c14e951b5d6870b
2018-05-17 19:56:41 +09:00
Masayuki Nakano
b0c954a103 Bug 1460509 - part 68: Mark HTMLEditRules::DidMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 5ZxF0ArbnLU

--HG--
extra : rebase_source : 08b22aebdadbadaecbca446998b898e20f25726a
2018-05-17 19:05:26 +09:00
Masayuki Nakano
93cbe764ca Bug 1460509 - part 67: Mark HTMLEditRules::WillIndent() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 3lP4jp2nOQy

--HG--
extra : rebase_source : d59d4d56370266f454b498811cb82d346636e244
2018-05-17 18:34:00 +09:00
Masayuki Nakano
c46d6b402b Bug 1460509 - part 66: Make HTMLEditRules::WillCSSIndent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: nnnC5VDpk8

--HG--
extra : rebase_source : e7086f18ef64883b384b1823f9f2145c80629967
2018-05-17 18:27:35 +09:00
Masayuki Nakano
ba826bb7b6 Bug 1460509 - part 65: Make HTMLEditRules::WillHTMLIndent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 2jZh8GtC7BA

--HG--
extra : rebase_source : e0fe459ce72d2123dde811445193508c81b27102
2018-05-17 18:14:01 +09:00
Masayuki Nakano
0829b9a5a2 Bug 1460509 - part 64: Make HTMLEditRules::WillOutdent() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch creates a new method, OutdentAroundSelection(), to check if
restoring Selection with AutoSelectionRestorer causes destroying the editor.
However, this does NOT change any logic in the new method except changing some
else-if blocks to if blocks with early-return style.

MozReview-Commit-ID: JMIo4kUOkwx

--HG--
extra : rebase_source : 0d628ebb866d7b63f8b78e6d701c27378a82dfb6
2018-05-17 17:57:09 +09:00
Masayuki Nakano
ea6085a0ab Bug 1460509 - part 63: Make HTMLEditRules::RemovePartOfBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to SplitRangeOffFromBlockAndRemoveMiddleContainer()
for making the name explain what it does.

MozReview-Commit-ID: 546dnCeoGOV

--HG--
extra : rebase_source : 7f0762cfa377a07d28342a1092ad0a7ee70fa108
2018-05-17 17:13:04 +09:00
Masayuki Nakano
7abbb58773 Bug 1460509 - part 62: Make HTMLEditRules::OutdentPartOfBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7IkBuQ6Tr3P

--HG--
extra : rebase_source : 603ff14905ccbd8242e6d6b1b6262e4e8fdda8d3
2018-05-17 16:53:18 +09:00
Masayuki Nakano
e0bed56f18 Bug 1460509 - part 61: Make HTMLEditRules::SplitBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to SplitRangeOffFromBlock() for making the name
explain what it does since "split" is used as splitting to two nodes widely
in editor.

MozReview-Commit-ID: GrRu5sI4yrP

--HG--
extra : rebase_source : 3ec27bce3769af518d3f1c317559fd89d379c539
2018-05-17 16:28:52 +09:00
Masayuki Nakano
100d1a3de0 Bug 1460509 - part 60: Make HTMLEditRules::ConvertListType() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 1xbR3f73NR1

--HG--
extra : rebase_source : 0a755c0fff5634513194c735dbb91061241abf9f
2018-05-17 14:28:47 +09:00
Masayuki Nakano
d24790beb0 Bug 1460509 - part 59: Make HTMLEditRules::CreateStyleForInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: GsBcGxfJhbb

--HG--
extra : rebase_source : 2be90309491187294d173c494b8da36257558cd0
2018-05-16 15:36:20 +09:00
Masayuki Nakano
72f5a20b04 Bug 1460509 - part 58: Make HTMLEditRules::WillAlign() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: L6rjqZABqsI

--HG--
extra : rebase_source : 068aa7391b6a7de21cb819bad8f62fe5053691b3
2018-05-16 15:23:52 +09:00
Masayuki Nakano
c97adaf670 Bug 1460509 - part 57: Mark HTMLEditRules::AlignInnerBlocks() as MOZ_MUST_USE since it may cause destroying the editor r=m_kato
MozReview-Commit-ID: 8hBJPn1shZu

--HG--
extra : rebase_source : 2df70cd07015fa0895a5d7540c1179107088a8e2
2018-05-16 14:54:33 +09:00
Masayuki Nakano
7fd1c21f25 Bug 1460509 - part 56: Make HTMLEditRules::AlignBlockContents() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Jn4m4uTdLtW

--HG--
extra : rebase_source : dcaa6a6ebfb34965053680b12fbaa0236ac604a6
2018-05-16 14:45:34 +09:00
Masayuki Nakano
bfe1ba2a3d Bug 1460509 - part 55: Make HTMLEditRules::AfterEditInner() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 2qdCWOdMseM

--HG--
extra : rebase_source : 1fe675fe0251abbbad4c86d743c08013eb89d7bb
2018-05-16 14:32:47 +09:00
Masayuki Nakano
fad6eb8411 Bug 1460509 - part 54: Make HTMLEditRules::WillInsert() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Mhim8mp1aw

--HG--
extra : rebase_source : e96c75ab6ebbb8d3a18f4cc762ec71a2680534bc
2018-05-16 14:21:21 +09:00
Masayuki Nakano
b646b85754 Bug 1460509 - part 53: Make HTMLEditRules::WillInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 22xxFFECNbi

--HG--
extra : rebase_source : 2dfe0cf975be32e729f7c22e97ff1a177cb9ab29
2018-05-16 14:05:10 +09:00
Masayuki Nakano
fc5224c601 Bug 1460509 - part 52: Make HTMLEditRules::LoadHTML() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: IKjTmm738Yg

--HG--
extra : rebase_source : 1c70229fa7db244ec9837474fc579da06f4d6fdb
2018-05-16 13:56:33 +09:00
Masayuki Nakano
f7c89adb71 Bug 1460509 - part 51: Make HTMLEditRules::WillInsertBreak() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 2oTOmT4HSv7

--HG--
extra : rebase_source : 06d1a35ae77830e95952732b5a6882bd700df448
2018-05-16 13:49:56 +09:00
Masayuki Nakano
55c30fa4e2 Bug 1460509 - part 50: Make HTMLEditRules::InsertBRElement() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7C3iy7T04M9

--HG--
extra : rebase_source : fb0a1701a3a897017f357d360f6191c39d168e6d
2018-05-16 01:47:54 +09:00
Masayuki Nakano
cd8e95a56b Bug 1460509 - part 49: Make HTMLEditRules::SplitMailCites() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 1Jy6bHAmtkT

--HG--
extra : rebase_source : 0d399f7bf088eda4abf36491a137d265cadd9e5d
2018-05-16 01:30:44 +09:00
Masayuki Nakano
24e8d0ebc1 Bug 1460509 - part 48: Make HTMLEditRules::CheckForEmptyBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Additionally, this patch renames it to MaybeDeleteTopMostEmptyAncestor() for
making its name explain what it does.

MozReview-Commit-ID: 1i7zeq9In2T

--HG--
extra : rebase_source : 8d9de9e6154038a993be636c3cedf950a6efd179
2018-05-16 00:10:11 +09:00
Masayuki Nakano
88e74d4d62 Bug 1460509 - part 47: Make HTMLEditRules::ExpandSelectionForDeletion() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: BdumFS7Rluv

--HG--
extra : rebase_source : cac8969335de207283cb818dc47b359554777753
2018-05-15 19:15:56 +09:00
Masayuki Nakano
1448107d77 Bug 1460509 - part 46: Make HTMLEditRules::NormalizeSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 5yf1ZJ5sQ1t

--HG--
extra : rebase_source : 7542fbae0bb5bae0ee545ff1af72a5a7ea47ff19
2018-05-15 18:59:27 +09:00
Masayuki Nakano
981ebf6352 Bug 1460509 - part 45: Test if HTMLEditRules::PromoteRange() won't get range in Selection r=m_kato
PromoteRange() related methods do not change Selection nor the DOM tree.
Therefore, they must be safe.  However, only PromoteRange() takes an nsRange
instance and modifies it.  If it's in Selection, that causes selectionchange
event.  Therefore, we should check if given range is in Selection with
MOZ_ASSERT().

MozReview-Commit-ID: AXkmHFB4P08

--HG--
extra : rebase_source : 539b39d0217a7dc06f76e70546096d30b2734c02
2018-05-15 18:39:27 +09:00
Masayuki Nakano
d388cab96a Bug 1460509 - part 44: Make HTMLEditRules::GetNodesForOperation() and related methods return NS_ERROR_EDITOR_DESTROYED if they cause destroying the editor r=m_kato
Despite of the name of GetNodesForOperation() and related methods, it changes
the DOM tree if their aTouchContent is TouchContent::yes (by default).
Therefore, they should return NS_ERROR_EDITOR_DESTROYED if they cause destroying
the editor and all callers should check the result.  Therefore, this patch mark
them as MOZ_MUST_USE.

Additionally, because of importance of aTouchContent, this patch makes the
arguments not optional.  This change must make other developers being careful
to use them.  (Although TouchContent does not feel dangerous.  We should rename
it to make its risk clearer.)

On the other hand, this patch removes aTouchContent from
GetParagraphFormatNodes() since it's always called with TouchContent::no.
Therefore, this method is always safe.

Although I tried to document those methods, but I have not understood them
completely yet.  Perhaps, we should redesign them in another bug both to
learn them and making them faster and simpler.

MozReview-Commit-ID: 4vknJGUdwEe

--HG--
extra : rebase_source : 486949005283548697e6eeb7175f6189a66defaa
2018-05-15 18:07:34 +09:00
Masayuki Nakano
278c709e0b Bug 1460509 - part 43: Make HTMLEditRules::BustUpInlinesAtRangeEndpoints() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: CSYCey8ugA8

--HG--
extra : rebase_source : ed2ace9e445f750b317ab984707c3c44b12bd72b
2018-05-15 17:21:08 +09:00
Masayuki Nakano
7e4a66f58c Bug 1460509 - part 42: Make HTMLEditRules::BustUpInlinesAtBRs() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 5KGPE8mPqge

--HG--
extra : rebase_source : 9de693ba99508ebc5b5c235cbc2ed589676fc045
2018-05-15 17:04:28 +09:00
Masayuki Nakano
6ce0d49219 Bug 1460509 - part 41: Make HTMLEditRules::ReturnInHeader() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: r03QSPXsZ2

--HG--
extra : rebase_source : 76b3a2043c8ffaa44bf861cd9e32256bba545ec1
2018-05-15 16:36:53 +09:00
Masayuki Nakano
0e442165f7 Bug 1460509 - part 40: Make HTMLEditRules::ReturnInParagraph() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: cnR8uXTfno

--HG--
extra : rebase_source : 5fdca1b01b3b37fd997f8686a03ada6079410e96
2018-05-15 16:22:59 +09:00
Masayuki Nakano
6c48f47e99 Bug 1460509 - part 39: Make HTMLEditRules::SplitParagraph() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 38hfUl88xXI

--HG--
extra : rebase_source : 7086a0f907487a74bc4656ec3f27fee99727af19
2018-05-15 16:15:35 +09:00
Masayuki Nakano
23b339760b Bug 1460509 - part 38: Make HTMLEditRules::ReturnInListItem() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Jl0oiBCuYPb

--HG--
extra : rebase_source : 825ea4d5bf571752b77b80d759bfe4071f902b6e
2018-05-15 15:32:11 +09:00
Masayuki Nakano
2a52edcc52 Bug 1460509 - part 37: Make HTMLEditRules::MakeBlockquote() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 3pUx52d6EYd

--HG--
extra : rebase_source : 160cfd6bcdd00572c4242ed8cd8721dbee43ba76
2018-05-15 15:09:13 +09:00
Masayuki Nakano
d7b703771c Bug 1460509 - part 36: Make HTMLEditRules::RemoveBlockStyle() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: KDfxeD9k0UN

--HG--
extra : rebase_source : 2ec8c6fb2b8803e56605ebdeee5aacce5cd323f9
2018-05-15 00:43:07 +09:00
Masayuki Nakano
6cb4ec14c0 Bug 1460509 - part 35: Make HTMLEditRules::ApplyBlockStyle() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 1ddHNx7lF9P

--HG--
extra : rebase_source : 660c205f47473daade92145385d047d482ded72e
2018-05-15 00:08:46 +09:00
Masayuki Nakano
76e7240d35 Bug 1460509 - part 34: Make HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7MqtKPNAOZ1

--HG--
extra : rebase_source : e66f057754082e0b28f14311462a84516c06cc37
2018-05-14 23:55:53 +09:00
Masayuki Nakano
a3320a815b Bug 1460509 - part 33: Make HTMLEditRules::JoinNearestEditableNodesWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Unfortunately, we need to make it take out argument for returning new first
child point of right node.  If we can create JoinNodesResult which have
nsresult and EditorDOMPoint, we can avoid that, but EditorBase::JoinNodes()
does not want it.  So, even if we create such class, only 2 callers of the
methods are its users...

MozReview-Commit-ID: 1zwVZ0FriwN

--HG--
extra : rebase_source : 1f7867774f9a30bec78596b0282717435e7223c0
2018-05-14 23:51:23 +09:00
Masayuki Nakano
f82870c55b Bug 1460509 - part 32: Mark HTMLEditRules::CacheInlineStyles() as MOZ_MUST_USE since it may cause destroying the editor and returns NS_ERROR_EDITOR_DESTROYED in such case r=m_kato
MozReview-Commit-ID: FJHxJ1j02l1

--HG--
extra : rebase_source : e881022bc486e3a8446afff6e3014dad6a79d292
2018-05-14 23:24:40 +09:00
Masayuki Nakano
5c4be41f42 Bug 1460509 - part 31: Make HTMLEditRules::GetInlineStyles() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 3Nk1gBttuwM

--HG--
extra : rebase_source : b9e0d63683407d9e5440157309cb61d213524223
2018-05-14 23:20:28 +09:00
Masayuki Nakano
d13545d1b1 Bug 1460509 - part 30: Make HTMLEditRules::ReapplyCachedStyles() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: HSv2els7Lys

--HG--
extra : rebase_source : 716cf33ab9ef344d4ba40400eda7379c6a2ff85e
2018-05-14 23:14:50 +09:00
Masayuki Nakano
deb2c6e032 Bug 1460509 - part 29: Make HTMLEditRules::AdjustSpecialBreaks() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to
InsertBRElementToEmptyListItemsAndTableCellsInChangedRange().

MozReview-Commit-ID: 1DGhcI93YAk

--HG--
extra : rebase_source : caa675a5b02c18e9ca57171294bdaf48e7563dc0
2018-05-14 22:56:06 +09:00
Masayuki Nakano
603b4cc93a Bug 1460509 - part 28: Make HTMLEditRules::AdjustWhitespace() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 6dFP6BYDXMg

--HG--
extra : rebase_source : 1e16de2a3a1289a638cd4b157c5f099170fa831f
2018-05-14 22:42:08 +09:00
Masayuki Nakano
9490ca976d Bug 1460509 - part 27: Make HTMLEditRules::PinSelectionToNewBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: GW0xI5BBxqU

--HG--
extra : rebase_source : 44ffab9c212c1210b0a8e8bf63254622fd883281
2018-05-14 22:37:33 +09:00
Masayuki Nakano
314c0524b5 Bug 1460509 - part 26: Make HTMLEditRules::AdjustSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: JCEvhhxNBgg

--HG--
extra : rebase_source : 8c6972c8367ce0e44fdc1edcb2b18174e7da2930
2018-05-14 19:25:48 +09:00
Masayuki Nakano
4d9d37891e Bug 1460509 - part 25: Make HTMLEditRules::RemoveEmptyNodes() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And this patch renames it to RemoveEmptyNodesInChangedRange().

MozReview-Commit-ID: Kr2xmUOH1ZZ

--HG--
extra : rebase_source : 59a0a70360c6e0d426c329f4be757c2c0eac96c4
2018-05-14 19:07:59 +09:00
Masayuki Nakano
5f681e9b5d Bug 1460509 - part 24: Make HTMLEditRules::PopListItem() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 2655OlPmteT

--HG--
extra : rebase_source : 464469593c4ed9fc58f75191cab47a72314001a8
2018-05-14 18:18:24 +09:00
Masayuki Nakano
3608fb3fbd Bug 1460509 - part 23: Make HTMLEditRules::RemoveListStructure() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: JLfjjtQS6Ar

--HG--
extra : rebase_source : a62dcf9cfa48c7c361efd80f76af7032703205e2
2018-05-14 17:47:21 +09:00
Masayuki Nakano
cf3ad1d97a Bug 1460509 - part 22: Mark HTMLEditRules::InsertBRIfNeededInternal() and its wrappers as MOZ_MUST_USE r=m_kato
MozReview-Commit-ID: 4ueY3i1QFuD

--HG--
extra : rebase_source : adfa0f9e6ffbcde2f050703cd01e70ee4b05c5cc
2018-05-12 11:56:56 +09:00
Masayuki Nakano
8f32e9e8a5 Bug 1460509 - part 21: Make HTMLEditRules::RemoveAlignment() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: JV2vdZXoYIL

--HG--
extra : rebase_source : 959b56974c5d9229cb371e3791b645c7db54c3cf
2018-05-12 11:39:01 +09:00
Masayuki Nakano
5983a789e1 Bug 1460509 - part 20: Make HTMLEditRules::MakeSureElemStartsAndEndsOnCR() and HTMLEditRules::MakeSureElemStartsOrEndsOnCR() return NS_ERROR_EDITOR_DESTROYED if they cause destroying the editor r=m_kato
MozReview-Commit-ID: I8HcvO9IB7x

--HG--
extra : rebase_source : 6ca2e3a58b84a150504c73a17bda6cc825a10176
2018-05-12 11:25:23 +09:00