| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 // Focus the second textbox that's in a touch-action: manipulation ancestor, | 2973 // Focus the second textbox that's in a touch-action: manipulation ancestor, |
| 2974 // this should cause an autozoom since it allows pinch-zoom. | 2974 // this should cause an autozoom since it allows pinch-zoom. |
| 2975 webViewHelper.webViewImpl()->advanceFocus(false); | 2975 webViewHelper.webViewImpl()->advanceFocus(false); |
| 2976 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); | 2976 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); |
| 2977 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes
ting(), initialScale); | 2977 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes
ting(), initialScale); |
| 2978 | 2978 |
| 2979 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init
ialScale); | 2979 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), init
ialScale); |
| 2980 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); | 2980 ASSERT_EQ(initialScale, webViewHelper.webViewImpl()->pageScaleFactor()); |
| 2981 | 2981 |
| 2982 // Focus the third textbox that has a touch-action: pan-x ancestor, this | 2982 // Focus the third textbox that has a touch-action: pan-x ancestor, this |
| 2983 // should cause an autozoom since it's seperated from the node with the | 2983 // should cause an autozoom since it's separated from the node with the |
| 2984 // touch-action by an overflow:scroll element. | 2984 // touch-action by an overflow:scroll element. |
| 2985 webViewHelper.webView()->advanceFocus(false); | 2985 webViewHelper.webView()->advanceFocus(false); |
| 2986 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); | 2986 webViewHelper.webViewImpl()->scrollFocusedNodeIntoRect(WebRect()); |
| 2987 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes
ting(), initialScale); | 2987 EXPECT_GT(webViewHelper.webViewImpl()->fakePageScaleAnimationPageScaleForTes
ting(), initialScale); |
| 2988 } | 2988 } |
| 2989 | 2989 |
| 2990 | 2990 |
| 2991 TEST_F(WebFrameTest, DivScrollIntoEditableTest) | 2991 TEST_F(WebFrameTest, DivScrollIntoEditableTest) |
| 2992 { | 2992 { |
| 2993 registerMockedHttpURLLoad("get_scale_for_zoom_into_editable_test.html"); | 2993 registerMockedHttpURLLoad("get_scale_for_zoom_into_editable_test.html"); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 const float minReadableCaretHeight = 16.0f; | 3080 const float minReadableCaretHeight = 16.0f; |
| 3081 FrameTestHelpers::WebViewHelper webViewHelper; | 3081 FrameTestHelpers::WebViewHelper webViewHelper; |
| 3082 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editabl
e_test.html"); | 3082 webViewHelper.initializeAndLoad(m_baseURL + "get_scale_for_zoom_into_editabl
e_test.html"); |
| 3083 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(fal
se); | 3083 webViewHelper.webViewImpl()->page()->settings().setTextAutosizingEnabled(fal
se); |
| 3084 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | 3084 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); |
| 3085 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); | 3085 webViewHelper.webViewImpl()->enableFakePageScaleAnimationForTesting(true); |
| 3086 | 3086 |
| 3087 const WebRect editBoxWithText(200, 200, 250, 20); | 3087 const WebRect editBoxWithText(200, 200, 250, 20); |
| 3088 | 3088 |
| 3089 webViewHelper.webView()->advanceFocus(false); | 3089 webViewHelper.webView()->advanceFocus(false); |
| 3090 // Set the caret to the begining of the input box. | 3090 // Set the caret to the beginning of the input box. |
| 3091 webViewHelper.webView()->mainFrame()->document().getElementById("EditBoxWith
Text").to<WebInputElement>().setSelectionRange(0, 0); | 3091 webViewHelper.webView()->mainFrame()->document().getElementById("EditBoxWith
Text").to<WebInputElement>().setSelectionRange(0, 0); |
| 3092 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), 1); | 3092 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), 1); |
| 3093 WebRect rect, caret; | 3093 WebRect rect, caret; |
| 3094 webViewHelper.webViewImpl()->selectionBounds(caret, rect); | 3094 webViewHelper.webViewImpl()->selectionBounds(caret, rect); |
| 3095 | 3095 |
| 3096 // Set the page scale to be twice as large as the minimal readable scale. | 3096 // Set the page scale to be twice as large as the minimal readable scale. |
| 3097 float newScale = minReadableCaretHeight / caret.height * 2.0; | 3097 float newScale = minReadableCaretHeight / caret.height * 2.0; |
| 3098 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), newS
cale); | 3098 setScaleAndScrollAndLayout(webViewHelper.webViewImpl(), WebPoint(0, 0), newS
cale); |
| 3099 | 3099 |
| 3100 float scale; | 3100 float scale; |
| (...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6410 | 6410 |
| 6411 // Show more, make sure the scroll actually gets clamped. | 6411 // Show more, make sure the scroll actually gets clamped. |
| 6412 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 20.0f / topControlsHeight); | 6412 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 20.0f / topControlsHeight); |
| 6413 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); | 6413 webView->mainFrame()->setScrollOffset(WebSize(0, 2000)); |
| 6414 EXPECT_POINT_EQ(IntPoint(0, 1940), IntPoint(frameView->scrollOffset())); | 6414 EXPECT_POINT_EQ(IntPoint(0, 1940), IntPoint(frameView->scrollOffset())); |
| 6415 | 6415 |
| 6416 // Hide until there's 10px showing. | 6416 // Hide until there's 10px showing. |
| 6417 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, -30.0f / topControlsHeight); | 6417 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, -30.0f / topControlsHeight); |
| 6418 EXPECT_POINT_EQ(IntPoint(0, 1910), frameView->maximumScrollPosition()); | 6418 EXPECT_POINT_EQ(IntPoint(0, 1910), frameView->maximumScrollPosition()); |
| 6419 | 6419 |
| 6420 // Simulate a LayoutPart::resize. The frame is resized to accomodate | 6420 // Simulate a LayoutPart::resize. The frame is resized to accommodate |
| 6421 // the top controls and Blink's view of the top controls matches that of | 6421 // the top controls and Blink's view of the top controls matches that of |
| 6422 // the CC | 6422 // the CC |
| 6423 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 30.0f / topControlsHeight); | 6423 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, 30.0f / topControlsHeight); |
| 6424 webView->setTopControlsHeight(40.0f, true); | 6424 webView->setTopControlsHeight(40.0f, true); |
| 6425 webView->resize(WebSize(100, 60)); | 6425 webView->resize(WebSize(100, 60)); |
| 6426 webView->updateAllLifecyclePhases(); | 6426 webView->updateAllLifecyclePhases(); |
| 6427 EXPECT_POINT_EQ(IntPoint(0, 1940), frameView->maximumScrollPosition()); | 6427 EXPECT_POINT_EQ(IntPoint(0, 1940), frameView->maximumScrollPosition()); |
| 6428 | 6428 |
| 6429 // Now simulate hiding. | 6429 // Now simulate hiding. |
| 6430 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, -10.0f / topControlsHeight); | 6430 webView->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatSize(),
1.0f, -10.0f / topControlsHeight); |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7650 }; | 7650 }; |
| 7651 | 7651 |
| 7652 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) | 7652 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) |
| 7653 { | 7653 { |
| 7654 FrameTestHelpers::TestWebViewClient viewClient; | 7654 FrameTestHelpers::TestWebViewClient viewClient; |
| 7655 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7655 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7656 WebView* view = WebView::create(&viewClient); | 7656 WebView* view = WebView::create(&viewClient); |
| 7657 view->setMainFrame(remoteClient.frame()); | 7657 view->setMainFrame(remoteClient.frame()); |
| 7658 toRemoteFrame(toCoreFrame(view->mainFrame()))->securityContext()->setReplica
tedOrigin(SecurityOrigin::create(toKURL(m_baseURL))); | 7658 toRemoteFrame(toCoreFrame(view->mainFrame()))->securityContext()->setReplica
tedOrigin(SecurityOrigin::create(toKURL(m_baseURL))); |
| 7659 | 7659 |
| 7660 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7660 // If an iframe has a remote main frame, ensure the initial commit is correc
tly identified as WebInitialCommitInChildFrame. |
| 7661 CommitTypeWebFrameClient childFrameClient; | 7661 CommitTypeWebFrameClient childFrameClient; |
| 7662 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr, WebFrameOwnerProperties()); | 7662 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr, WebFrameOwnerProperties()); |
| 7663 registerMockedHttpURLLoad("foo.html"); | 7663 registerMockedHttpURLLoad("foo.html"); |
| 7664 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7664 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7665 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7665 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7666 view->close(); | 7666 view->close(); |
| 7667 } | 7667 } |
| 7668 | 7668 |
| 7669 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 7669 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 7670 public: | 7670 public: |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8322 | 8322 |
| 8323 TEST_F(WebFrameTest, CallbackOrdering) | 8323 TEST_F(WebFrameTest, CallbackOrdering) |
| 8324 { | 8324 { |
| 8325 registerMockedHttpURLLoad("foo.html"); | 8325 registerMockedHttpURLLoad("foo.html"); |
| 8326 FrameTestHelpers::WebViewHelper webViewHelper; | 8326 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8327 CallbackOrderingWebFrameClient client; | 8327 CallbackOrderingWebFrameClient client; |
| 8328 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); | 8328 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); |
| 8329 } | 8329 } |
| 8330 | 8330 |
| 8331 } // namespace blink | 8331 } // namespace blink |
| OLD | NEW |