| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 webView->topControls().setShownRatio(1); | 160 webView->topControls().setShownRatio(1); |
| 161 | 161 |
| 162 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollBegin)); | 162 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollBegin)); |
| 163 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); | 163 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); |
| 164 | 164 |
| 165 // Top controls should be scrolled partially and page should not scroll. | 165 // Top controls should be scrolled partially and page should not scroll. |
| 166 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -25.f)); | 166 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -25.f)); |
| 167 EXPECT_FLOAT_EQ(25.f, webView->topControls().contentOffset()); | 167 EXPECT_FLOAT_EQ(25.f, webView->topControls().contentOffset()); |
| 168 EXPECT_POINT_EQ(IntPoint(0, 0), frame()->view()->scrollPosition()); | 168 EXPECT_POINT_EQ(IntPoint(0, 0), frame()->view()->scrollPosition()); |
| 169 | 169 |
| 170 // Top controls should consume 30px and become hidden. Excess scroll should
be consumed by the page. | 170 // Top controls should consume 25px and become hidden. Excess scroll should
be consumed by the page. |
| 171 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -40.f)); | 171 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -40.f)); |
| 172 EXPECT_FLOAT_EQ(0.f, webView->topControls().contentOffset()); | 172 EXPECT_FLOAT_EQ(0.f, webView->topControls().contentOffset()); |
| 173 EXPECT_POINT_EQ(IntPoint(0, 15), frame()->view()->scrollPosition()); | 173 EXPECT_POINT_EQ(IntPoint(0, 15), frame()->view()->scrollPosition()); |
| 174 | 174 |
| 175 // Only page should consume scroll | 175 // Only page should consume scroll |
| 176 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -20.f)); | 176 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollUpdate,
0, -20.f)); |
| 177 EXPECT_FLOAT_EQ(0.f, webView->topControls().contentOffset()); | 177 EXPECT_FLOAT_EQ(0.f, webView->topControls().contentOffset()); |
| 178 EXPECT_POINT_EQ(IntPoint(0, 35), frame()->view()->scrollPosition()); | 178 EXPECT_POINT_EQ(IntPoint(0, 35), frame()->view()->scrollPosition()); |
| 179 } | 179 } |
| 180 | 180 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 // that's 1600px wide so the minimum scale is 0.25 to encompass that. | 725 // that's 1600px wide so the minimum scale is 0.25 to encompass that. |
| 726 ASSERT_EQ(0.25f, webView->minimumPageScaleFactor()); | 726 ASSERT_EQ(0.25f, webView->minimumPageScaleFactor()); |
| 727 | 727 |
| 728 // The viewport will match the layout width at scale=0.5 so the height used | 728 // The viewport will match the layout width at scale=0.5 so the height used |
| 729 // for vh should be (300 / 0.5) for the layout height + (100 / 0.5) for top | 729 // for vh should be (300 / 0.5) for the layout height + (100 / 0.5) for top |
| 730 // controls = 800. | 730 // controls = 800. |
| 731 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height()); | 731 EXPECT_EQ(800, frame()->view()->viewportSizeForViewportUnits().height()); |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace blink | 734 } // namespace blink |
| OLD | NEW |