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

9193 Коммитов

Автор SHA1 Сообщение Дата
Tom Schuster 79d3c5244b Bug 571074 - Mark nsITransferable.getTransferData as [must_use]. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D13454

--HG--
extra : moz-landing-system : lando
2019-01-04 16:16:59 +00:00
Emilio Cobos Álvarez d2ed260822 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Emilio Cobos Álvarez 63814207cb Bug 1516853 - Merge nsIDocument and nsDocument. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D15498

--HG--
extra : moz-landing-system : lando
2018-12-31 14:10:19 +00:00
Makoto Kato 1c2f8f57a2 Bug 1441619 - Add crashtest. r=masayuki
Summary:
The latest version of Gecko doesn't crash by this HTML, but I would like to add
this for the future.

Bug #: 1441619

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

--HG--
extra : rebase_source : 5633e508d1c1f405465857a71f7c544fbb3782e8
2018-12-18 15:09:52 +09:00
Bogdan Tara dcf5ea092c Merge mozilla-central to mozilla-inbound. a=merge CLOSED TREE 2018-12-03 23:53:09 +02:00
Ehsan Akhgari 0dcf936804 Bug 1510911 - Part 2: Backout changeset f8849239da42 (bug 1493563 - Part 5) for regressing performance 2018-12-03 14:27:53 -05:00
Edgar Chen 30d48a6150 Bug 1507543 - Spellchecker for contenteditable/design-mode should not run without focus; r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D12875

--HG--
rename : editor/reftests/spellcheck-contenteditable-nofocus.html => editor/reftests/spellcheck-contenteditable-nofocus-1.html
extra : moz-landing-system : lando
2018-12-03 11:20:09 +00:00
Benjamin Bouvier a7f1d173a0 Bug 1511383: Update vim modelines after clang-format; r=sylvestre
- modify line wrap up to 80 chars; (tw=80)
- modify size of tab to 2 chars everywhere; (sts=2, sw=2)

--HG--
extra : rebase_source : 7eedce0311b340c9a5a1265dc42d3121cc0f32a0
extra : amend_source : 9cb4ffdd5005f5c4c14172390dd00b04b2066cd7
2018-11-30 16:39:55 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Razvan Maries 77d87d9972 Merge mozilla-central to autoland. a=merge on a CLOSED TREE 2018-11-30 05:13:14 +02:00
Masayuki Nakano 7348477018 Bug 1510183 - Make HTMLEditor treat empty string attribute of style as nullptr of nsAtom rather than nsGkAtoms::_empty r=m_kato
After fixing bug 1427060, HTMLEditor treats attribute of style as nullptr.
However, if empty string is used to call NS_Atomize(), it returns
nsGkAtoms::_empty.  Therefore, HTMLEditor fails to check whether attribute is
specified or not with nullptr check since some root callers sets
nsGkAtoms::_empty instead of nullptr.

This patch makes HTMLEditor always use nullptr for empty string of attribute
of style with wrapping NS_Atomize() with AtomzieAttribute().  Additionally,
for safer change, this patch makes PropItem and TypeInState treat
nsGkAtom::_empty as nullptr.

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

--HG--
extra : moz-landing-system : lando
2018-11-30 01:21:59 +00:00
Jan Varga be167c5e0b Bug 1286798 - Part 10: Support for storage events; r=asuth,janv
Storage events are fired either directly after getting response from synchronous SetItem call or through observers. When a new onstorage event listener is added, we sycnhronously register an observer in the parent process. There's always only one observer actor per content process.
PBackgroundLSDatabase is now managed by a new PBackgroundLSObject protocol. PBackgroundLSObject is needed to eliminate the need to pass the principal info and document URI everytime a write operation occurs.
Preparation of an observer shares some states with preparation of a datastore, so common stuff now lives in LSRequestBase and preparation of a datastore now implements a nested state machine.

This patch was enhanced by asuth to drop observers only when the last storage listener is removed.
EventListenerRemoved is invoked on any removal, not just the final removal, so we need to make sure it's the final removal before dropping observer.
2018-11-29 21:47:45 +01:00
Jan Varga 60831f2e38 Bug 1286798 - Part 3: New basic (memory only) implementation of LocalStorage; r=asuth,mccr8
The implementation is based on a cache (datastore) living in the parent process and sync IPC calls initiated from content processes.
IPC communication is done using per principal/origin database actors which connect to the datastore.
The synchronous blocking of the main thread is done by creating a nested event target and spinning the event loop.
2018-11-29 21:47:20 +01:00
Geoff Brown 1ec332e1cb Bug 1511101 - Enable a few android 7.0 x86 mochitest; r=me,a=test-only 2018-11-29 11:03:05 -07:00
Kyle Machulis c241567f0f Bug 1505601 - Turn nsIDocShell XPIDL const lists into cenums; r=bzbarsky
Turn all const lists and related attributes into cenums, to provide a
vague sense of type safety.

Depends on D11715

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

--HG--
extra : moz-landing-system : lando
2018-11-28 03:30:56 +00:00
Ehsan Akhgari 2febd96e7e Bug 1508472 - Part 2: Second batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of
reformatting the entire tree over the comments would be minimal.  I've used a
combination of strategies including disabling of formatting, some manual
formatting and some changes to formatting to work around some clang-format
limitations.

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

--HG--
extra : moz-landing-system : lando
2018-11-28 00:54:56 +00:00
Cosmin Sabou 0afa5aa670 Backed out 2 changesets (bug 1508472) for causing build bustages on JobScheduler_posix.cpp. CLOSED TREE
Backed out changeset af951294cf96 (bug 1508472)
Backed out changeset 2320933cb7bc (bug 1508472)
2018-11-28 00:08:11 +02:00
Ehsan Akhgari 7c937c2747 Bug 1508472 - Part 2: Second batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of
reformatting the entire tree over the comments would be minimal.  I've used a
combination of strategies including disabling of formatting, some manual
formatting and some changes to formatting to work around some clang-format
limitations.

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

--HG--
extra : moz-landing-system : lando
2018-11-27 21:36:18 +00:00
Andreea Pavel 945463d394 Backed out changeset 11d6688b953f (bug 1508472) for build bustages on a CLOSED TREE 2018-11-27 18:28:30 +02:00
Ehsan Akhgari d0a3a76106 Bug 1508472 - Part 2: Second batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of
reformatting the entire tree over the comments would be minimal.  I've used a
combination of strategies including disabling of formatting, some manual
formatting and some changes to formatting to work around some clang-format
limitations.

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

--HG--
extra : moz-landing-system : lando
2018-11-27 15:18:32 +00:00
Makoto Kato fcd1b7a07f Bug 1054087 - Turn on test_dom_input_event_on_htmleditor.html for Android. r=masayuki
Android's test runner passes this test, so I would like to run
test_dom_input_event_on_htmleditor.html even if Android.

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

--HG--
extra : moz-landing-system : lando
2018-11-27 04:50:40 +00:00
Masayuki Nakano 7bd2c26c2c Bug 1288640 - Make TextComposition not dispatch eCompositionChange events (DOM "text" event) in the default group of web content r=smaug
The usage of our specific "text" event is enough low (0.0003%).  So, let's
stop dispatching the event in the default group of web content.  Once we
release this new behavior, we can get rid of dispatching the event even in
chrome.  Then, we can optimize the event order for new specs.

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

--HG--
extra : moz-landing-system : lando
2018-11-27 13:26:51 +00:00
Emilio Cobos Álvarez 9ed36d7ba6 Bug 1506547 - Align user-select behavior more with other UAs. r=mats
There's a few subtle behavior changes here, which I'll try to break down in the
commit message.

The biggest one is the EditableDescendantCount stuff going away. This
was added in bug 1181130, to prevent clicking on the non-editable div from
selecting the editable div inside. This is problematic for multiple reasons:

 * First, I don't think non-editable regions of an editable element should
   be user-select: all.

 * Second, it just doesn't work in Shadow DOM (the editable descendant count is
   not kept up-to-date when not in the uncomposed doc), so nested
   contenteditables behave differently inside vs. outside a Shadow Tree.

 * Third, I think it's user hostile to just entirely disable selection if you
   have a contenteditable descendant as a child of a user-select: all thing.

   WebKit behaves like this patch in the following test-case (though not Blink):

     https://crisal.io/tmp/user-select-all-contenteditable-descendant.html

   Edge doesn't seem to support user-select: all at all (no pun intended).

   But we don't allow to select anything at all which looks wrong.

 * Fourth, it's not tested at all (which explains how we broke it in Shadow DOM
   and not even notice...).

In any case I've verified that this doesn't regress the editor from that bug. If
this regresses anything we can fix it as outlined in the first bullet point
above, which should also make us more compatible with other UAs in that
test-case.

The other change is `all` not overriding everything else. So, something like:

  <div style="-webkit-user-select: all">All <div style="-webkit-user-select: none">None</div></div>

Totally ignores the -webkit-user-select: none declaration in Firefox before this
change. This doesn't match any other UA nor the spec, and this patch aligns us
with WebKit / Blink.

This in turn makes us not need -moz-text anymore, whose only purpose was to
avoid this.

This also fixes a variety of bugs uncovered by the previous changes, like the
SetIgnoreUserModify(false) call in editor being completely useless, since
presShell->SetCaretEnabled ended in nsCaret::SetVisible, which overrode it.

This in turn uncovered even more bugs, from bugs in the caret painting code,
like not checking -moz-user-modify on the right frame if you're the last frame
of a line, to even funnier bits where before this patch you show the caret but
can't write at all...

In any case, the new setup I came up with is that when you're editing (the
selection is focused on an editable node) moving the caret forces it to end up
in an editable node, thus jumping over non-editable ones.

This has the nice effect of not completely disabling selection of
-moz-user-select: all elements that have editable descendants (which was a very
ad-hoc hack for bug 1181130, and somewhat broken per the above), and also
not needing the -moz-user-select: all for non-editable bits in contenteditable.css
at all.

This also fixes issues with br-skipping like not being able to insert content in
the following test-case:

  <div contenteditable="true"><span contenteditable="false">xyz </span><br>editable</div>

If you start moving to the left from the second line, for example.

I think this yields way better behavior in all the relevant test-cases from bug
1181130 / bug 1109968 / bug 1132768, shouldn't cause any regression, and the
complexity is significantly reduced in some places.

There's still some other broken bits that this patch doesn't fix, but I'll file
follow-ups for those.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 09:21:37 +00:00
Masayuki Nakano 8cd4eff52f Bug 1497746 - part 6: Add static_assert for preventing TextEditor to grow up again r=m_kato
TextEditor instance is created per <input> element which has text editor and
<textarea> element.  Therefore, we should keep TextEditor slim as far as
possible.

