[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:30 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 1b08cf9366a4470c8bdf2f571687a1c358823d67
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 5 20:19: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 Adele Peterson.
    
            Implement word transformation
            https://bugs.webkit.org/show_bug.cgi?id=51943
    
            * UIProcess/API/mac/WKView.mm:
            (-[WKView validateUserInterfaceItem:]):
            Handle the word transformation selectors.
    
            (-[WKView uppercaseWord:]):
            (-[WKView lowercaseWord:]):
            (-[WKView capitalizeWord:]):
            Call down to the WebPageProxy.
    
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::uppercaseWord):
            (WebKit::WebPageProxy::lowercaseWord):
            (WebKit::WebPageProxy::capitalizeWord):
            Send messages to the WebPage.
    
            * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
            (WebKit::changeWordCase):
            Add helper function.
    
            (WebKit::WebEditorClient::uppercaseWord):
            (WebKit::WebEditorClient::lowercaseWord):
            (WebKit::WebEditorClient::capitalizeWord):
            Call helper function.
    
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::changeSpellingToWord):
            Call replaceSelectionWithText.
    
            (WebKit::WebPage::uppercaseWord):
            (WebKit::WebPage::lowercaseWord):
            (WebKit::WebPage::capitalizeWord):
            Call the editor functions.
    
            (WebKit::WebPage::replaceSelectionWithText):
            New helper function that replaces the selected string with another string.
    
            * WebProcess/WebPage/WebPage.messages.in:
            Add new messages.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75093 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c026edb..a399f1a 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,49 @@
+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
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView validateUserInterfaceItem:]):
+        Handle the word transformation selectors.
+
+        (-[WKView uppercaseWord:]):
+        (-[WKView lowercaseWord:]):
+        (-[WKView capitalizeWord:]):
+        Call down to the WebPageProxy.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::uppercaseWord):
+        (WebKit::WebPageProxy::lowercaseWord):
+        (WebKit::WebPageProxy::capitalizeWord):
+        Send messages to the WebPage.
+
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+        (WebKit::changeWordCase):
+        Add helper function.
+
+        (WebKit::WebEditorClient::uppercaseWord):
+        (WebKit::WebEditorClient::lowercaseWord):
+        (WebKit::WebEditorClient::capitalizeWord):
+        Call helper function.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::changeSpellingToWord):
+        Call replaceSelectionWithText.
+
+        (WebKit::WebPage::uppercaseWord):
+        (WebKit::WebPage::lowercaseWord):
+        (WebKit::WebPage::capitalizeWord):
+        Call the editor functions.
+
+        (WebKit::WebPage::replaceSelectionWithText):
+        New helper function that replaces the selected string with another string.
+
+        * WebProcess/WebPage/WebPage.messages.in:
+        Add new messages.
+
 2011-01-05  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 47f26d0..c5008d2 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -411,6 +411,9 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
         return _data->_page->selectionState().isContentEditable;
     }
 
+    if (action == @selector(uppercaseWord:) || action == @selector(lowercaseWord:) || action == @selector(capitalizeWord:))
+        return _data->_page->selectionState().selectedRangeLength && _data->_page->selectionState().isContentEditable;
+    
     if (action == @selector(stopSpeaking:))
         return [NSApp isSpeaking];
 
@@ -613,6 +616,21 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
     _data->_page->process()->updateTextCheckerState();
 }
 
+- (void)uppercaseWord:(id)sender
+{
+    _data->_page->uppercaseWord();
+}
+
+- (void)lowercaseWord:(id)sender
+{
+    _data->_page->lowercaseWord();
+}
+
+- (void)capitalizeWord:(id)sender
+{
+    _data->_page->capitalizeWord();
+}
+
 // Events
 
 // Override this so that AppKit will send us arrow keys as key down events so we can
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 177c3c7..51b6cba 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1782,6 +1782,23 @@ void WebPageProxy::unmarkAllBadGrammar()
     process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID);
 }
 
+#if PLATFORM(MAC)
+void WebPageProxy::uppercaseWord()
+{
+    process()->send(Messages::WebPage::UppercaseWord(), m_pageID);
+}
+
+void WebPageProxy::lowercaseWord()
+{
+    process()->send(Messages::WebPage::LowercaseWord(), m_pageID);
+}
+
+void WebPageProxy::capitalizeWord()
+{
+    process()->send(Messages::WebPage::CapitalizeWord(), m_pageID);
+}
+#endif
+
 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
 {
     m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 2e2ef03..324af58 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -303,6 +303,11 @@ public:
     void changeSpellingToWord(const String& word);
     void unmarkAllMisspellings();
     void unmarkAllBadGrammar();
+#if PLATFORM(MAC)
+    void uppercaseWord();
+    void lowercaseWord();
+    void capitalizeWord();
+#endif
 
 private:
     WebPageProxy(WebContext*, WebPageGroup*, uint64_t pageID);
diff --git a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index 2c4110d..5d2fc65 100644
--- a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -130,20 +130,31 @@ NSArray *WebEditorClient::pasteboardTypesForSelection(Frame*)
 }
 #endif
 
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+static void changeWordCase(WebPage* page, SEL selector)
+{
+    Frame* frame = page->corePage()->focusController()->focusedOrMainFrame();
+    if (!frame->editor()->canEdit())
+        return;
+
+    frame->editor()->command("selectWord").execute();
+
+    NSString *selectedString = frame->displayStringModifiedByEncoding(frame->editor()->selectedText());
+    page->replaceSelectionWithText(frame, [selectedString performSelector:selector]);
+}
+
 void WebEditorClient::uppercaseWord()
 {
-    notImplemented();
+    changeWordCase(m_page, @selector(uppercaseString));
 }
 
 void WebEditorClient::lowercaseWord()
 {
-    notImplemented();
+    changeWordCase(m_page, @selector(lowercaseString));
 }
 
 void WebEditorClient::capitalizeWord()
 {
-    notImplemented();
+    changeWordCase(m_page, @selector(capitalizedString));
 }
 
 void WebEditorClient::showSubstitutionsPanel(bool)
@@ -221,7 +232,6 @@ void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, uint64
     // FIXME: It would be nice if we wouldn't have to copy the text here.
     m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(String(text, length), checkingTypes), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results));
 }
-#endif
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
 void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType type, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, const Vector<String>& alternativeReplacementStrings, WebCore::Editor*)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 3841185..f072da6 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1267,13 +1267,7 @@ void WebPage::advanceToNextMisspelling(bool startBeforeSelection)
 
 void WebPage::changeSpellingToWord(const String& word)
 {
-    Frame* frame = m_page->focusController()->focusedOrMainFrame();
-    if (frame->selection()->isNone())
-        return;
-
-    RefPtr<DocumentFragment> textFragment = createFragmentFromText(frame->selection()->toNormalizedRange().get(), word);
-    applyCommand(ReplaceSelectionCommand::create(frame->document(), textFragment.release(), true, false, true));
-    frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
+    replaceSelectionWithText(m_page->focusController()->focusedOrMainFrame(), word);
 }
 
 void WebPage::unmarkAllMisspellings()
@@ -1292,6 +1286,21 @@ void WebPage::unmarkAllBadGrammar()
     }
 }
 
+void WebPage::uppercaseWord()
+{
+    m_page->focusController()->focusedOrMainFrame()->editor()->uppercaseWord();
+}
+
+void WebPage::lowercaseWord()
+{
+    m_page->focusController()->focusedOrMainFrame()->editor()->lowercaseWord();
+}
+
+void WebPage::capitalizeWord()
+{
+    m_page->focusController()->focusedOrMainFrame()->editor()->capitalizeWord();
+}
+    
 void WebPage::setTextForActivePopupMenu(int32_t index)
 {
     if (!m_activePopupMenu)
@@ -1307,6 +1316,16 @@ void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& i
     m_contextMenu = 0;
 }
 
+void WebPage::replaceSelectionWithText(Frame* frame, const String& text)
+{
+    if (frame->selection()->isNone())
+        return;
+    
+    RefPtr<DocumentFragment> textFragment = createFragmentFromText(frame->selection()->toNormalizedRange().get(), text);
+    applyCommand(ReplaceSelectionCommand::create(frame->document(), textFragment.release(), true, false, true));
+    frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
+}
+
 #if PLATFORM(MAC)
 
 void WebPage::addPluginView(PluginView* pluginView)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 864d60f..19cbdab 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -288,6 +288,8 @@ public:
     void stopSpeaking();
 #endif
 
+    void replaceSelectionWithText(WebCore::Frame*, const String&);
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -378,6 +380,11 @@ private:
     void changeSpellingToWord(const String& word);
     void unmarkAllMisspellings();
     void unmarkAllBadGrammar();
+#if PLATFORM(MAC)
+    void uppercaseWord();
+    void lowercaseWord();
+    void capitalizeWord();
+#endif
 
 #if ENABLE(CONTEXT_MENUS)
     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index cf1fdc6..0511483 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -105,6 +105,11 @@ messages -> WebPage {
     ChangeSpellingToWord(WTF::String word)
     UnmarkAllMisspellings()
     UnmarkAllBadGrammar()
+#if PLATFORM(MAC)
+    UppercaseWord();
+    LowercaseWord();
+    CapitalizeWord();
+#endif
 
     SetWindowResizerSize(WebCore::IntSize intersectsView)
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list