Changeset 271262 in webkit
- Timestamp:
- Jan 7, 2021 3:09:29 PM (19 months 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
r271261 r271262 1 2021-01-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Text fields should not be translated while typing 4 https://bugs.webkit.org/show_bug.cgi?id=220431 5 <rdar://problem/71724918> 6 7 Reviewed by Tim Horton. 8 9 Don't vend text nodes or newly created elements inside input elements for translation (i.e. text manipulation) 10 if the input element was modified by the user. Note that this check is right before the call to 11 `observeParagraphs` as opposed to when we schedule the observation update, since edit commands may create 12 renderers for text nodes and other elements before the `m_lastChangeWasUserEdit` flag has been set. 13 14 Test: TextManipulation.StartTextManipulationDoesNotExtractUserModifiedText 15 16 * editing/TextManipulationController.cpp: 17 (WebCore::TextManipulationController::scheduleObservationUpdate): 18 1 19 2021-01-07 Eric Carlson <eric.carlson@apple.com> 2 20 -
trunk/Source/WebCore/editing/TextManipulationController.cpp
r270561 r271262 606 606 if (!node->isConnected()) 607 607 continue; 608 609 if (auto host = makeRefPtr(node->shadowHost()); is<HTMLInputElement>(host.get()) && downcast<HTMLInputElement>(*host).lastChangeWasUserEdit()) 610 continue; 611 608 612 if (!commonAncestor) 609 613 commonAncestor = is<ContainerNode>(node.get()) ? node.ptr() : node->parentNode(); -
trunk/Tools/ChangeLog
r271258 r271262 1 2021-01-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Text fields should not be translated while typing 4 https://bugs.webkit.org/show_bug.cgi?id=220431 5 <rdar://problem/71724918> 6 7 Reviewed by Tim Horton. 8 9 Add an API test that modifies text in two input fields (by executing an edit command, and then by 10 programmatically setting the value attribute). The test verifies that only the latter (programmatic) value 11 change propagates a text manipulation update to the client layer. 12 13 * TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm: 14 (TestWebKitAPI::TEST): 15 1 16 2021-01-07 Jonathan Bedard <JonWBedard@gmail.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm
r270561 r271262 925 925 } 926 926 927 TEST(TextManipulation, StartTextManipulationDoesNotExtractUserModifiedText) 928 { 929 auto delegate = adoptNS([[TextManipulationDelegate alloc] init]); 930 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]); 931 [webView _setTextManipulationDelegate:delegate.get()]; 932 [webView synchronouslyLoadHTMLString:@"<!DOCTYPE html><body><input id='one'><input id='two'></body>"]; 933 934 done = false; 935 [webView _startTextManipulationsWithConfiguration:nil completion:^{ 936 done = true; 937 }]; 938 TestWebKitAPI::Util::run(&done); 939 940 EXPECT_EQ([delegate items].count, 0UL); 941 942 Vector<RetainPtr<_WKTextManipulationItem>> items; 943 done = false; 944 [delegate setItemCallback:[&] (_WKTextManipulationItem *item) { 945 items.append(retainPtr(item)); 946 done = true; 947 }]; 948 949 [webView stringByEvaluatingJavaScript:@"document.getElementById('one').focus();" 950 "document.execCommand('InsertText', true, 'foo');" 951 "document.getElementById('two').value = 'bar';"]; 952 953 Util::run(&done); 954 955 EXPECT_EQ(items.size(), 1U); 956 957 auto tokens = [items[0] tokens]; 958 EXPECT_EQ(tokens.count, 1UL); 959 EXPECT_WK_STREQ("bar", tokens.firstObject.content); 960 } 961 927 962 TEST(TextManipulation, StartTextManipulationExtractsVisibleLineBreaksInTextAsExcludedTokens) 928 963 {
Note: See TracChangeset
for help on using the changeset viewer.