[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

andersca at apple.com andersca at apple.com
Fri Jan 21 14:58:41 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 2fa2dba4b01628fa7caee260ddce895bd8387790
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 5 21:22:04 2011 +0000

    2011-01-05  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Adele Peterson.
    
            Implement word transformation
            https://bugs.webkit.org/show_bug.cgi?id=51943
    
            Export Editor functions needed by WebKit2.
    
            * WebCore.exp.in:
    2011-01-05  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Sam Weinig.
    
            Handle smart insert/delete
            https://bugs.webkit.org/show_bug.cgi?id=51946
    
            * Shared/WebPageCreationParameters.cpp:
            (WebKit::WebPageCreationParameters::encode):
            (WebKit::WebPageCreationParameters::decode):
            * Shared/WebPageCreationParameters.h:
            Add isSmartInsertDelete enabled.
    
            * UIProcess/API/mac/WKView.mm:
            (-[WKView validateUserInterfaceItem:]):
            Handle toggleSmartInsertDelete:.
    
            (-[WKView toggleSmartInsertDelete:]):
            Toggle the smart insert/delete state.
    
            * UIProcess/TextChecker.h:
            Add isSmartInsertDeleteEnabled and setSmartInsertDeleteEnabled.
    
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::WebPageProxy):
            Initialize m_isSmartInsertDeleteEnabled.
    
            (WebKit::WebPageProxy::contextMenuItemSelected):
            Handle ContextMenuItemTagSmartCopyPaste.
    
            (WebKit::WebPageProxy::setSmartInsertDeleteEnabled):
            Update the state and send a SetSmartInsertDeleteEnabled message.
    
            (WebKit::WebPageProxy::creationParameters):
            Initialize isSmartInsertDeleteEnabled.
    
            * UIProcess/WebPageProxy.h:
            (WebKit::WebPageProxy::isSmartInsertDeleteEnabled):
            Return m_isSmartInsertDeleteEnabled.
    
            * UIProcess/mac/TextCheckerMac.mm:
            (WebKit::TextChecker::isSmartInsertDeleteEnabled):
            (WebKit::TextChecker::setSmartInsertDeleteEnabled):
            Store and fetch the smart insert delete state.
    
            * WebProcess/WebCoreSupport/WebEditorClient.cpp:
            (WebKit::WebEditorClient::smartInsertDeleteEnabled):
            Call WebPage::isSmartInsertDeleteEnabled.
    
            * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
            (WebKit::WebEditorClient::toggleSmartInsertDelete):
            Assert that this is never called.
    
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::WebPage):
            Initialize m_isSmartInsertDeleteEnabled
    
            * WebProcess/WebPage/WebPage.h:
            (WebKit::WebPage::isSmartInsertDeleteEnabled):
            (WebKit::WebPage::setSmartInsertDeleteEnabled):
            Add getter and setter.
    
            * WebProcess/WebPage/WebPage.messages.in:
            Add SetSmartInsertDeleteEnabled message.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75098 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 0ce116e..2f8b9a4 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,70 @@
 2011-01-05  Anders Carlsson  <andersca at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        Handle smart insert/delete