Currently, TextEditor class size is 400 bytes on Win64.  So, we should keep
512 bytes border.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 06:33:28 +00:00
Masayuki Nakano 674c63397e Bug 1497746 - part 5: Make EditorBase not reserve array for its listeners unless listeners are important r=m_kato
A lot of listeners are now notified with RefPtr for concrete classes.
Therefore, we can reduce size of arrays to listeners without damage for
the performance.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 06:32:34 +00:00
Masayuki Nakano b376e84323 Bug 1497746 - part 4: Move EditorBase::mRangeUpdater to AutoEditActionDataSetter r=m_kato
Similar to EditorBase::mSavedSel, we can move EditorBase::mRangeUpdater too
because of it's referred only when there is AutoEditActionDataSetter instance
so that it also does not need to be in the cycle collection.

And now, it can be marked as MOZ_STACK_CLASS and remove cycle collection
support.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 06:31:56 +00:00
Masayuki Nakano 692bb4e545 Bug 1497746 - part 3: Move EditorBase::mSavedSel into AutoEditActionDataSetter r=m_kato
EditorBase::mSavedSel is used only by EditorBase methods which are called only
by AutoSelectionRestorer.  Additionally, AutoSelectionRestorer requires
AutoEditActionDataSetter instance.  So, we don't need to keep create for
editor instance anymore.  And also we don't need to keep it in the cycle
collection.

Note that SelectionState class is also used by PlaceholderTransaction.
Therefore, we cannot make it MOZ_STACK_CLASS.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 06:31:13 +00:00
Masayuki Nakano 6daceee1f1 Bug 1497746 - part 2: Move EditorBase::mDirection to EditorBase::AutoEditActionDataSetter r=m_kato
EditorBase::mDirection is set and clear only when
EditorBase::AutoEditActionDataSetter::SetTopLevelEditSubAction().  So, the
direction is related to the top level edit sub action, and we can move it
into AutoEditActionDataSetter.

Note that except EditSubAction::eDeleteSelectedContent, the relation between
sub-action and direction is fixed so that this patch checks the relation with
MOZ_ASSERT.  If we could replace EditSubAction::eDeleteSelectedContent with
information of direction, we'd remove the new member of
AutoEditActionDataSetter, though.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 06:30:29 +00:00
Masayuki Nakano 49181b7721 Bug 1497746 - part 1: Move EditorBase::mTopLevelEditSubAction to EditorBase::AutoEditActionDataSetter r=m_kato
EditorBase::mTopLevelEditSubAction is set only by
EditorBase::OnStartToHandleTopLevelEditSubAction() and
EditorBase::OnEndToHandleTopLevelEditSubAction() and they are called only by
AutoTopLevelEditSubActionNotifier().

So, this is used only in stack when a public method of editor is called.
Therefore, we can move it into EditorBase::AutoEditActionDataSetter.  Then,
we can reduce heap allocation for editor instances.

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

--HG--
extra : moz-landing-system : lando
2018-11-26 03:53:29 +00:00
Brindusan Cristian 31f0c21cca Backed out changeset 1575904619b5 (bug 1506547) for mochitest failures on test_reftests_with_caret.html. 2018-11-26 03:03:14 +02:00
Emilio Cobos Álvarez b74c31e4d9 Bug 1506547 - Align user-select behavior more with other UAs. r=mats
There's a few subtle behavior changes here, which I'll try to break down in the
commit message.

The biggest one is the EditableDescendantCount stuff going away. This
was added in bug 1181130, to prevent clicking on the non-editable div from
selecting the editable div inside. This is problematic for multiple reasons:

 * First, I don't think non-editable regions of an editable element should
   be user-select: all.

 * Second, it just doesn't work in Shadow DOM (the editable descendant count is
   not kept up-to-date when not in the uncomposed doc), so nested
   contenteditables behave differently inside vs. outside a Shadow Tree.

 * Third, I think it's user hostile to just entirely disable selection if you
   have a contenteditable descendant as a child of a user-select: all thing.

   WebKit behaves like this patch in the following test-case (though not Blink):

     https://crisal.io/tmp/user-select-all-contenteditable-descendant.html

   Edge doesn't seem to support user-select: all at all (no pun intended).

   But we don't allow to select anything at all which looks wrong.

 * Fourth, it's not tested at all (which explains how we broke it in Shadow DOM
   and not even notice...).

In any case I've verified that this doesn't regress the editor from that bug. If
this regresses anything we can fix it as outlined in the first bullet point
above, which should also make us more compatible with other UAs in that
test-case.

The other change is `all` not overriding everything else. So, something like:

  <div style="-webkit-user-select: all">All <div style="-webkit-user-select: none">None</div></div>

Totally ignores the -webkit-user-select: none declaration in Firefox before this
change. This doesn't match any other UA nor the spec, and this patch aligns us
with WebKit / Blink.

This in turn makes us not need -moz-text anymore, whose only purpose was to
avoid this.

This also fixes a variety of bugs uncovered by the previous changes, like the
SetIgnoreUserModify(false) call in editor being completely useless, since
presShell->SetCaretEnabled ended in nsCaret::SetVisible, which overrode it.

This in turn uncovered even more bugs, from bugs in the caret painting code,
like not checking -moz-user-modify on the right frame if you're the last frame
of a line, to even funnier bits where before this patch you show the caret but
can't write at all...

In any case, the new setup I came up with is that when you're editing (the
selection is focused on an editable node) moving the caret forces it to end up
in an editable node, thus jumping over non-editable ones.

This has the nice effect of not completely disabling selection of
-moz-user-select: all elements that have editable descendants (which was a very
ad-hoc hack for bug 1181130, and somewhat broken per the above), and also
not needing the -moz-user-select: all for non-editable bits in contenteditable.css
at all.

This also fixes issues with br-skipping like not being able to insert content in
the following test-case:

  <div contenteditable="true"><span contenteditable="false">xyz </span><br>editable</div>

If you start moving to the left from the second line, for example.

I think this yields way better behavior in all the relevant test-cases from bug
1181130 / bug 1109968 / bug 1132768, shouldn't cause any regression, and the
complexity is significantly reduced in some places.

There's still some other broken bits that this patch doesn't fix, but I'll file
follow-ups for those.

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

--HG--
extra : moz-landing-system : lando
2018-11-25 20:01:07 +00:00
Masayuki Nakano 4ca52542bb Bug 1504911 - part 5: Make HTMLEditor::InsertTableCellsWithTransaction() create AutoPlaceholderBatch and AutoTopLevelEditSubActionNotifier r=m_kato
Currently, calling nsITableEditor.insertTableCell() does not cause dispatching
"input" event since it does not create AutoPlaceholderBatch.  Additionally,
different from InsertTableRowsWithTransaction() and
InsertTableColumnsWithTransaction(), it does not create
AutoTopLevelEditSubActionNotifier.

Because of those APIs should work similarly, we should make it creates
both auto class instances.

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

--HG--
extra : moz-landing-system : lando
2018-11-21 09:30:40 +00:00
Masayuki Nakano b5ea72aa13 Bug 1504911 - part 3: Make TextEditRules::WillSetText() not handle anything when EditAction is eReplaceText r=m_kato
When all editor text is replaced while handling a user operation, editor
needs to dispatch "input" event.  Therefore, in such case, i.e., EditAction
is eReplaceText, TextEditor::SetTextAsSubAction() needs to handle it instead
of TextEditRules::WillSetText().

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

--HG--
extra : moz-landing-system : lando
2018-11-20 14:34:32 +00:00
Masayuki Nakano abe138f771 Bug 1504911 - part 1: Make all "input" event dispatcher in C++ use new utility method r=smaug
Currently, a lot of code dispatch "input" event and some of them dispatch
"input" event with wrong interface and/or values.  Therefore this patch
creates nsContentUtils::DispatchInputEvent() to make all of them dispatch
correct event.

Unfortunately, due to bug 1506439, we cannot set pointer to refcountable
classes of MOZ_CAN_RUN_SCRIPT method to nullptr.  Therefore, this patch
creates temporary RefPtr<TextEditor> a lot even though it makes damage to
the performance if it's in a hot path.

This patch makes eEditorInput event dispatched with
InternalEditorInputEvent when "input" event should be dispatched with
dom::InputEvent.  However, this patch uses WidgetEvent whose message is
eUnidentifiedEvent and setting WidgetEvent::mSpecifiedEventType to
nsGkAtoms::oninput when "input" event should be dispatched with
dom::Event because we need to keep that eEditorInput and
InternalEditorInputEvent are mapped each other.

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

--HG--
extra : moz-landing-system : lando
2018-11-21 03:59:02 +00:00
Masayuki Nakano 388e64d857 Bug 1504911 - part 0: Add "input" event tests into existing tests r=smaug
It's difficult to create new test which checks "input" events caused by
all edit operations especially when text is inserted from our UI.  Therefore,
this adds "input" event type checks into existing tests.

Additionally, this adds new test for MozEditableElement.setUserInput() whose
behavior needs to be fixed in this bug.

Currently, InputEvent interface should be used only on text controls or
contenteditable editor when dispatching "input" event.
https://w3c.github.io/input-events/#events-inputevents

You may feel odd to use different event interface for same "input" events.
However, other browsers also use InputEvent interface only in the cases. So,
we should follow them for now.

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

--HG--
extra : moz-landing-system : lando
2018-11-20 14:24:06 +00:00
Tom Schuster 5a9d2a428c Bug 1493292 - Remove aDataLen parameters from nsITransferable.getTransferData. r=smaug
Depends on D11200

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

--HG--
extra : moz-landing-system : lando
2018-11-20 16:59:56 +00:00
Csoregi Natalia df7483024d Backed out 6 changesets (bug 1493292) for bustage on /nsTransferable.cpp. CLOSED TREE
Backed out changeset f198bf91320b (bug 1493292)
Backed out changeset 6487aa307123 (bug 1493292)
Backed out changeset f2cabd69c568 (bug 1493292)
Backed out changeset 71430fceb4a3 (bug 1493292)
Backed out changeset 3a9b6d65d8c7 (bug 1493292)
Backed out changeset 55769869037c (bug 1493292)
2018-11-20 17:13:18 +02:00
Tom Schuster b292ec7c2c Bug 1493292 - Remove aDataLen parameters from nsITransferable.getTransferData. r=smaug
Depends on D11200

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

--HG--
extra : moz-landing-system : lando
2018-11-20 14:47:02 +00:00
Nika Layzell fe2f2478f7 Bug 1477432 - Part 2: Avoid using nsIJSID in GenerateQI, and produce better diagnostics, r=kmag
This is the first part of hiding the implementation of nsIJSID behind the
interface added in Part 1, such that we can substitute that implementation out.

I had to make a couple of changes to fix the errors caused by the new behaviour
in GenerateQI.

Differential Revision: https://phabricator.services.mozilla.com/D2279
2018-11-16 17:27:31 -05:00
Andreea Pavel 987516303f Backed out changeset f9900ac6071c (bug 571074) for failing clipboard at browser/base/content/test/general/browser_clipboard.js on a CLOSED TREE 2018-11-30 02:30:22 +02:00
Tom Schuster 891f0040e6 Bug 571074 - Mark nsITransferable.getTransferData as [must_use]. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D13454

--HG--
extra : moz-landing-system : lando
2018-11-29 21:57:40 +00:00
Edgar Chen 6562a13ff2 Bug 1504179 - Trigger first spell-checking by moving focus to contenteditable element; r=smaug
The current test has an incorrect expectation for the first full spell-checking,
it actually happens when first-time focus moves to contenteditable element
(which trigger dictionary updating), not right after document loaded.

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

--HG--
extra : moz-landing-system : lando
2018-11-14 12:38:46 +00:00
Geoff Brown 450e947af0 Bug 1503299 - Disable a clipboard mochitest on more android variants; r=me,a=test-only 2018-11-14 09:20:09 -07:00
Masayuki Nakano 89cf9854fe Bug 1505679 - Make HTMLEditor::RemoveList() sets specific EditAction when it's called by execCommand("insertorderedlist") or execCommand("insertunorderedlist") r=m_kato
Even when execCommand("insertorderedlist") and
execCommand("insertunorderedlist") remove existing lists, we need to set
InputEvent.inputType value to "insertOrderedList" or "insertUnorderedList".

Fortunately, the XPCOM method is used only for handling
execCommand("insertorderedlist") and execCommand("insertunorderedlist") on
Firefox.  Therefore, we should make it set EditAction to
EditAction::eRemoveOrderedListElement or EditAction::RemoveUnorderedListElement.

Note that comm-central uses this method directly and uses "cmd_removeList"
which causes calling the XPCOM method with empty string.  However, input
events for them won't be exposed to the web.  Therefore, it's okay to set
EditAction::eRemoveListElement for the other cases.

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

--HG--
extra : moz-landing-system : lando
2018-11-12 08:13:58 +00:00
Masayuki Nakano 0451a3f0a7 Bug 1504910 - part 3: Make TextEditor::OnDrop() remove selected content before inserting dropped content and fire "input" event before inserting first content r=m_kato
Both Chrome and Safari dispatches 2 sets of "beforeinput" and "input" events
when user drag and drop content in same editor.  One is "deleteByDrag" and
the other is "insertFromDrop".  We need to follow same behavior since
it should be able to cancel only "deleteByDrag" or "insertFromDrop" when
we implement "beforeinput" event.

HTMLEditor::InsertObject() may handle asynchronously.  And we don't need to
do anything additionally for HTMLEditor.  Therefore, TextEditor::OnDrop()
can delete selection before inserting dropped content by itself.

Therefore, this patch makes TextEditor::OnDrop() call
TextEditor::PrepareToInsertContent() and EditorBase::FireInputEvent() by
itself.

Unfortunately, it seems that we cannot write automated tests for this.
Even if using synthesizeMouse() of EventUtils, synthesizing mouse events
won't generate "dragover" nor "drop" events.  Perhaps, like EventUtils.js,
we need to do something with drag service, but it means that we cannot
emulate drag and drop in an editor.

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

--HG--
extra : moz-landing-system : lando
2018-11-12 07:19:01 +00:00
Masayuki Nakano 484de9a0c4 Bug 1504910 - part 2: Make TextEditor::InsertTextAt() and HTMLEditor::DoInsertHTMLWithContext() share preparation code before inserting content r=m_kato
Only TextEditor::InsertTextAt() and HTMLEditor::DoInsertHTMLWithContext()
removes selected content before pasting from clipboard or inserting dropped
content, and they do same things.  Therefore, they can share the code with
a helper method.

Note that this makes each root caller won't return NS_ERROR_EDITOR_DESTROYED
since the destruction is expected by web app.

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

--HG--
extra : moz-landing-system : lando
2018-11-12 01:40:46 +00:00
Masayuki Nakano 9f7af9d8fc Bug 1504910 - part 1: Clean up methods which are called by TextEditor::OnDrop() r=m_kato
TextEditor::OnDrop() calls TextEditor::InsertFromDataTransfer() or
HTMLEditor::InsertFromDataTransfer() and they are called only by
TextEditor::OnDrop().

TextEditor::InsertFromDataTransfer() calls only TextEditor::InsertTextAt()
and TextEditor::InsertTextAt() calls only TextEditor::InsertTextAsSubAction() if
insertion point is nullptr.  Therefore, if the callers sets nullptr, they
should call TextEditor::InsertTextAsSubAction() directly.  Then, we can
make TextEditor::InsertTextAt() require non-nullptr insertion point.

HTMLEditor::InsertFromDataTransfer() calls HTMLEditor::InsertObject(),
HTMLEditor::DoInsertHTMLWithContext() or TextEditor::InsertTextAt().

HTMLEditor::InsertObject() calls HTMLEditor::DoInsertHTMLWithContext()
directly or via BlobReader (in this case, calls asynchronously).

Unfortunately both HTMLEditor::InsertObject() and
HTMLEditor::DoInsertHTMLWithContext() are called by
HTMLEditor::InsertFromTransferable() which is paste event handler.  Therefore,
we cannot make them require non-nullptr insertion point, though, anyway,
they cannot become simpler even if we could do that.

This patch marks them as MOZ_CAN_RUN_SCRIPT as far as possible and
makes them take |const EditorDOMPoint&| for insertion point.

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

--HG--
extra : moz-landing-system : lando
2018-11-09 08:40:57 +00:00
Csoregi Natalia ce0127e7c1 Merge inbound to mozilla-central. a=merge 2018-11-07 18:17:51 +02:00
Masayuki Nakano 834ab00aaa Bug 1503231 - Make TextEditor::DeleteSelectionAsAction() removes removing range information from EditAction when Selection is NOT collapsed r=m_kato
When Selection is NOT collapsed, we remove selected content.  Therefore,
web apps don't need to know range information of user operation.  However, web
apps may want to know direction of the operation (backward or forward).  E.g.,
web apps may just mark selected range as "deleted" and move caret before or
after the range.

Therefore, when computed EditAction is eDeleteWordBackward or
eDeleteToBeginningOfSoftLine, we should use eDeleteBackward instead.  When it
is eDeleteWordForward or eDeleteToEndOfSoftLine, we should use eDeleteForward
instead.

Note that only on Windows, we follow behavior of richtext control (and Word).
That is, Ctrl + Backspace/Delete collapse from start of selected range to
start/end of current word.  I.e., collapsing Selection to start first and
removing to start or end of current word is Windows's standard behavior.
Currently, we do this in DeleteSelectionAsSubAction() but every caller
specifies eNone to aDirection except DeleteSelectionAsAction().  So, we can
move this before re-computing EditAction in DeleteSelectionAsAction().

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

--HG--
extra : moz-landing-system : lando
2018-11-07 08:38:15 +00:00
Dorel Luca ea6a7e7d8d Backed out 2 changesets (bug 1504913) for build bustage in build/src/extensions/spellcheck/src/mozSpellChecker.cpp
Backed out changeset 89e02e0a1b77 (bug 1504913)
Backed out changeset ef65164fcac0 (bug 1504913)
2018-11-07 04:06:58 +02:00
Makoto Kato d0181acf20 Bug 1504913 - Part 2. Get rid of nsISpellChecker. r=masayuki
No one uses nsISpellChecker, so let's get rid of nsISpellChecker.

Depends on D10993

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

--HG--
extra : moz-landing-system : lando
2018-11-06 09:18:05 +00:00
Makoto Kato 92cfcb047c Bug 1504913 - Part 1. Use mozSpellChecker directly instead of nsISpellChecker. r=masayuki
When creating an instance of nsISpellChecker, we always use
mozSpellChecker::Create.  So we should use mozSpellChecker directly instead of
nsISpellChecker.

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

--HG--
extra : moz-landing-system : lando
2018-11-06 09:15:56 +00:00
Gurzau Raul 8feb5a86ea Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-11-06 12:03:05 +02:00
Ehsan Akhgari 6f7b03e600 Bug 1504574 - Remove the XPCOM registration for nsDocumentEncoder; r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D10856
2018-11-05 23:16:04 -05:00
Masayuki Nakano 93bb048158 Bug 1504131 - part 3: Remove editor/libeditor/HTMLEditorObjectResizerUtils.h r=m_kato
Now, the header file is not necessary.

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

--HG--
extra : moz-landing-system : lando
2018-11-06 06:10:01 +00:00
Masayuki Nakano dbc466a1f7 Bug 1504131 - part 2: Remove ResizerMouseMotionListener r=m_kato
ResizerMouseMotionListener listens to "mousemove" events for resizers
or grabber to move absolutely position element and it calls only
HTMLEditor::MouseMove().  Fortunately, neither EditorEventListener not
HTMLEditorEventListener listens to "mousemove" events.  Therefore, we
can use HTMLEditorEventListener instead.

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

--HG--
extra : moz-landing-system : lando
2018-11-06 06:09:18 +00:00
Masayuki Nakano b5f863bf51 Bug 1504131 - part 1: Remove DocumentResizeEventListener r=m_kato
DocumentResizeEventListener listens to only "resize" events of the window
and when it fired, it just calls HTMLEditor::RefreshResizers().  Fortunately,
neither EditorEventListener nor HTMLEditorEventListener listens to "resize"
events.  Therefore, we can move this implementation into
HTMLEditorEventListener.

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

--HG--
extra : moz-landing-system : lando
2018-11-06 04:58:29 +00:00
Masayuki Nakano 027abbffa5 Bug 1504379 - Add automated tests for nsIPlaintextEditor.insertLineBreak() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D10805

--HG--
extra : moz-landing-system : lando
2018-11-06 03:47:38 +00:00
Makoto Kato b682338978 Bug 1504913 - Part 2. Get rid of nsISpellChecker. r=masayuki
No one uses nsISpellChecker, so let's get rid of nsISpellChecker.

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

