Commit Graph

9701 Commits

Author SHA1 Message Date
Dorel Luca
d5f9df8ee1 Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
Backed out changeset fd177b40b561 (bug 1613985)
Backed out changeset fb6d62b7f28d (bug 1613985)
2020-02-19 22:22:41 +02:00
Simon Giesecke
59b23375c0 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

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

--HG--
extra : moz-landing-system : lando
2020-02-19 18:05:38 +00:00
Makoto Kato
1aadd31886 Bug 1359404 - Make IsEmptyNode infaillible. r=masayuki
IsEmptyNode won't return error if parameter is not null. So we shouldn't use
nserror for return value and use assertion to check parameter.

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

--HG--
extra : moz-landing-system : lando
2020-02-19 05:37:13 +00:00
Mirko Brodesser
f170973369 Bug 1615581: part 1) Rename TableSelection to TableSelectionMode. r=jfkthame
See part 2) why this is necessary.

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

--HG--
extra : moz-landing-system : lando
2020-02-18 12:28:45 +00:00
Masayuki Nakano
a5deb4a2c5 Bug 1611374 - Disallow nested Document.execCommand() calls in Nightly and early Beta r=smaug
Chrome does not allow nested `Document.execCommand()` calls:
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/document_exec_command.cc;l=75;drc=301e5d079a1b4c29c5b17574d0470e6db7370acc

On the other hand, Safari (and Firefox) allows it.  However, it's worthwhile to
follow Chrome's behavior.

This patch makes `Document::ExecCommand()` return `false` when it's called
while running another `Document::ExecCommand()` call on Nightly and early Beta.
This is exactly same behavior, and we should watch broken web apps reports
for a while before riding this on the train.

And this patch sets the pref to `true` when all crash tests under
`editor/libeditor/crashtests` which depend on nested calls of `execCommand` run
since same things may be reproducible with other DOM APIs.

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

--HG--
extra : moz-landing-system : lando
2020-02-15 19:17:00 +00:00
Masayuki Nakano
fe30c6ad87 Bug 1601532 - Make test_bug1332876.html synthesizes on <span> element in the <iframe> rather than on the <iframe> r=smaug
The timeout is caused by that `iframe.contentWindow` may not receive `click`
event (as far as I've tested, neither `mousedown` nor `mouseup` is fired in
that case) when synthesizing a mouse click over the `<iframe>` element with
parent window.  However, if it synthesizes mouse click with `<span>` element
in the `<iframe>` and `iframe.contentWindow`, `click` event is always fired.

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

--HG--
extra : moz-landing-system : lando
2020-02-16 14:54:11 +00:00
Masayuki Nakano
58a034fe7d Bug 1588688 - part 8: Make HTMLEditor::DoInsertHTMLWithContext() and its helper methods use array of nsIContent rather than nsINode r=m_kato
Finally, this patch makes `HTMLEditor::DoInsertHTMLWithContext()` stop using
array of `nsINode`.

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

--HG--
extra : moz-landing-system : lando
2020-02-14 07:16:27 +00:00
Masayuki Nakano
839d86eece Bug 1588688 - part 7-10: Make ReplaceOrphanedStructure() call CollectListAndTableRelatedElementsAt() by itself r=m_kato
For guaranteeing the meaning of `aArrayOfListAndTableRelatedElements`,
`ReplaceOrphanedStructure()` should call
`CollectListAndTableRelatedElementsAt()` by itself rather than taking as
a parameter.

Then, what it does becomes a little bit clearer.  Therefore, this patch renames
`ReplaceOrphanedStructure()` to `EnsureBeginsOrEndsWithValidContent()` and
`DiscoverPartialListsAndTables()` to `GetMostAncestorListOrTableElement()`,
and adds a lot of comments.

As far as I've tested by my hand, the behavior is not changed even though
it's really buggy in some cases.  We should fix them after writing automated
tests in another bug.

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

--HG--
extra : moz-landing-system : lando
2020-02-14 05:40:37 +00:00
Masayuki Nakano
d389b66f9c Bug 1588688 - part 7-9: Make ReplaceOrphanedStructure() call DiscoverPartialListsAndTables() by itself r=m_kato
For guaranteeing the meaning of list or `<table>` element in
`ReplaceOrphanedStructure()`, it should call `DiscoverPartialListsAndTables()`.
Then, their meaning becomes clearer than coming from its parameter.

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

