Merge lp:~osomon/oxide/touch-selection-api-updates into lp:~oxide-developers/oxide/oxide.trunk
- touch-selection-api-updates
- Merge into oxide.trunk
Status: | Merged |
---|---|
Merged at revision: | 1388 |
Proposed branch: | lp:~osomon/oxide/touch-selection-api-updates |
Merge into: | lp:~oxide-developers/oxide/oxide.trunk |
Diff against target: |
667 lines (+142/-59) 20 files modified
qt/core/browser/oxide_qt_contents_view.cc (+8/-2) qt/core/browser/oxide_qt_contents_view.h (+3/-1) qt/core/glue/oxide_qt_contents_view_proxy.h (+2/-0) qt/core/glue/oxide_qt_contents_view_proxy_client.h (+3/-1) qt/core/glue/oxide_qt_web_view_proxy.h (+0/-1) qt/qmlplugin/oxide.qmltypes (+8/-2) qt/qmlplugin/oxide_qml_plugin.cc (+6/-1) qt/quick/api/oxideqquicktouchselectioncontroller.cc (+26/-4) qt/quick/api/oxideqquicktouchselectioncontroller.h (+11/-2) qt/quick/api/oxideqquickwebview.cc (+2/-8) qt/quick/api/oxideqquickwebview_p.h (+0/-3) qt/quick/oxide_qquick_contents_view.cc (+18/-3) qt/quick/oxide_qquick_contents_view.h (+11/-7) shared/browser/oxide_render_widget_host_view.cc (+16/-3) shared/browser/oxide_render_widget_host_view.h (+1/-0) shared/browser/oxide_render_widget_host_view_container.h (+1/-1) shared/browser/oxide_web_contents_view.cc (+19/-17) shared/browser/oxide_web_contents_view.h (+3/-1) shared/browser/oxide_web_contents_view_client.cc (+2/-1) shared/browser/oxide_web_contents_view_client.h (+2/-1) |
To merge this branch: | bzr merge lp:~osomon/oxide/touch-selection-api-updates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Coulson | Approve | ||
Review via email: mp+287961@code.launchpad.net |
Commit message
Touch selection API updates:
- enable adaptive handle orientation
- add an 'handleDragInPr
- add a hide() method to OxideQQuickTouc
Description of the change
The new 'handleDragInPr
- 1314. By Olivier Tilloy
-
Register updated TouchSelectionC
ontroller type. - 1315. By Olivier Tilloy
-
Add a hide() method on OxideQQuickTouc
hSelectionContr oller.
This will be used to hide the handles and quick menu after tapping an action. - 1316. By Olivier Tilloy
-
Merge the latest changes from trunk.
- 1317. By Olivier Tilloy
-
Fix build.
- 1318. By Olivier Tilloy
-
Update the qmltypes file with API additions.
- 1319. By Olivier Tilloy
-
Bump revision to 1.15, as 1.14 has been branched already.
- 1320. By Olivier Tilloy
-
Move ownership of OxideQQuickTouc
hSelectionContr oller to oxide:: qquick: :ContentsView.
Olivier Tilloy (osomon) wrote : | # |
updated
Chris Coulson (chrisccoulson) : | # |
Preview Diff
1 | === modified file 'qt/core/browser/oxide_qt_contents_view.cc' |
2 | --- qt/core/browser/oxide_qt_contents_view.cc 2016-03-15 23:29:57 +0000 |
3 | +++ qt/core/browser/oxide_qt_contents_view.cc 2016-03-21 16:05:27 +0000 |
4 | @@ -424,6 +424,10 @@ |
5 | } |
6 | } |
7 | |
8 | +void ContentsView::hideTouchSelectionController() { |
9 | + view()->HideTouchSelectionController(); |
10 | +} |
11 | + |
12 | blink::WebScreenInfo ContentsView::GetScreenInfo() const { |
13 | QScreen* screen = client_->GetScreen(); |
14 | if (!screen) { |
15 | @@ -512,12 +516,14 @@ |
16 | } |
17 | |
18 | void ContentsView::TouchSelectionChanged(bool active, |
19 | - const gfx::RectF& bounds) const { |
20 | + const gfx::RectF& bounds, |
21 | + bool handle_drag_in_progress) const { |
22 | gfx::RectF scaled_bounds = |
23 | DpiUtils::ConvertChromiumPixelsToQt(bounds, GetScreen()); |
24 | client_->TouchSelectionChanged( |
25 | active, |
26 | - ToQt(DpiUtils::ConvertChromiumPixelsToQt(bounds, GetScreen()))); |
27 | + ToQt(DpiUtils::ConvertChromiumPixelsToQt(bounds, GetScreen())), |
28 | + handle_drag_in_progress); |
29 | } |
30 | |
31 | oxide::InputMethodContext* ContentsView::GetInputMethodContext() const { |
32 | |
33 | === modified file 'qt/core/browser/oxide_qt_contents_view.h' |
34 | --- qt/core/browser/oxide_qt_contents_view.h 2016-03-15 23:29:57 +0000 |
35 | +++ qt/core/browser/oxide_qt_contents_view.h 2016-03-21 16:05:27 +0000 |
36 | @@ -89,6 +89,7 @@ |
37 | void handleDragMoveEvent(QDragMoveEvent* event) override; |
38 | void handleDragLeaveEvent(QDragLeaveEvent* event) override; |
39 | void handleDropEvent(QDropEvent* event) override; |
40 | + void hideTouchSelectionController() override; |
41 | |
42 | // InputMethodContextClient implementation |
43 | void SetInputMethodEnabled(bool enabled); |
44 | @@ -107,7 +108,8 @@ |
45 | oxide::WebPopupMenu* CreatePopupMenu(content::RenderFrameHost* rfh) override; |
46 | ui::TouchHandleDrawable* CreateTouchHandleDrawable() const override; |
47 | void TouchSelectionChanged(bool active, |
48 | - const gfx::RectF& bounds) const override; |
49 | + const gfx::RectF& bounds, |
50 | + bool handle_drag_in_progress) const override; |
51 | oxide::InputMethodContext* GetInputMethodContext() const override; |
52 | void UnhandledKeyboardEvent( |
53 | const content::NativeWebKeyboardEvent& event) override; |
54 | |
55 | === modified file 'qt/core/glue/oxide_qt_contents_view_proxy.h' |
56 | --- qt/core/glue/oxide_qt_contents_view_proxy.h 2016-02-29 21:56:19 +0000 |
57 | +++ qt/core/glue/oxide_qt_contents_view_proxy.h 2016-03-21 16:05:27 +0000 |
58 | @@ -92,6 +92,8 @@ |
59 | virtual void handleDragMoveEvent(QDragMoveEvent* event) = 0; |
60 | virtual void handleDragLeaveEvent(QDragLeaveEvent* event) = 0; |
61 | virtual void handleDropEvent(QDropEvent* event) = 0; |
62 | + |
63 | + virtual void hideTouchSelectionController() = 0; |
64 | }; |
65 | |
66 | } // namespace qt |
67 | |
68 | === modified file 'qt/core/glue/oxide_qt_contents_view_proxy_client.h' |
69 | --- qt/core/glue/oxide_qt_contents_view_proxy_client.h 2016-02-29 20:40:07 +0000 |
70 | +++ qt/core/glue/oxide_qt_contents_view_proxy_client.h 2016-03-21 16:05:27 +0000 |
71 | @@ -66,7 +66,9 @@ |
72 | WebPopupMenuProxyClient* client) = 0; |
73 | virtual TouchHandleDrawableProxy* CreateTouchHandleDrawable() = 0; |
74 | |
75 | - virtual void TouchSelectionChanged(bool active, const QRectF& bounds) = 0; |
76 | + virtual void TouchSelectionChanged(bool active, |
77 | + const QRectF& bounds, |
78 | + bool handle_drag_in_progress) = 0; |
79 | |
80 | virtual void HandleUnhandledKeyboardEvent(QKeyEvent* event) = 0; |
81 | |
82 | |
83 | === modified file 'qt/core/glue/oxide_qt_web_view_proxy.h' |
84 | --- qt/core/glue/oxide_qt_web_view_proxy.h 2016-02-29 20:40:07 +0000 |
85 | +++ qt/core/glue/oxide_qt_web_view_proxy.h 2016-03-21 16:05:27 +0000 |
86 | @@ -33,7 +33,6 @@ |
87 | class OxideQFindController; |
88 | class OxideQNewViewRequest; |
89 | class OxideQSecurityStatus; |
90 | -class OxideQTouchSelectionController; |
91 | class OxideQWebPreferences; |
92 | |
93 | namespace oxide { |
94 | |
95 | === modified file 'qt/qmlplugin/oxide.qmltypes' |
96 | --- qt/qmlplugin/oxide.qmltypes 2016-01-12 11:45:54 +0000 |
97 | +++ qt/qmlplugin/oxide.qmltypes 2016-03-21 16:05:27 +0000 |
98 | @@ -292,9 +292,12 @@ |
99 | Component { |
100 | name: "OxideQQuickTouchSelectionController" |
101 | prototype: "QObject" |
102 | - exports: ["TouchSelectionController 1.12"] |
103 | + exports: [ |
104 | + "TouchSelectionController 1.12", |
105 | + "TouchSelectionController 1.15" |
106 | + ] |
107 | isCreatable: false |
108 | - exportMetaObjectRevisions: [0] |
109 | + exportMetaObjectRevisions: [0, 1] |
110 | Enum { |
111 | name: "HandleOrientation" |
112 | values: { |
113 | @@ -307,6 +310,9 @@ |
114 | Property { name: "active"; type: "bool"; isReadonly: true } |
115 | Property { name: "handle"; type: "QQmlComponent"; isPointer: true } |
116 | Property { name: "bounds"; type: "QRectF"; isReadonly: true } |
117 | + Property { name: "handleDragInProgress"; revision: 1; type: "bool"; isReadonly: true } |
118 | + Signal { name: "handleDragInProgressChanged"; revision: 1 } |
119 | + Method { name: "hide"; revision: 1 } |
120 | } |
121 | Component { |
122 | name: "OxideQQuickUserScript" |
123 | |
124 | === modified file 'qt/qmlplugin/oxide_qml_plugin.cc' |
125 | --- qt/qmlplugin/oxide_qml_plugin.cc 2016-01-13 19:05:43 +0000 |
126 | +++ qt/qmlplugin/oxide_qml_plugin.cc 2016-03-21 16:05:27 +0000 |
127 | @@ -1,5 +1,5 @@ |
128 | // vim:expandtab:shiftwidth=2:tabstop=2: |
129 | -// Copyright (C) 2013-2015 Canonical Ltd. |
130 | +// Copyright (C) 2013-2016 Canonical Ltd. |
131 | |
132 | // This library is free software; you can redistribute it and/or |
133 | // modify it under the terms of the GNU Lesser General Public |
134 | @@ -200,6 +200,11 @@ |
135 | "TouchSelectionController is accessed via " |
136 | "WebView.touchSelectionController"); |
137 | qmlRegisterType<OxideQQuickWebView, 7>(uri, 1, 12, "WebView"); |
138 | + |
139 | + qmlRegisterUncreatableType<OxideQQuickTouchSelectionController, 1>( |
140 | + uri, 1, 15, "TouchSelectionController", |
141 | + "TouchSelectionController is accessed via " |
142 | + "WebView.touchSelectionController"); |
143 | } |
144 | }; |
145 | |
146 | |
147 | === modified file 'qt/quick/api/oxideqquicktouchselectioncontroller.cc' |
148 | --- qt/quick/api/oxideqquicktouchselectioncontroller.cc 2016-01-13 18:16:11 +0000 |
149 | +++ qt/quick/api/oxideqquicktouchselectioncontroller.cc 2016-03-21 16:05:27 +0000 |
150 | @@ -17,6 +17,8 @@ |
151 | |
152 | #include "oxideqquicktouchselectioncontroller.h" |
153 | |
154 | +#include "qt/quick/oxide_qquick_contents_view.h" |
155 | + |
156 | #include "oxideqquickwebview_p.h" |
157 | |
158 | QT_BEGIN_NAMESPACE |
159 | @@ -28,16 +30,18 @@ |
160 | OxideQQuickTouchSelectionControllerPrivate() |
161 | : view(nullptr) |
162 | , handle(nullptr) |
163 | - , active(false) {} |
164 | + , active(false) |
165 | + , handle_drag_in_progress(false) {} |
166 | |
167 | - OxideQQuickWebView* view; |
168 | + oxide::qquick::ContentsView* view; |
169 | QQmlComponent* handle; |
170 | bool active; |
171 | QRectF bounds; |
172 | + bool handle_drag_in_progress; |
173 | }; |
174 | |
175 | OxideQQuickTouchSelectionController::OxideQQuickTouchSelectionController( |
176 | - OxideQQuickWebView* view) |
177 | + oxide::qquick::ContentsView* view) |
178 | : d_ptr(new OxideQQuickTouchSelectionControllerPrivate()) { |
179 | Q_D(OxideQQuickTouchSelectionController); |
180 | |
181 | @@ -46,6 +50,12 @@ |
182 | |
183 | OxideQQuickTouchSelectionController::~OxideQQuickTouchSelectionController() {} |
184 | |
185 | +void OxideQQuickTouchSelectionController::hide() const { |
186 | + Q_D(const OxideQQuickTouchSelectionController); |
187 | + |
188 | + d->view->hideTouchSelectionController(); |
189 | +} |
190 | + |
191 | bool OxideQQuickTouchSelectionController::active() const { |
192 | Q_D(const OxideQQuickTouchSelectionController); |
193 | |
194 | @@ -75,9 +85,16 @@ |
195 | return d->bounds; |
196 | } |
197 | |
198 | +bool OxideQQuickTouchSelectionController::handleDragInProgress() const { |
199 | + Q_D(const OxideQQuickTouchSelectionController); |
200 | + |
201 | + return d->handle_drag_in_progress; |
202 | +} |
203 | + |
204 | void OxideQQuickTouchSelectionController::onTouchSelectionChanged( |
205 | bool active, |
206 | - const QRectF& bounds) { |
207 | + const QRectF& bounds, |
208 | + bool handle_drag_in_progress) { |
209 | Q_D(OxideQQuickTouchSelectionController); |
210 | |
211 | if (active != d->active) { |
212 | @@ -89,4 +106,9 @@ |
213 | d->bounds = bounds; |
214 | Q_EMIT boundsChanged(); |
215 | } |
216 | + |
217 | + if (handle_drag_in_progress != d->handle_drag_in_progress) { |
218 | + d->handle_drag_in_progress = handle_drag_in_progress; |
219 | + Q_EMIT handleDragInProgressChanged(); |
220 | + } |
221 | } |
222 | |
223 | === modified file 'qt/quick/api/oxideqquicktouchselectioncontroller.h' |
224 | --- qt/quick/api/oxideqquicktouchselectioncontroller.h 2016-02-23 22:03:59 +0000 |
225 | +++ qt/quick/api/oxideqquicktouchselectioncontroller.h 2016-03-21 16:05:27 +0000 |
226 | @@ -48,6 +48,7 @@ |
227 | Q_PROPERTY(bool active READ active NOTIFY activeChanged) |
228 | Q_PROPERTY(QQmlComponent* handle READ handle WRITE setHandle NOTIFY handleChanged) |
229 | Q_PROPERTY(QRectF bounds READ bounds NOTIFY boundsChanged) |
230 | + Q_PROPERTY(bool handleDragInProgress READ handleDragInProgress NOTIFY handleDragInProgressChanged REVISION 1) |
231 | |
232 | Q_DISABLE_COPY(OxideQQuickTouchSelectionController) |
233 | Q_DECLARE_PRIVATE(OxideQQuickTouchSelectionController) |
234 | @@ -55,6 +56,8 @@ |
235 | public: |
236 | ~OxideQQuickTouchSelectionController() Q_DECL_OVERRIDE; |
237 | |
238 | + Q_REVISION(1) Q_INVOKABLE void hide() const; |
239 | + |
240 | enum HandleOrientation { |
241 | HandleOrientationLeft, |
242 | HandleOrientationCenter, |
243 | @@ -69,18 +72,24 @@ |
244 | |
245 | const QRectF& bounds() const; |
246 | |
247 | + bool handleDragInProgress() const; |
248 | + |
249 | Q_SIGNALS: |
250 | void activeChanged(); |
251 | void handleChanged(); |
252 | void boundsChanged(); |
253 | + Q_REVISION(1) void handleDragInProgressChanged(); |
254 | |
255 | private: |
256 | friend class OxideQQuickWebViewPrivate; |
257 | friend class oxide::qquick::ContentsView; |
258 | |
259 | - Q_DECL_HIDDEN OxideQQuickTouchSelectionController(OxideQQuickWebView* view); |
260 | + Q_DECL_HIDDEN OxideQQuickTouchSelectionController( |
261 | + oxide::qquick::ContentsView* view); |
262 | |
263 | - void onTouchSelectionChanged(bool active, const QRectF& bounds); |
264 | + void onTouchSelectionChanged(bool active, |
265 | + const QRectF& bounds, |
266 | + bool handle_drag_in_progress); |
267 | |
268 | QScopedPointer<OxideQQuickTouchSelectionControllerPrivate> d_ptr; |
269 | }; |
270 | |
271 | === modified file 'qt/quick/api/oxideqquickwebview.cc' |
272 | --- qt/quick/api/oxideqquickwebview.cc 2016-03-01 15:42:25 +0000 |
273 | +++ qt/quick/api/oxideqquickwebview.cc 2016-03-21 16:05:27 +0000 |
274 | @@ -60,7 +60,6 @@ |
275 | #include "oxideqquicklocationbarcontroller.h" |
276 | #include "oxideqquickscriptmessagehandler.h" |
277 | #include "oxideqquickscriptmessagehandler_p.h" |
278 | -#include "oxideqquicktouchselectioncontroller.h" |
279 | #include "oxideqquickwebcontext.h" |
280 | #include "oxideqquickwebcontext_p.h" |
281 | #include "oxideqquickwebframe.h" |
282 | @@ -130,12 +129,7 @@ |
283 | before_unload_dialog_(nullptr), |
284 | file_picker_(nullptr), |
285 | using_old_load_event_signal_(false), |
286 | - construct_props_(new ConstructProps()), |
287 | - touch_selection_controller_( |
288 | - new OxideQQuickTouchSelectionController(view)) { |
289 | - contents_view_->set_touch_selection_controller( |
290 | - touch_selection_controller_.data()); |
291 | -} |
292 | + construct_props_(new ConstructProps()) {} |
293 | |
294 | oxide::qt::JavaScriptDialogProxy* |
295 | OxideQQuickWebViewPrivate::CreateJavaScriptDialog( |
296 | @@ -1878,7 +1872,7 @@ |
297 | OxideQQuickTouchSelectionController* OxideQQuickWebView::touchSelectionController() { |
298 | Q_D(OxideQQuickWebView); |
299 | |
300 | - return d->touch_selection_controller_.data(); |
301 | + return d->contents_view_->touchSelectionController(); |
302 | } |
303 | |
304 | #include "moc_oxideqquickwebview.cpp" |
305 | |
306 | === modified file 'qt/quick/api/oxideqquickwebview_p.h' |
307 | --- qt/quick/api/oxideqquickwebview_p.h 2016-02-29 20:40:07 +0000 |
308 | +++ qt/quick/api/oxideqquickwebview_p.h 2016-03-21 16:05:27 +0000 |
309 | @@ -34,7 +34,6 @@ |
310 | class OxideQNewViewRequest; |
311 | class OxideQQuickLocationBarController; |
312 | class OxideQQuickScriptMessageHandler; |
313 | -class OxideQQuickTouchSelectionController; |
314 | class OxideQQuickWebContextPrivate; |
315 | class OxideQQuickWebView; |
316 | |
317 | @@ -180,8 +179,6 @@ |
318 | QScopedPointer<ConstructProps> construct_props_; |
319 | |
320 | QScopedPointer<OxideQQuickLocationBarController> location_bar_controller_; |
321 | - |
322 | - QScopedPointer<OxideQQuickTouchSelectionController> touch_selection_controller_; |
323 | }; |
324 | |
325 | #endif // _OXIDE_QT_QUICK_API_WEB_VIEW_P_P_H_ |
326 | |
327 | === modified file 'qt/quick/oxide_qquick_contents_view.cc' |
328 | --- qt/quick/oxide_qquick_contents_view.cc 2016-02-29 20:40:07 +0000 |
329 | +++ qt/quick/oxide_qquick_contents_view.cc 2016-03-21 16:05:27 +0000 |
330 | @@ -158,12 +158,17 @@ |
331 | |
332 | oxide::qt::TouchHandleDrawableProxy* |
333 | ContentsView::CreateTouchHandleDrawable() { |
334 | - return new TouchHandleDrawable(item_, touch_selection_controller_); |
335 | + return new TouchHandleDrawable(item_, touch_selection_controller_.data()); |
336 | } |
337 | |
338 | -void ContentsView::TouchSelectionChanged(bool active, const QRectF& bounds) { |
339 | +void ContentsView::TouchSelectionChanged(bool active, |
340 | + const QRectF& bounds, |
341 | + bool handle_drag_in_progress) { |
342 | if (touch_selection_controller_) { |
343 | - touch_selection_controller_->onTouchSelectionChanged(active, bounds); |
344 | + touch_selection_controller_->onTouchSelectionChanged( |
345 | + active, |
346 | + bounds, |
347 | + handle_drag_in_progress); |
348 | } |
349 | } |
350 | |
351 | @@ -182,6 +187,8 @@ |
352 | |
353 | ContentsView::ContentsView(QQuickItem* item) |
354 | : item_(item), |
355 | + touch_selection_controller_( |
356 | + new OxideQQuickTouchSelectionController(this)), |
357 | received_new_compositor_frame_(false), |
358 | frame_evicted_(false), |
359 | last_composited_frame_type_( |
360 | @@ -488,5 +495,13 @@ |
361 | return node; |
362 | } |
363 | |
364 | +void ContentsView::hideTouchSelectionController() const { |
365 | + if (!proxy()) { |
366 | + return; |
367 | + } |
368 | + |
369 | + proxy()->hideTouchSelectionController(); |
370 | +} |
371 | + |
372 | } // namespace qquick |
373 | } // namespace oxide |
374 | |
375 | === modified file 'qt/quick/oxide_qquick_contents_view.h' |
376 | --- qt/quick/oxide_qquick_contents_view.h 2016-02-29 20:40:07 +0000 |
377 | +++ qt/quick/oxide_qquick_contents_view.h 2016-03-21 16:05:27 +0000 |
378 | @@ -21,6 +21,7 @@ |
379 | #include <QObject> |
380 | #include <QPointer> |
381 | #include <QQuickItem> |
382 | +#include <QScopedPointer> |
383 | #include <QtGlobal> |
384 | |
385 | #include "qt/core/glue/oxide_qt_contents_view_proxy.h" |
386 | @@ -56,11 +57,6 @@ |
387 | ContentsView(QQuickItem* item); |
388 | ~ContentsView() override; |
389 | |
390 | - void set_touch_selection_controller( |
391 | - OxideQQuickTouchSelectionController* controller) { |
392 | - touch_selection_controller_ = controller; |
393 | - } |
394 | - |
395 | QVariant inputMethodQuery(Qt::InputMethodQuery query) const; |
396 | |
397 | void handleItemChange(QQuickItem::ItemChange change); |
398 | @@ -100,6 +96,12 @@ |
399 | popup_menu_ = popup_menu; |
400 | } |
401 | |
402 | + OxideQQuickTouchSelectionController* touchSelectionController() const { |
403 | + return touch_selection_controller_.data(); |
404 | + } |
405 | + |
406 | + void hideTouchSelectionController() const; |
407 | + |
408 | private Q_SLOTS: |
409 | void windowChanged(QQuickWindow* window); |
410 | void screenChanged(QScreen* screen); |
411 | @@ -132,11 +134,13 @@ |
412 | oxide::qt::WebPopupMenuProxy* CreateWebPopupMenu( |
413 | oxide::qt::WebPopupMenuProxyClient* client) override; |
414 | oxide::qt::TouchHandleDrawableProxy* CreateTouchHandleDrawable() override; |
415 | - void TouchSelectionChanged(bool active, const QRectF& bounds) override; |
416 | + void TouchSelectionChanged(bool active, |
417 | + const QRectF& bounds, |
418 | + bool handle_drag_in_progress) override; |
419 | void HandleUnhandledKeyboardEvent(QKeyEvent* event) override; |
420 | |
421 | QPointer<QQuickItem> item_; |
422 | - QPointer<OxideQQuickTouchSelectionController> touch_selection_controller_; |
423 | + QScopedPointer<OxideQQuickTouchSelectionController> touch_selection_controller_; |
424 | |
425 | QPointer<QQuickWindow> window_; |
426 | QPointer<QScreen> screen_; |
427 | |
428 | === modified file 'shared/browser/oxide_render_widget_host_view.cc' |
429 | --- shared/browser/oxide_render_widget_host_view.cc 2016-03-15 17:03:44 +0000 |
430 | +++ shared/browser/oxide_render_widget_host_view.cc 2016-03-21 16:05:27 +0000 |
431 | @@ -566,7 +566,7 @@ |
432 | if ((selection_controller_->active_status() != |
433 | ui::TouchSelectionController::INACTIVE) && |
434 | HasLocationBarOffsetChanged(old, displayed_frame_metadata_)) { |
435 | - container_->TouchSelectionChanged(); |
436 | + container_->TouchSelectionChanged(handle_drag_in_progress_); |
437 | // XXX: hack to ensure the position of the handles is updated. |
438 | selection_controller_->SetTemporarilyHidden(true); |
439 | selection_controller_->SetTemporarilyHidden(false); |
440 | @@ -698,8 +698,20 @@ |
441 | } |
442 | |
443 | void RenderWidgetHostView::OnSelectionEvent(ui::SelectionEventType event) { |
444 | + switch (event) { |
445 | + case ui::SELECTION_HANDLE_DRAG_STARTED: |
446 | + case ui::INSERTION_HANDLE_DRAG_STARTED: |
447 | + handle_drag_in_progress_ = true; |
448 | + break; |
449 | + case ui::SELECTION_HANDLE_DRAG_STOPPED: |
450 | + case ui::INSERTION_HANDLE_DRAG_STOPPED: |
451 | + handle_drag_in_progress_ = false; |
452 | + break; |
453 | + default: |
454 | + break; |
455 | + } |
456 | if (container_) { |
457 | - container_->TouchSelectionChanged(); |
458 | + container_->TouchSelectionChanged(handle_drag_in_progress_); |
459 | } |
460 | } |
461 | |
462 | @@ -805,6 +817,7 @@ |
463 | is_showing_(!host->is_hidden()), |
464 | top_controls_shrink_blink_size_(false), |
465 | gesture_provider_(GestureProvider::Create(this)), |
466 | + handle_drag_in_progress_(false), |
467 | weak_ptr_factory_(this) { |
468 | CHECK(host_) << "Implementation didn't supply a RenderWidgetHost"; |
469 | |
470 | @@ -816,7 +829,7 @@ |
471 | // default values from ui/events/gesture_detection/gesture_configuration.cc |
472 | tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds(150); |
473 | tsc_config.tap_slop = 15; |
474 | - tsc_config.enable_adaptive_handle_orientation = false; |
475 | + tsc_config.enable_adaptive_handle_orientation = true; |
476 | tsc_config.show_on_tap_for_empty_editable = true; |
477 | tsc_config.enable_longpress_drag_selection = false; |
478 | selection_controller_.reset( |
479 | |
480 | === modified file 'shared/browser/oxide_render_widget_host_view.h' |
481 | --- shared/browser/oxide_render_widget_host_view.h 2016-03-11 23:24:08 +0000 |
482 | +++ shared/browser/oxide_render_widget_host_view.h 2016-03-21 16:05:27 +0000 |
483 | @@ -250,6 +250,7 @@ |
484 | scoped_ptr<GestureProvider> gesture_provider_; |
485 | |
486 | scoped_ptr<ui::TouchSelectionController> selection_controller_; |
487 | + bool handle_drag_in_progress_; |
488 | |
489 | base::WeakPtrFactory<RenderWidgetHostView> weak_ptr_factory_; |
490 | |
491 | |
492 | === modified file 'shared/browser/oxide_render_widget_host_view_container.h' |
493 | --- shared/browser/oxide_render_widget_host_view_container.h 2016-02-29 20:40:07 +0000 |
494 | +++ shared/browser/oxide_render_widget_host_view_container.h 2016-03-21 16:05:27 +0000 |
495 | @@ -73,7 +73,7 @@ |
496 | |
497 | virtual ui::TouchHandleDrawable* CreateTouchHandleDrawable() const = 0; |
498 | |
499 | - virtual void TouchSelectionChanged() const = 0; |
500 | + virtual void TouchSelectionChanged(bool handle_drag_in_progress) const = 0; |
501 | |
502 | virtual void EditingCapabilitiesChanged() = 0; |
503 | }; |
504 | |
505 | === modified file 'shared/browser/oxide_web_contents_view.cc' |
506 | --- shared/browser/oxide_web_contents_view.cc 2016-03-20 23:29:02 +0000 |
507 | +++ shared/browser/oxide_web_contents_view.cc 2016-03-21 16:05:27 +0000 |
508 | @@ -89,10 +89,7 @@ |
509 | |
510 | ui::TouchSelectionController* |
511 | WebContentsView::GetTouchSelectionController() const { |
512 | - // We don't care about checking for a fullscreen view here - we're called |
513 | - // from StartDragging which is only supported in RenderViews |
514 | - content::RenderWidgetHostView* view = |
515 | - web_contents()->GetRenderWidgetHostView(); |
516 | + content::RenderWidgetHostView* view = GetRenderWidgetHostView(); |
517 | if (!view) { |
518 | return nullptr; |
519 | } |
520 | @@ -307,11 +304,7 @@ |
521 | return; |
522 | } |
523 | |
524 | - ui::TouchSelectionController* selection_controller = |
525 | - GetTouchSelectionController(); |
526 | - if (selection_controller) { |
527 | - selection_controller->HideAndDisallowShowingAutomatically(); |
528 | - } |
529 | + HideTouchSelectionController(); |
530 | |
531 | // As our implementation of gfx::Screen::GetDisplayNearestWindow always |
532 | // returns an invalid display, the passed in image isn't quite correct. |
533 | @@ -407,7 +400,7 @@ |
534 | } |
535 | |
536 | EditingCapabilitiesChanged(); |
537 | - TouchSelectionChanged(); |
538 | + TouchSelectionChanged(false); |
539 | } |
540 | |
541 | void WebContentsView::DidNavigateMainFrame( |
542 | @@ -434,7 +427,7 @@ |
543 | |
544 | web_contents()->GetRenderWidgetHostView()->Hide(); |
545 | |
546 | - TouchSelectionChanged(); |
547 | + TouchSelectionChanged(false); |
548 | } |
549 | |
550 | void WebContentsView::DidDestroyFullscreenWidget(int routing_id) { |
551 | @@ -461,7 +454,7 @@ |
552 | orig_rwhv->Blur(); |
553 | } |
554 | |
555 | - TouchSelectionChanged(); |
556 | + TouchSelectionChanged(false); |
557 | } |
558 | |
559 | void WebContentsView::DidAttachInterstitialPage() { |
560 | @@ -472,7 +465,7 @@ |
561 | rwhv->SetContainer(this); |
562 | interstitial_rwh_id_ = rwhv->GetRenderWidgetHost(); |
563 | |
564 | - TouchSelectionChanged(); |
565 | + TouchSelectionChanged(false); |
566 | } |
567 | |
568 | void WebContentsView::DidDetachInterstitialPage() { |
569 | @@ -488,7 +481,7 @@ |
570 | |
571 | static_cast<RenderWidgetHostView*>(rwh->GetView())->SetContainer(nullptr); |
572 | |
573 | - TouchSelectionChanged(); |
574 | + TouchSelectionChanged(false); |
575 | } |
576 | |
577 | void WebContentsView::CompositorSwapFrame(CompositorFrameHandle* handle) { |
578 | @@ -599,7 +592,8 @@ |
579 | return client_->CreateTouchHandleDrawable(); |
580 | } |
581 | |
582 | -void WebContentsView::TouchSelectionChanged() const { |
583 | +void WebContentsView::TouchSelectionChanged( |
584 | + bool handle_drag_in_progress) const { |
585 | if (!client_) { |
586 | return; |
587 | } |
588 | @@ -623,7 +617,7 @@ |
589 | } |
590 | bounds.Offset(0, offset); |
591 | |
592 | - client_->TouchSelectionChanged(active, bounds); |
593 | + client_->TouchSelectionChanged(active, bounds, handle_drag_in_progress); |
594 | } |
595 | |
596 | void WebContentsView::EditingCapabilitiesChanged() { |
597 | @@ -686,7 +680,7 @@ |
598 | |
599 | // Update client from view |
600 | CursorChanged(); |
601 | - TouchSelectionChanged(); |
602 | + TouchSelectionChanged(false); |
603 | } |
604 | |
605 | bool WebContentsView::IsVisible() const { |
606 | @@ -946,4 +940,12 @@ |
607 | content::RenderWidgetHostImpl::From(host)->NotifyScreenInfoChanged(); |
608 | } |
609 | |
610 | +void WebContentsView::HideTouchSelectionController() { |
611 | + ui::TouchSelectionController* selection_controller = |
612 | + GetTouchSelectionController(); |
613 | + if (selection_controller) { |
614 | + selection_controller->HideAndDisallowShowingAutomatically(); |
615 | + } |
616 | +} |
617 | + |
618 | } // namespace oxide |
619 | |
620 | === modified file 'shared/browser/oxide_web_contents_view.h' |
621 | --- shared/browser/oxide_web_contents_view.h 2016-03-20 23:29:02 +0000 |
622 | +++ shared/browser/oxide_web_contents_view.h 2016-03-21 16:05:27 +0000 |
623 | @@ -136,6 +136,8 @@ |
624 | void FocusChanged(); |
625 | void ScreenUpdated(); |
626 | |
627 | + void HideTouchSelectionController(); |
628 | + |
629 | private: |
630 | WebContentsView(content::WebContents* web_contents); |
631 | |
632 | @@ -235,7 +237,7 @@ |
633 | bool IsFullscreen() const override; |
634 | float GetLocationBarHeight() const override; |
635 | ui::TouchHandleDrawable* CreateTouchHandleDrawable() const override; |
636 | - void TouchSelectionChanged() const override; |
637 | + void TouchSelectionChanged(bool handle_drag_in_progress) const override; |
638 | void EditingCapabilitiesChanged() override; |
639 | |
640 | WebContentsViewClient* client_; |
641 | |
642 | === modified file 'shared/browser/oxide_web_contents_view_client.cc' |
643 | --- shared/browser/oxide_web_contents_view_client.cc 2016-02-29 20:40:07 +0000 |
644 | +++ shared/browser/oxide_web_contents_view_client.cc 2016-03-21 16:05:27 +0000 |
645 | @@ -53,7 +53,8 @@ |
646 | |
647 | void WebContentsViewClient::TouchSelectionChanged( |
648 | bool active, |
649 | - const gfx::RectF& bounds) const {} |
650 | + const gfx::RectF& bounds, |
651 | + bool handle_drag_in_progress) const {} |
652 | |
653 | InputMethodContext* WebContentsViewClient::GetInputMethodContext() const { |
654 | return nullptr; |
655 | |
656 | === modified file 'shared/browser/oxide_web_contents_view_client.h' |
657 | --- shared/browser/oxide_web_contents_view_client.h 2016-03-01 18:44:48 +0000 |
658 | +++ shared/browser/oxide_web_contents_view_client.h 2016-03-21 16:05:27 +0000 |
659 | @@ -69,7 +69,8 @@ |
660 | |
661 | virtual ui::TouchHandleDrawable* CreateTouchHandleDrawable() const; |
662 | virtual void TouchSelectionChanged(bool active, |
663 | - const gfx::RectF& bounds) const; |
664 | + const gfx::RectF& bounds, |
665 | + bool handle_drag_in_progress) const; |
666 | |
667 | virtual InputMethodContext* GetInputMethodContext() const; |
668 |
This is mostly ok - there's one small architectural issues though (I've left a comment inline)