Title: [292008] trunk/Source/WebKit
Revision
292008
Author
commit-qu...@webkit.org
Date
2022-03-28 16:31:02 -0700 (Mon, 28 Mar 2022)

Log Message

Unreviewed, reverting r291728.
https://bugs.webkit.org/show_bug.cgi?id=238476

causing crashes in tests

Reverted changeset:

"Expand autocorrect context for more accurate results."
https://bugs.webkit.org/show_bug.cgi?id=237990
https://commits.webkit.org/r291728

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (292007 => 292008)


--- trunk/Source/WebKit/ChangeLog	2022-03-28 23:28:00 UTC (rev 292007)
+++ trunk/Source/WebKit/ChangeLog	2022-03-28 23:31:02 UTC (rev 292008)
@@ -1,3 +1,16 @@
+2022-03-28  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r291728.
+        https://bugs.webkit.org/show_bug.cgi?id=238476
+
+        causing crashes in tests
+
+        Reverted changeset:
+
+        "Expand autocorrect context for more accurate results."
+        https://bugs.webkit.org/show_bug.cgi?id=237990
+        https://commits.webkit.org/r291728
+
 2022-03-28  Devin Rousso  <drou...@apple.com>
 
         [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (292007 => 292008)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2022-03-28 23:28:00 UTC (rev 292007)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2022-03-28 23:31:02 UTC (rev 292008)
@@ -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 = 10;
-    const unsigned minContextLength = 40;
-    const unsigned maxContextLength = 100;
+    const unsigned minContextWordCount = 3;
+    const unsigned minContextLength = 12;
+    const unsigned maxContextLength = 30;
 
     if (frame->selection().isRange())
         selectedText = plainTextForContext(frame->selection().selection().toNormalizedRange());
@@ -2598,9 +2598,6 @@
                     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)
@@ -2609,9 +2606,10 @@
         }
 
         if (endPosition != endOfEditableContent(endPosition)) {
-            VisiblePosition nextPosition = positionOfNextBoundaryOfGranularity(endPosition, TextGranularity::SentenceGranularity, SelectionDirection::Forward);
-            if (nextPosition.isNotNull() && nextPosition != endPosition)
-                contextAfter = plainTextForContext(makeSimpleRange(endPosition, nextPosition));
+            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));
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to