Bug 937688 - Add a helper to APZCCallbackHelper to obtain the presShellId and viewId. r=botond

This commit is contained in:
Kartikaya Gupta 2013-11-13 13:20:29 -05:00
parent 8b6dd7fcb5
commit bc389873b6
2 changed files with 18 additions and 0 deletions

View File

@ -133,5 +133,17 @@ APZCCallbackHelper::GetDOMWindowUtils(nsIContent* aContent)
return utils.forget();
}
bool
APZCCallbackHelper::GetScrollIdentifiers(nsIContent* aContent,
uint32_t* aPresShellIdOut,
FrameMetrics::ViewID* aViewIdOut)
{
if (!nsLayoutUtils::FindIDFor(aContent, aViewIdOut)) {
return false;
}
nsCOMPtr<nsIDOMWindowUtils> utils = GetDOMWindowUtils(aContent);
return utils && (utils->GetPresShellId(aPresShellIdOut) == NS_OK);
}
}
}

View File

@ -48,6 +48,12 @@ public:
/* Get the DOMWindowUtils for the window corresponding to the givent content
element. This might be an iframe inside the tab, for instance. */
static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIContent* aContent);
/* Get the presShellId and view ID for the given content element, if they can be
found. Returns false if the values could not be found, true if they could. */
static bool GetScrollIdentifiers(nsIContent* aContent,
uint32_t* aPresShellIdOut,
FrameMetrics::ViewID* aViewIdOut);
};
}