WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2006 23:43:17 +0000 (23:43 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2006 23:43:17 +0000 (23:43 +0000)
        Reviewed by Alice.

        * bridge/EditorClient.h: Removed "_web_" prefix from
        C++ userVisibleString member function. Alice will probably change
        this so it's not on the editor client any more later.

        * editing/Editor.h: Removed "_web_" prefix from
        C++ userVisibleString member function.
        * editing/Editor.cpp: Tweaked formatting a bit. Removed Mac-specific
        code from this file.

        * editing/mac/EditorMac.mm:
        (WebCore::Editor::newGeneralClipboard): Removed unnneded local variable.
        (WebCore::Editor::userVisibleString): Moved this function here.

        * platform/Pasteboard.h: Added some FIXMEs. Removed unneeded includes.
        Made Pasteboard noncopyable. Removed use of "protected" where we should
        be using "private". Removed s_generalPasteboard.
        * platform/mac/PasteboardMac.mm: Added some FIXMEs. Removed the
        s_generalPasteboard global. Removed the unused destructor. Updated call
        to userVisibleString for name change. Tweaked formatting.

WebKit:

        Reviewed by Alice.

        * WebCoreSupport/WebEditorClient.h: Removed "_web_" prefix from
        C++ userVisibleString member function.
        * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::userVisibleString):
        Ditto.

        * WebView/WebView.mm: (-[WebView selectedFrame]): Removed extra return statement.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18008 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bridge/EditorClient.h
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/mac/EditorMac.mm
WebCore/platform/Pasteboard.h
WebCore/platform/mac/PasteboardMac.mm
WebKit/ChangeLog
WebKit/WebCoreSupport/WebEditorClient.h
WebKit/WebCoreSupport/WebEditorClient.mm
WebKit/WebView/WebView.mm

index 6480e4d80311c6cceef694de545d9419855cc0f3..3dc9b6f6c8853d60fc06ea521a74b3c2e104fd3f 100644 (file)
@@ -1,3 +1,27 @@
+2006-12-04  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alice.
+
+        * bridge/EditorClient.h: Removed "_web_" prefix from
+        C++ userVisibleString member function. Alice will probably change
+        this so it's not on the editor client any more later.
+
+        * editing/Editor.h: Removed "_web_" prefix from
+        C++ userVisibleString member function.
+        * editing/Editor.cpp: Tweaked formatting a bit. Removed Mac-specific
+        code from this file.
+
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::newGeneralClipboard): Removed unnneded local variable.
+        (WebCore::Editor::userVisibleString): Moved this function here.
+
+        * platform/Pasteboard.h: Added some FIXMEs. Removed unneeded includes.
+        Made Pasteboard noncopyable. Removed use of "protected" where we should
+        be using "private". Removed s_generalPasteboard.
+        * platform/mac/PasteboardMac.mm: Added some FIXMEs. Removed the
+        s_generalPasteboard global. Removed the unused destructor. Updated call
+        to userVisibleString for name change. Tweaked formatting.
+
 2006-12-04  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by Oliver.
index 6e2417e15c9d894e1ab3881c871ca67bec6468eb..0bc890509ac42f0af84372cfa798b02d05bb9d6d 100644 (file)
@@ -90,7 +90,7 @@ public:
     // FIXME: This should become SelectionController::toWebArchive()
     virtual NSData* dataForArchivedSelection(Frame*) = 0; 
 
-    virtual NSString* _web_userVisibleString(NSURL*) = 0;
+    virtual NSString* userVisibleString(NSURL*) = 0;
 #endif
 
 };
