| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 WebLayer* m_platformLayer; | 89 WebLayer* m_platformLayer; |
| 90 OwnPtr<GraphicsLayerForTesting> m_graphicsLayer; | 90 OwnPtr<GraphicsLayerForTesting> m_graphicsLayer; |
| 91 OwnPtr<GraphicsLayerForTesting> m_scrollElasticityLayer; | 91 OwnPtr<GraphicsLayerForTesting> m_scrollElasticityLayer; |
| 92 OwnPtr<GraphicsLayerForTesting> m_clipLayer; | 92 OwnPtr<GraphicsLayerForTesting> m_clipLayer; |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 OwnPtr<WebLayerTreeView> m_layerTreeView; | 95 OwnPtr<WebLayerTreeView> m_layerTreeView; |
| 96 MockGraphicsLayerClient m_client; | 96 MockGraphicsLayerClient m_client; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations) | |
| 100 { | |
| 101 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); | |
| 102 | |
| 103 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->composi
torSupport()->createFloatAnimationCurve()); | |
| 104 curve->add(WebFloatKeyframe(0.0, 0.0)); | |
| 105 OwnPtr<WebCompositorAnimation> floatAnimation(adoptPtr(Platform::current()->
compositorSupport()->createAnimation(*curve, WebCompositorAnimation::TargetPrope
rtyOpacity))); | |
| 106 int animationId = floatAnimation->id(); | |
| 107 ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.leakPtr())); | |
| 108 | |
| 109 ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); | |
| 110 | |
| 111 m_graphicsLayer->setShouldFlattenTransform(false); | |
| 112 | |
| 113 m_platformLayer = m_graphicsLayer->platformLayer(); | |
| 114 ASSERT_TRUE(m_platformLayer); | |
| 115 | |
| 116 ASSERT_TRUE(m_platformLayer->hasActiveAnimation()); | |
| 117 m_platformLayer->removeAnimation(animationId); | |
| 118 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); | |
| 119 | |
| 120 m_graphicsLayer->setShouldFlattenTransform(true); | |
| 121 | |
| 122 m_platformLayer = m_graphicsLayer->platformLayer(); | |
| 123 ASSERT_TRUE(m_platformLayer); | |
| 124 | |
| 125 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); | |
| 126 } | |
| 127 | |
| 128 class FakeScrollableArea : public ScrollableArea { | 99 class FakeScrollableArea : public ScrollableArea { |
| 129 public: | 100 public: |
| 130 virtual bool isActive() const override { return false; } | 101 virtual bool isActive() const override { return false; } |
| 131 virtual int scrollSize(ScrollbarOrientation) const override { return 100; } | 102 virtual int scrollSize(ScrollbarOrientation) const override { return 100; } |
| 132 virtual bool isScrollCornerVisible() const override { return false; } | 103 virtual bool isScrollCornerVisible() const override { return false; } |
| 133 virtual IntRect scrollCornerRect() const override { return IntRect(); } | 104 virtual IntRect scrollCornerRect() const override { return IntRect(); } |
| 134 virtual int visibleWidth() const override { return 10; } | 105 virtual int visibleWidth() const override { return 10; } |
| 135 virtual int visibleHeight() const override { return 10; } | 106 virtual int visibleHeight() const override { return 10; } |
| 136 virtual IntSize contentsSize() const override { return IntSize(100, 100); } | 107 virtual IntSize contentsSize() const override { return IntSize(100, 100); } |
| 137 virtual bool scrollbarsCanBeActive() const override { return false; } | 108 virtual bool scrollbarsCanBeActive() const override { return false; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 163 | 134 |
| 164 WebDoublePoint scrollPosition(7, 9); | 135 WebDoublePoint scrollPosition(7, 9); |
| 165 m_platformLayer->setScrollPositionDouble(scrollPosition); | 136 m_platformLayer->setScrollPositionDouble(scrollPosition); |
| 166 m_graphicsLayer->didScroll(); | 137 m_graphicsLayer->didScroll(); |
| 167 | 138 |
| 168 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x())
; | 139 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x())
; |
| 169 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y())
; | 140 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y())
; |
| 170 } | 141 } |
| 171 | 142 |
| 172 } // namespace | 143 } // namespace |
| OLD | NEW |