2006-03-17 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2006 10:47:39 +0000 (10:47 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2006 10:47:39 +0000 (10:47 +0000)
        Reviewed by adele.

        Fix win32 build.
        Add PageWin class.
        Add previously forgotten KeyEventWin class.
        Pass MouseEvent() instead of 0 in a couple places to make compiler happy.

        * WebCore.vcproj/WebCore/WebCore.vcproj:
        * bridge/win/BrowserExtensionWin.h:
        * bridge/win/FrameWin.cpp:
        (WebCore::FrameWin::urlSelected):
        (WebCore::FrameWin::keyPress):
        * bridge/win/FrameWin.h:
        * bridge/win/PageWin.cpp: Added.
        (WebCore::rootWindowForFrame):
        (WebCore::Page::windowRect):
        (WebCore::Page::setWindowRect):
        * page/FrameView.cpp:
        (WebCore::FrameView::updateDragAndDrop):
        (WebCore::FrameView::hoverTimerFired):
        * page/Page.h:
        (WebCore::Page::mainFrame):
        * platform/win/KeyEventWin.cpp: Added.
        (WebCore::KeyEvent::KeyEvent):
        * platform/win/TemporaryLinkStubs.cpp:
        (WebCore::findNextWordFromIndex):
        (FrameWin::passMouseDownEventToWidget):
        (FrameWin::scheduleClose):
        (BrowserExtensionWin::createNewWindow):
        (WebCore::findWordBoundary):
        (FrameWin::registerCommandForUndo):
        (FrameWin::markMisspellingsInAdjacentWords):
        (FrameWin::respondToChangedContents):

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

WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore/WebCore.vcproj
WebCore/bridge/win/BrowserExtensionWin.h
WebCore/bridge/win/FrameWin.cpp
WebCore/bridge/win/FrameWin.h
WebCore/bridge/win/PageWin.cpp [new file with mode: 0644]
WebCore/page/FrameView.cpp
WebCore/page/Page.h
WebCore/platform/win/KeyEventWin.cpp [new file with mode: 0644]
WebCore/platform/win/TemporaryLinkStubs.cpp

index ad4fc168a9a6a8c10d9e96441e353a3a0ba9dffe..3640df00fca8e35f6def292022bd7b6b94ea0b63 100644 (file)
@@ -1,3 +1,39 @@
+2006-03-17  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by adele.
+
+        Fix win32 build.
+        Add PageWin class.
+        Add previously forgotten KeyEventWin class.
+        Pass MouseEvent() instead of 0 in a couple places to make compiler happy.
+
+        * WebCore.vcproj/WebCore/WebCore.vcproj:
+        * bridge/win/BrowserExtensionWin.h:
+        * bridge/win/FrameWin.cpp:
+        (WebCore::FrameWin::urlSelected):
+        (WebCore::FrameWin::keyPress):
+        * bridge/win/FrameWin.h:
+        * bridge/win/PageWin.cpp: Added.
+        (WebCore::rootWindowForFrame):
+        (WebCore::Page::windowRect):
+        (WebCore::Page::setWindowRect):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateDragAndDrop):
+        (WebCore::FrameView::hoverTimerFired):
+        * page/Page.h:
+        (WebCore::Page::mainFrame):
+        * platform/win/KeyEventWin.cpp: Added.
+        (WebCore::KeyEvent::KeyEvent):
+        * platform/win/TemporaryLinkStubs.cpp:
+        (WebCore::findNextWordFromIndex):
+        (FrameWin::passMouseDownEventToWidget):
+        (FrameWin::scheduleClose):
+        (BrowserExtensionWin::createNewWindow):
+        (WebCore::findWordBoundary):
+        (FrameWin::registerCommandForUndo):
+        (FrameWin::markMisspellingsInAdjacentWords):
+        (FrameWin::respondToChangedContents):
+
 2006-03-17  David Hyatt  <hyatt@apple.com>
 
         Fix pixel test regression in fast/table/overflowHidden.html.  There was
index d96262b0e4ccb2f1983cde95de3595464e0e9af2..86fbec95926cd4fcba62fcd1a2f8ce3171a0ff99 100644 (file)
                                        RelativePath="..\..\bridge\win\FrameWin.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\..\bridge\win\PageWin.cpp"\r
+                                       >\r
+                               </File>\r
                        </Filter>\r
                </Filter>\r
                <Filter\r
