Граф коммитов

8697 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 1f5ce6791d Bug 1460509 - part 73: Make HTMLEditRules::WillMakeList() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 6qTXENBW8tV

--HG--
extra : rebase_source : d4dcf5a10b2e9b735ee4a10fcc5faeefc3ab8c3c
2018-05-17 20:51:56 +09:00
Masayuki Nakano a982f9c53c Bug 1460509 - part 72: Mark HTMLEditRules::WillRemoveList() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
Additionally, it creates AutoSelectionRestorer.  So, this patch adds
CanHandleEditAction() check after its caller since even if it returns
NS_OK, the editor might have been gone.

MozReview-Commit-ID: BgIbpHFFPE1

--HG--
extra : rebase_source : 010befdb34f8269f6f7fc24d1ae13eba4575aa69
2018-05-17 20:27:53 +09:00
Masayuki Nakano c14d405f26 Bug 1460509 - part 71: Mark HTMLEditRules::WillMakeDefListItem() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: LrLmebLbwWm

--HG--
extra : rebase_source : 71c24de0975d74d5c843e9aa4074936ebbf166f2
2018-05-17 20:18:49 +09:00
Masayuki Nakano f176f48d03 Bug 1460509 - part 70: Mark HTMLEditRules::WillMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: 6mfoqUWync8

--HG--
extra : rebase_source : 39e601c8acea5fbb340727e833147a4148eb23e1
2018-05-17 20:01:19 +09:00
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
Masayuki Nakano b591f81cf5 Bug 1460509 - part 19: Make HTMLEditRules::AlignBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Additionally, this patch renames its specific enum class from ContentsOnly
to ResetAlignOf for making its target clearer.

MozReview-Commit-ID: KD4ndAsMClN

--HG--
extra : rebase_source : 302598397cf32893c7db18a6a014d0db862cb8f6
2018-05-12 10:58:57 +09:00
Masayuki Nakano d5d67de86f Bug 1460509 - part 18: Make HTMLEditRules::ChangeIndentation() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Additionally, this patch renames it to ChangeMarginStart() for making its
job clearer and add two inline wrapper methods.

MozReview-Commit-ID: L2GfLKhT6sa

--HG--
extra : rebase_source : d1d293f742214048ce5dfbbb7ebd50b0cbeed881
2018-05-12 10:29:41 +09:00
Masayuki Nakano dd74573897 Bug 1460509 - part 17: Make HTMLEditRules::WillAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the HTML editor r=m_kato
MozReview-Commit-ID: EGqb0hNpNnc

--HG--
extra : rebase_source : 97eeaca8b9386afe9ec320cd549d278955b69167
2018-05-11 20:25:01 +09:00
Masayuki Nakano 44d0e05143 Bug 1460509 - part 16: Make HTMLEditRules::DidAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: BBAvHn08og4

--HG--
extra : rebase_source : 5f4996be4be1813e382ec4180a583d5026dd7c63
2018-05-11 19:39:26 +09:00
Masayuki Nakano 8cb4cfda65 Bug 1460509 - part 15: Make HTMLEditRules::WillRemoveAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: DXzdtPQ01lo

--HG--
extra : rebase_source : 1fa36a1195aa7a6b5d891f83659af155b5bb16c0
2018-05-11 19:32:00 +09:00
Masayuki Nakano 531991202f Bug 1460509 - part 14: Make HTMLEditRules::WillRelativeChangeZIndex() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 8HEqK3DAPO4

--HG--
extra : rebase_source : bd1e3223b25d72ab0ef7728361fd9a9c3b8b12ab
2018-05-11 19:24:35 +09:00
Masayuki Nakano 285bb617db Bug 1460509 - part 13: Make TextEditRules::WillInsert() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
This patch also makes aCancel of TextEditRules::WillInsert() optional since
a lot of callers need to ignore the result.

MozReview-Commit-ID: JrvycxMQ9Mm

--HG--
extra : rebase_source : 9ecdc0fd363d9da33c12409f2993da9c58553598
2018-05-11 19:06:07 +09:00
Masayuki Nakano 21be173075 Bug 1460509 - part 12: Make TextEditRules::WillInsertBreak() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Ia5MJ465Hdf

--HG--
extra : rebase_source : 15daea3f4c4fe68e0c39e07fa7fdfca8b3ccaee5
2018-05-11 18:49:44 +09:00
Masayuki Nakano 29bc07945c Bug 1460509 - part 11: Make TextEditRules::CollapseSelectionToTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 3ulGUfu1af1

--HG--
extra : rebase_source : 0828f72d3c847d2c989ee8496567293e637ea3f8
2018-05-11 18:40:47 +09:00
Masayuki Nakano 6f6c32762e Bug 1460509 - part 10: Make TextEditRules::WillInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: RT0Bi9TBwt

--HG--
extra : rebase_source : d3c9657649dbce9ab8f872db9748a2d66d876f15
2018-05-11 18:29:54 +09:00
Masayuki Nakano d43e448993 Bug 1460509 - part 9: Make TextEditRules::WillSetText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 9ksPugTVVqh

--HG--
extra : rebase_source : 25089af1de8fc8429118e773df25ec2788cb75b9
2018-05-11 17:33:55 +09:00
Masayuki Nakano 04fbe5c6c1 Bug 1460509 - part 8: Make TextEditRules::WillDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
This patch creates internal method for it as DeleteSelectionWithTransaction()
because it needs to create SelectionBatcher and destruction of it may cause
destroying the editor.  Therefore, unfortunately, all callers of
DeleteSelectionWithTransaction() needs to check CanHandleEditAction()
manually.  If we could use try-catch, we could make it safer, though.

MozReview-Commit-ID: 13enOQjEzNn

--HG--
extra : rebase_source : 5a902026bcc507fbf9f1949fdcf33a98aabd9a0b
2018-05-11 17:15:53 +09:00
Masayuki Nakano b2219367ca Bug 1460509 - part 7: Make TextEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
And also this patch removes unnecessary arguments from the method.

MozReview-Commit-ID: UKscK4vFVX

--HG--
extra : rebase_source : 7f6b9405824a3f175f165a2d7d75a293108278f3
2018-05-11 16:48:29 +09:00
Masayuki Nakano d6057a85d0 Bug 1460509 - part 6: Make TextEditRules::RemoveRedundantTrailingBR() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: HpFo0SiTBWJ

--HG--
extra : rebase_source : 531116b0621557293f026f214601848a60602331
2018-05-11 16:36:07 +09:00
Masayuki Nakano 849d638e49 Bug 1460509 - part 5: Make TextEditRules::CreateTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: CNTgECam862

--HG--
extra : rebase_source : 633d729868f9cb6a287c45f98497e45a08ef2c95
2018-05-11 16:31:53 +09:00
Masayuki Nakano 349bf14f6b Bug 1460509 - part 4: Make TextEditRules::CreateBogusNodeIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
Note that HTMLEditRules::DocumentModifiedWorker() is a runnable method.
So, it cannot return nsresult.  Therefore, it just checks the result
only with NS_WARNING_ASSERTION().

MozReview-Commit-ID: KBSpv5H5KGU

--HG--
extra : rebase_source : b356ab04d0459214df9dbb3dbfb0e3eecc686348
2018-05-11 16:24:15 +09:00
Masayuki Nakano 2d5d9aed52 Bug 1460509 - part 3: Make TextEditRules::HideLastPWInput() return NS_ERROR_EDITOR_DESTROYED when it causes destroying the editor r=m_kato
And also this patch marks it as MOZ_MUST_USE.  All callers have to check if
the result is NS_ERROR_EDITOR_DESTROYED at least.

MozReview-Commit-ID: H4DfU1asPpe

--HG--
extra : rebase_source : c11cc00500aad44bd542147fb971e3cce4d634e2
2018-05-11 16:08:47 +09:00
Masayuki Nakano b2f86bbbe1 Bug 1460509 - part 2: Make TextEditRules::CreateBR() and TextEditRules::CreateMozBR() return both new <br> element node and error code since if they cause destroying the editor, each caller needs NS_ERROR_EDITOR_DESTROYED result r=m_kato
First, this patch changes TextEditRules::CreateBRInternal() to a private method
for making any callers use CreateBR() or CreateMozBR() instead.

Then, this patch makes TextEditRules::CreateBRInternal() return both nsresult
and created <br> element with CreateElementResult class.

Finally, this patch makes all callers of them check if they don't return an
error code including NS_ERROR_EDITOR_DESTROYED.

MozReview-Commit-ID: 18OvPmbDVHK

--HG--
extra : rebase_source : 328a91146539763cec317105b92aa3ce5d4b8233
2018-05-11 15:52:24 +09:00
Masayuki Nakano 9ac857639c Bug 1460509 - part 1: Declare NS_ERROR_EDITOR_DESTROYED error code and add a check method to TextEditRules whether it can keep handling edit action at a moment r=m_kato
This patch defines NS_ERROR_EDITOR_DESTROYED error code as an editor module
specific error code.

And creates TextEditRules::CanHandleEditAction() to check if the instance
can keep handling edit action.

MozReview-Commit-ID: 4qECwNBO0yz

--HG--
extra : rebase_source : a925a9b6840d4d06e2792b9fe276e062288b0806
2018-04-24 15:23:01 +09:00
Dorel Luca dc6d856805 Merge mozilla-inbound to mozilla-central. a=merge 2018-05-23 12:51:22 +03:00
Makoto Kato cac4fa86ed Bug 1463399 - Remove unused local variable in TextEditor::OutputToString. r=masayuki
Now RulesInfo uses nsAString, but old comment is "XXX Struct should store
a nsAReadable*".  We can remove unnecessary local variable of nsString.

MozReview-Commit-ID: C7gnTG7xTjU

--HG--
extra : rebase_source : e141bbcefd75d90b836668f710350d4362d66c76
2018-05-22 21:07:09 +09:00
Makoto Kato 71b2579c1e Bug 1463330 - Move CanPasteTransferable and PreDestroy to out of nsIEditor. r=masayuki
CanPasteTransferable and PreDestroy aren't used from script (inc. comm-central
and bluegriffon), so we should move these to out of nsIEditor.

MozReview-Commit-ID: GRfBobAm2qi

--HG--
extra : rebase_source : 812792ff43da24bfd9cb99c4b3127e6acdc43ba1
2018-05-22 18:23:21 +09:00
Kris Maglione 8340513b0c Bug 1463287: Add QueryInterface helper macro for concrete class types. r=bz
Using concrete class types with static IIDs in QueryInterface methods is a
pretty common pattern which isn't supported by any existing helper macros.
That's lead to separate ad-hoc implementations, with varying degrees of
dodginess, being scattered around the tree.

This patch adds a helper macro with a canonical (and safe) implementation, and
updates existing ad-hoc users to use it.

MozReview-Commit-ID: HaTGF7MN5Cv

--HG--
extra : rebase_source : ace930129d85960d22bc3048ca3bb19bbbd4a63e
extra : histedit_source : 03a87f746d957789d41381e4e1bfcc4fd7eebaf2%2C9c5bae9feeeef7721105db67be0f83e0ded66bb7
2018-05-21 16:33:18 -07:00
Kris Maglione 8134b33e89 Bug 1462964: Remove obsolete nsIDOMBlob interface. r=bz
MozReview-Commit-ID: 2HIlaSrvfBe

--HG--
extra : rebase_source : 944a6244dbfe1f0a37dd34a041d1329624a86f93
extra : histedit_source : d7859be664fed00f8504e40969480d3af3d674e7%2C4456b502db338bd06823654306e47c2583101396
2018-05-21 17:32:44 -07:00
Masayuki Nakano 8a70ae9bca Bug 1457083 - part 7: Remove methods of TextEditRules and HTMLEditRules, which just return NS_OK r=m_kato
Some Did*() of TextEditRules and HTMLEditRules do nothing except returning
NS_OK.  Let's remove them since there is no reason to keep them.

MozReview-Commit-ID: Jcdh5rnm5Yc

--HG--
extra : rebase_source : 54aedd8187edfa244bc8fbe8f560fb6ee064e9cf
2018-05-10 16:04:06 +09:00
Masayuki Nakano 16e2394c6e Bug 1457083 - part 6: Get rid of unnecessary Selection argument from all protected/private methods of TextEditRules and HTMLEditRules r=m_kato
Now, each protected/private method of TextEditRules and HTMLEditRules can
retrieve Selection instance safely and quickly.  Therefore, their pointer or
reference of Selection arguments are not necessary.  Therefore, this patch
removes them.

MozReview-Commit-ID: 1SPmKXmd7kz

--HG--
extra : rebase_source : 32dfd2d5e8b0667318a5b3766a8a7d8594bba8e7
2018-05-10 15:03:21 +09:00
Masayuki Nakano dd36848f80 Bug 1457083 - part 5: Make all users of Selection in TextEditRules and HTMLEditRules use TextEditRules::SelectionRef() r=m_kato
After this patch applies, most methods of TextEditRules and HTMLEditRules
don't need to take Selection as their arguments.  Therefore, next patch will
remove them.

MozReview-Commit-ID: 99r3ZkfG2In

--HG--
extra : rebase_source : 8666ded8f2e6954f2e3cf6bb1ba1cf3313f65e70
2018-05-08 17:30:05 +09:00
Masayuki Nakano 97763c2c92 Bug 1457083 - part 4: Replace mHTMLEditor in HTMLEditRules with HTMLEditorRef() r=m_kato
Although, this patch removes first check of mHTMLEditor in each method.  If
this causes some security issues, we should add now.  However, automated
tests don't indicate it.

Anyway, it should be fixed by bug 1454900 in same cycle.

MozReview-Commit-ID: 3LAtOQHyR5J

--HG--
extra : rebase_source : 48b78cb9477c6c47d23a864404ce95ca9edb8588
2018-04-27 01:42:22 +09:00
Masayuki Nakano 07772cd672 Bug 1457083 - part 3: Replace mTextEditor in TextEditRules with TextEditorRef() r=m_kato
This patch adds a debug methods to check if AutoSafeEditorData as expected and
inserting top of each method whose mTextEditor is replaced with TextEditorRef().

MozReview-Commit-ID: 8yjHsypLMRx

--HG--
extra : rebase_source : 0c07d18d102d6ffe6f4bc0cf50ad0dfca1f8bd4d
2018-04-27 00:09:10 +09:00
Masayuki Nakano 30e06e667e Bug 1457083 - part 2: Make all observer methods of HTMLEditRules create AutoSafeEditorData r=m_kato
Except HTMLEditRules::WillJoinNodes(), observer methods of HTMLEditRules
accesses mHTMLEditor.  Therefore, we need to make them create AutoSafeEditorData
instance in the stack.

Note that for reducing EditorBase::GetSelection() calls, this patch adds
Selection& argument to all of them.

MozReview-Commit-ID: 6mjuD2gZwVp

--HG--
extra : rebase_source : 56f16747a80927f0477b9b54f6088be719ed7b01
2018-04-26 23:27:50 +09:00
Masayuki Nakano 5f8ba21730 Bug 1457083 - part 1: Make public methods of TextEditUtils and HTMLEditUtils guarantee that the editor instance and selection instance won't be destroyed while it handles any edit actions r=m_kato
This patch creates a stack class in TextEditRules, its name is
AutoSafeEditorData and make all public methods (except editor observer methods)
which may change DOM tree, fire some DOM events or calling some XPCOM listeners
create its instance in the stack.  Then, it grabs associated editor instance
and its selection instance.

Next patch will make remaining public methods create AutoSafeEditorData.

MozReview-Commit-ID: 8oshdhL3ONQ

--HG--
extra : rebase_source : 591db71e45fe28ca93cbebd9bb7da8c16eae4466
2018-04-26 22:41:34 +09:00
Boris Zbarsky a02a40bdb5 Bug 1462737. Make AsElement() not compile when called on Element or some subclass. r=mccr8
It's just noise if we already have an Element.
2018-05-18 23:37:56 -04:00
Boris Zbarsky 2e09ba1f75 Bug 1377980 part 2. Remove most C++ use of nsIDOMRange. r=mccr8 2018-05-17 12:01:38 -04:00
Boris Zbarsky 40d2bf9d7f Bug 1377980 part 1. Remove use of nsIDOMRange in xpidl. r=mcc8 2018-05-17 12:01:37 -04:00
Makoto Kato bf208eff66 Bug 1423767 - Splitting node might be orphan. r=masayuki
SplitNodeDeepWithTransaction will split nodes until better point. But
this test case becomes that node is orphan into loop.  So I would like to
add more check whether parent is nothing.

MozReview-Commit-ID: EroSV4uVBVL

--HG--
extra : rebase_source : f594bdf7cd9efac7d10e6e05a8f87dadfc761295
2018-05-16 16:54:20 +09:00
Dorel Luca 0d2ff9e60d Merge mozilla-inbound to mozilla-central. a=merge 2018-05-16 00:54:22 +03:00
Emilio Cobos Álvarez 11794a944d Bug 1461701: Remove nsUpdateType and UPDATE_CONTENT_MODEL. r=smaug
MozReview-Commit-ID: 33iBMZqnkAc
2018-05-15 18:47:16 +02:00
Emilio Cobos Álvarez cb56e2c9f3 Bug 1459529: Remove UPDATE_STYLE. r=heycam
Now that BeginUpdate is useless for the UPDATE_STYLE case, we don't need the
update mechanism at all. Just ensure that ApplicableStylesChanged is called on
the pres shell via the relevant RuleChanged, etc. notifications.

There's a big hidden gotcha here. nsIDocument::BeginUpdate does put a script
blocker on the stack for these updates. However it's not needed, since no script
can run during these notifications (only the stylesheet events we post for
devtools, but those use AsyncEventDispatcher and PostDOMEvents, so they don't
try to run immediately).

nsIDocument::BeginUpdate also does XBL binding attached queue stuff, but we
can't change bindings during these notifications anyway, so it also doesn't
matter.

MozReview-Commit-ID: HJvK6zQfloh
2018-05-15 18:44:29 +02:00
Emilio Cobos Álvarez 2054320f28 Bug 1459529: Make sheets be associated to a shadow root too potentially. r=bz
MozReview-Commit-ID: Cd8xJuLRY5w
2018-05-15 18:44:25 +02:00
Adrian Wielgosik 3a8ef6cf8a Bug 1460940 - Remove nsIDOMDocument uses in editor/. r=bz
MozReview-Commit-ID: 8doC9drkrG9

--HG--
extra : rebase_source : 24ac8ea960faff10b04ef0f419bc6dc7b6556452
2018-05-11 19:46:15 +02:00
Emilio Cobos Álvarez 5aab8db970 Bug 1408301: Remove getPropertyCSSValue. r=bz
It's been removed for a while on Nightly without any known regressions. This
gives us a full beta cycle of telemetry and two nightly cycles without the API
before shipping.

This only removes the API, followup work will replace serialization by Servo's,
and remove the remaining DOM interfaces.

MozReview-Commit-ID: 2m1taYg5xEr
2018-05-12 11:23:47 +02:00
Cosmin Sabou a916fb7c3e Merge inbound to mozilla-central. a=merge 2018-05-09 20:27:38 +03:00
Chris Peterson 87ddcb8273 Bug 1457813 - Part 3: Remove NS_PRECONDITION definition. r=froydnj
--HG--
extra : rebase_source : 9bad9e57e2e0363fb315949ac73b869fac0b9a73
2018-05-08 22:21:22 -07:00
Boris Zbarsky 1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky a44e6132ff Bug 1387143 part 28. Remove nsISelection::AsSelection(). r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky b47b72dae9 Bug 1387143 part 23. Remove nsISelection collapse* methods. r=mats 2018-05-08 13:52:41 -04:00