| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Initialize top controls to be shown. | 341 // Initialize top controls to be shown. |
| 342 webView->setTopControlsHeight(50.f, true); | 342 webView->setTopControlsHeight(50.f, true); |
| 343 webView->topControls().setShownRatio(1); | 343 webView->topControls().setShownRatio(1); |
| 344 | 344 |
| 345 webView->topControls().scrollBegin(); | 345 webView->topControls().scrollBegin(); |
| 346 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); | 346 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); |
| 347 | 347 |
| 348 // This will result in a 20px scroll to the top controls so the show ratio | 348 // This will result in a 20px scroll to the top controls so the show ratio |
| 349 // will be 30/50 == 0.6 which is not representible in a float. Make sure | 349 // will be 30/50 == 0.6 which is not representible in a float. Make sure |
| 350 // that scroll still consumes the whole delta. | 350 // that scroll still consumes the whole delta. |
| 351 FloatSize remainingDelta = webView->topControls().scrollBy(FloatSize(0, -10)
); | 351 FloatSize remainingDelta = webView->topControls().scrollBy(FloatSize(0, 10))
; |
| 352 EXPECT_EQ(0, remainingDelta.height()); | 352 EXPECT_EQ(0, remainingDelta.height()); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Scrollable subregions should scroll before top controls | 355 // Scrollable subregions should scroll before top controls |
| 356 TEST_F(TopControlsTest, MAYBE(ScrollableSubregionScrollFirst)) | 356 TEST_F(TopControlsTest, MAYBE(ScrollableSubregionScrollFirst)) |
| 357 { | 357 { |
| 358 WebViewImpl* webView = initialize("overflow-scrolling.html"); | 358 WebViewImpl* webView = initialize("overflow-scrolling.html"); |
| 359 webView->setTopControlsHeight(50.f, true); | 359 webView->setTopControlsHeight(50.f, true); |
| 360 webView->topControls().setShownRatio(1); | 360 webView->topControls().setShownRatio(1); |
| 361 frame()->view()->scrollableArea()->setScrollPosition(IntPoint(0, 50), Progra
mmaticScroll); | 361 frame()->view()->scrollableArea()->setScrollPosition(IntPoint(0, 50), Progra
mmaticScroll); |
| (...skipping 363 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 |