Bug 1178847 - Move the code from ChromeProcessController::InitializeRoot to APZCCallbackHelper so it can be reused in the child process. r=botond

This commit is contained in:
Kartikaya Gupta
2015-07-21 10:51:22 -04:00
parent b539b64f35
commit ebde386fe9
3 changed files with 35 additions and 26 deletions

View File

@@ -38,32 +38,7 @@ ChromeProcessController::ChromeProcessController(nsIWidget* aWidget,
void
ChromeProcessController::InitializeRoot()
{
// Create a view-id and set a zero-margin displayport for the root element
// of the root document in the chrome process. This ensures that the scroll
// frame for this element gets an APZC, which in turn ensures that all content
// in the chrome processes is covered by an APZC.
// The displayport is zero-margin because this element is generally not
// actually scrollable (if it is, APZC will set proper margins when it's
// scrolled).
nsIPresShell* presShell = GetPresShell();
if (!presShell) {
return;
}
MOZ_ASSERT(presShell->GetDocument());
nsIContent* content = presShell->GetDocument()->GetDocumentElement();
if (!content) {
return;
}
uint32_t presShellId;
FrameMetrics::ViewID viewId;
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(content, &presShellId, &viewId)) {
// Note that the base rect that goes with these margins is set in
// nsRootBoxFrame::BuildDisplayList.
nsLayoutUtils::SetDisplayPortMargins(content, presShell, ScreenMargin(), 0,
nsLayoutUtils::RepaintMode::DoNotRepaint);
}
APZCCallbackHelper::InitializeRootDisplayport(GetPresShell());
}
void