--HG--
extra : moz-landing-system : lando
2020-02-14 03:27:16 +00:00
Masayuki Nakano
7656ed2a64 Bug 1588688 - part 7-8: Encapsulate the first and last node fixer into a stack only class r=m_kato
In these patches, we know that there are a lot of helper methods to fix node
list which is created by `SubtreeContentIterator` and will be inserted into
the editor's DOM tree, and they are not used by other places.  So, we can
encapsulate them into a stack only class for making their usage clearer.

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

--HG--
extra : moz-landing-system : lando
2020-02-14 02:59:32 +00:00
Masayuki Nakano
6725ec2b0e Bug 1601585 - Add a WPT to test selection in a contenteditable element with changing designMode r=smaug
We should port `editor/libeditor/tests/test_bug622371.html` to WPT.  It was
written for compatibility issue with CKEditor 9 years ago and Gecko and
Blink behave as exactly same.  Only Safari normalize the selection into the
end of the text node, but Safari also does not change selection at turning
on/off `designMode` too.  Therefore, all browser engines have implicit
agreement at least that selection shouldn't be changed at changing
`designMode`.

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

--HG--
extra : moz-landing-system : lando
2020-02-15 08:18:20 +00:00
Masayuki Nakano
55963fc5b9 Bug 1588688 - part 7-7: Clean up HTMLEditor::ReplaceOrphanedStructure() r=m_kato
Unfortunately, even with this cleaning up, I don't understand what it does
because existing comment and what actually it does seem different.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 09:06:44 +00:00
Masayuki Nakano
784573927c Bug 1588688 - part 7-6: Clean up HTMLEditor::DiscoverPartialListsAndTables() r=m_kato
`HTMLEditor::DiscoverPartialListsAndTables()` can be static and we can make
its definition simpler.  However, due to the odd logic, I'm still not sure
what it does.  I'll update it after cleaning up its result user,
`HTMLEditor::ReplaceOrphanedStructure()`.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 08:42:22 +00:00
Masayuki Nakano
817ac3e98e Bug 1588688 - part 7-5: Clean up HTMLEditor::CreateListOfNodesToPaste() r=m_kato
`HTMLEditor::CreateListOfNodesToPaste()` can be static and it does not need to
take `DocumentFragment` as an argument if the range is always specified.
For avoiding 2 input path to specify a range, we should make it take only
range boundaries and array of nodes to return the collected nodes.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 04:49:43 +00:00
Masayuki Nakano
3887f29cbc Bug 1588688 - part 7-4: Clean up HTMLEditor::GetListAndTableParents() r=m_kato
It can be a static method and does not make sense taking array of nodes as
input argument because it refers only first or last node of the array.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 02:56:25 +00:00
Masayuki Nakano
58164b1ddf Bug 1588688 - part 7-3: Clean up HTMLEditor::ScanForTableStructure() r=m_kato
The name does not explain what it does.  Additionally, it should be same style
as `HTMLEditor::IsReplaceableListElement()` for making it easier to understand.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 02:55:53 +00:00
Masayuki Nakano
12ce2b955c Bug 1588688 - part 7-2: Pick list element handling part of HTMLEditor::ScanForListAndTableStructure() up r=m_kato
`HTMLEditor::ScanForListAndTableStructure()` is complicated because it has
2 modes, one is for handling list element, the other is for handling table
element.  This patch splits them as 2 methods.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 02:55:20 +00:00
Masayuki Nakano
382f61920c Bug 1588688 - part 7-1: Sort out HTMLEditor::ScanForListAndTableStructure() r=m_kato
Helper methods of `HTMLEditor::DoInsertHTMLWithContext()` which uses array of
`nsINode` is really messy and we can make them simpler.  This is first
preparation of a series of refactoring patches of them.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 02:54:47 +00:00
Simon Giesecke
b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
Masayuki Nakano
ed10bfc397 Bug 1588688 - part 6: Make HTMLEditor::CollapseAdjacentTextNodes() use array of dom::Text rather than nsINode r=m_kato
`HTMLEditor::CollapseAdjacentTextNodes()` collects editable text nodes first so
that the array can be array of `dom::Text`.  Additionally, using
`DOMSubtreeIterator` instead of `ContentSubtreeIterator` makes the code easier
to understand.

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

--HG--
extra : moz-landing-system : lando
2020-02-13 02:54:45 +00:00
Masayuki Nakano
a25e33d6f2 Bug 1588688 - part 5: Make HTMLEditor::HandleDeleteNonCollapsedSelection() use array of nsIContent instead of nsINode r=m_kato
Same as the previous patch, the content iterator won't return non-`nsIContent`
node.  Therefore, `HTMLEditor::HandleDeleteNonCollapsedSelection()` can treat
it with array of `nsIContent`.

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

--HG--
extra : moz-landing-system : lando
2020-02-12 05:56:32 +00:00
Masayuki Nakano
1fb4eedd2a Bug 1588688 - part 4: Make HTMLEditor::RemoveEmptyNodesIn() use array of nsIContent rather than nsINode r=m_kato
The content iterators always return `nsIContent` even though the result of
`GetCurrentNode()` is `nsINode*`.  Therefore, we can make
`HTMLEditor::RemoveEmptyNodesIn()` use array of `nsIContent` instead of
array of `nsINode`.

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

--HG--
extra : moz-landing-system : lando
2020-02-12 05:53:34 +00:00
Masayuki Nakano
20807215a4 Bug 1588688 - part 3: Make HTMLEditor::CollectEditTargetNodes() and its users use array of nsIContent rather than nsINode r=m_kato
Unless editor needs to treat document node, all nodes are sub-class of
`nsIContent`.  Therefore, we can make `HTMLEditor::CollectEditTargetNodes()`
return array of `nsIContent` instead of array of `nsINode`.

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

--HG--
extra : moz-landing-system : lando
2020-02-12 05:52:30 +00:00
shindli
91aa0518dd Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Masayuki Nakano
4ac984054a Bug 1588688 - part 2: Remove UniqueFunctor and EmptyEditableFunctor r=m_kato
This patch creates `DOMIterator::AppendNodesToArray()` which takes pointer to
a functor and removes `DOMIterator::AppendList()`.  This allows callers to use
lambda rather than the remaining functors, `UniqueFunctor` and
`EmptyEditableFunctor`, which are used only once.  Therefore, writing them as
lambda makes the callers easier to understand.  Finally, we can remove those
functor classes' base class, `BoolDomIterFunctor` too.

Note that this patch avoids using `std::function` even though if we'd use it
as functor, we could make each lambda can capture variables and each lambda
does not need to convert to point of a function with `+` operator explicitly.
The reason is, `std::function` is too slow if `AppendNodesToArray()` is called
in a hot path.

Depends on D61968

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

--HG--
extra : moz-landing-system : lando
2020-02-11 23:29:59 +00:00
Masayuki Nakano
fc9618eabb Bug 1588688 - part 1: Remove TrivialFunctor and BRNodeFunctor for DOMIterator r=m_kato
`TrivialFunctor` returns always true for `DOMIterator::AppendList()`.  That
means that `DOMIterator` appends all nodes which are listed up by
`ContentIterator`.  So, it's reasonable to make `DOMIterator` have
`AppendAllNodesToArray()` because it's more self-documented and faster.

Additionally, `BRNodeFunctor` always returns true when nodes with which
`HTMLBRElement::FromNode()` returns non-nullptr.  So, we can make
`AppendAllNodesToArray()` a template class which just checks whether
every nodes are specific node type.

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

--HG--
extra : moz-landing-system : lando
2020-02-11 06:52:32 +00:00
Masayuki Nakano
e388597a7d Bug 1611360 - part 2: Change test_bug1151186.html to mochitest-plain r=smaug
Now, we have `SpecialPowers` to use `DOMWindowUtils`.  Therefore,
`test_bug1151186.html` can be a mochitest-plain and it's better since the
test checks behavior on web apps.

Depends on D62396

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

--HG--
rename : widget/tests/test_bug1151186.html => editor/libeditor/tests/test_bug1151186.html
extra : moz-landing-system : lando
2020-02-11 11:47:03 +00:00
Emilio Cobos Álvarez
e5463ecf7f Bug 1614718 - Add two missing includes to unbust thunderbird.
Differential Revision: https://phabricator.services.mozilla.com/D62474

--HG--
extra : moz-landing-system : lando
2020-02-11 19:18:45 +00:00
Masayuki Nakano
6bdd4b260e Bug 1612477 - part 2: Remove nsIDocumentStateListener.NotifyDocumentCreated() r=m_kato
There is no meaningful listener of this so that we can get rid of it.

Depends on D61357

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

--HG--
extra : moz-landing-system : lando
2020-02-04 06:19:55 +00:00
Masayuki Nakano
cc2af30635 Bug 1612477 - part 1: Make ComposerCommandsUpdater not inherit nsIDocumentStateListener r=m_kato
This patch makes `EditorBase::NotifyDocumentListeners()` notify
`ComposerCommandsUpdater` via `HTMLEditor::mComposerCommandsUpdater` directly.
Therefore, `ComposerCommandsUpdater` can stop inheriting
`nsIDocumentStateListener`.

Note that this patch also makes `ComposerCommandsUpdater::UpdateCommandGroup()`
not take `nsAString` as its parameter because inlinning the
`nsIDocumentStateListener` requires `ComposerCommandsUpdater.h` to include
`nsAString.h`, but it's redundant and `UpdateCommandGroup()` just compares
it with literal strings.  Therefore, using `enum class` for specifying command
group is faster.

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

--HG--
extra : moz-landing-system : lando
2020-02-03 07:35:44 +00:00
Emilio Cobos Álvarez
873a349556 Bug 1611701 - Tweak NODE_IS_EDITABLE flag handling for NAC so that it works consistently for <input type=number>. r=bzbarsky,masayuki,whimboo
I thought this would fix <input type=number style="user-select: none">, but
turns out it doesn't.

<input type=number> doesn't have the editor root as a root of the anonymous
subtree, so the current hack wouldn't work, as the anon root wouldn't have the
editable flag. So tweak the code a bit to handle stuff in a simpler way than
setting the flags after the fact, and set the NAC-root flag earlier to avoid
the mOuterWrapper->AppendChildTo(root) call forgetting about root's flags.

I had to tweak one AccessibleCaret test, but that's because it uses <textarea>
with user-select: none, and our behavior there is not particularly sane. It just
happened to work because that test-case also had a bunch of contenteditable
elements, and we stop matching this rule:

  https://searchfox.org/mozilla-central/rev/220a3bd6063fcbe5ca50e88dcabdc7dee0aca448/layout/style/contenteditable.css#22

Because the anonymous div now properly matches :-moz-read-write, which made the
rule apply and the test work. See comment 4 of this bug.

I'll fix this stuff up and add some tests for our behavior here in bug 1611699.

I refactored the dragdrop tests to cover more input types, but I ended up not
being able to use them because they're dependent on the content.

Instead I added an extra test and changed the refactor so that it applies to
<input type=search>, as there's layout work going on in bug 558594, and it'd be
unfortunate to regress this there too.

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

--HG--
extra : moz-landing-system : lando
2020-02-06 22:15:19 +00:00
Emilio Cobos Álvarez
69c87f6cb2 Bug 1613349 - Rename nsINode::DeleteProperty to RemoveProperty. r=smaug
And the related methods as well.

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

--HG--
extra : moz-landing-system : lando
2020-02-06 16:06:49 +00:00
Boris Zbarsky
c8713bf40a Bug 1612444. Improve some error messages for exceptions in layout. r=emilio
I used ThrowNotSupportedError for the not-implemented case.

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

--HG--
extra : moz-landing-system : lando
2020-02-03 20:35:54 +00:00
Masayuki Nakano
9eca50461b Bug 1540043 - part 3: Remove nsIPlaintextEditor interface r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D61350

--HG--
extra : moz-landing-system : lando
2020-02-01 04:38:13 +00:00
Masayuki Nakano
56d2a88c44 Bug 1609860 - Make AutoStyleCacheArray cache only applied styles r=m_kato
Currently, `AutoStyleCacheArray` has style information of all 19 styles.
However, its element type, `StyleCache` has `nsString` instance.  Therefore,
the initializing cost is not reasonable since in most cases most of the
`StyleCache` instances are not used actually.

This patch makes `HTMLEditor::GetInlineStyles()` append elements only for
applied styles and `HTMLEditor::ReapplyCachedStyles()` look for current
value from an instance with new `IndexOf()` method.  Therefore, this patch
may make slower if a lot of styles are applied.  However, we can expect that
it's rare case.

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

--HG--
extra : moz-landing-system : lando
2020-01-31 07:14:42 +00:00
Masayuki Nakano
083d7d9809 Bug 1612085 - part 3: Remove dirty hack of Selection::mCachedRange r=smaug
Previously, I added `Selection::mCachedRange` to save allocation cost of
`nsRange`.  However, with the previous patch, we don't need the hack anymore
since ranges removed by `Selection::RemoveAllRanges()` are always kept in
the global cache of `nsRange`.  Therefore, we can remove the ugly hack right
now.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 12:44:33 +00:00
Masayuki Nakano
450b71f763 Bug 1612085 - part 1: Hide constructor of nsRange r=smaug
`nsRange` instances are allocated a lot in the heap especially by editor and
spellchecker.  The allocation cost is too bad for benchmarks.  Therefore,
we should reuse released instances as far as possible.  For managing it in
static factory methods of `nsRange`, we need to hide `nsRange` constructor.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 13:23:35 +00:00
Masayuki Nakano
f506f1f653 Bug 1611751 - Remove unused scriptable methods of nsIHTMLEditor, nsIEditorStyleSheets and nsITableEditor r=m_kato
* `nsIHTMLEditor.removeAllInlineProperties`
* `nsIHTMLEditor.increaseFontSize`
* `nsIHTMLEditor.decreaseFontSize`
* `nsIHTMLEditor.setParagraphFormat`
* `nsIHTMLEditor.getBackgroundColorState`
* `nsIHTMLEditor.indent`
* `nsIHTMLEditor.align`
* `nsIEditorStyleSheets.replaceOverrideStyleSheet`
* `nsITableEditor.selectBlockOfCells`

These methods are not used by any Gecko products including comm-central and
BlueGriffon so that we should remove them.  Note that only
`HTMLEditor::GetBackgroundColorState()` is used internally so that we need to
keep it as a public method of `HTMLEditor`.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 08:50:41 +00:00
Masayuki Nakano
ec2a667824 Bug 1611895 - Make EditorEventListener::DragOverOrDrop() check whether the result of DragEvent::GetRangeParentContentAndOffset() returned nullptr or not r=smaug
`DragEvent::GetRangeParentContentAndOffset()` may return `nullptr`.  Previously,
it was checked and returned `NS_ERROR_FAILURE` before landing bug 1610264.

This patch adds the null check which was accidentally removed.

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

--HG--
extra : moz-landing-system : lando
2020-01-29 10:36:32 +00:00
Masayuki Nakano
4101b26261 Bug 1610264 - part 2: Make synthesizePlainDragAndDrop() stop dispatching drop event if dragover event listener sets drop effect to none r=smaug
`drop` event shouldn't be fired when drop target does not accept the data
at last `dragover` handling.

This patch makes `synthesizePlainDragAndDrop()` stop dispatching `drop` event
if last `dragover` event's `dataTransfer.dropEffect` is `none`.  In strictly
speaking, it should refer `nsIDragSession::canDrop`.  However, the value is
unstable only on Linux.  The reason must be that only GTK widget manages
`canDrop` state by itself.  Therefore, this patch directly uses the
`dataTransfer.dropEffect` value instead.

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

--HG--
extra : moz-landing-system : lando
2020-01-24 07:43:20 +00:00
Masayuki Nakano
7d3ca06add Bug 1610264 - part 1: Make EditorEventListener consume dragenter, dragover and drop events if the drop target is managed by it r=smaug
Currently, editor does not consume `dragenter`, `dragover` nor `drop` event if
`EditorEventListener::CanDrop()` returns false.  Then,
`EventStateManager::PostHandleEvent()` does not modify current drag session
with given drop effect value.  Therefore, it does not make sense that
`EditorEventListener` modifies modify drop effect of `DragEvent::mDataTransfer`
only with calling `Event::StopPropagation()`.

This patch makes `EditorEventListener` consume `eDragEnter`, `eDragOver` and
`eDrop` events unless drop target is not managed by the editor (i.e., when
drop target is non-editable nodes in HTML editor, or the editor is a part of
`<input type="file">`).

Then, `EditorEventListenr::DragOver()` and `EditorEventListener::Drop()`
become really similar.  Therefore, this patch also merges them.  Their
differences are only:

* Only `Drop()` calls `CleanupDragDropCaret()` first.
* The main purpose code (calling `TextEditor::OnDrop()` from `Drop()` and
  modifying drop effect and caret from `DragOver()`)

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

