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

210 Коммитов

Автор SHA1 Сообщение Дата
Olli Pettay 32d9cd7454 Bug 1815273 - WidgetEvent::Duplicate triggers extra TimeStamp::Now() call, r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D185608
2023-08-09 10:29:39 +00:00
Masayuki Nakano e6f42bf7f7 Bug 1833494 - Make `GlobalKeyListener` not try to match handler with keyboard event with ignoring `Shift` state after one handler matches with the key combination r=smaug
`GlobalKeyListener` try to match shortcut keys with exactly checking `Shift`
state, but for the cases which do not match localized language and active
keyboard layout location, it scans another shortcut keys with ignoring
`Shift` state if no handler is available.

`<command>` elements and `<key>` elements may be disabled conditionally.
E.g., Zoom-in/Zoom-out are disabled when current zoom level is max/min value.
In this case, it's odd that another shortcut key which does not exactly match
the modifiers works.

Therefore, this patch makes `GlobalKeyListener` does not try to scan handlers
with ignoring `Shift` state if it has already found a disabled handler which
exactly matches with the modifiers.

Differential Revision: https://phabricator.services.mozilla.com/D184789
2023-08-09 04:47:06 +00:00
Masayuki Nakano e4d8451468 Bug 1845904 - Make `PresShell::EventHandler::HandleEventWithCurrentEventInfo` stop flushing pending notifications if a query content event does not require that r=emilio
We've already known that `WidgetQueryContentEvent` is dispatched at initializing
a popup menu on macOS (bug 1530188).  Therefore, I made the dispatcher under
`widget/cocoa` set `WidgetQueryContentEvent::mNeedLayoutFlush` to `false` to
avoid to flush pending things in `ContentEventHandler`, but
`PresShell::EventHandler` does it.

Differential Revision: https://phabricator.services.mozilla.com/D185264
2023-08-07 05:24:20 +00:00
Masayuki Nakano 9bc06ad568 Bug 1232918 - Map Windows Logo keys in Win/Linux to `Meta` and rename `OSLeft`/`OSRight` to `MetaLeft`/`MetaRight` r=smaug,webdriver-reviewers,jdescottes,media-playback-reviewers,karlt
When we implement `KeyboardEvent.key`, its value for Windows Logo key was
declared as `OS`, but now the spec declares it as `Meta`.

When we implement `KeyboardEvent.code`, its value for Windows Logo keys in
Win/Linux and Command keys in macOS are declared as `OSLeft`/`OSRight`, but
now the spec declares them as `MetaLeft`/`MetaRight`.

This patch remaps and renames them.

Differential Revision: https://phabricator.services.mozilla.com/D183481
2023-08-07 01:03:58 +00:00
Masayuki Nakano 0f39d7eda7 Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-07 01:03:58 +00:00
Cristian Tuns f5572b469f Backed out 2 changesets (bug 1266437, bug 1232918) for causing mochitest failures in test_autoplay_policy_key_blacklist.html CLOSED TREE
Backed out changeset 33e3c6593d4b (bug 1232918)
Backed out changeset 1b56e99dd221 (bug 1266437)
2023-08-03 23:29:52 -04:00
Masayuki Nakano 035a69f44e Bug 1232918 - Map Windows Logo keys in Win/Linux to `Meta` and rename `OSLeft`/`OSRight` to `MetaLeft`/`MetaRight` r=smaug,webdriver-reviewers,jdescottes
When we implement `KeyboardEvent.key`, its value for Windows Logo key was
declared as `OS`, but now the spec declares it as `Meta`.

When we implement `KeyboardEvent.code`, its value for Windows Logo keys in
Win/Linux and Command keys in macOS are declared as `OSLeft`/`OSRight`, but
now the spec declares them as `MetaLeft`/`MetaRight`.

This patch remaps and renames them.

Differential Revision: https://phabricator.services.mozilla.com/D183481
2023-08-04 00:10:12 +00:00
Masayuki Nakano 0664d98bce Bug 1266437 - Drop "OS" modifier r=smaug,m_kato,karlt,Gijs
On Windows, Windows logo key was mapped to "OS" modifier, and on Linux,
it's same and the key is called "Super" and "Hyper".  That conformed to the
older UI Events spec.

