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 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/V8Document.h" | 33 #include "bindings/core/v8/V8Document.h" |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
36 #include "core/editing/FrameSelection.h" | 36 #include "core/editing/FrameSelection.h" |
37 #include "core/editing/InputMethodController.h" | 37 #include "core/editing/InputMethodController.h" |
38 #include "core/editing/markers/DocumentMarkerController.h" | 38 #include "core/editing/markers/DocumentMarkerController.h" |
39 #include "core/frame/EventHandlerRegistry.h" | 39 #include "core/frame/EventHandlerRegistry.h" |
40 #include "core/frame/FrameHost.h" | 40 #include "core/frame/FrameHost.h" |
41 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/PageScaleConstraints.h" |
| 44 #include "core/frame/PageScaleConstraintsSet.h" |
43 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
44 #include "core/frame/VisualViewport.h" | 46 #include "core/frame/VisualViewport.h" |
45 #include "core/html/HTMLDocument.h" | 47 #include "core/html/HTMLDocument.h" |
46 #include "core/html/HTMLIFrameElement.h" | 48 #include "core/html/HTMLIFrameElement.h" |
47 #include "core/html/HTMLInputElement.h" | 49 #include "core/html/HTMLInputElement.h" |
48 #include "core/html/HTMLTextAreaElement.h" | 50 #include "core/html/HTMLTextAreaElement.h" |
49 #include "core/layout/LayoutView.h" | 51 #include "core/layout/LayoutView.h" |
50 #include "core/loader/DocumentLoader.h" | 52 #include "core/loader/DocumentLoader.h" |
51 #include "core/loader/FrameLoadRequest.h" | 53 #include "core/loader/FrameLoadRequest.h" |
52 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "public/web/mac/WebSubstringUtil.h" | 105 #include "public/web/mac/WebSubstringUtil.h" |
104 #endif | 106 #endif |
105 | 107 |
106 using blink::FrameTestHelpers::loadFrame; | 108 using blink::FrameTestHelpers::loadFrame; |
107 using blink::URLTestHelpers::toKURL; | 109 using blink::URLTestHelpers::toKURL; |
108 using blink::URLTestHelpers::registerMockedURLLoad; | 110 using blink::URLTestHelpers::registerMockedURLLoad; |
109 using blink::testing::runPendingTasks; | 111 using blink::testing::runPendingTasks; |
110 | 112 |
111 namespace blink { | 113 namespace blink { |
112 | 114 |
| 115 #define EXPECT_POINT_EQ(expected, actual) \ |
| 116 do { \ |
| 117 EXPECT_DOUBLE_EQ((expected).x(), (actual).x()); \ |
| 118 EXPECT_DOUBLE_EQ((expected).y(), (actual).y()); \ |
| 119 } while (false) |
| 120 |
| 121 #define EXPECT_SIZE_EQ(expected, actual) \ |
| 122 do { \ |
| 123 EXPECT_DOUBLE_EQ((expected).width(), (actual).width()); \ |
| 124 EXPECT_DOUBLE_EQ((expected).height(), (actual).height()); \ |
| 125 } while (false) |
| 126 |
| 127 #define EXPECT_SCROLL_AND_SCALE(expectedScrollPosition, expectedVisualPosition,
expectedScale, frameView, visualViewport) \ |
| 128 do { \ |
| 129 EXPECT_POINT_EQ(expectedScrollPosition, frameView->scrollPositionDouble(
)); \ |
| 130 EXPECT_POINT_EQ(expectedScrollPosition, frameView->scrollAnimator().curr
entPosition()); \ |
| 131 EXPECT_POINT_EQ(expectedVisualPosition, visualViewport->scrollPositionDo
uble()); \ |
| 132 EXPECT_POINT_EQ(expectedVisualPosition, visualViewport->scrollAnimator()
.currentPosition()); \ |
| 133 EXPECT_EQ(expectedScale, visualViewport->scale()); \ |
| 134 } while (false) |
| 135 |
113 enum HorizontalScrollbarState { | 136 enum HorizontalScrollbarState { |
114 NoHorizontalScrollbar, | 137 NoHorizontalScrollbar, |
115 VisibleHorizontalScrollbar, | 138 VisibleHorizontalScrollbar, |
116 }; | 139 }; |
117 | 140 |
118 enum VerticalScrollbarState { | 141 enum VerticalScrollbarState { |
119 NoVerticalScrollbar, | 142 NoVerticalScrollbar, |
120 VisibleVerticalScrollbar, | 143 VisibleVerticalScrollbar, |
121 }; | 144 }; |
122 | 145 |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 webView->setInitialFocus(false); | 1083 webView->setInitialFocus(false); |
1061 frame->setEditableSelectionOffsets(4, 10); | 1084 frame->setEditableSelectionOffsets(4, 10); |
1062 EXPECT_TRUE(webView->isSelectionAnchorFirst()); | 1085 EXPECT_TRUE(webView->isSelectionAnchorFirst()); |
1063 WebRect anchor; | 1086 WebRect anchor; |
1064 WebRect focus; | 1087 WebRect focus; |
1065 webView->selectionBounds(anchor, focus); | 1088 webView->selectionBounds(anchor, focus); |
1066 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; | 1089 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y))
; |
1067 EXPECT_FALSE(webView->isSelectionAnchorFirst()); | 1090 EXPECT_FALSE(webView->isSelectionAnchorFirst()); |
1068 } | 1091 } |
1069 | 1092 |
| 1093 TEST_F(WebViewTest, ScrollAndScaleOverrideMovesAndZoomsViewports) |
| 1094 { |
| 1095 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1096 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1097 webViewImpl->resize(WebSize(100, 150)); |
| 1098 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1099 |
| 1100 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1101 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1102 |
| 1103 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1104 |
| 1105 // Scroll position override moves layout viewport. |
| 1106 webViewImpl->setScrollAndScaleOverride(IntPoint(100, 100), DoublePoint(-1, -
1), 0); |
| 1107 EXPECT_FALSE(frameView->layoutPending()); |
| 1108 EXPECT_FALSE(frameView->needsLayout()); |
| 1109 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(0, 0), 1.0, frame
View, visualViewport); |
| 1110 // Ensure that setting the override only affects the layer's offset, and |
| 1111 // not its position. The position should not be affected by the overridden |
| 1112 // minimumScrollPosition - prevents regression against crbug.com/625084. |
| 1113 EXPECT_POINT_EQ(DoublePoint(0, 0), frameView->layerForScrolling()->position(
)); |
| 1114 EXPECT_POINT_EQ(DoublePoint(100, 100), static_cast<DoublePoint>(frameView->l
ayerForScrolling()->platformLayer()->scrollPositionDouble())); |
| 1115 |
| 1116 webViewImpl->setScrollAndScaleOverride(IntPoint(50, 50), DoublePoint(-1, -1)
, 0); |
| 1117 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1118 |
| 1119 webViewImpl->clearScrollAndScaleOverride(); |
| 1120 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1121 |
| 1122 // Visual viewport scroll position override moves visual viewport. |
| 1123 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(50, 50)
, 0); |
| 1124 EXPECT_FALSE(frameView->layoutPending()); |
| 1125 EXPECT_FALSE(frameView->needsLayout()); |
| 1126 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(50, 50), 1.0, frameVi
ew, visualViewport); |
| 1127 // Ensure that setting the override only affects the layer's offset. |
| 1128 EXPECT_POINT_EQ(DoublePoint(0, 0), visualViewport->layerForScrolling()->posi
tion()); |
| 1129 EXPECT_POINT_EQ(DoublePoint(50, 50), static_cast<DoublePoint>(visualViewport
->layerForScrolling()->platformLayer()->scrollPositionDouble())); |
| 1130 |
| 1131 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(25, 25)
, 0); |
| 1132 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 25), 1.0, frameVi
ew, visualViewport); |
| 1133 |
| 1134 webViewImpl->clearScrollAndScaleOverride(); |
| 1135 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1136 |
| 1137 // Page scale override zooms into page. |
| 1138 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 2); |
| 1139 // Scale override is enforced via constraints, which require a layout. |
| 1140 EXPECT_TRUE(frameView->layoutPending()); |
| 1141 EXPECT_TRUE(frameView->needsLayout()); |
| 1142 webViewImpl->updateAllLifecyclePhases(); |
| 1143 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 2.0, frameView
, visualViewport); |
| 1144 |
| 1145 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 1.5); |
| 1146 EXPECT_TRUE(frameView->layoutPending()); |
| 1147 EXPECT_TRUE(frameView->needsLayout()); |
| 1148 webViewImpl->updateAllLifecyclePhases(); |
| 1149 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.5, frameView
, visualViewport); |
| 1150 |
| 1151 webViewImpl->clearScrollAndScaleOverride(); |
| 1152 EXPECT_TRUE(frameView->layoutPending()); |
| 1153 EXPECT_TRUE(frameView->needsLayout()); |
| 1154 webViewImpl->updateAllLifecyclePhases(); |
| 1155 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1156 |
| 1157 // Combined override of all factors repositions and scales viewports. |
| 1158 webViewImpl->setScrollAndScaleOverride(IntPoint(100, 100), DoublePoint(50, 5
0), 2); |
| 1159 EXPECT_TRUE(frameView->layoutPending()); |
| 1160 EXPECT_TRUE(frameView->needsLayout()); |
| 1161 webViewImpl->updateAllLifecyclePhases(); |
| 1162 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(50, 50), 2.0, fra
meView, visualViewport); |
| 1163 |
| 1164 webViewImpl->setScrollAndScaleOverride(IntPoint(50, 50), DoublePoint(25, 25)
, 1.5); |
| 1165 EXPECT_TRUE(frameView->layoutPending()); |
| 1166 EXPECT_TRUE(frameView->needsLayout()); |
| 1167 webViewImpl->updateAllLifecyclePhases(); |
| 1168 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1169 |
| 1170 webViewImpl->clearScrollAndScaleOverride(); |
| 1171 EXPECT_TRUE(frameView->layoutPending()); |
| 1172 EXPECT_TRUE(frameView->needsLayout()); |
| 1173 webViewImpl->updateAllLifecyclePhases(); |
| 1174 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1175 } |
| 1176 |
| 1177 TEST_F(WebViewTest, ScrollAndScaleOverrideFixesScaleAndScrollPositions) |
| 1178 { |
| 1179 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1180 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1181 webViewImpl->resize(WebSize(100, 150)); |
| 1182 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1183 |
| 1184 // We don't want to have to service animations for the test. |
| 1185 webViewImpl->settings()->setEnableScrollAnimator(false); |
| 1186 |
| 1187 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1188 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1189 ScrollableArea* rootScroller = frameView->getScrollableArea(); |
| 1190 |
| 1191 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1192 |
| 1193 // Empty overrides allow scrolling and zooming. |
| 1194 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 0); |
| 1195 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1196 |
| 1197 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1198 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(0, 0), 1.0, frame
View, visualViewport); |
| 1199 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1200 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(50, 50), 1.0, fra
meView, visualViewport); |
| 1201 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1202 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(0, 0), 1.0, frame
View, visualViewport); |
| 1203 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1204 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1205 webViewImpl->setPageScaleFactor(2.0); |
| 1206 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 2.0, frameVi
ew, visualViewport); |
| 1207 |
| 1208 webViewImpl->clearScrollAndScaleOverride(); |
| 1209 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1210 |
| 1211 // Override of scroll position fixes layout viewport, but not visual one. |
| 1212 webViewImpl->setScrollAndScaleOverride(IntPoint(50, 50), DoublePoint(-1, -1)
, 0); |
| 1213 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1214 |
| 1215 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1216 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1217 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1218 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(50, 50), 1.0, frame
View, visualViewport); |
| 1219 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1220 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1221 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).di
dScroll()); |
| 1222 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1223 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(1000, 1000)).d
idScroll()); |
| 1224 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(50, 75), 1.0, frame
View, visualViewport); |
| 1225 webViewImpl->setPageScaleFactor(2.0); |
| 1226 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(50, 75), 2.0, frame
View, visualViewport); |
| 1227 |
| 1228 webViewImpl->clearScrollAndScaleOverride(); |
| 1229 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1230 |
| 1231 // Override of visual position fixes visual viewport, but not layout one. |
| 1232 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(25, 25)
, 0); |
| 1233 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 25), 1.0, frameVi
ew, visualViewport); |
| 1234 |
| 1235 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1236 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(25, 25), 1.0, fra
meView, visualViewport); |
| 1237 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1238 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(25, 25), 1.0, fra
meView, visualViewport); |
| 1239 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-100, -100)).d
idScroll()); |
| 1240 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 25), 1.0, frameVi
ew, visualViewport); |
| 1241 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).di
dScroll()); |
| 1242 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 25), 1.0, frameVi
ew, visualViewport); |
| 1243 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(1000, 1000)).d
idScroll()); |
| 1244 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 150), DoublePoint(25, 25), 1.0, fra
meView, visualViewport); |
| 1245 webViewImpl->setPageScaleFactor(2.0); |
| 1246 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 150), DoublePoint(25, 25), 2.0, fra
meView, visualViewport); |
| 1247 |
| 1248 webViewImpl->clearScrollAndScaleOverride(); |
| 1249 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1250 |
| 1251 // Scroll position: override of one coordinate doesn't fix other one. |
| 1252 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, 50), DoublePoint(-1, -1)
, 0); |
| 1253 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 50), DoublePoint(0, 0), 1.0, frameVie
w, visualViewport); |
| 1254 |
| 1255 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1256 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 50), DoublePoint(0, 0), 1.0, frameV
iew, visualViewport); |
| 1257 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-100, -100)).d
idScroll()); |
| 1258 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 50), DoublePoint(0, 0), 1.0, frameVie
w, visualViewport); |
| 1259 |
| 1260 webViewImpl->setScrollAndScaleOverride(IntPoint(50, -1), DoublePoint(-1, -1)
, 0); |
| 1261 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.0, frameVi
ew, visualViewport); |
| 1262 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1263 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 100), DoublePoint(0, 0), 1.0, frameV
iew, visualViewport); |
| 1264 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-100, -100)).d
idScroll()); |
| 1265 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 0), DoublePoint(0, 0), 1.0, frameVie
w, visualViewport); |
| 1266 |
| 1267 webViewImpl->clearScrollAndScaleOverride(); |
| 1268 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1269 |
| 1270 // Visual position: override of one coordinate doesn't fix other one. |
| 1271 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, 25)
, 0); |
| 1272 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 25), 1.0, frameVie
w, visualViewport); |
| 1273 |
| 1274 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1275 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(50, 25), 1.0, frameVi
ew, visualViewport); |
| 1276 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1277 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 25), 1.0, frameVie
w, visualViewport); |
| 1278 |
| 1279 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(25, -1)
, 0); |
| 1280 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 25), 1.0, frameVi
ew, visualViewport); |
| 1281 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1282 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 50), 1.0, frameVi
ew, visualViewport); |
| 1283 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1284 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(25, 0), 1.0, frameVie
w, visualViewport); |
| 1285 |
| 1286 webViewImpl->clearScrollAndScaleOverride(); |
| 1287 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1288 |
| 1289 // Scale change is ignored when scale is overridden, but scrolls work. |
| 1290 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 1.5); |
| 1291 webViewImpl->updateAllLifecyclePhases(); |
| 1292 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.5, frameView
, visualViewport); |
| 1293 |
| 1294 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1295 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(0, 0), 1.5, frame
View, visualViewport); |
| 1296 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1297 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(50, 50), 1.5, fra
meView, visualViewport); |
| 1298 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1299 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 100), DoublePoint(0, 0), 1.5, frame
View, visualViewport); |
| 1300 EXPECT_TRUE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).did
Scroll()); |
| 1301 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.5, frameVi
ew, visualViewport); |
| 1302 webViewImpl->setPageScaleFactor(2.0); |
| 1303 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(0, 0), 1.5, frameVi
ew, visualViewport); |
| 1304 |
| 1305 webViewImpl->clearScrollAndScaleOverride(); |
| 1306 webViewImpl->updateAllLifecyclePhases(); |
| 1307 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1308 |
| 1309 // Scrolling is ignored when both scroll positions are fixed, but not zoom. |
| 1310 webViewImpl->setScrollAndScaleOverride(IntPoint(50, 50), DoublePoint(25, 25)
, 0); |
| 1311 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.0, frame
View, visualViewport); |
| 1312 |
| 1313 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1314 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.0, frame
View, visualViewport); |
| 1315 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1316 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.0, frame
View, visualViewport); |
| 1317 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).di
dScroll()); |
| 1318 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.0, frame
View, visualViewport); |
| 1319 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(1000, 1000)).
didScroll()); |
| 1320 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.0, frame
View, visualViewport); |
| 1321 webViewImpl->setPageScaleFactor(2.0); |
| 1322 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 2.0, frame
View, visualViewport); |
| 1323 |
| 1324 webViewImpl->clearScrollAndScaleOverride(); |
| 1325 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1326 |
| 1327 // Both scrolling and scale changes are ignored when they are all fixed. |
| 1328 webViewImpl->setScrollAndScaleOverride(IntPoint(50, 50), DoublePoint(25, 25)
, 1.5); |
| 1329 webViewImpl->updateAllLifecyclePhases(); |
| 1330 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1331 |
| 1332 frameView->setScrollPosition(DoublePoint(100, 100), ProgrammaticScroll, Scro
llBehaviorInstant); |
| 1333 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1334 visualViewport->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll, S
crollBehaviorInstant); |
| 1335 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1336 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(-50, -50)).di
dScroll()); |
| 1337 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1338 EXPECT_FALSE(rootScroller->userScroll(ScrollByPixel, FloatSize(1000, 1000)).
didScroll()); |
| 1339 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1340 webViewImpl->setPageScaleFactor(2.0); |
| 1341 EXPECT_SCROLL_AND_SCALE(DoublePoint(50, 50), DoublePoint(25, 25), 1.5, frame
View, visualViewport); |
| 1342 |
| 1343 webViewImpl->clearScrollAndScaleOverride(); |
| 1344 webViewImpl->updateAllLifecyclePhases(); |
| 1345 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1346 } |
| 1347 |
| 1348 TEST_F(WebViewTest, ScrollOverrideIsClamped) |
| 1349 { |
| 1350 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1351 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1352 webViewImpl->resize(WebSize(100, 150)); |
| 1353 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1354 |
| 1355 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1356 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1357 |
| 1358 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1359 |
| 1360 // Scroll position override is clamped to maximum. |
| 1361 webViewImpl->setScrollAndScaleOverride(IntPoint(1000, 1000), DoublePoint(-1,
-1), 0); |
| 1362 EXPECT_SCROLL_AND_SCALE(DoublePoint(100, 150), DoublePoint(0, 0), 1.0, frame
View, visualViewport); |
| 1363 |
| 1364 webViewImpl->clearScrollAndScaleOverride(); |
| 1365 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1366 |
| 1367 // Viewport scroll position override is clamped to maximum. |
| 1368 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(1000, 1
000), 0); |
| 1369 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(50, 75), 1.0, frameVi
ew, visualViewport); |
| 1370 |
| 1371 webViewImpl->clearScrollAndScaleOverride(); |
| 1372 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1373 } |
| 1374 |
| 1375 TEST_F(WebViewTest, ScrollAndScaleOverrideDisablesAndRestoresThreadedScrolling) |
| 1376 { |
| 1377 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1378 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1379 webViewImpl->resize(WebSize(100, 150)); |
| 1380 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1381 |
| 1382 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1383 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1384 |
| 1385 EXPECT_TRUE(webViewImpl->page()->settings().threadedScrollingEnabled()); |
| 1386 |
| 1387 // Setting scroll override disables threaded scrolling and sets main thread |
| 1388 // scrolling reasons. |
| 1389 webViewImpl->setScrollAndScaleOverride(IntPoint(0, 0), DoublePoint(0, 0), 0)
; |
| 1390 EXPECT_FALSE(webViewImpl->page()->settings().threadedScrollingEnabled()); |
| 1391 webViewImpl->updateAllLifecyclePhases(); |
| 1392 EXPECT_TRUE(frameView->layerForScrolling()->platformLayer()->shouldScrollOnM
ainThread()); |
| 1393 EXPECT_TRUE(visualViewport->layerForScrolling()->platformLayer()->shouldScro
llOnMainThread()); |
| 1394 |
| 1395 // Clearing override restores original setting. |
| 1396 webViewImpl->clearScrollAndScaleOverride(); |
| 1397 EXPECT_TRUE(webViewImpl->page()->settings().threadedScrollingEnabled()); |
| 1398 webViewImpl->updateAllLifecyclePhases(); |
| 1399 EXPECT_FALSE(frameView->layerForScrolling()->platformLayer()->shouldScrollOn
MainThread()); |
| 1400 EXPECT_FALSE(visualViewport->layerForScrolling()->platformLayer()->shouldScr
ollOnMainThread()); |
| 1401 |
| 1402 // Updating scroll override does not override stored default. |
| 1403 webViewImpl->setScrollAndScaleOverride(IntPoint(0, 0), DoublePoint(0, 0), 0)
; |
| 1404 webViewImpl->setScrollAndScaleOverride(IntPoint(100, 100), DoublePoint(0, 0)
, 0); |
| 1405 EXPECT_FALSE(webViewImpl->page()->settings().threadedScrollingEnabled()); |
| 1406 webViewImpl->updateAllLifecyclePhases(); |
| 1407 EXPECT_TRUE(frameView->layerForScrolling()->platformLayer()->shouldScrollOnM
ainThread()); |
| 1408 EXPECT_TRUE(visualViewport->layerForScrolling()->platformLayer()->shouldScro
llOnMainThread()); |
| 1409 |
| 1410 webViewImpl->clearScrollAndScaleOverride(); |
| 1411 EXPECT_TRUE(webViewImpl->page()->settings().threadedScrollingEnabled()); |
| 1412 webViewImpl->updateAllLifecyclePhases(); |
| 1413 EXPECT_FALSE(frameView->layerForScrolling()->platformLayer()->shouldScrollOn
MainThread()); |
| 1414 EXPECT_FALSE(visualViewport->layerForScrolling()->platformLayer()->shouldScr
ollOnMainThread()); |
| 1415 } |
| 1416 |
| 1417 TEST_F(WebViewTest, ScaleOverrideDoesNotAffectMainFrameSize) |
| 1418 { |
| 1419 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1420 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1421 webViewImpl->resize(WebSize(100, 150)); |
| 1422 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1423 |
| 1424 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1425 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1426 |
| 1427 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1428 |
| 1429 // Main frame size is normally calculated by dividing by minimum scale. |
| 1430 // Since scale override changes minimum scale, we need to ensure that the |
| 1431 // calculated main frame size does not change. |
| 1432 IntSize expectedSize = webViewImpl->mainFrameSize(); |
| 1433 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 2.0); |
| 1434 webViewImpl->updateAllLifecyclePhases(); |
| 1435 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 2.0, frameView
, visualViewport); |
| 1436 EXPECT_SIZE_EQ(expectedSize, webViewImpl->mainFrameSize()); |
| 1437 |
| 1438 // Main frame size resizes correctly. |
| 1439 WebSize viewSize = webViewImpl->size(); |
| 1440 webViewImpl->resize(WebSize(viewSize.width * 2, viewSize.height * 2)); |
| 1441 EXPECT_SIZE_EQ(IntSize(expectedSize.width() * 2, expectedSize.height() * 2),
webViewImpl->mainFrameSize()); |
| 1442 webViewImpl->resize(viewSize); |
| 1443 |
| 1444 webViewImpl->clearScrollAndScaleOverride(); |
| 1445 webViewImpl->updateAllLifecyclePhases(); |
| 1446 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1447 EXPECT_SIZE_EQ(expectedSize, webViewImpl->mainFrameSize()); |
| 1448 |
| 1449 // Same behavior for non-default minimum scale. |
| 1450 webViewImpl->setDefaultPageScaleLimits(0.25, 5.0); |
| 1451 webViewImpl->updateAllLifecyclePhases(); |
| 1452 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 0.25, frameVie
w, visualViewport); |
| 1453 expectedSize = webViewImpl->mainFrameSize(); |
| 1454 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 2.0); |
| 1455 webViewImpl->updateAllLifecyclePhases(); |
| 1456 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 2.0, frameView
, visualViewport); |
| 1457 EXPECT_SIZE_EQ(expectedSize, webViewImpl->mainFrameSize()); |
| 1458 |
| 1459 viewSize = webViewImpl->size(); |
| 1460 webViewImpl->resize(WebSize(viewSize.width * 2, viewSize.height * 2)); |
| 1461 EXPECT_SIZE_EQ(IntSize(expectedSize.width() * 2, expectedSize.height() * 2),
webViewImpl->mainFrameSize()); |
| 1462 webViewImpl->resize(viewSize); |
| 1463 |
| 1464 webViewImpl->clearScrollAndScaleOverride(); |
| 1465 webViewImpl->updateAllLifecyclePhases(); |
| 1466 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 0.25, frameVie
w, visualViewport); |
| 1467 EXPECT_SIZE_EQ(expectedSize, webViewImpl->mainFrameSize()); |
| 1468 } |
| 1469 |
| 1470 TEST_F(WebViewTest, ScaleOverrideSetsAndRestoresPageScaleConstraints) |
| 1471 { |
| 1472 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
| 1473 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
| 1474 webViewImpl->resize(WebSize(100, 150)); |
| 1475 webViewImpl->resizeVisualViewport(WebSize(50, 75)); |
| 1476 |
| 1477 FrameView* frameView = webViewImpl->mainFrameImpl()->frame()->view(); |
| 1478 VisualViewport* visualViewport = &webViewImpl->page()->frameHost().visualVie
wport(); |
| 1479 WebDeviceEmulationParams params; |
| 1480 |
| 1481 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1482 PageScaleConstraints originalConstraints(1.0, 0.5, 2.0); |
| 1483 webViewImpl->page()->frameHost().setUserAgentPageScaleConstraints(originalCo
nstraints); |
| 1484 webViewImpl->updateAllLifecyclePhases(); |
| 1485 EXPECT_EQ(originalConstraints.initialScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().initialScale); |
| 1486 EXPECT_EQ(originalConstraints.minimumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().minimumScale); |
| 1487 EXPECT_EQ(originalConstraints.maximumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().maximumScale); |
| 1488 |
| 1489 // Setting and clearing scale override restores original user-agent page |
| 1490 // scale constraints setting. |
| 1491 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 3.0); |
| 1492 webViewImpl->updateAllLifecyclePhases(); |
| 1493 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 3.0, frameView
, visualViewport); |
| 1494 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.initialScale); |
| 1495 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.minimumScale); |
| 1496 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.maximumScale); |
| 1497 |
| 1498 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 0); |
| 1499 webViewImpl->updateAllLifecyclePhases(); |
| 1500 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 2.0, frameView
, visualViewport); |
| 1501 EXPECT_EQ(originalConstraints.initialScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().initialScale); |
| 1502 EXPECT_EQ(originalConstraints.minimumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().minimumScale); |
| 1503 EXPECT_EQ(originalConstraints.maximumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().maximumScale); |
| 1504 |
| 1505 // Same behavior for disabling emulation after scale override. |
| 1506 webViewImpl->setScrollAndScaleOverride(IntPoint(-1, -1), DoublePoint(-1, -1)
, 3.0); |
| 1507 webViewImpl->updateAllLifecyclePhases(); |
| 1508 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 3.0, frameView
, visualViewport); |
| 1509 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.initialScale); |
| 1510 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.minimumScale); |
| 1511 EXPECT_EQ(3.0, webViewImpl->pageScaleConstraintsSet().userAgentConstraints()
.maximumScale); |
| 1512 |
| 1513 webViewImpl->clearScrollAndScaleOverride(); |
| 1514 webViewImpl->updateAllLifecyclePhases(); |
| 1515 EXPECT_SCROLL_AND_SCALE(DoublePoint(0, 0), DoublePoint(0, 0), 1.0, frameView
, visualViewport); |
| 1516 EXPECT_EQ(originalConstraints.initialScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().initialScale); |
| 1517 EXPECT_EQ(originalConstraints.minimumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().minimumScale); |
| 1518 EXPECT_EQ(originalConstraints.maximumScale, webViewImpl->pageScaleConstraint
sSet().userAgentConstraints().maximumScale); |
| 1519 } |
| 1520 |
1070 TEST_F(WebViewTest, ExitingDeviceEmulationResetsPageScale) | 1521 TEST_F(WebViewTest, ExitingDeviceEmulationResetsPageScale) |
1071 { | 1522 { |
1072 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); | 1523 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
1073 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); | 1524 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html"); |
1074 webViewImpl->resize(WebSize(200, 300)); | 1525 webViewImpl->resize(WebSize(200, 300)); |
1075 | 1526 |
1076 float pageScaleExpected = webViewImpl->pageScaleFactor(); | 1527 float pageScaleExpected = webViewImpl->pageScaleFactor(); |
1077 | 1528 |
1078 WebDeviceEmulationParams params; | 1529 WebDeviceEmulationParams params; |
1079 params.screenPosition = WebDeviceEmulationParams::Desktop; | 1530 params.screenPosition = WebDeviceEmulationParams::Desktop; |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3210 frame->setAutofillClient(&client); | 3661 frame->setAutofillClient(&client); |
3211 webView->setInitialFocus(false); | 3662 webView->setInitialFocus(false); |
3212 | 3663 |
3213 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3664 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
3214 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3665 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
3215 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3666 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
3216 frame->setAutofillClient(0); | 3667 frame->setAutofillClient(0); |
3217 } | 3668 } |
3218 | 3669 |
3219 } // namespace blink | 3670 } // namespace blink |
OLD | NEW |