| 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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 webViewImpl->updateAllLifecyclePhases(); | 1716 webViewImpl->updateAllLifecyclePhases(); |
| 1717 | 1717 |
| 1718 // Scroll the page down. | 1718 // Scroll the page down. |
| 1719 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 1719 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
| 1720 ASSERT_EQ(2000, webViewImpl->mainFrame()->getScrollOffset().height); | 1720 ASSERT_EQ(2000, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1721 | 1721 |
| 1722 // Enter fullscreen. | 1722 // Enter fullscreen. |
| 1723 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 1723 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 1724 Element* element = document->getElementById("fullscreenElement"); | 1724 Element* element = document->getElementById("fullscreenElement"); |
| 1725 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); | 1725 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); |
| 1726 Fullscreen::requestFullscreen(*element, Fullscreen::PrefixedRequest); | 1726 Fullscreen::requestFullscreen(*element); |
| 1727 webViewImpl->didEnterFullscreen(); | 1727 webViewImpl->didEnterFullscreen(); |
| 1728 webViewImpl->updateAllLifecyclePhases(); | 1728 webViewImpl->updateAllLifecyclePhases(); |
| 1729 | 1729 |
| 1730 // Sanity-check. There should be no scrolling possible. | 1730 // Sanity-check. There should be no scrolling possible. |
| 1731 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); | 1731 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1732 ASSERT_EQ(0, webViewImpl->mainFrameImpl() | 1732 ASSERT_EQ(0, webViewImpl->mainFrameImpl() |
| 1733 ->frameView() | 1733 ->frameView() |
| 1734 ->maximumScrollOffset() | 1734 ->maximumScrollOffset() |
| 1735 .height()); | 1735 .height()); |
| 1736 | 1736 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1757 webViewImpl->updateAllLifecyclePhases(); | 1757 webViewImpl->updateAllLifecyclePhases(); |
| 1758 | 1758 |
| 1759 // Scroll the page down. | 1759 // Scroll the page down. |
| 1760 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 1760 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
| 1761 ASSERT_EQ(2000, webViewImpl->mainFrame()->getScrollOffset().height); | 1761 ASSERT_EQ(2000, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1762 | 1762 |
| 1763 // Enter fullscreen. | 1763 // Enter fullscreen. |
| 1764 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 1764 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 1765 Element* element = document->getElementById("fullscreenElement"); | 1765 Element* element = document->getElementById("fullscreenElement"); |
| 1766 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); | 1766 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); |
| 1767 Fullscreen::requestFullscreen(*element, Fullscreen::PrefixedRequest); | 1767 Fullscreen::requestFullscreen(*element); |
| 1768 webViewImpl->didEnterFullscreen(); | 1768 webViewImpl->didEnterFullscreen(); |
| 1769 webViewImpl->updateAllLifecyclePhases(); | 1769 webViewImpl->updateAllLifecyclePhases(); |
| 1770 | 1770 |
| 1771 // Sanity-check. There should be no scrolling possible. | 1771 // Sanity-check. There should be no scrolling possible. |
| 1772 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); | 1772 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1773 ASSERT_EQ(0, webViewImpl->mainFrameImpl() | 1773 ASSERT_EQ(0, webViewImpl->mainFrameImpl() |
| 1774 ->frameView() | 1774 ->frameView() |
| 1775 ->maximumScrollOffset() | 1775 ->maximumScrollOffset() |
| 1776 .height()); | 1776 .height()); |
| 1777 | 1777 |
| 1778 // Exit and, without performing a layout, reenter fullscreen again. We | 1778 // Exit and, without performing a layout, reenter fullscreen again. We |
| 1779 // shouldn't try to restore the scroll and scale values when we layout to | 1779 // shouldn't try to restore the scroll and scale values when we layout to |
| 1780 // enter fullscreen. | 1780 // enter fullscreen. |
| 1781 webViewImpl->didExitFullscreen(); | 1781 webViewImpl->didExitFullscreen(); |
| 1782 Fullscreen::requestFullscreen(*element, Fullscreen::PrefixedRequest); | 1782 Fullscreen::requestFullscreen(*element); |
| 1783 webViewImpl->didEnterFullscreen(); | 1783 webViewImpl->didEnterFullscreen(); |
| 1784 webViewImpl->updateAllLifecyclePhases(); | 1784 webViewImpl->updateAllLifecyclePhases(); |
| 1785 | 1785 |
| 1786 // Sanity-check. There should be no scrolling possible. | 1786 // Sanity-check. There should be no scrolling possible. |
| 1787 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); | 1787 ASSERT_EQ(0, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1788 ASSERT_EQ(0, webViewImpl->mainFrameImpl() | 1788 ASSERT_EQ(0, webViewImpl->mainFrameImpl() |
| 1789 ->frameView() | 1789 ->frameView() |
| 1790 ->maximumScrollOffset() | 1790 ->maximumScrollOffset() |
| 1791 .height()); | 1791 .height()); |
| 1792 | 1792 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1814 webViewImpl->setVisualViewportOffset(WebFloatPoint(12, 20)); | 1814 webViewImpl->setVisualViewportOffset(WebFloatPoint(12, 20)); |
| 1815 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 1815 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
| 1816 EXPECT_EQ(94, webViewImpl->mainFrame()->getScrollOffset().width); | 1816 EXPECT_EQ(94, webViewImpl->mainFrame()->getScrollOffset().width); |
| 1817 EXPECT_EQ(111, webViewImpl->mainFrame()->getScrollOffset().height); | 1817 EXPECT_EQ(111, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1818 EXPECT_EQ(12, webViewImpl->visualViewportOffset().x); | 1818 EXPECT_EQ(12, webViewImpl->visualViewportOffset().x); |
| 1819 EXPECT_EQ(20, webViewImpl->visualViewportOffset().y); | 1819 EXPECT_EQ(20, webViewImpl->visualViewportOffset().y); |
| 1820 | 1820 |
| 1821 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); | 1821 Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
| 1822 Element* element = document->body(); | 1822 Element* element = document->body(); |
| 1823 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); | 1823 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); |
| 1824 Fullscreen::requestFullscreen(*element, Fullscreen::PrefixedRequest); | 1824 Fullscreen::requestFullscreen(*element); |
| 1825 webViewImpl->didEnterFullscreen(); | 1825 webViewImpl->didEnterFullscreen(); |
| 1826 | 1826 |
| 1827 // Page scale factor must be 1.0 during fullscreen for elements to be sized | 1827 // Page scale factor must be 1.0 during fullscreen for elements to be sized |
| 1828 // properly. | 1828 // properly. |
| 1829 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); | 1829 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); |
| 1830 | 1830 |
| 1831 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. | 1831 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. |
| 1832 Element* otherElement = document->getElementById("content"); | 1832 Element* otherElement = document->getElementById("content"); |
| 1833 Fullscreen::requestFullscreen(*otherElement, Fullscreen::PrefixedRequest); | 1833 Fullscreen::requestFullscreen(*otherElement); |
| 1834 | 1834 |
| 1835 // Confirm that exiting fullscreen restores the parameters. | 1835 // Confirm that exiting fullscreen restores the parameters. |
| 1836 webViewImpl->didExitFullscreen(); | 1836 webViewImpl->didExitFullscreen(); |
| 1837 webViewImpl->updateAllLifecyclePhases(); | 1837 webViewImpl->updateAllLifecyclePhases(); |
| 1838 | 1838 |
| 1839 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 1839 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
| 1840 EXPECT_EQ(94, webViewImpl->mainFrame()->getScrollOffset().width); | 1840 EXPECT_EQ(94, webViewImpl->mainFrame()->getScrollOffset().width); |
| 1841 EXPECT_EQ(111, webViewImpl->mainFrame()->getScrollOffset().height); | 1841 EXPECT_EQ(111, webViewImpl->mainFrame()->getScrollOffset().height); |
| 1842 EXPECT_EQ(12, webViewImpl->visualViewportOffset().x); | 1842 EXPECT_EQ(12, webViewImpl->visualViewportOffset().x); |
| 1843 EXPECT_EQ(20, webViewImpl->visualViewportOffset().y); | 1843 EXPECT_EQ(20, webViewImpl->visualViewportOffset().y); |
| (...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4245 .translate(50, 55) | 4245 .translate(50, 55) |
| 4246 .scale(1. / 2.f); | 4246 .scale(1. / 2.f); |
| 4247 EXPECT_EQ(expectedMatrix, | 4247 EXPECT_EQ(expectedMatrix, |
| 4248 webViewImpl->getDeviceEmulationTransformForTesting()); | 4248 webViewImpl->getDeviceEmulationTransformForTesting()); |
| 4249 // visibleContentRect doesn't change. | 4249 // visibleContentRect doesn't change. |
| 4250 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4250 EXPECT_EQ(IntRect(50, 55, 50, 75), |
| 4251 *devToolsEmulator->visibleContentRectForPainting()); | 4251 *devToolsEmulator->visibleContentRectForPainting()); |
| 4252 } | 4252 } |
| 4253 | 4253 |
| 4254 } // namespace blink | 4254 } // namespace blink |
| OLD | NEW |