However, UI Events declares that they should be mapped to "Meta" now and Chrome
handles it as the spec in Windows and Linux.  Therefore, we should align the
behavior to them.

Note that we've treated the legacy "Meta" modifier on Linux as DOM "Meta"
modifier state, and we'll keep this as-is because in Sun/Solaris keyboard
layout, they keys are mapped to the legacy "Meta".

Finally, the following check only `IsMeta()` but not `IsOS()`.  I think that
they should've checked `IsOS()` too.  Therefore, they will behave differently
in Windows and Linux.
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/base/Element.cpp#3287-3288
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3762-3764
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLInputElement.cpp#3796-3806
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/dom/html/HTMLLabelElement.cpp#127-128
* https://searchfox.org/mozilla-central/rev/9a4666e63199bd1bcfc9095f6efec3488c358458/widget/gtk/nsGtkKeyUtils.cpp#1461-1462

Note that `KEY_NAME_INDEX_OS` will be removed in the patch for bug 1232918.

Differential Revision: https://phabricator.services.mozilla.com/D183480
2023-08-04 00:10:11 +00:00
Masayuki Nakano 828d108d6f Bug 1832306 - Make `BrowserParent` stop handling access keys with delayed events r=smaug,NeilDeakin
`EventStateManager::WalkESMTreeToHandleAccessKey()` requests all `BrowserParent`
instances to handle access key in content processes:
https://searchfox.org/mozilla-central/rev/a4fd6daad3a4123d995478467c1274653b283801/dom/events/EventStateManager.cpp#1379,1398,1410-1411

Then, content processes will reply if no element matches with the access key:
https://searchfox.org/mozilla-central/rev/8e1b221afcdae76284b1439c547b032d1f84d236/dom/ipc/BrowserChild.cpp#2304-2305,2310

Finally, the parent process handles the keypress event:
https://searchfox.org/mozilla-central/rev/8e1b221afcdae76284b1439c547b032d1f84d236/dom/ipc/BrowserParent.cpp#2710-2712,2720,2725

However, this is odd because if multiple remote processes calls
`BrowserParent::RecvAccessKeyNotHandled()`, the parent process will handle
same `keypress` event multiple times.

The approach of this patch is, `BrowserParent` should store main data of
sending `eKeyPress` event, and `RecvAccessKeyNotHandled()` handles only if
the coming event matches with the stored one and clear the data to avoid
handling multiple times.

Even with this approach, we cannot avoid one `eKeyPress` event handled in
multiple content processes, or in both the main process and a content process.

Differential Revision: https://phabricator.services.mozilla.com/D179172
2023-06-15 13:33:19 +00:00
Masayuki Nakano cb321ed332 Bug 1690827 - part 1: Number each composition for native IME or synthesized in the parent process r=smaug
For handling (ignoring) "too late" composition commit request from content
process, we need to distinguish a request is for which composition.  Therefore,
we need to number each composition originated in the parent process.

This patch makes `TextComposition` instance which is created at first
composition event for a composition consider a composition ID in the parent
process and set it to composition events which are dispatched into the DOM
tree in the parent or sent to a remote process.

And also this patch adds the composition ID param to the request method of
committing composition and reply methods to notify the parent process of ending
a composition event handling.

The last patch handle them in `ContentCacheInParent` to consider
whether a request/reply should be ignored or handled.

Differential Revision: https://phabricator.services.mozilla.com/D179310
2023-06-14 01:57:33 +00:00
Cosmin Sabou b91f473221 Backed out 6 changesets (bug 1690827, bug 1835577, bug 1835578) for causing build bustages on widget/ContentCache.cpp. CLOSED TREE
Backed out changeset 8f96604b79a6 (bug 1835578)
Backed out changeset 3afcf20d7fb6 (bug 1835577)
Backed out changeset 41105bb6e199 (bug 1690827)
Backed out changeset feedd62f908d (bug 1690827)
Backed out changeset bc45f9483150 (bug 1690827)
Backed out changeset d2c874809470 (bug 1690827)
2023-06-13 09:31:03 +03:00
Masayuki Nakano b2e57090e9 Bug 1690827 - part 1: Number each composition for native IME or synthesized in the parent process r=smaug
For handling (ignoring) "too late" composition commit request from content
process, we need to distinguish a request is for which composition.  Therefore,
we need to number each composition originated in the parent process.