--HG--
extra : rebase_source : 1caeba2edf7677258c0406f087eaa41e12cbb8a8
extra : histedit_source : 6a90572e8ecddf0f13fbe5b1abf1bedf1c84a4d9
2018-11-06 12:32:04 +09:00
Makoto Kato a9fe8aa60c Bug 1504913 - Part 1. Use mozSpellChecker directly instead of nsISpellChecker. r=masayuki
When creating an instance of nsISpellChecker, we always use
mozSpellChecker::Create.  So we should use mozSpellChecker directly instead of
nsISpellChecker.

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

--HG--
extra : rebase_source : 0feffa60e6dc788904d212a77acbf416279af083
extra : histedit_source : b89cc8270c2df70ae414479f43ac30e8aa0a3d42
2018-11-06 12:31:36 +09:00
Masayuki Nakano 2bde324acf Bug 1501663 - part 7: HTMLEditor::GetSelectedElement() shouldn't return element node when Selection starts before the element node r=m_kato
This fixes odd case of this API.  GetSelectedElement() ignores non-element
nodes before an element node.  This must be intended to allow Selection to
start from in an element node.  However, current code allows to select starting
from previous text node.  This patch changes this behavior to stop looking
for element node if non-element node appears before an element node.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 11:38:10 +00:00
Masayuki Nakano 189f0a35de Bug 1501663 - part 6: Get rid of |foundElmentInRange| r=m_kato
The |for| loop in HTMLEditor::GetSelectedElement() does not allow to be
after an element node because if another element is found, returns nullptr,
and if another non-element node is found, lastElementInRange which is
result of the method is cleared.  So, we checking lastElementInRange at
first of the for loop (i.e., immediately after calling
nsIContentIterator::Next()), we can get rid of use ugly bool flag.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 11:16:20 +00:00
Masayuki Nakano 8442e9e0f6 Bug 1501663 - part 5: Rewrite the loop in HTMLEditor::GetSelectedElement() with |for| r=m_kato
HTMLEditor::GetSelectedElement() uses |while| and calls
nsIContentIterator::Next() at the last line.  Therefore, it cannot use
early-continue style.  Because nsIContentIterator::Next() is always called,
it should be rewrite with |for|.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 11:07:34 +00:00
Masayuki Nakano db5abeb169 Bug 1501663 - part 4: Clean up first-half of HTMLEditor::GetSelectedElement() r=m_kato
HTMLEditor::GetSelectedElement() should use RangeBoundary to reduce auto
variables which are in large scope.  So, first optimization block can be
optimized with RangeBoundary.

Then, the second block, for handling nsGkAtoms::href, does not need to
retrieve AnchorRef() nor FocusRef() since this is exactly same as
StartRef() and EndRef() of the first range when there is only one selected
range.  So, the last |if| block in this block is not necessary since
this has already been handled by the first block.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 11:05:54 +00:00
Masayuki Nakano 82618136b1 Bug 1501663 - part 3: HTMLEditor::GetElementOrParentByTagNameInternal() shouldn't return <a> element when it's looking for nsGkAtoms::href or nsGkAtoms::anchor but found <a> element does not match with <a href="..."> or <a name="..."> r=m_kato
HTMLEditor::GetElementOrParentByTagNameInternal() may return <a> element
which does not match for nsGkAtoms::href or nsGkAtoms::anchor (in the former
case, it should return only an <a> element which has "href" attribute and
its value is not empty.  in the latter case, it should return only <a> element
which has "name" attribute and its value is not empty).

This patch makes it won't check found element's name when nsGkAtoms::href or
nsGkAtoms::anchor is specified.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 06:52:11 +00:00
Masayuki Nakano 2654031504 Bug 1501663 - part 2: HTMLEditor::GetSelectedElement() should return nullptr if 2 or more elements are in selected range r=m_kato
This is also regression of bug 1432944, but hidden by the optimization of
bug 1482019.

In bug 1482019, we removing the code clearing |found| flag when the loop
meets second element in selection range.
https://searchfox.org/mozilla-central/diff/0dd29e18302c5e6b07b88aac7164889d752acda7/editor/libeditor/HTMLEditor.cpp#2751-2753
because the flag won't be referred.

However, before the fix of bug 1432944, it's referred and the cleared flag
makes the method return nullptr.

Therefore, this patch makes it return nullptr when 2 or more elements are
in selected range.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 04:57:02 +00:00
Masayuki Nakano fa95dc80c3 Bug 1501663 - part 1: HTMLEditor::GetSelectedElement() should return nullptr when first found element is not what the caller is looking for r=m_kato
This takes back old behavior, 59 or earlier version.

|selectedElement| may be set to an element which is not what the caller is
looking for.  Therefore, if the first element node in the selected range is
not what the caller is looking for, it should return nullptr.

This regression is caused by this changeset:
https://hg.mozilla.org/mozilla-central/rev/93c1d149d757 (bug 1432944)

Additionally, this patch modifies the automated test for conforming to
original idea of the API.  This API must not be intended to retrieve
usual inline elements like <b>, <i>, etc.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 03:52:10 +00:00
Masayuki Nakano f6c59cabb6 Bug 1504093 - Make DocumentResizeEventListener::HandleEvent() call public methods of HTMLEditor r=m_kato
DocumentResizeEventListener::HandleEvent() calls protected method,
HTMLEditor::RefreshResizersInternal().  However, this method is an event
handler, i.e., called when the editor is not handling an edit action.

Therefore, for ensuring AutoEditActionDataSetter instance, it should call
public method, nsIHTMLEditor::RefereshResizers() instead.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 06:28:53 +00:00
Masayuki Nakano 9d4ed3f232 Bug 1503744 - Make HTMLEditor::SetHTMLBackgroundColorWithTransaction() not refer RefPtr after moving it r=m_kato
Simple fix of crash caused by referring nullptr.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 02:13:05 +00:00
Masayuki Nakano dbbd5b9823 Bug 1503565 - Make HTMLEditor::BlobReader::OnResult() create AutoEditActionDataSetter r=m_kato
HTMLEditor::BlobReader::OnResult() is a callback method and it calls
non-public method of HTMLEditor, DoInsertHTMLWithContext().  So,
DoInsertHTMLWithContext() may need caller to have already created
AutoEditActionDataSetter instance.  Therefore, BlobReader should keep
EditAction which is the purpose of creating it and its OnResult() should
create AutoEditActionDataSetter instance with it.

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

--HG--
extra : moz-landing-system : lando
2018-11-05 02:12:27 +00:00
Masayuki Nakano 8e6dd0bc8a Bug 1503473 - part 5: Move InsertParagraphSeparator*() into HTMLEditor r=m_kato
Now, TextEditor needs only InsertLineBreak*() so that
InsertParagraphSeparator*() is necessary only in HTMLEditor.
With overriding nsIPlaintextEditor::InsertLineBreak() in HTMLEditor,
we can do it simply.

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

--HG--
extra : moz-landing-system : lando
2018-11-03 04:19:22 +00:00
Masayuki Nakano 9b49e5d514 Bug 1503473 - part 4: Create a new path to handle Enter key press in TextEditor r=m_kato
This patch creates new path to insert a line break in TextEditor.

Declares new EditSubAction::eInsertLineBreak and makes the path use
EditAction::eInsertLineBreak instead of EditAction::eInsertParagraphSeparator.

Unfortunately, this patch makes TextEditor::InsertLineBreakAsAction() as
a virtual method for keeping this change as small as possible.

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

--HG--
extra : moz-landing-system : lando
2018-11-03 11:22:13 +00:00
Masayuki Nakano 7c5fc30479 Bug 1503473 - part 3: Move inserting a line break code in TextEditor::InsertParagraphSeparatorAsSubAction() to TextEditRules::WillInsertLineBreak() r=m_kato
When TextEditRules::WillDoAction() and HTMLEditRules::WillDoAction() didn't
return error, didn't handle it, and didn't cancel it,
TextEditor::InsertParagraphSeparatorAsSubAction() inserts a line breaker.
However, this case is only when the instance is TextEditRules and
TextEditRules::WillInsertLineBreak() prepares to insert a line break without
any errors.  So, we can move the part into TextEditRules::WillInsertLineBreak()
simply.

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

--HG--
extra : moz-landing-system : lando
2018-11-03 11:21:15 +00:00
Masayuki Nakano 5787ea1b53 Bug 1503473 - part 2: Make TextEditRules::WillInsertBreak() and HTMLEditRules::WillInsertBreak() return EditActionResult r=m_kato
With this cleaning up, we can know when they return NS_OK with both
aCanceled is false and aHandled is false.  (Look for EditActionIgnored().)

Additionally, this patch renames HTMLEditRules::WillInsertBreak() to
WillInsertParagraphSeparator() and TextEditRules::WillInsertBreak() to
TextEditRules::WillInsertLineBreak().

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

--HG--
extra : moz-landing-system : lando
2018-11-03 11:20:06 +00:00
Masayuki Nakano 18ee481a2d Bug 1503473 - part 1: Rename TextEditor::OnInputParagraphSeparator() and HTMLEditor::OnInputLineBreak() r=m_kato
TextEditor::OnInputParagraphSeparator() and HTMLEditor::OnInputLineBreak() are
also used by command handlers.  Therefore, they should be renamed to
TextEditor::InsertParagraphSeparatorAsAction() and
HTMLEditor::InsertLineBreakAsAction().  Then, current
TextEditor::InsertParagraphSeparatorAsAction() should be renamed to
AsSubAction() and each caller of it should create AutoPlaceholderBatch
by themselves.

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

--HG--
extra : moz-landing-system : lando
2018-11-03 11:19:07 +00:00
Cosmin Sabou 7da86ef60f Backed out 5 changesets (bug 1503473) for crashes in Thunderbird on request of jorgk. a=backout
Backed out changeset a7f7d9f366b9 (bug 1503473)
Backed out changeset d067907793ef (bug 1503473)
Backed out changeset 130ba0de053f (bug 1503473)
Backed out changeset ec732243e9ad (bug 1503473)
Backed out changeset 13511cab2b41 (bug 1503473)
2018-11-03 02:08:42 +02:00
Masayuki Nakano d481dba0c1 Bug 1503473 - part 5: Move InsertParagraphSeparator*() into HTMLEditor r=m_kato
Now, TextEditor needs only InsertLineBreak*() so that
InsertParagraphSeparator*() is necessary only in HTMLEditor.
With overriding nsIPlaintextEditor::InsertLineBreak() in HTMLEditor,
we can do it simply.

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

--HG--
extra : moz-landing-system : lando
2018-11-02 14:24:33 +00:00
Masayuki Nakano b1587d8dd4 Bug 1503473 - part 4: Create a new path to handle Enter key press in TextEditor r=m_kato
This patch creates new path to insert a line break in TextEditor.

