[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

enrica at apple.com enrica at apple.com
Wed Dec 22 13:34:17 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1e404e0887460b7e1044b69005a5e0d8846c1f51
Author: enrica at apple.com <enrica at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 18:10:44 2010 +0000

    Pasteboard doesn't work in WebKit2.
    https://bugs.webkit.org/show_bug.cgi?id=42317
    <rdar://problem/7660537>
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    * loader/EmptyClients.h:
    (WebCore::EmptyEditorClient::documentFragmentFromAttributedString): Changed parameter to
    be a Vector of RefPtr.
    * page/EditorClient.h:
    * platform/mac/PasteboardMac.mm:
    (WebCore::Pasteboard::documentFragmentWithRtf): Stylistic changes.
    
    WebKit/mac:
    
    Some changes to fix style inconsistencies.
    Added OBJC 2.0 style enumeration.
    
    * WebCoreSupport/WebEditorClient.h:
    * WebCoreSupport/WebEditorClient.mm:
    (WebEditorClient::userVisibleString):
    (createExcludedElementsForAttributedStringConversion):
    (WebEditorClient::documentFragmentFromAttributedString): Changed parameter to be
    a Vector of RefPtr.
    (WebEditorClient::setInsertionPasteboard):
    (WebEditorClient::pasteboardTypesForSelection):
    
    WebKit2:
    
    Adding support for RTF, RTFD and NSUrl formats on the Mac.
    Still missing the selective enabling of the menu entries.
    
    * WebKit2.xcodeproj/project.pbxproj: Added WebEditorClientMac.mm.
    * WebProcess/WebCoreSupport/WebEditorClient.cpp: Removed Mac only methods
    that are now in WebEditorClientMac.mm
    * WebProcess/WebCoreSupport/WebEditorClient.h: Fixed style and changed parameter
    type in documentFragmentFromAttributedString to be a Vector of RefPtr.
    * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Added.
    All the following methods have been moved from WebEditorClient.cpp.
    (WebKit::WebEditorClient::userVisibleString): Added implementation.
    (WebKit::createExcludedElementsForAttributedStringConversion): Added.
    (WebKit::WebEditorClient::documentFragmentFromAttributedString): Added implementation.
    (WebKit::WebEditorClient::setInsertionPasteboard):
    (WebKit::WebEditorClient::pasteboardTypesForSelection):
    (WebKit::WebEditorClient::uppercaseWord):
    (WebKit::WebEditorClient::lowercaseWord):
    (WebKit::WebEditorClient::capitalizeWord):
    (WebKit::WebEditorClient::showSubstitutionsPanel):
    (WebKit::WebEditorClient::substitutionsPanelIsShowing):
    (WebKit::WebEditorClient::toggleSmartInsertDelete):
    (WebKit::WebEditorClient::isAutomaticQuoteSubstitutionEnabled):
    (WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution):
    (WebKit::WebEditorClient::isAutomaticLinkDetectionEnabled):
    (WebKit::WebEditorClient::toggleAutomaticLinkDetection):
    (WebKit::WebEditorClient::isAutomaticDashSubstitutionEnabled):
    (WebKit::WebEditorClient::toggleAutomaticDashSubstitution):
    (WebKit::WebEditorClient::isAutomaticTextReplacementEnabled):
    (WebKit::WebEditorClient::toggleAutomaticTextReplacement):
    (WebKit::WebEditorClient::isAutomaticSpellingCorrectionEnabled):
    (WebKit::WebEditorClient::toggleAutomaticSpellingCorrection):
    (WebKit::WebEditorClient::checkTextOfParagraph):
    (WebKit::WebEditorClient::showCorrectionPanel):
    (WebKit::WebEditorClient::dismissCorrectionPanel):
    (WebKit::WebEditorClient::isShowingCorrectionPanel):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e95a9fa..31e9f10 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-20  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Pasteboard doesn't work in WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=42317
+        <rdar://problem/7660537>
+
+        * loader/EmptyClients.h:
+        (WebCore::EmptyEditorClient::documentFragmentFromAttributedString): Changed parameter to
+        be a Vector of RefPtr.
+        * page/EditorClient.h:
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::documentFragmentWithRtf): Stylistic changes.
+
 2010-09-20  Yong Li  <yoli at rim.com>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index b3a196d..99c443a 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -435,7 +435,7 @@ public:
     virtual void markedTextAbandoned(Frame*) { }
 
     virtual NSString* userVisibleString(NSURL*) { return 0; }
-    virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<ArchiveResource*>&) { return 0; };
+    virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<RefPtr<ArchiveResource> >&) { return 0; };
     virtual void setInsertionPasteboard(NSPasteboard*) { };
 #ifdef BUILDING_ON_TIGER
     virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
diff --git a/WebCore/page/EditorClient.h b/WebCore/page/EditorClient.h
index c9d5f6a..97b0902 100644
--- a/WebCore/page/EditorClient.h
+++ b/WebCore/page/EditorClient.h
@@ -153,7 +153,7 @@ public:
 
 #if PLATFORM(MAC)
     virtual NSString* userVisibleString(NSURL*) = 0;
-    virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<ArchiveResource*>&) = 0;
+    virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector< RefPtr<ArchiveResource> >&) = 0;
     virtual void setInsertionPasteboard(NSPasteboard*) = 0;
 #ifdef BUILDING_ON_TIGER
     virtual NSArray* pasteboardTypesForSelection(Frame*) = 0;
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm
index 7ddba0d..0625287 100644
--- a/WebCore/platform/mac/PasteboardMac.mm
+++ b/WebCore/platform/mac/PasteboardMac.mm
@@ -407,7 +407,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragmentWithRtf(Frame* frame, N
     if (!wasDeferringCallbacks)
         frame->page()->setDefersLoading(true);
 
-    Vector<ArchiveResource*> resources;
+    Vector<RefPtr<ArchiveResource> > resources;
     RefPtr<DocumentFragment> fragment = frame->editor()->client()->documentFragmentFromAttributedString(string, resources);
 
     size_t size = resources.size();
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 2159ee5..b1543cc 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,23 @@
+2010-09-20  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Pasteboard doesn't work in WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=42317
+        <rdar://problem/7660537>
+
+        Some changes to fix style inconsistencies.
+        Added OBJC 2.0 style enumeration.
+        
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::userVisibleString):
+        (createExcludedElementsForAttributedStringConversion):
+        (WebEditorClient::documentFragmentFromAttributedString): Changed parameter to be
+        a Vector of RefPtr.
+        (WebEditorClient::setInsertionPasteboard):
+        (WebEditorClient::pasteboardTypesForSelection):
+
 2010-09-17  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h
index 0afe384..ad324b9 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -70,11 +70,11 @@ public:
     virtual void didWriteSelectionToPasteboard();
     virtual void didSetSelectionTypesForPasteboard();
 
-    virtual NSString* userVisibleString(NSURL*);
-    virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<WebCore::ArchiveResource*>&);
-    virtual void setInsertionPasteboard(NSPasteboard*);
+    virtual NSString* userVisibleString(NSURL *);
+    virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource> >&);
+    virtual void setInsertionPasteboard(NSPasteboard *);
 #ifdef BUILDING_ON_TIGER
-    virtual NSArray* pasteboardTypesForSelection(WebCore::Frame*);
+    virtual NSArray *pasteboardTypesForSelection(WebCore::Frame*);
 #endif
     
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 0b49563..2bf3259 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -78,8 +78,8 @@ using namespace WTF;
 using namespace HTMLNames;
 
 @interface NSAttributedString (WebNSAttributedStringDetails)
-- (id)_initWithDOMRange:(DOMRange *)range;
-- (DOMDocumentFragment *)_documentFromRange:(NSRange)range document:(DOMDocument *)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources;
+- (id)_initWithDOMRange:(DOMRange*)range;
+- (DOMDocumentFragment*)_documentFromRange:(NSRange)range document:(DOMDocument*)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources;
 @end
 
 static WebViewInsertAction kit(EditorInsertAction coreAction)
