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

9193 Коммитов

Автор SHA1 Сообщение Дата
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
Masayuki Nakano 3a48cf1623 Bug 1484111 - part 0: Add automated tests for nsITableEditor.insertTableCell.html r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D6258

--HG--
extra : moz-landing-system : lando
2018-09-20 11:44:33 +00:00
Masayuki Nakano 9c1afc4bee Bug 1484116 - part 1: Create HTMLEditor::InsertTableColumnsWithTransaction() for internal use of nsITableEditor::InsertTableColumn() r=m_kato
nsITableEditor::InsertTableColumn() is an XPCOM method but it's used internally.
So, HTMLEditor should implement it with a non-virtual method and internal
users should use it instead.

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

--HG--
extra : moz-landing-system : lando
2018-09-20 09:15:08 +00:00
Masayuki Nakano 3582509a37 Bug 1484116 - part 0: Add automated tests for nsITableEditor.insertTableColumn() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D6256

--HG--
extra : moz-landing-system : lando
2018-09-20 09:15:06 +00:00
Masayuki Nakano aa8e14f9d7 Bug 1484117 - part 0: Add automated tests for nsITableEditor.insertTableRow() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D6178

--HG--
extra : moz-landing-system : lando
2018-09-20 04:45:18 +00:00
Masayuki Nakano 3e96aa79b3 Bug 1484117 - part 1: Create HTMLEditor::InsertTableRowsWithTransaction() for internal use of nsITableEditor::InsertTableRow() r=m_kato
nsITableEditor::InsertTableRow() is an XPCOM method but there are some internal
users.  So, HTMLEditor should implement it with a non-virtual method and
it should be used by all internal users.

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

--HG--
extra : moz-landing-system : lando
2018-09-20 06:55:17 +00:00
Masayuki Nakano 3113cbebc3 Bug 1484119 - part 2: Make HTMLEditor::DeleteTableCellWithTransaction() remove <table> element if it becomes empty r=m_kato
HTMLEditor::DeleteTableCellWithTransaction() does not remove <table> element
even if it becomes empty only when 2 or more cell elements are selected.
Therefore, we should check table size before removing a row and if it's the
last row, the method should remove <table>.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 09:00:06 +00:00
Masayuki Nakano 80a2f99daf Bug 1484119 - part 1: Create HTMLEditor::DeleteTableCellWithTransaction() for internal use of nsITableEditor::DeleteTableCell() r=m_kato
nsITableEditor::DeleteTableCell() is an XPCOM method but used internally.
So, HTMLEditor should implement it with non-virtual method and use it
internally.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 08:50:11 +00:00
Masayuki Nakano 45c321017b Bug 1484119 - part 0: Add automated tests for nsITableEditor.deleteTableCell.html r=m_kato
Although this has a lot of todo_is() since this API is really broken.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 02:03:29 +00:00
Masayuki Nakano 2e78564a84 Bug 1484120 - part 1: Create HTMLEditor::DeleteTableCellContentsWithTransaction() for internal use of nsITableEditor::DeleteTableCellContents() r=m_kato
nsITableEditor::DeleteTableCellContents() is an XPCOM method but it's used
internally.  So, HTMLEditor should implement it with a non-virtual method
and all internal users should use the non-virtual method instead.

This patch adds HTMLEditor::DeleteTableCellContentsWithTransaction() for that.
Additionally, this patch renames its helper method DeleteCellContents() to
DeleteAllChidlrenWithTransaction() and moves it to HTMLEditor.cpp since it can
handle any element nodes.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 01:58:48 +00:00
Masayuki Nakano 1ad41381cc Bug 1484120 - part 0: Add automated tests for nsITableEditor.deleteTableCellContents.html r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D6173

--HG--
extra : moz-landing-system : lando
2018-09-19 01:58:51 +00:00
Masayuki Nakano 1a3e84fbef Bug 1484121 - part 2: Clean up HTMLEditor::DeleteColumn() r=m_kato
This patch renames HTMLEditor::DeleteColumn() to
HTMLEditor::DeleteTableColumnWithTransaction() and cleans up its implementation.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 06:39:31 +00:00
Masayuki Nakano 7f96a82ad5 Bug 1484121 - part 1: Create HTMLEditor::DeleteSelectedTableColumnsWithTransaction() for internal use of nsITableEditor::DeleteTableColumn() r=m_kato
nsITableEditor::DeleteTableColumn() is an XPCOM method but used internally.
So, it should be implemented with non-virtual method and internal users
should use it.

Note that this changes only one thing.  This moves
|AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(...| from
below DeleteTableElementAndChildrenWithTransaction() to above it.
I.e., DeleteTableElementAndChildrenWithTransaction() works under
EditSubAction::eDeleteNode as the top level sub-action now.  This is same
as DeleteSelectedTableRowsWithTransaction().  Therefore, the difference
with it when it removes <table> is now fixed.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 06:34:33 +00:00
Masayuki Nakano cf2eb50a7b Bug 1484121 - part 0: Add automated tests for nsITableEditor.deleteTableColumn() r=m_kato
This add automated tests for nsITableEditor.deleteTableColumn().

However, this contains some fixes of existing code since with those bugs,
the test isn't passed even in the simplest case.

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

--HG--
extra : moz-landing-system : lando
2018-09-19 04:32:10 +00:00
Makoto Kato a5335ab3ea Bug 1491199 - Get rid of nsIEditorBlobListener. r=masayuki
Since bug 1489812 is landed, we can get rid of nsIEditorBlobListener.

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

--HG--
extra : moz-landing-system : lando
2018-09-18 04:34:21 +00:00
Masayuki Nakano ee53372956 Bug 1484122 - part 2: Clean up HTMLEditor::DeleteRow() r=m_kato
This patch renames HTMLEditor::DeleteRow() to
HTMLEditor::DeleteTableRowWithTransaction() and cleans up its implementation.

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

--HG--
extra : moz-landing-system : lando
2018-09-18 08:31:00 +00:00
Masayuki Nakano 47fa32ffd8 Bug 1484122 - part 1: Create HTMLEditor::DeleteSelectedTableRowsWithTransaction() for internal use of nsITableEditor::DeleteTableRow() r=m_kato
nsITableEditor::DeleteTableRow() is an XPCOM method but there are some internal
users.  So, it should be implemented as non-virtual protected method and
internal users should use it instead.

This also renames (and reimplement) HTMLEditor::DeleteTable2() since it's
really bad name and the code dispatches unnecessary "selectionchange" events.

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

--HG--
extra : moz-landing-system : lando
2018-09-18 07:56:45 +00:00
Masayuki Nakano 3d69a1f95e Bug 1484122 - part 0: Add automated tests for nsITableEditor.deleteTableRow.html r=m_kato
This patch changes a bit in HTMLEditor::DeleteTableRow() because calling
DeleteTable2() without those helper classes hits MOZ_ASSERT().

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

--HG--
extra : moz-landing-system : lando
2018-09-18 07:25:58 +00:00
Makoto Kato f3b8a60bde Bug 1491191 - Remove unused methods in nsIEditorMailSupport. r=masayuki
Since I have landed bug 1489939, comm-central only uses rewrap method in
nsIEditorMailSupport.  And insertAsCitedQuotation is used by the test of
editor/libeditor/tests/test_bug616590.xul.

Other methods are unused now, so let's remove these from nsIEditorMailSupprt,
and move it to HTMLEditor.  Also, pasteAsQuotation is unused now even if
BlueGriffon.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 10:03:24 +00:00
Ehsan Akhgari 9fe0e0670a Bug 1491605 - Remove nsIControllerCommandGroup because it is dead code; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5965
2018-09-17 09:54:04 -04:00
Ehsan Akhgari ad7b8c9b02 Bug 1491569 - Remove the XPCOM registration for mozSpellChecker; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D5946
2018-09-15 20:13:51 -04:00
Masayuki Nakano 6dae86b837 Bug 1484133 - part 1: Create non-virtual HTMLEditor::GetSelectedOrParentTableElement() r=m_kato
nsITableEditor::GetSelectedOrParentTableElement() is of course an XPCOM method,
but it's used internally.  So, there should be non-virtual method.

On the other hand, this API is too ugly.  Returns various information but each
meaning is not clear.  So, result of the new non-virtual method should be
simpler.

This patch creates the new method as:
- returns found element
- takes ErrorResult to return error code.
- takes optional out-param for returning if a cell is selected.

Then, nsITableEditor::GetSelectedOrParentTableElement() can compute its
result from them with Selection.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 12:56:22 +00:00
Masayuki Nakano 9162d2e014 Bug 1484133 - part 0: Add automated tests for nsITableEditor.getSelectedOrParentTableElement() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D5727

--HG--
extra : moz-landing-system : lando
2018-09-14 12:54:43 +00:00
Masayuki Nakano 34e624bd86 Bug 1484131 - part 1: Create HTMLEditor::CellAndIndexes struct to store cell element and its indexes in the <table> r=m_kato
If a cell element and its indexes in the <table> are stored in a struct,
it makes the user methods easier to read.  Therefore, this patch implement
such struct as HTMLEditor::CellAndIndexes and make it finds first selected
cell and indexes with its method.  Finally, this reimplement
HTMLEditor::GetFirstSelectedCellInTable() with it.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 12:51:05 +00:00
Masayuki Nakano c6464efa59 Bug 1484131 - part 0: Add automated tests for nsITableEditor.getFirstSelectedCellInTable() and fixes a crash bug of it r=m_kato
This adds automated tests for nsITableEditor.getFirstSelectedCellInTable().
However, this test crashes due to regression of bug 1484128.  So, we need
to uplift only this fix into the Beta.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 12:49:46 +00:00
Masayuki Nakano a5d4bac990 Bug 1484123 - Create non-virtual HTMLEditor::NormalizeTable() for internal use of nsITableEditor::NormalizeTable() r=m_kato
I tried to create automated tests for nsITableEditor::NormalizeTable().
However, this method cannot normalize any broken table element.  The method
always returns error after calling HTMLEditor::FixBadRowSpan().  The reason
is that HTMLEditor::FixBadRowSpan() scans all cells in each row with a for
loop, and then, when it fails to find a cell element, it returns error even
though this method needs to fix the odd situation.  According to the history
of editor changes, each important point hasn't been changed since first
implementation.  So, perhaps, table layout API behavior was changed but
no automated tests couldn't detect the regression since we really don't have
enough tests for editor.

Anyway, this patch makes most part of nsITableEditor::NormalizeTable() with
non-virtual method, HTMLEditor::NormalizeTable().

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

--HG--
extra : moz-landing-system : lando
2018-09-13 08:03:56 +00:00
Masayuki Nakano d9b9a8b93b Bug 1490882 - Fix a bug of test_middle_click_paste.html r=m_kato
When I added some tests into test_middle_click_paste.html, I realized that
SimpleTest.waitForClipboard() in copyHTMLContent() fails to copy the
HTML fragment to clipboard and just quit the test.  Therefore, only the
last tests are ignored always.

The reason is, iframe.contentDocument.getSelection() returns nullptr
since the frame becomes visible immediately before accessing the Selection.

This patch makes flushing the pending layout with scrollTop.  This makes
getSelection() return non-null.

However, unfortunately, only on Linux, it fails to copy the content.  I'm
still not sure the reason. This patch just avoids running the last part
only on Linux.

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

--HG--
extra : moz-landing-system : lando
2018-09-14 07:20:04 +00:00
Makoto Kato 678de76911 Bug 1459108 - Skip spellcheck-textarea-ref2.html on Andorid. r=masayuki
Although this reftest is sometimes failure on Android, it is no meaning to run
this test on Android due to no spellchekcer on Firefox Android.

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

--HG--
extra : moz-landing-system : lando
2018-09-13 08:31:59 +00:00
Andreea Pavel dbdfde9c61 Bug 1489980 - Enable ESLint for editor/ - Follow-up: Remove unused Ci. r=eslint-fix on a CLOSED TREE
--HG--
extra : amend_source : b2b05ef32c8d217120e280d364db0c70f09300f9
2018-09-13 13:29:24 +03:00
Margareta Eliza Balazs 850a93cf13 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-09-13 13:02:36 +03:00
Mark Banner e824d800fb Bug 1489980 - Enable ESLint for editor/ - Manual fixes. r=masayuki
This enables the editor directory to be linted, and fixes the remaining issues raised by ESLint. Various rules were fixed here including, no-shadow, no-undef, no-unused-vars and others.

I've generally gone conservative, disabling rules where it doesn't make sense to fix them (e.g. sometimes suggests use-services for tests, but it is only used once, or within a Chrome script).

Depends on D5585

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

--HG--
extra : moz-landing-system : lando
2018-09-13 07:59:47 +00:00
Mark Banner d5e3a6a9e5 Bug 1489980 - Enable ESLint for editor/ - automatic fixes r=masayuki
These are all automatically generated by ESLint with the --fix option.

Depends on D5584

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

--HG--
extra : moz-landing-system : lando
2018-09-13 07:58:19 +00:00
Mark Banner 3720c020c0 Bug 1489980 - Editor ESLint for editor/ - Initial setup adding configs for tests. r=masayuki
Also block-disables no-multi-spaces for test_resizers_resizing_elements.html

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

--HG--
extra : moz-landing-system : lando
2018-09-13 07:57:57 +00:00
Ehsan Akhgari 5aedfad186 Bug 1489793 - Part 2: Remove nsComposerRegistration.cpp; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5372
2018-09-12 18:58:53 -04:00
Ehsan Akhgari 6d56a36888 Bug 1489793 - Part 1: Remove the XPCOM component registration for EditorSpellCheck; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5371
2018-09-12 18:58:53 -04:00
Bogdan Tara 11a51e4c3d Merge inbound to mozilla-central. a=merge 2018-09-12 01:12:32 +03:00
Ehsan Akhgari 1675c25fae Bug 1489790 - Part 11: Remove the overload of nsEditingSession::SetupEditorCommandController which takes a string and uses the XPCOM service manager to create the controller; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5366
2018-09-11 09:58:33 -04:00
Ehsan Akhgari 751c62d2ae Bug 1489790 - Part 10: Remove the XPCOM component registration for @mozilla.org/editor/editordocstatecontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5365
2018-09-11 09:58:33 -04:00
Ehsan Akhgari f3142db64e Bug 1489790 - Part 9: Remove the XPCOM component registration for @mozilla.org/editor/htmleditorcontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5364
2018-09-11 09:58:33 -04:00
Ehsan Akhgari 65f44ebf27 Bug 1489790 - Part 8: Remove the XPCOM component registration for @mozilla.org/editor/editorcontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5363
2018-09-11 09:58:33 -04:00
Ehsan Akhgari c9bfa076d5 Bug 1489790 - Part 7: Remove the XPCOM component registration for @mozilla.org/editor/editingcontroller;1; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5362
2018-09-11 09:58:33 -04:00
Ehsan Akhgari 935e51caab Bug 1489790 - Part 6: Add an overload of nsEditingSession::SetupEditorCommandController which takes a creator function argument instead of a contract ID; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5361
2018-09-11 09:58:33 -04:00
Ehsan Akhgari 554d3d7b44 Bug 1489790 - Part 1: Remove the XPCOM component registration for nsControllerCommandTable as well as kHTMLEditorCommandTableCID and kHTMLEditorDocStateCommandTableCID; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5356
2018-09-11 09:58:33 -04:00
Cosmin Sabou de7676288a Merge mozilla-inbound to mozilla-central. a=merge 2018-09-11 13:06:37 +03:00
Masayuki Nakano a527ce6536 Bug 1484136 - Create HTMLEditor::RefreshGrabberInternal() for internal use r=m_kato
HTMLEditor::RefereshGrabber() is an XPCOM method which is used by BlueGriffon.
Additionally, it's called internally.  Therefore, we should create a non-virtual
method for this and all internal users should use it.

This patch renames all other related methods to *Internal() for consistency.
Additionally, this fixes a bug of nested calls of ShowGrabber() and
HideGrabber().  This makes CreateGrabber() sets mGrabber directly since
it may be cleared by HideGrabber() while it's running, and also makes
HideGrabber() moves all members who will be cleaned up with local variables
and always clean them up even if it meats an error.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 05:30:33 +00:00
Ehsan Akhgari 9fcc4e5b9a Bug 1489812 - Part 2: Remove @mozilla.org/editor-utils;1; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5374
2018-09-10 08:42:27 -04:00
Ehsan Akhgari d19f79f590 Bug 1489812 - Part 1: Port nsIEditorUtils.slurpBlob() to C++; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5373
2018-09-10 08:42:26 -04:00
Ehsan Akhgari 7a9998cefe Bug 1489787 - Part 3: Decomtaminate nsComposeTxtSrvFilter; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5355
2018-09-10 08:15:00 -04:00
Ehsan Akhgari 72c28b2f81 Bug 1489787 - Part 2: Remove the XPCOM component registration for nsComposeTxtSrvFilter; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5354
2018-09-10 08:15:00 -04:00
Ehsan Akhgari d212ff2809 Bug 1489787 - Part 1: Remove nsITextServicesFilter and replace nsIEditorSpellCheck.setFilter() with nsIEditorSpellCheck.setFilterType(); r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5353
2018-09-10 08:14:59 -04:00
Ehsan Akhgari aa4cb10397 Bug 1489786 - Remove the XPCOM component registration for nsEditingSession; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5351
2018-09-09 15:47:00 -04:00
Masayuki Nakano 63856d6d6e Bug 1485929 - Create HTMLEditor::RefreshInlineTableEditingUIInternal() for internal use r=m_kato
HTMLEditor::RefreshInlineTableEditingUI() is an XPCOM method.  Therefore,
we should create a non-virtual method for internal use.

Additionally, this patch makes related methods safer for nested calls of
ShowInlineTableEditingUI() and HideInlineTableEditingUI().  If
ShowInlineTableEditingUI() and RefreshInlineTableEditingUIInternal() detects
hiding or replacing current UI, they return error to make the callers stop
handling anything for new UI.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 12:10:54 +00:00
Cosmin Sabou 5294f1000c Merge mozilla-central to autoland. a=merge
--HG--
rename : layout/tools/reftest/bootstrap.js => layout/tools/reftest/api.js
rename : layout/tools/reftest/install.rdf => layout/tools/reftest/manifest.json
extra : rebase_source : 69518845c89f7d49cb2644ee5110ff21bf46578d
2018-09-11 13:14:31 +03:00
Masayuki Nakano 811a32c96f Bug 1485927 - Get rid of nsIHTMLObjectResizers.resizedObject r=m_kato
nsIHTMLObjectResizers.resizedObject is used only for avoiding warning of
nsIHTMLObjectResizers.refreshResizers() if resizers are not visible.
Therefore, if we remove the unnecessary warnings, we can get rid of the
attribute.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 05:02:30 +00:00
Masayuki Nakano 9762aae24f Bug 1485921 - Create HTMLEditor::RefreshResizersInternal() for internal use r=m_kato
HTMLEditor::RefreshResizers() is an XPCOM method but it's used internally.  So,
HTMLEditor should implement it with non-virtual method and use new one for
internal use.

This patch also makes related methods nested-creation of resizers aware.  This
issue must not be dangerous, but looks like buggy.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 08:15:52 +00:00
Makoto Kato 7a9297b3ac Bug 1490192 - Get rid of nsIEditorMailSupport.getEmbeddedObjects. r=masayuki
Since I have landed bug 1478546, no one (inc. bluegriffon) uses this method.

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

--HG--
extra : moz-landing-system : lando
2018-09-11 07:24:27 +00:00
Nicholas Nethercote 6f5be00d2a Bug 1488628 - Change some nsIWebNavigation method arguments from wstring to AString. r=nika
--HG--
extra : rebase_source : a64af3af30b05e6a97b25550e6983121cc47add9
2018-09-05 13:42:16 +10:00
shindli 53d4f9c065 Backed out 2 changesets (bug 1489793) for failures in editor/spellchecker/tests/test_bug1219928.html
Backed out changeset 9d793ccd3fca (bug 1489793)
Backed out changeset 30219dab424e (bug 1489793)
2018-09-12 05:59:31 +03:00
Ehsan Akhgari 8f6c449995 Bug 1489793 - Part 2: Remove nsComposerRegistration.cpp; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5372
2018-09-11 19:17:46 -04:00
Ehsan Akhgari d536808f38 Bug 1489793 - Part 1: Remove the XPCOM component registration for EditorSpellCheck; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5371
2018-09-11 19:17:46 -04:00
Nicholas Nethercote 8478f8d66e Bug 1489047 - Change almost all DOMString occurrences in XPIDL files to AString. r=nika
Because they have almost identical semantics.

--HG--
extra : rebase_source : ea9074bcac2a1d190b88a5d1afc15997593659b7
2018-09-06 18:02:43 +10:00
Andrew Swan 62bcb25a7c Bug 1451503 Move most reftest resources from chrome: to resource: r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D5232

--HG--
extra : rebase_source : 00223dacf6cfdfc4bb8505405844f66c7134e2c0
extra : histedit_source : 2d1f6e353e394520038c05b07bcd08ce06908cf2
2018-09-06 16:01:39 -07:00
Masayuki Nakano 908ba601c1 Bug 1485925 - part 1: Create HTMLEditor::HideResizersInternal() for internal use r=m_kato
HTMLEditor::HideResizers() is an XPCOM method, so, we should create non-virtual
method for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-09-06 05:02:46 +00:00
Masayuki Nakano c4c2c747a5 Bug 1485925 - part 0: Add automated test for nsIHTMLObjectResizer_hideResizers.html r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D4922

--HG--
extra : moz-landing-system : lando
2018-09-05 10:51:35 +00:00
Masayuki Nakano 3e09e244fd Bug 1485923 - Remove nsIHTMLObjectResizer.showResizers(), rename HTMLEditor::ShowResizers() to HTMLEditor::ShowResizersInternal() and merge it with HTMLEditor::ShowResizersInner() r=m_kato
First, nobody uses nsIHTMLObjectResizer.showResizers().  So, we can remove it.

Then, we have two private methods, one is non-virtual
HTMLEditor::ShowResizers(), and the other is HTMLEditor::ShowResizersInner().
HTMLEditor::ShowResizers() calls HTMLEditor::ShowResizersInner() and if
it fails, calls HideResizers().  However, in some cases, e.g., when it already
has visible resizers, hiding resizers does not make sense.

So, this patch removes non-virtual HTMLEditor::ShowResizers() method too,
then, renames HTMLEditor::ShowResizersInner() to HTMLEditor::ShowResizers(),
finally, it hides resizers only when it fails to setup resizers for keeping
resizers hidden.

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

--HG--
extra : moz-landing-system : lando
2018-09-06 04:38:00 +00:00
Masayuki Nakano aef6842da1 Bug 1488333 - Enable some mochitests for editor which were disabled on debug build of Android due to bug 1480702 r=m_kato
Because of the rewrite of test_request.html, now, we can enable the mochitests
for editor which were disabled on debug build of Android due to bug 1480702.

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

--HG--
extra : moz-landing-system : lando
2018-09-05 09:27:01 +00:00
Ehsan Akhgari b26b734898 Bug 1488112 - Remove the XPCOM component registration for nsBaseCommandController; r=qdot
Differential Revision: https://phabricator.services.mozilla.com/D4835
2018-09-04 15:03:22 -04:00
Makoto Kato f47367829a Bug 1487305 - Make HTMLEditor::IsInLink as static method. r=masayuki
Summary:
Now HTMLEditor::IsInLink returns boolean and nsINode if returning true.

I would like to return Element instead of boolean for reducing refcounting
and QI like HTMLEditRules::IsInListItem.

Reviewers: masayuki

Tags: #secure-revision

Bug #: 1487305

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

--HG--
extra : rebase_source : 275629d7e1108b4e56fb39fa745f491bfb55963d
2018-08-30 14:20:24 +09:00
Margareta Eliza Balazs 2fe43133db Merge inbound to mozilla-central. a=merge 2018-08-29 12:43:37 +03:00
Masayuki Nakano 9440d9e3e5 Bug 1485935 - Use NS_IMETHODIMP for implementation of HTMLEditor::GetIsCSSEnabled() r=m_kato
Even though HTMLEditor::GetIsCSSEnabled() is an implementation of an XPCOM
method, it uses nsresult as its return type.  We should change it to
NS_IMETHODIMP.

Additionally, SetDocumentStateCommand::GetCommandStateParams() calls this,
but HTMLEditor can expose non-virtual method, HTMLEditor::IsCSSEnabled().
Therefore, this patch makes it public and makes SetDocumentStateCommand use
HTMLEditor::IsCSSEnabled().

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

--HG--
extra : moz-landing-system : lando
2018-08-28 09:46:53 +00:00
Masayuki Nakano f4b10b4e0f Bug 1485934 - Get rid of nsIHTMLEditor.getFontColorState() r=m_kato
Neither comm-central nor BlueGriffon uses nsIHTMLEditor.getFontColorSetate().
So, we can get rid of this from nsIHTMLEditor.  However, we need to keep it
as a non-virtual public method since it's used by FontColorStateCommand.

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

--HG--
extra : moz-landing-system : lando
2018-08-27 06:52:35 +00:00
Masayuki Nakano ea71b3e52c Bug 1484129 - part 1: Create HTMLEditor::GetNextSelectedTableCellElement() for internal use of nsITableEditor::GetNextCellElement() r=m_kato
nsITableEditor::GetNextCellElement() is an XPCOM method but it's used internally
a lot.  So, HTMLEditor should implement it with non-virtual method and
internal users should use the non-virtual method.

Therefore, this patch creates HTMLEditor::GetNextSelectedTableCellElement().

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

--HG--
extra : moz-landing-system : lando
2018-08-27 06:50:12 +00:00
Masayuki Nakano a010e89cbf Bug 1484129 - part 0: Add automated tests for nsITableEditor::GetNextSelectedCell() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D4193

--HG--
extra : moz-landing-system : lando
2018-08-27 06:50:41 +00:00
arthur.iakab 5527acb8d8 Merge inbound to mozilla-central a=merge 2018-08-25 01:08:22 +03:00
Nicholas Nethercote ac5efebb4b Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)

--HG--
extra : rebase_source : 47b6d5d7c5c99b1b50b396daf7a3b67abfd74fc1
2018-08-28 15:56:01 +10:00
Ehsan Akhgari 35f7627ddb Bug 1485871 - Remove some unused XPCOM registrations for editor; r=masayuki 2018-08-24 09:33:18 -04:00
Masayuki Nakano 5bf1468b39 Bug 1485369 - part 1: HTMLEditor::HideResizers() should not stop cleaning up even if there is no window r=m_kato
Oddly, on 63 Beta simulation, nsIDocument::GetWindow() may return nullptr
when HTMLEditor is being destroyed by unload of the page.  I'm not sure if
this is an expected change.  However, HTMLEditor::HideResizers() should
not stop cleaning up even if it meets unexpected situation.

Additionally, this patch moves all HTMLEditor members related to resizers
to local variables since while HideResizers() is cleaning up old resizers,
the members may be overwritten by ShowResizers() if mutation event listener
or something does something.

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

--HG--
extra : moz-landing-system : lando
2018-08-24 06:27:48 +00:00
Masayuki Nakano 7e89c94490 Bug 1485369 - part 0: Clean up HTMLEditor::HideResizers() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D4056

--HG--
extra : moz-landing-system : lando
2018-08-24 03:46:18 +00:00
Cosmin Sabou 3211507dfb Merge mozilla-inbound to mozilla-central. a=merge 2018-08-24 00:40:14 +03:00
Masayuki Nakano 2306bb5b40 Bug 1484128 - part 1: Create HTMLEditor::GetFirstSelectedTableCellElement() for internal use of HTMLEditor::GetFirstSelectedCell() r=m_kato
HTMLEditor::GetFirstSelectedCell() is an XPCOM method, but used internally a
lot.  Therefore, we should create a non-virtual method for internal use.

This patch creates HTMLEditor::GetFirstSelectedTableCellElement(), and it
won't return NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND since nobody needs the
value.  It's enough to check whether the result is nullptr without error for
any callers.

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

--HG--
extra : moz-landing-system : lando
2018-08-24 08:29:12 +00:00
Masayuki Nakano 42c125ffe6 Bug 1484128 - part 0: Add automated tests for nsITableEditor::GetFirstSelectedCell() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D4059

--HG--
extra : moz-landing-system : lando
2018-08-24 08:28:06 +00:00
Masayuki Nakano 8799893651 Bug 1485293 - Make test_resizers_resizing_elements.html allow 2px difference of the result r=m_kato
Oddly, on Android, size of resized objects may be 2px different from ideal
value.  I don't know the reason, could be zoom level or something is affected.
However, fortunately, this difference is not important for this test because
this test checks whether resizers actually works with specific elements.
So, even if the result is 2px smaller or bigger than ideal value, we succeeded
to check the resizer makes the element bigger or smaller as expected.

Therefore, this patch makes the test allow 2px differences of the result.

Additionally, on Android, this test is always timed out if TV (even opt build).
So, this patch disables TV on Android.

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

--HG--
extra : moz-landing-system : lando
2018-08-24 08:13:07 +00:00
Masayuki Nakano 65f8dc42b1 Bug 1484127 - part 1: Create HTMLEditor::GetTableCellElementAt() for internal use of nsITableEditor::GetCellAt() r=m_kato
nsITableEditor::GetCellAt() is an XPCOM method, but this is called internally
a lot.  So, we should create non-virtual method for internal use.

The XPCOM method retrieves a <table> element if given element is nullptr.
However, no internal user needs this feature.  So, we can create
GetTableCellElementAt() simply.  Then, we can get rid of nsresult and
ErrorResult from it.

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

--HG--
extra : moz-landing-system : lando
2018-08-23 06:39:30 +00:00
Masayuki Nakano 17d425da91 Bug 1484127 - part 0: Add automated tests for nsITableEditor::GetCellAt() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3955

--HG--
extra : moz-landing-system : lando
2018-08-23 06:13:22 +00:00
Masayuki Nakano 41eb258e25 Bug 1484125 - part 1: Create TableSize struct to compute and store number of rows and columns of a <table> element r=m_kato
HTMLEditor::GetTableSize() is an XPCOM method but used internally a lot.
Therefore, it shouldn't be called for internal use.  Additionally, the
callers need to declare two int32_t variables, but this causes the code
messy.  Therefore, this patch creates TableSize struct and it implements
HTMLEditor::GetTableSize().  Then, all callers of it is replaced with
TableSize struct.

New TableSize struct does not support computes <table> element from anchor
of Selection since there is no user of this in C++ code.

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

--HG--
extra : moz-landing-system : lando
2018-08-23 07:32:16 +00:00
Masayuki Nakano c5f59ca2f9 Bug 1484125 - part 0: Add automated tests for nsITableEditor::GetTableSize() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3951

--HG--
extra : moz-landing-system : lando
2018-08-23 06:42:11 +00:00
Masayuki Nakano 6bba243c2c Bug 1484124 - part 1: Create HTMLEditor::GetCellIndexes() class to get and store indexes of a table cell r=m_kato
HTMLEditor::GetCellIndexes() is an XPCOM method and used a lot internally.
So, we need alternative way to retrieve indexes of a cell without virtual
calls.  In a lot of places, receiving indexes with 2 int32_t variables causes
the code messy and that causes making it harder to understand which are
index for same cell and where they come from.  So, making both of them stored
one variable makes the callers simpler.  Therefore, this patch creates
CellIndexes stack class to get and store the result simply.  Then, this makes
all callers of GetCellIndexes() use this new class and makes GetCellIndexes()
also use this new class.

FYI: This patch does NOT put ErrorResult instances in small block scope as far as
possible. The reason is, I see its destructor in profile sometimes. I don't think
that we should use nsresult& instead of ErrorResult& only for this performance
reason, but I think that creating each instance in loops does not make sense.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 03:34:40 +00:00
Masayuki Nakano d344ead994 Bug 1484124 - part 0: Add automated tests for nsITableEditor::GetCellIndexes() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3848

--HG--
extra : moz-landing-system : lando
2018-08-22 03:35:05 +00:00
Masayuki Nakano 28c6b4ddec Bug 1484115 - part 2: Get rid of nsITableEditor.getNextRow() r=m_kato
Nobody uses nsITableEditor.getNextRow().  Therefore, this patch removes this
XPCOM API.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:52:16 +00:00
Masayuki Nakano 9bcbe841c9 Bug 1484115 - part 1: Create HTMLEditor::GetNextTableRowElement() for internal use of nsITableEditor::GetNextRow() r=m_kato
nsITableEditor::GetNextRow() is an XPCOM method.  Therefore, we should have
a non-virtual method for internal use of it.

This changes the definition in nsITableEditor.  First, it allows only <tr>
element as what HTMLEditor::GetNextRow() has actually done.  Then, changes
the return type to Element since it always returns an element node.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:52:07 +00:00
Masayuki Nakano 7b00fb391b Bug 1484693 - Fix some nits of test_resizers_resizing_elements.html r=m_kato
There are 2 bugs:

One is a simple mistake. kTest is each item of the tests, kTests is array of
all tests.  When it needs to refer kTest.isAbsolutePosition, it referred
kTests.isAbsolutePosiiton.  Therefore, the test always failed to enable
editing UI for absolute positioned element.

The other is, this test requires to disable inline-table-editing UI (which is
add or remove rows and columns).  Note that even if the UI is disabled,
resizers is available for <table> elements.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 06:44:51 +00:00
Masayuki Nakano 57ac6bcbf2 Bug 1484113 - part 1: Create HTMLEditor::GetFirstTableRowElement() for internal use of nsITableEditor::GetFirstRow() r=m_kato
nsITableEditor::GetFirstRow() is an XPCOM method, so, for internal use,
we should create non-virtual method, that is GetFirstTableRowElement().

This patch makes it never return NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND since
nobody refers it and it's detectable.  If the method returns nullptr without
error, it's the case of NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND.

Additionally, this patch changes the return type of GetFirstRow() from
Node to Element since it always return an Element node if not null.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 01:20:23 +00:00
Masayuki Nakano 56de772ab3 Bug 1484113 - part 0: Create automated tests for nsITableEditor::GetFirstRow() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3779

