Bug 937688 - Make UpdateCompositionBounds affect all of the root APZCs for the layers id. r=botond

This commit is contained in:
Kartikaya Gupta 2013-11-14 12:35:41 -05:00
Родитель 9e421b8c64
Коммит 86a26abf20
2 изменённых файлов: 26 добавлений и 21 удалений

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

@ -508,9 +508,13 @@ void
APZCTreeManager::UpdateRootCompositionBounds(const uint64_t& aLayersId, APZCTreeManager::UpdateRootCompositionBounds(const uint64_t& aLayersId,
const ScreenIntRect& aCompositionBounds) const ScreenIntRect& aCompositionBounds)
{ {
nsRefPtr<AsyncPanZoomController> apzc = GetRootAPZCFor(aLayersId); // There can be multiple root APZCs for a given layers id (e.g. tabs in
if (apzc) { // a single-process setup) and in such a case we probably want to notify
apzc->UpdateCompositionBounds(aCompositionBounds); // all of them.
nsTArray< nsRefPtr<AsyncPanZoomController> > rootApzcs;
GetRootAPZCsFor(aLayersId, &rootApzcs);
for (size_t i = 0; i < rootApzcs.Length(); i++) {
rootApzcs[i]->UpdateCompositionBounds(aCompositionBounds);
} }
} }
@ -651,19 +655,15 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint)
return target.forget(); return target.forget();
} }
already_AddRefed<AsyncPanZoomController> void
APZCTreeManager::GetRootAPZCFor(const uint64_t& aLayersId) APZCTreeManager::GetRootAPZCsFor(const uint64_t& aLayersId,
nsTArray< nsRefPtr<AsyncPanZoomController> >* aOutRootApzcs)
{ {
MonitorAutoLock lock(mTreeLock); MonitorAutoLock lock(mTreeLock);
nsRefPtr<AsyncPanZoomController> target;
// The root may have siblings, check those too // The root may have siblings, check those too
for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) { for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) {
target = FindRootAPZC(apzc, aLayersId); FindRootAPZCs(apzc, aLayersId, aOutRootApzcs);
if (target) {
break;
}
} }
return target.forget();
} }
AsyncPanZoomController* AsyncPanZoomController*
@ -742,21 +742,23 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& a
return nullptr; return nullptr;
} }
AsyncPanZoomController* void
APZCTreeManager::FindRootAPZC(AsyncPanZoomController* aApzc, const uint64_t& aLayersId) APZCTreeManager::FindRootAPZCs(AsyncPanZoomController* aApzc,
const uint64_t& aLayersId,
nsTArray< nsRefPtr<AsyncPanZoomController> >* aOutRootApzcs)
{ {
mTreeLock.AssertCurrentThreadOwns(); mTreeLock.AssertCurrentThreadOwns();
if (aApzc->IsRootForLayersId(aLayersId)) { if (aApzc->IsRootForLayersId(aLayersId)) {
return aApzc; aOutRootApzcs->AppendElement(aApzc);
// If this APZC is a root for this layers id then we know nothing else
// in the subtree rooted here will match so we can early-exit
return;
} }
for (AsyncPanZoomController* child = aApzc->GetLastChild(); child; child = child->GetPrevSibling()) { for (AsyncPanZoomController* child = aApzc->GetLastChild(); child; child = child->GetPrevSibling()) {
AsyncPanZoomController* match = FindRootAPZC(child, aLayersId); FindRootAPZCs(child, aLayersId, aOutRootApzcs);
if (match) {
return match;
}
} }
return nullptr;
} }
/* This function sets the aTransformToApzcOut and aTransformToGeckoOut out-parameters /* This function sets the aTransformToApzcOut and aTransformToGeckoOut out-parameters

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

@ -239,14 +239,17 @@ public:
*/ */
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScrollableLayerGuid& aGuid); already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScrollableLayerGuid& aGuid);
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint); already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint);
already_AddRefed<AsyncPanZoomController> GetRootAPZCFor(const uint64_t& aLayersId); void GetRootAPZCsFor(const uint64_t& aLayersId,
nsTArray< nsRefPtr<AsyncPanZoomController> >* aOutRootApzcs);
void GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix& aTransformToApzcOut, void GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix& aTransformToApzcOut,
gfx3DMatrix& aTransformToGeckoOut); gfx3DMatrix& aTransformToGeckoOut);
private: private:
/* Helpers */ /* Helpers */
AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableLayerGuid& aGuid); AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableLayerGuid& aGuid);
AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint); AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
AsyncPanZoomController* FindRootAPZC(AsyncPanZoomController* aApzc, const uint64_t& aLayersId); void FindRootAPZCs(AsyncPanZoomController* aApzc,
const uint64_t& aLayersId,
nsTArray< nsRefPtr<AsyncPanZoomController> >* aOutRootApzcs);
already_AddRefed<AsyncPanZoomController> CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2); already_AddRefed<AsyncPanZoomController> CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
already_AddRefed<AsyncPanZoomController> RootAPZCForLayersId(AsyncPanZoomController* aApzc); already_AddRefed<AsyncPanZoomController> RootAPZCForLayersId(AsyncPanZoomController* aApzc);
already_AddRefed<AsyncPanZoomController> GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint); already_AddRefed<AsyncPanZoomController> GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);