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

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

Issue 2855353002: Make Paste Popup use selection rect for positioning (Closed)
Patch Set: Fix typo Created 3 years, 7 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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/public/web/WebContextMenuData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63214655706a8c3468d99ef8c4ad55f781be68cd..290f9b08eda567b8246ee8401201cf8cb9fe568e 100644
--- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
@@ -402,6 +402,19 @@ 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);
aelias_OOO_until_Jul13 2017/05/06 01:18:39 The rect you're computing here would be useful to
amaralp 2017/05/11 18:46:55 This is already a problem since in CompositorFrame
aelias_OOO_until_Jul13 2017/05/11 21:16:17 It looks like RenderWidget::UpdateSelectionBounds
+
+ int left = std::min(focus_webrect.x, anchor_webrect.x);
+ int top = std::min(focus_webrect.y, anchor_webrect.y);
+ int right = std::max(focus_webrect.x + focus_webrect.width,
+ anchor_webrect.x + anchor_webrect.width);
+ int bottom = std::max(focus_webrect.y + focus_webrect.height,
+ anchor_webrect.y + anchor_webrect.height);
+
+ data.selection_rect = WebRect(left, top, right - left, bottom - top);
+
if (from_touch && !ShouldShowContextMenuFromTouch(data))
return false;
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/public/web/WebContextMenuData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698