Declares new EditSubAction::eInsertLineBreak and makes the path use
EditAction::eInsertLineBreak instead of EditAction::eInsertParagraphSeparator.

Unfortunately, this patch makes TextEditor::InsertLineBreakAsAction() as
a virtual method for keeping this change as small as possible.

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

--HG--
extra : moz-landing-system : lando
2018-11-02 13:10:43 +00:00
Masayuki Nakano 4cd5738394 Bug 1503473 - part 3: Move inserting a line break code in TextEditor::InsertParagraphSeparatorAsSubAction() to TextEditRules::WillInsertLineBreak() r=m_kato
When TextEditRules::WillDoAction() and HTMLEditRules::WillDoAction() didn't
return error, didn't handle it, and didn't cancel it,
TextEditor::InsertParagraphSeparatorAsSubAction() inserts a line breaker.
However, this case is only when the instance is TextEditRules and
TextEditRules::WillInsertLineBreak() prepares to insert a line break without
any errors.  So, we can move the part into TextEditRules::WillInsertLineBreak()
simply.

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

--HG--
extra : moz-landing-system : lando
2018-11-02 08:58:29 +00:00
Masayuki Nakano 5ed27c4ca6 Bug 1503473 - part 2: Make TextEditRules::WillInsertBreak() and HTMLEditRules::WillInsertBreak() return EditActionResult r=m_kato
With this cleaning up, we can know when they return NS_OK with both
aCanceled is false and aHandled is false.  (Look for EditActionIgnored().)

Additionally, this patch renames HTMLEditRules::WillInsertBreak() to
WillInsertParagraphSeparator() and TextEditRules::WillInsertBreak() to
TextEditRules::WillInsertLineBreak().

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

--HG--
extra : moz-landing-system : lando
2018-11-02 07:48:25 +00:00
Masayuki Nakano 6ba637600b Bug 1503473 - part 1: Rename TextEditor::OnInputParagraphSeparator() and HTMLEditor::OnInputLineBreak() r=m_kato
TextEditor::OnInputParagraphSeparator() and HTMLEditor::OnInputLineBreak() are
also used by command handlers.  Therefore, they should be renamed to
TextEditor::InsertParagraphSeparatorAsAction() and
HTMLEditor::InsertLineBreakAsAction().  Then, current
TextEditor::InsertParagraphSeparatorAsAction() should be renamed to
AsSubAction() and each caller of it should create AutoPlaceholderBatch
by themselves.

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

--HG--
extra : moz-landing-system : lando
2018-11-02 03:36:36 +00:00
Ciure Andrei 83010e5db0 Merge inbound to mozilla-central. a=merge 2018-11-02 18:44:43 +02:00
Makoto Kato 2fe36cbaf4 Bug 1501376 - Part 2. Add mochitest. r=masayuki
Since reftest doesn't access clipboard, this test is implemented by mochitest
even if this compares with image.

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

--HG--
extra : rebase_source : ef7bd6cc081ee5b5b821fdcef24b1c20c5315f49
2018-11-02 19:48:55 +09:00
Makoto Kato ad68faeb0f Bug 1501376 - Part 1. Pasting into GeckoView briefly displays text content in password field. r=masayuki
When inputting any character in password field, character isn't masked
immediately since echo password is turned on Android. But when pasting text,
the text is masked immediately on Blink and Android OS.

So we should adopt this behaviour on Gecko too.

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

--HG--
extra : rebase_source : b4bc026569e61fee697cb538719216fb258a11ae
2018-11-02 16:33:58 +09:00
Tom Schuster 8c1f89b6e5 Bug 1503588 - Remove aDataLen parameter from nsITransferable.getAnyTransferData. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D10441

--HG--
extra : moz-landing-system : lando
2018-11-02 11:02:25 +00:00
Masayuki Nakano 63f8b9a61d Bug 1503457 - Add some variation of EditAction values for composition r=m_kato
Input Events Level 2 declares "deleteByComposition" for empty composition
removes selected content and "deleteCompositionText" for canceling composition.
https://w3c.github.io/input-events/#interface-InputEvent-Attributes

Therefore, TextEditor::OnCompositionChange() should use a new EditAction for
the former only when new composition string is empty, there is no composition
string and there is non-collapsed Selection.

And also TextEditor::OnCompositionEnd() should use another new EditAction for
the latter when composition is canceled with empty string (we don't restore
selected content which is removed by the composition).

Additionally, due to bug 1305387, we don't dispatch "input" event when
we handle TextEditor::OnCompositionChange().  Instead, we dispatch it
when we handle TextEditor::OnCompositionEnd().  Therefore, we need to
use EditAction::eCommitComposition in TextEditor::OnCompositionEnd().

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

--HG--
extra : moz-landing-system : lando
2018-11-01 08:07:04 +00:00
Edgar Chen 81dcbf85e4 Bug 1497480 - Part 3: Add tests for spell-checking in ShadowDOM; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D9802

--HG--
extra : moz-landing-system : lando
2018-11-02 00:07:30 +00:00
Gabriele Svelto 266ef73c96 Bug 1503207 - Remove nsWeakPtr.h and cleanup all files including weak reference-related headers r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D10251

--HG--
extra : moz-landing-system : lando
2018-10-31 20:39:03 +00:00
Cosmin Sabou 223a549fe5 Backed out 3 changesets (bug 1497480) for causing Android mochitest failures on editor/libeditor/tests/test_bug. CLOSED TREE
Backed out changeset 6c2a5ce9fad8 (bug 1497480)
Backed out changeset cf74ff09b141 (bug 1497480)
Backed out changeset 31d9a680fb90 (bug 1497480)
2018-10-31 19:06:35 +02:00
Edgar Chen 4b3c7c5c9a Bug 1497480 - Part 3: Add tests for spell-checking in ShadowDOM; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D9802

--HG--
extra : moz-landing-system : lando
2018-10-31 14:44:53 +00:00
Masayuki Nakano d97102c926 Bug 1465702 - part 7: Make protected/private methods of EditorBase/TextEditor/HTMLEditor use SelectionRefPtr() instead of GetSelection() r=m_kato
Now, any protected/private methods of editor classes can refer
SelectionRefPtr() safely.  So, we can cut the cost of calling GetSelection()
only once per edit action handling.

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

--HG--
extra : moz-landing-system : lando
2018-10-30 10:04:08 +00:00
Masayuki Nakano 53578eb0db Bug 1465702 - part 6: Remove unnecessary Selection argument from TextEditRules and HTMLEditRules and rename/reimplement TextEditRules::SelectionRef() as TextEditRules::SelectionRefPtr() r=m_kato
When each method of TextEditRules and HTMLEditRules should be called only by
EditorBase/TextEditor/HTMLEditor while the editor instance has
AutoEditActionDataSetter instance.  Therefore, we can get rid of all
pointers/references of Selection from each method's argument.

Additionally, this reimplements TextEditRules::SelectionRef() with
EditorBase::SelectionRefPtr() and make it return |const RefPtr<Selection>&|
rather than |Selection&| since RefPtr reference is required when we call
methods which are marked as MOZ_CAN_RUN_SCRIPT.

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

--HG--
extra : moz-landing-system : lando
2018-10-30 10:02:58 +00:00
Masayuki Nakano f91716e775 Bug 1465702 - part 5: Remove unnecessary Selection argument from editor module r=m_kato
EditorBase::SelectionRefPtr() is now safe to use in editor and really fast to
retrieve Selection than EditorBase::GetSelection().  Therefore, we can get rid of
all Selection pointer/reference argument of each method which always take
normal Selection.

Note that this changes nsIHTMLEditor.checkSelectionStateForAnonymousButtons()
because its argument is only Selection.  So, BlueGriffon should work even
though it calls the method with nsIEditor.selection.

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

--HG--
extra : moz-landing-system : lando
2018-10-30 10:01:38 +00:00
Masayuki Nakano 41166eca5f Bug 1465702 - part 4: Make public methods of HTMLEditor create AutoEditActionDataSetter if necessary r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D10008

--HG--
extra : moz-landing-system : lando
2018-10-30 10:00:17 +00:00
Masayuki Nakano 062a07e7b0 Bug 1465702 - part 3: Make public methods of TextEditor create AutoEditActionDataSetter if necessary r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D10007

--HG--
extra : moz-landing-system : lando
2018-10-30 09:59:33 +00:00
Masayuki Nakano 779965a889 Bug 1465702 - part 2: Make public methods of EditorBase create AutoEditActionDataSetter if necessary r=m_kato
This patch makes public methods of EditorBase create AutoEditActionDataSetter
as far as possible.  However, does not do so for some public methods if they are
not necessary to create it.

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

--HG--
extra : moz-landing-system : lando
2018-10-30 09:57:52 +00:00
Masayuki Nakano 7f8df77fb6 Bug 1465702 - part 1: Add EditorBase::AutoEditActionDataSetter to store edit action and grab Selection instance while editor classes handle an edit action r=m_kato
Like TextEditRules, EditorBase should have a stack class which cache necessary
objects and current handling edit action.  The edit action will be necessary
when we implement InputEvent.inputType.

Different from TextEditRules, this adds |const RefPtr<Selection>&| instead
of |Selection&|.  The reason is, when I add MOZ_CAN_RUN_SCRIPT to some methods,
it's not allowed like this:

> foo->CanRunScriptMethod(SelectionRef());

I'll update TextEditRules for consistency in the following patches.

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

--HG--
extra : moz-landing-system : lando
2018-10-30 09:56:41 +00:00
Makoto Kato 0ca1f40c1b Bug 1485890 - Remove dumpContentTree, debugDumpContent and debugUnitTests from nsIEditor. r=masayuki
Since bug 1491173 is landed, there is no users of dumpContentTree,
debugDumpContent and debugUnitTests.  So Let's remove these methods from
nsIEditor.

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

--HG--
extra : moz-landing-system : lando
2018-10-29 07:23:49 +00:00
Masayuki Nakano 9507d36bda Bug 1501259 - HTMLEditor::InsertAsPlaintextQuotation() shouldn't refer |newNode| after calling its |forget()| r=m_kato
Regression of bug 1476897, HTMLEditor::InsertAsPlaintextQuotation() refers
|newNode| which is new created <span> element by the method at collapsing
Selection.  However, it's already been moved to its out param.  Therefore,
after the fix of bug 1476897, it won't collapse Selection.  This patch
moves the code moving |newNode| to the out param after collapsing Selection.

Additionally, this makes HTMLEditor::InsertAsCitedQuotationInternal() use
same style code around collapsing Selection since it's also tested by the
new test of nsIEditorMailSupport.insertAsCitedQuotation().

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

