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 55dfe1df690957fd5b3cc1179e778754a8525ac4..f6c652121939de0f47f5b3999ef86f526150cd59 100644 |
--- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp |
+++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp |
@@ -40,6 +40,7 @@ |
#include "core/editing/Editor.h" |
#include "core/editing/markers/DocumentMarkerController.h" |
#include "core/editing/spellcheck/SpellChecker.h" |
+#include "core/events/MouseEvent.h" |
#include "core/exported/WebDataSourceImpl.h" |
#include "core/exported/WebPluginContainerBase.h" |
#include "core/exported/WebViewBase.h" |
@@ -54,6 +55,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" |
@@ -80,7 +82,6 @@ |
#include "public/web/WebSearchableFormData.h" |
#include "public/web/WebTextCheckClient.h" |
#include "public/web/WebViewClient.h" |
-#include "web/ContextMenuAllowedScope.h" |
namespace blink { |
@@ -197,7 +198,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(); |
} |
static HTMLFormElement* AssociatedFormElement(HTMLElement& element) { |
@@ -253,8 +254,9 @@ static HTMLFormElement* CurrentForm(const FrameSelection& current_selection) { |
return ScanForForm(start); |
} |
-bool ContextMenuClientImpl::ShowContextMenu(const ContextMenu* default_menu, |
- bool from_touch) { |
+bool ContextMenuClientImpl::ShowContextMenu( |
+ const ContextMenu* default_menu, |
+ MouseEvent::SyntheticEventType synthetic_event_type) { |
// Displaying the context menu in this function is a big hack as we don't |
// have context, i.e. whether this is being invoked via a script or in |
// response to user input (Mouse event WM_RBUTTONDOWN, |
@@ -495,7 +497,9 @@ bool ContextMenuClientImpl::ShowContextMenu(const ContextMenu* default_menu, |
data.selection_rect = WebRect(left, top, right - left, bottom - top); |
- if (from_touch && !ShouldShowContextMenuFromTouch(data)) |
+ data.from_select_all = synthetic_event_type == MouseEvent::kFromSelectAll; |
+ if (synthetic_event_type == MouseEvent::kFromTouch && |
+ !ShouldShowContextMenuFromTouch(data)) |
return false; |
selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage()); |