Title: [291728] trunk/Source/WebKit
- Revision
- 291728
- Author
- [email protected]
- Date
- 2022-03-22 17:11:38 -0700 (Tue, 22 Mar 2022)
Log Message
Expand autocorrect context for more accurate results.
https://bugs.webkit.org/show_bug.cgi?id=237990
rdar://87353381
Expand autocorrect context to at least 10 words instead of 3, and with a min/max length of 40/100 instead of 12/30
and start context at the beginning of sentences to help with having more accurate autocorrect suggestions.
Reviewed by Tim Horton.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::autocorrectionContext):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (291727 => 291728)
--- trunk/Source/WebKit/ChangeLog 2022-03-23 00:00:17 UTC (rev 291727)
+++ trunk/Source/WebKit/ChangeLog 2022-03-23 00:11:38 UTC (rev 291728)
@@ -1,3 +1,17 @@
+2022-03-22 Megan Gardner <[email protected]>
+
+ Expand autocorrect context for more accurate results.
+ https://bugs.webkit.org/show_bug.cgi?id=237990
+ rdar://87353381
+
+ Expand autocorrect context to at least 10 words instead of 3, and with a min/max length of 40/100 instead of 12/30
+ and start context at the beginning of sentences to help with having more accurate autocorrect suggestions.
+
+ Reviewed by Tim Horton.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::autocorrectionContext):
+
2022-03-22 Tyler Wilcock <[email protected]>
Expose the AX tree of PDFs loaded via iframes on the Mac
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (291727 => 291728)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-03-23 00:00:17 UTC (rev 291727)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-03-23 00:11:38 UTC (rev 291728)
@@ -2565,9 +2565,9 @@
Ref frame = CheckedRef(m_page->focusController())->focusedOrMainFrame();
VisiblePosition startPosition = frame->selection().selection().start();
VisiblePosition endPosition = frame->selection().selection().end();
- const unsigned minContextWordCount = 3;
- const unsigned minContextLength = 12;
- const unsigned maxContextLength = 30;
+ const unsigned minContextWordCount = 10;
+ const unsigned minContextLength = 40;
+ const unsigned maxContextLength = 100;
if (frame->selection().isRange())
selectedText = plainTextForContext(frame->selection().selection().toNormalizedRange());
@@ -2598,6 +2598,9 @@
break;
contextStartPosition = previousPosition;
}
+ VisiblePosition sentenceContextStartPosition = positionOfNextBoundaryOfGranularity(startPosition, TextGranularity::SentenceGranularity, SelectionDirection::Backward);
+ if (sentenceContextStartPosition.isNotNull() && sentenceContextStartPosition < contextStartPosition)
+ contextStartPosition = sentenceContextStartPosition;
if (contextStartPosition.isNotNull() && contextStartPosition != startPosition) {
contextBefore = plainTextForContext(makeSimpleRange(contextStartPosition, startPosition));
if (atBoundaryOfGranularity(contextStartPosition, TextGranularity::ParagraphGranularity, SelectionDirection::Backward) && firstPositionInEditableContent != contextStartPosition)
@@ -2606,10 +2609,9 @@
}
if (endPosition != endOfEditableContent(endPosition)) {
- VisiblePosition nextPosition;
- if (!atBoundaryOfGranularity(endPosition, TextGranularity::WordGranularity, SelectionDirection::Forward) && withinTextUnitOfGranularity(endPosition, TextGranularity::WordGranularity, SelectionDirection::Forward))
- nextPosition = positionOfNextBoundaryOfGranularity(endPosition, TextGranularity::WordGranularity, SelectionDirection::Forward);
- contextAfter = plainTextForContext(makeSimpleRange(endPosition, nextPosition));
+ VisiblePosition nextPosition = positionOfNextBoundaryOfGranularity(endPosition, TextGranularity::SentenceGranularity, SelectionDirection::Forward);
+ if (nextPosition.isNotNull() && nextPosition != endPosition)
+ contextAfter = plainTextForContext(makeSimpleRange(endPosition, nextPosition));
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes