Commit Graph

9558 Commits

Author SHA1 Message Date
Masayuki Nakano
1df80236d6 Bug 1572375 - part 6: Get rid of HTMLEditRules::WillLoadHTML() r=m_kato
`HTMLEditRules::WillLoadHTML()` does exactly same thing as
`EditorBase::EnsureNoPaddingBRElementForEmptyEditor()`.  Therefore, we can
get rid of it and make `HTMLEditor::LoadHTML()` not use `HTMLEditRules`.

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

--HG--
extra : moz-landing-system : lando
2019-08-13 00:09:46 +00:00
Masayuki Nakano
c1906f614d Bug 1572375 - part 5: Move TextEditRules::CreatePaddingBRElementForEmptyEditorIfNeeded() into EditorBase r=m_kato
`TextEditRules::CreatePaddingBRElementForEmptyEditorIfNeeded()` is used by
both `TextEditor` and `HTMLEditor` so that this moves it into `EditorBase`.

Additionally, making `TextEditor::MaybeChangePaddingBRElementForEmptyEditor()`
call it if there is no content.  Then, we can avoid the dependency of them.

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

--HG--
extra : moz-landing-system : lando
2019-08-09 10:19:11 +00:00
Masayuki Nakano
3b82fdde10 Bug 1572375 - part 4: Move TextEditRules::RemoveRedundantTrailingBR() into TextEditor r=m_kato
`TextEditRules::RemoveRedundantTrailingBR()` is used only by multiline text
editor (i.e., `<textarea>`).  Therefore, it should be moved into `TextEditor`.

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

--HG--
extra : moz-landing-system : lando
2019-08-09 09:01:56 +00:00
Masayuki Nakano
d88036fb98 Bug 1572375 - part 3: Get rid of TextEditRules::WillUndo(), TextEditRules::DidUndo(), TextEditRules::WillRedo() and TextEditRules::DidRedo() r=m_kato
`TextEditRules::WillUndo()` and `TextEditRules::WillRedo()` only check whether
the editor is readonly/disabled or not.  So, `TextEditor::UndoAsAction()` and
`TextEditor::RedoAsAction()` should do it first.

`TextEditRules::DidUndo()` and `TextEditRules::DidRedo()` only set or unset
`mPaddingBRElementForEmptyEditor` if it's restored by undo or redo.
Therefore, we can move the code into `TextEditor::UndoAsAction()` and
`TextEditor::RedoAsAction()`.

Note that this patch makes `TextEditor::UndoAsAction()` discard the result of
`TransactionManager::Undo()` because this is inconsistent from what
`TextEditor::RedoAsAction()` does and this was changed by part 5 of bug 1447924.
https://hg.mozilla.org/mozilla-central/rev/869a1445816be7f43f54f7c97f28e4c6273fa75f

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

--HG--
extra : moz-landing-system : lando
2019-08-09 08:57:00 +00:00
Masayuki Nakano
b0606032ba Bug 1572375 - part 2: Split TextEditRules::WillInsert() r=m_kato
`TextEditRules::WillInsert()` is not used with initial purpose since
`HTMLEditor` always works with `HTMLEditRules` and its `WillDoAction()`
always handles `EditSubAction::eInsertElement`.

Additionally, its name is too generic since it does non-related 3 things.

One is checking whether the editor is readonly or disabled.  However, this
may not be necessary since its callers may have already checked it or
just ignored the result.  So, this should be check by each caller.

Next one is masking password if auto-masking is enabled.  This is `TextEditor`
specific feature so that this patch moves the code into
`TextEditor::MaybeDoAutoPasswordMasking()`.

Final one is removing empty `<br>` element for empty editor if there is.
This is common feature so that this patch moves this code into
`EditorBase::EnsureNoPaddingBRElementForEmptyEditor()`.

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

--HG--
extra : moz-landing-system : lando
2019-08-09 08:25:37 +00:00
Masayuki Nakano
b25f8b0e06 Bug 1572375 - part 1: Move TextEditRules::mPaddingBRElementForEmptyEditor to EditorBase r=m_kato
`TextEditRules::mPaddingBRElementForEmptyEditor` are used by both `TextEditor`
and `HTMLEditor`.  Therefore, it should be in `EditorBase`.

This patch makes `TextEditRules` and `HTMLEditRules` directly access the
private member of `EditorBase` temporarily.  It'll be fixed by the following
patches.

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

--HG--
extra : moz-landing-system : lando
2019-08-09 07:03:29 +00:00
Mirko Brodesser
a83f7bfa50 Bug 1572715: part 2) Make some methods around HTMLEditor const-correct. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D41385

--HG--
extra : moz-landing-system : lando
2019-08-12 08:31:04 +00:00
Mirko Brodesser
d0e7afc285 Bug 1572715: part 1) Factor out WSRunScanner from WSRunObject. r=masayuki
This allows users of `WSRunScanner`'s functionality to pass a `const
HTMLEditor*`, allowing themselves to become const-correct.

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

--HG--
extra : moz-landing-system : lando
2019-08-12 08:30:57 +00:00
Mirko Brodesser
d7dc23922f Bug 1572473: declare a few methods in WSRunObject const. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D41223

--HG--
extra : moz-landing-system : lando
2019-08-09 06:11:46 +00:00
Mirko Brodesser
1274c8140e Bug 1572060: declare a few methods around HTMLEditor static/const. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D40982

--HG--
extra : moz-landing-system : lando
2019-08-07 15:58:41 +00:00
Kannan Vijayan
e53a880b1c Bug 1569262 - Rename nsIDocShellTreeItem::GetRootTreeItem to GetInProcessRootTreeItem for Fission marking. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D41064

--HG--
extra : moz-landing-system : lando
2019-08-07 19:24:00 +00:00
Masayuki Nakano
f3fb0d1af8 Bug 1569613 - Add surrogate pair handling API to nsTextFragment r=hsivonen
We check surrogate pair at specific index in `nsTextFragement` in a lot of
places.  This requires boundary check of the index so that it can cause
security issue and crash reason with simple mistake, and also it steals
your time to understand the code what it does especially when it's a
part of an `if` condition.

Therefore, this patch adds new API to `nsTextFragment` and makes the all
surrogate pair handlers of `nsTextFragument` use new API.

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

--HG--
extra : moz-landing-system : lando
2019-08-06 05:43:21 +00:00
Nicholas Nethercote
c6ce52db91 Bug 1571621 - Convert VarCache prefs in HTMLEditor.cpp to static prefs. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D40775

--HG--
extra : moz-landing-system : lando
2019-08-06 08:49:32 +00:00
Makoto Kato
79bf4210ee Bug 1565919 - Don't separate words by contextual-based character. r=Ehsan
Original regression was by bug 1362858, and bug 1418629 wasn't enough to fix.

By bug 1362858, we use `CHAR_CLASS_SEPARATOR` in additional to DOM word separator. But some characters such as single quote, `@` and etc are `CHAR_CLASS_SEPARATOR`, so we may check spell by incomplete word.

We shouldn't separate word by characters that is email part, URL part or conditional punctuation.

And I also update test cases for this situation. `<textarea>` is better for spell checking since it can has multiple anonymous text nodes.

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

--HG--
extra : moz-landing-system : lando
2019-08-03 13:44:56 +00:00
Makoto Kato
1545cbbf19 Bug 1570861 - Editor should store text node in mCachedSelectionNode to pass previous selected node/offset to spell checker r=masayuki
When using `<textarea>`, spell checker sometimes check spell when editing last text node. Because editor passes invalid previous selection node and offset via `HandleInlineSpellCheck`.

Although previous selected node uses `mCachedSelectionNode` that is stored by `BeforeEdit`, when this occurs, it isn't text node.

When editing last text node in `<textarea>`, anchror node might be root node, not current text node. So we should use text node instead when this is inserting text operation.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 07:44:20 +00:00
Masayuki Nakano
11ae238f0f Bug 1569902 - part 4: Make TextEditor inserts padding <br> element for empty last line after setting flags to NS_PADDING_FOR_EMPTY_LAST_LINE r=m_kato
Stopping using attribute for "moz-br", `IMEContentObserver` cannot know when
new `<br>` element is changed to padding element for empty last line.
Therefore, editor needs to insert padding `<br>` element after setting the
flag properly.  Then, `IMEContentObserver` does not need to recompute the
length of `<br>` element (if it's for padding, it computes the length as 0).

Unfortunately, `TextEditor::InsertBrElementWithTransaction()` is used in too
many places and it already has optional argument.  Therefore, it's difficult
to change it.  However, we should share the preparation before creating `<br>`
element in it with new method.  Therefore, this patch creates
`EditorBase::PrepareToInsertBRElement()` to share the preparation point (almost
just moved from the method).  Then, new method is created as
`EditorBase::InsertPaddingBRElementForEmptyLastLineWithTransaction()` because
it's used both in `TextEditor` and `HTMLEditor`.  Finally, `TextEditor` won't
insert `<br>` element with `InsertBrElementWithTransaction()`.  Therefore, it's
moved to `HTMLEditor` with renaming to `InsertBRElementWithTransaction()`.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:46:41 +00:00
Masayuki Nakano
1d359bd94e Bug 1569902 - part 3: Get rid of TextEditRules::CreateBR() r=m_kato
`TextEditRules::CreateBR()` is used only by
`HTMLEditRules::InsertBRIfNeededInternal()` and it just calls
`TextEditor::InsertBrElementWithTransaction()`.  Therefore, we can get rid of
it.  Then, `CreateBRInternal()` can be renamed to
`CreatePaddingBRElementForEmptyLastLine()` since it's shared only by
`CreateBR()` and `CreatePaddingBRElementForEmptyLastLine()`.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:45:56 +00:00
Masayuki Nakano
23a22c597a Bug 1569902 - part 2: Stop using attribute to consider whether a <br> element is a special node for empty last line or not r=m_kato,smaug
Editor creates a `<br>` element to end of a block if last line
of the block is empty because caret should be placed as there is an empty
line.  Such special `<br>` element has `type` attribute whose value is "_moz".
However, adding/removing the attribute is expensive and such hacky attribute
shouldn't be referred nor changed by web apps.

Therefore, this patch makes `HTMLBRElement` take another specific flag whether
it's a special node for empty last line.  For making the meaning clearer,
this patch calls the such `<br>` elements as "padding `<br>` element for
empty last line" insead of "moz-br".  So, this patch also includes a lot of
renaming methods and variables, and modifying related comments.

Note that with this change, `IMEContentObserver` counts the padding `<br>`
element in `<textarea>` because it's inserted before setting the new flag
and setting the flag does not cause DOM tree mutation.  This issue will be
fixed by the following patches.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:45:18 +00:00
Masayuki Nakano
765e91b497 Bug 1569902 - part 1: Stop using attribute to consider whether a <br> element is an editor bogus node or not r=m_kato,smaug
Editor creates a `<br>` element when it's root element is empty.
Then, it's stored by `TextEditRules::mBogusNode` and used for checking
whether the editor is empty quickly.  However, this `<br>` element has
`mozeditorbogusnode` attribute whose value is `true`.  However, adding or
removing the attribute is not cheap and web apps can refer such illegal
attribute.

Therefore, this patch makes `HTMLBRElement` take a specific flag whether
it's a bogus node or not.  However, this means that this hacky thing will be
exposed outside editor module.  For making what is the bogus node clearer,
this patch calls the such `<br>` elements as "padding `<br>` element for
empty editor".  So, this patch also includes a lot of renaming methods and
variables, and modifying related comments.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:44:40 +00:00
Masayuki Nakano
7037a2b100 Bug 1568777 - Make first argument of nsIEditor.unmask() optional r=m_kato
Currently, if you need to unmask all password characters, you need to call
`nsIEditor.unmask(0)`. However, this is ugly and this must be the most use
case. So, I think that we should make it optional.

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

--HG--
extra : moz-landing-system : lando
2019-07-29 12:21:02 +00:00
Masayuki Nakano
d1512c277c Bug 1568753 - Make TextEditor::SetUnmaskRangeInternal() return NS_OK if there is no text node and aStart is UINT32_MAX r=m_kato
`aStart` of `TextEditor::SetUnmaskRangeInternal()` may be `UINT32_MAX` if
it's called for stopping unmasking.  However, it returns `NS_ERROR_INVALID_ARG`
if there is no text node and `aStart` is not 0, but this is unexpected behavior.

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

--HG--
extra : moz-landing-system : lando
2019-07-29 06:30:50 +00:00
Masayuki Nakano
fafe168f04 Bug 1560032 - part 2: Make cut/copy in password field available r=m_kato,smaug
First, we need to make `nsCopySupport::FireClipboardEvent()` keep handling
`eCopy` and `eCut` event even in password field, only if `TextEditor` allows
them.

Then, we need to make `nsPlainTextSerializer::AppendText()` not expose
masked password for making users safer.  Although `TextEditor` does not allow
`eCopy` nor `eCut` when selection is not in unmasked range.  Fortunately,
retrieving masked and unmasked password from `nsTextFragment` has already
been implemented in `ContentEventHandler.cpp`.  This patch moves it into
`EditorUtils` and makes `ContentEventHandler.cpp` and `nsPlaintextSerializer`
share it.

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

--HG--
extra : moz-landing-system : lando
2019-07-29 06:21:42 +00:00
Masayuki Nakano
ffbb14909f Bug 1560032 - part 1: Make TextEditor for password allow to copy password when selected range is in unmasked range r=m_kato
It does not make sense to copy masked password with mask characters.
Therefore, we should allow users to copy/cut in password fields only when
selected range is in unmasked range.

Note that for web-compat, copy/cut are always enabled in HTML/XHTML document
in content.  Therefore this patch changes the behavior only in chrome's
password fields.

Additionally, only the test uses `nsIEditor.canDelete()`.  Therefore, this
removes it and make the test use `nsIDocShell.isCommandEnabled()` instead.
Unfortunately, `nsIEditor.canCopy()` and `nsIEditor.canCut()` are used by
BlueGriffon, therefore, we cannot get rid of them for now.

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

--HG--
rename : editor/libeditor/tests/test_bug1067255.html => editor/libeditor/tests/test_cut_copy_delete_command_enabled.html
extra : moz-landing-system : lando
2019-07-29 06:21:14 +00:00
Kannan Vijayan
3fb6190ec6 Bug 1559414 - Rename unaudited pre-fission methods with SameProcess for future audit burndown. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D39378

--HG--
extra : moz-landing-system : lando
2019-07-26 16:48:31 +00:00
Nicholas Nethercote
18fae65f38 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

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

--HG--
extra : moz-landing-system : lando
2019-07-26 01:10:23 +00:00
Masayuki Nakano
15fcb38af8 Bug 1548389 - part 10: Make TextEditor::SetUnmaskRangeInternal() expand the range if specified offset is middle of a surrogate pair r=m_kato
Unmasking is an optional style of showing password.  Therefore, if callers of
`nsIEditor::Unmask()` specify middle of surrogate pair(s), it may mean that
they want to expand the unmask range from shorter range which does not include
the high and/or low surrogate.  Therefore, one of the surrogates is in unmasked
range, we unmask the surrogate pair.  However, we handle this in a lot of
places, i..e., we have duplicated code.  This can get rid of these duplicates
with making `nsIEditor::Unmask()` expand the range automatically.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:56:33 +00:00
Masayuki Nakano
9dc8292d3f Bug 1548389 - part 8: Make nsTextFrame::PeekOffsetWord() scan masked text r=jfkthame
Double click, long tap, moving selection with keyboard and deleting text
scan word boundary.  With these changes, the text node has raw password
value even if it's masked visually.  For making safer,
`nsTextFrame::PeekOffsetWord()` should search word boundary in masked text.
Then, we can hide word boundary at masked range, but keep allowing to look
for word boundary only in unmasked range.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:55:53 +00:00
Masayuki Nakano
1c2108934c Bug 1548389 - part 6: Add automated tests for new API and rendering of password fields r=m_kato,Jamie
Differential Revision: https://phabricator.services.mozilla.com/D38010

--HG--
extra : moz-landing-system : lando
2019-07-22 03:55:13 +00:00
Masayuki Nakano
5febecd19b Bug 1548389 - part 5: Make nsTextFrame and related code treat masking password characters as text-transform r=jfkthame
Anonymous text node in password field has `NS_MAYBE_MASKED` flag and
`TextEditor` managing the node has range of unmasking.  This patch makes
`BuildTextRunsScanner::BuildTextRunForFrames()` treat text frame in
password field as `text-transform` applied.  For recording the unmask range,
this patch creates `nsTransformedCharStyle::mMaskPassword` and treats unmask
range start/end edges as different style boundary.  Therefore,
`nsCaseTransformTextRunFactory::TransformString()` can replace each character
with a password mask character with the information.

Note that we need to kill bidi algorithm in password fields with forms.css
because caret position will tell everybody whether the typing character is
an RTL or an LTR character.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:54:50 +00:00
Masayuki Nakano
3102de8053 Bug 1548389 - part 3: Make editor mark text node in password field as "maybe masked" r=smaug
With the previous patches, editor has stopped masking characters in password
field.  Instead, layout code needs to handle it.  However, layout code
especially around `nsTextFrame` is performance critical area.  Therefore,
layout code requires a quick way to check whether a text node in password
field or not.

This patch creates new flag for `CharacterData` node and marks all text nodes
whose characters should be masked with the flag when `EditorBase` or
`nsTextControlFrame` creates them.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:54:16 +00:00
Masayuki Nakano
b8d245a76d Bug 1548389 - part 2: Make TextEditRules use the new editor API to mask/unmask characters in password editor r=m_kato
Now, `TextEditRules` should use the new editor API to mask/unmask characters
if it's for a password editor.  With this change, it does not need to manage
masked characters and unmasked characters separately since the anonymous
text node always have unmasked characters and `nsTextFrame` will mask the
characters at painting time.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:53:58 +00:00
Masayuki Nakano
010cde10c1 Bug 1548389 - part 1: Implement API to get/set unmask-range of password editor r=m_kato
This patch creates editor API to get/set unmask-range of password field.
Its design is similar to `setSelectionRange()` and `selectionStart`/
`selectionEnd` attributes.   The unmasked range is automatically
masked if `aTimeout` of `unmask()` is set to non-zero.
Otherwise, unmasked range won't be masked automatically even after user
or web apps modifies the editor, and inserting new character expands
unmasking range.

The following patch makes `TextEditRules` use these API to implement
delayed masking of password.

Note that editor has never supported dynamic `eEditorPasswordMask` change.
E.g., if you have typed some characters into an editor and toggle the flag,
the characters are not unmasked nor masked.  Then, if you type new characters,
only they are correctly masked or unmasked.  This patch puts `MOZ_ASSERT()`
to reject this feature completely on debug build for making the unmasking
implementation simpler.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:53:36 +00:00
Masayuki Nakano
ca49cc9d2d Bug 1548389 - part 0: Wrap modifying text node in editor with particular methods r=m_kato
In the next patch, we need to update unmasked range when anonymous text node
in `<input type="password">` is modified.  This patch makes editor manage it
easier to update the range.

Note that the next patch also handles text node creation and destruction.

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

--HG--
extra : moz-landing-system : lando
2019-07-22 03:53:29 +00:00
Mirko Brodesser
1669cc6770 Bug 1566046: rename GetParentOrHostNode to GetParentOrShadowHostNode. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D38078
2019-07-16 09:25:02 +02:00
Mirko Brodesser
2f40f072ab Bug 1565584: move nsIContentUtils::ContentIsDescendantOf to nsINode::IsInclusiveDescendantOf. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37880
2019-07-15 10:02:21 +02:00
Brendan Dahl
84f1f82f3d Bug 1557371 - Part 1 - Load all XUL reftests with chrome privilege. r=dbaron
This will have two benefits:

1) Align test setup with shipping Firefox - We don't allow content
privilege XUL in shipping versions of Firefox, so having the tests be
chrome would be more realistic to our use case.

2) Support the XUL to XHTML migration. These files will soon become XHTML
files, but will still need to load XUL elements, so they'll need to be
marked as chrome privileged to continue working.

One test (404149-1.xul) is now disabled, since it fails when loaded as
chrome. Bug 1557383 was filed to address this.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 19:40:33 +00:00
Emilio Cobos Álvarez
c17be889ab Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

Differential Revision: https://phabricator.services.mozilla.com/D37406
2019-07-09 23:08:05 +02:00
Emilio Cobos Álvarez
28801c9e84 Bug 1218456 - Allow navigating when there's no pres context. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37404
2019-07-09 23:07:29 +02:00
Dorel Luca
9925ca654c Backed out 5 changesets (bug 1218456) for Crashtest failures on dom/l10n/tests/mochitest/dom_localization/test_overlay.html. CLOSED TREE
Backed out changeset 31afe89c2d42 (bug 1218456)
Backed out changeset 8bd57ebc4528 (bug 1218456)
Backed out changeset e5d37afff36a (bug 1218456)
Backed out changeset e3da86278ecf (bug 1218456)
Backed out changeset 343046089f8e (bug 1218456)

--HG--
extra : rebase_source : f092d903c8c80581d187493e036b1875d8668b3d
2019-07-09 22:04:13 +03:00
Emilio Cobos Álvarez
23a7cb7a68 Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 16:17:47 +00:00
Emilio Cobos Álvarez
d5db3842a0 Bug 1218456 - Allow navigating when there's no pres context. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37404

--HG--
extra : moz-landing-system : lando
2019-07-09 16:17:27 +00:00
Masayuki Nakano
dddc25e1e9 Bug 1563508 - part 5: Make runRemoveContentTest() async and fix an editor's bug which found by the test order change r=m_kato
Previously, `runRemoveContentTest()` was the last test which synthesizes
composition in the `<textarea>`.  However, new test order move it to middle
of the other tests.  Then, it hits an `MOZ_ASSERT()` in
`TextComposition::EditorWillHandleCompositionChangeEvent()` that detects a
bug.  When editable element is removed from the DOM tree during a composition,
editor cannot listen to `eCompositionEnd` event.  Therefore, when the editor
gets back, it still has destroyed `TextComposition` and keeps handling new
composition with the old one.  Therefore this patch makes
`EditorBase::InstallEventListeners()` forget the destroyed composition.

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

--HG--
extra : moz-landing-system : lando
2019-07-09 05:20:01 +00:00
Victor Porof
5065489a4e Bug 1561435 - Format editor/, a=automatic-formatting
# ignore-this-changeset

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

--HG--
extra : source : 31c98530f9be7521baab316d7edc309361623fb1
2019-07-05 10:45:46 +02:00
Razvan Maries
daed363fd7 Merge mozilla-inbound to mozilla-central a=merge 2019-07-05 00:40:17 +03:00
Rob Wu
7efa6b1bd8 Bug 1396224 - Avoid cache for private clipboard data r=mstange
To avoid populating the clipboard cache,
`nsContentUtils::IPCTransferableToTransferable` should set the
IsPrivateData flag on the output transferable BEFORE assigning data to
it, not therafter.

This patch includes a new regression test for this specific scenario.

The patch also includes fixes for incorrect IsPrivateData flags in some
other locations with `transferable->Init(nullptr)`, but without unit
tests.

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

--HG--
extra : moz-landing-system : lando
2019-07-02 21:45:10 +00:00
Mirko Brodesser
6b67de025f Bug 1562876: rename Selection::RemoveRange to Selection::RemoveRangeAndUnselectFramesAndNotifyListeners. r=smaug
The name of the corresponding webidl interface of course remains unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D36607
2019-07-03 13:26:14 +02:00
Mirko Brodesser
63b4627d28 Bug 1562876: rename Selection::AddRange to Selection::AddRangeAndSelectFramesAndNotifyListeners. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36602
2019-07-03 13:26:13 +02:00
Mihai Alexandru Michis
761fb3a596 Backed out changeset c68a6b2e0157 (bug 1557371) for causing failures in reftest/content/bugs/272646-1.xul CLOSED TREE 2019-07-02 06:01:31 +03:00
Brendan Dahl
c5fbaae97e Bug 1557371 - Part 1 - Load all XUL reftests with chrome privilege. r=dbaron
This will have two benefits:

1) Align test setup with shipping Firefox - We don't allow content
privilege XUL in shipping versions of Firefox, so having the tests be
chrome would be more realistic to our use case.

2) Support the XUL to XHTML migration. These files will soon become XHTML
files, but will still need to load XUL elements, so they'll need to be
marked as chrome privileged to continue working.

One test (404149-1.xul) is now disabled, since it fails when loaded as
chrome. Bug 1557383 was filed to address this.

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

--HG--
extra : moz-landing-system : lando
2019-06-29 00:04:12 +00:00
Kris Maglione
fd61f8b9d4 Bug 1541557: Part 7 - Convert SpecialPowers to use JSWindowActors rather than framescripts. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D35057

--HG--
rename : testing/specialpowers/content/SpecialPowersObserverAPI.jsm => testing/specialpowers/content/SpecialPowersAPIParent.jsm
rename : testing/specialpowers/content/SpecialPowers.jsm => testing/specialpowers/content/SpecialPowersChild.jsm
rename : testing/specialpowers/content/SpecialPowersObserver.jsm => testing/specialpowers/content/SpecialPowersParent.jsm
extra : rebase_source : f3edaf8edc918bb4291b66cb50f4de117f57b2bd
extra : source : 46ff845a7b0cdabf640bb2e3c783735ab68b7cd1
2019-06-12 10:48:29 -07:00
Kris Maglione
3e44c16cf9 Bug 1541557: Part 5 - Update callers of ChromeScript.sendSyncMessage to use sendQuery instead. r=nika
Since JSWindowActors don't have direct access to synchronous messaging,
ChromeScript callers are going to need to migrate to asynchronous messaging
and queries instead.

Since there's no comparable API to sendQuery for frame message managers, this
patch adds a stub that uses synchronous messaging, but makes the API appear
asynchronous, and migrates callers to use it instead of direct synchronous
messaging. This will be replaced with a true synchronous API in the actor
migration.

Fortunately, most of the time, this actually leads to simpler code. The
`sendQuery` API doesn't have the odd return value semantics of
`sendSyncMessage`, and can usually just be used as a drop-in replacement. Many
of the `sendSyncMessage` callers don't actually use the result, and can just
be changed to `sendAsyncMessage`. And many of the existing async messaging
users can be changed to just use `sendQuery` rather than sending messages and
adding response listeners.

However, the APZ code is an exception. It relies on intricate properties of
the event loop, and doesn't have an easy way to slot in promise handlers, so I
migrated it to using sync messaging via process message managers instead.

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

--HG--
extra : rebase_source : d5707e87f293a831a5cf2e0b0a7e977090267f78
extra : source : 75ebd6fce136ab3bd0e591c2b8b2d06d3b5bf923
2019-06-12 12:40:51 -07:00
Kris Maglione
f70e67ad2d Bug 1541557: Part 4 - Stop relying on synchronous preference getters/setters. r=nika
The SpecialPowers set*Pref/get*Pref APIs currently use synchronous messaging
to set and get preference values from the parent process. Aside from directly
affecting callers of those APIs, it also affects callers of `pushPrefEnv`,
which is meant to be asynchronous, but is in practice usually synchronous due
to the synchronous messaging it uses.

This patch updates the getPref APIs to use the in-process preference service
(which most callers are expecting anyway), and also updates the callers of
the setPref and pushPrefEnv APIs to await the result if they're relying on it
taking effect immediately.

Unfortunately, there are some corner cases in tests that appear to only work
because of the quirks of the current sync messaging approach. The synchronous
setPref APIs, for instance, trigger preference changes in the parent
instantly, but don't update the values in the child until we've returned to
the event loop and had a chance to process the notifications from the parent.
The differnce in timing leads some tests to fail in strange ways, which this
patch works around by just adding timeouts.

There should be follow-ups for test owners to fix the flakiness.

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

--HG--
extra : rebase_source : 941298157e7c82f420cf50ce057154ce9b85301c
extra : source : 189dc8a359815e059a4a217f788d183260bb2bfe
2019-06-13 09:34:39 -07:00
Masayuki Nakano
ccf6a4c660 Bug 1444847 - part 7: Make EditorSpellCheck use StaticRange instead of nsRange to initialize itself r=smaug
`EditorSpellCheck` clones `nsRange` instance only for temporary use during
initialization even though the DOM tree won't be changed during it.  In this
case, using `StaticRange` is better since it does not need to observe the
DOM tree mutation.  I.e., we can save the cost of registering and
unregistering the mutation observer.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:36 +00:00
Masayuki Nakano
15b95c47c4 Bug 1444847 - part 6: Make HTMLEditRules::PinSelectionToNewBlock() use StaticRange instead of nsRange for temporary use r=smaug
This patch makes `HTMLEditRules::PinSelectionToNewBlock()` use `StaticRange`
instead of `nsRange` for comparing a point and a range (i.e., the DOM tree
won't be changed during it's alive).  Unfortunately, we still have allocation
cost, but we can save the cost of registering and unregistering mutation
observer and computing common ancestor of the range.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:34 +00:00
Masayuki Nakano
8d6b106ff6 Bug 1444847 - part 5: Make HTMLEditRules::ExpandSelectionForDeletion() use StaticRange instead of nsRange for temporary use r=smaug
This patch makes `HTMLEditRules::ExpandSelectionForDeletion()` use `StaticRange`
instead of `nsRange` for comparing a point and a range (i.e., the DOM tree
won't be changed during it's alive).  Unfortunately, we still have allocation
cost, but we can save the cost of registering and unregistering mutation
observer and computing common ancestor of the range.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:50:32 +00:00
Masayuki Nakano
da61ea3112 Bug 1444847 - part 3: Create RangeUtils to place public static methods of nsRange r=smaug
Some `nsRange` static methods are useful in `StaticRange` and some of them
are used in a lot of places but not related to `nsRange` directly.  This
patch moves them into new static method only class, `mozilla::RangeUtils`.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:48:07 +00:00
Masayuki Nakano
2a450c5196 Bug 1444847 - part 2: Sort out basic API of nsRange for consistency with coming StaticRange r=smaug
For avoiding confusion between API of `nsRange` and `StaticRange`, I'd like to
rename `nsRange::CreateRange()` to `nsRange::Create()` because
`StaticRange::CreateStaticRange()` is too long name and
`StaticRange::CreateRange()` sounds odd.  This patch renames it and changes
related methods to template methods to avoid runtime cost of temporary
`RawRangeBoundary` instance creation.

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

--HG--
extra : moz-landing-system : lando
2019-06-28 07:47:29 +00:00
Brendan Dahl
ccb8b2f945 Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan,bgrins
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-18 20:40:19 +00:00
Ciure Andrei
2e6ac83efb Backed out changeset 7312aba8ec3b (bug 1558674) for causing browser_console_context_menu_entries.js to permafail CLOSED TREE 2019-06-15 08:48:18 +03:00
Brendan Dahl
7c478fba5b Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan,bgrins
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-15 00:27:36 +00:00
Narcis Beleuzu
72a734cf98 Backed out changeset aa7f507ac743 (bug 1558674) for dt failures on browser_console_context_menu_entries.js . CLOSED TREE 2019-06-14 05:57:52 +03:00
Brendan Dahl
04a85879bb Bug 1558674 - Allow chrome privileged documents to enable/disable copy/paste. r=Ehsan
For content HTML/XHTML copy/paste should always be enabled, but for chrome
docs we can support enabling/disabling copy/paste.

Also, restores tests to how they were before copy/paste was always enabled.

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

--HG--
extra : moz-landing-system : lando
2019-06-14 00:32:21 +00:00
Brendan Dahl
8496f09e8e Bug 1558704 - Fix spellchecker when XUL is loaded as XHTML r=masayuki
Temporary workaround to use the document element as the root content node
in XHTML pages that have a XUL root element.

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

--HG--
extra : moz-landing-system : lando
2019-06-13 11:53:12 +00:00
Jonathan Kingston
a5ba216f93 Bug 1315460 - Removal of keygen element r=keeler,baku,jld,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D22810

--HG--
extra : moz-landing-system : lando
2019-06-13 08:58:07 +00:00
Boris Zbarsky
d5a8a4a595 Bug 1557793 part 3. Change the signatures of various nsContentUtils localization methods to play nicer with the new stringbundle API. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D34201

--HG--
extra : moz-landing-system : lando
2019-06-08 21:26:12 +00:00
Masayuki Nakano
121e90ba98 Bug 1557996 - Make HTMLEditor::GetSelectedElement() not treat an element as selected when it's followed by a <br> element r=m_kato
Currently, `HTMLEditor::GetSelectedElement()` is not used in mozilla-central
and mainly used for handling double clicks in the editor with its complicated
path.  In most cases, users don't want double clicks to cause showing
property dialog in mail composer.  Therefore, we must be able to stricter in
the complicated path.

This patch adds new check whether the selected range ends immediately before
a `<br>` element.  If it's end at a `<br>` element, we shouldn't treat found
element as selected.

Note that when `<a href="...">` element is double-clicked, the element itself
is selected like `<img>` element.  So, we don't need to worry about the case
which is that users probably want to update a link with double-clicking since
such case is handled by the first optimized path in the method.

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

--HG--
extra : moz-landing-system : lando
2019-06-11 07:59:07 +00:00
Masayuki Nakano
a1b8ba8568 Bug 1556235 - Make HTMLEditRules::WillDeleteSelection() remove empty parent blocks when it's called by drop handler r=m_kato
Chromium removes new empty blocks only when the content is removed by dragging.
Before bug 1504910, we just removed the dragged range, i.e., kept the new
empty blocks.  However, now, we put `<br>` element from
`HTMLEditRules::AfterEditInner()` because a D&D action was split to the deletion
part and inserting part (It wasn't called after inserting the dropped content).

Therefore, this patch adds new path for D&D into
`HTMLEditRules::WillDeleteSelection()`.  If parent blocks become empty,
the path removes such blocks and collapse `Selection` to where the most
ancestor empty block was.  With this patch, we get same behavior as Chrome
in most cases.  You can check it in https://jsfiddle.net/d_toybox/9px07yLr/

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:31:13 +00:00
Masayuki Nakano
84cbc7e792 Bug 1529884 - part 6: Through subject principal at Document::ExecCommand() to constructor of EditorBase::AutoEditActionDataSetter r=smaug
`Document::ExecCommand()` knows subject principal.  This patch makes it tell
`EditorCommand::DoCommand()` and `EditorCommand::DoCommandParam()`.  Then,
makes they tell each editor public methods which may cause dispatching
`beforeinput` event once we implement it.  Finally, each editor public
method sets it to the constructor of `EditorBase::AutoEditActionDataSetter`.
This means that when editor tries to dispatch `beforeinput` event, editor
can check whether it's called by JS or not from everywhere.

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:27:07 +00:00
Masayuki Nakano
94e3b7524c Bug 1529884 - part 1: Make Document use hashtable to map HTML command and internal command data r=smaug
Currently, `Document` converts HTML command (e.g., used by `execCommand()`) to
internal XUL command with array in the global space.  However, it requires scan
of the array for every command access.

This patch makes `Document` use hashtable to make the conversion faster.

New mapping info comes from:

- `mXULCommandName` is same as `internalCommandString`
- `mCommand` is mapped in CommandList.h from `mXULCommandName`
- `mGetEditorCommandFunc` is mapped from `mXULCommandName` in:
  - https://searchfox.org/mozilla-central/rev/d143f8ce30d1bcfee7a1227c27bf876a85f8cede/editor/libeditor/EditorController.cpp#31-32,34-38,40-41,43,45-51,54-57,67-112
  - https://searchfox.org/mozilla-central/rev/75294521381b331f821aad3d6b60636844080ee2/editor/libeditor/HTMLEditorController.cpp#26-28,31-39,48,51-52,55-58,60-63,65-73,76-80,83-88,90-91,93-94,97-100,102-104
- `mExecCommandParam` is converted from `useNewParam` and `convertToBoolean`:
  - If corresponding editor command class's `DoCommandParam()` just calls
    `DoCommand()`, `ExecCommandParam::Ignore`.
  - If `useNewParam` is `true` and `convertToBoolean` is `false`, given value
    should be ignored and may set constant instead.  In this case,
    `ExecCommandParam::Ignore`.
  - If `useNewParam` is `false` and `convertToBoolean` is `false`, given value
    should be treated as string.  In this case, `ExecCommandParam::String`.
  - If `useNewParam` is `false` and `convertToBoolean` is `true`, given value
    should be treated as bool.  In this case, if given command is not a legacy
    one, `ExecCommandParam::Boolean`.  Otherwise, i.e., if given command
    is a legacy one, `ExecCommandParam::InvertedBoolean`.
  - Otherwise, `ExecCommandParam::String`.

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

--HG--
extra : moz-landing-system : lando
2019-06-10 10:23:59 +00:00
Boris Zbarsky
5eb248348f Bug 1557847. Stop using [array] in nsIClipboard. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D34243

--HG--
extra : moz-landing-system : lando
2019-06-09 01:06:39 +00:00
Boris Zbarsky
dc2b7685d7 Bug 1557231. Stop using [array] in nsIInlineSpellChecker. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D33908

--HG--
extra : moz-landing-system : lando
2019-06-06 06:59:37 +00:00
Makoto Kato
b60b55e5bc Bug 1556656 - Restrict script access for some methods in nsIEditingSession r=masayuki
Some methods in `nsIEditingSession` isn't used from script. So we should move
these to `nsEditingSession` or add `[noscript]`.

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

--HG--
extra : moz-landing-system : lando
2019-06-06 05:31:16 +00:00
Emilio Cobos Álvarez
7540d08d90 Bug 1556799 - Remove manual NAC as soon as parent chain changes. r=masayuki
Having NAC bound to the tree when not connected is not quite fine, make sure to
clean up properly.

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

--HG--
extra : moz-landing-system : lando
2019-06-06 01:48:10 +00:00
Boris Zbarsky
9b956f652d Bug 1556922. Stop using [array] in nsIEditorSpellCheck. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D33742

--HG--
extra : moz-landing-system : lando
2019-06-05 04:07:28 +00:00
Ehsan Akhgari
adf073ce68 Bug 836176 - Part 3: Remove nsIHTMLDocument; r=farre
Differential Revision: https://phabricator.services.mozilla.com/D32925

--HG--
extra : moz-landing-system : lando
2019-06-04 17:27:43 +00:00
Masayuki Nakano
d9e3ea7e57 Bug 1426709 - Make HTMLEditor update selection ancestor limit synchronously when editing host is changed to ancestor element r=smaug
`HTMLEditor` initializes selection ancestor limit when it receives `focus`
event.  If `Document.execCommand()` is called immediately after an
ancestor of active editing host becomes new editing host,
`HTMLEditor::GetActiveEditingHost()` returns the new one, but selection
ancestor limit is still the previous one.  This mismatch causes a lot of
bugs.  Therefore, this patch makes `nsGenericHTMLElement` notifies `HTMLEditor`
of an element becoming `contenteditable`, and makes `HTMLEditor` update
selection ancestor limit only when the new editing host is ancestor of
old selection ancestor limit.

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

--HG--
extra : moz-landing-system : lando
2019-06-04 08:42:43 +00:00
Masayuki Nakano
5ac5e497b5 Bug 1555227 - Make GetInternalCommand() return new commands when the command is "cmd_align" without params r=m_kato
`cmd_align` is always with `nsCommandParams` when it's executed.  However,
when somebody checks whether the command is enabled or not, or retrieves the
state, `GetInternalCommand()` is called without `nsCommandParams`.  Therefore,
even when `nsCommandParmas` is nullptr for `cmd_align`, `GetInternalCommand()`
shouldn't warn it.

Additionally, internal command supports to set `align` to empty string.
Therefore, `GetInternalCommand()` also needs to support it.

This patch adds `Command::FormatJustify` for the former case and
`Command::FormatJustifyNone` for the latter case.

Note that this does not affect to actual behavior since `AlignCommand`
does not refer the result of `GetInternalCommand()`.

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

--HG--
extra : moz-landing-system : lando
2019-06-04 10:01:31 +00:00
Emilio Cobos Álvarez
6917a38081 Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky
BindContext was going to have way more information at first, but then I realized
that most of the things I wanted to know were basically a flag away using the
parent node.

Still I think it's worth it, now experimenting with BindToTree will only mean
adding a field to a struct that's included from a couple cpp files, instead of a
massive pain.

I also think this is clearer, and doing this highlights quite a few
inconsistencies in our code which I've left untouched, but commented with
FIXMEs.

Steps are:

$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#                      nsIContent\* aBindingParent) override#override#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done
$ ./mach clang-format

Then manual fixups.

Depends on D32948

Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-31 23:31:52 +02:00
Emilio Cobos Álvarez
19258bfbb4 Bug 1554716 - Remove nsStyleColor moving the color property to nsStyleText. r=jfkthame
I think this is a good change regardless of other discussion in bug 1552587. If
we decide to move `mColor` to the top-level of the struct that can be done
separately.

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

--HG--
extra : moz-landing-system : lando
2019-05-31 14:48:22 +00:00
Ehsan Akhgari
df65fc2dfc Bug 1415270 - Part 2: Enable editing support for non-HTML documents as well; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D32912

--HG--
extra : moz-landing-system : lando
2019-05-31 01:38:58 +00:00
Ehsan Akhgari
a9e9f5ccdb Bug 1415270 - Part 1: Move nsHTMLDocument editing APIs to Document; r=farre,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D32911

--HG--
extra : moz-landing-system : lando
2019-05-31 01:37:26 +00:00
Masayuki Nakano
a3d946e313 Bug 1555640 - Check if aPointAfterInsertedString is nullptr when WSRunObject::InsertText() sets its value r=m_kato
`aPointAfterInsertedString` of `WSRunObject::InsertText()` is optional (i.e.,
may be nullptr).  However, the fix for bug 1534394 makes it always set to
original insertion point when `InsertTextWithTransaction()` is failed.

This patch just make it check if `aPointAfterInsertedString` is nullptr before
setting its value.

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

--HG--
extra : moz-landing-system : lando
2019-05-30 10:32:44 +00:00
Masayuki Nakano
761f01d612 Bug 1533913 - Make HTMLEditRules::ApplyBlockStyle() stop handling it if target node is moved from expected container unexpectedly r=m_kato
`HTMLEditRules::ApplyBlockStyle()` stores `curBlock` and `newBlock` during its
loop to keep handling from deeper child to ancestor, and may do two things for
a `curNode`.  If `curBlock` and/or `newBlock` is moved from expected container
when it sets one of or both of them, this patch check whether mutation event
listeners change the DOM tree.  Additionally, this patch also checks whether
`curNode' is moved by mutation event listener at first step of two jobs for it.

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

