Commit d76d74ec authored by Tatiana Meshkova's avatar Tatiana Meshkova

Touch listener / scroll, double block moved to external component

parent 14aada96
......@@ -49,6 +49,7 @@ fi
AC_SUBST(SDK_DIR)
AC_SUBST(IDL_DIR)
# Required flags
CXXFLAGS="$CXXFLAGS -include mozilla-config.h -std=gnu++0x -fno-rtti -fvisibility=hidden "
# random warnings hide
......
This diff is collapsed.
......@@ -12,6 +12,7 @@
#include "nsIDOMEventListener.h"
#include "nsIEmbedAppService.h"
#include "nsIDOMWindow.h"
#include "gfxRect.h"
#define MOZ_DOMTitleChanged "DOMTitleChanged"
#define MOZ_DOMContentLoaded "DOMContentLoaded"
......@@ -24,7 +25,8 @@
#define MOZ_pagehide "pagehide"
#define MOZ_DOMMetaAdded "DOMMetaAdded"
class EmbedTouchListener : public nsIDOMEventListener
class EmbedTouchListener : public nsIDOMEventListener,
public mozilla::layers::GeckoContentController
{
public:
EmbedTouchListener(nsIDOMWindow* aWin);
......@@ -33,10 +35,34 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
virtual void RequestContentRepaint(const mozilla::layers::FrameMetrics&);
virtual void HandleDoubleTap(const nsIntPoint&);
virtual void HandleSingleTap(const nsIntPoint&);
virtual void HandleLongTap(const nsIntPoint&);
virtual void SendAsyncScrollDOMEvent(const mozilla::gfx::Rect&, const mozilla::gfx::Size&);
nsCOMPtr<nsIDOMWindow> DOMWindow;
private:
void AnyElementFromPoint(nsIDOMWindow* aWindow, double aX, double aY, nsIDOMElement* *aElem);
bool ShouldZoomToElement(nsIDOMElement* aElement);
void ZoomToElement(nsIDOMElement* aElement,
int aClickY = -1,
bool aCanZoomOut = true,
bool aCanZoomIn = true);
mozilla::gfx::Rect GetBoundingContentRect(nsIDOMElement* aElement);
bool IsRectZoomedIn(mozilla::gfx::Rect aRect, mozilla::gfx::Rect aViewport);
void ScrollToFocusedInput(bool aAllowZoom);
nsresult GetFocusedInput(nsIDOMElement* *aElement, bool aOnlyInputElements = false);
nsCOMPtr<nsIEmbedAppService> mService;
int mWindowCounter;
mozilla::gfx::Rect mContentRect;
mozilla::gfx::Size mScrollSize;
bool mGotViewPortUpdate;
mozilla::gfx::Rect mViewport;
mozilla::gfx::Rect mCssCompositedRect;
mozilla::gfx::Rect mCssPageRect;
uint32_t mTopWinid;
bool mHadResizeSinceLastFrameUpdate;
};
#endif /*EmbedTouchListener_H_*/
......@@ -54,6 +54,10 @@ EmbedTouchManager::Init()
"domwindowopened",
true);
NS_ENSURE_SUCCESS(rv, rv);
rv = observerService->AddObserver(this,
"embedliteviewcreated",
true);
NS_ENSURE_SUCCESS(rv, rv);
rv = observerService->AddObserver(this,
"domwindowclosed",
true);
......@@ -72,7 +76,7 @@ EmbedTouchManager::Observe(nsISupports *aSubject,
const PRUnichar *aData)
{
nsresult rv;
if (!strcmp(aTopic, "domwindowopened")) {
if (!strcmp(aTopic, "embedliteviewcreated")) {
nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(aSubject, &rv);
NS_ENSURE_SUCCESS(rv, NS_OK);
WindowCreated(win);
......@@ -101,6 +105,10 @@ EmbedTouchManager::WindowCreated(nsIDOMWindow* aWin)
if (!mService) {
mService = do_GetService("@mozilla.org/embedlite-app-service;1");
}
uint32_t id = 0;
mService->GetIDByWindow(aWin, &id);
LOGT("id for window: %u", id);
mService->AddContentListener(id, listener);
}
void
......@@ -121,6 +129,9 @@ EmbedTouchManager::WindowDestroyed(nsIDOMWindow* aWin)
}
mArray.RemoveObjectAt(i);
mWindowCounter--;
uint32_t id = 0;
mService->GetIDByWindow(aWin, &id);
mService->AddContentListener(id, listener);
if (!mWindowCounter) {
mService = nullptr;
}
......
......@@ -15,7 +15,7 @@
#include "nsCOMArray.h"
class EmbedTouchManager : public nsIObserver,
public nsSupportsWeakReference
public nsSupportsWeakReference
{
public:
EmbedTouchManager();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment