summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess/win
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/win')
-rw-r--r--Source/WebKit2/UIProcess/win/TextCheckerWin.cpp80
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextWin.cpp4
-rw-r--r--Source/WebKit2/UIProcess/win/WebGrammarDetail.cpp72
-rw-r--r--Source/WebKit2/UIProcess/win/WebGrammarDetail.h62
-rw-r--r--Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp3
-rw-r--r--Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp9
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp23
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h7
-rw-r--r--Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp36
-rw-r--r--Source/WebKit2/UIProcess/win/WebTextChecker.cpp84
-rw-r--r--Source/WebKit2/UIProcess/win/WebTextChecker.h63
-rw-r--r--Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp175
-rw-r--r--Source/WebKit2/UIProcess/win/WebTextCheckerClient.h61
-rw-r--r--Source/WebKit2/UIProcess/win/WebUndoClient.cpp16
-rwxr-xr-xSource/WebKit2/UIProcess/win/WebUndoClient.h2
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.cpp212
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.h19
17 files changed, 875 insertions, 53 deletions
diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
index dbc6fdc..9f7c766 100644
--- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
+++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
@@ -27,6 +27,7 @@
#include "TextChecker.h"
#include "TextCheckerState.h"
+#include "WebTextChecker.h"
#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -37,68 +38,103 @@ static TextCheckerState textCheckerState;
const TextCheckerState& TextChecker::state()
{
- notImplemented();
+ static bool didInitializeState;
+ if (didInitializeState)
+ return textCheckerState;
+
+ WebTextCheckerClient& client = WebTextChecker::shared()->client();
+ textCheckerState.isContinuousSpellCheckingEnabled = client.continuousSpellCheckingEnabled();
+ textCheckerState.isGrammarCheckingEnabled = client.grammarCheckingEnabled();
+
+ didInitializeState = true;
return textCheckerState;
}
bool TextChecker::isContinuousSpellCheckingAllowed()
{
- notImplemented();
-
- return false;
+ return WebTextChecker::shared()->client().continuousSpellCheckingAllowed();
}
void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled)
{
- notImplemented();
+ if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
+ return;
+ textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
+ WebTextChecker::shared()->client().setContinuousSpellCheckingEnabled(isContinuousSpellCheckingEnabled);
}
void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
{
- notImplemented();
+ if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
+ return;
+ textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled;
+ WebTextChecker::shared()->client().setGrammarCheckingEnabled(isGrammarCheckingEnabled);
+}
+
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+ textCheckerState.isContinuousSpellCheckingEnabled = enabled;
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+ textCheckerState.isGrammarCheckingEnabled = enabled;
+}
+
+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy* page)
+{
+ return WebTextChecker::shared()->client().uniqueSpellDocumentTag(page);
+}
+
+void TextChecker::closeSpellDocumentWithTag(int64_t tag)
+{
+ WebTextChecker::shared()->client().closeSpellDocumentWithTag(tag);
+}
+
+void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength)
+{
+ WebTextChecker::shared()->client().checkSpellingOfString(spellDocumentTag, String(text, length), misspellingLocation, misspellingLength);
}
-int64_t TextChecker::uniqueSpellDocumentTag()
+void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
{
- notImplemented();
- return 0;
+ WebTextChecker::shared()->client().checkGrammarOfString(spellDocumentTag, String(text, length), grammarDetails, badGrammarLocation, badGrammarLength);
}
-void TextChecker::closeSpellDocumentWithTag(int64_t)
+bool TextChecker::spellingUIIsShowing()
{
- notImplemented();
+ return WebTextChecker::shared()->client().spellingUIIsShowing();
}
-Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes)
+void TextChecker::toggleSpellingUIIsShowing()
{
- notImplemented();
- return Vector<WebCore::TextCheckingResult>();
+ WebTextChecker::shared()->client().toggleSpellingUIIsShowing();
}
-void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord)
{
- notImplemented();
+ WebTextChecker::shared()->client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord);
}
-void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+void TextChecker::updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
{
- notImplemented();
+ WebTextChecker::shared()->client().updateSpellingUIWithGrammarString(spellDocumentTag, badGrammarPhrase, grammarDetail);
}
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
- notImplemented();
+ WebTextChecker::shared()->client().guessesForWord(spellDocumentTag, word, guesses);
}
-void TextChecker::learnWord(const String& word)
+void TextChecker::learnWord(int64_t spellDocumentTag, const String& word)
{
- notImplemented();
+ WebTextChecker::shared()->client().learnWord(spellDocumentTag, word);
}
void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word)
{
- notImplemented();
+ WebTextChecker::shared()->client().ignoreWord(spellDocumentTag, word);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
index d5fd859..c1c2a00 100644
--- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
@@ -48,9 +48,7 @@ void WebContext::setShouldPaintNativeControls(bool b)
{
m_shouldPaintNativeControls = b;
- if (!hasValidProcess())
- return;
- m_process->send(Messages::WebProcess::SetShouldPaintNativeControls(m_shouldPaintNativeControls), 0);
+ sendToAllProcesses(Messages::WebProcess::SetShouldPaintNativeControls(m_shouldPaintNativeControls));
}
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
diff --git a/Source/WebKit2/UIProcess/win/WebGrammarDetail.cpp b/Source/WebKit2/UIProcess/win/WebGrammarDetail.cpp
new file mode 100644
index 0000000..8df528c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebGrammarDetail.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebGrammarDetail.h"
+
+#include "ImmutableArray.h"
+#include "WKGrammarDetail.h"
+#include "WebString.h"
+
+namespace WebKit {
+
+PassRefPtr<WebGrammarDetail> WebGrammarDetail::create(int location, int length, ImmutableArray* guesses, const String& userDescription)
+{
+ return adoptRef(new WebGrammarDetail(location, length, guesses, userDescription));
+}
+
+PassRefPtr<WebGrammarDetail> WebGrammarDetail::create(const WebCore::GrammarDetail& grammarDetail)
+{
+ return adoptRef(new WebGrammarDetail(grammarDetail));
+}
+
+WebGrammarDetail::WebGrammarDetail(int location, int length, ImmutableArray* guesses, const String& userDescription)
+{
+ m_grammarDetail.location = location;
+ m_grammarDetail.length = length;
+
+ size_t numGuesses = guesses->size();
+ m_grammarDetail.guesses.reserveCapacity(numGuesses);
+ for (size_t i = 0; i < numGuesses; ++i)
+ m_grammarDetail.guesses.uncheckedAppend(guesses->at<WebString>(i)->string());
+
+ m_grammarDetail.userDescription = userDescription;
+}
+
+PassRefPtr<ImmutableArray> WebGrammarDetail::guesses() const
+{
+ size_t numGuesses = m_grammarDetail.guesses.size();
+ Vector<RefPtr<APIObject> > wkGuesses(numGuesses);
+ for (unsigned i = 0; i < numGuesses; ++i)
+ wkGuesses[i] = WebString::create(m_grammarDetail.guesses[i]);
+ return ImmutableArray::adopt(wkGuesses);
+}
+
+WebGrammarDetail::WebGrammarDetail(const WebCore::GrammarDetail& grammarDetail)
+ : m_grammarDetail(grammarDetail)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebGrammarDetail.h b/Source/WebKit2/UIProcess/win/WebGrammarDetail.h
new file mode 100644
index 0000000..ff79b5c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebGrammarDetail.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebGrammarDetail_h
+#define WebGrammarDetail_h
+
+#include "APIObject.h"
+#include <WebCore/TextCheckerClient.h>
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class ImmutableArray;
+
+class WebGrammarDetail : public APIObject {
+public:
+ static const Type APIType = TypeGrammarDetail;
+ static PassRefPtr<WebGrammarDetail> create(int location, int length, ImmutableArray* guesses, const String& userDescription);
+ static PassRefPtr<WebGrammarDetail> create(const WebCore::GrammarDetail&);
+
+ int location() const { return m_grammarDetail.location; }
+ int length() const { return m_grammarDetail.length; }
+ PassRefPtr<ImmutableArray> guesses() const;
+ const String& userDescription() const { return m_grammarDetail.userDescription; }
+
+ const WebCore::GrammarDetail& grammarDetail() { return m_grammarDetail; }
+
+private:
+ WebGrammarDetail(int location, int length, ImmutableArray* guesses, const String& userDescription);
+ WebGrammarDetail(const WebCore::GrammarDetail&);
+
+ virtual Type type() const { return APIType; }
+
+ WebCore::GrammarDetail m_grammarDetail;
+};
+
+} // namespace WebKit
+
+#endif // WebGrammarDetail_h
diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
index 30b012e..ec5e91c 100644
--- a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
@@ -30,6 +30,7 @@
#include "WebKitBundle.h"
#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
#include "WebView.h"
#include <WebCore/WebCoreInstanceHandle.h>
#include <wtf/PassRefPtr.h>
@@ -155,7 +156,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
ASSERT(!m_inspectorWindow);
RECT emptyRect = { 0 };
- m_inspectorView = WebView::create(emptyRect, m_page->context(), inspectorPageGroup(), 0);
+ m_inspectorView = WebView::create(emptyRect, m_page->process()->context(), inspectorPageGroup(), 0);
return m_inspectorView->page();
}
diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
index 1745a06..40a4cbb 100644
--- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "WebPageProxy.h"
+#include "WebPopupMenuProxyWin.h"
#include "resource.h"
#include <tchar.h>
@@ -54,4 +55,12 @@ String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent
return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)", applicationNameForUserAgent.isEmpty() ? "" : " ", applicationNameForUserAgent);
}
+void WebPageProxy::setPopupMenuSelectedIndex(int32_t selectedIndex)
+{
+ if (!m_activePopupMenu)
+ return;
+
+ static_cast<WebPopupMenuProxyWin*>(m_activePopupMenu.get())->setFocusedIndex(selectedIndex);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
index eebde75..a8d8063 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "WebPopupMenuProxyWin.h"
+#include "NativeWebMouseEvent.h"
#include "WebView.h"
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebCore/ScrollbarTheme.h>
@@ -324,8 +325,26 @@ void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, dou
m_showPopup = false;
::ShowWindow(m_popup, SW_HIDE);
- if (m_client)
- m_client->valueChangedForPopupMenu(this, m_newSelectedIndex);
+ if (!m_client)
+ return;
+
+ m_client->valueChangedForPopupMenu(this, m_newSelectedIndex);
+
+ // <https://bugs.webkit.org/show_bug.cgi?id=57904> In order to properly call the onClick()
+ // handler on a <select> element, we need to fake a mouse up event in the main window.
+ // The main window already received the mouse down, which showed this popup, but upon
+ // selection of an item the mouse up gets eaten by the popup menu. So we take the mouse down
+ // event, change the message type to a mouse up event, and post that in the message queue.
+ // Thus, we are virtually clicking at the
+ // same location where the mouse down event occurred. This allows the hit test to select
+ // the correct element, and thereby call the onClick() JS handler.
+ if (!m_client->currentlyProcessedMouseDownEvent())
+ return;
+
+ const MSG* initiatingWinEvent = m_client->currentlyProcessedMouseDownEvent()->nativeEvent();
+ MSG fakeEvent = *initiatingWinEvent;
+ fakeEvent.message = WM_LBUTTONUP;
+ ::PostMessage(fakeEvent.hwnd, fakeEvent.message, fakeEvent.wParam, fakeEvent.lParam);
}
void WebPopupMenuProxyWin::hidePopupMenu()
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
index 5a20edf..9d6d5b2 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
@@ -51,6 +51,8 @@ public:
virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
+ bool setFocusedIndex(int index, bool hotTracking = false);
+
void hide() { hidePopupMenu(); }
private:
@@ -63,8 +65,10 @@ private:
virtual int scrollPosition(WebCore::Scrollbar*) const;
virtual void setScrollOffset(const WebCore::IntPoint&);
virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&);
+ virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { }
virtual bool isActive() const { return true; }
- virtual bool scrollbarCornerPresent() const { return false; }
+ virtual bool isScrollCornerVisible() const { return false; }
+ virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); }
virtual WebCore::Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); }
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
@@ -107,7 +111,6 @@ private:
void paint(const WebCore::IntRect& damageRect, HDC = 0);
int visibleItems() const;
int listIndexAtPoint(const WebCore::IntPoint&) const;
- bool setFocusedIndex(int index, bool hotTracking = false);
int focusedIndex() const;
void focusFirst();
void focusLast();
diff --git a/Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp
new file mode 100644
index 0000000..1856b3b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+
+Vector<HWND> WebProcessProxy::windowsToReceiveSentMessagesWhileWaitingForSyncReply()
+{
+ return Vector<HWND>();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebTextChecker.cpp b/Source/WebKit2/UIProcess/win/WebTextChecker.cpp
new file mode 100644
index 0000000..2761844
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebTextChecker.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebTextChecker.h"
+
+#include "TextChecker.h"
+#include "WKAPICast.h"
+#include "WebContext.h"
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+WebTextChecker* WebTextChecker::shared()
+{
+ static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
+ return textChecker;
+}
+
+WebTextChecker::WebTextChecker()
+{
+}
+
+void WebTextChecker::setClient(const WKTextCheckerClient* client)
+{
+ m_client.initialize(client);
+}
+
+static void updateStateForAllWebProcesses()
+{
+ const Vector<WebContext*>& contexts = WebContext::allContexts();
+ for (size_t i = 0; i < contexts.size(); ++i) {
+ WebProcessProxy* webProcess = contexts[i]->process();
+ if (!webProcess)
+ continue;
+ webProcess->updateTextCheckerState();
+ }
+}
+
+void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+ TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
+ updateStateForAllWebProcesses();
+}
+
+void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+ TextChecker::grammarCheckingEnabledStateChanged(enabled);
+ updateStateForAllWebProcesses();
+}
+
+void WebTextChecker::checkSpelling(const WebPageProxy* page, bool startBeforeSelection)
+{
+ page->advanceToNextMisspelling(startBeforeSelection);
+}
+
+void WebTextChecker::changeSpellingToWord(const WebPageProxy* page, const String& text)
+{
+ page->changeSpellingToWord(text);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebTextChecker.h b/Source/WebKit2/UIProcess/win/WebTextChecker.h
new file mode 100644
index 0000000..a1c574c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebTextChecker.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebTextChecker_h
+#define WebTextChecker_h
+
+#include "APIObject.h"
+#include "WKTextChecker.h"
+#include "WebTextCheckerClient.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebTextChecker : public APIObject {
+public:
+ static const Type APIType = TypeTextChecker;
+
+ static WebTextChecker* shared();
+
+ void setClient(const WKTextCheckerClient*);
+ WebTextCheckerClient& client() { return m_client; }
+
+ void continuousSpellCheckingEnabledStateChanged(bool);
+ void grammarCheckingEnabledStateChanged(bool);
+
+ void checkSpelling(const WebPageProxy*, bool startBeforeSelection);
+ void changeSpellingToWord(const WebPageProxy*, const String&);
+
+private:
+ WebTextChecker();
+
+ virtual Type type() const { return APIType; }
+
+ WebTextCheckerClient m_client;
+};
+
+} // namespace WebKit
+
+#endif // WebTextChecker_h
diff --git a/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp
new file mode 100644
index 0000000..86e52c6
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebTextCheckerClient.h"
+
+#include "ImmutableArray.h"
+#include "WKAPICast.h"
+#include "WKSharedAPICast.h"
+#include "WebGrammarDetail.h"
+#include "WebPageProxy.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+bool WebTextCheckerClient::continuousSpellCheckingAllowed()
+{
+ if (!m_client.continuousSpellCheckingAllowed)
+ return false;
+
+ return m_client.continuousSpellCheckingAllowed(m_client.clientInfo);
+}
+
+bool WebTextCheckerClient::continuousSpellCheckingEnabled()
+{
+ if (!m_client.continuousSpellCheckingEnabled)
+ return false;
+
+ return m_client.continuousSpellCheckingEnabled(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::setContinuousSpellCheckingEnabled(bool enabled)
+{
+ if (!m_client.setContinuousSpellCheckingEnabled)
+ return;
+
+ m_client.setContinuousSpellCheckingEnabled(enabled, m_client.clientInfo);
+}
+
+bool WebTextCheckerClient::grammarCheckingEnabled()
+{
+ if (!m_client.grammarCheckingEnabled)
+ return false;
+
+ return m_client.grammarCheckingEnabled(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::setGrammarCheckingEnabled(bool enabled)
+{
+ if (!m_client.setGrammarCheckingEnabled)
+ return;
+
+ m_client.setGrammarCheckingEnabled(enabled, m_client.clientInfo);
+}
+
+uint64_t WebTextCheckerClient::uniqueSpellDocumentTag(WebPageProxy* page)
+{
+ if (!m_client.uniqueSpellDocumentTag)
+ return 0;
+
+ return m_client.uniqueSpellDocumentTag(toAPI(page), m_client.clientInfo);
+}
+
+void WebTextCheckerClient::closeSpellDocumentWithTag(uint64_t tag)
+{
+ if (!m_client.closeSpellDocumentWithTag)
+ return;
+
+ m_client.closeSpellDocumentWithTag(tag, m_client.clientInfo);
+}
+
+void WebTextCheckerClient::checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
+{
+ if (!m_client.checkSpellingOfString)
+ return;
+
+ m_client.checkSpellingOfString(tag, toAPI(text.impl()), &misspellingLocation, &misspellingLength, m_client.clientInfo);
+}
+
+void WebTextCheckerClient::checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
+{
+ if (!m_client.checkGrammarOfString)
+ return;
+
+ WKArrayRef wkGrammarDetailsRef = 0;
+ m_client.checkGrammarOfString(tag, toAPI(text.impl()), &wkGrammarDetailsRef, &badGrammarLocation, &badGrammarLength, m_client.clientInfo);
+
+ RefPtr<ImmutableArray> wkGrammarDetails = adoptRef(toImpl(wkGrammarDetailsRef));
+ size_t numGrammarDetails = wkGrammarDetails->size();
+ for (size_t i = 0; i < numGrammarDetails; ++i)
+ grammarDetails.append(wkGrammarDetails->at<WebGrammarDetail>(i)->grammarDetail());
+}
+
+bool WebTextCheckerClient::spellingUIIsShowing()
+{
+ if (!m_client.spellingUIIsShowing)
+ return false;
+
+ return m_client.spellingUIIsShowing(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::toggleSpellingUIIsShowing()
+{
+ if (!m_client.toggleSpellingUIIsShowing)
+ return;
+
+ return m_client.toggleSpellingUIIsShowing(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord)
+{
+ if (!m_client.updateSpellingUIWithMisspelledWord)
+ return;
+
+ m_client.updateSpellingUIWithMisspelledWord(tag, toAPI(misspelledWord.impl()), m_client.clientInfo);
+}
+
+void WebTextCheckerClient::updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail& grammarDetail)
+{
+ if (!m_client.updateSpellingUIWithGrammarString)
+ return;
+
+ m_client.updateSpellingUIWithGrammarString(tag, toAPI(badGrammarPhrase.impl()), toAPI(grammarDetail), m_client.clientInfo);
+}
+
+void WebTextCheckerClient::guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses)
+{
+ if (!m_client.guessesForWord)
+ return;
+
+ RefPtr<ImmutableArray> wkGuesses = adoptRef(toImpl(m_client.guessesForWord(tag, toAPI(word.impl()), m_client.clientInfo)));
+ size_t numGuesses = wkGuesses->size();
+ for (size_t i = 0; i < numGuesses; ++i)
+ guesses.append(wkGuesses->at<WebString>(i)->string());
+}
+
+void WebTextCheckerClient::learnWord(uint64_t tag, const String& word)
+{
+ if (!m_client.learnWord)
+ return;
+
+ m_client.learnWord(tag, toAPI(word.impl()), m_client.clientInfo);
+}
+
+void WebTextCheckerClient::ignoreWord(uint64_t tag, const String& word)
+{
+ if (!m_client.ignoreWord)
+ return;
+
+ m_client.ignoreWord(tag, toAPI(word.impl()), m_client.clientInfo);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h
new file mode 100644
index 0000000..50fb42d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebTextCheckerClient_h
+#define WebTextCheckerClient_h
+
+#include "APIClient.h"
+#include "WKTextChecker.h"
+#include <WebCore/TextCheckerClient.h>
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebTextCheckerClient : public APIClient<WKTextCheckerClient> {
+public:
+ bool continuousSpellCheckingAllowed();
+ bool continuousSpellCheckingEnabled();
+ void setContinuousSpellCheckingEnabled(bool);
+ bool grammarCheckingEnabled();
+ void setGrammarCheckingEnabled(bool);
+ uint64_t uniqueSpellDocumentTag(WebPageProxy*);
+ void closeSpellDocumentWithTag(uint64_t);
+ void checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
+ void checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
+ bool spellingUIIsShowing();
+ void toggleSpellingUIIsShowing();
+ void updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord);
+ void updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail&);
+ void guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses);
+ void learnWord(uint64_t tag, const String& word);
+ void ignoreWord(uint64_t tag, const String& word);
+};
+
+} // namespace WebKit
+
+#endif // WebTextCheckerClient_h
diff --git a/Source/WebKit2/UIProcess/win/WebUndoClient.cpp b/Source/WebKit2/UIProcess/win/WebUndoClient.cpp
index 9bc96f5..9b86540 100644
--- a/Source/WebKit2/UIProcess/win/WebUndoClient.cpp
+++ b/Source/WebKit2/UIProcess/win/WebUndoClient.cpp
@@ -49,5 +49,21 @@ void WebUndoClient::clearAllEditCommands(WebView* view)
m_client.clearAllEditCommands(toAPI(view), m_client.clientInfo);
}
+bool WebUndoClient::canUndoRedo(WebView* view, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ if (!m_client.canUndoRedo)
+ return false;
+
+ return m_client.canUndoRedo(toAPI(view), undoOrRedo, m_client.clientInfo);
+}
+
+void WebUndoClient::executeUndoRedo(WebView* view, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ if (!m_client.executeUndoRedo)
+ return;
+
+ m_client.executeUndoRedo(toAPI(view), undoOrRedo, m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebUndoClient.h b/Source/WebKit2/UIProcess/win/WebUndoClient.h
index 12582c0..b7fdc15 100755
--- a/Source/WebKit2/UIProcess/win/WebUndoClient.h
+++ b/Source/WebKit2/UIProcess/win/WebUndoClient.h
@@ -39,6 +39,8 @@ class WebUndoClient : public APIClient<WKViewUndoClient> {
public:
void registerEditCommand(WebView*, PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
void clearAllEditCommands(WebView*);
+ bool canUndoRedo(WebView*, WebPageProxy::UndoOrRedo);
+ void executeUndoRedo(WebView*, WebPageProxy::UndoOrRedo);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index 1447864..8cecb02 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -31,6 +31,7 @@
#include "FindIndicator.h"
#include "Logging.h"
#include "NativeWebKeyboardEvent.h"
+#include "NativeWebMouseEvent.h"
#include "Region.h"
#include "RunLoop.h"
#include "WKAPICast.h"
@@ -44,13 +45,14 @@
#include <WebCore/BitmapInfo.h>
#include <WebCore/Cursor.h>
#include <WebCore/FloatRect.h>
-#if PLATFORM(CG)
+#if USE(CG)
#include <WebCore/GraphicsContextCG.h>
#endif
#include <WebCore/IntRect.h>
#include <WebCore/SoftLinking.h>
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebCore/WindowMessageBroadcaster.h>
+#include <WebCore/WindowsTouch.h>
#include <wtf/text/WTFString.h>
namespace Ime {
@@ -67,6 +69,17 @@ SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD d
SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
};
+// Soft link functions for gestures and panning.
+SOFT_LINK_LIBRARY(USER32);
+SOFT_LINK_OPTIONAL(USER32, GetGestureInfo, BOOL, WINAPI, (HGESTUREINFO, PGESTUREINFO));
+SOFT_LINK_OPTIONAL(USER32, SetGestureConfig, BOOL, WINAPI, (HWND, DWORD, UINT, PGESTURECONFIG, UINT));
+SOFT_LINK_OPTIONAL(USER32, CloseGestureInfoHandle, BOOL, WINAPI, (HGESTUREINFO));
+
+SOFT_LINK_LIBRARY(Uxtheme);
+SOFT_LINK_OPTIONAL(Uxtheme, BeginPanningFeedback, BOOL, WINAPI, (HWND));
+SOFT_LINK_OPTIONAL(Uxtheme, EndPanningFeedback, BOOL, WINAPI, (HWND, BOOL));
+SOFT_LINK_OPTIONAL(Uxtheme, UpdatePanningFeedback, BOOL, WINAPI, (HWND, LONG, LONG, BOOL));
+
using namespace WebCore;
namespace WebKit {
@@ -157,6 +170,12 @@ LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_VSCROLL:
lResult = onVerticalScroll(hWnd, message, wParam, lParam, handled);
break;
+ case WM_GESTURENOTIFY:
+ lResult = onGestureNotify(hWnd, message, wParam, lParam, handled);
+ break;
+ case WM_GESTURE:
+ lResult = onGesture(hWnd, message, wParam, lParam, handled);
+ break;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
case WM_SYSCHAR:
@@ -254,6 +273,10 @@ WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND p
, m_inIMEComposition(0)
, m_findIndicatorCallback(0)
, m_findIndicatorCallbackContext(0)
+ , m_lastPanX(0)
+ , m_lastPanY(0)
+ , m_overPanY(0)
+ , m_gestureReachedScrollingLimit(false)
{
registerWebViewWindowClass();
@@ -365,7 +388,7 @@ void WebView::windowAncestryDidChange()
LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
- WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(hWnd, message, wParam, lParam, m_wasActivatedByMouseEvent);
+ NativeWebMouseEvent mouseEvent = NativeWebMouseEvent(hWnd, message, wParam, lParam, m_wasActivatedByMouseEvent);
setWasActivatedByMouseEvent(false);
switch (message) {
@@ -480,6 +503,109 @@ LRESULT WebView::onVerticalScroll(HWND hWnd, UINT message, WPARAM wParam, LPARAM
return 0;
}
+LRESULT WebView::onGestureNotify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
+{
+ // We shouldn't be getting any gesture messages without SetGestureConfig soft-linking correctly.
+ ASSERT(SetGestureConfigPtr());
+
+ GESTURENOTIFYSTRUCT* gn = reinterpret_cast<GESTURENOTIFYSTRUCT*>(lParam);
+
+ POINT localPoint = { gn->ptsLocation.x, gn->ptsLocation.y };
+ ::ScreenToClient(m_window, &localPoint);
+
+ bool canPan = m_page->gestureWillBegin(localPoint);
+
+ DWORD dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER;
+ DWORD dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+ if (canPan)
+ dwPanWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+ else
+ dwPanBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+
+ GESTURECONFIG gc = { GID_PAN, dwPanWant, dwPanBlock };
+ return SetGestureConfigPtr()(m_window, 0, 1, &gc, sizeof(gc));
+}
+
+LRESULT WebView::onGesture(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
+{
+ ASSERT(GetGestureInfoPtr());
+ ASSERT(CloseGestureInfoHandlePtr());
+ ASSERT(UpdatePanningFeedbackPtr());
+ ASSERT(BeginPanningFeedbackPtr());
+ ASSERT(EndPanningFeedbackPtr());
+
+ if (!GetGestureInfoPtr() || !CloseGestureInfoHandlePtr() || !UpdatePanningFeedbackPtr() || !BeginPanningFeedbackPtr() || !EndPanningFeedbackPtr()) {
+ handled = false;
+ return 0;
+ }
+
+ HGESTUREINFO gestureHandle = reinterpret_cast<HGESTUREINFO>(lParam);
+ GESTUREINFO gi = {0};
+ gi.cbSize = sizeof(GESTUREINFO);
+
+ if (!GetGestureInfoPtr()(gestureHandle, &gi)) {
+ handled = false;
+ return 0;
+ }
+
+ switch (gi.dwID) {
+ case GID_BEGIN:
+ m_lastPanX = gi.ptsLocation.x;
+ m_lastPanY = gi.ptsLocation.y;
+ break;
+ case GID_END:
+ m_page->gestureDidEnd();
+ break;
+ case GID_PAN: {
+ int currentX = gi.ptsLocation.x;
+ int currentY = gi.ptsLocation.y;
+
+ // Reverse the calculations because moving your fingers up should move the screen down, and
+ // vice-versa.
+ int deltaX = m_lastPanX - currentX;
+ int deltaY = m_lastPanY - currentY;
+
+ m_lastPanX = currentX;
+ m_lastPanY = currentY;
+
+ // Calculate the overpan for window bounce.
+ m_overPanY -= deltaY;
+
+ if (deltaX || deltaY)
+ m_page->gestureDidScroll(IntSize(deltaX, deltaY));
+
+ if (gi.dwFlags & GF_BEGIN) {
+ BeginPanningFeedbackPtr()(m_window);
+ m_gestureReachedScrollingLimit = false;
+ m_overPanY = 0;
+ } else if (gi.dwFlags & GF_END) {
+ EndPanningFeedbackPtr()(m_window, true);
+ m_overPanY = 0;
+ }
+
+ // FIXME: Support horizontal window bounce - <http://webkit.org/b/58068>.
+ // FIXME: Window Bounce doesn't undo until user releases their finger - <http://webkit.org/b/58069>.
+
+ if (m_gestureReachedScrollingLimit)
+ UpdatePanningFeedbackPtr()(m_window, 0, m_overPanY, gi.dwFlags & GF_INERTIA);
+
+ CloseGestureInfoHandlePtr()(gestureHandle);
+
+ handled = true;
+ return 0;
+ }
+ default:
+ break;
+ }
+
+ // If we get to this point, the gesture has not been handled. We forward
+ // the call to DefWindowProc by returning false, and we don't need to
+ // to call CloseGestureInfoHandle.
+ // http://msdn.microsoft.com/en-us/library/dd353228(VS.85).aspx
+ handled = false;
+ return 0;
+}
+
LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
m_page->handleKeyboardEvent(NativeWebKeyboardEvent(hWnd, message, wParam, lParam));
@@ -565,8 +691,22 @@ LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool
RECT winRect;
::GetClientRect(hWnd, &winRect);
+ // Twidding the visibility flags tells the DrawingArea to resume painting. Right now, the
+ // the visible state of the view only affects whether or not painting happens, but in the
+ // future it could affect more, which we wouldn't want to touch here.
+
+ // FIXME: We should have a better way of telling the WebProcess to draw even if we're
+ // invisible than twiddling the visibility flag.
+
+ bool wasVisible = isViewVisible();
+ if (!wasVisible)
+ setIsVisible(true);
+
paint(hdc, winRect);
+ if (!wasVisible)
+ setIsVisible(false);
+
handled = true;
return 0;
}
@@ -626,11 +766,8 @@ LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARA
// lParam is 0 when the message is sent because of a ShowWindow call.
// FIXME: Since we don't get notified when an ancestor window is hidden or shown, we will keep
// painting even when we have a hidden ancestor. <http://webkit.org/b/54104>
- if (!lParam) {
- m_isVisible = wParam;
- if (m_page)
- m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
- }
+ if (!lParam)
+ setIsVisible(wParam);
handled = false;
return 0;
@@ -760,6 +897,15 @@ void WebView::close()
{
m_undoClient.initialize(0);
::RevokeDragDrop(m_window);
+ if (m_window) {
+ // We can't check IsWindow(m_window) here, because that will return true even while
+ // we're already handling WM_DESTROY. So we check !m_isBeingDestroyed instead.
+ if (!m_isBeingDestroyed)
+ DestroyWindow(m_window);
+ // Either we just destroyed m_window, or it's in the process of being destroyed. Either
+ // way, we clear it out to make sure we don't try to use it later.
+ m_window = 0;
+ }
setParentWindow(0);
m_page->close();
}
@@ -844,10 +990,6 @@ void WebView::didRelaunchProcess()
::InvalidateRect(m_window, 0, TRUE);
}
-void WebView::takeFocus(bool)
-{
-}
-
void WebView::toolTipChanged(const String&, const String& newToolTip)
{
if (!m_toolTipWindow)
@@ -929,6 +1071,16 @@ void WebView::clearAllEditCommands()
m_undoClient.clearAllEditCommands(this);
}
+bool WebView::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ return m_undoClient.canUndoRedo(this, undoOrRedo);
+}
+
+void WebView::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ m_undoClient.executeUndoRedo(this, undoOrRedo);
+}
+
void WebView::reapplyEditCommand(WebEditCommandProxy* command)
{
if (!m_page->isValid() || !m_page->isValidEditCommand(command))
@@ -996,7 +1148,7 @@ void WebView::setInputMethodState(bool enabled)
void WebView::compositionSelectionChanged(bool hasChanged)
{
- if (m_page->selectionState().hasComposition && !hasChanged)
+ if (m_page->editorState().hasComposition && !hasChanged)
resetIME();
}
@@ -1104,7 +1256,7 @@ bool WebView::onIMEComposition(LPARAM lparam)
if (!hInputContext)
return true;
- if (!m_page->selectionState().isContentEditable)
+ if (!m_page->editorState().isContentEditable)
return true;
prepareCandidateWindow(hInputContext);
@@ -1147,7 +1299,7 @@ bool WebView::onIMEEndComposition()
LOG(TextInput, "onIMEEndComposition");
// If the composition hasn't been confirmed yet, it needs to be cancelled.
// This happens after deleting the last character from inline input hole.
- if (m_page->selectionState().hasComposition)
+ if (m_page->editorState().hasComposition)
m_page->confirmComposition(String());
if (m_inIMEComposition)
@@ -1158,7 +1310,7 @@ bool WebView::onIMEEndComposition()
LRESULT WebView::onIMERequestCharPosition(IMECHARPOSITION* charPos)
{
- if (charPos->dwCharPos && !m_page->selectionState().hasComposition)
+ if (charPos->dwCharPos && !m_page->editorState().hasComposition)
return 0;
IntRect caret = m_page->firstRectForCharacterInSelectedRange(charPos->dwCharPos);
charPos->pt.x = caret.x();
@@ -1190,7 +1342,7 @@ LRESULT WebView::onIMERequestReconvertString(RECONVERTSTRING* reconvertString)
LRESULT WebView::onIMERequest(WPARAM request, LPARAM data)
{
LOG(TextInput, "onIMERequest %s", imeRequestName(request).latin1().data());
- if (!m_page->selectionState().isContentEditable)
+ if (!m_page->editorState().isContentEditable)
return 0;
switch (request) {
@@ -1254,7 +1406,7 @@ void WebView::setFindIndicator(PassRefPtr<FindIndicator> prpFindIndicator, bool
hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
-#if PLATFORM(CG)
+#if USE(CG)
RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(bits, width, height,
8, width * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
@@ -1310,12 +1462,28 @@ void WebView::didChangeScrollbarsForMainFrame() const
{
}
+void WebView::findStringInCustomRepresentation(const String&, FindOptions, unsigned)
+{
+}
+
+void WebView::countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned)
+{
+}
+
void WebView::setIsInWindow(bool isInWindow)
{
m_isInWindow = isInWindow;
m_page->viewStateDidChange(WebPageProxy::ViewIsInWindow);
}
+void WebView::setIsVisible(bool isVisible)
+{
+ m_isVisible = isVisible;
+
+ if (m_page)
+ m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+}
+
#if USE(ACCELERATED_COMPOSITING)
void WebView::enterAcceleratedCompositingMode(const LayerTreeContext&)
@@ -1425,7 +1593,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragEnter(IDataObject* pDataObject, DWORD grf
POINTL localpt = pt;
::ScreenToClient(m_window, (LPPOINT)&localpt);
DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
- m_page->performDragControllerAction(DragControllerActionEntered, &data);
+ m_page->dragEntered(&data);
*pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
m_lastDropEffect = *pdwEffect;
@@ -1443,7 +1611,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragOver(DWORD grfKeyState, POINTL pt, DWORD*
POINTL localpt = pt;
::ScreenToClient(m_window, (LPPOINT)&localpt);
DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
- m_page->performDragControllerAction(DragControllerActionUpdated, &data);
+ m_page->dragUpdated(&data);
*pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
} else
*pdwEffect = DROPEFFECT_NONE;
@@ -1459,7 +1627,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragLeave()
if (m_dragData) {
DragData data(m_dragData.get(), IntPoint(), IntPoint(), DragOperationNone);
- m_page->performDragControllerAction(DragControllerActionExited, &data);
+ m_page->dragExited(&data);
m_dragData = 0;
m_page->resetDragOperation();
}
@@ -1476,7 +1644,9 @@ HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeySt
POINTL localpt = pt;
::ScreenToClient(m_window, (LPPOINT)&localpt);
DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
- m_page->performDragControllerAction(DragControllerActionPerformDrag, &data);
+
+ SandboxExtension::Handle sandboxExtensionHandle;
+ m_page->performDrag(&data, String(), sandboxExtensionHandle);
return S_OK;
}
diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h
index 1d65179..d62311c 100644
--- a/Source/WebKit2/UIProcess/win/WebView.h
+++ b/Source/WebKit2/UIProcess/win/WebView.h
@@ -60,6 +60,7 @@ public:
void setParentWindow(HWND);
void windowAncestryDidChange();
void setIsInWindow(bool);
+ void setIsVisible(bool);
void setOverrideCursor(HCURSOR);
void setInitialFocus(bool forward);
void setScrollOffsetOnNextResize(const WebCore::IntSize&);
@@ -97,6 +98,8 @@ private:
LRESULT onWheelEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onHorizontalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onVerticalScroll(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+ LRESULT onGestureNotify(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
+ LRESULT onGesture(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onKeyEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
LRESULT onPrintClientEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
@@ -154,13 +157,13 @@ private:
virtual void processDidCrash();
virtual void didRelaunchProcess();
virtual void pageClosed();
- virtual void takeFocus(bool direction);
- virtual void setFocus(bool focused) { }
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void setCursor(const WebCore::Cursor&);
virtual void setViewportArguments(const WebCore::ViewportArguments&);
virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
virtual void clearAllEditCommands();
+ virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
+ virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
@@ -182,8 +185,13 @@ private:
WebCore::DragOperation keyStateToDragOperation(DWORD grfKeyState) const;
virtual void didChangeScrollbarsForMainFrame() const;
+ virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount);
+ virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount);
+
virtual HWND nativeWindow();
+ virtual void setGestureReachedScrollingLimit(bool limitReached) { m_gestureReachedScrollingLimit = limitReached; }
+
// WebCore::WindowMessageListener
virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
@@ -219,6 +227,13 @@ private:
// Thus, on return from DoDragDrop we have the correct pdwEffect for the drag-and-drop operation.
// (see https://bugs.webkit.org/show_bug.cgi?id=29264)
DWORD m_lastDropEffect;
+
+ int m_lastPanX;
+ int m_lastPanY;
+
+ int m_overPanY;
+
+ bool m_gestureReachedScrollingLimit;
};
} // namespace WebKit