--HG--
extra : moz-landing-system : lando
2020-01-24 20:10:25 +00:00
Emilio Cobos Álvarez
a25126cd0d Bug 1611181 - Make direction use an enum class. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D60857

--HG--
extra : moz-landing-system : lando
2020-01-24 11:46:14 +00:00
Masayuki Nakano
b1bf7e0db4 Bug 1540043 - part 1: Move all constants and methods of nsIPlaintextEditor to nsIEditor and make nsIPlaintextEditor inherit nsIEditor r=m_kato
For preparing to remove `nsIPlaintextEditor` interface, this patch moves
all of them to `nsIEditor`, but for avoiding bustage in comm-central, makes
`nsIPlaintextEditor` inherit `nsIEditor` for now (i.e., even with this patch,
script can access old `nsIPlaintextEditor` members with the interface.

In C++ code, this patch moves `SetWrapColumn()`, `InsertTextAsAction()`,
`InsertTextAsSubAction()` and `InsertLineBreakAsSubAction()` because
they do common things between `TextEditor` and `HTMLEditor`.  On the other
hand, this does not move `TextEditor::GetTextLength()` because it's designed
only for `TextEditor`.

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

--HG--
rename : editor/libeditor/tests/test_nsIPlaintextEditor_insertLineBreak.html => editor/libeditor/tests/test_nsIEditor_insertLineBreak.html
extra : moz-landing-system : lando
2020-01-24 08:33:42 +00:00
Masayuki Nakano
d48b18fa27 Bug 1610750 - Get rid of unused nsIEditor methods r=m_kato
* getAttributeValue
* cloneAttribute
* splitNode
* joinNodes
* markNodeDirty
* removeEditorObserver

are not used from script.  Therefore, we can get rid of them from `nsIEditor`.

However, `EditorBase::GetAttributeValue()` is referred by
`HTMLEditor::CopyCellBackgroundColor()` and it's just a wrapper of
`Element::GetAttr()`.  Therefore, this patch makes
`HTMLEditor::CopyCellBackgroundColor()` use `Element::GetAttr()` directly.

And also `EditorBase::MarkNodeDirty()` is used from some friend classes.
Therefore, this patch redesigns it as `MarkElementDirty()` and make all of
them check whether the method call destroys the editor.

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

--HG--
extra : moz-landing-system : lando
2020-01-23 12:27:00 +00:00
Mark Banner
e0c4808608 Bug 1609998 - Enable ESLint for non-third party files in editor/libeditor/tests/browserscope/. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D60305

--HG--
extra : moz-landing-system : lando
2020-01-21 20:46:49 +00:00
Mihai Alexandru Michis
2dab66d06e Backed out 9 changesets (bug 1607172, bug 1609998, bug 1608799) for causing xpcshell failures in test_parser.js
CLOSED TREE

Backed out changeset 7753083b67dd (bug 1609998)
Backed out changeset e6f5aac734ab (bug 1608799)
Backed out changeset 90ea35966b73 (bug 1608799)
Backed out changeset 6fafa451b3f9 (bug 1608799)
Backed out changeset e07a4aea2ae1 (bug 1608799)
Backed out changeset d69d6dfdccad (bug 1607172)
Backed out changeset 93023b1b6153 (bug 1607172)
Backed out changeset 99ce7a56080e (bug 1607172)
Backed out changeset 20aa5934c785 (bug 1607172)
2020-01-21 21:44:03 +02:00
Mark Banner
07db0a7e2b Bug 1609998 - Enable ESLint for non-third party files in editor/libeditor/tests/browserscope/. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D60305

--HG--
extra : moz-landing-system : lando
2020-01-21 17:00:48 +00:00
Masayuki Nakano
6ea35a12b9 Bug 1606232 - Make nsIHTMLEditor::GetSelectedElement() check whether the found element is followed by <br> element deeper r=m_kato
Current `nsIHTMLEditor::GetSelectedElement()` just checks whether the
found element is followed by `<br>` element or not.  However, following
element may start with `<br>` element and if there is end of the range,
`PostContentIterator` does not list up the `<br>` element.

Therefore, it should check whether the found element is followed by
`<br>` element which is starts the next sibling element too.

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

--HG--
extra : moz-landing-system : lando
2020-01-21 08:16:03 +00:00
Sylvestre Ledru
187e9bafaf Bug 1519636 - Automatically reformat recent changes using clang-format r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2020-01-21 09:51:27 +00:00