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

8812 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 235de70472 Bug 1467693 - Merge EditorBase::SwitchTextDirection() and EditorBase::SwitchTextDirectionTo() r=m_kato
There are two similar methods, but they are created with copy & paste.
So, the common code should be merged into new method, SetTextDirection().

Additionally, EditorBase::SwitchTextDirection() is a scriptable method but
nobody uses this from JS.  So, we can make it from nsIEditor and this
patch renames it to ToggleTextDirection() since current name is too
similar to SwitchTextDirectionTo().

MozReview-Commit-ID: BX3M1OKxiD5

--HG--
extra : rebase_source : 74a5ff65adc96ba69792f2e63daf14828c505270
2018-06-07 23:26:59 +09:00
Masayuki Nakano a6f0eec408 Bug 1467691 - Make some methods of EditorBase non-public r=m_kato
This moves NotifyEditorObservers() and GetInputEventTargetContent() into
protected member which should not be used by friends.

And also this moves IsModifiableNode() into protected member which can be
used by friends.

MozReview-Commit-ID: AxDBgTVED3V

--HG--
extra : rebase_source : 979c6cb0d075b3fd0106bd1c381aa3ef3b98ba78
2018-06-06 13:30:44 +09:00
Masayuki Nakano bb000aa73b Bug 1467690 - Make HTMLEditor use MaybeCollapseSelectionAtFirstEditableNode(false) instead of BeginningOfDocument() r=m_kato
HTMLEditor::BeginningOfDocument() is an XPCOM method and it just calls
MaybeCollapseSelectionAtFirstEditableNode(false).  So, HTMLEditor can call
MaybeCollapseSelectionAtFirstEditableNode(false) directly.

MozReview-Commit-ID: 8x4j0AwzISl

--HG--
extra : rebase_source : 40a9e9eea95b22c59dc007f6babfc518205702ea
2018-06-05 21:18:05 +09:00
Olli Pettay 5dad9cd69b Bug 1467790 - Inline nsINode::IsEditable, r=masayuki 2018-06-08 15:57:13 -04:00
Makoto Kato ef31f52f39 Bug 1467670 - Devirtualize InsertFromDrop. r=masayuki
InsertFromDrop is implemented on TextEditor only, so it can do devirtualize
this method.  Also, this method is only called by drop event handler of
EditorEventListener, so it should rename to better name (OnDrop).

Differential Revision: https://phabricator.services.mozilla.com/D1592
2018-06-08 05:19:51 +00:00
Makoto Kato b027fd188e Bug 1423776 - Return error when splitted node might be orphan. r=masayuki
This crash occurs when start container of range for range updater is nullptr
in GetNodesForOperation.

Splitted node by SplitNodeDeepWithTransaction can return orphan node, so we
should return error when splitted node is orphan node.

MozReview-Commit-ID: 3ySdzc9FAzL

--HG--
extra : rebase_source : 3c6f37e81641751d32b8a9777b8362baad301ecb
2018-06-04 16:31:38 +09:00
Makoto Kato 35f52b478b Bug 1466469 - Devirtialize nsIHTMLEditor.GetActiveEditingHost. r=masayuki
Since GetActiveEditingHost is noscript method, we should move this from
nsIHTMLEditor to HTMLEditor.

MozReview-Commit-ID: 3jLHSstixxk

--HG--
extra : rebase_source : 72e992a6c5643e1d0f0f5454f803139716c6309c
2018-06-04 17:45:34 +09:00
Miko Mynttinen 4c85ef17cc Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 1e7eea4f2d4ec16ec0c559a8afb26976ddbf4d07
2018-06-01 17:59:07 +02:00
arthur.iakab 7e765f798b Backed out 2 changesets (bug 1465060) for build bustages on security/sandbox/linux/reporter/SandboxReporter.cpp
Backed out changeset 7c8905b6b226 (bug 1465060)
Backed out changeset 10446073eca8 (bug 1465060)
2018-06-03 19:25:41 +03:00
Miko Mynttinen 8d9dc85cd4 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 619d0e0ff63a2453c80f0c4d9beb906d43fa9b01
2018-06-01 17:59:07 +02:00
Boris Zbarsky 15b087c696 Bug 1465875 part 4. Eliminate random mentions of nsIDOMNSEditableElement. r=qdot 2018-06-01 22:35:23 -04:00
Boris Zbarsky 0cf65db1d3 Bug 1465875 part 2. Eliminate use of "instanceof nsIDOMNSEditablElement". r=qdot 2018-06-01 22:35:22 -04:00
Boris Zbarsky c7f378d7ab Bug 1465875 part 1. Eliminate pointless QIs to nsIDOMNSEditableElement. r=qdot
We expose the relevant APIs on textarea and input elements anyway
(chromeonly).  The QIs will throw on a non-input or non-textarea element, but
none of these consumers expect that to happen.
2018-06-01 22:35:22 -04:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Nazım Can Altınova 361380987c Bug 1464496 - Part 1: Merge ServoDeclarationBlock and DeclarationBlock r=emilio
MozReview-Commit-ID: By9fV70Oq0K

--HG--
extra : rebase_source : 837afe9c33b21d7db41ff19d3aaf6cf3e9eedbdf
2018-05-30 18:15:25 +02:00
Andreea Pavel 38bcf897f1 Merge mozilla-inbound to mozilla-central. a=merge 2018-05-31 13:04:21 +03:00
Emilio Cobos Álvarez fe09ffd3af Bug 1465478: Introduce Element::FromNode. r=smaug
And use it in a couple places I noticed.

MozReview-Commit-ID: 8baSMrbdEbF
2018-05-31 02:46:10 +02:00
Masayuki Nakano 908dbbfada Bug 1463985 - part 27: Replace EditSubAction::ignore with EditSubAction::eReplaceHeadWithHTMLSource and EditSubAction::eCreateBogusNode r=m_kato
EditSubAction::ignore is declared for making HTMLEditRules::AfterEditInner()
ignores post-processing of handling edit action.  Currently, this is used only
by TextEditRules::CreateBogusNodeIfNeeded() and
HTMLEditor::ReplaceHeadContentsWithHTML().  So, we should make them use
specific EditSubAction values which explain what they do and make
HTMLEditRules::AfterEditInner() ignore both of them.

MozReview-Commit-ID: JSHcgPfTrOE

--HG--
extra : rebase_source : c054c2db257dda7e1e3ace01f8e8831e07268f7e
2018-05-29 00:06:24 +09:00
Masayuki Nakano cc803498e8 Bug 1463985 - part 26: Rename EditSubAction::decreaseZIndex and EditSubAction::increaseZIndex to EditSubAction::eDecreaseZIndex and EditSubAction::eIncreaseZIndex r=m_kato
MozReview-Commit-ID: 87Pux0xZOM

--HG--
extra : rebase_source : cc89eb98558b32e31867ef9f6b1ab74acabadea5
2018-05-28 23:52:16 +09:00
Masayuki Nakano 0fe0c32b1a Bug 1463985 - part 25: Rename EditSubAction::setAbsolutePosition and EditSubAction::removeAbsolutePosition to EditSubAction::eSetPositionToAbsolute and EditSubAction::eSetPositionToStatic r=m_kato
MozReview-Commit-ID: DiyCAkGw2uo

--HG--
extra : rebase_source : e10f7af40ac3a21350526f803801683de5696182
2018-05-28 23:48:39 +09:00
Masayuki Nakano a48c9c34aa Bug 1463985 - part 24: Rename EditSubAction::resetTextProperties to EditSubAction::eRemoveAllTextProperties r=m_kato
MozReview-Commit-ID: 1QKUg361MSY

--HG--
extra : rebase_source : 7ed2f41e20e498e105fac8a88be90157dd812fa1
2018-05-28 23:40:45 +09:00
Masayuki Nakano a9c4b1bc58 Bug 1463985 - part 23: Rename EditSubAction::htmlPaste and EditSubAction::loadHTML to EditSubAction::ePasteHTMLContent and EditSubAction::eInsertHTMLSource r=m_kato
MozReview-Commit-ID: B1Ag1yP5PXl

--HG--
extra : rebase_source : 47b20d72c53f8c97c4ccbb20960d5bf571d9cde6
2018-05-28 23:37:12 +09:00
Masayuki Nakano 4db8c8a594 Bug 1463985 - part 22: Rename EditSubAction::insertQuotation to EditSubAction::eInsertQuotation r=m_kato
According to this usage, perhaps, we can remove this from EditSubAction and
this should be moved to new EditAction.

MozReview-Commit-ID: HzfcC051rNB

--HG--
extra : rebase_source : e42cade8436b082b4dc2adfcbbac75e17779cfd7
2018-05-28 23:22:19 +09:00
Masayuki Nakano 84aca99c88 Bug 1463985 - part 21: Rename EditSubAction::insertElement to EditSubAction::eInsertElement r=m_kato
MozReview-Commit-ID: 6nrm1zJ968f

--HG--
extra : rebase_source : 633824e9564dddd9d9b80414ab07e7aa960b8fb1
2018-05-28 23:13:41 +09:00
Masayuki Nakano 1affc933f7 Bug 1463985 - part 20: Rename EditSubAction::makeDefListItem to EditSubAction::eCreateOrChangeDefinitionList r=m_kato
MozReview-Commit-ID: 1ucTdFEjasz

--HG--
extra : rebase_source : 1c00f4b480ebc8c30ef5d6979319f6db01235dc9
2018-05-28 23:08:50 +09:00
Masayuki Nakano 220ec91e25 Bug 1463985 - part 19: Rename EditSubAction::removeList to EditSubAction::eRemoveList r=m_kato
MozReview-Commit-ID: DgsZwANcEdF

--HG--
extra : rebase_source : e0032e957ccc4448e210783a67ef83c1257c0a3b
2018-05-28 23:05:00 +09:00
Masayuki Nakano 7d6ea95d32 Bug 1463985 - part 18: Rename EditSubAction::makeBasicBlock to EditSubAction::eCreateOrRemoveBlock r=m_kato
MozReview-Commit-ID: 3GuscIcaWe9

--HG--
extra : rebase_source : 3f580a1d60296c232a70156d68a18a7b13c9d640
2018-05-28 23:01:19 +09:00
Masayuki Nakano 9a8bb4d35e Bug 1463985 - part 17: Rename EditSubAction::align to EditSubAction::eSetOrClearAlignment r=m_kato
MozReview-Commit-ID: KausJ4mihk9

--HG--
extra : rebase_source : 48fd37f2578714f46c0fcbf84788f9b0c69d3608
2018-05-28 22:51:31 +09:00
Masayuki Nakano b43f12de7f Bug 1463985 - part 16: Rename EditSubAction::indent and EditSubAction::outdent to EditSubAction::eIndent and EditSubAction::eOutdent r=m_kato
MozReview-Commit-ID: 2JDyYLT8V7Q

--HG--
extra : rebase_source : 5b0ebe706e8144fa6cbdf1ee16573d5166ef8028
2018-05-28 22:42:31 +09:00
Masayuki Nakano 004c690a96 Bug 1463985 - part 15: Rename EditSubAction::makeList to EditSubAction::eCreateOrChangeList r=m_kato
MozReview-Commit-ID: 4Mkh3Mfm6fY

--HG--
extra : rebase_source : 5509f3f2e05ce4fe25965ca69334309a9109a791
2018-05-28 22:36:19 +09:00
Masayuki Nakano 54321db367 Bug 1463985 - part 14: Rename EditSubAction::insertBreak to EditSubAction::eInsertParagraphSeparator r=m_kato
MozReview-Commit-ID: DhEzqhLxMme

