Changeset 261903 in webkit
- Timestamp:
- May 19, 2020 8:13:49 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261901 r261903 1 2020-05-19 Darin Adler <darin@apple.com> 2 3 REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed 4 https://bugs.webkit.org/show_bug.cgi?id=212093 5 6 Reviewed by Daniel Bates. 7 8 * dom/DocumentMarkerController.cpp: 9 (WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to 10 unsigned. This protects against underflow. 11 1 12 2020-05-19 Sam Weinig <weinig@apple.com> 2 13 -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r259930 r261903 596 596 #if PLATFORM(IOS_FAMILY) 597 597 // FIXME: No obvious reason this should be iOS-specific. Remove the #if at some point. 598 int targetStartOffset = marker.startOffset() + delta;599 int targetEndOffset = marker.endOffset() + delta;600 if ( static_cast<unsigned>(targetStartOffset)>= node.length() || targetEndOffset <= 0) {598 auto targetStartOffset = clampTo<unsigned>(static_cast<int>(marker.startOffset()) + delta); 599 auto targetEndOffset = clampTo<unsigned>(static_cast<int>(marker.endOffset()) + delta); 600 if (targetStartOffset >= node.length() || targetEndOffset <= 0) { 601 601 list->remove(i); 602 602 continue; … … 612 612 // FIXME: No obvious reason this should be iOS-specific. Remove the #if at some point. 613 613 else if (marker.endOffset() > startOffset) { 614 if ( marker.endOffset() + delta<= marker.startOffset()) {614 if (targetEndOffset <= marker.startOffset()) { 615 615 list->remove(i); 616 616 continue; 617 617 } 618 marker.setEndOffset(std::min <unsigned>(targetEndOffset, node.length()));618 marker.setEndOffset(std::min(targetEndOffset, node.length())); 619 619 didShiftMarker = true; 620 620 } -
trunk/Tools/ChangeLog
r261898 r261903 1 2020-05-19 Darin Adler <darin@apple.com> 2 3 REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed 4 https://bugs.webkit.org/show_bug.cgi?id=212093 5 6 Reviewed by Daniel Bates. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm: 9 (TestWebKitAPI::TEST): Expect success rather than failure. 10 1 11 2020-05-19 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm
r261897 r261903 154 154 } 155 155 156 TEST(InsertTextAlternatives, InsertTrailingSpaceWhitespaceRebalance_ExpectedFailure) 157 { 158 auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 159 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration]); 160 auto inputDelegate = adoptNS([[TestInputDelegate alloc] init]); 161 [inputDelegate setFocusStartsInputSessionPolicyHandler:[] (WKWebView *, id <_WKFocusedElementInfo>) { return _WKFocusStartsInputSessionPolicyAllow; }]; 162 [webView _setInputDelegate:inputDelegate.get()]; 163 164 [webView synchronouslyLoadHTMLString:@"<body contenteditable='true'></body>"]; 165 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.body.focus()"]; 166 [[webView textInputContentView] insertText:@"hello" alternatives:@[@"yellow"] style:UITextAlternativeStyleNone]; 167 [[webView textInputContentView] insertText:@" "]; 168 [webView waitForNextPresentationUpdate]; 169 170 // FIXME: Change this to EXPECT_TRUE() once <https://webkit.org/b/212093> is fixed. 171 EXPECT_FALSE([[webView objectByEvaluatingJavaScript:@"internals.hasDictationAlternativesMarker(0, 5)"] boolValue]); // hello 156 TEST(InsertTextAlternatives, InsertTrailingSpaceWhitespaceRebalance) 157 { 158 auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 159 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration]); 160 auto inputDelegate = adoptNS([[TestInputDelegate alloc] init]); 161 [inputDelegate setFocusStartsInputSessionPolicyHandler:[] (WKWebView *, id <_WKFocusedElementInfo>) { return _WKFocusStartsInputSessionPolicyAllow; }]; 162 [webView _setInputDelegate:inputDelegate.get()]; 163 164 [webView synchronouslyLoadHTMLString:@"<body contenteditable='true'></body>"]; 165 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.body.focus()"]; 166 [[webView textInputContentView] insertText:@"hello" alternatives:@[@"yellow"] style:UITextAlternativeStyleNone]; 167 [[webView textInputContentView] insertText:@" "]; 168 [webView waitForNextPresentationUpdate]; 169 170 EXPECT_TRUE([[webView objectByEvaluatingJavaScript:@"internals.hasDictationAlternativesMarker(0, 5)"] boolValue]); // hello 172 171 } 173 172
Note: See TracChangeset
for help on using the changeset viewer.