Create a common chrome-process GeckoContentController. (bug 1110540 part 2, r=kats)

This commit is contained in:
David Anderson 2014-12-15 01:49:48 -08:00
parent f1639d0bdf
commit f13b493c59
6 changed files with 90 additions and 52 deletions

View File

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/ChromeProcessController.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "nsLayoutUtils.h"
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::widget;
void
ChromeProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
if (targetContent) {
FrameMetrics metrics = aFrameMetrics;
APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
}
}
void
ChromeProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
void
ChromeProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}

View File

@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_ChromeProcessController_h
#define mozilla_layers_ChromeProcessController_h
#include "mozilla/layers/GeckoContentController.h"
namespace mozilla {
namespace layers {
class CompositorParent;
// A ChromeProcessController is attached to the root of a compositor's layer
// tree.
class ChromeProcessController : public mozilla::layers::GeckoContentController
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
public:
// GeckoContentController interface
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) MOZ_OVERRIDE {}
virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
};
} // namespace layers
} // namespace mozilla
#endif /* mozilla_layers_ChromeProcessController_h */

View File

@ -113,6 +113,7 @@ EXPORTS.mozilla.layers += [
'apz/testutil/APZTestData.h',
'apz/util/ActiveElementManager.h',
'apz/util/APZCCallbackHelper.h',
'apz/util/ChromeProcessController.h',
'AtomicRefCountedWithFinalize.h',
'AxisPhysicsModel.h',
'AxisPhysicsMSDModel.h',
@ -244,6 +245,7 @@ UNIFIED_SOURCES += [
'apz/testutil/APZTestData.cpp',
'apz/util/ActiveElementManager.cpp',
'apz/util/APZCCallbackHelper.cpp',
'apz/util/ChromeProcessController.cpp',
'AxisPhysicsModel.cpp',
'AxisPhysicsMSDModel.cpp',
'basic/BasicCanvasLayer.cpp',

View File

@ -549,7 +549,6 @@ protected:
}
void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
void DoRemoteComposition(const nsIntRect& aRenderRect);

View File

@ -84,7 +84,7 @@
#include "GeckoProfiler.h"
#include "nsIDOMWheelEvent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/ChromeProcessController.h"
#include "nsLayoutUtils.h"
#include "InputData.h"
#include "VibrancyManager.h"
@ -393,48 +393,6 @@ protected:
GLuint mQuadVBO;
};
class APZCTMController : public mozilla::layers::GeckoContentController
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
public:
// GeckoContentController interface
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics)
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
if (targetContent) {
FrameMetrics metrics = aFrameMetrics;
APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
}
}
virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) MOZ_OVERRIDE
{
APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}
virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) MOZ_OVERRIDE {}
virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
};
} // unnamed namespace
#pragma mark -
@ -1884,13 +1842,6 @@ nsChildView::CreateCompositor()
}
}
already_AddRefed<GeckoContentController>
nsChildView::CreateRootContentController()
{
nsRefPtr<APZCTMController> controller = new APZCTMController();
return controller.forget();
}
void
nsChildView::ConfigureAPZCTreeManager()
{

View File

@ -44,6 +44,7 @@
#include "GLConsts.h"
#include "mozilla/unused.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/ChromeProcessController.h"
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
@ -915,7 +916,8 @@ void nsBaseWidget::CreateCompositor()
already_AddRefed<GeckoContentController>
nsBaseWidget::CreateRootContentController()
{
return nullptr;
nsRefPtr<GeckoContentController> controller = new ChromeProcessController();
return controller.forget();
}
void nsBaseWidget::ConfigureAPZCTreeManager()