--HG--
extra : rebase_source : 87e482478b881ba9c9fbc99562fce5e5a576e0ab
2018-05-28 22:27:47 +09:00
Masayuki Nakano f24da5be63 Bug 1463985 - part 13: Rename EditSubAction::setText to EditSubAction::eSetText r=m_kato
MozReview-Commit-ID: A4DF3fX9IV6

--HG--
extra : rebase_source : d89acbacb9f17a599ee5b1c1387fd08f42cac3b6
2018-05-28 22:20:43 +09:00
Masayuki Nakano b539d189c1 Bug 1463985 - part 12: Rename EditSubAction::outputText to EditSubAction::eComputeTextToOutput r=m_kato
MozReview-Commit-ID: ItJi2rKv6Pw

--HG--
extra : rebase_source : 3c0bea9a8cdfd74b3f65d504d32d63746afe82cd
2018-05-28 22:09:55 +09:00
Masayuki Nakano 9fa1c953b2 Bug 1463985 - part 11: Rename EditSubAction::setTextProperty and EditSubAction::removeTextProperty to EditSubAction::eSetTextProperty and EditSubAction::eRemoveTextProperty r=m_kato
There may be better name for them though.

MozReview-Commit-ID: KxwziJArh84

--HG--
extra : rebase_source : 3af1c052c62f244bbbeaef65ff3b203d35d88ef4
2018-05-28 22:05:10 +09:00
Masayuki Nakano cbdd1207ab Bug 1463985 - part 10: Rename EditSubAction::deleteSelection to EditSubAction::eDeleteSelectedContent r=m_kato
MozReview-Commit-ID: 8LNY42KnyDf

--HG--
extra : rebase_source : 7778c0ff7c3da1c5070d0e5acf607665ff8efd4f
2018-05-28 21:49:56 +09:00
Masayuki Nakano 99a921d037 Bug 1463985 - part 9: Rename EditSubAction::insertIMEText to EditSubAction::eInsertTextComingFromIME r=m_kato
MozReview-Commit-ID: 1TmryMStB7H

--HG--
extra : rebase_source : 33dea12fe1ce0d5b9ea9ee13681949f288056d2a
2018-05-28 21:44:39 +09:00
Masayuki Nakano 63f1437458 Bug 1463985 - part 8: Rename EditSubAction::insertText to EditSubAction::eInsertText r=m_kato
MozReview-Commit-ID: Bd7GMng3T1T

--HG--
extra : rebase_source : a7e1774282c69b38add45faa993682d98e976d6b
2018-05-28 21:36:47 +09:00
Masayuki Nakano 204a55a114 Bug 1463985 - part 7: Rename EditSubAction::eDeleteText to EditSubAction::deleteText r=m_kato
And the odd number assign does not make sense anymore.  So, removes it.

MozReview-Commit-ID: JSyMNcrNhpP

--HG--
extra : rebase_source : efdb31d94d0fcae50cd72b5ee0d27041a454887a
2018-05-28 21:29:14 +09:00
Masayuki Nakano 52bba9f895 Bug 1463985 - part 6: Rename EditSubAction::splitNode and EditSubAction::joinNode to EditSubAction::eSplitNode and EditSubAction::eJoinNodes r=m_kato
MozReview-Commit-ID: Lk0UKyzWK8d

--HG--
extra : rebase_source : 3bc062c85da2ca8d7e9f9ca072c478135b3850fc
2018-05-28 21:25:20 +09:00
Masayuki Nakano db6dc253e0 Bug 1463985 - part 5: Rename EditSubAction::deleteNode to EditSubAction::eDeleteNode r=m_kato
MozReview-Commit-ID: 1K5bdzvNUaF

