Start extracting platform specific bits out of PlatformEvents
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Dec 2011 03:45:50 +0000 (03:45 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Dec 2011 03:45:50 +0000 (03:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75063

Reviewed by Anders Carlsson.

Source/WebCore:

* WebCore.exp.in:
Update exports.

* WebCore.xcodeproj/project.pbxproj:
Add factory, remove implementation files for mac PlatformWheelEvent
and PlatformMouseEvent.

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::wheelEvent):
(WebCore::EventHandler::keyEvent):
(WebCore::EventHandler::currentPlatformMouseEvent):
Switch to use the factory.

* platform/PlatformEvent.h:
(WebCore::PlatformEvent::shiftKey):
(WebCore::PlatformEvent::ctrlKey):
(WebCore::PlatformEvent::altKey):
(WebCore::PlatformEvent::metaKey):
(WebCore::PlatformEvent::modifiers):
(WebCore::PlatformEvent::PlatformEvent):
Switch to storing the modifiers as bits on an unsigned
instead of as individual bools.

* platform/PlatformGestureEvent.h:
Remove unused timestamp member.

* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::keyIdentifier):
(WebCore::PlatformKeyboardEvent::macCharCode):
(WebCore::PlatformKeyboardEvent::isSystemKey):
Give this class a more consistent interface across platforms,
and remove constructor that took an NSEvent.

* platform/PlatformMouseEvent.h:
Remove constructor that took an NSEvent (and an unused constructor that took
many arguments) as well as some free functions for point conversion.

* platform/PlatformWheelEvent.h:
Remove constructor that took an NSEvent and an unnecessary override of the timestamp()
function.

* platform/mac/KeyEventMac.mm:
Removed constructor and moved helpers to PlatformEventFactory.