+        https://bugs.webkit.org/show_bug.cgi?id=51946
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        Add isSmartInsertDelete enabled.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView validateUserInterfaceItem:]):
+        Handle toggleSmartInsertDelete:.
+
+        (-[WKView toggleSmartInsertDelete:]):
+        Toggle the smart insert/delete state.
+
+        * UIProcess/TextChecker.h:
+        Add isSmartInsertDeleteEnabled and setSmartInsertDeleteEnabled.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        Initialize m_isSmartInsertDeleteEnabled.
+
+        (WebKit::WebPageProxy::contextMenuItemSelected):
+        Handle ContextMenuItemTagSmartCopyPaste.
+
+        (WebKit::WebPageProxy::setSmartInsertDeleteEnabled):
+        Update the state and send a SetSmartInsertDeleteEnabled message.
+
+        (WebKit::WebPageProxy::creationParameters):
+        Initialize isSmartInsertDeleteEnabled.
+
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isSmartInsertDeleteEnabled):
+        Return m_isSmartInsertDeleteEnabled.
+
+        * UIProcess/mac/TextCheckerMac.mm:
+        (WebKit::TextChecker::isSmartInsertDeleteEnabled):
+        (WebKit::TextChecker::setSmartInsertDeleteEnabled):
+        Store and fetch the smart insert delete state.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::smartInsertDeleteEnabled):
+        Call WebPage::isSmartInsertDeleteEnabled.
+
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+        (WebKit::WebEditorClient::toggleSmartInsertDelete):
+        Assert that this is never called.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Initialize m_isSmartInsertDeleteEnabled
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::isSmartInsertDeleteEnabled):
+        (WebKit::WebPage::setSmartInsertDeleteEnabled):
+        Add getter and setter.
+
+        * WebProcess/WebPage/WebPage.messages.in:
+        Add SetSmartInsertDeleteEnabled message.
+
+2011-01-05  Anders Carlsson  <andersca at apple.com>
+
         Fix Windows build.
         
         * WebProcess/WebPage/WebPage.cpp:
diff --git a/WebKit2/Shared/WebPageCreationParameters.cpp b/WebKit2/Shared/WebPageCreationParameters.cpp
index d11098a..22236e2 100644
--- a/WebKit2/Shared/WebPageCreationParameters.cpp
+++ b/WebKit2/Shared/WebPageCreationParameters.cpp
@@ -39,6 +39,10 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(drawsTransparentBackground);
     encoder->encode(userAgent);
 
+#if PLATFORM(MAC)
+    encoder->encode(isSmartInsertDeleteEnabled);
+#endif
+
 #if PLATFORM(WIN)
     encoder->encode(reinterpret_cast<uint64_t>(nativeWindow));
 #endif
@@ -60,6 +64,10 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
         return false;
     if (!decoder->decode(parameters.userAgent))
         return false;
+#if PLATFORM(MAC)
+    if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
+        return false;
+#endif
 
 #if PLATFORM(WIN)
     uint64_t nativeWindow;
diff --git a/WebKit2/Shared/WebPageCreationParameters.h b/WebKit2/Shared/WebPageCreationParameters.h
index 8a59dd8..72f2a2a 100644
--- a/WebKit2/Shared/WebPageCreationParameters.h
+++ b/WebKit2/Shared/WebPageCreationParameters.h
@@ -53,6 +53,9 @@ struct WebPageCreationParameters {
 
     String userAgent;
 
+#if PLATFORM(MAC)
+    bool isSmartInsertDeleteEnabled;
+#endif
 #if PLATFORM(WIN)
     HWND nativeWindow;
 #endif
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index c5008d2..a66581a 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -387,6 +387,12 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
         return _data->_page->selectionState().isContentEditable;
     }
 
+    if (action == @selector(toggleSmartInsertDelete:)) {
+        bool checked = _data->_page->isSmartInsertDeleteEnabled();
+        [menuItem(item) setState:checked ? NSOnState : NSOffState];
+        return _data->_page->selectionState().isContentEditable;
+    }
+
     if (action == @selector(toggleAutomaticQuoteSubstitution:)) {
         bool checked = TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
@@ -536,6 +542,11 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
     [substitutionsPanel orderFront:sender];
 }
 
+- (IBAction)toggleSmartInsertDelete:(id)sender
+{
+    _data->_page->setSmartInsertDeleteEnabled(!_data->_page->isSmartInsertDeleteEnabled());
+}
+
 - (BOOL)isAutomaticQuoteSubstitutionEnabled
 {
     return TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
diff --git a/WebKit2/UIProcess/TextChecker.h b/WebKit2/UIProcess/TextChecker.h
index 2970f3e..7415da3 100644
--- a/WebKit2/UIProcess/TextChecker.h
+++ b/WebKit2/UIProcess/TextChecker.h
@@ -46,6 +46,9 @@ public:
     static void setAutomaticDashSubstitutionEnabled(bool);
     static void setAutomaticLinkDetectionEnabled(bool);
     static void setAutomaticTextReplacementEnabled(bool);
+
+    static bool isSmartInsertDeleteEnabled();
+    static void setSmartInsertDeleteEnabled(bool);
 #endif
 
     static int64_t uniqueSpellDocumentTag();
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 51b6cba..bf325b2 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -113,6 +113,9 @@ WebPageProxy::WebPageProxy(WebContext* context, WebPageGroup* pageGroup, uint64_
     , m_processingWheelEvent(false)
     , m_processingMouseMoveEvent(false)
     , m_pageID(pageID)
+#if PLATFORM(MAC)
+    , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
+#endif
     , m_spellDocumentTag(0)
     , m_hasSpellDocumentTag(false)
     , m_pendingLearnOrIgnoreWordMessageCount(0)
@@ -1708,6 +1711,10 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
     }
 
 #if PLATFORM(MAC)
+    if (item.action() == ContextMenuItemTagSmartCopyPaste) {
+        setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
+        return;
+    }
     if (item.action() == ContextMenuItemTagSmartQuotes) {
         TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
         process()->updateTextCheckerState();
@@ -1797,6 +1804,16 @@ void WebPageProxy::capitalizeWord()
 {
     process()->send(Messages::WebPage::CapitalizeWord(), m_pageID);
 }
+
+void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
+{ 
+    if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled)
+        return;
+
+    TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled);
+    m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled;
+    process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
+}
 #endif
 
 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
@@ -2078,6 +2095,10 @@ WebPageCreationParameters WebPageProxy::creationParameters(const IntSize& size)
     parameters.drawsTransparentBackground = m_drawsTransparentBackground;
     parameters.userAgent = userAgent();
 
+#if PLATFORM(MAC)
+    parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
+#endif
+
 #if PLATFORM(WIN)
     parameters.nativeWindow = m_pageClient->nativeWindow();
 #endif
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 324af58..c8ce1a4 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -307,6 +307,9 @@ public:
     void uppercaseWord();
     void lowercaseWord();
     void capitalizeWord();
+
+    bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
+    void setSmartInsertDeleteEnabled(bool);
 #endif
 
 private:
@@ -549,6 +552,10 @@ private:
 
     uint64_t m_pageID;
 
+#if PLATFORM(MAC)
+    bool m_isSmartInsertDeleteEnabled;
+#endif
+
     int64_t m_spellDocumentTag;
     bool m_hasSpellDocumentTag;
     unsigned m_pendingLearnOrIgnoreWordMessageCount;
diff --git a/WebKit2/UIProcess/mac/TextCheckerMac.mm b/WebKit2/UIProcess/mac/TextCheckerMac.mm
index ccfce4a..c89011e 100644
--- a/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -35,6 +35,7 @@
 static const NSString * const WebAutomaticSpellingCorrectionEnabled = @"WebAutomaticSpellingCorrectionEnabled";
 static const NSString * const WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckingEnabled";
 static const NSString * const WebGrammarCheckingEnabled = @"WebGrammarCheckingEnabled";
+static const NSString * const WebSmartInsertDeleteEnabled = @"WebSmartInsertDeleteEnabled";
 static const NSString * const WebAutomaticQuoteSubstitutionEnabled = @"WebAutomaticQuoteSubstitutionEnabled";
 static const NSString * const WebAutomaticDashSubstitutionEnabled = @"WebAutomaticDashSubstitutionEnabled";
 static const NSString * const WebAutomaticLinkDetectionEnabled = @"WebAutomaticLinkDetectionEnabled";
