зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564391 - Rename internal uses of `mozInputSource`. r=emilio,pip-reviewers,tabbrowser-reviewers,dao,kpatenio
This allows us to deprecate `mozInputSource` for the Web while avoiding console warnings for internal uses, which now use the ChromeOnly `inputSource` attribute. Differential Revision: https://phabricator.services.mozilla.com/D183643
This commit is contained in:
Родитель
7637bccd22
Коммит
21cd613492
|
@ -770,7 +770,7 @@ export class ContextMenuChild extends JSWindowActorChild {
|
|||
context.timeStamp = aEvent.timeStamp;
|
||||
context.screenXDevPx = aEvent.screenX * this.contentWindow.devicePixelRatio;
|
||||
context.screenYDevPx = aEvent.screenY * this.contentWindow.devicePixelRatio;
|
||||
context.mozInputSource = aEvent.mozInputSource;
|
||||
context.inputSource = aEvent.inputSource;
|
||||
|
||||
let node = aEvent.composedTarget;
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ var gGestureSupport = {
|
|||
aEvent.metaKey,
|
||||
0,
|
||||
aEvent,
|
||||
aEvent.mozInputSource
|
||||
aEvent.inputSource
|
||||
);
|
||||
node.dispatchEvent(cmdEvent);
|
||||
}
|
||||
|
|
|
@ -878,7 +878,7 @@ const gClickAndHoldListenersOnElement = {
|
|||
aEvent.metaKey,
|
||||
0,
|
||||
null,
|
||||
aEvent.mozInputSource
|
||||
aEvent.inputSource
|
||||
);
|
||||
aEvent.currentTarget.dispatchEvent(cmdEvent);
|
||||
|
||||
|
@ -8524,7 +8524,7 @@ var MenuTouchModeObserver = {
|
|||
|
||||
handleEvent(event) {
|
||||
let target = event.originalTarget;
|
||||
if (event.mozInputSource == MouseEvent.MOZ_SOURCE_TOUCH) {
|
||||
if (event.inputSource == MouseEvent.MOZ_SOURCE_TOUCH) {
|
||||
target.setAttribute("touchmode", "true");
|
||||
} else {
|
||||
target.removeAttribute("touchmode");
|
||||
|
|
|
@ -101,7 +101,7 @@ function openContextMenu(aMessage, aBrowser, aActor) {
|
|||
2,
|
||||
null,
|
||||
0,
|
||||
context.mozInputSource
|
||||
context.inputSource
|
||||
);
|
||||
popup.openPopupAtScreen(newEvent.screenX, newEvent.screenY, true, newEvent);
|
||||
}
|
||||
|
|
|
@ -3918,7 +3918,7 @@
|
|||
!aTab.pinned &&
|
||||
!aTab.hidden &&
|
||||
aTab._fullyOpen &&
|
||||
triggeringEvent?.mozInputSource == MouseEvent.MOZ_SOURCE_MOUSE &&
|
||||
triggeringEvent?.inputSource == MouseEvent.MOZ_SOURCE_MOUSE &&
|
||||
triggeringEvent?.target.closest(".tabbrowser-tab");
|
||||
if (lockTabSizing) {
|
||||
this.tabContainer._lockTabSizing(aTab, tabWidth);
|
||||
|
|
|
@ -162,7 +162,7 @@ function checkForMiddleClick(node, event) {
|
|||
event.metaKey,
|
||||
0,
|
||||
event,
|
||||
event.mozInputSource
|
||||
event.inputSource
|
||||
);
|
||||
node.dispatchEvent(cmdEvent);
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class TouchSimulator {
|
|||
// (especially ignore mouse event being dispatched from a touch event)
|
||||
if (
|
||||
evt.button ||
|
||||
evt.mozInputSource != evt.MOZ_SOURCE_MOUSE ||
|
||||
evt.inputSource != evt.MOZ_SOURCE_MOUSE ||
|
||||
evt.isSynthesized
|
||||
) {
|
||||
return;
|
||||
|
|
|
@ -3209,7 +3209,7 @@ void Element::DispatchChromeOnlyLinkClickEvent(
|
|||
/* Cancelable */ true, nsGlobalWindowInner::Cast(doc->GetInnerWindow()),
|
||||
0, mouseEvent->CtrlKey(), mouseEvent->AltKey(), mouseEvent->ShiftKey(),
|
||||
mouseEvent->MetaKey(), mouseEvent->Button(), mouseDOMEvent,
|
||||
mouseEvent->MozInputSource(), IgnoreErrors());
|
||||
mouseEvent->InputSource(), IgnoreErrors());
|
||||
// Note: we're always trusted, but the event we pass as the `sourceEvent`
|
||||
// might not be. Frontend code will check that event's trusted property to
|
||||
// make that determination; doing it this way means we don't also start
|
||||
|
|
|
@ -304,7 +304,7 @@ float MouseEvent::MozPressure() const {
|
|||
return mEvent->AsMouseEventBase()->mPressure;
|
||||
}
|
||||
|
||||
uint16_t MouseEvent::MozInputSource() const {
|
||||
uint16_t MouseEvent::InputSource() const {
|
||||
return mEvent->AsMouseEventBase()->mInputSource;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class MouseEvent : public UIEvent {
|
|||
int32_t MovementX() { return GetMovementPoint().x; }
|
||||
int32_t MovementY() { return GetMovementPoint().y; }
|
||||
float MozPressure() const;
|
||||
uint16_t MozInputSource() const;
|
||||
uint16_t InputSource() const;
|
||||
void InitNSMouseEvent(const nsAString& aType, bool aCanBubble,
|
||||
bool aCancelable, nsGlobalWindowInner* aView,
|
||||
int32_t aDetail, int32_t aScreenX, int32_t aScreenY,
|
||||
|
|
|
@ -15,15 +15,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=547996
|
|||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript"><![CDATA[
|
||||
<script>//<![CDATA[
|
||||
|
||||
/** Test for Bug 547996 **/
|
||||
/* mouseEvent.mozInputSource attribute */
|
||||
/* mouseEvent.inputSource attribute */
|
||||
|
||||
var expectedInputSource = null;
|
||||
|
||||
function check(event) {
|
||||
is(event.mozInputSource, expectedInputSource, ".mozInputSource");
|
||||
is(event.inputSource, expectedInputSource, ".inputSource");
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
|
@ -58,7 +58,8 @@ function cleanup() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(doTest, window);
|
||||
|
||||
]]></script>
|
||||
//]]>
|
||||
</script>
|
||||
</pre>
|
||||
<xul:button id="xulButtonTarget" accesskey="t">XUL Button</xul:button>
|
||||
</body>
|
||||
|
|
|
@ -103,6 +103,10 @@ partial interface MouseEvent
|
|||
const unsigned short MOZ_SOURCE_TOUCH = 5;
|
||||
const unsigned short MOZ_SOURCE_KEYBOARD = 6;
|
||||
|
||||
[ChromeOnly]
|
||||
readonly attribute unsigned short inputSource;
|
||||
|
||||
[BinaryName="inputSource"]
|
||||
readonly attribute unsigned short mozInputSource;
|
||||
|
||||
undefined initNSMouseEvent(DOMString typeArg,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<toolbarbutton oncommand="++countera;" id="a">A</toolbarbutton>
|
||||
<toolbarbutton oncommand="++counterb;" id="b">B</toolbarbutton>
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
<script>
|
||||
//<![CDATA[
|
||||
let aEl = document.getElementById('a');
|
||||
let bEl = document.getElementById('b');
|
||||
let countera = 0;
|
||||
|
@ -16,7 +16,7 @@
|
|||
let cmdEvent = document.createEvent("xulcommandevent");
|
||||
cmdEvent.initCommandEvent("command", true, true, window, 0,
|
||||
aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
|
||||
aEvent.metaKey, 0, null, aEvent.mozInputSource);
|
||||
aEvent.metaKey, 0, null, aEvent.inputSource);
|
||||
aEvent.currentTarget.dispatchEvent(cmdEvent);
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
let cmdEvent = document.createEvent("xulcommandevent");
|
||||
cmdEvent.initCommandEvent("command", true, true, window, 0,
|
||||
aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
|
||||
aEvent.metaKey, 0, null, aEvent.mozInputSource);
|
||||
aEvent.metaKey, 0, null, aEvent.inputSource);
|
||||
aEvent.currentTarget.dispatchEvent(cmdEvent);
|
||||
});
|
||||
|
||||
|
@ -33,6 +33,6 @@
|
|||
|
||||
is(countera, 1, "Counter should be one as event fires once");
|
||||
is(counterb, 2, "Counter should be two as event fires twice");
|
||||
]]>
|
||||
//]]>
|
||||
</script>
|
||||
</window>
|
||||
|
|
|
@ -421,7 +421,7 @@ nsresult HTMLSelectEventListener::MouseDown(dom::Event* aMouseEvent) {
|
|||
}
|
||||
|
||||
if (mIsCombobox) {
|
||||
uint16_t inputSource = mouseEvent->MozInputSource();
|
||||
uint16_t inputSource = mouseEvent->InputSource();
|
||||
if (mElement->OpenInParentProcess()) {
|
||||
nsCOMPtr<nsIContent> target = do_QueryInterface(aMouseEvent->GetTarget());
|
||||
if (target && target->IsHTMLElement(nsGkAtoms::option)) {
|
||||
|
|
|
@ -1531,7 +1531,7 @@ export class PictureInPictureToggleChild extends JSWindowActorChild {
|
|||
this.sendAsyncMessage("PictureInPicture:OpenToggleContextMenu", {
|
||||
screenXDevPx: event.screenX * devicePixelRatio,
|
||||
screenYDevPx: event.screenY * devicePixelRatio,
|
||||
mozInputSource: event.mozInputSource,
|
||||
inputSource: event.inputSource,
|
||||
});
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
|
|
|
@ -1413,7 +1413,7 @@ export var PictureInPicture = {
|
|||
0,
|
||||
null,
|
||||
0,
|
||||
data.mozInputSource
|
||||
data.inputSource
|
||||
);
|
||||
popup.openPopupAtScreen(newEvent.screenX, newEvent.screenY, true, newEvent);
|
||||
},
|
||||
|
|
|
@ -674,7 +674,7 @@ let Player = {
|
|||
|
||||
case "closed-caption": {
|
||||
let options = {};
|
||||
if (event.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
if (event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
options.isKeyboard = true;
|
||||
}
|
||||
this.toggleSubtitlesSettingsPanel(options);
|
||||
|
|
|
@ -137,7 +137,7 @@ The `toggle(event)` method will use `event.target` as the anchor for the menu.
|
|||
|
||||
To achieve the expected behaviour, the menu should open on `mousedown` for mouse
|
||||
events, and `click` for keyboard events. This can be accomplished by checking
|
||||
the `event.mozInputSource` property in chrome contexts or `event.detail` in
|
||||
the `event.inputSource` property in chrome contexts or `event.detail` in
|
||||
non-chrome contexts (`event.detail` will be the click count which is `0` when a
|
||||
click is from the keyboard).
|
||||
|
||||
|
@ -145,7 +145,7 @@ click is from the keyboard).
|
|||
function openMenu(event) {
|
||||
if (
|
||||
event.type == "mousedown" ||
|
||||
event.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
!event.detail
|
||||
) {
|
||||
document.querySelector("panel-list").toggle(event);
|
||||
|
|
|
@ -95,8 +95,8 @@
|
|||
this.lastAnchorNode = this.getTargetForEvent(this.triggeringEvent);
|
||||
this.wasOpenedByKeyboard =
|
||||
triggeringEvent &&
|
||||
(triggeringEvent.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
triggeringEvent.mozInputSource == MouseEvent.MOZ_SOURCE_UNKNOWN);
|
||||
(triggeringEvent.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
triggeringEvent.inputSource == MouseEvent.MOZ_SOURCE_UNKNOWN);
|
||||
this.open = true;
|
||||
|
||||
if (this.parentIsXULPanel()) {
|
||||
|
|
|
@ -29,7 +29,7 @@ panel-list-settings = Settings
|
|||
function openMenu(event) {
|
||||
if (
|
||||
event.type == "mousedown" ||
|
||||
event.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD ||
|
||||
!event.detail
|
||||
) {
|
||||
event.target.getRootNode().querySelector("panel-list").toggle(event);
|
||||
|
|
|
@ -882,7 +882,7 @@ class AddonPageHeader extends HTMLElement {
|
|||
window.history.back();
|
||||
break;
|
||||
case pageOptionsMenuButton:
|
||||
if (e.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
if (e.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
this.pageOptionsMenu.toggle(e);
|
||||
}
|
||||
break;
|
||||
|
@ -2566,7 +2566,7 @@ class AddonCard extends HTMLElement {
|
|||
break;
|
||||
case "more-options":
|
||||
// Open panel on click from the keyboard.
|
||||
if (e.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
if (e.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
this.panel.toggle(e);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -605,7 +605,7 @@ ChromeUtils.defineESModuleGetters(this, {
|
|||
card.setAttribute("expanded", "true");
|
||||
setLabel("collapse");
|
||||
// If this as a keyboard event then focus the next input.
|
||||
if (event.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
if (event.inputSource == MouseEvent.MOZ_SOURCE_KEYBOARD) {
|
||||
firstHiddenInput.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ nsBaseDragService::InvokeDragSessionWithImage(
|
|||
mSourceWindowContext ? mSourceWindowContext->TopWindowContext() : nullptr;
|
||||
|
||||
mScreenPosition = aDragEvent->ScreenPoint(CallerType::System);
|
||||
mInputSource = aDragEvent->MozInputSource();
|
||||
mInputSource = aDragEvent->InputSource();
|
||||
|
||||
// If dragging within a XUL tree and no custom drag image was
|
||||
// set, the region argument to InvokeDragSessionWithImage needs
|
||||
|
@ -470,7 +470,7 @@ nsBaseDragService::InvokeDragSessionWithRemoteImage(
|
|||
mSourceTopWindowContext = mDragStartData->GetSourceTopWindowContext();
|
||||
|
||||
mScreenPosition = aDragEvent->ScreenPoint(CallerType::System);
|
||||
mInputSource = aDragEvent->MozInputSource();
|
||||
mInputSource = aDragEvent->InputSource();
|
||||
|
||||
nsresult rv = InvokeDragSession(
|
||||
aDOMNode, aPrincipal, aCsp, aCookieJarSettings, aTransferableArray,
|
||||
|
@ -502,7 +502,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(
|
|||
|
||||
mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
|
||||
mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
|
||||
mInputSource = aDragEvent->MozInputSource();
|
||||
mInputSource = aDragEvent->InputSource();
|
||||
|
||||
// just get the focused node from the selection
|
||||
// XXXndeakin this should actually be the deepest node that contains both
|
||||
|
|
Загрузка…
Ссылка в новой задаче