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

Side by Side Diff: third_party/WebKit/Source/web/ContextMenuClientImpl.cpp

Issue 2855353002: Make Paste Popup use selection rect for positioning (Closed)
Patch Set: Calculate selection rect better 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 if (data.selected_text.IsEmpty()) {
aelias_OOO_until_Jul13 2017/05/11 21:16:17 Please push this logic down into FrameSelection::B
406 WebRect focus_webrect;
407 WebRect anchor_webrect;
408 web_view_->SelectionBounds(focus_webrect, anchor_webrect);
409 data.selection_rect = focus_webrect;
410 } else {
411 data.selection_rect = selected_frame->View()->ContentsToViewport(
412 web_view_->MainFrame()->SelectionBoundsRect());
413 }
414
405 if (from_touch && !ShouldShowContextMenuFromTouch(data)) 415 if (from_touch && !ShouldShowContextMenuFromTouch(data))
406 return false; 416 return false;
407 417
408 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage()); 418 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage());
409 if (!selected_web_frame->Client()) 419 if (!selected_web_frame->Client())
410 return false; 420 return false;
411 421
412 selected_web_frame->Client()->ShowContextMenu(data); 422 selected_web_frame->Client()->ShowContextMenu(data);
413 return true; 423 return true;
414 } 424 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 sub_menu_items.Swap(output_items); 476 sub_menu_items.Swap(output_items);
467 } 477 }
468 478
469 void ContextMenuClientImpl::PopulateCustomMenuItems( 479 void ContextMenuClientImpl::PopulateCustomMenuItems(
470 const ContextMenu* default_menu, 480 const ContextMenu* default_menu,
471 WebContextMenuData* data) { 481 WebContextMenuData* data) {
472 PopulateSubMenuItems(default_menu->Items(), data->custom_items); 482 PopulateSubMenuItems(default_menu->Items(), data->custom_items);
473 } 483 }
474 484
475 } // namespace blink 485 } // 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