+2012-02-11 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r107435.
+ http://trac.webkit.org/changeset/107435
+ https://bugs.webkit.org/show_bug.cgi?id=78410
+
+ It broke the Qt build (Requested by Ossy on #webkit).
+
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::writeSelectionToPasteboard):
+ * platform/Pasteboard.h:
+ (WebCore):
+ (Pasteboard):
+ * platform/PasteboardStrategy.h: Removed.
+ * platform/PlatformPasteboard.h: Removed.
+ * platform/PlatformStrategies.h:
+ (WebCore):
+ (WebCore::PlatformStrategies::PlatformStrategies):
+ (PlatformStrategies):
+ * platform/mac/DragDataMac.mm:
+ (WebCore::DragData::canSmartReplace):
+ (WebCore::insertablePasteboardTypes):
+ (WebCore::DragData::asURL):
+ * platform/mac/PasteboardMac.mm:
+ (WebCore):
+ (WebCore::selectionPasteboardTypes):
+ (WebCore::writableTypesForURL):
+ (WebCore::createWritableTypesForImage):
+ (WebCore::writableTypesForImage):
+ (WebCore::Pasteboard::Pasteboard):
+ (WebCore::Pasteboard::clear):
+ (WebCore::Pasteboard::writeSelectionForTypes):
+ (WebCore::Pasteboard::writePlainText):
+ (WebCore::Pasteboard::writeSelection):
+ (WebCore::writeURLForTypes):
+ (WebCore::Pasteboard::writeURL):
+ (WebCore::writeFileWrapperAsRTFDAttachment):
+ (WebCore::Pasteboard::writeImage):
+ (WebCore::Pasteboard::writeClipboard):
+ (WebCore::Pasteboard::canSmartReplace):
+ (WebCore::Pasteboard::plainText):
+ (WebCore::documentFragmentWithRTF):
+ (WebCore::Pasteboard::documentFragment):
+ * platform/mac/PlatformPasteboardMac.mm: Removed.
+
2012-02-10 Antti Koivisto <antti@apple.com>
Move CSSOM wrapper pointer out of StylePropertySet
__ZN7WebCore17openTemporaryFileERKN3WTF6StringERi
__ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE
__ZN7WebCore18PlatformStrategies26createLocalizationStrategyEv
-__ZN7WebCore18PlatformPasteboard13bufferForTypeERKN3WTF6StringE
-__ZN7WebCore18PlatformPasteboard13stringForTypeERKN3WTF6StringE
-__ZN7WebCore18PlatformPasteboard19setPathnamesForTypeERKN3WTF6VectorINS1_6StringELm0EEERKS3_
-__ZN7WebCore18PlatformPasteboard19getPathnamesForTypeERN3WTF6VectorINS1_6StringELm0EEERKS3_
-__ZN7WebCore18PlatformPasteboard8setTypesERKN3WTF6VectorINS1_6StringELm0EEE
-__ZN7WebCore18PlatformPasteboardC1ERKN3WTF6StringE
-__ZN7WebCore18PlatformPasteboard8getTypesERN3WTF6VectorINS1_6StringELm0EEE
-__ZN7WebCore18PlatformPasteboard4copyERKN3WTF6StringE
-__ZN7WebCore18PlatformPasteboard16setBufferForTypeEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS1_6StringE
-__ZN7WebCore18PlatformPasteboard16setStringForTypeERKN3WTF6StringES4_
__ZN7WebCore18SearchPopupMenuMacC1EPNS_15PopupMenuClientE
__ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
__ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE
C585A6FC11D4FB3D004C3E4B /* IDBFactoryBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */; };
C585A6FD11D4FB3D004C3E4B /* IDBFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */; };
C585A6FE11D4FB3D004C3E4B /* IDBFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */; };
- C5BAC17014E30E4700008837 /* PlatformPasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = C5BAC16F14E30E4700008837 /* PlatformPasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; };
C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; };
- C5F765B514E1D414006C899B /* PasteboardStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = C5F765B414E1D414006C899B /* PasteboardStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
- C5F765BB14E1ECF4006C899B /* PlatformPasteboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */; };
C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; };
C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F08FB91430FE8F00685849 /* MutationRecord.cpp */; };
C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactory.cpp; sourceTree = "<group>"; };
C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactory.h; sourceTree = "<group>"; };
C585A6CB11D4FB3D004C3E4B /* IDBFactory.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBFactory.idl; sourceTree = "<group>"; };
- C5BAC16F14E30E4700008837 /* PlatformPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformPasteboard.h; sourceTree = "<group>"; };
C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphMetricsMap.h; sourceTree = "<group>"; };
C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageEventDispatcher.cpp; sourceTree = "<group>"; };
C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; };
- C5F765B414E1D414006C899B /* PasteboardStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardStrategy.h; sourceTree = "<group>"; };
- C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformPasteboardMac.mm; sourceTree = "<group>"; };
C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; };
C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; };
C6F08FB91430FE8F00685849 /* MutationRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutationRecord.cpp; sourceTree = "<group>"; };
CDAA8D0814D385600061EA60 /* PlatformClockCM.mm */,
BCAA486E14A052530088FAC4 /* PlatformEventFactoryMac.h */,
BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */,
- C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
D39D006C11F8E308006041F2 /* PopupMenuMac.h */,
0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */,
BC772C4D0C4EB3040083285F /* MIMETypeRegistry.h */,
98EB1F941313FE0500D0E1EA /* NotImplemented.h */,
4B2708C50AF19EE40065127F /* Pasteboard.h */,
- C5F765B414E1D414006C899B /* PasteboardStrategy.h */,
BC5C76281497FE1400BC4775 /* PlatformEvent.cpp */,
BC5C76291497FE1400BC4775 /* PlatformEvent.h */,
A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */,
935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */,
932871BF0B20DEB70049035A /* PlatformMenuDescription.h */,
935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */,
- C5BAC16F14E30E4700008837 /* PlatformPasteboard.h */,
BCEC01D60C274EB4009F4EC9 /* PlatformScreen.h */,
1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */,
1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */,
1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */,
1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */,
1AAADDE914DC8DF800AF64B3 /* ScrollingTreeNodeMac.h in Headers */,
- C5F765B514E1D414006C899B /* PasteboardStrategy.h in Headers */,
- C5BAC17014E30E4700008837 /* PlatformPasteboard.h in Headers */,
10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */,
7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */,
7A54881714E432A1006AE05A /* DOMPatchSupport.h in Headers */,
1AAADDDA14DC74EC00AF64B3 /* ScrollingTreeStateMac.mm in Sources */,
1AAADDE314DC8C8F00AF64B3 /* ScrollingTreeNode.cpp in Sources */,
1AAADDE814DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm in Sources */,
- C5F765BB14E1ECF4006C899B /* PlatformPasteboardMac.mm in Sources */,
7A54857F14E02D51006AE05A /* InspectorHistory.cpp in Sources */,
CDAA8D0A14D71B2E0061EA60 /* PlatformClockCM.mm in Sources */,
7A54881814E432A1006AE05A /* DOMPatchSupport.cpp in Sources */,
void Editor::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes)
{
+ RetainPtr<NSMutableArray> types(AdoptNS, [[NSMutableArray alloc] init]);
+ for (size_t i = 0; i < pasteboardTypes.size(); ++i)
+ [types.get() addObject:pasteboardTypes[i]];
Pasteboard pasteboard(pasteboardName);
- pasteboard.writeSelectionForTypes(pasteboardTypes, selectedRange().get(), true, m_frame);
+ pasteboard.writeSelectionForTypes(types.get(), selectedRange().get(), true, m_frame);
}
void Editor::readSelectionFromPasteboard(const String& pasteboardName)
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
-#include <wtf/Vector.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
namespace WebCore {
#if PLATFORM(MAC)
-extern const char* WebArchivePboardType;
-extern const char* WebSmartPastePboardType;
-extern const char* WebURLNamePboardType;
-extern const char* WebURLPboardType;
-extern const char* WebURLsWithTitlesPboardType;
+extern NSString *WebArchivePboardType;
+extern NSString *WebSmartPastePboardType;
+extern NSString *WebURLNamePboardType;
+extern NSString *WebURLPboardType;
+extern NSString *WebURLsWithTitlesPboardType;
#endif
class Clipboard;
public:
#if PLATFORM(MAC)
// This is required to support OS X services.
- void writeSelectionForTypes(const Vector<String>& pasteboardTypes, Range* selectedRange, bool canSmartCopyOrDelete, Frame*);
+ void writeSelectionForTypes(NSArray* pasteboardTypes, Range* selectedRange, bool canSmartCopyOrDelete, Frame*);
Pasteboard(const String& pasteboardName);
#endif
Pasteboard();
#if PLATFORM(MAC)
- String m_pasteboardName;
+ RetainPtr<NSPasteboard> m_pasteboard;
#endif
#if PLATFORM(WIN)
+++ /dev/null
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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.
- */
-
-#ifndef PasteboardStrategy_h
-#define PasteboardStrategy_h
-
-#if USE(PLATFORM_STRATEGIES)
-
-#include "SharedBuffer.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class PasteboardStrategy {
-public:
-#if PLATFORM(MAC)
- virtual void getTypes(Vector<String>& types, const String& pasteboardName) = 0;
- virtual PassRefPtr<SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) = 0;
- virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) = 0;
- virtual String stringForType(const String& pasteboardType, const String& pasteboardName) = 0;
-
- virtual void copy(const String& fromPasteboard, const String& toPasteboard) = 0;
- virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
- virtual void setBufferForType(PassRefPtr<SharedBuffer>, const String& pasteboardType, const String& pasteboardName) = 0;
- virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) = 0;
- virtual void setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName) = 0;
-#endif
-protected:
- virtual ~PasteboardStrategy()
- {
- }
-};
-
-}
-#endif // USE(PLATFORM_STRATEGIES)
-
-#endif // !PasteboardStrategy_h
+++ /dev/null
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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.
- */
-
-#ifndef PlatformPasteboard_h
-#define PlatformPasteboard_h
-
-#include "SharedBuffer.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-#if PLATFORM(MAC)
-OBJC_CLASS NSPasteboard;
-#endif
-
-namespace WebCore {
-
-class PlatformPasteboard {
-public:
- PlatformPasteboard(const String& pasteboardName);
-
- void getTypes(Vector<String>& types);
- PassRefPtr<SharedBuffer> bufferForType(const String& pasteboardType);
- void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType);
- String stringForType(const String& pasteboardType);
-
- void copy(const String& fromPasteboard);
- void setTypes(const Vector<String>& pasteboardTypes);
- void setBufferForType(PassRefPtr<SharedBuffer>, const String& pasteboardType);
- void setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType);
- void setStringForType(const String& string, const String& pasteboardType);
-
-private:
- RetainPtr<NSPasteboard> m_pasteboard;
-};
-
-}
-
-#endif // !PlatformPasteboard_h
namespace WebCore {
class CookiesStrategy;
-class PasteboardStrategy;
class PluginStrategy;
class LocalizationStrategy;
class VisitedLinkStrategy;
return m_visitedLinkStrategy;
}
- PasteboardStrategy* pasteboardStrategy()
- {
- if (!m_pasteboardStrategy)
- m_pasteboardStrategy = createPasteboardStrategy();
- return m_pasteboardStrategy;
- }
-
protected:
PlatformStrategies()
: m_cookiesStrategy(0)
, m_pluginStrategy(0)
, m_localizationStrategy(0)
, m_visitedLinkStrategy(0)
- , m_pasteboardStrategy(0)
{
}
virtual PluginStrategy* createPluginStrategy() = 0;
virtual LocalizationStrategy* createLocalizationStrategy();
virtual VisitedLinkStrategy* createVisitedLinkStrategy() = 0;
- virtual PasteboardStrategy* createPasteboardStrategy() = 0;
CookiesStrategy* m_cookiesStrategy;
PluginStrategy* m_pluginStrategy;
LocalizationStrategy* m_localizationStrategy;
VisitedLinkStrategy* m_visitedLinkStrategy;
- PasteboardStrategy* m_pasteboardStrategy;
};
PlatformStrategies* platformStrategies();
{
//Need to call this so that the various Pasteboard type strings are intialised
Pasteboard::generalPasteboard();
- return [[m_pasteboard.get() types] containsObject:String(WebSmartPastePboardType)];
+ return [[m_pasteboard.get() types] containsObject:WebSmartPastePboardType];
}
bool DragData::containsColor() const
{
static NSArray *types = nil;
if (!types) {
- types = [[NSArray alloc] initWithObjects:String(WebArchivePboardType), NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType,
+ types = [[NSArray alloc] initWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType,
#ifdef BUILDING_ON_LEOPARD
NSPICTPboardType,
#endif
(void)filenamePolicy;
if (title) {
- if (NSString *URLTitleString = [m_pasteboard.get() stringForType:String(WebURLNamePboardType)])
+ if (NSString *URLTitleString = [m_pasteboard.get() stringForType:WebURLNamePboardType])
*title = URLTitleString;
}
#import <wtf/UnusedParam.h>
#import <wtf/unicode/CharacterNames.h>
-#if USE(PLATFORM_STRATEGIES)
-#include "PasteboardStrategy.h"
-#include "PlatformStrategies.h"
-#endif
-
+@interface NSAttributedString (AppKitSecretsIKnowAbout)
+- (id)_initWithDOMRange:(DOMRange *)domRange;
+@end
namespace WebCore {
// FIXME: It's not great to have these both here and in WebKit.
-const char* WebArchivePboardType = "Apple Web Archive pasteboard type";
-const char* WebSmartPastePboardType = "NeXT smart paste pasteboard type";
-const char* WebURLNamePboardType = "public.url-name";
-const char* WebURLPboardType = "public.url";
-const char* WebURLsWithTitlesPboardType = "WebURLsWithTitlesPboardType";
+NSString *WebArchivePboardType = @"Apple Web Archive pasteboard type";
+NSString *WebSmartPastePboardType = @"NeXT smart paste pasteboard type";
+NSString *WebURLNamePboardType = @"public.url-name";
+NSString *WebURLPboardType = @"public.url";
+NSString *WebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
-static Vector<String> selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments)
+static NSArray* selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments)
{
- Vector<String> types;
- if (canSmartCopyOrDelete)
- types.append(WebSmartPastePboardType);
- types.append(WebArchivePboardType);
- if (selectionContainsAttachments)
- types.append(String(NSRTFDPboardType));
- types.append(String(NSRTFPboardType));
- types.append(String(NSStringPboardType));
-
- return types;
+ if (selectionContainsAttachments) {
+ if (canSmartCopyOrDelete)
+ return [NSArray arrayWithObjects:WebSmartPastePboardType, WebArchivePboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, nil];
+ else
+ return [NSArray arrayWithObjects:WebArchivePboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, nil];
+ } else { // Don't write RTFD to the pasteboard when the copied attributed string has no attachments.
+ if (canSmartCopyOrDelete)
+ return [NSArray arrayWithObjects:WebSmartPastePboardType, WebArchivePboardType, NSRTFPboardType, NSStringPboardType, nil];
+ else
+ return [NSArray arrayWithObjects:WebArchivePboardType, NSRTFPboardType, NSStringPboardType, nil];
+ }
}
-static const Vector<String> writableTypesForURL()
+static NSArray* writableTypesForURL()
{
- Vector<String> types;
-
- types.append(WebURLsWithTitlesPboardType);
- types.append(String(NSURLPboardType));
- types.append(WebURLPboardType);
- types.append(WebURLNamePboardType);
- types.append(String(NSStringPboardType));
- return types;
+ DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, types, ([[NSArray alloc] initWithObjects:
+ WebURLsWithTitlesPboardType,
+ NSURLPboardType,
+ WebURLPboardType,
+ WebURLNamePboardType,
+ NSStringPboardType,
+ nil]));
+ return types.get();
}
-static inline Vector<String> createWritableTypesForImage()
+static inline NSArray* createWritableTypesForImage()
{
- Vector<String> types;
-
- types.append(String(NSTIFFPboardType));
- types.append(writableTypesForURL());
- types.append(String(NSRTFDPboardType));
+ NSMutableArray *types = [[NSMutableArray alloc] initWithObjects:NSTIFFPboardType, nil];
+ [types addObjectsFromArray:writableTypesForURL()];
+ [types addObject:NSRTFDPboardType];
return types;
}
-static Vector<String> writableTypesForImage()
+static NSArray* writableTypesForImage()
{
- Vector<String> types;
- types.append(createWritableTypesForImage());
- return types;
+ DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, types, (createWritableTypesForImage()));
+ return types.get();
}
Pasteboard* Pasteboard::generalPasteboard()
}
Pasteboard::Pasteboard(const String& pasteboardName)
- : m_pasteboardName(pasteboardName)
+ : m_pasteboard([NSPasteboard pasteboardWithName:pasteboardName])
{
ASSERT(pasteboardName);
}
void Pasteboard::clear()
{
- platformStrategies()->pasteboardStrategy()->setTypes(Vector<String>(), m_pasteboardName);
+ [m_pasteboard.get() declareTypes:[NSArray array] owner:nil];
}
-void Pasteboard::writeSelectionForTypes(const Vector<String>& pasteboardTypes, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
+void Pasteboard::writeSelectionForTypes(NSArray* pasteboardTypes, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{
if (!WebArchivePboardType)
Pasteboard::generalPasteboard(); // Initializes pasteboard types.
if (enclosingAnchor && comparePositions(firstPositionInOrBeforeNode(selectedRange->startPosition().anchorNode()), selectedRange->startPosition()) >= 0)
selectedRange->setStart(enclosingAnchor, 0, ec);
+ // Using different API for WebKit and WebKit2.
NSAttributedString *attributedString = nil;
- RetainPtr<WebHTMLConverter> converter(AdoptNS, [[WebHTMLConverter alloc] initWithDOMRange:kit(selectedRange)]);
- if (converter)
- attributedString = [converter.get() attributedString];
+ if (frame->view()->platformWidget())
+ attributedString = [[[NSAttributedString alloc] _initWithDOMRange:kit(selectedRange)] autorelease];
+#ifndef BUILDING_ON_LEOPARD
+ else {
+ // In WebKit2 we are using a different way to create the NSAttributedString from the DOMrange that doesn't require access to the WebView.
+ RetainPtr<WebHTMLConverter> converter(AdoptNS, [[WebHTMLConverter alloc] initWithDOMRange:kit(selectedRange)]);
+ if (converter)
+ attributedString = [converter.get() attributedString];
+ }
+#endif
- const Vector<String> types = !pasteboardTypes.isEmpty() ? pasteboardTypes : selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]);
- platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
+ NSArray *types = pasteboardTypes ? pasteboardTypes : selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]);
+ [m_pasteboard.get() declareTypes:types owner:nil];
frame->editor()->client()->didSetSelectionTypesForPasteboard();
// Put HTML on the pasteboard.
- if (types.contains(WebArchivePboardType)) {
+ if ([types containsObject:WebArchivePboardType]) {
RefPtr<LegacyWebArchive> archive = LegacyWebArchive::createFromSelection(frame);
RetainPtr<CFDataRef> data = archive ? archive->rawDataRepresentation() : 0;
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)data.get()), WebArchivePboardType, m_pasteboardName);
+ [m_pasteboard.get() setData:(NSData *)data.get() forType:WebArchivePboardType];
}
// Put the attributed string on the pasteboard (RTF/RTFD format).
- if (types.contains(String(NSRTFDPboardType))) {
+ if ([types containsObject:NSRTFDPboardType]) {
NSData *RTFDData = [attributedString RTFDFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)RTFDData).get(), NSRTFDPboardType, m_pasteboardName);
+ [m_pasteboard.get() setData:RTFDData forType:NSRTFDPboardType];
}
- if (types.contains(String(NSRTFPboardType))) {
+ if ([types containsObject:NSRTFPboardType]) {
if ([attributedString containsAttachments])
attributedString = attributedStringByStrippingAttachmentCharacters(attributedString);
NSData *RTFData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)RTFData).get(), NSRTFPboardType, m_pasteboardName);
+ [m_pasteboard.get() setData:RTFData forType:NSRTFPboardType];
}
// Put plain string on the pasteboard.
- if (types.contains(String(NSStringPboardType))) {
+ if ([types containsObject:NSStringPboardType]) {
// Map to a plain old space because this is better for source code, other browsers do it,
// and because HTML forces you to do this any time you want two spaces in a row.
String text = frame->editor()->selectedText();
NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&noBreakSpace length:1];
[s replaceOccurrencesOfString:NonBreakingSpaceString withString:@" " options:0 range:NSMakeRange(0, [s length])];
- platformStrategies()->pasteboardStrategy()->setStringForType(s, NSStringPboardType, m_pasteboardName);
+ [m_pasteboard.get() setString:s forType:NSStringPboardType];
[s release];
}
- if (types.contains(WebSmartPastePboardType))
- platformStrategies()->pasteboardStrategy()->setBufferForType(0, WebSmartPastePboardType, m_pasteboardName);
+ if ([types containsObject:WebSmartPastePboardType]) {
+ [m_pasteboard.get() setData:nil forType:WebSmartPastePboardType];
+ }
}
void Pasteboard::writePlainText(const String& text)
{
- Vector<String> types;
- types.append(NSStringPboardType);
- platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
- platformStrategies()->pasteboardStrategy()->setStringForType(text, NSStringPboardType, m_pasteboardName);
+ [m_pasteboard.get() declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+ [m_pasteboard.get() setString:text forType:NSStringPboardType];
}
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{
- writeSelectionForTypes(Vector<String>(), selectedRange, canSmartCopyOrDelete, frame);
+ writeSelectionForTypes(nil, selectedRange, canSmartCopyOrDelete, frame);
}
-static void writeURLForTypes(const Vector<String>& types, const String& pasteboardName, const KURL& url, const String& titleStr, Frame* frame)
+static void writeURLForTypes(NSArray* types, NSPasteboard* pasteboard, const KURL& url, const String& titleStr, Frame* frame)
{
- platformStrategies()->pasteboardStrategy()->setTypes(types, pasteboardName);
+ [pasteboard declareTypes:types owner:nil];
ASSERT(!url.isEmpty());
if ([title length] == 0)
title = userVisibleString;
}
- if (types.contains(WebURLsWithTitlesPboardType)) {
- Vector<String> paths;
- paths.append(userVisibleString);
- paths.append(titleStr.stripWhiteSpace());
- platformStrategies()->pasteboardStrategy()->setPathnamesForType(paths, WebURLsWithTitlesPboardType, pasteboardName);
- }
- if (types.contains(String(NSURLPboardType)))
- platformStrategies()->pasteboardStrategy()->setStringForType([cocoaURL absoluteString], NSURLPboardType, pasteboardName);
- if (types.contains(WebURLPboardType))
- platformStrategies()->pasteboardStrategy()->setStringForType(userVisibleString, WebURLPboardType, pasteboardName);
- if (types.contains(WebURLNamePboardType))
- platformStrategies()->pasteboardStrategy()->setStringForType(title, WebURLNamePboardType, pasteboardName);
- if (types.contains(String(NSStringPboardType)))
- platformStrategies()->pasteboardStrategy()->setStringForType(userVisibleString, NSStringPboardType, pasteboardName);
+
+ if ([types containsObject:WebURLsWithTitlesPboardType])
+ [pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:userVisibleString],
+ [NSArray arrayWithObject:(NSString*)titleStr.stripWhiteSpace()],
+ nil]
+ forType:WebURLsWithTitlesPboardType];
+ if ([types containsObject:NSURLPboardType])
+ [cocoaURL writeToPasteboard:pasteboard];
+ if ([types containsObject:WebURLPboardType])
+ [pasteboard setString:userVisibleString forType:WebURLPboardType];
+ if ([types containsObject:WebURLNamePboardType])
+ [pasteboard setString:title forType:WebURLNamePboardType];
+ if ([types containsObject:NSStringPboardType])
+ [pasteboard setString:userVisibleString forType:NSStringPboardType];
}
void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
{
- writeURLForTypes(writableTypesForURL(), m_pasteboardName, url, titleStr, frame);
+ writeURLForTypes(writableTypesForURL(), m_pasteboard.get(), url, titleStr, frame);
}
static NSFileWrapper* fileWrapperForImage(CachedResource* resource, NSURL *url)
return wrapper;
}
-static void writeFileWrapperAsRTFDAttachment(NSFileWrapper* wrapper, const String& pasteboardName)
+static void writeFileWrapperAsRTFDAttachment(NSFileWrapper* wrapper, NSPasteboard* pasteboard)
{
NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:wrapper];
[attachment release];
NSData *RTFDData = [string RTFDFromRange:NSMakeRange(0, [string length]) documentAttributes:nil];
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)RTFDData).get(), NSRTFDPboardType, pasteboardName);
+ [pasteboard setData:RTFDData forType:NSRTFDPboardType];
}
void Pasteboard::writeImage(Node* node, const KURL& url, const String& title)
if (!(node->renderer() && node->renderer()->isImage()))
return;
+ Frame* frame = node->document()->frame();
+
NSURL *cocoaURL = url;
ASSERT(cocoaURL);
if (!cachedImage || cachedImage->errorOccurred())
return;
- writeURLForTypes(writableTypesForImage(), m_pasteboardName, cocoaURL, nsStringNilIfEmpty(title), node->document()->frame());
+ writeURLForTypes(writableTypesForImage(), m_pasteboard.get(), cocoaURL, nsStringNilIfEmpty(title), frame);
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
- platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::wrapNSData((NSData *)image->getNSImage()), NSTIFFPboardType, m_pasteboardName);
+ [m_pasteboard.get() setData:[image->getNSImage() TIFFRepresentation] forType:NSTIFFPboardType];
String MIMEType = cachedImage->response().mimeType();
ASSERT(MIMETypeRegistry::isSupportedImageResourceMIMEType(MIMEType));
- writeFileWrapperAsRTFDAttachment(fileWrapperForImage(cachedImage, cocoaURL), m_pasteboardName);
+ writeFileWrapperAsRTFDAttachment(fileWrapperForImage(cachedImage, cocoaURL), m_pasteboard.get());
}
void Pasteboard::writeClipboard(Clipboard* clipboard)
{
- // FIXME: this is the last access to NSPasteboard. It will removed when the ClipboardMac
- // class is refactored.
NSPasteboard* pasteboard = static_cast<ClipboardMac*>(clipboard)->pasteboard();
- platformStrategies()->pasteboardStrategy()->copy([pasteboard name], m_pasteboardName);
+ NSArray* types = [pasteboard types];
+
+ [m_pasteboard.get() addTypes:types owner:nil];
+ for (NSUInteger i = 0; i < [types count]; i++) {
+ NSString* type = [types objectAtIndex:i];
+ [m_pasteboard.get() setData:[pasteboard dataForType:type] forType:type];
+ }
}
bool Pasteboard::canSmartReplace()
{
- Vector<String> types;
- platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
- return types.contains(WebSmartPastePboardType);
+ return [[m_pasteboard.get() types] containsObject:WebSmartPastePboardType];
}
String Pasteboard::plainText(Frame* frame)
{
- Vector<String> types;
- platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
+ NSArray *types = [m_pasteboard.get() types];
- if (types.contains(String(NSStringPboardType)))
- return [(NSString *)platformStrategies()->pasteboardStrategy()->stringForType(NSStringPboardType, m_pasteboardName) precomposedStringWithCanonicalMapping];
+ if ([types containsObject:NSStringPboardType])
+ return [[m_pasteboard.get() stringForType:NSStringPboardType] precomposedStringWithCanonicalMapping];
NSAttributedString *attributedString = nil;
NSString *string;
- if (types.contains(String(NSRTFDPboardType))) {
- RefPtr<SharedBuffer> data = platformStrategies()->pasteboardStrategy()->bufferForType(NSRTFDPboardType, m_pasteboardName);
- attributedString = [[NSAttributedString alloc] initWithRTFD:[data->createNSData() autorelease] documentAttributes:NULL];
- }
- if (attributedString == nil && types.contains(String(NSRTFPboardType))) {
- RefPtr<SharedBuffer> data = platformStrategies()->pasteboardStrategy()->bufferForType(NSRTFPboardType, m_pasteboardName);
- attributedString = [[NSAttributedString alloc] initWithRTF:[data->createNSData() autorelease] documentAttributes:NULL];
- }
+ if ([types containsObject:NSRTFDPboardType])
+ attributedString = [[NSAttributedString alloc] initWithRTFD:[m_pasteboard.get() dataForType:NSRTFDPboardType] documentAttributes:NULL];
+ if (attributedString == nil && [types containsObject:NSRTFPboardType])
+ attributedString = [[NSAttributedString alloc] initWithRTF:[m_pasteboard.get() dataForType:NSRTFPboardType] documentAttributes:NULL];
if (attributedString != nil) {
string = [[attributedString string] precomposedStringWithCanonicalMapping];
[attributedString release];
return string;
}
- if (types.contains(String(NSFilenamesPboardType))) {
- Vector<String> pathnames;
- platformStrategies()->pasteboardStrategy()->getPathnamesForType(pathnames, NSFilenamesPboardType, m_pasteboardName);
- for (size_t i = 0; i < pathnames.size(); i++)
- string = [string length] ? @"\n" + pathnames[i] : pathnames[i];
- string = [string precomposedStringWithCanonicalMapping];
+ if ([types containsObject:NSFilenamesPboardType]) {
+ string = [[[m_pasteboard.get() propertyListForType:NSFilenamesPboardType] componentsJoinedByString:@"\n"] precomposedStringWithCanonicalMapping];
if (string != nil)
return string;
}
- string = platformStrategies()->pasteboardStrategy()->stringForType(NSURLPboardType, m_pasteboardName);
- if ([string length]) {
+
+ if (NSURL *url = [NSURL URLFromPasteboard:m_pasteboard.get()]) {
// FIXME: using the editorClient to call into webkit, for now, since
// calling _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()->userVisibleString([NSURL URLWithString:string]);
+ string = frame->editor()->client()->userVisibleString(url);
if ([string length] > 0)
return [string precomposedStringWithCanonicalMapping];
}
return 0;
}
-static PassRefPtr<DocumentFragment> documentFragmentWithRTF(Frame* frame, NSString *pasteboardType,const String& pastebordName)
+static PassRefPtr<DocumentFragment> documentFragmentWithRTF(Frame* frame, NSString *pasteboardType, NSPasteboard *pasteboard)
{
if (!frame || !frame->document() || !frame->document()->isHTMLDocument())
return 0;
NSAttributedString *string = nil;
- if (pasteboardType == NSRTFDPboardType) {
- RefPtr<SharedBuffer> data = platformStrategies()->pasteboardStrategy()->bufferForType(NSRTFDPboardType, pastebordName);
- string = [[NSAttributedString alloc] initWithRTFD:[data->createNSData() autorelease] documentAttributes:NULL];
- }
- if (string == nil) {
- RefPtr<SharedBuffer> data = platformStrategies()->pasteboardStrategy()->bufferForType(NSRTFPboardType, pastebordName);
- string = [[NSAttributedString alloc] initWithRTF:[data->createNSData() autorelease] documentAttributes:NULL];
- }
+ if (pasteboardType == NSRTFDPboardType)
+ string = [[NSAttributedString alloc] initWithRTFD:[pasteboard dataForType:NSRTFDPboardType] documentAttributes:NULL];
+ if (string == nil)
+ string = [[NSAttributedString alloc] initWithRTF:[pasteboard dataForType:NSRTFPboardType] documentAttributes:NULL];
if (string == nil)
return nil;
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
{
- Vector<String> types;
- platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
+ NSArray *types = [m_pasteboard.get() types];
RefPtr<DocumentFragment> fragment;
chosePlainText = false;
- if (types.contains(WebArchivePboardType)) {
- RefPtr<LegacyWebArchive> coreArchive = LegacyWebArchive::create(KURL(), platformStrategies()->pasteboardStrategy()->bufferForType(WebArchivePboardType, m_pasteboardName).get());
+ if ([types containsObject:WebArchivePboardType]) {
+ RefPtr<LegacyWebArchive> coreArchive = LegacyWebArchive::create(KURL(), SharedBuffer::wrapNSData([m_pasteboard.get() dataForType:WebArchivePboardType]).get());
if (coreArchive) {
RefPtr<ArchiveResource> mainResource = coreArchive->mainResource();
if (mainResource) {
return fragment.release();
}
- if (types.contains(String(NSFilenamesPboardType))) {
- Vector<String> paths;
- platformStrategies()->pasteboardStrategy()->getPathnamesForType(paths, NSFilenamesPboardType, m_pasteboardName);
+ if ([types containsObject:NSFilenamesPboardType]) {
+ NSArray* paths = [m_pasteboard.get() propertyListForType:NSFilenamesPboardType];
+ NSEnumerator* enumerator = [paths objectEnumerator];
+ NSString* path;
Vector< RefPtr<Node> > refNodesVector;
Vector<Node*> nodesVector;
- for (size_t i = 0; i < paths.size(); i++) {
+ while ((path = [enumerator nextObject]) != nil) {
// Non-image file types; _web_userVisibleString is appropriate here because this will
// be pasted as visible text.
- NSString *url = frame->editor()->client()->userVisibleString([NSURL fileURLWithPath:paths[i]]);
+ NSString *url = frame->editor()->client()->userVisibleString([NSURL fileURLWithPath:path]);
RefPtr<Node> textNode = frame->document()->createTextNode(url);
refNodesVector.append(textNode.get());
nodesVector.append(textNode.get());
return fragment.release();
}
- if (types.contains(String(NSHTMLPboardType))) {
- NSString *HTMLString = platformStrategies()->pasteboardStrategy()->stringForType(NSHTMLPboardType, m_pasteboardName);
+ if ([types containsObject:NSHTMLPboardType]) {
+ NSString *HTMLString = [m_pasteboard.get() stringForType:NSHTMLPboardType];
// This is a hack to make Microsoft's HTML pasteboard data work. See 3778785.
if ([HTMLString hasPrefix:@"Version:"]) {
NSRange range = [HTMLString rangeOfString:@"<html" options:NSCaseInsensitiveSearch];
return fragment.release();
}
- if (types.contains(String(NSRTFDPboardType)) &&
- (fragment = documentFragmentWithRTF(frame, NSRTFDPboardType, m_pasteboardName)))
+ if ([types containsObject:NSRTFDPboardType] &&
+ (fragment = documentFragmentWithRTF(frame, NSRTFDPboardType, m_pasteboard.get())))
return fragment.release();
- if (types.contains(String(NSRTFPboardType)) &&
- (fragment = documentFragmentWithRTF(frame, NSRTFPboardType, m_pasteboardName)))
+ if ([types containsObject:NSRTFPboardType] &&
+ (fragment = documentFragmentWithRTF(frame, NSRTFPboardType, m_pasteboard.get())))
return fragment.release();
- if (types.contains(String(NSTIFFPboardType)) &&
- (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(platformStrategies()->pasteboardStrategy()->bufferForType(NSTIFFPboardType, m_pasteboardName), uniqueURLWithRelativePart(@"image.tiff"), "image/tiff", "", ""))))
+ if ([types containsObject:NSTIFFPboardType] &&
+ (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:NSTIFFPboardType] copy] autorelease]), uniqueURLWithRelativePart(@"image.tiff"), "image/tiff", "", ""))))
return fragment.release();
- if (types.contains(String(NSPDFPboardType)) &&
- (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(platformStrategies()->pasteboardStrategy()->bufferForType(NSPDFPboardType, m_pasteboardName).get(), uniqueURLWithRelativePart(@"application.pdf"), "application/pdf", "", ""))))
+ if ([types containsObject:NSPDFPboardType] &&
+ (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:NSPDFPboardType] copy] autorelease]), uniqueURLWithRelativePart(@"application.pdf"), "application/pdf", "", ""))))
return fragment.release();
- if (types.contains(String(kUTTypePNG)) &&
- (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(platformStrategies()->pasteboardStrategy()->bufferForType(String(kUTTypePNG), m_pasteboardName), uniqueURLWithRelativePart(@"image.png"), "image/png", "", ""))))
+#ifdef BUILDING_ON_LEOPARD
+ if ([types containsObject:NSPICTPboardType] &&
+ (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:NSPICTPboardType] copy] autorelease]), uniqueURLWithRelativePart(@"image.pict"), "image/pict", "", ""))))
+ return fragment.release();
+#endif
+
+ // Only 10.5 and higher support setting and retrieving pasteboard types with UTIs, but we don't believe
+ // that any applications on Tiger put types for which we only have a UTI, like PNG, on the pasteboard.
+ if ([types containsObject:(NSString*)kUTTypePNG] &&
+ (fragment = documentFragmentWithImageResource(frame, ArchiveResource::create(SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:(NSString*)kUTTypePNG] copy] autorelease]), uniqueURLWithRelativePart(@"image.png"), "image/png", "", ""))))
return fragment.release();
- if (types.contains(String(NSURLPboardType))) {
- NSURL *URL = [NSURL URLWithString:platformStrategies()->pasteboardStrategy()->stringForType(NSURLPboardType, m_pasteboardName)];
+ if ([types containsObject:NSURLPboardType]) {
+ NSURL *URL = [NSURL URLFromPasteboard:m_pasteboard.get()];
Document* document = frame->document();
ASSERT(document);
if (!document)
NSString *URLString = [URL absoluteString]; // Original data is ASCII-only, so there is no need to precompose.
if ([URLString length] == 0)
return nil;
- NSString *URLTitleString = [platformStrategies()->pasteboardStrategy()->stringForType(WebURLNamePboardType, m_pasteboardName) precomposedStringWithCanonicalMapping];
+ NSString *URLTitleString = [[m_pasteboard.get() stringForType:WebURLNamePboardType] precomposedStringWithCanonicalMapping];
ExceptionCode ec;
anchor->setAttribute(HTMLNames::hrefAttr, URLString);
anchor->appendChild(document->createTextNode(URLTitleString), ec);
}
}
- if (allowPlainText && types.contains(String(NSStringPboardType))) {
+ if (allowPlainText && [types containsObject:NSStringPboardType]) {
chosePlainText = true;
- fragment = createFragmentFromText(context.get(), [platformStrategies()->pasteboardStrategy()->stringForType(NSStringPboardType, m_pasteboardName) precomposedStringWithCanonicalMapping]);
+ fragment = createFragmentFromText(context.get(), [[m_pasteboard.get() stringForType:NSStringPboardType] precomposedStringWithCanonicalMapping]);
return fragment.release();
}
+++ /dev/null
-/*
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
- * 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 "config.h"
-#import "PlatformPasteboard.h"
-
-namespace WebCore {
-
-PlatformPasteboard::PlatformPasteboard(const String& pasteboardName)
- : m_pasteboard([NSPasteboard pasteboardWithName:pasteboardName])
-{
- ASSERT(pasteboardName);
-}
-
-void PlatformPasteboard::getTypes(Vector<String>& types)
-{
- NSArray *pasteboardTypes = [m_pasteboard.get() types];
-
- for (NSUInteger i = 0; i < [pasteboardTypes count]; i++)
- types.append([pasteboardTypes objectAtIndex:i]);
-}
-
-PassRefPtr<SharedBuffer> PlatformPasteboard::bufferForType(const String& pasteboardType)
-{
- return SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:pasteboardType] copy] autorelease]);
-}
-
-void PlatformPasteboard::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType)
-{
- NSArray* paths = [m_pasteboard.get() propertyListForType:pasteboardType];
- for (NSUInteger i = 0; i < [paths count]; i++)
- pathnames.append([paths objectAtIndex:i]);
-}
-
-String PlatformPasteboard::stringForType(const String& pasteboardType)
-{
- return [m_pasteboard.get() stringForType:pasteboardType];
-}
-
-void PlatformPasteboard::copy(const String& fromPasteboard)
-{
- NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName:fromPasteboard];
- NSArray* types = [pasteboard types];
-
- [m_pasteboard.get() addTypes:types owner:nil];
- for (NSUInteger i = 0; i < [types count]; i++) {
- NSString* type = [types objectAtIndex:i];
- [m_pasteboard.get() setData:[pasteboard dataForType:type] forType:type];
- }
-}
-
-void PlatformPasteboard::setTypes(const Vector<String>& pasteboardTypes)
-{
- if (pasteboardTypes.isEmpty()) {
- [m_pasteboard.get() declareTypes:nil owner:nil];
- return;
- }
-
- RetainPtr<NSMutableArray> types(AdoptNS, [[NSMutableArray alloc] init]);
- for (size_t i = 0; i < pasteboardTypes.size(); ++i)
- [types.get() addObject:pasteboardTypes[i]];
-
- [m_pasteboard.get() declareTypes:types.get() owner:nil];
-}
-
-void PlatformPasteboard::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType)
-{
- [m_pasteboard.get() setData:[buffer->createNSData() autorelease] forType:pasteboardType];
-}
-
-void PlatformPasteboard::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType)
-{
- RetainPtr<NSMutableArray> paths(AdoptNS, [[NSMutableArray alloc] init]);
- for (size_t i = 0; i < pathnames.size(); ++i)
- [paths.get() addObject:pathnames[i]];
- [m_pasteboard.get() setPropertyList:paths.get() forType:pasteboardType];
-}
-
-void PlatformPasteboard::setStringForType(const String& string, const String& pasteboardType)
-{
- [m_pasteboard.get() setString:string forType:pasteboardType];
-}
-
-}
+2012-02-11 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r107435.
+ http://trac.webkit.org/changeset/107435
+ https://bugs.webkit.org/show_bug.cgi?id=78410
+
+ It broke the Qt build (Requested by Ossy on #webkit).
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ (WebPlatformStrategies):
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::addVisitedLink):
+
2012-02-10 Adam Klein <adamk@chromium.org>
Enable MUTATION_OBSERVERS by default on all platforms
#define WebPlatformStrategies_h
#include <WebCore/CookiesStrategy.h>
-#include <WebCore/PasteboardStrategy.h>
#include <WebCore/PlatformStrategies.h>
#include <WebCore/PluginStrategy.h>
#include <WebCore/VisitedLinkStrategy.h>
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy, private WebCore::PasteboardStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy {
public:
static void initialize();
virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE;
virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE;
virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE;
- virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE;
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged() OVERRIDE;
// WebCore::VisitedLinkStrategy
virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE;
virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash) OVERRIDE;
-
- // WebCore::PasteboardStrategy
- virtual void getTypes(Vector<String>& types, const String& pasteboardName) OVERRIDE;
- virtual PassRefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual String stringForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
-
- virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE;
- virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
- virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
-
};
#endif // WebPlatformStrategies_h
#import <WebCore/BlockExceptions.h>
#import <WebCore/Page.h>
#import <WebCore/PageGroup.h>
-#import <WebCore/PlatformPasteboard.h>
using namespace WebCore;
return this;
}
-PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
-{
- return this;
-}
-
void WebPlatformStrategies::notifyCookiesChanged()
{
}
{
return page->group().addVisitedLinkHash(hash);
}
-
-void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.getTypes(types);
-}
-
-PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.bufferForType(pasteboardType);
-}
-
-void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.getPathnamesForType(pathnames, pasteboardType);
-}
-
-String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.stringForType(pasteboardType);
-}
-
-void WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard)
-{
- PlatformPasteboard pasteboard(toPasteboard);
- return pasteboard.copy(fromPasteboard);
-}
-
-void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setTypes(pasteboardTypes);
-}
-
-void WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setBufferForType(buffer, pasteboardType);
-}
-
-void WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.setPathnamesForType(pathnames, pasteboardType);
-}
-
-void WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setStringForType(string, pasteboardType);
-}
+2012-02-11 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r107435.
+ http://trac.webkit.org/changeset/107435
+ https://bugs.webkit.org/show_bug.cgi?id=78410
+
+ It broke the Qt build (Requested by Ossy on #webkit).
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+ (WebPlatformStrategies):
+
2012-02-10 Brian Weinstein <bweinstein@apple.com>
Web Inspector: Add the ability to jump to the source for a given frame
#include "WebCoreArgumentCoders.h"
#include "WebProcess.h"
#include <WebCore/Page.h>
-#include <WebCore/PlatformPasteboard.h>
#if USE(CF)
#include <wtf/RetainPtr.h>
return this;
}
-PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
-{
- return this;
-}
-
// CookiesStrategy
void WebPlatformStrategies::notifyCookiesChanged()
WebProcess::shared().addVisitedLink(linkHash);
}
-#if PLATFORM(MAC)
-// PasteboardStrategy
-
-void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.getTypes(types);
-}
-
-PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.bufferForType(pasteboardType);
-}
-
-void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.getPathnamesForType(pathnames, pasteboardType);
-}
-
-String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.stringForType(pasteboardType);
-}
-
-void WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard)
-{
- PlatformPasteboard pasteboard(toPasteboard);
- return pasteboard.copy(fromPasteboard);
-}
-
-void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setTypes(pasteboardTypes);
-}
-
-void WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setBufferForType(buffer, pasteboardType);
-}
-
-void WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- pasteboard.setPathnamesForType(pathnames, pasteboardType);
-}
-
-void WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
-{
- PlatformPasteboard pasteboard(pasteboardName);
- return pasteboard.setStringForType(string, pasteboardType);
-}
-#endif
-
} // namespace WebKit
#endif // USE(PLATFORM_STRATEGIES)
#if USE(PLATFORM_STRATEGIES)
#include <WebCore/CookiesStrategy.h>
-#include <WebCore/PasteboardStrategy.h>
#include <WebCore/PlatformStrategies.h>
#include <WebCore/PluginStrategy.h>
#include <WebCore/VisitedLinkStrategy.h>
namespace WebKit {
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy, private WebCore::PasteboardStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PluginStrategy, private WebCore::VisitedLinkStrategy {
public:
static void initialize();
virtual WebCore::CookiesStrategy* createCookiesStrategy() OVERRIDE;
virtual WebCore::PluginStrategy* createPluginStrategy() OVERRIDE;
virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() OVERRIDE;
- virtual WebCore::PasteboardStrategy* createPasteboardStrategy() OVERRIDE;
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged() OVERRIDE;
virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE;
virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash) OVERRIDE;
-#if PLATFORM(MAC)
- // WebCore::PasteboardStrategy
- virtual void getTypes(Vector<String>& types, const String& pasteboardName) OVERRIDE;
- virtual PassRefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual String stringForType(const String& pasteboardType, const String& pasteboardName) OVERRIDE;
-
- virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE;
- virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
- virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
- virtual void setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
-#endif
-
bool m_pluginCacheIsPopulated;
bool m_shouldRefreshPlugins;
Vector<WebCore::PluginInfo> m_cachedPlugins;