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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 web_view->SetInitialFocus(false); | 1617 web_view->SetInitialFocus(false); |
1618 frame->SetEditableSelectionOffsets(4, 10); | 1618 frame->SetEditableSelectionOffsets(4, 10); |
1619 EXPECT_TRUE(web_view->IsSelectionAnchorFirst()); | 1619 EXPECT_TRUE(web_view->IsSelectionAnchorFirst()); |
1620 WebRect anchor; | 1620 WebRect anchor; |
1621 WebRect focus; | 1621 WebRect focus; |
1622 web_view->SelectionBounds(anchor, focus); | 1622 web_view->SelectionBounds(anchor, focus); |
1623 frame->SelectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y)); | 1623 frame->SelectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y)); |
1624 EXPECT_FALSE(web_view->IsSelectionAnchorFirst()); | 1624 EXPECT_FALSE(web_view->IsSelectionAnchorFirst()); |
1625 } | 1625 } |
1626 | 1626 |
| 1627 TEST_P( |
| 1628 WebViewTest, |
| 1629 MoveFocusToNextFocusableElementInFormWithKeyEventListenersAndNonEditableElem
ents) { |
| 1630 const std::string testFile = |
| 1631 "advance_focus_in_form_with_key_event_listeners.html"; |
| 1632 RegisterMockedHttpURLLoad(testFile); |
| 1633 WebViewImpl* webViewImpl = |
| 1634 web_view_helper_.InitializeAndLoad(base_url_ + testFile); |
| 1635 webViewImpl->SetInitialFocus(false); |
| 1636 Document* document = webViewImpl->MainFrameImpl()->GetFrame()->GetDocument(); |
| 1637 WebInputMethodController* activeInputMethodController = |
| 1638 webViewImpl->MainFrameImpl() |
| 1639 ->FrameWidget() |
| 1640 ->GetActiveWebInputMethodController(); |
| 1641 const int defaultTextInputFlags = kWebTextInputFlagAutocapitalizeSentences; |
| 1642 |
| 1643 struct FocusedElement { |
| 1644 const char* elementId; |
| 1645 int textInputFlags; |
| 1646 } focusedElements[] = { |
| 1647 {"input1", |
| 1648 defaultTextInputFlags | kWebTextInputFlagHaveNextFocusableElement}, |
| 1649 {"contenteditable1", kWebTextInputFlagHaveNextFocusableElement | |
| 1650 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1651 {"input2", defaultTextInputFlags | |
| 1652 kWebTextInputFlagHaveNextFocusableElement | |
| 1653 kWebTextInputFlagHavePreviousFocusableElement | |
| 1654 kWebTextInputFlagListeningToKeyboardEvents}, |
| 1655 {"textarea1", defaultTextInputFlags | |
| 1656 kWebTextInputFlagHaveNextFocusableElement | |
| 1657 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1658 {"input3", defaultTextInputFlags | |
| 1659 kWebTextInputFlagHaveNextFocusableElement | |
| 1660 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1661 {"textarea2", |
| 1662 defaultTextInputFlags | kWebTextInputFlagHavePreviousFocusableElement}, |
| 1663 }; |
| 1664 |
| 1665 // Forward Navigation in form1 with NEXT |
| 1666 Element* input1 = document->getElementById("input1"); |
| 1667 input1->focus(); |
| 1668 Element* currentFocus = nullptr; |
| 1669 WebTextInputInfo textInputInfo; |
| 1670 for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) { |
| 1671 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1672 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1673 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1674 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1675 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1676 } |
| 1677 // Now focus will stay on previous focus itself, because it has no next |
| 1678 // element. |
| 1679 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1680 |
| 1681 // Backward Navigation in form1 with PREVIOUS |
| 1682 for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) { |
| 1683 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1684 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1685 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1686 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1687 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1688 } |
| 1689 // Now focus will stay on previous focus itself, because it has no previous |
| 1690 // element. |
| 1691 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1692 |
| 1693 // Setting a non editable element as focus in form1, and ensuring editable |
| 1694 // navigation is fine in forward and backward. |
| 1695 Element* button1 = document->getElementById("button1"); |
| 1696 button1->focus(); |
| 1697 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1698 // No Next/Previous element for elements outside form. |
| 1699 EXPECT_EQ(0, textInputInfo.flags); |
| 1700 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1701 Element* contenteditable1 = document->getElementById("contenteditable1"); |
| 1702 EXPECT_EQ(contenteditable1, document->FocusedElement()); |
| 1703 button1->focus(); |
| 1704 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1705 EXPECT_EQ(input1, document->FocusedElement()); |
| 1706 |
| 1707 Element* anchor1 = document->getElementById("anchor1"); |
| 1708 anchor1->focus(); |
| 1709 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1710 // No Next/Previous element for elements outside form. |
| 1711 EXPECT_EQ(0, textInputInfo.flags); |
| 1712 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1713 // Since anchor is not a form control element, next/previous element will |
| 1714 // be null, hence focus will stay same as it is. |
| 1715 EXPECT_EQ(anchor1, document->FocusedElement()); |
| 1716 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1717 EXPECT_EQ(anchor1, document->FocusedElement()); |
| 1718 |
| 1719 // Navigation of elements which is not part of any forms. |
| 1720 Element* textarea3 = document->getElementById("textarea3"); |
| 1721 textarea3->focus(); |
| 1722 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1723 // No Next/Previous element for elements outside form. |
| 1724 EXPECT_EQ(defaultTextInputFlags, textInputInfo.flags); |
| 1725 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1726 // No Next/Previous element to this element because it's not part of any |
| 1727 // form. Hence focus won't change wrt NEXT/PREVIOUS. |
| 1728 EXPECT_EQ(textarea3, document->FocusedElement()); |
| 1729 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1730 EXPECT_EQ(textarea3, document->FocusedElement()); |
| 1731 |
| 1732 // Navigation from an element which is part of a form but not an editable |
| 1733 // element. |
| 1734 Element* button2 = document->getElementById("button2"); |
| 1735 button2->focus(); |
| 1736 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1737 // No Next element for this element, due to last element outside the form. |
| 1738 EXPECT_EQ(0, textInputInfo.flags); |
| 1739 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1740 // No Next element to this element because it's not part of any form. |
| 1741 // Hence focus won't change wrt NEXT. |
| 1742 EXPECT_EQ(button2, document->FocusedElement()); |
| 1743 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1744 // Since button is a form control element from form1, ensuring focus is set |
| 1745 // at correct position. |
| 1746 Element* textarea2 = document->getElementById("textarea2"); |
| 1747 EXPECT_EQ(textarea2, document->FocusedElement()); |
| 1748 |
| 1749 Element* contenteditable2 = document->getElementById("contenteditable2"); |
| 1750 document->SetFocusedElement( |
| 1751 contenteditable2, |
| 1752 FocusParams(SelectionBehaviorOnFocus::kNone, kWebFocusTypeNone, nullptr)); |
| 1753 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1754 // No Next/Previous element for elements outside form. |
| 1755 EXPECT_EQ(0, textInputInfo.flags); |
| 1756 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1757 // No Next/Previous element to this element because it's not part of any |
| 1758 // form. Hence focus won't change wrt NEXT/PREVIOUS. |
| 1759 EXPECT_EQ(contenteditable2, document->FocusedElement()); |
| 1760 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1761 EXPECT_EQ(contenteditable2, document->FocusedElement()); |
| 1762 |
| 1763 // Navigation of elements which is having invalid form attribute and hence |
| 1764 // not part of any forms. |
| 1765 Element* textarea4 = document->getElementById("textarea4"); |
| 1766 textarea4->focus(); |
| 1767 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1768 // No Next/Previous element for elements which is having invalid form |
| 1769 // attribute. |
| 1770 EXPECT_EQ(defaultTextInputFlags, textInputInfo.flags); |
| 1771 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1772 // No Next/Previous element to this element because it's not part of any |
| 1773 // form. Hence focus won't change wrt NEXT/PREVIOUS. |
| 1774 EXPECT_EQ(textarea4, document->FocusedElement()); |
| 1775 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1776 EXPECT_EQ(textarea4, document->FocusedElement()); |
| 1777 |
| 1778 web_view_helper_.Reset(); |
| 1779 } |
| 1780 |
| 1781 TEST_P( |
| 1782 WebViewTest, |
| 1783 MoveFocusToNextFocusableElementInFormWithNonEditableNonFormControlElements)
{ |
| 1784 const std::string testFile = |
| 1785 "advance_focus_in_form_with_key_event_listeners.html"; |
| 1786 RegisterMockedHttpURLLoad(testFile); |
| 1787 WebViewImpl* webViewImpl = |
| 1788 web_view_helper_.InitializeAndLoad(base_url_ + testFile); |
| 1789 webViewImpl->SetInitialFocus(false); |
| 1790 Document* document = webViewImpl->MainFrameImpl()->GetFrame()->GetDocument(); |
| 1791 WebInputMethodController* activeInputMethodController = |
| 1792 webViewImpl->MainFrameImpl() |
| 1793 ->FrameWidget() |
| 1794 ->GetActiveWebInputMethodController(); |
| 1795 const int defaultTextInputFlags = kWebTextInputFlagAutocapitalizeSentences; |
| 1796 |
| 1797 struct FocusedElement { |
| 1798 const char* elementId; |
| 1799 int textInputFlags; |
| 1800 } focusedElements[] = { |
| 1801 {"textarea5", defaultTextInputFlags | |
| 1802 kWebTextInputFlagListeningToKeyboardEvents | |
| 1803 kWebTextInputFlagHaveNextFocusableElement}, |
| 1804 {"input4", defaultTextInputFlags | |
| 1805 kWebTextInputFlagListeningToKeyboardEvents | |
| 1806 kWebTextInputFlagHaveNextFocusableElement | |
| 1807 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1808 {"contenteditable3", kWebTextInputFlagListeningToKeyboardEvents | |
| 1809 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1810 }; |
| 1811 |
| 1812 // Forward Navigation in form2 with NEXT |
| 1813 Element* textarea5 = document->getElementById("textarea5"); |
| 1814 textarea5->focus(); |
| 1815 Element* currentFocus = nullptr; |
| 1816 WebTextInputInfo textInputInfo; |
| 1817 for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) { |
| 1818 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1819 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1820 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1821 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1822 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1823 } |
| 1824 // Now focus will stay on previous focus itself, because it has no next |
| 1825 // element. |
| 1826 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1827 |
| 1828 // Backward Navigation in form1 with PREVIOUS |
| 1829 for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) { |
| 1830 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1831 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1832 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1833 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1834 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1835 } |
| 1836 // Now focus will stay on previous focus itself, because it has no previous |
| 1837 // element. |
| 1838 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1839 |
| 1840 // Setting a non editable element as focus in form1, and ensuring editable |
| 1841 // navigation is fine in forward and backward. |
| 1842 Element* anchor2 = document->getElementById("anchor2"); |
| 1843 anchor2->focus(); |
| 1844 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1845 // No Next/Previous element for elements outside form. |
| 1846 EXPECT_EQ(0, textInputInfo.flags); |
| 1847 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1848 // No editable element after this inside the form, hence focus won't change. |
| 1849 EXPECT_EQ(anchor2, document->FocusedElement()); |
| 1850 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1851 // Since anchor is not a form control element, next/previous element will |
| 1852 // be null, hence focus will stay same as it is. |
| 1853 EXPECT_EQ(anchor2, document->FocusedElement()); |
| 1854 |
| 1855 web_view_helper_.Reset(); |
| 1856 } |
| 1857 |
| 1858 TEST_P(WebViewTest, MoveFocusToNextFocusableElementInFormWithTabIndexElements) { |
| 1859 const std::string testFile = |
| 1860 "advance_focus_in_form_with_tabindex_elements.html"; |
| 1861 RegisterMockedHttpURLLoad(testFile); |
| 1862 WebViewImpl* webViewImpl = |
| 1863 web_view_helper_.InitializeAndLoad(base_url_ + testFile); |
| 1864 webViewImpl->SetInitialFocus(false); |
| 1865 Document* document = webViewImpl->MainFrameImpl()->GetFrame()->GetDocument(); |
| 1866 WebInputMethodController* activeInputMethodController = |
| 1867 webViewImpl->MainFrameImpl() |
| 1868 ->FrameWidget() |
| 1869 ->GetActiveWebInputMethodController(); |
| 1870 const int defaultTextInputFlags = kWebTextInputFlagAutocapitalizeSentences; |
| 1871 |
| 1872 struct FocusedElement { |
| 1873 const char* elementId; |
| 1874 int textInputFlags; |
| 1875 } focusedElements[] = { |
| 1876 {"textarea6", |
| 1877 defaultTextInputFlags | kWebTextInputFlagHaveNextFocusableElement}, |
| 1878 {"input5", defaultTextInputFlags | |
| 1879 kWebTextInputFlagHaveNextFocusableElement | |
| 1880 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1881 {"contenteditable4", kWebTextInputFlagHaveNextFocusableElement | |
| 1882 kWebTextInputFlagHavePreviousFocusableElement}, |
| 1883 {"input6", |
| 1884 defaultTextInputFlags | kWebTextInputFlagHavePreviousFocusableElement}, |
| 1885 }; |
| 1886 |
| 1887 // Forward Navigation in form with NEXT which has tabindex attribute |
| 1888 // which differs visual order. |
| 1889 Element* textarea6 = document->getElementById("textarea6"); |
| 1890 textarea6->focus(); |
| 1891 Element* currentFocus = nullptr; |
| 1892 WebTextInputInfo textInputInfo; |
| 1893 for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) { |
| 1894 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1895 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1896 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1897 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1898 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1899 } |
| 1900 // No next editable element which is focusable with proper tab index, hence |
| 1901 // staying on previous focus. |
| 1902 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1903 |
| 1904 // Backward Navigation in form with PREVIOUS which has tabindex attribute |
| 1905 // which differs visual order. |
| 1906 for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) { |
| 1907 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1908 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1909 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1910 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1911 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1912 } |
| 1913 // Now focus will stay on previous focus itself, because it has no previous |
| 1914 // element. |
| 1915 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1916 |
| 1917 // Setting an element which has invalid tabindex and ensuring it is not |
| 1918 // modifying further navigation. |
| 1919 Element* contenteditable5 = document->getElementById("contenteditable5"); |
| 1920 contenteditable5->focus(); |
| 1921 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1922 Element* input6 = document->getElementById("input6"); |
| 1923 EXPECT_EQ(input6, document->FocusedElement()); |
| 1924 contenteditable5->focus(); |
| 1925 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1926 EXPECT_EQ(textarea6, document->FocusedElement()); |
| 1927 |
| 1928 web_view_helper_.Reset(); |
| 1929 } |
| 1930 |
| 1931 TEST_P(WebViewTest, |
| 1932 MoveFocusToNextFocusableElementInFormWithDisabledAndReadonlyElements) { |
| 1933 const std::string testFile = |
| 1934 "advance_focus_in_form_with_disabled_and_readonly_elements.html"; |
| 1935 RegisterMockedHttpURLLoad(testFile); |
| 1936 WebViewImpl* webViewImpl = |
| 1937 web_view_helper_.InitializeAndLoad(base_url_ + testFile); |
| 1938 webViewImpl->SetInitialFocus(false); |
| 1939 Document* document = webViewImpl->MainFrameImpl()->GetFrame()->GetDocument(); |
| 1940 WebInputMethodController* activeInputMethodController = |
| 1941 webViewImpl->MainFrameImpl() |
| 1942 ->FrameWidget() |
| 1943 ->GetActiveWebInputMethodController(); |
| 1944 |
| 1945 struct FocusedElement { |
| 1946 const char* elementId; |
| 1947 int textInputFlags; |
| 1948 } focusedElements[] = { |
| 1949 {"contenteditable6", kWebTextInputFlagHaveNextFocusableElement}, |
| 1950 {"contenteditable7", kWebTextInputFlagHavePreviousFocusableElement}, |
| 1951 }; |
| 1952 // Forward Navigation in form with NEXT which has has disabled/enabled |
| 1953 // elements which will gets skipped during navigation. |
| 1954 Element* contenteditable6 = document->getElementById("contenteditable6"); |
| 1955 contenteditable6->focus(); |
| 1956 Element* currentFocus = nullptr; |
| 1957 WebTextInputInfo textInputInfo; |
| 1958 for (size_t i = 0; i < WTF_ARRAY_LENGTH(focusedElements); ++i) { |
| 1959 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1960 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1961 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1962 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1963 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeForward); |
| 1964 } |
| 1965 // No next editable element which is focusable, hence staying on previous |
| 1966 // focus. |
| 1967 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1968 |
| 1969 // Backward Navigation in form with PREVIOUS which has has |
| 1970 // disabled/enabled elements which will gets skipped during navigation. |
| 1971 for (size_t i = WTF_ARRAY_LENGTH(focusedElements); i-- > 0;) { |
| 1972 currentFocus = document->getElementById(focusedElements[i].elementId); |
| 1973 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1974 textInputInfo = activeInputMethodController->TextInputInfo(); |
| 1975 EXPECT_EQ(focusedElements[i].textInputFlags, textInputInfo.flags); |
| 1976 webViewImpl->MainFrameImpl()->AdvanceFocusInForm(kWebFocusTypeBackward); |
| 1977 } |
| 1978 // Now focus will stay on previous focus itself, because it has no previous |
| 1979 // element. |
| 1980 EXPECT_EQ(currentFocus, document->FocusedElement()); |
| 1981 |
| 1982 web_view_helper_.Reset(); |
| 1983 } |
| 1984 |
1627 TEST_P(WebViewTest, ExitingDeviceEmulationResetsPageScale) { | 1985 TEST_P(WebViewTest, ExitingDeviceEmulationResetsPageScale) { |
1628 RegisterMockedHttpURLLoad("200-by-300.html"); | 1986 RegisterMockedHttpURLLoad("200-by-300.html"); |
1629 WebViewImpl* web_view_impl = | 1987 WebViewImpl* web_view_impl = |
1630 web_view_helper_.InitializeAndLoad(base_url_ + "200-by-300.html"); | 1988 web_view_helper_.InitializeAndLoad(base_url_ + "200-by-300.html"); |
1631 web_view_impl->Resize(WebSize(200, 300)); | 1989 web_view_impl->Resize(WebSize(200, 300)); |
1632 | 1990 |
1633 float page_scale_expected = web_view_impl->PageScaleFactor(); | 1991 float page_scale_expected = web_view_impl->PageScaleFactor(); |
1634 | 1992 |
1635 WebDeviceEmulationParams params; | 1993 WebDeviceEmulationParams params; |
1636 params.screen_position = WebDeviceEmulationParams::kDesktop; | 1994 params.screen_position = WebDeviceEmulationParams::kDesktop; |
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4344 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); | 4702 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); |
4345 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4703 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
4346 EXPECT_NE(nullptr, | 4704 EXPECT_NE(nullptr, |
4347 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); | 4705 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); |
4348 } else { | 4706 } else { |
4349 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); | 4707 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); |
4350 } | 4708 } |
4351 } | 4709 } |
4352 | 4710 |
4353 } // namespace blink | 4711 } // namespace blink |
OLD | NEW |