@@ -168,6 +169,31 @@ void TextChecker::setAutomaticTextReplacementEnabled(bool isAutomaticTextReplace
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
 
+static bool smartInsertDeleteEnabled;
+    
+bool TextChecker::isSmartInsertDeleteEnabled()
+{
+    static bool readSmartInsertDeleteEnabledDefault;
+
+    if (!readSmartInsertDeleteEnabledDefault) {
+        smartInsertDeleteEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled];
+
+        readSmartInsertDeleteEnabledDefault = true;
+    }
+
+    return smartInsertDeleteEnabled;
+}
+
+void TextChecker::setSmartInsertDeleteEnabled(bool flag)
+{
+    if (flag == isSmartInsertDeleteEnabled())
+        return;
+
+    smartInsertDeleteEnabled = flag;
+
+    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebSmartInsertDeleteEnabled];
+}
+
 int64_t TextChecker::uniqueSpellDocumentTag()
 {
     return [NSSpellChecker uniqueSpellDocumentTag];
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index cf34674..e3db967 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -70,8 +70,12 @@ bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*)
 
 bool WebEditorClient::smartInsertDeleteEnabled()
 {
-    notImplemented();
+    // FIXME: Why isn't this Mac specific like toggleSmartInsertDeleteEnabled?
+#if PLATFORM(MAC)
+    return m_page->isSmartInsertDeleteEnabled();
+#else
     return true;
+#endif
 }
  
 bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
diff --git a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index 5d2fc65..d623434 100644
--- a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -170,7 +170,8 @@ bool WebEditorClient::substitutionsPanelIsShowing()
 
 void WebEditorClient::toggleSmartInsertDelete()
 {
-    notImplemented();
+    // This is handled in the UI process.
+    ASSERT_NOT_REACHED();
 }
 
 bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
@@ -180,7 +181,7 @@ bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
 
 void WebEditorClient::toggleAutomaticQuoteSubstitution()
 {
-    // This should be handled in the UI process.
+    // This is handled in the UI process.
     ASSERT_NOT_REACHED();
 }
 
@@ -191,7 +192,7 @@ bool WebEditorClient::isAutomaticLinkDetectionEnabled()
 
 void WebEditorClient::toggleAutomaticLinkDetection()
 {
-    // This should be handled in the UI process.
+    // This is handled in the UI process.
     ASSERT_NOT_REACHED();
 }
 
@@ -202,7 +203,7 @@ bool WebEditorClient::isAutomaticDashSubstitutionEnabled()
 
 void WebEditorClient::toggleAutomaticDashSubstitution()
 {
-    // This should be handled in the UI process.
+    // This is handled in the UI process.
     ASSERT_NOT_REACHED();
 }
 
@@ -213,7 +214,7 @@ bool WebEditorClient::isAutomaticTextReplacementEnabled()
 
 void WebEditorClient::toggleAutomaticTextReplacement()
 {
-    // This should be handled in the UI process.
+    // This is handled in the UI process.
     ASSERT_NOT_REACHED();
 }
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 15c9c80..7b4ab46 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -130,6 +130,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_tabToLinks(false)
 #if PLATFORM(MAC)
     , m_windowIsVisible(false)
+    , m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled)
 #elif PLATFORM(WIN)
     , m_nativeWindow(parameters.nativeWindow)
 #endif
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 19cbdab..bd6cebd 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -286,6 +286,8 @@ public:
     bool isSpeaking();
     void speak(const String&);
     void stopSpeaking();
+
+    bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
 #endif
 
     void replaceSelectionWithText(WebCore::Frame*, const String&);
@@ -384,6 +386,8 @@ private:
     void uppercaseWord();
     void lowercaseWord();
     void capitalizeWord();
+
+    void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
 #endif
 
 #if ENABLE(CONTEXT_MENUS)
@@ -413,6 +417,9 @@ private:
     // Whether the containing window is visible or not.
     bool m_windowIsVisible;
 
+    // Whether smart insert/delete is enabled or not.
+    bool m_isSmartInsertDeleteEnabled;
+
     // The frame of the containing window in screen coordinates.
     WebCore::IntRect m_windowFrameInScreenCoordinates;
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 0511483..103e3ba 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -109,6 +109,8 @@ messages -> WebPage {
     UppercaseWord();
     LowercaseWord();
     CapitalizeWord();
+
+    SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled);
 #endif
 
     SetWindowResizerSize(WebCore::IntSize intersectsView)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list