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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu
rn true; } | 139 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu
rn true; } |
140 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa
lse; } | 140 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa
lse; } |
141 virtual int pageStep(ScrollbarOrientation) const override { return 0; } | 141 virtual int pageStep(ScrollbarOrientation) const override { return 0; } |
142 virtual IntPoint minimumScrollPosition() const override { return IntPoint();
} | 142 virtual IntPoint minimumScrollPosition() const override { return IntPoint();
} |
143 virtual IntPoint maximumScrollPosition() const override | 143 virtual IntPoint maximumScrollPosition() const override |
144 { | 144 { |
145 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().
height() - visibleHeight()); | 145 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().
height() - visibleHeight()); |
146 } | 146 } |
147 | 147 |
148 virtual void setScrollOffset(const IntPoint& scrollOffset) override { m_scro
llPosition = scrollOffset; } | 148 virtual void setScrollOffset(const IntPoint& scrollOffset) override { m_scro
llPosition = scrollOffset; } |
149 virtual IntPoint scrollPosition() const override { return m_scrollPosition;
} | 149 virtual void setScrollOffset(const DoublePoint& scrollOffset) override { m_s
crollPosition = scrollOffset; } |
| 150 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP
osition; } |
| 151 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_
scrollPosition); } |
150 | 152 |
151 private: | 153 private: |
152 IntPoint m_scrollPosition; | 154 DoublePoint m_scrollPosition; |
153 }; | 155 }; |
154 | 156 |
155 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) | 157 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) |
156 { | 158 { |
157 FakeScrollableArea scrollableArea; | 159 FakeScrollableArea scrollableArea; |
158 m_graphicsLayer->setScrollableArea(&scrollableArea, false); | 160 m_graphicsLayer->setScrollableArea(&scrollableArea, false); |
159 | 161 |
160 WebPoint scrollPosition(7, 9); | 162 WebDoublePoint scrollPosition(7.2, 9.6); |
161 m_platformLayer->setScrollPosition(scrollPosition); | 163 m_platformLayer->setScrollPositionDouble(scrollPosition); |
162 m_graphicsLayer->didScroll(); | 164 m_graphicsLayer->didScroll(); |
163 | 165 |
164 EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition())); | 166 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x())
; |
| 167 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y())
; |
165 } | 168 } |
166 | 169 |
167 } // namespace | 170 } // namespace |
OLD | NEW |