--HG--
extra : moz-landing-system : lando
2018-08-22 02:16:36 +00:00
Makoto Kato 77fffe84be Bug 1476914 - Add fuzzy-if on Bug 1443902's reftests for Android. r=masayuki
Android's reftest of Bug 1443902 is failed rarely (Bug 1476914, Bug 1475049
Bug 1477502 and Bug 1476129) due to "image comparison, max difference: 1,
number of differing pixels: 1". But I don't know why difference is 1 and
I think that this might be reftest framework for Android or Android emulator
issue.

So I would like to add fuzzy-if as workaround.

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

--HG--
extra : moz-landing-system : lando
2018-08-21 09:29:29 +00:00
Dorel Luca 3fa761ade8 Merge mozilla-inbound to mozilla-central. a=merge 2018-08-21 19:01:08 +03:00
Makoto Kato 539755989c Bug 1484602 - Don't reuse variables in WillDeleteSelection. r=masayuki
HTMLEditRules::WillDeleteSelection is complex since some variables is reused.
So I would like to clean up this to use block scope and EditorDOMPoint
before fixing bug 685799.

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

--HG--
extra : moz-landing-system : lando
2018-08-21 06:54:47 +00:00
Makoto Kato a86db13435 Bug 1484612 - Remove EditSubActionInfo.bOrdered due to unused. r=masayuki
RemoveList doesn't use aListType parameter, but c-c still call this method.
So I keep aListType parameter even if unused.

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

--HG--
extra : moz-landing-system : lando
2018-08-20 12:23:56 +00:00
Dorel Luca d11c177f44 Merge mozilla-central to mozilla-inbound 2018-08-21 12:59:51 +03:00
Masayuki Nakano d33fe8cd6d Bug 1484110 - part 3: HTMLEditor::RefereshEditingUI() should refresh UIs when one of them is changed to enabled or disabled r=m_kato
HTMLEditor::RefereshEditingUI() works only with enabled UIs.  Therefore, if
UI is disabled while it's visible, it keeps shown.  This is too bad if web
apps tries to disable the Gecko specific UIs after we show some of them.

This patch adds HTMLEditor::HideAnonymousEditingUIsIfUnnecessary() to hide
unnecessary UIs and makes RefereshEditingUI() call it always.
2018-08-17 19:03:02 +09:00
Masayuki Nakano a24cf41019 Bug 1484110 - part 2: Rewrite HTMLEditor::HideInlineTableEditingUI() r=m_kato
First, HTMLEditor::HideInlineTableEditingUI() always returns NS_OK.  So, we
can change its return type to void.

Additionally, it removes each UI from the DOM tree one by one.  However, each
mutation could cause showing same UI again.  In such case,
ShowInlineTableEditingUI() overwrites each UI with newly created element.
Then, HTMLEditor cannot remove the old UI anymore.  Therefore, this patch
moves all members of the UI into local variables first.
2018-08-17 18:23:13 +09:00
Masayuki Nakano 7fc2bdaae1 Bug 1484110 - part 1: Create HTMLEditor::RefereshEditingUI() for internal use of nsIHTMLEditor::CheckSelectionStateForAnonymousButtons() r=m_kato
HTMLEditor::CheckSelectionStateForAnonymousButtons() is called a lot internally.
Especially, its virtual call cost may make damage to our performance since
it's called from a selection listener.

So, we should create non-virtual method, RefereshEditingUI() for internal use.
2018-08-17 17:56:28 +09:00
Masayuki Nakano d70e55af73 Bug 1449564 - part 4: Make users can show Gecko specific editing UIs with new prefs r=m_kato
Even after we disable Gecko specific editing UIs by default, web apps can
enable them with execCommand.  However, until such web apps change their
behavior, users cannot use Gecko specific UIs.  At least for now, we should
make users can enable them by default.

MozReview-Commit-ID: AuAdw4FQ4He

--HG--
extra : rebase_source : a1f88f2928df0d7afb4361c425d75c74872ac9d5
2018-08-16 13:51:36 +09:00
Masayuki Nakano be1b849fa2 Bug 1449564 - part 3: Make absolute position editor listen to mouse events at the system event group r=m_kato
Currently, absolute position editor listens to mouse events at the default
event group to handle dragging of positioner.  However, this is blocked by
a call of Event.stopPropagation() in web apps unexpectedly.  Therefore,
we should make it listen to the events at the system event group instead.

MozReview-Commit-ID: Hoa8c9QvMuG

--HG--
extra : rebase_source : 77500356fd1a65e8d81da131e09bc48229a208f9
2018-04-05 00:32:32 +09:00
Masayuki Nakano 44ae690779 Bug 1449564 - part 2: Make absolute positioned element editor disabled in default and make it possible to enable it with new command r=m_kato
We have another built-in UI of editor which is not implemented by any other
browsers.  That is a draggable handler to move absolute positioned elements.
So, we should disable it in default for compatibility with the other browsers.

However, different from resizers and inline table editor, we don't have
command to enable/disable this feature but for backward compatibility, we
should have it.  Therefore, this patch adds new command
"enableAbsolutePositionEditor".

Note that whether resizing UI is available only with enableObjectResizing
state is different from enableInlineTableEditing command.  Resizers for
absolute positioned elements are NOT available both enableObjectResizing
and enableAbsolutePositionEditor are enabled.

Additionally, this adds automated tests to check basic functions of absolute
positioned editor.

MozReview-Commit-ID: 9ZSGB8tLpFw

--HG--
rename : editor/libeditor/tests/test_resizers_appearance.html => editor/libeditor/tests/test_abs_positioner_appearance.html
rename : editor/libeditor/tests/test_resizers_resizing_elements.html => editor/libeditor/tests/test_abs_positioner_positioning_elements.html
extra : rebase_source : d516f3f3ef36d4ad13938f214cb6e3868d7ff407
2018-04-04 22:27:49 +09:00
Masayuki Nakano b808917841 Bug 1449564 - part 1: Disable object resizer and inline table editor in default r=m_kato
Gecko supports resizers of <img> elements and <table>, <td>, <th> elements and
has UI to remove existing table row or column in default.  However, the other
browsers don't have such UI and web apps need to disable this feature with
calling both:
document.execCommand("enableObjectResizing", false, false);
document.execCommand("enableInlineTableEditing", false, false);
for avoiding conflicting with their own features to edit such elements.

Therefore, it doesn't make sense to keep enabling them in default only on
Gecko.  If web apps want to keep using these features, they should call:
document.execCommand("enableObjectResizing", false, true);
document.execCommand("enableInlineTableEditing", false, true);
at initializing the editor.

And also this patch fixes bugs of
document.queryCommandState("enableObjectResizing") and
document.queryCommandState("enableInlineTableEditing").  They always return
false even after calling document.execCommand(..., false, true) since
nsSetDocumentStateCommand::GetCommandStateParams() sets bool value as
STATE_ATTRIBUTE.  However, nsHTMLDocument::QueryCommandValue() which is the
caller referring STATE_ATTRIBUTE doesn't treat it as bool value.  And also
those commands are related to state of document.  Therefore, they should be
return as bool value of STATE_ALL instead.  Then,
nsHTMLDocument::QueryCommandState() returns the state as expected.  Note that
those commands are supported only by Gecko.  So, we don't need to worry about
the compatibility.

Finally, this patch rewrites 2 existing tests to check basic behavior of
resizers and appearance of resizers.

Note that this patch does not add new tests to test inline table editor
since it's difficult to test the behavior with current API.  Perhaps, we
should add an API to nsIHTMLEditor to retrieve each anonymous elements in
another bug since it requires to add wrapping API of SpecialPowers.

MozReview-Commit-ID: 1FhYo5vcV60

--HG--
rename : editor/libeditor/tests/test_objectResizing.html => editor/libeditor/tests/test_resizers_appearance.html
rename : editor/libeditor/tests/test_bug640321.html => editor/libeditor/tests/test_resizers_resizing_elements.html
extra : rebase_source : a707de5a64ef1f8ce974cdf1be093d1b4f61c7bc
2018-04-02 17:26:46 +09:00
Daniel Varga 36e523e699 Merge mozilla-central to mozilla-inbound 2018-08-18 01:05:36 +03:00
Masayuki Nakano b7d5928ee6 Bug 1484092 - part 3: IsLinkTag() and IsNamedAnchorTag() should compare with nsGkAtoms r=m_kato
The methods compared with const characters since we've supported "namedanchor"
which is not in nsGkAtoms.  Now, it's dropped so that we can compare given
atom with nsGkAtoms.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:51:40 +00:00
Masayuki Nakano 65bb9451c3 Bug 1484092 - part 2: Drop supporting "namedanchor" special element name from nsIHTMLEditor::GetSelectedElement(), nsIHTMLEditor::GetElementOrParentByTagName() and nsIHTMLEditor::CreateElementWithDefaults() r=m_kato
Nobody (including comm-central and BlueGriffon) does not use "namedanchor"
special element name with those XPCOMs.  Of course, our internal callers too.
Therefore, we can drop.

Note that there is no static Atom for this, so, keeping it makes unnecessary
runtime cost for Firefox users.

This could cause breaking some legacy add-ons for Thunderbird.  However,
they can use "anchor" special element name for same purpose.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:50:56 +00:00
Masayuki Nakano b212948c3b Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&).  For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.

GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node.  The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node.  Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal().  Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().

Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly.  Then, public method,
GetElementOrParentByTagName() is called only by outer classes.

Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr.  They may be bug of them.  We should investigate
the API callers later.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 14:06:18 +00:00
Noemi Erli 79400be144 Backed out 2 changesets (bug 1484092) for build bustages in builds/worker/workspace/build/src/editor/libeditor/HTMLEditor.cpp💯53 on a CLOSED TREE
Backed out changeset 10fdd041f1b5 (bug 1484092)
Backed out changeset d0b14e8711df (bug 1484092)
2018-08-17 13:39:44 +03:00
Masayuki Nakano 16a97643c7 Bug 1484092 - part 2: Drop supporting "namedanchor" special element name from nsIHTMLEditor::GetSelectedElement(), nsIHTMLEditor::GetElementOrParentByTagName() and nsIHTMLEditor::CreateElementWithDefaults() r=m_kato
Nobody (including comm-central and BlueGriffon) does not use "namedanchor"
special element name with those XPCOMs.  Of course, our internal callers too.
Therefore, we can drop.

Note that there is no static Atom for this, so, keeping it makes unnecessary
runtime cost for Firefox users.

This could cause breaking some legacy add-ons for Thunderbird.  However,
they can use "anchor" special element name for same purpose.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 07:41:55 +00:00
Masayuki Nakano a8b7670d10 Bug 1484092 - part 1: Make HTMLEditor::GetElementOrParentByTagName() use nsAtom for the tag name r=m_kato
HTMLElementOrParentByTagName() is the last user of IsLinkTag(const nsAString&)
and IsNamedAnchorTag(const nsAString&).  For making their maintenance easier,
let's make GetElementOrParentByTagName() take const nsAtom& for tag name.

GetElementOrParentByTagName() has two functions, one is looking for an element
starting from a node.  The other is, if the start node is nullptr, it retrieves
anchor node of Selection as start node.  Therefore, this patch splits the
first part to GetElementOrParentByTagNameInternal().  Then, creates its
wrapper which retrieves anchor of Selection automatically,
GetElementOrParentByTagNameAtSelection().

Additionally, this patch makes all internal callers of HTMLEditor use
GetElementOrParentByTagNameInternal() or
GetElementOrParentByTagNameAtSelection() directly.  Then, public method,
GetElementOrParentByTagName() is called only by outer classes.

