Commit Graph

8739 Commits

Author SHA1 Message Date
Masayuki Nakano
98a833407e Bug 1467794 - Split TextEditor::DeleteSelectionAsAction() to itself and TextEditor::DeleteSelectionAsSubAction() r=m_kato
TextEditor::DeleteSelectionAsAction() is called even if it's a part of edit
action.  For example, it's called to prepare for inserting text.

For bug 1465702, editor itself and edit rules classes should not call
public DeleteSelectionAsAction() directly.  Therefore, this patch creates
DeleteSelectionAsSubAction() for internal use.

Note that this patch adds NS_ASSERTION() to detect wrong caller.  However,
it cannot distinguish if the call is valid, for example, it's allowed to
call DeleteSelectionAsSelection() even if it's handling an edit action but
the method is called via mutation event listener.  So, we need to allow
some assertions with some tests.  But unfortunately, 1405747.html uses
mutation event listener too many times (about 1,000 times) and the number
of assertion isn't stable.  Therefore, this patch makes the test stop using
the mutation event listener 2nd time since I can reproduce the crash with
ESR 52 at the 2nd time.

MozReview-Commit-ID: 1TWaypmnoCC

--HG--
extra : rebase_source : a6a4fb1cbcaf2ab6f10c5f3e7168a6bc0fcb02ed
2018-06-29 20:16:50 +09:00
Makoto Kato
afbbfcc910 Bug 1405897 - Move assertion before setting resizer attribute. r=masayuki
This assertion was added by review comment of bug 1487945. Since mutation event
handler of this test case hides resizer, this case hits this assertion.

Although 4th parameter of SetAttr can control mutation event, if this event
isn't fired, another test case (layout/base/tests/test_bug558663.html) becomes
failure.

So we should move the assertion before setting resizer attribute.

Differential Revision: https://phabricator.services.mozilla.com/D1854

--HG--
extra : moz-landing-system : lando
2018-06-29 04:47:21 +00:00
Sylvestre Ledru
6dd1af0903 Bug 1471596 - Simplify the code in HTMLEditor::GetSelectedOrParentTableElement r=m_kato
the first branch of the if was useless

MozReview-Commit-ID: GgKYOcI3sGX

--HG--
extra : rebase_source : eacfa0e86ae259e7940f92e1ad8e765949e9412e
2018-06-27 15:40:43 +02:00
Jeff Gilbert
5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Margareta Eliza Balazs
14cb8f1c23 Merge inbound to mozilla-central. a=merge 2018-06-26 17:53:19 +03:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Makoto Kato
8bd7e4fabf Bug 1471115 - Remove unused methods in nsIHTMLEditor. r=masayuki
insertHTMLWithContext, getIndentState, setBodyAttribute and
getSelectionContainer are unused from script (inc. c-c and bluegriffon).

Differential Revision: https://phabricator.services.mozilla.com/D1822
2018-06-26 04:29:36 +00:00
Emilio Cobos Álvarez
6a2e3606ae Bug 1470361: Remove nsIEditorStyleSheets.addStyleSheet / removeStyleSheet / replaceStyleSheet. r=m_kato
These are effectively equivalent to appending a <link> element to the body, are
not unused, and bring in a fair amount of complexity because even though they're
owned by the document and stored in the document's mStyleSheets, they're not
owned by it per se, which causes confusion.

Unless I've missed something, both bluegriffon and common-central use the
*Override APIs, which this patch leaves untouched.

MozReview-Commit-ID: EOSMOHj3A95
2018-06-25 10:46:38 +02:00
Dorel Luca
b595d82310 Merge mozilla-central to mozilla-inbound 2018-06-20 01:06:23 +03:00
Dorel Luca
e06ba10d0b Merge mozilla-inbound to mozilla-central. a=merge 2018-06-20 00:54:45 +03:00
Makoto Kato
12c210e67e Bug 1421510 - Part 3. Make nsITextServicesFilter.skip noscript access. r=masayuki
nsITextServicesFilter.skip isn't accessed from JavaScript (including c-c and
bluegriffon), so we can remove it from IDL.

Also, skip method should use early return style for clean up.

MozReview-Commit-ID: qjZS54ZeoT

--HG--
extra : rebase_source : 45c302e3f3b893a8b4eec796890c43d5d8894230
2018-06-04 12:32:39 +09:00
Makoto Kato
51e4d2154d Bug 1421510 - Part 2. Use nsComposeTxtSrvFilter directly. r=masayuki
nsITextServicesFilter is builtin class, so we can store nsComposeTxtSrvFilter
instead of nsITextServicesFilter.

MozReview-Commit-ID: ErZQwWC0Wjx

--HG--
extra : rebase_source : 7b327a0dbdf12e2e085d109e66e5140ac6d18773
2018-06-19 16:00:35 +09:00
Makoto Kato
98b51e91ce Bug 1421510 - Part 1. Make nsITextServicesFilter builtinclass. r=masayuki
There is no JavaScript implementation (including c-c and bluegriffon) for
nsITextServicesFilter, so we make this builtin to access builtin C++
implementation directly.

MozReview-Commit-ID: BGZlDzsKT6N

--HG--
extra : rebase_source : 1a0e328b84f1a71638425bb4dfba756a211faa74
2018-06-04 11:15:05 +09:00
Joel Maher
8324126795 Bug 1405428 - annotate crashtests and reftests which fail in test-verify mode. r=gbrown 2018-06-19 11:38:25 -04:00
Markus Stange
2fa0e26050 Bug 426246 - cmd_deleteToBeginningOfLine should delete to the beginning of the line, not the whole line. r=masayuki
MozReview-Commit-ID: 3OTOSz8u9Co

--HG--
extra : rebase_source : a2f9619c41add013e09cbb10b8ea21206f5709b4
2018-06-14 15:42:16 -04:00
Makoto Kato
d7d2ea2a38 Bug 1468708 - Part 6. Move HTMLEditorCommands and HTMLEditorController to libeditor. r=masayuki
HTMLEditorController and HTMLEditorCommands is for execCommand, so we should
move from composer to libeditor since HTML editor code is in libeditor.

MozReview-Commit-ID: DEBoTqUsQnw

--HG--
rename : editor/composer/HTMLEditorCommands.cpp => editor/libeditor/HTMLEditorCommands.cpp
rename : editor/composer/HTMLEditorCommands.h => editor/libeditor/HTMLEditorCommands.h
rename : editor/composer/HTMLEditorController.cpp => editor/libeditor/HTMLEditorController.cpp
rename : editor/composer/HTMLEditorController.h => editor/libeditor/HTMLEditorController.h
rename : editor/composer/HTMLEditorDocumentCommands.cpp => editor/libeditor/HTMLEditorDocumentCommands.cpp
extra : rebase_source : 0b9627ac89803212da3377db3dfefedc3b57ce73
2018-06-13 14:49:06 -07:00
Makoto Kato
5c774c32b5 Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki
Rename nsComposerCommands to mozilla::*Command

Base class
- nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase
- nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase
- nsMultiStateCommand -> mozilla::MultiStateCommandBase

Command class
(HTMLEditorCommands)
- nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand
- nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand
- nsListCommand -> mozilla::ListCommand
- nsListItemCommand -> mozilla::ListItemCommand
- nsRemoveListCommand -> mozilla::RemoveListCommand
- nsIndentCommand -> mozilla::IndentCommand
- nsOutdentCommand -> mozilla::OutdentCommand
- nsParagraphStateCommand -> mozilla::ParagraphStateCommand
- nsFontFaceStateCommand -> mozilla::FontFaceStateCommand
- nsFontSizeStateCommand -> mozilla::FontSizeStateCommand
- nsFontColorStateCommand -> mozilla::FontColorStateCommand
- nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand
- nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand
- nsAlignCommand -> mozilla::AlignCommand
- nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand
- nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand
- nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand
- nsRemoveStylesCommand -> mozilla::RemoveStylesCommand
- nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand
- nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand
- nsInsertHTMLCommand -> mozilla::InsertHTMLCommand
- nsInsertTagCommand -> mozilla::InsertTagCommand

(HTMLEditorDocumentCommands)
- nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand
- nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand
- nsDocumentStateCommand -> mozilla::DocumentStateCommand

MozReview-Commit-ID: ImCLDU2JpXT

--HG--
rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp
rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h
rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp
extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 09:13:31 -07:00
Makoto Kato
bedfd9166e Bug 1468708 - Part 4. Use EditorBase::GetPresContext to get nsPresContext in nsComposerDocumentCommands. r=masayuki
MozReview-Commit-ID: 5ubcYtk5Ylj

--HG--
extra : rebase_source : a83029c7f5c3b20d57ed367292baed2641f3a8bf
2018-06-12 16:55:34 -07:00
Makoto Kato
7b8d3f391a Bug 1468708 - Part 3. Clean up local functions not to calculate atom again. r=masayuki
nsComposerCommands has unnecessary atom calculation, so we should remove it.
Also, since nsStyleUpdatingCommand doesn't hava "all" tag names, we don't need
to support it.

MozReview-Commit-ID: Q0EBsK2mxr

--HG--
extra : rebase_source : eecf3314f416e0f77cc364eefc008deb81933ddf
2018-06-15 08:56:25 -07:00
Makoto Kato
e4a357f9ab Bug 1468708 - Part 2. Remove unimplemented commands. r=masayuki
Some commands are C++ header only, so we should remove unnecessary headers.

MozReview-Commit-ID: IXP5rLTkW5v

--HG--
extra : rebase_source : 993b90abc00072bb125a066b5fe6d16c4523f2f2
2018-06-12 15:05:56 -07:00
Makoto Kato
95d99759d1 Bug 1468708 - Part 1. Rename nsComposerController to HTMLEditorController. r=masayuki
nsComposerController is execCommand's command controller now.  So it is better
to use mozilla::HTMLEditorController class name instead of nsComposerController.

MozReview-Commit-ID: 7QNFO2dV5Zd

--HG--
rename : editor/composer/nsComposerController.cpp => editor/composer/HTMLEditorController.cpp
rename : editor/composer/nsComposerController.h => editor/composer/HTMLEditorController.h
extra : rebase_source : 413caf298b8583b5de3c6ac011b96ccebf24341e
2018-06-08 16:34:28 +09:00
Andi-Bogdan Postelnicu
d6e2c6a0f3 Bug 1453795 - Editor - Initialize member fields in classes/ structures. r=masayuki 2018-06-13 23:14:16 +03:00
Margareta Eliza Balazs
bf81d741ff Merge inbound to mozilla-central. a=merge 2018-06-11 12:36:11 +03:00
Joel Maher
50b91c0a14 Bug 1405428 - skip-if = verify on mochitests which do not pass test-verify. r=gbrown 2018-06-10 05:01:47 -04:00
Masayuki Nakano
65a183e7d5 Bug 1467692 - Create EditorBase::SelectAllInternal() for internal use r=m_kato
For preparing to fix bug 1465702, we need to split public methods of editor
which are used by both outside and itself or friends.

SelectAll() is used by both outside and TextEditor.  So, we need to create
SelectAllInternal() and make TextEditor use it instead.

MozReview-Commit-ID: JtIlrfBYBSD

--HG--
extra : rebase_source : 5c29a9c1bb99f457f66f320b873b2c7b0f93fcde
2018-06-07 22:30:14 +09:00
Ryan VanderMeulen
8e415eb4c0 Merge m-c to autoland. a=merge 2018-06-09 11:41:36 -04:00
Bogdan Tara
04b9cbbc2b Merge autoland to mozilla-central. a=merge 2018-06-09 18:34:58 +03:00
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