mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 940420 - It's nearly impossible to close browser app tabs with edge gestures enabled. r=smaug
This commit is contained in:
parent
3e7e7271fa
commit
edac2e565a
@ -855,6 +855,45 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
bool *aPreventDefault)
|
||||
{
|
||||
return SendTouchEventCommon(aType, aIdentifiers, aXs, aYs, aRxs, aRys,
|
||||
aRotationAngles, aForces, aCount, aModifiers,
|
||||
aIgnoreRootScrollFrame, false, aPreventDefault);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendTouchEventToWindow(const nsAString& aType,
|
||||
uint32_t* aIdentifiers,
|
||||
int32_t* aXs,
|
||||
int32_t* aYs,
|
||||
uint32_t* aRxs,
|
||||
uint32_t* aRys,
|
||||
float* aRotationAngles,
|
||||
float* aForces,
|
||||
uint32_t aCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
bool* aPreventDefault)
|
||||
{
|
||||
return SendTouchEventCommon(aType, aIdentifiers, aXs, aYs, aRxs, aRys,
|
||||
aRotationAngles, aForces, aCount, aModifiers,
|
||||
aIgnoreRootScrollFrame, true, aPreventDefault);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
||||
uint32_t* aIdentifiers,
|
||||
int32_t* aXs,
|
||||
int32_t* aYs,
|
||||
uint32_t* aRxs,
|
||||
uint32_t* aRys,
|
||||
float* aRotationAngles,
|
||||
float* aForces,
|
||||
uint32_t aCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
bool aToWindow,
|
||||
bool* aPreventDefault)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
@ -900,6 +939,27 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
if (aToWindow) {
|
||||
nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
|
||||
if (!presShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsViewManager* viewManager = presShell->GetViewManager();
|
||||
if (!viewManager) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsView* view = viewManager->GetRootView();
|
||||
if (!view) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
status = nsEventStatus_eIgnore;
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
|
||||
}
|
||||
|
||||
nsresult rv = widget->DispatchEvent(&event, status);
|
||||
*aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
|
||||
return rv;
|
||||
|
@ -48,6 +48,21 @@ protected:
|
||||
bool aToWindow,
|
||||
bool *aPreventDefault);
|
||||
|
||||
NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
|
||||
uint32_t* aIdentifiers,
|
||||
int32_t* aXs,
|
||||
int32_t* aYs,
|
||||
uint32_t* aRxs,
|
||||
uint32_t* aRys,
|
||||
float* aRotationAngles,
|
||||
float* aForces,
|
||||
uint32_t aCount,
|
||||
int32_t aModifiers,
|
||||
bool aIgnoreRootScrollFrame,
|
||||
bool aToWindow,
|
||||
bool* aPreventDefault);
|
||||
|
||||
|
||||
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
|
||||
};
|
||||
|
||||
|
@ -839,18 +839,18 @@ BrowserElementChild.prototype = {
|
||||
let json = data.json;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
utils.sendMouseEvent(json.type, json.x, json.y, json.button,
|
||||
json.clickCount, json.modifiers);
|
||||
utils.sendMouseEventToWindow(json.type, json.x, json.y, json.button,
|
||||
json.clickCount, json.modifiers);
|
||||
},
|
||||
|
||||
_recvSendTouchEvent: function(data) {
|
||||
let json = data.json;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
utils.sendTouchEvent(json.type, json.identifiers, json.touchesX,
|
||||
json.touchesY, json.radiisX, json.radiisY,
|
||||
json.rotationAngles, json.forces, json.count,
|
||||
json.modifiers);
|
||||
utils.sendTouchEventToWindow(json.type, json.identifiers, json.touchesX,
|
||||
json.touchesY, json.radiisX, json.radiisY,
|
||||
json.rotationAngles, json.forces, json.count,
|
||||
json.modifiers);
|
||||
},
|
||||
|
||||
_recvCanGoBack: function(data) {
|
||||
|
@ -43,7 +43,7 @@ interface nsIDOMEventTarget;
|
||||
interface nsIRunnable;
|
||||
interface nsICompositionStringSynthesizer;
|
||||
|
||||
[scriptable, uuid(3772df78-905f-40cf-952f-e4954c63d0ec)]
|
||||
[scriptable, uuid(3d9bf70c-5b83-11e3-9090-3c970e9f4238)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -313,6 +313,21 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
[optional] in float aPressure,
|
||||
[optional] in unsigned short aInputSourceArg);
|
||||
|
||||
/** The same as sendTouchEvent but ensures that the event is dispatched to
|
||||
* this DOM window or one of its children.
|
||||
*/
|
||||
boolean sendTouchEventToWindow(in AString aType,
|
||||
[array, size_is(count)] in uint32_t aIdentifiers,
|
||||
[array, size_is(count)] in int32_t aXs,
|
||||
[array, size_is(count)] in int32_t aYs,
|
||||
[array, size_is(count)] in uint32_t aRxs,
|
||||
[array, size_is(count)] in uint32_t aRys,
|
||||
[array, size_is(count)] in float aRotationAngles,
|
||||
[array, size_is(count)] in float aForces,
|
||||
in uint32_t count,
|
||||
in long aModifiers,
|
||||
[optional] in boolean aIgnoreRootScrollFrame);
|
||||
|
||||
/** Synthesize a wheel event for a window. The event types supported is only
|
||||
* wheel.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user