Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |