Skip to content

Commit

Permalink
Fix zoom-to-rect upon double tap
Browse files Browse the repository at this point in the history
  • Loading branch information
rojkov committed Feb 6, 2014
1 parent 29d2d9b commit 36ad22a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.cpp
Expand Up @@ -31,6 +31,9 @@
#include "EmbedLiteAppService.h"
#include "nsIWidgetListener.h"

#include "APZCCallbackHelper.h"
#include "mozilla/dom/Element.h"

using namespace mozilla::layers;
using namespace mozilla::widget;

Expand Down Expand Up @@ -920,6 +923,15 @@ EmbedLiteViewThreadChild::OnUpdateDisplayPort()
return NS_OK;
}

bool
EmbedLiteViewThreadChild::GetScrollIdentifiers(uint32_t *aPresShellIdOut, mozilla::layers::FrameMetrics::ViewID *aViewIdOut)
{
nsCOMPtr<nsIDOMDocument> domDoc;
mWebNavigation->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
return APZCCallbackHelper::GetScrollIdentifiers(doc->GetDocumentElement(), aPresShellIdOut, aViewIdOut);
}

} // namespace embedlite
} // namespace mozilla

5 changes: 5 additions & 0 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.h
Expand Up @@ -56,6 +56,11 @@ class EmbedLiteViewThreadChild : public PEmbedLiteViewChild,
uint32_t GetID() { return mId; }
gfxSize GetGLViewSize();

/**
* This method is used by EmbedLiteAppService::ZoomToRect() only.
*/
bool GetScrollIdentifiers(uint32_t *aPresShellId, mozilla::layers::FrameMetrics::ViewID *aViewId);

virtual bool RecvAsyncMessage(const nsString& aMessage,
const nsString& aData);

Expand Down
8 changes: 7 additions & 1 deletion embedding/embedlite/modules/EmbedLiteAppService.cpp
Expand Up @@ -276,7 +276,13 @@ EmbedLiteAppService::ZoomToRect(uint32_t aWinId, float aX, float aY, float aWidt
{
EmbedLiteViewThreadChild* view = sGetViewById(aWinId);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
view->SendZoomToRect(0, 0, CSSRect(aX, aY, aWidth, aHeight));

uint32_t presShellId;
mozilla::layers::FrameMetrics::ViewID viewId;
if (view->GetScrollIdentifiers(&presShellId, &viewId)) {
view->SendZoomToRect(presShellId, viewId, CSSRect(aX, aY, aWidth, aHeight));
}

return NS_OK;
}

Expand Down

0 comments on commit 36ad22a

Please sign in to comment.