Note that some callers use both GetElementOrParentByTagNameInternal()
and GetElementOrParentByTagNameAtSelection() since they don't check whether
setting node is nullptr.  They may be bug of them.  We should investigate
the API callers later.

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

--HG--
extra : moz-landing-system : lando
2018-08-17 10:04:42 +00:00
Ehsan Akhgari a930263192 Bug 1484137 - Remove the XPCOM component registration for content iterator classes; r=qdot 2018-08-17 14:51:12 -04:00
Masayuki Nakano 0e96aef5c8 Bug 1483144 - Make HTMLEditor::GetSelectionContainer() protected r=m_kato
HTMLEditor::GetSelectionContainer() is a public method, but it's not used by
outer classes. So, we can make it a protected member.

Additionally, this patch cleans up the method.

  - Renames to GetSelectionContainerElement() for making clearer what will be
    returned.
  - Makes it const.
  - Makes it take Selection reference since most callers already have Selection.
  - Makes it use RangeBoundary to access start point and end point of range since nsRange::StartOffset() and nsRange::EndOffset() may be slow.
  - Makes it not use GetSelectedElement() since it requires unnecessary additional cost and the condition to call it means it uses only the first path in GetSelectedElement() which just returns start node of the range.
  - Makes it output warning when it returns nullptr since it reaches nullptr only when illegal cases, e.g., Selection is in orphan node.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 15:12:51 +00:00
Masayuki Nakano 4bf13b90c7 Bug 1483132 - Make EditorBase::AreNodesSameType() non-virtual r=m_kato
EditorBase::AreNodesSameType() is overridden only by HTMLEditor and the
implementation is enough simple to re-implement in EditorBase.

Additionally, this is called from condition of a loop in
JoinNodesDeepWithTransaction().  So, the virtual call cost may make damage
to the performance.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:29:20 +00:00
Masayuki Nakano d9f788a4df Bug 1483127 - Use NS_IMETHODIMP at definition of HTMLEditor::SetIsCSSEnabled() r=m_kato
HTMLEditor::SetIsCSSEnabled() is an XPCOM but it's defined with nsresult.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:05:06 +00:00
Masayuki Nakano 72aa2e3133 Bug 1483119 - Get rid of HTMLEditor::GetURLForStyleSheet() since unused r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3458

--HG--
extra : moz-landing-system : lando
2018-08-16 10:03:49 +00:00
Masayuki Nakano b01e3d2d25 Bug 1482023 - Create HTMLEditor::EnableStyleSheetInternal() for internal use r=m_kato
HTMLEditor::EnableStyleSheet() is an XPCOM method but it's used internally.
Therefore, we should create non-virtual method for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:03:46 +00:00
Masayuki Nakano e9f6afbc49 Bug 1482022 - Create HTMLEditor::RemoveOverrideStyleSheetInternal() for internal use r=m_kato
HTMLEditor::RemoveOverrideStyleSheet() is an XPCOM method but used internally.
So, we should create non-virtual method for this.

Additionally, it calls GetStyleSheetForURL() and RemoveStyleSheetFromList(),
but they search index of internal override style sheet array redundantly.
Moreover, RemoveStyleSheetFromList() returns error only when given URL is
not found, but RemoveOverrideStyleSheet() which is the only one caller, ignores
the error.  Therefore, for saving the redundant cost, this patch makes
RemoveStyleSheetFromList() return removing StyleSheet which is retrieved
with the call of GetStyleSheetForURL().  So, RemoveOverrideStyleSheetInternal()
stops calling GetStyleSheetForURL().

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

--HG--
extra : moz-landing-system : lando
2018-08-16 10:01:23 +00:00
Masayuki Nakano 9e79dd8fe6 Bug 1482021 - Create HTMLEditor::AddOverrideStyleSheetInternal() for internal use r=m_kato
HTMLEditor::AddOverrideStyleSheet() is an XPCOM method but it's called
internally.  So, we should create non-virtual method for it and call it
for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-16 09:26:09 +00:00
Masayuki Nakano b8fd63d7b5 Bug 1482020 - Make all callers of CreateElementWithDefaults() use non-virtual method r=m_kato
Fortunately, despite of becoming public method,
HTMLEditor::CreateElementWithDefaults() can be used by internal methods too
since it does not touch undo transactions nor the DOM tree, and does not
refer mRules nor GetSelection().  So, we can make it public and make any
C++ callers use it.
2018-08-10 19:36:24 +09:00
Masayuki Nakano 53b9108e13 Bug 1482019 - part 5: Make HTMLEditor::GetSelectedNode() never return non-element node and change its name to GetSelectedElement() r=m_kato
If HTMLEditor::GetSelectedNode() is called with nullptr for aTagName,
the first block may return non-element node.  In such case, we should return
nullptr without error for now (since I have no idea which element node is
a good node to return).

Then, we can rename it to GetSelectedElement() and can replace existing
GetSelectedElement() with the new one.
2018-08-10 18:01:42 +09:00
Masayuki Nakano f1cdc15e87 Bug 1482019 - part 4: Reduce the indent level of the last block in HTMLEditor::GetSelectedNode() r=m_kato
The first check of the last block of HTMLEditor::GetSelectedNode() can use
early-return style.  Additionally, |current| is not necessary since Selection
is not changed since the method retrieved first range.  So, we can get rid of
|current| and the |nullptr| case of it.
2018-08-10 17:46:33 +09:00
Masayuki Nakano 0dd29e1830 Bug 1482019 - part 3: Minimize some scope of auto varaiables in HTMLEditor::GetSelectedNode() r=m_kato
Some variables in HTMLEditor::GetSelectedNode() are declared very large block
they are not used and/or referred.  So, we can get rid of some variables or
move smaller block.
2018-08-10 17:41:58 +09:00
Masayuki Nakano 837bcd9d8e Bug 1482019 - part 2: Make HTMLEditor::GetSelectedNode() take nsAtom* for element name r=m_kato
Using nsAtom makes the method faster and simpler, although the caller needs
to atomize lower-cased string.
2018-08-10 17:30:04 +09:00
Masayuki Nakano 8e992098fa Bug 1482019 - part 1: Create non-virtual method HTMLEditor::GetSelectedNode() for implementing nsIHTMLEditor::GetSelectedElement() r=m_kato
For making each diff compact, this bug needs some patches.

First of all, this patch moves implementation of
nsIHTMLEditor::GetSelectedElement() to new non-virtual method
HTMLEditor::GetSelectedNode().
2018-08-10 16:51:52 +09:00
Masayuki Nakano 3b38503bf4 Bug 1482019 - part 0: Add automated tests for nsIHTMLEditor.getSelectedElement() r=m_kato
The HTMLEditor::GetSelectedElement() is ugly.  Probably, it's checked only with
expected simple cases since the result does not make sense in some cases.

For example, when Selection is collapsed, it returns an element only when
"href" is specified with the argument.  When Selection selects only one
element node (including its children), it quickly returns the node, however,
in the slow path, it returns second element node if first element node matches
with the argument.  Or returns first element ndoe if it does not match with
the argument.

For preventing regressions, new test is designed to keep current odd behavior.

The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.
2018-08-13 15:31:56 +09:00
Makoto Kato d3b4ee4c97 Bug 1483434 - Allow nullptr parameter for PriorVisibleNode and NextVisibleNode. r=masayuki
Summary:
Sometimes the caller of PriorVisibleNode or NextVisibleNode doesn't use
outVisNode and/or outvisOffset. But both methods require all parameters and
it don't allow nullptr. It is complex whether parameter is used or unused.

So I would like to allow nullptr.

Also, this methods can change to const method, so I will change some methods
to const method too for this change.

Reviewers: masayuki

Tags: #secure-revision

Bug #: 1483434

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

--HG--
extra : rebase_source : 5bd9c87f05c8e88879268188a46a4a80126bd3e5
2018-08-14 18:26:46 +09:00
Masayuki Nakano 557a9e3c62 Bug 1482018 - Create non-virtual methods of nsIHTMLEditor::Indent() equivalents r=m_kato
nsIHTMLEditor::Indent() is used for handling Tab key in HandleKeyPressEvent()
and used for implementing indent/outdent commands.  Unfortunately, it takes
string argument to switch between indent or outdent.  So, it does not make
sense to use this in C++ code.

This patch creates IndentAsAction() and OutdentAsAction() as public methods
and the implementation is moved to IndentOrOutdentAsSubAction() which takes
EditSubAction to switch between indent and outdent.

Note that HandleKeyPressEvent() uses the new public methods.  However, this
is not problem for the future changes since HandleKeyPressEvent() is an
exception which may call other public methods.

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

--HG--
extra : moz-landing-system : lando
2018-08-14 08:30:09 +00:00
Masayuki Nakano ecc94d2ee3 Bug 1482017 - part 1: Create HTMLEditor::CollapseSelectionAfter() for internal use of nsIHTMLEditor::SetCaretAfterElement() r=m_kato
We need to make it possible nsIHTMLEditor::SetCaretAfterElement() to distinguish
if it's called by outer class or editor itself.  Therefore, this patch creates
CollapseSelectionAfter() for internal use.

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

--HG--
extra : moz-landing-system : lando
2018-08-14 06:13:54 +00:00
Masayuki Nakano bdc0aaa4af Bug 1482017 - part 0: Add automated tests for nsIHTMLEditor.setCaretAfterElement() r=m_kato
The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 12:46:51 +00:00
Masayuki Nakano 5499f18c98 Bug 1482016 - part 1: Create HTMLEditor::SelectContentInternal() for internal use of HTMLEditor::SelectElement() r=m_kato
For making it possible HTMLEditor::SelectElement() to distinguish if it's
called by outer class or editor itself, this patch creates
HTMLEditor::SelectContentInternal().

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

--HG--
extra : moz-landing-system : lando
2018-08-15 08:59:40 +00:00
Masayuki Nakano 9eb55eb576 Bug 1482016 - part 0: Add automated tests for nsIHTMLEditor.selectElement() r=m_kato
The new test is disabled only debug build on Android because adding this test
causes permanent orange of non-related test,
dom/tests/mochitest/fetch/test_request.html, see bug 1480702.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 08:49:25 +00:00
Cosmin Sabou 425b934989 Backed out changeset 419fd4edef4f (bug 1482016) for turning Bug 1480702 into permafail. a=backout 2018-08-15 04:29:48 +03:00
Cosmin Sabou 3a67fed29b Backed out changeset 302ce3cdb98f (bug 1482016) for turning bug 1480702 into permafail. a=backout 2018-08-15 04:17:26 +03:00
Andreea Pavel 5d75e43adc Merge mozilla-inbound to mozilla-central. a=merge 2018-08-14 19:15:33 +03:00
Henri Sivonen 3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Masayuki Nakano fc9f86fabd Bug 1482016 - part 1: Create HTMLEditor::SelectContentInternal() for internal use of HTMLEditor::SelectElement() r=m_kato
For making it possible HTMLEditor::SelectElement() to distinguish if it's
called by outer class or editor itself, this patch creates
HTMLEditor::SelectContentInternal().

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

--HG--
extra : moz-landing-system : lando
2018-08-14 08:36:59 +00:00
Tiberius Oros 0930c2bbe1 Backed out changeset ec2b796f1af2 (bug 1482016) for build bustages on builds/worker/workspace/build/src/editor/libeditor/HTMLTableEditor on a CLOSED TREE 2018-08-14 09:17:44 +03:00
Masayuki Nakano cbb0249edb Bug 1482016 - part 1: Create HTMLEditor::SelectContentInternal() for internal use of HTMLEditor::SelectElement() r=m_kato
For making it possible HTMLEditor::SelectElement() to distinguish if it's
called by outer class or editor itself, this patch creates
HTMLEditor::SelectContentInternal().

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

--HG--
extra : moz-landing-system : lando
2018-08-13 07:21:28 +00:00
Masayuki Nakano aa59ff8fc6 Bug 1482016 - part 0: Add automated tests for nsIHTMLEditor.selectElement() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D3186

--HG--
extra : moz-landing-system : lando
2018-08-14 05:56:24 +00:00
Adrian Wielgosik be0c1a4f55 Bug 1481645 - Remove some redundant uses of do_QueryInterface. r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D2893

--HG--
extra : moz-landing-system : lando
2018-08-13 09:05:19 +00:00
Masayuki Nakano e235a4e390 Bug 1482015 - Create HTMLEditor::RemoveInlinePropertyInternal() for internal use r=m_kato
For making it possible to distinguish if HTMLEditor::RemoveInlineProperty() is
called by outer class or editor itself, this patch creates
Create HTMLEditor::RemoveInlinePropertyInternal() and makes the internal
callers use this new method.

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

--HG--
extra : moz-landing-system : lando
2018-08-13 06:16:24 +00:00
Masayuki Nakano 205851fb7c Bug 1482013 - Create HTMLEditor::SetInlinePropertyInternal() for internal use r=m_kato
For making it possible to distinguish if SetInlineProperty() is called by outer
class or the editor itself, this patch creates SetInlinePropertyInternal().

Additionally, this makes the first argument of SetInlineProperty() from
nsAtom* to nsAtom& since it's not nullable.

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

--HG--
extra : moz-landing-system : lando
2018-08-13 05:16:10 +00:00
Masayuki Nakano c0e869978e Bug 1482012 - part 2: Create TextEditor::PasteAsAction() as non-virtual method for outer C++ code r=m_kato
User may paste a lot with pressing Accel+V for a while (i.e., with auto repeat).
So, calling nsIEditor::Paste() may be in a hot path and we can now make
non-virtual public method with AsHTMLEditor().

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

--HG--
extra : moz-landing-system : lando
2018-08-13 04:37:56 +00:00
Masayuki Nakano fa50ac3342 Bug 1482012 - part 1: Create HTMLEditor::PasteInternal() for internal use r=m_kato
HTMLEditor::Paste() is an override of nsIEditor.  So, it's virtual and public.
We should use protected method for internal use and should make it non-virtual
if possible.  This patch creates PasteInternal() which is a protected
non-virtual method.

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

--HG--
extra : moz-landing-system : lando
2018-08-13 04:15:34 +00:00
Makoto Kato fef13a2f66 Bug 1464251 - SplitNodeDeepWithTransaction might create orphan node. r=masayuki
SplitStyleAbovePoint calls SplitNodeDeepWithTransaction repeatedly. If
SplitNodeDeepWithTransaction creates orphan node like this test case,
this crash occurs.  So we should check whether node becomes orphan node.

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

--HG--
extra : moz-landing-system : lando
2018-08-09 08:22:50 +00:00
Geoff Brown 11f0d46c60 Bug 1481587 - Skip a few mochitests on Android x86 7.0 only; r=snorp
Skip a few failing tests on Android 7, to enable green runs of mochitest-cl
and mochitest-gpu on packet.net.
2018-08-10 07:54:41 -06:00
L. David Baron 1e88f0f003 Bug 1369941: Replace single integers N in fuzzy() and fuzzy-if() with 0-N ranges. r=dholbert
This patch was written entirely by the following script:

  #!/bin/bash

  if [ ! -d "./.hg" ]
  then
    echo "Not in a source tree." 1>&2
    exit 1
  fi

  find . -regex '.*\(ref\|crash\)test.*\.list' | while read FILENAME
  do
    echo "Processing ${FILENAME}."
    # The following has four substitutions:
    # * The first one replaces the *first* argument to fuzzy() when it doesn't
    #   have a - in it, by replacing it with an explicit 0-N range.
    # * The second one does the same for the *second* argument to fuzzy().
    # * The third does the same for the *second* argument to fuzzy-if().
    # * The fourth does the same for the *third* argument to fuzzy-if().
    #
    # Note that this is using perl rather than sed because perl doesn't
    # support non-greedy matching, which is needed for the first argument to
    # fuzzy-if.
    perl -pi -e 's/(fuzzy\()([^ ,()-]*)(,[^ ,()]*\))/${1}0-${2}${3}/g;s/(fuzzy\([^ ,()]*,)([^ ,()-]*)(\))/${1}0-${2}${3}/g;s/(fuzzy-if\([^ ]*?,)([^ ,()-]*)(,[^ ,()]*\))/${1}0-${2}${3}/g;s/(fuzzy-if\([^ ]*?,[^ ,()]*,)([^ ,()-]*)(\))/${1}0-${2}${3}/g' "${FILENAME}"
  done

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

--HG--
extra : moz-landing-system : lando
2018-08-09 20:10:21 +00:00
Masayuki Nakano 5f872684af Bug 1467800 - Create HTMLEditor::InsertTextWithQuotationsInternal() for internal use of InsertTextWithQuotations() r=m_kato
HTMLEditor::InsertTextWithQuotations() is called by HTMLEditor::Rewrap() but
it's an XPCOM method, i.e., can be called by anybody.  For making possible to
distinguish whether it's called by outer or not, we should create non-virtual
method and Rewrap() should use it instead.

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

--HG--
extra : moz-landing-system : lando
2018-08-09 12:24:53 +00:00
Masayuki Nakano bf98468b58 Bug 1482007 - part 2: Make all callers of EditorBase::BeginTransaction() use AutoTransactionBatch r=m_kato
This patch also removes LOCK_DOC() and UNLOCK_DOC() from TextServiceDocument.cpp
since they looks like we cannot use early-return style without call of
UNLOCK_DOC() even after removing EndTransaction() calls.  However, they
are defined as empty.  So, they do nothing even since first landing.
Therefore, there is no reason to keep them.

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

--HG--
extra : moz-landing-system : lando
2018-08-09 11:52:46 +00:00
Masayuki Nakano 89e5796790 Bug 1482007 - part 1: Create a helper class to guarantee to call nsIEditor::EndTransaction() after nsIEditor::BeginTransaction() call r=m_kato
This patch also creates non-virtual methods,
EditorBase::BeginTransactionInternal(), EditorBase::EndTransactionInternal(),
TransactionManager::BeginBatchInternal() and
TransactionManager::EndBatchInternal().

Although, this could be replaced with API to use PlaceholderTransaction,
we should investigate it when we have much time.

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

--HG--
extra : moz-landing-system : lando
2018-08-09 11:45:41 +00:00
Emilio Cobos Álvarez 1a7f1a4dbf Bug 1478604 - Fix RepaintSelectionRunner so that it does something for non-presShell impls. r=masayuki
The regressing bug made RepaintSelectionRunner do nothing for any
nsISelectionListener that wasn't a PresShell.

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

--HG--
extra : moz-landing-system : lando
2018-08-07 12:55:21 +00:00
Masayuki Nakano 2413e81af0 Bug 1480666 - Make EditorBase::EndUpdateViewBatch() non-virtual r=m_kato
Although HTMLEditor::EndUpdateViewBatch() calls a method of nsIHTMLEditor,
the additional work after calling EditorBase::EndUpdateViewBatch() is enough
simple. So, we can move the implementation in HTMLEditor to EditorBase and
make it non-virtual.

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

--HG--
extra : moz-landing-system : lando
2018-08-06 04:42:39 +00:00
Ehsan Akhgari 68af33dddb Bug 1484118 - Remove the XPCOM component registration for nsTransactionManager; r=masayuki 2018-08-23 09:36:59 -04:00
Masayuki Nakano 45a67c4b77 Bug 1480663 - Make EditorBase::IsModifiableNode() non-virtual r=m_kato
HTMLEditor::IsModifiableNode() is enough simple and can be checked in
EditorBase. So, we should make it non-virtual and check if instance is
HTMLEditor in EditorBase::IsModifiableNode().

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

--HG--
extra : moz-landing-system : lando
2018-08-03 11:10:46 +00:00
Masayuki Nakano 7484cc4573 Bug 1480055 - part 4: Make AutoTransactionsConserveSelection take reference of Editor rather than pointer r=m_kato
It's always created with non-nullptr.  So, making it treat reference of
EditorBase makes its implementation simpler.

Note that this changes comment in EditorBase::InsertTextWithTransaction() to
a MOZ_ASSERT() for detecting bugs.  However, the comment is wrong.  When
the insertion is for updating composition string, callers don't need to create
AutoTransactionsConserveSelection since it'll be ignored by
CompositionTransaction.  So, the new MOZ_ASSERT() checks whether it's
in composition or prevented transaction changing Selection.

MozReview-Commit-ID: 6jZ4LpksyoD

--HG--
extra : rebase_source : 61ca9272ddea165b3691cf1ce42dc6f4df099a36
2018-08-01 21:30:14 +09:00
Masayuki Nakano 4292293e8c Bug 1480055 - part 3: Create non-virtual method to set EditorBase::mAllowsTransactionsToChangeSelection r=m_kato
There is no non-virtual method to modify
EditorBase::mAllowsTransactionsToChangeSelection.  Therefore,
AutoTransactionsConserveSelection calls virtual method,
nsIEditor::SetShouldTxnSetSelection() twice (from both constructor and
destructor).  So, we should save this unnecessary cost.

MozReview-Commit-ID: B7TYGnGtuLB

--HG--
extra : rebase_source : 26ce77fb63a1967cca88b002cd65e1105477a63d
2018-08-01 21:11:44 +09:00
Masayuki Nakano a9559a1d82 Bug 1480055 - part 2: Rename EditorBase::GetShouldTxnSetSelection() to EditorBase::AllowsTransactionsToChangeSelection() r=m_kato
For explaining what it does clearer, we should rename it and corresponding
member.

MozReview-Commit-ID: 6U8FgfHBbCL

--HG--
extra : rebase_source : 50bc3ce0d3b9900939c7e6e8a137abe2288cf727
2018-08-01 20:53:57 +09:00
Masayuki Nakano 470feacd31 Bug 1480055 - part 1: Remove nsIEditor::shouldTxnSetSelection() r=m_kato
nsIEditor::ShouldTxnSetSelection() is used only by DeleteRangeTransaction
(even if including comm-central and BlueGriffon) and there is a non-virtual
method EditorBase::GetShouldTxnSetSelection().  So, we can remove this.

MozReview-Commit-ID: JWSCw9k6lI0

--HG--
extra : rebase_source : 2509274216a1493134757a7d106464f06ea0ba57
2018-08-01 20:16:30 +09:00
Masayuki Nakano 0fadf6b9da Bug 1467796 - part 3: Make mozInlineSpellChecker::ReplaceWord() use TextEditor::ReplaceTextAsAction() r=m_kato,smaug
mozInlineSpellChecker::ReplaceWord() is used for replacing misspelled word
with a word.  So, this is necessary to be distinguished from insertText
command when we implement InputEvent.inputType.  So, we should make it
use TextEditor::ReplaceTextAsAction() instead (same as autocomplete).

