Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Unified Diff: third_party/WebKit/Source/web/ContextMenuClientImpl.cpp

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: Fixing rebase bug Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
index d2fd4a6de6115178e09157762b20c26d02c5802a..06d8e4543400138ec9533fad8a70d772e57b9074 100644
--- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
@@ -48,6 +48,7 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/HTMLPlugInElement.h"
+#include "core/input/ContextMenuAllowedScope.h"
#include "core/input/EventHandler.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutPart.h"
@@ -75,7 +76,6 @@
#include "public/web/WebSearchableFormData.h"
#include "public/web/WebTextCheckClient.h"
#include "public/web/WebViewClient.h"
-#include "web/ContextMenuAllowedScope.h"
#include "web/WebDataSourceImpl.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebPluginContainerImpl.h"
@@ -168,7 +168,7 @@ bool ContextMenuClientImpl::ShouldShowContextMenuFromTouch(
!data.link_url.IsEmpty() ||
data.media_type == WebContextMenuData::kMediaTypeImage ||
data.media_type == WebContextMenuData::kMediaTypeVideo ||
- data.is_editable;
+ data.is_editable || !data.selected_text.IsEmpty();
}
bool ContextMenuClientImpl::ShowContextMenu(const ContextMenu* default_menu,
@@ -400,6 +400,13 @@ bool ContextMenuClientImpl::ShowContextMenu(const ContextMenu* default_menu,
data.input_field_type = WebContextMenuData::kInputFieldTypeNone;
}
+ WebRect focus_webrect;
+ WebRect anchor_webrect;
+ web_view_->SelectionBounds(focus_webrect, anchor_webrect);
+ data.selection_rect = WebRect(focus_webrect.x, focus_webrect.y,
+ anchor_webrect.x + anchor_webrect.width,
+ anchor_webrect.y + anchor_webrect.height);
+ data.from_touch = from_touch;
if (from_touch && !ShouldShowContextMenuFromTouch(data))
return false;

Powered by Google App Engine
This is Rietveld 408576698