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

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

Issue 2855353002: Make Paste Popup use selection rect for positioning (Closed)
Patch Set: 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);
408 data.selection_rect = WebRect(focus_webrect.x, focus_webrect.y,
409 anchor_webrect.x + anchor_webrect.width,
aelias_OOO_until_Jul13 2017/05/04 20:48:56 C++ rects have different format from Java Rects, s
amaralp 2017/05/05 01:14:32 Done, also fixed an issue when anchor comes before
410 anchor_webrect.y + anchor_webrect.height);
411
405 if (from_touch && !ShouldShowContextMenuFromTouch(data)) 412 if (from_touch && !ShouldShowContextMenuFromTouch(data))
406 return false; 413 return false;
407 414
408 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage()); 415 selected_web_frame->SetContextMenuNode(r.InnerNodeOrImageMapImage());
409 if (!selected_web_frame->Client()) 416 if (!selected_web_frame->Client())
410 return false; 417 return false;
411 418
412 selected_web_frame->Client()->ShowContextMenu(data); 419 selected_web_frame->Client()->ShowContextMenu(data);
413 return true; 420 return true;
414 } 421 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 sub_menu_items.Swap(output_items); 473 sub_menu_items.Swap(output_items);
467 } 474 }
468 475
469 void ContextMenuClientImpl::PopulateCustomMenuItems( 476 void ContextMenuClientImpl::PopulateCustomMenuItems(
470 const ContextMenu* default_menu, 477 const ContextMenu* default_menu,
471 WebContextMenuData* data) { 478 WebContextMenuData* data) {
472 PopulateSubMenuItems(default_menu->Items(), data->custom_items); 479 PopulateSubMenuItems(default_menu->Items(), data->custom_items);
473 } 480 }
474 481
475 } // namespace blink 482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698