Commit Graph

9017 Commits

Author SHA1 Message Date
Masayuki Nakano
d481dba0c1 Bug 1503473 - part 5: Move InsertParagraphSeparator*() into HTMLEditor r=m_kato
Now, TextEditor needs only InsertLineBreak*() so that
InsertParagraphSeparator*() is necessary only in HTMLEditor.
With overriding nsIPlaintextEditor::InsertLineBreak() in HTMLEditor,
we can do it simply.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

So we should adopt this behaviour on Gecko too.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

> foo->CanRunScriptMethod(SelectionRef());

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--HG--
extra : moz-landing-system : lando
2018-10-15 02:01:09 +00:00