This patch makes TextEditor::ReplaceTextAsAction() take optional argument
to make callers can specify replace range.  Then, the range is a spellchecker
selection range if the caller is mozInlineSpellChecker::ReplaceWord().
Prior to this patch, it clones the range for normal selection, but it's
expensive and we may be able to reuse cached range of Selection in this case.
So, this patch makes Selection::AddRangeInternal() checks if given range is
in another Selection and use mCachedRange as far as possible.

MozReview-Commit-ID: JIOTTsxlj4Q

--HG--
extra : rebase_source : 7c26b0255f08608ebe8c7045c9bcdca1dc70cadf
2018-07-04 22:51:55 +09:00
Masayuki Nakano 08f4c56c7e Bug 1467796 - part 2: Make autocomplete use new method TextEditor::ReplaceTextAsAction() which replaces all text with specified text r=m_kato
InputEvent.inputType needs to distinguish whether inserting text is caused
by insertText command or replaced by autocomplete or spellchecker.
Therefore, nsTextEditorState::SetValue() cannot use
TextEditor::InsertTextAsAction() nor TextEditor::DeleteSelectionAsAction().

This patch reuses TextEditor::SetText()'s slow path for the new method.

Note that the new method uses EditSubAction::eInsertText as top level edit sub-
action because specifying this improves undo/redo behavior.

And also this patch modifies test_bug1368544.html.  Oddly, only on Android,
we get different result.  After removing all text with setUserInput(""),
TextEditor::DeleteSelectionAsSubAction() removes both text node and non-bogus
<br> element from the anonymous-div element.  However, only on Android, new
<br> element is recreated.  I've not understood where this difference comes
from yet.

MozReview-Commit-ID: GKNksctGik

--HG--
rename : toolkit/content/tests/chrome/file_autocomplete_with_composition.js => toolkit/content/tests/chrome/file_editor_with_autocomplete.js
rename : toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html => toolkit/content/tests/chrome/test_editor_for_input_with_autocomplete.html
rename : toolkit/content/tests/chrome/test_autocomplete_with_composition_on_textbox.xul => toolkit/content/tests/chrome/test_editor_for_textbox_with_autocomplete.xul
extra : rebase_source : b90419d9e5a01e86f6e6418f8df002c91416acae
2018-07-03 22:25:52 +09:00
Masayuki Nakano efd8891532 Bug 1467796 - part 1: Split TextEditor::InsertTextAsAction() to itself and TextEditor::InsertTextAsSubAction() for internal use r=m_kato
For bug 1465702, we need to split TextEditor::InsertTextAsAction() to 2 methods.
One is for root of handling an edit operation.  The other is for internal use,
e.g., handling as a part of an edit operation.  Therefore, this patch creates
InsertTextAsSubAction() for the internal use.

MozReview-Commit-ID: CIU5zdp0owP

--HG--
extra : rebase_source : 79b58fb01e48d1831bbdea01ed7b1a26dcd1821b
2018-07-02 20:12:22 +09:00
Boris Zbarsky 754087a992 Bug 1446940 part 5. Stop getting docshells from windows via getInterface in dom/editor/etc code. r=kmag 2018-08-01 13:07:11 -04:00
Emilio Cobos Álvarez 8f34c12e14 Bug 1479860: Remove unused aCompileEventHandlers argument from BindToTree. r=bz
Mostly automatic via sed. Only parts which I touched manually (apart from a
couple ones where I fixed indentation or which had mispelled arguments) are the
callers. I may have removed a couple redundant `virtual` keywords as well when
I started to do it manually, I can revert those if wanted.

Most of them are just removing the argument, but in Element.cpp I also added an
assertion for GetBindingParent when binding the ShadowRoot's kids (the binding
parent is set from the ShadowRoot constructor, and I don't think we bind a
shadow tree during unlink or what not which could cause a behavior difference).

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

MozReview-Commit-ID: 2oIgatty2HU
2018-08-01 10:42:54 +02:00
Bogdan Tara b95ba78360 Merge inbound to mozilla-central. a=merge 2018-07-31 21:30:12 +03:00
Emilio Cobos Álvarez 2996813963 Bug 1479450: Implement nsCSSProps::LookupProperty using Rust. r=xidorn
Always assume allowed-for-all-content. There are a couple callers which weren't
doing that:

 * A unit test -> removed.

 * ComputeAnimationDistance: Used for testing (in transitions_per_property), and
   for the animation inspector. The animation inspector shouldn't show
   non-enabled properties. The transitions_per_property test already relies on
   getComputedStyle stuff which only uses eForAllContent.

 * GetCSSImageURLs: I added this API for the context menu page and such. It
   doesn't rely on non-enabled-everywhere properties, it was only using
   eInChrome because it was a ChromeOnly API, but it doesn't really need this.

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

MozReview-Commit-ID: 4VOi5Su3Bos
2018-07-31 12:00:15 +02:00
Makoto Kato a8ca18700d Bug 1479383 - Use const method for some GetEditorRoot methods. r=masayuki
Some methods to get editor root etc has unnecessary refcounting and it isn't
const method.  So we should remove unnecessary refcounting and change to
const method.

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

--HG--
extra : moz-landing-system : lando
2018-07-30 10:35:43 +00:00
Kris Maglione 031076f2f3 Bug 1463291: Move docShell getter from Document to Window. r=bz
DocShells are associated with outer DOM Windows, rather than Documents, so
having the getter on the document is a bit odd to begin with. But it's also
considerably less convenient, since most of the times when we want a docShell
from JS, we're dealing most directly with a window, and have to detour through
the document to get it.

MozReview-Commit-ID: LUj1H9nG3QL

--HG--
extra : source : fcfb99baa0f0fb60a7c420a712c6ae7c72576871
extra : histedit_source : 5be9b7b29a52a4b8376ee0bdfc5c08b12e3c775a
2018-05-21 16:58:23 -07:00
Kris Maglione 02ba563399 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : source : 0d69b4fb1ed43751cfcbc0b4f2fe3b6a49bc0494
extra : histedit_source : d0ce31513ffaae2fd7f01f6567a97b6d2d96b797%2Cfff837de7a00fa90809d2c3e755097180dfd56d8
2018-05-20 18:10:16 -07:00
Narcis Beleuzu 561ccb2ceb Backed out 2 changesets (bug 1463016, bug 1463291) for geckoview failures
Backed out changeset fcfb99baa0f0 (bug 1463291)
Backed out changeset 0d69b4fb1ed4 (bug 1463016)
2018-07-29 03:55:23 +03:00
Kris Maglione cb1ee1e34d Bug 1463291: Move docShell getter from Document to Window. r=bz
DocShells are associated with outer DOM Windows, rather than Documents, so
having the getter on the document is a bit odd to begin with. But it's also
considerably less convenient, since most of the times when we want a docShell
from JS, we're dealing most directly with a window, and have to detour through
the document to get it.

MozReview-Commit-ID: LUj1H9nG3QL

--HG--
extra : rebase_source : a13c59d1a5ed000187c7fd8e7339408ad6e2dee6
2018-05-21 16:58:23 -07:00
Kris Maglione 636f1839e5 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : rebase_source : 36565ef5e74360aad14062005e5bdab2939e888b
2018-05-20 18:10:16 -07:00
Masayuki Nakano a9d57dd8a8 Bug 1478564 - part 1: Optimize TextEditRules::HandleNewLines() r=m_kato
TextEditRules::HandleNewLines() is expensive since it may scan all of given
string twice and more.  On the other hand, in most cases, given string does
not contain \n, \r nor \r\n.

First, for avoid using nsTString::FindCharInSet(), HandleNewLine() should
receive string which never contains \r nor \r\n.  Then, it always can use
nsTSubstring::FindChar() instead.

Next, HandleNewLines() should do nothing if given string does not contain \n.

Finally, because of unused, this removes unnecessary HandleNewLines() argument
which can specify the way to handle new lines.

MozReview-Commit-ID: 8WSfxfkuFgN

--HG--
extra : rebase_source : 1c05721162a30288929d030c0a15fe83a50fe9d2
2018-07-24 17:46:12 +09:00
Masayuki Nakano 58cbd9a01e Bug 1478564 - part 0: Add automated tests for TextEditRules::HandleNewLines() r=m_kato
MozReview-Commit-ID: L55zBuflDBP

--HG--
extra : rebase_source : 1df602adddf15534198b12191c41197d14ed045b
2018-07-26 22:27:47 +09:00
Masayuki Nakano 4619306c40 Bug 1478268 - Fix condition of MOZ_ASSERT() in TextEditor::InsertWithQuotationsAsSubAction() r=jorgk+176914
As explained in the comment of TextEditor::InsertWithQuotationsAsSubAction(),
it excepts that TextEditRules::WillDoAction() won't handle it.  So, the
MOZ_ASSERT() should check |!handled|, not |handled|.

Caused this regression means that we do not have test to paste text into
<textarea>.  Therefore, this patch adds the tests.

MozReview-Commit-ID: 2UUSVrmmNVK

--HG--
extra : rebase_source : 912d5428aeed83a7a46ec7e4a49c73c33dd7b295
2018-07-26 17:01:15 +09:00
Masayuki Nakano b590219ca3 Bug 1478605 - HTMLEditRules::SplitMailCites() should check if split left node has a primary frame before accessing it r=jorgk+176914
The crash at this point may be caused by unexpected behavior change.  However,
it's difficult to investigate what causes the crash.  So, let's just avoid
the crash to investigate what unexpected behavior occurs.

MozReview-Commit-ID: P6YZTqP7zI

--HG--
extra : rebase_source : 24620884511aa3f1bc9fddb6049fcf6554150439
2018-07-26 19:38:33 +09:00
Boris Zbarsky 75abc43e0d Bug 1476145 part 8. Stop using getInterface(nsIDOMWindowUtils) in various test code. r=kmag 2018-07-24 19:47:43 -04:00
Masayuki Nakano 77fdd1508b Bug 1476897 - part 7: Drop nsIEditorMailSupport interface from TextEditor r=m_kato
Nobody uses nsIEditorMailSupport interface with TextEditor instances.
Therefore, stopping nsIEditorMailSupport interface support of TextEditor
saves memory of TextEditor which may be created a lot even in a document.

MozReview-Commit-ID: BJ4ucCaeYHl

--HG--
extra : rebase_source : 2c932df04d00a4453428dc3b7fd64d338c6963eb
2018-07-23 16:45:07 +09:00
Masayuki Nakano 5e98e38c30 Bug 1476897 - part 6: Move implementation of both TextEditor::PasteAsQuotation() and HTMLEditor::PasteAsQuotation() to new virtual methods r=m_kato
Neither TextEditor::PasteAsQuotation() nor HTMLEditor::PasteAsQuotation()
is used via nsIEditorMailSupport.  So, perhaps, we can remove this method
from the interface.  But for now, we should move each implementation to
new virtual methods and make only HTMLEditor::PasteAsQuotation() calls
new method since nobody uses nsIEditorMailSupport with TextEditor instances.

MozReview-Commit-ID: Eilxk74VHwT

--HG--
extra : rebase_source : 15abe305d9f332ecd521d9115a71443665a8c9fe
2018-07-23 16:34:03 +09:00
Masayuki Nakano a2ecad4a67 Bug 1476897 - part 5: Move implementation of TextEditor::InsertAsQuotation() to new method r=m_kato
TextEditor::InsertAsQuotation() is not used as a method of nsIEditorMailSupport,
however, this is used internally.  So, we need to keep this method's function
as a non-virtual method but we can make the method just return
NS_ERROR_NOT_IMPLEMENTED.

MozReview-Commit-ID: 2CcY4SZGwyr

