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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1944 webView->resize(WebSize(640, 480)); | 1944 webView->resize(WebSize(640, 480)); |
1945 webView->setPageScaleFactor(pageScaleFactor); | 1945 webView->setPageScaleFactor(pageScaleFactor); |
1946 webView->layout(); | 1946 webView->layout(); |
1947 runPendingTasks(); | 1947 runPendingTasks(); |
1948 | 1948 |
1949 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 1949 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
1950 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 1950 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
1951 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); | 1951 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); |
1952 | 1952 |
1953 WebRect expectedRootBounds = ExpectedRootBounds(document, webView->pageScale Factor()); | 1953 WebRect expectedRootBounds = ExpectedRootBounds(document, webView->pageScale Factor()); |
1954 WebRect actualRootBounds; | |
1955 webView->getSelectionRootBounds(actualRootBounds); | |
1956 ASSERT_EQ(expectedRootBounds, actualRootBounds); | |
1957 | 1954 |
1958 WebRect anchor, focus; | 1955 WebRect anchor, focus; |
1959 webView->selectionBounds(anchor, focus); | 1956 webView->selectionBounds(anchor, focus); |
1960 IntRect expectedIntRect = expectedRootBounds; | 1957 IntRect expectedIntRect = expectedRootBounds; |
pdr.
2014/12/04 19:01:59
Lets remove "WebRect expectedRootBounds = ..." abo
| |
1961 ASSERT_TRUE(expectedIntRect.contains(anchor)); | 1958 ASSERT_TRUE(expectedIntRect.contains(anchor)); |
1962 // The "overflow" tests have the focus boundary outside of the element box. | 1959 // The "overflow" tests have the focus boundary outside of the element box. |
1963 ASSERT_EQ(url.find("overflow") == std::string::npos, expectedIntRect.contain s(focus)); | 1960 ASSERT_EQ(url.find("overflow") == std::string::npos, expectedIntRect.contain s(focus)); |
1964 } | 1961 } |
1965 | 1962 |
1966 TEST_F(WebViewTest, GetSelectionRootBounds) | |
1967 { | |
1968 // Register all the pages we will be using. | |
1969 registerMockedHttpURLLoad("select_range_basic.html"); | |
1970 registerMockedHttpURLLoad("select_range_div_editable.html"); | |
1971 registerMockedHttpURLLoad("select_range_scroll.html"); | |
1972 registerMockedHttpURLLoad("select_range_span_editable.html"); | |
1973 registerMockedHttpURLLoad("select_range_input.html"); | |
1974 registerMockedHttpURLLoad("select_range_input_overflow.html"); | |
1975 registerMockedHttpURLLoad("select_range_textarea.html"); | |
1976 registerMockedHttpURLLoad("select_range_textarea_overflow.html"); | |
1977 registerMockedHttpURLLoad("select_range_iframe.html"); | |
1978 registerMockedHttpURLLoad("select_range_iframe_div_editable.html"); | |
1979 registerMockedHttpURLLoad("select_range_iframe_scroll.html"); | |
1980 registerMockedHttpURLLoad("select_range_iframe_span_editable.html"); | |
1981 registerMockedHttpURLLoad("select_range_iframe_input.html"); | |
1982 registerMockedHttpURLLoad("select_range_iframe_input_overflow.html"); | |
1983 registerMockedHttpURLLoad("select_range_iframe_textarea.html"); | |
1984 registerMockedHttpURLLoad("select_range_iframe_textarea_overflow.html"); | |
1985 | |
1986 // Test with simple pages. | |
1987 testSelectionRootBounds("select_range_basic.html", 1.0f); | |
1988 testSelectionRootBounds("select_range_div_editable.html", 1.0f); | |
1989 testSelectionRootBounds("select_range_scroll.html", 1.0f); | |
1990 testSelectionRootBounds("select_range_span_editable.html", 1.0f); | |
1991 testSelectionRootBounds("select_range_input.html", 1.0f); | |
1992 testSelectionRootBounds("select_range_input_overflow.html", 1.0f); | |
1993 testSelectionRootBounds("select_range_textarea.html", 1.0f); | |
1994 testSelectionRootBounds("select_range_textarea_overflow.html", 1.0f); | |
1995 | |
1996 // Test with the same pages as above in iframes. | |
1997 testSelectionRootBounds("select_range_iframe.html", 1.0f); | |
1998 testSelectionRootBounds("select_range_iframe_div_editable.html", 1.0f); | |
1999 testSelectionRootBounds("select_range_iframe_scroll.html", 1.0f); | |
2000 testSelectionRootBounds("select_range_iframe_span_editable.html", 1.0f); | |
2001 testSelectionRootBounds("select_range_iframe_input.html", 1.0f); | |
2002 testSelectionRootBounds("select_range_iframe_input_overflow.html", 1.0f); | |
2003 testSelectionRootBounds("select_range_iframe_textarea.html", 1.0f); | |
2004 testSelectionRootBounds("select_range_iframe_textarea_overflow.html", 1.0f); | |
2005 | |
2006 // Basic page with scale factor. | |
2007 testSelectionRootBounds("select_range_basic.html", 0.0f); | |
2008 testSelectionRootBounds("select_range_basic.html", 0.1f); | |
2009 testSelectionRootBounds("select_range_basic.html", 1.5f); | |
2010 testSelectionRootBounds("select_range_basic.html", 2.0f); | |
2011 } | |
2012 | |
2013 TEST_F(WebViewTest, GetSelectionRootBoundsBrokenHeight) | 1963 TEST_F(WebViewTest, GetSelectionRootBoundsBrokenHeight) |
pdr.
2014/12/04 19:01:59
Lets just remove this test entirely.
| |
2014 { | 1964 { |
2015 WebSize contentSize = WebSize(640, 480); | 1965 WebSize contentSize = WebSize(640, 480); |
2016 | 1966 |
2017 registerMockedHttpURLLoad("select_range_basic_broken_height.html"); | 1967 registerMockedHttpURLLoad("select_range_basic_broken_height.html"); |
2018 | 1968 |
2019 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "select_ran ge_basic_broken_height.html", true); | 1969 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "select_ran ge_basic_broken_height.html", true); |
2020 webView->resize(contentSize); | 1970 webView->resize(contentSize); |
2021 webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); | 1971 webView->setPageScaleFactor(1.0f, WebPoint(0, 0)); |
2022 webView->layout(); | 1972 webView->layout(); |
2023 runPendingTasks(); | 1973 runPendingTasks(); |
2024 | 1974 |
2025 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 1975 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
2026 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); | 1976 EXPECT_TRUE(frame->frame()->document()->isHTMLDocument()); |
2027 | 1977 |
2028 WebRect expectedRootBounds = WebRect(0, 0, contentSize.width, contentSize.he ight); | 1978 WebRect expectedRootBounds = WebRect(0, 0, contentSize.width, contentSize.he ight); |
2029 WebRect actualRootBounds; | |
2030 webView->getSelectionRootBounds(actualRootBounds); | |
2031 ASSERT_EQ(expectedRootBounds, actualRootBounds); | |
2032 } | 1979 } |
2033 | 1980 |
2034 class NonUserInputTextUpdateWebViewClient : public FrameTestHelpers::TestWebView Client { | 1981 class NonUserInputTextUpdateWebViewClient : public FrameTestHelpers::TestWebView Client { |
2035 public: | 1982 public: |
2036 NonUserInputTextUpdateWebViewClient() : m_textIsUpdated(false) { } | 1983 NonUserInputTextUpdateWebViewClient() : m_textIsUpdated(false) { } |
2037 | 1984 |
2038 // WebWidgetClient methods | 1985 // WebWidgetClient methods |
2039 virtual void didUpdateTextOfFocusedElementByNonUserInput() override | 1986 virtual void didUpdateTextOfFocusedElementByNonUserInput() override |
2040 { | 1987 { |
2041 m_textIsUpdated = true; | 1988 m_textIsUpdated = true; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2229 loadFrame(webView->mainFrame(), url); | 2176 loadFrame(webView->mainFrame(), url); |
2230 | 2177 |
2231 FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl()->frame View(); | 2178 FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl()->frame View(); |
2232 | 2179 |
2233 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T his EXPECT is | 2180 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T his EXPECT is |
2234 // merely a dummy. The real test is that we don't trigger asserts in debug b uilds. | 2181 // merely a dummy. The real test is that we don't trigger asserts in debug b uilds. |
2235 EXPECT_FALSE(frameView->needsLayout()); | 2182 EXPECT_FALSE(frameView->needsLayout()); |
2236 }; | 2183 }; |
2237 | 2184 |
2238 } // namespace | 2185 } // namespace |
OLD | NEW |