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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7689 }; | 7689 }; |
7690 | 7690 |
7691 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) | 7691 TEST_P(ParameterizedWebFrameTest, RemoteFrameInitialCommitType) |
7692 { | 7692 { |
7693 FrameTestHelpers::TestWebViewClient viewClient; | 7693 FrameTestHelpers::TestWebViewClient viewClient; |
7694 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7694 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
7695 WebView* view = WebView::create(&viewClient); | 7695 WebView* view = WebView::create(&viewClient); |
7696 view->setMainFrame(remoteClient.frame()); | 7696 view->setMainFrame(remoteClient.frame()); |
7697 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); | 7697 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createFromStrin
g(WebString::fromUTF8(m_baseURL))); |
7698 | 7698 |
7699 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7699 // If an iframe has a remote main frame, ensure the initial commit is correc
tly identified as WebInitialCommitInChildFrame. |
7700 CommitTypeWebFrameClient childFrameClient; | 7700 CommitTypeWebFrameClient childFrameClient; |
7701 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr, WebFrameOwnerProperties()); | 7701 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr, WebFrameOwnerProperties()); |
7702 registerMockedHttpURLLoad("foo.html"); | 7702 registerMockedHttpURLLoad("foo.html"); |
7703 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7703 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
7704 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7704 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
7705 view->close(); | 7705 view->close(); |
7706 } | 7706 } |
7707 | 7707 |
7708 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 7708 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
7709 public: | 7709 public: |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8360 | 8360 |
8361 TEST_F(WebFrameTest, CallbackOrdering) | 8361 TEST_F(WebFrameTest, CallbackOrdering) |
8362 { | 8362 { |
8363 registerMockedHttpURLLoad("foo.html"); | 8363 registerMockedHttpURLLoad("foo.html"); |
8364 FrameTestHelpers::WebViewHelper webViewHelper; | 8364 FrameTestHelpers::WebViewHelper webViewHelper; |
8365 CallbackOrderingWebFrameClient client; | 8365 CallbackOrderingWebFrameClient client; |
8366 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); | 8366 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); |
8367 } | 8367 } |
8368 | 8368 |
8369 } // namespace blink | 8369 } // namespace blink |
OLD | NEW |