This patch makes `TextComposition` instance which is created at first
composition event for a composition consider a composition ID in the parent
process and set it to composition events which are dispatched into the DOM
tree in the parent or sent to a remote process.

And also this patch adds the composition ID param to the request method of
committing composition and reply methods to notify the parent process of ending
a composition event handling.

The last patch handle them in `ContentCacheInParent` to consider
whether a request/reply should be ignored or handled.

Differential Revision: https://phabricator.services.mozilla.com/D179310
2023-06-13 04:07:45 +00:00
Emilio Cobos Álvarez 3d092ba60e Bug 1775062 - Implement ipdl reads without needing default ctors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D149743
2023-02-04 11:12:36 +00:00
Emilio Cobos Álvarez 8f6c1fee57 Bug 1726454 - Make nsGenericHTMLElement::HandleKeyboardActivation handle spacebar key press correctly. r=masayuki
This prevents <summary> from scrolling with the space bar. Add a test
for that.

Differential Revision: https://phabricator.services.mozilla.com/D158517
2022-10-06 14:28:43 +00:00
Narcis Beleuzu d55e1f332d Backed out changeset 6f819654ebc5 (bug 1726454) for wpt failure on details-keyboard-activation.html . CLOSED TREE 2022-10-04 17:52:13 +03:00
Emilio Cobos Álvarez 7ddd987dbe Bug 1726454 - Make nsGenericHTMLElement::HandleKeyboardActivation handle spacebar key press correctly. r=masayuki
This prevents <summary> from scrolling with the space bar. Add a test
for that.

Differential Revision: https://phabricator.services.mozilla.com/D158517
2022-10-04 10:15:20 +00:00
Masayuki Nakano 91e18f14d8 Bug 1760160 - Make `ContentCacheInChild` stop storing content if editable element has already been blurred r=m_kato
It's designed for caching content information of focused editor.  However, at
sending focus notification to the main process, the editor may have already
been blurred but `IMEContentObserver` may have not known it yet.  In this edge
case, only query selection succeeds since IMEContentObserver still has a cache,
but query the others failed because of root content node check of
`IMEContentObserver::HandleQueryContentEvent`.  If a content process meets this
case, it should not send focus notification and stop storing the content since
IME shouldn't get focus nor query non-editable content.

On the other hand, the reported testcase reproduces this with a fuzzing API
called **in** the content process. Therefore, I have no idea how to reproduce
it without the API. That's the reason why this patch does not contain new tests.

Differential Revision: https://phabricator.services.mozilla.com/D141821
2022-04-07 00:58:49 +00:00
Masayuki Nakano 4e5ab7b4f1 Bug 1191862 - part 2: Make `TextEventDispatcher` store writing mode at selection at receiving focus notification r=m_kato
Querying selection for getting writing mode may run script in the main process
if focus is in it.  For avoiding new users of writing mode at selection **only**
when the value is required during an editable content has focus,
`TextEventDispatcher` should always store writing mode at receiving focus
notification.

Differential Revision: https://phabricator.services.mozilla.com/D138008
2022-02-15 08:00:06 +00:00
Masayuki Nakano d450beac6f Bug 1191862 - part 1: Make `nsIWidget::NativeKeyBindingsType` independent from `nsIWidget` and defined in an independent header file r=smaug
I'd like to use it in `IMEData.h`.  However, adding new include into it may
cause bustage with MinGW, and it's included by `nsIWidget.h` because `nsIWidget`
requires some classes defined in `IMEData.h`.  Therefore, I'd like to make a
new header file for avoiding the include hell.

Differential Revision: https://phabricator.services.mozilla.com/D138007
2022-02-15 08:00:05 +00:00
Masayuki Nakano 69c1675bde Bug 1746104 - part 7: Make `eQuerySelectedText` event and `ContentEventHandler` work with no selection ranges r=m_kato
Finally, making `WidgetQueryContentEvent::Succeeded` return `true` when there
is no selection when its message is `eQuerySelectedText`, and making
`ContentEventHandler::OnQuerySelectedText` set the no selection range data even
when the queried selection type is "normal.  Then, all things which are
changed by the previous patches start to work.

And this patch adds a simple test for `ContentCache` and update tests of
`nsITextInputProcessor`.

Differential Revision: https://phabricator.services.mozilla.com/D137432
2022-02-07 22:33:41 +00:00
Masayuki Nakano e3a9c1271d Bug 1746104 - part 6-1: Make `IMENotification::SelectionChangeDataBase` and `WidgetQueryContentEvent::Reply` have `AnchorOffset` and `FocusOffset` r=m_kato,geckoview-reviewers
`StartOffset` and `EndOffset` of `IMENotification::SelectionChangeDataBase`
depend on whether the range is reversed or not.  Therefore, their actual
meaning is "anchor offset" and "focus offset" in the DOM selection terms.

Similarly, `SelectionStartOffset` and `SelectionEndOffset` of
`WidgetQueryContentEvent::Reply` are exactly same ones.

Therefore, they should be renamed to `AnchorOffset` and `FocusOffset` for
making what they return clearer.

Differential Revision: https://phabricator.services.mozilla.com/D137427
2022-02-07 22:33:39 +00:00
Masayuki Nakano fd30eaf365 Bug 1746104 - part 5-1: Get rid of `WidgetQueryContentEvent::Reply::mHasSelection` r=m_kato
It's intended to indicate whether the selection is collapsed or not, but it can
be referred by other members, there is no reasonable user and the name makes
developers confused.

Differential Revision: https://phabricator.services.mozilla.com/D137422
2022-02-07 22:33:37 +00:00
Butkovits Atila 1557f3a480 Backed out 3 changesets (bug 1685183) for causing build bustages. CLOSED TREE
Backed out changeset bef089a9a5fa (bug 1685183)
Backed out changeset d9e2699b32c6 (bug 1685183)
Backed out changeset 083f895fddd9 (bug 1685183)
2021-04-08 06:48:02 +03:00
Brad Werth 430c8d503c Bug 1685183 Part 3: Remove remaining references to PluginInstanceChild. r=jgilbert
These references were left behind in the cleanup of the plugin code.

Depends on D101227

Differential Revision: https://phabricator.services.mozilla.com/D111197
2021-04-08 01:39:05 +00:00
Simon Giesecke ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Simon Giesecke 6da5224516 Bug 1634281 - Add nsHashtablesFwd.h and remove all other forward declarations for hashtables. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D105960
2021-03-04 18:52:17 +00:00
Masayuki Nakano a25988774a Bug 1685491 - part 5: Move the code remapping arrow keys in vertical content to `NativeKeyBindings` r=smaug,jfkthame
Currently, this feature is implemented only on Linux and macOS (see also
bug 1077515 and bug 1301497), and the code is really similar each other.
Additionally, it always tries to query selection to check whether the caret is
in vertical content or not if arrow keys are pressed.  For avoiding a lot of
query, this patch makes `TextEventDispatcher` cache writing mode at every
selection change notification.  However, unfortunately, it's not available when
non-editable content has focus, but it should be out of scope of this bug since
it requires a lot of changes.

Anyway, with this patch, we can write a mochitest only on Linux and macOS.
The following patch adds a test for this as a fix of bug 1103374.

Differential Revision: https://phabricator.services.mozilla.com/D102881
2021-02-02 03:29:31 +00:00
Masayuki Nakano cb448c5095 Bug 1685491 - part.1: Map typical commands to synthesized keyboard events for test on Linux and macOS r=smaug,remote-protocol-reviewers
Currently, we don't allow keyboard events synthesized for tests retrieve native
key bindings in content process.  However, due to this, we cannot test keyboard
navigation, deleting per word, etc on Linux and macOS either with mochitest
or WPT.  For making better compatibility with the other browsers, we should
write WPT more with the test driver.  Therefore, we should allow keyboard
events synthesized for tests retrieve native key bindings.

On the other hand, if we make them retrieve customized keyboard shortcuts
in the environment, some developers may not be able to run tests locally without
resetting their customization.  Therefore, this patch makes `NativeKeyBindings`
set "standard" shortcut keys on the platform instead of retrieving actual
shortcut key results.

