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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); | 803 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); |
804 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().height); | 804 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().height); |
805 | 805 |
806 // Make the page scale and scroll with the given paremeters. | 806 // Make the page scale and scroll with the given paremeters. |
807 webViewImpl->setPageScaleFactor(2.0f); | 807 webViewImpl->setPageScaleFactor(2.0f); |
808 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84)); | 808 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84)); |
809 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 809 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
810 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); | 810 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); |
811 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); | 811 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); |
812 | 812 |
813 RefPtr<WebCore::Element> element = static_cast<PassRefPtr<WebCore::Element>
>(webViewImpl->mainFrame()->document().body()); | 813 RefPtrWillBeRawPtr<WebCore::Element> element = static_cast<PassRefPtrWillBeR
awPtr<WebCore::Element> >(webViewImpl->mainFrame()->document().body()); |
814 webViewImpl->enterFullScreenForElement(element.get()); | 814 webViewImpl->enterFullScreenForElement(element.get()); |
815 webViewImpl->willEnterFullScreen(); | 815 webViewImpl->willEnterFullScreen(); |
816 webViewImpl->didEnterFullScreen(); | 816 webViewImpl->didEnterFullScreen(); |
817 | 817 |
818 // Page scale factor must be 1.0 during fullscreen for elements to be sized | 818 // Page scale factor must be 1.0 during fullscreen for elements to be sized |
819 // properly. | 819 // properly. |
820 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); | 820 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); |
821 | 821 |
822 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. | 822 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. |
823 RefPtr<WebCore::Element> otherElement = static_cast<PassRefPtr<WebCore::Elem
ent> >(webViewImpl->mainFrame()->document().head()); | 823 RefPtrWillBeRawPtr<WebCore::Element> otherElement = static_cast<PassRefPtrWi
llBeRawPtr<WebCore::Element> >(webViewImpl->mainFrame()->document().head()); |
824 webViewImpl->enterFullScreenForElement(otherElement.get()); | 824 webViewImpl->enterFullScreenForElement(otherElement.get()); |
825 | 825 |
826 // Confirm that exiting fullscreen restores the parameters. | 826 // Confirm that exiting fullscreen restores the parameters. |
827 webViewImpl->willExitFullScreen(); | 827 webViewImpl->willExitFullScreen(); |
828 webViewImpl->didExitFullScreen(); | 828 webViewImpl->didExitFullScreen(); |
829 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 829 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
830 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); | 830 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); |
831 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); | 831 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); |
832 | 832 |
833 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. | 833 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 private: | 916 private: |
917 bool m_contentDetectionRequested; | 917 bool m_contentDetectionRequested; |
918 bool m_pendingIntentsCancelled; | 918 bool m_pendingIntentsCancelled; |
919 WebURL m_scheduledIntentURL; | 919 WebURL m_scheduledIntentURL; |
920 WebContentDetectionResult m_contentDetectionResult; | 920 WebContentDetectionResult m_contentDetectionResult; |
921 }; | 921 }; |
922 | 922 |
923 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web
String& id) | 923 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web
String& id) |
924 { | 924 { |
925 ASSERT(webView); | 925 ASSERT(webView); |
926 RefPtr<WebCore::Element> element = static_cast<PassRefPtr<WebCore::Element>
>(webView->mainFrame()->document().getElementById(id)); | 926 RefPtrWillBeRawPtr<WebCore::Element> element = static_cast<PassRefPtrWillBeR
awPtr<WebCore::Element> >(webView->mainFrame()->document().getElementById(id)); |
927 if (!element) | 927 if (!element) |
928 return false; | 928 return false; |
929 | 929 |
930 element->scrollIntoViewIfNeeded(); | 930 element->scrollIntoViewIfNeeded(); |
931 WebCore::IntPoint center = element->screenRect().center(); | 931 WebCore::IntPoint center = element->screenRect().center(); |
932 | 932 |
933 WebGestureEvent event; | 933 WebGestureEvent event; |
934 event.type = type; | 934 event.type = type; |
935 event.x = center.x(); | 935 event.x = center.x(); |
936 event.y = center.y(); | 936 event.y = center.y(); |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 | 1926 |
1927 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 1927 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
1928 | 1928 |
1929 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 1929 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
1930 | 1930 |
1931 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 1931 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
1932 webView->setAutofillClient(0); | 1932 webView->setAutofillClient(0); |
1933 } | 1933 } |
1934 | 1934 |
1935 } // namespace | 1935 } // namespace |
OLD | NEW |