<!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>[191508] 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/191508">191508</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-10-23 13:49:38 -0700 (Fri, 23 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.
* UIProcess/API/mac/WKView.mm:
(-[WKView _interpretKeyEvent:completionHandler:]):
(-[WKView inputContext]):
(-[WKView performKeyEquivalent:]):
(-[WKView keyDown:]):
(-[WKView _doneWithKeyEvent:eventWasHandled:]):
(-[WKView _setPluginComplexTextInputState:]): Deleted.
(-[WKView _disableComplexTextInputIfNecessary]): Deleted.
(-[WKView _handlePluginComplexTextInputKeyDown:]): Deleted.
(-[WKView _tryHandlePluginComplexTextInputKeyDown:]): Deleted.
(-[WKView _tryPostProcessPluginComplexTextInputKeyDown:]): Deleted.
(-[WKView _pluginFocusOrWindowFocusChanged:pluginComplexTextInputIdentifier:]): Deleted.
(-[WKView _setPluginComplexTextInputState:pluginComplexTextInputIdentifier:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::pluginComplexTextInputState):
(WebKit::WebViewImpl::pluginComplexTextInputIdentifier):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::setPluginComplexTextInputState):
(WebKit::WebViewImpl::setPluginComplexTextInputStateAndIdentifier):
(WebKit::WebViewImpl::disableComplexTextInputIfNecessary):
(WebKit::WebViewImpl::handlePluginComplexTextInputKeyDown):
(WebKit::WebViewImpl::tryHandlePluginComplexTextInputKeyDown):
(WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
(WebKit::WebViewImpl::tryPostProcessPluginComplexTextInputKeyDown):
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::pluginFocusOrWindowFocusChanged):
(WebKit::PageClientImpl::setPluginComplexTextInputState):
Move a few more methods.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</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="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/ChangeLog        2015-10-23 20:49:38 UTC (rev 191508)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2015-10-23 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.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _interpretKeyEvent:completionHandler:]):
+ (-[WKView inputContext]):
+ (-[WKView performKeyEquivalent:]):
+ (-[WKView keyDown:]):
+ (-[WKView _doneWithKeyEvent:eventWasHandled:]):
+ (-[WKView _setPluginComplexTextInputState:]): Deleted.
+ (-[WKView _disableComplexTextInputIfNecessary]): Deleted.
+ (-[WKView _handlePluginComplexTextInputKeyDown:]): Deleted.
+ (-[WKView _tryHandlePluginComplexTextInputKeyDown:]): Deleted.
+ (-[WKView _tryPostProcessPluginComplexTextInputKeyDown:]): Deleted.
+ (-[WKView _pluginFocusOrWindowFocusChanged:pluginComplexTextInputIdentifier:]): Deleted.
+ (-[WKView _setPluginComplexTextInputState:pluginComplexTextInputIdentifier:]): Deleted.
+ * UIProcess/API/mac/WKViewInternal.h:
+ * UIProcess/Cocoa/WebViewImpl.h:
+ (WebKit::WebViewImpl::pluginComplexTextInputState):
+ (WebKit::WebViewImpl::pluginComplexTextInputIdentifier):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::setPluginComplexTextInputState):
+ (WebKit::WebViewImpl::setPluginComplexTextInputStateAndIdentifier):
+ (WebKit::WebViewImpl::disableComplexTextInputIfNecessary):
+ (WebKit::WebViewImpl::handlePluginComplexTextInputKeyDown):
+ (WebKit::WebViewImpl::tryHandlePluginComplexTextInputKeyDown):
+ (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
+ (WebKit::WebViewImpl::tryPostProcessPluginComplexTextInputKeyDown):
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::pluginFocusOrWindowFocusChanged):
+ (WebKit::PageClientImpl::setPluginComplexTextInputState):
+ Move a few more methods.
+
</ins><span class="cx"> 2015-10-23 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> [MediaStream] Fix UserMediaPermissionRequestProxy::invalidate
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 20:49:38 UTC (rev 191508)
</span><span class="lines">@@ -201,15 +201,8 @@
</span><span class="cx"> WKViewInterpretKeyEventsParameters* _interpretKeyEventsParameters;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- // The identifier of the plug-in we want to send complex text input to, or 0 if there is none.
- uint64_t _pluginComplexTextInputIdentifier;
-
- // The state of complex text input for the plug-in.
- PluginComplexTextInputState _pluginComplexTextInputState;
-
</del><span class="cx"> BOOL _willBecomeFirstResponderAgain;
</span><span class="cx"> NSEvent *_mouseDownEvent;
</span><del>- NSEvent *_pressureEvent;
</del><span class="cx"> BOOL _ignoringMouseDraggedEvents;
</span><span class="cx">
</span><span class="cx"> BOOL _hasSpellCheckerDocumentTag;
</span><span class="lines">@@ -392,17 +385,6 @@
</span><span class="cx"> [super renewGState];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState
-{
- _data->_pluginComplexTextInputState = pluginComplexTextInputState;
-
- if (_data->_pluginComplexTextInputState != PluginComplexTextInputDisabled)
- return;
-
- // Send back an empty string to the plug-in. This will disable text input.
- _data->_page->sendComplexTextInputToPlugin(_data->_pluginComplexTextInputIdentifier, String());
-}
-
</del><span class="cx"> typedef HashMap<SEL, String> SelectorNameMap;
</span><span class="cx">
</span><span class="cx"> // Map selectors into Editor command names.
</span><span class="lines">@@ -1188,55 +1170,6 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_disableComplexTextInputIfNecessary
-{
- if (!_data->_pluginComplexTextInputIdentifier)
- return;
-
- if (_data->_pluginComplexTextInputState != PluginComplexTextInputEnabled)
- return;
-
- // Check if the text input window has been dismissed.
- if (![[WKTextInputWindowController sharedTextInputWindowController] hasMarkedText])
- [self _setPluginComplexTextInputState:PluginComplexTextInputDisabled];
-}
-
-- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event
-{
- ASSERT(_data->_pluginComplexTextInputIdentifier);
- ASSERT(_data->_pluginComplexTextInputState != PluginComplexTextInputDisabled);
-
- BOOL usingLegacyCocoaTextInput = _data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy;
-
- NSString *string = nil;
- BOOL didHandleEvent = [[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:&string];
-
- if (string) {
- _data->_page->sendComplexTextInputToPlugin(_data->_pluginComplexTextInputIdentifier, string);
-
- if (!usingLegacyCocoaTextInput)
- _data->_pluginComplexTextInputState = PluginComplexTextInputDisabled;
- }
-
- return didHandleEvent;
-}
-
-- (BOOL)_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event
-{
- if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
- return NO;
-
- // Check if the text input window has been dismissed and let the plug-in process know.
- // This is only valid with the updated Cocoa text input spec.
- [self _disableComplexTextInputIfNecessary];
-
- // Try feeding the keyboard event directly to the plug-in.
- if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy)
- return [self _handlePluginComplexTextInputKeyDown:event];
-
- return NO;
-}
-
</del><span class="cx"> static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnderline>& result)
</span><span class="cx"> {
</span><span class="cx"> int length = [[string string] length];
</span><span class="lines">@@ -1279,7 +1212,7 @@
</span><span class="cx"> {
</span><span class="cx"> // For regular Web content, input methods run before passing a keydown to DOM, but plug-ins get an opportunity to handle the event first.
</span><span class="cx"> // There is no need to collect commands, as the plug-in cannot execute them.
</span><del>- if (_data->_pluginComplexTextInputIdentifier) {
</del><ins>+ if (_data->_impl->pluginComplexTextInputIdentifier()) {
</ins><span class="cx"> completionHandler(NO, Vector<KeypressCommand>());
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -1523,7 +1456,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSTextInputContext *)inputContext
</span><span class="cx"> {
</span><del>- if (_data->_pluginComplexTextInputIdentifier) {
</del><ins>+ if (_data->_impl->pluginComplexTextInputIdentifier()) {
</ins><span class="cx"> ASSERT(!_data->_collectedKeypressCommands); // Should not get here from -_interpretKeyEvent:completionHandler:, we only use WKTextInputWindowController after giving the plug-in a chance to handle keydown natively.
</span><span class="cx"> return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
</span><span class="cx"> }
</span><span class="lines">@@ -1638,7 +1571,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(event == [NSApp currentEvent]);
</span><span class="cx">
</span><del>- [self _disableComplexTextInputIfNecessary];
</del><ins>+ _data->_impl->disableComplexTextInputIfNecessary();
</ins><span class="cx">
</span><span class="cx"> // Pass key combos through WebCore if there is a key binding available for
</span><span class="cx"> // this event. This lets webpages have a crack at intercepting key-modified keypresses.
</span><span class="lines">@@ -1673,7 +1606,7 @@
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "keyDown:%p %@%s", theEvent, theEvent, (theEvent == _data->_keyDownEventBeingResent) ? " (re-sent)" : "");
</span><span class="cx">
</span><del>- if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) {
</del><ins>+ if (_data->_impl->tryHandlePluginComplexTextInputKeyDown(theEvent)) {
</ins><span class="cx"> LOG(TextInput, "...handled by plug-in");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -1859,7 +1792,7 @@
</span><span class="cx"> {
</span><span class="cx"> WKViewInterpretKeyEventsParameters* parameters = _data->_interpretKeyEventsParameters;
</span><span class="cx">
</span><del>- if (_data->_pluginComplexTextInputIdentifier && !parameters)
</del><ins>+ if (_data->_impl->pluginComplexTextInputIdentifier() && !parameters)
</ins><span class="cx"> return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
</span><span class="cx">
</span><span class="cx"> // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
</span><span class="lines">@@ -2081,7 +2014,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(event == [NSApp currentEvent]);
</span><span class="cx">
</span><del>- [self _disableComplexTextInputIfNecessary];
</del><ins>+ _data->_impl->disableComplexTextInputIfNecessary();
</ins><span class="cx">
</span><span class="cx"> // Pass key combos through WebCore if there is a key binding available for
</span><span class="cx"> // this event. This lets webpages have a crack at intercepting key-modified keypresses.
</span><span class="lines">@@ -2118,7 +2051,7 @@
</span><span class="cx"> // the current event prevents that from causing a problem inside WebKit or AppKit code.
</span><span class="cx"> [[theEvent retain] autorelease];
</span><span class="cx">
</span><del>- if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) {
</del><ins>+ if (_data->_impl->tryHandlePluginComplexTextInputKeyDown(theEvent)) {
</ins><span class="cx"> LOG(TextInput, "...handled by plug-in");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -2541,24 +2474,12 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (BOOL)_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event
-{
- if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled)
- return NO;
-
- // In the legacy text input model, the event has already been sent to the input method.
- if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy)
- return NO;
-
- return [self _handlePluginComplexTextInputKeyDown:event];
-}
-
</del><span class="cx"> - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled
</span><span class="cx"> {
</span><span class="cx"> if ([event type] != NSKeyDown)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if ([self _tryPostProcessPluginComplexTextInputKeyDown:event])
</del><ins>+ if (_data->_impl->tryPostProcessPluginComplexTextInputKeyDown(event))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (eventWasHandled) {
</span><span class="lines">@@ -2840,44 +2761,6 @@
</span><span class="cx"> [self _updateRemoteAccessibilityRegistration:YES];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier
-{
- BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier;
-
- if (pluginHasFocusAndWindowHasFocus) {
- // Check if we're already allowing text input for this plug-in.
- if (pluginComplexTextInputIdentifier == _data->_pluginComplexTextInputIdentifier)
- return;
-
- _data->_pluginComplexTextInputIdentifier = pluginComplexTextInputIdentifier;
-
- } else {
- // Check if we got a request to unfocus a plug-in that isn't focused.
- if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier)
- return;
-
- _data->_pluginComplexTextInputIdentifier = 0;
- }
-
- if (inputSourceChanged) {
- // The input source changed; discard any entered text.
- [[WKTextInputWindowController sharedTextInputWindowController] unmarkText];
- }
-
- // This will force the current input context to be updated to its correct value.
- [NSApp updateWindows];
-}
-
-- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier
-{
- if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) {
- // We're asked to update the state for a plug-in that doesn't have focus.
- return;
- }
-
- [self _setPluginComplexTextInputState:pluginComplexTextInputState];
-}
-
</del><span class="cx"> - (void)_dragImageForView:(NSView *)view withImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag
</span><span class="cx"> {
</span><span class="cx"> // The call below could release this WKView.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 20:49:38 UTC (rev 191508)
</span><span class="lines">@@ -95,8 +95,6 @@
</span><span class="cx">
</span><span class="cx"> - (void)_setAccessibilityWebProcessToken:(NSData *)data;
</span><span class="cx">
</span><del>-- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
-- (void)_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
</del><span class="cx"> - (void)_dragImageForView:(NSView *)view withImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
</span><span class="cx"> - (void)_setPromisedDataForImage:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName;
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 20:49:38 UTC (rev 191508)
</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>+#include "PluginComplexTextInputState.h"
</ins><span class="cx"> #include "WKLayoutMode.h"
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="cx"> #include <WebCore/TextIndicatorWindow.h>
</span><span class="lines">@@ -159,6 +160,14 @@
</span><span class="cx"> void resetSecureInputState();
</span><span class="cx"> bool inSecureInputState() const { return m_inSecureInputState; }
</span><span class="cx"> void notifyInputContextAboutDiscardedComposition();
</span><ins>+ void setPluginComplexTextInputStateAndIdentifier(PluginComplexTextInputState, uint64_t identifier);
+ void disableComplexTextInputIfNecessary();
+ bool handlePluginComplexTextInputKeyDown(NSEvent *);
+ bool tryHandlePluginComplexTextInputKeyDown(NSEvent *);
+ void pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus, uint64_t pluginComplexTextInputIdentifier);
+ bool tryPostProcessPluginComplexTextInputKeyDown(NSEvent *);
+ PluginComplexTextInputState pluginComplexTextInputState() const { return m_pluginComplexTextInputState; }
+ uint64_t pluginComplexTextInputIdentifier() const { return m_pluginComplexTextInputIdentifier; }
</ins><span class="cx">
</span><span class="cx"> void pressureChangeWithEvent(NSEvent *);
</span><span class="cx"> NSEvent *lastPressureEvent() { return m_lastPressureEvent.get(); }
</span><span class="lines">@@ -218,6 +227,8 @@
</span><span class="cx">
</span><span class="cx"> void postFakeMouseMovedEventForFlagsChangedEvent(NSEvent *);
</span><span class="cx">
</span><ins>+ void setPluginComplexTextInputState(PluginComplexTextInputState);
+
</ins><span class="cx"> NSView <WebViewImplDelegate> *m_view;
</span><span class="cx"> WebPageProxy& m_page;
</span><span class="cx"> PageClient& m_pageClient;
</span><span class="lines">@@ -251,6 +262,12 @@
</span><span class="cx"> bool m_inSecureInputState { false };
</span><span class="cx"> RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
</span><span class="cx">
</span><ins>+ // The identifier of the plug-in we want to send complex text input to, or 0 if there is none.
+ uint64_t m_pluginComplexTextInputIdentifier;
+
+ // The state of complex text input for the plug-in.
+ PluginComplexTextInputState m_pluginComplexTextInputState;
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> RetainPtr<WKFullScreenWindowController> m_fullScreenWindowController;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 20:49:38 UTC (rev 191508)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import "PageClient.h"
</span><span class="cx"> #import "WKFullScreenWindowController.h"
</span><span class="cx"> #import "WKImmediateActionController.h"
</span><ins>+#import "WKTextInputWindowController.h"
</ins><span class="cx"> #import "WKViewLayoutStrategy.h"
</span><span class="cx"> #import "WKWebView.h"
</span><span class="cx"> #import "WebEditCommandProxy.h"
</span><span class="lines">@@ -1015,6 +1016,116 @@
</span><span class="cx"> [[m_view _superInputContext] discardMarkedText]; // Inform the input method that we won't have an inline input area despite having been asked to.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::setPluginComplexTextInputState(PluginComplexTextInputState pluginComplexTextInputState)
+{
+ m_pluginComplexTextInputState = pluginComplexTextInputState;
+
+ if (m_pluginComplexTextInputState != PluginComplexTextInputDisabled)
+ return;
+
+ // Send back an empty string to the plug-in. This will disable text input.
+ m_page.sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, String());
+}
+
+void WebViewImpl::setPluginComplexTextInputStateAndIdentifier(PluginComplexTextInputState pluginComplexTextInputState, uint64_t pluginComplexTextInputIdentifier)
+{
+ if (pluginComplexTextInputIdentifier != m_pluginComplexTextInputIdentifier) {
+ // We're asked to update the state for a plug-in that doesn't have focus.
+ return;
+ }
+
+ setPluginComplexTextInputState(pluginComplexTextInputState);
+}
+
+void WebViewImpl::disableComplexTextInputIfNecessary()
+{
+ if (!m_pluginComplexTextInputIdentifier)
+ return;
+
+ if (m_pluginComplexTextInputState != PluginComplexTextInputEnabled)
+ return;
+
+ // Check if the text input window has been dismissed.
+ if (![[WKTextInputWindowController sharedTextInputWindowController] hasMarkedText])
+ setPluginComplexTextInputState(PluginComplexTextInputDisabled);
+}
+
+bool WebViewImpl::handlePluginComplexTextInputKeyDown(NSEvent *event)
+{
+ ASSERT(m_pluginComplexTextInputIdentifier);
+ ASSERT(m_pluginComplexTextInputState != PluginComplexTextInputDisabled);
+
+ BOOL usingLegacyCocoaTextInput = m_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy;
+
+ NSString *string = nil;
+ BOOL didHandleEvent = [[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:&string];
+
+ if (string) {
+ m_page.sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, string);
+
+ if (!usingLegacyCocoaTextInput)
+ m_pluginComplexTextInputState = PluginComplexTextInputDisabled;
+ }
+
+ return didHandleEvent;
+}
+
+bool WebViewImpl::tryHandlePluginComplexTextInputKeyDown(NSEvent *event)
+{
+ if (!m_pluginComplexTextInputIdentifier || m_pluginComplexTextInputState == PluginComplexTextInputDisabled)
+ return NO;
+
+ // Check if the text input window has been dismissed and let the plug-in process know.
+ // This is only valid with the updated Cocoa text input spec.
+ disableComplexTextInputIfNecessary();
+
+ // Try feeding the keyboard event directly to the plug-in.
+ if (m_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy)
+ return handlePluginComplexTextInputKeyDown(event);
+
+ return NO;
+}
+
+void WebViewImpl::pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus, uint64_t pluginComplexTextInputIdentifier)
+{
+ BOOL inputSourceChanged = m_pluginComplexTextInputIdentifier;
+
+ if (pluginHasFocusAndWindowHasFocus) {
+ // Check if we're already allowing text input for this plug-in.
+ if (pluginComplexTextInputIdentifier == m_pluginComplexTextInputIdentifier)
+ return;
+
+ m_pluginComplexTextInputIdentifier = pluginComplexTextInputIdentifier;
+
+ } else {
+ // Check if we got a request to unfocus a plug-in that isn't focused.
+ if (pluginComplexTextInputIdentifier != m_pluginComplexTextInputIdentifier)
+ return;
+
+ m_pluginComplexTextInputIdentifier = 0;
+ }
+
+ if (inputSourceChanged) {
+ // The input source changed; discard any entered text.
+ [[WKTextInputWindowController sharedTextInputWindowController] unmarkText];
+ }
+
+ // This will force the current input context to be updated to its correct value.
+ [NSApp updateWindows];
+}
+
+bool WebViewImpl::tryPostProcessPluginComplexTextInputKeyDown(NSEvent *event)
+{
+ if (!m_pluginComplexTextInputIdentifier || m_pluginComplexTextInputState == PluginComplexTextInputDisabled)
+ return NO;
+
+ // In the legacy text input model, the event has already been sent to the input method.
+ if (m_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy)
+ return NO;
+
+ return handlePluginComplexTextInputKeyDown(event);
+}
+
</ins><span class="cx"> void WebViewImpl::pressureChangeWithEvent(NSEvent *event)
</span><span class="cx"> {
</span><span class="cx"> #if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (191507 => 191508)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 20:21:54 UTC (rev 191507)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 20:49:38 UTC (rev 191508)
</span><span class="lines">@@ -536,12 +536,12 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus)
</span><span class="cx"> {
</span><del>- [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
</del><ins>+ m_impl->pluginFocusOrWindowFocusChanged(pluginHasFocusAndWindowHasFocus, pluginComplexTextInputIdentifier);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState)
</span><span class="cx"> {
</span><del>- [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
</del><ins>+ m_impl->setPluginComplexTextInputStateAndIdentifier(pluginComplexTextInputState, pluginComplexTextInputIdentifier);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo)
</span></span></pre>
</div>
</div>
</body>
</html>