New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 819864 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 30
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

"Look Up" Broken with Multiline

Project Member Reported by spqc...@chromium.org, Mar 8 2018

Issue description

1) Select multiple lines on a webpage
2) Right click and select the  "Look Up" item

Expected:
- The first line to be highlighted by the look up dialog

Actual
- The final line to be highlighted
 

Comment 1 by msw@chromium.org, Mar 8 2018

Components: Internals>PlatformIntegration
Also, there seems to be some incorrect event location or selection range info on Gerrit:
1) Visit https://chromium-review.googlesource.com/c/chromium/src/+/941733/11/ui/views/controls/views_text_services_context_menu_mac.mm#102
2) Double-click the word 'widget' to select that text on line 102
3) Right click the selected word 'widget' and select 'Look Up "Widget"'.
Expected: The popup points to 'widget' with some info for that word.
Actual: The popup points to 'tToTar' off to the left of 'widget' (see attached).

Screen Shot 2018-03-07 at 6.54.16 PM.png
286 KB View Download
Cc: spqc...@chromium.org
Owner: tnijssen@google.com

Comment 4 by tnijssen@google.com, Jun 15 2018

Status: Started (was: Assigned)

Comment 5 by tnijssen@google.com, Jun 26 2018

The Appkit method showDefinitionForAttributedString:atPoint: gets called with the selected string and the baseline point of the selection. In a multiline selection, the baseline point is at the bottom of the lowest line of text. This is why the dictionary overlay appears in the incorrect location when multiple lines of text are selected.
Is there a way to introduce a new method that would calculate the basepoint for the first line of text?
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da71e35a7c1f7afce21a17dcda49ce30d7890de4

commit da71e35a7c1f7afce21a17dcda49ce30d7890de4
Author: Tessa Nijssen <tnijssen@google.com>
Date: Mon Jul 30 18:33:11 2018

[Mac] Look Up Overlay Appears on First Line

Currently, when a user selects multiple lines of text, right clicks, and
selects "Look Up", the yellow overlay appears on the last line of the
selected text but with the text of the first line of the selected text.

WebSubstringUtil::GetBaselinePoint() was modified to call
FirstRectForRange() instead of ComputeTextRect(). FirstRectForRange()
returns the IntRect for the first line of text which is needed to get
the baseline point of the first line of text.

WebViewTest.WebSubstringUtilBaselinePoint was added to test that the
baseline point does not change when multiple lines of text are selected
compared to a single line of text.

Bug:  819864 
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Iec0bac8d45baf2142ea5e826ebdfd7d997e7f584
Reviewed-on: https://chromium-review.googlesource.com/1103448
Commit-Queue: Tessa Nijssen <tnijssen@google.com>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579094}
[modify] https://crrev.com/da71e35a7c1f7afce21a17dcda49ce30d7890de4/third_party/blink/renderer/core/editing/web_substring_util.mm
[modify] https://crrev.com/da71e35a7c1f7afce21a17dcda49ce30d7890de4/third_party/blink/renderer/core/exported/web_view_test.cc
[add] https://crrev.com/da71e35a7c1f7afce21a17dcda49ce30d7890de4/third_party/blink/renderer/core/testing/data/content_editable_multiline.html

Status: Fixed (was: Started)

Sign in to add a comment