WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195795
Add a platform-driven spell-checking mechanism
https://bugs.webkit.org/show_bug.cgi?id=195795
Summary
Add a platform-driven spell-checking mechanism
Tim Horton
Reported
2019-03-15 01:46:30 PDT
Add an platform-driven spell-checking mechanism
Attachments
wip
(55.81 KB, patch)
2019-03-15 01:47 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(56.73 KB, patch)
2019-03-15 15:09 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(56.73 KB, patch)
2019-03-15 17:21 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(56.90 KB, patch)
2019-03-19 00:05 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(56.46 KB, patch)
2019-03-19 12:23 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews107 for mac-highsierra-wk2
(2.73 MB, application/zip)
2019-03-19 17:14 PDT
,
EWS Watchlist
no flags
Details
Patch
(56.17 KB, patch)
2019-03-19 23:52 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Tim Horton
Comment 1
2019-03-15 01:47:31 PDT
Created
attachment 364782
[details]
wip
EWS Watchlist
Comment 2
2019-03-15 01:50:36 PDT
Attachment 364782
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/DocumentMarker.h:112: Missing spaces around < [whitespace/operators] [3] Total errors found: 1 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 3
2019-03-15 01:59:03 PDT
This is at best a prototype, and is missing a whole bunch of things. Here are my big concerns: - probably need to use the right editing command, not replaceSelectionWithText - performance cost of doing so much TextIterator - what about all the things that aren't Spelling and Grammar (links? etc.) - what if the selection changes? how can we validate the selection/offsets - I don't think the selection quite ends back up in the right place all the time (there's much more complicated code in Editor for this, but I don't know enough about editing to know why) - who knows if I've really disabled all of the normal spell checking things, or if there's a better bottleneck
Tim Horton
Comment 4
2019-03-15 15:09:06 PDT
Created
attachment 364852
[details]
Patch
EWS Watchlist
Comment 5
2019-03-15 15:12:44 PDT
Attachment 364852
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/DocumentMarker.h:112: Missing spaces around < [whitespace/operators] [3] Total errors found: 1 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 6
2019-03-15 17:21:48 PDT
Created
attachment 364889
[details]
Patch
EWS Watchlist
Comment 7
2019-03-15 17:24:24 PDT
Attachment 364889
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/DocumentMarker.h:112: Missing spaces around < [whitespace/operators] [3] Total errors found: 1 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 8
2019-03-15 22:03:57 PDT
Comment on
attachment 364889
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364889&action=review
> Source/WebKit/WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:110 > + frameSelection.moveTo(range.get()); > + frame.editor().replaceSelectionWithText([annotatedString.string string], WebCore::Editor::SelectReplacement::No, WebCore::Editor::SmartReplace::No);
We want to be using SpellingCorrectionCommand instead. Otherwise, we won't fire the right type of input events.
Ryosuke Niwa
Comment 9
2019-03-15 22:06:41 PDT
(In reply to Tim Horton from
comment #3
)
> This is at best a prototype, and is missing a whole bunch of things. Here > are my big concerns: > > - probably need to use the right editing command, not > replaceSelectionWithText
Indeed, we want to use SpellingCorrectionCommand.
> - performance cost of doing so much TextIterator
This is probably okay.
> - I don't think the selection quite ends back up in the right place all the > time (there's much more complicated code in Editor for this, but I don't > know enough about editing to know why)
The tricky case is when there are multiple corrections coming on our way. e.g. auto-linkify then smart-quote at the same time. How are those things implemented with this API? In general, the current approach of using selection-relative offsets makes me uneasy. There is no guarantee that the selection offsets don't change between the time we went to UIKit and by the time we receive the message back in the web content process. Usually, we use the offsets relative to the root editable element. Can we do that somehow?
> - who knows if I've really disabled all of the normal spell checking things, > or if there's a better bottleneck
Well, I guess we'd have to start from somewhere.
Tim Horton
Comment 10
2019-03-18 20:39:11 PDT
(In reply to Ryosuke Niwa from
comment #9
)
> (In reply to Tim Horton from
comment #3
) > > This is at best a prototype, and is missing a whole bunch of things. Here > > are my big concerns: > > > > - probably need to use the right editing command, not > > replaceSelectionWithText > > Indeed, we want to use SpellingCorrectionCommand.
Yeah, I've made that change.
> > - I don't think the selection quite ends back up in the right place all the > > time (there's much more complicated code in Editor for this, but I don't > > know enough about editing to know why) > > The tricky case is when there are multiple corrections coming on our way. > e.g. auto-linkify then smart-quote at the same time. How are those things > implemented with this API?
Like I mentioned, at the moment it only does spelling and grammar. But in general, they can push as many updates (and changes of different kinds!) as they want in a single message.
> In general, the current approach of using selection-relative offsets makes > me uneasy. There is no guarantee that the selection offsets don't change > between the time we went to UIKit and by the time we receive the message > back in the web content process. Usually, we use the offsets relative to the > root editable element. Can we do that somehow?
Not right now, no. And this "range relative to selection" thing is very common in our interface with UIKit. I think it's generally OK because UIKit drives the selection in the general case, but obviously things will fall down if the page starts moving it around. But I think that's already true for many other interactions. I'll bring it up with other folks and see what they think, but we'll start here.
Tim Horton
Comment 11
2019-03-19 00:05:02 PDT
Created
attachment 365129
[details]
Patch
Tim Horton
Comment 12
2019-03-19 12:23:01 PDT
Created
attachment 365202
[details]
Patch
EWS Watchlist
Comment 13
2019-03-19 12:28:34 PDT
Attachment 365202
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/DocumentMarker.h:112: Missing spaces around < [whitespace/operators] [3] Total errors found: 1 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
EWS Watchlist
Comment 14
2019-03-19 17:14:29 PDT
Comment on
attachment 365202
[details]
Patch
Attachment 365202
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/11572027
New failing tests: http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html
EWS Watchlist
Comment 15
2019-03-19 17:14:30 PDT
Created
attachment 365266
[details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
Ryosuke Niwa
Comment 16
2019-03-19 19:49:20 PDT
Comment on
attachment 365202
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=365202&action=review
r=me. I guess we can polish the code more as the related radar gets resolved.
> Source/WebKit/WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:73 > +RefPtr<Range> TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection(int64_t offset, uint64_t length, size_t& outLocationInRoot)
Make this return optional<struct { Ref<Range> range; size_t locationInRoot; }> instead of taking an out argument?
> Source/WebKit/WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:107 > + bool restoreSelection = frameSelection.selection().selectionType() == VisibleSelection::CaretSelection;
Just check frameSelection.selection().isRange()
> Source/WebKit/WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:109 > + Editor::replaceRangeForSpellChecking(*range, [annotatedString.string string]);
Can we make this a regular instance member function? We already have frame here.
Tim Horton
Comment 17
2019-03-19 23:52:40 PDT
Created
attachment 365322
[details]
Patch
EWS Watchlist
Comment 18
2019-03-19 23:54:03 PDT
Attachment 365322
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/DocumentMarker.h:112: Missing spaces around < [whitespace/operators] [3] Total errors found: 1 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 19
2019-03-20 00:32:46 PDT
Comment on
attachment 365322
[details]
Patch Clearing flags on attachment: 365322 Committed
r243195
: <
https://trac.webkit.org/changeset/243195
>
WebKit Commit Bot
Comment 20
2019-03-20 00:32:48 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 21
2019-03-20 00:33:22 PDT
<
rdar://problem/49053492
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug