Commit Graph

8876 Commits

Author SHA1 Message Date
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
Makoto Kato
16910a6e95 Bug 1443902 - Reinitilize selection after destroying nsIEditingSession. r=masayuki
When setting contenteditable to false, editing session destroys HTMLEditor.
Destroying HTMLEditor means that selection visibility is reset by
FinalizeSelection.

So after calling TearDownEditorOnWindow on nsHTMLDocument, we should initialize
selection visibility if current focus is text control that has editor.

MozReview-Commit-ID: 4V8kZtOtKO3

--HG--
extra : rebase_source : 9d90c12b3c93e4dfd95095ce29a26e5fdd83f952
2018-07-09 16:53:47 +09:00
Ciure Andrei
b37e54e443 Backed out 1 changesets (bug 1443902) for reftest failures reftest/tests/editor/reftests/1443902-2.html CLOSED TREE
Backed out changeset 4c31558d3481 (bug 1443902)
2018-07-10 05:50:31 +03:00
Makoto Kato
98611161ee Bug 1443902 - Reinitilize selection after destroying nsIEditingSession. r=masayuki
When setting contenteditable to false, editing session destroys HTMLEditor.
Destroying HTMLEditor means that selection visibility is reset by
FinalizeSelection.

So after calling TearDownEditorOnWindow on nsHTMLDocument, we should initialize
selection visibility if current focus is text control that has editor.

MozReview-Commit-ID: 4V8kZtOtKO3

--HG--
extra : rebase_source : 773c06bb22cf2da24fd11be9be8d7b0376da3e36
2018-07-09 16:53:47 +09:00
Masayuki Nakano
2b43129579 Bug 1473515 - Make AutoDisableUndo restores enabled state of undo/redo with previous number of maximum transactions r=m_kato
Calling EditorBase::EnableUndoRedo() without argument means that editor supports
unlimited undo/redo stack.  AutoDisableUndo class calls it without argument
when it needs to restore undo/redo feature.

However, <input type="text"> and <textarea> limits number of maximum
transactions up to 1,000, perhaps for footprint.  So, AutoDisableUndo should
store the last number of maximum transactions before disabling undo/redo from
the constructor.

MozReview-Commit-ID: CoI6ZXyTd3X

--HG--
extra : rebase_source : e2b9af17e5857dcc0a6781e254e45fdb790c9a9e
2018-07-05 19:44:23 +09:00
Masayuki Nakano
98a833407e Bug 1467794 - Split TextEditor::DeleteSelectionAsAction() to itself and TextEditor::DeleteSelectionAsSubAction() r=m_kato
TextEditor::DeleteSelectionAsAction() is called even if it's a part of edit
action.  For example, it's called to prepare for inserting text.

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

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

MozReview-Commit-ID: 1TWaypmnoCC

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

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

So we should move the assertion before setting resizer attribute.

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

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

MozReview-Commit-ID: GgKYOcI3sGX

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

MozReview-Commit-ID: 5UQVHElSpCr

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

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

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

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

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

MozReview-Commit-ID: qjZS54ZeoT

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

MozReview-Commit-ID: ErZQwWC0Wjx

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

MozReview-Commit-ID: BGZlDzsKT6N

--HG--
extra : rebase_source : 1a0e328b84f1a71638425bb4dfba756a211faa74
2018-06-04 11:15:05 +09:00