--HG--
extra : rebase_source : a7347e953cfe8f4419f9982794a4d693af303220
2018-05-28 21:19:34 +09:00
Masayuki Nakano 32dc755297 Bug 1463985 - part 4: Rename EditSubAction::insertNode and EditSubAction::createNode to EditSubAction::eInsertNode and EditSubAction::eCreateNode r=m_kato
Although, there might be no reason to have those edit sub-actions separately.

MozReview-Commit-ID: BaaNCqfk4V4

--HG--
extra : rebase_source : 061bc85c85489b6b2617e05bd91254667ddedb1a
2018-05-28 21:16:44 +09:00
Masayuki Nakano 5de95ff37e Bug 1463985 - part 3: Rename EditSubAction::undo and EditSubAction::redo to EditSubAction::eUndo and EditSubAction::eRedo r=m_kato
MozReview-Commit-ID: 3eNlmFimFlu

--HG--
extra : rebase_source : 3ed271141f5161ca48cd39882fa6290b1d45946c
2018-05-28 20:36:06 +09:00
Masayuki Nakano 82c12dc72d Bug 1463985 - part 2: Rename EditSubAction::none to EditSubAction::eNone r=m_kato
MozReview-Commit-ID: 4wJyaNS1P1y

--HG--
extra : rebase_source : 169e2faffa25ed42875c8dccb5c49ae5aaa54ebb
2018-05-28 20:29:34 +09:00
Masayuki Nakano 99341a9445 Bug 1463985 - part 1: Rename EditAction to EditSubAction and related stuff r=m_kato
When we implement InputEvent.inputType, we need to set a stack class to record
which edit action is currently handled.  However, currently, we call smaller
jobs as edit action.  For example, when user types a character at selecting
some characters, then, EditAction::deleteSelection is performed first, then,
EditAction::insertText is performed.  However, for the InputEvent.inputType,
we need inserText information.  So, for making new enum EditAction, we need
to rename current EditAction to EditSubAction.

And also this renames related stuff:

EditorBase::mIsInEditAction -> EditorBase::mIsInEditSubAction
EditorBase::IsInEditAction() -> EditorBase::IsInEditSubAction()
EditorBase::mAction -> EditorBase::mTopLevelEditSubAction
TextEditRules::mTheAction -> TextEditRules::mTopLevelEditSubAction
EditorBase::StartOperation() ->
  EditorBase::OnStartToHandleTopLevelEditSubAction()
EditorBase::EndOperation() ->
  EditorBase::OnEndHandlingTopLevelEditSubAction()
AutoRules -> AutoTopLevelEditSubActionNotifier
RulesInfo -> EditSubActionInfo

MozReview-Commit-ID: cvSkPUjFm1

--HG--
extra : rebase_source : baf527a3e353b7a8ebe9a46be2243b059c500234
2018-05-28 20:12:34 +09:00
Boris Zbarsky 931b9e37ad Bug 1455676 part 10. Remove use of nsIDOMNode from remaining xpidl. r=qdot 2018-05-29 22:58:49 -04:00
Kartikaya Gupta 8e203673f1 Bug 1463416 - use new WR subpixel positioning API from WR PR 2738. r=Gankro
Patch originally developed on bug 1458921 but needs to land with the WR update.

MozReview-Commit-ID: 82BYyNWBAfn

--HG--
extra : rebase_source : e6bca2f446c019fd41a37c2c28db73bbe1cfc216
2018-05-26 11:09:21 -04:00
Boris Zbarsky c73f664888 Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki 2018-05-24 13:18:34 -04:00
Boris Zbarsky 0f8f7f6fba Bug 1463981 part 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki 2018-05-24 13:18:34 -04:00
Boris Zbarsky 8f50a01cba Bug 1463981 part 1. Remove use of nsIDOMNode in spellchecker xpidl. r=masayuki 2018-05-24 13:18:34 -04:00
Masayuki Nakano 11ae2207cf Bug 1463327 - part 4: Add comments to explain which kind of methods should be public methods r=m_kato
MozReview-Commit-ID: 6l8ZiMWEYCI