If referring the default shortcut key bindings is not good thing for
WebDriver/CDP, perhaps, `TextInputProcessor` should have a new flag which can
refer customized shortcut keys even in content process.  But I think that it
should be done in another bug because some edit commands are mapped forcibly
like this patch.
https://searchfox.org/mozilla-central/rev/c03e8de87cdb0ce0378c0886d3c0ce8bbf9dc44e/remote/domains/parent/Input.jsm#82-102

Differential Revision: https://phabricator.services.mozilla.com/D102877
2021-02-02 03:02:30 +00:00
Masayuki Nakano 5d24a92232 Bug 1689034 - part 3: Get rid of keyboard events on plugins r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103140
2021-01-28 07:48:15 +00:00
Masayuki Nakano 1b07095476 Bug 1683226 - part 15: Get rid of plugin specific members of `WidgetKeyboardEvent` r=m_kato,smaug
Depends on D100388

Differential Revision: https://phabricator.services.mozilla.com/D100389
2020-12-29 21:16:48 +00:00
Masayuki Nakano 912a5bc76d Bug 1678553 - part 13: Make `WidgetQueryContentEvent` use `Maybe` to store some data r=m_kato,geckoview-reviewers
Sorry for this big patch.

This makes `WidgetQueryContentEvent::Reply` is stored with `Maybe` to get
rid of `WidgetQueryContentEvent`.  And `Reply` stores offset and string
with `Maybe` and ``OffsetAndData<uint32_t>`, and also tentative caret offset
with `Maybe`.  Then, we can get rid of `WidgetQueryContentEvent::NOT_FOUND`.

Note that I tried to make `OffsetAndData` have a method to create `NSRange`
for cocoa widget.  However, it causes the column limit`to 100 or longer
and that causes unrelated changes in `TextEvents.h` and `IMEData.h`.
Therefore, I create an inline function in `TextInputHandler.mm` instead.

Differential Revision: https://phabricator.services.mozilla.com/D98264
2020-12-02 05:32:19 +00:00
Masayuki Nakano f011eb52b7 Bug 1677668 - Make `WidgetQueryContentEvent::MakeOffsetAbsolute()` stop casting its `mOffset` before adding `aInsertionPointOffset` r=m_kato
Currently, it validates the result of `mStart + aInsertPointOffset` with
the following code.
```
CheckedInt<uint32_t> absOffset =
    CheckedInt<uint32_t>(mOffset) + aInsertionPointOffset;

```

However, this does not work when `mOffset` is a negative value since it's
converted to unsigned value before adding `aInsertionPointOffset`.
Therefore, when TSF queries first character rect of the document with
`TSFTextStore::GetTextExt()` whose `acpStart` is set to 0, and composition
start is second or later character, the check may fail and anyway, even
if it does not overflow, the computed offset becomes too big and fails
to query character rect anyway.

Therefore, this patch makes its constructor take computed value instead.

Unfortunately, this cannot be tested without writing a big framework to
test async composition event handling because synthesizing similar
query text rect in same process works fine.

Differential Revision: https://phabricator.services.mozilla.com/D97269
2020-11-18 04:08:41 +00:00
Edgar Chen 38dcba8fbb Bug 1640883 - Treat ctrl-c, ctrl-x and ctrl-v as user activation; r=smaug
ctrl-c and ctrl-x is quite common shortcut for clipboard operation, we should
treat it as user activation.

Differential Revision: https://phabricator.services.mozilla.com/D77046
2020-05-28 21:56:30 +00:00
Noemi Erli b2592ed343 Backed out changeset aa89e2840bce (bug 1640883) for causing failures in test_autoplay_policy_key_blacklist.html CLOSED TREE 2020-05-28 19:38:12 +03:00
Edgar Chen 45646b6a07 Bug 1640883 - Treat ctrl-c, ctrl-x and ctrl-v as user activation; r=smaug
ctrl-c and ctrl-x is quite common shortcut for clipboard operation, we should
treat it as user activation.

Differential Revision: https://phabricator.services.mozilla.com/D77046
2020-05-28 14:23:14 +00:00
Simon Giesecke dbf542e979 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D73639
2020-05-07 08:49:18 +00:00
Simon Giesecke 49eb05a114 Bug 1626570 - Improve handling of copying arrays in widget/. r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D72321
2020-04-30 09:38:38 +00:00
Masayuki Nakano f5af8613ec Bug 1449831 - part 3: Make editor set target ranges of `beforeinput` event if the editor instance is an `HTMLEditor` r=smaug
In most cases, `InputEvent.getTargetRange()` of `beforeinput` event should
return `Selection` ranges at dispatching the event.