--HG--
extra : moz-landing-system : lando
2019-05-29 04:44:23 +00:00
Ehsan Akhgari
ad6a833e39 Bug 1549560 - Move HTMLDocument.open/close/write/writeln to Document; r=farre
Differential Revision: https://phabricator.services.mozilla.com/D32388

--HG--
extra : moz-landing-system : lando
2019-05-27 23:03:03 +00:00
Bogdan Tara
2bcd3a4566 Backed out changeset c352b73db92b (bug 1549560) for dom/base/Document.cpp related build bustages CLOSED TREE 2019-05-27 23:57:00 +03:00
Ehsan Akhgari
6b308d9e98 Bug 1549560 - Move HTMLDocument.open/close/write/writeln to Document; r=farre
Differential Revision: https://phabricator.services.mozilla.com/D32388

--HG--
extra : moz-landing-system : lando
2019-05-27 18:42:23 +00:00
Masayuki Nakano
4fe540db19 Bug 1547897 - Make WSRunObject stop scanning outside of editing host r=m_kato
`WSRunObject` scans previous and next node of given point/range **without**
checking editing host boundary.  Therefore, its methods may return non-editable
nodes or editable nodes in another editing host.  In such cases, `HTMLEditRules`
is confused.

This patch makes it store editing host at initialization and it check the
boundary.  However, the former cost may appear in score of some benchmark
tests, but we shouldn't allow attackers to use this entrance.

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

