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