зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1131695 - Extract a GetLayoutDeviceToCSSScale helper function in TabParent. r=fabrice
This commit is contained in:
Родитель
1663e96baa
Коммит
6ae0cb6aa4
|
@ -1160,23 +1160,21 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
|
|||
return SendRealMouseButtonEvent(event);
|
||||
}
|
||||
|
||||
CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint)
|
||||
LayoutDeviceToCSSScale
|
||||
TabParent::GetLayoutDeviceToCSSScale()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
|
||||
nsIDocument* doc = (content ? content->OwnerDoc() : nullptr);
|
||||
nsIPresShell* shell = (doc ? doc->GetShell() : nullptr);
|
||||
nsPresContext* ctx = (shell ? shell->GetPresContext() : nullptr);
|
||||
return LayoutDeviceToCSSScale(ctx
|
||||
? (float)ctx->AppUnitsPerDevPixel() / nsPresContext::AppUnitsPerCSSPixel()
|
||||
: 0.0f);
|
||||
}
|
||||
|
||||
if (!content || !content->OwnerDoc()) {
|
||||
return aPoint;
|
||||
}
|
||||
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
if (!doc || !doc->GetShell()) {
|
||||
return aPoint;
|
||||
}
|
||||
nsPresContext* presContext = doc->GetShell()->GetPresContext();
|
||||
|
||||
return aPoint + CSSPoint(
|
||||
presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.x),
|
||||
presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.y));
|
||||
CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint)
|
||||
{
|
||||
return aPoint + (LayoutDevicePoint(mChildProcessOffsetAtTouchStart) * GetLayoutDeviceToCSSScale());
|
||||
}
|
||||
|
||||
bool TabParent::SendHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
|
||||
|
|
|
@ -264,6 +264,7 @@ public:
|
|||
bool MapEventCoordinatesForChildProcess(mozilla::WidgetEvent* aEvent);
|
||||
void MapEventCoordinatesForChildProcess(const LayoutDeviceIntPoint& aOffset,
|
||||
mozilla::WidgetEvent* aEvent);
|
||||
LayoutDeviceToCSSScale GetLayoutDeviceToCSSScale();
|
||||
|
||||
virtual bool RecvRequestNativeKeyBindings(const mozilla::WidgetKeyboardEvent& aEvent,
|
||||
MaybeNativeKeyBinding* aBindings) MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче