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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (element->type() == InputTypeNames::password) 395 if (element->type() == InputTypeNames::password)
396 data.input_field_type = WebContextMenuData::kInputFieldTypePassword; 396 data.input_field_type = WebContextMenuData::kInputFieldTypePassword;
397 else if (element->IsTextField()) 397 else if (element->IsTextField())
398 data.input_field_type = WebContextMenuData::kInputFieldTypePlainText; 398 data.input_field_type = WebContextMenuData::kInputFieldTypePlainText;
399 else 399 else
400 data.input_field_type = WebContextMenuData::kInputFieldTypeOther; 400 data.input_field_type = WebContextMenuData::kInputFieldTypeOther;
401 } else { 401 } else {
402 data.input_field_type = WebContextMenuData::kInputFieldTypeNone; 402 data.input_field_type = WebContextMenuData::kInputFieldTypeNone;
403 } 403 }
404 404
405 WebRect focus_webrect;
406 WebRect anchor_webrect;
407 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
408
409 int left = std::min(focus_webrect.x, anchor_webrect.x);
410 int top = std::min(focus_webrect.y, anchor_webrect.y);
411 int right = std::max(focus_webrect.x + focus_webrect.width,
412 anchor_webrect.x + anchor_webrect.width);
413 int bottom = std::max(focus_webrect.y + focus_webrect.height,
414 anchor_webrect.y + anchor_webrect.height);
415
416 data.selection_rect = WebRect(left, top, right - left, bottom - top);
417
405 if (from_touch && !ShouldShowContextMenuFromTouch(data)) 418 if (from_touch && !ShouldShowContextMenuFromTouch(data))
406 return false; 419 return false;
407 420
408 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage()); 421 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage());
409 if (!selected_web_frame->Client()) 422 if (!selected_web_frame->Client())
410 return false; 423 return false;
411 424
412 selected_web_frame->Client()->ShowContextMenu(data); 425 selected_web_frame->Client()->ShowContextMenu(data);
413 return true; 426 return true;
414 } 427 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 sub_menu_items.Swap(output_items); 479 sub_menu_items.Swap(output_items);
467 } 480 }
468 481
469 void ContextMenuClientImpl::PopulateCustomMenuItems( 482 void ContextMenuClientImpl::PopulateCustomMenuItems(
470 const ContextMenu* default_menu, 483 const ContextMenu* default_menu,
471 WebContextMenuData* data) { 484 WebContextMenuData* data) {
472 PopulateSubMenuItems(default_menu->Items(), data->custom_items); 485 PopulateSubMenuItems(default_menu->Items(), data->custom_items);
473 } 486 }
474 487
475 } // namespace blink 488 } // namespace blink
OLDNEW
« 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