Title: [267487] branches/safari-611.1.1-branch
- Revision
- 267487
- Author
- [email protected]
- Date
- 2020-09-23 10:07:50 -0700 (Wed, 23 Sep 2020)
Log Message
Cherry-pick r267439. rdar://problem/69441287
REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
https://bugs.webkit.org/show_bug.cgi?id=216846
Reviewed by Wenson Hsieh.
Source/WebCore:
TextIterator does not visit node that has no renderer, so if node has become hidden, TextManipulationController
will not find content node in paragraph range during replacement.
API Test: TextManipulation.CompleteTextManipulationParagraphBecomesHidden
* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::replace):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-611.1.1-branch/Source/WebCore/ChangeLog (267486 => 267487)
--- branches/safari-611.1.1-branch/Source/WebCore/ChangeLog 2020-09-23 17:07:18 UTC (rev 267486)
+++ branches/safari-611.1.1-branch/Source/WebCore/ChangeLog 2020-09-23 17:07:50 UTC (rev 267487)
@@ -1,3 +1,45 @@
+2020-09-23 Russell Epstein <[email protected]>
+
+ Cherry-pick r267439. rdar://problem/69441287
+
+ REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
+ https://bugs.webkit.org/show_bug.cgi?id=216846
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebCore:
+
+ TextIterator does not visit node that has no renderer, so if node has become hidden, TextManipulationController
+ will not find content node in paragraph range during replacement.
+
+ API Test: TextManipulation.CompleteTextManipulationParagraphBecomesHidden
+
+ * editing/TextManipulationController.cpp:
+ (WebCore::TextManipulationController::replace):
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
+ (TestWebKitAPI::TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-22 Sihui Liu <[email protected]>
+
+ REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
+ https://bugs.webkit.org/show_bug.cgi?id=216846
+
+ Reviewed by Wenson Hsieh.
+
+ TextIterator does not visit node that has no renderer, so if node has become hidden, TextManipulationController
+ will not find content node in paragraph range during replacement.
+
+ API Test: TextManipulation.CompleteTextManipulationParagraphBecomesHidden
+
+ * editing/TextManipulationController.cpp:
+ (WebCore::TextManipulationController::replace):
+
2020-09-20 Zalan Bujtas <[email protected]>
[LFC][IFC] InlineFormattingState should not store display lines and runs
Modified: branches/safari-611.1.1-branch/Source/WebCore/editing/TextManipulationController.cpp (267486 => 267487)
--- branches/safari-611.1.1-branch/Source/WebCore/editing/TextManipulationController.cpp 2020-09-23 17:07:18 UTC (rev 267486)
+++ branches/safari-611.1.1-branch/Source/WebCore/editing/TextManipulationController.cpp 2020-09-23 17:07:50 UTC (rev 267487)
@@ -828,6 +828,9 @@
}
}
+ if (!firstContentNode)
+ return ManipulationFailureType::ContentChanged;
+
while (lastChildOfCommonAncestorInRange && lastChildOfCommonAncestorInRange->parentNode() != commonAncestor)
lastChildOfCommonAncestorInRange = lastChildOfCommonAncestorInRange->parentNode();
Modified: branches/safari-611.1.1-branch/Tools/ChangeLog (267486 => 267487)
--- branches/safari-611.1.1-branch/Tools/ChangeLog 2020-09-23 17:07:18 UTC (rev 267486)
+++ branches/safari-611.1.1-branch/Tools/ChangeLog 2020-09-23 17:07:50 UTC (rev 267487)
@@ -1,3 +1,40 @@
+2020-09-23 Russell Epstein <[email protected]>
+
+ Cherry-pick r267439. rdar://problem/69441287
+
+ REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
+ https://bugs.webkit.org/show_bug.cgi?id=216846
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebCore:
+
+ TextIterator does not visit node that has no renderer, so if node has become hidden, TextManipulationController
+ will not find content node in paragraph range during replacement.
+
+ API Test: TextManipulation.CompleteTextManipulationParagraphBecomesHidden
+
+ * editing/TextManipulationController.cpp:
+ (WebCore::TextManipulationController::replace):
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
+ (TestWebKitAPI::TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-09-22 Sihui Liu <[email protected]>
+
+ REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
+ https://bugs.webkit.org/show_bug.cgi?id=216846
+
+ Reviewed by Wenson Hsieh.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
+ (TestWebKitAPI::TEST):
+
2020-09-19 Lauro Moura <[email protected]>
[GLIB] Merge API test expectations
Modified: branches/safari-611.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm (267486 => 267487)
--- branches/safari-611.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm 2020-09-23 17:07:18 UTC (rev 267486)
+++ branches/safari-611.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm 2020-09-23 17:07:50 UTC (rev 267487)
@@ -3195,6 +3195,46 @@
[webView stringByEvaluatingJavaScript:@"document.body.innerHTML"]);
}
+TEST(TextManipulation, CompleteTextManipulationParagraphBecomesHidden)
+{
+ auto delegate = adoptNS([[TextManipulationDelegate alloc] init]);
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+ [webView _setTextManipulationDelegate:delegate.get()];
+ [webView synchronouslyLoadHTMLString:@"<!DOCTYPE html>"
+ "<head><style> .hidden { display: none; } </style></head>"
+ "<body><span>hello</span></body>"];
+
+ done = false;
+ [webView _startTextManipulationsWithConfiguration:nil completion:^{
+ done = true;
+ }];
+ TestWebKitAPI::Util::run(&done);
+
+ auto items = [delegate items];
+ EXPECT_EQ(items.count, 1UL);
+ EXPECT_EQ(items[0].tokens.count, 1UL);
+ EXPECT_WK_STREQ("hello", items[0].tokens[0].content);
+
+ done = false;
+ [webView evaluateJavaScript:@"document.querySelector('span').classList.add('hidden');" completionHandler:^(id result, NSError *) {
+ EXPECT_NULL(result);
+ done = true;
+ }];
+
+ done = false;
+ __block auto item = createItem(items[0].identifier, {{ items[0].tokens[0].identifier, @"Hello" }});
+ [webView _completeTextManipulationForItems:@[item.get()] completion:^(NSArray<NSError *> *errors) {
+ EXPECT_EQ(errors.count, 1UL);
+ EXPECT_EQ(errors.firstObject.domain, _WKTextManipulationItemErrorDomain);
+ EXPECT_EQ(errors.firstObject.code, _WKTextManipulationItemErrorContentChanged);
+ EXPECT_EQ(errors.firstObject.userInfo[_WKTextManipulationItemErrorItemKey], item.get());
+ done = true;
+ }];
+ TestWebKitAPI::Util::run(&done);
+
+ EXPECT_WK_STREQ("<span class=\"hidden\">hello</span>", [webView stringByEvaluatingJavaScript:@"document.body.innerHTML"]);
+}
+
TEST(TextManipulation, TextManipulationTokenDebugDescription)
{
auto token = adoptNS([[_WKTextManipulationToken alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes