surface_id_(0),
is_modifier_key_(false),
touch_events_enabled_(false),
- should_restore_selection_menu_(false),
- selection_acked_on_tap_(false),
- was_scrolled_(false),
web_contents_(web_contents),
- single_tap_performed_(false),
compositor_(NULL),
root_layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)),
delegated_frame_host_(new DelegatedFrameHost(this)),
void RenderWidgetHostViewEfl::HandleGestureBegin() {
EnsureEdgeEffect().Enable();
- selection_acked_on_tap_ = false;
- single_tap_performed_ = false;
- was_scrolled_ = false;
if (GetSelectionController()) {
- should_restore_selection_menu_ =
- GetSelectionController()->IsAnyHandleVisible();
-
GetSelectionController()->HandleGestureBegin();
}
}
void RenderWidgetHostViewEfl::HandleGestureEnd() {
- if (GetSelectionController()) {
- if (should_restore_selection_menu_ && !was_scrolled_ &&
- !selection_acked_on_tap_ &&
- !(single_tap_performed_ &&
- GetSelectionController()->GetSelectionEditable())) {
- should_restore_selection_menu_ = false;
- GetSelectionController()->HideHandleAndContextMenu();
- }
-
+ if (GetSelectionController())
GetSelectionController()->HandleGestureEnd();
- }
- single_tap_performed_ = false;
+
// Edge effect should be disabled upon scroll end/fling start.
// Gesture end comes just after those events, so it's disabled here.
EnsureEdgeEffect().Disable();
blink::WebGestureEvent& event) {
SelectionControllerEfl* controller = GetSelectionController();
if (controller)
- controller->HandleGesture(event,
- should_restore_selection_menu_);
+ controller->HandleGesture(event);
if (event.type == blink::WebInputEvent::GestureDoubleTap ||
event.type == blink::WebInputEvent::GesturePinchBegin ||
fling_cancel.type = blink::WebInputEvent::GestureFlingCancel;
fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen;
SendGestureEvent(fling_cancel);
- single_tap_performed_ = true;
- } else if (event.type == blink::WebInputEvent::GestureTapCancel ||
- event.type == blink::WebInputEvent::GestureTapUnconfirmed) {
- selection_acked_on_tap_ = should_restore_selection_menu_;
- single_tap_performed_ = false;
- } else if (event.type == blink::WebInputEvent::GestureScrollBegin) {
- was_scrolled_ = true;
} else if (event.type == blink::WebInputEvent::GestureScrollUpdate) {
if (event.data.scrollUpdate.deltaX < 0)
EnsureEdgeEffect().Hide("edge,left");
bool touch_events_enabled_;
- bool should_restore_selection_menu_;
- bool selection_acked_on_tap_;
- // Used only to indicate that user scrolled view
- // after gesture GestureTapDown.
- bool was_scrolled_;
-
// The last scroll offset of the view.
gfx::Vector2dF last_scroll_offset_;
WebContents& web_contents_;
- bool single_tap_performed_;
-
IDMap<ScreenshotCapturedCallback, IDMapOwnPointer> screen_capture_cb_map_;
ui::Compositor* compositor_;
scoped_ptr<ui::Layer> root_layer_;
mouse_press_(false),
scrolling_(false),
show_after_scroll_(false),
+ should_restore_selection_menu_(false),
+ selection_acked_on_tap_(false),
+ single_tap_performed_(false),
+ was_scrolled_(false),
postponed_(false),
expecting_update_(false),
long_mouse_press_(false),
return false;
}
-void SelectionControllerEfl::HandleGesture(blink::WebGestureEvent& event,
- bool should_restore_selection_menu) {
+void SelectionControllerEfl::HandleGesture(blink::WebGestureEvent& event) {
if (event.type == blink::WebInputEvent::GestureTap) {
if (GetCaretSelectionStatus())
restore_showing_large_handle_on_gesture_end_.reset();
restore_showing_large_handle_on_gesture_end_.reset();
HandlePostponedGesture(
event.x, event.y, ui::ET_GESTURE_LONG_PRESS);
+ } else if (event.type == blink::WebInputEvent::GestureTapDown) {
+ single_tap_performed_ = true;
+ } else if (event.type == blink::WebInputEvent::GestureTapCancel ||
+ event.type == blink::WebInputEvent::GestureTapUnconfirmed) {
+ selection_acked_on_tap_ = should_restore_selection_menu_;
+ single_tap_performed_ = false;
}
if (event.type == blink::WebInputEvent::GestureScrollBegin) {
+ was_scrolled_ = true;
SetScrollStatus(true);
} else if (event.type == blink::WebInputEvent::GestureScrollEnd) {
if (GetScrollStatus())
GetLeftRect(),
GetRightRect(),
false /* unused */,
- should_restore_selection_menu);
+ should_restore_selection_menu_);
}
}
}
void SelectionControllerEfl::HandleGestureBegin() {
+ selection_acked_on_tap_ = false;
+ single_tap_performed_ = false;
+ was_scrolled_ = false;
+ should_restore_selection_menu_ = IsAnyHandleVisible();
+
// There can be multiple GestureBegin, but we need
// only state of showing large handle at first time
if (!restore_showing_large_handle_on_gesture_end_) {
}
void SelectionControllerEfl::HandleGestureEnd() {
+ if (should_restore_selection_menu_ && !was_scrolled_ &&
+ !selection_acked_on_tap_ &&
+ !(single_tap_performed_ && GetSelectionEditable())) {
+ should_restore_selection_menu_ = false;
+ HideHandleAndContextMenu();
+ }
+
if (restore_showing_large_handle_on_gesture_end_) {
SetShowOnlyLargeHandle(
*restore_showing_large_handle_on_gesture_end_);
restore_showing_large_handle_on_gesture_end_.reset();
}
+ single_tap_performed_ = false;
}
void SelectionControllerEfl::HandlePostponedGesture(int x, int y, ui::EventType type) {
// Gesture handlers.
void HandlePostponedGesture(int x, int y, ui::EventType type);
- void HandleGesture(blink::WebGestureEvent& event,
- bool should_restore_selection_menu);
+ void HandleGesture(blink::WebGestureEvent& event);
void HandleGestureBegin();
void HandleGestureEnd();
// Saves state of context popup menu and handlers before scroll
bool show_after_scroll_;
+ bool should_restore_selection_menu_;
+ bool selection_acked_on_tap_;
+ bool single_tap_performed_;
+ // Used only to indicate that user scrolled view
+ // after gesture GestureTapDown.
+ bool was_scrolled_;
// Flag which indicates if showing handlers and popup menu was prevented due to selection
// behind other layer.