Diff
Modified: trunk/Source/WebCore/ChangeLog (101866 => 101867)
--- trunk/Source/WebCore/ChangeLog 2011-12-02 23:31:35 UTC (rev 101866)
+++ trunk/Source/WebCore/ChangeLog 2011-12-02 23:36:06 UTC (rev 101867)
@@ -1,3 +1,24 @@
+2011-12-02 Benjamin Poulain <[email protected]>
+
+ Update platform/iphone to platform/ios
+ https://bugs.webkit.org/show_bug.cgi?id=73708
+
+ Reviewed by Darin Adler.
+
+ The platform is now best known as iOS, update the platform layer accordingly.
+
+ * Configurations/WebCore.xcconfig:
+ * WebCore.gypi:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/cocoa/KeyEventCocoa.mm:
+ * platform/ios/KeyEventCodesIOS.h: Renamed from Source/WebCore/platform/iphone/KeyEventCodesIPhone.h.
+ * platform/ios/KeyEventIOS.mm: Renamed from Source/WebCore/platform/iphone/KeyEventIPhone.mm.
+ (WebCore::keyIdentifierForKeyEvent):
+ (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+ (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
+ (WebCore::PlatformKeyboardEvent::currentCapsLockState):
+ (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
+
2011-12-02 Jonathan Backer <[email protected]>
[chromium] Eliminate unnecessary state on previous CL
Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (101866 => 101867)
--- trunk/Source/WebCore/Configurations/WebCore.xcconfig 2011-12-02 23:31:35 UTC (rev 101866)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig 2011-12-02 23:36:06 UTC (rev 101867)
@@ -83,6 +83,7 @@
EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(REAL_PLATFORM_NAME)) $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS);
EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png localizedStrings.js;
EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos);
+EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm
SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(REAL_PLATFORM_NAME));
SQLITE3_LIBRARY_iphoneos = sqlite3;
Modified: trunk/Source/WebCore/WebCore.gypi (101866 => 101867)
--- trunk/Source/WebCore/WebCore.gypi 2011-12-02 23:31:35 UTC (rev 101866)
+++ trunk/Source/WebCore/WebCore.gypi 2011-12-02 23:36:06 UTC (rev 101867)
@@ -4076,8 +4076,8 @@
'platform/image-encoders/skia/PNGImageEncoder.h',
'platform/image-encoders/skia/WEBPImageEncoder.cpp',
'platform/image-encoders/skia/WEBPImageEncoder.h',
- 'platform/iphone/KeyEventCodesIPhone.h',
- 'platform/iphone/KeyEventIPhone.mm',
+ 'platform/ios/KeyEventCodesIOS.h',
+ 'platform/ios/KeyEventIOS.mm',
'platform/mac/AutodrainedPool.mm',
'platform/mac/BlockExceptions.mm',
'platform/mac/ClipboardMac.mm',
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (101866 => 101867)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-12-02 23:31:35 UTC (rev 101866)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-12-02 23:36:06 UTC (rev 101867)
@@ -675,6 +675,8 @@
24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */; settings = {ATTRIBUTES = (); }; };
2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */; };
2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 265541391489811C000DFC5D /* KeyEventCodesIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 265541371489811C000DFC5D /* KeyEventCodesIOS.h */; };
+ 2655413A1489811C000DFC5D /* KeyEventIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 265541381489811C000DFC5D /* KeyEventIOS.mm */; };
26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
2917B5611473496C0052C9D0 /* LayerFlushScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */; };
2917B5621473496C0052C9D0 /* LayerFlushScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3423,8 +3425,6 @@
A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; };
A5732B0D136A16C4005C8D7C /* LocalizedDate.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B0C136A16C4005C8D7C /* LocalizedDate.h */; };
A5732B0F136A1715005C8D7C /* LocalizedDateNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5732B0E136A1715005C8D7C /* LocalizedDateNone.cpp */; };
- A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */ = {isa = PBXBuildFile; fileRef = A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */; };
- A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */ = {isa = PBXBuildFile; fileRef = A59E3C1D11580F510072928E /* KeyEventIPhone.mm */; };
A5ABB78713B904BC00F197E3 /* LineBreakIteratorPoolICU.h in Headers */ = {isa = PBXBuildFile; fileRef = A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */; };
A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AFB34D115151A700B045CB /* StepRange.cpp */; };
A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; };
@@ -7774,6 +7774,8 @@
24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; };
2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = "<group>"; };
2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; };
+ 265541371489811C000DFC5D /* KeyEventCodesIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIOS.h; path = ios/KeyEventCodesIOS.h; sourceTree = "<group>"; };
+ 265541381489811C000DFC5D /* KeyEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventIOS.mm; path = ios/KeyEventIOS.mm; sourceTree = "<group>"; };
26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; };
2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LayerFlushScheduler.cpp; path = ca/LayerFlushScheduler.cpp; sourceTree = "<group>"; };
2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerFlushScheduler.h; path = ca/LayerFlushScheduler.h; sourceTree = "<group>"; };
@@ -10631,8 +10633,6 @@
A5732B09136A161D005C8D7C /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = "<group>"; };
A5732B0C136A16C4005C8D7C /* LocalizedDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedDate.h; sourceTree = "<group>"; };
A5732B0E136A1715005C8D7C /* LocalizedDateNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalizedDateNone.cpp; sourceTree = "<group>"; };
- A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIPhone.h; path = iphone/KeyEventCodesIPhone.h; sourceTree = "<group>"; };
- A59E3C1D11580F510072928E /* KeyEventIPhone.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventIPhone.mm; path = iphone/KeyEventIPhone.mm; sourceTree = "<group>"; };
A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineBreakIteratorPoolICU.h; sourceTree = "<group>"; };
A5AFB34D115151A700B045CB /* StepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepRange.cpp; sourceTree = "<group>"; };
A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = "<group>"; };
@@ -17598,13 +17598,13 @@
name = parser;
sourceTree = "<group>";
};
- A59E3C1B11580F340072928E /* iphone */ = {
+ A59E3C1B11580F340072928E /* ios */ = {
isa = PBXGroup;
children = (
- A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */,
- A59E3C1D11580F510072928E /* KeyEventIPhone.mm */,
+ 265541371489811C000DFC5D /* KeyEventCodesIOS.h */,
+ 265541381489811C000DFC5D /* KeyEventIOS.mm */,
);
- name = iphone;
+ name = ios;
sourceTree = "<group>";
};
A5C974CE11485FDA0066F2AB /* cocoa */ = {
@@ -20061,7 +20061,7 @@
1AE42F670AA4B8CB00C8612D /* cf */,
A5C974CE11485FDA0066F2AB /* cocoa */,
B2A015910AF6CD53006BCE0E /* graphics */,
- A59E3C1B11580F340072928E /* iphone */,
+ A59E3C1B11580F340072928E /* ios */,
8CADF2A2135C7B36009EF43F /* leveldb */,
6582A14809999D6C00BEEB6D /* mac */,
59C77F101054591C00506104 /* mock */,
@@ -23604,7 +23604,6 @@
BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */,
85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */,
A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */,
- A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */,
316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */,
BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */,
521D46F811AEC9B100514613 /* KillRing.h in Headers */,
@@ -24745,6 +24744,7 @@
5038BF2B14750F190095E0D1 /* FilterOperations.h in Headers */,
6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextures.h in Headers */,
6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextures.h in Headers */,
+ 265541391489811C000DFC5D /* KeyEventCodesIOS.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -26694,7 +26694,6 @@
BCEFE1E50DCA5F3300739219 /* JSXSLTProcessorCustom.cpp in Sources */,
85031B430A44EFC700F992E0 /* KeyboardEvent.cpp in Sources */,
A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */,
- A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */,
935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */,
316FE1190E6E1DA700BF6088 /* KeyframeAnimation.cpp in Sources */,
BC5EBA100E823E4700B25965 /* KeyframeList.cpp in Sources */,
@@ -27619,6 +27618,7 @@
5038BF2A14750F190095E0D1 /* FilterOperations.cpp in Sources */,
6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */,
6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextures.cpp in Sources */,
+ 2655413A1489811C000DFC5D /* KeyEventIOS.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm (101866 => 101867)
--- trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm 2011-12-02 23:31:35 UTC (rev 101866)
+++ trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm 2011-12-02 23:36:06 UTC (rev 101867)
@@ -32,7 +32,7 @@
#import <wtf/ASCIICType.h>
#if PLATFORM(IOS)
-#import "KeyEventCodesIPhone.h"
+#import "KeyEventCodesIOS.h"
#endif
using namespace WTF;
Added: trunk/Source/WebCore/platform/ios/KeyEventCodesIOS.h (0 => 101867)
--- trunk/Source/WebCore/platform/ios/KeyEventCodesIOS.h (rev 0)
+++ trunk/Source/WebCore/platform/ios/KeyEventCodesIOS.h 2011-12-02 23:36:06 UTC (rev 101867)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 KeyEventCodesIOS_h
+#define KeyEventCodesIOS_h
+
+// Unicodes we reserve for function keys on the keyboard,
+// OpenStep reserves the range 0xF700-0xF8FF for this purpose.
+// The availability of various keys will be system dependent.
+
+enum {
+ NSUpArrowFunctionKey = 0xF700,
+ NSDownArrowFunctionKey = 0xF701,
+ NSLeftArrowFunctionKey = 0xF702,
+ NSRightArrowFunctionKey = 0xF703,
+ NSF1FunctionKey = 0xF704,
+ NSF2FunctionKey = 0xF705,
+ NSF3FunctionKey = 0xF706,
+ NSF4FunctionKey = 0xF707,
+ NSF5FunctionKey = 0xF708,
+ NSF6FunctionKey = 0xF709,
+ NSF7FunctionKey = 0xF70A,
+ NSF8FunctionKey = 0xF70B,
+ NSF9FunctionKey = 0xF70C,
+ NSF10FunctionKey = 0xF70D,
+ NSF11FunctionKey = 0xF70E,
+ NSF12FunctionKey = 0xF70F,
+ NSF13FunctionKey = 0xF710,
+ NSF14FunctionKey = 0xF711,
+ NSF15FunctionKey = 0xF712,
+ NSF16FunctionKey = 0xF713,
+ NSF17FunctionKey = 0xF714,
+ NSF18FunctionKey = 0xF715,
+ NSF19FunctionKey = 0xF716,
+ NSF20FunctionKey = 0xF717,
+ NSF21FunctionKey = 0xF718,
+ NSF22FunctionKey = 0xF719,
+ NSF23FunctionKey = 0xF71A,
+ NSF24FunctionKey = 0xF71B,
+ NSF25FunctionKey = 0xF71C,
+ NSF26FunctionKey = 0xF71D,
+ NSF27FunctionKey = 0xF71E,
+ NSF28FunctionKey = 0xF71F,
+ NSF29FunctionKey = 0xF720,
+ NSF30FunctionKey = 0xF721,
+ NSF31FunctionKey = 0xF722,
+ NSF32FunctionKey = 0xF723,
+ NSF33FunctionKey = 0xF724,
+ NSF34FunctionKey = 0xF725,
+ NSF35FunctionKey = 0xF726,
+ NSInsertFunctionKey = 0xF727,
+ NSDeleteFunctionKey = 0xF728,
+ NSHomeFunctionKey = 0xF729,
+ NSBeginFunctionKey = 0xF72A,
+ NSEndFunctionKey = 0xF72B,
+ NSPageUpFunctionKey = 0xF72C,
+ NSPageDownFunctionKey = 0xF72D,
+ NSPrintScreenFunctionKey = 0xF72E,
+ NSScrollLockFunctionKey = 0xF72F,
+ NSPauseFunctionKey = 0xF730,
+ NSSysReqFunctionKey = 0xF731,
+ NSBreakFunctionKey = 0xF732,
+ NSResetFunctionKey = 0xF733,
+ NSStopFunctionKey = 0xF734,
+ NSMenuFunctionKey = 0xF735,
+ NSUserFunctionKey = 0xF736,
+ NSSystemFunctionKey = 0xF737,
+ NSPrintFunctionKey = 0xF738,
+ NSClearLineFunctionKey = 0xF739,
+ NSClearDisplayFunctionKey = 0xF73A,
+ NSInsertLineFunctionKey = 0xF73B,
+ NSDeleteLineFunctionKey = 0xF73C,
+ NSInsertCharFunctionKey = 0xF73D,
+ NSDeleteCharFunctionKey = 0xF73E,
+ NSPrevFunctionKey = 0xF73F,
+ NSNextFunctionKey = 0xF740,
+ NSSelectFunctionKey = 0xF741,
+ NSExecuteFunctionKey = 0xF742,
+ NSUndoFunctionKey = 0xF743,
+ NSRedoFunctionKey = 0xF744,
+ NSFindFunctionKey = 0xF745,
+ NSHelpFunctionKey = 0xF746,
+ NSModeSwitchFunctionKey = 0xF747
+};
+
+enum {
+ NSParagraphSeparatorCharacter = 0x2029,
+ NSLineSeparatorCharacter = 0x2028,
+ NSTabCharacter = 0x0009,
+ NSFormFeedCharacter = 0x000c,
+ NSNewlineCharacter = 0x000a,
+ NSCarriageReturnCharacter = 0x000d,
+ NSEnterCharacter = 0x0003,
+ NSBackspaceCharacter = 0x0008,
+ NSBackTabCharacter = 0x0019,
+ NSDeleteCharacter = 0x007f
+};
+
+#endif // KeyEventCodesIOS_h
Added: trunk/Source/WebCore/platform/ios/KeyEventIOS.mm (0 => 101867)
--- trunk/Source/WebCore/platform/ios/KeyEventIOS.mm (rev 0)
+++ trunk/Source/WebCore/platform/ios/KeyEventIOS.mm 2011-12-02 23:36:06 UTC (rev 101867)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 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.
+ */
+
+#import "config.h"
+#import "PlatformKeyboardEvent.h"
+
+#if PLATFORM(IOS)
+
+#import "KeyEventCocoa.h"
+#import "Logging.h"
+#import "NotImplemented.h"
+#import "WebEvent.h"
+
+using namespace WTF;
+
+namespace WebCore {
+
+static String keyIdentifierForKeyEvent(WebEvent *event)
+{
+ NSString *s = event.charactersIgnoringModifiers;
+ if ([s length] != 1) {
+ LOG(Events, "received an unexpected number of characters in key event: %u", [s length]);
+ return "Unidentified";
+ }
+
+ unichar c = CFStringGetCharacterAtIndex((CFStringRef)s, 0);
+ return keyIdentifierForCharCode(c);
+}
+
+PlatformKeyboardEvent::PlatformKeyboardEvent(WebEvent *event)
+ : m_type(event.type == WebEventKeyUp ? PlatformKeyboardEvent::KeyUp : PlatformKeyboardEvent::KeyDown)
+ , m_text(event.characters)
+ , m_unmodifiedText(event.charactersIgnoringModifiers)
+ , m_keyIdentifier(keyIdentifierForKeyEvent(event))
+ , m_autoRepeat(event.isKeyRepeating)
+ , m_windowsVirtualKeyCode(event.keyCode)
+ , m_isKeypad(false) // iPhone does not distinguish the numpad <rdar://problem/7190835>
+ , m_shiftKey(event.modifierFlags & WebEventFlagMaskShift)
+ , m_ctrlKey(event.modifierFlags & WebEventFlagMaskControl)
+ , m_altKey(event.modifierFlags & WebEventFlagMaskAlternate)
+ , m_metaKey(event.modifierFlags & WebEventFlagMaskCommand)
+ , m_Event(event)
+{
+ ASSERT(event.type == WebEventKeyDown || event.type == WebEventKeyUp);
+
+ // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
+ if (m_windowsVirtualKeyCode == '\r') {
+ m_text = "\r";
+ m_unmodifiedText = "\r";
+ }
+
+ // The adjustments below are only needed in backward compatibility mode, but we cannot tell what mode we are in from here.
+
+ // Turn 0x7F into 8, because backspace needs to always be 8.
+ if (m_text == "\x7F")
+ m_text = "\x8";
+ if (m_unmodifiedText == "\x7F")
+ m_unmodifiedText = "\x8";
+ // Always use 9 for tab -- we don't want to use AppKit's different character for shift-tab.
+ if (m_windowsVirtualKeyCode == 9) {
+ m_text = "\x9";
+ m_unmodifiedText = "\x9";
+ }
+}
+
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode)
+{
+ // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.
+ ASSERT(m_type == KeyDown);
+ ASSERT(type == RawKeyDown || type == Char);
+ m_type = type;
+ if (backwardCompatibilityMode)
+ return;
+
+ if (type == RawKeyDown) {
+ m_text = String();
+ m_unmodifiedText = String();
+ } else {
+ m_keyIdentifier = String();
+ m_windowsVirtualKeyCode = 0;
+ if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7FF)) {
+ // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8FF for function keys. However, some actual private use characters
+ // happen to be in this range, e.g. the Apple logo (Option+Shift+K).
+ // 0xF7FF is an arbitrary cut-off.
+ m_text = String();
+ m_unmodifiedText = String();
+ }
+ }
+}
+
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+ notImplemented();
+ return false;
+}
+
+void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
+{
+ notImplemented();
+ shiftKey = false;
+ ctrlKey = false;
+ altKey = false;
+ metaKey = false;
+}
+
+}
+
+#endif // PLATFORM(IOS)