--HG--
extra : moz-landing-system : lando
2018-10-29 04:13:50 +00:00
Cristina Coroiu aea73c87db Bug 1446282 - Disable browser_bug629172.js on debug mac and win10x64 for frequent failures. r=jmaher
--HG--
extra : histedit_source : da7342ce510c03304865c910085c32c841430a19
2018-10-25 20:25:00 +03:00
Masayuki Nakano 51565faee9 Bug 1501260 - Make HTMLEditRules::DocumentModifiedWorker() create bogus node via editor instance r=m_kato
HTMLEditRules::DocumentModifiedWorker() may be called asynchronously via
AddScriptRunnder. Therefore, this may not be in the stack while editor handles
an edit action. Then, HTMLEditRules cannot access edit action data which will
be put on the stack after fixing bug 1465702. So, it should do it after once
calling a method of editor instance (and editor instance should call back
proper HTMLEditRules method).

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

--HG--
extra : moz-landing-system : lando
2018-10-25 05:55:04 +00:00
Masayuki Nakano ede88b49c1 Bug 1501180 - Make TextEditRules::Notify() hide input characters via editor instance r=m_kato
TextEditRules::Notify() is callback of the timer.  Therefore, this won't be
in the stack while editor handles an edit action.  Then, TextEditRules
cannot access edit action data which will be put on the stack after fixing
bug 1465702.  So, it should do it after once calling a method of editor
instance (and editor instance should call back proper TextEditRules method).

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

--HG--
extra : moz-landing-system : lando
2018-10-25 03:35:26 +00:00
Masayuki Nakano 446538a446 Bug 1501177 - Create HTMLEditor::InsertAsCitedQuotationInternal() for internal use of nsIEditorMailSupport::InsertAsCitedQuotation() r=m_kato
HTMLEditor::InsertAsCitedQuotation() is an XPCOM method, so, it shouldn't be
used for internal use.  Instead, there should be non-virtual method and
InsertAsCitedQuotation() should use it.

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

--HG--
extra : moz-landing-system : lando
2018-10-25 04:49:13 +00:00
Masayuki Nakano cb95d44ffc Bug 1500862 - part 3: Change all stack base helper classes which access protected members of EditorBase to nested classes of EditorBase r=m_kato
AutoTransactionBatch, AutoPlaceholderBatch, AutoSelectionRestorer,
AutoTopLevelEditSubActionNotifier, AutoTransactionsConserveSelection and
AutoUpdateViewBatch access protected members of EditorBase.  The access
scope management assume that they are used only by EditorBase or its
subclasses or TextEditRules or its inherited class (i.e., HTMLEditRules).

For guaranteeing this at build-time, we should change them to nested classes
of EditorBase.  Then, EditorBase and its subclasses and friends can use them.

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

--HG--
extra : moz-landing-system : lando
2018-10-24 09:42:06 +00:00
Masayuki Nakano 87499ae61c Bug 1500862 - part 2: Create AutoTransactionBatchExternal class which calls XPCOM methods instead of non-virtual internal methods r=m_kato
Unfortunately, TextServicesDocument::InsertText() is too complicated to
do it with both editor class and TextServicesDocument separately.
Therefore, this patch adds AutoTransactionBatchExternal class which is
almost same as AutoTransactionBatch but uses XPCOM methods to begin/end
transaction.  This change helps editor to manage whether it starts to
handle new edit action or not when BeginTransaction() is called explicitly.

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

--HG--
extra : moz-landing-system : lando
2018-10-24 05:18:40 +00:00
Masayuki Nakano 25b5b80801 Bug 1500862 - part 1: Make HTMLEditor::SetInlineProperty() remove exclusive style automatically r=m_kato
StyleUpdatingCommand::ToggleState() removes exclusive style when it sets
superscript style or subscript style.  However, it accesses protected
members of EditorBase via AutoTransactionBatch even though it's outside
of editor classes.

This patch moves the removing exclusive style code from the method to
HTMLEditor::SetInlineProperty() and rename it "AsAction".

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

--HG--
extra : moz-landing-system : lando
2018-10-24 04:17:42 +00:00
Julian Descottes 52b85a20e2 Bug 1499096 - Update wrong usage of ok() with todo_is();r=Standard8
Depends on D8739.
This changeset updates calls to ok() that were most likely intended
for is(), but are not working as is.

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

--HG--
extra : moz-landing-system : lando
2018-10-23 07:13:02 +00:00
Julian Descottes 2fcd6cb020 Bug 1499096 - Update tests using ok() to is();r=Standard8
This changeset updates all the test that were wrongly using ok() and wanted to
use is() AND for which the assert is still passing without any modification
required.

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

--HG--
extra : moz-landing-system : lando
2018-10-23 07:12:23 +00:00
Masayuki Nakano cda6a9ac80 Bug 1484126 - part 21: Rewrite some loops in HTMLTableEditor.cpp with CellData::NextColumnIndex() or CellData::NextRowIndex() r=m_kato
A lot of loops in HTMLTableEditor.cpp scans cells along column-axis or
row-axis.  In those cases, they need to skip columns/rows which are spanned
from prior column/row.  So, we can rewrite them with CellData::NextColumnIndex()
or CellData::NextRowColumn().

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

--HG--
extra : moz-landing-system : lando
2018-10-16 01:10:44 +00:00
Masayuki Nakano deccc4b041 Bug 1484126 - part 20: Replace |CellData::mFirst.mColumn + CellData::mEffectiveColSpan| with CellData::NextColumnIndex() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8357

--HG--
extra : moz-landing-system : lando
2018-10-15 11:37:38 +00:00
Masayuki Nakano 4b04d7a2fa Bug 1484126 - part 19: Replace |CellData::mCurrent.mColumn + CellData::NumberOfFollowingColumns()| with CellData::LastColumnIndex() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8356

--HG--
extra : moz-landing-system : lando
2018-10-15 11:35:33 +00:00
Masayuki Nakano 1e41589a76 Bug 1484126 - part 18: Make HTMLEditor::InsertTableCellsWithTransaction() use CellData::NextColumnIndex() instead of |CellData::mCurrent::mColumn + CellData::mColSpan| r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8355

--HG--
extra : moz-landing-system : lando
2018-10-15 11:35:10 +00:00
Masayuki Nakano fa7eb4fc9f Bug 1484126 - part 17: Make all CellData users refer CellData::mIsSelected directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8354

--HG--
extra : moz-landing-system : lando
2018-10-15 11:34:40 +00:00
Masayuki Nakano cad6cdb5d5 Bug 1484126 - part 16: Replace |CellData::mEffectiveColSpan - 1| with CellData::NumberOfFollowingColumns() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8353

--HG--
extra : moz-landing-system : lando
2018-10-15 11:34:06 +00:00
Masayuki Nakano 140330e8d3 Bug 1484126 - part 15: Make all CellData users refer CellData::mEffectiveColspan directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8352

--HG--
extra : moz-landing-system : lando
2018-10-15 11:33:33 +00:00
Masayuki Nakano ff86516630 Bug 1484126 - part 14: Replace |CellData::mEffectiveRowSpan - 1| with CellData::NumberOfFollowingRows() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8351

--HG--
extra : moz-landing-system : lando
2018-10-15 11:15:15 +00:00
Masayuki Nakano 5c8e2f568e Bug 1484126 - part 13: Make all CellData users refer CellData::mEffectiveRowSpan directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8350

--HG--
extra : moz-landing-system : lando
2018-10-15 10:44:08 +00:00
Masayuki Nakano d4155efc9f Bug 1484126 - part 12: Make all CellData users refer CellData::mColSpan directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8349

--HG--
extra : moz-landing-system : lando
2018-10-15 08:22:29 +00:00
Masayuki Nakano e782a5f973 Bug 1484126 - part 11: Make all CellData users refer CellData.mRowSpan directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8348

--HG--
extra : moz-landing-system : lando
2018-10-15 08:14:18 +00:00
Masayuki Nakano 5b5f57c621 Bug 1484126 - part 10: Replace all comparisons of CellData::mFirst.mColumn and CellData::mCurrent.mColumn with CellData::IsSpannedFromOtherColumn() or CellData::IsSpannedFromOtherRowOrColumn() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8347

--HG--
extra : moz-landing-system : lando
2018-10-15 08:06:14 +00:00
Masayuki Nakano 632c38026b Bug 1484126 - part 9: Make all CellData users refer CellData::mFirst.mColumn directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8346

--HG--
extra : moz-landing-system : lando
2018-10-15 07:37:57 +00:00
Masayuki Nakano 44e8323821 Bug 1484126 - part 8: Replace |CellData::mCurrent.mRow - CellData::mFirst.mRow| with CellData::NumberOfPrecedingRows() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8345

--HG--
extra : moz-landing-system : lando
2018-10-15 05:06:13 +00:00
Masayuki Nakano 9b2f3a5b31 Bug 1484126 - part 7: Replace all comparisons of CellData::mFirst.mRow and CellData::mCurrent.mRow with CellData::IsSpannedFromOtherRow() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8344

--HG--
extra : moz-landing-system : lando
2018-10-15 04:21:34 +00:00
Masayuki Nakano cf118e4bf3 Bug 1484126 - part 6: Make all CellData users refer CellData::mFirst.mRow directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8343

--HG--
extra : moz-landing-system : lando
2018-10-15 04:10:32 +00:00
Masayuki Nakano 32323fbf7f Bug 1484126 - part 5: Make all CellData users refer CellData::mElement directly r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8342

--HG--
extra : moz-landing-system : lando
2018-10-15 04:06:32 +00:00
Masayuki Nakano 57ed02b758 Bug 1484126 - part 4: Make all CellData users use CellData::mCurrent.mColumn r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8341

--HG--
extra : moz-landing-system : lando
2018-10-15 02:01:09 +00:00
Masayuki Nakano 5c59a980fc Bug 1484126 - part 3: Make all CellData users use CellData::mCurrent.mRow r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8340

--HG--
extra : moz-landing-system : lando
2018-10-15 01:43:54 +00:00
Masayuki Nakano 2bf1b6ac55 Bug 1484126 - part 2: Make all nsITableEditor::GetCellDataAt() use CellData r=m_kato
This patch makes all nsITableEditor::GetCellDataAt() use CellData, and if
each caller checks the result of GetCellDataAt() with NS_FAILED(), this
replaces it with CellData::FailedOrNotFound() since GetCellDataAt() returns
error even when it does not find a cell element.  Finally, copies each
CellData member to the variable which received corresponding value from
GetCellDataAt() for making this change safe.  Note that for easier to review,
the copying blocks have odd indent.  Those variables will be removed or
corrected the indent by the following patches.

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

