mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 4290ee7475c1 (bug 864441) for compilation failures on a CLOSED TREE
This commit is contained in:
parent
8e751f3337
commit
4138b6a41f
@ -40,14 +40,6 @@ struct ViewTransform {
|
||||
gfx3DMatrix::ScalingMatrix(mScale.scale, mScale.scale, 1);
|
||||
}
|
||||
|
||||
bool operator==(const ViewTransform& rhs) const {
|
||||
return mTranslation == rhs.mTranslation && mScale == rhs.mScale;
|
||||
}
|
||||
|
||||
bool operator!=(const ViewTransform& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
LayerPoint mTranslation;
|
||||
CSSToScreenScale mScale;
|
||||
};
|
||||
|
@ -106,21 +106,6 @@ static float gYSkateSizeMultiplier = 3.5f;
|
||||
static float gXStationarySizeMultiplier = 1.5f;
|
||||
static float gYStationarySizeMultiplier = 2.5f;
|
||||
|
||||
static TimeStamp sFrameTime;
|
||||
|
||||
static TimeStamp
|
||||
GetFrameTime() {
|
||||
if (sFrameTime.IsNull()) {
|
||||
return TimeStamp::Now();
|
||||
}
|
||||
return sFrameTime;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::SetFrameTime(const TimeStamp& aTime) {
|
||||
sFrameTime = aTime;
|
||||
}
|
||||
|
||||
static void ReadAZPCPrefs()
|
||||
{
|
||||
Preferences::AddIntVarCache(&gPanRepaintInterval, "gfx.azpc.pan_repaint_interval", gPanRepaintInterval);
|
||||
@ -169,10 +154,10 @@ AsyncPanZoomController::AsyncPanZoomController(GeckoContentController* aGeckoCon
|
||||
mMinZoom(MIN_ZOOM),
|
||||
mMaxZoom(MAX_ZOOM),
|
||||
mMonitor("AsyncPanZoomController"),
|
||||
mLastSampleTime(GetFrameTime()),
|
||||
mLastSampleTime(TimeStamp::Now()),
|
||||
mState(NOTHING),
|
||||
mPreviousPaintStartTime(GetFrameTime()),
|
||||
mLastAsyncScrollTime(GetFrameTime()),
|
||||
mPreviousPaintStartTime(TimeStamp::Now()),
|
||||
mLastAsyncScrollTime(TimeStamp::Now()),
|
||||
mLastAsyncScrollOffset(0, 0),
|
||||
mCurrentAsyncScrollOffset(0, 0),
|
||||
mAsyncScrollTimeoutTask(nullptr),
|
||||
@ -778,7 +763,7 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
||||
ScrollBy(CSSPoint::FromUnknownPoint(displacement));
|
||||
ScheduleComposite();
|
||||
|
||||
TimeDuration timePaintDelta = GetFrameTime() - mPreviousPaintStartTime;
|
||||
TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
|
||||
if (timePaintDelta.ToMilliseconds() > gPanRepaintInterval) {
|
||||
RequestContentRepaint();
|
||||
}
|
||||
@ -815,7 +800,7 @@ bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
|
||||
mX.GetDisplacementForDuration(inverseResolution.scale, aDelta),
|
||||
mY.GetDisplacementForDuration(inverseResolution.scale, aDelta)
|
||||
)));
|
||||
TimeDuration timePaintDelta = GetFrameTime() - mPreviousPaintStartTime;
|
||||
TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
|
||||
if (timePaintDelta.ToMilliseconds() > gFlingRepaintInterval) {
|
||||
RequestContentRepaint();
|
||||
}
|
||||
@ -832,7 +817,10 @@ void AsyncPanZoomController::SetCompositorParent(CompositorParent* aCompositorPa
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) {
|
||||
mFrameMetrics.mScrollOffset += aOffset;
|
||||
CSSPoint newOffset = mFrameMetrics.mScrollOffset + aOffset;
|
||||
FrameMetrics metrics(mFrameMetrics);
|
||||
metrics.mScrollOffset = newOffset;
|
||||
mFrameMetrics = metrics;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ScaleWithFocus(float aZoom,
|
||||
@ -1010,7 +998,7 @@ void AsyncPanZoomController::ScheduleComposite() {
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::RequestContentRepaint() {
|
||||
mPreviousPaintStartTime = GetFrameTime();
|
||||
mPreviousPaintStartTime = TimeStamp::Now();
|
||||
|
||||
double estimatedPaintSum = 0.0;
|
||||
for (uint32_t i = 0; i < mPreviousPaintDurations.Length(); i++) {
|
||||
@ -1219,7 +1207,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aViewportFr
|
||||
}
|
||||
|
||||
mPreviousPaintDurations.AppendElement(
|
||||
GetFrameTime() - mPreviousPaintStartTime);
|
||||
TimeStamp::Now() - mPreviousPaintStartTime);
|
||||
} else {
|
||||
// No paint was requested, but we got one anyways. One possible cause of this
|
||||
// is that content could have fired a scrollTo(). In this case, we should take
|
||||
@ -1389,7 +1377,7 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||
mStartZoomToMetrics = mFrameMetrics;
|
||||
mEndZoomToMetrics.mScrollOffset = zoomToRect.TopLeft();
|
||||
|
||||
mAnimationStartTime = GetFrameTime();
|
||||
mAnimationStartTime = TimeStamp::Now();
|
||||
|
||||
ScheduleComposite();
|
||||
}
|
||||
|
@ -251,13 +251,6 @@ public:
|
||||
*/
|
||||
nsEventStatus HandleInputEvent(const InputData& aEvent);
|
||||
|
||||
/**
|
||||
* Sync panning and zooming animation using a fixed frame time.
|
||||
* This will ensure that we animate the APZC correctly with other external
|
||||
* animations to the same timestamp.
|
||||
*/
|
||||
static void SetFrameTime(const TimeStamp& aMilliseconds);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Helper method for touches beginning. Sets everything up for panning and any
|
||||
|
@ -196,12 +196,6 @@ void RgnRectMemoryAllocatorDTOR(void *priv)
|
||||
|
||||
nsresult nsRegion::InitStatic()
|
||||
{
|
||||
if (gRectPoolTlsIndex.initialized()) {
|
||||
// It's ok to call InitStatic if we called ShutdownStatic first
|
||||
MOZ_ASSERT(gRectPoolTlsIndex.get() == nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return gRectPoolTlsIndex.init() ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ LOCAL_INCLUDES = \
|
||||
GTEST_CPPSRCS = \
|
||||
TestLayers.cpp \
|
||||
TestTiledLayerBuffer.cpp \
|
||||
TestAsyncPanZoomController.cpp \
|
||||
$(NULL)
|
||||
|
||||
# Because of gkmedia on windows we wont find these
|
||||
@ -41,5 +40,4 @@ GTEST_CPPSRCS += \
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
|
||||
|
@ -1,196 +0,0 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform
|
||||
#include "mozilla/layers/AsyncPanZoomController.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/GeckoContentController.h"
|
||||
#include "Layers.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
using ::testing::_;
|
||||
|
||||
class MockContentController : public GeckoContentController {
|
||||
public:
|
||||
MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
|
||||
MOCK_METHOD1(HandleDoubleTap, void(const CSSIntPoint&));
|
||||
MOCK_METHOD1(HandleSingleTap, void(const CSSIntPoint&));
|
||||
MOCK_METHOD1(HandleLongTap, void(const CSSIntPoint&));
|
||||
MOCK_METHOD2(SendAsyncScrollDOMEvent, void(const CSSRect &aContentRect, const CSSSize &aScrollableSize));
|
||||
MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs));
|
||||
};
|
||||
|
||||
class TestContainerLayer : public ContainerLayer {
|
||||
public:
|
||||
TestContainerLayer()
|
||||
: ContainerLayer(nullptr, nullptr)
|
||||
{}
|
||||
void RemoveChild(Layer* aChild) {}
|
||||
void InsertAfter(Layer* aChild, Layer* aAfter) {}
|
||||
void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) {}
|
||||
void RepositionChild(Layer* aChild, Layer* aAfter) {}
|
||||
};
|
||||
|
||||
static
|
||||
FrameMetrics TestFrameMetrics() {
|
||||
FrameMetrics fm;
|
||||
|
||||
fm.mDisplayPort = CSSRect(0, 0, 10, 10);
|
||||
fm.mCompositionBounds = ScreenIntRect(0, 0, 10, 10);
|
||||
fm.mCriticalDisplayPort = CSSRect(0, 0, 10, 10);
|
||||
fm.mScrollableRect = CSSRect(0, 0, 100, 100);
|
||||
fm.mViewport = CSSRect(0, 0, 10, 10);
|
||||
|
||||
return fm;
|
||||
}
|
||||
|
||||
static
|
||||
void ApzcPan(AsyncPanZoomController* apzc, int& aTime, int aTouchStartY, int aTouchEndY) {
|
||||
|
||||
const int TIME_BETWEEN_TOUCH_EVENT = 100;
|
||||
const int OVERCOME_TOUCH_TOLERANCE = 100;
|
||||
MultiTouchInput mti;
|
||||
nsEventStatus status;
|
||||
|
||||
mti = MultiTouchInput(MultiTouchInput::MULTITOUCH_START, aTime);
|
||||
aTime += TIME_BETWEEN_TOUCH_EVENT;
|
||||
// Make sure the move is large enough to not be handled as a tap
|
||||
mti.mTouches.AppendElement(SingleTouchData(0, ScreenIntPoint(10, aTouchStartY+OVERCOME_TOUCH_TOLERANCE), ScreenSize(0, 0), 0, 0));
|
||||
status = apzc->HandleInputEvent(mti);
|
||||
EXPECT_EQ(status, nsEventStatus_eConsumeNoDefault);
|
||||
// APZC should be in TOUCHING state
|
||||
|
||||
mti = MultiTouchInput(MultiTouchInput::MULTITOUCH_MOVE, aTime);
|
||||
aTime += TIME_BETWEEN_TOUCH_EVENT;
|
||||
mti.mTouches.AppendElement(SingleTouchData(0, ScreenIntPoint(10, aTouchStartY), ScreenSize(0, 0), 0, 0));
|
||||
status = apzc->HandleInputEvent(mti);
|
||||
EXPECT_EQ(status, nsEventStatus_eConsumeNoDefault);
|
||||
// APZC should be in PANNING, otherwise status != ConsumeNoDefault
|
||||
|
||||
mti = MultiTouchInput(MultiTouchInput::MULTITOUCH_MOVE, aTime);
|
||||
aTime += TIME_BETWEEN_TOUCH_EVENT;
|
||||
mti.mTouches.AppendElement(SingleTouchData(0, ScreenIntPoint(10, aTouchEndY), ScreenSize(0, 0), 0, 0));
|
||||
status = apzc->HandleInputEvent(mti);
|
||||
EXPECT_EQ(status, nsEventStatus_eConsumeNoDefault);
|
||||
|
||||
mti = MultiTouchInput(MultiTouchInput::MULTITOUCH_END, aTime);
|
||||
aTime += TIME_BETWEEN_TOUCH_EVENT;
|
||||
mti.mTouches.AppendElement(SingleTouchData(0, ScreenIntPoint(10, aTouchEndY), ScreenSize(0, 0), 0, 0));
|
||||
status = apzc->HandleInputEvent(mti);
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, Constructor) {
|
||||
// RefCounted class can't live in the stack
|
||||
nsRefPtr<MockContentController> mcc = new MockContentController();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = new AsyncPanZoomController(mcc);
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, SimpleTransform) {
|
||||
TimeStamp testStartTime = TimeStamp::Now();
|
||||
// RefCounted class can't live in the stack
|
||||
nsRefPtr<MockContentController> mcc = new MockContentController();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = new AsyncPanZoomController(mcc);
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
|
||||
TestContainerLayer layer;
|
||||
ScreenPoint pointOut;
|
||||
ViewTransform viewTransformOut;
|
||||
apzc->SampleContentTransformForFrame(testStartTime, &layer, &viewTransformOut, pointOut);
|
||||
|
||||
EXPECT_EQ(pointOut, ScreenPoint());
|
||||
EXPECT_EQ(viewTransformOut, ViewTransform());
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, Pan) {
|
||||
TimeStamp testStartTime = TimeStamp::Now();
|
||||
AsyncPanZoomController::SetFrameTime(testStartTime);
|
||||
|
||||
nsRefPtr<MockContentController> mcc = new MockContentController();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = new AsyncPanZoomController(mcc);
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
|
||||
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(4);
|
||||
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
|
||||
|
||||
int time = 0;
|
||||
int touchStart = 50;
|
||||
int touchEnd = 10;
|
||||
TestContainerLayer layer;
|
||||
ScreenPoint pointOut;
|
||||
ViewTransform viewTransformOut;
|
||||
|
||||
// Pan down
|
||||
ApzcPan(apzc, time, touchStart, touchEnd);
|
||||
apzc->SampleContentTransformForFrame(testStartTime, &layer, &viewTransformOut, pointOut);
|
||||
EXPECT_EQ(pointOut, ScreenPoint(0, -(touchEnd-touchStart)));
|
||||
EXPECT_NE(viewTransformOut, ViewTransform());
|
||||
|
||||
// Pan back
|
||||
ApzcPan(apzc, time, touchEnd, touchStart);
|
||||
apzc->SampleContentTransformForFrame(testStartTime, &layer, &viewTransformOut, pointOut);
|
||||
EXPECT_EQ(pointOut, ScreenPoint());
|
||||
EXPECT_EQ(viewTransformOut, ViewTransform());
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, Fling) {
|
||||
TimeStamp testStartTime = TimeStamp::Now();
|
||||
AsyncPanZoomController::SetFrameTime(testStartTime);
|
||||
|
||||
nsRefPtr<MockContentController> mcc = new MockContentController();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = new AsyncPanZoomController(mcc);
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
|
||||
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(2);
|
||||
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
|
||||
|
||||
int time = 0;
|
||||
int touchStart = 50;
|
||||
int touchEnd = 10;
|
||||
TestContainerLayer layer;
|
||||
ScreenPoint pointOut;
|
||||
ViewTransform viewTransformOut;
|
||||
|
||||
// Fling down. Each step scroll further down
|
||||
ApzcPan(apzc, time, touchStart, touchEnd);
|
||||
ScreenPoint lastPoint;
|
||||
for (int i = 1; i < 50; i+=1) {
|
||||
apzc->SampleContentTransformForFrame(testStartTime+TimeDuration::FromMilliseconds(i), &layer, &viewTransformOut, pointOut);
|
||||
printf("Time %f, y position %f\n", (float)i, pointOut.y);
|
||||
EXPECT_GT(pointOut.y, lastPoint.y);
|
||||
lastPoint = pointOut;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, OverScrollPanning) {
|
||||
TimeStamp testStartTime = TimeStamp::Now();
|
||||
AsyncPanZoomController::SetFrameTime(testStartTime);
|
||||
|
||||
nsRefPtr<MockContentController> mcc = new MockContentController();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = new AsyncPanZoomController(mcc);
|
||||
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
|
||||
|
||||
EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_)).Times(3);
|
||||
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
|
||||
|
||||
// Pan sufficiently to hit overscroll behavior
|
||||
int time = 0;
|
||||
int touchStart = 500;
|
||||
int touchEnd = 10;
|
||||
TestContainerLayer layer;
|
||||
ScreenPoint pointOut;
|
||||
ViewTransform viewTransformOut;
|
||||
|
||||
// Pan down
|
||||
ApzcPan(apzc, time, touchStart, touchEnd);
|
||||
apzc->SampleContentTransformForFrame(testStartTime+TimeDuration::FromMilliseconds(1000), &layer, &viewTransformOut, pointOut);
|
||||
EXPECT_EQ(pointOut, ScreenPoint(0, 90));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user