Changeset 259819 in webkit
- Timestamp:
- Apr 9, 2020, 1:16:38 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/TextManipulationController.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259817 r259819 1 2020-04-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add an API test for <https://trac.webkit.org/r259766> 4 https://bugs.webkit.org/show_bug.cgi?id=210294 5 6 Reviewed by Tim Horton. 7 8 Avoid trying to place the missing value into paragraphSets in TextManipulationController by bailing if either 9 the start or end positions are null (while the missing value requires both the start and end to be null, it is 10 sufficient to bail if either are null because `observeParagraphs` will be a no-op anyways). 11 12 See Tools/ChangeLog for more details. 13 14 Test: TextManipulation.CompleteTextManipulationAvoidCrashingWhenContentIsRemoved 15 16 * editing/TextManipulationController.cpp: 17 (WebCore::TextManipulationController::scheduleObservartionUpdate): 18 1 19 2020-04-09 Ryan Haddad <ryanhaddad@apple.com> 2 20 -
trunk/Source/WebCore/editing/TextManipulationController.cpp
r259766 r259819 377 377 auto end = endOfParagraph(lastPositionInOrAfterNode(element.ptr())); 378 378 379 if (start.isNull() || end.isNull()) 380 continue; 381 379 382 auto key = makeHashablePositionRange(start, end); 380 383 if (!paragraphSets.add(key).isNewEntry) -
trunk/Tools/ChangeLog
r259818 r259819 1 2020-04-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add an API test for <https://trac.webkit.org/r259766> 4 https://bugs.webkit.org/show_bug.cgi?id=210294 5 6 Reviewed by Tim Horton. 7 8 Exercise the pathological case fixed in r259766 by inserting and then immediately removing a paragraph element 9 after starting text manipulation. This test also revealed an existing issue in TextManipulationController, where 10 we will end up hitting a debug assertion when trying to insert { null position, null position } into a HashMap 11 underneath `TextManipulationController::scheduleObservartionUpdate`. 12 13 * TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm: 14 (TestWebKitAPI::TEST): 15 1 16 2020-04-09 Simon Fraser <simon.fraser@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm
r259647 r259819 844 844 } 845 845 846 TEST(TextManipulation, CompleteTextManipulationAvoidCrashingWhenContentIsRemoved) 847 { 848 auto delegate = adoptNS([[TextManipulationDelegate alloc] init]); 849 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]); 850 [webView _setTextManipulationDelegate:delegate.get()]; 851 852 [webView synchronouslyLoadTestPageNamed:@"simple"]; 853 854 done = false; 855 [webView _startTextManipulationsWithConfiguration:nil completion:^{ 856 done = true; 857 }]; 858 TestWebKitAPI::Util::run(&done); 859 860 auto *items = [delegate items]; 861 EXPECT_EQ(items.count, 1UL); 862 auto *tokens = items[0].tokens; 863 EXPECT_EQ(tokens.count, 1UL); 864 865 __block bool done = false; 866 [webView performAfterReceivingMessage:@"DoneRemovingParagraph" action:^{ 867 done = true; 868 }]; 869 870 [webView stringByEvaluatingJavaScript: 871 @"const paragraph = document.createElement('p');" 872 "paragraph.textContent = 'Hello world';" 873 "document.body.appendChild(paragraph);" 874 "setTimeout(() => { paragraph.remove(); webkit.messageHandlers.testHandler.postMessage('DoneRemovingParagraph') })"]; 875 876 done = false; 877 [webView _completeTextManipulationForItems:@[(_WKTextManipulationItem *)createItem(items[0].identifier, { 878 { tokens[0].identifier, @"Simple HTML file!" }, 879 })] completion:^(NSArray<NSError *> *errors) { 880 EXPECT_EQ(errors, nil); 881 done = true; 882 }]; 883 884 EXPECT_WK_STREQ("Simple HTML file!", [webView stringByEvaluatingJavaScript:@"document.body.textContent"]); 885 } 886 846 887 TEST(TextManipulation, CompleteTextManipulationShouldPreserveImagesAsExcludedTokens) 847 888 {
Note:
See TracChangeset
for help on using the changeset viewer.