Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1842)

Unified Diff: Source/platform/graphics/GraphicsLayerTest.cpp

Issue 1209293004: WIP - improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp ('k') | Source/platform/mac/ScrollAnimatorMac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsLayerTest.cpp
diff --git a/Source/platform/graphics/GraphicsLayerTest.cpp b/Source/platform/graphics/GraphicsLayerTest.cpp
index 3f495b6e9d5b8ac43369c454b1e764d33b38a7ac..eba964d4d461803ee59478a097b69e35165ff7b4 100644
--- a/Source/platform/graphics/GraphicsLayerTest.cpp
+++ b/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -125,8 +125,14 @@ TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations)
ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
}
-class FakeScrollableArea : public ScrollableArea {
+class FakeScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<FakeScrollableArea>, public ScrollableArea {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FakeScrollableArea);
public:
+ static PassOwnPtrWillBeRawPtr<FakeScrollableArea> create()
+ {
+ return adoptPtrWillBeNoop(new FakeScrollableArea);
+ }
+
bool isActive() const override { return false; }
int scrollSize(ScrollbarOrientation) const override { return 100; }
bool isScrollCornerVisible() const override { return false; }
@@ -152,21 +158,26 @@ public:
DoublePoint scrollPositionDouble() const override { return m_scrollPosition; }
IntPoint scrollPosition() const override { return flooredIntPoint(m_scrollPosition); }
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ ScrollableArea::trace(visitor);
+ }
+
private:
DoublePoint m_scrollPosition;
};
TEST_F(GraphicsLayerTest, applyScrollToScrollableArea)
{
- FakeScrollableArea scrollableArea;
- m_graphicsLayer->setScrollableArea(&scrollableArea, false);
+ OwnPtrWillBeRawPtr<FakeScrollableArea> scrollableArea = FakeScrollableArea::create();
+ m_graphicsLayer->setScrollableArea(scrollableArea.get(), false);
WebDoublePoint scrollPosition(7, 9);
m_platformLayer->setScrollPositionDouble(scrollPosition);
m_graphicsLayer->didScroll();
- EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x());
- EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y());
+ EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x());
+ EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y());
}
} // namespace blink
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp ('k') | Source/platform/mac/ScrollAnimatorMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698