| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); | 960 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); |
| 961 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().height); | 961 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().height); |
| 962 | 962 |
| 963 // Make the page scale and scroll with the given paremeters. | 963 // Make the page scale and scroll with the given paremeters. |
| 964 webViewImpl->setPageScaleFactor(2.0f); | 964 webViewImpl->setPageScaleFactor(2.0f); |
| 965 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84)); | 965 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84)); |
| 966 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 966 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
| 967 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); | 967 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); |
| 968 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); | 968 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); |
| 969 | 969 |
| 970 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment> >(webViewImpl->mainFrame()->document().body()); | 970 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment>>(webViewImpl->mainFrame()->document().body()); |
| 971 webViewImpl->enterFullScreenForElement(element.get()); | 971 webViewImpl->enterFullScreenForElement(element.get()); |
| 972 webViewImpl->didEnterFullScreen(); | 972 webViewImpl->didEnterFullScreen(); |
| 973 | 973 |
| 974 // Page scale factor must be 1.0 during fullscreen for elements to be sized | 974 // Page scale factor must be 1.0 during fullscreen for elements to be sized |
| 975 // properly. | 975 // properly. |
| 976 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); | 976 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); |
| 977 | 977 |
| 978 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. | 978 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. |
| 979 RefPtrWillBeRawPtr<Element> otherElement = static_cast<PassRefPtrWillBeRawPt
r<Element> >(webViewImpl->mainFrame()->document().head()); | 979 RefPtrWillBeRawPtr<Element> otherElement = static_cast<PassRefPtrWillBeRawPt
r<Element>>(webViewImpl->mainFrame()->document().head()); |
| 980 webViewImpl->enterFullScreenForElement(otherElement.get()); | 980 webViewImpl->enterFullScreenForElement(otherElement.get()); |
| 981 | 981 |
| 982 // Confirm that exiting fullscreen restores the parameters. | 982 // Confirm that exiting fullscreen restores the parameters. |
| 983 webViewImpl->didExitFullScreen(); | 983 webViewImpl->didExitFullScreen(); |
| 984 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); | 984 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); |
| 985 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); | 985 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); |
| 986 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); | 986 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); |
| 987 | 987 |
| 988 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. | 988 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. |
| 989 } | 989 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 private: | 1117 private: |
| 1118 bool m_contentDetectionRequested; | 1118 bool m_contentDetectionRequested; |
| 1119 bool m_pendingIntentsCancelled; | 1119 bool m_pendingIntentsCancelled; |
| 1120 WebURL m_scheduledIntentURL; | 1120 WebURL m_scheduledIntentURL; |
| 1121 WebContentDetectionResult m_contentDetectionResult; | 1121 WebContentDetectionResult m_contentDetectionResult; |
| 1122 }; | 1122 }; |
| 1123 | 1123 |
| 1124 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web
String& id) | 1124 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web
String& id) |
| 1125 { | 1125 { |
| 1126 ASSERT(webView); | 1126 ASSERT(webView); |
| 1127 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment> >(webView->mainFrame()->document().getElementById(id)); | 1127 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment>>(webView->mainFrame()->document().getElementById(id)); |
| 1128 if (!element) | 1128 if (!element) |
| 1129 return false; | 1129 return false; |
| 1130 | 1130 |
| 1131 element->scrollIntoViewIfNeeded(); | 1131 element->scrollIntoViewIfNeeded(); |
| 1132 IntPoint center = element->screenRect().center(); | 1132 IntPoint center = element->screenRect().center(); |
| 1133 | 1133 |
| 1134 WebGestureEvent event; | 1134 WebGestureEvent event; |
| 1135 event.type = type; | 1135 event.type = type; |
| 1136 event.x = center.x(); | 1136 event.x = center.x(); |
| 1137 event.y = center.y(); | 1137 event.y = center.y(); |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2172 EXPECT_EQ(100, size.width); | 2172 EXPECT_EQ(100, size.width); |
| 2173 EXPECT_EQ(100, size.height); | 2173 EXPECT_EQ(100, size.height); |
| 2174 | 2174 |
| 2175 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(2.0)); | 2175 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(2.0)); |
| 2176 size = webView->contentsPreferredMinimumSize(); | 2176 size = webView->contentsPreferredMinimumSize(); |
| 2177 EXPECT_EQ(200, size.width); | 2177 EXPECT_EQ(200, size.width); |
| 2178 EXPECT_EQ(200, size.height); | 2178 EXPECT_EQ(200, size.height); |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 } // namespace | 2181 } // namespace |
| OLD | NEW |