Title: [150132] trunk/Source/WebKit2
Revision
150132
Author
[email protected]
Date
2013-05-15 11:50:16 -0700 (Wed, 15 May 2013)

Log Message

        [WK2][Mac] Split resetTextInputState into two functions
        https://bugs.webkit.org/show_bug.cgi?id=116174

        Reviewed by Anders Carlsson.

        Splitting resetTextInputState into resetSecureInputState and
        notifyInputContextAboutDiscardedComposition, paving the way for a fix where these
        won't be happening simultaneously.

        * UIProcess/API/mac/PageClientImpl.h:
        * UIProcess/API/mac/PageClientImpl.mm:
        (WebKit::PageClientImpl::resetSecureInputState):
        (WebKit::PageClientImpl::notifyInputContextAboutDiscardedComposition):
        * UIProcess/API/mac/WKView.mm:
        (-[WKView resignFirstResponder]):
        (-[WKView _resetSecureInputState]):
        (-[WKView _notifyInputContextAboutDiscardedComposition]):
        * UIProcess/API/mac/WKViewInternal.h:
        * UIProcess/PageClient.h:
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::didCommitLoadForFrame):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (150131 => 150132)


--- trunk/Source/WebKit2/ChangeLog	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-15 18:50:16 UTC (rev 150132)
@@ -1,3 +1,27 @@
+2013-05-15  Alexey Proskuryakov  <[email protected]>
+
+        [WK2][Mac] Split resetTextInputState into two functions
+        https://bugs.webkit.org/show_bug.cgi?id=116174
+
+        Reviewed by Anders Carlsson.
+
+        Splitting resetTextInputState into resetSecureInputState and
+        notifyInputContextAboutDiscardedComposition, paving the way for a fix where these
+        won't be happening simultaneously.
+
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::resetSecureInputState):
+        (WebKit::PageClientImpl::notifyInputContextAboutDiscardedComposition):
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView resignFirstResponder]):
+        (-[WKView _resetSecureInputState]):
+        (-[WKView _notifyInputContextAboutDiscardedComposition]):
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+
 2013-05-15  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Add padding to all public class structs for future expansion without breaking ABI

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-05-15 18:50:16 UTC (rev 150132)
@@ -40,7 +40,7 @@
 namespace WebKit {
 class FindIndicatorWindow;
 
-class PageClientImpl : public PageClient {
+class PageClientImpl FINAL : public PageClient {
 public:
     static PassOwnPtr<PageClientImpl> create(WKView*);
     virtual ~PageClientImpl();
@@ -83,7 +83,8 @@
     virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
                                  const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer);
     virtual void updateTextInputState(bool updateSecureInputState);
-    virtual void resetTextInputState();
+    virtual void resetSecureInputState() OVERRIDE;
+    virtual void notifyInputContextAboutDiscardedComposition() OVERRIDE;
 
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-05-15 18:50:16 UTC (rev 150132)
@@ -333,11 +333,16 @@
     [m_wkView _updateTextInputStateIncludingSecureInputState:updateSecureInputState];
 }
 
-void PageClientImpl::resetTextInputState()
+void PageClientImpl::resetSecureInputState()
 {
-    [m_wkView _resetTextInputState];
+    [m_wkView _resetSecureInputState];
 }
 
+void PageClientImpl::notifyInputContextAboutDiscardedComposition()
+{
+    [m_wkView _notifyInputContextAboutDiscardedComposition];
+}
+
 FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
 {
     return [m_wkView _convertToDeviceSpace:rect];

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-05-15 18:50:16 UTC (rev 150132)
@@ -357,8 +357,11 @@
 
     if (_data->_page->editorState().hasComposition && !_data->_page->editorState().shouldIgnoreCompositionSelectionChange)
         _data->_page->cancelComposition();
-    [self _resetTextInputState];
-    
+
+    [self _notifyInputContextAboutDiscardedComposition];
+
+    [self _resetSecureInputState];
+
     if (!_data->_page->maintainsInactiveSelection())
         _data->_page->clearSelection();
     
@@ -1461,18 +1464,6 @@
     LOG(TextInput, "...done executing saved keypress commands.");
 }
 
-- (void)_notifyInputContextAboutDiscardedComposition
-{
-    // <rdar://problem/9359055>: -discardMarkedText can only be called for active contexts.
-    // FIXME: We fail to ever notify the input context if something (e.g. a navigation) happens while the window is not key.
-    // This is not a problem when the window is key, because we discard marked text on resigning first responder.
-    if (![[self window] isKeyWindow] || self != [[self window] firstResponder])
-        return;
-
-    LOG(TextInput, "-> discardMarkedText");
-    [[super inputContext] discardMarkedText]; // Inform the input method that we won't have an inline input area despite having been asked to.
-}
-
 - (NSTextInputContext *)inputContext
 {
     WKViewInterpretKeyEventsParameters* parameters = _data->_interpretKeyEventsParameters;
@@ -2926,16 +2917,26 @@
     [self _notifyInputContextAboutDiscardedComposition];
 }
 
-- (void)_resetTextInputState
+- (void)_resetSecureInputState
 {
-    [self _notifyInputContextAboutDiscardedComposition];
-
     if (_data->_inSecureInputState) {
         DisableSecureEventInput();
         _data->_inSecureInputState = NO;
     }
 }
 
+- (void)_notifyInputContextAboutDiscardedComposition
+{
+    // <rdar://problem/9359055>: -discardMarkedText can only be called for active contexts.
+    // FIXME: We fail to ever notify the input context if something (e.g. a navigation) happens while the window is not key.
+    // This is not a problem when the window is key, because we discard marked text on resigning first responder.
+    if (![[self window] isKeyWindow] || self != [[self window] firstResponder])
+        return;
+
+    LOG(TextInput, "-> discardMarkedText");
+    [[super inputContext] discardMarkedText]; // Inform the input method that we won't have an inline input area despite having been asked to.
+}
+
 #if ENABLE(FULLSCREEN_API)
 - (BOOL)hasFullScreenWindowController
 {

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2013-05-15 18:50:16 UTC (rev 150132)
@@ -82,8 +82,9 @@
 - (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
 - (void)_setPromisedData:(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;
 - (void)_updateSecureInputState;
+- (void)_resetSecureInputState;
+- (void)_notifyInputContextAboutDiscardedComposition;
 - (void)_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState;
-- (void)_resetTextInputState;
 
 - (WebKit::ColorSpaceData)_colorSpace;
 

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2013-05-15 18:50:16 UTC (rev 150132)
@@ -157,7 +157,8 @@
     virtual bool executeSavedCommandBySelector(const String& selector) = 0;
     virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
     virtual void updateTextInputState(bool updateSecureInputState) = 0;
-    virtual void resetTextInputState() = 0;
+    virtual void resetSecureInputState() = 0;
+    virtual void notifyInputContextAboutDiscardedComposition() = 0;
     virtual void makeFirstResponder() = 0;
     virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
                                  const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (150131 => 150132)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-05-15 18:36:36 UTC (rev 150131)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-05-15 18:50:16 UTC (rev 150132)
@@ -2250,8 +2250,8 @@
 #if PLATFORM(MAC)
     // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
     // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
-    m_pageClient->resetTextInputState();
-    // FIXME: Should this be moved inside resetTextInputState()?
+    m_pageClient->notifyInputContextAboutDiscardedComposition();
+    m_pageClient->resetSecureInputState();
     dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
     m_pageClient->dismissDictionaryLookupPanel();
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to