--HG--
extra : rebase_source : 024625012c917b17710016b91db10bfbaace2134
2018-05-22 20:15:05 +09:00
Masayuki Nakano d40825b1e4 Bug 1463327 - part 3: Change scope of some methods of HTMLEditor which won't be called by non-helper classes of editing to protected r=m_kato
HTMLEditor has 2 type of public methods.  One is rue-public methods.  I.e.,
they should be able to be called by anybody.  E.g., command handlers, event
listeners, or JS via nsIEditor interface.  The other is semi-public methods.
They are not called by the above examples but called by other classes which
are helper classes to handle edit actions.  E.g., TextEditRules, HTMLEditRules,
HTMLEditUtils, CSSEditUtils and Transaction classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make HTMLEditor have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in HTMLEditor.h
(except removes BlockTransformationType since it's unused and replaces
ResizingRequestID with new enum class ResizeAt since normal enum isn't hit by
searchfox.org).

MozReview-Commit-ID: 7PC8E8vD7w2

--HG--
extra : rebase_source : 13f51565f2b89ab816ba529af18ee88193a9c932
2018-05-22 18:28:50 +09:00
Masayuki Nakano f615160008 Bug 1463327 - part 2: Change scope of some methods of TextEditor which won't be called by non-helper classes of editing to protected r=m_kato
TextEditor has 2 type of public methods.  One is true-public methods.  I.e.,
they should be able to be called by anybody.  E.g., command handlers, event
listeners, or JS via nsIEditor interface.  The other is semi-public methods.
 They are not called by the above examples but called by other classes which
are helper classes to handle edit actions.  E.g., TextEditRules, HTMLEditRules,
HTMLEditUtils, CSSEditUtils and Transaction classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make TextEditor have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in TextEditor.h.

MozReview-Commit-ID: Db3H6d1V8IU

--HG--
extra : rebase_source : d928a6bb378d02944c5a207de83211c33bb63613
2018-05-22 16:40:44 +09:00
Masayuki Nakano 40ab33fe29 Bug 1463327 - part 1: Change scope of some methods of EditorBase which won't be called by non-helper classes of editing to protected r=m_kato
EditorBase (and other editor classes) have 2 type of public methods.  One is
true-public methods.  I.e., they should be able to be called by anybody.
E.g., command handlers, event listeners, or JS via nsIEditor interface.
The other is semi-public methods.  They are not called by the above examples
but called by other classes which are helper classes to handle edit actions.
E.g., TextEditRules, HTMLEditRules, HTMLEditUtils, CSSEditUtils and Transaction
classes.

When we will implement InputEvent.inputType, we need to create new stack
class and create its instance at every true-public methods to manage current
inputType (like TextEditRules::AutoSafeEditorData).  Therefore, it should not
happen that new code starts to call semi-public methods without the new
stack class instance.

For preventing this issue, we should make EditorBase have only the true-public
methods as public.  The other public methods should be protected and their
users should be friend classes.  Then, we can protect such method from external
classes.

