mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959242 - Make mozbrowser's sendTouchEvent work with APZC enabled iframes. r=smaug,fabrice. f=kats
This commit is contained in:
parent
1f44ee0ca8
commit
1bc4cd5da1
@ -586,18 +586,33 @@ BrowserElementParent.prototype = {
|
||||
_sendTouchEvent: function(type, identifiers, touchesX, touchesY,
|
||||
radiisX, radiisY, rotationAngles, forces,
|
||||
count, modifiers) {
|
||||
this._sendAsyncMsg("send-touch-event", {
|
||||
"type": type,
|
||||
"identifiers": identifiers,
|
||||
"touchesX": touchesX,
|
||||
"touchesY": touchesY,
|
||||
"radiisX": radiisX,
|
||||
"radiisY": radiisY,
|
||||
"rotationAngles": rotationAngles,
|
||||
"forces": forces,
|
||||
"count": count,
|
||||
"modifiers": modifiers
|
||||
});
|
||||
|
||||
let tabParent = this._frameLoader.tabParent;
|
||||
if (tabParent && tabParent.useAsyncPanZoom) {
|
||||
tabParent.injectTouchEvent(type,
|
||||
identifiers,
|
||||
touchesX,
|
||||
touchesY,
|
||||
radiisX,
|
||||
radiisY,
|
||||
rotationAngles,
|
||||
forces,
|
||||
count,
|
||||
modifiers);
|
||||
} else {
|
||||
this._sendAsyncMsg("send-touch-event", {
|
||||
"type": type,
|
||||
"identifiers": identifiers,
|
||||
"touchesX": touchesX,
|
||||
"touchesY": touchesY,
|
||||
"radiisX": radiisX,
|
||||
"radiisY": radiisY,
|
||||
"rotationAngles": rotationAngles,
|
||||
"forces": forces,
|
||||
"count": count,
|
||||
"modifiers": modifiers
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_goBack: function() {
|
||||
|
@ -5,8 +5,19 @@
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
// Sole purpose is to be able to identify the concrete class nsTabParent
|
||||
[uuid(95c7c50b-6677-456f-9f1e-885e1cc272dc)]
|
||||
[scriptable, uuid(c402d6c2-837d-11e3-b47c-3c970e9f4238)]
|
||||
interface nsITabParent : nsISupports
|
||||
{
|
||||
void injectTouchEvent(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);
|
||||
|
||||
readonly attribute boolean useAsyncPanZoom;
|
||||
};
|
||||
|
@ -1897,5 +1897,49 @@ TabParent::GetLoadContext()
|
||||
return loadContext.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::InjectTouchEvent(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)
|
||||
{
|
||||
uint32_t msg;
|
||||
nsContentUtils::GetEventIdAndAtom(aType, NS_TOUCH_EVENT, &msg);
|
||||
if (msg != NS_TOUCH_START && msg != NS_TOUCH_MOVE &&
|
||||
msg != NS_TOUCH_END && msg != NS_TOUCH_CANCEL) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
WidgetTouchEvent event(true, msg, nullptr);
|
||||
event.modifiers = aModifiers;
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
event.touches.SetCapacity(aCount);
|
||||
for (uint32_t i = 0; i < aCount; ++i) {
|
||||
nsRefPtr<Touch> t = new Touch(aIdentifiers[i],
|
||||
nsIntPoint(aXs[i], aYs[i]),
|
||||
nsIntPoint(aRxs[i], aRys[i]),
|
||||
aRotationAngles[i],
|
||||
aForces[i]);
|
||||
event.touches.AppendElement(t);
|
||||
}
|
||||
|
||||
SendRealTouchEvent(event);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetUseAsyncPanZoom(bool* useAsyncPanZoom)
|
||||
{
|
||||
*useAsyncPanZoom = UseAsyncPanZoom();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace tabs
|
||||
} // namespace mozilla
|
||||
|
@ -59,6 +59,9 @@ class TabParent : public PBrowserParent
|
||||
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
|
||||
|
||||
public:
|
||||
// nsITabParent
|
||||
NS_DECL_NSITABPARENT
|
||||
|
||||
TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags);
|
||||
virtual ~TabParent();
|
||||
Element* GetOwnerElement() const { return mFrameElement; }
|
||||
|
Loading…
Reference in New Issue
Block a user