Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats

This commit is contained in:
Randall Barker 2016-01-19 17:44:44 -08:00
Родитель e1823cfe72
Коммит 45a15ccb02
11 изменённых файлов: 55 добавлений и 11 удалений

Просмотреть файл

@ -420,7 +420,7 @@ parent:
* Instructs the TabParent to forward a request to zoom to a rect given in
* CSS pixels. This rect is relative to the document.
*/
ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect);
ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect, uint32_t aFlags);
/**
* We know for sure that content has either preventDefaulted or not

Просмотреть файл

@ -1688,7 +1688,7 @@ TabChild::RecvHandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifier
ViewID viewId;
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
document->GetDocumentElement(), &presShellId, &viewId)) {
SendZoomToRect(presShellId, viewId, zoomToRect);
SendZoomToRect(presShellId, viewId, zoomToRect, DEFAULT_BEHAVIOR);
}
return true;

Просмотреть файл

@ -2798,10 +2798,11 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
bool
TabParent::RecvZoomToRect(const uint32_t& aPresShellId,
const ViewID& aViewId,
const CSSRect& aRect)
const CSSRect& aRect,
const uint32_t& aFlags)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->ZoomToRect(aPresShellId, aViewId, aRect);
rfp->ZoomToRect(aPresShellId, aViewId, aRect, aFlags);
}
return true;
}

Просмотреть файл

@ -299,7 +299,8 @@ public:
virtual bool RecvZoomToRect(const uint32_t& aPresShellId,
const ViewID& aViewId,
const CSSRect& aRect) override;
const CSSRect& aRect,
const uint32_t& aFlags) override;
virtual bool
RecvUpdateZoomConstraints(const uint32_t& aPresShellId,

Просмотреть файл

@ -506,11 +506,12 @@ RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void
RenderFrameParent::ZoomToRect(uint32_t aPresShellId, ViewID aViewId,
const CSSRect& aRect)
const CSSRect& aRect,
const uint32_t aFlags)
{
if (GetApzcTreeManager()) {
GetApzcTreeManager()->ZoomToRect(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
aRect);
aRect, aFlags);
}
}

Просмотреть файл

@ -79,7 +79,7 @@ public:
void OwnerContentChanged(nsIContent* aContent);
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect);
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect, const uint32_t aFlags);
void ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,

Просмотреть файл

@ -1424,5 +1424,18 @@ PuppetWidget::SetCandidateWindowForPlugin(int32_t aX, int32_t aY)
mTabChild->SendSetCandidateWindowForPlugin(aX, aY);
}
void
PuppetWidget::ZoomToRect(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags)
{
if (!mTabChild) {
return;
}
mTabChild->SendZoomToRect(aPresShellId, aViewId, aRect, aFlags);
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -40,6 +40,7 @@ class PuppetWidget : public nsBaseWidget
typedef mozilla::dom::TabChild TabChild;
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef nsBaseWidget Base;
typedef mozilla::CSSRect CSSRect;
// The width and height of the "widget" are clamped to this.
static const size_t kMaxDimension;
@ -254,6 +255,10 @@ public:
virtual void SetCandidateWindowForPlugin(int32_t aX, int32_t aY) override;
virtual void ZoomToRect(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags) override;
protected:
virtual nsresult NotifyIMEInternal(
const IMENotification& aIMENotification) override;

Просмотреть файл

@ -1803,6 +1803,19 @@ nsBaseWidget::GetTextEventDispatcher()
return mTextEventDispatcher;
}
void
nsBaseWidget::ZoomToRect(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags)
{
if (!mCompositorParent || !mAPZC) {
return;
}
uint64_t layerId = mCompositorParent->RootLayerTreeId();
mAPZC->ZoomToRect(ScrollableLayerGuid(layerId, aPresShellId, aViewId), aRect, aFlags);
}
#ifdef ACCESSIBILITY
a11y::Accessible*

Просмотреть файл

@ -100,6 +100,7 @@ protected:
typedef mozilla::layers::APZEventState APZEventState;
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
typedef mozilla::CSSIntRect CSSIntRect;
typedef mozilla::CSSRect CSSRect;
typedef mozilla::ScreenRotation ScreenRotation;
virtual ~nsBaseWidget();
@ -251,7 +252,10 @@ public:
virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override;
virtual void SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) override;
NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() override final;
virtual void ZoomToRect(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags) override;
// Helper function for dispatching events which are not processed by APZ,
// but need to be transformed by APZ.
nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;

Просмотреть файл

@ -133,8 +133,8 @@ typedef void* nsNativeWidget;
#endif
#define NS_IWIDGET_IID \
{ 0x73c0a475, 0x450f, 0x4202, \
{ 0xab, 0xb4, 0x62, 0xf8, 0x9d, 0xbe, 0xf7, 0x9a } }
{ 0x6dc8ce1f, 0xbb55, 0x47c1, \
{ 0xa1, 0x6f, 0x4e, 0x12, 0x37, 0xa1, 0xc2, 0xf4 } }
/*
* Window shadow styles
@ -350,6 +350,7 @@ class nsIWidget : public nsISupports {
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
typedef mozilla::ScreenIntPoint ScreenIntPoint;
typedef mozilla::DesktopIntRect DesktopIntRect;
typedef mozilla::CSSRect CSSRect;
// Used in UpdateThemeGeometries.
struct ThemeGeometry {
@ -2069,6 +2070,11 @@ public:
*/
NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() = 0;
virtual void ZoomToRect(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const CSSRect& aRect,
const uint32_t& aFlags) = 0;
protected:
/**
* Like GetDefaultScale, but taking into account only the system settings