truncated_start = ConvertRectToPixel(device_scale_factor, truncated_start);
truncated_end = ConvertRectToPixel(device_scale_factor, truncated_end);
+ bool show = expecting_update_;
UpdateSelectionDataAndShow(
- truncated_start, truncated_end, false /*show*/);
+ truncated_start, truncated_end, show);
}
void SelectionControllerEfl::UpdateSelectionData(const base::string16& text) {
selection_data_->UpdateRectData(left_rect, right_rect);
return false;
}
+
RenderWidgetHostViewEfl* rwhv =
static_cast<RenderWidgetHostViewEfl*>(web_contents_.GetRenderWidgetHostView());
if (show_only_large_handle_ && GetCaretSelectionStatus() &&
{ show_only_large_handle_ = show_only_large_handle; }
bool GetShowOnlyLargeHandle() const { return show_only_large_handle_; }
+ void SetWaitsForRendererSelectionChanges(
+ bool value) { expecting_update_ = value; }
+
// Gesture handlers.
void HandlePostponedGesture(int x, int y, ui::EventType type);
void HandleGesture(blink::WebGestureEvent& event);
// behind other layer.
bool postponed_;
- // True when new caret/selection position was sent to chromium,
- // but no reply was received, yet
+ // Enters a state where browser has requested a text selection
+ // change to the renderer. At the next composited selection update
+ // state is handled and reset.
bool expecting_update_;
// Saves state so that handlers and context menu is not shown when seletion change event occurs.
controller->HideHandles();
}
-void ContextMenuControllerEfl::ShowSelectionHandleAndContextMenu() {
+void ContextMenuControllerEfl::RequestShowSelectionHandleAndContextMenu() {
SelectionControllerEfl* controller = webview_->GetSelectionController();
if (controller) {
controller->SetSelectionStatus(true);
- controller->UpdateSelectionDataAndShow(
- controller->GetLeftRect(),
- controller->GetRightRect(),
- true);
+ controller->SetWaitsForRendererSelectionChanges(true);
}
}
Evas_Coord x, y;
evas_object_geometry_get(webview_->evas_object(), &x, &y, 0, 0);
webview_->SelectLinkText(gfx::Point(params_.x - x, params_.y - y));
- ShowSelectionHandleAndContextMenu();
+ RequestShowSelectionHandleAndContextMenu();
break;
}
case MENU_ITEM_COPY_IMAGE_TO_CLIPBOARD: {
}
case MENU_ITEM_SELECT_WORD: {
webview_->ExecuteEditCommand("SelectWord", NULL);
- ShowSelectionHandleAndContextMenu();
+ RequestShowSelectionHandleAndContextMenu();
break;
}
case MENU_ITEM_SELECT_ALL: {
webview_->ExecuteEditCommand("SelectAll", NULL);
- ShowSelectionHandleAndContextMenu();
+ RequestShowSelectionHandleAndContextMenu();
break;
}
case MENU_ITEM_PASTE: {
const std::string& link_url = std::string(),
const std::string& icon_path = std::string());
void HideSelectionHandle();
- void ShowSelectionHandleAndContextMenu();
+ void RequestShowSelectionHandleAndContextMenu();
virtual void OnDownloadUpdated(content::DownloadItem* download) override;
void OnClipboardDownload(content::DownloadItem* item,
content::DownloadInterruptReason interrupt_reason);