index 0982bdbb866c2bcd35ecf184c9b4deadf9acbc51..3757b27c39a419e36852789cc3e76bbda6ac8d30 100644 (file)
@@ -35,13 +35,13 @@ public:
     BrowserExtensionWin(Frame*);
  
     virtual void openURLRequest(const KURL &, 
-                                const URLArgs &args = URLArgs());
+                                const ResourceRequest &args = ResourceRequest());
     virtual void openURLNotify();
      
     virtual void createNewWindow(const KURL &url, 
-                                 const URLArgs &urlArgs = URLArgs());
+                                 const ResourceRequest &ResourceRequest = ResourceRequest());
     virtual void createNewWindow(const KURL& url,
-                                 const URLArgs& urlArgs
+                                 const ResourceRequest& ResourceRequest
                                  const WindowArgs& winArgs, 
                                  Frame*& part);
 
index 7e1a524942e27d21f9882db21169aed4477049b8..940486be6408b402aa6df7aea423bb60330e1b22 100644 (file)
@@ -58,7 +58,7 @@ FrameWin::~FrameWin()
 {
 }
 
-void FrameWin::urlSelected(const KURL& url, const URLArgs&)
+void FrameWin::urlSelected(const KURL& url, const ResourceRequest&)
 {
     if (m_client)
         m_client->openURL(url.url());
@@ -88,7 +88,7 @@ bool FrameWin::runJavaScriptConfirm(String const& message)
 }
 
 // FIXME: This needs to be unified with the keyPress method on MacFrame
-bool FrameWin::keyPress(KeyEvent* keyEvent)
+bool FrameWin::keyPress(const KeyEvent& keyEvent)
 {
     bool result;
     // Check for cases where we are too early for events -- possible unmatched key up
@@ -106,7 +106,7 @@ bool FrameWin::keyPress(KeyEvent* keyEvent)
             return false;
     }
     
-    if (!keyEvent->isKeyUp())
+    if (!keyEvent.isKeyUp())
         prepareForUserAction();
 
     result = !node->dispatchKeyEvent(keyEvent);
index a187b66b21394ed39d03b3b8dffb2916e467d543..882ae081fd62080808666938bac976ed4825403d 100644 (file)
@@ -43,9 +43,9 @@ public:
     ~FrameWin();
 
     virtual bool openURL(const KURL&);
-    virtual void openURLRequest(const KURL&, const URLArgs&);
-    virtual void submitForm(const KURL&, const URLArgs&);
-    virtual void urlSelected(const KURL&, const URLArgs&);
+    virtual void openURLRequest(const KURL&, const ResourceRequest&);
+    virtual void submitForm(const KURL&, const ResourceRequest&);
+    virtual void urlSelected(const KURL&, const ResourceRequest&);
 
     virtual void setTitle(const String&);
 
@@ -119,7 +119,7 @@ public:
     virtual bool canUndo() const;
     virtual void print();
 
-    bool keyPress(KeyEvent*);
+    bool keyPress(const KeyEvent&);
 
 private:
     virtual bool passMouseDownEventToWidget(Widget*);
diff --git a/WebCore/bridge/win/PageWin.cpp b/WebCore/bridge/win/PageWin.cpp
new file mode 100644 (file)
index 0000000..80c6c00
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "Page.h"
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "IntRect.h"
+#include <windows.h>
+
+namespace WebCore {
+
+static HWND rootWindowForFrame(const Frame* frame)
+{
+    if (!frame)
+        return 0;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return 0;
+    HWND frameWnd = frameView->windowHandle();
+    if (!frameWnd)
+        return 0;
+    return GetAncestor(frameWnd, GA_ROOT);
+}
+
+IntRect Page::windowRect() const
+{
+    HWND windowHandle = rootWindowForFrame(mainFrame());
+    if (!windowHandle)
+        return IntRect();
+    RECT rect;
+    GetWindowRect(windowHandle, &rect);
+    return rect;
+}
+
+void Page::setWindowRect(const IntRect& r)
+{
+    HWND windowHandle = rootWindowForFrame(mainFrame());
+    if (!windowHandle)
+        return;
+    MoveWindow(windowHandle, r.x(), r.y(), r.width(), r.height(), true);
+}
+
+}
index 15909b54f2126800d5947be8170ee9c535597fed..1baf7a8a96fb4d7d7cee981b05f0b370191f046e 100644 (file)
@@ -687,7 +687,7 @@ bool FrameView::updateDragAndDrop(const MouseEvent& event, ClipboardImpl* clipbo
     bool accept = false;
     int xm, ym;
     viewportToContents(event.x(), event.y(), xm, ym);
-    MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(true, false, false, xm, ym, 0);
+    MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(true, false, false, xm, ym, MouseEvent());
 
     // Drag events should never go to text nodes (following IE, and proper mouseover/out dispatch)
     NodeImpl* newTarget = mev.innerNode();
@@ -1051,7 +1051,7 @@ void FrameView::layoutTimerFired(Timer<FrameView>*)
 void FrameView::hoverTimerFired(Timer<FrameView>*)
 {
     d->hoverTimer.stop();
-    m_frame->document()->prepareMouseEvent(false, false, true, d->prevMouseX, d->prevMouseY, 0);
+    m_frame->document()->prepareMouseEvent(false, false, true, d->prevMouseX, d->prevMouseY, MouseEvent());
 }
 
 void FrameView::scheduleRelayout()
index 7cb295e5324d89b8771f6b185b1dfae656ef842b..a6126381cc845e7d73b2e822e8f70b5f828c2bc5 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
         ~Page();
 
         void setMainFrame(PassRefPtr<Frame> mainFrame);
-        Frame* mainFrame() { return m_mainFrame.get(); }
+        Frame* mainFrame() const { return m_mainFrame.get(); }
 
         IntRect windowRect() const;
         void setWindowRect(const IntRect&);
diff --git a/WebCore/platform/win/KeyEventWin.cpp b/WebCore/platform/win/KeyEventWin.cpp
new file mode 100644 (file)
index 0000000..4c42c02
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "KeyEvent.h"
+#include <windows.h>
+
+#define REPEAT_COUNT_MASK           0x0000FFFF
+#define NEW_DOWN_STATE_MASK         0x80000000
+#define PREVIOUS_DOWN_STATE_MASK    0x40000000
+#define ALT_KEY_DOWN_MASK           0x20000000
+
+#define HIGH_BIT_MASK_SHORT         0x8000
+
+namespace WebCore {
+
+KeyEvent::KeyEvent(HWND hWnd, WPARAM wParam, LPARAM lParam)
+    : m_text(QChar(wParam))
+    , m_unmodifiedText(QChar(wParam))
+    , m_keyIdentifier(QString().sprintf("U+%06X", toupper(wParam)))
+    , m_isKeyUp(!(lParam & NEW_DOWN_STATE_MASK))
+    , m_autoRepeat(lParam & REPEAT_COUNT_MASK)
+    , m_WindowsKeyCode(wParam)
+    , m_isKeypad(false) // FIXME
+    , m_shiftKey(GetAsyncKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT)
+    , m_ctrlKey(GetAsyncKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT)
+    , m_altKey(lParam & ALT_KEY_DOWN_MASK)
+    , m_metaKey(lParam & ALT_KEY_DOWN_MASK) // FIXME: Is this right?
+{
+    if (!m_shiftKey)
+        m_text = String(QChar(tolower(wParam)));
+}   
+
+}
index 2193973383cd240afc8126cd484ef08ca695bb5c..706528cc57fe1e24aa5824d49e05201cf33fe1c9 100644 (file)
@@ -40,7 +40,6 @@ using namespace WebCore;
 
 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; }
 
@@ -139,11 +138,9 @@ String WebCore::searchableIndexIntroduction() { notImplemented(); return String(
 int WebCore::findNextSentenceFromIndex(QChar const*,int,int,bool) { notImplemented(); return 0; }
 void WebCore::findSentenceBoundary(QChar const*,int,int,int*,int*) { notImplemented(); }
 int WebCore::findNextWordFromIndex(QChar const*,int,int,bool) { notImplemented(); return 0; }
-void WebCore::findWordBoundary(QChar const*,int,int,int*,int*) { notImplemented(); }
 
 Array<char> KWQServeSynchronousRequest(Loader*,DocLoader*,TransferJob*,KURL&,QString&) { notImplemented(); return 0; }
 
-void FrameWin::respondToChangedContents() { notImplemented(); }
 void FrameWin::unfocusWindow() { notImplemented(); }
 bool FrameWin::locationbarVisible() { notImplemented(); return 0; }
 void FrameWin::issueRedoCommand(void) { notImplemented(); }
@@ -157,16 +154,14 @@ bool FrameWin::openURL(KURL const&) { notImplemented(); return 0; }
 void FrameWin::print() { notImplemented(); }
 KJS::Bindings::Instance* FrameWin::getAppletInstanceForWidget(Widget*) { notImplemented(); return 0; }
 bool FrameWin::passMouseDownEventToWidget(Widget*) { notImplemented(); return 0; }
-void FrameWin::registerCommandForUndo(WebCore::EditCommandPtr const&) { notImplemented(); }
 void FrameWin::issueCutCommand() { notImplemented(); }
 void FrameWin::issueCopyCommand() { notImplemented(); }
-void FrameWin::openURLRequest(KURL const&,struct WebCore::URLArgs const&) { notImplemented(); }
+void FrameWin::openURLRequest(KURL const&,struct WebCore::ResourceRequest const&) { notImplemented(); }
 bool FrameWin::passWheelEventToChildWidget(NodeImpl*) { notImplemented(); return 0; }
 void FrameWin::issueUndoCommand() { notImplemented(); }
 QString FrameWin::mimeTypeForFileName(QString const&) const { notImplemented(); return QString(); }
 void FrameWin::issuePasteCommand() { notImplemented(); }
 void FrameWin::scheduleClose() { notImplemented(); }
-void FrameWin::markMisspellingsInAdjacentWords(WebCore::VisiblePosition const&) { notImplemented(); }
 void FrameWin::markMisspellings(WebCore::SelectionController const&) { notImplemented(); }
 bool FrameWin::menubarVisible() { notImplemented(); return 0; }
 bool FrameWin::personalbarVisible() { notImplemented(); return 0; }
@@ -179,14 +174,14 @@ bool FrameWin::canGoBackOrForward(int) const { notImplemented(); return 0; }
 void FrameWin::issuePasteAndMatchStyleCommand() { notImplemented(); }
 Plugin* FrameWin::createPlugin(KURL const&,QStringList const&,QStringList const&,QString const&) { notImplemented(); return 0; }
 
-void BrowserExtensionWin::openURLRequest(KURL const&,struct WebCore::URLArgs const&) { notImplemented(); }
+void BrowserExtensionWin::openURLRequest(KURL const&,struct WebCore::ResourceRequest const&) { notImplemented(); }
 bool BrowserExtensionWin::canRunModal() { notImplemented(); return 0; }
 void BrowserExtensionWin::openURLNotify() { notImplemented(); }
-void BrowserExtensionWin::createNewWindow(KURL const&,struct WebCore::URLArgs const&,struct WebCore::WindowArgs const&,Frame*&) { notImplemented(); }
+void BrowserExtensionWin::createNewWindow(KURL const&,struct WebCore::ResourceRequest const&,struct WebCore::WindowArgs const&,Frame*&) { notImplemented(); }
 bool BrowserExtensionWin::canRunModalNow() { notImplemented(); return 0; }
 void BrowserExtensionWin::runModal() { notImplemented(); }
 void BrowserExtensionWin::goBackOrForward(int) { notImplemented(); }
-void BrowserExtensionWin::createNewWindow(KURL const&,struct WebCore::URLArgs const&) { notImplemented(); }
+void BrowserExtensionWin::createNewWindow(KURL const&,struct WebCore::ResourceRequest const&) { notImplemented(); }
 
 void RenderCanvasImage::setNeedsImageUpdate() { notImplemented(); }
 
@@ -203,6 +198,8 @@ String WebCore::inputElementAltText() { return QString(); }
 String WebCore::resetButtonDefaultLabel() { return "Reset"; }
 String WebCore::defaultLanguage() { return "en"; }
 
+void WebCore::findWordBoundary(QChar const* str,int len,int position,int* start, int* end) {*start=position; *end=position; }
+
 void WebCore::setCookies(KURL const&,KURL const&,String const&) { }
 String WebCore::cookies(KURL const&) { return String(); }
 bool WebCore::cookiesEnabled() { return false; }
@@ -229,11 +226,14 @@ void FrameWin::respondToChangedSelection(WebCore::SelectionController const&,boo
 static int frameNumber = 0;
 Frame* FrameWin::createFrame(KURL const&,QString const&,RenderPart*,String const&) { return 0; }
 void FrameWin::saveDocumentState(void) { }
+void FrameWin::registerCommandForUndo(WebCore::EditCommandPtr const&) { }
 void FrameWin::clearUndoRedoOperations(void) { }
 QString FrameWin::incomingReferrer() const { return QString(); }
 void FrameWin::clearRecordedFormValues() { }
 void FrameWin::recordFormValue(QString const&,QString const&,WebCore::HTMLFormElementImpl*) { }
-void FrameWin::submitForm(KURL const&,struct WebCore::URLArgs const&) { }
+void FrameWin::submitForm(KURL const&,struct WebCore::ResourceRequest const&) { }
+void FrameWin::markMisspellingsInAdjacentWords(WebCore::VisiblePosition const&) { }
+void FrameWin::respondToChangedContents() { }
 
 BrowserExtensionWin::BrowserExtensionWin(WebCore::Frame*) { }
 void BrowserExtensionWin::setTypedIconURL(KURL const&,QString const&) { }