WebKit Bugzilla
Attachment 371799 Details for
Bug 198735
: Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198735-20190610173407.patch (text/plain), 8.09 KB, created by
Wenson Hsieh
on 2019-06-10 17:34:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-06-10 17:34:08 PDT
Size:
8.09 KB
patch
obsolete
>Subversion Revision: 246278 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 98c6ebab6b5446f5eafc3aee3924902c180986d7..293c4ecf7b7b7c8c3512b5b4feefb7b79006756f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2019-06-10 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors >+ https://bugs.webkit.org/show_bug.cgi?id=198735 >+ <rdar://problem/51557159> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a flag in FocusedElementInformation to indicate whether spellchecking is allowed in the focused element. >+ If spellchecking is not allowed, then disable smart quotes and dashes, which matches behavior on macOS. >+ >+ * Shared/FocusedElementInformation.cpp: >+ (WebKit::FocusedElementInformation::encode const): >+ (WebKit::FocusedElementInformation::decode): >+ * Shared/FocusedElementInformation.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView textInputTraits]): >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::getFocusedElementInformation): >+ > 2019-06-10 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] fast/xsl tests are flaky when run after certain viewport shrink-to-fit tests >diff --git a/Source/WebKit/Shared/FocusedElementInformation.cpp b/Source/WebKit/Shared/FocusedElementInformation.cpp >index 48fb32423d558b20dbe7d9eb10c8e87072b140db..f1e5364fae4e647aa6c80f1c44dbb722cbafbd42 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.cpp >+++ b/Source/WebKit/Shared/FocusedElementInformation.cpp >@@ -105,6 +105,7 @@ void FocusedElementInformation::encode(IPC::Encoder& encoder) const > #endif > #endif > encoder << shouldSynthesizeKeyEventsForEditing; >+ encoder << isSpellCheckingEnabled; > } > > bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInformation& result) >@@ -226,6 +227,9 @@ bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInfo > if (!decoder.decode(result.shouldSynthesizeKeyEventsForEditing)) > return false; > >+ if (!decoder.decode(result.isSpellCheckingEnabled)) >+ return false; >+ > return true; > } > #endif >diff --git a/Source/WebKit/Shared/FocusedElementInformation.h b/Source/WebKit/Shared/FocusedElementInformation.h >index 8d03ae2e5b5418f60e7d26c9d92f7cc324aa8d04..2f665a929592224343a4bf47935968fc805c77e3 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.h >+++ b/Source/WebKit/Shared/FocusedElementInformation.h >@@ -137,6 +137,7 @@ struct FocusedElementInformation { > #endif > #endif > bool shouldSynthesizeKeyEventsForEditing { false }; >+ bool isSpellCheckingEnabled { true }; > > FocusedElementIdentifier focusedElementIdentifier { 0 }; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index ca87bf3d2e6baf129c3f2191553d83551a7f8a16..776771c32f64accd5355e6a6cc43be4406b2a39f 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4384,6 +4384,11 @@ - (UITextInputTraits *)textInputTraits > [_traits setAutocorrectionType:_focusedElementInformation.isAutocorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo]; > } > >+ if (!_focusedElementInformation.isSpellCheckingEnabled) { >+ [_traits setSmartQuotesType:UITextSmartQuotesTypeNo]; >+ [_traits setSmartDashesType:UITextSmartDashesTypeNo]; >+ } >+ > switch (_focusedElementInformation.inputMode) { > case WebCore::InputMode::None: > case WebCore::InputMode::Unspecified: >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index da24f83c3814f2f6b818ecfdcb47846b076bd79d..b7d0e960230e0ed42d0dbcd1ea798cef8f52d072 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2766,6 +2766,9 @@ void WebPage::getFocusedElementInformation(FocusedElementInformation& informatio > } else > information.elementRect = IntRect(); > >+ if (is<HTMLElement>(m_focusedElement)) >+ information.isSpellCheckingEnabled = downcast<HTMLElement>(*m_focusedElement).spellcheck(); >+ > information.minimumScaleFactor = minimumPageScaleFactor(); > information.maximumScaleFactor = maximumPageScaleFactor(); > information.maximumScaleFactorIgnoringAlwaysScalable = maximumPageScaleFactorIgnoringAlwaysScalable(); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index cce5ef6c316c7948079d6928ca30219384a25804..9be21e7ddb7f21a11a44aa1491356301b3594f71 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2019-06-10 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Quotes are always inserted as smart quotes on stackblitz.com, causing compilation errors >+ https://bugs.webkit.org/show_bug.cgi?id=198735 >+ <rdar://problem/51557159> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test to verify that spellcheck="false" disables smart quotes and dashes, but any other value defers to the >+ user's preferences by using UITextSmartQuotesTypeDefault and UITextSmartDashesTypeDefault. >+ >+ * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: >+ (TestWebKitAPI::TEST): >+ > 2019-06-10 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] fast/xsl tests are flaky when run after certain viewport shrink-to-fit tests >diff --git a/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm b/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >index 6cba2aa5e326e5caee8b1b350df4c8bfc52e7128..a7ab42097fd6b3e96976553284954a3ab909a01f 100644 >--- a/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >+++ b/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm >@@ -473,6 +473,38 @@ TEST(KeyboardInputTests, OverrideInputViewAndInputAccessoryView) > EXPECT_EQ(inputView.get(), [contentView inputView]); > } > >+TEST(KeyboardInputTests, DisableSmartQuotesAndDashes) >+{ >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); >+ auto inputDelegate = adoptNS([[TestInputDelegate alloc] init]); >+ [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy { >+ return _WKFocusStartsInputSessionPolicyAllow; >+ }]; >+ [webView _setInputDelegate:inputDelegate.get()]; >+ >+ auto checkSmartQuotesAndDashesType = [&] (UITextSmartDashesType dashesType, UITextSmartQuotesType quotesType) { >+ UITextInputTraits *traits = [[webView textInputContentView] textInputTraits]; >+ EXPECT_EQ(dashesType, traits.smartDashesType); >+ EXPECT_EQ(quotesType, traits.smartQuotesType); >+ }; >+ >+ [webView synchronouslyLoadHTMLString:@"<div id='foo' contenteditable spellcheck='false'></div><textarea id='bar' spellcheck='false'></textarea><input id='baz' spellcheck='false'>"]; >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"foo.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"bar.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"baz.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeNo, UITextSmartQuotesTypeNo); >+ >+ [webView synchronouslyLoadHTMLString:@"<div id='foo' contenteditable></div><textarea id='bar' spellcheck='true'></textarea><input id='baz'>"]; >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"foo.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"bar.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); >+ [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"baz.focus()"]; >+ checkSmartQuotesAndDashesType(UITextSmartDashesTypeDefault, UITextSmartQuotesTypeDefault); >+} >+ > } // namespace TestWebKitAPI > > #endif // PLATFORM(IOS_FAMILY)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198735
: 371799