--HG--
extra : moz-landing-system : lando
2019-05-27 12:10:23 +00:00
Sylvestre Ledru
d57d4905f1 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-05-25 17:46:15 +00:00
Brindusan Cristian
fd5a4a259a Merge inbound to mozilla-central. a=merge 2019-05-25 00:49:05 +03:00
Masayuki Nakano
e61b4bc007 Bug 1551185 - Make nsImageFrame::ShouldDisplaySelection() check whether resizer target element is its content or not r=smaug
Currently, `nsISelectionDisplay::DISPLAY_ALL` is used only by `HTMLEditor`.
And only when it's set, `nsImageFrame::ShouldDisplaySelection()` returns `false`
if only its `mContent` is selected.  However, this is based on an assumption,
that is, when only one `<img>` is selected in an HTML editor, it's target of
resizers.  However, this is completely wrong.  Web apps can disable resizers
with `document.execCommand("enableObjectResizing", false, false)` and now,
it's disabled by default.

Therefore, this patch makes the method check whether its `mContent` is
target of resizers at the moment.

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

--HG--
extra : moz-landing-system : lando
2019-05-24 12:02:34 +00:00
Mihai Alexandru Michis
35449f0689 Backed out changeset e52d041dc3de (bug 1553378) for causing build bustages in ContentEventHandler.cpp. CLOSED TREE
--HG--
extra : amend_source : 36025186ca5788f5889ff7d97252900eefab0a36
2019-05-24 14:32:27 +03:00
arthur.iakab
af8e458c5f Backed out changeset a296439a25ff (bug 1519636) for frequent Windows cppunit failures CLOSED TREE 2019-05-24 14:26:01 +03:00
Cameron McCormack
5bed2b0138 Bug 1553378 - Devirtualize calls to GetText() / TextLength() when we know we have a Text node. r=smaug,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D32100

--HG--
extra : moz-landing-system : lando
2019-05-24 08:10:55 +00:00
Sylvestre Ledru
c82ea97226 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-05-24 09:59:17 +00:00
Makoto Kato
d05eeb5f3a Bug 1520456 - test_CF_HTML_clipboard.html should skip non-mac platform instead of detecting platform in html file. r=masayuki
test_CF_HTML_clipboard.html does nothing if platform isn't mac. But according
to intermittent failure log, this is often failure on Android.

I guess that this is infra issue, but we should use skip-if to avoid this
failure instead.

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

--HG--
extra : moz-landing-system : lando
2019-05-24 06:28:02 +00:00
violet
91d759f562 Bug 1553252 - Use cbindgen for text-overflow r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D32285

--HG--
extra : moz-landing-system : lando
2019-05-24 04:48:46 +00:00
Razvan Maries
234389cf17 Backed out changeset 82b18d61da00 (bug 1553378) for build bustages. CLOSED TREE 2019-05-24 06:50:14 +03:00
Cameron McCormack
f5dd691a74 Bug 1553378 - Devirtualize calls to GetText() / TextLength() when we know we have a Text node. r=smaug,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D32100

--HG--
extra : moz-landing-system : lando
2019-05-24 03:18:44 +00:00
Masayuki Nakano
c6ffcedbf2 Bug 1534394 - Make WSRunObject::InsertText() set aPointAfterInsertedString by itself when HTMLEditor::InsertTextWithTransaction() returns error r=m_kato
Oddly, `WSRunObject::InsertText()` returns `NS_OK` even when
`HTMLEditor::InsertTextWithTransaction()` returns error.  However,
it fails if insertion point is not editable like `<noscript>` element.
In such case, `aPointAfterInsertedString` isn't modified and its caller,
`HTMLEditRules::WillInsertText()` keep handling inserting remaining text
with non-positioned `EditorDOMPoint`.  Therefore, at the next time,
`WSRunObject` fails to do anything since it requires positioned
`EditorDOMPoint`.

For making uplift safer, this patch makes `WSRunObject::InsertText()` set
`aPointAfterInsertedString` by itself when
`HTMLEditor::InsertTextWithTransaction()` returns error.

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

--HG--
extra : moz-landing-system : lando
2019-05-23 06:06:18 +00:00
Cameron McCormack
e82b3826f9 Bug 1553378 - Devirtualize calls to GetText() / TextLength() when we know we have a Text node. r=smaug,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D32100
2019-05-22 15:18:48 +10:00
Masayuki Nakano
fc57d9bf0f Bug 1549661 - part 7: Make GetInternalCommand() take nsCommandParams instead of nsAString r=m_kato
`GetInternalCommand()` is currently used only by `EditorCommand` and it
treats the additional parameter only when given command is `cmd_align`.
However, the value is complicated since `AlignCommand` allows both `CString`
value and `String` value.  Therefore, `EditorCommand::DoCommandParams()` may
fail to solve `cmd_align` to a `Command` value without checking both of them.

Therefore, it must make sense that `GetInternalCommand()` take `nsCommandParams`
as optional argument and check it only when given command matches `cmd_align`.
Then, we don't need to waste unnecessary run-time cost.

Note that this bug has been hidden since `AlignCommand` class does not refer
the `Command` value but refers only `nsCommandParams`.  However, the previous
patch makes `EditorCommand::GetParamType()` not allow `Command::DoNothing`.
Therefore, we need this follow-up fix now.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:47:51 +00:00
Masayuki Nakano
29dd5c8e74 Bug 1549661 - part 6: Create EditorCommand::DoCommandParam(Command aCommand, nsITransferable* aTransferableParam, TextEditor& aTextEditor) r=m_kato
If `nsIControllerCommand::DoCommandParams()` is called without aParams or
`nsITransferable` pointer, this patch sets nullptr to `aTransferableParam` for
`DoCommandParam()`.  This allows each implementation to choose ignore or
return error.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:47:49 +00:00
Masayuki Nakano
276f23b02c Bug 1549661 - part 5: Make commands for MultiStateCommandBase take both CString and String r=m_kato
Only `MultiStateCommandBase::DoCommandParams()` allows `CString` param and
`String` param (the former is preferred).  This patch makes
`EditorCommand::DoCommandParams()` aware of this case.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:47:47 +00:00
Masayuki Nakano
3e190307e7 Bug 1549661 - part 4: Create EditorCommand::DoCommandParam(Command aCommand, const nsAString& aStringParam, TextEditor& aTextEditor) r=m_kato
If `nsIControllerCommand::DoCommandParams()` is called with `nullptr` for its
`aParams`, this patch sets `VoidString()` to `DoCommandParam()` for making
each implementation be able to consider whether the case is an error or
treat it as specific default value.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:45:55 +00:00
Masayuki Nakano
723ebc93fe Bug 1549661 - part 3: Create EditorCommand::DoCommandParam(Command aCommand, const nsACString& aCStringParam, TextEditor& aTextEditor) r=m_kato
If `nsIControllerCommand::DoCommandParams()` is called with `nullptr` for its
`aParams`, this patch sets `VoidCString()` to `DoCommandParam()` for making
each implementation be able to consider whether the case is an error or
treat it as specific default value.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:45:22 +00:00
Masayuki Nakano
2b5a319f77 Bug 1549661 - part 2: Create EditorCommand::DoCommandParam(Command aCommand, const Maybe<bool>& aBoolParam, TextEditor& aTextEditor) r=m_kato
We should use `Maybe` for `bool` because some command may treat the default
value when the parameter is omitted as `true` or `false.  Although, current
implementation does not do that.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:44:39 +00:00
Masayuki Nakano
ef7e3647d8 Bug 1549661 - part 1: Create EditorCommand::DoCommandParam(Command aCommand, TextEditor& aTextEditor) and make it just call DoCommand() r=m_kato
Most `EditorCommand` classes don't require additional params for executing
a command.  All of them just calls their `DoCommand()` or returns same result.
So, we can create new virtual method,
`EditorCommand::DoCommandParam(Command aCommand, TextEditor& aTextEditor)`,
which just delegates to `DoCommand()`.

This patch adds some undeclared commands but which are handled by
`EditorCommand` subclasses, and changes `CommandInt` type from `int8_t` to
`uint8_t` since the count of `Command` items becomes over 128.

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

--HG--
extra : moz-landing-system : lando
2019-05-21 07:44:11 +00:00
Tim Nguyen
c1f5b7a338 Bug 1521280 - Convert search-textbox to a custom element. r=dao,bgrins
Differential Revision: https://phabricator.services.mozilla.com/D23045

--HG--
rename : toolkit/content/widgets/textbox.xml => toolkit/content/widgets/search-textbox.js
extra : moz-landing-system : lando
2019-05-13 18:12:37 +00:00
Coroiu Cristina
cc280c4be9 Backed out changeset c5798de806e2 (bug 1521280) for crashing when searching about:config for upcoming beta (bug 1551013)
--HG--
extra : rebase_source : 8f936159c23d09bf227ce4f5eb6f2d96d33bbff1
2019-05-13 08:50:28 +03:00
Tim Nguyen
1a57aab68e Bug 1521280 - Convert search-textbox to a custom element. r=dao,bgrins
Differential Revision: https://phabricator.services.mozilla.com/D23045

--HG--
rename : toolkit/content/widgets/textbox.xml => toolkit/content/widgets/search-textbox.js
extra : moz-landing-system : lando
2019-05-10 11:46:49 +00:00
Masayuki Nakano
19fbb1a392 Bug 1549925 - Mark all methods of nsIDocumentStateListener as can_run_script r=m_kato
`nsIDocumentStateListener` is a scriptable interface and each method may run
any script.  So, we should mark them as `can_run_script`.  Then, we need to
mark a lot of editing methods because we need to mark
`EditorBase::EndTransactionInternal()` and `EditorBase::DoTransactionInternal()`
as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2019-05-09 07:37:51 +00:00
Makoto Kato
bda6300874 Bug 1418629 - Single quotation mark shouldn't always separator. r=Ehsan
This seems to be regression by bug 1362858.

Actually, single quotation mark is always separator for spellchecker after
landing bug 1462858. When user tries to input "doesn't",  "'" becomes separator
for spellchecker. Then "doesn" will be misspell word.

So we shouldn't mark single quotation mark as separator if user is inputting
word.

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

--HG--
extra : moz-landing-system : lando
2019-05-08 09:36:05 +00:00
Masayuki Nakano
4579004eac Bug 1549319 - Make template methods marked as MOZ_CAN_RUN_SCRIPT take only EditorDOMPoint (i.e., not allow EditorRawDOMPoint) r=m_kato
It'd be better to change copy constructor of `EditorDOMPointBase` to explicit,
but it'd require too many changes in editor code.  So, this patch just changes
each method callers only.

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

--HG--
extra : moz-landing-system : lando
2019-05-08 09:40:17 +00:00
Masayuki Nakano
8eddd573c6 Bug 1549306 - Mark EditorBase::CreateNodeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30052

--HG--
extra : moz-landing-system : lando
2019-05-08 07:00:45 +00:00
Masayuki Nakano
f761cbd2bc Bug 1549302 - Mark EditorBase::DeleteTextWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30049

--HG--
extra : moz-landing-system : lando
2019-05-08 06:31:48 +00:00
Masayuki Nakano
ed4cc22661 Bug 1549270 - part 3: Mark EditorBase::SetAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30047

--HG--
extra : moz-landing-system : lando
2019-05-08 06:26:25 +00:00
Masayuki Nakano
6d224d7259 Bug 1549270 - part 2: Mark EditorBase::RemoveAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30044

--HG--
extra : moz-landing-system : lando
2019-05-08 05:09:56 +00:00
Masayuki Nakano
e4c46a73ce Bug 1549270 - part 1: Mark EditorBase::CloneAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30043

--HG--
extra : moz-landing-system : lando
2019-05-08 04:46:56 +00:00
Masayuki Nakano
48d2fce863 Bug 1549268 - Mark EditorBase::JoinNodesWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30041

--HG--
extra : moz-landing-system : lando
2019-05-08 02:29:43 +00:00
Masayuki Nakano
f440ac739a Bug 1549264 - Mark EditorBase::SplitNodeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30039

--HG--
extra : moz-landing-system : lando
2019-05-07 22:34:28 +00:00
Masayuki Nakano
0925cb9a70 Bug 1549155 - Mark EditorBase::DeleteNodeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30038

--HG--
extra : moz-landing-system : lando
2019-05-07 22:27:29 +00:00
Masayuki Nakano
a337925c38 Bug 1549148 - Mark EditorBase::InsertTextIntoTextNodeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30036

--HG--
extra : moz-landing-system : lando
2019-05-07 10:58:08 +00:00
Masayuki Nakano
387c2c8b25 Bug 1547898 - part 2: Make HTMLEditRules::NormalizeSelection() use EditorDOMPoint r=m_kato
For guaranteeing the sets of container node, offset in it, and the node
referred by the offset, the method should use `EditorDOMPoint` instead of
managing them separately.

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

--HG--
extra : moz-landing-system : lando
2019-05-07 10:21:43 +00:00
Masayuki Nakano
33d3bc7789 Bug 1547898 - part 1: The constructor of EditorDOMPointBase which takes all information should allow non-end point of text node r=m_kato
This is a simple mistake of `MOZ_ASSERTION()` in it. When `mParent` is a node
which can have children, `mChild` should be non-`nullptr` or `mOffset` should
/ be set to the end of `mParent`.  But when `mParent` is not a container, any
`mOffset` value should be allowed.

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

--HG--
extra : moz-landing-system : lando
2019-05-07 07:44:04 +00:00
Masayuki Nakano
12fcf328aa Bug 1548751 - Make TextEditRules::WillSetText() use fast path even if it's for <textarea> element r=m_kato
As far as I've tested, `TextEditor` has the following structure patterns:
1. If it's for a non-empty `<input>` element, it has only one text node.
2. If it's for an empty `<input>` element, it has only bogus node.
3. If it's for a non-empty `<textarea>` element, it has a text node and
   `moz-<br>` element.  Additionally they are followed by `<scrollbar>` and
   `<resizer>` elements.
4. If it's for an empty `<textarea>` element, it has a `moz-<br>` element
   followed by `<scrollbar>` and `<resizer>` elements.

Additionally, `TextEditRules::WillInsert()` always removes bogus node if
there is.  So, in the case #2, there is no children.

Fortunately, we don't support XUL addons anymore on Firefox.  However, in
other products like Thunderbird, the tree may be changed as unexpected.
Therefore, we still need to keep checking the tree, but we can use the fast
path for `<textarea>` element too.

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

--HG--
extra : moz-landing-system : lando
2019-05-07 05:07:14 +00:00
Masayuki Nakano
006066d2ee Bug 1546888 - Make editor public methods which may be canceled by clipboard event listener return NS_SUCCESS_DOM_NO_OPERATION when it's canceled r=m_kato
This patch makes editors return new error code internally when clipboard event
is dispatched and canceled by script.  This is for making each caller stop
handling the edit action.  However, it's not actual failure.  Therefore, making
public methods return `NS_SUCCESS_DOM_NO_OPERATION` instead via
`EditorBase::ToGenericNSResult()`.

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

--HG--
extra : moz-landing-system : lando
2019-05-02 08:39:53 +00:00
Masayuki Nakano
ad65eafe7c Bug 1547869 - Make IsCommandEnabled() of HTML editor command classes return false if given editor is TextEditor r=smaug
Currently, this bug does not occur actually because nobody has not accessed
these command classes directly and they are registered only in command table
for HTML editor.  However, once rewriting `nsHTMLDocument::ExecCommand()` with
these classes, its `IsCommandEnabled()` should return false if given editor
is `TextEditor`.  The reason why we need this fix is, when we make
`ExecCommand()` call `IsCommandEnabled()` and it returns `true`, `ExecCommand()`
needs to call `DoCommand()`.  Then, it throws exception if given editor is not
an `HTMLEditor` but the command class is only for `HTMLEditor`.

This patch adds new WPT for testing whether `document.execCommand()` works
with `<input>` and `<textarea>`.  The behavior has not been standardized, but
Chromium handles some commands even in it.  So, I write the expectations from
the point of view of web developers.  (Chrome fails in "cut", "copy" and
"removeformat" cases.)

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

--HG--
extra : moz-landing-system : lando
2019-05-03 02:15:18 +00:00
Sylvestre Ledru
e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

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

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Joel Maher
6611f95ab0 Bug 1546459 - remove subsuite=clipboard from manifests. r=ahal
remove subsuite=clipboard from manifests

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

--HG--
extra : moz-landing-system : lando
2019-05-01 08:16:44 +00:00
Masayuki Nakano
6da5cf38da Bug 1546839 - part 4: Make all editor command classes use Command instead of command name r=smaug
`strcmp` may be slow due to checking null character.  Therefore, internal
methods of them should use command as far as possible.  This patch makes
them take/use `Command` instead of `const char*`.

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

--HG--
extra : moz-landing-system : lando
2019-04-30 04:24:49 +00:00
Masayuki Nakano
36e5df54ec Bug 1547621 - Move all inline methods of nsIPresShell into mozilla::PresShell r=smaug
And also this patch moves some related methods which use the inline methods
and member variables used only by them.

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

--HG--
rename : layout/base/nsIPresShellInlines.h => layout/base/PresShellInlines.h
extra : moz-landing-system : lando
2019-04-30 01:52:53 +00:00
Jamie Nicol
9fd3bd8252 Bug 1530195 - Call restoreNormalRefresh before closing window. r=kats
A test was intermittently crashing because it was calling
restoreNormalRefresh after closing the window. This meant
LayerTransactionParent::RecvLeaveTestMode fired after the
CompositorBridgeParent had been destroyed.

This fixes the test by calling restoreNormalRefresh before
win.close. It also checks mDestroyed in RecvLeaveTestMode (for both
LayerTransactionParent and WebRenderBridgeParent).

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

--HG--
extra : moz-landing-system : lando
2019-04-29 17:06:35 +00:00
Joel Maher
6e318fef99 Bug 1546493 - fixed editor/libeditor mochitests to work outside of isolated clipboard job. r=masayuki
fixed editor/libeditor mochitests to work outside of isolated clipboard job.

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

--HG--
extra : moz-landing-system : lando
2019-04-28 00:07:39 +00:00
Masayuki Nakano
28714c6be2 Bug 1546578 - part 10: Mark methods of editor command classes as far as possible r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D28698

--HG--
extra : moz-landing-system : lando
2019-04-27 07:37:19 +00:00
Masayuki Nakano
143cfe7fde Bug 1546578 - part 9: Make GetCurrentState() of editor command classes take nsCommandParams& instead of nsICommandParams* r=m_kato
Now, all callers of `GetCurrentState()` have reference or pointer to
`nsCommandParam`.  So, taking the concrete class makes sense.

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

--HG--
extra : moz-landing-system : lando
2019-04-27 07:36:30 +00:00
Masayuki Nakano
0592829433 Bug 1546578 - part 8: Make EditorCommand implement nsIControllerCommand::GetCommandStateParams() and call internal GetCommandStateParams() method which take TextEditor directly r=m_kato
This patch makes `EditorCommand` implement
`nsIControllerCommand::GetCommandStateParams()` and then, makes it call internal
`GetCommandStateParams()` method which takes `TextEditor` or `nsIEditingSession`
instead.

This makes each implementation really simpler.

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

--HG--
extra : moz-landing-system : lando
2019-04-27 07:35:56 +00:00
Masayuki Nakano
cae2231fcc Bug 1546578 - part 7: Make EditorCommand implement nsIControllerCommand::DoCommandParams() and call internal DoCommandParams() method which take TextEditor directly r=m_kato
This patch makes `EditorCommand` implement
`nsIControllerCommand::DoCommandParams()` and then, makes it call internal
`DoCommandParams()` method which takes `TextEditor` instead.

This makes each implementation really simpler.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 15:32:06 +00:00
Masayuki Nakano
c4b1e41c47 Bug 1546578 - part 6: Make EditorCommand implement nsIControllerCommand::DoCommand() and call internal DoCommand() method which take TextEditor directly r=m_kato
This patch makes `EditorCommand` implement `nsIControllerCommand::DoCommand()`
and then, makes it call internal `DoCommand()` method which takes `TextEditor`
instead.

Note that `DoCommand()` of some command classes have not returned error when
given context is not editor.  However, it does not make sense to do that only
for some commands.  Therefore, this patch makes `EditorCommand::DoCommand()`
return error when given context is not an editor.

This makes each implementation really simpler.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 14:00:47 +00:00
Masayuki Nakano
2c962c8575 Bug 1546578 - part 5: Make EditorCommand implement nsIControllerCommand::IsCommandEnabled() and call internal IsCommandEnabled() method which return bool directly r=m_kato
This patch makes `EditorCommand` implement
`nsIControllerCommand::IsCommandEnabled()` and then, makes it call internal
`IsCommandEnabled()` method which returns `bool` directly and takes `TextEditor`
instead.

This makes each implementation really simpler.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 13:11:24 +00:00
Masayuki Nakano
dc5aeff4d8 Bug 1546578 - part 4: Merge AbsolutePositioningCommand::IsCommandEnabled() with StateUpdatingCommandBase::IsCommandEnabled() r=m_kato
[`AbsolutePositioningCommand::IsCommandEnabled()`](https://searchfox.org/mozilla-central/rev/f46e2bf881d522a440b30cbf5cf8d76fc212eaf4/editor/libeditor/HTMLEditorCommands.cpp#1038-1056) overrides
[`StateUpdatingCommandBase::IsCommandEnabled()`](https://searchfox.org/mozilla-central/rev/f46e2bf881d522a440b30cbf5cf8d76fc212eaf4/editor/libeditor/HTMLEditorCommands.cpp#65-77).

There are only 2 differences between them:
1. `AbsolutePositioningCommand::IsCommandEnabled()` never returns true if given
   context is not an HTMLEditor instance.
2. `AbsolutePositioningCommand::IsCommandEnabled()` checks
   `HTMLEditor::IsAbsolutePositionEditorEnabled()` additionally.

So, we can get rid of it if we make
`StateUpdatingCommandBase::IsCommandEnabled()` check given command name is
"cmd_absPos" or not.  The mapping is here:
https://searchfox.org/mozilla-central/rev/ec489aa170b6486891cf3625717d6fa12bcd11c1/editor/libeditor/HTMLEditorController.cpp#102

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

--HG--
extra : moz-landing-system : lando
2019-04-26 11:06:45 +00:00
Masayuki Nakano
b8709cc5da Bug 1546578 - part 3: Get rid of HighlightColorStateCommand::IsCommandEnabled() because of it's exactly same as its superclass's definition r=m_kato
[`HighlightColorStateCommand::IsCommandEnabled()`](https://searchfox.org/mozilla-central/rev/f46e2bf881d522a440b30cbf5cf8d76fc212eaf4/editor/libeditor/HTMLEditorCommands.cpp#930-942) is exactly same as
[its superclass's implementation](https://searchfox.org/mozilla-central/rev/f46e2bf881d522a440b30cbf5cf8d76fc212eaf4/editor/libeditor/HTMLEditorCommands.cpp#586-599).

So, we can get rid of it.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 03:20:45 +00:00
Masayuki Nakano
39220c722f Bug 1546578 - part 2: Make all editor command classes derived from EditorCommand class r=m_kato
This patch makes all editor command classes derived from `EditorCommand` class.
So, this allows `nsHTMLEditor::ExecCommand()` to access them directly in the
future.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 03:20:02 +00:00
Masayuki Nakano
129a809380 Bug 1546578 - part 1: Get rid of HTMLEditorCommands.h r=m_kato
When declaring a common base class of all editor command classes in
EditorCommands.h, we need to declare some useful macro to declare its
subclasses.  However, such macro should be `#undef`ed in the header file.

Therefore, this patch moves all contents in HTMLEditorCommands.h to
EditorCommands.h and removes it from the tree.

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

--HG--
extra : moz-landing-system : lando
2019-04-26 02:20:22 +00:00
Masayuki Nakano
9405d61cb8 Bug 1546577 - Make overloads of CanCut(), CanCopy(), CanDelete() and CanPaste() which return bool instead of nsresult r=m_kato
`CanCut()`, `CanCopy()` and `CanPaste()` return error only when the editor has
already been destroyed or not been initialized yet, or when failed to access
clipboard when the document is not HTML/XHTML.

`CanDelete()` returns error only when the editor has already been destroyed or
not been initialized yet.

So, these error result won't be exposed to the web in most cases and such
exception shouldn't stop any content script because Chrome basically does not
throw exception in such situation as far as I know.

Therefore, there should be overloads of them to return `bool` result directly
for making their callers simpler.

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

--HG--
extra : moz-landing-system : lando
2019-04-25 07:14:39 +00:00
Ryan Hunt
0eeced87be Bug 1534395 - Rename TabParent to BrowserParent. r=nika
This commit renames TabParent to BrowserParent.

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

--HG--
rename : dom/ipc/TabParent.cpp => dom/ipc/BrowserParent.cpp
rename : dom/ipc/TabParent.h => dom/ipc/BrowserParent.h
extra : rebase_source : d2706b9f42177d8de16068b7b1d088a44b8720a4
extra : histedit_source : a617ddac45c58050ef799116a67d2d983f2a8f6d%2C1d1dabd8761a32d548a6fbf1027be960698f6a5e
2019-04-09 16:38:15 -05:00
Andreea Pavel
6d71ad8258 Bug 1535792 - disabled test_richtext2.html on linux32 debug r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D27441

--HG--
extra : moz-landing-system : lando
2019-04-21 13:03:24 +00:00
Daniel Varga
2b1837cc6d Backed out changeset 2ef93e029730 (bug 1535792) for ParseError: could not parse: (os == 'android') || ((debug && (os == 'linux') && (bits == 32)). On a CLOSED TREE 2019-04-23 10:59:21 +03:00
Razvan Maries
c973f005fe Bug 1535792 - Disabled test test_richtext2.html on Linux32 debug r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D28291

--HG--
extra : moz-landing-system : lando
2019-04-21 14:28:48 +00:00
Srujana Peddinti
b44e48bff4 Bug 1259660 - Moved mozilla::WidgetMosueEventBase::buttonType in MouseEvents.h to mozilla::MouseButton in EventForwards.h, and mozilla::WidgetMouseEventBase::buttonsFlag to mozilla::MouseButtonsFlag r=masayuki
Moved mozilla::WidgetMosueEventBase::buttonType in MouseEvents.h to mozilla::MouseButton in EventForwards.h, and mozilla::WidgetMouseEventBase::buttonsFlag to mozilla::MouseButtonsFlag so that any referer in header files do not need to include MouseEvents.h only for referring them. Instead, they just need to include EventForwards.h. Now when MouseEvents.h is changed, the rebuild speed becomes faster.

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

--HG--
extra : moz-landing-system : lando
2019-04-21 20:13:34 +00:00
Srujana Peddinti
5f185eb5aa Bug 1259660 - Cleaned up WidgetMouseEventBase by renaming WidgetMouseEventBase::button to WidgetMouseEventBase::mButton. r=masayuki
Renamed all class member instances from WidgetMouseEventBase::button to WidgetMouseEventBase::mButton.

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

--HG--
extra : moz-landing-system : lando
2019-04-21 18:17:10 +00:00
Andrew McCreight
f242e71c8a Bug 1545822 - Clean up some whitespace in XPIDL files. r=froydnj
The attributes for an interface should be on the line right before the
interface.

Interface attributes should be separated by spaces.

Clean up some trailing whitespace in widget/.

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

--HG--
extra : moz-landing-system : lando
2019-04-21 01:47:00 +00:00
Andrew McCreight
9c94962bf5 Bug 1545831 - Use ChromeUtils.generateQI in a few more places. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D28241

--HG--
extra : moz-landing-system : lando
2019-04-19 19:58:13 +00:00
Ian Moody
be1cc378ed Bug 1379466 - Make editor listen for auxclick mouse events. r=smaug,masayuki
Editable elements will no longer get click events for non-primary mouse buttons
since they are being unshipped from the web in favour of auxclick events.
Listen for auxclick as well so middle-click paste still works.
Don't stop propagation after middle-click paste, instead ignore clicks on
contenteditable elements in ClickHandlerChild.
Update test_middle_click_paste.html for the new behaviour.

Also remove the mNoContentDispatch overrides in HTMLInputElement and
HTMLTextAreaElement that were needed for middle-pasting.

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

--HG--
extra : moz-landing-system : lando
2019-04-18 12:57:36 +00:00
Brian Grinstead
381332c51e Bug 1544051 - Part 3 - Scripted change to remove references to AddTask.js r=ahal
This was generated with the script at https://bug1544051.bmoattachments.org/attachment.cgi?id=9058672

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

--HG--
extra : moz-landing-system : lando
2019-04-18 16:51:01 +00:00
Brian Grinstead
c4fa4cfc0c Bug 1544322 - Part 4 - Remove the [type] attribute for multiline <script> tags loading files in /tests/SimpleTest/ r=bzbarsky
This is an autogenerated commit to handle scripts loading mochitest harness files, in
the case where the script src is on the line below the script tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 4` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-16 04:01:46 +00:00
Brian Grinstead
911776d674 Bug 1544322 - Part 3 - Remove the [type] attribute for multiline <script> tags loading files in chrome://mochikit/content/ r=bzbarsky
This is an autogenerated commit to handle scripts loading mochitest harness files, in
the case where the script src is on the line below the script tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 3` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-16 03:59:25 +00:00
Brian Grinstead
ede8c44ef2 Bug 1544322 - Part 2.1 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in everything except for dom/ r=bzbarsky
This excludes dom/, otherwise the file size is too large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-16 03:50:44 +00:00
Brian Grinstead
6515f97bcb Bug 1544322 - Part 1 - Remove the [type] attribute for one-liner <script> tags loading files in chrome://mochikit/content/ r=bzbarsky
This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 1` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-15 20:56:58 +00:00
Masayuki Nakano
b19088bb41 Bug 1543966 - part 2: Make "HTML editor commands" and "document state commands" singleton classes r=m_kato
Some "HTML editor commands" are stateful due to storing tag name to handle it
with specific command.  However, we can make it stateless with retrieving
tag name from command name once per command only when it's necessary.  The
runtime cost must be really cheap since we can map it with hash table.

This patch makes them stateless and singleton classes.  So, we can save
footprint and allocation runtime cost with this change.

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

--HG--
extra : moz-landing-system : lando
2019-04-15 07:29:17 +00:00
Masayuki Nakano
6d9c401af5 Bug 1543966 - part 1: Make "editing commands" and "editor commands" singleton classes r=m_kato
Different from the comment in `EditorCommands.h`, editing commands and
editor commands are instantiated for each editable document or each
`HTMLInputElement` or `HTMLTextareaElement`.  Therefore, even though they
are stateless, we allocate too many instances of them.  We should make
them singleton classes to reduce the footprint and save runtime allocation
cost.

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

--HG--
extra : moz-landing-system : lando
2019-04-15 07:49:46 +00:00
Masayuki Nakano
414509fe00 Bug 1543315 - part 9: Mark nsIPresShell::FlushPendingNotifications() as MOZ_CAN_RUN_SCRIPT r=smaug
So, this patch makes all caller of it safe including its arguments unless
they come from other methods.

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

--HG--
extra : moz-landing-system : lando
2019-04-13 12:43:57 +00:00
Masayuki Nakano
0986fb819b Bug 1542506 - Make nsDocShell use mozilla::PresShell* directly rather than nsIPresShell* r=bzbarsky
This patch makes `nsDocShell::GetPresShell()` and
`nsDocShell::GetEldestPresShell()` return `mozilla::PresShell*` and
some non-public methods use `mozilla::PresShell*` directly.

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

--HG--
extra : moz-landing-system : lando
2019-04-13 01:03:13 +00:00
Sylvestre Ledru
7f60810d86 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-12 13:14:25 +00:00
Makoto Kato
e6c2e7bc87 Bug 1543585 - Clean up finding words for spellchecker. r=masayuki
`mozSpellChecker::Replace` and `mozSpellChecker::NextMisspelledWord` have a loop
to find word from text content. But `mozEnglishWordUtils::FindNextWord` always
returns `NS_OK` and some code doesn't check error even if `nsresult` local
variable is used.

So I would like to clean up this loop.

- `mozEnglishWordUtils::FindNextWord` should return true if word is found
- We should use reference type for some `TextServicesDocument`'s methods.
- Add more check for error

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

--HG--
extra : moz-landing-system : lando
2019-04-12 03:54:18 +00:00
Masayuki Nakano
349901dac4 Bug 1539110 - Make HTMLEditor::RemoveStyleInside() and HTMLEditor::SplitStyleAbovePoint() check tag names with whitelist r=m_kato
`document.execCommand("removeformat")` removes any elements in the range which
are editable, not `<a>`, not block and a container.
https://searchfox.org/mozilla-central/rev/dd7e27f4a805e4115d0dbee70e1220b23b23c567/editor/libeditor/HTMLStyleEditor.cpp#760-763

This means that it removes hidden elements like `<script>` and `<style>`,
or non-HTML elements like SVG elements.  However, the unofficial document
of `execCommand()` lists up elements which should be handled by the command.
https://w3c.github.io/editing/execCommand.html#removeformat-candidate

Additionally, Chrome respects this list since not including `<del>` element
into the list does not make sense but Chrome ignores it.  So, we should
respect the list.

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

--HG--
extra : moz-landing-system : lando
2019-04-12 01:17:50 +00:00
Cosmin Sabou
9599610f96 Bug 1424790 - Disable 694880-1.html on Android 4.3 and linux !debug for frequent failures. r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D26659

--HG--
extra : moz-landing-system : lando
2019-04-09 10:40:42 +00:00
Masayuki Nakano
a50a0700d4 Bug 1530649 - Improve composition string handling which ends with whitespaces r=m_kato
If insertion string ends with ASCII whitespace and there is no following
content in the block, `HTMLEditRules::AdjustWhitespaces()` needs to insert
`<br>` element.  It's called only by `HTMLEditRules::AfterEditInner()` and
that does only simple things with `WSRunObject`.  Therefore, this moves the
code into `AfterEditInner()`.

For making it adjust the whitespaces, `HTMLEditRules::WillInsertText()` needs
to notify `AfterEditInner()` of dirty range with `mDocChangeRange`.  Therefore,
this patch makes it set `mDocChangeRange` manually after inserting composition
string.

On the other hand, there is another bug.  `WSRunObject` was designed to treat
only inserting text for `WSRunObject::InsertText()`.  I.e., not designed to
treat replacing existing composition string with new string.  Therefore,
`WSRunObject::InsertText()` adjusts whitespaces only around start of
composition string.  Therefore, if composition string ends with an ASCII
whitespace, it's not replaced with NBSP and that causes:
- failing `WSRunObject::AdjustWhitespaces()` inserts `<br>` element at
  `AfterEditInner()` of committing composition.
- then, next composition's first `WSRunObject::InsertText()` removes the
  last whitespace due to not followed by `<br>` nor any other content.
Therefore, this patch makes `WSRunObject` takes 2 DOM points to be able to
treat replaced range.

In strictly speaking, the latter change require more changes and tests for
supporting replacement with any other methods.  However, it's risky and out
of scope of this bug.

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

--HG--
extra : moz-landing-system : lando
2019-04-09 05:28:38 +00:00
Emilio Cobos Álvarez
d15876acb4 Bug 1541952 - Move ApplicableStylesChanged() to Document. r=heycam
It's the right place for it to be now that it owns the StyleSet.

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

--HG--
extra : moz-landing-system : lando
2019-04-06 19:25:25 +00:00
Emilio Cobos Álvarez
7980a72d0a Bug 760345 - Remove the last usage of lossy currentcolor. r=heycam
We don't have lossy currentcolor in the style system anymore, except for a
single property -moz-font-smoothing-background-color.

I could've converted it into a proper StyleColor and thread down all the
necessary information to the font metrics code.

But it doesn't really seem worth it given it's not exposed to the web, so I just
did the simplest thing, which is making currentcolor compute to transparent to
that specific property.

This patch also removes the stores_complex_colors_lossily code and related,
since now we always can cache computed colors.

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

--HG--
extra : moz-landing-system : lando
2019-04-06 17:47:58 +00:00
Sylvestre Ledru
03fc65347c Bug 1542146 - Apply the change with the option StatementMacros from clang-format-8 r=andi
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-05 21:42:17 +00:00
Sylvestre Ledru
03c8e8c2dd Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-05 21:41:42 +00:00
Csoregi Natalia
ba58e936bd Backed out changeset 4ad80127f89f (bug 1519636) for bustage on MarkupMap.h and nsAccessibilityService.cpp. CLOSED TREE 2019-04-05 09:48:19 +03:00
Sylvestre Ledru
d1c1878603 Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-04 21:36:16 +00:00
Brindusan Cristian
c298fe167e Backed out changeset 1ea4b3582033 (bug 760345) for build bustages at ia2AccessibleComponent.cpp. 2019-04-05 07:49:09 +03:00
Emilio Cobos Álvarez
993731e44b Bug 760345 - Remove the last usage of lossy currentcolor. r=heycam
We don't have lossy currentcolor in the style system anymore, except for a
single property -moz-font-smoothing-background-color.

I could've converted it into a proper StyleColor and thread down all the
necessary information to the font metrics code.

But it doesn't really seem worth it given it's not exposed to the web, so I just
did the simplest thing, which is making currentcolor compute to transparent to
that specific property.

This patch also removes the stores_complex_colors_lossily code and related,
since now we always can cache computed colors.

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

--HG--
extra : moz-landing-system : lando
2019-04-04 22:06:03 +00:00
Narcis Beleuzu
24dbe577a5 Backed out changeset 389b6bbd76db (bug 1519636) for bustages on MarkupMap.h . CLOSED TREE 2019-04-05 00:27:56 +03:00
Sylvestre Ledru
399dbd28fe Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-04-04 20:12:23 +00:00
Masayuki Nakano
98518a7159 Bug 1540969 - Get rid of nsPICommandUpdater r=bzbarsky
`nsPICommandUpdater` is a scriptable interface, but nobody refers it from JS,
and it's implemented only by `nsCommandManager`.  Therefore, we can get rid
of this interface.

Additionally, `nsCommandManager::Init()` is called only by `nsDocShell`, which
is the only instantiater of the class, and returns error only when given window
is nullptr.  Therefore, we can make the constructor take the window instead.

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

--HG--
extra : moz-landing-system : lando
2019-04-03 12:53:54 +00:00
Masayuki Nakano
4204b59128 Bug 1540963 - Make nsIControllerCommandTable builtinclass and make its users use nsControllerCommandTable directly r=bzbarsky
`nsIControllerCommandTable` isn't implemented with JS even in comm-central nor
BlueGriffon.  Therefore, we can make it a builtinclass.

Additionally, it's inherited only by nsControllerCommandTable.  So, all users
in C++ can treat the concrete class directly.

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

--HG--
extra : moz-landing-system : lando
2019-04-03 12:52:14 +00:00
Masayuki Nakano
8329e8382e Bug 1540962 - Make nsICommandManager builtinclass and make users use nsCommandManager directly r=bzbarsky
`nsICommandManager` isn't implemented by JS even in comm-central nor
BlueGriffon.  Therefore, we can make it a builtinclass.

Additionally, this patch makes all users in C++ use `nsCommandManager` which is
the only implementation of `nsICommandManager`.  This avoids QI from
`nsICommandManager` to `nsPICommandUpdater`.

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

--HG--
extra : moz-landing-system : lando
2019-04-03 12:51:38 +00:00
Emilio Cobos Álvarez
d8e2990d8a Bug 1535788 - Make the Document own the StyleSet. r=heycam
This is the last step to be able to call matchMedia on display: none iframes.

This is green, except for some startup preference query tests that I'm going to
address in a blocking bug (making LangGroupFontPrefs global, basically).

The setup is similar to the ShadowRoot one, except we don't eagerly keep the
StyleSet around up-to-date, we only fill it if it ever had a pres context.

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

--HG--
extra : moz-landing-system : lando
2019-04-03 07:02:00 +00:00
Masayuki Nakano
e28c807e5a Bug 1533989 - Make InputEvent.data and InputEvent.dataTransfer not expose clipboard data if user disables clipboard events r=smaug
If user disables clipboard events, it means that they don't want to expose
clipboard data to web apps even if web apps cannot handle "paste" operation.
Therefore, they must not want to leak clipboard data with `InputEvent.data`
and `InputEvent.dataTransfer`.

This patch makes `InputEvent::GetData()` and `InputEvent::GetDataTransfer()`
returns empty string or new `DataTransfer` object which has only empty string
if:
- They are called by content JS.
- The event is a trusted event.
- `inputType` value is `insertFromPaste` or `insertFromPasteAsQuotation`.

The reason why we don't return null for both is, Input Events spec declares
`data` or `dataTransfer` shouldn't be null in the `inputType` values.  And
the reason why we don't return empty `DataTransfer` is, web apps may expect
at least one data is stored in non-null `dataTransfer` value.

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

--HG--
extra : moz-landing-system : lando
2019-03-29 16:08:11 +00:00
Masayuki Nakano
3e64f2c30d Bug 1539356 - Mark EditorBase::InsertNodeTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
This patch marks `EditorBase::InsertNodeTransaction()` **and** its callers as `MOZ_CAN_RUN_SCRIPT`.

Unfortunately, this patch tells us that some `GetSomething()` methods may destroy the editor since `HTMLEditRules::GetNodesForOperation()`, `HTMLEditRules::GetNodesFromPoint()` and `HTMLEditRules::GetNodesFromSelection()` may change the DOM tree.  Additionally, initialization methods may destroy the editor since it may insert a bogus `<br>` node.

Note that this patch also removes some unused methods. I.e., they are not result of some cleaning up the code. This patch just avoids marking unused methods as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2019-03-30 11:55:29 +00:00
Oana Pop Rus
43fadb6745 Backed out changeset 447c87c2d139 (bug 1539356) on request of Jorg K. a=backout 2019-03-30 00:42:32 +02:00
Masayuki Nakano
de2d589e58 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

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

--HG--
extra : moz-landing-system : lando
2019-03-29 15:12:47 +00:00
Dorel Luca
5a0fa68b78 Backed out 3 changesets (bug 1540015) for build bustage. CLOSED TREE
Backed out changeset 7b71c9da0214 (bug 1540015)
Backed out changeset 5723ddbc5c44 (bug 1540015)
Backed out changeset 9561d2c36fa5 (bug 1540015)
2019-03-29 16:14:26 +02:00
Masayuki Nakano
9273f25ce2 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

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

--HG--
extra : moz-landing-system : lando
2019-03-29 13:09:26 +00:00
Masayuki Nakano
81b30d7143 Bug 1539356 - Mark EditorBase::InsertNodeTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
This patch marks `EditorBase::InsertNodeTransaction()` **and** its callers as `MOZ_CAN_RUN_SCRIPT`.

Unfortunately, this patch tells us that some `GetSomething()` methods may destroy the editor since `HTMLEditRules::GetNodesForOperation()`, `HTMLEditRules::GetNodesFromPoint()` and `HTMLEditRules::GetNodesFromSelection()` may change the DOM tree.  Additionally, initialization methods may destroy the editor since it may insert a bogus `<br>` node.

Note that this patch also removes some unused methods. I.e., they are not result of some cleaning up the code. This patch just avoids marking unused methods as `MOZ_CAN_RUN_SCRIPT`.

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

--HG--
extra : moz-landing-system : lando
2019-03-29 10:55:31 +00:00
Makoto Kato
66d295beb2 Bug 1540062 - Get rid of nsIPlaintextEditor.setWrapColumn. r=masayuki
No one (m-c, c-c and bluegriffon) uses nsIPlaintextEditor.setWrapColumn from
script. It is used from C++ only.

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

--HG--
extra : moz-landing-system : lando
2019-03-29 09:44:36 +00:00
Masayuki Nakano
0a753c3aac Bug 1533293 - part 3: Make editor and ContentEventHandler not use Selection::Extend() due to too slow r=m_kato
`Selection::Extend()` is too slow but editor and ContentEventHandler use it in
some places.  We should make them use `Selection::SetStartAndEndInLimiter()` or
`Selection::SetBaseAndExtentInLimiter()`.  The former is usable only when caller
guarantees the start point is prior to the end point in the DOM tree.
Otherwise, we need to use the latter even though it's slower than the former.

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

--HG--
extra : moz-landing-system : lando
2019-03-26 10:09:47 +00:00
Masayuki Nakano
534fd23ca4 Bug 1533293 - part 2: Rewrite EditorBase::SelectEntireDocument() and its overrides r=m_kato
`EditorBase::SelectEntierDocument()` uses `Selection::Extend()` but it's too
slow.  It should use `Selection::SetStartAndEndInLimiter()` instead.

Additionally, `TextEditor::SelectEntierDocument()` shrink the result of
`EditorBase::SelectEntierDocument()` with `Selection::Extend()` if there is
a `moz-<br>` element.  So, `TextEditor::SelectEntinerDocument()` should set
its expected selection with a call for saving the runtime cost.

Then, we don't need to make `EditorBase::SelectEntierDocument()` as non-pure
virtual method.  So, this patch makes each its callers call
`Selection->SelectAllChildren()` directly.

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

--HG--
extra : moz-landing-system : lando
2019-03-26 10:06:43 +00:00
Masayuki Nakano
e4ea50f3f8 Bug 1533293 - part 1: Create Selection::SetStartAndEnd() to set new range as far as faster r=smaug
`Selection::Extend()` is too slow because:
- it may create some `nsRange` instances.
- it users `nsContentUtils::ComparePoints()` multiple times.

Therefore, we can improve the performance if we can stop using it in some
places.  First, this patch creates `Selection::SetStartAndEnd()` and
`Selection::SetStartAndEndInLimiter()` for internal use.  They remove
current ranges, reuse `nsRange` instance as far as possible and add new
range which is set by their arguments.  Then, this patch makes
`Selection::SelectAllChildren()` stop using `Selection::Extend()`.  At this
time, this fixes a web-compat issue.  `Selection::Expand()` cannot cross the
selection limiter boundary when there is a limiter (e.g., when an editing host
has focus).  But we can now fix this with using the new internal API.

Note that methods in editor shouldn't move selection to outside of active
editing host.  Therefore, this patch adds `Selection::SetStartAndEndInLimiter()`
and `Selection::SetBaseAndExtentInLimiter()` for them.

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

--HG--
extra : moz-landing-system : lando
2019-03-26 10:06:00 +00:00
shindli
12c0629a98 Merge mozilla-central to inbound. a=merge CLOSED TREE
--HG--
rename : js/src/tests/non262/fields/basic.js => js/src/jit-test/tests/fields/basic.js
rename : js/src/tests/non262/fields/literal.js => js/src/jit-test/tests/fields/literal.js
rename : js/src/tests/non262/fields/mixed_methods.js => js/src/jit-test/tests/fields/mixed_methods.js
rename : js/src/tests/non262/fields/quirks.js => js/src/jit-test/tests/fields/quirks.js
2019-03-21 06:36:37 +02:00
Noemi Erli
165f0d8c1c Backed out 3 changesets (bug 1533293) for causing Bug 1536595 a=backout
Backed out changeset d011dfe83683 (bug 1533293)
Backed out changeset e536f6e123d8 (bug 1533293)
Backed out changeset 19cff61f4fed (bug 1533293)
2019-03-20 13:29:17 +02:00
Andreea Pavel
dd962029e9 Backed out 2 changesets (bug 676268) for failing android checkstyle
Backed out changeset 85d03febdb70 (bug 676268)
Backed out changeset cfa2c6443a6d (bug 676268)

--HG--
extra : rebase_source : 603eb3f1d13a11a98e2f92c3fc41c92d408cec6d
2019-03-20 07:16:34 +02:00
Makoto Kato
61804ba4b3 Bug 676268 - Part 1. Support text/html on Android clipboard backend r=geckoview-reviewers,snorp
Actually, we only support `text/unicode` mime type on Android clipboard backend.  But Android API 16+ supports `text/html`, so we should support this type since Chrome/Blink already supports it.

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

--HG--
extra : moz-landing-system : lando
2019-03-11 15:35:54 +00:00
Masayuki Nakano
6dd0ecdd8e Bug 1533293 - part 3: Make editor and ContentEventHandler not use Selection::Extend() due to too slow r=m_kato
`Selection::Extend()` is too slow but editor and ContentEventHandler use it in
some places.  We should make them use `Selection::SetStartAndEndInLimiter()` or
`Selection::SetBaseAndExtentInLimiter()`.  The former is usable only when caller
guarantees the start point is prior to the end point in the DOM tree.
Otherwise, we need to use the latter even though it's slower than the former.

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

--HG--
extra : moz-landing-system : lando
2019-03-18 01:52:36 +00:00
Masayuki Nakano
448571fd81 Bug 1533293 - part 2: Rewrite EditorBase::SelectEntireDocument() and its overrides r=m_kato
`EditorBase::SelectEntierDocument()` uses `Selection::Extend()` but it's too
slow.  It should use `Selection::SetStartAndEndInLimiter()` instead.

Additionally, `TextEditor::SelectEntierDocument()` shrink the result of
`EditorBase::SelectEntierDocument()` with `Selection::Extend()` if there is
a `moz-<br>` element.  So, `TextEditor::SelectEntinerDocument()` should set
its expected selection with a call for saving the runtime cost.

Then, we don't need to make `EditorBase::SelectEntierDocument()` as non-pure
virtual method.  So, this patch makes each its callers call
`Selection->SelectAllChildren()` directly.

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

--HG--
extra : moz-landing-system : lando
2019-03-18 01:51:53 +00:00
Masayuki Nakano
d4cbc09db8 Bug 1533293 - part 1: Create Selection::SetStartAndEnd() to set new range as far as faster r=smaug
`Selection::Extend()` is too slow because:
- it may create some `nsRange` instances.
- it users `nsContentUtils::ComparePoints()` multiple times.

Therefore, we can improve the performance if we can stop using it in some
places.  First, this patch creates `Selection::SetStartAndEnd()` and
`Selection::SetStartAndEndInLimiter()` for internal use.  They remove
current ranges, reuse `nsRange` instance as far as possible and add new
range which is set by their arguments.  Then, this patch makes
`Selection::SelectAllChildren()` stop using `Selection::Extend()`.  At this
time, this fixes a web-compat issue.  `Selection::Expand()` cannot cross the
selection limiter boundary when there is a limiter (e.g., when an editing host
has focus).  But we can now fix this with using the new internal API.

Note that methods in editor shouldn't move selection to outside of active
editing host.  Therefore, this patch adds `Selection::SetStartAndEndInLimiter()`
and `Selection::SetBaseAndExtentInLimiter()` for them.

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

--HG--
extra : moz-landing-system : lando
2019-03-18 01:50:59 +00:00
Masayuki Nakano
39daaa7db8 Bug 1534561 - Make editor use PresShell directly rather than nsIPresShell r=m_kato
`PresShell.h` is exposed as `mozilla/PresShell.h` and `PresShell` is the only
concrete class of `nsIPresShell`.  Therefore, we have no reason to access
`PresShell` via `nsIPresShell`.

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

--HG--
extra : moz-landing-system : lando
2019-03-15 05:01:10 +00:00
Boris Zbarsky
4ff91d4938 Bug 1506439 part 2. Stop creating a useless nsCOMPtr in DispatchInputEvent. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D23068

--HG--
extra : moz-landing-system : lando
2019-03-13 02:34:48 +00:00
Boris Zbarsky
f9a32ca8b1 Bug 1534370 part 4. Remove some simple MOZ_CAN_RUN_SCRIPT_BOUNDARY annotations from editor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D23044

--HG--
extra : moz-landing-system : lando
2019-03-12 01:50:41 +00:00
Boris Zbarsky
9a4ba73134 Bug 1534370 part 3. Mark InsertFromTransferable as MOZ_CAN_RUN_SCRIPT. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D23042

--HG--
extra : moz-landing-system : lando
2019-03-12 01:55:03 +00:00
Boris Zbarsky
6d1f77b386 Bug 1534370 part 2. Annotate doCommand as MOZ_CAN_RUN_SCRIPT. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D23041

--HG--
extra : moz-landing-system : lando
2019-03-12 01:57:42 +00:00
Boris Zbarsky
358e378b63 Bug 1505029. Teach our static analysis about nsCOMPtr<nsISupports> being a strong ref. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D23021

--HG--
extra : moz-landing-system : lando
2019-03-12 21:04:07 +00:00
Makoto Kato
ae43a8cf0a Bug 676268 - Part 1. Support text/html on Android clipboard backend. r=geckoview-reviewers,snorp
Summary: Actually, we only support `text/unicode` mime type on Android clipboard backend.  But Android API 16+ supports `text/html`, so we should support this type since Chrome/Blink already supports it.

Reviewers: #geckoview-reviewers, snorp

Reviewed By: #geckoview-reviewers, snorp

Bug #: 676268

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

--HG--
extra : rebase_source : 17ef0aa06b83b812bb9bccfab93a72e0b37f9652
2019-03-20 14:47:19 +09:00
Makoto Kato
ba8662db5b Bug 1533250 - Remove *JSAndPlugins* methods from nsIEditingSession. r=masayuki
Firefox, comm-central and bluegriffon don't use `*JSAndPlugin*` methods of
`nsIEditingSession` from script. Let's remove or move to `nsEditingSession`.

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

--HG--
extra : rebase_source : 256fb4025fe8c6f5a61d5b015af942ff65759c23
2019-02-10 19:41:43 +09:00
Masayuki Nakano
49207fb1b7 Bug 1532890 - Get rid of CachedWeakPtr due to unused r=m_kato
The class was created for Quantum Flow, but now, nobody uses it.

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

--HG--
extra : moz-landing-system : lando
2019-03-07 04:25:40 +00:00
Masayuki Nakano
8763d4dcac Bug 1532527 - Support "insertFromPasteAsQuotation" inputType value r=smaug
Only Firefox has an operation to paste clipboard data as quoted text
(Control + middle button paste).  Input Events Level 1 and Level 2 declared
new inputType value for this operation.  Therefore, we should support it.

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

--HG--
extra : moz-landing-system : lando
2019-03-05 14:35:43 +00:00
Tim Nguyen
fa021187df Bug 1513343 - Remove textarea binding and replace usages with html:textarea. r=bgrins,dao
Differential Revision: https://phabricator.services.mozilla.com/D15001

--HG--
extra : moz-landing-system : lando
2019-03-05 11:41:42 +00:00
Josef Citrine
dde7723c68 Bug 1485264 - Removed dom.event.highrestimestamp.enabled pref r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D21580

--HG--
extra : moz-landing-system : lando
2019-03-01 18:49:44 +00:00
Marco Bonardo
5c4e44ce0a Bug 1528751 - Add a custom eslint rule to check "consistent" if bracing. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D20753

--HG--
extra : moz-landing-system : lando
2019-02-28 08:39:33 +00:00
James Willcox
61ca9441b1 Bug 1525959 - Skip some mochitests tests under GeckoView r=geckoview-reviewers,esawin
There are few things that are either Fennec-specific or don't work
currently under GeckoView w/ e10s under TestRunnerActivity. Disable
these so we can get some testing going in automation.

This also replaces 'isFennec' with the more correct 'is_fennec'.

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

--HG--
extra : moz-landing-system : lando
2019-02-27 15:01:43 +00:00
Masayuki Nakano
995e03c1d3 Bug 1530250 - Make InsertTagCommand::DoCommandParams() check result of nsCommandParams::GetString() r=m_kato
Accidentally, I removed the check in the previous landing (bug 1529190).  This
patch restores it.

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

--HG--
extra : moz-landing-system : lando
2019-02-27 00:44:18 +00:00
Masayuki Nakano
9609df9a73 Bug 1525481 - part 3: Make editor not expose internal errors to the web r=m_kato
As far as I've tested, Chrome does not throw exception even when editor is
destroyed or editor content is modified unexpectedly.  So, we should return
`NS_OK` from most public methods of editor when internal methods return
`NS_ERROR_EDITOR_DESTROYED` or `NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE`.

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

--HG--
extra : moz-landing-system : lando
2019-02-25 09:07:54 +00:00
Masayuki Nakano
0b16be82cb Bug 1525481 - part 2: Make EditorBase::DoSplitNode() return error if split nodes are moved/removed unexpectedly r=m_kato
We should stop handling splitting nodes if mutation event listeners move or
remove the split nodes unexpectedly because the post processors may not be
able to keep handling the nodes.  For example, if a node is moved to outside
of editing host, we shouldn't touch it anymore due to non-editable.

This patch makes `EditorBase::DoSplitNode()` return new error for making
any parent callers stop their job, but note that the following patch makes
any public methods expose the new error as exception for compatibility with
Chrome.

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

--HG--
extra : moz-landing-system : lando
2019-02-25 08:29:38 +00:00
Masayuki Nakano
dc541393db Bug 1525481 - part 1: Make SplitNodeTransaction::DoTransaction() always check the result of EditorBase::DoSplitNode() r=m_kato
Oddly, `SplitNodeTransaction::DoTransaction()` checks the result of
`EditorBase::DoSplitNode()` only when it's not allowed to change `Selection`.
We should make it always check the result.

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

--HG--
extra : moz-landing-system : lando
2019-02-25 05:00:27 +00:00
Masayuki Nakano
e4a493a90c Bug 1529190 - Make execCommand("createLink") and execCommand("insertImage") aware of URL including non-ASCII characters r=m_kato
`InsertTagCommand::DoCommandParams()` inserts given URL to `href` of `<a>` or
`src` of `<img>`.  However, it treats the given URL includes only ASCII
characters.  Therefore, we cannot insert URL including non-ASCII characters
with `execCommand("createLink")` nor `execCommand("insertImage")`.

This patch makes `nsHTMLDocument::ExecCommand()` set the param as `nsString`
and makes `InsertTagCommand::DoCommandParams()` retrieve it with `GetString()`.

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

--HG--
extra : moz-landing-system : lando
2019-02-25 03:30:50 +00:00
Masayuki Nakano
d926c78b43 Bug 1529177 - Make InsertTagCommand::DoCommandParams() use nsGkAtoms to set attribute r=m_kato
`InsertTagCommand::DoCommandParams()` uses `Element::SetAttribute()` which takes
`nsAString` as attribute name.  For avoiding unnecessary copy of attribute name,
we should make it use `Element::SetAttr()` which takes `nsAtom` instead.

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

--HG--
extra : moz-landing-system : lando
2019-02-22 08:19:37 +00:00
Masayuki Nakano
6e11a1ab32 Bug 1505668 - part 3: Stop supporting "cmd_copyAndCollapseToEnd" since only CopyPasteAssistent refers it but nobody uses it r=m_kato,TYLin
"cmd_copyAndCollapseToEnd" is referred only by CopyPasteAssistent (even
including comm-central and BlueGriffon), but CopyPasteAssistent won't receive
"copy" command to send it.

So, it seems that we can get rid of a lot around CopyPasteAssistent but this
patch just changes the mapping in it ("copy" is mapped to "cmd_copy") and
removes command handlers of "cmd_copyAndCollapseToEnd" completely.

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

--HG--
extra : moz-landing-system : lando
2019-02-22 01:39:14 +00:00
Masayuki Nakano
a0806ef68a Bug 1505668 - part 2: Stop supporting "cmd_setDocumentOptions" since nobody uses it r=m_kato
"cmd_setDocumentOptions" is never used now (even including comm-central and
BlueGriffon).  So, we can stop supporting this command and we can get rid of
the command handler, SetDocumentOptionsCommand.

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

--HG--
extra : moz-landing-system : lando
2019-02-21 11:16:27 +00:00
Masayuki Nakano
4c828577c0 Bug 1505668 - part 1: Stop supporting "cmd_clearUndo" since nobody uses it r=m_kato
"cmd_clearUndo" is never used now (even including comm-central and BlueGriffon).
So, we can stop supporting this command and we can get rid of the command
handler, ClearUndoCommand.

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

--HG--
extra : moz-landing-system : lando
2019-02-21 11:14:11 +00:00
Masayuki Nakano
f4e8c4a068 Bug 1528676 - Remove telemetry probes for HTMLEditors which have shown Gecko build-in editing UIs and if they are operated r=m_kato,Ehsan
Those probes are now expired and we got enough data:

- Almost no user uses the grip to move absolute positioned element
- There were over one thousand users using the inline table editor and the object resizers.
- Such users keep using even after we disabled the UIs by default.

Perhaps, such small number of users keep using the UIs, i.e., I guess the
number won't become smaller in short term.  Therefore, this patch removes the
telemetry probes and members of HTMLEditor which are necessary to call
Telemetry API.

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

--HG--
extra : moz-landing-system : lando
2019-02-22 02:17:27 +00:00
Emilio Cobos Álvarez
f8ecce61ec Bug 1470926 - Null-check mBoundFrame after calling SetSelectionRange on it. r=TYLin
This code was already handling the world going away, but did not handle the case
of just getting unbound, which can happen if some selection listener (e.g.,
AccessibleCaret) flushes layout.

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

--HG--
extra : moz-landing-system : lando
2019-02-21 00:18:15 +00:00
Ting-Yu Lin
d373ed0def Bug 1526097 - Remove nsIFrame::eBlockFrame flag. r=dholbert
Only nsBlockFrame and its subclasses recognize the nsIFrame::eBlockFrame
flag, so we can replace the usage of the flag with either
nsIFrame::IsBlockFrameOrSubclass() or a do_QueryFrame().

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

--HG--
extra : moz-landing-system : lando
2019-02-20 21:18:14 +00:00
Emilio Cobos Álvarez
39d3da7fd5 Bug 1528644 - Internal value changes shouldn't change validity state. r=masayuki
Even less so on reframe, where it's just unsound to do so. I had to give a value
to eSetValue_Internal, since otherwise I cannot check for its presence. I can
further special-case the reframe case if you prefer.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 09:25:55 +00:00
Masayuki Nakano
f8a317eb9a Bug 998941 - part 2-3: Create new constructors of DataTransfer to set only plain text or nsITransferable r=smaug
DataTransfer should have more 2 constructors.  One takes |const nsAString&| and
sets its data to the string.  The other takes |nsITransferable*| and stores only
its data with DataTransferItem.

If given data is external resource like the case of `HTMLEditor::PasteTransferable()`,
we should copy its data to each DataTransferItem because nsITransferable is not
cycle-collectable, but DataTransfer may be grabbed by JS.  Unfortunately, adding
new path to initialize DataTransfer with nsITransferable instance is too risky
because DataTransfer and DataTransferItem work together to initialize each of
them if DataTransfer is in external mode. Therefore, this patch makes the
new constructor temporarily sets it to in external mode, then, cache usable types
first, then, call `FillAllExternalData()` to  make each DataTransferItem initializes
its data by itself, finally, make the constructor set it to internal mode and release
nsITransferable instance.  This is ugly implementation but the most reasonable
way for now because:

- We don't need to change DataTransfer nor DataTransferItem a lot in this bug.
- We don't need to duplicate any code like a loop in `CacheExternalData()`.

In another bug, we should redesign DataTransfer and DataTransferItem to
make DataTransferable easier to be added new constructors.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 07:13:20 +00:00
Masayuki Nakano
474225038e Bug 998941 - part 2-2: Make HTMLEditor set InputEvent.dataTransfer when InputEvent.inputType is "insertFromPaste", "insertFromDrop" or "insertReplacementText" r=smaug,m_kato
InputEvent.dataTransfer should be set to non-null when InputEvent.inputType
is "insertFromPaste", "insertFromDrop" or "insertReplacementText" and
editor is an HTMLEditor instance:
https://rawgit.com/w3c/input-events/v1/index.html#dfn-data
https://w3c.github.io/input-events/#dfn-data

("insertTranspose" and "insertFromYank" are not currently supported on Gecko.)

This patch makes nsContentUtils::DispatchInputEvent() take dataTransfer value
and EditorBase set it via AutoEditActionDataSetter like data value.

However, we need to create other constructors of DataTransfer to create its
read-only instances initialized with nsITransferable or nsAString.  This will
be implemented by the following patch.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:33:42 +00:00
Masayuki Nakano
551de121c1 Bug 998941 - part 1-7: Make HTMLEditor set InputEvent.data to serialized color value when InputEvent.inputType is "formatBackColor" or "formatForeColor" r=smaug,m_kato,emilio
Although neither Chrome nor Safari does not set InputEvent.data when the event
is caused by `document.execCommand()` with `backColor`, `foreColor` nor
`hiliteColor`, Safari supports styling color with touchbar and in that case,
Safari sets it (*1).

Additionally, currently Safari uses `rgb()` to represents a color value and
using same rule to serializing color value for CSS OM matches Safari's behavior
and can represent any valid color values.

This patch makes given color value parsed and then serialized with same code
in style system.  If the value is `currentcolor`, `inherit`, `initial` or `reset`, sets
the value as-is for now.  Additionally, when given value is invalid, sets the value
as-is for forward compatibility.

Note that automated tests will be added into input-events-exec-command.html
by the last patch.

1. https://github.com/w3c/input-events/issues/94#issuecomment-461061517

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:31:28 +00:00
Masayuki Nakano
135f048bdf Bug 998941 - part 1-6: Make HTMLEditor set InputEvent.data when InputEvent.inputType is "fontName" r=smaug,m_kato
Although neither Chrome nor Safari does not set InputEvent.data value when
InputEvent.inputType is "fontName", but it's easy to implement. Therefore, this
patch implements it as declaration of Input Events.

This patch uses given value as-is.  Perhaps, this shouldn't cause any problems
because such value can be set to Element.style.fontFamily without any changes.

Note that automated test will be added into WPT later.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:30:50 +00:00
Masayuki Nakano
0d571915df Bug 998941 - part 1-5: Make HTMLEditor set InputEvent.data when InputEvent.inputType is "insertLink" r=smaug,m_kato
Although neither Chrome nor Safari does not set InputEvent.data value when
InputEvent.inputType is "insertLink", but it's easy to implement.  Therefore,
this patch implements it as declaration of Input Events.

This patch sets the value to raw href attribute value because we create
<a> element without absolute URI when web apps call execCommand("createLink")
with relative URI.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:30:12 +00:00
Masayuki Nakano
122ab2691a Bug 998941 - part 1-4: Make editor set InputEvent.data to "ltr" or "rtl" when InputEvent.inputType is "formatSetBlockTextDirection" r=smaug,m_kato
When InputEvent.inputType is "formatSetBlockTextDirection" or
"formatSetInlineTextDirection", InputEvent.data value should be one of
"ltr", "rtl", "auto" or "null".
https://rawgit.com/w3c/input-events/v1/index.html#dfn-data
https://w3c.github.io/input-events/#dfn-data

We only supports "ltr" and "rtl" when user switches the direction with
Accel + Shift + X.  Therefore this patch makes EditorBase set the data
to "ltr" or "rtl".

Oddly, with synthesizing the shortcut keys, the command is not executed
properly in the automated test.  Therefore, this patch dispatches the
command directly.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:29:38 +00:00
Masayuki Nakano
2eaf64e594 Bug 998941 - part 1-3: Make TextEditor (only when not HTMLEditor instance) set InputEvent.data to inserting string when InputEvent.inputType is "insertFromPaste", "insertFromDrop" or "insertReplacementText" r=smaug,m_kato
https://rawgit.com/w3c/input-events/v1/index.html#dfn-data
https://w3c.github.io/input-events/#dfn-data

Both Input Events Level 1 and Level 2 declare that InputEvent.data should be
set to inserting string only on TextEditor when InputEvent.inputType is
"insertFromPaste", "insertFromPasteAsQuotation", "insertFromDrop",
"insertTranspose", "insertReplacementText" or "insertFromYank".

Currently, we support only "insertFromPaste", "insertFromDrop",
"insertReplacementText".  Therefore, this patch makes TextEditor set
EditorBase::mEditActionData::mData only for them (and the instance is not
HTMLEditor's).

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:28:57 +00:00
Masayuki Nakano
a3484e40c0 Bug 998941 - part 1-2: Make editor set InputEvent.data to inserting text when it sets InputEvent.inputType to "insertText" or "insertCompositionText" r=smaug,m_kato
This patch makes nsContentUtils::DispatchInputEvent() support to set
InputEvent.data.  Whether the its value should be null or DOMString depends
on InputEvent.inputType value.

- https://rawgit.com/w3c/input-events/v1/index.html#overview
- https://rawgit.com/w3c/input-events/v1/index.html#dfn-data
- https://w3c.github.io/input-events/#overview
- https://w3c.github.io/input-events/#dfn-data

According to the draft specs, InputEvent.data should be always inserting text
when inputType is "insertText" or "insertCompositionText" (or
"insertFromCompoition" if Level 2 support is enabled).

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:28:19 +00:00
Andreea Pavel
7b1605af56 Backed out 3 changesets (bug 1525959, bug 1526002) for failing android
Backed out changeset de0efca1118e (bug 1526002)
Backed out changeset 503cbc86e442 (bug 1525959)
Backed out changeset 33ea61c54aea (bug 1525959)
2019-02-12 23:53:05 +02:00
James Willcox
c7a8bf9699 Bug 1526002 - Replace 'isFennec' with 'is_fennec' in mochitest.ini r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D19038

--HG--
extra : moz-landing-system : lando
2019-02-10 19:07:57 +00:00
James Willcox
228b5844d5 Bug 1525959 - Skip some mochitests tests under GeckoView r=geckoview-reviewers,esawin
There are few things that are either Fennec-specific or don't work
currently under GeckoView w/ e10s under TestRunnerActivity. Disable
these so we can get some testing going in automation.

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

--HG--
extra : moz-landing-system : lando
2019-02-12 15:15:28 +00:00
Makoto Kato
c1917e9616 Bug 1503491 - Part 1. Remove CheckCurrentWordNoSuggest. r=masayuki
No one uses CheckCurrentWordNoSuggest. So I would like to get a rid of this
method. And this method is only user of mozSpellChecker::CheckWord. So
mozSpellChecker::CheckWord shouldn't allow that aSuggestions is nullptr on
content process since we already have async API as mozSpellChecker::CheckWords.

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

--HG--
extra : moz-landing-system : lando
2019-02-10 22:03:53 +00:00
Makoto Kato
03c4d17822 Bug 1496118 - Clean up caret when destroying editor. r=masayuki
Summary:
Editor changes caret visibility during drag and drop.  But when destroying
editor, we don't restore caret state.  So we should restore it when destroying
editor.

Tags: #secure-revision

Bug #: 1496118

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

--HG--
extra : rebase_source : 157f2c9e69857c7f7adb916af2a319392c4d125a
2019-02-06 19:26:35 +09:00
Myk Melez
25349d2601 Bug 1518283 - prohibit blank lines at the beginning and end of blocks (eslint padded-blocks) r=mossop,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D17526

--HG--
extra : moz-landing-system : lando
2019-01-30 17:26:25 +00:00
Kris Maglione
e930b89c34 Bug 1514594: Part 3 - Change ChromeUtils.import API.
***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8

This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:

  ChromeUtils.import("resource://gre/modules/Services.jsm");

is approximately the same as the following, in the new model:

  var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs

This was done using the followng script:

https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs

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

--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
2019-01-17 10:18:31 -08:00
Randell Jesup
76bd9e73cc Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd
* * *
Bug 1522150: Rename NS_IdleDispatch* functions since they take queue identifiers r=froyd
2019-01-26 12:18:05 -05:00
Ehsan Akhgari
4137a92662 Bug 1514340 - Part 2: Break out the content blocking related notifications into nsIWebProgressListener.onContentBlockingEvent(); r=baku,johannh
Differential Revision: https://phabricator.services.mozilla.com/D16052
2019-01-21 09:58:50 -05:00
Cosmin Sabou
7ccc9d8b0b Merge mozilla-inbound to mozilla-central. a=merge 2019-01-19 11:57:49 +02:00
Makoto Kato
c7936919a5 Bug 1518002 - Update selection cache when initializing editor. r=masayuki
GitLab's comment calls scrollTop on input event handler. The scollTop may cause
reflow.  When causing reflow, editor is destroyed and initialized again. Then
nsTextEditorState will set current value to editor.  But this is failure.

By bug 1465702, selection is cached in edit action. When initializing editor,
selection controller is updated, so selection into cache becomes invalid. It
means that all selection methods will return error since document is different.

So we should update selection cache when initializing editor.

Also, I cannot create test case for this situation since we have to cause reflow
in input and/or composition event. Do you have any idea?

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

--HG--
extra : moz-landing-system : lando
2019-01-18 10:00:23 +00:00
Ehsan Akhgari
e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Makoto Kato
7bc8f8b726 Bug 1502661 - Part 2. Add async method to check word by spellchecker. r=masayuki
For mozInlineSpellChecker, I would like to add promse-based method to check
word. But this method is

- On content process, it works by async.
- On chrome process, it works by sync.

Some reftests with non-e10s don't wait that spellchecker is finished correctly
due to race condition of spellchecker dictionary update.  So it uses sync'd
promise on chrome.

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

--HG--
extra : rebase_source : 63d8fb1b3a6f8754f5b7604ea920c1a26bcd4f5b
2018-12-18 20:23:44 +09:00
Sylvestre Ledru
47a5dd1fb8 Bug 1519636 - Reformat everything to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-01-16 08:50:07 +00:00
Razvan Maries
642dd2cc11 Merge mozilla-central to autoland. a=merge on a CLOSED TREE 2019-01-11 17:33:16 +02:00
Christoph Kerschbaumer
fbb4bafd5c Bug 1513241: Update loadURI interface and pass a loadURIOptions dictionary from frontend to docshell loads. r=bz 2019-01-11 12:43:39 +01:00