+2007-07-03 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Adam.
+
+ Fixed <rdar://problem/5225119> support smart pasting on Windows
+
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ Added new files
+ * editing/SmartReplace.cpp: Added.
+ (WebCore::isCharacterSmartReplaceExempt):
+ Added non-CF implementation placeholder
+ * editing/SmartReplace.h: Added.
+ * editing/SmartReplaceCF.cpp: Added.
+ (WebCore::getSmartSet):
+ (WebCore::isCharacterSmartReplaceExempt):
+ Added new implementation
+
+ * bridge/win/FrameWin.cpp:
+ * page/Frame.h:
+ * page/mac/FrameMac.mm:
+ Removed old declaration and implementation
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply):
+ Changed to call the new function instead of old
+
+ * page/mac/WebCoreFrameBridge.h:
+ * page/mac/WebCoreFrameBridge.mm:
+ Removed old declaration and implementation
+ (-[WebCoreFrameBridge smartInsertForString:replacingRange:beforeString:afterString:]):
+ Changed to call the new function instead of old
+
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::Pasteboard):
+ Register new clipboard format
+ (WebCore::Pasteboard::writeSelection):
+ Set data for smartpaste format on clipboard
+ (WebCore::Pasteboard::canSmartReplace):
+ Added non-stub implementation
+
2007-07-04 Qing Zhao <qing@staikos.net>
Reviewed by George Staikos.
RelativePath="..\editing\SetNodeAttributeCommand.h"
>
</File>
+ <File
+ RelativePath="..\editing\SmartReplace.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\editing\SmartReplace.h"
+ >
+ </File>
+ <File
+ RelativePath="..\editing\SmartReplaceCF.cpp"
+ >
+ </File>
<File
RelativePath="..\editing\SplitElementCommand.cpp"
>
4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043C80AE0371D00A82647 /* SoundMac.mm */; };
4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043CA0AE0373B00A82647 /* Editor.cpp */; };
4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 4B6FA6F40C39E48C00087011 /* SmartReplace.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6FA6F20C39E48C00087011 /* SmartReplace.h */; };
+ 4B6FA6F50C39E48C00087011 /* SmartReplace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6FA6F30C39E48C00087011 /* SmartReplace.cpp */; };
+ 4B6FA6F70C39E4A100087011 /* SmartReplaceCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */; };
4B8AF4AA0B1CE02B00687690 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B8AF4A90B1CE02B00687690 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
4BAE95B10B2FA9CE00AED8A0 /* EditorDeleteAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
4BBDBF7D0ACC9290005F6E97 /* CommandByName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */; };
4B3043C80AE0371D00A82647 /* SoundMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SoundMac.mm; sourceTree = "<group>"; };
4B3043CA0AE0373B00A82647 /* Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Editor.cpp; sourceTree = "<group>"; };
4B3043CB0AE0373B00A82647 /* Editor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Editor.h; sourceTree = "<group>"; };
+ 4B6FA6F20C39E48C00087011 /* SmartReplace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartReplace.h; sourceTree = "<group>"; };
+ 4B6FA6F30C39E48C00087011 /* SmartReplace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartReplace.cpp; sourceTree = "<group>"; };
+ 4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartReplaceCF.cpp; sourceTree = "<group>"; };
4B8AF4A90B1CE02B00687690 /* ClipboardAccessPolicy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ClipboardAccessPolicy.h; sourceTree = "<group>"; };
4BAE95B00B2FA9CE00AED8A0 /* EditorDeleteAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorDeleteAction.h; sourceTree = "<group>"; };
4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommandByName.cpp; sourceTree = "<group>"; };
93309DD1099E64910056E581 /* VisiblePosition.h */,
93309DD4099E64910056E581 /* WrapContentsInDummySpanCommand.cpp */,
93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */,
+ 4B6FA6F20C39E48C00087011 /* SmartReplace.h */,
+ 4B6FA6F30C39E48C00087011 /* SmartReplace.cpp */,
+ 4B6FA6F60C39E4A100087011 /* SmartReplaceCF.cpp */,
);
path = editing;
sourceTree = "<group>";
BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */,
BC94D1540C275C8B006BC617 /* History.h in Headers */,
BC94D1570C275CAB006BC617 /* GlobalHistory.h in Headers */,
+ 4B6FA6F40C39E48C00087011 /* SmartReplace.h in Headers */,
BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
BC073BAA0C399B1F000F5979 /* FloatConversion.h in Headers */,
BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */,
BC94D1530C275C8B006BC617 /* History.cpp in Sources */,
BC94D1590C275CB6006BC617 /* GlobalHistoryMac.mm in Sources */,
+ 4B6FA6F50C39E48C00087011 /* SmartReplace.cpp in Sources */,
+ 4B6FA6F70C39E4A100087011 /* SmartReplaceCF.cpp in Sources */,
BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,
BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */,
BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
return hbmp;
}
-bool Frame::isCharacterSmartReplaceExempt(UChar, bool)
-{
- // no smart replace
- return true;
-}
-
DragImageRef Frame::dragImageForSelection()
{
if (selectionController()->isRange())
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "SelectionController.h"
+#include "SmartReplace.h"
#include "TextIterator.h"
#include "htmlediting.h"
#include "markup.h"
}
if (m_smartReplace) {
bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) &&
- !frame->isCharacterSmartReplaceExempt(endOfInsertedContent.characterAfter(), false);
+ !isCharacterSmartReplaceExempt(endOfInsertedContent.characterAfter(), false);
if (needsTrailingSpace) {
RenderObject* renderer = m_lastLeafInserted->renderer();
bool collapseWhiteSpace = !renderer || renderer->style()->collapseWhiteSpace();
}
bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) &&
- !frame->isCharacterSmartReplaceExempt(startOfInsertedContent.previous().characterAfter(), true);
+ !isCharacterSmartReplaceExempt(startOfInsertedContent.previous().characterAfter(), true);
if (needsLeadingSpace) {
RenderObject* renderer = m_lastLeafInserted->renderer();
bool collapseWhiteSpace = !renderer || renderer->style()->collapseWhiteSpace();
--- /dev/null
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ */
+
+#include "config.h"
+#include "SmartReplace.h"
+
+#if !PLATFORM(CF)
+
+namespace WebCore {
+
+bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
+{
+ return false;
+}
+
+}
+
+#endif // !PLATFORM(CF)
--- /dev/null
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ */
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter);
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ */
+
+#include "config.h"
+#include "SmartReplace.h"
+
+#include <CoreFoundation/CFCharacterSet.h>
+
+namespace WebCore {
+
+static CFMutableCharacterSetRef getSmartSet(bool isPreviousCharacter)
+{
+ static CFMutableCharacterSetRef preSmartSet = NULL;
+ static CFMutableCharacterSetRef postSmartSet = NULL;
+ CFMutableCharacterSetRef smartSet = isPreviousCharacter ? preSmartSet : postSmartSet;
+ if (!smartSet) {
+ smartSet = CFCharacterSetCreateMutable(kCFAllocatorDefault);
+ CFCharacterSetAddCharactersInString(smartSet, isPreviousCharacter ? CFSTR("([\"\'#$/-`{") : CFSTR(")].,;:?\'!\"%*-/}"));
+ CFCharacterSetUnion(smartSet, CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline));
+ // Adding CJK ranges
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x1100, 256)); // Hangul Jamo (0x1100 - 0x11FF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x2E80, 352)); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x2FF0, 464)); // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x3200, 29392)); // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0xAC00, 11183)); // Hangul Syllables (0xAC00 - 0xD7AF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0xF900, 352)); // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0xFE30, 32)); // CJK Compatibility From (0xFE30 - 0xFE4F)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0xFF00, 240)); // Half/Full Width Form (0xFF00 - 0xFFEF)
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x20000, 0xA6D7)); // CJK Ideograph Exntension B
+ CFCharacterSetAddCharactersInRange(smartSet, CFRangeMake(0x2F800, 0x021E)); // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
+
+ if (isPreviousCharacter)
+ preSmartSet = smartSet;
+ else {
+ CFCharacterSetUnion(smartSet, CFCharacterSetGetPredefined(kCFCharacterSetPunctuation));
+ postSmartSet = smartSet;
+ }
+ }
+ return smartSet;
+}
+
+bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
+{
+ return CFCharacterSetIsLongCharacterMember(getSmartSet(isPreviousCharacter), c);
+}
+
+}
void caretBlinkTimerFired(Timer<Frame>*);
void setUseSecureKeyboardEntry(bool);
-// === to be moved into the Platform directory
-
-public:
- bool isCharacterSmartReplaceExempt(UChar, bool);
-
-// === to be deleted
-
public:
SelectionController* dragCaretController() const;
[d->m_bridge willPopupMenu:menu];
}
-bool Frame::isCharacterSmartReplaceExempt(UChar c, bool isPreviousChar)
-{
- return [d->m_bridge isCharacterSmartReplaceExempt:c isPreviousCharacter:isPreviousChar];
-}
-
void Frame::setNeedsReapplyStyles()
{
[d->m_bridge setNeedsReapplyStyles];
- (void)dragSourceMovedTo:(NSPoint)windowLoc;
- (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
-- (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter;
-
- (BOOL)getData:(NSData **)data andResponse:(NSURLResponse **)response forURL:(NSString *)URL;
- (void)getAllResourceDatas:(NSArray **)datas andResponses:(NSArray **)responses;
#import "ResourceRequest.h"
#import "PlatformScreen.h"
#import "SelectionController.h"
+#import "SmartReplace.h"
#import "SystemTime.h"
#import "TextEncoding.h"
#import "TextIterator.h"
bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos);
if (addLeadingSpace)
if (UChar previousChar = startVisiblePos.previous().characterAfter())
- addLeadingSpace = !m_frame->isCharacterSmartReplaceExempt(previousChar, true);
+ addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true);
bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos);
if (addTrailingSpace)
if (UChar thisChar = endVisiblePos.characterAfter())
- addTrailingSpace = !m_frame->isCharacterSmartReplaceExempt(thisChar, false);
+ addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false);
// inspect source
bool hasWhitespaceAtStart = false;
return [DOMRange _wrapRange:makeRange(previous, next).get()];
}
-// FIXME: The following 2 functions are copied from AppKit. It would be best to share code.
-
-// MF:!!! For now we will use static character sets for the computation, but we should eventually probably make these keys in the language dictionaries.
-// MF:!!! The following characters (listed with their nextstep encoding values) were in the preSmartTable in the old text objet, but aren't yet in the new text object: NS_FIGSPACE (0x80), exclamdown (0xa1), sterling (0xa3), yen (0xa5), florin (0xa6) section (0xa7), currency (0xa8), quotesingle (0xa9), quotedblleft (0xaa), guillemotleft (0xab), guilsinglleft (0xac), endash (0xb1), quotesinglbase (0xb8), quotedblbase (0xb9), questiondown (0xbf), emdash (0xd0), plusminus (0xd1).
-// MF:!!! The following characters (listed with their nextstep encoding values) were in the postSmartTable in the old text objet, but aren't yet in the new text object: NS_FIGSPACE (0x80), cent (0xa2), guilsinglright (0xad), registered (0xb0), dagger (0xa2), daggerdbl (0xa3), endash (0xb1), quotedblright (0xba), guillemotright (0xbb), perthousand (0xbd), onesuperior (0xc0), twosuperior (0xc9), threesuperior (0xcc), emdash (0xd0), ordfeminine (0xe3), ordmasculine (0xeb).
-// MF:!!! Another difference in both of these sets from the old text object is we include all the whitespace in whitespaceAndNewlineCharacterSet.
-#define _preSmartString @"([\"\'#$/-`{"
-#define _postSmartString @")].,;:?\'!\"%*-/}"
-
-static NSCharacterSet *_getPreSmartSet(void)
-{
- static RetainPtr<NSMutableCharacterSet> _preSmartSet = nil;
- if (!_preSmartSet) {
- _preSmartSet = [[NSMutableCharacterSet characterSetWithCharactersInString:_preSmartString] retain];
- [_preSmartSet.get() formUnionWithCharacterSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- // Adding CJK ranges
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x1100, 256)]; // Hangul Jamo (0x1100 - 0x11FF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x2E80, 352)]; // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x2FF0, 464)]; // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x3200, 29392)]; // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0xAC00, 11183)]; // Hangul Syllables (0xAC00 - 0xD7AF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0xF900, 352)]; // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0xFE30, 32)]; // CJK Compatibility From (0xFE30 - 0xFE4F)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0xFF00, 240)]; // Half/Full Width Form (0xFF00 - 0xFFEF)
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x20000, 0xA6D7)]; // CJK Ideograph Exntension B
- [_preSmartSet.get() addCharactersInRange:NSMakeRange(0x2F800, 0x021E)]; // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
- }
- return _preSmartSet.get();
-}
-
-static NSCharacterSet *_getPostSmartSet(void)
-{
- static RetainPtr<NSMutableCharacterSet> _postSmartSet = nil;
- if (!_postSmartSet) {
- _postSmartSet = [[NSMutableCharacterSet characterSetWithCharactersInString:_postSmartString] retain];
- [_postSmartSet.get() formUnionWithCharacterSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x1100, 256)]; // Hangul Jamo (0x1100 - 0x11FF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x2E80, 352)]; // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x2FF0, 464)]; // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x3200, 29392)]; // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0xAC00, 11183)]; // Hangul Syllables (0xAC00 - 0xD7AF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0xF900, 352)]; // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0xFE30, 32)]; // CJK Compatibility From (0xFE30 - 0xFE4F)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0xFF00, 240)]; // Half/Full Width Form (0xFF00 - 0xFFEF)
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x20000, 0xA6D7)]; // CJK Ideograph Exntension B
- [_postSmartSet.get() addCharactersInRange:NSMakeRange(0x2F800, 0x021E)]; // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
- [_postSmartSet.get() formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
- }
- return _postSmartSet.get();
-}
-
-- (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter
-{
- return [isPreviousCharacter ? _getPreSmartSet() : _getPostSmartSet() characterIsMember:c];
-}
-
- (BOOL)getData:(NSData **)data andResponse:(NSURLResponse **)response forURL:(NSString *)URL
{
Document* doc = m_frame->document();
static UINT HTMLClipboardFormat = 0;
static UINT BookmarkClipboardFormat = 0;
+static UINT WebSmartPasteFormat = 0;
static LRESULT CALLBACK PasteboardOwnerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HTMLClipboardFormat = ::RegisterClipboardFormat(L"HTML Format");
BookmarkClipboardFormat = ::RegisterClipboardFormat(L"UniformResourceLocatorW");
+ WebSmartPasteFormat = ::RegisterClipboardFormat(L"WebKit Smart Paste Format");
}
void Pasteboard::clear()
::GlobalFree(cbData);
::CloseClipboard();
}
+
+ // enable smart-replacing later on by putting dummy data on the pasteboard
+ if (canSmartCopyOrDelete) {
+ if (::OpenClipboard(m_owner)) {
+ ::SetClipboardData(WebSmartPasteFormat, NULL);
+ ::CloseClipboard();
+ }
+
+ }
}
void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
bool Pasteboard::canSmartReplace()
{
- // WebSmartPastePboardType is unavailable
- return false;
+ return ::IsClipboardFormatAvailable(WebSmartPasteFormat);
}
String Pasteboard::plainText(Frame* frame)