зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
6ea0227583
Коммит
1da529b8b9
|
@ -266,6 +266,36 @@ APZCCallbackHelper::GetOrCreateScrollIdentifiers(nsIContent* aContent,
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
APZCCallbackHelper::InitializeRootDisplayport(nsIPresShell* aPresShell)
|
||||
{
|
||||
// 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).
|
||||
if (!aPresShell) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aPresShell->GetDocument());
|
||||
nsIContent* content = aPresShell->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, aPresShell, ScreenMargin(), 0,
|
||||
nsLayoutUtils::RepaintMode::DoNotRepaint);
|
||||
}
|
||||
}
|
||||
|
||||
class FlingSnapEvent : public nsRunnable
|
||||
{
|
||||
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
|
||||
|
|
|
@ -68,6 +68,10 @@ public:
|
|||
uint32_t* aPresShellIdOut,
|
||||
FrameMetrics::ViewID* aViewIdOut);
|
||||
|
||||
/* Initialize a zero-margin displayport on the root document element of the
|
||||
given presShell. */
|
||||
static void InitializeRootDisplayport(nsIPresShell* aPresShell);
|
||||
|
||||
/* Tell layout to perform scroll snapping for the scrollable frame with the
|
||||
* given scroll id. aDestination specifies the expected landing position of
|
||||
* a current fling or scrolling animation that should be used to select
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче