<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191761] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191761">191761</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-10-29 16:13:10 -0700 (Thu, 29 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>WKView being inside WKWebView leads to weird API issues
https://bugs.webkit.org/show_bug.cgi?id=150174
Reviewed by Anders Carlsson.
* Platform/spi/mac/AppKitSPI.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView validRequestorForSendType:returnType:]):
(-[WKView readSelectionFromPasteboard:]):
(-[WKView changeFont:]):
(-[WKView startSpeaking:]):
(-[WKView stopSpeaking:]):
(-[WKView showGuessPanel:]):
(-[WKView checkSpelling:]):
(-[WKView changeSpelling:]):
(-[WKView toggleContinuousSpellChecking:]):
(-[WKView isGrammarCheckingEnabled]):
(-[WKView setGrammarCheckingEnabled:]):
(-[WKView toggleGrammarChecking:]):
(-[WKView toggleAutomaticSpellingCorrection:]):
(-[WKView orderFrontSubstitutionsPanel:]):
(-[WKView toggleSmartInsertDelete:]):
(-[WKView isAutomaticQuoteSubstitutionEnabled]):
(-[WKView setAutomaticQuoteSubstitutionEnabled:]):
(-[WKView toggleAutomaticQuoteSubstitution:]):
(-[WKView isAutomaticDashSubstitutionEnabled]):
(-[WKView setAutomaticDashSubstitutionEnabled:]):
(-[WKView toggleAutomaticDashSubstitution:]):
(-[WKView isAutomaticLinkDetectionEnabled]):
(-[WKView setAutomaticLinkDetectionEnabled:]):
(-[WKView toggleAutomaticLinkDetection:]):
(-[WKView isAutomaticTextReplacementEnabled]):
(-[WKView setAutomaticTextReplacementEnabled:]):
(-[WKView toggleAutomaticTextReplacement:]):
(-[WKView uppercaseWord:]):
(-[WKView lowercaseWord:]):
(-[WKView capitalizeWord:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::readSelectionFromPasteboard):
(WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
(WebKit::WebViewImpl::changeFontFromFontPanel):
(WebKit::WebViewImpl::startSpeaking):
(WebKit::WebViewImpl::stopSpeaking):
(WebKit::WebViewImpl::showGuessPanel):
(WebKit::WebViewImpl::checkSpelling):
(WebKit::WebViewImpl::changeSpelling):
(WebKit::WebViewImpl::toggleContinuousSpellChecking):
(WebKit::WebViewImpl::isGrammarCheckingEnabled):
(WebKit::WebViewImpl::setGrammarCheckingEnabled):
(WebKit::WebViewImpl::toggleGrammarChecking):
(WebKit::WebViewImpl::toggleAutomaticSpellingCorrection):
(WebKit::WebViewImpl::orderFrontSubstitutionsPanel):
(WebKit::WebViewImpl::toggleSmartInsertDelete):
(WebKit::WebViewImpl::isAutomaticQuoteSubstitutionEnabled):
(WebKit::WebViewImpl::setAutomaticQuoteSubstitutionEnabled):
(WebKit::WebViewImpl::toggleAutomaticQuoteSubstitution):
(WebKit::WebViewImpl::isAutomaticDashSubstitutionEnabled):
(WebKit::WebViewImpl::setAutomaticDashSubstitutionEnabled):
(WebKit::WebViewImpl::toggleAutomaticDashSubstitution):
(WebKit::WebViewImpl::isAutomaticLinkDetectionEnabled):
(WebKit::WebViewImpl::setAutomaticLinkDetectionEnabled):
(WebKit::WebViewImpl::toggleAutomaticLinkDetection):
(WebKit::WebViewImpl::setAutomaticTextReplacementEnabled):
(WebKit::WebViewImpl::toggleAutomaticTextReplacement):
(WebKit::WebViewImpl::uppercaseWord):
(WebKit::WebViewImpl::lowercaseWord):
(WebKit::WebViewImpl::capitalizeWord):
Move spellcheck and related bits.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformspimacAppKitSPIh">trunk/Source/WebKit2/Platform/spi/mac/AppKitSPI.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplmm">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/ChangeLog        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -1,3 +1,75 @@
</span><ins>+2015-10-29 Tim Horton <timothy_horton@apple.com>
+
+ WKView being inside WKWebView leads to weird API issues
+ https://bugs.webkit.org/show_bug.cgi?id=150174
+
+ Reviewed by Anders Carlsson.
+
+ * Platform/spi/mac/AppKitSPI.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView validRequestorForSendType:returnType:]):
+ (-[WKView readSelectionFromPasteboard:]):
+ (-[WKView changeFont:]):
+ (-[WKView startSpeaking:]):
+ (-[WKView stopSpeaking:]):
+ (-[WKView showGuessPanel:]):
+ (-[WKView checkSpelling:]):
+ (-[WKView changeSpelling:]):
+ (-[WKView toggleContinuousSpellChecking:]):
+ (-[WKView isGrammarCheckingEnabled]):
+ (-[WKView setGrammarCheckingEnabled:]):
+ (-[WKView toggleGrammarChecking:]):
+ (-[WKView toggleAutomaticSpellingCorrection:]):
+ (-[WKView orderFrontSubstitutionsPanel:]):
+ (-[WKView toggleSmartInsertDelete:]):
+ (-[WKView isAutomaticQuoteSubstitutionEnabled]):
+ (-[WKView setAutomaticQuoteSubstitutionEnabled:]):
+ (-[WKView toggleAutomaticQuoteSubstitution:]):
+ (-[WKView isAutomaticDashSubstitutionEnabled]):
+ (-[WKView setAutomaticDashSubstitutionEnabled:]):
+ (-[WKView toggleAutomaticDashSubstitution:]):
+ (-[WKView isAutomaticLinkDetectionEnabled]):
+ (-[WKView setAutomaticLinkDetectionEnabled:]):
+ (-[WKView toggleAutomaticLinkDetection:]):
+ (-[WKView isAutomaticTextReplacementEnabled]):
+ (-[WKView setAutomaticTextReplacementEnabled:]):
+ (-[WKView toggleAutomaticTextReplacement:]):
+ (-[WKView uppercaseWord:]):
+ (-[WKView lowercaseWord:]):
+ (-[WKView capitalizeWord:]):
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::readSelectionFromPasteboard):
+ (WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
+ (WebKit::WebViewImpl::changeFontFromFontPanel):
+ (WebKit::WebViewImpl::startSpeaking):
+ (WebKit::WebViewImpl::stopSpeaking):
+ (WebKit::WebViewImpl::showGuessPanel):
+ (WebKit::WebViewImpl::checkSpelling):
+ (WebKit::WebViewImpl::changeSpelling):
+ (WebKit::WebViewImpl::toggleContinuousSpellChecking):
+ (WebKit::WebViewImpl::isGrammarCheckingEnabled):
+ (WebKit::WebViewImpl::setGrammarCheckingEnabled):
+ (WebKit::WebViewImpl::toggleGrammarChecking):
+ (WebKit::WebViewImpl::toggleAutomaticSpellingCorrection):
+ (WebKit::WebViewImpl::orderFrontSubstitutionsPanel):
+ (WebKit::WebViewImpl::toggleSmartInsertDelete):
+ (WebKit::WebViewImpl::isAutomaticQuoteSubstitutionEnabled):
+ (WebKit::WebViewImpl::setAutomaticQuoteSubstitutionEnabled):
+ (WebKit::WebViewImpl::toggleAutomaticQuoteSubstitution):
+ (WebKit::WebViewImpl::isAutomaticDashSubstitutionEnabled):
+ (WebKit::WebViewImpl::setAutomaticDashSubstitutionEnabled):
+ (WebKit::WebViewImpl::toggleAutomaticDashSubstitution):
+ (WebKit::WebViewImpl::isAutomaticLinkDetectionEnabled):
+ (WebKit::WebViewImpl::setAutomaticLinkDetectionEnabled):
+ (WebKit::WebViewImpl::toggleAutomaticLinkDetection):
+ (WebKit::WebViewImpl::setAutomaticTextReplacementEnabled):
+ (WebKit::WebViewImpl::toggleAutomaticTextReplacement):
+ (WebKit::WebViewImpl::uppercaseWord):
+ (WebKit::WebViewImpl::lowercaseWord):
+ (WebKit::WebViewImpl::capitalizeWord):
+ Move spellcheck and related bits.
+
</ins><span class="cx"> 2015-10-29 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> Revert inadvertent changes
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformspimacAppKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/spi/mac/AppKitSPI.h (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/spi/mac/AppKitSPI.h        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/Platform/spi/mac/AppKitSPI.h        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -36,3 +36,10 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // USE(APPLE_INTERNAL_SDK)
</span><ins>+
+@interface NSApplication ()
+
+- (void)speakString:(NSString *)string;
+- (void)_setCurrentEvent:(NSEvent *)event;
+
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx">
</span><span class="cx"> #import "APILegacyContextHistoryClient.h"
</span><span class="cx"> #import "APIPageConfiguration.h"
</span><ins>+#import "AppKitSPI.h"
</ins><span class="cx"> #import "AttributedString.h"
</span><span class="cx"> #import "DataReference.h"
</span><span class="cx"> #import "EditingRange.h"
</span><span class="lines">@@ -109,11 +110,6 @@
</span><span class="cx"> #import "WKBrowsingContextGroupPrivate.h"
</span><span class="cx"> #import "WKProcessGroupPrivate.h"
</span><span class="cx">
</span><del>-@interface NSApplication (WKNSApplicationDetails)
-- (void)speakString:(NSString *)string;
-- (void)_setCurrentEvent:(NSEvent *)event;
-@end
-
</del><span class="cx"> #if USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="cx"> @interface NSTextInputContext (WKNSTextInputContextDetails)
</span><span class="cx"> - (void)handleEvent:(NSEvent *)theEvent completionHandler:(void(^)(BOOL handled))completionHandler;
</span><span class="lines">@@ -381,8 +377,6 @@
</span><span class="cx">
</span><span class="cx"> #undef WEBCORE_COMMAND
</span><span class="cx">
</span><del>-// This method is needed to support Mac OS X services.
-
</del><span class="cx"> - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
</span><span class="cx"> {
</span><span class="cx"> return _data->_impl->writeSelectionToPasteboard(pasteboard, types);
</span><span class="lines">@@ -393,48 +387,19 @@
</span><span class="cx"> _data->_impl->centerSelectionInVisibleArea();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// This method is needed to support Mac OS X services.
-
</del><span class="cx"> - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
</span><span class="cx"> {
</span><del>- EditorState editorState = _data->_page->editorState();
- BOOL isValidSendType = NO;
-
- if (sendType && !editorState.selectionIsNone) {
- if (editorState.isInPlugin)
- isValidSendType = [sendType isEqualToString:NSStringPboardType];
- else
- isValidSendType = [PasteboardTypes::forSelection() containsObject:sendType];
- }
-
- BOOL isValidReturnType = NO;
- if (!returnType)
- isValidReturnType = YES;
- else if ([PasteboardTypes::forEditing() containsObject:returnType] && editorState.isContentEditable) {
- // We can insert strings in any editable context. We can insert other types, like images, only in rich edit contexts.
- isValidReturnType = editorState.isContentRichlyEditable || [returnType isEqualToString:NSStringPboardType];
- }
- if (isValidSendType && isValidReturnType)
- return self;
- return [[self nextResponder] validRequestorForSendType:sendType returnType:returnType];
</del><ins>+ return _data->_impl->validRequestorForSendAndReturnTypes(sendType, returnType);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// This method is needed to support Mac OS X services.
-
</del><span class="cx"> - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><del>- return _data->_page->readSelectionFromPasteboard([pasteboard name]);
</del><ins>+ return _data->_impl->readSelectionFromPasteboard(pasteboard);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Font panel support.
-
</del><span class="cx"> - (void)changeFont:(id)sender
</span><span class="cx"> {
</span><del>- NSFontManager *fontManager = [NSFontManager sharedFontManager];
- NSFont *font = [fontManager convertFont:[fontManager selectedFont]];
- if (!font)
- return;
- _data->_page->setFont([font familyName], [font pointSize], [[font fontDescriptor] symbolicTraits]);
</del><ins>+ _data->_impl->changeFontFromFontPanel();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /*
</span><span class="lines">@@ -475,202 +440,137 @@
</span><span class="cx">
</span><span class="cx"> - (IBAction)startSpeaking:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->getSelectionOrContentsAsString([self](const String& string, WebKit::CallbackBase::Error error) {
- if (error != WebKit::CallbackBase::Error::None)
- return;
- if (!string)
- return;
-
- [NSApp speakString:string];
- });
</del><ins>+ _data->_impl->startSpeaking();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)stopSpeaking:(id)sender
</span><span class="cx"> {
</span><del>- [NSApp stopSpeaking:sender];
</del><ins>+ _data->_impl->stopSpeaking(sender);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)showGuessPanel:(id)sender
</span><span class="cx"> {
</span><del>- NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
- if (!checker) {
- LOG_ERROR("No NSSpellChecker");
- return;
- }
-
- NSPanel *spellingPanel = [checker spellingPanel];
- if ([spellingPanel isVisible]) {
- [spellingPanel orderOut:sender];
- return;
- }
-
- _data->_page->advanceToNextMisspelling(true);
- [spellingPanel orderFront:sender];
</del><ins>+ _data->_impl->showGuessPanel(sender);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)checkSpelling:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->advanceToNextMisspelling(false);
</del><ins>+ _data->_impl->checkSpelling();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)changeSpelling:(id)sender
</span><span class="cx"> {
</span><del>- NSString *word = [[sender selectedCell] stringValue];
-
- _data->_page->changeSpellingToWord(word);
</del><ins>+ _data->_impl->changeSpelling(sender);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)toggleContinuousSpellChecking:(id)sender
</span><span class="cx"> {
</span><del>- bool spellCheckingEnabled = !TextChecker::state().isContinuousSpellCheckingEnabled;
- TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled);
-
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleContinuousSpellChecking();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isGrammarCheckingEnabled
</span><span class="cx"> {
</span><del>- return TextChecker::state().isGrammarCheckingEnabled;
</del><ins>+ return _data->_impl->isGrammarCheckingEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setGrammarCheckingEnabled:(BOOL)flag
</span><span class="cx"> {
</span><del>- if (static_cast<bool>(flag) == TextChecker::state().isGrammarCheckingEnabled)
- return;
-
- TextChecker::setGrammarCheckingEnabled(flag);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->setGrammarCheckingEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)toggleGrammarChecking:(id)sender
</span><span class="cx"> {
</span><del>- bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled;
- TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled);
-
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleGrammarChecking();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)toggleAutomaticSpellingCorrection:(id)sender
</span><span class="cx"> {
</span><del>- TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
-
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleAutomaticSpellingCorrection();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)orderFrontSubstitutionsPanel:(id)sender
</span><span class="cx"> {
</span><del>- NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
- if (!checker) {
- LOG_ERROR("No NSSpellChecker");
- return;
- }
-
- NSPanel *substitutionsPanel = [checker substitutionsPanel];
- if ([substitutionsPanel isVisible]) {
- [substitutionsPanel orderOut:sender];
- return;
- }
- [substitutionsPanel orderFront:sender];
</del><ins>+ _data->_impl->orderFrontSubstitutionsPanel(sender);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)toggleSmartInsertDelete:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->setSmartInsertDeleteEnabled(!_data->_page->isSmartInsertDeleteEnabled());
</del><ins>+ _data->_impl->toggleSmartInsertDelete();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticQuoteSubstitutionEnabled
</span><span class="cx"> {
</span><del>- return TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
</del><ins>+ return _data->_impl->isAutomaticQuoteSubstitutionEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag
</span><span class="cx"> {
</span><del>- if (static_cast<bool>(flag) == TextChecker::state().isAutomaticQuoteSubstitutionEnabled)
- return;
-
- TextChecker::setAutomaticQuoteSubstitutionEnabled(flag);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->setAutomaticQuoteSubstitutionEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)toggleAutomaticQuoteSubstitution:(id)sender
</span><span class="cx"> {
</span><del>- TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleAutomaticQuoteSubstitution();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticDashSubstitutionEnabled
</span><span class="cx"> {
</span><del>- return TextChecker::state().isAutomaticDashSubstitutionEnabled;
</del><ins>+ return _data->_impl->isAutomaticDashSubstitutionEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAutomaticDashSubstitutionEnabled:(BOOL)flag
</span><span class="cx"> {
</span><del>- if (static_cast<bool>(flag) == TextChecker::state().isAutomaticDashSubstitutionEnabled)
- return;
-
- TextChecker::setAutomaticDashSubstitutionEnabled(flag);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->setAutomaticDashSubstitutionEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)toggleAutomaticDashSubstitution:(id)sender
</span><span class="cx"> {
</span><del>- TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleAutomaticDashSubstitution();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticLinkDetectionEnabled
</span><span class="cx"> {
</span><del>- return TextChecker::state().isAutomaticLinkDetectionEnabled;
</del><ins>+ return _data->_impl->isAutomaticLinkDetectionEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAutomaticLinkDetectionEnabled:(BOOL)flag
</span><span class="cx"> {
</span><del>- if (static_cast<bool>(flag) == TextChecker::state().isAutomaticLinkDetectionEnabled)
- return;
-
- TextChecker::setAutomaticLinkDetectionEnabled(flag);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->setAutomaticLinkDetectionEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)toggleAutomaticLinkDetection:(id)sender
</span><span class="cx"> {
</span><del>- TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleAutomaticLinkDetection();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isAutomaticTextReplacementEnabled
</span><span class="cx"> {
</span><del>- return TextChecker::state().isAutomaticTextReplacementEnabled;
</del><ins>+ return _data->_impl->isAutomaticTextReplacementEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAutomaticTextReplacementEnabled:(BOOL)flag
</span><span class="cx"> {
</span><del>- if (static_cast<bool>(flag) == TextChecker::state().isAutomaticTextReplacementEnabled)
- return;
-
- TextChecker::setAutomaticTextReplacementEnabled(flag);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->setAutomaticTextReplacementEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)toggleAutomaticTextReplacement:(id)sender
</span><span class="cx"> {
</span><del>- TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
- _data->_page->process().updateTextCheckerState();
</del><ins>+ _data->_impl->toggleAutomaticTextReplacement();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)uppercaseWord:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->uppercaseWord();
</del><ins>+ _data->_impl->uppercaseWord();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)lowercaseWord:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->lowercaseWord();
</del><ins>+ _data->_impl->lowercaseWord();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)capitalizeWord:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->capitalizeWord();
</del><ins>+ _data->_impl->capitalizeWord();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Events
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -230,12 +230,45 @@
</span><span class="cx"> void registerEditCommand(RefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
</span><span class="cx"> void clearAllEditCommands();
</span><span class="cx"> bool writeSelectionToPasteboard(NSPasteboard *, NSArray *types);
</span><ins>+ bool readSelectionFromPasteboard(NSPasteboard *);
+ id validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType);
</ins><span class="cx"> void centerSelectionInVisibleArea();
</span><span class="cx"> void selectionDidChange();
</span><span class="cx"> void startObservingFontPanel();
</span><span class="cx"> void updateFontPanelIfNeeded();
</span><ins>+ void changeFontFromFontPanel();
</ins><span class="cx"> bool validateUserInterfaceItem(id <NSValidatedUserInterfaceItem>);
</span><span class="cx">
</span><ins>+ void startSpeaking();
+ void stopSpeaking(id);
+
+ void showGuessPanel(id);
+ void checkSpelling();
+ void changeSpelling(id);
+ void toggleContinuousSpellChecking();
+
+ bool isGrammarCheckingEnabled();
+ void setGrammarCheckingEnabled(bool);
+ void toggleGrammarChecking();
+ void toggleAutomaticSpellingCorrection();
+ void orderFrontSubstitutionsPanel(id);
+ void toggleSmartInsertDelete();
+ bool isAutomaticQuoteSubstitutionEnabled();
+ void setAutomaticQuoteSubstitutionEnabled(bool);
+ void toggleAutomaticQuoteSubstitution();
+ bool isAutomaticDashSubstitutionEnabled();
+ void setAutomaticDashSubstitutionEnabled(bool);
+ void toggleAutomaticDashSubstitution();
+ bool isAutomaticLinkDetectionEnabled();
+ void setAutomaticLinkDetectionEnabled(bool);
+ void toggleAutomaticLinkDetection();
+ bool isAutomaticTextReplacementEnabled();
+ void setAutomaticTextReplacementEnabled(bool);
+ void toggleAutomaticTextReplacement();
+ void uppercaseWord();
+ void lowercaseWord();
+ void capitalizeWord();
+
</ins><span class="cx"> void preferencesDidChange();
</span><span class="cx">
</span><span class="cx"> void setTextIndicator(WebCore::TextIndicator&, WebCore::TextIndicatorWindowLifetime = WebCore::TextIndicatorWindowLifetime::Permanent);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">
</span><ins>+#import "AppKitSPI.h"
</ins><span class="cx"> #import "ColorSpaceData.h"
</span><span class="cx"> #import "GenericCallback.h"
</span><span class="cx"> #import "Logging.h"
</span><span class="lines">@@ -1583,6 +1584,35 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebViewImpl::readSelectionFromPasteboard(NSPasteboard *pasteboard)
+{
+ return m_page.readSelectionFromPasteboard([pasteboard name]);
+}
+
+id WebViewImpl::validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType)
+{
+ EditorState editorState = m_page.editorState();
+ bool isValidSendType = false;
+
+ if (sendType && !editorState.selectionIsNone) {
+ if (editorState.isInPlugin)
+ isValidSendType = [sendType isEqualToString:NSStringPboardType];
+ else
+ isValidSendType = [PasteboardTypes::forSelection() containsObject:sendType];
+ }
+
+ bool isValidReturnType = false;
+ if (!returnType)
+ isValidReturnType = true;
+ else if ([PasteboardTypes::forEditing() containsObject:returnType] && editorState.isContentEditable) {
+ // We can insert strings in any editable context. We can insert other types, like images, only in rich edit contexts.
+ isValidReturnType = editorState.isContentRichlyEditable || [returnType isEqualToString:NSStringPboardType];
+ }
+ if (isValidSendType && isValidReturnType)
+ return m_view;
+ return [[m_view nextResponder] validRequestorForSendType:sendType returnType:returnType];
+}
+
</ins><span class="cx"> void WebViewImpl::centerSelectionInVisibleArea()
</span><span class="cx"> {
</span><span class="cx"> m_page.centerSelectionInVisibleArea();
</span><span class="lines">@@ -1612,6 +1642,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::changeFontFromFontPanel()
+{
+ NSFontManager *fontManager = [NSFontManager sharedFontManager];
+ NSFont *font = [fontManager convertFont:fontManager.selectedFont];
+ if (!font)
+ return;
+ m_page.setFont(font.familyName, font.pointSize, font.fontDescriptor.symbolicTraits);
+}
+
</ins><span class="cx"> static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item)
</span><span class="cx"> {
</span><span class="cx"> if (![(NSObject *)item isKindOfClass:[NSMenuItem class]])
</span><span class="lines">@@ -1747,6 +1786,206 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::startSpeaking()
+{
+ m_page.getSelectionOrContentsAsString([](const String& string, WebKit::CallbackBase::Error error) {
+ if (error != WebKit::CallbackBase::Error::None)
+ return;
+ if (!string)
+ return;
+
+ [NSApp speakString:string];
+ });
+}
+
+void WebViewImpl::stopSpeaking(id sender)
+{
+ [NSApp stopSpeaking:sender];
+}
+
+void WebViewImpl::showGuessPanel(id sender)
+{
+ NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
+ if (!checker) {
+ LOG_ERROR("No NSSpellChecker");
+ return;
+ }
+
+ NSPanel *spellingPanel = [checker spellingPanel];
+ if ([spellingPanel isVisible]) {
+ [spellingPanel orderOut:sender];
+ return;
+ }
+
+ m_page.advanceToNextMisspelling(true);
+ [spellingPanel orderFront:sender];
+}
+
+void WebViewImpl::checkSpelling()
+{
+ m_page.advanceToNextMisspelling(false);
+}
+
+void WebViewImpl::changeSpelling(id sender)
+{
+ NSString *word = [[sender selectedCell] stringValue];
+
+ m_page.changeSpellingToWord(word);
+}
+
+void WebViewImpl::toggleContinuousSpellChecking()
+{
+ bool spellCheckingEnabled = !TextChecker::state().isContinuousSpellCheckingEnabled;
+ TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled);
+
+ m_page.process().updateTextCheckerState();
+}
+
+bool WebViewImpl::isGrammarCheckingEnabled()
+{
+ return TextChecker::state().isGrammarCheckingEnabled;
+}
+
+void WebViewImpl::setGrammarCheckingEnabled(bool flag)
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isGrammarCheckingEnabled)
+ return;
+
+ TextChecker::setGrammarCheckingEnabled(flag);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleGrammarChecking()
+{
+ bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled;
+ TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled);
+
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleAutomaticSpellingCorrection()
+{
+ TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
+
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::orderFrontSubstitutionsPanel(id sender)
+{
+ NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
+ if (!checker) {
+ LOG_ERROR("No NSSpellChecker");
+ return;
+ }
+
+ NSPanel *substitutionsPanel = [checker substitutionsPanel];
+ if ([substitutionsPanel isVisible]) {
+ [substitutionsPanel orderOut:sender];
+ return;
+ }
+ [substitutionsPanel orderFront:sender];
+}
+
+void WebViewImpl::toggleSmartInsertDelete()
+{
+ m_page.setSmartInsertDeleteEnabled(!m_page.isSmartInsertDeleteEnabled());
+}
+
+bool WebViewImpl::isAutomaticQuoteSubstitutionEnabled()
+{
+ return TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
+}
+
+void WebViewImpl::setAutomaticQuoteSubstitutionEnabled(bool flag)
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isAutomaticQuoteSubstitutionEnabled)
+ return;
+
+ TextChecker::setAutomaticQuoteSubstitutionEnabled(flag);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleAutomaticQuoteSubstitution()
+{
+ TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
+ m_page.process().updateTextCheckerState();
+}
+
+bool WebViewImpl::isAutomaticDashSubstitutionEnabled()
+{
+ return TextChecker::state().isAutomaticDashSubstitutionEnabled;
+}
+
+void WebViewImpl::setAutomaticDashSubstitutionEnabled(bool flag)
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isAutomaticDashSubstitutionEnabled)
+ return;
+
+ TextChecker::setAutomaticDashSubstitutionEnabled(flag);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleAutomaticDashSubstitution()
+{
+ TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
+ m_page.process().updateTextCheckerState();
+}
+
+bool WebViewImpl::isAutomaticLinkDetectionEnabled()
+{
+ return TextChecker::state().isAutomaticLinkDetectionEnabled;
+}
+
+void WebViewImpl::setAutomaticLinkDetectionEnabled(bool flag)
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isAutomaticLinkDetectionEnabled)
+ return;
+
+ TextChecker::setAutomaticLinkDetectionEnabled(flag);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleAutomaticLinkDetection()
+{
+ TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
+ m_page.process().updateTextCheckerState();
+}
+
+bool WebViewImpl::isAutomaticTextReplacementEnabled()
+{
+ return TextChecker::state().isAutomaticTextReplacementEnabled;
+}
+
+void WebViewImpl::setAutomaticTextReplacementEnabled(bool flag)
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isAutomaticTextReplacementEnabled)
+ return;
+
+ TextChecker::setAutomaticTextReplacementEnabled(flag);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::toggleAutomaticTextReplacement()
+{
+ TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
+ m_page.process().updateTextCheckerState();
+}
+
+void WebViewImpl::uppercaseWord()
+{
+ m_page.uppercaseWord();
+}
+
+void WebViewImpl::lowercaseWord()
+{
+ m_page.lowercaseWord();
+}
+
+void WebViewImpl::capitalizeWord()
+{
+ m_page.capitalizeWord();
+}
+
</ins><span class="cx"> void WebViewImpl::preferencesDidChange()
</span><span class="cx"> {
</span><span class="cx"> BOOL needsViewFrameInWindowCoordinates = m_page.preferences().pluginsEnabled();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (191760 => 191761)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2015-10-29 22:35:37 UTC (rev 191760)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2015-10-29 23:13:10 UTC (rev 191761)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">
</span><span class="cx"> #import "APIUIClient.h"
</span><ins>+#import "AppKitSPI.h"
</ins><span class="cx"> #import "AttributedString.h"
</span><span class="cx"> #import "ColorSpaceData.h"
</span><span class="cx"> #import "DataReference.h"
</span><span class="lines">@@ -57,10 +58,6 @@
</span><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx"> #import <wtf/text/StringConcatenate.h>
</span><span class="cx">
</span><del>-@interface NSApplication ()
-- (void)speakString:(NSString *)string;
-@end
-
</del><span class="cx"> #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process().connection())
</span><span class="cx"> #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>