Reviewed by Eric.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2006 00:19:24 +0000 (00:19 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2006 00:19:24 +0000 (00:19 +0000)
        - removed KWQWindowWidget
        - changed most event handling to use references instead of pointers
        - chagned PageMac to no longer be a subclass of Page

        Yes, I know there's no detail in this ChangeLog entry.
        No, I don't plan to make a habit of doing things this way.
        Yes, this will probably break the Windows build again.

        * WebCore.xcodeproj/project.pbxproj:
        * bridge/mac/BrowserExtensionMac.mm:
        (WebCore::BrowserExtensionMac::createNewWindow):
        * bridge/mac/FrameViewMac.mm:
        * bridge/mac/MacFrame.h:
        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::MacFrame):
        (WebCore::MacFrame::~MacFrame):
        (WebCore::MacFrame::wheelEvent):
        (WebCore::MacFrame::keyEvent):
        (WebCore::MacFrame::khtmlMousePressEvent):
        (WebCore::MacFrame::khtmlMouseMoveEvent):
        (WebCore::MacFrame::khtmlMouseReleaseEvent):
        (WebCore::MacFrame::mouseDown):
        (WebCore::MacFrame::mouseDragged):
        (WebCore::MacFrame::mouseUp):
        (WebCore::MacFrame::mouseMoved):
        (WebCore::MacFrame::sendContextMenuEvent):
        (WebCore::MacFrame::setBridge):
        (WebCore::MacFrame::dragSourceMovedTo):
        (WebCore::MacFrame::dragSourceEndedAt):
        (WebCore::MacFrame::dispatchDragSrcEvent):
        * bridge/mac/PageMac.h: Removed.
        * bridge/mac/PageMac.mm: Added.
        (WebCore::Page::Page):
        (WebCore::Page::windowRect):
        (WebCore::Page::setWindowRect):
        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge page]):
        (-[WebCoreFrameBridge initializeSettings:]):
        (globalPoint):
        (createMouseEventFromDraggingInfo):
        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
        (-[WebCoreFrameBridge dragExitedWithDraggingInfo:]):
        (-[WebCoreFrameBridge concludeDragForDraggingInfo:]):
        (-[WebCoreFrameBridge dragSourceMovedTo:]):
        (-[WebCoreFrameBridge dragSourceEndedAt:operation:]):
        * bridge/mac/WebCoreFrameNamespaces.mm:
        (WebCore::):
        * bridge/mac/WebCorePageBridge.h:
        * bridge/mac/WebCorePageBridge.mm:
        (-[WebCorePageBridge init]):
        * dom/DocumentImpl.cpp:
        (WebCore::DocumentImpl::prepareMouseEvent):
        (WebCore::DocumentImpl::defaultEventHandler):
        * dom/DocumentImpl.h:
        * dom/NodeImpl.cpp:
        (WebCore::NodeImpl::dispatchMouseEvent):
        (WebCore::NodeImpl::dispatchKeyEvent):
        (WebCore::NodeImpl::dispatchWheelEvent):
        * dom/NodeImpl.h:
        * dom/dom2_eventsimpl.cpp:
        (WebCore::KeyboardEventImpl::KeyboardEventImpl):
        * dom/dom2_eventsimpl.h:
        (WebCore::KeyboardEventImpl::keyEvent):
        * khtml/ecma/kjs_window.cpp:
        (KJS::Window::getValueProperty):
        (KJS::WindowFunc::callAsFunction):
        * khtml/html/html_inlineimpl.cpp:
        (WebCore::HTMLAnchorElementImpl::defaultEventHandler):
        * ksvg2/svg/SVGDocumentImpl.cpp:
        * ksvg2/svg/SVGDocumentImpl.h:
        * kwq/KWQWindowWidget.h:
        * kwq/KWQWindowWidget.mm: Removed.
        * page/Frame.cpp:
        (WebCore::Frame::selectClosestWordFromMouseEvent):
        (WebCore::Frame::handleMousePressEventDoubleClick):
        (WebCore::Frame::handleMousePressEventTripleClick):
        (WebCore::Frame::handleMousePressEventSingleClick):
        (WebCore::Frame::khtmlMousePressEvent):
        (WebCore::Frame::handleMouseMoveEventSelection):
        (WebCore::Frame::khtmlMouseMoveEvent):
        (WebCore::Frame::khtmlMouseReleaseEvent):
        (WebCore::Frame::khtmlMouseDoubleClickEvent):
        (WebCore::Frame::passWidgetMouseDownEventToWidget):
        * page/Frame.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::viewportMousePressEvent):
        (WebCore::FrameView::viewportMouseDoubleClickEvent):
        (WebCore::FrameView::viewportMouseMoveEvent):
        (WebCore::FrameView::viewportMouseReleaseEvent):
        (WebCore::FrameView::dispatchDragEvent):
        (WebCore::FrameView::updateDragAndDrop):
        (WebCore::FrameView::cancelDragAndDrop):
        (WebCore::FrameView::performDragAndDrop):
        (WebCore::FrameView::dispatchMouseEvent):
        (WebCore::FrameView::viewportWheelEvent):
        * page/FrameView.h:
        * page/MouseEventWithHitTestResults.h:
        (WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
        (WebCore::MouseEventWithHitTestResults::event):
        * page/Page.cpp:
        (WebCore::Page::init):
        * page/Page.h:
        (WebCore::Page::bridge):
        * platform/KeyEvent.h:
        (WebCore::KeyEvent::isAutoRepeat):
        * platform/MouseEvent.h:
        (WebCore::MouseEvent::MouseEvent):
        * platform/mac/KeyEventMac.mm:
        (WebCore::KeyEvent::KeyEvent):
        * platform/win/TemporaryLinkStubs.cpp:
        (FrameView::isFrameView):
        * rendering/render_form.cpp:
        (WebCore::RenderFormElement::clicked):

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

36 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/BrowserExtensionMac.mm
WebCore/bridge/mac/FrameViewMac.mm
WebCore/bridge/mac/MacFrame.h
WebCore/bridge/mac/MacFrame.mm
WebCore/bridge/mac/PageMac.mm [moved from WebCore/bridge/mac/PageMac.h with 60% similarity]
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/bridge/mac/WebCoreFrameNamespaces.mm
WebCore/bridge/mac/WebCorePageBridge.h
WebCore/bridge/mac/WebCorePageBridge.mm
WebCore/dom/DocumentImpl.cpp
WebCore/dom/DocumentImpl.h
WebCore/dom/NodeImpl.cpp
WebCore/dom/NodeImpl.h
WebCore/dom/dom2_eventsimpl.cpp
WebCore/dom/dom2_eventsimpl.h
WebCore/khtml/ecma/kjs_window.cpp
WebCore/khtml/html/html_inlineimpl.cpp
WebCore/ksvg2/svg/SVGDocumentImpl.cpp
WebCore/ksvg2/svg/SVGDocumentImpl.h
WebCore/kwq/KWQWindowWidget.h [deleted file]
WebCore/kwq/KWQWindowWidget.mm [deleted file]
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/page/MouseEventWithHitTestResults.h
WebCore/page/Page.cpp
WebCore/page/Page.h
WebCore/platform/KeyEvent.h
WebCore/platform/MouseEvent.h
WebCore/platform/mac/KeyEventMac.mm
WebCore/platform/win/TemporaryLinkStubs.cpp
WebCore/rendering/render_form.cpp

index 41b8fecef9af1483171b0cb5e878ad1e97fbac3a..fe0a7939acb585c80faf07a8f5c68274dd7bff53 100644 (file)
@@ -1,3 +1,122 @@
+2006-03-16  Darin Adler  <darin@apple.com>
+
+        Reviewed by Eric.
+
+        - removed KWQWindowWidget
+        - changed most event handling to use references instead of pointers
+        - chagned PageMac to no longer be a subclass of Page
+
+        Yes, I know there's no detail in this ChangeLog entry.
+        No, I don't plan to make a habit of doing things this way.
+        Yes, this will probably break the Windows build again.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bridge/mac/BrowserExtensionMac.mm:
+        (WebCore::BrowserExtensionMac::createNewWindow):
+        * bridge/mac/FrameViewMac.mm:
+        * bridge/mac/MacFrame.h:
+        * bridge/mac/MacFrame.mm:
+        (WebCore::MacFrame::MacFrame):
+        (WebCore::MacFrame::~MacFrame):
+        (WebCore::MacFrame::wheelEvent):
+        (WebCore::MacFrame::keyEvent):
+        (WebCore::MacFrame::khtmlMousePressEvent):
+        (WebCore::MacFrame::khtmlMouseMoveEvent):
+        (WebCore::MacFrame::khtmlMouseReleaseEvent):
+        (WebCore::MacFrame::mouseDown):
+        (WebCore::MacFrame::mouseDragged):
+        (WebCore::MacFrame::mouseUp):
+        (WebCore::MacFrame::mouseMoved):
+        (WebCore::MacFrame::sendContextMenuEvent):
+        (WebCore::MacFrame::setBridge):
+        (WebCore::MacFrame::dragSourceMovedTo):
+        (WebCore::MacFrame::dragSourceEndedAt):
+        (WebCore::MacFrame::dispatchDragSrcEvent):
+        * bridge/mac/PageMac.h: Removed.
+        * bridge/mac/PageMac.mm: Added.
+        (WebCore::Page::Page):
+        (WebCore::Page::windowRect):
+        (WebCore::Page::setWindowRect):
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge page]):
+        (-[WebCoreFrameBridge initializeSettings:]):
+        (globalPoint):
+        (createMouseEventFromDraggingInfo):
+        (-[WebCoreFrameBridge dragOperationForDraggingInfo:]):
+        (-[WebCoreFrameBridge dragExitedWithDraggingInfo:]):
+        (-[WebCoreFrameBridge concludeDragForDraggingInfo:]):
+        (-[WebCoreFrameBridge dragSourceMovedTo:]):
+        (-[WebCoreFrameBridge dragSourceEndedAt:operation:]):
+        * bridge/mac/WebCoreFrameNamespaces.mm:
+        (WebCore::):
+        * bridge/mac/WebCorePageBridge.h:
+        * bridge/mac/WebCorePageBridge.mm:
+        (-[WebCorePageBridge init]):
+        * dom/DocumentImpl.cpp:
+        (WebCore::DocumentImpl::prepareMouseEvent):
+        (WebCore::DocumentImpl::defaultEventHandler):
+        * dom/DocumentImpl.h:
+        * dom/NodeImpl.cpp:
+        (WebCore::NodeImpl::dispatchMouseEvent):
+        (WebCore::NodeImpl::dispatchKeyEvent):
+        (WebCore::NodeImpl::dispatchWheelEvent):
+        * dom/NodeImpl.h:
+        * dom/dom2_eventsimpl.cpp:
+        (WebCore::KeyboardEventImpl::KeyboardEventImpl):
+        * dom/dom2_eventsimpl.h:
+        (WebCore::KeyboardEventImpl::keyEvent):
+        * khtml/ecma/kjs_window.cpp:
+        (KJS::Window::getValueProperty):
+        (KJS::WindowFunc::callAsFunction):
+        * khtml/html/html_inlineimpl.cpp:
+        (WebCore::HTMLAnchorElementImpl::defaultEventHandler):
+        * ksvg2/svg/SVGDocumentImpl.cpp:
+        * ksvg2/svg/SVGDocumentImpl.h:
+        * kwq/KWQWindowWidget.h:
+        * kwq/KWQWindowWidget.mm: Removed.
+        * page/Frame.cpp:
+        (WebCore::Frame::selectClosestWordFromMouseEvent):
+        (WebCore::Frame::handleMousePressEventDoubleClick):
+        (WebCore::Frame::handleMousePressEventTripleClick):
+        (WebCore::Frame::handleMousePressEventSingleClick):
+        (WebCore::Frame::khtmlMousePressEvent):
+        (WebCore::Frame::handleMouseMoveEventSelection):
+        (WebCore::Frame::khtmlMouseMoveEvent):
+        (WebCore::Frame::khtmlMouseReleaseEvent):
+        (WebCore::Frame::khtmlMouseDoubleClickEvent):
+        (WebCore::Frame::passWidgetMouseDownEventToWidget):
+        * page/Frame.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::viewportMousePressEvent):
+        (WebCore::FrameView::viewportMouseDoubleClickEvent):
+        (WebCore::FrameView::viewportMouseMoveEvent):
+        (WebCore::FrameView::viewportMouseReleaseEvent):
+        (WebCore::FrameView::dispatchDragEvent):
+        (WebCore::FrameView::updateDragAndDrop):
+        (WebCore::FrameView::cancelDragAndDrop):
+        (WebCore::FrameView::performDragAndDrop):
+        (WebCore::FrameView::dispatchMouseEvent):
+        (WebCore::FrameView::viewportWheelEvent):
+        * page/FrameView.h:
+        * page/MouseEventWithHitTestResults.h:
+        (WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
+        (WebCore::MouseEventWithHitTestResults::event):
+        * page/Page.cpp:
+        (WebCore::Page::init):
+        * page/Page.h:
+        (WebCore::Page::bridge):
+        * platform/KeyEvent.h:
+        (WebCore::KeyEvent::isAutoRepeat):
+        * platform/MouseEvent.h:
+        (WebCore::MouseEvent::MouseEvent):
+        * platform/mac/KeyEventMac.mm:
+        (WebCore::KeyEvent::KeyEvent):
+        * platform/win/TemporaryLinkStubs.cpp:
+        (FrameView::isFrameView):
+        * rendering/render_form.cpp:
+        (WebCore::RenderFormElement::clicked):
+
 2006-03-16  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by darin.
index 2ec5264369f2492ae0a49b1e11a8266020af30d2..2732c264b845142dcc8f3296edeaa5371c6b631b 100644 (file)
                935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 935FBCF109BA143B00E230B1 /* ExceptionCode.h */; };
                936B424E09A436CD00BAA820 /* KSVGCSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6F6089701F100BA5114 /* KSVGCSSParser.cpp */; };
                937A36A7097E2E3200E4EE2F /* UserAgentStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 937A36A6097E2E3200E4EE2F /* UserAgentStyleSheets.cpp */; };
-               937D809A09A063330092A01E /* PageMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 937D809909A063330092A01E /* PageMac.h */; };
                9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9380F47109A11AB4001FDB34 /* Widget.cpp */; };
                9380F47409A11AB4001FDB34 /* Widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 9380F47209A11AB4001FDB34 /* Widget.h */; };
                9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9380F47709A11ACC001FDB34 /* WidgetMac.mm */; };
                93CD4FE30995F9EA007ECC97 /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93CD4FDC0995F9EA007ECC97 /* StringImpl.cpp */; };
                93CD4FE40995F9EA007ECC97 /* StringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CD4FDD0995F9EA007ECC97 /* StringImpl.h */; };
                93CD4FEC0995FD2A007ECC97 /* PlatformString.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CD4FEB0995FD2A007ECC97 /* PlatformString.h */; };
+               93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */; };
                93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E62D990985F41600E1B5E3 /* SystemTime.h */; };
                93EEC1F809C2877700C515D1 /* Attr.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93EEC1E509C2877700C515D1 /* Attr.idl */; };
                93EEC1F909C2877700C515D1 /* CharacterData.idl in Resources */ = {isa = PBXBuildFile; fileRef = 93EEC1E609C2877700C515D1 /* CharacterData.idl */; };
                93F1999B08245E59001E9ABC /* KWQTextStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786BF02DE3B8601EA4122 /* KWQTextStream.h */; };
                93F1999D08245E59001E9ABC /* KWQValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C202DE3B8601EA4122 /* KWQValueList.h */; };
                93F1999E08245E59001E9ABC /* KWQValueListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587853B02DE375901EA4122 /* KWQValueListImpl.h */; };
-               93F199A308245E59001E9ABC /* KWQWindowWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = F587854302DE375901EA4122 /* KWQWindowWidget.h */; };
                93F199A508245E59001E9ABC /* WebCoreCache.h in Headers */ = {isa = PBXBuildFile; fileRef = F5B2A4FC02E2220F018635CB /* WebCoreCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199A608245E59001E9ABC /* WebCoreCookieAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = F587854902DE375901EA4122 /* WebCoreCookieAdapter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199A708245E59001E9ABC /* WebCoreEncodings.h in Headers */ = {isa = PBXBuildFile; fileRef = F56234DF03026D7301629B47 /* WebCoreEncodings.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F19A5308245E59001E9ABC /* KWQTextEdit.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587853802DE375901EA4122 /* KWQTextEdit.mm */; };
                93F19A5408245E59001E9ABC /* KWQTextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853902DE375901EA4122 /* KWQTextStream.cpp */; };
                93F19A5608245E59001E9ABC /* KWQValueListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853C02DE375901EA4122 /* KWQValueListImpl.cpp */; };
-               93F19A5A08245E59001E9ABC /* KWQWindowWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587854402DE375901EA4122 /* KWQWindowWidget.mm */; };
                93F19A5C08245E59001E9ABC /* WebCoreCookieAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = F587854A02DE375901EA4122 /* WebCoreCookieAdapter.m */; };
                93F19A5D08245E59001E9ABC /* WebCoreImageRendererFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587854F02DE375901EA4122 /* WebCoreImageRendererFactory.m */; };
                93F19A5E08245E59001E9ABC /* WebCoreTextRendererFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587855302DE375901EA4122 /* WebCoreTextRendererFactory.mm */; };
                935FBC4409BA00B900E230B1 /* EventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventListener.h; sourceTree = "<group>"; };
                935FBCF109BA143B00E230B1 /* ExceptionCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCode.h; sourceTree = "<group>"; };
                937A36A6097E2E3200E4EE2F /* UserAgentStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserAgentStyleSheets.cpp; sourceTree = "<group>"; };
-               937D809909A063330092A01E /* PageMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageMac.h; sourceTree = "<group>"; };
                9380F47109A11AB4001FDB34 /* Widget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Widget.cpp; path = platform/Widget.cpp; sourceTree = "<group>"; };
                9380F47209A11AB4001FDB34 /* Widget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Widget.h; path = platform/Widget.h; sourceTree = "<group>"; };
                9380F47709A11ACC001FDB34 /* WidgetMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetMac.mm; sourceTree = "<group>"; };
                93CD4FDC0995F9EA007ECC97 /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImpl.cpp; path = platform/StringImpl.cpp; sourceTree = "<group>"; };
                93CD4FDD0995F9EA007ECC97 /* StringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringImpl.h; path = platform/StringImpl.h; sourceTree = "<group>"; };
                93CD4FEB0995FD2A007ECC97 /* PlatformString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformString.h; path = platform/PlatformString.h; sourceTree = "<group>"; };
+               93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; };
                93E62D990985F41600E1B5E3 /* SystemTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemTime.h; path = platform/SystemTime.h; sourceTree = "<group>"; };
                93EEC1E509C2877700C515D1 /* Attr.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Attr.idl; sourceTree = "<group>"; };
                93EEC1E609C2877700C515D1 /* CharacterData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CharacterData.idl; sourceTree = "<group>"; };
                F587853902DE375901EA4122 /* KWQTextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQTextStream.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587853B02DE375901EA4122 /* KWQValueListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQValueListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587853C02DE375901EA4122 /* KWQValueListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQValueListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F587854302DE375901EA4122 /* KWQWindowWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQWindowWidget.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F587854402DE375901EA4122 /* KWQWindowWidget.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQWindowWidget.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587854902DE375901EA4122 /* WebCoreCookieAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreCookieAdapter.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587854A02DE375901EA4122 /* WebCoreCookieAdapter.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreCookieAdapter.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587854C02DE375901EA4122 /* WebCoreFrameView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFrameView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                935C475E09AC4CAE00A6AAB4 /* HistoryMac.mm */,
                                65BF023B0974819000C43196 /* MacFrame.h */,
                                65BF023C0974819000C43196 /* MacFrame.mm */,
-                               937D809909A063330092A01E /* PageMac.h */,
+                               93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */,
                                F5B2A4FC02E2220F018635CB /* WebCoreCache.h */,
                                F5B2A4FD02E2220F018635CB /* WebCoreCache.mm */,
                                F56234DF03026D7301629B47 /* WebCoreEncodings.h */,
                                F587853602DE375901EA4122 /* KWQTextArea.mm */,
                                F587851B02DE375901EA4122 /* KWQTextField.h */,
                                F587851C02DE375901EA4122 /* KWQTextField.mm */,
-                               F587854302DE375901EA4122 /* KWQWindowWidget.h */,
-                               F587854402DE375901EA4122 /* KWQWindowWidget.mm */,
                        );
                        name = other;
                        sourceTree = "<group>";
                                93F1999B08245E59001E9ABC /* KWQTextStream.h in Headers */,
                                93F1999D08245E59001E9ABC /* KWQValueList.h in Headers */,
                                93F1999E08245E59001E9ABC /* KWQValueListImpl.h in Headers */,
-                               93F199A308245E59001E9ABC /* KWQWindowWidget.h in Headers */,
                                93F199A508245E59001E9ABC /* WebCoreCache.h in Headers */,
                                93F199A608245E59001E9ABC /* WebCoreCookieAdapter.h in Headers */,
                                93F199A708245E59001E9ABC /* WebCoreEncodings.h in Headers */,
                                6550B6A2099DF0270090D781 /* CommentImpl.h in Headers */,
                                6550B6A4099DF0270090D781 /* EditingTextImpl.h in Headers */,
                                6550B6A6099DF0270090D781 /* TextImpl.h in Headers */,
-                               937D809A09A063330092A01E /* PageMac.h in Headers */,
                                9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
                                ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */,
                                BCC47E2709A3D6F100ADB771 /* FontFamily.h in Headers */,
                                93F19A5308245E59001E9ABC /* KWQTextEdit.mm in Sources */,
                                93F19A5408245E59001E9ABC /* KWQTextStream.cpp in Sources */,
                                93F19A5608245E59001E9ABC /* KWQValueListImpl.cpp in Sources */,
-                               93F19A5A08245E59001E9ABC /* KWQWindowWidget.mm in Sources */,
                                93F19A5C08245E59001E9ABC /* WebCoreCookieAdapter.m in Sources */,
                                93F19A5D08245E59001E9ABC /* WebCoreImageRendererFactory.m in Sources */,
                                93F19A5E08245E59001E9ABC /* WebCoreTextRendererFactory.mm in Sources */,
                                935207C009BD412100F2038D /* LocalizedStringsMac.mm in Sources */,
                                9352084509BD43B900F2038D /* Language.mm in Sources */,
                                9352087709BD453400F2038D /* CookieJar.mm in Sources */,
+                               93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */,
                                93EEC1FF09C2877700C515D1 /* CanvasRenderingContext2D.cpp in Sources */,
                                93EEC20209C2877700C515D1 /* CanvasGradient.cpp in Sources */,
                                93EEC26F09C3218000C515D1 /* CanvasPattern.cpp in Sources */,
index 8905259959fdf572fb25709f6e193fcd2f0d2f36..18f44e50df5bebe2beb4a80bc44a8680b7d2673c 100644 (file)
@@ -130,7 +130,7 @@ void BrowserExtensionMac::createNewWindow(const KURL& url,
     [bridge setScrollbarsVisible:winArgs.scrollBarsVisible];
     [bridge setWindowIsResizable:winArgs.resizable];
     
-    NSRect windowFrame = [bridge windowFrame];
+    NSRect windowFrame = [page windowFrame];
 
     NSSize size = { 1, 1 }; // workaround for 4213314
     NSSize scaleRect = [[page outerView] convertSize:size toView:nil];
@@ -162,7 +162,7 @@ void BrowserExtensionMac::createNewWindow(const KURL& url,
        windowFrame.origin.y -= heightDelta;
     }
     
-    [bridge setWindowFrame:windowFrame];
+    [page setWindowFrame:windowFrame];
     
     [bridge showWindow];
     
index 51cba7920b32a5c8bb52f84c68ad2f798e7eeb14..35d86e83b44127d874fea3cb15eb529135f9ec63 100644 (file)
 
 #import "DocumentImpl.h"
 #import "KWQExceptions.h"
-#import "KWQWindowWidget.h"
 #import "MacFrame.h"
 #import "WebCoreFrameBridge.h"
 #import "render_object.h"
 
 namespace WebCore {
 
-Widget* FrameView::topLevelWidget() const 
-{
-    return Mac(frame())->topLevelWidget();
-}
-
 void FrameView::updateBorder()
 {
     KWQ_BLOCK_EXCEPTIONS;
@@ -58,9 +52,4 @@ void FrameView::updateDashboardRegions()
     }
 }
 
-IntPoint FrameView::viewportToGlobal(const IntPoint &p) const
-{
-    return static_cast<KWQWindowWidget*>(topLevelWidget())->viewportToGlobal(p);
-}
-
 }
index a2f3100db5e88657db70d7e344e9b9732d66cdd3..7b375ef1a7e76dbd565ed706e46b37bd8341d4b8 100644 (file)
@@ -30,6 +30,7 @@
 #include "IntRect.h"
 #include "KWQClipboard.h"
 #include "KWQScrollBar.h"
+#include "MouseEvent.h"
 #include "NodeImpl.h"
 #include "WebCoreKeyboardAccess.h"
 #include "text_affinity.h"
@@ -37,7 +38,6 @@
 
 #import <CoreFoundation/CoreFoundation.h>
 
-class KWQWindowWidget;
 class NPObject;
 
 namespace KJS {
@@ -189,7 +189,7 @@ public:
     NSImage *selectionImage() const;
     NSImage *snapshotDragImage(NodeImpl *node, NSRect *imageRect, NSRect *elementRect) const;
 
-    bool dispatchDragSrcEvent(const AtomicString &eventType, const IntPoint &loc) const;
+    bool dispatchDragSrcEvent(const AtomicString &eventType, const MouseEvent&) const;
 
     NSFont *fontForSelection(bool *hasMultipleFonts) const;
     NSDictionary *fontAttributesForSelectionStart() const;
@@ -216,8 +216,8 @@ public:
 
     bool dragHysteresisExceeded(float dragLocationX, float dragLocationY) const;
     bool eventMayStartDrag(NSEvent *) const;
-    void dragSourceMovedTo(const IntPoint &loc);
-    void dragSourceEndedAt(const IntPoint &loc, NSDragOperation operation);
+    void dragSourceMovedTo(const MouseEvent&);
+    void dragSourceEndedAt(const MouseEvent&, NSDragOperation);
 
     bool mayCut();
     bool mayCopy();
@@ -241,8 +241,6 @@ public:
 
     bool findString(NSString *str, bool forward, bool caseFlag, bool wrapFlag);
 
-    KWQWindowWidget *topLevelWidget();
-    
     virtual void tokenizerProcessedData();
 
     virtual QString overrideMediaType() const;
@@ -317,9 +315,9 @@ protected:
     virtual void redirectionTimerFired(Timer<Frame>*);
 
 private:
-    virtual void khtmlMousePressEvent(MouseEventWithHitTestResults *);
-    virtual void khtmlMouseMoveEvent(MouseEventWithHitTestResults *);
-    virtual void khtmlMouseReleaseEvent(MouseEventWithHitTestResults *);
+    virtual void khtmlMousePressEvent(const MouseEventWithHitTestResults&);
+    virtual void khtmlMouseMoveEvent(const MouseEventWithHitTestResults&);
+    virtual void khtmlMouseReleaseEvent(const MouseEventWithHitTestResults&);
     
     NSView *mouseDownViewIfStillGood();
 
@@ -343,8 +341,7 @@ private:
     bool _sendingEventToSubview;
     bool _mouseDownMayStartDrag;
     bool _mouseDownMayStartSelect;
-    // in our window's coords
-    int _mouseDownWinX, _mouseDownWinY;
+    MouseEvent m_mouseDown;
     // in our view's coords
     int _mouseDownX, _mouseDownY;
     float _mouseDownTimestamp;
@@ -355,8 +352,6 @@ private:
     NSMutableDictionary *_formValuesAboutToBeSubmitted;
     ObjCDOMElement *_formAboutToBeSubmitted;
 
-    KWQWindowWidget *_windowWidget;
-
     bool _haveUndoRedoOperations;
     
     HashSet<RefPtr<DOMStringImpl> > urlsBridgeKnowsAbout;
index d8e06ebd8d15096e6794026deee275b9594d0687..70cc576b169ce40db116cd80fd4094011ed689c0 100644 (file)
@@ -50,7 +50,6 @@
 #import "KWQRegExp.h"
 #import "KWQScrollBar.h"
 #import "TextEncoding.h"
-#import "KWQWindowWidget.h"
 #import "KeyEvent.h"
 #import "MouseEvent.h"
 #import "MouseEventWithHitTestResults.h"
@@ -123,7 +122,6 @@ MacFrame::MacFrame(Page* page, RenderPart* ownerRenderer)
     , _activationEventNumber(0)
     , _formValuesAboutToBeSubmitted(nil)
     , _formAboutToBeSubmitted(nil)
-    , _windowWidget(0)
     , _bindingRoot(0)
     , _windowScriptObject(0)
     , _windowScriptNPObject(0)
@@ -143,8 +141,6 @@ MacFrame::~MacFrame()
     [_bridge clearFrame];
     KWQRelease(_bridge);
     _bridge = nil;
-
-    delete _windowWidget;
 }
 
 void MacFrame::freeClipboard()
@@ -789,7 +785,7 @@ bool MacFrame::wheelEvent(NSEvent *event)
         _currentEvent = KWQRetain(event);
 
         WheelEvent qEvent(event);
-        v->viewportWheelEvent(&qEvent);
+        v->viewportWheelEvent(qEvent);
 
         ASSERT(_currentEvent == event);
         KWQRelease(event);
@@ -1373,7 +1369,7 @@ bool MacFrame::keyEvent(NSEvent *event)
     _currentEvent = KWQRetain(event);
 
     KeyEvent qEvent(event);
-    result = !node->dispatchKeyEvent(&qEvent);
+    result = !node->dispatchKeyEvent(qEvent);
 
     // We want to send both a down and a press for the initial key event.
     // To get KHTML to do this, we send a second KeyPress with "is repeat" set to true,
@@ -1381,9 +1377,8 @@ bool MacFrame::keyEvent(NSEvent *event)
     // That's not a great hack; it would be good to do this in a better way.
     if ([event type] == NSKeyDown && ![event isARepeat]) {
         KeyEvent repeatEvent(event, true);
-        if (!node->dispatchKeyEvent(&repeatEvent)) {
+        if (!node->dispatchKeyEvent(repeatEvent))
             result = true;
-        }
     }
 
     ASSERT(_currentEvent == event);
@@ -1397,18 +1392,18 @@ bool MacFrame::keyEvent(NSEvent *event)
     return false;
 }
 
-void MacFrame::khtmlMousePressEvent(MouseEventWithHitTestResults *event)
+void MacFrame::khtmlMousePressEvent(const MouseEventWithHitTestResults& event)
 {
     bool singleClick = [_currentEvent clickCount] <= 1;
 
     // If we got the event back, that must mean it wasn't prevented,
     // so it's allowed to start a drag or selection.
-    _mouseDownMayStartSelect = canMouseDownStartSelect(event->innerNode());
+    _mouseDownMayStartSelect = canMouseDownStartSelect(event.innerNode());
     
     // Careful that the drag starting logic stays in sync with eventMayStartDrag()
     _mouseDownMayStartDrag = singleClick;
 
-    d->m_mousePressNode = event->innerNode();
+    d->m_mousePressNode = event.innerNode();
     
     if (!passWidgetMouseDownEventToWidget(event, false)) {
         // We don't do this at the start of mouse down handling (before calling into WebCore),
@@ -1609,7 +1604,7 @@ bool MacFrame::dragHysteresisExceeded(float dragLocationX, float dragLocationY)
     return deltaX >= threshold || deltaY >= threshold;
 }
 
-void MacFrame::khtmlMouseMoveEvent(MouseEventWithHitTestResults *event)
+void MacFrame::khtmlMouseMoveEvent(const MouseEventWithHitTestResults& event)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
@@ -1697,7 +1692,7 @@ void MacFrame::khtmlMouseMoveEvent(MouseEventWithHitTestResults *event)
                         _dragClipboard->setDragImageElement(_dragSrc.get(), IntPoint(_mouseDownX - srcX, _mouseDownY - srcY));
                     } 
 
-                    _mouseDownMayStartDrag = dispatchDragSrcEvent(dragstartEvent, IntPoint(_mouseDownWinX, _mouseDownWinY));
+                    _mouseDownMayStartDrag = dispatchDragSrcEvent(dragstartEvent, m_mouseDown);
                     // Invalidate clipboard here against anymore pasteboard writing for security.  The drag
                     // image can still be changed as we drag, but not the pasteboard data.
                     _dragClipboard->setAccessPolicy(KWQClipboard::ImageWritable);
@@ -1724,7 +1719,8 @@ void MacFrame::khtmlMouseMoveEvent(MouseEventWithHitTestResults *event)
                     BOOL startedDrag = [_bridge startDraggingImage:dragImage at:dragLoc operation:srcOp event:_currentEvent sourceIsDHTML:_dragSrcIsDHTML DHTMLWroteData:wcWrotePasteboard];
                     if (!startedDrag && _dragSrcMayBeDHTML) {
                         // WebKit canned the drag at the last minute - we owe _dragSrc a DRAGEND event
-                        dispatchDragSrcEvent(dragendEvent, IntPoint(dragLocation));
+                        MouseEvent event;
+                        dispatchDragSrcEvent(dragendEvent, event);
                         _mouseDownMayStartDrag = false;
                     }
                 } 
@@ -1747,7 +1743,7 @@ void MacFrame::khtmlMouseMoveEvent(MouseEventWithHitTestResults *event)
         _mouseDownMayStartDrag = false;
         d->m_view->invalidateClick();
 
-        NodeImpl* node = event->innerNode();
+        NodeImpl* node = event.innerNode();
         RenderLayer* layer = 0;
         if (node && node->renderer())
             layer = node->renderer()->enclosingLayer();
@@ -1840,7 +1836,7 @@ bool MacFrame::tryPaste()
     return !dispatchCPPEvent(pasteEvent, KWQClipboard::Readable);
 }
 
-void MacFrame::khtmlMouseReleaseEvent(MouseEventWithHitTestResults *event)
+void MacFrame::khtmlMouseReleaseEvent(const MouseEventWithHitTestResults& event)
 {
     NSView *view = mouseDownViewIfStillGood();
     if (!view) {
@@ -1849,9 +1845,8 @@ void MacFrame::khtmlMouseReleaseEvent(MouseEventWithHitTestResults *event)
         // the mouse down and drag events to see if we might start a drag.  For other first clicks
         // in a window, we just don't acceptFirstMouse, and the whole down-drag-up sequence gets
         // ignored upstream of this layer.
-        if (_activationEventNumber != [_currentEvent eventNumber]) {
+        if (_activationEventNumber != [_currentEvent eventNumber])
             Frame::khtmlMouseReleaseEvent(event);
-        }
         return;
     }
     stopAutoscrollTimer();
@@ -1984,17 +1979,15 @@ void MacFrame::mouseDown(NSEvent *event)
     
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = KWQRetain(event);
+    m_mouseDown = MouseEvent(event);
     NSPoint loc = [event locationInWindow];
-    _mouseDownWinX = (int)loc.x;
-    _mouseDownWinY = (int)loc.y;
-    d->m_view->viewportToContents(_mouseDownWinX, _mouseDownWinY, _mouseDownX, _mouseDownY);
+    d->m_view->viewportToContents((int)loc.x, (int)loc.y, _mouseDownX, _mouseDownY);
     _mouseDownTimestamp = [event timestamp];
 
     _mouseDownMayStartDrag = false;
     _mouseDownMayStartSelect = false;
 
-    MouseEvent kEvent(event);
-    v->viewportMousePressEvent(&kEvent);
+    v->viewportMousePressEvent(event);
     
     ASSERT(_currentEvent == event);
     KWQRelease(event);
@@ -2015,8 +2008,7 @@ void MacFrame::mouseDragged(NSEvent *event)
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = KWQRetain(event);
 
-    MouseEvent kEvent(event);
-    v->viewportMouseMoveEvent(&kEvent);
+    v->viewportMouseMoveEvent(event);
     
     ASSERT(_currentEvent == event);
     KWQRelease(event);
@@ -2044,13 +2036,10 @@ void MacFrame::mouseUp(NSEvent *event)
     // a triple click is treated as a single click, but the fourth is then
     // treated as another double click. Hence the "% 2" below.
     int clickCount = [event clickCount];
-    if (clickCount > 0 && clickCount % 2 == 0) {
-        MouseEvent doubleClickEvent(event);
-        v->viewportMouseDoubleClickEvent(&doubleClickEvent);
-    } else {
-        MouseEvent releaseEvent(event);
-        v->viewportMouseReleaseEvent(&releaseEvent);
-    }
+    if (clickCount > 0 && clickCount % 2 == 0)
+        v->viewportMouseDoubleClickEvent(event);
+    else
+        v->viewportMouseReleaseEvent(event);
     
     ASSERT(_currentEvent == event);
     KWQRelease(event);
@@ -2135,8 +2124,7 @@ void MacFrame::mouseMoved(NSEvent *event)
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = KWQRetain(event);
     
-    MouseEvent kEvent(event);
-    v->viewportMouseMoveEvent(&kEvent);
+    v->viewportMouseMoveEvent(event);
     
     ASSERT(_currentEvent == event);
     KWQRelease(event);
@@ -2179,12 +2167,12 @@ bool MacFrame::sendContextMenuEvent(NSEvent *event)
     int xm, ym;
     v->viewportToContents(mouseEvent.x(), mouseEvent.y(), xm, ym);
 
-    MouseEventWithHitTestResults mev = doc->prepareMouseEvent(false, true, false, xm, ym, &mouseEvent);
+    MouseEventWithHitTestResults mev = doc->prepareMouseEvent(false, true, false, xm, ym, mouseEvent);
 
-    swallowEvent = v->dispatchMouseEvent(contextmenuEvent, mev.innerNode(), true, 0, &mouseEvent, true);
+    swallowEvent = v->dispatchMouseEvent(contextmenuEvent, mev.innerNode(), true, 0, mouseEvent, true);
     if (!swallowEvent && !isPointInsideSelection(xm, ym) &&
         ([_bridge selectWordBeforeMenuEvent] || [_bridge isEditable] || mev.innerNode()->isContentEditable())) {
-        selectClosestWordFromMouseEvent(&mouseEvent, mev.innerNode(), xm, ym);
+        selectClosestWordFromMouseEvent(mouseEvent, mev.innerNode(), xm, ym);
     }
 
     ASSERT(_currentEvent == event);
@@ -2889,11 +2877,6 @@ NSWritingDirection MacFrame::baseWritingDirectionForSelectionStart() const
     return result;
 }
 
-KWQWindowWidget *MacFrame::topLevelWidget()
-{
-    return _windowWidget;
-}
-
 void MacFrame::tokenizerProcessedData()
 {
     if (d->m_doc) {
@@ -2907,11 +2890,9 @@ void MacFrame::setBridge(WebCoreFrameBridge *bridge)
     if (_bridge == bridge)
         return;
 
-    delete _windowWidget;
     KWQRetain(bridge);
     KWQRelease(_bridge);
     _bridge = bridge;
-    _windowWidget = new KWQWindowWidget(_bridge);
 }
 
 QString MacFrame::overrideMediaType() const
@@ -3451,29 +3432,29 @@ bool MacFrame::shouldClose()
     return true;
 }
 
-void MacFrame::dragSourceMovedTo(const IntPoint &loc)
+void MacFrame::dragSourceMovedTo(const MouseEvent& event)
 {
     if (_dragSrc && _dragSrcMayBeDHTML) {
         // for now we don't care if event handler cancels default behavior, since there is none
-        dispatchDragSrcEvent(dragEvent, loc);
+        dispatchDragSrcEvent(dragEvent, event);
     }
 }
 
-void MacFrame::dragSourceEndedAt(const IntPoint &loc, NSDragOperation operation)
+void MacFrame::dragSourceEndedAt(const MouseEvent& event, NSDragOperation operation)
 {
     if (_dragSrc && _dragSrcMayBeDHTML) {
         _dragClipboard->setDestinationOperation(operation);
         // for now we don't care if event handler cancels default behavior, since there is none
-        dispatchDragSrcEvent(dragendEvent, loc);
+        dispatchDragSrcEvent(dragendEvent, event);
     }
     freeClipboard();
     _dragSrc = 0;
 }
 
 // returns if we should continue "default processing", i.e., whether eventhandler canceled
-bool MacFrame::dispatchDragSrcEvent(const AtomicString &eventType, const IntPoint &loc) const
+bool MacFrame::dispatchDragSrcEvent(const AtomicString &eventType, const MouseEvent& event) const
 {
-    bool noDefaultProc = d->m_view->dispatchDragEvent(eventType, _dragSrc.get(), loc, _dragClipboard.get());
+    bool noDefaultProc = d->m_view->dispatchDragEvent(eventType, _dragSrc.get(), event, _dragClipboard.get());
     return !noDefaultProc;
 }
 
similarity index 60%
rename from WebCore/bridge/mac/PageMac.h
rename to WebCore/bridge/mac/PageMac.mm
index 7e72206df3106987a12ccf72528808a05f203caf..fddb71a3f0efd369e0b38061b6ce587905b8fa2a 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef PAGE_MAC_H
-#define PAGE_MAC_H
+#import "config.h"
+#import "Page.h"
 
-#include "Page.h"
-
-#ifdef __OBJC__
-@class WebCorePageBridge;
-#else
-class WebCorePageBridge;
-#endif
+#import "Frame.h"
+#import "IntRect.h"
+#import "WebCorePageBridge.h"
 
 namespace WebCore {
 
-    class PageMac : public Page {
-    public:
-        PageMac(WebCorePageBridge* b) : m_bridge(b) { }
-        WebCorePageBridge* bridge() const { return m_bridge; }
-    private:
-        WebCorePageBridge* m_bridge;
-    };
+static NSRect flipGlobalRect(NSRect rect)
+{
+    rect.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(rect);
+    return rect;
+}
+
+Page::Page(WebCorePageBridge* bridge)
+    : m_frameCount(0), m_bridge(bridge)
+{
+    init();
+}
+
+IntRect Page::windowRect() const
+{
+    return enclosingIntRect(flipGlobalRect([bridge() windowFrame]));
+}
 
-    inline PageMac* Mac(Page* page) { return static_cast<PageMac*>(page); }
-    inline const PageMac* Mac(const Page* page) { return static_cast<const PageMac*>(page); }
+void Page::setWindowRect(const IntRect& r)
+{
+    [bridge() setWindowFrame:flipGlobalRect(r)];
+}
 
-} // namespace WebCore
-    
-#endif // PAGE_H
+}
index 24b4c2d8759b3eebcc040db4bf8931b1388849f2..8d785eb678fcd4050ce399abf7296cca6338549f 100644 (file)
@@ -511,10 +511,6 @@ typedef enum {
 - (BOOL)areScrollbarsVisible;
 - (void)setScrollbarsVisible:(BOOL)visible;
 - (NSWindow *)window;
-- (void)setWindowFrame:(NSRect)frame;
-- (NSRect)windowFrame;
-- (void)setWindowContentRect:(NSRect)frame;
-- (NSRect)windowContentRect;
 
 - (void)setWindowIsResizable:(BOOL)resizable;
 - (BOOL)windowIsResizable;
index 22abbfd2b9d205239300c88450b14bc758bca26a..4f47661073031988697320d536bafc1821bc6fbc 100644 (file)
@@ -48,7 +48,7 @@
 #import "TextEncoding.h"
 #import "MacFrame.h"
 #import "NodeImpl.h"
-#import "PageMac.h"
+#import "Page.h"
 #import "SelectionController.h"
 #import "WebCorePageBridge.h"
 #import "WebCoreSettings.h"
@@ -478,12 +478,12 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 
 - (WebCorePageBridge *)page
 {
-    return Mac(m_frame->page())->bridge();
+    return m_frame->page()->bridge();
 }
 
-- (void)initializeSettings: (WebCoreSettings *)settings
+- (void)initializeSettings:(WebCoreSettings *)settings
 {
-    m_frame->setSettings ([settings settings]);
+    m_frame->setSettings([settings settings]);
 }
 
 - (void)dealloc
@@ -2291,6 +2291,19 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return m_frame ? m_frame->eventMayStartDrag(event) : NO;
 }
 
+static IntPoint globalPoint(NSWindow* window, NSPoint windowPoint)
+{
+    NSPoint screenPoint = [window convertBaseToScreen:windowPoint];
+    return IntPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
+}
+
+static MouseEvent createMouseEventFromDraggingInfo(NSWindow* window, id <NSDraggingInfo> info)
+{
+    // FIXME: Fake modifier keys here.
+    return MouseEvent(IntPoint([info draggingLocation]), globalPoint(window, [info draggingLocation]),
+        LeftButton, 0, false, false, false, false);
+}
+
 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info
 {
     NSDragOperation op = NSDragOperationNone;
@@ -2302,7 +2315,8 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
             NSDragOperation srcOp = [info draggingSourceOperationMask];
             clipboard->setSourceOperation(srcOp);
 
-            if (v->updateDragAndDrop(IntPoint([info draggingLocation]), clipboard.get())) {
+            MouseEvent event = createMouseEventFromDraggingInfo([self window], info);
+            if (v->updateDragAndDrop(event, clipboard.get())) {
                 // *op unchanged if no source op was set
                 if (!clipboard->destinationOperation(&op)) {
                     // The element accepted but they didn't pick an operation, so we pick one for them
@@ -2338,7 +2352,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
             KWQClipboard::AccessPolicy policy = m_frame->baseURL().isLocalFile() ? KWQClipboard::Readable : KWQClipboard::TypesReadable;
             RefPtr<KWQClipboard> clipboard = new KWQClipboard(true, [info draggingPasteboard], policy);
             clipboard->setSourceOperation([info draggingSourceOperationMask]);            
-            v->cancelDragAndDrop(IntPoint([info draggingLocation]), clipboard.get());
+            v->cancelDragAndDrop(createMouseEventFromDraggingInfo([self window], info), clipboard.get());
             clipboard->setAccessPolicy(KWQClipboard::Numb);    // invalidate clipboard here for security
         }
     }
@@ -2352,7 +2366,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
             // Sending an event can result in the destruction of the view and part.
             RefPtr<KWQClipboard> clipboard = new KWQClipboard(true, [info draggingPasteboard], KWQClipboard::Readable);
             clipboard->setSourceOperation([info draggingSourceOperationMask]);
-            BOOL result = v->performDragAndDrop(IntPoint([info draggingLocation]), clipboard.get());
+            BOOL result = v->performDragAndDrop(createMouseEventFromDraggingInfo([self window], info), clipboard.get());
             clipboard->setAccessPolicy(KWQClipboard::Numb);    // invalidate clipboard here for security
             return result;
         }
@@ -2363,14 +2377,20 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
 - (void)dragSourceMovedTo:(NSPoint)windowLoc
 {
     if (m_frame) {
-        m_frame->dragSourceMovedTo(IntPoint(windowLoc));
+        // FIXME: Fake modifier keys here.
+        MouseEvent event(IntPoint(windowLoc), globalPoint([self window], windowLoc),
+            LeftButton, 0, false, false, false, false);
+        m_frame->dragSourceMovedTo(event);
     }
 }
 
 - (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation
 {
     if (m_frame) {
-        m_frame->dragSourceEndedAt(IntPoint(windowLoc), operation);
+        // FIXME: Fake modifier keys here.
+        MouseEvent event(IntPoint(windowLoc), globalPoint([self window], windowLoc),
+            LeftButton, 0, false, false, false, false);
+        m_frame->dragSourceEndedAt(event, operation);
     }
 }
 
index 9f34e09e90875121ef2f65c7df3e075429fe9239..362f5eab84223504152a1a6f48f22ea18ab67208 100644 (file)
@@ -29,7 +29,7 @@
 #import "config.h"
 #import "WebCoreFrameNamespaces.h"
 
-#import "PageMac.h"
+#import "Page.h"
 
 using namespace WebCore;
 
@@ -43,7 +43,7 @@ using namespace WebCore;
     NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:set->size()];
     HashSet<Page*>::const_iterator end = set->end();
     for (HashSet<Page*>::const_iterator it = set->begin(); it != end; ++it) {
-        [array addObject:Mac(*it)->bridge()];
+        [array addObject:(*it)->bridge()];
     }
     NSEnumerator* enumerator = [array objectEnumerator];
     [array release];
index c1c9a98f758e4f6e22e005f2d58b2ff2538cafd4..5b9d7f3b754ba1d28aa8b21eac11742538073f0d 100644 (file)
@@ -65,6 +65,9 @@ class WebCoreFrameBridge;
 
 - (NSView *)outerView;
 
+- (void)setWindowFrame:(NSRect)frame;
+- (NSRect)windowFrame;
+
 @end
 
 // This interface definition allows those who hold a WebCorePageBridge * to call all the methods
index 66fda3d7280a3d910e65f2ecf273ffa63f4c01a0..c69de6febc94631cfd44643e9aef1a11678853af 100644 (file)
@@ -27,7 +27,7 @@
 #import "WebCorePageBridge.h"
 
 #import "MacFrame.h"
-#import "PageMac.h"
+#import "Page.h"
 #import "WebCoreFrameBridge.h"
 #import "Logging.h"
 
@@ -69,7 +69,7 @@ static void initializeLoggingChannelsIfNecessary()
     initializeLoggingChannelsIfNecessary();
     self = [super init];
     if (self)
-        _page = new PageMac(self);
+        _page = new Page(self);
     return self;
 }
 
index 1d3a4286c8199320cbabac0d1d020e7ff4b87570..6a2236b009d0ee307c32dec2d2a411c6ff0b3f8e 100644 (file)
@@ -1638,10 +1638,10 @@ void DocumentImpl::processHttpEquiv(const DOMString &equiv, const DOMString &con
 }
 
 MouseEventWithHitTestResults DocumentImpl::prepareMouseEvent(bool readonly, bool active, bool mouseMove,
-    int x, int y, MouseEvent* event)
+    int x, int y, const MouseEvent& event)
 {
     if (!renderer())
-        return MouseEventWithHitTestResults();
+        return MouseEventWithHitTestResults(event, String(), String(), 0);
 
     assert(renderer()->isCanvas());
     RenderObject::NodeInfo renderInfo(readonly, active, mouseMove);
@@ -2221,7 +2221,7 @@ void DocumentImpl::defaultEventHandler(EventImpl *evt)
     if (evt->type() == keydownEvent) {
         KeyboardEventImpl* kevt = static_cast<KeyboardEventImpl *>(evt);
         if (kevt->ctrlKey()) {
-            KeyEvent* ev = kevt->keyEvent();
+            const KeyEvent* ev = kevt->keyEvent();
             String key = (ev ? ev->unmodifiedText() : kevt->keyIdentifier()).lower();
             ElementImpl* elem = getElementByAccessKey(key);
             if (elem) {
index e92f3e20af8d023e627cacc34f9b163f622abf09..f74017911c1ad2f45249cbb0173d50e9da2c16ec 100644 (file)
@@ -334,7 +334,7 @@ public:
     void resetVisitedLinkColor();
     void resetActiveLinkColor();
     
-    MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, int x, int y, MouseEvent*);
+    MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, int x, int y, const MouseEvent&);
 
     virtual bool childAllowed(NodeImpl*);
     virtual bool childTypeAllowed(NodeType);
index 3d245189f235a37964d9e4c28f01d17349932f40..4f396499abefc3b8268c25de8d9f1dd0ab05b6e9 100644 (file)
@@ -638,7 +638,7 @@ void NodeImpl::dispatchWindowEvent(const AtomicString &eventType, bool canBubble
      }
 }
 
-bool NodeImpl::dispatchMouseEvent(MouseEvent* _mouse, const AtomicString& eventType,
+bool NodeImpl::dispatchMouseEvent(const MouseEvent& _mouse, const AtomicString& eventType,
     int clickCount, NodeImpl* relatedTarget)
 {
     assert(!eventDispatchForbidden());
@@ -646,11 +646,11 @@ bool NodeImpl::dispatchMouseEvent(MouseEvent* _mouse, const AtomicString& eventT
     int clientX = 0;
     int clientY = 0;
     if (FrameView *view = getDocument()->view())
-        view->viewportToContents(_mouse->x(), _mouse->y(), clientX, clientY);
+        view->viewportToContents(_mouse.x(), _mouse.y(), clientX, clientY);
 
-    return dispatchMouseEvent(eventType, _mouse->button(), clickCount,
-        clientX, clientY, _mouse->globalX(), _mouse->globalY(),
-        _mouse->ctrlKey(), _mouse->altKey(), _mouse->shiftKey(), _mouse->metaKey(),
+    return dispatchMouseEvent(eventType, _mouse.button(), clickCount,
+        clientX, clientY, _mouse.globalX(), _mouse.globalY(),
+        _mouse.ctrlKey(), _mouse.altKey(), _mouse.shiftKey(), _mouse.metaKey(),
         false, relatedTarget);
 }
 
@@ -796,7 +796,7 @@ bool NodeImpl::dispatchSubtreeModifiedEvent(bool sendChildrenChanged)
                          true,false,0,DOMString(),DOMString(),DOMString(),0),ec,true);
 }
 
-bool NodeImpl::dispatchKeyEvent(KeyEvent* key)
+bool NodeImpl::dispatchKeyEvent(const KeyEvent& key)
 {
     assert(!eventDispatchForbidden());
     ExceptionCode ec = 0;
@@ -812,31 +812,31 @@ bool NodeImpl::dispatchKeyEvent(KeyEvent* key)
     return r;
 }
 
-void NodeImpl::dispatchWheelEvent(WheelEvent *e)
+void NodeImpl::dispatchWheelEvent(WheelEvente)
 {
     assert(!eventDispatchForbidden());
-    if (e->delta() == 0)
+    if (e.delta() == 0)
         return;
 
-    DocumentImpl *doc = getDocument();
+    DocumentImpldoc = getDocument();
     if (!doc)
         return;
 
-    FrameView *view = getDocument()->view();
+    FrameViewview = getDocument()->view();
     if (!view)
         return;
 
     int x;
     int y;
-    view->viewportToContents(e->x(), e->y(), x, y);
+    view->viewportToContents(e.x(), e.y(), x, y);
 
-    RefPtr<WheelEventImpl> we = new WheelEventImpl(e->isHorizontal(), e->delta(),
-        getDocument()->defaultView(), e->globalX(), e->globalY(), x, y,
-        e->ctrlKey(), e->altKey(), e->shiftKey(), e->metaKey());
+    RefPtr<WheelEventImpl> we = new WheelEventImpl(e.isHorizontal(), e.delta(),
+        getDocument()->defaultView(), e.globalX(), e.globalY(), x, y,
+        e.ctrlKey(), e.altKey(), e.shiftKey(), e.metaKey());
 
     ExceptionCode ec = 0;
     if (!dispatchEvent(we, ec, true))
-        e->accept();
+        e.accept();
 }
 
 void NodeImpl::handleLocalEvents(EventImpl *evt, bool useCapture)
index babb3c0eac2f86491ffac75579599c98cbf2d995..8becb94c811f44dc6042bd33e185d93bb76c0ae2 100644 (file)
@@ -267,7 +267,7 @@ public:
     bool dispatchGenericEvent(PassRefPtr<EventImpl>, ExceptionCode&, bool tempEvent = false);
     bool dispatchHTMLEvent(const AtomicString& eventType, bool canBubble, bool cancelable);
     void dispatchWindowEvent(const AtomicString& eventType, bool canBubble, bool cancelable);
-    bool dispatchMouseEvent(MouseEvent*, const AtomicString& eventType,
+    bool dispatchMouseEvent(const MouseEvent&, const AtomicString& eventType,
         int clickCount = 0, NodeImpl* relatedTarget = 0);
     bool dispatchSimulatedMouseEvent(const AtomicString& eventType);
     bool dispatchMouseEvent(const AtomicString& eventType, int button, int clickCount,
@@ -276,8 +276,8 @@ public:
         bool isSimulated = false, NodeImpl* relatedTarget = 0);
     bool dispatchUIEvent(const AtomicString& eventType, int detail = 0);
     bool dispatchSubtreeModifiedEvent(bool childrenChanged = true);
-    bool dispatchKeyEvent(KeyEvent*);
-    void dispatchWheelEvent(WheelEvent*);
+    bool dispatchKeyEvent(const KeyEvent&);
+    void dispatchWheelEvent(WheelEvent&);
 
     void handleLocalEvents(EventImpl*, bool useCapture);
 
index fa67edc71f5712d26f19ca88620534514e2cd787..ea31a41a907e8e767a2e5b9efcee612c3f5505ac 100644 (file)
@@ -442,12 +442,12 @@ KeyboardEventImpl::KeyboardEventImpl()
 {
 }
 
-KeyboardEventImpl::KeyboardEventImpl(KeyEvent *key, AbstractViewImpl *view)
-  : UIEventWithKeyStateImpl(key->isKeyUp() ? keyupEvent : key->isAutoRepeat() ? keypressEvent : keydownEvent,
-    true, true, view, 0, key->ctrlKey(), key->altKey(), key->shiftKey(), key->metaKey())
-  , m_keyEvent(new KeyEvent(*key))
-  , m_keyIdentifier(DOMString(key->keyIdentifier()).impl())
-  , m_keyLocation(key->isKeypad() ? DOM_KEY_LOCATION_NUMPAD : DOM_KEY_LOCATION_STANDARD)
+KeyboardEventImpl::KeyboardEventImpl(const KeyEvent& key, AbstractViewImpl *view)
+  : UIEventWithKeyStateImpl(key.isKeyUp() ? keyupEvent : key.isAutoRepeat() ? keypressEvent : keydownEvent,
+    true, true, view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey())
+  , m_keyEvent(new KeyEvent(key))
+  , m_keyIdentifier(DOMString(key.keyIdentifier()).impl())
+  , m_keyLocation(key.isKeypad() ? DOM_KEY_LOCATION_NUMPAD : DOM_KEY_LOCATION_STANDARD)
   , m_altGraphKey(false)
 {
 }
index 180168b4f43ee9d54a02091f4f1f8f1a87056601..8f04f2e73a1e3774c15cb0c94b4410feffb17751 100644 (file)
@@ -277,7 +277,7 @@ public:
         DOM_KEY_LOCATION_NUMPAD        = 0x03,
     };
     KeyboardEventImpl();
-    KeyboardEventImpl(KeyEvent*, AbstractViewImpl*);
+    KeyboardEventImpl(const KeyEvent&, AbstractViewImpl*);
     KeyboardEventImpl(const AtomicString &type,
                 bool canBubbleArg,
                 bool cancelableArg,
@@ -308,7 +308,7 @@ public:
     
     bool altGraphKey() const { return m_altGraphKey; }
     
-    KeyEvent* keyEvent() const { return m_keyEvent; }
+    const KeyEvent* keyEvent() const { return m_keyEvent; }
 
     int keyCode() const; // key code for keydown and keyup, character for other events
     int charCode() const;
index f0016a95796a9601accc883b35b499fea8e57daf..6fce51519b50543f95ceeb9d4efb640badcba337 100644 (file)
 
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameTree.h"
 #include "FrameView.h"
 #include "JSMutationEvent.h"
 #include "JSXMLHttpRequest.h"
-#include "PlugInInfoStore.h"
 #include "Logging.h"
+#include "Page.h"
+#include "PlatformString.h"
+#include "PlugInInfoStore.h"
 #include "Screen.h"
 #include "SelectionController.h"
 #include "Shared.h"
 #include "dom2_rangeimpl.h"
 #include "dom_elementimpl.h"
 #include "dom_position.h"
-#include "PlatformString.h"
 #include "domparser.h"
 #include "html_documentimpl.h"
 #include "htmlediting.h"
+#include "khtml_settings.h"
 #include "kjs_css.h"
 #include "kjs_events.h"
 #include "kjs_html.h"
@@ -52,8 +55,6 @@
 #include "render_canvas.h"
 #include "xmlserializer.h"
 #include <kjs/collector.h>
-#include "FrameTree.h"
-#include "khtml_settings.h"
 
 #if KHTML_XSLT
 #include "XSLTProcessor.h"
@@ -726,14 +727,9 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       else
         return jsNull();
     case OuterHeight:
+        return jsNumber(m_frame->page()->windowRect().height());
     case OuterWidth:
-    {
-      if (m_frame->view()) {
-        IntRect frame = m_frame->view()->topLevelWidget()->frameGeometry();
-        return jsNumber(token == OuterHeight ? frame.height() : frame.width());
-      } else
-        return jsNumber(0);
-    }
+        return jsNumber(m_frame->page()->windowRect().width());
     case PageXOffset:
       if (!m_frame->view())
         return jsUndefined();
@@ -745,23 +741,15 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       updateLayout();
       return jsNumber(m_frame->view()->contentsY());
     case Parent:
-      return retrieve(m_frame->tree()->parent() ? m_frame->tree()->parent() : (Frame*)m_frame);
+      return retrieve(m_frame->tree()->parent() ? m_frame->tree()->parent() : m_frame);
     case Personalbar:
       return personalbar(exec);
     case ScreenLeft:
     case ScreenX:
-      if (!m_frame->view())
-        return jsUndefined();
-      // We want to use frameGeometry here instead of mapToGlobal because it goes through
-      // the windowFrame method of the WebKit's UI delegate. Also we don't want to try
-      // to do anything relative to the screen the window is on.
-      return jsNumber(m_frame->view()->topLevelWidget()->frameGeometry().x());
+      return jsNumber(m_frame->page()->windowRect().x());
     case ScreenTop:
     case ScreenY:
-      if (!m_frame->view())
-        return jsUndefined();
-      // See comment above in ScreenX.
-      return jsNumber(m_frame->view()->topLevelWidget()->frameGeometry().y());
+      return jsNumber(m_frame->page()->windowRect().y());
     case ScrollX:
       if (!m_frame->view())
         return jsUndefined();
@@ -781,12 +769,8 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
     case Self:
     case _Window:
       return retrieve(m_frame);
-    case Top: {
-      Frame *p = m_frame;
-      while (p->tree()->parent())
-        p = p->tree()->parent();
-      return retrieve(p);
-    }
+    case Top:
+      return retrieve(m_frame->page()->mainFrame());
     case _Screen:
       if (!screen)
         screen = new Screen(exec, m_frame);
@@ -1662,58 +1646,44 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
       widget->setContentsPos(args[0]->toInt32(exec), args[1]->toInt32(exec));
     return jsUndefined();
   case Window::MoveBy:
-    if(args.size() >= 2 && widget)
-    {
-      Widget* tl = widget->topLevelWidget();
-      IntRect sg = screenRect(widget);
-      IntPoint dest = tl->pos() + IntPoint(args[0]->toInt32(exec), args[1]->toInt32(exec));
+    if (args.size() >= 2 && widget) {
+      IntRect r = frame->page()->windowRect();
+      r.move(args[0]->toInt32(exec), args[1]->toInt32(exec));
       // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-      if (sg.contains(IntRect(dest, IntSize(tl->width(), tl->height()))))
-        tl->move(dest);
+      if (screenRect(widget).contains(r))
+        frame->page()->setWindowRect(r);
     }
     return jsUndefined();
   case Window::MoveTo:
-    if(args.size() >= 2 && widget)
-    {
-      Widget* tl = widget->topLevelWidget();
-      IntRect sg = screenRect(widget);
-      IntPoint dest(args[0]->toInt32(exec) + sg.x(), args[1]->toInt32(exec) + sg.y());
+    if (args.size() >= 2 && widget) {
+      IntRect r = frame->page()->windowRect();
+      IntRect sr = screenRect(widget);
+      r.setLocation(sr.location() + IntPoint(args[0]->toInt32(exec), args[1]->toInt32(exec)));
       // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-      if (sg.contains(IntRect(dest, IntSize(tl->width(), tl->height()))))
-        tl->move(dest);
+      if (sr.contains(r))
+        frame->page()->setWindowRect(r);
     }
     return jsUndefined();
   case Window::ResizeBy:
-    if(args.size() >= 2 && widget)
-    {
-      Widget* tl = widget->topLevelWidget();
-      IntSize dest = tl->size() + IntSize(args[0]->toInt32(exec), args[1]->toInt32(exec));
+    if (args.size() >= 2 && widget) {
+      IntRect r = frame->page()->windowRect();
+      IntSize dest = r.size() + IntSize(args[0]->toInt32(exec), args[1]->toInt32(exec));
       IntRect sg = screenRect(widget);
       // Security check: within desktop limits and bigger than 100x100 (per spec)
-      if (tl->x() + dest.width() <= sg.right() && tl->y() + dest.height() <= sg.bottom()
+      if (r.x() + dest.width() <= sg.right() && r.y() + dest.height() <= sg.bottom()
            && dest.width() >= 100 && dest.height() >= 100)
-      {
-        // Take into account the window frame
-        int deltaWidth = tl->frameGeometry().width() - tl->width();
-        int deltaHeight = tl->frameGeometry().height() - tl->height();
-        tl->resize(dest.width() - deltaWidth, dest.height() - deltaHeight);
-      }
+        frame->page()->setWindowRect(IntRect(r.location(), dest));
     }
     return jsUndefined();
   case Window::ResizeTo:
     if (args.size() >= 2 && widget) {
-      Widget* tl = widget->topLevelWidget();
+      IntRect r = frame->page()->windowRect();
       IntSize dest = IntSize(args[0]->toInt32(exec), args[1]->toInt32(exec));
       IntRect sg = screenRect(widget);
       // Security check: within desktop limits and bigger than 100x100 (per spec)
-      if (tl->x() + dest.width() <= sg.right() && tl->y() + dest.height() <= sg.bottom() &&
+      if (r.x() + dest.width() <= sg.right() && r.y() + dest.height() <= sg.bottom() &&
            dest.width() >= 100 && dest.height() >= 100)
-      {
-        // Take into account the window frame
-        int deltaWidth = tl->frameGeometry().width() - tl->width();
-        int deltaHeight = tl->frameGeometry().height() - tl->height();
-        tl->resize(dest.width() - deltaWidth, dest.height() - deltaHeight);
-      }
+        frame->page()->setWindowRect(IntRect(r.location(), dest));
     }
     return jsUndefined();
   case Window::SetTimeout:
index 3ab6ed6bb8fdf57e4b5dba419bcb2646bb37cf48..200038b0ce47e3e2a1d6079e5cbaea28ac7ed66a 100644 (file)
@@ -135,7 +135,6 @@ void HTMLAnchorElementImpl::defaultEventHandler(EventImpl *evt)
                 return;
             }
             if (k->keyEvent()) {
-                k->keyEvent()->accept();
                 evt->setDefaultHandled();
                 click(false);
                 return;
index fae4139accc619c252fc9343d832f9f02c497b28..7eb484267791013461d78a31bc6ae5df46ec1ae2 100644 (file)
@@ -185,17 +185,6 @@ void SVGDocumentImpl::dispatchScrollEvent()
     rootElement()->dispatchEvent(event.get(), ec);
 }
 
-bool SVGDocumentImpl::dispatchKeyEvent(EventTargetImpl* target, KeyEvent* key, bool keypress)
-{
-    // dispatch key event
-    ExceptionCode ec;
-    RefPtr<KeyboardEventImpl> keyEventImpl = static_pointer_cast<KeyboardEventImpl>(createEvent("KeyboardEvents", ec));
-    //keyEventImpl->initKeyboardEvent(key);
-    target->dispatchEvent(keyEventImpl.get(), ec);
-
-    return /*keyEventImpl->defaultHandled() ||*/ keyEventImpl->defaultPrevented();
-}
-
 CSSStyleSelector *SVGDocumentImpl::createStyleSelector(const QString &usersheet)
 {
     return new CSSStyleSelector(this, usersheet, m_styleSheets.get(), false);
index faf4b947a15cae40068e0fc6f82ebb66f7ef0226..0e699a925b530a30eb6ca4209a0e418d788141ba 100644 (file)
@@ -62,7 +62,6 @@ namespace WebCore {
         void dispatchRecursiveEvent(EventImpl *event, NodeImpl *obj);
         void dispatchZoomEvent(float prevScale, float newScale);
         void dispatchScrollEvent();
-        bool dispatchKeyEvent(NodeImpl* target, KeyEvent *key, bool keypress);
 
         virtual void recalcStyle(StyleChange = NoChange);
 
diff --git a/WebCore/kwq/KWQWindowWidget.h b/WebCore/kwq/KWQWindowWidget.h
deleted file mode 100644 (file)
index 75dc00e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2003 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. 
- */
-
-#ifndef KWQKWINDOW_WIDGET_H
-#define KWQKWINDOW_WIDGET_H
-
-#include "Widget.h"
-
-#ifdef __OBJC__
-@class WebCoreFrameBridge;
-#else
-class WebCoreFrameBridge;
-#endif
-
-class KWQWindowWidgetPrivate;
-
-class KWQWindowWidget : public Widget
-{
- public:
-    virtual ~KWQWindowWidget();
-
-    KWQWindowWidget(WebCoreFrameBridge *bridge);
-
-    virtual IntSize sizeHint() const;
-    virtual IntRect frameGeometry() const;
-    virtual void setFrameGeometry(const IntRect &);
-
-    virtual Widget *topLevelWidget() const;
-    virtual IntPoint mapFromGlobal(const IntPoint &) const;
-    virtual IntPoint viewportToGlobal(const IntPoint &) const;
-
- private:
-    KWQWindowWidgetPrivate *d;
-};
-
-#endif /* KWQKWINDOW_WIDGET_H */
diff --git a/WebCore/kwq/KWQWindowWidget.mm b/WebCore/kwq/KWQWindowWidget.mm
deleted file mode 100644 (file)
index f76eb24..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2003, 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 "KWQWindowWidget.h"
-
-#import "IntRect.h"
-#import "WebCoreFrameBridge.h"
-
-#import <Cocoa/Cocoa.h>
-
-// The NSScreen calls in this file can't throw, so no need to block
-// Cocoa exceptions.
-
-class KWQWindowWidgetPrivate
-{
-public:
-    WebCoreFrameBridge *bridge;
-};
-
-KWQWindowWidget::KWQWindowWidget(WebCoreFrameBridge *bridge) :
-    d(new KWQWindowWidgetPrivate())
-{
-    // intentionally not retained, since the bridge owns the window widget
-    d->bridge = bridge;
-}
-
-KWQWindowWidget::~KWQWindowWidget()
-{
-    delete d;
-}
-
-IntSize KWQWindowWidget::sizeHint() const
-{
-    return size();
-}
-
-IntRect KWQWindowWidget::frameGeometry() const
-{
-    NSRect frame = [d->bridge windowFrame];
-    return IntRect((int)frame.origin.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(frame)),
-                 (int)frame.size.width, (int)frame.size.height);
-}
-
-Widget *KWQWindowWidget::topLevelWidget() const
-{
-    return (Widget *)this;
-}
-
-// Note these routines work on QT window coords - origin upper left
-IntPoint KWQWindowWidget::mapFromGlobal(const IntPoint &p) const
-{
-    NSPoint screenPoint = NSMakePoint(p.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - p.y());
-    NSPoint windowPoint = [[d->bridge window] convertScreenToBase:screenPoint];
-    return IntPoint((int)windowPoint.x, (int)([d->bridge windowFrame].size.height - windowPoint.y));
-}
-
-// maps "viewport" (actually Cocoa window coords) to screen coords
-IntPoint KWQWindowWidget::viewportToGlobal(const IntPoint &p) const
-{
-    NSPoint windowPoint = NSMakePoint(p.x(), p.y());
-    NSPoint screenPoint = [[d->bridge window] convertBaseToScreen:windowPoint];
-    return IntPoint((int)screenPoint.x, (int)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y));
-}
-
-void KWQWindowWidget::setFrameGeometry(const IntRect &r)
-{
-    // FIXME: Could do something to make it easy for the browser to avoid saving this change.
-    [d->bridge setWindowFrame:NSMakeRect(r.x(), NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - r.bottom(),
-        r.width(), r.height())];
-}
index aad075cd824fd46d50a12d85a7d5fd2617f46ce9..5d535c18e009d7fc125f46aa5e64b93b64e5a90d 100644 (file)
@@ -1700,7 +1700,7 @@ bool Frame::isPointInsideSelection(int x, int y)
    return false;
 }
 
-void Frame::selectClosestWordFromMouseEvent(MouseEvent *mouse, NodeImpl *innerNode, int x, int y)
+void Frame::selectClosestWordFromMouseEvent(const MouseEvent& mouse, NodeImpl *innerNode, int x, int y)
 {
     SelectionController selection;
 
@@ -1721,9 +1721,9 @@ void Frame::selectClosestWordFromMouseEvent(MouseEvent *mouse, NodeImpl *innerNo
         setSelection(selection);
 }
 
-void Frame::handleMousePressEventDoubleClick(MouseEventWithHitTestResults* event)
+void Frame::handleMousePressEventDoubleClick(const MouseEventWithHitTestResults& event)
 {
-    if (event->event()->button() == LeftButton) {
+    if (event.event().button() == LeftButton) {
         if (selection().isRange())
             // A double-click when range is already selected
             // should not change the selection.  So, do not call
@@ -1733,22 +1733,21 @@ void Frame::handleMousePressEventDoubleClick(MouseEventWithHitTestResults* event
             d->m_beganSelectingText = true;
         else {
             int x, y;
-            view()->viewportToContents(event->event()->x(), event->event()->y(), x, y);
-            selectClosestWordFromMouseEvent(event->event(), event->innerNode(), x, y);
+            view()->viewportToContents(event.event().x(), event.event().y(), x, y);
+            selectClosestWordFromMouseEvent(event.event(), event.innerNode(), x, y);
         }
     }
 }
 
-void Frame::handleMousePressEventTripleClick(MouseEventWithHitTestResults* event)
+void Frame::handleMousePressEventTripleClick(const MouseEventWithHitTestResults& event)
 {
-    MouseEvent *mouse = event->event();
-    NodeImpl *innerNode = event->innerNode();
+    NodeImpl *innerNode = event.innerNode();
     
-    if (mouse->button() == LeftButton && innerNode && innerNode->renderer() &&
+    if (event.event().button() == LeftButton && innerNode && innerNode->renderer() &&
         mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
         SelectionController selection;
         int x, y;
-        view()->viewportToContents(event->event()->x(), event->event()->y(), x, y);
+        view()->viewportToContents(event.event().x(), event.event().y(), x, y);
         VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
         if (pos.isNotNull()) {
             selection.moveTo(pos);
@@ -1764,23 +1763,22 @@ void Frame::handleMousePressEventTripleClick(MouseEventWithHitTestResults* event
     }
 }
 
-void Frame::handleMousePressEventSingleClick(MouseEventWithHitTestResults* event)
+void Frame::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event)
 {
-    MouseEvent *mouse = event->event();
-    NodeImpl *innerNode = event->innerNode();
+    NodeImpl *innerNode = event.innerNode();
     
-    if (mouse->button() == LeftButton) {
+    if (event.event().button() == LeftButton) {
         if (innerNode && innerNode->renderer() &&
             mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
             SelectionController sel;
             
             // Extend the selection if the Shift key is down, unless the click is in a link.
-            bool extendSelection = mouse->shiftKey() && event->url().isNull();
+            bool extendSelection = event.event().shiftKey() && event.url().isNull();
 
             // Don't restart the selection when the mouse is pressed on an
             // existing selection so we can allow for text dragging.
             int x, y;
-            view()->viewportToContents(event->event()->x(), event->event()->y(), x, y);
+            view()->viewportToContents(event.event().x(), event.event().y(), x, y);
             if (!extendSelection && isPointInsideSelection(x, y))
                 return;
 
@@ -1818,24 +1816,23 @@ void Frame::handleMousePressEventSingleClick(MouseEventWithHitTestResults* event
     }
 }
 
-void Frame::khtmlMousePressEvent(MouseEventWithHitTestResults* event)
+void Frame::khtmlMousePressEvent(const MouseEventWithHitTestResults& event)
 {
-    DOMString url = event->url();
-    MouseEvent *mouse = event->event();
-    NodeImpl *innerNode = event->innerNode();
+    DOMString url = event.url();
+    NodeImpl *innerNode = event.innerNode();
 
     d->m_mousePressNode = innerNode;
-    d->m_dragStartPos = mouse->pos();
+    d->m_dragStartPos = event.event().pos();
 
-    if (mouse->button() == LeftButton || mouse->button() == MiddleButton) {
+    if (event.event().button() == LeftButton || event.event().button() == MiddleButton) {
         d->m_bMousePressed = true;
         d->m_beganSelectingText = false;
 
-        if (mouse->clickCount() == 2) {
+        if (event.event().clickCount() == 2) {
             handleMousePressEventDoubleClick(event);
             return;
         }
-        if (mouse->clickCount() >= 3) {
+        if (event.event().clickCount() >= 3) {
             handleMousePressEventTripleClick(event);
             return;
         }
@@ -1843,21 +1840,20 @@ void Frame::khtmlMousePressEvent(MouseEventWithHitTestResults* event)
     }
 }
 
-void Frame::handleMouseMoveEventSelection(MouseEventWithHitTestResults* event)
+void Frame::handleMouseMoveEventSelection(const MouseEventWithHitTestResults& event)
 {
     // Mouse not pressed. Do nothing.
     if (!d->m_bMousePressed)
         return;
 
-    MouseEvent *mouse = event->event();
-    NodeImpl *innerNode = event->innerNode();
+    NodeImpl *innerNode = event.innerNode();
 
-    if (mouse->button() != 0 || !innerNode || !innerNode->renderer() || !mouseDownMayStartSelect() || !innerNode->renderer()->shouldSelect())
+    if (event.event().button() != 0 || !innerNode || !innerNode->renderer() || !mouseDownMayStartSelect() || !innerNode->renderer()->shouldSelect())
         return;
 
     // handle making selection
     int x, y;
-    view()->viewportToContents(event->event()->x(), event->event()->y(), x, y);
+    view()->viewportToContents(event.event().x(), event.event().y(), x, y);
     VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
 
     // Don't modify the selection if we're not on a node.
@@ -1882,12 +1878,12 @@ void Frame::handleMouseMoveEventSelection(MouseEventWithHitTestResults* event)
         setSelection(sel);
 }
 
-void Frame::khtmlMouseMoveEvent(MouseEventWithHitTestResults* event)
+void Frame::khtmlMouseMoveEvent(const MouseEventWithHitTestResults& event)
 {
     handleMouseMoveEventSelection(event);
 }
 
-void Frame::khtmlMouseReleaseEvent(MouseEventWithHitTestResults* event)
+void Frame::khtmlMouseReleaseEvent(const MouseEventWithHitTestResults& event)
 {
     stopAutoscrollTimer();
     
@@ -1899,13 +1895,13 @@ void Frame::khtmlMouseReleaseEvent(MouseEventWithHitTestResults* event)
     // We do this so when clicking on the selection, the selection goes away.
     // However, if we are editing, place the caret.
     if (mouseDownMayStartSelect() && !d->m_beganSelectingText
-            && d->m_dragStartPos == event->event()->pos()
+            && d->m_dragStartPos == event.event().pos()
             && d->m_selection.isRange()) {
         SelectionController selection;
-        NodeImpl *node = event->innerNode();
+        NodeImpl *node = event.innerNode();
         if (node && node->isContentEditable() && node->renderer()) {
             int x, y;
-            view()->viewportToContents(event->event()->x(), event->event()->y(), x, y);
+            view()->viewportToContents(event.event().x(), event.event().y(), x, y);
             VisiblePosition pos = node->renderer()->positionForCoordinates(x, y);
             selection.moveTo(pos);
         }
@@ -3039,15 +3035,15 @@ bool Frame::canMouseDownStartSelect(NodeImpl* node)
     return true;
 }
 
-void Frame::khtmlMouseDoubleClickEvent(MouseEventWithHitTestResults* event)
+void Frame::khtmlMouseDoubleClickEvent(const MouseEventWithHitTestResults& event)
 {
     passWidgetMouseDownEventToWidget(event, true);
 }
 
-bool Frame::passWidgetMouseDownEventToWidget(MouseEventWithHitTestResults* event, bool isDoubleClick)
+bool Frame::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event, bool isDoubleClick)
 {
     // Figure out which view to send the event to.
-    RenderObject *target = event->innerNode() ? event->innerNode()->renderer() : 0;
+    RenderObject *target = event.innerNode() ? event.innerNode()->renderer() : 0;
     if (!target)
         return false;
     
index bdf0755bca57adf11abb416d34c65f793b722a9d..29036fee0734f485320d4ebcf2c2e7973257603e 100644 (file)
@@ -542,12 +542,12 @@ public:
    */
   KURL completeURL( const QString &url );
 
-  virtual void khtmlMouseDoubleClickEvent(MouseEventWithHitTestResults*);
-  virtual void khtmlMousePressEvent(MouseEventWithHitTestResults*);
-  virtual void khtmlMouseMoveEvent(MouseEventWithHitTestResults*);
-  virtual void khtmlMouseReleaseEvent(MouseEventWithHitTestResults*);
+  virtual void khtmlMouseDoubleClickEvent(const MouseEventWithHitTestResults&);
+  virtual void khtmlMousePressEvent(const MouseEventWithHitTestResults&);
+  virtual void khtmlMouseMoveEvent(const MouseEventWithHitTestResults&);
+  virtual void khtmlMouseReleaseEvent(const MouseEventWithHitTestResults&);
   
-  void selectClosestWordFromMouseEvent(MouseEvent*, NodeImpl* innerNode, int x, int y);
+  void selectClosestWordFromMouseEvent(const MouseEvent&, NodeImpl* innerNode, int x, int y);
 
   virtual void urlSelected(const QString& url, const QString& target, const ResourceRequest& request = ResourceRequest());
 
@@ -746,10 +746,10 @@ private:
   void sendScrollEvent();
   bool scrollbarsVisible();
   void scrollToAnchor(const KURL &);
-  bool canMouseDownStartSelect(NodeImpl* node);
-  bool passWidgetMouseDownEventToWidget(MouseEventWithHitTestResults *, bool isDoubleClick);
-  bool passWidgetMouseDownEventToWidget(RenderWidget *);
-  virtual bool passMouseDownEventToWidget(Widget *) = 0;
+  bool canMouseDownStartSelect(NodeImpl*);
+  bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&, bool isDoubleClick);
+  bool passWidgetMouseDownEventToWidget(RenderWidget*);
+  virtual bool passMouseDownEventToWidget(Widget*) = 0;
 
   void clearTimers();
   static void clearTimers(FrameView *);
@@ -790,18 +790,18 @@ protected:
   
   void receivedFirstData();
 
-  bool handleMouseMoveEventDrag(MouseEventWithHitTestResults*);
-  bool handleMouseMoveEventOver(MouseEventWithHitTestResults*);
-  void handleMouseMoveEventSelection(MouseEventWithHitTestResults*);
+  bool handleMouseMoveEventDrag(const MouseEventWithHitTestResults&);
+  bool handleMouseMoveEventOver(const MouseEventWithHitTestResults&);
+  void handleMouseMoveEventSelection(const MouseEventWithHitTestResults&);
 
   /**
    * @internal Extracts anchor and tries both encoded and decoded form.
    */
   void gotoAnchor();
 
-  void handleMousePressEventSingleClick(MouseEventWithHitTestResults*);
-  void handleMousePressEventDoubleClick(MouseEventWithHitTestResults*);
-  void handleMousePressEventTripleClick(MouseEventWithHitTestResults*);
+  void handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
+  void handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
+  void handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
 
   CSSComputedStyleDeclarationImpl *selectionComputedStyle(NodeImpl *&nodeToRemove) const;
 
index 9f2e2bd2749caf2e2d63e4a682f255d5b3511e87..15909b54f2126800d5947be8170ee9c535597fed 100644 (file)
@@ -463,7 +463,7 @@ void FrameView::layout()
 //
 /////////////////
 
-void FrameView::viewportMousePressEvent(MouseEvent* mouseEvent)
+void FrameView::viewportMousePressEvent(const MouseEvent& mouseEvent)
 {
     if (!m_frame->document())
         return;
@@ -471,7 +471,7 @@ void FrameView::viewportMousePressEvent(MouseEvent* mouseEvent)
     RefPtr<FrameView> protector(this);
 
     int xm, ym;
-    viewportToContents(mouseEvent->x(), mouseEvent->y(), xm, ym);
+    viewportToContents(mouseEvent.x(), mouseEvent.y(), xm, ym);
 
     d->mousePressed = true;
 
@@ -482,13 +482,13 @@ void FrameView::viewportMousePressEvent(MouseEvent* mouseEvent)
         return;
     }
 
-    d->clickCount = mouseEvent->clickCount();
+    d->clickCount = mouseEvent.clickCount();
     d->clickNode = mev.innerNode();
 
     bool swallowEvent = dispatchMouseEvent(mousedownEvent, mev.innerNode(), true, d->clickCount, mouseEvent, true);
 
     if (!swallowEvent) {
-        m_frame->khtmlMousePressEvent(&mev);
+        m_frame->khtmlMousePressEvent(mev);
         // Many AK widgets run their own event loops and consume events while the mouse is down.
         // When they finish, currentEvent is the mouseUp that they exited on.  We need to update
         // the khtml state with this mouseUp, which khtml never saw.
@@ -499,7 +499,7 @@ void FrameView::viewportMousePressEvent(MouseEvent* mouseEvent)
     }
 }
 
-void FrameView::viewportMouseDoubleClickEvent(MouseEvent* mouseEvent)
+void FrameView::viewportMouseDoubleClickEvent(const MouseEvent& mouseEvent)
 {
     if (!m_frame->document())
         return;
@@ -507,7 +507,7 @@ void FrameView::viewportMouseDoubleClickEvent(MouseEvent* mouseEvent)
     RefPtr<FrameView> protector(this);
 
     int xm, ym;
-    viewportToContents(mouseEvent->x(), mouseEvent->y(), xm, ym);
+    viewportToContents(mouseEvent.x(), mouseEvent.y(), xm, ym);
 
     // We get this instead of a second mouse-up 
     d->mousePressed = false;
@@ -517,7 +517,7 @@ void FrameView::viewportMouseDoubleClickEvent(MouseEvent* mouseEvent)
     if (m_frame->passSubframeEventToSubframe(mev))
         return;
 
-    d->clickCount = mouseEvent->clickCount();
+    d->clickCount = mouseEvent.clickCount();
     bool swallowEvent = dispatchMouseEvent(mouseupEvent, mev.innerNode(), true, d->clickCount, mouseEvent, false);
 
     if (mev.innerNode() == d->clickNode)
@@ -525,8 +525,8 @@ void FrameView::viewportMouseDoubleClickEvent(MouseEvent* mouseEvent)
 
     // Qt delivers a release event AND a double click event.
     if (!swallowEvent) {
-        m_frame->khtmlMouseReleaseEvent(&mev);
-        m_frame->khtmlMouseDoubleClickEvent(&mev);
+        m_frame->khtmlMouseReleaseEvent(mev);
+        m_frame->khtmlMouseDoubleClickEvent(mev);
     }
 
     invalidateClick();
@@ -591,7 +591,7 @@ static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* fra
     return pointerCursor();
 }
 
-void FrameView::viewportMouseMoveEvent(MouseEvent* mouseEvent)
+void FrameView::viewportMouseMoveEvent(const MouseEvent& mouseEvent)
 {
     // in Radar 3703768 we saw frequent crashes apparently due to the
     // part being null here, which seems impossible, so check for nil
@@ -605,7 +605,7 @@ void FrameView::viewportMouseMoveEvent(MouseEvent* mouseEvent)
         d->hoverTimer.stop();
 
     int xm, ym;
-    viewportToContents(mouseEvent->x(), mouseEvent->y(), xm, ym);
+    viewportToContents(mouseEvent.x(), mouseEvent.y(), xm, ym);
 
     if (d->resizingFrameSet) {
         dispatchMouseEvent(mousemoveEvent, d->resizingFrameSet.get(), false, 0, mouseEvent, false);
@@ -624,7 +624,7 @@ void FrameView::viewportMouseMoveEvent(MouseEvent* mouseEvent)
         
     bool swallowEvent = dispatchMouseEvent(mousemoveEvent, mev.innerNode(), false, 0, mouseEvent, true);
     if (!swallowEvent)
-        m_frame->khtmlMouseMoveEvent(&mev);
+        m_frame->khtmlMouseMoveEvent(mev);
 }
 
 void FrameView::invalidateClick()
@@ -633,7 +633,7 @@ void FrameView::invalidateClick()
     d->clickNode = 0;
 }
 
-void FrameView::viewportMouseReleaseEvent(MouseEvent* mouseEvent)
+void FrameView::viewportMouseReleaseEvent(const MouseEvent& mouseEvent)
 {
     if (!m_frame->document())
         return;
@@ -641,7 +641,7 @@ void FrameView::viewportMouseReleaseEvent(MouseEvent* mouseEvent)
     RefPtr<FrameView> protector(this);
 
     int xm, ym;
-    viewportToContents(mouseEvent->x(), mouseEvent->y(), xm, ym);
+    viewportToContents(mouseEvent.x(), mouseEvent.y(), xm, ym);
 
     d->mousePressed = false;
 
@@ -661,35 +661,20 @@ void FrameView::viewportMouseReleaseEvent(MouseEvent* mouseEvent)
         dispatchMouseEvent(clickEvent, mev.innerNode(), true, d->clickCount, mouseEvent, true);
 
     if (!swallowEvent)
-        m_frame->khtmlMouseReleaseEvent(&mev);
+        m_frame->khtmlMouseReleaseEvent(mev);
 
     invalidateClick();
 }
 
-void FrameView::keyPressEvent(KeyEvent* ke)
-{
-    if (m_frame->document() && m_frame->document()->focusNode()) {
-        if (m_frame->document()->focusNode()->dispatchKeyEvent(ke))
-            ke->accept();
-    }
-}
-
-bool FrameView::dispatchDragEvent(const AtomicString &eventType, NodeImpl *dragTarget, const IntPoint &loc, ClipboardImpl *clipboard)
+bool FrameView::dispatchDragEvent(const AtomicString &eventType, NodeImpl *dragTarget, const MouseEvent& event, ClipboardImpl *clipboard)
 {
     int clientX, clientY;
-    viewportToContents(loc.x(), loc.y(), clientX, clientY);
-    IntPoint screenLoc = viewportToGlobal(loc);
-    int screenX = screenLoc.x();
-    int screenY = screenLoc.y();
-    bool ctrlKey = 0;   // FIXME - set up modifiers, grab from AK or CG
-    bool altKey = 0;
-    bool shiftKey = 0;
-    bool metaKey = 0;
+    viewportToContents(event.x(), event.y(), clientX, clientY);
     
     RefPtr<MouseEventImpl> me = new MouseEventImpl(eventType,
         true, true, m_frame->document()->defaultView(),
-        0, screenX, screenY, clientX, clientY,
-        ctrlKey, altKey, shiftKey, metaKey,
+        0, event.globalX(), event.globalY(), clientX, clientY,
+        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
         0, 0, clipboard);
 
     ExceptionCode ec = 0;
@@ -697,11 +682,11 @@ bool FrameView::dispatchDragEvent(const AtomicString &eventType, NodeImpl *dragT
     return me->defaultPrevented();
 }
 
-bool FrameView::updateDragAndDrop(const IntPoint &loc, ClipboardImpl *clipboard)
+bool FrameView::updateDragAndDrop(const MouseEvent& event, ClipboardImpl* clipboard)
 {
     bool accept = false;
     int xm, ym;
-    viewportToContents(loc.x(), loc.y(), xm, ym);
+    viewportToContents(event.x(), event.y(), xm, ym);
     MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(true, false, false, xm, ym, 0);
 
     // Drag events should never go to text nodes (following IE, and proper mouseover/out dispatch)
@@ -712,30 +697,30 @@ bool FrameView::updateDragAndDrop(const IntPoint &loc, ClipboardImpl *clipboard)
     if (d->dragTarget != newTarget) {
         // note this ordering is explicitly chosen to match WinIE
         if (newTarget)
-            accept = dispatchDragEvent(dragenterEvent, newTarget, loc, clipboard);
+            accept = dispatchDragEvent(dragenterEvent, newTarget, event, clipboard);
         if (d->dragTarget)
-            dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), loc, clipboard);
+            dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
     } else {
         if (newTarget)
-            accept = dispatchDragEvent(dragoverEvent, newTarget, loc, clipboard);
+            accept = dispatchDragEvent(dragoverEvent, newTarget, event, clipboard);
     }
     d->dragTarget = newTarget;
 
     return accept;
 }
 
-void FrameView::cancelDragAndDrop(const IntPoint &loc, ClipboardImpl *clipboard)
+void FrameView::cancelDragAndDrop(const MouseEvent& event, ClipboardImpl* clipboard)
 {
     if (d->dragTarget)
-        dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), loc, clipboard);
+        dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
     d->dragTarget = 0;
 }
 
-bool FrameView::performDragAndDrop(const IntPoint &loc, ClipboardImpl *clipboard)
+bool FrameView::performDragAndDrop(const MouseEvent& event, ClipboardImpl* clipboard)
 {
     bool accept = false;
     if (d->dragTarget)
-        accept = dispatchDragEvent(dropEvent, d->dragTarget.get(), loc, clipboard);
+        accept = dispatchDragEvent(dropEvent, d->dragTarget.get(), event, clipboard);
     d->dragTarget = 0;
     return accept;
 }
@@ -940,7 +925,7 @@ void FrameView::setResizingFrameSet(HTMLFrameSetElementImpl *frameSet)
 }
 
 bool FrameView::dispatchMouseEvent(const AtomicString& eventType, NodeImpl* targetNode, bool cancelable,
-    int clickCount, MouseEvent* mouseEvent, bool setUnder)
+    int clickCount, const MouseEvent& mouseEvent, bool setUnder)
 {
     // if the target node is a text node, dispatch on the parent node - rdar://4196646
     if (targetNode && targetNode->isTextNode())
@@ -950,7 +935,7 @@ bool FrameView::dispatchMouseEvent(const AtomicString& eventType, NodeImpl* targ
     // mouseout/mouseover
     if (setUnder) {
         int clientX, clientY;
-        viewportToContents(mouseEvent->x(), mouseEvent->y(), clientX, clientY);
+        viewportToContents(mouseEvent.x(), mouseEvent.y(), clientX, clientY);
         if (d->prevMouseX != clientX || d->prevMouseY != clientY) {
             // ### this code sucks. we should save the oldUnder instead of calculating
             // it again. calculating is expensive! (Dirk)
@@ -1016,26 +1001,26 @@ void FrameView::setIgnoreWheelEvents( bool e )
     d->ignoreWheelEvents = e;
 }
 
-void FrameView::viewportWheelEvent(WheelEvent* e)
+void FrameView::viewportWheelEvent(WheelEvent& e)
 {
     DocumentImpl *doc = m_frame->document();
     if (doc) {
         RenderObject *docRenderer = doc->renderer();
         if (docRenderer) {
             int x, y;
-            viewportToContents(e->x(), e->y(), x, y);
+            viewportToContents(e.x(), e.y(), x, y);
 
             RenderObject::NodeInfo hitTestResult(true, false);
             doc->renderer()->layer()->hitTest(hitTestResult, x, y); 
             NodeImpl *node = hitTestResult.innerNode();
 
            if (m_frame->passWheelEventToChildWidget(node)) {
-                e->accept();
+                e.accept();
                 return;
             }
             if (node) {
                 node->dispatchWheelEvent(e);
-                if (e->isAccepted())
+                if (e.isAccepted())
                     return;
             }
         }
index 02c341d3f55c8639e4b92dfb7aea559c9b9d983a..9db02c29a4a6c4e443ecd7c6cb5566890c89c788 100644 (file)
@@ -136,18 +136,17 @@ public:
 public:
     void clearPart();
 
-    void viewportMousePressEvent(MouseEvent*);
-    void viewportMouseDoubleClickEvent(MouseEvent*);
-    void viewportMouseMoveEvent(MouseEvent*);
-    void viewportMouseReleaseEvent(MouseEvent*);
-    void viewportWheelEvent(WheelEvent*);
-    void keyPressEvent(KeyEvent*);
+    void viewportMousePressEvent(const MouseEvent&);
+    void viewportMouseDoubleClickEvent(const MouseEvent&);
+    void viewportMouseMoveEvent(const MouseEvent&);
+    void viewportMouseReleaseEvent(const MouseEvent&);
+    void viewportWheelEvent(WheelEvent&);
 
     void doAutoScroll();
 
-    bool updateDragAndDrop(const IntPoint &, ClipboardImpl *clipboard);
-    void cancelDragAndDrop(const IntPoint &, ClipboardImpl *clipboard);
-    bool performDragAndDrop(const IntPoint &, ClipboardImpl *clipboard);
+    bool updateDragAndDrop(const MouseEvent&, ClipboardImpl*);
+    void cancelDragAndDrop(const MouseEvent&, ClipboardImpl*);
+    bool performDragAndDrop(const MouseEvent&, ClipboardImpl*);
 
     void layoutTimerFired(Timer<FrameView>*);
     void hoverTimerFired(Timer<FrameView>*);
@@ -164,10 +163,6 @@ public:
 
     void scheduleHoverStateUpdate();
 
-    Widget *topLevelWidget() const;
-    IntPoint mapToGlobal(const IntPoint &) const;
-    // maps "viewport" (actually Cocoa window coords) to screen coords
-    IntPoint viewportToGlobal(const IntPoint &) const;
     void adjustViewSize();
     void initScrollBars();
     
@@ -190,16 +185,6 @@ private:
     void resetCursor();
     void invalidateClick();
 
-    /**
-     * Paints the HTML document.
-     * The document will be scaled to match the width of
-     * the rectangle and clipped to fit in the height.
-     * yOffset determines the vertical offset in the document to start with.
-     * more, if not null, will be set to true if the documents extends
-     * beyond the rc or false if everything below yOffset was painted.
-     **/
-    void paint(GraphicsContext, const IntRect&, int yOffset = 0, bool* more = 0);
-
     /**
      * Get/set the CSS Media Type.
      *
@@ -231,9 +216,9 @@ private:
     void addFormCompletionItem(const QString &name, const QString &value);
 
     bool dispatchMouseEvent(const AtomicString& eventType, NodeImpl* target,
-        bool cancelable, int clickCount, MouseEvent*, bool setUnder);
+        bool cancelable, int clickCount, const MouseEvent&, bool setUnder);
     bool dispatchDragEvent(const AtomicString& eventType, NodeImpl* target,
-        const IntPoint& loc, ClipboardImpl*);
+        const MouseEvent&, ClipboardImpl*);
 
     void applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
 
index 8b3523d25dd866c8a2898dd92774407658f67cec..911a82ba071b909b337d9cddf517f56aa6dbd81f 100644 (file)
 #define MouseEventWithHitTestResults_h
 
 #include "NodeImpl.h"
+#include "MouseEvent.h"
 
 namespace WebCore {
 
 class MouseEventWithHitTestResults {
 public:
-    MouseEventWithHitTestResults() : m_event(0) { }
-    MouseEventWithHitTestResults(MouseEvent* e, const String& u, const String& t, PassRefPtr<NodeImpl> n)
+    MouseEventWithHitTestResults(const MouseEvent& e, const String& u, const String& t, PassRefPtr<NodeImpl> n)
         : m_event(e), m_url(u), m_target(t), m_innerNode(n) { }
 
-    MouseEvent* event() const { return m_event; }
+    const MouseEvent& event() const { return m_event; }
     String url() const { return m_url; }
     String target() const { return m_target; }
     NodeImpl* innerNode() const { return m_innerNode.get(); }
 
 private:
-    MouseEvent* m_event;
+    MouseEvent m_event;
     String m_url;
     String m_target;
     RefPtr<NodeImpl> m_innerNode;
index 19c0ee9e6b78f362f1ad0699c28a30d74f2c5bf3..32bb913ad12815b0d5dc1f7cc47220c3e2c2b64a 100644 (file)
@@ -33,7 +33,7 @@ namespace WebCore {
 static int pageCount;
 static HashMap<String, HashSet<Page*>*>* frameNamespaces;
 
-Page::Page() : m_frameCount(0)
+void Page::init()
 {
     ++pageCount;
 }
index da2a6fb5dd5aaba9cfa07963f7abcee5815e0072..7cb295e5324d89b8771f6b185b1dfae656ef842b 100644 (file)
 #include <kxmlcore/PassRefPtr.h>
 #include <kxmlcore/RefPtr.h>
 
+#if __APPLE__
+#ifdef __OBJC__
+@class WebCorePageBridge;
+#else
+class WebCorePageBridge;
+#endif
+#endif
+
 namespace WebCore {
 
     class Frame;
     class FrameNamespace;
+    class IntRect;
     
     class Page : Noncopyable {
     public:
-        Page();
-        virtual ~Page();
+        ~Page();
 
         void setMainFrame(PassRefPtr<Frame> mainFrame);
         Frame* mainFrame() { return m_mainFrame.get(); }
 
+        IntRect windowRect() const;
+        void setWindowRect(const IntRect&);
+
         void setGroupName(const String&);
         String groupName() const { return m_groupName; }
         const HashSet<Page*>* frameNamespace() const;
@@ -49,10 +60,21 @@ namespace WebCore {
         void decrementFrameCount() { --m_frameCount; }
         int frameCount() const { return m_frameCount; }
 
+#if __APPLE__
+        Page(WebCorePageBridge*);
+        WebCorePageBridge* bridge() const { return m_bridge; }
+#endif
+
     private:
+        void init();
+
         RefPtr<Frame> m_mainFrame;
         int m_frameCount;
         String m_groupName;
+
+#if __APPLE__
+        WebCorePageBridge* m_bridge;
+#endif
     };
 
 } // namespace WebCore
index bc595a4ecb4213296499c9f355ed353cc476131e..6157423297d7ff2a7502af96df90ccbad3ae83b0 100644 (file)
@@ -49,7 +49,6 @@ namespace WebCore {
         String keyIdentifier() const { return m_keyIdentifier; }
         bool isKeyUp() const { return m_isKeyUp; }
         bool isAutoRepeat() const { return m_autoRepeat; }
-        bool isAccepted() const { return m_isAccepted; }
         int WindowsKeyCode() const { return m_WindowsKeyCode; }
         bool isKeypad() const { return m_isKeypad; }
         bool shiftKey() const { return m_shiftKey; }
@@ -57,9 +56,6 @@ namespace WebCore {
         bool altKey() const { return m_altKey; }
         bool metaKey() const { return m_metaKey; }
 
-        void accept() { m_isAccepted = true; }
-        void ignore() { m_isAccepted = false; }
-
 #ifdef __APPLE__
         KeyEvent(NSEvent*, bool forceAutoRepeat = false);
 #endif
@@ -74,7 +70,6 @@ namespace WebCore {
         String m_keyIdentifier;
         bool m_isKeyUp;
         bool m_autoRepeat;
-        bool m_isAccepted;
         int m_WindowsKeyCode;
         bool m_isKeypad;
         bool m_shiftKey;
index e3344e394530fe149aa94c8c453aadb67448b8d3..a485639887e0e8b44f2779e33ab3804fe14718f1 100644 (file)
@@ -37,9 +37,9 @@ class NSEvent;
 #endif
 
 #if WIN32
-typedef struct HWND__ *HWND;
-typedef unsigned    WPARAM;
-typedef long        LPARAM;
+typedef struct HWND__HWND;
+typedef unsigned WPARAM;
+typedef long LPARAM;
 #endif
 
 namespace WebCore {
@@ -50,9 +50,12 @@ namespace WebCore {
     class MouseEvent {
     public:
         MouseEvent(); // "current event"
-#if WIN32
-        MouseEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, int clickCount);
-#endif
+        MouseEvent(const IntPoint& pos, const IntPoint& globalPos, MouseButton button,
+                int clickCount, bool shift, bool ctrl, bool alt, bool meta)
+            : m_position(pos), m_globalPosition(globalPos), m_button(button)
+            , m_clickCount(clickCount)
+            , m_shiftKey(shift), m_ctrlKey(ctrl), m_altKey(alt), m_metaKey(meta)
+            { }
 
         const IntPoint& pos() const { return m_position; }
         int x() const { return m_position.x(); }
@@ -70,6 +73,9 @@ namespace WebCore {
 #if __APPLE__
         MouseEvent(NSEvent*);
 #endif
+#if WIN32
+        MouseEvent(HWND, WPARAM, LPARAM, int clickCount);
+#endif
 
     private:
         IntPoint m_position;
index 6801610ca7d9c62206ba9104720f548e24d94617..4e4932cd1129dec615a041944aecb648ad665ad7 100644 (file)
@@ -706,7 +706,6 @@ KeyEvent::KeyEvent(NSEvent *event, bool forceAutoRepeat)
       m_keyIdentifier(keyIdentifierForKeyEvent(event)),
       m_isKeyUp([event type] == NSKeyUp),
       m_autoRepeat(forceAutoRepeat || [event isARepeat]),
-      m_isAccepted(false),
       m_WindowsKeyCode(WindowsKeyCodeForKeyEvent(event)),
       m_isKeypad(isKeypadEvent(event)),
       m_shiftKey([event modifierFlags] & NSShiftKeyMask),
index 0b68431890b63d09ac859a1c0a25018595ff0fc4..2193973383cd240afc8126cd484ef08ca695bb5c 100644 (file)
@@ -43,7 +43,6 @@ static void notImplemented() { puts("Not yet implemented"); _CrtDbgBreak(); }
 IntPoint FrameView::viewportToGlobal(IntPoint const&) const { notImplemented(); return IntPoint(); }
 void FrameView::updateBorder() { notImplemented(); }
 bool FrameView::isFrameView() const { notImplemented(); return 0; }
-Widget* FrameView::topLevelWidget() const { notImplemented(); return 0; }
 
 QTextEdit::QTextEdit(Widget*) { notImplemented(); }
 QTextEdit::~QTextEdit() { notImplemented(); }
index 6b46541d37dbea9efb0d8754f7d327405cd73fb5..98342c252c11d6e447cc58f7250f562353a871d1 100644 (file)
@@ -99,7 +99,7 @@ void RenderFormElement::clicked(Widget*)
     RenderArena* arena = ref();
     MouseEvent event; // gets "current event"
     if (element())
-        element()->dispatchMouseEvent(&event, clickEvent, event.clickCount());
+        element()->dispatchMouseEvent(event, clickEvent, event.clickCount());
     deref(arena);
 }