--HG--
extra : moz-landing-system : lando
2018-10-15 01:43:11 +00:00
Masayuki Nakano 08c4b07fc9 Bug 1484126 - part 1: Create CellData struct which implements nsITableEditor::GetCellDataAt() r=m_kato
nsITableEditor::GetCellDataAt() is an XPCOM method but used internally a lot.
Additionally, it scatters a lot of variables (including unused) since it takes
a lot of out arguments to return.  Therefore, this should be implemented as
struct and users should refer each member as result.

This does not replaces the callers yet since it's too risky if the caller is
not tested by automated test.  Following patches will replace the method call
and each variable step by step.

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

--HG--
extra : moz-landing-system : lando
2018-10-12 13:40:25 +00:00
Masayuki Nakano e7eda01d23 Bug 1484126 - part 0: Add automated tests for nsITableEditor.getCellDataAt() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D8337

--HG--
extra : moz-landing-system : lando
2018-10-12 04:09:19 +00:00
Masayuki Nakano 1c08e312af Bug 1497815 - Rename EditorEventListener::EnsureCommitCompoisition() to EditorEventListener::EnsureCommitComposition() r=m_kato
Just fixing typo of the method name.

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

--HG--
extra : moz-landing-system : lando
2018-10-11 09:12:15 +00:00
Masayuki Nakano 5c47cf2ccf Bug 1461708 - part 8: Make EventStateManager handle middle click paste as a default action of mouseup event r=smaug
This patch makes EventStateManager handle middle click paste as a default
action.

Unfortunately, we cannot remove the call of HandleMiddleClickPaste() in
EditorEventListener because it's important to consume middle click event
before any elements in the editor.  For example, if clicked HTMLEditor has
non-editable <a href> element, middle click event needs to be handled by the
editor rather than contentAreaUtils which handles click events of <a href>
elements.  The cause of this kind of issues is, any click event handlers
which handle non-primary button events still listen to "click" events.
Therefore, this patch makes HandleMiddleClickPaste() do nothing if the mouseup
event is fired on an editor.

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

--HG--
extra : moz-landing-system : lando
2018-10-10 12:06:17 +00:00
Masayuki Nakano 9b40433ef6 Bug 1461708 - part 7: Make EventStateManager::HandleMiddleClickPaste() dispatch ePaste event by itself r=smaug
This is preparation of the last patch.  Even if no editor is clicked with
middle button, we need to do:
- collapse Selection at the clicked point.
- dispatch "paste" event.

Therefore, HandleMiddleClickPaste() should dispatch ePaste event by itself
and each editor methods should have a bool argument which the caller wants
ePaste event automatically.

Note that Chromium dispatches "paste" event and pastes clipboard content
into clicked editor even if preceding "auxclick" event is consumed.
However, our traditional behavior is not dispatching "paste" event nor
pasting clipboard content.  Unless Chromium developer keeps their odd
behavior, we should keep our traditional behavior since our behavior is
conforming to DOM event model.

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

--HG--
extra : moz-landing-system : lando
2018-10-10 12:05:39 +00:00
Masayuki Nakano d581c69689 Bug 1461708 - part 6: Make EditorEventListener::MouseClick() use WidgetMouseEvent instead of dom::MouseEvent r=m_kato
The event argument of only EditorEventListener::MouseClick() can be replaced
with WidgetMouseEvent simply.  So, for avoiding unnecessary RefPtr in
EditorEventListener::HandleEvent(), we should fix this now.

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

--HG--
extra : moz-landing-system : lando
2018-10-10 12:05:21 +00:00
Masayuki Nakano fd4e78f2a1 Bug 1461708 - part 5: Move EditorEventListener::HandleMiddleClickPaste() to EventStateManager r=smaug
EventStateManager needs to handle middle click paste without editor.
Therefore, the handler should be in EventStateManager.

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

--HG--
extra : moz-landing-system : lando
2018-10-10 12:04:17 +00:00
Masayuki Nakano d472d6f312 Bug 1461708 - part 4: Move implementation of UIEvent::GetRangeParent() and UIEvent::RangeOffset() to nsLayoutUtils r=smaug
We need to move EditorEventListener::HandleMiddleClickPaste() into
EventStateManager to handle middle click paste after all click events are
dispatched.  This is preparation of the change.

HandleMiddleClickPaste() uses UIEvent::GetRangeParent() and
UIEvent::RangeOffset() to collapse Selection at clicked point.  However,
EventStateManager cannot access them since EventStateManager can handle it
with WidgetMouseEvent.  Fortunately, only WidgetMouseEvent is necessary for
implementing them.  Therefore, we can move the implementation into
nsLayoutUtils and merge them.

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

--HG--
extra : moz-landing-system : lando
2018-10-10 12:03:34 +00:00
Dão Gottwald b1186958ff Bug 1473927 - Load textbox.css and numberbox.css as document stylesheets. r=paolo 2018-10-09 10:22:15 +02:00
Makoto Kato e851a155cb Bug 1487301 - Part 2. Set ancestor limitter if no set yet. r=masayuki
The ancestor limiter is set by focus event handler of editor. But window that
is run script has no focus, this event isn't fired by addRange etc.

Some execCommand's commands such as 'forwardDelete' uses WillDeleteSelection
then selection for deletion is set by selection controller (in
TextEditor::ExtendSelectionForDelete). So, due to no ancestor limiter, caret
(and any for delete commands such as CharacterExtendForDelete) can move to out
of editor's root.

So we should set ancestor limiter if nothing. If focus event is received by
user interaction etc, limiter will be set again.

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

--HG--
extra : rebase_source : 240c3bc09b37d46d1ce3245bcca55cafc59454c5
2018-09-20 19:03:24 +09:00
Makoto Kato eed71e1db2 Bug 1487301 - Part 1. FindSelectionRoot should return Element. r=masayuki
FindSelectionRoot isn't const method and returns already_AddRefed<nsIContent>.
But this method doesn't modify any members and nodes, so we can change to const
method

Also, this method already returns Element, so it shouldn't return nsIContent.

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

--HG--
extra : rebase_source : d4a5dbe96dfc0a71b39f3d5c6d1a4c7ce85f4fa9
2018-09-20 18:53:35 +09:00
arthur.iakab 326255bed6 Backed out changeset 82b600b76a38 (bug 1473927)for marionette failures on test_element_state_chrome.py CLOSED TREE 2018-10-08 23:34:50 +03:00
Dão Gottwald 3444ae75f8 Bug 1473927 - Load textbox.css and numberbox.css as document stylesheets. r=paolo
--HG--
extra : source : 4b1f939f4f3be1dd74f069083032bc1ebd9ea2ff
extra : amend_source : 21277b867aba288c321b1471655fec2302cc7aec
2018-10-08 19:47:56 +02:00
arthur.iakab b406acca82 Backed out changeset 4b1f939f4f3b (bug 1473927)for build bustages on config/tests/test_mozbuild_reading.py CLOSED TREE 2018-10-08 21:21:21 +03:00
Dão Gottwald 6abcd86863 Bug 1473927 - Load textbox.css and numberbox.css as document stylesheets. r=paolo 2018-10-08 19:47:56 +02:00
Gurzau Raul ca3641419f Merge inbound to mozilla-central. a=merge
--HG--
rename : docshell/test/bug123696-subframe.html => docshell/test/mochitest/bug123696-subframe.html
rename : docshell/test/bug404548-subframe.html => docshell/test/mochitest/bug404548-subframe.html
rename : docshell/test/bug404548-subframe_window.html => docshell/test/mochitest/bug404548-subframe_window.html
rename : docshell/test/bug413310-post.sjs => docshell/test/mochitest/bug413310-post.sjs
rename : docshell/test/bug413310-subframe.html => docshell/test/mochitest/bug413310-subframe.html
rename : docshell/test/bug529119-window.html => docshell/test/mochitest/bug529119-window.html
rename : docshell/test/bug530396-noref.sjs => docshell/test/mochitest/bug530396-noref.sjs
rename : docshell/test/bug530396-subframe.html => docshell/test/mochitest/bug530396-subframe.html
rename : docshell/test/bug570341_recordevents.html => docshell/test/mochitest/bug570341_recordevents.html
rename : docshell/test/bug668513_redirect.html => docshell/test/mochitest/bug668513_redirect.html
rename : docshell/test/bug668513_redirect.html^headers^ => docshell/test/mochitest/bug668513_redirect.html^headers^
rename : docshell/test/bug691547_frame.html => docshell/test/mochitest/bug691547_frame.html
rename : docshell/test/dummy_page.html => docshell/test/mochitest/dummy_page.html
rename : docshell/test/file_anchor_scroll_after_document_open.html => docshell/test/mochitest/file_anchor_scroll_after_document_open.html
rename : docshell/test/file_bfcache_plus_hash_1.html => docshell/test/mochitest/file_bfcache_plus_hash_1.html
rename : docshell/test/file_bfcache_plus_hash_2.html => docshell/test/mochitest/file_bfcache_plus_hash_2.html
rename : docshell/test/file_bug1121701_1.html => docshell/test/mochitest/file_bug1121701_1.html
rename : docshell/test/file_bug1121701_2.html => docshell/test/mochitest/file_bug1121701_2.html
rename : docshell/test/file_bug1151421.html => docshell/test/mochitest/file_bug1151421.html
rename : docshell/test/file_bug1186774.html => docshell/test/mochitest/file_bug1186774.html
rename : docshell/test/file_bug1450164.html => docshell/test/mochitest/file_bug1450164.html
rename : docshell/test/file_bug385434_1.html => docshell/test/mochitest/file_bug385434_1.html
rename : docshell/test/file_bug385434_2.html => docshell/test/mochitest/file_bug385434_2.html
rename : docshell/test/file_bug385434_3.html => docshell/test/mochitest/file_bug385434_3.html
rename : docshell/test/file_bug475636.sjs => docshell/test/mochitest/file_bug475636.sjs
rename : docshell/test/file_bug509055.html => docshell/test/mochitest/file_bug509055.html
rename : docshell/test/file_bug511449.html => docshell/test/mochitest/file_bug511449.html
rename : docshell/test/file_bug540462.html => docshell/test/mochitest/file_bug540462.html
rename : docshell/test/file_bug580069_1.html => docshell/test/mochitest/file_bug580069_1.html
rename : docshell/test/file_bug580069_2.sjs => docshell/test/mochitest/file_bug580069_2.sjs
rename : docshell/test/file_bug590573_1.html => docshell/test/mochitest/file_bug590573_1.html
rename : docshell/test/file_bug590573_2.html => docshell/test/mochitest/file_bug590573_2.html
rename : docshell/test/file_bug598895_1.html => docshell/test/mochitest/file_bug598895_1.html
rename : docshell/test/file_bug598895_2.html => docshell/test/mochitest/file_bug598895_2.html
rename : docshell/test/file_bug634834.html => docshell/test/mochitest/file_bug634834.html
rename : docshell/test/file_bug598895_1.html => docshell/test/mochitest/file_bug637644_1.html
rename : docshell/test/file_bug598895_2.html => docshell/test/mochitest/file_bug637644_2.html
rename : docshell/test/file_bug640387.html => docshell/test/mochitest/file_bug640387.html
rename : docshell/test/file_bug653741.html => docshell/test/mochitest/file_bug653741.html
rename : docshell/test/file_bug660404 => docshell/test/mochitest/file_bug660404
rename : docshell/test/file_bug660404-1.html => docshell/test/mochitest/file_bug660404-1.html
rename : docshell/test/file_bug660404^headers^ => docshell/test/mochitest/file_bug660404^headers^
rename : docshell/test/file_bug653741.html => docshell/test/mochitest/file_bug662170.html
rename : docshell/test/file_bug668513.html => docshell/test/mochitest/file_bug668513.html
rename : docshell/test/file_bug669671.sjs => docshell/test/mochitest/file_bug669671.sjs
rename : docshell/test/file_bug675587.html => docshell/test/mochitest/file_bug675587.html
rename : docshell/test/file_bug680257.html => docshell/test/mochitest/file_bug680257.html
rename : docshell/test/file_bug703855.html => docshell/test/mochitest/file_bug703855.html
rename : docshell/test/file_bug728939.html => docshell/test/mochitest/file_bug728939.html
rename : docshell/test/file_close_onpagehide1.html => docshell/test/mochitest/file_close_onpagehide1.html
rename : docshell/test/file_close_onpagehide2.html => docshell/test/mochitest/file_close_onpagehide2.html
rename : docshell/test/file_framedhistoryframes.html => docshell/test/mochitest/file_framedhistoryframes.html
rename : docshell/test/file_pushState_after_document_open.html => docshell/test/mochitest/file_pushState_after_document_open.html
rename : docshell/test/historyframes.html => docshell/test/mochitest/historyframes.html
rename : docshell/test/mochitest.ini => docshell/test/mochitest/mochitest.ini
rename : docshell/test/start_historyframe.html => docshell/test/mochitest/start_historyframe.html
rename : docshell/test/test_anchor_scroll_after_document_open.html => docshell/test/mochitest/test_anchor_scroll_after_document_open.html
rename : docshell/test/test_bfcache_plus_hash.html => docshell/test/mochitest/test_bfcache_plus_hash.html
rename : docshell/test/test_bug1045096.html => docshell/test/mochitest/test_bug1045096.html
rename : docshell/test/test_bug1121701.html => docshell/test/mochitest/test_bug1121701.html
rename : docshell/test/test_bug1151421.html => docshell/test/mochitest/test_bug1151421.html
rename : docshell/test/test_bug1186774.html => docshell/test/mochitest/test_bug1186774.html
rename : docshell/test/test_bug123696.html => docshell/test/mochitest/test_bug123696.html
rename : docshell/test/test_bug1450164.html => docshell/test/mochitest/test_bug1450164.html
rename : docshell/test/test_bug384014.html => docshell/test/mochitest/test_bug384014.html
rename : docshell/test/test_bug385434.html => docshell/test/mochitest/test_bug385434.html
rename : docshell/test/test_bug387979.html => docshell/test/mochitest/test_bug387979.html
rename : docshell/test/test_bug402210.html => docshell/test/mochitest/test_bug402210.html
rename : docshell/test/test_bug404548.html => docshell/test/mochitest/test_bug404548.html
rename : docshell/test/test_bug413310.html => docshell/test/mochitest/test_bug413310.html
rename : docshell/test/test_bug475636.html => docshell/test/mochitest/test_bug475636.html
rename : docshell/test/test_bug509055.html => docshell/test/mochitest/test_bug509055.html
rename : docshell/test/test_bug511449.html => docshell/test/mochitest/test_bug511449.html
rename : docshell/test/test_bug529119-1.html => docshell/test/mochitest/test_bug529119-1.html
rename : docshell/test/test_bug529119-2.html => docshell/test/mochitest/test_bug529119-2.html
rename : docshell/test/test_bug530396.html => docshell/test/mochitest/test_bug530396.html
rename : docshell/test/test_bug540462.html => docshell/test/mochitest/test_bug540462.html
rename : docshell/test/test_bug551225.html => docshell/test/mochitest/test_bug551225.html
rename : docshell/test/test_bug570341.html => docshell/test/mochitest/test_bug570341.html
rename : docshell/test/test_bug580069.html => docshell/test/mochitest/test_bug580069.html
rename : docshell/test/test_bug590573.html => docshell/test/mochitest/test_bug590573.html
rename : docshell/test/test_bug598895.html => docshell/test/mochitest/test_bug598895.html
rename : docshell/test/test_bug634834.html => docshell/test/mochitest/test_bug634834.html
rename : docshell/test/test_bug637644.html => docshell/test/mochitest/test_bug637644.html
rename : docshell/test/test_bug640387_1.html => docshell/test/mochitest/test_bug640387_1.html
rename : docshell/test/test_bug640387_2.html => docshell/test/mochitest/test_bug640387_2.html
rename : docshell/test/test_bug653741.html => docshell/test/mochitest/test_bug653741.html
rename : docshell/test/test_bug660404.html => docshell/test/mochitest/test_bug660404.html
rename : docshell/test/test_bug662170.html => docshell/test/mochitest/test_bug662170.html
rename : docshell/test/test_bug668513.html => docshell/test/mochitest/test_bug668513.html
rename : docshell/test/test_bug669671.html => docshell/test/mochitest/test_bug669671.html
rename : docshell/test/test_bug675587.html => docshell/test/mochitest/test_bug675587.html
rename : docshell/test/test_bug680257.html => docshell/test/mochitest/test_bug680257.html
rename : docshell/test/test_bug691547.html => docshell/test/mochitest/test_bug691547.html
rename : docshell/test/test_bug694612.html => docshell/test/mochitest/test_bug694612.html
rename : docshell/test/test_bug703855.html => docshell/test/mochitest/test_bug703855.html
rename : docshell/test/test_bug728939.html => docshell/test/mochitest/test_bug728939.html
rename : docshell/test/test_bug797909.html => docshell/test/mochitest/test_bug797909.html
rename : docshell/test/test_close_onpagehide_by_history_back.html => docshell/test/mochitest/test_close_onpagehide_by_history_back.html
rename : docshell/test/test_close_onpagehide_by_window_close.html => docshell/test/mochitest/test_close_onpagehide_by_window_close.html
rename : docshell/test/test_forceinheritprincipal_overrule_owner.html => docshell/test/mochitest/test_forceinheritprincipal_overrule_owner.html
rename : docshell/test/test_framedhistoryframes.html => docshell/test/mochitest/test_framedhistoryframes.html
rename : docshell/test/test_pushState_after_document_open.html => docshell/test/mochitest/test_pushState_after_document_open.html
rename : docshell/test/test_triggeringprincipal_location_seturi.html => docshell/test/mochitest/test_triggeringprincipal_location_seturi.html
rename : docshell/test/test_windowedhistoryframes.html => docshell/test/mochitest/test_windowedhistoryframes.html
rename : docshell/test/url1_historyframe.html => docshell/test/mochitest/url1_historyframe.html
rename : docshell/test/url2_historyframe.html => docshell/test/mochitest/url2_historyframe.html
rename : third_party/rust/syn/src/parsers.rs => third_party/rust/syn-0.14.6/src/parsers.rs
rename : third_party/rust/syn/src/verbatim.rs => third_party/rust/syn-0.14.6/src/verbatim.rs
rename : third_party/rust/uuid/.travis.yml => third_party/rust/uuid-0.5.1/.travis.yml
rename : third_party/rust/uuid/src/rustc_serialize.rs => third_party/rust/uuid-0.5.1/src/rustc_serialize.rs
rename : third_party/rust/uuid/src/serde.rs => third_party/rust/uuid-0.5.1/src/serde.rs
2018-10-02 19:03:40 +03:00
Andrew McCreight 837f0af066 Bug 1493737 - Fix many trivial calls to do_QueryInterface r=smaug
If class A is derived from class B, then an instance of class A can be
converted to B via a static cast, so a slower QI is not needed.

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

--HG--
extra : moz-landing-system : lando
2018-10-01 21:38:01 +00:00
Ehsan Akhgari 5f0be07390 Bug 1493563 - Part 5: Present the old state and the content blocking log to the web progress listeners; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D6595
2018-09-28 14:46:02 -04:00
Noemi Erli 4419e20e14 Backed out 12 changesets (bug 1493563) for failures in test_css-logic-getCssPath.html CLOSED TREE
Backed out changeset d2e83655082f (bug 1493563)
Backed out changeset 1ce58f004593 (bug 1493563)
Backed out changeset 344298c73ee7 (bug 1493563)
Backed out changeset 02b8b073f7d7 (bug 1493563)
Backed out changeset 3ef707008502 (bug 1493563)
Backed out changeset bb2720a401fe (bug 1493563)
Backed out changeset ce0211be57a1 (bug 1493563)
Backed out changeset 83d6c2bf8dc6 (bug 1493563)
Backed out changeset 1844af4cc25b (bug 1493563)
Backed out changeset c8ab17addb7a (bug 1493563)
Backed out changeset a1ff0cd62563 (bug 1493563)
Backed out changeset 932b41e211e0 (bug 1493563)
2018-09-28 21:31:18 +03:00
Ehsan Akhgari f0108e78c2 Bug 1493563 - Part 5: Present the old state and the content blocking log to the web progress listeners; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D6595
2018-09-28 13:24:41 -04:00
Emilio Cobos Álvarez 864a303a8c Bug 1494622 - Remove nsDOMCSSRGBColor. r=xidorn
Differential Revision: https://phabricator.services.mozilla.com/D7068
2018-09-27 16:11:42 +02:00
Masayuki Nakano 20d1804f6b Bug 1484111 - part 1: Create HTMLEditor::InsertTableCellsWithTransaction() for internal use of nsITableEditor::InsertTableCell() r=m_kato
nsITableEditor::InsertTableCell() is an XPCOM method but used internally.  So,
HTMLEditor should implement it with a non-virtual method and all internal users
should use it instead.

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

--HG--
extra : moz-landing-system : lando
2018-09-20 11:44:35 +00:00