Bug 1124452 - Set a displayport for the root scroll frame of the root document in the chrome process. r=kats,tn

--HG--
extra : rebase_source : 08f10c1c81888d1ce4164f8609aa86fd3c93a4f8
This commit is contained in:
Botond Ballo 2015-01-28 13:25:53 -05:00
Родитель 0bbcf4d17c
Коммит 88c75539b0
2 изменённых файлов: 34 добавлений и 0 удалений

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

@ -9,7 +9,10 @@
#include "base/message_loop.h" // for MessageLoop
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
using namespace mozilla;
using namespace mozilla::layers;
@ -21,6 +24,35 @@ ChromeProcessController::ChromeProcessController(nsIWidget* aWidget)
{
// Otherwise we're initializing mUILoop incorrectly.
MOZ_ASSERT(NS_IsMainThread());
mUILoop->PostTask(
FROM_HERE,
NewRunnableMethod(this, &ChromeProcessController::InitializeRoot));
}
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).
nsView* view = nsView::GetViewFor(mWidget);
MOZ_ASSERT(view);
nsIPresShell* presShell = view->GetPresShell();
MOZ_ASSERT(presShell);
MOZ_ASSERT(presShell->GetDocument());
nsIContent* content = presShell->GetDocument()->GetDocumentElement();
MOZ_ASSERT(content);
uint32_t presShellId;
FrameMetrics::ViewID viewId;
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(content, &presShellId, &viewId)) {
nsLayoutUtils::SetDisplayPortMargins(content, presShell, ScreenMargin(), 0,
nsLayoutUtils::RepaintMode::DoNotRepaint);
}
}
void

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

@ -49,6 +49,8 @@ public:
private:
nsCOMPtr<nsIWidget> mWidget;
MessageLoop* mUILoop;
void InitializeRoot();
};
} // namespace layers