Changeset 246311 in webkit
- Timestamp:
- Jun 11, 2019, 7:46:23 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/FocusedElementInformation.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/FocusedElementInformation.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246308 r246311 1 2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors 4 https://bugs.webkit.org/show_bug.cgi?id=198735 5 <rdar://problem/51557159> 6 7 Reviewed by Megan Gardner. 8 9 Add a flag in FocusedElementInformation to indicate whether spellchecking is allowed in the focused element. 10 If spellchecking is not allowed, then disable smart quotes and dashes, which matches behavior on macOS. 11 12 * Shared/FocusedElementInformation.cpp: 13 (WebKit::FocusedElementInformation::encode const): 14 (WebKit::FocusedElementInformation::decode): 15 * Shared/FocusedElementInformation.h: 16 * UIProcess/ios/WKContentViewInteraction.mm: 17 (-[WKContentView textInputTraits]): 18 * WebProcess/WebPage/ios/WebPageIOS.mm: 19 (WebKit::WebPage::getFocusedElementInformation): 20 1 21 2019-06-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 22 -
trunk/Source/WebKit/Shared/FocusedElementInformation.cpp
r246226 r246311 106 106 #endif 107 107 encoder << shouldSynthesizeKeyEventsForEditing; 108 encoder << isSpellCheckingEnabled; 108 109 } 109 110 … … 227 228 return false; 228 229 230 if (!decoder.decode(result.isSpellCheckingEnabled)) 231 return false; 232 229 233 return true; 230 234 } -
trunk/Source/WebKit/Shared/FocusedElementInformation.h
r246226 r246311 138 138 #endif 139 139 bool shouldSynthesizeKeyEventsForEditing { false }; 140 bool isSpellCheckingEnabled { true }; 140 141 141 142 FocusedElementIdentifier focusedElementIdentifier { 0 }; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246300 r246311 4385 4385 } 4386 4386 4387 if (!_focusedElementInformation.isSpellCheckingEnabled) { 4388 [_traits setSmartQuotesType:UITextSmartQuotesTypeNo]; 4389 [_traits setSmartDashesType:UITextSmartDashesTypeNo]; 4390 } 4391 4387 4392 switch (_focusedElementInformation.inputMode) { 4388 4393 case WebCore::InputMode::None: -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r246276 r246311 2767 2767 information.elementRect = IntRect(); 2768 2768 2769 if (is<HTMLElement>(m_focusedElement)) 2770 information.isSpellCheckingEnabled = downcast<HTMLElement>(*m_focusedElement).spellcheck(); 2771 2769 2772 information.minimumScaleFactor = minimumPageScaleFactor(); 2770 2773 information.maximumScaleFactor = maximumPageScaleFactor(); -
trunk/Tools/ChangeLog
r246307 r246311 1 2019-06-11 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors 4 https://bugs.webkit.org/show_bug.cgi?id=198735 5 <rdar://problem/51557159> 6 7 Reviewed by Megan Gardner. 8 9 Add a test to verify that spellcheck="false" disables smart quotes and dashes, but any other value defers to the 10 user's preferences by using UITextSmartQuotesTypeDefault and UITextSmartDashesTypeDefault. 11 12 * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: 13 (TestWebKitAPI::TEST): 14 1 15 2019-06-11 Tadeu Zagallo <tzagallo@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r246229 r246311 474 474 } 475 475 476 TEST(KeyboardInputTests, DisableSmartQuotesAndDashes) 477 { 478 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 479 auto inputDelegate = adoptNS([[TestInputDelegate alloc] init]); 480 [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy { 481 return _WKFocusStartsInputSessionPolicyAllow; 482 }]; 483 [webView _setInputDelegate:inputDelegate.get()]; 484 485 auto checkSmartQuotesAndDashesType = [&] (UITextSmartDashesType dashesType, UITextSmartQuotesType quotesType) { 486 UITextInputTraits *traits = [[webView textInputContentView] textInputTraits]; 487 EXPECT_EQ(dashesType, traits.smartDashesType); 488 EXPECT_EQ(quotesType, traits.smartQuotesType); 489 }; 490 491 [webView synchronouslyLoadHTMLString:@"<div id='foo' contenteditable spellcheck='false'></div><textarea id='bar' spellcheck='false'></textarea><input id='baz' spellcheck='false'>"]; 492 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"foo.focus()"]; 493 checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); 494 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"bar.focus()"]; 495 checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); 496 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"baz.focus()"]; 497 checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); 498 499 [webView synchronouslyLoadHTMLString:@"<div id='foo' contenteditable></div><textarea id='bar' spellcheck='true'></textarea><input id='baz'>"]; 500 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"foo.focus()"]; 501 checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); 502 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"bar.focus()"]; 503 checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); 504 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"baz.focus()"]; 505 checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); 506 } 507 476 508 } // namespace TestWebKitAPI 477 509
Note:
See TracChangeset
for help on using the changeset viewer.