@@ -336,59 +336,54 @@ void WebEditorClient::didSetSelectionTypesForPasteboard()
     [[m_webView _editingDelegateForwarder] webView:m_webView didSetSelectionTypesForPasteboard:[NSPasteboard generalPasteboard]];
 }
 
-NSString* WebEditorClient::userVisibleString(NSURL *URL)
+NSString *WebEditorClient::userVisibleString(NSURL *URL)
 {
     return [URL _web_userVisibleString];
 }
 
-static NSArray* excludedElementsForAttributedStringConversion()
-{
-    static NSArray *elements = nil;
-    if (elements == nil) {
-        elements = [[NSArray alloc] initWithObjects:
-                    // Omit style since we want style to be inline so the fragment can be easily inserted.
-                    @"style",
-                    // Omit xml so the result is not XHTML.
-                    @"xml", 
-                    // Omit tags that will get stripped when converted to a fragment anyway.
-                    @"doctype", @"html", @"head", @"body",
-                    // Omit deprecated tags.
-                    @"applet", @"basefont", @"center", @"dir", @"font", @"isindex", @"menu", @"s", @"strike", @"u",
-                    // Omit object so no file attachments are part of the fragment.
-                    @"object", nil];
-        CFRetain(elements);
-    }
+static NSArray *createExcludedElementsForAttributedStringConversion()
+{
+    NSArray *elements = [[NSArray alloc] initWithObjects: 
+        // Omit style since we want style to be inline so the fragment can be easily inserted.
+        @"style", 
+        // Omit xml so the result is not XHTML.
+        @"xml", 
+        // Omit tags that will get stripped when converted to a fragment anyway.
+        @"doctype", @"html", @"head", @"body", 
+        // Omit deprecated tags.
+        @"applet", @"basefont", @"center", @"dir", @"font", @"isindex", @"menu", @"s", @"strike", @"u", 
+        // Omit object so no file attachments are part of the fragment.
+        @"object", nil];
+    CFRetain(elements);
     return elements;
 }
 
-DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString* string, Vector<ArchiveResource*>& resources)
+DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource> >& resources)
 {
-    NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
-                                        excludedElementsForAttributedStringConversion(), NSExcludedElementsDocumentAttribute,
-                                        m_webView, @"WebResourceHandler", nil];
+    static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion();
+    
+    NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: excludedElements, NSExcludedElementsDocumentAttribute, 
+        nil, @"WebResourceHandler", nil];
     
-    NSArray* s;
-    DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length]) 
-                                                      document:[[m_webView mainFrame] DOMDocument] 
+    NSArray *subResources;
+    DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length])
+                                                      document:[[m_webView mainFrame] DOMDocument]
                                             documentAttributes:dictionary
-                                                  subresources:&s];
-    NSEnumerator *e = [s objectEnumerator];
-    WebResource *r;
-    while ((r = [e nextObject])) {
-        RefPtr<ArchiveResource>  ar = [r _coreResource];
-        resources.append(ar.get());
-    }
+                                                  subresources:&subResources];
+    for (WebResource* resource in subResources)
+        resources.append([resource _coreResource]);
+    
     [dictionary release];
     return core(fragment);
 }
 
-void WebEditorClient::setInsertionPasteboard(NSPasteboard* pasteboard)
+void WebEditorClient::setInsertionPasteboard(NSPasteboard *pasteboard)
 {
     [m_webView _setInsertionPasteboard:pasteboard];
 }
 
 #ifdef BUILDING_ON_TIGER
-NSArray* WebEditorClient::pasteboardTypesForSelection(Frame* selectedFrame)
+NSArray *WebEditorClient::pasteboardTypesForSelection(Frame* selectedFrame)
 {
     WebFrame* frame = kit(selectedFrame);
     return [[[frame frameView] documentView] pasteboardTypesForSelection];
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a97cda1..33b2a8f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,47 @@
+2010-09-20  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Pasteboard doesn't work in WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=42317
+        <rdar://problem/7660537>
+
+        Adding support for RTF, RTFD and NSUrl formats on the Mac.
+        Still missing the selective enabling of the menu entries.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added WebEditorClientMac.mm.
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp: Removed Mac only methods
+        that are now in WebEditorClientMac.mm
+        * WebProcess/WebCoreSupport/WebEditorClient.h: Fixed style and changed parameter
+        type in documentFragmentFromAttributedString to be a Vector of RefPtr.
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Added.
+        All the following methods have been moved from WebEditorClient.cpp.
+        (WebKit::WebEditorClient::userVisibleString): Added implementation.
+        (WebKit::createExcludedElementsForAttributedStringConversion): Added.
+        (WebKit::WebEditorClient::documentFragmentFromAttributedString): Added implementation.
+        (WebKit::WebEditorClient::setInsertionPasteboard):
+        (WebKit::WebEditorClient::pasteboardTypesForSelection):
+        (WebKit::WebEditorClient::uppercaseWord):
+        (WebKit::WebEditorClient::lowercaseWord):
+        (WebKit::WebEditorClient::capitalizeWord):
+        (WebKit::WebEditorClient::showSubstitutionsPanel):
+        (WebKit::WebEditorClient::substitutionsPanelIsShowing):
+        (WebKit::WebEditorClient::toggleSmartInsertDelete):
+        (WebKit::WebEditorClient::isAutomaticQuoteSubstitutionEnabled):
+        (WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution):
+        (WebKit::WebEditorClient::isAutomaticLinkDetectionEnabled):
+        (WebKit::WebEditorClient::toggleAutomaticLinkDetection):
+        (WebKit::WebEditorClient::isAutomaticDashSubstitutionEnabled):
+        (WebKit::WebEditorClient::toggleAutomaticDashSubstitution):
+        (WebKit::WebEditorClient::isAutomaticTextReplacementEnabled):
+        (WebKit::WebEditorClient::toggleAutomaticTextReplacement):
+        (WebKit::WebEditorClient::isAutomaticSpellingCorrectionEnabled):
+        (WebKit::WebEditorClient::toggleAutomaticSpellingCorrection):
+        (WebKit::WebEditorClient::checkTextOfParagraph):
+        (WebKit::WebEditorClient::showCorrectionPanel):
+        (WebKit::WebEditorClient::dismissCorrectionPanel):
+        (WebKit::WebEditorClient::isShowingCorrectionPanel):
+
 2010-09-20  Andy Estes  <aestes at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 8923b9f..8923231 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -358,6 +358,7 @@
 		C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA481209E45000A49D01 /* ModuleMac.mm */; };
 		C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA451209E2BA00A49D01 /* Module.cpp */; };
 		C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
+		C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5237F5F12441CA300780472 /* WebEditorClientMac.mm */; };
 		D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */; };
 		D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; };
 		D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */; };
@@ -752,6 +753,7 @@
 		C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
 		C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
 		C0E3AA481209E45000A49D01 /* ModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModuleMac.mm; sourceTree = "<group>"; };
+		C5237F5F12441CA300780472 /* WebEditorClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClientMac.mm; sourceTree = "<group>"; };
 		D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupMenu.cpp; sourceTree = "<group>"; };
 		D3B9484311FF4B6500032B39 /* WebPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenu.h; sourceTree = "<group>"; };
 		D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSearchPopupMenu.cpp; sourceTree = "<group>"; };
@@ -1242,6 +1244,7 @@
 		BC111ADE112F5B9A00337BAB /* mac */ = {
 			isa = PBXGroup;
 			children = (
+				C5237F5F12441CA300780472 /* WebEditorClientMac.mm */,
 				BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */,
 				9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */,
 				9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */,
@@ -1719,6 +1722,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */;
 			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
@@ -1915,6 +1919,7 @@
 				BC33DE8F12385C3300360F3F /* WKNumber.cpp in Sources */,
 				BCF50122123ED3B3005955AE /* ThreadLauncher.cpp in Sources */,
 				BCF501B4123EF602005955AE /* ThreadLauncherMac.mm in Sources */,
+				C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */,
 				BC33E0D212408E8600360F3F /* InjectedBundleRangeHandle.cpp in Sources */,
 				BC60C57A1240A546008C5E29 /* WKBundleRangeHandle.cpp in Sources */,
 				BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */,
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 0a930ba..235f5ce 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -340,125 +340,6 @@ void WebEditorClient::textWillBeDeletedInTextField(Element* element)
     m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), WKInputFieldActionTypeInsertDelete, webFrame);
 }
 
-
-#if PLATFORM(MAC)
-NSString* WebEditorClient::userVisibleString(NSURL*)
-{
-    notImplemented();
-    return nil;
-}
-
-DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString*, Vector<ArchiveResource*>&)
-{
-    // FIXME: add code here to create fake WebView and load WebKit 1
-    // This is needed to support RTF and RTFD in the pasteboard
-    return 0;
-}
-
-void WebEditorClient::setInsertionPasteboard(NSPasteboard*)
-{
-    // This is used only by Mail, no need to implement it now.
-    notImplemented();
-}
-
-#ifdef BUILDING_ON_TIGER
-NSArray* WebEditorClient::pasteboardTypesForSelection(Frame*)
-{
-    notImplemented();
-    return nil;
-}
-#endif
-#endif
-
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-void WebEditorClient::uppercaseWord()
-{
-    notImplemented();
-}
-
-void WebEditorClient::lowercaseWord()
-{
-    notImplemented();
-}
-
-void WebEditorClient::capitalizeWord()
-{
-    notImplemented();
-}
-
-void WebEditorClient::showSubstitutionsPanel(bool)
-{
-    notImplemented();
-}
-
-bool WebEditorClient::substitutionsPanelIsShowing()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleSmartInsertDelete()
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleAutomaticQuoteSubstitution()
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isAutomaticLinkDetectionEnabled()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleAutomaticLinkDetection()
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isAutomaticDashSubstitutionEnabled()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleAutomaticDashSubstitution()
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isAutomaticTextReplacementEnabled()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleAutomaticTextReplacement()
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isAutomaticSpellingCorrectionEnabled()
-{
-    notImplemented();
-    return false;
-}
-
-void WebEditorClient::toggleAutomaticSpellingCorrection()
-{
-    notImplemented();
-}
-
-#endif
-
 void WebEditorClient::ignoreWordInSpellDocument(const String&)
 {
     notImplemented();
@@ -485,13 +366,6 @@ void WebEditorClient::checkGrammarOfString(const UChar*, int, Vector<GrammarDeta
     notImplemented();
 }
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-void WebEditorClient::checkTextOfParagraph(const UChar*, int length, uint64_t, Vector<TextCheckingResult>&)
-{
-    notImplemented();
-}
-#endif
-
 void WebEditorClient::updateSpellingUIWithGrammarString(const String&, const GrammarDetail&)
 {
     notImplemented();
@@ -528,22 +402,4 @@ void WebEditorClient::setInputMethodState(bool)
     notImplemented();
 }
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-void WebEditorClient::showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, WebCore::Editor*)
-{
-    notImplemented();
-}
-
-void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
-{
-    notImplemented();
-}
-
-bool WebEditorClient::isShowingCorrectionPanel()
-{
-    notImplemented();
-    return false;
-}
-#endif
-
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
index 7344c06..4b1f99c 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
@@ -91,11 +91,11 @@ private:
     virtual void textDidChangeInTextArea(WebCore::Element*);
 
 #if PLATFORM(MAC)
-    virtual NSString* userVisibleString(NSURL*);
-    virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<WebCore::ArchiveResource*>&);
-    virtual void setInsertionPasteboard(NSPasteboard*);
+    virtual NSString *userVisibleString(NSURL *);
+    virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource> >&);
+    virtual void setInsertionPasteboard(NSPasteboard *);
 #ifdef BUILDING_ON_TIGER
-    virtual NSArray* pasteboardTypesForSelection(WebCore::Frame*);
+    virtual NSArray *pasteboardTypesForSelection(WebCore::Frame*);
 #endif
 #endif
 
diff --git a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
new file mode 100644
index 0000000..fb37409
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebEditorClient.h"
+
+#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
+#include "NotImplemented.h"
+
+#include "WebPage.h"
+#include "WebFrame.h"
+#include <WebCore/ArchiveResource.h>
+#include <WebCore/DocumentFragment.h>
+#include <WebCore/DOMDocumentFragmentInternal.h>
+#include <WebCore/DOMDocumentInternal.h>
+#include <WebCore/Frame.h>
+#include <WebKit/WebResource.h>
+#include <WebKit/WebNSURLExtras.h>
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#import <AppKit/NSTextChecker.h>
+#endif
+
+using namespace WebCore;
+using namespace WTF;
+
+ at interface NSAttributedString (WebNSAttributedStringDetails)
+- (DOMDocumentFragment*)_documentFromRange:(NSRange)range document:(DOMDocument*)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources;
+ at end
+
+ at interface WebResource (WebResourceInternal)
+- (WebCore::ArchiveResource*)_coreResource;
+ at end
+
+namespace WebKit {
+
+NSString *WebEditorClient::userVisibleString(NSURL *url)
+{
+    return [url _web_userVisibleString];
+}
+
+static NSArray *createExcludedElementsForAttributedStringConversion()
+{
+    NSArray *elements = [[NSArray alloc] initWithObjects: 
+        // Omit style since we want style to be inline so the fragment can be easily inserted.
+        @"style", 
+        // Omit xml so the result is not XHTML.
+        @"xml", 
+        // Omit tags that will get stripped when converted to a fragment anyway.
+        @"doctype", @"html", @"head", @"body", 
+        // Omit deprecated tags.
+        @"applet", @"basefont", @"center", @"dir", @"font", @"isindex", @"menu", @"s", @"strike", @"u", 
+        // Omit object so no file attachments are part of the fragment.
+        @"object", nil];
+    CFRetain(elements);
+    return elements;
+}
+
+DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource> >& resources)
+{
+    static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion();
+    
+    NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: excludedElements,
+        NSExcludedElementsDocumentAttribute, nil, @"WebResourceHandler", nil];
+    
+    NSArray *subResources;
+    DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length])
+                                                      document:kit(m_page->mainFrame()->coreFrame()->document())
+                                            documentAttributes:dictionary
+                                                  subresources:&subResources];
+    for (WebResource* resource in subResources)
+        resources.append([resource _coreResource]);
+    
+    [dictionary release];
+    return core(fragment);
+}
+
+void WebEditorClient::setInsertionPasteboard(NSPasteboard *)
+{
+    // This is used only by Mail, no need to implement it now.
+    notImplemented();
+}
+
+#ifdef BUILDING_ON_TIGER
+NSArray *WebEditorClient::pasteboardTypesForSelection(Frame*)
+{
+    notImplemented();
+    return nil;
+}
+#endif
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+void WebEditorClient::uppercaseWord()
+{
+    notImplemented();
+}
+
+void WebEditorClient::lowercaseWord()
+{
+    notImplemented();
+}
+
+void WebEditorClient::capitalizeWord()
+{
+    notImplemented();
+}
+
+void WebEditorClient::showSubstitutionsPanel(bool)
+{
+    notImplemented();
+}
+
+bool WebEditorClient::substitutionsPanelIsShowing()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleSmartInsertDelete()
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleAutomaticQuoteSubstitution()
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isAutomaticLinkDetectionEnabled()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleAutomaticLinkDetection()
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isAutomaticDashSubstitutionEnabled()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleAutomaticDashSubstitution()
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isAutomaticTextReplacementEnabled()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleAutomaticTextReplacement()
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isAutomaticSpellingCorrectionEnabled()
+{
+    notImplemented();
+    return false;
+}
+
+void WebEditorClient::toggleAutomaticSpellingCorrection()
+{
+    notImplemented();
+}
+
+void WebEditorClient::checkTextOfParagraph(const UChar *, int length, uint64_t, Vector<TextCheckingResult>&)
+{
+    notImplemented();
+}
+
+#endif
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+void WebEditorClient::showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*)
+{
+    notImplemented();
+}
+
+void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
+{
+    notImplemented();
+}
+
+bool WebEditorClient::isShowingCorrectionPanel()
+{
+    notImplemented();
+    return false;
+}
+#endif
+
+} // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list