| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 m_platformLayer = m_graphicsLayer->platformLayer(); | 111 m_platformLayer = m_graphicsLayer->platformLayer(); |
| 112 ASSERT_TRUE(m_platformLayer); | 112 ASSERT_TRUE(m_platformLayer); |
| 113 | 113 |
| 114 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); | 114 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 class FakeScrollableArea : public ScrollableArea { | 117 class FakeScrollableArea : public ScrollableArea { |
| 118 public: | 118 public: |
| 119 virtual bool isActive() const OVERRIDE { return false; } | 119 virtual bool isActive() const OVERRIDE { return false; } |
| 120 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE { return 100; } | 120 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE { return 100; } |
| 121 virtual int scrollPosition(Scrollbar*) const OVERRIDE { return 0; } | |
| 122 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } | 121 virtual bool isScrollCornerVisible() const OVERRIDE { return false; } |
| 123 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } | 122 virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } |
| 124 virtual int visibleWidth() const OVERRIDE { return 10; } | 123 virtual int visibleWidth() const OVERRIDE { return 10; } |
| 125 virtual int visibleHeight() const OVERRIDE { return 10; } | 124 virtual int visibleHeight() const OVERRIDE { return 10; } |
| 126 virtual IntSize contentsSize() const OVERRIDE { return IntSize(100, 100); } | 125 virtual IntSize contentsSize() const OVERRIDE { return IntSize(100, 100); } |
| 127 virtual bool scrollbarsCanBeActive() const OVERRIDE { return false; } | 126 virtual bool scrollbarsCanBeActive() const OVERRIDE { return false; } |
| 128 virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0;
} | 127 virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0;
} |
| 129 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE { return IntRect(
); } | 128 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE { return IntRect(
); } |
| 130 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE {
} | 129 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE {
} |
| 131 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } | 130 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } |
| 131 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE { retu
rn true; } |
| 132 virtual int pageStep(ScrollbarOrientation) const OVERRIDE { return 0; } |
| 133 virtual IntPoint minimumScrollPosition() const OVERRIDE { return IntPoint();
} |
| 134 virtual IntPoint maximumScrollPosition() const OVERRIDE |
| 135 { |
| 136 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().
height() - visibleHeight()); |
| 137 } |
| 132 | 138 |
| 133 virtual void setScrollOffset(const IntPoint& scrollOffset) OVERRIDE { m_scro
llPosition = scrollOffset; } | 139 virtual void setScrollOffset(const IntPoint& scrollOffset) OVERRIDE { m_scro
llPosition = scrollOffset; } |
| 134 virtual IntPoint scrollPosition() const OVERRIDE { return m_scrollPosition;
} | 140 virtual IntPoint scrollPosition() const OVERRIDE { return m_scrollPosition;
} |
| 135 | 141 |
| 136 private: | 142 private: |
| 137 IntPoint m_scrollPosition; | 143 IntPoint m_scrollPosition; |
| 138 }; | 144 }; |
| 139 | 145 |
| 140 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) | 146 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) |
| 141 { | 147 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 155 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); | 161 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); |
| 156 | 162 |
| 157 m_graphicsLayer->setContentsToSolidColor(Color::white); | 163 m_graphicsLayer->setContentsToSolidColor(Color::white); |
| 158 EXPECT_TRUE(m_graphicsLayer->contentsLayer()); | 164 EXPECT_TRUE(m_graphicsLayer->contentsLayer()); |
| 159 | 165 |
| 160 m_graphicsLayer->setContentsToSolidColor(Color()); | 166 m_graphicsLayer->setContentsToSolidColor(Color()); |
| 161 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); | 167 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); |
| 162 } | 168 } |
| 163 | 169 |
| 164 } // namespace | 170 } // namespace |
| OLD | NEW |