[Smart Selection] Set |selected_text| when |kMenuSourceAdjustSelection|
Java adjustSelectionByCharacterOffset() will be triggered if |TextClassifier| API thinks we should adjust previous selection, the renderer FrameInputHandlerImpl::AdjustSelectionByCharacterOffset() is called with the need to show context menu later. Eventually it will call EventHanlder::ShowNonLocatedContextMenu(), which will give us the left selection bound's middle point as the new point for MouseEvent. In ContextMenuController#ShowContextMenu() there is another hit test based on this point. In some cases, this point is under other HTML element, so we won't get current selection text based on the hit test result. Later in SelectionPopupController::ShowSelectionMenu() we checked that if the selection text is empty and this is non-editable element, we won't call Java side SelectionPopupControllerImpl#showSelectionMenu(). Users are expecting context menu, but there won't be one. In this CL, we set |data.selected_text| when |source_type| is |kMenuSourceAdjustSelection|. Hit test isn't needed in this case. Bug: 840007, b/78631924 Change-Id: I9631773655300b2fc1dc5f84faa161093fae900f Reviewed-on: https://chromium-review.googlesource.com/1045510Reviewed-by:Dave Tapuska <dtapuska@chromium.org> Commit-Queue: Shimi Zhang <ctzsm@chromium.org> Cr-Commit-Position: refs/heads/master@{#556856}
Showing
Please register or sign in to comment