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

Issue 2348143003: MacViews: Implement Force Touch/Mac dictionary lookup for Textfields. (Closed)

Created:
4 years, 3 months ago by karandeepb
Modified:
4 years, 2 months ago
Reviewers:
tapted, sky, msw
CC:
chromium-reviews, tfarina, James Su, shuchen+watch_chromium.org, yusukes+watch_chromium.org, nona+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Implement Force Touch/Mac dictionary lookup for Textfields. This CL adds support to MacViews for Force touch and dictionary lookups. This is achieved by implementing quickLookWithEvent: on the BridgedContentView. A new interface called WordLookupClient is added which is to be implemented by views which support word lookups. Currently only views::Textfield implements this interface. A virtual method GetWordLookupClient is added to views::View to retrieve the WordLookupClient associated with a given View. Support is added to the RenderText class to retreive the word displayed at a given point along with its styling information. A DecoratedText class is also introduced to encapsulate the styling information for some given text. Note, this CL only adds support for dictionary lookups to Views::Textfields. Doc- https://docs.google.com/a/google.com/document/d/17QYrMpIXpk-FpGanjhJ-Yx33njNQy7B5oL_bxb7-vns/edit?usp=sharing. BUG=640502 TEST= Enable chrome://flags/#mac-views-native-dialogs. Open Bookmark Bubble. Enter some text in the name textfield. Hover over the text and press Ctrl+Command+D. Verify that a dictionary popup appears showing the definition of the word, the mouse was hovering on. Committed: https://crrev.com/a56ce7b0a7e774caebf3a4dd774d6d5d7d9b8d2a Cr-Commit-Position: refs/heads/master@{#423419}

Patch Set 1 : --- #

Patch Set 2 : --- #

Total comments: 24

Patch Set 3 : Address review. #

Total comments: 3

Patch Set 4 #

Patch Set 5 : Fix compile. #

Total comments: 20

Patch Set 6 : Rebase. #

Patch Set 7 : Address review. #

Total comments: 2

Patch Set 8 : Address review. #

Total comments: 2

Patch Set 9 : Rebase. #

Total comments: 1

Patch Set 10 : Add tests. #

Patch Set 11 : Fix tests. #

Patch Set 12 : Typos. #

Patch Set 13 : Fix compile. #

Total comments: 35

Patch Set 14 : Address msw's review comments. #

Patch Set 15 : Add LookupWordClient interface. #

Patch Set 16 : Typos, cleanup, comments etc. #

Patch Set 17 : Views export, reduntant forward decl. #

Total comments: 8

Patch Set 18 : Address nits. Rename LookupWordClient->WordLookupClient. #

Patch Set 19 : Call EnsureLayout in GetDecoratedTextForRange. #

Total comments: 26

Patch Set 20 : Address nits. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+656 lines, -42 lines) Patch
M ui/gfx/BUILD.gn View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A ui/gfx/decorated_text.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +46 lines, -0 lines 0 comments Download
A ui/gfx/decorated_text.cc View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
M ui/gfx/render_text.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +27 lines, -0 lines 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +96 lines, -33 lines 0 comments Download
M ui/gfx/render_text_harfbuzz.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +4 lines, -0 lines 0 comments Download
M ui/gfx/render_text_harfbuzz.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +42 lines, -6 lines 0 comments Download
M ui/gfx/render_text_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +4 lines, -0 lines 0 comments Download
M ui/gfx/render_text_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +12 lines, -0 lines 0 comments Download
M ui/gfx/render_text_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +269 lines, -0 lines 0 comments Download
M ui/views/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5 chunks +70 lines, -0 lines 0 comments Download
M ui/views/controls/textfield/textfield.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +8 lines, -0 lines 0 comments Download
M ui/views/controls/textfield/textfield.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +14 lines, -0 lines 0 comments Download
M ui/views/controls/textfield/textfield_model.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -3 lines 0 comments Download
M ui/views/view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +4 lines, -0 lines 0 comments Download
M ui/views/view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +4 lines, -0 lines 0 comments Download
A ui/views/word_lookup_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 109 (77 generated)
karandeepb
PTAL Trent. WDYT of the approach/design? Will add tests/cleanup CL description subsequently.
4 years, 3 months ago (2016-09-21 02:59:31 UTC) #19
tapted
just did a quick skim.. https://codereview.chromium.org/2348143003/diff/140001/ui/gfx/render_text.h File ui/gfx/render_text.h (right): https://codereview.chromium.org/2348143003/diff/140001/ui/gfx/render_text.h#newcode733 ui/gfx/render_text.h:733: // Expands |range| to ...
4 years, 3 months ago (2016-09-21 04:06:56 UTC) #20
tapted
https://codereview.chromium.org/2348143003/diff/140001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (right): https://codereview.chromium.org/2348143003/diff/140001/ui/views/cocoa/bridged_content_view.mm#newcode760 ui/views/cocoa/bridged_content_view.mm:760: target->GetWordAtPoint(locationInTarget, word, &baselinePoint); On 2016/09/21 04:06:56, tapted wrote: > ...
4 years, 3 months ago (2016-09-21 04:44:15 UTC) #21
karandeepb
https://codereview.chromium.org/2348143003/diff/140001/ui/views/cocoa/bridged_content_view.mm File ui/views/cocoa/bridged_content_view.mm (right): https://codereview.chromium.org/2348143003/diff/140001/ui/views/cocoa/bridged_content_view.mm#newcode760 ui/views/cocoa/bridged_content_view.mm:760: target->GetWordAtPoint(locationInTarget, word, &baselinePoint); On 2016/09/21 04:44:14, tapted wrote: > ...
4 years, 3 months ago (2016-09-21 05:37:12 UTC) #22
tapted
https://codereview.chromium.org/2348143003/diff/140001/ui/views/view.h File ui/views/view.h (right): https://codereview.chromium.org/2348143003/diff/140001/ui/views/view.h#newcode580 ui/views/view.h:580: virtual bool GetWordAtPoint(const gfx::Point& point, On 2016/09/21 05:37:12, karandeepb ...
4 years, 3 months ago (2016-09-22 00:50:04 UTC) #24
karandeepb
PTAL Trent. https://codereview.chromium.org/2348143003/diff/140001/ui/gfx/render_text.h File ui/gfx/render_text.h (right): https://codereview.chromium.org/2348143003/diff/140001/ui/gfx/render_text.h#newcode733 ui/gfx/render_text.h:733: // Expands |range| to it's nearest word ...
4 years, 3 months ago (2016-09-22 08:17:40 UTC) #30
karandeepb
Thinking about it a bit more, I don't think exposing a non const RenderText in ...
4 years, 3 months ago (2016-09-23 01:15:24 UTC) #37
tapted
https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/decorated_text.h File ui/gfx/decorated_text.h (right): https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/decorated_text.h#newcode29 ui/gfx/decorated_text.h:29: Font::Weight weight; can weight, underline, italic be retrieved from ...
4 years, 2 months ago (2016-09-26 02:02:31 UTC) #43
karandeepb
PTAL Trent. https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/decorated_text.h File ui/gfx/decorated_text.h (right): https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/decorated_text.h#newcode29 ui/gfx/decorated_text.h:29: Font::Weight weight; On 2016/09/26 02:02:31, tapted wrote: ...
4 years, 2 months ago (2016-09-26 07:00:08 UTC) #47
tapted
looks good - I'll probably be adding ObjC array subscripting support in https://codereview.chromium.org/2193153002/ - something ...
4 years, 2 months ago (2016-09-26 08:07:26 UTC) #48
karandeepb
https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/render_text_harfbuzz.cc File ui/gfx/render_text_harfbuzz.cc (right): https://codereview.chromium.org/2348143003/diff/280001/ui/gfx/render_text_harfbuzz.cc#newcode1603 ui/gfx/render_text_harfbuzz.cc:1603: for (size_t i = 0; i < run_list->size(); i++) ...
4 years, 2 months ago (2016-09-26 09:22:07 UTC) #51
karandeepb
PTAL msw@ for ui/gfx/*, ui/views/controls/textfield/* and chrome/* review. PTAL sky@ for ui/views/view.* review. Please see ...
4 years, 2 months ago (2016-09-26 09:39:07 UTC) #53
sky
https://codereview.chromium.org/2348143003/diff/360001/ui/views/view.h File ui/views/view.h (right): https://codereview.chromium.org/2348143003/diff/360001/ui/views/view.h#newcode579 ui/views/view.h:579: virtual const gfx::RenderText* GetRenderText() const; Can you outline why ...
4 years, 2 months ago (2016-09-26 16:20:18 UTC) #59
karandeepb
PTAL sky@. https://codereview.chromium.org/2348143003/diff/360001/ui/views/view.h File ui/views/view.h (right): https://codereview.chromium.org/2348143003/diff/360001/ui/views/view.h#newcode579 ui/views/view.h:579: virtual const gfx::RenderText* GetRenderText() const; On 2016/09/26 ...
4 years, 2 months ago (2016-09-27 01:09:11 UTC) #60
sky
None of these options are that satisfying. I favor 4 as it's what we've done ...
4 years, 2 months ago (2016-09-27 13:15:34 UTC) #61
karandeepb
On 2016/09/27 13:15:34, sky wrote: > None of these options are that satisfying. I favor ...
4 years, 2 months ago (2016-09-29 04:35:01 UTC) #62
karandeepb
Ping sky@ regarding c#62. Also PTAL msw@. I have now added some tests as well. ...
4 years, 2 months ago (2016-09-30 08:29:36 UTC) #71
sky
On 2016/09/29 04:35:01, karandeepb wrote: > On 2016/09/27 13:15:34, sky wrote: > > None of ...
4 years, 2 months ago (2016-09-30 15:51:51 UTC) #72
msw
https://codereview.chromium.org/2348143003/diff/500001/ui/gfx/render_text.cc File ui/gfx/render_text.cc (right): https://codereview.chromium.org/2348143003/diff/500001/ui/gfx/render_text.cc#newcode1050 ui/gfx/render_text.cc:1050: if (range.IsValid() && range.GetMin() < text().length()) I see that ...
4 years, 2 months ago (2016-10-04 01:52:37 UTC) #73
karandeepb
PTAL sky@, msw@. Have created a new interface LookupWordClient with a getter on the View ...
4 years, 2 months ago (2016-10-04 12:04:25 UTC) #83
sky
https://codereview.chromium.org/2348143003/diff/600001/ui/views/lookup_word_client.h File ui/views/lookup_word_client.h (right): https://codereview.chromium.org/2348143003/diff/600001/ui/views/lookup_word_client.h#newcode18 ui/views/lookup_word_client.h:18: class VIEWS_EXPORT LookupWordClient { WordLookupClient?
4 years, 2 months ago (2016-10-04 17:26:48 UTC) #86
msw
Please update the CL description (no more View::GetRenderText); otherwise lgtm with nits. https://codereview.chromium.org/2348143003/diff/500001/ui/gfx/render_text.cc File ui/gfx/render_text.cc ...
4 years, 2 months ago (2016-10-05 00:24:49 UTC) #87
karandeepb
Thanks for the review msw@. Have also changed GetDecoratedTextForRange to call EnsureLayout first. https://codereview.chromium.org/2348143003/diff/600001/ui/gfx/render_text.cc File ...
4 years, 2 months ago (2016-10-05 04:31:40 UTC) #95
karandeepb
PTAL sky@ and Trent. https://codereview.chromium.org/2348143003/diff/600001/ui/views/lookup_word_client.h File ui/views/lookup_word_client.h (right): https://codereview.chromium.org/2348143003/diff/600001/ui/views/lookup_word_client.h#newcode18 ui/views/lookup_word_client.h:18: class VIEWS_EXPORT LookupWordClient { On ...
4 years, 2 months ago (2016-10-05 04:36:25 UTC) #96
tapted
lgtm, just a few nits https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_harfbuzz.cc File ui/gfx/render_text_harfbuzz.cc (right): https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_harfbuzz.cc#newcode1617 ui/gfx/render_text_harfbuzz.cc:1617: gfx::Range(intersection.start() - range.GetMin(), nit: ...
4 years, 2 months ago (2016-10-05 06:20:55 UTC) #97
sky
LGTM https://codereview.chromium.org/2348143003/diff/660001/ui/views/word_lookup_client.h File ui/views/word_lookup_client.h (right): https://codereview.chromium.org/2348143003/diff/660001/ui/views/word_lookup_client.h#newcode30 ui/views/word_lookup_client.h:30: ~WordLookupClient() {} On 2016/10/05 06:20:55, tapted wrote: > ...
4 years, 2 months ago (2016-10-05 16:15:36 UTC) #98
karandeepb
https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_harfbuzz.cc File ui/gfx/render_text_harfbuzz.cc (right): https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_harfbuzz.cc#newcode1617 ui/gfx/render_text_harfbuzz.cc:1617: gfx::Range(intersection.start() - range.GetMin(), On 2016/10/05 06:20:54, tapted wrote: > ...
4 years, 2 months ago (2016-10-06 01:07:05 UTC) #100
tapted
still lgtm https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_unittest.cc File ui/gfx/render_text_unittest.cc (right): https://codereview.chromium.org/2348143003/diff/660001/ui/gfx/render_text_unittest.cc#newcode3912 ui/gfx/render_text_unittest.cc:3912: VerifyDecoratedWordsAreEqual(expected_word_1, decorated_word); On 2016/10/06 01:07:05, karandeepb wrote: ...
4 years, 2 months ago (2016-10-06 02:03:19 UTC) #101
karandeepb
https://codereview.chromium.org/2348143003/diff/660001/ui/views/word_lookup_client.h File ui/views/word_lookup_client.h (right): https://codereview.chromium.org/2348143003/diff/660001/ui/views/word_lookup_client.h#newcode30 ui/views/word_lookup_client.h:30: ~WordLookupClient() {} On 2016/10/06 02:03:19, tapted wrote: > On ...
4 years, 2 months ago (2016-10-06 02:23:02 UTC) #102
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2348143003/700001
4 years, 2 months ago (2016-10-06 02:23:45 UTC) #105
commit-bot: I haz the power
Committed patchset #20 (id:700001)
4 years, 2 months ago (2016-10-06 03:23:38 UTC) #107
commit-bot: I haz the power
4 years, 2 months ago (2016-10-06 03:26:52 UTC) #109
Message was sent while issue was closed.
Patchset 20 (id:??) landed as
https://crrev.com/a56ce7b0a7e774caebf3a4dd774d6d5d7d9b8d2a
Cr-Commit-Position: refs/heads/master@{#423419}

Powered by Google App Engine
This is Rietveld 408576698