index 2fe5cbafdbb8bb0f728c515b604de4b1044202ec..909f98f7b03ed054a49897099351cbcca3ab5b08 100644 (file)
@@ -61,7 +61,6 @@ namespace WebCore {
 
 using namespace EventNames;
 using namespace HTMLNames;
-using namespace EventNames;
 
 EditorClient* Editor::client() const
 {
@@ -191,9 +190,9 @@ bool Editor::canSmartReplaceWithPasteboard(Pasteboard* pasteboard)
 bool Editor::shouldInsertFragment(PassRefPtr<DocumentFragment> fragment, PassRefPtr<Range> replacingDOMRange, EditorInsertAction givenAction)
 {
     if (client()) {
-        Node *child = fragment->firstChild();
+        Nodechild = fragment->firstChild();
         if (fragment->lastChild() == child && child->isCharacterDataNode())
-            return client()->shouldInsertText(((CharacterData *)child)->data(), replacingDOMRange.get(), givenAction);
+            return client()->shouldInsertText(static_cast<CharacterData*>(child)->data(), replacingDOMRange.get(), givenAction);
         return client()->shouldInsertNode(fragment.get(), replacingDOMRange.get(), givenAction);
     }
     return false;
@@ -389,7 +388,7 @@ bool Editor::dispatchCPPEvent(const AtomicString &eventType, ClipboardAccessPoli
     return !noDefaultProcessing;
 }
 
-void Editor::applyStyle(CSSStyleDeclaration *style, EditAction editingAction)
+void Editor::applyStyle(CSSStyleDeclarationstyle, EditAction editingAction)
 {
     switch (m_frame->selectionController()->state()) {
         case Selection::NONE:
@@ -406,7 +405,7 @@ void Editor::applyStyle(CSSStyleDeclaration *style, EditAction editingAction)
     }
 }
 
-void Editor::applyParagraphStyle(CSSStyleDeclaration *style, EditAction editingAction)
+void Editor::applyParagraphStyle(CSSStyleDeclarationstyle, EditAction editingAction)
 {
     switch (m_frame->selectionController()->state()) {
         case Selection::NONE:
@@ -1142,13 +1141,4 @@ void Editor::didEndEditing()
         client()->didEndEditing();
 }
 
-#if PLATFORM(MAC)
-NSString* Editor::_web_userVisibleString(NSURL* nsURL)
-{
-    if (client())
-        return client()->_web_userVisibleString(nsURL);
-    return nil;
-}
-#endif
-
 } // namespace WebCore
index 5d07f94397b979e59ebca110c27bd811189b68e9..87eb870269eec959de43364c06b41b8225fe1e19 100644 (file)
@@ -132,7 +132,7 @@ public:
     void didEndEditing();
 
 #if PLATFORM(MAC)
-    NSString* _web_userVisibleString(NSURL* nsURL);
+    NSString* userVisibleString(NSURL* nsURL);
 #endif
 
 private:
index 5932591c60601da30d1600377d79f2c979ea9955..af836e73d766c1433c164b8d9d676b3a13a9889f 100644 (file)
@@ -34,8 +34,14 @@ namespace WebCore {
 
 PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
 {
-    RefPtr<ClipboardMac> clipboard = new ClipboardMac(false, [NSPasteboard generalPasteboard], policy);
-    return clipboard.release();
+    return new ClipboardMac(false, [NSPasteboard generalPasteboard], policy);
+}
+
+NSString* Editor::userVisibleString(NSURL* nsURL)
+{
+    if (client())
+        return client()->userVisibleString(nsURL);
+    return nil;
 }
 
 } // namespace WebCore
index 46db1202ef03cd3cd8200318093572f7e97eb6ab..93fe57a5a22baaa0bb80ee13c82ca8f54872502f 100644 (file)
 #ifndef PASTEBOARD_H_
 #define PASTEBOARD_H_
 
-#include "AtomicStringImpl.h"
-#include "DeprecatedCString.h"
-#include "PlatformString.h"
-#include "Range.h"
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+
+// FIXME: This class is too high-level to be in the platform directory, since it
+// uses the DOM and makes calls to Editor. It should either be divested of its
+// knowledge of the frame and editor or moved into the editing directory.
 
 #if PLATFORM(MAC)
 class NSPasteboard;
 class NSArray;
-extern NSString *WebArchivePboardType;
-extern NSString *WebSmartPastePboardType;
-extern NSString *WebURLNamePboardType;
-extern NSString *WebURLPboardType;
-extern NSString *WebURLsWithTitlesPboardType;
 #endif
 
 #if PLATFORM(WIN)
-#include <wtf/HashSet.h>
 #include <windows.h>
 typedef struct HWND__* HWND;
 #endif
 
+#if PLATFORM(MAC)
+// FIXME: These should be moved into the WebCore namespace.
+extern NSString *WebArchivePboardType;
+extern NSString *WebSmartPastePboardType;
+extern NSString *WebURLNamePboardType;
+extern NSString *WebURLPboardType;
+extern NSString *WebURLsWithTitlesPboardType;
+#endif
+
 namespace WebCore {
 
+class CString;
+class DeprecatedCString;
 class DocumentFragment;
 class Frame;
+class Range;
+class String;
 
-class Pasteboard {
+class Pasteboard : Noncopyable {
 public:
     static Pasteboard* generalPasteboard();
     void writeSelection(PassRefPtr<Range>, bool canSmartCopyOrDelete, Frame*);
     void clearTypes();
     bool canSmartReplace();
     PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText);
-    String plainText(Frame* frame=0);
-    
-protected:
-    Pasteboard();
-    ~Pasteboard();
+    String plainText(Frame* = 0);
 
 private:
-    static Pasteboard* s_generalPasteboard;
+    Pasteboard();
+    ~Pasteboard();
 
 #if PLATFORM(MAC)
-    Pasteboard(NSPasteboard* pboard);
-    NSArrayselectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments);
-    NSPasteboardm_pasteboard;
+    Pasteboard(NSPasteboard *);
+    NSArray *selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments);
+    NSPasteboard *m_pasteboard;
 #endif
 
 #if PLATFORM(WIN)
@@ -80,10 +87,8 @@ private:
     HGLOBAL createHandle(String);
     HGLOBAL createHandle(CString);
     DeprecatedCString createCF_HTMLFromRange(PassRefPtr<Range>);
-
     HWND m_owner;
 #endif
-
 };
 
 } // namespace WebCore
index 32b6f33587f7158449794baa8da4f86402d55c3c..3c7315a590bcce79e56838251f7d6e6493e73d08 100644 (file)
 #import "WebNSAttributedStringExtras.h"
 #import "markup.h"
 
-using namespace WebCore;
-
 NSString *WebArchivePboardType          = @"Apple Web Archive pasteboard type";
 NSString *WebSmartPastePboardType       = @"NeXT smart paste pasteboard type";
+// FIXME: The code to initialize these needs to be moved in here, and out of WebKit.
 NSString *WebURLNamePboardType          = nil;
 NSString *WebURLPboardType              = nil;
 NSString *WebURLsWithTitlesPboardType   = @"WebURLsWithTitlesPboardType";
@@ -44,25 +43,19 @@ NSString *WebURLsWithTitlesPboardType   = @"WebURLsWithTitlesPboardType";
 - (id)_initWithDOMRange:(DOMRange *)domRange;
 @end
 
-Pasteboard* Pasteboard::s_generalPasteboard = 0;
+namespace WebCore {
 
 Pasteboard* Pasteboard::generalPasteboard() 
 {
-    if (!s_generalPasteboard)
-        s_generalPasteboard = new Pasteboard([NSPasteboard generalPasteboard]);
-    return s_generalPasteboard;
+    static Pasteboard* pasteboard = new Pasteboard([NSPasteboard generalPasteboard]);
+    return pasteboard;
 }
 
-Pasteboard::~Pasteboard()
+Pasteboard::Pasteboard(NSPasteboard* pboard)
+    : m_pasteboard(pboard)
 {
-    delete s_generalPasteboard;
-    s_generalPasteboard = 0;
 }
 
-Pasteboard::Pasteboard(NSPasteboard* pboard)
-: m_pasteboard(pboard)
-{ }
-
 void Pasteboard::clearTypes()
 {
     [m_pasteboard declareTypes:[NSArray array] owner:nil];
@@ -166,7 +159,7 @@ String Pasteboard::plainText(Frame* frame)
         // FIXME: using the editorClient to call into webkit, for now, since 
         // calling [URL _web_userVisibleString] from WebCore involves migrating a sizable web of 
         // helper code that should either be done in a separate patch or figured out in another way.
-        string = frame->editor()->client()->_web_userVisibleString(URL);
+        string = frame->editor()->client()->userVisibleString(URL);
         if ([string length] > 0)
             return string;
     }
@@ -206,3 +199,4 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
     return 0;
 }
 
+}
index 6bf911c0393a3daa6d4478bdd2dea32ba5102a51..009ef56b02721a8a6c32dabf033855aafb693874 100644 (file)
@@ -1,3 +1,14 @@
+2006-12-04  Darin Adler  <darin@apple.com>
+
+        Reviewed by Alice.
+
+        * WebCoreSupport/WebEditorClient.h: Removed "_web_" prefix from
+        C++ userVisibleString member function.
+        * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::userVisibleString):
+        Ditto.
+
+        * WebView/WebView.mm: (-[WebView selectedFrame]): Removed extra return statement.
+
 2006-12-04  Don Gibson  <dgibson77@gmail.com>
 
         Reviewed and landed by Alexey.
index 61aee51c28982fdd8ecafab762e32d61b0cdbd9d..3449cf47972ed84b92cee6efd5384e2f644b90b4 100644 (file)
@@ -61,7 +61,7 @@ public:
     virtual void didEndEditing();
 
     virtual NSData* dataForArchivedSelection(WebCore::Frame*);
-    virtual NSString* _web_userVisibleString(NSURL*);
+    virtual NSString* userVisibleString(NSURL*);
     
     virtual void respondToChangedContents();
 
index 2e6e8832489dd436cb075566a8609a28d36a2e3a..5dda74b81364d43ad8a8785b346aa4cc67a1451e 100644 (file)
@@ -236,7 +236,7 @@ NSData* WebEditorClient::dataForArchivedSelection(Frame* frame)
     return [archive data];
 }
 
-NSString* WebEditorClient::_web_userVisibleString(NSURL *URL)
+NSString* WebEditorClient::userVisibleString(NSURL *URL)
 {
     return [URL _web_userVisibleString];
 }
index 2917a31da006c6bf67ff470927621a3cd7f4d92a..611018712b8af79da20892d8cd25392fb19cda0f 100644 (file)
@@ -2148,8 +2148,6 @@ NS_ENDHANDLER
     // If the first responder is outside of our view tree, we search for a frame containing a selection.
     // There should be at most only one of these.
     return [[self mainFrame] _findFrameWithSelection];
-    
-    return nil;
 }
 
 - (WebBackForwardList *)backForwardList