summaryrefslogtreecommitdiffstats
path: root/cc/layer_tree_host_unittest.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-05 16:56:49 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-05 16:56:49 +0000
commitec454716d4056ddc796788b0cab45ec99b16113b (patch)
treec12de89ddf61012d1d5eb7f8c8573773a9215f5a /cc/layer_tree_host_unittest.cc
parent992359d7cb13821cbc9cbf76d3e870860dea760d (diff)
downloadchromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.zip
chromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.tar.gz
chromium_src-ec454716d4056ddc796788b0cab45ec99b16113b.tar.bz2
cc: Remove all remaining use of WebCore Rect/Point/Size types from the compositor.
This change removes all IntPoint/FloatRect/IntSize/etc from the compositor. There remains an indirect dependency on these types through the WebCore::Region class, which we wrap but need to replace. However, the wrapper there hides the WebCore types inside it, so there are now no references to the types from anywhere else in the compositor. I went back and forth on how to deal with scroll "positions". The name suggested that they should be Points, and that the deltas should be Vectors. However this lent itself to super awkward math at times. In the end, it was much cleaner to make all scroll "positions" into scroll "offsets" and represent everything as Vectors. Covered by existing tests; no change in behaviour. R=enne BUG=147395 Review URL: https://codereview.chromium.org/11367080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165947 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host_unittest.cc')
-rw-r--r--cc/layer_tree_host_unittest.cc205
1 files changed, 103 insertions, 102 deletions
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 704158e..893ebee 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -24,6 +24,7 @@
#include "third_party/khronos/GLES2/gl2ext.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/size_conversions.h"
+#include "ui/gfx/vector2d_conversions.h"
#include <public/WebLayerScrollClient.h>
#include <public/WebSize.h>
@@ -834,8 +835,8 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestAnimationFinishedEvents)
class LayerTreeHostTestScrollSimple : public LayerTreeHostTest {
public:
LayerTreeHostTestScrollSimple()
- : m_initialScroll(IntPoint(10, 20))
- , m_secondScroll(IntPoint(40, 5))
+ : m_initialScroll(10, 20)
+ , m_secondScroll(40, 5)
, m_scrollAmount(2, -1)
, m_scrolls(0)
{
@@ -844,7 +845,7 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->rootLayer()->setScrollable(true);
- m_layerTreeHost->rootLayer()->setScrollPosition(m_initialScroll);
+ m_layerTreeHost->rootLayer()->setScrollOffset(m_initialScroll);
postSetNeedsCommitToMainThread();
}
@@ -852,39 +853,39 @@ public:
{
Layer* root = m_layerTreeHost->rootLayer();
if (!m_layerTreeHost->commitNumber())
- EXPECT_EQ(root->scrollPosition(), m_initialScroll);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll);
else {
- EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll + m_scrollAmount);
// Pretend like Javascript updated the scroll position itself.
- root->setScrollPosition(m_secondScroll);
+ root->setScrollOffset(m_secondScroll);
}
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
LayerImpl* root = impl->rootLayer();
- EXPECT_EQ(root->scrollDelta(), IntSize());
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d());
root->setScrollable(true);
- root->setMaxScrollPosition(IntSize(100, 100));
+ root->setMaxScrollOffset(gfx::Vector2d(100, 100));
root->scrollBy(m_scrollAmount);
if (!impl->sourceFrameNumber()) {
- EXPECT_EQ(root->scrollPosition(), m_initialScroll);
- EXPECT_EQ(root->scrollDelta(), m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll);
+ EXPECT_VECTOR_EQ(root->scrollDelta(), m_scrollAmount);
postSetNeedsCommitToMainThread();
} else if (impl->sourceFrameNumber() == 1) {
- EXPECT_EQ(root->scrollPosition(), m_secondScroll);
- EXPECT_EQ(root->scrollDelta(), m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_secondScroll);
+ EXPECT_VECTOR_EQ(root->scrollDelta(), m_scrollAmount);
endTest();
}
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
- m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
+ m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
m_scrolls++;
}
@@ -893,9 +894,9 @@ public:
EXPECT_EQ(1, m_scrolls);
}
private:
- IntPoint m_initialScroll;
- IntPoint m_secondScroll;
- IntSize m_scrollAmount;
+ gfx::Vector2d m_initialScroll;
+ gfx::Vector2d m_secondScroll;
+ gfx::Vector2d m_scrollAmount;
int m_scrolls;
};
@@ -907,7 +908,7 @@ TEST_F(LayerTreeHostTestScrollSimple, runMultiThread)
class LayerTreeHostTestScrollMultipleRedraw : public LayerTreeHostTest {
public:
LayerTreeHostTestScrollMultipleRedraw()
- : m_initialScroll(IntPoint(40, 10))
+ : m_initialScroll(40, 10)
, m_scrollAmount(-3, 17)
, m_scrolls(0)
{
@@ -916,7 +917,7 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->rootLayer()->setScrollable(true);
- m_layerTreeHost->rootLayer()->setScrollPosition(m_initialScroll);
+ m_layerTreeHost->rootLayer()->setScrollOffset(m_initialScroll);
postSetNeedsCommitToMainThread();
}
@@ -924,48 +925,48 @@ public:
{
Layer* root = m_layerTreeHost->rootLayer();
if (!m_layerTreeHost->commitNumber())
- EXPECT_EQ(root->scrollPosition(), m_initialScroll);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll);
else if (m_layerTreeHost->commitNumber() == 1)
- EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll + m_scrollAmount + m_scrollAmount);
else if (m_layerTreeHost->commitNumber() == 2)
- EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll + m_scrollAmount + m_scrollAmount);
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
LayerImpl* root = impl->rootLayer();
root->setScrollable(true);
- root->setMaxScrollPosition(IntSize(100, 100));
+ root->setMaxScrollOffset(gfx::Vector2d(100, 100));
if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 1) {
// First draw after first commit.
- EXPECT_EQ(root->scrollDelta(), IntSize());
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d());
root->scrollBy(m_scrollAmount);
- EXPECT_EQ(root->scrollDelta(), m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollDelta(), m_scrollAmount);
- EXPECT_EQ(root->scrollPosition(), m_initialScroll);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll);
postSetNeedsRedrawToMainThread();
} else if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 2) {
// Second draw after first commit.
EXPECT_EQ(root->scrollDelta(), m_scrollAmount);
root->scrollBy(m_scrollAmount);
- EXPECT_EQ(root->scrollDelta(), m_scrollAmount + m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollDelta(), m_scrollAmount + m_scrollAmount);
- EXPECT_EQ(root->scrollPosition(), m_initialScroll);
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll);
postSetNeedsCommitToMainThread();
} else if (impl->sourceFrameNumber() == 1) {
// Third or later draw after second commit.
EXPECT_GE(impl->sourceAnimationFrameNumber(), 3);
- EXPECT_EQ(root->scrollDelta(), IntSize());
- EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount);
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d());
+ EXPECT_VECTOR_EQ(root->scrollOffset(), m_initialScroll + m_scrollAmount + m_scrollAmount);
endTest();
}
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
- m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
+ m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
m_scrolls++;
}
@@ -974,8 +975,8 @@ public:
EXPECT_EQ(1, m_scrolls);
}
private:
- IntPoint m_initialScroll;
- IntSize m_scrollAmount;
+ gfx::Vector2d m_initialScroll;
+ gfx::Vector2d m_scrollAmount;
int m_scrolls;
};
@@ -1029,20 +1030,20 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->rootLayer()->setScrollable(true);
- m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint());
+ m_layerTreeHost->rootLayer()->setScrollOffset(gfx::Vector2d());
postSetNeedsCommitToMainThread();
postSetNeedsRedrawToMainThread();
}
void requestStartPageScaleAnimation()
{
- layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, base::TimeDelta());
+ layerTreeHost()->startPageScaleAnimation(gfx::Vector2d(), false, 1.25, base::TimeDelta());
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
impl->rootLayer()->setScrollable(true);
- impl->rootLayer()->setScrollPosition(IntPoint());
+ impl->rootLayer()->setScrollOffset(gfx::Vector2d());
impl->setPageScaleFactorAndLimits(impl->pageScaleFactor(), 0.5, 2);
// We request animation only once.
@@ -1052,10 +1053,10 @@ public:
}
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
- m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
+ m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2);
}
@@ -2090,36 +2091,36 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
LayerImpl* root = impl->rootLayer();
- root->setMaxScrollPosition(IntSize(100, 100));
+ root->setMaxScrollOffset(gfx::Vector2d(100, 100));
// Check that a fractional scroll delta is correctly accumulated over multiple commits.
if (!impl->sourceFrameNumber()) {
- EXPECT_EQ(root->scrollPosition(), IntPoint(0, 0));
- EXPECT_EQ(root->scrollDelta(), FloatSize(0, 0));
+ EXPECT_VECTOR_EQ(root->scrollOffset(), gfx::Vector2d(0, 0));
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d(0, 0));
postSetNeedsCommitToMainThread();
} else if (impl->sourceFrameNumber() == 1) {
- EXPECT_EQ(root->scrollPosition(), flooredIntPoint(m_scrollAmount));
- EXPECT_EQ(root->scrollDelta(), FloatSize(fmod(m_scrollAmount.width(), 1), 0));
+ EXPECT_VECTOR_EQ(root->scrollOffset(), gfx::ToFlooredVector2d(m_scrollAmount));
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2dF(fmod(m_scrollAmount.x(), 1), 0));
postSetNeedsCommitToMainThread();
} else if (impl->sourceFrameNumber() == 2) {
- EXPECT_EQ(root->scrollPosition(), flooredIntPoint(m_scrollAmount + m_scrollAmount));
- EXPECT_EQ(root->scrollDelta(), FloatSize(fmod(2 * m_scrollAmount.width(), 1), 0));
+ EXPECT_VECTOR_EQ(root->scrollOffset(), gfx::ToFlooredVector2d(m_scrollAmount + m_scrollAmount));
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2dF(fmod(2 * m_scrollAmount.x(), 1), 0));
endTest();
}
root->scrollBy(m_scrollAmount);
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
- m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scrollOffset();
+ m_layerTreeHost->rootLayer()->setScrollOffset(offset + scrollDelta);
}
virtual void afterTest() OVERRIDE
{
}
private:
- FloatSize m_scrollAmount;
+ gfx::Vector2dF m_scrollAmount;
};
TEST_F(LayerTreeHostTestFractionalScroll, runMultiThread)
@@ -2223,8 +2224,8 @@ class LayerTreeHostTestScrollChildLayer : public LayerTreeHostTest, public WebLa
public:
LayerTreeHostTestScrollChildLayer(float deviceScaleFactor)
: m_deviceScaleFactor(deviceScaleFactor)
- , m_initialScroll(IntPoint(10, 20))
- , m_secondScroll(IntPoint(40, 5))
+ , m_initialScroll(10, 20)
+ , m_secondScroll(40, 5)
, m_scrollAmount(2, -1)
, m_rootScrolls(0)
{
@@ -2246,7 +2247,7 @@ public:
m_rootScrollLayer->setIsDrawable(true);
m_rootScrollLayer->setScrollable(true);
- m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100));
+ m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100));
m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer);
m_childLayer = ContentLayer::create(&m_mockDelegate);
@@ -2260,42 +2261,42 @@ public:
m_childLayer->setIsDrawable(true);
m_childLayer->setScrollable(true);
- m_childLayer->setMaxScrollPosition(IntSize(100, 100));
+ m_childLayer->setMaxScrollOffset(gfx::Vector2d(100, 100));
m_rootScrollLayer->addChild(m_childLayer);
- m_childLayer->setScrollPosition(m_initialScroll);
+ m_childLayer->setScrollOffset(m_initialScroll);
postSetNeedsCommitToMainThread();
}
virtual void didScroll() OVERRIDE
{
- m_finalScrollPosition = m_childLayer->scrollPosition();
+ m_finalScrollOffset = m_childLayer->scrollOffset();
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_rootScrollLayer->scrollPosition();
- m_rootScrollLayer->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_rootScrollLayer->scrollOffset();
+ m_rootScrollLayer->setScrollOffset(offset + scrollDelta);
m_rootScrolls++;
}
virtual void layout() OVERRIDE
{
- EXPECT_EQ(IntPoint(), m_rootScrollLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(gfx::Vector2d(), m_rootScrollLayer->scrollOffset());
switch (m_layerTreeHost->commitNumber()) {
case 0:
- EXPECT_POINT_EQ(m_initialScroll, m_childLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_initialScroll, m_childLayer->scrollOffset());
break;
case 1:
- EXPECT_POINT_EQ(m_initialScroll + m_scrollAmount, m_childLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_initialScroll + m_scrollAmount, m_childLayer->scrollOffset());
// Pretend like Javascript updated the scroll position itself.
- m_childLayer->setScrollPosition(m_secondScroll);
+ m_childLayer->setScrollOffset(m_secondScroll);
break;
case 2:
- EXPECT_POINT_EQ(m_secondScroll + m_scrollAmount, m_childLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, m_childLayer->scrollOffset());
break;
}
}
@@ -2306,8 +2307,8 @@ public:
LayerImpl* rootScrollLayer = root->children()[0];
LayerImpl* childLayer = rootScrollLayer->children()[0];
- EXPECT_SIZE_EQ(root->scrollDelta(), IntSize());
- EXPECT_SIZE_EQ(rootScrollLayer->scrollDelta(), IntSize());
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d());
+ EXPECT_VECTOR_EQ(rootScrollLayer->scrollDelta(), gfx::Vector2d());
EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootScrollLayer->contentBounds().width());
EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, rootScrollLayer->contentBounds().height());
EXPECT_EQ(childLayer->bounds().width() * m_deviceScaleFactor, childLayer->contentBounds().width());
@@ -2320,8 +2321,8 @@ public:
impl->scrollBy(gfx::Point(), m_scrollAmount);
impl->scrollEnd();
- EXPECT_POINT_EQ(m_initialScroll, childLayer->scrollPosition());
- EXPECT_SIZE_EQ(m_scrollAmount, childLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_initialScroll, childLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta());
break;
case 1:
// Wheel scroll on impl thread.
@@ -2329,12 +2330,12 @@ public:
impl->scrollBy(gfx::Point(), m_scrollAmount);
impl->scrollEnd();
- EXPECT_POINT_EQ(m_secondScroll, childLayer->scrollPosition());
- EXPECT_SIZE_EQ(m_scrollAmount, childLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_secondScroll, childLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(m_scrollAmount, childLayer->scrollDelta());
break;
case 2:
- EXPECT_POINT_EQ(m_secondScroll + m_scrollAmount, childLayer->scrollPosition());
- EXPECT_SIZE_EQ(IntSize(0, 0), childLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, childLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), childLayer->scrollDelta());
endTest();
}
@@ -2343,16 +2344,16 @@ public:
virtual void afterTest() OVERRIDE
{
EXPECT_EQ(0, m_rootScrolls);
- EXPECT_POINT_EQ(m_secondScroll + m_scrollAmount, m_finalScrollPosition);
+ EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, m_finalScrollOffset);
}
private:
float m_deviceScaleFactor;
- IntPoint m_initialScroll;
- IntPoint m_secondScroll;
- IntSize m_scrollAmount;
+ gfx::Vector2d m_initialScroll;
+ gfx::Vector2d m_secondScroll;
+ gfx::Vector2d m_scrollAmount;
int m_rootScrolls;
- IntPoint m_finalScrollPosition;
+ gfx::Vector2d m_finalScrollOffset;
MockContentLayerClient m_mockDelegate;
scoped_refptr<Layer> m_rootScrollLayer;
@@ -2383,8 +2384,8 @@ class LayerTreeHostTestScrollRootScrollLayer : public LayerTreeHostTest {
public:
LayerTreeHostTestScrollRootScrollLayer(float deviceScaleFactor)
: m_deviceScaleFactor(deviceScaleFactor)
- , m_initialScroll(IntPoint(10, 20))
- , m_secondScroll(IntPoint(40, 5))
+ , m_initialScroll(10, 20)
+ , m_secondScroll(40, 5)
, m_scrollAmount(2, -1)
, m_rootScrolls(0)
{
@@ -2399,25 +2400,25 @@ public:
m_layerTreeHost->setDeviceScaleFactor(m_deviceScaleFactor);
m_rootScrollLayer = ContentLayer::create(&m_mockDelegate);
- m_rootScrollLayer->setBounds(IntSize(110, 110));
+ m_rootScrollLayer->setBounds(gfx::Size(110, 110));
m_rootScrollLayer->setPosition(gfx::PointF(0, 0));
m_rootScrollLayer->setAnchorPoint(gfx::PointF(0, 0));
m_rootScrollLayer->setIsDrawable(true);
m_rootScrollLayer->setScrollable(true);
- m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100));
+ m_rootScrollLayer->setMaxScrollOffset(gfx::Vector2d(100, 100));
m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer);
- m_rootScrollLayer->setScrollPosition(m_initialScroll);
+ m_rootScrollLayer->setScrollOffset(m_initialScroll);
postSetNeedsCommitToMainThread();
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE
{
- IntPoint position = m_rootScrollLayer->scrollPosition();
- m_rootScrollLayer->setScrollPosition(position + scrollDelta);
+ gfx::Vector2d offset = m_rootScrollLayer->scrollOffset();
+ m_rootScrollLayer->setScrollOffset(offset + scrollDelta);
m_rootScrolls++;
}
@@ -2425,16 +2426,16 @@ public:
{
switch (m_layerTreeHost->commitNumber()) {
case 0:
- EXPECT_POINT_EQ(m_initialScroll, m_rootScrollLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_initialScroll, m_rootScrollLayer->scrollOffset());
break;
case 1:
- EXPECT_POINT_EQ(m_initialScroll + m_scrollAmount, m_rootScrollLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_initialScroll + m_scrollAmount, m_rootScrollLayer->scrollOffset());
// Pretend like Javascript updated the scroll position itself.
- m_rootScrollLayer->setScrollPosition(m_secondScroll);
+ m_rootScrollLayer->setScrollOffset(m_secondScroll);
break;
case 2:
- EXPECT_POINT_EQ(m_secondScroll + m_scrollAmount, m_rootScrollLayer->scrollPosition());
+ EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, m_rootScrollLayer->scrollOffset());
break;
}
}
@@ -2444,7 +2445,7 @@ public:
LayerImpl* root = impl->rootLayer();
LayerImpl* rootScrollLayer = root->children()[0];
- EXPECT_SIZE_EQ(root->scrollDelta(), IntSize());
+ EXPECT_VECTOR_EQ(root->scrollDelta(), gfx::Vector2d());
EXPECT_EQ(rootScrollLayer->bounds().width() * m_deviceScaleFactor, rootScrollLayer->contentBounds().width());
EXPECT_EQ(rootScrollLayer->bounds().height() * m_deviceScaleFactor, rootScrollLayer->contentBounds().height());
@@ -2455,8 +2456,8 @@ public:
impl->scrollBy(gfx::Point(), m_scrollAmount);
impl->scrollEnd();
- EXPECT_POINT_EQ(m_initialScroll, rootScrollLayer->scrollPosition());
- EXPECT_SIZE_EQ(m_scrollAmount, rootScrollLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_initialScroll, rootScrollLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta());
break;
case 1:
// Wheel scroll on impl thread.
@@ -2464,12 +2465,12 @@ public:
impl->scrollBy(gfx::Point(), m_scrollAmount);
impl->scrollEnd();
- EXPECT_POINT_EQ(m_secondScroll, rootScrollLayer->scrollPosition());
- EXPECT_SIZE_EQ(m_scrollAmount, rootScrollLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_secondScroll, rootScrollLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(m_scrollAmount, rootScrollLayer->scrollDelta());
break;
case 2:
- EXPECT_POINT_EQ(m_secondScroll + m_scrollAmount, rootScrollLayer->scrollPosition());
- EXPECT_SIZE_EQ(IntSize(0, 0), rootScrollLayer->scrollDelta());
+ EXPECT_VECTOR_EQ(m_secondScroll + m_scrollAmount, rootScrollLayer->scrollOffset());
+ EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), rootScrollLayer->scrollDelta());
endTest();
}
@@ -2482,9 +2483,9 @@ public:
private:
float m_deviceScaleFactor;
- IntPoint m_initialScroll;
- IntPoint m_secondScroll;
- IntSize m_scrollAmount;
+ gfx::Vector2d m_initialScroll;
+ gfx::Vector2d m_secondScroll;
+ gfx::Vector2d m_scrollAmount;
int m_rootScrolls;
MockContentLayerClient m_mockDelegate;