* platform/mac/PlatformEventFactory.h: Added.
* platform/mac/PlatformEventFactory.mm: Added.
(WebCore::globalPoint):
(WebCore::globalPointForEvent):
(WebCore::pointForEvent):
(WebCore::mouseButtonForEvent):
(WebCore::mouseEventTypeForEvent):
(WebCore::clickCountForEvent):
(WebCore::momentumPhaseForEvent):
(WebCore::phaseForEvent):
(WebCore::gestureEventTypeForEvent):
(WebCore::textFromEvent):
(WebCore::unmodifiedTextFromEvent):
(WebCore::keyIdentifierForKeyEvent):
(WebCore::isKeypadEvent):
(WebCore::windowsKeyCodeForKeyEvent):
(WebCore::isKeyUpEvent):
(WebCore::modifiersForEvent):
(WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
(WebCore::PlatformEventFactory::createPlatformMouseEvent):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
(WebCore::PlatformEventFactory::createPlatformWheelEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebCore::PlatformEventFactory::createPlatformKeyboardEvent):
(WebCore::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
(WebCore::PlatformEventFactory::createPlatformGestureEvent):
Consolidate platform event creation logic and add factory functions.

* platform/mac/PlatformMouseEventMac.mm: Removed.
* platform/mac/WheelEventMac.mm: Removed.

* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:
Expose wkGetNSEventKeyChar in WebCore.

* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/gtk/PlatformMouseEventGtk.cpp:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* platform/gtk/PlatformWheelEventGtk.cpp:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
* platform/qt/PlatformKeyboardEventQt.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/qt/PlatformMouseEventQt.cpp:
(WebCore::mouseEventModifiersFromQtKeyboardModifiers):
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* platform/qt/PlatformTouchEventQt.cpp:
(WebCore::PlatformTouchEvent::PlatformTouchEvent):
* platform/win/KeyEventWin.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/win/WheelEventWin.cpp:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
Update for new variables/names.

Source/WebKit/chromium:

* src/WebInputEventConversion.cpp:
(WebKit::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
(WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
(WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
(WebKit::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder):

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
* WebView/WebFrame.mm:
* WebView/WebHTMLView.mm:
(-[WebHTMLView menuForEvent:]):
(-[WebHTMLView acceptsFirstMouse:]):
(-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
(currentKeyboardEvent):
(-[WebHTMLView flagsChanged:]):
* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):
* WebView/WebView.mm:

Source/WebKit2:

* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
(WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
(WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
(WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
* UIProcess/API/mac/WKView.mm:
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

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

36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/platform/PlatformEvent.h
Source/WebCore/platform/PlatformGestureEvent.h
Source/WebCore/platform/PlatformKeyboardEvent.h
Source/WebCore/platform/PlatformMouseEvent.h
Source/WebCore/platform/PlatformWheelEvent.h
Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp
Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp
Source/WebCore/platform/mac/KeyEventMac.mm
Source/WebCore/platform/mac/PlatformEventFactory.h [new file with mode: 0644]
Source/WebCore/platform/mac/PlatformEventFactory.mm [new file with mode: 0644]
Source/WebCore/platform/mac/PlatformMouseEventMac.mm [deleted file]
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/mac/WheelEventMac.mm [deleted file]
Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
Source/WebCore/platform/qt/PlatformMouseEventQt.cpp
Source/WebCore/platform/qt/PlatformTouchEventQt.cpp
Source/WebCore/platform/win/KeyEventWin.cpp
Source/WebCore/platform/win/WheelEventWin.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebInputEventConversion.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebPDFView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebEventConversion.cpp
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

index ff1ce5e..1a8ce85 100644 (file)
@@ -1,3 +1,109 @@
+2011-12-23  Sam Weinig  <sam@webkit.org>
+
+        Start extracting platform specific bits out of PlatformEvents
+        https://bugs.webkit.org/show_bug.cgi?id=75063
+
+        Reviewed by Anders Carlsson.
+
+        * WebCore.exp.in:
+        Update exports.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add factory, remove implementation files for mac PlatformWheelEvent
+        and PlatformMouseEvent.
+
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::wheelEvent):
+        (WebCore::EventHandler::keyEvent):
+        (WebCore::EventHandler::currentPlatformMouseEvent):
+        Switch to use the factory.
+
+        * platform/PlatformEvent.h:
+        (WebCore::PlatformEvent::shiftKey):
+        (WebCore::PlatformEvent::ctrlKey):
+        (WebCore::PlatformEvent::altKey):
+        (WebCore::PlatformEvent::metaKey):
+        (WebCore::PlatformEvent::modifiers):
+        (WebCore::PlatformEvent::PlatformEvent):
+        Switch to storing the modifiers as bits on an unsigned
+        instead of as individual bools.
+
+        * platform/PlatformGestureEvent.h:
+        Remove unused timestamp member.
+
+        * platform/PlatformKeyboardEvent.h:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        (WebCore::PlatformKeyboardEvent::keyIdentifier):
+        (WebCore::PlatformKeyboardEvent::macCharCode):
+        (WebCore::PlatformKeyboardEvent::isSystemKey):
+        Give this class a more consistent interface across platforms,
+        and remove constructor that took an NSEvent.
+
+        * platform/PlatformMouseEvent.h:
+        Remove constructor that took an NSEvent (and an unused constructor that took
+        many arguments) as well as some free functions for point conversion.
+
+        * platform/PlatformWheelEvent.h:
+        Remove constructor that took an NSEvent and an unnecessary override of the timestamp()
+        function.
+
+        * platform/mac/KeyEventMac.mm:
+        Removed constructor and moved helpers to PlatformEventFactory.
+
+        * platform/mac/PlatformEventFactory.h: Added.
+        * platform/mac/PlatformEventFactory.mm: Added.
+        (WebCore::globalPoint):
+        (WebCore::globalPointForEvent):
+        (WebCore::pointForEvent):
+        (WebCore::mouseButtonForEvent):
+        (WebCore::mouseEventTypeForEvent):
+        (WebCore::clickCountForEvent):
+        (WebCore::momentumPhaseForEvent):
+        (WebCore::phaseForEvent):
+        (WebCore::gestureEventTypeForEvent):
+        (WebCore::textFromEvent):
+        (WebCore::unmodifiedTextFromEvent):
+        (WebCore::keyIdentifierForKeyEvent):
+        (WebCore::isKeypadEvent):
+        (WebCore::windowsKeyCodeForKeyEvent):
+        (WebCore::isKeyUpEvent):
+        (WebCore::modifiersForEvent):
+        (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+        (WebCore::PlatformEventFactory::createPlatformMouseEvent):
+        (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
+        (WebCore::PlatformEventFactory::createPlatformWheelEvent):
+        (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
+        (WebCore::PlatformEventFactory::createPlatformKeyboardEvent):
+        (WebCore::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+        (WebCore::PlatformEventFactory::createPlatformGestureEvent):
+        Consolidate platform event creation logic and add factory functions.
+
+        * platform/mac/PlatformMouseEventMac.mm: Removed.
+        * platform/mac/WheelEventMac.mm: Removed.
+
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        Expose wkGetNSEventKeyChar in WebCore.
+
+        * platform/gtk/PlatformKeyboardEventGtk.cpp:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        * platform/gtk/PlatformMouseEventGtk.cpp:
+        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+        * platform/gtk/PlatformWheelEventGtk.cpp:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+        * platform/qt/PlatformKeyboardEventQt.cpp:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        * platform/qt/PlatformMouseEventQt.cpp:
+        (WebCore::mouseEventModifiersFromQtKeyboardModifiers):
+        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+        * platform/qt/PlatformTouchEventQt.cpp:
+        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
+        * platform/win/KeyEventWin.cpp:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        * platform/win/WheelEventWin.cpp:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+        Update for new variables/names.
+
 2011-12-22  Andreas Kling  <kling@webkit.org>
 
         CSSParser: Avoid creating dummy declaration in parseColor() slow path.
index f5dc000..de3e77f 100644 (file)
@@ -157,6 +157,7 @@ __ZN7WebCore10toDocumentEN3JSC7JSValueE
 __ZN7WebCore11BitmapImageC1EP7CGImagePNS_13ImageObserverE
 __ZN7WebCore11CachedFrame23cachedFramePlatformDataEv
 __ZN7WebCore11CachedFrame26setCachedFramePlatformDataEN3WTF10PassOwnPtrINS_23CachedFramePlatformDataEEE
+__ZN7WebCore11CachedImage5imageEv
 __ZN7WebCore11FileChooser10chooseFileERKN3WTF6StringE
 __ZN7WebCore11FileChooser11chooseFilesERKN3WTF6VectorINS1_6StringELm0EEE
 __ZN7WebCore11FileChooserD1Ev
@@ -292,8 +293,8 @@ __ZN7WebCore12SharedBufferD1Ev
 __ZN7WebCore12SpellChecker8didCheckEiRKN3WTF6VectorINS_18TextCheckingResultELm0EEE
 __ZN7WebCore12TextEncodingC1ERKN3WTF6StringE
 __ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb
-__ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_
 __ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib
+__ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_
 __ZN7WebCore12TextIterator7advanceEv
 __ZN7WebCore12TextIterator8subrangeEPNS_5RangeEii
 __ZN7WebCore12TextIteratorC1EPKNS_5RangeENS_20TextIteratorBehaviorE
@@ -365,8 +366,8 @@ __ZN7WebCore14SchemeRegistry25registerURLSchemeAsSecureERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry32registerURLSchemeAsEmptyDocumentERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry34shouldLoadURLSchemeAsEmptyDocumentERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry40setDomainRelaxationForbiddenForURLSchemeEbRKN3WTF6StringE
-__ZN7WebCore14SchemeRegistry62registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsingERKN3WTF6StringE
 __ZN7WebCore14SchemeRegistry58registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsingERKN3WTF6StringE
+__ZN7WebCore14SchemeRegistry62registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsingERKN3WTF6StringE
 __ZN7WebCore14ScrollableArea15contentsResizedEv
 __ZN7WebCore14ScrollableArea16handleWheelEventERKNS_18PlatformWheelEventE
 __ZN7WebCore14ScrollableArea17willEndLiveResizeEv
@@ -393,15 +394,15 @@ __ZN7WebCore14SecurityPolicy22generateReferrerHeaderENS0_14ReferrerPolicyERKNS_4
 __ZN7WebCore14SecurityPolicy27resetOriginAccessWhitelistsEv
 __ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
 __ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
-__ZN7WebCore14StorageTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0EEE
-__ZN7WebCore14StorageTracker7trackerEv
-__ZN7WebCore14StorageTracker9setClientEPNS_20StorageTrackerClientE
 __ZN7WebCore14StorageTracker12deleteOriginEPNS_14SecurityOriginE
 __ZN7WebCore14StorageTracker16deleteAllOriginsEv
 __ZN7WebCore14StorageTracker16syncLocalStorageEv
 __ZN7WebCore14StorageTracker17initializeTrackerERKN3WTF6StringEPNS_20StorageTrackerClientE
 __ZN7WebCore14StorageTracker18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore14StorageTracker32syncFileSystemAndTrackerDatabaseEv
+__ZN7WebCore14StorageTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0EEE
+__ZN7WebCore14StorageTracker7trackerEv
+__ZN7WebCore14StorageTracker9setClientEPNS_20StorageTrackerClientE
 __ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
 __ZN7WebCore15AffineTransform5flipYEv
 __ZN7WebCore15AffineTransform5scaleEd
@@ -433,8 +434,8 @@ __ZN7WebCore15GraphicsContext11clearShadowEv
 __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext15setFillGradientEN3WTF10PassRefPtrINS_8GradientEEE
 __ZN7WebCore15GraphicsContext18setShouldAntialiasEb
-__ZN7WebCore15GraphicsContext20setShouldSmoothFontsEb
 __ZN7WebCore15GraphicsContext20endTransparencyLayerEv
+__ZN7WebCore15GraphicsContext20setShouldSmoothFontsEb
 __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE
 __ZN7WebCore15GraphicsContext22applyDeviceScaleFactorEf
 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
@@ -539,7 +540,6 @@ __ZN7WebCore17RegularExpressionC1ERKN3WTF6StringENS1_19TextCaseSensitivityE
 __ZN7WebCore17RegularExpressionD1Ev
 __ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE
 __ZN7WebCore17openTemporaryFileERKN3WTF6StringERi
-__ZN7WebCore18PlatformMouseEventC1EP7NSEventP6NSView
 __ZN7WebCore18PlatformStrategies26createLocalizationStrategyEv
 __ZN7WebCore18SearchPopupMenuMacC1EPNS_15PopupMenuClientE
 __ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
@@ -588,6 +588,8 @@ __ZN7WebCore20DisplaySleepDisablerC1EPKc
 __ZN7WebCore20DisplaySleepDisablerD1Ev
 __ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE
 __ZN7WebCore20NodeRenderingContextD1Ev
+__ZN7WebCore20PlatformEventFactory24createPlatformMouseEventEP7NSEventP6NSView
+__ZN7WebCore20PlatformEventFactory27createPlatformKeyboardEventEP7NSEvent
 __ZN7WebCore20RenderEmbeddedObject30setShowsCrashedPluginIndicatorEv
 __ZN7WebCore20ResourceResponseBase11setMimeTypeERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase17setHTTPStatusCodeEi
@@ -605,7 +607,6 @@ __ZN7WebCore20makeRGBA32FromFloatsEffff
 __ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
 __ZN7WebCore21BackForwardController11itemAtIndexEi
 __ZN7WebCore21MemoryPressureHandler7installEv
-__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
 __ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
 __ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
 __ZN7WebCore21ResourceLoadScheduler24schedulePluginStreamLoadEPNS_5FrameEPNS_32NetscapePlugInStreamLoaderClientERKNS_15ResourceRequestE
@@ -661,8 +662,6 @@ __ZN7WebCore25PluginMainThreadScheduler16unregisterPluginEP4_NPP
 __ZN7WebCore25PluginMainThreadScheduler9schedulerEv
 __ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E
 __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiiiNS_7IntSizeE
-__ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE
-__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
 __ZN7WebCore25contextMenuItemTagOutlineEv
 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev
 __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv
@@ -720,6 +719,7 @@ __ZN7WebCore37contextMenuItemTagTransformationsMenuEv
 __ZN7WebCore38contextMenuItemTagWritingDirectionMenuEv
 __ZN7WebCore3macERKNS_10CredentialE
 __ZN7WebCore3macERKNS_23AuthenticationChallengeE
+__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
 __ZN7WebCore42contextMenuItemTagCheckGrammarWithSpellingEv
 __ZN7WebCore42contextMenuItemTagCheckSpellingWhileTypingEv
 __ZN7WebCore46contextMenuItemTagCorrectSpellingAutomaticallyEv
@@ -786,6 +786,7 @@ __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE
+__ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE
 __ZN7WebCore5Color11transparentE
 __ZN7WebCore5Color5whiteE
 __ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
@@ -837,9 +838,9 @@ __ZN7WebCore6Editor21applyStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditAc
 __ZN7WebCore6Editor21isSelectionMisspelledEv
 __ZN7WebCore6Editor23setBaseWritingDirectionE16WritingDirection
 __ZN7WebCore6Editor24advanceToNextMisspellingEb
-__ZN7WebCore6Editor24replaceSelectionWithTextERKN3WTF6StringEbb
 __ZN7WebCore6Editor24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore6Editor24isSelectionUngrammaticalEv
+__ZN7WebCore6Editor24replaceSelectionWithTextERKN3WTF6StringEbb
 __ZN7WebCore6Editor26decreaseSelectionListLevelEv
 __ZN7WebCore6Editor26increaseSelectionListLevelEv
 __ZN7WebCore6Editor26writeSelectionToPasteboardERKN3WTF6StringERKNS1_6VectorIS2_Lm0EEE
@@ -927,6 +928,7 @@ __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEiNS0_10AnchorTypeE
 __ZN7WebCore8Settings14setJavaEnabledEb
 __ZN7WebCore8Settings15setWebGLEnabledEb
+__ZN7WebCore8Settings16setScriptEnabledEb
 __ZN7WebCore8Settings16setUsesPageCacheEb
 __ZN7WebCore8Settings17setPluginsEnabledEb
 __ZN7WebCore8Settings18setDOMPasteAllowedEb
@@ -939,7 +941,6 @@ __ZN7WebCore8Settings19minDOMTimerIntervalEv
 __ZN7WebCore8Settings19setShowDebugBordersEb
 __ZN7WebCore8Settings20setCursiveFontFamilyERKN3WTF12AtomicStringE11UScriptCode
 __ZN7WebCore8Settings20setFantasyFontFamilyERKN3WTF12AtomicStringE11UScriptCode
-__ZN7WebCore8Settings16setScriptEnabledEb
 __ZN7WebCore8Settings20setXSSAuditorEnabledEb
 __ZN7WebCore8Settings21setShowRepaintCounterEb
 __ZN7WebCore8Settings21setStandardFontFamilyERKN3WTF12AtomicStringE11UScriptCode
@@ -1026,7 +1027,6 @@ __ZN7WebCore9FrameView17setScrollPositionERKNS_8IntPointE
 __ZN7WebCore9FrameView17setTracksRepaintsEb
 __ZN7WebCore9FrameView18updateControlTintsEv
 __ZN7WebCore9FrameView19scrollElementToRectEPNS_7ElementERKNS_7IntRectE
-__ZN7WebCore9FrameView43setShouldLayoutFixedElementsRelativeToFrameEb
 __ZN7WebCore9FrameView20enterCompositingModeEv
 __ZN7WebCore9FrameView21flushDeferredRepaintsEv
 __ZN7WebCore9FrameView22setBaseBackgroundColorERKNS_5ColorE
@@ -1037,6 +1037,7 @@ __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
 __ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
 __ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetEv
 __ZN7WebCore9FrameView38syncCompositingStateIncludingSubframesEv
+__ZN7WebCore9FrameView43setShouldLayoutFixedElementsRelativeToFrameEb
 __ZN7WebCore9FrameView6createEPNS_5FrameE
 __ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE
 __ZN7WebCore9HTMLNames10listingTagE
@@ -1133,13 +1134,12 @@ __ZNK7WebCore10ScrollView14scrollbarModesERNS_13ScrollbarModeES2_
 __ZNK7WebCore10ScrollView14useFixedLayoutEv
 __ZNK7WebCore10ScrollView15fixedLayoutSizeEv
 __ZNK7WebCore10ScrollView16contentsToWindowERKNS_7IntRectE
-__ZNK7WebCore10ScrollView16windowToContentsERKNS_7IntRectE
 __ZNK7WebCore10ScrollView16contentsToWindowERKNS_8IntPointE
+__ZNK7WebCore10ScrollView16windowToContentsERKNS_7IntRectE
 __ZNK7WebCore10ScrollView16windowToContentsERKNS_8IntPointE
-__ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_7IntRectE
 __ZNK7WebCore10ScrollView18contentsToRootViewERKNS_8IntPointE
-__ZN7WebCore11CachedImage5imageEv
+__ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore11FrameLoader10isCompleteEv
 __ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14frameHasLoadedEv
@@ -1174,11 +1174,11 @@ __ZNK7WebCore11ScriptValue9getStringEPN3JSC9ExecStateERN3WTF6StringE
 __ZNK7WebCore12IconDatabase12databasePathEv
 __ZNK7WebCore12IconDatabase24shouldStopThreadActivityEv
 __ZNK7WebCore12IconDatabase9isEnabledEv
-__ZNK7WebCore12RenderObject23absoluteBoundingBoxRectEb
+__ZNK7WebCore12RenderObject13styleInRegionEv
 __ZNK7WebCore12RenderObject14enclosingLayerEv
 __ZNK7WebCore12RenderObject15localToAbsoluteERKNS_10FloatPointEbb
+__ZNK7WebCore12RenderObject23absoluteBoundingBoxRectEb
 __ZNK7WebCore12RenderObject7childAtEj
-__ZNK7WebCore12RenderObject13styleInRegionEv
 __ZNK7WebCore12RenderWidget14windowClipRectEv
 __ZNK7WebCore12SharedBuffer11getSomeDataERPKcj
 __ZNK7WebCore12SharedBuffer4dataEv
@@ -1490,6 +1490,7 @@ _wkGetHTTPCookieAcceptPolicy
 _wkGetHTTPPipeliningPriority
 _wkGetHyphenationLocationBeforeIndex
 _wkGetMIMETypeForExtension
+_wkGetNSEventKeyChar
 _wkGetNSURLResponseCalculatedExpiration
 _wkGetNSURLResponseLastModifiedDate
 _wkGetNSURLResponseMustRevalidate
index 8b84ea2..3273889 100644 (file)
                1ABFE7530CD968D000FE4834 /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABFE7520CD968D000FE4834 /* SQLTransaction.cpp */; };
                1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
                1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
-               1AC6926A14A1253200BD85F1 /* ScrollableAreaClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC6926914A1253100BD85F1 /* ScrollableAreaClient.h */; };
                1ACD1B630B029739007E5016 /* DOMCSSStyleDeclarationInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E711440AC5D5340053270F /* DOMCSSStyleDeclarationInternal.h */; };
                1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */; };
                1ACE53E00A8D18810022947D /* JSDOMParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACE53DE0A8D18810022947D /* JSDOMParser.h */; };
                935C476B09AC4D4F00A6AAB4 /* PlatformWheelEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935C476D09AC4D6300A6AAB4 /* FoundationExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */; };
-               935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */; };
-               935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C477209AC4D7700A6AAB4 /* WheelEventMac.mm */; };
                935C477509AC4D8E00A6AAB4 /* GapRects.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C477409AC4D8D00A6AAB4 /* GapRects.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935F45400F7C3B5F00D7C1FB /* JSLazyEventListener.cpp */; };
                935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 935F45410F7C3B5F00D7C1FB /* JSLazyEventListener.h */; };
                BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */; };
                BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */; };
                BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BCAA486F14A052530088FAC4 /* PlatformEventFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCAA486D14A052530088FAC4 /* PlatformEventFactory.mm */; };
+               BCAA487014A052530088FAC4 /* PlatformEventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAA486E14A052530088FAC4 /* PlatformEventFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */; };
                BCAB418113E356E800D8AAF3 /* Region.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAB417F13E356E800D8AAF3 /* Region.cpp */; };
                BCAB418213E356E800D8AAF3 /* Region.h in Headers */ = {isa = PBXBuildFile; fileRef = BCAB418013E356E800D8AAF3 /* Region.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWheelEvent.h; sourceTree = "<group>"; };
                935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationExtras.h; sourceTree = "<group>"; };
                935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyEventMac.mm; sourceTree = "<group>"; };
-               935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformMouseEventMac.mm; sourceTree = "<group>"; };
-               935C477209AC4D7700A6AAB4 /* WheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WheelEventMac.mm; sourceTree = "<group>"; };
                935C477409AC4D8D00A6AAB4 /* GapRects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GapRects.h; sourceTree = "<group>"; };
                935F45400F7C3B5F00D7C1FB /* JSLazyEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSLazyEventListener.cpp; sourceTree = "<group>"; };
                935F45410F7C3B5F00D7C1FB /* JSLazyEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSLazyEventListener.h; sourceTree = "<group>"; };
                BCA8C81D11E3D36900812FB7 /* BackForwardController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardController.cpp; sourceTree = "<group>"; };
                BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardListImpl.cpp; sourceTree = "<group>"; };
                BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardListImpl.h; sourceTree = "<group>"; };
+               BCAA486D14A052530088FAC4 /* PlatformEventFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformEventFactory.mm; sourceTree = "<group>"; };
+               BCAA486E14A052530088FAC4 /* PlatformEventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformEventFactory.h; sourceTree = "<group>"; };
                BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Scrollbar.cpp; sourceTree = "<group>"; };
                BCAB417F13E356E800D8AAF3 /* Region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Region.cpp; sourceTree = "<group>"; };
                BCAB418013E356E800D8AAF3 /* Region.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Region.h; sourceTree = "<group>"; };
                                52F52E1014A0134F00ACC397 /* NSScrollerImpDetails.mm */,
                                A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */,
                                4B2709810AF2E5E00065127F /* PasteboardMac.mm */,
-                               935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
                                BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
                                D39D006C11F8E308006041F2 /* PopupMenuMac.h */,
                                0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */,
                                CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */,
                                CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */,
                                CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */,
-                               935C477209AC4D7700A6AAB4 /* WheelEventMac.mm */,
                                9380F47709A11ACC001FDB34 /* WidgetMac.mm */,
                                CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */,
                                CDEA762F146084EE008B31F1 /* PlatformClockCA.h */,
+                               BCAA486D14A052530088FAC4 /* PlatformEventFactory.mm */,
+                               BCAA486E14A052530088FAC4 /* PlatformEventFactory.h */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                1A2F9D7A14968C740065AC63 /* ScrollingCoordinator.h in Headers */,
                                1AA7160B149BC4DB0016EC19 /* TileCache.h in Headers */,
                                C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */,
-                               1AC6926A14A1253200BD85F1 /* ScrollableAreaClient.h in Headers */,
                                FDB1700614A2BAB200A2B5D9 /* MultiChannelResampler.h in Headers */,
                                FD00D7A514A3F61900734011 /* SincResampler.h in Headers */,
+                               BCAA487014A052530088FAC4 /* PlatformEventFactory.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                4958782112A57DDF007238AC /* PlatformCAAnimationMac.mm in Sources */,
                                4958782212A57DDF007238AC /* PlatformCALayerMac.mm in Sources */,
                                41BF700F0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp in Sources */,
-                               935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */,
                                BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */,
                                1AD8F81C11CAB9E900E93E54 /* PlatformStrategies.cpp in Sources */,
                                A9C6E4F30D745E48006442E9 /* PluginData.cpp in Sources */,
                                CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */,
                                F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */,
                                85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */,
-                               935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */,
                                9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */,
                                9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */,
                                939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */,
                                52F52E1114A0134F00ACC397 /* NSScrollerImpDetails.mm in Sources */,
                                FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */,
                                FD00D7A414A3F61900734011 /* SincResampler.cpp in Sources */,
+                               BCAA486F14A052530088FAC4 /* PlatformEventFactory.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 82aa79e..5f91132 100644 (file)
@@ -41,8 +41,7 @@
 #include "MouseEventWithHitTestResults.h"
 #include "NotImplemented.h"
 #include "Page.h"
-#include "PlatformKeyboardEvent.h"
-#include "PlatformWheelEvent.h"
+#include "PlatformEventFactory.h"
 #include "RenderWidget.h"
 #include "RuntimeApplicationChecks.h"
 #include "Scrollbar.h"
@@ -104,9 +103,7 @@ bool EventHandler::wheelEvent(NSEvent *event)
         return false;
 
     CurrentEventScope scope(event);
-
-    PlatformWheelEvent wheelEvent(event, page->chrome()->platformPageClient());
-    return handleWheelEvent(wheelEvent);
+    return handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event, page->chrome()->platformPageClient()));
 }
 
 bool EventHandler::keyEvent(NSEvent *event)
@@ -116,7 +113,7 @@ bool EventHandler::keyEvent(NSEvent *event)
     ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
 
     CurrentEventScope scope(event);
-    return keyEvent(PlatformKeyboardEvent(event));
+    return keyEvent(PlatformEventFactory::createPlatformKeyboardEvent(event));
 
     END_BLOCK_OBJC_EXCEPTIONS;
 
@@ -646,7 +643,7 @@ PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const
     NSView *windowView = nil;
     if (Page* page = m_frame->page())
         windowView = page->chrome()->platformPageClient();
-    return PlatformMouseEvent(currentNSEvent(), windowView);
+    return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), windowView);
 }
 
 bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
index a32d280..77d447e 100644 (file)
@@ -65,59 +65,59 @@ public:
 #endif
     };
 
-    enum ModifierKey {
-        AltKey = 1 << 0,
-        CtrlKey = 1 << 1,
-        MetaKey = 1 << 2,
-        ShiftKey = 1 << 3
+    enum Modifiers {
+        AltKey      = 1 << 0,
+        CtrlKey     = 1 << 1,
+        MetaKey     = 1 << 2,
+        ShiftKey    = 1 << 3,
     };
 
     Type type() const { return static_cast<Type>(m_type); }
 
-    bool shiftKey() const { return m_shiftKey; }
-    bool ctrlKey() const { return m_ctrlKey; }
-    bool altKey() const { return m_altKey; }
-    bool metaKey() const { return m_metaKey; }
+    bool shiftKey() const { return m_modifiers & ShiftKey; }
+    bool ctrlKey() const { return m_modifiers & CtrlKey; }
+    bool altKey() const { return m_modifiers & AltKey; }
+    bool metaKey() const { return m_modifiers & MetaKey; }
 
-    unsigned modifiers() const
-    {
-        return (altKey() ? AltKey : 0)
-            | (ctrlKey() ? CtrlKey : 0)
-            | (metaKey() ? MetaKey : 0)
-            | (shiftKey() ? ShiftKey : 0);
-    }
+    unsigned modifiers() const { return m_modifiers; }
 
     double timestamp() const { return m_timestamp; }
 
 protected:
     PlatformEvent()
         : m_type(NoType)
-        , m_shiftKey(false)
-        , m_ctrlKey(false)
-        , m_altKey(false)
-        , m_metaKey(false)
+        , m_modifiers(0)
         , m_timestamp(0)
     {
     }
 
     PlatformEvent(Type type)
         : m_type(type)
-        , m_shiftKey(false)
-        , m_ctrlKey(false)
-        , m_altKey(false)
-        , m_metaKey(false)
+        , m_modifiers(0)
         , m_timestamp(0)
     {
     }
 
+    PlatformEvent(Type type, Modifiers modifiers, double timestamp)
+        : m_type(type)
+        , m_modifiers(modifiers)
+        , m_timestamp(timestamp)
+    {
+    }
+
     PlatformEvent(Type type, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
         : m_type(type)
-        , m_shiftKey(shiftKey)
-        , m_ctrlKey(ctrlKey)
-        , m_altKey(altKey)
-        , m_metaKey(metaKey)
+        , m_modifiers(0)
         , m_timestamp(timestamp)
     {
+        if (shiftKey)
+            m_modifiers |= ShiftKey;
+        if (ctrlKey)
+            m_modifiers |= CtrlKey;
+        if (altKey)
+            m_modifiers |= AltKey;
+        if (metaKey)
+            m_modifiers |= MetaKey;
     }
 
     // Explicit protected destructor so that people don't accidentally
@@ -127,10 +127,7 @@ protected:
     }
 
     unsigned m_type;
-    bool m_shiftKey;
-    bool m_ctrlKey;
-    bool m_altKey;
-    bool m_metaKey;
+    unsigned m_modifiers;
     double m_timestamp;
 };
 
index 55fe8ef..e313be5 100644 (file)
@@ -60,7 +60,6 @@ public:
 protected:
     IntPoint m_position;
     IntPoint m_globalPosition;
-    double m_timestamp;
     float m_deltaX;
     float m_deltaY;
 };
index 2ed1a0a..f154966 100644 (file)
@@ -70,13 +70,12 @@ namespace WebCore {
     public:
         PlatformKeyboardEvent()
             : PlatformEvent(PlatformEvent::KeyDown)
-            , m_autoRepeat(false)
             , m_windowsVirtualKeyCode(0)
             , m_nativeVirtualKeyCode(0)
+            , m_macCharCode(0)
+            , m_autoRepeat(false)
             , m_isKeypad(false)
-#if PLATFORM(WIN) || PLATFORM(CHROMIUM)
             , m_isSystemKey(false)
-#endif
 #if PLATFORM(GTK)
             , m_gdkEventKey(0)
 #endif
@@ -86,6 +85,20 @@ namespace WebCore {
         {
         }
 
+        PlatformKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+            : PlatformEvent(type, modifiers, timestamp)
+            , m_text(text)
+            , m_unmodifiedText(unmodifiedText)
+            , m_keyIdentifier(keyIdentifier)
+            , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
+            , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
+            , m_macCharCode(macCharCode)
+            , m_autoRepeat(isAutoRepeat)
+            , m_isKeypad(isKeypad)
+            , m_isSystemKey(isSystemKey)
+        {
+        }
+
         void disambiguateKeyDownEvent(Type, bool backwardCompatibilityMode = false); // Only used on platforms that need it, i.e. those that generate KeyDown events.
 
         // Text as as generated by processing a virtual key code with a keyboard layout
@@ -101,24 +114,24 @@ namespace WebCore {
         // Otherwise, same as text().
         String unmodifiedText() const { return m_unmodifiedText; }
 
+        String keyIdentifier() const { return m_keyIdentifier; }
+
         // Most compatible Windows virtual key code associated with the event.
         // Zero for Char events.
         int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
         void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
 
         int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
-        void setNativeVirtualKeyCode(int code) { m_nativeVirtualKeyCode = code; }
+        int macCharCode() const { return m_macCharCode; }
 
-        String keyIdentifier() const { return m_keyIdentifier; }
         bool isAutoRepeat() const { return m_autoRepeat; }
-        void setIsAutoRepeat(bool in) { m_autoRepeat = in; }
         bool isKeypad() const { return m_isKeypad; }
+        bool isSystemKey() const { return m_isSystemKey; }
 
         static bool currentCapsLockState();
         static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey);
 
 #if PLATFORM(MAC)
-        PlatformKeyboardEvent(NSEvent*);
         NSEvent* macEvent() const { return m_macEvent.get(); }
 #endif
 
@@ -147,10 +160,6 @@ namespace WebCore {
         PlatformKeyboardEvent(wxKeyEvent&);
 #endif
 
-#if PLATFORM(WIN) || PLATFORM(CHROMIUM)
-        bool isSystemKey() const { return m_isSystemKey; }
-#endif
-
 #if PLATFORM(EFL)
         PlatformKeyboardEvent(const Evas_Event_Key_Down*);
         PlatformKeyboardEvent(const Evas_Event_Key_Up*);
@@ -160,17 +169,16 @@ namespace WebCore {
         String m_text;
         String m_unmodifiedText;
         String m_keyIdentifier;
-        bool m_autoRepeat;
         int m_windowsVirtualKeyCode;
         int m_nativeVirtualKeyCode;
+        int m_macCharCode;
+        bool m_autoRepeat;
         bool m_isKeypad;
+        bool m_isSystemKey;
 
 #if PLATFORM(MAC)
         RetainPtr<NSEvent> m_macEvent;
 #endif
-#if PLATFORM(WIN) || PLATFORM(CHROMIUM)
-        bool m_isSystemKey;
-#endif
 #if PLATFORM(GTK)
         GdkEventKey* m_gdkEventKey;
 #endif
index b3a4067..a3dcce4 100644 (file)
@@ -119,12 +119,6 @@ namespace WebCore {
 #endif
 
 #if PLATFORM(MAC)
-#if defined(__OBJC__)
-        PlatformMouseEvent(NSEvent *, NSView *windowView);
-#endif
-        PlatformMouseEvent(int x, int y, int globalX, int globalY, MouseButton, PlatformEvent::Type,
-                           int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp,
-                           unsigned modifierFlags, int eventNumber);
         int eventNumber() const { return m_eventNumber; }
 #endif
 
@@ -160,12 +154,6 @@ namespace WebCore {
 #endif
     };
 
-#if PLATFORM(MAC) && defined(__OBJC__)
-    IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *);
-    IntPoint pointForEvent(NSEvent *, NSView *windowView);
-    IntPoint globalPointForEvent(NSEvent *);
-#endif
-
 } // namespace WebCore
 
 #endif // PlatformMouseEvent_h
index ba91054..8e99e47 100644 (file)
@@ -154,17 +154,10 @@ namespace WebCore {
         PlatformWheelEvent(const Evas_Event_Mouse_Wheel*);
 #endif
 
-#if PLATFORM(MAC)
-#if defined(__OBJC__)
-        PlatformWheelEvent(NSEvent *, NSView *windowView);
-#endif
-#endif
-
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
         PlatformWheelEventPhase phase() const { return m_phase; }
         PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
         bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
-        double timestamp() const { return m_timestamp; }
 #endif
 
 #if PLATFORM(QT)
index 53ef78b..3a2409d 100644 (file)
@@ -552,10 +552,12 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event)
     , m_text(singleCharacterString(event->keyval))
     , m_unmodifiedText(singleCharacterString(event->keyval))
     , m_keyIdentifier(keyIdentifierForGdkKeyCode(event->keyval))
-    , m_autoRepeat(false)
     , m_windowsVirtualKeyCode(windowsKeyCodeForGdkKeyCode(event->keyval))
     , m_nativeVirtualKeyCode(event->keyval)
+    , m_macCharCode(0)
+    , m_autoRepeat(false)
     , m_isKeypad(event->keyval >= GDK_KP_Space && event->keyval <= GDK_KP_9)
+    , m_isSystemKey(false)
     , m_gdkEventKey(event)
 {
 }
index 879e8cc..4e6200f 100644 (file)
@@ -41,10 +41,16 @@ PlatformMouseEvent::PlatformMouseEvent(GdkEventButton* event)
     m_timestamp = event->time;
     m_position = IntPoint((int)event->x, (int)event->y);
     m_globalPosition = IntPoint((int)event->x_root, (int)event->y_root);
-    m_shiftKey = event->state & GDK_SHIFT_MASK;
-    m_ctrlKey = event->state & GDK_CONTROL_MASK;
-    m_altKey = event->state & GDK_MOD1_MASK;
-    m_metaKey = event->state & GDK_META_MASK;
+
+    m_modifiers = 0;
+    if (event->state & GDK_SHIFT_MASK)
+        m_modifiers |= ShiftKey;
+    if (event->state & GDK_CONTROL_MASK)
+        m_modifiers |= CtrlKey;
+    if (event->state & GDK_MOD1_MASK)
+        m_modifiers |= AltKey;
+    if (event->state & GDK_META_MASK)
+        m_modifiers |= MetaKey;
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
@@ -80,10 +86,16 @@ PlatformMouseEvent::PlatformMouseEvent(GdkEventMotion* motion)
     m_timestamp = motion->time;
     m_position = IntPoint((int)motion->x, (int)motion->y);
     m_globalPosition = IntPoint((int)motion->x_root, (int)motion->y_root);
-    m_shiftKey = motion->state & GDK_SHIFT_MASK;
-    m_ctrlKey = motion->state & GDK_CONTROL_MASK;
-    m_altKey = motion->state & GDK_MOD1_MASK;
-    m_metaKey = motion->state & GDK_META_MASK;
+
+    m_modifiers = 0;
+    if (motion->state & GDK_SHIFT_MASK)
+        m_modifiers |= ShiftKey;
+    if (motion->state & GDK_CONTROL_MASK)
+        m_modifiers |= CtrlKey;
+    if (motion->state & GDK_MOD1_MASK)
+        m_modifiers |= AltKey;
+    if (motion->state & GDK_META_MASK)
+        m_modifiers |= MetaKey;
 
     switch (motion->type) {
     case GDK_MOTION_NOTIFY:
index cbe06df..84b02b3 100644 (file)
@@ -42,6 +42,16 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event)
     m_type = PlatformEvent::Wheel;
     m_timestamp = currentTime();
 
+    m_modifiers = 0;
+    if (event->state & GDK_SHIFT_MASK)
+        m_modifiers |= ShiftKey;
+    if (event->state & GDK_CONTROL_MASK)
+        m_modifiers |= CtrlKey;
+    if (event->state & GDK_MOD1_MASK)
+        m_modifiers |= AltKey;
+    if (event->state & GDK_META_MASK)
+        m_modifiers |= MetaKey;
+
     m_deltaX = 0;
     m_deltaY = 0;
 
@@ -66,10 +76,6 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event)
     m_position = IntPoint(static_cast<int>(event->x), static_cast<int>(event->y));
     m_globalPosition = IntPoint(static_cast<int>(event->x_root), static_cast<int>(event->y_root));
     m_granularity = ScrollByPixelWheelEvent;
-    m_shiftKey = event->state & GDK_SHIFT_MASK;
-    m_ctrlKey = event->state & GDK_CONTROL_MASK;
-    m_altKey = event->state & GDK_MOD1_MASK;
-    m_metaKey = event->state & GDK_META_MASK;
     m_directionInvertedFromDevice = false;
 
     // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
index 44d6cc3..4bdf620 100644 (file)
@@ -37,187 +37,6 @@ using namespace WTF;
 
 namespace WebCore {
 
-static bool isKeypadEvent(NSEvent* event)
-{
-    // Check that this is the type of event that has a keyCode.
-    switch ([event type]) {
-        case NSKeyDown:
-        case NSKeyUp:
-        case NSFlagsChanged:
-            break;
-        default:
-            return false;
-    }
-
-    if ([event modifierFlags] & NSNumericPadKeyMask)
-        return true;
-
-    switch ([event keyCode]) {
-        case 71: // Clear
-        case 81: // =
-        case 75: // /
-        case 67: // *
-        case 78: // -
-        case 69: // +
-        case 76: // Enter
-        case 65: // .
-        case 82: // 0
-        case 83: // 1
-        case 84: // 2
-        case 85: // 3
-        case 86: // 4
-        case 87: // 5
-        case 88: // 6
-        case 89: // 7
-        case 91: // 8
-        case 92: // 9
-            return true;
-     }
-
-     return false;
-}
-
-static inline bool isKeyUpEvent(NSEvent *event)
-{
-    if ([event type] != NSFlagsChanged)
-        return [event type] == NSKeyUp;
-    // FIXME: This logic fails if the user presses both Shift keys at once, for example:
-    // we treat releasing one of them as keyDown.
-    switch ([event keyCode]) {
-        case 54: // Right Command
-        case 55: // Left Command
-            return ([event modifierFlags] & NSCommandKeyMask) == 0;
-
-        case 57: // Capslock
-            return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0;
-
-        case 56: // Left Shift
-        case 60: // Right Shift
-            return ([event modifierFlags] & NSShiftKeyMask) == 0;
-
-        case 58: // Left Alt
-        case 61: // Right Alt
-            return ([event modifierFlags] & NSAlternateKeyMask) == 0;
-
-        case 59: // Left Ctrl
-        case 62: // Right Ctrl
-            return ([event modifierFlags] & NSControlKeyMask) == 0;
-
-        case 63: // Function
-            return ([event modifierFlags] & NSFunctionKeyMask) == 0;
-    }
-    return false;
-}
-
-static inline String textFromEvent(NSEvent* event)
-{
-    if ([event type] == NSFlagsChanged)
-        return "";
-    return [event characters];
-}
-
-
-static inline String unmodifiedTextFromEvent(NSEvent* event)
-{
-    if ([event type] == NSFlagsChanged)
-        return "";
-    return [event charactersIgnoringModifiers];
-}
-
-static String keyIdentifierForKeyEvent(NSEvent* event)
-{
-    if ([event type] == NSFlagsChanged)
-        switch ([event keyCode]) {
-            case 54: // Right Command
-            case 55: // Left Command
-                return "Meta";
-
-            case 57: // Capslock
-                return "CapsLock";
-
-            case 56: // Left Shift
-            case 60: // Right Shift
-                return "Shift";
-
-            case 58: // Left Alt
-            case 61: // Right Alt
-                return "Alt";
-
-            case 59: // Left Ctrl
-            case 62: // Right Ctrl
-                return "Control";
-
-            default:
-                ASSERT_NOT_REACHED();
-                return "";
-        }
-
-    NSString *s = [event charactersIgnoringModifiers];
-    if ([s length] != 1) {
-        LOG(Events, "received an unexpected number of characters in key event: %u", [s length]);
-        return "Unidentified";
-    }
-    return keyIdentifierForCharCode([s characterAtIndex:0]);
-}
-
-static int windowsKeyCodeForKeyEvent(NSEvent *event)
-{
-    int code = 0;
-    // There are several kinds of characters for which we produce key code from char code:
-    // 1. Roman letters. Windows keyboard layouts affect both virtual key codes and character codes for these,
-    //    so e.g. 'A' gets the same keyCode on QWERTY, AZERTY or Dvorak layouts.
-    // 2. Keys for which there is no known Mac virtual key codes, like PrintScreen.
-    // 3. Certain punctuation keys. On Windows, these are also remapped depending on current keyboard layout,
-    //    but see comment in windowsKeyCodeForCharCode().
-    if ([event type] == NSKeyDown || [event type] == NSKeyUp) {
-        // Cmd switches Roman letters for Dvorak-QWERTY layout, so try modified characters first.
-        NSString* s = [event characters];
-        code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0;
-        if (code)
-            return code;
-
-        // Ctrl+A on an AZERTY keyboard would get VK_Q keyCode if we relied on -[NSEvent keyCode] below.
-        s = [event charactersIgnoringModifiers];
-        code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0;
-        if (code)
-            return code;
-    }
-
-    // Map Mac virtual key code directly to Windows one for any keys not handled above.
-    // E.g. the key next to Caps Lock has the same Event.keyCode on U.S. keyboard ('A') and on Russian keyboard (CYRILLIC LETTER EF).
-    return windowsKeyCodeForKeyCode([event keyCode]);
-}
-
-PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event)
-    : PlatformEvent(isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown, [event modifierFlags] & NSShiftKeyMask, [event modifierFlags] & NSControlKeyMask, [event modifierFlags] & NSAlternateKeyMask, [event modifierFlags] & NSCommandKeyMask, [event timestamp])
-    , m_text(textFromEvent(event))
-    , m_unmodifiedText(unmodifiedTextFromEvent(event))
-    , m_keyIdentifier(keyIdentifierForKeyEvent(event))
-    , m_autoRepeat(([event type] != NSFlagsChanged) && [event isARepeat])
-    , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event))
-    , m_nativeVirtualKeyCode([event keyCode])
-    , m_isKeypad(isKeypadEvent(event))
-    , m_macEvent(event)
-{
-    // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
-    if (m_windowsVirtualKeyCode == VK_RETURN) {
-        m_text = "\r";
-        m_unmodifiedText = "\r";
-    }
-
-    // AppKit sets text to "\x7F" for backspace, but the correct KeyboardEvent character code is 8.
-    if (m_windowsVirtualKeyCode == VK_BACK) {
-        m_text = "\x8";
-        m_unmodifiedText = "\x8";
-    }
-
-    // Always use 9 for Tab -- we don't want to use AppKit's different character for shift-tab.
-    if (m_windowsVirtualKeyCode == VK_TAB) {
-        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.
@@ -257,6 +76,6 @@ void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKe
     metaKey = currentModifiers & ::cmdKey;
 }
 
-}
+} // namespace WebCore
 
 #endif // PLATFORM(MAC)
diff --git a/Source/WebCore/platform/mac/PlatformEventFactory.h b/Source/WebCore/platform/mac/PlatformEventFactory.h
new file mode 100644 (file)
index 0000000..9c183c1
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 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 INC. 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 INC. 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.
+ */
+
+#ifndef PlatformEventFactory_h
+#define PlatformEventFactory_h
+
+#include "PlatformKeyboardEvent.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+
+#if ENABLE(GESTURE_EVENTS)
+#include "PlatformGestureEvent.h"
+#endif
+
+namespace WebCore {
+
+class PlatformEventFactory {
+public:
+    static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSView *windowView);
+    static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView);
+    static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *);
+#if ENABLE(GESTURE_EVENTS)
+    static PlatformGestureEvent createPlatformGestureEvent(NSEvent *, NSView *windowView);
+#endif
+};
+
+// FIXME: This doesn't really belong here.
+
+#if PLATFORM(MAC) && defined(__OBJC__)
+IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *);
+#endif
+
+} // namespace WebCore
+
+#endif // PlatformEventFactory_h
diff --git a/Source/WebCore/platform/mac/PlatformEventFactory.mm b/Source/WebCore/platform/mac/PlatformEventFactory.mm
new file mode 100644 (file)
index 0000000..a56b388
--- /dev/null
@@ -0,0 +1,534 @@
+/*
+ * Copyright (C) 2011 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 INC. 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 INC. 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 "PlatformEventFactory.h"
+
+#import "KeyEventCocoa.h"
+#import "Logging.h"
+#import "PlatformScreen.h"
+#import "Scrollbar.h"
+#import "WebCoreSystemInterface.h"
+#import "WindowsKeyboardCodes.h"
+#import <wtf/ASCIICType.h>
+
+namespace WebCore {
+
+IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)
+{
+    return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));
+}
+
+static IntPoint globalPointForEvent(NSEvent *event)
+{
+    switch ([event type]) {
+        case NSLeftMouseDown:
+        case NSLeftMouseDragged:
+        case NSLeftMouseUp:
+        case NSMouseEntered:
+        case NSMouseExited:
+        case NSMouseMoved:
+        case NSOtherMouseDown:
+        case NSOtherMouseDragged:
+        case NSOtherMouseUp:
+        case NSRightMouseDown:
+        case NSRightMouseDragged:
+        case NSRightMouseUp:
+        case NSScrollWheel:
+            return globalPoint([event locationInWindow], [event window]);
+        default:
+            return IntPoint();
+    }
+}
+
+static IntPoint pointForEvent(NSEvent *event, NSView *windowView)
+{
+    switch ([event type]) {
+        case NSLeftMouseDown:
+        case NSLeftMouseDragged:
+        case NSLeftMouseUp:
+        case NSMouseEntered:
+        case NSMouseExited:
+        case NSMouseMoved:
+        case NSOtherMouseDown:
+        case NSOtherMouseDragged:
+        case NSOtherMouseUp:
+        case NSRightMouseDown:
+        case NSRightMouseDragged:
+        case NSRightMouseUp:
+        case NSScrollWheel: {
+            // Note: This will have its origin at the bottom left of the window unless windowView is flipped.
+            // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow.
+            NSPoint location = [event locationInWindow];
+            if (windowView)
+                location = [windowView convertPoint:location fromView:nil];
+            return IntPoint(location);
+        }
+        default:
+            return IntPoint();
+    }
+}
+
+static MouseButton mouseButtonForEvent(NSEvent *event)
+{
+    switch ([event type]) {
+        case NSLeftMouseDown:
+        case NSLeftMouseUp:
+        case NSLeftMouseDragged:
+            return LeftButton;
+        case NSRightMouseDown:
+        case NSRightMouseUp:
+        case NSRightMouseDragged:
+            return RightButton;
+        case NSOtherMouseDown:
+        case NSOtherMouseUp:
+        case NSOtherMouseDragged:
+            return MiddleButton;
+        default:
+            return NoButton;
+    }
+}
+
+static PlatformEvent::Type mouseEventTypeForEvent(NSEvent* event)
+{
+    switch ([event type]) {
+        case NSLeftMouseDragged:
+        case NSMouseEntered:
+        case NSMouseExited:
+        case NSMouseMoved:
+        case NSOtherMouseDragged:
+        case NSRightMouseDragged:
+            return PlatformEvent::MouseMoved;
+        case NSLeftMouseDown:
+        case NSRightMouseDown:
+        case NSOtherMouseDown:
+            return PlatformEvent::MousePressed;
+        case NSLeftMouseUp:
+        case NSRightMouseUp:
+        case NSOtherMouseUp:
+            return PlatformEvent::MouseReleased;
+        default:
+            return PlatformEvent::MouseMoved;
+    }
+}
+
+static int clickCountForEvent(NSEvent *event)
+{
+    switch ([event type]) {
+        case NSLeftMouseDown:
+        case NSLeftMouseUp:
+        case NSLeftMouseDragged:
+        case NSRightMouseDown:
+        case NSRightMouseUp:
+        case NSRightMouseDragged:
+        case NSOtherMouseDown:
+        case NSOtherMouseUp:
+        case NSOtherMouseDragged:
+            return [event clickCount];
+        default:
+            return 0;
+    }
+}
+
+static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event)
+{
+    uint32_t phase = PlatformWheelEventPhaseNone;
+
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    if ([event momentumPhase] & NSEventPhaseBegan)
+        phase |= PlatformWheelEventPhaseBegan;
+    if ([event momentumPhase] & NSEventPhaseStationary)
+        phase |= PlatformWheelEventPhaseStationary;
+    if ([event momentumPhase] & NSEventPhaseChanged)
+        phase |= PlatformWheelEventPhaseChanged;
+    if ([event momentumPhase] & NSEventPhaseEnded)
+        phase |= PlatformWheelEventPhaseEnded;
+    if ([event momentumPhase] & NSEventPhaseCancelled)
+        phase |= PlatformWheelEventPhaseCancelled;
+#else
+    switch (wkGetNSEventMomentumPhase(event)) {
+    case wkEventPhaseNone:
+        phase = PlatformWheelEventPhaseNone;
+        break;
+    case wkEventPhaseBegan:
+        phase = PlatformWheelEventPhaseBegan;
+        break;
+    case wkEventPhaseChanged:
+        phase = PlatformWheelEventPhaseChanged;
+        break;
+    case wkEventPhaseEnded:
+        phase = PlatformWheelEventPhaseEnded;
+        break;
+    }
+#endif
+
+    return static_cast<PlatformWheelEventPhase>(phase);
+}
+
+static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    uint32_t phase = PlatformWheelEventPhaseNone; 
+    if ([event phase] & NSEventPhaseBegan)
+        phase |= PlatformWheelEventPhaseBegan;
+    if ([event phase] & NSEventPhaseStationary)
+        phase |= PlatformWheelEventPhaseStationary;
+    if ([event phase] & NSEventPhaseChanged)
+        phase |= PlatformWheelEventPhaseChanged;
+    if ([event phase] & NSEventPhaseEnded)
+        phase |= PlatformWheelEventPhaseEnded;
+    if ([event phase] & NSEventPhaseCancelled)
+        phase |= PlatformWheelEventPhaseCancelled;
+    return static_cast<PlatformWheelEventPhase>(phase);
+#else
+    UNUSED_PARAM(event);
+    return PlatformWheelEventPhaseNone;
+#endif
+}
+
+#if ENABLE(GESTURE_EVENTS)
+static PlatformEvent::Type gestureEventTypeForEvent(NSEvent *event)
+{
+    switch ([event type]) {
+    case NSEventTypeBeginGesture:
+        return PlatformEvent::GestureScrollBegin;
+    case NSEventTypeEndGesture:
+        return PlatformEvent::GestureScrollEnd;
+    default:
+        ASSERT_NOT_REACHED();
+        return PlatformEvent::GestureScrollEnd;
+    }
+}
+#endif
+
+static inline String textFromEvent(NSEvent* event)
+{
+    if ([event type] == NSFlagsChanged)
+        return String("");
+    return String([event characters]);
+}
+
+static inline String unmodifiedTextFromEvent(NSEvent* event)
+{
+    if ([event type] == NSFlagsChanged)
+        return String("");
+    return String([event charactersIgnoringModifiers]);
+}
+
+static String keyIdentifierForKeyEvent(NSEvent* event)
+{
+    if ([event type] == NSFlagsChanged) 
+        switch ([event keyCode]) {
+            case 54: // Right Command
+            case 55: // Left Command
+                return String("Meta");
+                
+            case 57: // Capslock
+                return String("CapsLock");
+                
+            case 56: // Left Shift
+            case 60: // Right Shift
+                return String("Shift");
+                
+            case 58: // Left Alt
+            case 61: // Right Alt
+                return String("Alt");
+                
+            case 59: // Left Ctrl
+            case 62: // Right Ctrl
+                return String("Control");
+                
+            default:
+                ASSERT_NOT_REACHED();
+                return String("");
+        }
+    
+    NSString *s = [event charactersIgnoringModifiers];
+    if ([s length] != 1) {
+        LOG(Events, "received an unexpected number of characters in key event: %u", [s length]);
+        return "Unidentified";
+    }
+    return keyIdentifierForCharCode([s characterAtIndex:0]);
+}
+
+static bool isKeypadEvent(NSEvent* event)
+{
+    // Check that this is the type of event that has a keyCode.
+    switch ([event type]) {
+        case NSKeyDown:
+        case NSKeyUp:
+        case NSFlagsChanged:
+            break;
+        default:
+            return false;
+    }
+
+    if ([event modifierFlags] & NSNumericPadKeyMask)
+        return true;
+
+    switch ([event keyCode]) {
+        case 71: // Clear
+        case 81: // =
+        case 75: // /
+        case 67: // *
+        case 78: // -
+        case 69: // +
+        case 76: // Enter
+        case 65: // .
+        case 82: // 0
+        case 83: // 1
+        case 84: // 2
+        case 85: // 3
+        case 86: // 4
+        case 87: // 5
+        case 88: // 6
+        case 89: // 7
+        case 91: // 8
+        case 92: // 9
+            return true;
+     }
+     
+     return false;
+}
+
+static int windowsKeyCodeForKeyEvent(NSEvent* event)
+{
+    int code = 0;
+    // There are several kinds of characters for which we produce key code from char code:
+    // 1. Roman letters. Windows keyboard layouts affect both virtual key codes and character codes for these,
+    //    so e.g. 'A' gets the same keyCode on QWERTY, AZERTY or Dvorak layouts.
+    // 2. Keys for which there is no known Mac virtual key codes, like PrintScreen.
+    // 3. Certain punctuation keys. On Windows, these are also remapped depending on current keyboard layout,
+    //    but see comment in windowsKeyCodeForCharCode().
+    if ([event type] == NSKeyDown || [event type] == NSKeyUp) {
+        // Cmd switches Roman letters for Dvorak-QWERTY layout, so try modified characters first.
+        NSString* s = [event characters];
+        code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0;
+        if (code)
+            return code;
+
+        // Ctrl+A on an AZERTY keyboard would get VK_Q keyCode if we relied on -[NSEvent keyCode] below.
+        s = [event charactersIgnoringModifiers];
+        code = [s length] > 0 ? windowsKeyCodeForCharCode([s characterAtIndex:0]) : 0;
+        if (code)
+            return code;
+    }
+
+    // Map Mac virtual key code directly to Windows one for any keys not handled above.
+    // E.g. the key next to Caps Lock has the same Event.keyCode on U.S. keyboard ('A') and on Russian keyboard (CYRILLIC LETTER EF).
+    return windowsKeyCodeForKeyCode([event keyCode]);
+}
+
+static inline bool isKeyUpEvent(NSEvent *event)
+{
+    if ([event type] != NSFlagsChanged)
+        return [event type] == NSKeyUp;
+    // FIXME: This logic fails if the user presses both Shift keys at once, for example:
+    // we treat releasing one of them as keyDown.
+    switch ([event keyCode]) {
+        case 54: // Right Command
+        case 55: // Left Command
+            return ([event modifierFlags] & NSCommandKeyMask) == 0;
+            
+        case 57: // Capslock
+            return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0;
+            
+        case 56: // Left Shift
+        case 60: // Right Shift
+            return ([event modifierFlags] & NSShiftKeyMask) == 0;
+            
+        case 58: // Left Alt
+        case 61: // Right Alt
+            return ([event modifierFlags] & NSAlternateKeyMask) == 0;
+            
+        case 59: // Left Ctrl
+        case 62: // Right Ctrl
+            return ([event modifierFlags] & NSControlKeyMask) == 0;
+            
+        case 63: // Function
+            return ([event modifierFlags] & NSFunctionKeyMask) == 0;
+    }
+    return false;
+}
+
+static inline PlatformEvent::Modifiers modifiersForEvent(NSEvent *event)
+{
+    unsigned modifiers = 0;
+    if ([event modifierFlags] & NSShiftKeyMask)
+        modifiers |= PlatformEvent::ShiftKey;
+    if ([event modifierFlags] & NSControlKeyMask)
+        modifiers |= PlatformEvent::CtrlKey;
+    if ([event modifierFlags] & NSAlternateKeyMask)
+        modifiers |= PlatformEvent::AltKey;
+    if ([event modifierFlags] & NSCommandKeyMask)
+        modifiers |= PlatformEvent::MetaKey;
+    return (PlatformEvent::Modifiers)modifiers;
+}
+
+
+class PlatformMouseEventBuilder : public PlatformMouseEvent {
+public:
+    PlatformMouseEventBuilder(NSEvent *event, NSView *windowView)
+    {
+        // PlatformEvent
+        m_type                              = mouseEventTypeForEvent(event);
+        m_modifiers                         = modifiersForEvent(event);
+        m_timestamp                         = [event timestamp];
+
+        // PlatformMouseEvent
+        m_position                          = pointForEvent(event, windowView);
+        m_globalPosition                    = globalPointForEvent(event);
+        m_button                            = mouseButtonForEvent(event);
+        m_clickCount                        = clickCountForEvent(event);
+        
+        // Mac specific
+        m_modifierFlags                     = [event modifierFlags];
+        m_eventNumber                       = [event eventNumber];
+    }
+};
+
+PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSView *windowView)
+{
+    return PlatformMouseEventBuilder(event, windowView);
+}
+
+
+class PlatformWheelEventBuilder : public PlatformWheelEvent {
+public:
+    PlatformWheelEventBuilder(NSEvent *event, NSView *windowView)
+    {
+        // PlatformEvent
+        m_type                              = PlatformEvent::Wheel;
+        m_modifiers                         = modifiersForEvent(event);
+        m_timestamp                         = [event timestamp];
+
+        // PlatformWheelEvent
+        m_position                          = pointForEvent(event, windowView);
+        m_globalPosition                    = globalPointForEvent(event);
+        m_granularity                       = ScrollByPageWheelEvent;
+
+        BOOL continuous;
+        wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
+        if (continuous) {
+            m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
+            m_wheelTicksY = m_deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep());
+        } else {
+            m_wheelTicksX = m_deltaX;
+            m_wheelTicksY = m_deltaY;
+            m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
+            m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
+        }
+
+        m_phase                             = phaseForEvent(event);
+        m_momentumPhase                     = momentumPhaseForEvent(event);
+        m_hasPreciseScrollingDeltas         = continuous;
+
+#if HAVE(INVERTED_WHEEL_EVENTS)
+        m_directionInvertedFromDevice       = [event isDirectionInvertedFromDevice];
+#else
+        m_directionInvertedFromDevice       = false;
+#endif
+    }
+};
+
+PlatformWheelEvent PlatformEventFactory::createPlatformWheelEvent(NSEvent *event, NSView *windowView)
+{
+    return PlatformWheelEventBuilder(event, windowView);
+}
+
+
+class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent {
+public:
+    PlatformKeyboardEventBuilder(NSEvent *event)
+    {
+        // PlatformEvent
+        m_type                              = isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
+        m_modifiers                         = modifiersForEvent(event);
+        m_timestamp                         = [event timestamp];
+
+        // PlatformKeyboardEvent
+        m_text                              = textFromEvent(event);
+        m_unmodifiedText                    = unmodifiedTextFromEvent(event);
+        m_keyIdentifier                     = keyIdentifierForKeyEvent(event);
+        m_windowsVirtualKeyCode             = windowsKeyCodeForKeyEvent(event);
+        m_nativeVirtualKeyCode              = [event keyCode];
+        m_macCharCode                       = wkGetNSEventKeyChar(event);
+        m_autoRepeat                        = ([event type] != NSFlagsChanged) && [event isARepeat];
+        m_isKeypad                          = isKeypadEvent(event);
+        m_isSystemKey                       = false; // SystemKey is always false on the Mac.
+
+        // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
+        if (m_windowsVirtualKeyCode == VK_RETURN) {
+            m_text = "\r";
+            m_unmodifiedText = "\r";
+        }
+
+        // AppKit sets text to "\x7F" for backspace, but the correct KeyboardEvent character code is 8.
+        if (m_windowsVirtualKeyCode == VK_BACK) {
+            m_text = "\x8";
+            m_unmodifiedText = "\x8";
+        }
+
+        // Always use 9 for Tab -- we don't want to use AppKit's different character for shift-tab.
+        if (m_windowsVirtualKeyCode == VK_TAB) {
+            m_text = "\x9";
+            m_unmodifiedText = "\x9";
+        }
+
+        // Mac specific.
+        m_macEvent = event;
+    }
+};
+
+PlatformKeyboardEvent PlatformEventFactory::createPlatformKeyboardEvent(NSEvent *event)
+{
+    return PlatformKeyboardEventBuilder(event);
+}
+
+#if ENABLE(GESTURE_EVENTS)
+class PlatformGestureEventBuilder : public PlatformGestureEvent {
+public:
+    PlatformGestureEventBuilder(NSEvent *event, NSView *windowView)
+    {
+        // PlatformEvent
+        m_type                              = gestureEventTypeForEvent(event);
+        m_modifiers                         = modifiersForEvent(event);
+        m_timestamp                         = [event timestamp];
+
+        // PlatformGestureEvent
+        m_position                          = pointForEvent(event, windowView);
+        m_globalPosition                    = globalPointForEvent(event);
+        m_deltaX                            = 0;
+        m_deltaY                            = 0;
+    }
+};
+
+PlatformGestureEvent PlatformEventFactory::createPlatformGestureEvent(NSEvent *event, NSView *windowView)
+{
+    return PlatformGestureEventBuilder(event, windowView);
+}
+#endif
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/mac/PlatformMouseEventMac.mm b/Source/WebCore/platform/mac/PlatformMouseEventMac.mm
deleted file mode 100644 (file)
index c5f5989..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2004, 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 "PlatformMouseEvent.h"
-
-#import "PlatformScreen.h"
-
-namespace WebCore {
-
-static MouseButton mouseButtonForEvent(NSEvent *event)
-{
-    switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseUp:
-        case NSLeftMouseDragged:
-            return LeftButton;
-        case NSRightMouseDown:
-        case NSRightMouseUp:
-        case NSRightMouseDragged:
-            return RightButton;
-        case NSOtherMouseDown:
-        case NSOtherMouseUp:
-        case NSOtherMouseDragged:
-            return MiddleButton;
-        default:
-            return NoButton;
-    }
-}
-
-static int clickCountForEvent(NSEvent *event)
-{
-    switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseUp:
-        case NSLeftMouseDragged:
-        case NSRightMouseDown:
-        case NSRightMouseUp:
-        case NSRightMouseDragged:
-        case NSOtherMouseDown:
-        case NSOtherMouseUp:
-        case NSOtherMouseDragged:
-            return [event clickCount];
-        default:
-            return 0;
-    }
-}
-
-IntPoint globalPoint(const NSPoint& windowPoint, NSWindow *window)
-{
-    return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));
-}
-
-IntPoint pointForEvent(NSEvent *event, NSView *windowView)
-{
-    switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseUp:
-        case NSLeftMouseDragged:
-        case NSRightMouseDown:
-        case NSRightMouseUp:
-        case NSRightMouseDragged:
-        case NSOtherMouseDown:
-        case NSOtherMouseUp:
-        case NSOtherMouseDragged:
-        case NSMouseMoved:
-        case NSScrollWheel: {
-            // Note: This will have its origin at the bottom left of the window unless windowView is flipped.
-            // In those cases, the Y coordinate gets flipped by Widget::convertFromContainingWindow.
-            NSPoint location = [event locationInWindow];
-            if (windowView)
-                location = [windowView convertPoint:location fromView:nil];
-            return IntPoint(location);
-        }
-        default:
-            return IntPoint();
-    }
-}
-
-IntPoint globalPointForEvent(NSEvent *event)
-{
-    switch ([event type]) {
-        case NSLeftMouseDown:
-        case NSLeftMouseUp:
-        case NSLeftMouseDragged:
-        case NSRightMouseDown:
-        case NSRightMouseUp:
-        case NSRightMouseDragged:
-        case NSOtherMouseDown:
-        case NSOtherMouseUp:
-        case NSOtherMouseDragged:
-        case NSMouseMoved:
-        case NSScrollWheel:
-            return globalPoint([event locationInWindow], [event window]);
-        default:
-            return IntPoint();
-    }
-}
-
-static PlatformEvent::Type mouseEventForNSEvent(NSEvent* event) 
-{
-    switch ([event type]) {
-    case NSScrollWheel:
-        return PlatformEvent::MouseScroll;
-    case NSLeftMouseDragged:
-    case NSRightMouseDragged:
-    case NSOtherMouseDragged:
-    case NSMouseMoved:
-        return PlatformEvent::MouseMoved;
-    case NSLeftMouseDown:
-    case NSRightMouseDown:
-    case NSOtherMouseDown:
-        return PlatformEvent::MousePressed;
-    case NSLeftMouseUp:
-    case NSRightMouseUp:
-    case NSOtherMouseUp:
-        return PlatformEvent::MouseReleased;
-    default:
-        return PlatformEvent::MouseMoved;
-    }
-}
-
-PlatformMouseEvent::PlatformMouseEvent(NSEvent* event, NSView *windowView)
-    : PlatformEvent(mouseEventForNSEvent(event), [event modifierFlags] & NSShiftKeyMask, [event modifierFlags] & NSControlKeyMask, [event modifierFlags] & NSAlternateKeyMask, [event modifierFlags] & NSCommandKeyMask, [event timestamp])
-    , m_position(pointForEvent(event, windowView))
-    , m_globalPosition(globalPointForEvent(event))
-    , m_button(mouseButtonForEvent(event))
-    , m_clickCount(clickCountForEvent(event))
-    , m_modifierFlags([event modifierFlags])
-    , m_eventNumber([event eventNumber])
-{
-}
-
-PlatformMouseEvent::PlatformMouseEvent(int x, int y, int globalX, int globalY, MouseButton button, PlatformEvent::Type type,
-                   int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp,
-                   unsigned modifierFlags, int eventNumber)
-    : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
-    , m_position(IntPoint(x, y))
-    , m_globalPosition(IntPoint(globalX, globalY))
-    , m_button(button)
-    , m_clickCount(clickCount)
-    , m_modifierFlags(modifierFlags)
-    , m_eventNumber(eventNumber)
-{
-}
-
-}
index 1764b79..beb36ca 100644 (file)
@@ -172,6 +172,7 @@ extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response)
 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
+extern UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
 extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
 extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
 extern NSView *(*wkCreateMediaUIBackgroundView)(void);
index cda095b..b4ca540 100644 (file)
@@ -60,6 +60,7 @@ NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response
 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
+UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
 int (*wkQTMovieDataRate)(QTMovie*);
diff --git a/Source/WebCore/platform/mac/WheelEventMac.mm b/Source/WebCore/platform/mac/WheelEventMac.mm
deleted file mode 100644 (file)
index 89c9fb7..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2004, 2006, 2010, 2011 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 "PlatformWheelEvent.h"
-
-#import "PlatformMouseEvent.h"
-#import "Scrollbar.h"
-#import "WebCoreSystemInterface.h"
-#import <wtf/UnusedParam.h>
-
-namespace WebCore {
-
-static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event)
-{
-    uint32_t phase = PlatformWheelEventPhaseNone;
-
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    if ([event momentumPhase] & NSEventPhaseBegan)
-        phase |= PlatformWheelEventPhaseBegan;
-    if ([event momentumPhase] & NSEventPhaseStationary)
-        phase |= PlatformWheelEventPhaseStationary;
-    if ([event momentumPhase] & NSEventPhaseChanged)
-        phase |= PlatformWheelEventPhaseChanged;
-    if ([event momentumPhase] & NSEventPhaseEnded)
-        phase |= PlatformWheelEventPhaseEnded;
-    if ([event momentumPhase] & NSEventPhaseCancelled)
-        phase |= PlatformWheelEventPhaseCancelled;
-#else
-    switch (wkGetNSEventMomentumPhase(event)) {
-    case wkEventPhaseNone:
-        phase = PlatformWheelEventPhaseNone;
-        break;
-    case wkEventPhaseBegan:
-        phase = PlatformWheelEventPhaseBegan;
-        break;
-    case wkEventPhaseChanged:
-        phase = PlatformWheelEventPhaseChanged;
-        break;
-    case wkEventPhaseEnded:
-        phase = PlatformWheelEventPhaseEnded;
-        break;
-    }
-#endif
-
-    return static_cast<PlatformWheelEventPhase>(phase);
-}
-
-static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
-{
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    uint32_t phase = PlatformWheelEventPhaseNone; 
-    if ([event phase] & NSEventPhaseBegan)
-        phase |= PlatformWheelEventPhaseBegan;
-    if ([event phase] & NSEventPhaseStationary)
-        phase |= PlatformWheelEventPhaseStationary;
-    if ([event phase] & NSEventPhaseChanged)
-        phase |= PlatformWheelEventPhaseChanged;
-    if ([event phase] & NSEventPhaseEnded)
-        phase |= PlatformWheelEventPhaseEnded;
-    if ([event phase] & NSEventPhaseCancelled)
-        phase |= PlatformWheelEventPhaseCancelled;
-    return static_cast<PlatformWheelEventPhase>(phase);
-#else
-    UNUSED_PARAM(event);
-    return PlatformWheelEventPhaseNone;
-#endif
-}
-
-PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
-    : PlatformEvent(PlatformEvent::Wheel, [event modifierFlags] & NSShiftKeyMask, [event modifierFlags] & NSControlKeyMask, [event modifierFlags] & NSAlternateKeyMask, [event modifierFlags] & NSCommandKeyMask, [event timestamp])
-    , m_position(pointForEvent(event, windowView))
-    , m_globalPosition(globalPointForEvent(event))
-    , m_granularity(ScrollByPixelWheelEvent)
-    , m_phase(phaseForEvent(event))
-    , m_momentumPhase(momentumPhaseForEvent(event))
-{
-    BOOL continuous;
-    wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
-    if (continuous) {
-        m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
-        m_wheelTicksY = m_deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep());
-        m_hasPreciseScrollingDeltas = true;
-    } else {
-        m_wheelTicksX = m_deltaX;
-        m_wheelTicksY = m_deltaY;
-        m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep());
-        m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
-        m_hasPreciseScrollingDeltas = false;
-    }
-
-#if HAVE(INVERTED_WHEEL_EVENTS)
-    m_directionInvertedFromDevice = [event isDirectionInvertedFromDevice];
-#else
-    m_directionInvertedFromDevice = false;
-#endif
-}
-
-} // namespace WebCore
index 38fe8d6..62d8a24 100644 (file)
@@ -598,17 +598,26 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
 {
     const int state = event->modifiers();
     m_type = (event->type() == QEvent::KeyRelease) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
+
+    m_modifiers = 0;
+    if ((state & Qt::ShiftModifier) || event->key() == Qt::Key_Backtab) // Simulate Shift+Tab with Key_Backtab
+        m_modifiers |= ShiftKey;
+    if (state & Qt::ControlModifier)
+        m_modifiers |= CtrlKey;
+    if (state & Qt::AltModifier)
+        m_modifiers |= AltKey;
+    if (state & Qt::MetaModifier)
+        m_modifiers |= MetaKey;
+
     m_text = keyTextForKeyEvent(event);
     m_unmodifiedText = m_text; // FIXME: not correct
     m_keyIdentifier = keyIdentifierForQtKeyCode(event->key());
     m_autoRepeat = event->isAutoRepeat();
-    m_ctrlKey = (state & Qt::ControlModifier);
-    m_altKey = (state & Qt::AltModifier);
-    m_metaKey = (state & Qt::MetaModifier);
     m_isKeypad = (state & Qt::KeypadModifier);
+    m_isSystemKey = false;
     m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), m_isKeypad);
     m_nativeVirtualKeyCode = event->nativeVirtualKey();
-    m_shiftKey = (state & Qt::ShiftModifier) || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
+    m_macCharCode = 0;
     m_qtEvent = event;
     m_timestamp = WTF::currentTime();
 }
index 909d22c..9946c4e 100644 (file)
 
 namespace WebCore {
 
-static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers keyboardModifiers, bool& altKey, bool& ctrlKey, bool& metaKey, bool& shiftKey)
+static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers keyboardModifiers, unsigned& modifiers)
 {
-    altKey = keyboardModifiers & Qt::AltModifier;
-    ctrlKey = keyboardModifiers & Qt::ControlModifier;
-    metaKey = keyboardModifiers & Qt::MetaModifier;
-    shiftKey = keyboardModifiers & Qt::ShiftModifier;
+    modifiers = 0;
+    if (keyboardModifiers & Qt::ShiftModifier)
+        modifiers |= PlatformEvent::ShiftKey;
+    if (keyboardModifiers & Qt::ControlModifier)
+        modifiers |= PlatformEvent::CtrlKey;
+    if (keyboardModifiers & Qt::AltModifier)
+        modifiers |= PlatformEvent::AltKey;
+    if (keyboardModifiers & Qt::MetaModifier)
+        modifiers |= PlatformEvent::MetaKey;
 }
 
 static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, PlatformEvent::Type& mouseEventType, MouseButton& mouseButton)
@@ -121,7 +126,7 @@ PlatformMouseEvent::PlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clic
     m_globalPosition = IntPoint(event->screenPos());
 
     m_clickCount = clickCount;
-    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_altKey, m_ctrlKey, m_metaKey, m_shiftKey);
+    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers);
 }
 #endif // QT_NO_GRAPHICSVIEW
 
@@ -151,7 +156,7 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
     }
 
     m_clickCount = clickCount;
-    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_altKey, m_ctrlKey, m_metaKey, m_shiftKey);
+    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers);
 }
 
 }
index 7c62da6..e3cae8c 100644 (file)
@@ -46,10 +46,16 @@ PlatformTouchEvent::PlatformTouchEvent(QTouchEvent* event)
     for (int i = 0; i < points.count(); ++i)
         m_touchPoints.append(PlatformTouchPoint(points.at(i)));
 
-    m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
-    m_altKey = (event->modifiers() & Qt::AltModifier);
-    m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
-    m_metaKey = (event->modifiers() & Qt::MetaModifier);
+    m_modifiers = 0;
+    if (event->modifiers()  & Qt::ShiftModifier)
+        m_modifiers |= ShiftKey;
+    if (event->modifiers()  & Qt::ControlModifier)
+        m_modifiers |= CtrlKey;
+    if (event->modifiers()  & Qt::AltModifier)
+        m_modifiers |= AltKey;
+    if (event->modifiers()  & Qt::MetaModifier)
+        m_modifiers |= MetaKey;
+
     m_timestamp = WTF::currentTime();
 }
 
index ad589bb..8fd977d 100644 (file)
@@ -194,9 +194,10 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM code, LPARAM keyData,
     , m_text((type == PlatformEvent::Char) ? singleCharacterString(code) : String())
     , m_unmodifiedText((type == PlatformEvent::Char) ? singleCharacterString(code) : String())
     , m_keyIdentifier((type == PlatformEvent::Char) ? String() : keyIdentifierForWindowsKeyCode(code))
-    , m_autoRepeat(HIWORD(keyData) & KF_REPEAT)
     , m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyUp) ? code : 0)
     , m_nativeVirtualKeyCode(m_windowsVirtualKeyCode)
+    , m_macCharCode(0)
+    , m_autoRepeat(HIWORD(keyData) & KF_REPEAT)
     , m_isKeypad(isKeypadEvent(code, keyData, type))
     , m_isSystemKey(systemKey)
 {
index cb2dda5..5224697 100644 (file)
@@ -113,7 +113,7 @@ PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam,
         m_wheelTicksX = 0;
         m_wheelTicksY = delta;
     }
-    if (isMouseHWheel || m_shiftKey) {
+    if (isMouseHWheel || shiftKey()) {
         m_deltaX = delta * static_cast<float>(horizontalScrollChars()) * cScrollbarPixelsPerLine;
         m_deltaY = 0;
         m_granularity = ScrollByPixelWheelEvent;
index 5e203f6..83b9628 100644 (file)
@@ -1,3 +1,17 @@
+2011-12-23  Sam Weinig  <sam@webkit.org>
+
+        Start extracting platform specific bits out of PlatformEvents
+        https://bugs.webkit.org/show_bug.cgi?id=75063
+
+        Reviewed by Anders Carlsson.
+
+        * src/WebInputEventConversion.cpp:
+        (WebKit::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+        (WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
+        (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+        (WebKit::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
+        (WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
+
 2011-12-23  Ryosuke Niwa  <rniwa@webkit.org>
 
         Chromium Chromium DEPS from 115012 to 115743.
index b93cdfd..38d8a55 100644 (file)
@@ -64,10 +64,17 @@ PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo
     m_movementDelta = IntPoint(e.movementX, e.movementY);
 #endif
     m_button = static_cast<MouseButton>(e.button);
-    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
-    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
-    m_altKey = (e.modifiers & WebInputEvent::AltKey);
-    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+
+    m_modifiers = 0;
+    if (e.modifiers & WebInputEvent::ShiftKey)
+        m_modifiers |= PlatformEvent::ShiftKey;
+    if (e.modifiers & WebInputEvent::ControlKey)
+        m_modifiers |= PlatformEvent::CtrlKey;
+    if (e.modifiers & WebInputEvent::AltKey)
+        m_modifiers |= PlatformEvent::AltKey;
+    if (e.modifiers & WebInputEvent::MetaKey)
+        m_modifiers |= PlatformEvent::MetaKey;
+
     m_modifierFlags = e.modifiers;
     m_timestamp = e.timeStampSeconds;
     m_clickCount = e.clickCount;
@@ -105,10 +112,17 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo
         ScrollByPageWheelEvent : ScrollByPixelWheelEvent;
     
     m_type = PlatformEvent::Wheel;
-    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
-    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
-    m_altKey = (e.modifiers & WebInputEvent::AltKey);
-    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+
+    m_modifiers = 0;
+    if (e.modifiers & WebInputEvent::ShiftKey)
+        m_modifiers |= PlatformEvent::ShiftKey;
+    if (e.modifiers & WebInputEvent::ControlKey)
+        m_modifiers |= PlatformEvent::CtrlKey;
+    if (e.modifiers & WebInputEvent::AltKey)
+        m_modifiers |= PlatformEvent::AltKey;
+    if (e.modifiers & WebInputEvent::MetaKey)
+        m_modifiers |= PlatformEvent::MetaKey;
+
 #if OS(DARWIN)
     m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
     m_phase = static_cast<WebCore::PlatformWheelEventPhase>(e.phase);
@@ -143,10 +157,16 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
     m_deltaX = e.deltaX;
     m_deltaY = e.deltaY;
     m_timestamp = e.timeStampSeconds;
-    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
-    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
-    m_altKey = (e.modifiers & WebInputEvent::AltKey);
-    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
+
+    m_modifiers = 0;
+    if (e.modifiers & WebInputEvent::ShiftKey)
+        m_modifiers |= PlatformEvent::ShiftKey;
+    if (e.modifiers & WebInputEvent::ControlKey)
+        m_modifiers |= PlatformEvent::CtrlKey;
+    if (e.modifiers & WebInputEvent::AltKey)
+        m_modifiers |= PlatformEvent::AltKey;
+    if (e.modifiers & WebInputEvent::MetaKey)
+        m_modifiers |= PlatformEvent::MetaKey;
 }
 #endif
 
@@ -179,11 +199,17 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven
     m_windowsVirtualKeyCode = e.windowsKeyCode;
     m_nativeVirtualKeyCode = e.nativeKeyCode;
     m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad);
-    m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
-    m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);
-    m_altKey = (e.modifiers & WebInputEvent::AltKey);
-    m_metaKey = (e.modifiers & WebInputEvent::MetaKey);
     m_isSystemKey = e.isSystemKey;
+
+    m_modifiers = 0;
+    if (e.modifiers & WebInputEvent::ShiftKey)
+        m_modifiers |= PlatformEvent::ShiftKey;
+    if (e.modifiers & WebInputEvent::ControlKey)
+        m_modifiers |= PlatformEvent::CtrlKey;
+    if (e.modifiers & WebInputEvent::AltKey)
+        m_modifiers |= PlatformEvent::AltKey;
+    if (e.modifiers & WebInputEvent::MetaKey)
+        m_modifiers |= PlatformEvent::MetaKey;
 }
 
 void PlatformKeyboardEventBuilder::setKeyType(Type type)
@@ -269,10 +295,17 @@ PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTouchEvent& event)
 {
     m_type = toPlatformTouchEventType(event.type);
-    m_ctrlKey = event.modifiers & WebInputEvent::ControlKey;
-    m_altKey = event.modifiers & WebInputEvent::AltKey;
-    m_shiftKey = event.modifiers & WebInputEvent::ShiftKey;
-    m_metaKey = event.modifiers & WebInputEvent::MetaKey;
+
+    m_modifiers = 0;
+    if (event.modifiers & WebInputEvent::ShiftKey)
+        m_modifiers |= PlatformEvent::ShiftKey;
+    if (event.modifiers & WebInputEvent::ControlKey)
+        m_modifiers |= PlatformEvent::CtrlKey;
+    if (event.modifiers & WebInputEvent::AltKey)
+        m_modifiers |= PlatformEvent::AltKey;
+    if (event.modifiers & WebInputEvent::MetaKey)
+        m_modifiers |= PlatformEvent::MetaKey;
+
     m_timestamp = event.timeStampSeconds;
 
     for (unsigned i = 0; i < event.touchesLength; ++i)
index 6c7bf30..07faec8 100644 (file)
@@ -1,3 +1,23 @@
+2011-12-21  Sam Weinig  <sam@webkit.org>
+
+        Start extracting platform specific bits out of PlatformEvents
+        https://bugs.webkit.org/show_bug.cgi?id=75063
+
+        Reviewed by Anders Carlsson.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+        * WebView/WebFrame.mm:
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView menuForEvent:]):
+        (-[WebHTMLView acceptsFirstMouse:]):
+        (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+        (currentKeyboardEvent):
+        (-[WebHTMLView flagsChanged:]):
+        * WebView/WebPDFView.mm:
+        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
+        * WebView/WebView.mm:
+
 2011-12-21  Timothy Hatcher  <timothy@apple.com>
 
         Web Inspector: suppress incremental rendering and use application chrome mode
index 1310124..e93d0c6 100644 (file)
@@ -67,6 +67,7 @@ void InitWebCoreSystemInterface(void)
     INIT(SignedPublicKeyAndChallengeString);
     INIT(GetPreferredExtensionForMIMEType);
     INIT(GetWheelEventDeltas);
+    INIT(GetNSEventKeyChar);
     INIT(HitTestMediaUIPart);
     INIT(InitializeMaximumHTTPConnectionCountPerHost);
     INIT(MeasureMediaUIPart);
index 61b8e88..a5c342c 100644 (file)
@@ -76,6 +76,7 @@
 #import <WebCore/HitTestResult.h>
 #import <WebCore/LegacyWebArchive.h>
 #import <WebCore/Page.h>
+#import <WebCore/PlatformEventFactory.h>
 #import <WebCore/PluginData.h>
 #import <WebCore/PrintContext.h>
 #import <WebCore/RenderLayer.h>
index d1eeb69..c4bc2a2 100644 (file)
 #import <WebCore/LegacyWebArchive.h>
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/Page.h>
-#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/PlatformEventFactory.h>
 #import <WebCore/Range.h>
 #import <WebCore/RenderWidget.h>
 #import <WebCore/RenderView.h>
@@ -3108,7 +3108,7 @@ static void setMenuTargets(NSMenu* menu)
     _private->handlingMouseDownEvent = YES;
     page->contextMenuController()->clearContextMenu();
     coreFrame->eventHandler()->mouseDown(event);
-    BOOL handledEvent = coreFrame->eventHandler()->sendContextMenuEvent(PlatformMouseEvent(event, page->chrome()->platformPageClient()));
+    BOOL handledEvent = coreFrame->eventHandler()->sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome()->platformPageClient()));
     _private->handlingMouseDownEvent = NO;
 
     if (!handledEvent)
@@ -3473,7 +3473,7 @@ static void setMenuTargets(NSMenu* menu)
             [hitHTMLView _setMouseDownEvent:event];
             if ([hitHTMLView _isSelectionEvent:event]) {
                 if (Page* page = coreFrame->page())
-                    result = coreFrame->eventHandler()->eventMayStartDrag(PlatformMouseEvent(event, page->chrome()->platformPageClient()));
+                    result = coreFrame->eventHandler()->eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome()->platformPageClient()));
             } else if ([hitHTMLView _isScrollBarEvent:event])
                 result = true;
             [hitHTMLView _setMouseDownEvent:nil];
@@ -3498,7 +3498,7 @@ static void setMenuTargets(NSMenu* menu)
             if (Frame* coreFrame = core([hitHTMLView _frame])) {
                 [hitHTMLView _setMouseDownEvent:event];
                 if (Page* page = coreFrame->page())
-                    result = coreFrame->eventHandler()->eventMayStartDrag(PlatformMouseEvent(event, page->chrome()->platformPageClient()));
+                    result = coreFrame->eventHandler()->eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome()->platformPageClient()));
                 [hitHTMLView _setMouseDownEvent:nil];
             }
         }
@@ -3738,12 +3738,12 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 
     switch ([event type]) {
     case NSKeyDown: {
-        PlatformKeyboardEvent platformEvent(event);
+        PlatformKeyboardEvent platformEvent = PlatformEventFactory::createPlatformKeyboardEvent(event);
         platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
         return KeyboardEvent::create(platformEvent, coreFrame->document()->defaultView());
     }
     case NSKeyUp:
-        return KeyboardEvent::create(event, coreFrame->document()->defaultView());
+        return KeyboardEvent::create(PlatformEventFactory::createPlatformKeyboardEvent(event), coreFrame->document()->defaultView());
     default:
         return 0;
     }
@@ -4141,7 +4141,7 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
 
     // Don't make an event from the num lock and function keys.
     if (coreFrame && keyCode != 0 && keyCode != 10 && keyCode != 63) {
-        coreFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(event));
+        coreFrame->eventHandler()->keyEvent(PlatformEventFactory::createPlatformKeyboardEvent(event));
         return;
     }
         
index 8ae0f3c..c5fe921 100644 (file)
@@ -58,7 +58,7 @@
 #import <WebCore/KURL.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/MouseEvent.h>
-#import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/PlatformEventFactory.h>
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/WebNSAttributedStringExtras.h>
 #import <wtf/Assertions.h>
@@ -959,7 +959,7 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
             button = [nsEvent buttonNumber];
             break;
         case NSKeyDown: {
-            PlatformKeyboardEvent pe(nsEvent);
+            PlatformKeyboardEvent pe = PlatformEventFactory::createPlatformKeyboardEvent(nsEvent);
             pe.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
             event = KeyboardEvent::create(eventNames().keydownEvent, true, true, 0,
                 pe.keyIdentifier(), pe.windowsVirtualKeyCode(),
index d7c9ab4..6d01777 100644 (file)
 #import <WebCore/Page.h>
 #import <WebCore/PageCache.h>
 #import <WebCore/PageGroup.h>
-#import <WebCore/PlatformMouseEvent.h>
+#import <WebCore/PlatformEventFactory.h>
 #import <WebCore/ProgressTracker.h>
 #import <WebCore/RenderView.h>
 #import <WebCore/RenderWidget.h>
index 14e9166..49cb50a 100644 (file)
@@ -1,3 +1,20 @@
+2011-12-21  Sam Weinig  <sam@webkit.org>
+
+        Start extracting platform specific bits out of PlatformEvents
+        https://bugs.webkit.org/show_bug.cgi?id=75063
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
+        (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+        (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
+        (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
+        (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
+        * UIProcess/API/mac/WKView.mm:
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2011-12-22  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         [Qt] [WK2] Use HashMap instead of Vector in the builtin bundle
index a531573..a2b41f2 100644 (file)
@@ -49,10 +49,16 @@ public:
             ASSERT_NOT_REACHED();
         }
 
-        m_shiftKey = webEvent.shiftKey();
-        m_ctrlKey = webEvent.controlKey();
-        m_altKey = webEvent.altKey();
-        m_metaKey = webEvent.metaKey();
+        m_modifiers = 0;
+        if (webEvent.shiftKey())
+            m_modifiers |= ShiftKey;
+        if (webEvent.controlKey())
+            m_modifiers |= CtrlKey;
+        if (webEvent.altKey())
+            m_modifiers |= AltKey;
+        if (webEvent.altKey())
+            m_modifiers |= MetaKey;
+
         m_timestamp = webEvent.timestamp();
 
         // PlatformMouseEvent
@@ -78,13 +84,13 @@ public:
         m_clickCount = webEvent.clickCount();
 
         m_modifierFlags = 0;
-        if (m_shiftKey)
+        if (webEvent.shiftKey())
             m_modifierFlags |= WebEvent::ShiftKey;
-        if (m_ctrlKey)
+        if (webEvent.controlKey())
             m_modifierFlags |= WebEvent::ControlKey;
-        if (m_altKey)
+        if (webEvent.altKey())
             m_modifierFlags |= WebEvent::AltKey;
-        if (m_metaKey)
+        if (webEvent.altKey())
             m_modifierFlags |= WebEvent::MetaKey;
 
 #if PLATFORM(WIN)
@@ -104,10 +110,17 @@ public:
     {
         // PlatformEvent
         m_type = PlatformEvent::Wheel;
-        m_shiftKey = webEvent.shiftKey();
-        m_ctrlKey = webEvent.controlKey();
-        m_altKey = webEvent.altKey();
-        m_metaKey = webEvent.metaKey();
+
+        m_modifiers = 0;
+        if (webEvent.shiftKey())
+            m_modifiers |= ShiftKey;
+        if (webEvent.controlKey())
+            m_modifiers |= CtrlKey;
+        if (webEvent.altKey())
+            m_modifiers |= AltKey;
+        if (webEvent.altKey())
+            m_modifiers |= MetaKey;
+
         m_timestamp = webEvent.timestamp();
 
         // PlatformWheelEvent
@@ -154,10 +167,16 @@ public:
             ASSERT_NOT_REACHED();
         }
 
-        m_shiftKey = webEvent.shiftKey();
-        m_ctrlKey = webEvent.controlKey();
-        m_altKey = webEvent.altKey();
-        m_metaKey = webEvent.metaKey();
+        m_modifiers = 0;
+        if (webEvent.shiftKey())
+            m_modifiers |= ShiftKey;
+        if (webEvent.controlKey())
+            m_modifiers |= CtrlKey;
+        if (webEvent.altKey())
+            m_modifiers |= AltKey;
+        if (webEvent.altKey())
+            m_modifiers |= MetaKey;
+
         m_timestamp = webEvent.timestamp();
 
         // PlatformKeyboardEvent
@@ -166,14 +185,10 @@ public:
         m_keyIdentifier = webEvent.keyIdentifier();
         m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode();
         m_nativeVirtualKeyCode = webEvent.nativeVirtualKeyCode();
+        m_macCharCode = webEvent.macCharCode();
         m_autoRepeat = webEvent.isAutoRepeat();
         m_isKeypad = webEvent.isKeypad();
-        
-#if PLATFORM(WIN)
-        // FIXME: We should make m_isSystemKey available (and false) on all platforms
-        // to avoid this #define. 
         m_isSystemKey = webEvent.isSystemKey();
-#endif
     }
 };
 
@@ -202,10 +217,16 @@ public:
             ASSERT_NOT_REACHED();
         }
 
-        m_shiftKey = webEvent.shiftKey();
-        m_ctrlKey = webEvent.controlKey();
-        m_altKey = webEvent.altKey();
-        m_metaKey = webEvent.metaKey();
+        m_modifiers = 0;
+        if (webEvent.shiftKey())
+            m_modifiers |= ShiftKey;
+        if (webEvent.controlKey())
+            m_modifiers |= CtrlKey;
+        if (webEvent.altKey())
+            m_modifiers |= AltKey;
+        if (webEvent.altKey())
+            m_modifiers |= MetaKey;
+
         m_timestamp = webEvent.timestamp();
 
         // PlatformGestureEvent
@@ -274,10 +295,16 @@ public:
             ASSERT_NOT_REACHED();
         }
 
-        m_ctrlKey = webEvent.controlKey();
-        m_altKey = webEvent.altKey();
-        m_shiftKey = webEvent.shiftKey();
-        m_metaKey = webEvent.metaKey();
+        m_modifiers = 0;
+        if (webEvent.shiftKey())
+            m_modifiers |= ShiftKey;
+        if (webEvent.controlKey())
+            m_modifiers |= CtrlKey;
+        if (webEvent.altKey())
+            m_modifiers |= AltKey;
+        if (webEvent.altKey())
+            m_modifiers |= MetaKey;
+
         m_timestamp = webEvent.timestamp();
 
         // PlatformTouchEvent
index dca018a..403eabb 100644 (file)
@@ -67,7 +67,7 @@
 #import <WebCore/IntRect.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/LocalizedStrings.h>
-#import <WebCore/PlatformMouseEvent.h>
+#import <WebCore/PlatformEventFactory.h>
 #import <WebCore/PlatformScreen.h>
 #import <WebCore/Region.h>
 #import <WebKitSystemInterface.h>
index 8581dff..29c4ac3 100644 (file)
@@ -65,6 +65,7 @@ void InitWebCoreSystemInterface(void)
         INIT(GetPreferredExtensionForMIMEType);
         INIT(GetUserToBaseCTM);
         INIT(GetWheelEventDeltas);
+        INIT(GetNSEventKeyChar);
         INIT(HitTestMediaUIPart);
         INIT(InitializeMaximumHTTPConnectionCountPerHost);
         INIT(MeasureMediaUIPart);