| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 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 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 web_view_impl->MainFrameImpl()->SetScrollOffset(WebSize(94, 111)); | 1671 web_view_impl->MainFrameImpl()->SetScrollOffset(WebSize(94, 111)); |
| 1672 EXPECT_EQ(2.0f, web_view_impl->PageScaleFactor()); | 1672 EXPECT_EQ(2.0f, web_view_impl->PageScaleFactor()); |
| 1673 EXPECT_EQ(94, web_view_impl->MainFrameImpl()->GetScrollOffset().width); | 1673 EXPECT_EQ(94, web_view_impl->MainFrameImpl()->GetScrollOffset().width); |
| 1674 EXPECT_EQ(111, web_view_impl->MainFrameImpl()->GetScrollOffset().height); | 1674 EXPECT_EQ(111, web_view_impl->MainFrameImpl()->GetScrollOffset().height); |
| 1675 LocalFrame* main_frame_local = | 1675 LocalFrame* main_frame_local = |
| 1676 ToLocalFrame(web_view_impl->GetPage()->MainFrame()); | 1676 ToLocalFrame(web_view_impl->GetPage()->MainFrame()); |
| 1677 main_frame_local->Loader().SaveScrollState(); | 1677 main_frame_local->Loader().SaveScrollState(); |
| 1678 EXPECT_EQ(2.0f, main_frame_local->Loader() | 1678 EXPECT_EQ(2.0f, main_frame_local->Loader() |
| 1679 .GetDocumentLoader() | 1679 .GetDocumentLoader() |
| 1680 ->GetHistoryItem() | 1680 ->GetHistoryItem() |
| 1681 ->PageScaleFactor()); | 1681 ->GetViewState() |
| 1682 ->page_scale_factor_); |
| 1682 EXPECT_EQ(94, main_frame_local->Loader() | 1683 EXPECT_EQ(94, main_frame_local->Loader() |
| 1683 .GetDocumentLoader() | 1684 .GetDocumentLoader() |
| 1684 ->GetHistoryItem() | 1685 ->GetHistoryItem() |
| 1685 ->GetScrollOffset() | 1686 ->GetViewState() |
| 1686 .Width()); | 1687 ->scroll_offset_.Width()); |
| 1687 EXPECT_EQ(111, main_frame_local->Loader() | 1688 EXPECT_EQ(111, main_frame_local->Loader() |
| 1688 .GetDocumentLoader() | 1689 .GetDocumentLoader() |
| 1689 ->GetHistoryItem() | 1690 ->GetHistoryItem() |
| 1690 ->GetScrollOffset() | 1691 ->GetViewState() |
| 1691 .Height()); | 1692 ->scroll_offset_.Height()); |
| 1692 | 1693 |
| 1693 // Confirm that resetting the page state resets the saved scroll position. | 1694 // Confirm that resetting the page state resets the saved scroll position. |
| 1694 web_view_impl->ResetScrollAndScaleState(); | 1695 web_view_impl->ResetScrollAndScaleState(); |
| 1695 EXPECT_EQ(1.0f, web_view_impl->PageScaleFactor()); | 1696 EXPECT_EQ(1.0f, web_view_impl->PageScaleFactor()); |
| 1696 EXPECT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().width); | 1697 EXPECT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().width); |
| 1697 EXPECT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().height); | 1698 EXPECT_EQ(0, web_view_impl->MainFrameImpl()->GetScrollOffset().height); |
| 1698 EXPECT_EQ(1.0f, main_frame_local->Loader() | 1699 EXPECT_EQ(nullptr, main_frame_local->Loader() |
| 1699 .GetDocumentLoader() | 1700 .GetDocumentLoader() |
| 1700 ->GetHistoryItem() | 1701 ->GetHistoryItem() |
| 1701 ->PageScaleFactor()); | 1702 ->GetViewState()); |
| 1702 EXPECT_EQ(0, main_frame_local->Loader() | |
| 1703 .GetDocumentLoader() | |
| 1704 ->GetHistoryItem() | |
| 1705 ->GetScrollOffset() | |
| 1706 .Width()); | |
| 1707 EXPECT_EQ(0, main_frame_local->Loader() | |
| 1708 .GetDocumentLoader() | |
| 1709 ->GetHistoryItem() | |
| 1710 ->GetScrollOffset() | |
| 1711 .Height()); | |
| 1712 } | 1703 } |
| 1713 | 1704 |
| 1714 TEST_P(WebViewTest, BackForwardRestoreScroll) { | 1705 TEST_P(WebViewTest, BackForwardRestoreScroll) { |
| 1715 RegisterMockedHttpURLLoad("back_forward_restore_scroll.html"); | 1706 RegisterMockedHttpURLLoad("back_forward_restore_scroll.html"); |
| 1716 WebViewBase* web_view_impl = web_view_helper_.InitializeAndLoad( | 1707 WebViewBase* web_view_impl = web_view_helper_.InitializeAndLoad( |
| 1717 base_url_ + "back_forward_restore_scroll.html"); | 1708 base_url_ + "back_forward_restore_scroll.html"); |
| 1718 web_view_impl->Resize(WebSize(640, 480)); | 1709 web_view_impl->Resize(WebSize(640, 480)); |
| 1719 web_view_impl->UpdateAllLifecyclePhases(); | 1710 web_view_impl->UpdateAllLifecyclePhases(); |
| 1720 | 1711 |
| 1721 // Emulate a user scroll | 1712 // Emulate a user scroll |
| (...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4398 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); | 4389 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); |
| 4399 if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { | 4390 if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { |
| 4400 EXPECT_NE(nullptr, | 4391 EXPECT_NE(nullptr, |
| 4401 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); | 4392 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); |
| 4402 } else { | 4393 } else { |
| 4403 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); | 4394 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); |
| 4404 } | 4395 } |
| 4405 } | 4396 } |
| 4406 | 4397 |
| 4407 } // namespace blink | 4398 } // namespace blink |
| OLD | NEW |