Note that this patch just moves the methods without any changes in EditorBase.h
(except removes GetName() since there is no body of this method and removes
IterDirection since it's unused).

MozReview-Commit-ID: HBseKLL6pxx

--HG--
extra : rebase_source : 2251ff659d831d01a6778d38f4e2714fcf2d6ef4
2018-05-22 16:08:43 +09:00
Masayuki Nakano 6099476d10 Bug 1460509 - part 84: Make HTMLEditRules::GetNodesFromPoint() use IgnoredErrorResult instead of ErrorResult r=m_kato
HTMLEditRules::GetNodesFromPoint() uses ErrorResult only for checking in
debug build.  So, it should use IgnoredErrorResult instead.

MozReview-Commit-ID: 5roQI03A0kF

--HG--
extra : rebase_source : 5f54dc18635653d214b22520f4747a00258d9d9b
2018-05-22 23:22:27 +09:00
Masayuki Nakano ddb1f08834 Bug 1460509 - part 83: Make HTMLEditRules::InsertBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: Kuga8LvWfaM

--HG--
extra : rebase_source : 8e3e855268a5bddf069a8cfbb869eb64074188fb
2018-05-18 12:41:53 +09:00
Masayuki Nakano ec1146f4c4 Bug 1460509 - part 82: Refine comments of TextEditRules.h and HTMLEditRules.h r=m_kato
This patch adds new rules of TextEditRules and HTMLEditRules about
NS_ERROR_EDITOR_DESTROYED.

Additionally, this patch moves some method explanation in each .cpp file to .h
file.

MozReview-Commit-ID: JqZFrWyrND8

--HG--
extra : rebase_source : d86385d9c26bb23adae1eca3b1be1a868c20e353
2018-05-18 12:38:32 +09:00
Masayuki Nakano 7bbdd6b2f2 Bug 1460509 - part 81: Make HTMLEditRules::WillDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: IPN1GMQYGeY

--HG--
extra : rebase_source : 97bd6e6d9e925a66c2f9f4dfb2678bc4e33aed42
2018-05-18 00:43:52 +09:00
Masayuki Nakano c7127dda7f Bug 1460509 - part 80: Make HTMLEditRules::DeleteNodeIfCollapsedText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: C8ZNGlKJXlq

--HG--
extra : rebase_source : 17bd0b929b6339c2736514c28a354b21c45143b6
2018-05-18 00:31:20 +09:00
Masayuki Nakano 7e3a011a75 Bug 1460509 - part 79: Make HTMLEditRules::TryToJoinBlocksWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: BdoIrAYckNe

--HG--
extra : rebase_source : 182d41eb20fbc3e4088b3fcb76347154e0e88df6
2018-05-18 00:22:43 +09:00
Masayuki Nakano 17eab7beeb Bug 1460509 - part 78: Make HTMLEditRules::MoveBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 7RKXiYaH2l0

--HG--
extra : rebase_source : 8c30c66fbd9e20382aa0c26f868b9b5099c212da
2018-05-18 00:08:58 +09:00
Masayuki Nakano c66a577ca5 Bug 1460509 - part 77: Make HTMLEditRules::MoveNodeSmart() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: D9mgBt2ftuz

--HG--
extra : rebase_source : 1286eddebb2f26ab22223825f13d82e0f6d051cb
2018-05-18 00:02:00 +09:00
Masayuki Nakano 2250135c6b Bug 1460509 - part 76: Mark HTMLEditRules::MoveContents() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r=m_kato
MozReview-Commit-ID: gBAssBJfrF

--HG--
extra : rebase_source : 20b4dac757f1991c95d16885726b38d01c238a92
2018-05-17 23:52:47 +09:00
Masayuki Nakano ddf4765c0a Bug 1460509 - part 75: Make HTMLEditRules::DeleteNonTableElements() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: 9SIBECF8s1R

--HG--
extra : rebase_source : 5087d948f1f7bb64c9f202976bc85719fa6ddab4
2018-05-17 23:46:00 +09:00
Masayuki Nakano 0f41ff01e6 Bug 1460509 - part 74: Make HTMLEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato
MozReview-Commit-ID: E3LGBAbaw7N

--HG--
extra : rebase_source : 2075312aad4062341272f95df2f19975c1b3779b
2018-05-17 23:21:52 +09:00
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
Emilio Cobos Álvarez 9bed821e90 Bug 1467722: Don't return null for getComputedStyle when there's no pres shell. r=heycam
We need to deal with this case regardless from getPropertyValue, and this causes
pain and webcompat issues.

MozReview-Commit-ID: Gbpzq0N4O2T
2018-06-19 11:47:16 +02: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