--HG--
extra : rebase_source : d490145b571bea465be5379872b9ea01daa633cc
2018-07-23 16:05:30 +09:00
Masayuki Nakano b195745b15 Bug 1476897 - part 4: Make TextEditor::InsertTextWithQuotations() returns NS_ERROR_NOT_IMPLEMENTED since it's never used r=m_kato
InsertTextWithQuotations() is called only by HTMLEditor::Rewrap().  So,
HTMLEditor::InsertTextWithQuotations() is always called.  Therefore, we can
make it just return NS_ERROR_NOT_IMPLEMENTED.

MozReview-Commit-ID: FvmY2x3OOn7

--HG--
extra : rebase_source : be567c3882f81c83d2c07955c07202bb9ce2d797
2018-07-23 15:25:18 +09:00
Masayuki Nakano 69e0b4e72b Bug 1476897 - part 3: Make TextEditor::InsertAsCitedQuotation() return NS_ERROR_NOT_IMPLEMENTED since nobody uses this method with TextEditor instances r=m_kato
MozReview-Commit-ID: 487sf6d2wrt

--HG--
extra : rebase_source : dfacb64768de3eab11b7e11478be4c297641f2a0
2018-07-23 15:17:03 +09:00
Masayuki Nakano edd6613c92 Bug 1476897 - part 2: Make TextEditor::GetEmbeddedObjects() just return NS_ERROR_NOT_IMPLEMENTED since it's never used r=m_kato
TextEditor::GetEmbeddedObjects() is never called unless
nsIEditorMailSupport::GetEmbeddedObjects() is used with TextEditor instance.
However, nobody uses nsIEditorMailSupport interface with TextEditor instance.

MozReview-Commit-ID: 4HTnL7KsNGf

--HG--
extra : rebase_source : ceb4f895192b9518c02364c8a317d6c941ac9cc2
2018-07-23 15:07:35 +09:00
Masayuki Nakano ddfc315822 Bug 1476897 - part 1: Implement nsIEditorMailSupport in HTMLEditor since it's never used with TextEditor instance r=m_kato
MozReview-Commit-ID: 5JT4m0IftXY

--HG--
extra : rebase_source : d805fe53c11b01c3aba4578a5b934d6c66490c8e
2018-07-23 14:40:05 +09:00
Masayuki Nakano 1764b38048 Bug 1476294 - Make HTMLEditorDocumentCommands.cpp use non-virtual methods of nsCommandParams instead of virtual methods of nsICommandParams r=Ehsan
This is remaining part of bug 1450882.  I forgot to update
HTMLEditorDocumentCommands.cpp when I work on the bug.

This patch makes HTMLEditorDocumentCommands.cpp use non-virtual methods of
nsCommandParams instead of virtual methods of nsICommandParams.

MozReview-Commit-ID: 12AjXbeYNOa

--HG--
extra : rebase_source : 8d73866b21f6dd1c436244a771fb39bbe2debd40
2018-07-18 00:30:05 +09:00
Masayuki Nakano 905e9bda47 Bug 1476906 - Change nsIHTMLEditor::ReplaceHeadContentsWithHTML() to a non-virtual method of HTMLEditor r=m_kato
nsIHTMLEditor::ReplaceHeadContentsWithHTML() is used only by HTMLEditor
internally. So, it shouldn't be an nsIHTMLEditor's method.  This patch
changes it as a non-virtual method of HTMLEditor and rename it to
ReplaceHeadContentsWithSourceWithTransaction() for consistency with other
methods.

MozReview-Commit-ID: GT3maKEbZuP

--HG--
extra : rebase_source : 2dc8c682f0dd82d3fc9032fbf5195de121975c32
2018-07-19 21:31:19 +09:00
Makoto Kato b870a3fcf3 Bug 358033 - Part 2. Add test. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D2260

--HG--
extra : moz-landing-system : lando
2018-07-23 02:46:24 +00:00
Makoto Kato 414c3e8695 Bug 358033 - Part 1. Restore direction of Selection. r=masayuki
SelectionState doesn't save and restore current selection's direction.  So the
direction of selection is always default after undoing.

So we should restore direction of selection.

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

--HG--
extra : moz-landing-system : lando
2018-07-23 02:44:42 +00:00
Masayuki Nakano 8245258aa0 Bug 1264876 - Remove StripCites() from nsIEditorMailSupport r=m_kato
nsIEditorMailSupport::StripCites() is used only by QA addon of Seamonkey.
So, this is not necessary API now.  This patch removes it and removes its
helper classes in InternetCiter.

MozReview-Commit-ID: 4Esl3GXzo0U

--HG--
extra : rebase_source : 8f5fa85b18613726bfa7e21e5a6312cbd42af7c2
2018-07-19 16:55:31 +09:00
Masayuki Nakano 25f3d21b8d Bug 1337247 - Remove PasteAsCitedQuotation() from nsIEditorMailSupport r=m_kato
nsIEditorMailSupport::PasteAsCitedQuotation() is only used by
HTMLEditor::PasteAsQuotation().  So, we can get rid of the method from the
interface and merge current implementation with HTMLEditor::PasteAsQuotation().

MozReview-Commit-ID: II5ExMAIOhP

--HG--
extra : rebase_source : e40b9b676358a09642e16c73e702e04ac192cb18
2018-07-19 16:08:00 +09:00
Masayuki Nakano 3a1344255b Bug 1467802 - part 4: Create TextEditor::ComputeValueInternal() for internal use of nsIPlaintextEditor::OutputToString() r=m_kato
For reducing virtual calls of nsIPlaintextEditor::OutputToString(),
TextEditor should have new non-virtual public method, ComputeTextValue() and
shared code between it and OutputToString() as ComputeValueInternal().

MozReview-Commit-ID: KFeovQ568bf

--HG--
extra : rebase_source : a5cfb24cefe44f7c60e649959ed49350ed00d4d6
2018-07-18 21:27:30 +09:00
Masayuki Nakano 91c0a26b3f Bug 1467802 - part 3: Create EditorBase::GetDocumentCharsetInternal() for internal use of nsIEditor::GetDocumentCharacterSet() r=m_kato
This patch creates non-virtual method, EditorBase::GetDocumentCharsetInternal(),
for internal use of nsIEditor::GetDocumentCharacterSet() since the virtual
call method is redundant and the caller cannot be marked as const.

MozReview-Commit-ID: v6kDo2eKg3

--HG--
extra : rebase_source : 07f6dd8341cb6686835db2ee3ded479323cccca9
2018-07-18 21:11:32 +09:00
Masayuki Nakano 85b94e287c Bug 1467802 - part 2: Mark TextEditor::GetAndInitDocEncoder() as const r=m_kato
TextEditor::GetAndInitDocEncoder() modifies only mCachedDocumentEncoder and
mCachedDocumentEncoderType which are cache of the method to save recreation
cost of document encoder when same type document encoder is requested.

So, with marking them mutable, we can change the method to a const method.

MozReview-Commit-ID: 80W0NtQhJOR

--HG--
extra : rebase_source : 84f4b49fe3a3124c0de99b39a2141a8cee553e54
2018-07-18 20:51:55 +09:00
Masayuki Nakano 9da3ea2d22 Bug 1467802 - part 1: Create TextEditor::WrapWidth() for internal use of nsIPlaintextEditor::GetWrapWidth() r=m_kato
Let's create non-virtual and simple accessor for TextEditor::mWrapColumn.

MozReview-Commit-ID: 97LhhOgkx4A

--HG--
extra : rebase_source : bd57d7fbcc8da5e00fe71b81a6a2a9ef2f92e939
2018-07-18 20:31:17 +09:00
Masayuki Nakano 2fa716ed4d Bug 1467799 - part 2: Stop using nsIEditor::GetDocumentIsEmpty() from C++ code r=m_kato
nsIEditor::GetDocumentIsEmpty() is a virtual code and there is non-virtual
method, TextEditor::IsEmpty().  So, any callers in C++ should use
TextEditor::IsEmpty() instead.

MozReview-Commit-ID: CQE8LP6XI96

--HG--
extra : rebase_source : e0027c3d71856adcd5fa7820bf936a6b405560c5
2018-07-18 17:51:49 +09:00
Masayuki Nakano 0d09e1a26a Bug 1467799 - part 1: Remove implementation of EditorBase::GetDocumentIsEmpty() and rename TextEditor::DocumentIsEmpty() to TextEditor::IsEmpty() r=m_kato
EditorBase::GetDocumentIsEmpty() is never called since it's overridden by
TextEditor::GetDocumentIsEmtpy() and never called directly.  So, we can remove
its implementation.

Additionally, DocumentIsEmpty() is redundant. We can make it just IsEmpty().

MozReview-Commit-ID: CGsNzCHyVf

--HG--
extra : rebase_source : 3a8eeaf108bb387ea559e0643acfa96e26768577
2018-07-18 17:44:14 +09:00
Masayuki Nakano b98777fe41 Bug 1462257 - TextComposition should dispatch eCompositionChange event when eCompositionCommit is being fired immediately after eCompositionStart r=m_kato
TextEditor modifies composition string or selected string when first
eCompositionChange event is received.  However, TextComposition dispatches
eCompositionChange event ("text" event of DOM) only when composition string
becomes non-empty if current composition string is empty.  So, when IME
dispatches only eCompositionStart and eCompositionCommit events for removing
selected text, TextEditor does nothing.  This hacky behavior is used by
MS Pinyin on Windows 10 at least.

For supporting this behavior, we need to make TextComposition dispatch
eCompositionChange event when eCompositionChange(AsIs) event is fired
even before dispatching eCompositionChange event.

Although from point of view of web apps, the hacky composition should be
merged into the previous composition if it's possible but it's out of scope
of this bug.

MozReview-Commit-ID: 7QfeBJamGTU

--HG--
extra : rebase_source : 8de1353021f2961ae9f8bdf17ddded1058175339
2018-07-11 23:05:39 +09:00
Masayuki Nakano 7581aff013 Bug 1450882 - part 4: Make C++ users of nsICommandParams use nsCommandParams directly r=Ehsan
nsICommandParams is implemented only by nsCommandParams.  So, all C++ users
can treat all instances of nsICommandParams as nsCommandParams.  Therefore,
this patch makes all set/get value calls use non-virtual methods and all
constructors directly create nsCommandParams instance.

MozReview-Commit-ID: CscgK0gKp5g

--HG--
extra : rebase_source : 62eb0f60aada795a44cf5496cdafbff6cba80013
2018-07-10 20:04:21 +09:00
Masayuki Nakano 5a2332692a Bug 1450882 - part 2: Make nsICommandParams::GetCStringValue() and nsICommandParams::SetCStringValue() treat nsACString instead of char r=Ehsan
nsICommandParams::GetCStringValue() and nsICommandParams::SetCStringValue()
treat char.  However, this makes their callers complicated.  So, they should
be rewritten as treating nsACString.

MozReview-Commit-ID: DWO9veSyzyG

--HG--
extra : rebase_source : fbea13f6d7116ea1887434c0842b7768a7dc59ec
2018-07-10 18:04:46 +09:00
Makoto Kato a3492f7faa Bug 1443902 - Part 2. Update spellcheck status on focused element after turning off contenteditable. r=masayuki
Spellchecker of <input> element is off by default, however, if it's in a
contenteditable element, spellchecker is on by default.

When turning off contenteditable, we have to update spellcheck status if
focused editor is in this contenteditable.

MozReview-Commit-ID: 6Y9mUWTIWRn

--HG--
extra : rebase_source : 80951a0389d429d781d359b05bfa6b4046d9e641
2018-07-10 14:17:50 +09:00