Bug 915213 - Add a apzc hit test helper for metrofx. r=kats
authorJim Mathies <jmathies@mozilla.com>
Tue, 24 Sep 2013 16:17:26 -0500
changeset 162316 379b43febfc647e9edc30578e103ecc05e4b8507
parent 162315 401f078bbfe8808240da5b628c93cea38fc957fd
child 162317 2218a8908d3e227ed4c380ea33320d301a876c6f
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs915213
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 915213 - Add a apzc hit test helper for metrofx. r=kats
gfx/layers/composite/APZCTreeManager.cpp
gfx/layers/composite/APZCTreeManager.h
--- a/gfx/layers/composite/APZCTreeManager.cpp
+++ b/gfx/layers/composite/APZCTreeManager.cpp
@@ -566,16 +566,32 @@ APZCTreeManager::HandleOverscroll(AsyncP
   // Convert start and end points to parent's transformed screen coordinates.
   GetInputTransforms(parent, transformToApzc, transformToScreen);
   ApplyTransform(&aStartPoint, transformToApzc);
   ApplyTransform(&aEndPoint, transformToApzc);
 
   parent->AttemptScroll(aStartPoint, aEndPoint);
 }
 
+bool
+APZCTreeManager::HitTestAPZC(const ScreenPoint& aPoint)
+{
+  MonitorAutoLock lock(mTreeLock);
+  nsRefPtr<AsyncPanZoomController> target;
+  // The root may have siblings, so check those too
+  gfxPoint point(aPoint.x, aPoint.y);
+  for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) {
+    target = GetAPZCAtPoint(apzc, point);
+    if (target) {
+      return true;
+    }
+  }
+  return false;
+}
+
 already_AddRefed<AsyncPanZoomController>
 APZCTreeManager::GetTargetAPZC(const ScrollableLayerGuid& aGuid)
 {
   MonitorAutoLock lock(mTreeLock);
   nsRefPtr<AsyncPanZoomController> target;
   // The root may have siblings, check those too
   for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) {
     target = FindTargetAPZC(apzc, aGuid);
--- a/gfx/layers/composite/APZCTreeManager.h
+++ b/gfx/layers/composite/APZCTreeManager.h
@@ -244,16 +244,21 @@ public:
    * tree back to empty. This function may be called multiple times during the
    * lifetime of this APZCTreeManager, but it must always be called at least once
    * when this APZCTreeManager is no longer needed. Failing to call this function
    * may prevent objects from being freed properly.
    */
   void ClearTree();
 
   /**
+   * Tests if a screen point intersect an apz in the tree.
+   */
+  bool HitTestAPZC(const ScreenPoint& aPoint);
+
+  /**
    * Set the dpi value used by all AsyncPanZoomControllers.
    * DPI defaults to 72 if not set using SetDPI() at any point.
    */
   static void SetDPI(float aDpiValue) { sDPI = aDpiValue; }
 
   /**
    * Returns the current dpi value in use.
    */