This patch also handles special cases.
* composition change - target range should be the previous composition string
  which will be replaced with new composition string.
* replace text - target range should be the replace range.  This is used by
  spellchecker.
* drop - target range should be the drop point.

However, the other exception is not handled by this patch.  That is, deletions.
The target range(s) should be the range(s) which will be removed.  In most
cases, they also matches selection ranges, but may be extended to:
* surrogate pair boundary
* grapheme cluster boundary like complex emoji
* word/line deletion deletion
* `Backspace` or `Delete` from collapsed selection
* to end of unnecessary whitespaces

For supporting these cases, we need to separate
`HTMLEditor::HandleDeleteSelection()` and its helper methods and helper class
to range computation part and modifying the DOM tree part.  Of course, it
requires big changes and `InputEvent.getTargetRanges()` may be important for
feature detection of `beforeinput` event so that we should put off the big
changes to bug 1618457.

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

--HG--
extra : moz-landing-system : lando
2020-03-03 03:39:26 +00:00
Masayuki Nakano b4cc4486d4 Bug 1449831 - part 1: Add `InputEvent.getTargetRanges()` r=smaug
`InputEvent.getTargetRanges()` can be used only when event type is
`beforeinput`.  So, it may be used for feature detection of `beforeinput`
event because Chrome does not implement `onbeforeinput` event handler attribute.
Therefore, this patch makes it behind the pref for `beforeinput` event.

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

--HG--
extra : moz-landing-system : lando
2020-03-02 07:39:38 +00:00
Gabriele Svelto 5dc21d568c Bug 1600545 - Remove useless inclusions of header files generated from IDL files in modules/, netwerk/, parser/, security/, startupcache/, storage/, toolkit/, tools/, uriloader/, widget/, xpcom/ and xpfe/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

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

--HG--
extra : moz-landing-system : lando
2019-12-06 09:17:57 +00:00
Masayuki Nakano 0f9b3a05da Bug 1594215 - Make `PuppetWidget::GetEditCommands()` check `mBrowserChild` before using it r=smaug
The reason of the crash is, the window may have already been destroyed and
`PuppetWidget::mBrowserChild` was set to `nullptr` when synthesizing key event.

This patch makes `PuppetWidget::GetEditCommands()` check whether it's `nullptr`
and returns whether it's succeeded or not.  Therefore, `TextInputProcessor`
can throw exception in such case.

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

--HG--
extra : moz-landing-system : lando
2019-11-08 11:32:51 +00:00
kriswright be316b6bf9 Bug 1573992 - Convert 3 ui.key.* prefs to static prefs. r=njn
Converts ui.key.generalAccessKey, ui.key.chromeAccess, and ui.key.contentAccess to static prefs. Updates usages.

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

--HG--
extra : moz-landing-system : lando
2019-08-26 20:25:42 +00:00
Masayuki Nakano fefd623c98 Bug 1530188 - Make nsChildView::GetEditorView() use eQueryContentState without flushing layout r=smaug
`nsChildView::GetEditorView()` is called by `TextInputHandlerBase::GetWindowLevel()`
which is called when Cocoa requests window level of focused widget.

It currently gets widget including focused element (e.g., it may be in a XUL
`<panel>`) with `eQueryTextContent` event.  However, it requires only the widget
(i.e., when a XUL `<panel>` has focused element, the widget for the panel).
Therefore, it does not require to flush the layout.

However, on macOS, `ContentEventHandler` always flushes layout even with
`eQueryContentState` which does not require any layout information.  Whether
it requires flushing layout or not is considered with
`WidgetQueryContentEvent::mNeedsToFlushLayout` but this is set to false only
when `IMEContentObserver` notifies widget (and IME) of focus set.  At this
time, only on macOS, IME caches the layout information, for example, the
character coordinates, but we don't have a way to update it.  This is the reason
why we always flush layout on macOS.

Unfortunately, when a menu popup frame is created, widget for the popup is
created synchronously.  Then, Cocoa retrieves window level of the widget including
focused element.  But this is unsafe to flush the layout.  So, we need to stop
flushing layout in this case.

Therefore, this patch moves the `#ifdef` from `TextEvents.h` to
`IMEContentObserver.cpp`, then, makes `nsChildView::GetEditorView()` use
`eQueryContentState` which is the simplest query content event, and finally,
sets `mNeedsToFlushLayout` to `false`.

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

--HG--
extra : moz-landing-system : lando
2019-04-03 10:27:13 +00:00
Masayuki Nakano 1b0e6d02fe Bug 1466208 - part 39: Create PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch() r=smaug
`PresShell::EventHandler::HandleEventInternal()` may handle `Escape` key before
dispatching it in some cases.  This requires too many lines for somebody who
investigate the method for the other events.  Therefore, this patch moves it
into the new method.

Additionally, this patch creates `WidgetKeyboardEvent::CanTreatAsUserInput()`
and `WidgetKeyboardEvent::ShouldInteractionTimeRecorded()` because we should
manage similar checks in one place (we already have
`WidgetKeyboardEvent::CanUserGestureActivateTarget()`).  Finally, their
conditions are not enough for what the comment wants to do there since they do
not check some modifier keys.  Therefore, this patch makes them check all
possible modifier keys too.

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

--HG--
extra : moz-landing-system : lando
2019-03-08 12:46:17 +00:00
Alex Gaynor 34c7c8f3d5 Bug 1484910 - Use the CheckedInt API correctly; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D21235

--HG--
extra : moz-landing-system : lando
2019-03-07 05:49:44 +00:00
Alastor Wu b89fda8a6d Bug 1530220 - part1 : allow some non-printalble keys as supported user gesture inputs to activate document. r=masayuki,cpearce
`carriage return` and `space` are common keys which user might use to start media, so we should take account them as supported user gesture inputs.

As their pseudo char code are zero, we have to check their key code in order to distinguish them from other controls keys such as shift, alt...

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

--HG--
extra : moz-landing-system : lando
2019-03-05 02:06:22 +00:00
Masayuki Nakano 6eadee9e6c Bug 998941 - part 2-1: Implement InputEvent.dataTransfer declared by Input Events r=smaug
InputEvent.dataTransfer is declared by Input Events Level 1 and Level 2 (i.e.,
not UI Events).  It's necessary for "beforeinput" event on contenteditable
elements because of with some InputEvent.inputType values on contenteditable,
InputEvent.dataTransfer is used instead of InputEvent.data.

According to the Chrome's behavior, if InputEvent.dataTransfer is created by
web apps, the DataTransfer object is mutable.  Otherwise, i.e., the event
represents user input, the DataTransfer object is read only.  We should follow
this behavior.

This is enabled by default.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:32:11 +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
Masayuki Nakano 0f145fc8e5 Bug 998941 - part 1-1: Implement InputEvent.data of UI Events r=smaug
InputEvent.data notifies web apps of inserting/inserted text with "beforeinput"
and "input" events.  So, this is important especially for "beforeinput" event
listeners.  That's the reason why we need to support this before implementing
"beforeinput" event.

This patch adds it into InputEvent and make it enabled by default.

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

--HG--
extra : moz-landing-system : lando
2019-02-19 06:27:41 +00:00
Masayuki Nakano ed2040ac16 Bug 1447239 - Implement InputEvent.inputType r=smaug
This patch implements InputType.inputType which is declared by Input Events.
The attribute has already been implemented by Chrome and Safari.  Chrome
implements Input Events Level 1, but Safari implements Input Events Level 2.
 Difference between them is only whether it supports "insertFromComposition",
"deleteByComposition" and "deleteCompositionText".  This patch makes the
level switchable with pref and takes Level 1 by default because Level 2 is
still unstable around event order with composition events.

For reducing string copy cost at dispatching "input" event, this patch
makes EditorInternalInputEvent store valid input-type as enum class,
EditorInputType and resolves it to string value when
dom::InputEvent::GetInputType() is called.  Note that the reason why
this patch names the enum class as EditorInputType is, there is InputType
enum class already for avoiding conflict the name, this appends "Editor"
prefix because "input" and "beforeinput" events are fired only when an
editor has focus.

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

--HG--
extra : moz-landing-system : lando
2019-01-07 10:10:57 +00:00