Title: [261903] trunk
- Revision
- 261903
- Author
- [email protected]
- Date
- 2020-05-19 20:13:49 -0700 (Tue, 19 May 2020)
Log Message
REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed
https://bugs.webkit.org/show_bug.cgi?id=212093
Reviewed by Daniel Bates.
Source/WebCore:
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to
unsigned. This protects against underflow.
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm:
(TestWebKitAPI::TEST): Expect success rather than failure.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (261902 => 261903)
--- trunk/Source/WebCore/ChangeLog 2020-05-20 02:33:02 UTC (rev 261902)
+++ trunk/Source/WebCore/ChangeLog 2020-05-20 03:13:49 UTC (rev 261903)
@@ -1,3 +1,14 @@
+2020-05-19 Darin Adler <[email protected]>
+
+ REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed
+ https://bugs.webkit.org/show_bug.cgi?id=212093
+
+ Reviewed by Daniel Bates.
+
+ * dom/DocumentMarkerController.cpp:
+ (WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to
+ unsigned. This protects against underflow.
+
2020-05-19 Sam Weinig <[email protected]>
Remove almost always incorrect Color::getRGBA
Modified: trunk/Source/WebCore/dom/DocumentMarkerController.cpp (261902 => 261903)
--- trunk/Source/WebCore/dom/DocumentMarkerController.cpp 2020-05-20 02:33:02 UTC (rev 261902)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.cpp 2020-05-20 03:13:49 UTC (rev 261903)
@@ -595,9 +595,9 @@
#if PLATFORM(IOS_FAMILY)
// FIXME: No obvious reason this should be iOS-specific. Remove the #if at some point.
- int targetStartOffset = marker.startOffset() + delta;
- int targetEndOffset = marker.endOffset() + delta;
- if (static_cast<unsigned>(targetStartOffset) >= node.length() || targetEndOffset <= 0) {
+ auto targetStartOffset = clampTo<unsigned>(static_cast<int>(marker.startOffset()) + delta);
+ auto targetEndOffset = clampTo<unsigned>(static_cast<int>(marker.endOffset()) + delta);
+ if (targetStartOffset >= node.length() || targetEndOffset <= 0) {
list->remove(i);
continue;
}
@@ -611,11 +611,11 @@
#if PLATFORM(IOS_FAMILY)
// FIXME: No obvious reason this should be iOS-specific. Remove the #if at some point.
else if (marker.endOffset() > startOffset) {
- if (marker.endOffset() + delta <= marker.startOffset()) {
+ if (targetEndOffset <= marker.startOffset()) {
list->remove(i);
continue;
}
- marker.setEndOffset(std::min<unsigned>(targetEndOffset, node.length()));
+ marker.setEndOffset(std::min(targetEndOffset, node.length()));
didShiftMarker = true;
}
#endif
Modified: trunk/Tools/ChangeLog (261902 => 261903)
--- trunk/Tools/ChangeLog 2020-05-20 02:33:02 UTC (rev 261902)
+++ trunk/Tools/ChangeLog 2020-05-20 03:13:49 UTC (rev 261903)
@@ -1,3 +1,13 @@
+2020-05-19 Darin Adler <[email protected]>
+
+ REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed
+ https://bugs.webkit.org/show_bug.cgi?id=212093
+
+ Reviewed by Daniel Bates.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm:
+ (TestWebKitAPI::TEST): Expect success rather than failure.
+
2020-05-19 Alex Christensen <[email protected]>
Add _WKDownloadDelegate callback including totalBytesWritten
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm (261902 => 261903)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm 2020-05-20 02:33:02 UTC (rev 261902)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InsertTextAlternatives.mm 2020-05-20 03:13:49 UTC (rev 261903)
@@ -153,7 +153,7 @@
EXPECT_FALSE([[webView objectByEvaluatingJavaScript:@"internals.hasDictationAlternativesMarker(5, 1)"] boolValue]); // <space>
}
-TEST(InsertTextAlternatives, InsertTrailingSpaceWhitespaceRebalance_ExpectedFailure)
+TEST(InsertTextAlternatives, InsertTrailingSpaceWhitespaceRebalance)
{
auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration]);
@@ -167,8 +167,7 @@
[[webView textInputContentView] insertText:@" "];
[webView waitForNextPresentationUpdate];
- // FIXME: Change this to EXPECT_TRUE() once <https://webkit.org/b/212093> is fixed.
- EXPECT_FALSE([[webView objectByEvaluatingJavaScript:@"internals.hasDictationAlternativesMarker(0, 5)"] boolValue]); // hello
+ EXPECT_TRUE([[webView objectByEvaluatingJavaScript:@"internals.hasDictationAlternativesMarker(0, 5)"] boolValue]); // hello
}
TEST(InsertTextAlternatives, InsertTrailingNewline)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes