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

9452 Коммитов

Автор SHA1 Сообщение Дата
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