summaryrefslogtreecommitdiffstats
path: root/WebKit/win
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/win')
-rw-r--r--WebKit/win/CFDictionaryPropertyBag.cpp186
-rw-r--r--WebKit/win/CFDictionaryPropertyBag.h63
-rw-r--r--WebKit/win/COMEnumVariant.h221
-rw-r--r--WebKit/win/CodeAnalysisConfig.h36
-rw-r--r--WebKit/win/DOMCSSClasses.cpp171
-rw-r--r--WebKit/win/DOMCSSClasses.h124
-rw-r--r--WebKit/win/DOMCoreClasses.cpp1283
-rw-r--r--WebKit/win/DOMCoreClasses.h840
-rw-r--r--WebKit/win/DOMCreateInstance.cpp359
-rw-r--r--WebKit/win/DOMCreateInstance.h38
-rw-r--r--WebKit/win/DOMEventsClasses.cpp735
-rw-r--r--WebKit/win/DOMEventsClasses.h960
-rw-r--r--WebKit/win/DOMHTMLClasses.cpp1473
-rw-r--r--WebKit/win/DOMHTMLClasses.h2344
-rw-r--r--WebKit/win/DefaultDownloadDelegate.cpp243
-rw-r--r--WebKit/win/DefaultDownloadDelegate.h71
-rw-r--r--WebKit/win/DefaultPolicyDelegate.cpp197
-rw-r--r--WebKit/win/DefaultPolicyDelegate.h76
-rw-r--r--WebKit/win/English.lproj/Localizable.stringsbin0 -> 28236 bytes
-rw-r--r--WebKit/win/ForEachCoClass.cpp46
-rw-r--r--WebKit/win/ForEachCoClass.h90
-rw-r--r--WebKit/win/GEN_DOMObject.cpp76
-rw-r--r--WebKit/win/GEN_DOMObject.h48
-rw-r--r--WebKit/win/HTTPHeaderPropertyBag.cpp120
-rw-r--r--WebKit/win/HTTPHeaderPropertyBag.h62
-rw-r--r--WebKit/win/Interfaces/DOMCSS.idl252
-rw-r--r--WebKit/win/Interfaces/DOMCore.idl828
-rw-r--r--WebKit/win/Interfaces/DOMEvents.idl478
-rw-r--r--WebKit/win/Interfaces/DOMExtensions.idl48
-rw-r--r--WebKit/win/Interfaces/DOMHTML.idl930
-rw-r--r--WebKit/win/Interfaces/DOMPrivate.idl134
-rw-r--r--WebKit/win/Interfaces/DOMRange.idl188
-rwxr-xr-xWebKit/win/Interfaces/DOMWindow.idl91
-rw-r--r--WebKit/win/Interfaces/IGEN_DOMObject.idl42
-rw-r--r--WebKit/win/Interfaces/IWebArchive.idl98
-rw-r--r--WebKit/win/Interfaces/IWebBackForwardList.idl175
-rwxr-xr-xWebKit/win/Interfaces/IWebBackForwardListPrivate.idl43
-rw-r--r--WebKit/win/Interfaces/IWebCache.idl44
-rw-r--r--WebKit/win/Interfaces/IWebDataSource.idl217
-rw-r--r--WebKit/win/Interfaces/IWebDatabaseManager.idl62
-rw-r--r--WebKit/win/Interfaces/IWebDocument.idl245
-rw-r--r--WebKit/win/Interfaces/IWebDownload.idl158
-rw-r--r--WebKit/win/Interfaces/IWebEditingDelegate.idl190
-rw-r--r--WebKit/win/Interfaces/IWebError.idl168
-rw-r--r--WebKit/win/Interfaces/IWebErrorPrivate.idl47
-rw-r--r--WebKit/win/Interfaces/IWebFormDelegate.idl97
-rw-r--r--WebKit/win/Interfaces/IWebFrame.idl243
-rw-r--r--WebKit/win/Interfaces/IWebFrameLoadDelegate.idl223
-rw-r--r--WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl53
-rwxr-xr-xWebKit/win/Interfaces/IWebFramePrivate.idl76
-rw-r--r--WebKit/win/Interfaces/IWebFrameView.idl78
-rw-r--r--WebKit/win/Interfaces/IWebHTMLRepresentation.idl105
-rw-r--r--WebKit/win/Interfaces/IWebHTTPURLResponse.idl44
-rw-r--r--WebKit/win/Interfaces/IWebHistory.idl185
-rw-r--r--WebKit/win/Interfaces/IWebHistoryItem.idl125
-rw-r--r--WebKit/win/Interfaces/IWebHistoryItemPrivate.idl58
-rw-r--r--WebKit/win/Interfaces/IWebIconDatabase.idl151
-rw-r--r--WebKit/win/Interfaces/IWebInspector.idl48
-rw-r--r--WebKit/win/Interfaces/IWebJavaScriptCollector.idl43
-rw-r--r--WebKit/win/Interfaces/IWebKitStatistics.idl46
-rw-r--r--WebKit/win/Interfaces/IWebMutableURLRequest.idl99
-rw-r--r--WebKit/win/Interfaces/IWebMutableURLRequestPrivate.idl44
-rw-r--r--WebKit/win/Interfaces/IWebNotification.idl59
-rw-r--r--WebKit/win/Interfaces/IWebNotificationCenter.idl64
-rw-r--r--WebKit/win/Interfaces/IWebNotificationObserver.idl46
-rw-r--r--WebKit/win/Interfaces/IWebPolicyDelegate.idl226
-rw-r--r--WebKit/win/Interfaces/IWebPreferences.idl183
-rw-r--r--WebKit/win/Interfaces/IWebPreferencesPrivate.idl51
-rw-r--r--WebKit/win/Interfaces/IWebResource.idl93
-rw-r--r--WebKit/win/Interfaces/IWebResourceLoadDelegate.idl182
-rw-r--r--WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl61
-rw-r--r--WebKit/win/Interfaces/IWebScriptCallFrame.idl54
-rw-r--r--WebKit/win/Interfaces/IWebScriptDebugListener.idl57
-rw-r--r--WebKit/win/Interfaces/IWebScriptDebugServer.idl52
-rw-r--r--WebKit/win/Interfaces/IWebScriptObject.idl137
-rw-r--r--WebKit/win/Interfaces/IWebScrollBarDelegatePrivate.idl43
-rw-r--r--WebKit/win/Interfaces/IWebScrollBarPrivate.idl98
-rw-r--r--WebKit/win/Interfaces/IWebSecurityOrigin.idl50
-rw-r--r--WebKit/win/Interfaces/IWebTextRenderer.idl43
-rw-r--r--WebKit/win/Interfaces/IWebUIDelegate.idl781
-rwxr-xr-xWebKit/win/Interfaces/IWebUIDelegatePrivate.idl76
-rw-r--r--WebKit/win/Interfaces/IWebURLAuthenticationChallenge.idl224
-rw-r--r--WebKit/win/Interfaces/IWebURLRequest.idl111
-rw-r--r--WebKit/win/Interfaces/IWebURLResponse.idl71
-rw-r--r--WebKit/win/Interfaces/IWebURLResponsePrivate.idl44
-rw-r--r--WebKit/win/Interfaces/IWebUndoManager.idl314
-rwxr-xr-xWebKit/win/Interfaces/IWebUndoTarget.idl40
-rw-r--r--WebKit/win/Interfaces/IWebView.idl1145
-rw-r--r--WebKit/win/Interfaces/IWebViewPrivate.idl127
-rw-r--r--WebKit/win/Interfaces/WebKit.idl438
-rw-r--r--WebKit/win/MarshallingHelpers.cpp293
-rw-r--r--WebKit/win/MarshallingHelpers.h72
-rw-r--r--WebKit/win/MemoryStream.cpp258
-rw-r--r--WebKit/win/MemoryStream.h105
-rw-r--r--WebKit/win/ProgIDMacros.h37
-rw-r--r--WebKit/win/WebActionPropertyBag.cpp159
-rw-r--r--WebKit/win/WebActionPropertyBag.h68
-rw-r--r--WebKit/win/WebBackForwardList.cpp303
-rw-r--r--WebKit/win/WebBackForwardList.h115
-rw-r--r--WebKit/win/WebCache.cpp162
-rw-r--r--WebKit/win/WebCache.h62
-rw-r--r--WebKit/win/WebCachedPagePlatformData.h45
-rw-r--r--WebKit/win/WebCoreLocalizedStrings.cpp97
-rw-r--r--WebKit/win/WebCoreSupport/FormValuesPropertyBag.cpp169
-rw-r--r--WebKit/win/WebCoreSupport/FormValuesPropertyBag.h91
-rw-r--r--WebKit/win/WebCoreSupport/WebChromeClient.cpp514
-rw-r--r--WebKit/win/WebCoreSupport/WebChromeClient.h111
-rw-r--r--WebKit/win/WebCoreSupport/WebContextMenuClient.cpp179
-rw-r--r--WebKit/win/WebCoreSupport/WebContextMenuClient.h51
-rw-r--r--WebKit/win/WebCoreSupport/WebDragClient.cpp269
-rw-r--r--WebKit/win/WebCoreSupport/WebDragClient.h46
-rw-r--r--WebKit/win/WebCoreSupport/WebEditorClient.cpp762
-rw-r--r--WebKit/win/WebCoreSupport/WebEditorClient.h117
-rw-r--r--WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp715
-rw-r--r--WebKit/win/WebCoreSupport/WebFrameLoaderClient.h121
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorClient.cpp413
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorClient.h92
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorDelegate.cpp66
-rw-r--r--WebKit/win/WebCoreSupport/WebInspectorDelegate.h257
-rw-r--r--WebKit/win/WebDataSource.cpp305
-rw-r--r--WebKit/win/WebDataSource.h121
-rw-r--r--WebKit/win/WebDatabaseManager.cpp364
-rw-r--r--WebKit/win/WebDatabaseManager.h87
-rw-r--r--WebKit/win/WebDocumentLoader.cpp90
-rw-r--r--WebKit/win/WebDocumentLoader.h48
-rw-r--r--WebKit/win/WebDownload.cpp796
-rw-r--r--WebKit/win/WebDownload.h137
-rw-r--r--WebKit/win/WebDropSource.cpp119
-rw-r--r--WebKit/win/WebDropSource.h53
-rw-r--r--WebKit/win/WebElementPropertyBag.cpp193
-rw-r--r--WebKit/win/WebElementPropertyBag.h67
-rw-r--r--WebKit/win/WebError.cpp226
-rw-r--r--WebKit/win/WebError.h99
-rw-r--r--WebKit/win/WebFrame.cpp1969
-rw-r--r--WebKit/win/WebFrame.h331
-rw-r--r--WebKit/win/WebFramePolicyListener.cpp133
-rw-r--r--WebKit/win/WebFramePolicyListener.h71
-rw-r--r--WebKit/win/WebHTMLRepresentation.cpp313
-rw-r--r--WebKit/win/WebHTMLRepresentation.h133
-rw-r--r--WebKit/win/WebHistory.cpp956
-rw-r--r--WebKit/win/WebHistory.h162
-rw-r--r--WebKit/win/WebHistoryItem.cpp452
-rw-r--r--WebKit/win/WebHistoryItem.h110
-rw-r--r--WebKit/win/WebIconDatabase.cpp362
-rw-r--r--WebKit/win/WebIconDatabase.h123
-rw-r--r--WebKit/win/WebInspector.cpp148
-rw-r--r--WebKit/win/WebInspector.h62
-rw-r--r--WebKit/win/WebJavaScriptCollector.cpp113
-rw-r--r--WebKit/win/WebJavaScriptCollector.h58
-rw-r--r--WebKit/win/WebKit.resources/Info.plist24
-rw-r--r--WebKit/win/WebKit.vcproj/DerivedSources.make149
-rw-r--r--WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl76
-rw-r--r--WebKit/win/WebKit.vcproj/Interfaces.vcproj179
-rw-r--r--WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj48
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit.def109
-rwxr-xr-xWebKit/win/WebKit.vcproj/WebKit.make18
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit.rc72
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit.sln193
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit.submit.sln57
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit.vcproj1705
-rw-r--r--WebKit/win/WebKit.vcproj/WebKitGUID.vcproj207
-rw-r--r--WebKit/win/WebKit.vcproj/WebKit_debug.def111
-rw-r--r--WebKit/win/WebKit.vcproj/build-generated-files.sh62
-rw-r--r--WebKit/win/WebKit.vcproj/deleteButton.pngbin0 -> 2231 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/deleteButtonPressed.pngbin0 -> 2323 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/missingImage.pngbin0 -> 456 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/nullplugin.pngbin0 -> 1286 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/resource.h25
-rw-r--r--WebKit/win/WebKit.vcproj/textAreaResizeCorner.pngbin0 -> 195 bytes
-rwxr-xr-xWebKit/win/WebKit.vcproj/urlIcon.pngbin0 -> 819 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/verticalTextCursor.pngbin0 -> 120 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/zoomInCursor.pngbin0 -> 199 bytes
-rw-r--r--WebKit/win/WebKit.vcproj/zoomOutCursor.pngbin0 -> 182 bytes
-rw-r--r--WebKit/win/WebKitClassFactory.cpp172
-rw-r--r--WebKit/win/WebKitClassFactory.h49
-rw-r--r--WebKit/win/WebKitDLL.cpp321
-rw-r--r--WebKit/win/WebKitDLL.h54
-rw-r--r--WebKit/win/WebKitGraphics.cpp138
-rw-r--r--WebKit/win/WebKitGraphics.h69
-rw-r--r--WebKit/win/WebKitLogging.cpp105
-rw-r--r--WebKit/win/WebKitLogging.h66
-rw-r--r--WebKit/win/WebKitPrefix.cpp30
-rw-r--r--WebKit/win/WebKitPrefix.h50
-rw-r--r--WebKit/win/WebKitStatistics.cpp133
-rw-r--r--WebKit/win/WebKitStatistics.h70
-rw-r--r--WebKit/win/WebKitStatisticsPrivate.h33
-rw-r--r--WebKit/win/WebKitSystemBits.cpp56
-rw-r--r--WebKit/win/WebKitSystemBits.h37
-rw-r--r--WebKit/win/WebLocalizableStrings.cpp226
-rw-r--r--WebKit/win/WebLocalizableStrings.h73
-rw-r--r--WebKit/win/WebMutableURLRequest.cpp382
-rw-r--r--WebKit/win/WebMutableURLRequest.h170
-rw-r--r--WebKit/win/WebNodeHighlight.cpp205
-rw-r--r--WebKit/win/WebNodeHighlight.h62
-rw-r--r--WebKit/win/WebNotification.cpp144
-rw-r--r--WebKit/win/WebNotification.h67
-rw-r--r--WebKit/win/WebNotificationCenter.cpp217
-rw-r--r--WebKit/win/WebNotificationCenter.h80
-rw-r--r--WebKit/win/WebPreferenceKeysPrivate.h108
-rw-r--r--WebKit/win/WebPreferences.cpp1132
-rw-r--r--WebKit/win/WebPreferences.h345
-rw-r--r--WebKit/win/WebResource.cpp167
-rw-r--r--WebKit/win/WebResource.h85
-rw-r--r--WebKit/win/WebScriptCallFrame.cpp270
-rw-r--r--WebKit/win/WebScriptCallFrame.h94
-rw-r--r--WebKit/win/WebScriptDebugServer.cpp361
-rw-r--r--WebKit/win/WebScriptDebugServer.h139
-rw-r--r--WebKit/win/WebScriptDebugger.cpp179
-rw-r--r--WebKit/win/WebScriptDebugger.h71
-rw-r--r--WebKit/win/WebScriptObject.cpp138
-rw-r--r--WebKit/win/WebScriptObject.h78
-rw-r--r--WebKit/win/WebScrollBar.cpp266
-rw-r--r--WebKit/win/WebScrollBar.h129
-rw-r--r--WebKit/win/WebSecurityOrigin.cpp151
-rw-r--r--WebKit/win/WebSecurityOrigin.h77
-rw-r--r--WebKit/win/WebTextRenderer.cpp89
-rw-r--r--WebKit/win/WebTextRenderer.h56
-rw-r--r--WebKit/win/WebURLAuthenticationChallenge.cpp226
-rw-r--r--WebKit/win/WebURLAuthenticationChallenge.h91
-rw-r--r--WebKit/win/WebURLAuthenticationChallengeSender.cpp142
-rw-r--r--WebKit/win/WebURLAuthenticationChallengeSender.h71
-rw-r--r--WebKit/win/WebURLCredential.cpp169
-rw-r--r--WebKit/win/WebURLCredential.h77
-rw-r--r--WebKit/win/WebURLProtectionSpace.cpp275
-rw-r--r--WebKit/win/WebURLProtectionSpace.h98
-rw-r--r--WebKit/win/WebURLResponse.cpp476
-rw-r--r--WebKit/win/WebURLResponse.h102
-rw-r--r--WebKit/win/WebView.cpp4704
-rw-r--r--WebKit/win/WebView.h787
229 files changed, 52035 insertions, 0 deletions
diff --git a/WebKit/win/CFDictionaryPropertyBag.cpp b/WebKit/win/CFDictionaryPropertyBag.cpp
new file mode 100644
index 0000000..22de1b8
--- /dev/null
+++ b/WebKit/win/CFDictionaryPropertyBag.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "CFDictionaryPropertyBag.h"
+
+#include "MarshallingHelpers.h"
+#include "WebKit.h"
+
+// CFDictionaryPropertyBag -----------------------------------------------
+
+CFDictionaryPropertyBag::CFDictionaryPropertyBag()
+: m_refCount(1)
+{
+}
+
+CFDictionaryPropertyBag* CFDictionaryPropertyBag::createInstance()
+{
+ CFDictionaryPropertyBag* instance = new CFDictionaryPropertyBag();
+ return instance;
+}
+
+void CFDictionaryPropertyBag::setDictionary(CFMutableDictionaryRef dictionary)
+{
+ m_dictionary = dictionary;
+}
+
+CFMutableDictionaryRef CFDictionaryPropertyBag::dictionary() const
+{
+ return m_dictionary.get();
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE CFDictionaryPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, __uuidof(this)))
+ *ppvObject = this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE CFDictionaryPropertyBag::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE CFDictionaryPropertyBag::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IPropertyBag ------------------------------------------------------------
+
+static bool ConvertCFTypeToVariant(VARIANT* pVar, void* cfObj)
+{
+ if (!cfObj) {
+ V_VT(pVar) = VT_NULL;
+ return true;
+ }
+ else {
+ // if caller expects a string, retrieve BSTR from CFStringRef
+ if (V_VT(pVar) == VT_BSTR) {
+ V_BSTR(pVar) = MarshallingHelpers::CFStringRefToBSTR((CFStringRef) cfObj);
+ return true;
+ } else if (V_VT(pVar) == VT_I4) {
+ V_I4(pVar) = MarshallingHelpers::CFNumberRefToInt((CFNumberRef) cfObj);
+ return true;
+ } else if (!!(V_VT(pVar)&VT_ARRAY)) {
+ if ((V_VT(pVar)&~VT_ARRAY) == VT_BSTR) {
+ V_ARRAY(pVar) = MarshallingHelpers::stringArrayToSafeArray((CFArrayRef) cfObj);
+ return true;
+ } else if ((V_VT(pVar)&~VT_ARRAY) == VT_I4) {
+ V_ARRAY(pVar) = MarshallingHelpers::intArrayToSafeArray((CFArrayRef) cfObj);
+ return true;
+ } else if ((V_VT(pVar)&~VT_ARRAY) == VT_UNKNOWN) {
+ V_ARRAY(pVar) = MarshallingHelpers::iunknownArrayToSafeArray((CFArrayRef) cfObj);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+static bool ConvertVariantToCFType(VARIANT* pVar, void** cfObj)
+{
+ if (V_VT(pVar) == VT_NULL) {
+ *cfObj = 0;
+ return true;
+ }
+ else {
+ // if caller expects a string, retrieve BSTR from CFStringRef
+ if (V_VT(pVar) == VT_BSTR) {
+ *cfObj = (void*) MarshallingHelpers::BSTRToCFStringRef(V_BSTR(pVar));
+ return true;
+ } else if (V_VT(pVar) == VT_I4) {
+ *cfObj = (void*) MarshallingHelpers::intToCFNumberRef(V_I4(pVar));
+ return true;
+ } else if (!!(V_VT(pVar)&VT_ARRAY)) {
+ if ((V_VT(pVar)&~VT_ARRAY) == VT_BSTR) {
+ *cfObj = (void*) MarshallingHelpers::safeArrayToStringArray(V_ARRAY(pVar));
+ return true;
+ } else if ((V_VT(pVar)&~VT_ARRAY) == VT_I4) {
+ *cfObj = (void*) MarshallingHelpers::safeArrayToIntArray(V_ARRAY(pVar));
+ return true;
+ } else if ((V_VT(pVar)&~VT_ARRAY) == VT_UNKNOWN) {
+ *cfObj = (void*) MarshallingHelpers::safeArrayToIUnknownArray(V_ARRAY(pVar));
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+HRESULT STDMETHODCALLTYPE CFDictionaryPropertyBag::Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog * /*pErrorLog*/)
+{
+ if (!pszPropName)
+ return E_POINTER;
+ if (m_dictionary) {
+ void* value;
+ CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(pszPropName);
+ HRESULT hr = E_FAIL;
+ if (CFDictionaryGetValueIfPresent(m_dictionary.get(), key, (const void**) &value)) {
+ if (ConvertCFTypeToVariant(pVar, value))
+ hr = S_OK;
+ } else
+ hr = E_INVALIDARG;
+ CFRelease(key);
+ return hr;
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CFDictionaryPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+ if (!m_dictionary) {
+ m_dictionary = CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ }
+ void* cfObj;
+ if (ConvertVariantToCFType(pVar, &cfObj)) {
+ CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(pszPropName);
+ CFDictionaryAddValue(m_dictionary.get(), key, cfObj);
+ // CFDictionaryAddValue should automatically retain the CF objects passed in, so release them here
+ CFRelease(key);
+ CFRelease(cfObj);
+ return S_OK;
+ }
+ return E_FAIL;
+} \ No newline at end of file
diff --git a/WebKit/win/CFDictionaryPropertyBag.h b/WebKit/win/CFDictionaryPropertyBag.h
new file mode 100644
index 0000000..4e74689
--- /dev/null
+++ b/WebKit/win/CFDictionaryPropertyBag.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CFDictionaryPropertyBag_H
+#define CFDictionaryPropertyBag_H
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <wtf/RetainPtr.h>
+
+class CFDictionaryPropertyBag : public IPropertyBag
+{
+public:
+ static CFDictionaryPropertyBag* createInstance();
+protected:
+ CFDictionaryPropertyBag();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IPropertyBag
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [out][in] */ VARIANT *pVar,
+ /* [in] */ IErrorLog *pErrorLog);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [in] */ VARIANT *pVar);
+
+ void setDictionary(CFMutableDictionaryRef dictionary);
+ CFMutableDictionaryRef dictionary() const;
+
+private:
+ RetainPtr<CFMutableDictionaryRef> m_dictionary;
+ ULONG m_refCount;
+};
+
+#endif \ No newline at end of file
diff --git a/WebKit/win/COMEnumVariant.h b/WebKit/win/COMEnumVariant.h
new file mode 100644
index 0000000..be0ac8c
--- /dev/null
+++ b/WebKit/win/COMEnumVariant.h
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 COMEnumVariant_h
+#define COMEnumVariant_h
+
+#define NOMINMAX
+#include <unknwn.h>
+
+#include <WebCore/BString.h>
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+ class String;
+}
+
+template<typename T> struct COMVariantSetter {};
+
+template<> struct COMVariantSetter<WebCore::String>
+{
+ static void setVariant(VARIANT* variant, const WebCore::String& value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VT_BSTR;
+ V_BSTR(variant) = WebCore::BString(value).release();
+ }
+};
+
+template<> struct COMVariantSetter<unsigned long long>
+{
+ static void setVariant(VARIANT* variant, unsigned long long value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VT_UI8;
+ V_UI8(variant) = value;
+ }
+};
+
+template<typename COMType, typename UnderlyingType>
+struct COMIUnknownVariantSetter
+{
+ static void setVariant(VARIANT* variant, const UnderlyingType& value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VT_UNKNOWN;
+ V_UNKNOWN(variant) = COMType::createInstance(value);
+ }
+};
+
+template<typename ContainerType>
+class COMEnumVariant : public IEnumVARIANT, Noncopyable {
+public:
+ static COMEnumVariant* adopt(ContainerType&);
+ static COMEnumVariant* createInstance(const ContainerType&);
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IEnumVARIANT
+ virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, VARIANT* rgVar, ULONG* pCeltFetched);
+ virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
+ virtual HRESULT STDMETHODCALLTYPE Reset();
+ virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT** ppEnum);
+
+private:
+ COMEnumVariant()
+ : m_refCount(0)
+ {
+ }
+
+ COMEnumVariant(const ContainerType& container)
+ : m_refCount(0)
+ , m_container(container)
+ , m_currentPos(m_container.begin())
+ {
+ }
+
+ ~COMEnumVariant() {}
+
+ ULONG m_refCount;
+
+ ContainerType m_container;
+ typename ContainerType::const_iterator m_currentPos;
+};
+
+// COMEnumVariant ------------------------------------------------------------------
+template<typename ContainerType>
+COMEnumVariant<typename ContainerType>* COMEnumVariant<ContainerType>::adopt(ContainerType& container)
+{
+ COMEnumVariant* instance = new COMEnumVariant;
+ instance->m_container.swap(container);
+ instance->m_currentPos = instance->m_container.begin();
+ instance->AddRef();
+ return instance;
+}
+
+template<typename ContainerType>
+COMEnumVariant<typename ContainerType>* COMEnumVariant<ContainerType>::createInstance(const ContainerType& container)
+{
+ COMEnumVariant* instance = new COMEnumVariant(container);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown ------------------------------------------------------------------------
+template<typename ContainerType>
+HRESULT STDMETHODCALLTYPE COMEnumVariant<ContainerType>::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<COMEnumVariant*>(this);
+ else if (IsEqualGUID(riid, IID_IEnumVARIANT))
+ *ppvObject = static_cast<COMEnumVariant*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+template<typename ContainerType>
+ULONG STDMETHODCALLTYPE COMEnumVariant<ContainerType>::AddRef()
+{
+ return ++m_refCount;
+}
+
+template<typename ContainerType>
+ULONG STDMETHODCALLTYPE COMEnumVariant<ContainerType>::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+// IEnumVARIANT --------------------------------------------------------------------
+template<typename ContainerType>
+HRESULT STDMETHODCALLTYPE COMEnumVariant<ContainerType>::Next(ULONG celt, VARIANT* rgVar, ULONG* pCeltFetched)
+{
+ if (pCeltFetched)
+ *pCeltFetched = 0;
+ if (!rgVar)
+ return E_POINTER;
+ for (unsigned i = 0 ; i < celt; i++)
+ VariantInit(&rgVar[i]);
+
+ for (unsigned i = 0; i < celt; i++) {
+ if (m_currentPos == m_container.end())
+ return S_FALSE;
+
+ COMVariantSetter<ContainerType::ValueType>::setVariant(&rgVar[i], *m_currentPos);
+ ++m_currentPos;
+ if (pCeltFetched)
+ (*pCeltFetched)++;
+ }
+
+ return S_OK;
+}
+
+template<typename ContainerType>
+HRESULT STDMETHODCALLTYPE COMEnumVariant<ContainerType>::Skip(ULONG celt)
+{
+ for (unsigned i = 0; i < celt; i++) {
+ if (m_currentPos == m_container.end())
+ return S_FALSE;
+
+ ++m_currentPos;
+ }
+ return S_OK;
+}
+
+template<typename ContainerType>
+HRESULT STDMETHODCALLTYPE COMEnumVariant<ContainerType>::Reset()
+{
+ m_currentPos = m_container.begin();
+ return S_OK;
+}
+
+template<typename ContainerType>
+HRESULT STDMETHODCALLTYPE COMEnumVariant<ContainerType>::Clone(IEnumVARIANT** ppEnum)
+{
+ if (!ppEnum)
+ return E_POINTER;
+
+ *ppEnum = 0;
+ return E_NOTIMPL;
+}
+
+#endif
diff --git a/WebKit/win/CodeAnalysisConfig.h b/WebKit/win/CodeAnalysisConfig.h
new file mode 100644
index 0000000..ea91d7c
--- /dev/null
+++ b/WebKit/win/CodeAnalysisConfig.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CodeAnalysisConfig_H
+#define CodeAnalysisConfig_H
+
+// warning C6011: dereferencing NULL pointer <name>
+// warning C6031: return value ignored: <function> could return unexpected value
+// warning C6211: Leaking memory due to an exception. Consider using a local catch block to clean up memory.
+// warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _alloca_s instead
+// warning C6387: <argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y
+#pragma warning(disable: 6011 6031 6211 6255 6387)
+
+#endif
diff --git a/WebKit/win/DOMCSSClasses.cpp b/WebKit/win/DOMCSSClasses.cpp
new file mode 100644
index 0000000..c6190ec
--- /dev/null
+++ b/WebKit/win/DOMCSSClasses.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "DOMCSSClasses.h"
+
+#pragma warning(push, 0)
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+// DOMCSSStyleDeclaration - DOMCSSStyleDeclaration ----------------------------
+
+DOMCSSStyleDeclaration::DOMCSSStyleDeclaration(WebCore::CSSStyleDeclaration* s)
+: m_style(0)
+{
+ if (s)
+ s->ref();
+
+ m_style = s;
+}
+
+DOMCSSStyleDeclaration::~DOMCSSStyleDeclaration()
+{
+ if (m_style)
+ m_style->deref();
+}
+
+IDOMCSSStyleDeclaration* DOMCSSStyleDeclaration::createInstance(WebCore::CSSStyleDeclaration* s)
+{
+ if (!s)
+ return 0;
+
+ HRESULT hr;
+ IDOMCSSStyleDeclaration* domStyle = 0;
+
+ DOMCSSStyleDeclaration* newStyle = new DOMCSSStyleDeclaration(s);
+ hr = newStyle->QueryInterface(IID_IDOMCSSStyleDeclaration, (void**)&domStyle);
+
+ if (FAILED(hr))
+ return 0;
+
+ return domStyle;
+}
+
+// DOMCSSStyleDeclaration - IUnknown ------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMCSSStyleDeclaration))
+ *ppvObject = static_cast<IDOMCSSStyleDeclaration*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMCSSStyleDeclaration - IDOMCSSStyleDeclaration ---------------------------
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::cssText(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::setCssText(
+ /* [in] */ BSTR cssText)
+{
+ WebCore::String cssTextString(cssText);
+ // FIXME: <rdar://5148045> return DOM exception info
+ WebCore::ExceptionCode ec;
+ m_style->setCssText(cssTextString, ec);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyValue(
+ /* [in] */ BSTR propertyName,
+ /* [retval][out] */ BSTR* result)
+{
+ WebCore::String propertyNameString(propertyName);
+ WebCore::String value = m_style->getPropertyValue(propertyNameString);
+ *result = SysAllocStringLen(value.characters(), value.length());
+ if (value.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyCSSValue(
+ /* [in] */ BSTR /*propertyName*/,
+ /* [retval][out] */ IDOMCSSValue** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::removeProperty(
+ /* [in] */ BSTR /*propertyName*/,
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyPriority(
+ /* [in] */ BSTR /*propertyName*/,
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::setProperty(
+ /* [in] */ BSTR propertyName,
+ /* [in] */ BSTR value,
+ /* [in] */ BSTR priority)
+{
+ WebCore::String propertyNameString(propertyName);
+ WebCore::String valueString(value);
+ WebCore::String priorityString(priority);
+ // FIXME: <rdar://5148045> return DOM exception info
+ WebCore::ExceptionCode code;
+ m_style->setProperty(propertyNameString, valueString, priorityString, code);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::length(
+ /* [retval][out] */ UINT* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::item(
+ /* [in] */ UINT /*index*/,
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::parentRule(
+ /* [retval][out] */ IDOMCSSRule** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
diff --git a/WebKit/win/DOMCSSClasses.h b/WebKit/win/DOMCSSClasses.h
new file mode 100644
index 0000000..5ddf592
--- /dev/null
+++ b/WebKit/win/DOMCSSClasses.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMCSSClasses_H
+#define DOMCSSClasses_H
+
+#include "WebKit.h"
+#include "DOMCoreClasses.h"
+
+#include <WebCore/CSSStyleDeclaration.h>
+
+class DOMCSSStyleDeclaration : public DOMObject, public IDOMCSSStyleDeclaration
+{
+protected:
+ DOMCSSStyleDeclaration(WebCore::CSSStyleDeclaration* d);
+ ~DOMCSSStyleDeclaration();
+
+public:
+ static IDOMCSSStyleDeclaration* createInstance(WebCore::CSSStyleDeclaration* d);
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMCSSStyleDeclaration
+ virtual HRESULT STDMETHODCALLTYPE cssText(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setCssText(
+ /* [in] */ BSTR cssText);
+
+ virtual HRESULT STDMETHODCALLTYPE getPropertyValue(
+ /* [in] */ BSTR propertyName,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE getPropertyCSSValue(
+ /* [in] */ BSTR propertyName,
+ /* [retval][out] */ IDOMCSSValue **result);
+
+ virtual HRESULT STDMETHODCALLTYPE removeProperty(
+ /* [in] */ BSTR propertyName,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE getPropertyPriority(
+ /* [in] */ BSTR propertyName,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setProperty(
+ /* [in] */ BSTR propertyName,
+ /* [in] */ BSTR value,
+ /* [in] */ BSTR priority);
+
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ UINT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE item(
+ /* [in] */ UINT index,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE parentRule(
+ /* [retval][out] */ IDOMCSSRule **result);
+
+protected:
+ ULONG m_refCount;
+ WebCore::CSSStyleDeclaration* m_style;
+};
+
+#endif
diff --git a/WebKit/win/DOMCoreClasses.cpp b/WebKit/win/DOMCoreClasses.cpp
new file mode 100644
index 0000000..bd4ff16
--- /dev/null
+++ b/WebKit/win/DOMCoreClasses.cpp
@@ -0,0 +1,1283 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "DOMCoreClasses.h"
+
+#include "COMPtr.h"
+#include "DOMCSSClasses.h"
+#include "DOMEventsClasses.h"
+#include "DOMHTMLClasses.h"
+#include "WebKitGraphics.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/DOMWindow.h>
+#include <WebCore/Document.h>
+#include <WebCore/Element.h>
+#include <WebCore/SimpleFontData.h>
+#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLNames.h>
+#include <WebCore/HTMLOptionElement.h>
+#include <WebCore/HTMLSelectElement.h>
+#include <WebCore/HTMLTextAreaElement.h>
+#include <WebCore/NodeList.h>
+#include <WebCore/RenderObject.h>
+#pragma warning(pop)
+
+#include <initguid.h>
+// {79A193A5-D783-4c73-9AD9-D10678B943DE}
+DEFINE_GUID(IID_DOMNode, 0x79a193a5, 0xd783, 0x4c73, 0x9a, 0xd9, 0xd1, 0x6, 0x78, 0xb9, 0x43, 0xde);
+// {3B0C0EFF-478B-4b0b-8290-D2321E08E23E}
+DEFINE_GUID(IID_DOMElement, 0x3b0c0eff, 0x478b, 0x4b0b, 0x82, 0x90, 0xd2, 0x32, 0x1e, 0x8, 0xe2, 0x3e);
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+// DOMObject - IUnknown -------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMObject::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMObject))
+ *ppvObject = static_cast<IDOMObject*>(this);
+ else
+ return WebScriptObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMNode - IUnknown ---------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMNode::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMNode))
+ *ppvObject = static_cast<IDOMNode*>(this);
+ else if (IsEqualGUID(riid, IID_DOMNode))
+ *ppvObject = static_cast<DOMNode*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMNode --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMNode::nodeName(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::nodeValue(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!m_node)
+ return E_FAIL;
+ WebCore::String nodeValueStr = m_node->nodeValue();
+ *result = SysAllocStringLen(nodeValueStr.characters(), nodeValueStr.length());
+ if (nodeValueStr.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::setNodeValue(
+ /* [in] */ BSTR /*value*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::nodeType(
+ /* [retval][out] */ unsigned short* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::parentNode(
+ /* [retval][out] */ IDOMNode** result)
+{
+ *result = 0;
+ if (!m_node || !m_node->parentNode())
+ return E_FAIL;
+ *result = DOMNode::createInstance(m_node->parentNode());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::childNodes(
+ /* [retval][out] */ IDOMNodeList** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::firstChild(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::lastChild(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::previousSibling(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::nextSibling(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::attributes(
+ /* [retval][out] */ IDOMNamedNodeMap** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::ownerDocument(
+ /* [retval][out] */ IDOMDocument** result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+ if (!m_node)
+ return E_FAIL;
+ *result = DOMDocument::createInstance(m_node->ownerDocument());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::insertBefore(
+ /* [in] */ IDOMNode* /*newChild*/,
+ /* [in] */ IDOMNode* /*refChild*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::replaceChild(
+ /* [in] */ IDOMNode* /*newChild*/,
+ /* [in] */ IDOMNode* /*oldChild*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::removeChild(
+ /* [in] */ IDOMNode* /*oldChild*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::appendChild(
+ /* [in] */ IDOMNode* /*oldChild*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::hasChildNodes(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::cloneNode(
+ /* [in] */ BOOL /*deep*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::normalize( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::isSupported(
+ /* [in] */ BSTR /*feature*/,
+ /* [in] */ BSTR /*version*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::namespaceURI(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::prefix(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::setPrefix(
+ /* [in] */ BSTR /*prefix*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::localName(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::hasAttributes(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = FALSE;
+
+ if (!other)
+ return E_POINTER;
+
+ COMPtr<DOMNode> domOther;
+ HRESULT hr = other->QueryInterface(IID_DOMNode, (void**)&domOther);
+ if (FAILED(hr))
+ return hr;
+
+ *result = m_node->isSameNode(domOther->node()) ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::isEqualNode(
+ /* [in] */ IDOMNode* /*other*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::textContent(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_node->textContent()).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::setTextContent(
+ /* [in] */ BSTR /*text*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMNode - IDOMEventTarget --------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMNode::addEventListener(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ IDOMEventListener* /*listener*/,
+ /* [in] */ BOOL /*useCapture*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::removeEventListener(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ IDOMEventListener* /*listener*/,
+ /* [in] */ BOOL /*useCapture*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNode::dispatchEvent(
+ /* [in] */ IDOMEvent* evt,
+ /* [retval][out] */ BOOL* result)
+{
+ if (!m_node || !evt)
+ return E_FAIL;
+
+#if 0 // FIXME - raise dom exceptions
+ if (![self _node]->isEventTargetNode())
+ WebCore::raiseDOMException(DOM_NOT_SUPPORTED_ERR);
+#endif
+
+ COMPtr<DOMEvent> domEvent;
+ HRESULT hr = evt->QueryInterface(IID_DOMEvent, (void**) &domEvent);
+ if (FAILED(hr))
+ return hr;
+
+ WebCore::ExceptionCode ec = 0;
+ *result = WebCore::EventTargetNodeCast(m_node)->dispatchEvent(domEvent->coreEvent(), ec) ? TRUE : FALSE;
+#if 0 // FIXME - raise dom exceptions
+ WebCore::raiseOnDOMError(ec);
+#endif
+ return S_OK;
+}
+
+// DOMNode - DOMNode ----------------------------------------------------------
+
+DOMNode::DOMNode(WebCore::Node* n)
+: m_node(0)
+{
+ if (n)
+ n->ref();
+
+ m_node = n;
+}
+
+DOMNode::~DOMNode()
+{
+ if (m_node)
+ m_node->deref();
+}
+
+IDOMNode* DOMNode::createInstance(WebCore::Node* n)
+{
+ if (!n)
+ return 0;
+
+ HRESULT hr = S_OK;
+ IDOMNode* domNode = 0;
+ WebCore::Node::NodeType nodeType = n->nodeType();
+
+ switch (nodeType) {
+ case WebCore::Node::ELEMENT_NODE:
+ {
+ IDOMElement* newElement = DOMElement::createInstance(static_cast<WebCore::Element*>(n));
+ if (newElement) {
+ hr = newElement->QueryInterface(IID_IDOMNode, (void**)&domNode);
+ newElement->Release();
+ }
+ }
+ break;
+ case WebCore::Node::DOCUMENT_NODE:
+ {
+ IDOMDocument* newDocument = DOMDocument::createInstance(n->document());
+ if (newDocument) {
+ hr = newDocument->QueryInterface(IID_IDOMNode, (void**)&domNode);
+ newDocument->Release();
+ }
+ }
+ break;
+ default:
+ {
+ DOMNode* newNode = new DOMNode(n);
+ hr = newNode->QueryInterface(IID_IDOMNode, (void**)&domNode);
+ }
+ break;
+ }
+
+ if (FAILED(hr))
+ return 0;
+
+ return domNode;
+}
+
+// DOMNodeList - IUnknown -----------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMNodeList::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMNodeList))
+ *ppvObject = static_cast<IDOMNodeList*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// IDOMNodeList ---------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMNodeList::item(
+ /* [in] */ UINT index,
+ /* [retval][out] */ IDOMNode **result)
+{
+ *result = 0;
+ if (!m_nodeList)
+ return E_FAIL;
+
+ WebCore::Node* itemNode = m_nodeList->item(index);
+ if (!itemNode)
+ return E_FAIL;
+
+ *result = DOMNode::createInstance(itemNode);
+ if (!(*result))
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMNodeList::length(
+ /* [retval][out] */ UINT *result)
+{
+ *result = 0;
+ if (!m_nodeList)
+ return E_FAIL;
+ *result = m_nodeList->length();
+ return S_OK;
+}
+
+// DOMNodeList - DOMNodeList --------------------------------------------------
+
+DOMNodeList::DOMNodeList(WebCore::NodeList* l)
+: m_nodeList(0)
+{
+ if (l)
+ l->ref();
+
+ m_nodeList = l;
+}
+
+DOMNodeList::~DOMNodeList()
+{
+ if (m_nodeList)
+ m_nodeList->deref();
+}
+
+IDOMNodeList* DOMNodeList::createInstance(WebCore::NodeList* l)
+{
+ if (!l)
+ return 0;
+
+ IDOMNodeList* domNodeList = 0;
+ DOMNodeList* newNodeList = new DOMNodeList(l);
+ if (FAILED(newNodeList->QueryInterface(IID_IDOMNodeList, (void**)&domNodeList)))
+ return 0;
+
+ return domNodeList;
+}
+
+// DOMDocument - IUnknown -----------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMDocument::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMDocument))
+ *ppvObject = static_cast<IDOMDocument*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMViewCSS))
+ *ppvObject = static_cast<IDOMViewCSS*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMDocumentEvent))
+ *ppvObject = static_cast<IDOMDocumentEvent*>(this);
+ else
+ return DOMNode::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMDocument ----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMDocument::doctype(
+ /* [retval][out] */ IDOMDocumentType** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::implementation(
+ /* [retval][out] */ IDOMImplementation** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::documentElement(
+ /* [retval][out] */ IDOMElement** result)
+{
+ *result = DOMElement::createInstance(m_document->documentElement());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createElement(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMElement** result)
+{
+ if (!m_document)
+ return E_FAIL;
+
+ String tagNameString(tagName);
+ ExceptionCode ec;
+ *result = DOMElement::createInstance(m_document->createElement(tagNameString, ec).get());
+ if (!(*result))
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createDocumentFragment(
+ /* [retval][out] */ IDOMDocumentFragment** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createTextNode(
+ /* [in] */ BSTR /*data*/,
+ /* [retval][out] */ IDOMText** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createComment(
+ /* [in] */ BSTR /*data*/,
+ /* [retval][out] */ IDOMComment** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createCDATASection(
+ /* [in] */ BSTR /*data*/,
+ /* [retval][out] */ IDOMCDATASection** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createProcessingInstruction(
+ /* [in] */ BSTR /*target*/,
+ /* [in] */ BSTR /*data*/,
+ /* [retval][out] */ IDOMProcessingInstruction** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createAttribute(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createEntityReference(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMEntityReference** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::getElementsByTagName(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMNodeList** result)
+{
+ if (!m_document)
+ return E_FAIL;
+
+ String tagNameString(tagName);
+ *result = DOMNodeList::createInstance(m_document->getElementsByTagName(tagNameString).get());
+ if (!(*result))
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::importNode(
+ /* [in] */ IDOMNode* /*importedNode*/,
+ /* [in] */ BOOL /*deep*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createElementNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*qualifiedName*/,
+ /* [retval][out] */ IDOMElement** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createAttributeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*qualifiedName*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList** result)
+{
+ if (!m_document)
+ return E_FAIL;
+
+ String namespaceURIString(namespaceURI);
+ String localNameString(localName);
+ *result = DOMNodeList::createInstance(m_document->getElementsByTagNameNS(namespaceURIString, localNameString).get());
+ if (!(*result))
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMDocument::getElementById(
+ /* [in] */ BSTR elementId,
+ /* [retval][out] */ IDOMElement** result)
+{
+ if (!m_document)
+ return E_FAIL;
+
+ String idString(elementId);
+ *result = DOMElement::createInstance(m_document->getElementById(idString));
+ if (!(*result))
+ return E_FAIL;
+ return S_OK;
+}
+
+// DOMDocument - IDOMViewCSS --------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMDocument::getComputedStyle(
+ /* [in] */ IDOMElement* elt,
+ /* [in] */ BSTR pseudoElt,
+ /* [retval][out] */ IDOMCSSStyleDeclaration** result)
+{
+ if (!elt || !result)
+ return E_POINTER;
+
+ COMPtr<DOMElement> domEle;
+ HRESULT hr = elt->QueryInterface(IID_DOMElement, (void**)&domEle);
+ if (FAILED(hr))
+ return hr;
+ Element* element = domEle->element();
+
+ WebCore::DOMWindow* dv = m_document->defaultView();
+ String pseudoEltString(pseudoElt);
+
+ if (!dv)
+ return E_FAIL;
+
+ *result = DOMCSSStyleDeclaration::createInstance(dv->getComputedStyle(element, pseudoEltString.impl()).get());
+ return S_OK;
+}
+
+// DOMDocument - IDOMDocumentEvent --------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMDocument::createEvent(
+ /* [in] */ BSTR eventType,
+ /* [retval][out] */ IDOMEvent **result)
+{
+ String eventTypeString(eventType, SysStringLen(eventType));
+ WebCore::ExceptionCode ec = 0;
+ *result = DOMEvent::createInstance(m_document->createEvent(eventTypeString, ec));
+ return S_OK;
+}
+
+// DOMDocument - DOMDocument --------------------------------------------------
+
+DOMDocument::DOMDocument(WebCore::Document* d)
+: DOMNode(d)
+, m_document(d)
+{
+}
+
+DOMDocument::~DOMDocument()
+{
+}
+
+IDOMDocument* DOMDocument::createInstance(WebCore::Document* d)
+{
+ if (!d)
+ return 0;
+
+ HRESULT hr;
+ IDOMDocument* domDocument = 0;
+
+ if (d->isHTMLDocument()) {
+ DOMHTMLDocument* newDocument = new DOMHTMLDocument(d);
+ hr = newDocument->QueryInterface(IID_IDOMDocument, (void**)&domDocument);
+ } else {
+ DOMDocument* newDocument = new DOMDocument(d);
+ hr = newDocument->QueryInterface(IID_IDOMDocument, (void**)&domDocument);
+ }
+
+ if (FAILED(hr))
+ return 0;
+
+ return domDocument;
+}
+
+// DOMElement - IUnknown ------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMElement))
+ *ppvObject = static_cast<IDOMElement*>(this);
+ else if (IsEqualGUID(riid, IID_DOMElement))
+ *ppvObject = static_cast<DOMElement*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMElementPrivate))
+ *ppvObject = static_cast<IDOMElementPrivate*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMNodeExtensions))
+ *ppvObject = static_cast<IDOMNodeExtensions*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMElementCSSInlineStyle))
+ *ppvObject = static_cast<IDOMElementCSSInlineStyle*>(this);
+ else if (IsEqualGUID(riid, IID_IDOMElementExtensions))
+ *ppvObject = static_cast<IDOMElementExtensions*>(this);
+ else
+ return DOMNode::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMElement - IDOMNodeExtensions---------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMElement::boundingBox(
+ /* [retval][out] */ LPRECT rect)
+{
+ ::SetRectEmpty(rect);
+
+ if (!m_element)
+ return E_FAIL;
+
+ WebCore::RenderObject *renderer = m_element->renderer();
+ if (renderer) {
+ IntRect boundsIntRect = renderer->absoluteBoundingBoxRect();
+ rect->left = boundsIntRect.x();
+ rect->top = boundsIntRect.y();
+ rect->right = boundsIntRect.x() + boundsIntRect.width();
+ rect->bottom = boundsIntRect.y() + boundsIntRect.height();
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::lineBoxRects(
+ /* [size_is][in] */ RECT* /*rects*/,
+ /* [in] */ int /*cRects*/)
+{
+ return E_NOTIMPL;
+}
+
+// IDOMElement ----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMElement::tagName(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR* result)
+{
+ if (!m_element)
+ return E_FAIL;
+ WebCore::String nameString(name, SysStringLen(name));
+ WebCore::String& attrValueString = (WebCore::String&) m_element->getAttribute(nameString);
+ *result = SysAllocStringLen(attrValueString.characters(), attrValueString.length());
+ if (attrValueString.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ WebCore::String nameString(name, SysStringLen(name));
+ WebCore::String valueString(value, SysStringLen(value));
+ WebCore::ExceptionCode ec = 0;
+ m_element->setAttribute(nameString, valueString, ec);
+ return ec ? E_FAIL : S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::removeAttribute(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getAttributeNode(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setAttributeNode(
+ /* [in] */ IDOMAttr* /*newAttr*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::removeAttributeNode(
+ /* [in] */ IDOMAttr* /*oldAttr*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getElementsByTagName(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMNodeList** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getAttributeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*localName*/,
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setAttributeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*qualifiedName*/,
+ /* [in] */ BSTR /*value*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::removeAttributeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*localName*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getAttributeNodeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*localName*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setAttributeNodeNS(
+ /* [in] */ IDOMAttr* /*newAttr*/,
+ /* [retval][out] */ IDOMAttr** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::getElementsByTagNameNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*localName*/,
+ /* [retval][out] */ IDOMNodeList** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::hasAttribute(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::hasAttributeNS(
+ /* [in] */ BSTR /*namespaceURI*/,
+ /* [in] */ BSTR /*localName*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::focus( void)
+{
+ if (!m_element)
+ return E_FAIL;
+ m_element->focus();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::blur( void)
+{
+ if (!m_element)
+ return E_FAIL;
+ m_element->blur();
+ return S_OK;
+}
+
+// IDOMElementPrivate ---------------------------------------------------------
+
+HRESULT DOMElement::coreElement(void **element)
+{
+ if (!m_element)
+ return E_FAIL;
+ *element = (void*) m_element;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::isEqual(
+ /* [in] */ IDOMElement *other,
+ /* [retval][out] */ BOOL *result)
+{
+ *result = FALSE;
+
+ if (!other || !result)
+ return E_POINTER;
+
+ IDOMElementPrivate* otherPriv;
+ HRESULT hr = other->QueryInterface(IID_IDOMElementPrivate, (void**) &otherPriv);
+ if (FAILED(hr))
+ return hr;
+
+ void* otherCoreEle;
+ hr = otherPriv->coreElement(&otherCoreEle);
+ otherPriv->Release();
+ if (FAILED(hr))
+ return hr;
+
+ *result = (otherCoreEle == (void*)m_element) ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::isFocused(
+ /* [retval][out] */ BOOL *result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ if (m_element->document()->focusedNode() == m_element)
+ *result = TRUE;
+ else
+ *result = FALSE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::innerText(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ if (!m_element) {
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ *result = BString(m_element->innerText()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::font(WebFontDescription* webFontDescription)
+{
+ if (!webFontDescription) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ ASSERT(m_element);
+
+ WebCore::RenderObject* renderer = m_element->renderer();
+ if (!renderer)
+ return E_FAIL;
+
+ FontDescription fontDescription = renderer->style()->font().fontDescription();
+ AtomicString family = fontDescription.family().family();
+ webFontDescription->family = family.characters();
+ webFontDescription->familyLength = family.length();
+ webFontDescription->size = fontDescription.computedSize();
+ webFontDescription->bold = fontDescription.bold();
+ webFontDescription->italic = fontDescription.italic();
+
+ return S_OK;
+}
+
+// IDOMElementCSSInlineStyle --------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMElement::style(
+ /* [retval][out] */ IDOMCSSStyleDeclaration** result)
+{
+ if (!result)
+ return E_POINTER;
+ if (!m_element)
+ return E_FAIL;
+
+ WebCore::CSSStyleDeclaration* style = m_element->style();
+ if (!style)
+ return E_FAIL;
+
+ *result = DOMCSSStyleDeclaration::createInstance(style);
+ return S_OK;
+}
+
+// IDOMElementExtensions ------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMElement::offsetLeft(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->offsetLeft();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::offsetTop(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->offsetTop();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::offsetWidth(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->offsetWidth();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::offsetHeight(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->offsetHeight();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::offsetParent(
+ /* [retval][out] */ IDOMElement** /*result*/)
+{
+ // FIXME
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::clientWidth(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->clientWidth();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::clientHeight(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->clientHeight();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollLeft(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->scrollLeft();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setScrollLeft(
+ /* [in] */ int /*newScrollLeft*/)
+{
+ // FIXME
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollTop(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->scrollTop();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::setScrollTop(
+ /* [in] */ int /*newScrollTop*/)
+{
+ // FIXME
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollWidth(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->scrollWidth();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollHeight(
+ /* [retval][out] */ int* result)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ *result = m_element->scrollHeight();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollIntoView(
+ /* [in] */ BOOL alignWithTop)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ m_element->scrollIntoView(!!alignWithTop);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMElement::scrollIntoViewIfNeeded(
+ /* [in] */ BOOL centerIfNeeded)
+{
+ if (!m_element)
+ return E_FAIL;
+
+ m_element->scrollIntoViewIfNeeded(!!centerIfNeeded);
+ return S_OK;
+}
+
+// DOMElement -----------------------------------------------------------------
+
+DOMElement::DOMElement(WebCore::Element* e)
+: DOMNode(e)
+, m_element(e)
+{
+}
+
+DOMElement::~DOMElement()
+{
+}
+
+IDOMElement* DOMElement::createInstance(WebCore::Element* e)
+{
+ if (!e)
+ return 0;
+
+ HRESULT hr;
+ IDOMElement* domElement = 0;
+
+ if (e->hasTagName(formTag)) {
+ DOMHTMLFormElement* newElement = new DOMHTMLFormElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else if (e->hasTagName(selectTag)) {
+ DOMHTMLSelectElement* newElement = new DOMHTMLSelectElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else if (e->hasTagName(optionTag)) {
+ DOMHTMLOptionElement* newElement = new DOMHTMLOptionElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else if (e->hasTagName(inputTag)) {
+ DOMHTMLInputElement* newElement = new DOMHTMLInputElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else if (e->hasTagName(textareaTag)) {
+ DOMHTMLTextAreaElement* newElement = new DOMHTMLTextAreaElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else if (e->isHTMLElement()) {
+ DOMHTMLElement* newElement = new DOMHTMLElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ } else {
+ DOMElement* newElement = new DOMElement(e);
+ hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
+ }
+
+ if (FAILED(hr))
+ return 0;
+
+ return domElement;
+}
diff --git a/WebKit/win/DOMCoreClasses.h b/WebKit/win/DOMCoreClasses.h
new file mode 100644
index 0000000..3d3603d
--- /dev/null
+++ b/WebKit/win/DOMCoreClasses.h
@@ -0,0 +1,840 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMCoreClasses_H
+#define DOMCoreClasses_H
+
+#include "WebKit.h"
+#include "WebScriptObject.h"
+
+// {79A193A5-D783-4c73-9AD9-D10678B943DE}
+DEFINE_GUID(IID_DOMNode, 0x79a193a5, 0xd783, 0x4c73, 0x9a, 0xd9, 0xd1, 0x6, 0x78, 0xb9, 0x43, 0xde);
+
+namespace WebCore {
+ class Element;
+ class Document;
+ class Node;
+ class NodeList;
+}
+
+class DOMObject : public WebScriptObject, public IDOMObject
+{
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return WebScriptObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return WebScriptObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return WebScriptObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return WebScriptObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return WebScriptObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return WebScriptObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return WebScriptObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return WebScriptObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return WebScriptObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return WebScriptObject::setException(description); }
+};
+
+class DOMNode : public DOMObject, public IDOMNode, public IDOMEventTarget
+{
+protected:
+ DOMNode(WebCore::Node* n);
+ ~DOMNode();
+
+public:
+ static IDOMNode* createInstance(WebCore::Node* n);
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result);
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result);
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result);
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result);
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void);
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix);
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text);
+
+ // IDOMEventTarget
+ virtual HRESULT STDMETHODCALLTYPE addEventListener(
+ /* [in] */ BSTR type,
+ /* [in] */ IDOMEventListener *listener,
+ /* [in] */ BOOL useCapture);
+
+ virtual HRESULT STDMETHODCALLTYPE removeEventListener(
+ /* [in] */ BSTR type,
+ /* [in] */ IDOMEventListener *listener,
+ /* [in] */ BOOL useCapture);
+
+ virtual HRESULT STDMETHODCALLTYPE dispatchEvent(
+ /* [in] */ IDOMEvent *evt,
+ /* [retval][out] */ BOOL *result);
+
+ // DOMNode
+ WebCore::Node* node() const { return m_node; }
+
+protected:
+ WebCore::Node* m_node;
+};
+
+class DOMNodeList : public DOMObject, public IDOMNodeList
+{
+protected:
+ DOMNodeList(WebCore::NodeList* l);
+ ~DOMNodeList();
+
+public:
+ static IDOMNodeList* createInstance(WebCore::NodeList* l);
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMNodeList
+ virtual HRESULT STDMETHODCALLTYPE item(
+ /* [in] */ UINT index,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ UINT *result);
+
+protected:
+ WebCore::NodeList* m_nodeList;
+};
+
+class DOMDocument : public DOMNode, public IDOMDocument, public IDOMViewCSS, public IDOMDocumentEvent
+{
+protected:
+ DOMDocument(WebCore::Document* d);
+ ~DOMDocument();
+
+public:
+ static IDOMDocument* createInstance(WebCore::Document* d);
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMNode::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMNode::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMNode::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMNode::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMNode::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMNode::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMNode::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMNode::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMNode::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMNode::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMNode::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMNode::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMNode::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMNode::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMNode::setTextContent(text); }
+
+ // IDOMDocument
+ virtual HRESULT STDMETHODCALLTYPE doctype(
+ /* [retval][out] */ IDOMDocumentType **result);
+
+ virtual HRESULT STDMETHODCALLTYPE implementation(
+ /* [retval][out] */ IDOMImplementation **result);
+
+ virtual HRESULT STDMETHODCALLTYPE documentElement(
+ /* [retval][out] */ IDOMElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createElement(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createDocumentFragment(
+ /* [retval][out] */ IDOMDocumentFragment **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createTextNode(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMText **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createComment(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMComment **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createCDATASection(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMCDATASection **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createProcessingInstruction(
+ /* [in] */ BSTR target,
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMProcessingInstruction **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createEntityReference(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMEntityReference **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMNodeList **result);
+
+ virtual HRESULT STDMETHODCALLTYPE importNode(
+ /* [in] */ IDOMNode *importedNode,
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createElementNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [retval][out] */ IDOMElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE createAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementById(
+ /* [in] */ BSTR elementId,
+ /* [retval][out] */ IDOMElement **result);
+
+ // IDOMViewCSS
+ virtual HRESULT STDMETHODCALLTYPE getComputedStyle(
+ /* [in] */ IDOMElement *elt,
+ /* [in] */ BSTR pseudoElt,
+ /* [retval][out] */ IDOMCSSStyleDeclaration **result);
+
+ // IDOMDocumentEvent
+ virtual HRESULT STDMETHODCALLTYPE createEvent(
+ /* [in] */ BSTR eventType,
+ /* [retval][out] */ IDOMEvent **result);
+
+ // DOMDocument
+ WebCore::Document* document() { return m_document; }
+
+protected:
+ WebCore::Document* m_document;
+};
+
+class DOMElement : public DOMNode, public IDOMElement, public IDOMElementPrivate, public IDOMNodeExtensions, public IDOMElementCSSInlineStyle, public IDOMElementExtensions
+{
+protected:
+ DOMElement(WebCore::Element* e);
+ ~DOMElement();
+
+public:
+ static IDOMElement* createInstance(WebCore::Element* e);
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMNode::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMNode::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMNode::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMNode::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMNode::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMNode::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMNode::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMNode::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMNode::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMNode::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMNode::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMNode::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMNode::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMNode::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMNode::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMNode::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMNode::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName);
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result);
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void);
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void);
+
+ // IDOMNodeExtensions
+ virtual HRESULT STDMETHODCALLTYPE boundingBox(
+ /* [retval][out] */ LPRECT rect);
+
+ virtual HRESULT STDMETHODCALLTYPE lineBoxRects(
+ /* [size_is][in] */ RECT* rects,
+ /* [in] */ int cRects);
+
+ // IDOMElementPrivate
+ virtual HRESULT STDMETHODCALLTYPE coreElement(
+ void** element);
+
+ virtual HRESULT STDMETHODCALLTYPE isEqual(
+ /* [in] */ IDOMElement *other,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE isFocused(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE font(
+ WebFontDescription* webFontDescription);
+
+ // IDOMElementCSSInlineStyle
+ virtual HRESULT STDMETHODCALLTYPE style(
+ /* [retval][out] */ IDOMCSSStyleDeclaration **result);
+
+ // IDOMElementExtensions
+ virtual HRESULT STDMETHODCALLTYPE offsetLeft(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetTop(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetWidth(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetHeight(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetParent(
+ /* [retval][out] */ IDOMElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientWidth(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientHeight(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollLeft(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setScrollLeft(
+ /* [in] */ int newScrollLeft);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollTop(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setScrollTop(
+ /* [in] */ int newScrollTop);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollWidth(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollHeight(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollIntoView(
+ /* [in] */ BOOL alignWithTop);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollIntoViewIfNeeded(
+ /* [in] */ BOOL centerIfNeeded);
+
+ // DOMElement
+ WebCore::Element* element() { return m_element; }
+
+protected:
+ WebCore::Element* m_element;
+};
+
+#endif
diff --git a/WebKit/win/DOMCreateInstance.cpp b/WebKit/win/DOMCreateInstance.cpp
new file mode 100644
index 0000000..78b2d4e
--- /dev/null
+++ b/WebKit/win/DOMCreateInstance.cpp
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+// This file is a temporary hack to implement the createInstance methods for
+// the COM DOM bindings.
+
+#include "config.h"
+#include "DOMCreateInstance.h"
+
+#include "GEN_DOMNode.h"
+#include "GEN_DOMElement.h"
+#include "GEN_DOMDocument.h"
+#include "GEN_DOMAttr.h"
+#include "GEN_DOMText.h"
+#include "GEN_DOMCDATASection.h"
+#include "GEN_DOMEntityReference.h"
+#include "GEN_DOMEntity.h"
+#include "GEN_DOMProcessingInstruction.h"
+#include "GEN_DOMComment.h"
+#include "GEN_DOMHTMLElement.h"
+#include "GEN_DOMHTMLDocument.h"
+#include "GEN_DOMHTMLCollection.h"
+#include "GEN_DOMDocumentType.h"
+#include "GEN_DOMDocumentFragment.h"
+#include "GEN_DOMNotation.h"
+#include "GEN_DOMCSSCharsetRule.h"
+#include "GEN_DOMCSSFontFaceRule.h"
+#include "GEN_DOMCSSImportRule.h"
+#include "GEN_DOMCSSMediaRule.h"
+#include "GEN_DOMCSSPageRule.h"
+#include "GEN_DOMCSSPrimitiveValue.h"
+#include "GEN_DOMCSSRule.h"
+#include "GEN_DOMCSSRuleList.h"
+#include "GEN_DOMCSSStyleDeclaration.h"
+#include "GEN_DOMCSSStyleRule.h"
+#include "GEN_DOMCSSStyleSheet.h"
+#include "GEN_DOMCSSValueList.h"
+#include "GEN_DOMStyleSheet.h"
+#include "GEN_DOMDOMImplementation.h"
+#include "GEN_DOMNamedNodeMap.h"
+#include "GEN_DOMNodeList.h"
+#include "GEN_DOMCounter.h"
+#include "GEN_DOMCSSRuleList.h"
+#include "GEN_DOMCSSStyleDeclaration.h"
+#include "GEN_DOMMediaList.h"
+#include "GEN_DOMRect.h"
+#include "GEN_DOMStyleSheet.h"
+#include "GEN_DOMStyleSheetList.h"
+#include "GEN_DOMEvent.h"
+#include "GEN_DOMEventListener.h"
+#include "GEN_DOMEvent.h"
+#include <wtf/HashMap.h>
+
+#pragma warning(push, 0)
+#include <WebCore/Node.h>
+#include <WebCore/Element.h>
+#include <WebCore/Document.h>
+#include <WebCore/Attr.h>
+#include <WebCore/Text.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/CDATASection.h>
+#include <WebCore/EntityReference.h>
+#include <WebCore/Entity.h>
+#include <WebCore/ProcessingInstruction.h>
+#include <WebCore/Comment.h>
+#include <WebCore/HTMLDocument.h>
+#include <WebCore/HTMLElement.h>
+#include <WebCore/HTMLCollection.h>
+#include <WebCore/DocumentType.h>
+#include <WebCore/DocumentFragment.h>
+#include <WebCore/Notation.h>
+#include <WebCore/CSSCharsetRule.h>
+#include <WebCore/CSSFontFaceRule.h>
+#include <WebCore/CSSImportRule.h>
+#include <WebCore/CSSMediaRule.h>
+#include <WebCore/CSSPageRule.h>
+#include <WebCore/CSSPrimitiveValue.h>
+#include <WebCore/CSSRule.h>
+#include <WebCore/CSSRuleList.h>
+#include <WebCore/CSSStyleDeclaration.h>
+#include <WebCore/CSSStyleRule.h>
+#include <WebCore/CSSStyleSheet.h>
+#include <WebCore/CSSValueList.h>
+#include <WebCore/StyleSheet.h>
+#include <WebCore/DOMImplementation.h>
+#include <WebCore/NamedNodeMap.h>
+#include <WebCore/NodeList.h>
+#include <WebCore/Counter.h>
+#include <WebCore/CSSRuleList.h>
+#include <WebCore/CSSStyleDeclaration.h>
+#include <WebCore/MediaList.h>
+#include <WebCore/Rect.h>
+#include <WebCore/StyleSheet.h>
+#include <WebCore/StyleSheetList.h>
+#include <WebCore/Event.h>
+#include <WebCore/EventListener.h>
+#pragma warning(pop)
+
+typedef HashMap<void*, GEN_DOMObject*> DOMWrapperCache;
+
+static DOMWrapperCache& domWrapperCache()
+{
+ static DOMWrapperCache cache;
+ return cache;
+}
+
+GEN_DOMObject* getDOMWrapper(void* objectHandle)
+{
+ return domWrapperCache().get(objectHandle);
+}
+
+void setDOMWrapper(void* objectHandle, GEN_DOMObject* wrapper)
+{
+ domWrapperCache().set(objectHandle, wrapper);
+}
+
+void removeDOMWrapper(void* objectHandle)
+{
+ domWrapperCache().remove(objectHandle);
+}
+
+#define COM_DOM_PREFIX(Type) GEN_DOM##Type
+#define CREATE_ONLY_SELF(Type) \
+ COM_DOM_PREFIX(Type)* COM_DOM_PREFIX(Type)::createInstance(WebCore::Type* impl) \
+ { \
+ if (!impl) \
+ return 0; \
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(impl)) { \
+ cachedInstance->AddRef(); \
+ return static_cast<COM_DOM_PREFIX(Type)*>(cachedInstance); \
+ } \
+ COMPtr<COM_DOM_PREFIX(Type)> comDOMObject = new COM_DOM_PREFIX(Type)(impl); \
+ setDOMWrapper(impl, comDOMObject.get()); \
+ return comDOMObject.releaseRef(); \
+ } \
+
+// Core
+
+GEN_DOMNode* GEN_DOMNode::createInstance(WebCore::Node* node)
+{
+ if (!node)
+ return 0;
+
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(node)) {
+ cachedInstance->AddRef();
+ return static_cast<GEN_DOMNode*>(cachedInstance);
+ }
+
+ COMPtr<GEN_DOMNode> domNode;
+ switch (node->nodeType()) {
+ case WebCore::Node::ELEMENT_NODE:
+ // FIXME: add support for creating subclasses of HTMLElement.
+ // FIXME: add support for creating SVGElements and its subclasses.
+ if (node->isHTMLElement())
+ domNode = new GEN_DOMHTMLElement(static_cast<WebCore::HTMLElement*>(node));
+ else
+ domNode = new GEN_DOMElement(static_cast<WebCore::Element*>(node));
+ break;
+ case WebCore::Node::ATTRIBUTE_NODE:
+ domNode = new GEN_DOMAttr(static_cast<WebCore::Attr*>(node));
+ break;
+ case WebCore::Node::TEXT_NODE:
+ domNode = new GEN_DOMText(static_cast<WebCore::Text*>(node));
+ break;
+ case WebCore::Node::CDATA_SECTION_NODE:
+ domNode = new GEN_DOMCDATASection(static_cast<WebCore::CDATASection*>(node));
+ break;
+ case WebCore::Node::ENTITY_REFERENCE_NODE:
+ domNode = new GEN_DOMEntityReference(static_cast<WebCore::EntityReference*>(node));
+ break;
+ case WebCore::Node::ENTITY_NODE:
+ domNode = new GEN_DOMEntity(static_cast<WebCore::Entity*>(node));
+ break;
+ case WebCore::Node::PROCESSING_INSTRUCTION_NODE:
+ domNode = new GEN_DOMProcessingInstruction(static_cast<WebCore::ProcessingInstruction*>(node));
+ break;
+ case WebCore::Node::COMMENT_NODE:
+ domNode = new GEN_DOMComment(static_cast<WebCore::Comment*>(node));
+ break;
+ case WebCore::Node::DOCUMENT_NODE:
+ // FIXME: add support for SVGDocument.
+ if (static_cast<WebCore::Document*>(node)->isHTMLDocument())
+ domNode = new GEN_DOMHTMLDocument(static_cast<WebCore::HTMLDocument*>(node));
+ else
+ domNode = new GEN_DOMDocument(static_cast<WebCore::Document*>(node));
+ break;
+ case WebCore::Node::DOCUMENT_TYPE_NODE:
+ domNode = new GEN_DOMDocumentType(static_cast<WebCore::DocumentType*>(node));
+ break;
+ case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
+ domNode = new GEN_DOMDocumentFragment(static_cast<WebCore::DocumentFragment*>(node));
+ break;
+ case WebCore::Node::NOTATION_NODE:
+ domNode = new GEN_DOMNotation(static_cast<WebCore::Notation*>(node));
+ break;
+ default:
+ domNode = new GEN_DOMNode(node);
+ break;
+ }
+
+ setDOMWrapper(node, domNode.get());
+ return domNode.releaseRef();
+}
+
+GEN_DOMImplementation* GEN_DOMImplementation::createInstance(WebCore::DOMImplementation* impl)
+{
+ if (!impl)
+ return 0;
+
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(impl)) {
+ cachedInstance->AddRef();
+ return static_cast<GEN_DOMImplementation*>(cachedInstance);
+ }
+
+ COMPtr<GEN_DOMImplementation> comDOMObject = new GEN_DOMImplementation(impl);
+ setDOMWrapper(impl, comDOMObject.get());
+ return comDOMObject.releaseRef();
+}
+
+CREATE_ONLY_SELF(NamedNodeMap)
+CREATE_ONLY_SELF(NodeList)
+
+// Events
+
+// FIXME: Add the subclasses for Event when they get generated.
+CREATE_ONLY_SELF(Event)
+CREATE_ONLY_SELF(EventListener)
+
+
+// CSS
+
+GEN_DOMCSSRule* GEN_DOMCSSRule::createInstance(WebCore::CSSRule* rule)
+{
+ if (!rule)
+ return 0;
+
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(rule)) {
+ cachedInstance->AddRef();
+ return static_cast<GEN_DOMCSSRule*>(cachedInstance);
+ }
+
+ COMPtr<GEN_DOMCSSRule> domRule;
+ switch (rule->type()) {
+ case WebCore::CSSRule::STYLE_RULE:
+ domRule = new GEN_DOMCSSStyleRule(static_cast<WebCore::CSSStyleRule*>(rule));
+ break;
+ case WebCore::CSSRule::CHARSET_RULE:
+ domRule = new GEN_DOMCSSCharsetRule(static_cast<WebCore::CSSCharsetRule*>(rule));
+ break;
+ case WebCore::CSSRule::IMPORT_RULE:
+ domRule = new GEN_DOMCSSImportRule(static_cast<WebCore::CSSImportRule*>(rule));
+ break;
+ case WebCore::CSSRule::MEDIA_RULE:
+ domRule = new GEN_DOMCSSMediaRule(static_cast<WebCore::CSSMediaRule*>(rule));
+ break;
+ case WebCore::CSSRule::FONT_FACE_RULE:
+ domRule = new GEN_DOMCSSFontFaceRule(static_cast<WebCore::CSSFontFaceRule*>(rule));
+ break;
+ case WebCore::CSSRule::PAGE_RULE:
+ domRule = new GEN_DOMCSSPageRule(static_cast<WebCore::CSSPageRule*>(rule));
+ break;
+ case WebCore::CSSRule::UNKNOWN_RULE:
+ default:
+ domRule = new GEN_DOMCSSRule(rule);
+ break;
+ }
+
+ setDOMWrapper(rule, domRule.get());
+ return domRule.releaseRef();
+}
+
+GEN_DOMStyleSheet* GEN_DOMStyleSheet::createInstance(WebCore::StyleSheet* styleSheet)
+{
+ if (!styleSheet)
+ return 0;
+
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(styleSheet)) {
+ cachedInstance->AddRef();
+ return static_cast<GEN_DOMStyleSheet*>(cachedInstance);
+ }
+
+ COMPtr<GEN_DOMStyleSheet> domStyleSheet;
+ if (styleSheet->isCSSStyleSheet())
+ domStyleSheet = new GEN_DOMCSSStyleSheet(static_cast<WebCore::CSSStyleSheet*>(styleSheet));
+ else
+ domStyleSheet = new GEN_DOMStyleSheet(styleSheet);
+
+ setDOMWrapper(styleSheet, domStyleSheet.get());
+ return domStyleSheet.releaseRef();
+}
+
+
+GEN_DOMCSSValue* GEN_DOMCSSValue::createInstance(WebCore::CSSValue* value)
+{
+ if (!value)
+ return 0;
+
+ if (GEN_DOMObject* cachedInstance = getDOMWrapper(value)) {
+ cachedInstance->AddRef();
+ return static_cast<GEN_DOMCSSValue*>(cachedInstance);
+ }
+
+ COMPtr<GEN_DOMCSSValue> domValue;
+ switch (value->cssValueType()) {
+ case WebCore::CSSValue::CSS_PRIMITIVE_VALUE:
+ domValue = new GEN_DOMCSSPrimitiveValue(static_cast<WebCore::CSSPrimitiveValue*>(value));
+ break;
+ case WebCore::CSSValue::CSS_VALUE_LIST:
+ domValue = new GEN_DOMCSSValueList(static_cast<WebCore::CSSValueList*>(value));
+ break;
+ case WebCore::CSSValue::CSS_INHERIT:
+ domValue = new GEN_DOMCSSValue(value);
+ break;
+ case WebCore::CSSValue::CSS_CUSTOM:
+ // FIXME: add support for SVGPaint and SVGColor
+ domValue = new GEN_DOMCSSValue(value);
+ break;
+ }
+
+ setDOMWrapper(value, domValue.get());
+ return domValue.releaseRef();
+}
+
+CREATE_ONLY_SELF(Counter)
+CREATE_ONLY_SELF(CSSRuleList)
+CREATE_ONLY_SELF(CSSStyleDeclaration)
+CREATE_ONLY_SELF(MediaList)
+CREATE_ONLY_SELF(Rect)
+CREATE_ONLY_SELF(StyleSheetList)
+
+
+// HTML
+
+CREATE_ONLY_SELF(HTMLCollection)
diff --git a/WebKit/win/DOMCreateInstance.h b/WebKit/win/DOMCreateInstance.h
new file mode 100644
index 0000000..a733e84
--- /dev/null
+++ b/WebKit/win/DOMCreateInstance.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DOMCreateInstance_h
+#define DOMCreateInstance_h
+
+class GEN_DOMObject;
+
+GEN_DOMObject* getDOMWrapper(void* objectHandle);
+void setDOMWrapper(void* objectHandle, GEN_DOMObject* wrapper);
+void removeDOMWrapper(void* objectHandle);
+
+#endif // DOMCreateInstance_h
diff --git a/WebKit/win/DOMEventsClasses.cpp b/WebKit/win/DOMEventsClasses.cpp
new file mode 100644
index 0000000..11e14b3
--- /dev/null
+++ b/WebKit/win/DOMEventsClasses.cpp
@@ -0,0 +1,735 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include <initguid.h>
+#include "DOMEventsClasses.h"
+
+#pragma warning( push, 0 )
+#include <WebCore/DOMWindow.h>
+#include <WebCore/Event.h>
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/MouseEvent.h>
+#pragma warning( pop )
+
+// DOMEventListener -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMEventListener::QueryInterface(const IID &riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMEventListener))
+ *ppvObject = static_cast<IDOMEventListener*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEventListener::handleEvent(
+ /* [in] */ IDOMEvent* /*evt*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMEvent -------------------------------------------------------------------
+
+DOMEvent::DOMEvent(PassRefPtr<WebCore::Event> e)
+: m_event(0)
+{
+ m_event = e;
+}
+
+DOMEvent::~DOMEvent()
+{
+}
+
+IDOMEvent* DOMEvent::createInstance(PassRefPtr<WebCore::Event> e)
+{
+ if (!e)
+ return 0;
+
+ HRESULT hr;
+ IDOMEvent* domEvent = 0;
+
+ if (e->isKeyboardEvent()) {
+ DOMKeyboardEvent* newEvent = new DOMKeyboardEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMKeyboardEvent, (void**)&domEvent);
+ } else if (e->isMouseEvent()) {
+ DOMMouseEvent* newEvent = new DOMMouseEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMMouseEvent, (void**)&domEvent);
+ } else if (e->isMutationEvent()) {
+ DOMMutationEvent* newEvent = new DOMMutationEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMMutationEvent, (void**)&domEvent);
+ } else if (e->isOverflowEvent()) {
+ DOMOverflowEvent* newEvent = new DOMOverflowEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMOverflowEvent, (void**)&domEvent);
+ } else if (e->isWheelEvent()) {
+ DOMWheelEvent* newEvent = new DOMWheelEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMWheelEvent, (void**)&domEvent);
+ } else if (e->isUIEvent()) {
+ DOMUIEvent* newEvent = new DOMUIEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMUIEvent, (void**)&domEvent);
+ } else {
+ DOMEvent* newEvent = new DOMEvent(e);
+ hr = newEvent->QueryInterface(IID_IDOMEvent, (void**)&domEvent);
+ }
+
+ if (FAILED(hr))
+ return 0;
+
+ return domEvent;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::QueryInterface(const IID &riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_DOMEvent))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IDOMEvent))
+ *ppvObject = static_cast<IDOMEvent*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::type(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::target(
+ /* [retval][out] */ IDOMEventTarget** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::currentTarget(
+ /* [retval][out] */ IDOMEventTarget** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::eventPhase(
+ /* [retval][out] */ unsigned short* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::bubbles(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::cancelable(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::timeStamp(
+ /* [retval][out] */ DOMTimeStamp* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::stopPropagation( void)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::preventDefault( void)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMEvent::initEvent(
+ /* [in] */ BSTR /*eventTypeArg*/,
+ /* [in] */ BOOL /*canBubbleArg*/,
+ /* [in] */ BOOL /*cancelableArg*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMUIEvent -----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMUIEvent))
+ *ppvObject = static_cast<IDOMUIEvent*>(this);
+ else
+ return DOMEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::view(
+ /* [retval][out] */ IDOMWindow** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::detail(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::initUIEvent(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ BOOL /*canBubble*/,
+ /* [in] */ BOOL /*cancelable*/,
+ /* [in] */ IDOMWindow* /*view*/,
+ /* [in] */ long /*detail*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::keyCode(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::charCode(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::layerX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::layerY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::pageX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::pageY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMUIEvent::which(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMKeyboardEvent -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMKeyboardEvent))
+ *ppvObject = static_cast<IDOMKeyboardEvent*>(this);
+ else
+ return DOMUIEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::keyIdentifier(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::keyLocation(
+ /* [retval][out] */ unsigned long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::ctrlKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isKeyboardEvent())
+ return E_FAIL;
+ WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(m_event.get());
+
+ *result = keyEvent->ctrlKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::shiftKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isKeyboardEvent())
+ return E_FAIL;
+ WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(m_event.get());
+
+ *result = keyEvent->shiftKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::altKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isKeyboardEvent())
+ return E_FAIL;
+ WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(m_event.get());
+
+ *result = keyEvent->altKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::metaKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isKeyboardEvent())
+ return E_FAIL;
+ WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(m_event.get());
+
+ *result = keyEvent->metaKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::altGraphKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isKeyboardEvent())
+ return E_FAIL;
+ WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(m_event.get());
+
+ *result = keyEvent->altGraphKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::getModifierState(
+ /* [in] */ BSTR /*keyIdentifierArg*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMKeyboardEvent::initKeyboardEvent(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ BOOL /*canBubble*/,
+ /* [in] */ BOOL /*cancelable*/,
+ /* [in] */ IDOMWindow* /*view*/,
+ /* [in] */ BSTR /*keyIdentifier*/,
+ /* [in] */ unsigned long /*keyLocation*/,
+ /* [in] */ BOOL /*ctrlKey*/,
+ /* [in] */ BOOL /*altKey*/,
+ /* [in] */ BOOL /*shiftKey*/,
+ /* [in] */ BOOL /*metaKey*/,
+ /* [in] */ BOOL /*graphKey*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMMouseEvent --------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMMouseEvent))
+ *ppvObject = static_cast<IDOMMouseEvent*>(this);
+ else
+ return DOMUIEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::screenX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::screenY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::clientX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::clientY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::ctrlKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isMouseEvent())
+ return E_FAIL;
+ WebCore::MouseEvent* mouseEvent = static_cast<WebCore::MouseEvent*>(m_event.get());
+
+ *result = mouseEvent->ctrlKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::shiftKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isMouseEvent())
+ return E_FAIL;
+ WebCore::MouseEvent* mouseEvent = static_cast<WebCore::MouseEvent*>(m_event.get());
+
+ *result = mouseEvent->shiftKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::altKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isMouseEvent())
+ return E_FAIL;
+ WebCore::MouseEvent* mouseEvent = static_cast<WebCore::MouseEvent*>(m_event.get());
+
+ *result = mouseEvent->altKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::metaKey(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ if (!m_event || !m_event->isMouseEvent())
+ return E_FAIL;
+ WebCore::MouseEvent* mouseEvent = static_cast<WebCore::MouseEvent*>(m_event.get());
+
+ *result = mouseEvent->metaKey() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::button(
+ /* [retval][out] */ unsigned short* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::relatedTarget(
+ /* [retval][out] */ IDOMEventTarget** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::initMouseEvent(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ BOOL /*canBubble*/,
+ /* [in] */ BOOL /*cancelable*/,
+ /* [in] */ IDOMWindow* /*view*/,
+ /* [in] */ long /*detail*/,
+ /* [in] */ long /*screenX*/,
+ /* [in] */ long /*screenY*/,
+ /* [in] */ long /*clientX*/,
+ /* [in] */ long /*clientY*/,
+ /* [in] */ BOOL /*ctrlKey*/,
+ /* [in] */ BOOL /*altKey*/,
+ /* [in] */ BOOL /*shiftKey*/,
+ /* [in] */ BOOL /*metaKey*/,
+ /* [in] */ unsigned short /*button*/,
+ /* [in] */ IDOMEventTarget* /*relatedTarget*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::offsetX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::offsetY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::x(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::y(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::fromElement(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMouseEvent::toElement(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMMutationEvent -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMMutationEvent))
+ *ppvObject = static_cast<IDOMMutationEvent*>(this);
+ else
+ return DOMEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::relatedNode(
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::prevValue(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::newValue(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::attrName(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::attrChange(
+ /* [retval][out] */ unsigned short* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMMutationEvent::initMutationEvent(
+ /* [in] */ BSTR /*type*/,
+ /* [in] */ BOOL /*canBubble*/,
+ /* [in] */ BOOL /*cancelable*/,
+ /* [in] */ IDOMNode* /*relatedNode*/,
+ /* [in] */ BSTR /*prevValue*/,
+ /* [in] */ BSTR /*newValue*/,
+ /* [in] */ BSTR /*attrName*/,
+ /* [in] */ unsigned short /*attrChange*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMOverflowEvent -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMOverflowEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMOverflowEvent))
+ *ppvObject = static_cast<IDOMOverflowEvent*>(this);
+ else
+ return DOMEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMOverflowEvent::orient(
+ /* [retval][out] */ unsigned short* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMOverflowEvent::horizontalOverflow(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMOverflowEvent::verticalOverflow(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+// DOMWheelEvent --------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMWheelEvent))
+ *ppvObject = static_cast<IDOMWheelEvent*>(this);
+ else
+ return DOMUIEvent::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::screenX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::screenY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::clientX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::clientY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::ctrlKey(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::shiftKey(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::altKey(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::metaKey(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::wheelDelta(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::wheelDeltaX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::wheelDeltaY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::offsetX(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::offsetY(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::x(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::y(
+ /* [retval][out] */ long* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::isHorizontal(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMWheelEvent::initWheelEvent(
+ /* [in] */ long /*wheelDeltaX*/,
+ /* [in] */ long /*wheelDeltaY*/,
+ /* [in] */ IDOMWindow* /*view*/,
+ /* [in] */ long /*screenX*/,
+ /* [in] */ long /*screenY*/,
+ /* [in] */ long /*clientX*/,
+ /* [in] */ long /*clientY*/,
+ /* [in] */ BOOL /*ctrlKey*/,
+ /* [in] */ BOOL /*altKey*/,
+ /* [in] */ BOOL /*shiftKey*/,
+ /* [in] */ BOOL /*metaKey*/)
+{
+ return E_NOTIMPL;
+}
diff --git a/WebKit/win/DOMEventsClasses.h b/WebKit/win/DOMEventsClasses.h
new file mode 100644
index 0000000..c55b26b
--- /dev/null
+++ b/WebKit/win/DOMEventsClasses.h
@@ -0,0 +1,960 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMEventsClasses_H
+#define DOMEventsClasses_H
+
+#include "WebKit.h"
+#include "DOMCoreClasses.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+// {AC3D1BC3-4976-4431-8A19-4812C5EFE39C}
+DEFINE_GUID(IID_DOMEvent, 0xac3d1bc3, 0x4976, 0x4431, 0x8a, 0x19, 0x48, 0x12, 0xc5, 0xef, 0xe3, 0x9c);
+
+namespace WebCore {
+ class Event;
+}
+
+class DOMUIEvent;
+
+class DOMEventListener : public DOMObject, public IDOMEventListener
+{
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEventListener
+ virtual HRESULT STDMETHODCALLTYPE handleEvent(
+ /* [in] */ IDOMEvent* evt);
+};
+
+class DOMEvent : public DOMObject, public IDOMEvent
+{
+public:
+ static IDOMEvent* createInstance(PassRefPtr<WebCore::Event> e);
+protected:
+ DOMEvent(PassRefPtr<WebCore::Event> e);
+ ~DOMEvent();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result);
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result);
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result);
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result);
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void);
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void);
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg);
+
+ // DOMEvent methods
+ WebCore::Event* coreEvent() { return m_event.get(); }
+
+protected:
+ RefPtr<WebCore::Event> m_event;
+};
+
+class DOMUIEvent : public DOMEvent, public IDOMUIEvent
+{
+public:
+ DOMUIEvent(PassRefPtr<WebCore::Event> e) : DOMEvent(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMUIEvent
+ virtual HRESULT STDMETHODCALLTYPE view(
+ /* [retval][out] */ IDOMWindow** result);
+
+ virtual HRESULT STDMETHODCALLTYPE detail(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initUIEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long detail);
+
+ virtual HRESULT STDMETHODCALLTYPE keyCode(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE charCode(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE layerX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE layerY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE pageX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE pageY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE which(
+ /* [retval][out] */ long* result);
+};
+
+class DOMKeyboardEvent : public DOMUIEvent, public IDOMKeyboardEvent
+{
+public:
+ DOMKeyboardEvent(PassRefPtr<WebCore::Event> e) : DOMUIEvent(e) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMUIEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMUIEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMUIEvent
+ virtual HRESULT STDMETHODCALLTYPE view(
+ /* [retval][out] */ IDOMWindow** result) { return DOMUIEvent::view(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE detail(
+ /* [retval][out] */ long* result) { return DOMUIEvent::detail(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE initUIEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long detail) { return DOMUIEvent::initUIEvent(type, canBubble, cancelable, view, detail); }
+
+ virtual HRESULT STDMETHODCALLTYPE keyCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::keyCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE charCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::charCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE which(
+ /* [retval][out] */ long* result) { return DOMUIEvent::which(result); }
+
+ // IDOMKeyboardEvent
+ virtual HRESULT STDMETHODCALLTYPE keyIdentifier(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE keyLocation(
+ /* [retval][out] */ unsigned long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE ctrlKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE shiftKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE altKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE metaKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE altGraphKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE getModifierState(
+ /* [in] */ BSTR keyIdentifierArg,
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initKeyboardEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ BSTR keyIdentifier,
+ /* [in] */ unsigned long keyLocation,
+ /* [in] */ BOOL ctrlKey,
+ /* [in] */ BOOL altKey,
+ /* [in] */ BOOL shiftKey,
+ /* [in] */ BOOL metaKey,
+ /* [in] */ BOOL graphKey);
+};
+
+class DOMMouseEvent : public DOMUIEvent, public IDOMMouseEvent
+{
+public:
+ DOMMouseEvent(PassRefPtr<WebCore::Event> e) : DOMUIEvent(e) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMUIEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMUIEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMUIEvent
+ virtual HRESULT STDMETHODCALLTYPE view(
+ /* [retval][out] */ IDOMWindow** result) { return DOMUIEvent::view(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE detail(
+ /* [retval][out] */ long* result) { return DOMUIEvent::detail(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE initUIEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long detail) { return DOMUIEvent::initUIEvent(type, canBubble, cancelable, view, detail); }
+
+ virtual HRESULT STDMETHODCALLTYPE keyCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::keyCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE charCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::charCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE which(
+ /* [retval][out] */ long* result) { return DOMUIEvent::which(result); }
+
+ // IDOMMouseEvent
+ virtual HRESULT STDMETHODCALLTYPE screenX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE screenY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE ctrlKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE shiftKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE altKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE metaKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE button(
+ /* [retval][out] */ unsigned short* result);
+
+ virtual HRESULT STDMETHODCALLTYPE relatedTarget(
+ /* [retval][out] */ IDOMEventTarget** result);
+
+ virtual HRESULT STDMETHODCALLTYPE initMouseEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long detail,
+ /* [in] */ long screenX,
+ /* [in] */ long screenY,
+ /* [in] */ long clientX,
+ /* [in] */ long clientY,
+ /* [in] */ BOOL ctrlKey,
+ /* [in] */ BOOL altKey,
+ /* [in] */ BOOL shiftKey,
+ /* [in] */ BOOL metaKey,
+ /* [in] */ unsigned short button,
+ /* [in] */ IDOMEventTarget* relatedTarget);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE x(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE y(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE fromElement(
+ /* [retval][out] */ IDOMNode** result);
+
+ virtual HRESULT STDMETHODCALLTYPE toElement(
+ /* [retval][out] */ IDOMNode** result);
+};
+
+class DOMMutationEvent : public DOMEvent, public IDOMMutationEvent
+{
+public:
+ DOMMutationEvent(PassRefPtr<WebCore::Event> e) : DOMEvent(e) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMMutationEvent
+ virtual HRESULT STDMETHODCALLTYPE relatedNode(
+ /* [retval][out] */ IDOMNode** result);
+
+ virtual HRESULT STDMETHODCALLTYPE prevValue(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE newValue(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE attrName(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE attrChange(
+ /* [retval][out] */ unsigned short* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initMutationEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMNode* relatedNode,
+ /* [in] */ BSTR prevValue,
+ /* [in] */ BSTR newValue,
+ /* [in] */ BSTR attrName,
+ /* [in] */ unsigned short attrChange);
+};
+
+class DOMOverflowEvent : public DOMEvent, public IDOMOverflowEvent
+{
+public:
+ DOMOverflowEvent(PassRefPtr<WebCore::Event> e) : DOMEvent(e) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMOverflowEvent
+ virtual HRESULT STDMETHODCALLTYPE orient(
+ /* [retval][out] */ unsigned short* result);
+
+ virtual HRESULT STDMETHODCALLTYPE horizontalOverflow(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE verticalOverflow(
+ /* [retval][out] */ BOOL* result);
+};
+
+class DOMWheelEvent : public DOMUIEvent, public IDOMWheelEvent
+{
+public:
+ DOMWheelEvent(PassRefPtr<WebCore::Event> e) : DOMUIEvent(e) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMUIEvent::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMUIEvent::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMEvent
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR* result) { return DOMEvent::type(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::target(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE currentTarget(
+ /* [retval][out] */ IDOMEventTarget** result) { return DOMEvent::currentTarget(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE eventPhase(
+ /* [retval][out] */ unsigned short* result) { return DOMEvent::eventPhase(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE bubbles(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::bubbles(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cancelable(
+ /* [retval][out] */ BOOL* result) { return DOMEvent::cancelable(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE timeStamp(
+ /* [retval][out] */ DOMTimeStamp* result) { return DOMEvent::timeStamp(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE stopPropagation( void) { return DOMEvent::stopPropagation(); }
+
+ virtual HRESULT STDMETHODCALLTYPE preventDefault( void) { return DOMEvent::preventDefault(); }
+
+ virtual HRESULT STDMETHODCALLTYPE initEvent(
+ /* [in] */ BSTR eventTypeArg,
+ /* [in] */ BOOL canBubbleArg,
+ /* [in] */ BOOL cancelableArg) { return DOMEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); }
+
+ // IDOMUIEvent
+ virtual HRESULT STDMETHODCALLTYPE view(
+ /* [retval][out] */ IDOMWindow** result) { return DOMUIEvent::view(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE detail(
+ /* [retval][out] */ long* result) { return DOMUIEvent::detail(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE initUIEvent(
+ /* [in] */ BSTR type,
+ /* [in] */ BOOL canBubble,
+ /* [in] */ BOOL cancelable,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long detail) { return DOMUIEvent::initUIEvent(type, canBubble, cancelable, view, detail); }
+
+ virtual HRESULT STDMETHODCALLTYPE keyCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::keyCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE charCode(
+ /* [retval][out] */ long* result) { return DOMUIEvent::charCode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE layerY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::layerY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageX(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageX(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE pageY(
+ /* [retval][out] */ long* result) { return DOMUIEvent::pageY(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE which(
+ /* [retval][out] */ long* result) { return DOMUIEvent::which(result); }
+
+ // IDOMWheelEvent
+ virtual HRESULT STDMETHODCALLTYPE screenX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE screenY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE clientY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE ctrlKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE shiftKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE altKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE metaKey(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE wheelDelta(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE wheelDeltaX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE wheelDeltaY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetX(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE offsetY(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE x(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE y(
+ /* [retval][out] */ long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE isHorizontal(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initWheelEvent(
+ /* [in] */ long wheelDeltaX,
+ /* [in] */ long wheelDeltaY,
+ /* [in] */ IDOMWindow* view,
+ /* [in] */ long screenX,
+ /* [in] */ long screenY,
+ /* [in] */ long clientX,
+ /* [in] */ long clientY,
+ /* [in] */ BOOL ctrlKey,
+ /* [in] */ BOOL altKey,
+ /* [in] */ BOOL shiftKey,
+ /* [in] */ BOOL metaKey);
+};
+
+#endif
diff --git a/WebKit/win/DOMHTMLClasses.cpp b/WebKit/win/DOMHTMLClasses.cpp
new file mode 100644
index 0000000..47f8f2b
--- /dev/null
+++ b/WebKit/win/DOMHTMLClasses.cpp
@@ -0,0 +1,1473 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "DOMHTMLClasses.h"
+#include "COMPtr.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/Document.h>
+#include <WebCore/Element.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/HTMLDocument.h>
+#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLNames.h>
+#include <WebCore/HTMLOptionElement.h>
+#include <WebCore/HTMLSelectElement.h>
+#include <WebCore/HTMLTextAreaElement.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/RenderObject.h>
+#include <WebCore/RenderTextControl.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+// DOMHTMLCollection
+
+DOMHTMLCollection::DOMHTMLCollection(WebCore::HTMLCollection* c)
+: m_collection(c)
+{
+}
+
+IDOMHTMLCollection* DOMHTMLCollection::createInstance(WebCore::HTMLCollection* c)
+{
+ if (!c)
+ return 0;
+
+ IDOMHTMLCollection* htmlCollection = 0;
+ DOMHTMLCollection* newCollection = new DOMHTMLCollection(c);
+ if (FAILED(newCollection->QueryInterface(IID_IDOMHTMLCollection, (void**)&htmlCollection))) {
+ delete newCollection;
+ return 0;
+ }
+
+ return htmlCollection;
+}
+
+// DOMHTMLCollection - IUnknown -----------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLCollection::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLCollection))
+ *ppvObject = static_cast<IDOMHTMLCollection*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLCollection ----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLCollection::length(
+ /* [retval][out] */ UINT* result)
+{
+ *result = 0;
+ if (!m_collection)
+ return E_POINTER;
+
+ *result = m_collection->length();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLCollection::item(
+ /* [in] */ UINT index,
+ /* [retval][out] */ IDOMNode** node)
+{
+ *node = 0;
+ if (!m_collection)
+ return E_POINTER;
+
+ *node = DOMNode::createInstance(m_collection->item(index));
+ return *node ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLCollection::namedItem(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMNode** /*node*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLOptionsCollection - IUnknown ----------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLOptionsCollection))
+ *ppvObject = static_cast<IDOMHTMLOptionsCollection*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLOptionsCollection ---------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::length(
+ /* [retval][out] */ unsigned int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::setLength(
+ /* [in] */ unsigned int /*length*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::item(
+ /* [in] */ unsigned int /*index*/,
+ /* [retval][out] */ IDOMNode** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionsCollection::namedItem(
+ /* [in] */ BSTR /*name*/,
+ /* [retval][out] */ IDOMNode* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLDocument - IUnknown -------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLDocument))
+ *ppvObject = static_cast<IDOMHTMLDocument*>(this);
+ else
+ return DOMDocument::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLDocument ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::title(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setTitle(
+ /* [in] */ BSTR /*title*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::referrer(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::domain(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::URL(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(static_cast<HTMLDocument*>(m_document)->url()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::body(
+ /* [retval][out] */ IDOMHTMLElement** bodyElement)
+{
+ *bodyElement = 0;
+ if (!m_document || !m_document->isHTMLDocument())
+ return E_FAIL;
+
+ HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
+ COMPtr<IDOMElement> domElement;
+ domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc->body()));
+ if (domElement)
+ return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) bodyElement);
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setBody(
+ /* [in] */ IDOMHTMLElement* /*body*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::images(
+ /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::applets(
+ /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::links(
+ /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::forms(
+ /* [retval][out] */ IDOMHTMLCollection** collection)
+{
+ *collection = 0;
+ if (!m_document || !m_document->isHTMLDocument())
+ return E_FAIL;
+
+ HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
+ *collection = DOMHTMLCollection::createInstance(htmlDoc->forms().get());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::anchors(
+ /* [retval][out] */ IDOMHTMLCollection** /*collection*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::cookie(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::setCookie(
+ /* [in] */ BSTR /*cookie*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::open( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::close( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::write(
+ /* [in] */ BSTR /*text*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::writeln(
+ /* [in] */ BSTR /*text*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementById_(
+ /* [in] */ BSTR /*elementId*/,
+ /* [retval][out] */ IDOMElement** /*element*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLDocument::getElementsByName(
+ /* [in] */ BSTR /*elementName*/,
+ /* [retval][out] */ IDOMNodeList** /*nodeList*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLElement - IUnknown --------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLElement))
+ *ppvObject = static_cast<IDOMHTMLElement*>(this);
+ else
+ return DOMElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLElement -------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::idName(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setIdName(
+ /* [in] */ BSTR /*idName*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::title(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setTitle(
+ /* [in] */ BSTR /*title*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::lang(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setLang(
+ /* [in] */ BSTR /*lang*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::dir(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setDir(
+ /* [in] */ BSTR /*dir*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::className(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setClassName(
+ /* [in] */ BSTR /*className*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerHTML(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerHTML(
+ /* [in] */ BSTR /*html*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText(
+ /* [retval][out] */ BSTR* result)
+{
+ ASSERT(m_element && m_element->isHTMLElement());
+ WebCore::String innerTextString = static_cast<HTMLElement*>(m_element)->innerText();
+ *result = BString(innerTextString.characters(), innerTextString.length()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLElement::setInnerText(
+ /* [in] */ BSTR text)
+{
+ ASSERT(m_element && m_element->isHTMLElement());
+ HTMLElement* htmlEle = static_cast<HTMLElement*>(m_element);
+ WebCore::String textString(text, SysStringLen(text));
+ WebCore::ExceptionCode ec = 0;
+ htmlEle->setInnerText(textString, ec);
+ return S_OK;
+}
+
+// DOMHTMLFormElement - IUnknown ----------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLFormElement))
+ *ppvObject = static_cast<IDOMHTMLFormElement*>(this);
+ else
+ return DOMHTMLElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLFormElement ---------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::elements(
+ /* [retval][out] */ IDOMHTMLCollection** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::length(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::name(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setName(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::acceptCharset(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAcceptCharset(
+ /* [in] */ BSTR /*acceptCharset*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::action(
+ /* [retval][out] */ BSTR* result)
+{
+ ASSERT(m_element && m_element->hasTagName(formTag));
+ WebCore::String actionString = static_cast<HTMLFormElement*>(m_element)->action();
+ *result = BString(actionString.characters(), actionString.length()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setAction(
+ /* [in] */ BSTR /*action*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::encType(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setEnctype(
+ /* [retval][out] */ BSTR* /*encType*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method(
+ /* [retval][out] */ BSTR* result)
+{
+ ASSERT(m_element && m_element->hasTagName(formTag));
+ WebCore::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
+ *result = BString(methodString.characters(), methodString.length()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setMethod(
+ /* [in] */ BSTR /*method*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::target(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::setTarget(
+ /* [in] */ BSTR /*target*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::submit( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::reset( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLSelectElement - IUnknown ----------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLSelectElement))
+ *ppvObject = static_cast<IDOMHTMLSelectElement*>(this);
+ else if (IsEqualGUID(riid, IID_IFormsAutoFillTransitionSelect))
+ *ppvObject = static_cast<IFormsAutoFillTransitionSelect*>(this);
+ else
+ return DOMHTMLElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLSelectElement -------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::type(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::selectedIndex(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSelectedIndx(
+ /* [in] */ int /*selectedIndex*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::value(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setValue(
+ /* [in] */ BSTR /*value*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::length(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::form(
+ /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::options(
+ /* [retval][out] */ IDOMHTMLOptionsCollection** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::disabled(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setDisabled(
+ /* [in] */ BOOL /*disabled*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::multiple(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setMultiple(
+ /* [in] */ BOOL /*multiple*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::name(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setName(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::size(
+ /* [retval][out] */ int* /*size*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setSize(
+ /* [in] */ int /*size*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::tabIndex(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::setTabIndex(
+ /* [in] */ int /*tabIndex*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::add(
+ /* [in] */ IDOMHTMLElement* /*element*/,
+ /* [in] */ IDOMHTMLElement* /*before*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::remove(
+ /* [in] */ int /*index*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLSelectElement - IFormsAutoFillTransitionSelect ----------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLSelectElement::activateItemAtIndex(
+ /* [in] */ int /*index*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLOptionElement - IUnknown --------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLOptionElement))
+ *ppvObject = static_cast<IDOMHTMLOptionElement*>(this);
+ else
+ return DOMHTMLElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLOptionElement -------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::form(
+ /* [retval][out] */ IDOMHTMLFormElement** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::defaultSelected(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDefaultSelected(
+ /* [in] */ BOOL /*defaultSelected*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::text(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::index(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::disabled(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setDisabled(
+ /* [in] */ BOOL /*disabled*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::label(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setLabel(
+ /* [in] */ BSTR /*label*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::selected(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setSelected(
+ /* [in] */ BOOL /*selected*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::value(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::setValue(
+ /* [in] */ BSTR /*value*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// DOMHTMLInputElement - IUnknown ----------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLInputElement))
+ *ppvObject = static_cast<IDOMHTMLInputElement*>(this);
+ else if (IsEqualGUID(riid, IID_IFormsAutoFillTransition))
+ *ppvObject = static_cast<IFormsAutoFillTransition*>(this);
+ else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
+ *ppvObject = static_cast<IFormPromptAdditions*>(this);
+ else
+ return DOMHTMLElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLInputElement --------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultValue(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultValue(
+ /* [in] */ BSTR /*val*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::defaultChecked(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDefaultChecked(
+ /* [in] */ BSTR /*checked*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::form(
+ /* [retval][out] */ IDOMHTMLElement** result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ COMPtr<IDOMElement> domElement;
+ domElement.adoptRef(DOMHTMLElement::createInstance(inputElement->form()));
+ if (domElement)
+ return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accept(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccept(
+ /* [in] */ BSTR /*accept*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::accessKey(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAccessKey(
+ /* [in] */ BSTR /*key*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::align(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlign(
+ /* [in] */ BSTR /*align*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::alt(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAlt(
+ /* [in] */ BSTR /*alt*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::checked(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setChecked(
+ /* [in] */ BOOL /*checked*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::disabled(
+ /* [retval][out] */ BOOL* result)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *result = inputElement->disabled() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setDisabled(
+ /* [in] */ BOOL /*disabled*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::maxLength(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setMaxLength(
+ /* [in] */ int /*maxLength*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::name(
+ /* [retval][out] */ BSTR* /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setName(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::readOnly(
+ /* [retval][out] */ BOOL* result)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *result = inputElement->readOnly() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setReadOnly(
+ /* [in] */ BOOL /*readOnly*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::size(
+ /* [retval][out] */ unsigned int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSize(
+ /* [in] */ unsigned int /*size*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::src(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSrc(
+ /* [in] */ BSTR /*src*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::tabIndex(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setTabIndex(
+ /* [in] */ int /*tabIndex*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::type(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setType(
+ /* [in] */ BSTR type)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ WebCore::String typeString(type, SysStringLen(type));
+ inputElement->setType(typeString);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::useMap(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setUseMap(
+ /* [in] */ BSTR /*useMap*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value(
+ /* [retval][out] */ BSTR* result)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ WebCore::String valueString = inputElement->value();
+ *result = BString(valueString.characters(), valueString.length()).release();
+ if (valueString.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValue(
+ /* [in] */ BSTR value)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ inputElement->setValue(String((UChar*) value, SysStringLen(value)));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ inputElement->select();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::click( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionStart(
+ /* [in] */ long start)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ inputElement->setSelectionStart(start);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionStart(
+ /* [retval][out] */ long *start)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *start = inputElement->selectionStart();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionEnd(
+ /* [in] */ long end)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ inputElement->setSelectionEnd(end);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionEnd(
+ /* [retval][out] */ long *end)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *end = inputElement->selectionEnd();
+ return S_OK;
+}
+
+// DOMHTMLInputElement -- IFormsAutoFillTransition ----------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField(
+ /* [retval][out] */ BOOL* result)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *result = inputElement->isTextField() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen(
+ /* [retval][out] */ LPRECT rect)
+{
+ rect->left = rect->top = rect->right = rect->bottom = 0;
+ RenderObject* renderer = m_element->renderer();
+ FrameView* view = m_element->document()->view();
+ if (!renderer || !view)
+ return E_FAIL;
+
+ IntRect coreRect = renderer->absoluteBoundingBoxRect();
+ coreRect.setLocation(view->contentsToWindow(coreRect.location()));
+ rect->left = coreRect.x();
+ rect->top = coreRect.y();
+ rect->right = coreRect.right();
+ rect->bottom = coreRect.bottom();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange(
+ /* [in] */ int /*startTarget*/,
+ /* [in] */ int /*endTarget*/,
+ /* [in] */ BSTR /*replacementString*/,
+ /* [in] */ int /*index*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange(
+ /* [out] */ int* start,
+ /* [out] */ int* end)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ *start = inputElement->selectionStart();
+ *end = inputElement->selectionEnd();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled(
+ /* [in] */ BOOL filled)
+{
+ ASSERT(m_element && m_element->hasTagName(inputTag));
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
+ inputElement->setAutofilled(!!filled);
+ return S_OK;
+}
+
+// DOMHTMLInputElement -- IFormPromptAdditions ------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited(
+ /* [retval][out] */ BOOL *result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = FALSE;
+ ASSERT(m_element);
+ BOOL textField = FALSE;
+ if (FAILED(isTextField(&textField)) || !textField)
+ return S_OK;
+ RenderObject* renderer = m_element->renderer();
+ if (renderer && static_cast<WebCore::RenderTextControl*>(renderer)->isUserEdited())
+ *result = TRUE;
+ return S_OK;
+}
+
+// DOMHTMLTextAreaElement - IUnknown ----------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IDOMHTMLTextAreaElement))
+ *ppvObject = static_cast<IDOMHTMLTextAreaElement*>(this);
+ else if (IsEqualGUID(riid, IID_IFormPromptAdditions))
+ *ppvObject = static_cast<IFormPromptAdditions*>(this);
+ else
+ return DOMHTMLElement::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMHTMLTextAreaElement -----------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::defaultValue(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDefaultValue(
+ /* [in] */ BSTR /*val*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::form(
+ /* [retval][out] */ IDOMHTMLElement** result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+ ASSERT(m_element && m_element->hasTagName(textareaTag));
+ HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
+ COMPtr<IDOMElement> domElement;
+ domElement.adoptRef(DOMHTMLElement::createInstance(textareaElement->form()));
+ if (domElement)
+ return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) result);
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::accessKey(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setAccessKey(
+ /* [in] */ BSTR /*key*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::cols(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setCols(
+ /* [in] */ int /*cols*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::disabled(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setDisabled(
+ /* [in] */ BOOL /*disabled*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::name(
+ /* [retval][out] */ BSTR* /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setName(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::readOnly(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setReadOnly(
+ /* [in] */ BOOL /*readOnly*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::rows(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setRows(
+ /* [in] */ int /*rows*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::tabIndex(
+ /* [retval][out] */ int* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setTabIndex(
+ /* [in] */ int /*tabIndex*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::type(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value(
+ /* [retval][out] */ BSTR* result)
+{
+ ASSERT(m_element && m_element->hasTagName(textareaTag));
+ HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
+ WebCore::String valueString = textareaElement->value();
+ *result = BString(valueString.characters(), valueString.length()).release();
+ if (valueString.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setValue(
+ /* [in] */ BSTR value)
+{
+ ASSERT(m_element && m_element->hasTagName(textareaTag));
+ HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
+ textareaElement->setValue(String((UChar*) value, SysStringLen(value)));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::select( void)
+{
+ ASSERT(m_element && m_element->hasTagName(textareaTag));
+ HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
+ textareaElement->select();
+ return S_OK;
+}
+
+// DOMHTMLTextAreaElement -- IFormPromptAdditions ------------------------------------
+
+HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited(
+ /* [retval][out] */ BOOL *result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = FALSE;
+ ASSERT(m_element);
+ RenderObject* renderer = m_element->renderer();
+ if (renderer && static_cast<WebCore::RenderTextControl*>(renderer)->isUserEdited())
+ *result = TRUE;
+ return S_OK;
+}
diff --git a/WebKit/win/DOMHTMLClasses.h b/WebKit/win/DOMHTMLClasses.h
new file mode 100644
index 0000000..ddc3dd1
--- /dev/null
+++ b/WebKit/win/DOMHTMLClasses.h
@@ -0,0 +1,2344 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DOMHTMLClasses_H
+#define DOMHTMLClasses_H
+
+#include "WebKit.h"
+#include "DOMCoreClasses.h"
+#include "WebScriptObject.h"
+
+#include <WTF/RefPtr.h>
+
+namespace WebCore {
+ class HTMLCollection;
+}
+
+class DOMHTMLCollection : public DOMObject, public IDOMHTMLCollection
+{
+protected:
+ DOMHTMLCollection(WebCore::HTMLCollection* c);
+
+public:
+ static IDOMHTMLCollection* createInstance(WebCore::HTMLCollection*);
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMHTMLCollection
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ UINT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE item(
+ /* [in] */ UINT index,
+ /* [retval][out] */ IDOMNode **node);
+
+ virtual HRESULT STDMETHODCALLTYPE namedItem(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNode **node);
+
+protected:
+ RefPtr<WebCore::HTMLCollection> m_collection;
+};
+
+class DOMHTMLOptionsCollection : public DOMObject, public IDOMHTMLOptionsCollection
+{
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMObject::setException(description); }
+
+ // IDOMHTMLOptionsCollection
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ unsigned int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setLength(
+ /* [in] */ unsigned int length);
+
+ virtual HRESULT STDMETHODCALLTYPE item(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ IDOMNode **result);
+
+ virtual HRESULT STDMETHODCALLTYPE namedItem(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNode *result);
+};
+
+class DOMHTMLDocument : public DOMDocument, public IDOMHTMLDocument
+{
+protected:
+ DOMHTMLDocument();
+public:
+ DOMHTMLDocument(WebCore::Document* d) : DOMDocument(d) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMDocument::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMDocument::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMDocument::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMDocument::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMDocument::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMDocument::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMDocument::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMDocument::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMDocument::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMDocument::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMDocument::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMDocument::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMDocument::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMDocument::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMDocument::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMDocument::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMDocument::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMDocument::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMDocument::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMDocument::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMDocument::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMDocument::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMDocument::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMDocument::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMDocument::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMDocument::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMDocument::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMDocument::setTextContent(text); }
+
+ // IDOMDocument
+ virtual HRESULT STDMETHODCALLTYPE doctype(
+ /* [retval][out] */ IDOMDocumentType **result) { return DOMDocument::doctype(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE implementation(
+ /* [retval][out] */ IDOMImplementation **result) { return DOMDocument::implementation(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE documentElement(
+ /* [retval][out] */ IDOMElement **result) { return DOMDocument::documentElement(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createElement(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMElement **result) { return DOMDocument::createElement(tagName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createDocumentFragment(
+ /* [retval][out] */ IDOMDocumentFragment **result) { return DOMDocument::createDocumentFragment(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createTextNode(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMText **result) { return DOMDocument::createTextNode(data, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createComment(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMComment **result) { return DOMDocument::createComment(data, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createCDATASection(
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMCDATASection **result) { return DOMDocument::createCDATASection(data, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createProcessingInstruction(
+ /* [in] */ BSTR target,
+ /* [in] */ BSTR data,
+ /* [retval][out] */ IDOMProcessingInstruction **result) { return DOMDocument::createProcessingInstruction(target, data, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMDocument::createAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createEntityReference(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMEntityReference **result) { return DOMDocument::createEntityReference(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR tagName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMDocument::getElementsByTagName(tagName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE importNode(
+ /* [in] */ IDOMNode *importedNode,
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMDocument::importNode(importedNode, deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createElementNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [retval][out] */ IDOMElement **result) { return DOMDocument::createElementNS(namespaceURI, qualifiedName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE createAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMDocument::createAttributeNS(namespaceURI, qualifiedName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMDocument::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementById(
+ /* [in] */ BSTR elementId,
+ /* [retval][out] */ IDOMElement **result) { return DOMDocument::getElementById(elementId, result); }
+
+ // IDOMHTMLDocument
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title);
+
+ virtual HRESULT STDMETHODCALLTYPE referrer(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE domain(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE URL(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE body(
+ /* [retval][out] */ IDOMHTMLElement **bodyElement);
+
+ virtual HRESULT STDMETHODCALLTYPE setBody(
+ /* [in] */ IDOMHTMLElement *body);
+
+ virtual HRESULT STDMETHODCALLTYPE images(
+ /* [retval][out] */ IDOMHTMLCollection **collection);
+
+ virtual HRESULT STDMETHODCALLTYPE applets(
+ /* [retval][out] */ IDOMHTMLCollection **collection);
+
+ virtual HRESULT STDMETHODCALLTYPE links(
+ /* [retval][out] */ IDOMHTMLCollection **collection);
+
+ virtual HRESULT STDMETHODCALLTYPE forms(
+ /* [retval][out] */ IDOMHTMLCollection **collection);
+
+ virtual HRESULT STDMETHODCALLTYPE anchors(
+ /* [retval][out] */ IDOMHTMLCollection **collection);
+
+ virtual HRESULT STDMETHODCALLTYPE cookie(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setCookie(
+ /* [in] */ BSTR cookie);
+
+ virtual HRESULT STDMETHODCALLTYPE open( void);
+
+ virtual HRESULT STDMETHODCALLTYPE close( void);
+
+ virtual HRESULT STDMETHODCALLTYPE write(
+ /* [in] */ BSTR text);
+
+ virtual HRESULT STDMETHODCALLTYPE writeln(
+ /* [in] */ BSTR text);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementById_(
+ /* [in] */ BSTR elementId,
+ /* [retval][out] */ IDOMElement **element);
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByName(
+ /* [in] */ BSTR elementName,
+ /* [retval][out] */ IDOMNodeList **nodeList);
+};
+
+class DOMHTMLElement : public DOMElement, public IDOMHTMLElement
+{
+protected:
+ DOMHTMLElement();
+public:
+ DOMHTMLElement(WebCore::Element* e) : DOMElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName);
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title);
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang);
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir);
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className);
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html);
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text);
+
+};
+
+class DOMHTMLFormElement : public DOMHTMLElement, public IDOMHTMLFormElement
+{
+protected:
+ DOMHTMLFormElement();
+public:
+ DOMHTMLFormElement(WebCore::Element* e) : DOMHTMLElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMHTMLElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMHTMLElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMHTMLElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMHTMLElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMHTMLElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMHTMLElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMHTMLElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMHTMLElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMHTMLElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMHTMLElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMHTMLElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMHTMLElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMHTMLElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMHTMLElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMHTMLElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::idName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName) { return DOMHTMLElement::setIdName(idName); }
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::title(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title) { return DOMHTMLElement::setTitle(title); }
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::lang(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang) { return DOMHTMLElement::setLang(lang); }
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::dir(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir) { return DOMHTMLElement::setDir(dir); }
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::className(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className) { return DOMHTMLElement::setClassName(className); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerHTML(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html) { return DOMHTMLElement::setInnerHTML(html); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerText(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setInnerText(text); }
+
+ // IDOMHTMLFormElement
+ virtual HRESULT STDMETHODCALLTYPE elements(
+ /* [retval][out] */ IDOMHTMLCollection **result);
+
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setName(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE acceptCharset(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAcceptCharset(
+ /* [in] */ BSTR acceptCharset);
+
+ virtual HRESULT STDMETHODCALLTYPE action(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAction(
+ /* [in] */ BSTR action);
+
+ virtual HRESULT STDMETHODCALLTYPE encType(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setEnctype(
+ /* [retval][out] */ BSTR *encType);
+
+ virtual HRESULT STDMETHODCALLTYPE method(
+ /* [retval][out] */ BSTR *method);
+
+ virtual HRESULT STDMETHODCALLTYPE setMethod(
+ /* [in] */ BSTR method);
+
+ virtual HRESULT STDMETHODCALLTYPE target(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTarget(
+ /* [in] */ BSTR target);
+
+ virtual HRESULT STDMETHODCALLTYPE submit( void);
+
+ virtual HRESULT STDMETHODCALLTYPE reset( void);
+};
+
+class DOMHTMLSelectElement : public DOMHTMLElement, public IDOMHTMLSelectElement, public IFormsAutoFillTransitionSelect
+{
+protected:
+ DOMHTMLSelectElement();
+public:
+ DOMHTMLSelectElement(WebCore::Element* e) : DOMHTMLElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMHTMLElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMHTMLElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMHTMLElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMHTMLElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMHTMLElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMHTMLElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMHTMLElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMHTMLElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMHTMLElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMHTMLElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMHTMLElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMHTMLElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMHTMLElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMHTMLElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMHTMLElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::idName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName) { return DOMHTMLElement::setIdName(idName); }
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::title(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title) { return DOMHTMLElement::setTitle(title); }
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::lang(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang) { return DOMHTMLElement::setLang(lang); }
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::dir(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir) { return DOMHTMLElement::setDir(dir); }
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::className(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className) { return DOMHTMLElement::setClassName(className); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerHTML(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html) { return DOMHTMLElement::setInnerHTML(html); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerText(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setInnerText(text); }
+
+ // IDOMHTMLSelectElement
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE selectedIndex(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setSelectedIndx(
+ /* [in] */ int selectedIndex);
+
+ virtual HRESULT STDMETHODCALLTYPE value(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE length(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE form(
+ /* [retval][out] */ IDOMHTMLFormElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE options(
+ /* [retval][out] */ IDOMHTMLOptionsCollection **result);
+
+ virtual HRESULT STDMETHODCALLTYPE disabled(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDisabled(
+ /* [in] */ BOOL disabled);
+
+ virtual HRESULT STDMETHODCALLTYPE multiple(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setMultiple(
+ /* [in] */ BOOL multiple);
+
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setName(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE size(
+ /* [retval][out] */ int *size);
+
+ virtual HRESULT STDMETHODCALLTYPE setSize(
+ /* [in] */ int size);
+
+ virtual HRESULT STDMETHODCALLTYPE tabIndex(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTabIndex(
+ /* [in] */ int tabIndex);
+
+ virtual HRESULT STDMETHODCALLTYPE add(
+ /* [in] */ IDOMHTMLElement *element,
+ /* [in] */ IDOMHTMLElement *before);
+
+ virtual HRESULT STDMETHODCALLTYPE remove(
+ /* [in] */ int index);
+
+ // IFormsAutoFillTransitionSelect
+ virtual HRESULT STDMETHODCALLTYPE activateItemAtIndex(
+ /* [in] */ int index);
+};
+
+class DOMHTMLOptionElement : public DOMHTMLElement, public IDOMHTMLOptionElement
+{
+protected:
+ DOMHTMLOptionElement();
+public:
+ DOMHTMLOptionElement(WebCore::Element* e) : DOMHTMLElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMHTMLElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMHTMLElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMHTMLElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMHTMLElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMHTMLElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMHTMLElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMHTMLElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMHTMLElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMHTMLElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMHTMLElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMHTMLElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMHTMLElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMHTMLElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMHTMLElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMHTMLElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::idName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName) { return DOMHTMLElement::setIdName(idName); }
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::title(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title) { return DOMHTMLElement::setTitle(title); }
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::lang(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang) { return DOMHTMLElement::setLang(lang); }
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::dir(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir) { return DOMHTMLElement::setDir(dir); }
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::className(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className) { return DOMHTMLElement::setClassName(className); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerHTML(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html) { return DOMHTMLElement::setInnerHTML(html); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerText(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setInnerText(text); }
+
+ // IDOMHTMLOptionElement
+ virtual HRESULT STDMETHODCALLTYPE form(
+ /* [retval][out] */ IDOMHTMLFormElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultSelected(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultSelected(
+ /* [in] */ BOOL defaultSelected);
+
+ virtual HRESULT STDMETHODCALLTYPE text(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE index(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE disabled(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDisabled(
+ /* [in] */ BOOL disabled);
+
+ virtual HRESULT STDMETHODCALLTYPE label(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setLabel(
+ /* [in] */ BSTR label);
+
+ virtual HRESULT STDMETHODCALLTYPE selected(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setSelected(
+ /* [in] */ BOOL selected);
+
+ virtual HRESULT STDMETHODCALLTYPE value(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ BSTR value);
+};
+
+class DOMHTMLInputElement : public DOMHTMLElement, public IDOMHTMLInputElement, public IFormsAutoFillTransition, public IFormPromptAdditions
+{
+protected:
+ DOMHTMLInputElement();
+public:
+ DOMHTMLInputElement(WebCore::Element* e) : DOMHTMLElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMHTMLElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMHTMLElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMHTMLElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMHTMLElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMHTMLElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMHTMLElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMHTMLElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMHTMLElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMHTMLElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMHTMLElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMHTMLElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMHTMLElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMHTMLElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMHTMLElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMHTMLElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::idName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName) { return DOMHTMLElement::setIdName(idName); }
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::title(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title) { return DOMHTMLElement::setTitle(title); }
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::lang(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang) { return DOMHTMLElement::setLang(lang); }
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::dir(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir) { return DOMHTMLElement::setDir(dir); }
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::className(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className) { return DOMHTMLElement::setClassName(className); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerHTML(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html) { return DOMHTMLElement::setInnerHTML(html); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerText(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setInnerText(text); }
+
+ // IDOMHTMLInputElement
+ virtual HRESULT STDMETHODCALLTYPE defaultValue(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultValue(
+ /* [in] */ BSTR val);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultChecked(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultChecked(
+ /* [in] */ BSTR checked);
+
+ virtual HRESULT STDMETHODCALLTYPE form(
+ /* [retval][out] */ IDOMHTMLElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE accept(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAccept(
+ /* [in] */ BSTR accept);
+
+ virtual HRESULT STDMETHODCALLTYPE accessKey(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAccessKey(
+ /* [in] */ BSTR key);
+
+ virtual HRESULT STDMETHODCALLTYPE align(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAlign(
+ /* [in] */ BSTR align);
+
+ virtual HRESULT STDMETHODCALLTYPE alt(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAlt(
+ /* [in] */ BSTR alt);
+
+ virtual HRESULT STDMETHODCALLTYPE checked(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setChecked(
+ /* [in] */ BOOL checked);
+
+ virtual HRESULT STDMETHODCALLTYPE disabled(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDisabled(
+ /* [in] */ BOOL disabled);
+
+ virtual HRESULT STDMETHODCALLTYPE maxLength(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setMaxLength(
+ /* [in] */ int maxLength);
+
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *name);
+
+ virtual HRESULT STDMETHODCALLTYPE setName(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE readOnly(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setReadOnly(
+ /* [in] */ BOOL readOnly);
+
+ virtual HRESULT STDMETHODCALLTYPE size(
+ /* [retval][out] */ unsigned int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setSize(
+ /* [in] */ unsigned int size);
+
+ virtual HRESULT STDMETHODCALLTYPE src(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setSrc(
+ /* [in] */ BSTR src);
+
+ virtual HRESULT STDMETHODCALLTYPE tabIndex(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTabIndex(
+ /* [in] */ int tabIndex);
+
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setType(
+ /* [in] */ BSTR type);
+
+ virtual HRESULT STDMETHODCALLTYPE useMap(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setUseMap(
+ /* [in] */ BSTR useMap);
+
+ virtual HRESULT STDMETHODCALLTYPE value(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE select( void);
+
+ virtual HRESULT STDMETHODCALLTYPE click( void);
+
+ virtual HRESULT STDMETHODCALLTYPE setSelectionStart(
+ /* [in] */ long start);
+
+ virtual HRESULT STDMETHODCALLTYPE selectionStart(
+ /* [retval][out] */ long *start);
+
+ virtual HRESULT STDMETHODCALLTYPE setSelectionEnd(
+ /* [in] */ long end);
+
+ virtual HRESULT STDMETHODCALLTYPE selectionEnd(
+ /* [retval][out] */ long *end);
+
+ // IFormsAutoFillTransition
+ virtual HRESULT STDMETHODCALLTYPE isTextField(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE rectOnScreen(
+ /* [retval][out] */ LPRECT rect);
+
+ virtual HRESULT STDMETHODCALLTYPE replaceCharactersInRange(
+ /* [in] */ int startTarget,
+ /* [in] */ int endTarget,
+ /* [in] */ BSTR replacementString,
+ /* [in] */ int index);
+
+ virtual HRESULT STDMETHODCALLTYPE selectedRange(
+ /* [out] */ int *start,
+ /* [out] */ int *end);
+
+ virtual HRESULT STDMETHODCALLTYPE setAutofilled(
+ /* [in] */ BOOL filled);
+
+ // IFormPromptAdditions
+ virtual HRESULT STDMETHODCALLTYPE isUserEdited(
+ /* [retval][out] */ BOOL *result);
+};
+
+class DOMHTMLTextAreaElement : public DOMHTMLElement, public IDOMHTMLTextAreaElement, public IFormPromptAdditions
+{
+protected:
+ DOMHTMLTextAreaElement();
+public:
+ DOMHTMLTextAreaElement(WebCore::Element* e) : DOMHTMLElement(e) {}
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMHTMLElement::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMHTMLElement::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::throwException(exceptionMessage, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::callWebScriptMethod(name, args, cArgs, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::evaluateWebScript(script, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeWebScriptKey(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation) { return DOMHTMLElement::stringRepresentation(stringRepresentation); }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result) { return DOMHTMLElement::webScriptValueAtIndex(index, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val) { return DOMHTMLElement::setWebScriptValueAtIndex(index, val); }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description) { return DOMHTMLElement::setException(description); }
+
+ // IDOMNode
+ virtual HRESULT STDMETHODCALLTYPE nodeName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeValue(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::nodeValue(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setNodeValue(
+ /* [in] */ BSTR value) { return DOMHTMLElement::setNodeValue(value); }
+
+ virtual HRESULT STDMETHODCALLTYPE nodeType(
+ /* [retval][out] */ unsigned short *result) { return DOMHTMLElement::nodeType(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE parentNode(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::parentNode(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE childNodes(
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::childNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE firstChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::firstChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE lastChild(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::lastChild(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE previousSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::previousSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE nextSibling(
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::nextSibling(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE attributes(
+ /* [retval][out] */ IDOMNamedNodeMap **result) { return DOMHTMLElement::attributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE ownerDocument(
+ /* [retval][out] */ IDOMDocument **result) { return DOMHTMLElement::ownerDocument(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE insertBefore(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *refChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::insertBefore(newChild, refChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE replaceChild(
+ /* [in] */ IDOMNode *newChild,
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::replaceChild(newChild, oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::removeChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE appendChild(
+ /* [in] */ IDOMNode *oldChild,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::appendChild(oldChild, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasChildNodes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE cloneNode(
+ /* [in] */ BOOL deep,
+ /* [retval][out] */ IDOMNode **result) { return DOMHTMLElement::cloneNode(deep, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMHTMLElement::normalize(); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSupported(
+ /* [in] */ BSTR feature,
+ /* [in] */ BSTR version,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::isSupported(feature, version, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE namespaceURI(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::namespaceURI(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE prefix(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::prefix(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setPrefix(
+ /* [in] */ BSTR prefix) { return DOMHTMLElement::setPrefix(prefix); }
+
+ virtual HRESULT STDMETHODCALLTYPE localName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::localName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributes(
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributes(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isSameNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isSameNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE isEqualNode(
+ /* [in] */ IDOMNode* other,
+ /* [retval][out] */ BOOL* result) { return DOMHTMLElement::isEqualNode(other, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE textContent(
+ /* [retval][out] */ BSTR* result) { return DOMHTMLElement::textContent(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTextContent(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setTextContent(text); }
+
+ // IDOMElement
+ virtual HRESULT STDMETHODCALLTYPE tagName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::tagName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttribute(
+ /* [in] */ BSTR name,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttribute(name, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttribute(
+ /* [in] */ BSTR name) { return DOMHTMLElement::removeAttribute(name); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNode(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNode(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
+ /* [in] */ IDOMAttr *oldAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::removeAttributeNode(oldAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagName(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::getAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR qualifiedName,
+ /* [in] */ BSTR value) { return DOMHTMLElement::setAttributeNS(namespaceURI, qualifiedName, value); }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName) { return DOMHTMLElement::removeAttributeNS(namespaceURI, localName); }
+
+ virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::getAttributeNodeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
+ /* [in] */ IDOMAttr *newAttr,
+ /* [retval][out] */ IDOMAttr **result) { return DOMHTMLElement::setAttributeNodeNS(newAttr, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ IDOMNodeList **result) { return DOMHTMLElement::getElementsByTagNameNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttribute(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttribute(name, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
+ /* [in] */ BSTR namespaceURI,
+ /* [in] */ BSTR localName,
+ /* [retval][out] */ BOOL *result) { return DOMHTMLElement::hasAttributeNS(namespaceURI, localName, result); }
+
+ virtual HRESULT STDMETHODCALLTYPE focus( void) { return DOMHTMLElement::focus(); }
+
+ virtual HRESULT STDMETHODCALLTYPE blur( void) { return DOMHTMLElement::blur(); }
+
+ // IDOMHTMLElement
+ virtual HRESULT STDMETHODCALLTYPE idName(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::idName(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setIdName(
+ /* [in] */ BSTR idName) { return DOMHTMLElement::setIdName(idName); }
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::title(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setTitle(
+ /* [in] */ BSTR title) { return DOMHTMLElement::setTitle(title); }
+
+ virtual HRESULT STDMETHODCALLTYPE lang(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::lang(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setLang(
+ /* [in] */ BSTR lang) { return DOMHTMLElement::setLang(lang); }
+
+ virtual HRESULT STDMETHODCALLTYPE dir(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::dir(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setDir(
+ /* [in] */ BSTR dir) { return DOMHTMLElement::setDir(dir); }
+
+ virtual HRESULT STDMETHODCALLTYPE className(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::className(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setClassName(
+ /* [in] */ BSTR className) { return DOMHTMLElement::setClassName(className); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerHTML(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerHTML(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerHTML(
+ /* [in] */ BSTR html) { return DOMHTMLElement::setInnerHTML(html); }
+
+ virtual HRESULT STDMETHODCALLTYPE innerText(
+ /* [retval][out] */ BSTR *result) { return DOMHTMLElement::innerText(result); }
+
+ virtual HRESULT STDMETHODCALLTYPE setInnerText(
+ /* [in] */ BSTR text) { return DOMHTMLElement::setInnerText(text); }
+
+ // IDOMHTMLTextArea
+ virtual HRESULT STDMETHODCALLTYPE defaultValue(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultValue(
+ /* [in] */ BSTR val);
+
+ virtual HRESULT STDMETHODCALLTYPE form(
+ /* [retval][out] */ IDOMHTMLElement **result);
+
+ virtual HRESULT STDMETHODCALLTYPE accessKey(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAccessKey(
+ /* [in] */ BSTR key);
+
+ virtual HRESULT STDMETHODCALLTYPE cols(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setCols(
+ /* [in] */ int cols);
+
+ virtual HRESULT STDMETHODCALLTYPE disabled(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setDisabled(
+ /* [in] */ BOOL disabled);
+
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *name);
+
+ virtual HRESULT STDMETHODCALLTYPE setName(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE readOnly(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setReadOnly(
+ /* [in] */ BOOL readOnly);
+
+ virtual HRESULT STDMETHODCALLTYPE rows(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setRows(
+ /* [in] */ int rows);
+
+ virtual HRESULT STDMETHODCALLTYPE tabIndex(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setTabIndex(
+ /* [in] */ int tabIndex);
+
+ virtual HRESULT STDMETHODCALLTYPE type(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE value(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE select( void);
+
+ // IFormPromptAdditions
+ virtual HRESULT STDMETHODCALLTYPE isUserEdited(
+ /* [retval][out] */ BOOL *result);
+};
+
+#endif
diff --git a/WebKit/win/DefaultDownloadDelegate.cpp b/WebKit/win/DefaultDownloadDelegate.cpp
new file mode 100644
index 0000000..e56d88e
--- /dev/null
+++ b/WebKit/win/DefaultDownloadDelegate.cpp
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "config.h"
+#include "WebKitDLL.h"
+#include "DefaultDownloadDelegate.h"
+
+#include "MarshallingHelpers.h"
+#include "WebKit.h"
+#include "WebKitLogging.h"
+#include "WebMutableURLRequest.h"
+
+#include <shlobj.h>
+#include <tchar.h>
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+
+// DefaultDownloadDelegate ----------------------------------------------------------------
+
+DefaultDownloadDelegate::DefaultDownloadDelegate()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+DefaultDownloadDelegate::~DefaultDownloadDelegate()
+{
+ gClassCount--;
+ HashSet<IWebDownload*>::iterator i = m_downloads.begin();
+ for (;i != m_downloads.end(); ++i)
+ (*i)->Release();
+}
+
+DefaultDownloadDelegate* DefaultDownloadDelegate::sharedInstance()
+{
+ static COMPtr<DefaultDownloadDelegate> shared;
+ if (!shared)
+ shared.adoptRef(DefaultDownloadDelegate::createInstance());
+ return shared.get();
+}
+
+DefaultDownloadDelegate* DefaultDownloadDelegate::createInstance()
+{
+ DefaultDownloadDelegate* instance = new DefaultDownloadDelegate();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDownloadDelegate))
+ *ppvObject = static_cast<IWebDownloadDelegate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE DefaultDownloadDelegate::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE DefaultDownloadDelegate::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::decideDestinationWithSuggestedFilename(IWebDownload *download, BSTR filename)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - decideDestinationWithSuggestedFilename %s", download, String(filename, SysStringLen(filename)).ascii().data());
+
+ TCHAR pathChars[MAX_PATH];
+ if (FAILED(SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, 0, 0, pathChars))) {
+ if (FAILED(download->setDestination(filename, true))) {
+ LOG_ERROR("Failed to set destination on file");
+ return E_FAIL;
+ }
+ return S_OK;
+ }
+
+ size_t fullLength = _tcslen(pathChars) + SysStringLen(filename) + 2;
+ BSTR full = SysAllocStringLen(0, (UINT)fullLength);
+ if (!full)
+ return E_OUTOFMEMORY;
+
+ _tcscpy_s(full, fullLength, pathChars);
+ _tcscat_s(full, fullLength, _T("\\"));
+ _tcscat_s(full, fullLength, filename);
+ BString fullPath;
+ fullPath.adoptBSTR(full);
+
+#ifndef NDEBUG
+ String debug((BSTR)fullPath, SysStringLen(BSTR(fullPath)));
+ LOG(Download, "Setting path to %s", debug.ascii().data());
+#endif
+
+ if (FAILED(download->setDestination(fullPath, true))) {
+ LOG_ERROR("Failed to set destination on file");
+ return E_FAIL;
+ }
+ return S_OK;
+}
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didCancelAuthenticationChallenge(IWebDownload* download, IWebURLAuthenticationChallenge* challenge)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didCancelAuthenticationChallenge %p", download, challenge);
+ download = 0;
+ challenge = 0;
+ return S_OK;
+}
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didCreateDestination(IWebDownload* download, BSTR destination)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didCreateDestination %s", download, String(destination, SysStringLen(destination)).ascii().data());
+ download = 0;
+ destination = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didReceiveAuthenticationChallenge(IWebDownload* download, IWebURLAuthenticationChallenge* challenge)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didReceiveAuthenticationChallenge %p", download, challenge);
+ download = 0;
+ challenge = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didReceiveDataOfLength(IWebDownload* download, unsigned length)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didReceiveDataOfLength %i", download, length);
+ download = 0;
+ length = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didReceiveResponse(IWebDownload* download, IWebURLResponse* response)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didReceiveResponse %p", download, response);
+ download = 0;
+ response = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::shouldDecodeSourceDataOfMIMEType(IWebDownload* download, BSTR encodingType, BOOL* shouldDecode)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - shouldDecodeSourceDataOfMIMEType %s", download, String(encodingType, SysStringLen(encodingType)).ascii().data());
+ download = 0;
+ encodingType = 0;
+ *shouldDecode = false;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::willResumeWithResponse(IWebDownload* download, IWebURLResponse* response, long long fromByte)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - willResumeWithResponse %p, %q", download, response, fromByte);
+ download = 0;
+ response = 0;
+ fromByte = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::willSendRequest(IWebDownload* download, IWebMutableURLRequest* request,
+ IWebURLResponse* redirectResponse, IWebMutableURLRequest** finalRequest)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - willSendRequest %p %p", download, request, redirectResponse);
+ download = 0;
+ redirectResponse = 0;
+ *finalRequest = request;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didBegin(IWebDownload* download)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didBegin", download);
+ registerDownload(download);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didFinish(IWebDownload* download)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didFinish", download);
+ unregisterDownload(download);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::didFailWithError(IWebDownload* download, IWebError* error)
+{
+ LOG(Download, "DefaultDownloadDelegate %p - didFailWithError %p", download, error);
+ unregisterDownload(download);
+ error = 0;
+ return S_OK;
+}
+
+void DefaultDownloadDelegate::registerDownload(IWebDownload* download)
+{
+ if (m_downloads.contains(download))
+ return;
+ download->AddRef();
+ m_downloads.add(download);
+}
+
+void DefaultDownloadDelegate::unregisterDownload(IWebDownload* download)
+{
+ if (m_downloads.contains(download)) {
+ download->Release();
+ m_downloads.remove(download);
+ }
+}
diff --git a/WebKit/win/DefaultDownloadDelegate.h b/WebKit/win/DefaultDownloadDelegate.h
new file mode 100644
index 0000000..6175170
--- /dev/null
+++ b/WebKit/win/DefaultDownloadDelegate.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef DefaultDownloadDelegate_h
+#define DefaultDownloadDelegate_h
+
+#include "COMPtr.h"
+#include "WebKit.h"
+
+#include <CFNetwork/CFURLDownloadPriv.h>
+#include <wtf/HashSet.h>
+
+class DefaultDownloadDelegate : public IWebDownloadDelegate
+{
+public:
+ static DefaultDownloadDelegate* sharedInstance();
+ static DefaultDownloadDelegate* createInstance();
+private:
+ DefaultDownloadDelegate();
+ ~DefaultDownloadDelegate();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebDownloadDelegate
+ virtual HRESULT STDMETHODCALLTYPE decideDestinationWithSuggestedFilename(IWebDownload *download, BSTR filename);
+ virtual HRESULT STDMETHODCALLTYPE didCancelAuthenticationChallenge(IWebDownload* download, IWebURLAuthenticationChallenge* challenge);
+ virtual HRESULT STDMETHODCALLTYPE didCreateDestination(IWebDownload* download, BSTR destination);
+ virtual HRESULT STDMETHODCALLTYPE didFailWithError(IWebDownload* download, IWebError* error);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveAuthenticationChallenge(IWebDownload* download, IWebURLAuthenticationChallenge* challenge);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveDataOfLength(IWebDownload* download, unsigned length);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveResponse(IWebDownload* download, IWebURLResponse* response);
+ virtual HRESULT STDMETHODCALLTYPE shouldDecodeSourceDataOfMIMEType(IWebDownload* download, BSTR encodingType, BOOL* shouldDecode);
+ virtual HRESULT STDMETHODCALLTYPE willResumeWithResponse(IWebDownload* download, IWebURLResponse* response, long long fromByte);
+ virtual HRESULT STDMETHODCALLTYPE willSendRequest(IWebDownload* download, IWebMutableURLRequest* request, IWebURLResponse* redirectResponse, IWebMutableURLRequest** finalRequest);
+ virtual HRESULT STDMETHODCALLTYPE didBegin(IWebDownload* download);
+ virtual HRESULT STDMETHODCALLTYPE didFinish(IWebDownload* download);
+
+ // DefaultDownloadDelegate
+ void registerDownload(IWebDownload*);
+ void unregisterDownload(IWebDownload*);
+protected:
+ ULONG m_refCount;
+
+ HashSet<IWebDownload*> m_downloads;
+};
+
+#endif
diff --git a/WebKit/win/DefaultPolicyDelegate.cpp b/WebKit/win/DefaultPolicyDelegate.cpp
new file mode 100644
index 0000000..71f9be9
--- /dev/null
+++ b/WebKit/win/DefaultPolicyDelegate.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "DefaultPolicyDelegate.h"
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// FIXME: move this enum to a separate header file when other code begins to use it.
+typedef enum WebExtraNavigationType {
+ WebNavigationTypePlugInRequest = WebNavigationTypeOther + 1
+} WebExtraNavigationType;
+
+// DefaultPolicyDelegate ----------------------------------------------------------------
+
+DefaultPolicyDelegate::DefaultPolicyDelegate()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+DefaultPolicyDelegate::~DefaultPolicyDelegate()
+{
+ gClassCount--;
+}
+
+DefaultPolicyDelegate* DefaultPolicyDelegate::sharedInstance()
+{
+ static COMPtr<DefaultPolicyDelegate> shared;
+ if (!shared)
+ shared.adoptRef(DefaultPolicyDelegate::createInstance());
+ return shared.get();
+}
+
+DefaultPolicyDelegate* DefaultPolicyDelegate::createInstance()
+{
+ DefaultPolicyDelegate* instance = new DefaultPolicyDelegate();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IWebPolicyDelegate))
+ *ppvObject = static_cast<IWebPolicyDelegate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE DefaultPolicyDelegate::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE DefaultPolicyDelegate::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForNavigationAction(
+ /*[in]*/ IWebView* webView,
+ /*[in]*/ IPropertyBag* actionInformation,
+ /*[in]*/ IWebURLRequest* request,
+ /*[in]*/ IWebFrame* /*frame*/,
+ /*[in]*/ IWebPolicyDecisionListener* listener)
+{
+ int navType = 0;
+ VARIANT var;
+ if (SUCCEEDED(actionInformation->Read(WebActionNavigationTypeKey, &var, 0))) {
+ V_VT(&var) = VT_I4;
+ navType = V_I4(&var);
+ }
+ COMPtr<IWebViewPrivate> wvPrivate(Query, webView);
+ if (wvPrivate) {
+ BOOL canHandleRequest = FALSE;
+ if (SUCCEEDED(wvPrivate->canHandleRequest(request, &canHandleRequest)) && canHandleRequest)
+ listener->use();
+ else if (navType == WebNavigationTypePlugInRequest)
+ listener->use();
+ else {
+ BSTR url;
+ // A file URL shouldn't fall through to here, but if it did,
+ // it would be a security risk to open it.
+ if (SUCCEEDED(request->URL(&url)) && !String(url, SysStringLen(url)).startsWith("file:")) {
+ // FIXME: Open the URL not by means of a webframe, but by handing it over to the system and letting it determine how to open that particular URL scheme. See documentation for [NSWorkspace openURL]
+ ;
+ }
+ listener->ignore();
+ SysFreeString(url);
+ }
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForNewWindowAction(
+ /*[in]*/ IWebView* /*webView*/,
+ /*[in]*/ IPropertyBag* /*actionInformation*/,
+ /*[in]*/ IWebURLRequest* /*request*/,
+ /*[in]*/ BSTR /*frameName*/,
+ /*[in]*/ IWebPolicyDecisionListener* listener)
+{
+ listener->use();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForMIMEType(
+ /*[in]*/ IWebView* webView,
+ /*[in]*/ BSTR type,
+ /*[in]*/ IWebURLRequest* request,
+ /*[in]*/ IWebFrame* /*frame*/,
+ /*[in]*/ IWebPolicyDecisionListener* listener)
+{
+ BOOL canShowMIMEType;
+ if (FAILED(webView->canShowMIMEType(type, &canShowMIMEType)))
+ canShowMIMEType = FALSE;
+
+ BSTR url;
+ request->URL(&url);
+
+ if (String(url, SysStringLen(url)).startsWith("file:")) {
+ BOOL isDirectory = FALSE;
+ WIN32_FILE_ATTRIBUTE_DATA attrs;
+ if (GetFileAttributesEx(url, GetFileExInfoStandard, &attrs))
+ isDirectory = !!(attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+
+ if (isDirectory)
+ listener->ignore();
+ else if(canShowMIMEType)
+ listener->use();
+ else
+ listener->ignore();
+ } else if (canShowMIMEType)
+ listener->use();
+ else
+ listener->ignore();
+ SysFreeString(url);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::unableToImplementPolicyWithError(
+ /*[in]*/ IWebView* /*webView*/,
+ /*[in]*/ IWebError* error,
+ /*[in]*/ IWebFrame* frame)
+{
+ BSTR errorStr;
+ error->localizedDescription(&errorStr);
+
+ BSTR frameName;
+ frame->name(&frameName);
+
+ LOG_ERROR("called unableToImplementPolicyWithError:%S inFrame:%S", errorStr ? errorStr : TEXT(""), frameName ? frameName : TEXT(""));
+ SysFreeString(errorStr);
+ SysFreeString(frameName);
+
+ return S_OK;
+}
diff --git a/WebKit/win/DefaultPolicyDelegate.h b/WebKit/win/DefaultPolicyDelegate.h
new file mode 100644
index 0000000..443cf8a
--- /dev/null
+++ b/WebKit/win/DefaultPolicyDelegate.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DefaultPolicyDelegate_h
+#define DefaultPolicyDelegate_h
+
+#include "COMPtr.h"
+#include "WebKit.h"
+
+class DefaultPolicyDelegate : public IWebPolicyDelegate {
+public:
+ static DefaultPolicyDelegate* sharedInstance();
+ static DefaultPolicyDelegate* createInstance();
+private:
+ DefaultPolicyDelegate();
+ ~DefaultPolicyDelegate();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebPolicyDelegate
+ virtual HRESULT STDMETHODCALLTYPE decidePolicyForNavigationAction(
+ /* [in] */ IWebView *webView,
+ /* [in] */ IPropertyBag *actionInformation,
+ /* [in] */ IWebURLRequest *request,
+ /* [in] */ IWebFrame *frame,
+ /* [in] */ IWebPolicyDecisionListener *listener);
+
+ virtual HRESULT STDMETHODCALLTYPE decidePolicyForNewWindowAction(
+ /* [in] */ IWebView *webView,
+ /* [in] */ IPropertyBag *actionInformation,
+ /* [in] */ IWebURLRequest *request,
+ /* [in] */ BSTR frameName,
+ /* [in] */ IWebPolicyDecisionListener *listener);
+
+ virtual HRESULT STDMETHODCALLTYPE decidePolicyForMIMEType(
+ /* [in] */ IWebView *webView,
+ /* [in] */ BSTR type,
+ /* [in] */ IWebURLRequest *request,
+ /* [in] */ IWebFrame *frame,
+ /* [in] */ IWebPolicyDecisionListener *listener);
+
+ virtual HRESULT STDMETHODCALLTYPE unableToImplementPolicyWithError(
+ /* [in] */ IWebView *webView,
+ /* [in] */ IWebError *error,
+ /* [in] */ IWebFrame *frame);
+
+protected:
+ ULONG m_refCount;
+};
+
+#endif // DefaultPolicyDelegate_h
diff --git a/WebKit/win/English.lproj/Localizable.strings b/WebKit/win/English.lproj/Localizable.strings
new file mode 100644
index 0000000..c2612c2
--- /dev/null
+++ b/WebKit/win/English.lproj/Localizable.strings
Binary files differ
diff --git a/WebKit/win/ForEachCoClass.cpp b/WebKit/win/ForEachCoClass.cpp
new file mode 100644
index 0000000..edc6a45
--- /dev/null
+++ b/WebKit/win/ForEachCoClass.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitDLL.h"
+#include "ForEachCoClass.h"
+
+#include <JavaScriptCore/Assertions.h>
+
+void setUseOpenSourceWebKit(bool b)
+{
+ s_progIDs = b ? openSourceProgIDs : productionProgIDs;
+}
+
+LPCOLESTR progIDForClass(WebKitClass cls)
+{
+ ASSERT(cls < WebKitClassSentinel);
+ return s_progIDs[cls];
+}
+
+
diff --git a/WebKit/win/ForEachCoClass.h b/WebKit/win/ForEachCoClass.h
new file mode 100644
index 0000000..e60a1ff
--- /dev/null
+++ b/WebKit/win/ForEachCoClass.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 ForEachCoClass_h
+#define ForEachCoClass_h
+
+#include "ProgIDMacros.h"
+
+#define FOR_EACH_COCLASS(macro) \
+ macro(CFDictionaryPropertyBag) \
+ macro(WebCache) \
+ macro(WebDatabaseManager) \
+ macro(WebDownload) \
+ macro(WebError) \
+ macro(WebHistory) \
+ macro(WebHistoryItem) \
+ macro(WebIconDatabase) \
+ macro(WebJavaScriptCollector) \
+ macro(WebKitStatistics) \
+ macro(WebMutableURLRequest) \
+ macro(WebNotificationCenter) \
+ macro(WebPreferences) \
+ macro(WebScrollBar) \
+ macro(WebScriptDebugServer) \
+ macro(WebTextRenderer) \
+ macro(WebURLCredential) \
+ macro(WebURLProtectionSpace) \
+ macro(WebURLRequest) \
+ macro(WebURLResponse) \
+ macro(WebView) \
+ // end of macro
+
+#define WEBKITCLASS_MEMBER(cls) cls##Class,
+enum WebKitClass {
+ FOR_EACH_COCLASS(WEBKITCLASS_MEMBER)
+ WebKitClassSentinel
+};
+#undef WEBKITCLASS_MEMBER
+
+#define PRODUCTION_PROGID(cls) VERSION_INDEPENDENT_PRODUCTION_PROGID(cls),
+static LPCOLESTR productionProgIDs[WebKitClassSentinel] = {
+ FOR_EACH_COCLASS(PRODUCTION_PROGID)
+};
+#undef PRODUCTION_PROGID
+
+#define OPENSOURCE_PROGID(cls) VERSION_INDEPENDENT_OPENSOURCE_PROGID(cls),
+static LPCOLESTR openSourceProgIDs[WebKitClassSentinel] = {
+ FOR_EACH_COCLASS(OPENSOURCE_PROGID)
+};
+#undef OPENSOURCE_PROGID
+
+#if __PRODUCTION__
+ static LPCOLESTR* s_progIDs = productionProgIDs;
+#else
+ static LPCOLESTR* s_progIDs = openSourceProgIDs;
+#endif
+
+#define PROGID(className) progIDForClass(className##Class)
+
+void setUseOpenSourceWebKit(bool);
+LPCOLESTR progIDForClass(WebKitClass);
+
+
+
+#endif // !defined(ForEachCoClass_h)
diff --git a/WebKit/win/GEN_DOMObject.cpp b/WebKit/win/GEN_DOMObject.cpp
new file mode 100644
index 0000000..1ba0875
--- /dev/null
+++ b/WebKit/win/GEN_DOMObject.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitDLL.h"
+
+#include "GEN_DOMObject.h"
+
+#include <wtf/Assertions.h>
+
+// DOMObject ------------------------------------------------------------
+
+GEN_DOMObject::GEN_DOMObject()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+GEN_DOMObject::~GEN_DOMObject()
+{
+ gClassCount--;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE GEN_DOMObject::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IGEN_DOMObject*>(this);
+ else if (IsEqualGUID(riid, IID_IGEN_DOMObject))
+ *ppvObject = static_cast<GEN_DOMObject*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE GEN_DOMObject::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE GEN_DOMObject::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
diff --git a/WebKit/win/GEN_DOMObject.h b/WebKit/win/GEN_DOMObject.h
new file mode 100644
index 0000000..bb654fb
--- /dev/null
+++ b/WebKit/win/GEN_DOMObject.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 GEN_DOMObject_h
+#define GEN_DOMObject_h
+
+#include "WebKit.h"
+
+class GEN_DOMObject : public IGEN_DOMObject {
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+protected:
+ GEN_DOMObject();
+ virtual ~GEN_DOMObject();
+
+ ULONG m_refCount;
+};
+
+#endif // GEN_DOMObject_h
diff --git a/WebKit/win/HTTPHeaderPropertyBag.cpp b/WebKit/win/HTTPHeaderPropertyBag.cpp
new file mode 100644
index 0000000..4c451fd
--- /dev/null
+++ b/WebKit/win/HTTPHeaderPropertyBag.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTTPHeaderPropertyBag.h"
+
+#include "HTTPHeaderMap.h"
+
+#include <WebCore/BString.h>
+
+// HTTPHeaderPropertyBag -----------------------------------------------
+
+HTTPHeaderPropertyBag::HTTPHeaderPropertyBag(WebURLResponse* response)
+ : m_refCount(1)
+ , m_response(response)
+{
+}
+
+HTTPHeaderPropertyBag* HTTPHeaderPropertyBag::createInstance(WebURLResponse* response)
+{
+ return new HTTPHeaderPropertyBag(response);
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE HTTPHeaderPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, __uuidof(HTTPHeaderPropertyBag)))
+ *ppvObject = this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE HTTPHeaderPropertyBag::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE HTTPHeaderPropertyBag::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+static inline WebCore::String ConvertFromLPCOLESTRToString(LPCOLESTR pszPropName)
+{
+ return WebCore::String(pszPropName);
+}
+
+static bool ConvertFromStringToVariant(VARIANT* pVar, const WebCore::String& stringVal)
+{
+ if (!pVar)
+ return false;
+
+ if (V_VT(pVar) == VT_BSTR) {
+ V_BSTR(pVar) = WebCore::BString(stringVal);
+ return true;
+ }
+
+ return false;
+}
+
+// IPropertyBag ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE HTTPHeaderPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* /*pErrorLog*/)
+{
+ if (!pszPropName)
+ return E_POINTER;
+
+ if (!m_response)
+ return E_FAIL;
+
+ const WebCore::HTTPHeaderMap& headerMap = m_response->resourceResponse().httpHeaderFields();
+ WebCore::String key = ConvertFromLPCOLESTRToString(pszPropName);
+ WebCore::String value = headerMap.get(key);
+
+ if (!ConvertFromStringToVariant(pVar, value))
+ return E_INVALIDARG;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE HTTPHeaderPropertyBag::Write(LPCOLESTR /*pszPropName*/, VARIANT* /*pVar*/)
+{
+ // We cannot add to the Resource Response's header hash map
+ return E_FAIL;
+}
diff --git a/WebKit/win/HTTPHeaderPropertyBag.h b/WebKit/win/HTTPHeaderPropertyBag.h
new file mode 100644
index 0000000..ddcfc15
--- /dev/null
+++ b/WebKit/win/HTTPHeaderPropertyBag.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTTPHeaderPropertyBag_H
+#define HTTPHeaderPropertyBag_H
+
+#include "WebURLResponse.h"
+#include <wtf/RetainPtr.h>
+
+class __declspec(uuid("3DBD89EB-CEFB-4ddb-8D1A-5BE47ED4E929")) HTTPHeaderPropertyBag : public IPropertyBag {
+
+public:
+ static HTTPHeaderPropertyBag* createInstance(WebURLResponse*);
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IPropertyBag
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [out][in] */ VARIANT *pVar,
+ /* [in] */ IErrorLog *pErrorLog);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [in] */ VARIANT *pVar);
+
+protected:
+ virtual ~HTTPHeaderPropertyBag() {}
+
+private:
+ HTTPHeaderPropertyBag(WebURLResponse*);
+
+ RetainPtr<WebURLResponse> m_response;
+ ULONG m_refCount;
+};
+
+#endif //HTTPHeaderPropertyBag_H
diff --git a/WebKit/win/Interfaces/DOMCSS.idl b/WebKit/win/Interfaces/DOMCSS.idl
new file mode 100644
index 0000000..3727018
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMCSS.idl
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+import "IWebScriptObject.idl";
+#endif
+
+interface IDOMObject;
+interface IDOMCSSValue;
+interface IDOMCSSStyleDeclaration;
+interface IDOMCSSStyleSheet;
+interface IDOMCSSRule;
+interface IDOMElement;
+
+/*
+ @interface DOMDocument (DOMViewCSS)
+*/
+[
+ object,
+ oleautomation,
+ uuid(43EFE238-A4DF-400a-983D-FCE0C0F56BCD),
+ pointer_default(unique)
+]
+interface IDOMViewCSS : IUnknown
+{
+ /*
+ - (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)elt :(NSString *)pseudoElt;
+ */
+ HRESULT getComputedStyle([in] IDOMElement* elt, [in] BSTR pseudoElt, [out, retval] IDOMCSSStyleDeclaration** result);
+}
+
+/*
+ @interface DOMCSSRuleList : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(D45DA43D-5EDB-4315-A097-3ED3FA089193),
+ pointer_default(unique)
+]
+interface IDOMCSSRuleList : IDOMObject
+{
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+
+ /*
+ - (DOMCSSRule *)item:(unsigned)index;
+ */
+ HRESULT item([in] UINT index, [out, retval] IDOMCSSRule** result);
+}
+
+/*
+ @interface DOMCSSRule : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(05947A31-9E1C-4c98-8608-6688959D6542),
+ pointer_default(unique)
+]
+interface IDOMCSSRule : IDOMObject
+{
+ /*
+ - (unsigned short)type;
+ */
+ HRESULT type([out, retval] unsigned short* result);
+
+ /*
+ - (NSString *)cssText;
+ */
+ HRESULT cssText([out, retval] BSTR* text);
+
+ /*
+ - (void)setCssText:(NSString *)cssText;
+ */
+ HRESULT setCssText([in] BSTR cssText);
+
+ /*
+ - (DOMCSSStyleSheet *)parentStyleSheet;
+ */
+ HRESULT parentStyleSheet([out, retval] IDOMCSSStyleSheet** sheet);
+
+ /*
+ - (DOMCSSRule *)parentRule;
+ */
+ HRESULT parentRule([out, retval] IDOMCSSRule** rule);
+}
+
+/*
+ @interface DOMCSSStyleDeclaration : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(DBBE9A6B-D505-4647-B4AB-40A7CF3EE63E),
+ pointer_default(unique)
+]
+interface IDOMCSSStyleDeclaration : IDOMObject
+{
+ /*
+ - (NSString *)cssText;
+ */
+ HRESULT cssText([out, retval] BSTR* result);
+
+ /*
+ - (void)setCssText:(NSString *)cssText;
+ */
+ HRESULT setCssText([in] BSTR cssText);
+
+ /*
+ - (NSString *)getPropertyValue:(NSString *)propertyName;
+ */
+ HRESULT getPropertyValue([in] BSTR propertyName, [out, retval] BSTR* result);
+
+ /*
+ - (DOMCSSValue *)getPropertyCSSValue:(NSString *)propertyName;
+ */
+ HRESULT getPropertyCSSValue([in] BSTR propertyName, [out, retval] IDOMCSSValue** result);
+
+ /*
+ - (NSString *)removeProperty:(NSString *)propertyName;
+ */
+ HRESULT removeProperty([in] BSTR propertyName, [out, retval] BSTR* result);
+
+ /*
+ - (NSString *)getPropertyPriority:(NSString *)propertyName;
+ */
+ HRESULT getPropertyPriority([in] BSTR propertyName, [out, retval] BSTR* result);
+
+ /*
+ - (void)setProperty:(NSString *)propertyName :(NSString *)value :(NSString *)priority;
+ */
+ HRESULT setProperty([in] BSTR propertyName, [in] BSTR value, [in] BSTR priority);
+
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+
+ /*
+ - (NSString *)item:(unsigned)index;
+ */
+ HRESULT item([in] UINT index, [out, retval] BSTR* result);
+
+ /*
+ - (DOMCSSRule *)parentRule;
+ */
+ HRESULT parentRule([out, retval] IDOMCSSRule** result);
+}
+
+/*
+ @interface DOMCSSValue : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(51D29553-2AF7-4f52-AFE6-3C59196A8BAA),
+ pointer_default(unique)
+]
+interface IDOMCSSValue : IDOMObject
+{
+ /*
+ - (NSString *)cssText;
+ */
+ HRESULT cssText([out, retval] BSTR* text);
+
+ /*
+ - (void)setCssText:(NSString *)cssText;
+ */
+ HRESULT setCssText([in] BSTR text);
+
+ /*
+ - (unsigned short)cssValueType;
+ */
+ HRESULT cssValueType([out, retval] unsigned short *valueType);
+}
+
+/*
+ @interface DOMCSSStyleSheet : DOMStyleSheet
+*/
+[
+ object,
+ oleautomation,
+ uuid(14B1C213-1458-48a1-AD8F-54BFE64F9ECF),
+ pointer_default(unique)
+]
+interface IDOMCSSStyleSheet : IDOMObject
+{
+ /*
+ - (DOMCSSRule *)ownerRule;
+ */
+ HRESULT ownerRule([out, retval] IDOMCSSRule** rule);
+
+ /*
+ - (DOMCSSRuleList *)cssRules;
+ */
+ HRESULT cssRules([out, retval] IDOMCSSRuleList** ruleList);
+
+ /*
+ - (unsigned)insertRule:(NSString *)rule :(unsigned)index;
+ */
+ HRESULT insertRule([in] BSTR rule, [in] UINT index, [out, retval] UINT* result);
+
+ /*
+ - (void)deleteRule:(unsigned)index;
+ */
+ HRESULT deleteRule([in] UINT index);
+}
+
+/*
+ @interface DOMElement (DOMElementCSSInlineStyle)
+*/
+[
+ object,
+ oleautomation,
+ uuid(585127E2-D698-44c4-83EC-4D1E6E07E90D),
+ pointer_default(unique)
+]
+interface IDOMElementCSSInlineStyle : IUnknown
+{
+ /*
+ - (DOMCSSStyleDeclaration *)style;
+ */
+ HRESULT style([out, retval] IDOMCSSStyleDeclaration** result);
+}
diff --git a/WebKit/win/Interfaces/DOMCore.idl b/WebKit/win/Interfaces/DOMCore.idl
new file mode 100644
index 0000000..09f61fb
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMCore.idl
@@ -0,0 +1,828 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScriptObject.idl";
+#endif
+
+interface IWebScriptObject;
+interface IDOMNodeList;
+interface IDOMNamedNodeMap;
+interface IDOMDocumentType;
+interface IDOMElement;
+interface IDOMDocumentFragment;
+interface IDOMText;
+interface IDOMComment;
+interface IDOMCDATASection;
+interface IDOMProcessingInstruction;
+interface IDOMAttr;
+interface IDOMEntityReference;
+interface IDOMDocument;
+interface IDOMCSSStyleDeclaration;
+/*
+ @interface DOMObject : WebScriptObject <NSCopying>
+*/
+[
+ object,
+ oleautomation,
+ uuid(A27FA225-F34E-425d-88EB-A35BD105A527),
+ pointer_default(unique)
+]
+interface IDOMObject : IWebScriptObject
+{
+}
+
+/*
+ @interface DOMImplementation : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(6E48C25D-E542-4d1a-BC73-ACDC21E39C56),
+ pointer_default(unique)
+]
+interface IDOMImplementation : IDOMObject
+{
+ /*
+ - (BOOL)hasFeature:(NSString *)feature :(NSString *)version;
+ */
+ HRESULT hasFeature([in] BSTR feature, [in] BSTR version, [out, retval] BOOL* result);
+
+ /*
+ - (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId;
+ */
+ HRESULT createDocumentType([in] BSTR qualifiedName, [in] BSTR publicId, [in] BSTR systemId, [out, retval] IDOMDocumentType** result);
+
+ /*
+ - (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype;
+ */
+ HRESULT createDocument([in] BSTR namespaceURI, [in] BSTR qualifiedName, [in] IDOMDocumentType* doctype, [out, retval] IDOMDocument** result);
+}
+
+/*
+ @interface DOMNode : DOMObject <DOMEventTarget>
+*/
+[
+ object,
+ oleautomation,
+ uuid(3EEA3E20-72DA-4be7-954F-79B5A14AD726),
+ pointer_default(unique)
+]
+interface IDOMNode : IDOMObject
+{
+ /*
+ - (NSString *)nodeName;
+ */
+ HRESULT nodeName([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)nodeValue;
+ */
+ HRESULT nodeValue([out, retval] BSTR* result);
+
+ /*
+ - (void)setNodeValue:(NSString *)string;
+ */
+ HRESULT setNodeValue([in] BSTR value);
+
+ /*
+ - (unsigned short)nodeType;
+ */
+ HRESULT nodeType([out, retval] unsigned short* result);
+
+ /*
+ - (DOMNode *)parentNode;
+ */
+ HRESULT parentNode([out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNodeList *)childNodes;
+ */
+ HRESULT childNodes([out, retval] IDOMNodeList** result);
+
+ /*
+ - (DOMNode *)firstChild;
+ */
+ HRESULT firstChild([out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)lastChild;
+ */
+ HRESULT lastChild([out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)previousSibling;
+ */
+ HRESULT previousSibling([out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)nextSibling;
+ */
+ HRESULT nextSibling([out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNamedNodeMap *)attributes;
+ */
+ HRESULT attributes([out, retval] IDOMNamedNodeMap** result);
+
+ /*
+ - (DOMDocument *)ownerDocument;
+ */
+ HRESULT ownerDocument([out, retval] IDOMDocument** result);
+
+ /*
+ - (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild;
+ */
+ HRESULT insertBefore([in] IDOMNode* newChild, [in] IDOMNode* refChild, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild;
+ */
+ HRESULT replaceChild([in] IDOMNode* newChild, [in] IDOMNode* oldChild, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)removeChild:(DOMNode *)oldChild;
+ */
+ HRESULT removeChild([in] IDOMNode* oldChild, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)appendChild:(DOMNode *)newChild;
+ */
+ HRESULT appendChild([in] IDOMNode* oldChild, [out, retval] IDOMNode** result);
+
+ /*
+ - (BOOL)hasChildNodes;
+ */
+ HRESULT hasChildNodes([out, retval] BOOL* result);
+
+ /*
+ - (DOMNode *)cloneNode:(BOOL)deep;
+ */
+ HRESULT cloneNode([in] BOOL deep, [out, retval] IDOMNode** result);
+
+ /*
+ - (void)normalize;
+ */
+ HRESULT normalize();
+
+ /*
+ - (BOOL)isSupported:(NSString *)feature :(NSString *)version;
+ */
+ HRESULT isSupported([in] BSTR feature, [in] BSTR version, [out, retval] BOOL* result);
+
+ /*
+ - (NSString *)namespaceURI;
+ */
+ HRESULT namespaceURI([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)prefix;
+ */
+ HRESULT prefix([out, retval] BSTR* result);
+
+ /*
+ - (void)setPrefix:(NSString *)prefix;
+ */
+ HRESULT setPrefix([in] BSTR prefix);
+
+ /*
+ - (NSString *)localName;
+ */
+ HRESULT localName([out, retval] BSTR* result);
+
+ /*
+ - (BOOL)hasAttributes;
+ */
+ HRESULT hasAttributes([out, retval] BOOL* result);
+
+ /*
+ - (BOOL)isSameNode:(DOMNode *)other;
+ */
+ HRESULT isSameNode([in] IDOMNode* other, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)isEqualNode:(DOMNode *)other;
+ */
+ HRESULT isEqualNode([in] IDOMNode* other, [out, retval] BOOL* result);
+
+ /*
+ - (NSString *)textContent;
+ */
+ HRESULT textContent([out, retval] BSTR* result);
+
+ /*
+ - (void)setTextContent:(NSString *)text;
+ */
+ HRESULT setTextContent([in] BSTR text);
+}
+
+/*
+ @interface DOMNodeList : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(10A05A96-CBD9-4493-83AD-FAFB952615CE),
+ pointer_default(unique)
+]
+interface IDOMNodeList : IDOMObject
+{
+ /*
+ - (DOMNode *)item:(unsigned)index;
+ */
+ HRESULT item([in] UINT index, [out, retval] IDOMNode** result);
+
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+}
+
+/*
+ @interface DOMNamedNodeMap : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(E6CBF396-C9F9-431b-A8D6-BCB525067E9F),
+ pointer_default(unique)
+]
+interface IDOMNamedNodeMap : IDOMObject
+{
+ /*
+ - (DOMNode *)getNamedItem:(NSString *)name;
+ */
+ HRESULT getNamedItem([in] BSTR name, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)setNamedItem:(DOMNode *)arg;
+ */
+ HRESULT setNamedItem([in] IDOMNode* arg, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)removeNamedItem:(NSString *)name;
+ */
+ HRESULT removeNamedItem([in] BSTR name, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)item:(unsigned)index;
+ */
+ HRESULT item([in] UINT index, [out, retval] IDOMNode** result);
+
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+
+ /*
+ - (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT getNamedItemNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)setNamedItemNS:(DOMNode *)arg;
+ */
+ HRESULT setNamedItemNS([in] IDOMNode* arg, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT removeNamedItemNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] IDOMNode** result);
+}
+
+/*
+ @interface DOMDocument : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(A83C2C44-0BAC-45c7-8E17-6A49975D5CCA),
+ pointer_default(unique)
+]
+interface IDOMDocument : IDOMNode
+{
+ /*
+ - (DOMDocumentType *)doctype;
+ */
+ HRESULT doctype([out, retval] IDOMDocumentType** result);
+
+ /*
+ - (DOMImplementation *)implementation;
+ */
+ HRESULT implementation([out, retval] IDOMImplementation** result);
+
+ /*
+ - (DOMElement *)documentElement;
+ */
+ HRESULT documentElement([out, retval] IDOMElement** result);
+
+ /*
+ - (DOMElement *)createElement:(NSString *)tagName;
+ */
+ HRESULT createElement([in] BSTR tagName, [out, retval] IDOMElement** result);
+
+ /*
+ - (DOMDocumentFragment *)createDocumentFragment;
+ */
+ HRESULT createDocumentFragment([out, retval] IDOMDocumentFragment** result);
+
+ /*
+ - (DOMText *)createTextNode:(NSString *)data;
+ */
+ HRESULT createTextNode([in] BSTR data, [out, retval] IDOMText** result);
+
+ /*
+ - (DOMComment *)createComment:(NSString *)data;
+ */
+ HRESULT createComment([in] BSTR data, [out, retval] IDOMComment** result);
+
+ /*
+ - (DOMCDATASection *)createCDATASection:(NSString *)data;
+ */
+ HRESULT createCDATASection([in] BSTR data, [out, retval] IDOMCDATASection** result);
+
+ /*
+ - (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data;
+ */
+ HRESULT createProcessingInstruction([in] BSTR target, [in] BSTR data, [out, retval] IDOMProcessingInstruction** result);
+
+ /*
+ - (DOMAttr *)createAttribute:(NSString *)name;
+ */
+ HRESULT createAttribute([in] BSTR name, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMEntityReference *)createEntityReference:(NSString *)name;
+ */
+ HRESULT createEntityReference([in] BSTR name, [out, retval] IDOMEntityReference** result);
+
+ /*
+ - (DOMNodeList *)getElementsByTagName:(NSString *)tagname;
+ */
+ HRESULT getElementsByTagName([in] BSTR tagName, [out, retval] IDOMNodeList** result);
+
+ /*
+ - (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep;
+ */
+ HRESULT importNode([in] IDOMNode* importedNode, [in] BOOL deep, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
+ */
+ HRESULT createElementNS([in] BSTR namespaceURI, [in] BSTR qualifiedName, [out, retval] IDOMElement** result);
+
+ /*
+ - (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName;
+ */
+ HRESULT createAttributeNS([in] BSTR namespaceURI, [in] BSTR qualifiedName, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT getElementsByTagNameNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] IDOMNodeList** result);
+
+ /*
+ - (DOMElement *)getElementById:(NSString *)elementId;
+ */
+ HRESULT getElementById([in] BSTR elementId, [out, retval] IDOMElement** result);
+}
+
+/*
+ @interface DOMCharacterData : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(F4DED047-FE61-461a-BDBD-BB87F79DB713),
+ pointer_default(unique)
+]
+interface IDOMCharacterData : IDOMNode
+{
+ /*
+ - (NSString *)data;
+ */
+ HRESULT data([out, retval] BSTR* result);
+
+ /*
+ - (void)setData:(NSString *)data;
+ */
+ HRESULT setData([in] BSTR data);
+
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+
+ /*
+ - (NSString *)substringData:(unsigned)offset :(unsigned)count;
+ */
+ HRESULT substringData([in] UINT offset, [in] UINT count, [out, retval] BSTR* result);
+
+ /*
+ - (void)appendData:(NSString *)arg;
+ */
+ HRESULT appendData([in] BSTR arg);
+
+ /*
+ - (void)insertData:(unsigned)offset :(NSString *)arg;
+ */
+ HRESULT insertData([in] UINT offset, [in] BSTR arg);
+
+ /*
+ - (void)deleteData:(unsigned)offset :(unsigned) count;
+ */
+ HRESULT deleteData([in] UINT offset, [in] UINT count);
+
+ /*
+ - (void)replaceData:(unsigned)offset :(unsigned)count :(NSString *)arg;
+ */
+ HRESULT replaceData([in] UINT offset, [in] UINT count, [in] BSTR arg);
+}
+
+/*
+ @interface DOMAttr : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(B587E098-8206-4b5a-A7DB-422F218571A0),
+ pointer_default(unique)
+]
+interface IDOMAttr : IDOMNode
+{
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* result);
+
+ /*
+ - (BOOL)specified;
+ */
+ HRESULT specified([out, retval] BOOL* result);
+
+ /*
+ - (NSString *)value;
+ */
+ HRESULT value([out, retval] BSTR* value);
+
+ /*
+ - (void)setValue:(NSString *)value;
+ */
+ HRESULT setValue([in] BSTR value);
+
+ /*
+ - (DOMElement *)ownerElement;
+ */
+ HRESULT ownerElement([out, retval] IDOMElement** result);
+}
+
+/*
+ @interface DOMElement : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(E053A35B-7775-4859-80EA-C35D02D145A2),
+ pointer_default(unique)
+]
+interface IDOMElement : IDOMNode
+{
+ /*
+ - (NSString *)tagName;
+ */
+ HRESULT tagName([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)getAttribute:(NSString *)name;
+ */
+ HRESULT getAttribute([in] BSTR name, [out, retval] BSTR* result);
+
+ /*
+ - (void)setAttribute:(NSString *)name :(NSString *)value;
+ */
+ HRESULT setAttribute([in] BSTR name, [in] BSTR value);
+
+ /*
+ - (void)removeAttribute:(NSString *)name;
+ */
+ HRESULT removeAttribute([in] BSTR name);
+
+ /*
+ - (DOMAttr *)getAttributeNode:(NSString *)name;
+ */
+ HRESULT getAttributeNode([in] BSTR name, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr;
+ */
+ HRESULT setAttributeNode([in] IDOMAttr* newAttr, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr;
+ */
+ HRESULT removeAttributeNode([in] IDOMAttr* oldAttr, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMNodeList *)getElementsByTagName:(NSString *)name;
+ */
+ HRESULT getElementsByTagName([in] BSTR name, [out, retval] IDOMNodeList** result);
+
+ /*
+ - (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT getAttributeNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] BSTR* result);
+
+ /*
+ - (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value;
+ */
+ HRESULT setAttributeNS([in] BSTR namespaceURI, [in] BSTR qualifiedName, [in] BSTR value);
+
+ /*
+ - (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT removeAttributeNS([in] BSTR namespaceURI, [in] BSTR localName);
+
+ /*
+ - (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT getAttributeNodeNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr;
+ */
+ HRESULT setAttributeNodeNS([in] IDOMAttr* newAttr, [out, retval] IDOMAttr** result);
+
+ /*
+ - (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT getElementsByTagNameNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] IDOMNodeList** result);
+
+ /*
+ - (BOOL)hasAttribute:(NSString *)name;
+ */
+ HRESULT hasAttribute([in] BSTR name, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName;
+ */
+ HRESULT hasAttributeNS([in] BSTR namespaceURI, [in] BSTR localName, [out, retval] BOOL* result);
+
+ /*
+ - (void)focus;
+ */
+ HRESULT focus();
+
+ /*
+ - (void)blur;
+ */
+ HRESULT blur();
+}
+
+/*
+ @interface DOMElement (DOMElementExtensions)
+*/
+[
+ object,
+ oleautomation,
+ uuid(98E481F5-4405-4c2a-BF77-1CE95FE5F992),
+ pointer_default(unique)
+]
+interface IDOMElementExtensions : IUnknown
+{
+ /*
+ - (int)offsetLeft;
+ */
+ HRESULT offsetLeft([out, retval] int* result);
+
+ /*
+ - (int)offsetTop;
+ */
+ HRESULT offsetTop([out, retval] int* result);
+
+ /*
+ - (int)offsetWidth;
+ */
+ HRESULT offsetWidth([out, retval] int* result);
+
+ /*
+ - (int)offsetHeight;
+ */
+ HRESULT offsetHeight([out, retval] int* result);
+
+ /*
+ - (DOMElement *)offsetParent;
+ */
+ HRESULT offsetParent([out, retval] IDOMElement** result);
+
+ /*
+ - (int)clientWidth;
+ */
+ HRESULT clientWidth([out, retval] int* result);
+
+ /*
+ - (int)clientHeight;
+ */
+ HRESULT clientHeight([out, retval] int* result);
+
+ /*
+ - (int)scrollLeft;
+ */
+ HRESULT scrollLeft([out, retval] int* result);
+
+ /*
+ - (void)setScrollLeft:(int)newScrollLeft;
+ */
+ HRESULT setScrollLeft([in] int newScrollLeft);
+
+ /*
+ - (int)scrollTop;
+ */
+ HRESULT scrollTop([out, retval] int* result);
+
+ /*
+ - (void)setScrollTop:(int)newScrollTop;
+ */
+ HRESULT setScrollTop([in] int newScrollTop);
+
+ /*
+ - (int)scrollWidth;
+ */
+ HRESULT scrollWidth([out, retval] int* result);
+
+ /*
+ - (int)scrollHeight;
+ */
+ HRESULT scrollHeight([out, retval] int* result);
+
+ /*
+ - (void)scrollIntoView:(BOOL)alignWithTop;
+ */
+ HRESULT scrollIntoView([in] BOOL alignWithTop);
+
+ /*
+ - (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded;
+ */
+ HRESULT scrollIntoViewIfNeeded([in] BOOL centerIfNeeded);
+}
+
+/*
+ @interface DOMText : DOMCharacterData
+*/
+[
+ object,
+ oleautomation,
+ uuid(74638F45-1AA0-4db5-958C-82066E00BD2B),
+ pointer_default(unique)
+]
+interface IDOMText : IDOMCharacterData
+{
+ /*
+ - (DOMText *)splitText:(unsigned)offset;
+ */
+ HRESULT splitText([in] UINT offset, [out, retval] IDOMText** result);
+}
+
+/*
+ @interface DOMComment : DOMCharacterData
+*/
+[
+ object,
+ oleautomation,
+ uuid(118002E8-847F-4b1a-968C-B25A6AC7B128),
+ pointer_default(unique)
+]
+interface IDOMComment : IDOMCharacterData
+{
+}
+
+/*
+ @interface DOMCDATASection : DOMText
+*/
+[
+ object,
+ oleautomation,
+ uuid(31B506C1-45A3-4d72-815A-311B0A897E58),
+ pointer_default(unique)
+]
+interface IDOMCDATASection : IDOMText
+{
+}
+
+/*
+ @interface DOMDocumentType : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(17FCE6EA-4164-4bd4-9DBF-0395FBF37FD3),
+ pointer_default(unique)
+]
+interface IDOMDocumentType : IDOMNode
+{
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* result);
+
+ /*
+ - (DOMNamedNodeMap *)entities;
+ */
+ HRESULT entities([out, retval] IDOMNamedNodeMap** result);
+
+ /*
+ - (DOMNamedNodeMap *)notations;
+ */
+ HRESULT notations([out, retval] IDOMNamedNodeMap** result);
+
+ /*
+ - (NSString *)publicId;
+ */
+ HRESULT publicId([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)systemId;
+ */
+ HRESULT systemId([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)internalSubset;
+ */
+ HRESULT internalSubset([out, retval] BSTR* result);
+}
+
+/*
+ @interface DOMEntityReference : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(0593CE45-15B2-44af-BBD0-5A1654F8240E),
+ pointer_default(unique)
+]
+interface IDOMEntityReference : IDOMNode
+{
+}
+
+/*
+ @interface DOMProcessingInstruction : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(D99D2F48-ABF3-426a-9339-54681E1AFCA9),
+ pointer_default(unique)
+]
+interface IDOMProcessingInstruction : IDOMNode
+{
+ /*
+ - (NSString *)target;
+ */
+ HRESULT target([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)data;
+ */
+ HRESULT data([out, retval] BSTR* result);
+
+ /*
+ - (void)setData:(NSString *)data;
+ */
+ HRESULT setData([in] BSTR data);
+}
+
+/*
+ @interface DOMDocumentFragment : IDOMNode
+*/
+[
+ object,
+ oleautomation,
+ uuid(09D35665-8396-4868-949E-8AA2407A6E10),
+ pointer_default(unique)
+]
+interface IDOMDocumentFragment : IDOMNode
+{
+}
diff --git a/WebKit/win/Interfaces/DOMEvents.idl b/WebKit/win/Interfaces/DOMEvents.idl
new file mode 100644
index 0000000..3ff7fce
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMEvents.idl
@@ -0,0 +1,478 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+import "DOMWindow.idl";
+#endif
+
+interface IDOMEvent;
+interface IDOMEventException;
+interface IDOMEventTarget;
+interface IDOMKeyboardEvent;
+interface IDOMMouseEvent;
+interface IDOMMutationEvent;
+interface IDOMNode;
+interface IDOMOverflowEvent;
+interface IDOMUIEvent;
+interface IDOMWheelEvent;
+interface IDOMWindow;
+
+typedef long long DOMTimeStamp;
+
+[
+ object,
+ oleautomation,
+ uuid(7f8a0a96-f864-44fb-87fb-c5f03666e8e6),
+ pointer_default(unique)
+]
+interface IDOMEventListener : IDOMObject
+{
+ //void handleEvent(in Event evt);
+ HRESULT handleEvent([in] IDOMEvent* evt);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(62343a9e-a779-4e91-818a-14fc178cf4c2),
+ pointer_default(unique)
+]
+interface IDOMEvent : IDOMObject
+{
+ // DOM PhaseType
+ const unsigned short DOMEVENT_CAPTURING_PHASE = 1;
+ const unsigned short DOMEVENT_AT_TARGET = 2;
+ const unsigned short DOMEVENT_BUBBLING_PHASE = 3;
+
+ // Reverse-engineered from Netscape
+ const unsigned short DOMEVENT_MOUSEDOWN = 1;
+ const unsigned short DOMEVENT_MOUSEUP = 2;
+ const unsigned short DOMEVENT_MOUSEOVER = 4;
+ const unsigned short DOMEVENT_MOUSEOUT = 8;
+ const unsigned short DOMEVENT_MOUSEMOVE = 16;
+ const unsigned short DOMEVENT_MOUSEDRAG = 32;
+ const unsigned short DOMEVENT_CLICK = 64;
+ const unsigned short DOMEVENT_DBLCLICK = 128;
+ const unsigned short DOMEVENT_KEYDOWN = 256;
+ const unsigned short DOMEVENT_KEYUP = 512;
+ const unsigned short DOMEVENT_KEYPRESS = 1024;
+ const unsigned short DOMEVENT_DRAGDROP = 2048;
+ const unsigned short DOMEVENT_FOCUS = 4096;
+ const unsigned short DOMEVENT_BLUR = 8192;
+ const unsigned short DOMEVENT_SELECT = 16384;
+ const unsigned short DOMEVENT_CHANGE = 32768;
+
+ //readonly attribute DOMString type;
+ HRESULT type([out, retval] BSTR* result);
+
+ //readonly attribute EventTarget target;
+ HRESULT target([out, retval] IDOMEventTarget** result);
+
+ //readonly attribute EventTarget currentTarget;
+ HRESULT currentTarget([out, retval] IDOMEventTarget** result);
+
+ //readonly attribute unsigned short eventPhase;
+ HRESULT eventPhase([out, retval] unsigned short* result);
+
+ //readonly attribute boolean bubbles;
+ HRESULT bubbles([out, retval] BOOL* result);
+
+ //readonly attribute boolean cancelable;
+ HRESULT cancelable([out, retval] BOOL* result);
+
+ //readonly attribute DOMTimeStamp timeStamp;
+ HRESULT timeStamp([out, retval] DOMTimeStamp* result);
+
+ //void stopPropagation();
+ HRESULT stopPropagation();
+
+ //void preventDefault();
+ HRESULT preventDefault();
+
+ //[OldStyleObjC] void initEvent(in DOMString eventTypeArg,
+ // in boolean canBubbleArg,
+ // in boolean cancelableArg);
+ HRESULT initEvent([in] BSTR eventTypeArg, [in] BOOL canBubbleArg, [in] BOOL cancelableArg);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(c7cf7d84-d755-40bc-b664-84bc79eff709),
+ pointer_default(unique)
+]
+interface IDOMEventTarget : IUnknown
+{
+ //void addEventListener(in DOMString type,
+ // in EventListener listener,
+ // in boolean useCapture);
+ HRESULT addEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
+
+ //void removeEventListener(in DOMString type,
+ // in EventListener listener,
+ // in boolean useCapture);
+ HRESULT removeEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
+
+ //boolean dispatchEvent(in Event event)
+ HRESULT dispatchEvent([in] IDOMEvent* event, [out, retval] BOOL* result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(55AAF192-68CD-409f-A551-89710DC7240A),
+ pointer_default(unique)
+]
+interface IDOMDocumentEvent : IUnknown
+{
+ //Event createEvent(in DOMString eventType)
+ // raises(DOMException);
+ HRESULT createEvent([in] BSTR eventType, [out, retval] IDOMEvent** result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(76bc4e46-67df-40d3-89b0-a94dcc2ed507),
+ pointer_default(unique)
+]
+interface IDOMKeyboardEvent : IDOMUIEvent
+{
+ // KeyLocationCode
+ const unsigned long DOMKEYBOARDEVENT_KEY_LOCATION_STANDARD = 0x00;
+ const unsigned long DOMKEYBOARDEVENT_KEY_LOCATION_LEFT = 0x01;
+ const unsigned long DOMKEYBOARDEVENT_KEY_LOCATION_RIGHT = 0x02;
+ const unsigned long DOMKEYBOARDEVENT_KEY_LOCATION_NUMPAD = 0x03;
+
+ //readonly attribute DOMString keyIdentifier;
+ HRESULT keyIdentifier([out, retval] BSTR* result);
+
+ //readonly attribute unsigned long keyLocation;
+ HRESULT keyLocation([out, retval] unsigned long* result);
+
+ //readonly attribute boolean ctrlKey;
+ HRESULT ctrlKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean shiftKey;
+ HRESULT shiftKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean altKey;
+ HRESULT altKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean metaKey;
+ HRESULT metaKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean altGraphKey;
+ HRESULT altGraphKey([out, retval] BOOL* result);
+
+ //boolean getModifierState(in DOMString keyIdentifierArg);
+ HRESULT getModifierState([in] BSTR keyIdentifierArg, [out, retval] BOOL* result);
+
+ // FIXME: this does not match the version in the DOM spec.
+ //void initKeyboardEvent(in AtomicString type,
+ // in boolean canBubble,
+ // in boolean cancelable,
+ // in DOMWindow view,
+ // in DOMString keyIdentifier,
+ // in unsigned long keyLocation,
+ // in boolean ctrlKey,
+ // in boolean altKey,
+ // in boolean shiftKey,
+ // in boolean metaKey,
+ // in boolean altGraphKey);
+ HRESULT initKeyboardEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] BSTR keyIdentifier, [in] unsigned long keyLocation, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey, [in] BOOL graphKey);
+
+ // WebKit Extensions
+ //readonly attribute long keyCode;
+ //HRESULT keyCode([out, retval] long* result);
+
+ //readonly attribute long charCode;
+ //HRESULT charCode([out, retval] long* result);
+
+ //void initKeyboardEvent(in AtomicString type,
+ // in boolean canBubble,
+ // in boolean cancelable,
+ // in DOMWindow view,
+ // in DOMString keyIdentifier,
+ // in unsigned long keyLocation,
+ // in boolean ctrlKey,
+ // in boolean altKey,
+ // in boolean shiftKey,
+ // in boolean metaKey);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(bdd97151-5f6a-4ba4-a902-9b008392eb54),
+ pointer_default(unique)
+]
+interface IDOMMouseEvent : IDOMUIEvent
+{
+ //readonly attribute long screenX;
+ HRESULT screenX([out, retval] long* result);
+
+ //readonly attribute long screenY;
+ HRESULT screenY([out, retval] long* result);
+
+ //readonly attribute long clientX;
+ HRESULT clientX([out, retval] long* result);
+
+ //readonly attribute long clientY;
+ HRESULT clientY([out, retval] long* result);
+
+ //readonly attribute boolean ctrlKey;
+ HRESULT ctrlKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean shiftKey;
+ HRESULT shiftKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean altKey;
+ HRESULT altKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean metaKey;
+ HRESULT metaKey([out, retval] BOOL* result);
+
+ //readonly attribute unsigned short button;
+ HRESULT button([out, retval] unsigned short* result);
+
+ //readonly attribute EventTarget relatedTarget;
+ HRESULT relatedTarget([out, retval] IDOMEventTarget** result);
+
+ //[OldStyleObjC] void initMouseEvent(in AtomicString type,
+ // in boolean canBubble,
+ // in boolean cancelable,
+ // in DOMWindow view,
+ // in long detail,
+ // in long screenX,
+ // in long screenY,
+ // in long clientX,
+ // in long clientY,
+ // in boolean ctrlKey,
+ // in boolean altKey,
+ // in boolean shiftKey,
+ // in boolean metaKey,
+ // in unsigned short button,
+ // in EventTarget relatedTarget);
+ HRESULT initMouseEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] long detail, [in] long screenX, [in] long screenY, [in] long clientX, [in] long clientY, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey, [in] unsigned short button, [in] IDOMEventTarget* relatedTarget);
+
+ // extensions
+ //readonly attribute long offsetX;
+ HRESULT offsetX([out, retval] long* result);
+
+ //readonly attribute long offsetY;
+ HRESULT offsetY([out, retval] long* result);
+
+ //readonly attribute long x;
+ HRESULT x([out, retval] long* result);
+
+ //readonly attribute long y;
+ HRESULT y([out, retval] long* result);
+
+ //readonly attribute Node fromElement;
+ HRESULT fromElement([out, retval] IDOMNode** result);
+
+ //readonly attribute Node toElement;
+ HRESULT toElement([out, retval] IDOMNode** result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(6345d228-ea67-48ee-93c8-ff6e9c6356e9),
+ pointer_default(unique)
+]
+interface IDOMMutationEvent : IDOMEvent
+{
+ // attrChangeType
+ const unsigned short DOMMUTATIONEVENT_MODIFICATION = 1;
+ const unsigned short DOMMUTATIONEVENT_ADDITION = 2;
+ const unsigned short DOMMUTATIONEVENT_REMOVAL = 3;
+
+ //readonly attribute Node relatedNode;
+ HRESULT relatedNode([out, retval] IDOMNode** result);
+
+ //readonly attribute DOMString prevValue;
+ HRESULT prevValue([out, retval] BSTR* result);
+
+ //readonly attribute DOMString newValue;
+ HRESULT newValue([out, retval] BSTR* result);
+
+ //readonly attribute DOMString attrName;
+ HRESULT attrName([out, retval] BSTR* result);
+
+ //readonly attribute unsigned short attrChange;
+ HRESULT attrChange([out, retval] unsigned short* result);
+
+ //[OldStyleObjC] void initMutationEvent(in AtomicString type,
+ // in boolean canBubble,
+ // in boolean cancelable,
+ // in Node relatedNode,
+ // in DOMString prevValue,
+ // in DOMString newValue,
+ // in DOMString attrName,
+ // in unsigned short attrChange);
+ HRESULT initMutationEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMNode* relatedNode, [in] BSTR prevValue, [in] BSTR newValue, [in] BSTR attrName, [in] unsigned short attrChange);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(6048369e-e444-401b-950d-c9daef9384d2),
+ pointer_default(unique)
+]
+interface IDOMOverflowEvent : IDOMEvent
+{
+ const unsigned short DOMOVERFLOWEVENT_HORIZONTAL = 0;
+ const unsigned short DOMOVERFLOWEVENT_VERTICAL = 1;
+ const unsigned short DOMOVERFLOWEVENT_BOTH = 2;
+
+ //readonly attribute unsigned short orient;
+ HRESULT orient([out, retval] unsigned short* result);
+
+ //readonly attribute boolean horizontalOverflow;
+ HRESULT horizontalOverflow([out, retval] BOOL* result);
+
+ //readonly attribute boolean verticalOverflow;
+ HRESULT verticalOverflow([out, retval] BOOL* result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(b928261d-7c9e-4156-af71-6f698bd97788),
+ pointer_default(unique)
+]
+interface IDOMUIEvent : IDOMEvent
+{
+ //readonly attribute DOMWindow view;
+ HRESULT view([out, retval] IDOMWindow** result);
+
+ //readonly attribute long detail;
+ HRESULT detail([out, retval] long* result);
+
+ //[OldStyleObjC] void initUIEvent(in AtomicString type,
+ // in boolean canBubble,
+ // in boolean cancelable,
+ // in DOMWindow view,
+ // in long detail);
+ HRESULT initUIEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] long detail);
+
+ // extentsions
+ //readonly attribute long keyCode;
+ HRESULT keyCode([out, retval] long* result);
+
+ //readonly attribute long charCode;
+ HRESULT charCode([out, retval] long* result);
+
+ //readonly attribute long layerX;
+ HRESULT layerX([out, retval] long* result);
+
+ //readonly attribute long layerY;
+ HRESULT layerY([out, retval] long* result);
+
+ //readonly attribute long pageX;
+ HRESULT pageX([out, retval] long* result);
+
+ //readonly attribute long pageY;
+ HRESULT pageY([out, retval] long* result);
+
+ //readonly attribute long which;
+ HRESULT which([out, retval] long* result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(5404e6d9-a2bb-4c74-8070-ce9d2599bd00),
+ pointer_default(unique)
+]
+interface IDOMWheelEvent : IDOMUIEvent
+{
+ //readonly attribute long screenX;
+ HRESULT screenX([out, retval] long* result);
+
+ //readonly attribute long screenY;
+ HRESULT screenY([out, retval] long* result);
+
+ //readonly attribute long clientX;
+ HRESULT clientX([out, retval] long* result);
+
+ //readonly attribute long clientY;
+ HRESULT clientY([out, retval] long* result);
+
+ //readonly attribute boolean ctrlKey;
+ HRESULT ctrlKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean shiftKey;
+ HRESULT shiftKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean altKey;
+ HRESULT altKey([out, retval] BOOL* result);
+
+ //readonly attribute boolean metaKey;
+ HRESULT metaKey([out, retval] BOOL* result);
+
+ //readonly attribute long wheelDelta;
+ HRESULT wheelDelta([out, retval] long* result);
+
+ //readonly attribute long wheelDeltaX;
+ HRESULT wheelDeltaX([out, retval] long* result);
+
+ //readonly attribute long wheelDeltaY;
+ HRESULT wheelDeltaY([out, retval] long* result);
+
+ // WebKit Extensions
+ //readonly attribute long offsetX;
+ HRESULT offsetX([out, retval] long* result);
+
+ //readonly attribute long offsetY;
+ HRESULT offsetY([out, retval] long* result);
+
+ //readonly attribute long x;
+ HRESULT x([out, retval] long* result);
+
+ //readonly attribute long y;
+ HRESULT y([out, retval] long* result);
+
+ //readonly attribute boolean isHorizontal;
+ HRESULT isHorizontal([out, retval] BOOL* result);
+
+ //void initWheelEvent(in long wheelDeltaX,
+ // in long wheelDeltaY,
+ // in DOMWindow view,
+ // in long screenX,
+ // in long screenY,
+ // in long clientX,
+ // in long clientY,
+ // in boolean ctrlKey,
+ // in boolean altKey,
+ // in boolean shiftKey,
+ // in boolean metaKey);
+ HRESULT initWheelEvent([in] long wheelDeltaX, [in] long wheelDeltaY, [in] IDOMWindow* view, [in] long screenX, [in] long screenY, [in] long clientX, [in] long clientY, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey);
+}
diff --git a/WebKit/win/Interfaces/DOMExtensions.idl b/WebKit/win/Interfaces/DOMExtensions.idl
new file mode 100644
index 0000000..83c26d7
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMExtensions.idl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(E6CEE774-41C6-4c1b-8832-798E49245E6B),
+ pointer_default(unique)
+]
+interface IDOMNodeExtensions : IUnknown
+{
+ /*
+ - (NSRect)boundingBox
+ */
+ HRESULT boundingBox([out, retval] LPRECT rect);
+
+ /*
+ - (NSArray *)lineBoxRects
+ */
+ HRESULT lineBoxRects([in, size_is(cRects)] RECT* rects, [in] int cRects);
+}
diff --git a/WebKit/win/Interfaces/DOMHTML.idl b/WebKit/win/Interfaces/DOMHTML.idl
new file mode 100644
index 0000000..6c276aa
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMHTML.idl
@@ -0,0 +1,930 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+#endif
+
+interface IDOMHTMLElement;
+interface IDOMHTMLFormElement;
+interface IDOMHTMLTableCaptionElement;
+interface IDOMHTMLTableSectionElement;
+interface IDOMDocument;
+interface IDOMElement;
+interface IDOMNode;
+interface IDOMNodeList;
+
+/*
+ @interface DOMHTMLCollection : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(DD8E4E33-D1D4-48e7-BB23-6DC3D7CCEC42),
+ pointer_default(unique)
+]
+interface IDOMHTMLCollection : IDOMObject
+{
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] UINT* result);
+
+ /*
+ - (DOMNode *)item:(unsigned)index;
+ */
+ HRESULT item([in] UINT index, [out, retval] IDOMNode** node);
+
+ /*
+ - (DOMNode *)namedItem:(NSString *)name;
+ */
+ HRESULT namedItem([in] BSTR name, [out, retval] IDOMNode** node);
+}
+
+/*
+ @interface DOMHTMLOptionsCollection : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(1AD98D99-163C-4c04-B6EE-85A3DD31F5C4),
+ pointer_default(unique)
+]
+interface IDOMHTMLOptionsCollection : IDOMObject
+{
+ /*
+ - (unsigned)length;
+ */
+ HRESULT length([out, retval] unsigned int* result);
+
+ /*
+ - (void)setLength:(unsigned)length;
+ */
+ HRESULT setLength([in] unsigned int length);
+
+ /*
+ - (DOMNode *)item:(unsigned)index;
+ */
+ HRESULT item([in] unsigned int index, [out, retval] IDOMNode** result);
+
+ /*
+ - (DOMNode *)namedItem:(NSString *)name;
+ */
+ HRESULT namedItem([in] BSTR name, [out, retval] IDOMNode** result);
+}
+
+/*
+ @interface DOMHTMLDocument : DOMDocument
+*/
+[
+ object,
+ oleautomation,
+ uuid(A7DF8485-25B7-4a98-B70C-1E29CAA00597),
+ pointer_default(unique)
+]
+interface IDOMHTMLDocument : IDOMDocument
+{
+ /*
+ - (NSString *)title;
+ */
+ HRESULT title([out, retval] BSTR* result);
+
+ /*
+ - (void)setTitle:(NSString *)title;
+ */
+ HRESULT setTitle([in] BSTR title);
+
+ /*
+ - (NSString *)referrer;
+ */
+ HRESULT referrer([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)domain;
+ */
+ HRESULT domain([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)URL;
+ */
+ HRESULT URL([out, retval] BSTR* result);
+
+ /*
+ - (DOMHTMLElement *)body;
+ */
+ HRESULT body([out, retval] IDOMHTMLElement** bodyElement);
+
+ /*
+ - (void)setBody:(DOMHTMLElement *)body;
+ */
+ HRESULT setBody([in] IDOMHTMLElement* body);
+
+ /*
+ - (DOMHTMLCollection *)images;
+ */
+ HRESULT images([out, retval] IDOMHTMLCollection** collection);
+
+ /*
+ - (DOMHTMLCollection *)applets;
+ */
+ HRESULT applets([out, retval] IDOMHTMLCollection** collection);
+
+ /*
+ - (DOMHTMLCollection *)links;
+ */
+ HRESULT links([out, retval] IDOMHTMLCollection** collection);
+
+ /*
+ - (DOMHTMLCollection *)forms;
+ */
+ HRESULT forms([out, retval] IDOMHTMLCollection** collection);
+
+ /*
+ - (DOMHTMLCollection *)anchors;
+ */
+ HRESULT anchors([out, retval] IDOMHTMLCollection** collection);
+
+ /*
+ - (NSString *)cookie;
+ */
+ HRESULT cookie([out, retval] BSTR* result);
+
+ /*
+ - (void)setCookie:(NSString *)cookie;
+ */
+ HRESULT setCookie([in] BSTR cookie);
+
+ /*
+ - (void)open;
+ */
+ HRESULT open();
+
+ /*
+ - (void)close;
+ */
+ HRESULT close();
+
+ /*
+ - (void)write:(NSString *)text;
+ */
+ HRESULT write([in] BSTR text);
+
+ /*
+ - (void)writeln:(NSString *)text;
+ */
+ HRESULT writeln([in] BSTR text);
+
+ /*
+ - (DOMElement *)getElementById:(NSString *)elementId;
+ */
+ HRESULT getElementById_([in] BSTR elementId, [out, retval] IDOMElement** element);
+
+ /*
+ - (DOMNodeList *)getElementsByName:(NSString *)elementName;
+ */
+ HRESULT getElementsByName([in] BSTR elementName, [out, retval] IDOMNodeList** nodeList);
+}
+
+/*
+ @interface DOMHTMLElement : DOMElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(EBD5F41D-FF65-41d8-97C9-FCE3A3D4CC3E),
+ pointer_default(unique)
+]
+interface IDOMHTMLElement : IDOMElement
+{
+ /*
+ - (NSString *)idName;
+ */
+ HRESULT idName([out, retval] BSTR* result);
+
+ /*
+ - (void)setIdName:(NSString *)idName;
+ */
+ HRESULT setIdName([in] BSTR idName);
+
+ /*
+ - (NSString *)title;
+ */
+ HRESULT title([out, retval] BSTR* result);
+
+ /*
+ - (void)setTitle:(NSString *)title;
+ */
+ HRESULT setTitle([in] BSTR title);
+
+ /*
+ - (NSString *)lang;
+ */
+ HRESULT lang([out, retval] BSTR* result);
+
+ /*
+ - (void)setLang:(NSString *)lang;
+ */
+ HRESULT setLang([in] BSTR lang);
+
+ /*
+ - (NSString *)dir;
+ */
+ HRESULT dir([out, retval] BSTR* result);
+
+ /*
+ - (void)setDir:(NSString *)dir;
+ */
+ HRESULT setDir([in] BSTR dir);
+
+ /*
+ - (NSString *)className;
+ */
+ HRESULT className([out, retval] BSTR* result);
+
+ /*
+ - (void)setClassName:(NSString *)className;
+ */
+ HRESULT setClassName([in] BSTR className);
+
+ /*
+ - (NSString *)innerHTML;
+ */
+ HRESULT innerHTML([out, retval] BSTR* result);
+
+ /*
+ - (void)setInnerHTML:(NSString *)innerHTML;
+ */
+ HRESULT setInnerHTML([in] BSTR html);
+
+ /*
+ - (NSString *)innerHTML;
+ */
+ HRESULT innerText([out, retval] BSTR* result);
+
+ /*
+ - (void)setInnerText:(NSString *)innerText;
+ */
+ HRESULT setInnerText([in] BSTR text);
+}
+
+/*
+ @interface DOMHTMLFormElement : DOMHTMLElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(DF5C0054-DDDB-4888-9198-7A4E4EBF8D69),
+ pointer_default(unique)
+]
+interface IDOMHTMLFormElement : IDOMHTMLElement
+{
+ /*
+ - (DOMHTMLCollection *)elements;
+ */
+ HRESULT elements([out, retval] IDOMHTMLCollection** result);
+
+ /*
+ - (int)length;
+ */
+ HRESULT length([out, retval] int* result);
+
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* result);
+
+ /*
+ - (void)setName:(NSString *)name;
+ */
+ HRESULT setName([in] BSTR name);
+
+ /*
+ - (NSString *)acceptCharset;
+ */
+ HRESULT acceptCharset([out, retval] BSTR* result);
+ /*
+ - (void)setAcceptCharset:(NSString *)acceptCharset;
+ */
+ HRESULT setAcceptCharset([in] BSTR acceptCharset);
+
+ /*
+ - (NSString *)action;
+ */
+ HRESULT action([out, retval] BSTR* result);
+
+ /*
+ - (void)setAction:(NSString *)action;
+ */
+ HRESULT setAction([in] BSTR action);
+
+ /*
+ - (NSString *)enctype;
+ */
+ HRESULT encType([out, retval] BSTR* result);
+
+ /*
+ - (void)setEnctype:(NSString *)enctype;
+ */
+ HRESULT setEnctype([out, retval] BSTR* encType);
+
+ /*
+ - (NSString *)method;
+ */
+ HRESULT method([out, retval] BSTR* method);
+
+ /*
+ - (void)setMethod:(NSString *)method;
+ */
+ HRESULT setMethod([in] BSTR method);
+
+ /*
+ - (NSString *)target;
+ */
+ HRESULT target([out, retval] BSTR* result);
+
+ /*
+ - (void)setTarget:(NSString *)target;
+ */
+ HRESULT setTarget([in] BSTR target);
+
+ /*
+ - (void)submit;
+ */
+ HRESULT submit();
+
+ /*
+ - (void)reset;
+ */
+ HRESULT reset();
+}
+
+/*
+ @interface DOMHTMLSelectElement : DOMHTMLElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(3825AA04-B38F-4399-95BB-F5410B29594A),
+ pointer_default(unique)
+]
+interface IDOMHTMLSelectElement : IDOMHTMLElement
+{
+ /*
+ - (NSString *)type;
+ */
+ HRESULT type([out, retval] BSTR* result);
+
+ /*
+ - (int)selectedIndex;
+ */
+ HRESULT selectedIndex([out, retval] int* result);
+
+ /*
+ - (void)setSelectedIndex:(int)selectedIndex;
+ */
+ HRESULT setSelectedIndx([in] int selectedIndex);
+
+ /*
+ - (NSString *)value;
+ */
+ HRESULT value([out, retval] BSTR* result);
+
+ /*
+ - (void)setValue:(NSString *)value;
+ */
+ HRESULT setValue([in] BSTR value);
+
+ /*
+ - (int)length;
+ */
+ HRESULT length([out, retval] int* result);
+
+ /*
+ - (DOMHTMLFormElement *)form;
+ */
+ HRESULT form([out, retval] IDOMHTMLFormElement** result);
+
+ /*
+ - (DOMHTMLOptionsCollection *)options;
+ */
+ HRESULT options([out, retval] IDOMHTMLOptionsCollection** result);
+
+ /*
+ - (BOOL)disabled;
+ */
+ HRESULT disabled([out, retval] BOOL* result);
+
+ /*
+ - (void)setDisabled:(BOOL)disabled;
+ */
+ HRESULT setDisabled([in] BOOL disabled);
+
+ /*
+ - (BOOL)multiple;
+ */
+ HRESULT multiple([out, retval] BOOL* result);
+
+ /*
+ - (void)setMultiple:(BOOL)multiple;
+ */
+ HRESULT setMultiple([in] BOOL multiple);
+
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* result);
+
+ /*
+ - (void)setName:(NSString *)name;
+ */
+ HRESULT setName([in] BSTR name);
+
+ /*
+ - (int)size;
+ */
+ HRESULT size([out, retval] int* size);
+
+ /*
+ - (void)setSize:(int)size;
+ */
+ HRESULT setSize([in] int size);
+
+ /*
+ - (int)tabIndex;
+ */
+ HRESULT tabIndex([out, retval] int* result);
+
+ /*
+ - (void)setTabIndex:(int)tabIndex;
+ */
+ HRESULT setTabIndex([in] int tabIndex);
+
+ /*
+ - (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before;
+ */
+ HRESULT add([in] IDOMHTMLElement* element, [in] IDOMHTMLElement* before);
+
+ /*
+ - (void)remove:(int)index;
+ */
+ HRESULT remove([in] int index);
+
+ /*
+ - (void)blur;
+ */
+ HRESULT blur();
+
+ /*
+ - (void)focus;
+ */
+ HRESULT focus();
+}
+
+/*
+ @interface DOMHTMLOptionElement : DOMHTMLElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(0E1EF5AB-4008-4d83-9135-D4DC1B4603D4),
+ pointer_default(unique)
+]
+interface IDOMHTMLOptionElement : IDOMHTMLElement
+{
+ /*
+ - (DOMHTMLFormElement *)form;
+ */
+ HRESULT form([out, retval] IDOMHTMLFormElement** result);
+
+ /*
+ - (BOOL)defaultSelected;
+ */
+ HRESULT defaultSelected([out, retval] BOOL* result);
+
+ /*
+ - (void)setDefaultSelected:(BOOL)defaultSelected;
+ */
+ HRESULT setDefaultSelected([in] BOOL defaultSelected);
+
+ /*
+ - (NSString *)text;
+ */
+ HRESULT text([out, retval] BSTR* result);
+
+ /*
+ - (int)index;
+ */
+ HRESULT index([out, retval] int* result);
+
+ /*
+ - (BOOL)disabled;
+ */
+ HRESULT disabled([out, retval] BOOL* result);
+
+ /*
+ - (void)setDisabled:(BOOL)disabled;
+ */
+ HRESULT setDisabled([in] BOOL disabled);
+
+ /*
+ - (NSString *)label;
+ */
+ HRESULT label([out, retval] BSTR* result);
+
+ /*
+ - (void)setLabel:(NSString *)label;
+ */
+ HRESULT setLabel([in] BSTR label);
+
+ /*
+ - (BOOL)selected;
+ */
+ HRESULT selected([out, retval] BOOL* result);
+
+ /*
+ - (void)setSelected:(BOOL)selected;
+ */
+ HRESULT setSelected([in] BOOL selected);
+
+ /*
+ - (NSString *)value;
+ */
+ HRESULT value([out, retval] BSTR* result);
+
+ /*
+ - (void)setValue:(NSString *)value;
+ */
+ HRESULT setValue([in] BSTR value);
+}
+
+/*
+ @interface DOMHTMLInputElement : DOMHTMLElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(80C40AC5-1755-4894-812F-479269C262A2),
+ pointer_default(unique)
+]
+/* FIXME: The Safari app currently relies on IDOMHTMLInputElement inheriting from
+ IDOMElement. This can't be changed until a version of SafariWin which no longer
+ makes this assumption is released.
+*/
+interface IDOMHTMLInputElement : IDOMElement
+{
+ /*
+ - (NSString *)defaultValue;
+ */
+ HRESULT defaultValue([out, retval] BSTR* result);
+
+ /*
+ - (void)setDefaultValue:(NSString *)defaultValue;
+ */
+ HRESULT setDefaultValue([in] BSTR val);
+
+ /*
+ - (BOOL)defaultChecked;
+ */
+ HRESULT defaultChecked([out, retval] BOOL* result);
+
+ /*
+ - (void)setDefaultChecked:(BOOL)defaultChecked;
+ */
+ HRESULT setDefaultChecked([in] BSTR checked);
+
+ /*
+ - (DOMHTMLFormElement *)form;
+ */
+ HRESULT form([out, retval] IDOMHTMLElement** result);
+
+ /*
+ - (NSString *)accept;
+ */
+ HRESULT accept([out, retval] BSTR* result);
+
+ /*
+ - (void)setAccept:(NSString *)accept;
+ */
+ HRESULT setAccept([in] BSTR accept);
+
+ /*
+ - (NSString *)accessKey;
+ */
+ HRESULT accessKey([out, retval] BSTR* result);
+
+ /*
+ - (void)setAccessKey:(NSString *)accessKey;
+ */
+ HRESULT setAccessKey([in] BSTR key);
+
+ /*
+ - (NSString *)align;
+ */
+ HRESULT align([out, retval] BSTR* result);
+
+ /*
+ - (void)setAlign:(NSString *)align;
+ */
+ HRESULT setAlign([in] BSTR align);
+
+ /*
+ - (NSString *)alt;
+ */
+ HRESULT alt([out, retval] BSTR* result);
+
+ /*
+ - (void)setAlt:(NSString *)alt;
+ */
+ HRESULT setAlt([in] BSTR alt);
+
+ /*
+ - (BOOL)checked;
+ */
+ HRESULT checked([out, retval] BOOL* result);
+
+ /*
+ - (void)setChecked:(BOOL)checked;
+ */
+ HRESULT setChecked([in] BOOL checked);
+
+ /*
+ - (BOOL)disabled;
+ */
+ HRESULT disabled([out, retval] BOOL* result);
+
+ /*
+ - (void)setDisabled:(BOOL)disabled;
+ */
+ HRESULT setDisabled([in] BOOL disabled);
+
+ /*
+ - (int)maxLength;
+ */
+ HRESULT maxLength([out, retval] int* result);
+
+ /*
+ - (void)setMaxLength:(int)maxLength;
+ */
+ HRESULT setMaxLength([in] int maxLength);
+
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* name);
+
+ /*
+ - (void)setName:(NSString *)name;
+ */
+ HRESULT setName([in] BSTR name);
+
+ /*
+ - (BOOL)readOnly;
+ */
+ HRESULT readOnly([out, retval] BOOL* result);
+
+ /*
+ - (void)setReadOnly:(BOOL)readOnly;
+ */
+ HRESULT setReadOnly([in] BOOL readOnly);
+
+ /*
+ - (unsigned)size;
+ */
+ HRESULT size([out, retval] unsigned int *result);
+
+ /*
+ - (void)setSize:(unsigned)size;
+ */
+ HRESULT setSize([in] unsigned int size);
+
+ /*
+ - (NSString *)src;
+ */
+ HRESULT src([out, retval] BSTR* result);
+
+ /*
+ - (void)setSrc:(NSString *)src;
+ */
+ HRESULT setSrc([in] BSTR src);
+
+ /*
+ - (int)tabIndex;
+ */
+ HRESULT tabIndex([out, retval] int* result);
+
+ /*
+ - (void)setTabIndex:(int)tabIndex;
+ */
+ HRESULT setTabIndex([in] int tabIndex);
+
+ /*
+ - (NSString *)type;
+ */
+ HRESULT type([out, retval] BSTR* result);
+
+ /*
+ - (void)setType:(NSString *)type;
+ */
+ HRESULT setType([in] BSTR type);
+
+ /*
+ - (NSString *)useMap;
+ */
+ HRESULT useMap([out, retval] BSTR* result);
+
+ /*
+ - (void)setUseMap:(NSString *)useMap;
+ */
+ HRESULT setUseMap([in] BSTR useMap);
+
+ /*
+ - (NSString *)value;
+ */
+ HRESULT value([out, retval] BSTR* result);
+
+ /*
+ - (void)setValue:(NSString *)value;
+ */
+ HRESULT setValue([in] BSTR value);
+
+ /*
+ - (void)blur;
+ */
+ HRESULT blur();
+
+ /*
+ - (void)focus;
+ */
+ HRESULT focus();
+
+ /*
+ - (void)select;
+ */
+ HRESULT select();
+
+ /*
+ - (void)click;
+ */
+ HRESULT click();
+
+ // FIXME - this is not in objC bindings at the moment
+ // attribute long selectionStart;
+ HRESULT setSelectionStart([in] long start);
+ HRESULT selectionStart([out, retval] long* start);
+
+ // FIXME - thisis not in the objC bindings at the moment
+ // attribute long selectionEnd;
+ HRESULT setSelectionEnd([in] long end);
+ HRESULT selectionEnd([out, retval] long* end);
+}
+
+/*
+ @interface DOMHTMLTextAreaElement : DOMHTMLElement
+*/
+[
+ object,
+ oleautomation,
+ uuid(298B02B7-3EB5-4ba4-AD3F-7FA53241AADE),
+ pointer_default(unique)
+]
+interface IDOMHTMLTextAreaElement : IDOMHTMLElement
+{
+ /*
+ - (NSString *)defaultValue;
+ */
+ HRESULT defaultValue([out, retval] BSTR* result);
+
+ /*
+ - (void)setDefaultValue:(NSString *)defaultValue;
+ */
+ HRESULT setDefaultValue([in] BSTR val);
+
+ /*
+ - (DOMHTMLFormElement *)form;
+ */
+ HRESULT form([out, retval] IDOMHTMLElement** result);
+
+ /*
+ - (NSString *)accessKey;
+ */
+ HRESULT accessKey([out, retval] BSTR* result);
+
+ /*
+ - (void)setAccessKey:(NSString *)accessKey;
+ */
+ HRESULT setAccessKey([in] BSTR key);
+
+ /*
+ - (int)cols;
+ */
+ HRESULT cols([out, retval] int* result);
+
+ /*
+ - (void)setCols:(int)cols;
+ */
+ HRESULT setCols([in] int cols);
+
+ /*
+ - (BOOL)disabled;
+ */
+ HRESULT disabled([out, retval] BOOL* result);
+
+ /*
+ - (void)setDisabled:(BOOL)disabled;
+ */
+ HRESULT setDisabled([in] BOOL disabled);
+
+ /*
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* name);
+
+ /*
+ - (void)setName:(NSString *)name;
+ */
+ HRESULT setName([in] BSTR name);
+
+ /*
+ - (BOOL)readOnly;
+ */
+ HRESULT readOnly([out, retval] BOOL* result);
+
+ /*
+ - (void)setReadOnly:(BOOL)readOnly;
+ */
+ HRESULT setReadOnly([in] BOOL readOnly);
+
+ /*
+ - (int)rows;
+ */
+ HRESULT rows([out, retval] int* result);
+
+ /*
+ - (void)setRows:(int)rows;
+ */
+ HRESULT setRows([in] int rows);
+
+ /*
+ - (int)tabIndex;
+ */
+ HRESULT tabIndex([out, retval] int* result);
+
+ /*
+ - (void)setTabIndex:(int)tabIndex;
+ */
+ HRESULT setTabIndex([in] int tabIndex);
+
+ /*
+ - (NSString *)type;
+ */
+ HRESULT type([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)value;
+ */
+ HRESULT value([out, retval] BSTR* result);
+
+ /*
+ - (void)setValue:(NSString *)value;
+ */
+ HRESULT setValue([in] BSTR value);
+
+ /*
+ - (void)blur;
+ */
+ HRESULT blur();
+
+ /*
+ - (void)focus;
+ */
+ HRESULT focus();
+
+ /*
+ - (void)select;
+ */
+ HRESULT select();
+}
diff --git a/WebKit/win/Interfaces/DOMPrivate.idl b/WebKit/win/Interfaces/DOMPrivate.idl
new file mode 100644
index 0000000..dcacac2
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMPrivate.idl
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+#endif
+
+interface IDOMElement;
+
+typedef struct WebFontDescription WebFontDescription;
+
+[
+ object,
+ oleautomation,
+ uuid(7FF28EC8-6DA1-498d-9A43-7E67C2D3128F),
+ pointer_default(unique)
+]
+interface IDOMElementPrivate : IUnknown
+{
+ [local] HRESULT coreElement(void** element);
+ HRESULT isEqual([in] IDOMElement* other, [out, retval] BOOL* result);
+ HRESULT isFocused([out, retval] BOOL* result);
+ HRESULT innerText([out, retval] BSTR* result);
+ [local] HRESULT font(WebFontDescription* webFontDescription);
+}
+
+/*
+ All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
+ They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
+ replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
+ and these will be deleted.
+
+ @interface DOMHTMLInputElement(FormsAutoFillTransition)
+*/
+[
+ object,
+ oleautomation,
+ uuid(2DF339BC-B48E-4d35-B93A-299756ED0B4B),
+ pointer_default(unique)
+]
+interface IFormsAutoFillTransition : IUnknown
+{
+ /*
+ - (BOOL)_isTextField;
+ */
+ HRESULT isTextField([out, retval] BOOL* result);
+
+ /*
+ - (NSRect)_rectOnScreen; // bounding box of the text field, in screen coordinates
+ */
+ HRESULT rectOnScreen([out, retval] LPRECT rect);
+
+ /*
+ - (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index;
+ */
+ HRESULT replaceCharactersInRange([in] int startTarget, [in] int endTarget, [in] BSTR replacementString, [in] int index);
+
+ /*
+ - (NSRange)_selectedRange;
+ */
+ HRESULT selectedRange([out] int* start, [out] int* end);
+
+ /*
+ - (void)_setAutofilled:(BOOL)filled;
+ */
+ HRESULT setAutofilled([in] BOOL filled);
+}
+
+/*
+ // These changes are necessary to detect whether a form input was modified by a user
+ // or javascript
+ @interface DOMHTMLInputElement (FormPromptAdditions)
+
+ @interface DOMHTMLTextAreaElement (FormPromptAdditions)
+*/
+[
+ object,
+ oleautomation,
+ uuid(C8C5F0CD-07B0-4a32-BFA8-AE465E80DD3C),
+ pointer_default(unique)
+]
+interface IFormPromptAdditions : IUnknown
+{
+ /*
+ - (BOOL)_isUserEdited;
+ */
+ HRESULT isUserEdited([out, retval] BOOL* result);
+}
+
+/*
+ All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
+ They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
+ replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
+ and these will be deleted.
+
+ @interface DOMHTMLSelectElement(FormsAutoFillTransition)
+*/
+[
+ object,
+ oleautomation,
+ uuid(6959F712-1563-4661-8D8C-F4C739C55839),
+ pointer_default(unique)
+]
+interface IFormsAutoFillTransitionSelect : IUnknown
+{
+ /*
+ - (void)_activateItemAtIndex:(int)index;
+ */
+ HRESULT activateItemAtIndex([in] int index);
+}
diff --git a/WebKit/win/Interfaces/DOMRange.idl b/WebKit/win/Interfaces/DOMRange.idl
new file mode 100644
index 0000000..58dd54d
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMRange.idl
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+#endif
+
+interface IDOMNode;
+interface IDOMDocumentFragment;
+
+typedef enum _WebSelectionAffinity {
+ WebSelectionAffinityUpstream = 0,
+ WebSelectionAffinityDownstream = 1
+} WebSelectionAffinity;
+
+enum {
+ //
+ // DOM range exception codes
+ //
+ DOM_BAD_BOUNDARYPOINTS_ERR = 1,
+ DOM_INVALID_NODE_TYPE_ERR = 2,
+};
+
+enum {
+ //
+ // DOM Range comparison codes
+ //
+ DOM_START_TO_START = 0,
+ DOM_START_TO_END = 1,
+ DOM_END_TO_END = 2,
+ DOM_END_TO_START = 3,
+};
+
+/*
+ @interface DOMRange : DOMObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(2F33E42C-0B39-48b3-B7B6-E910CDB325AD),
+ pointer_default(unique)
+]
+interface IDOMRange : IDOMObject
+{
+ /*
+ - (DOMNode *)startContainer;
+ */
+ HRESULT startContainer([out, retval] IDOMNode** node);
+
+ /*
+ - (int)startOffset;
+ */
+ HRESULT startOffset([out, retval] int* offset);
+
+ /*
+ - (DOMNode *)endContainer;
+ */
+ HRESULT endContainer([out, retval] IDOMNode** node);
+
+ /*
+ - (int)endOffset;
+ */
+ HRESULT endOffset([out, retval] int* offset);
+
+ /*
+ - (BOOL)collapsed;
+ */
+ HRESULT collapsed([out, retval] BOOL* result);
+
+ /*
+ - (DOMNode *)commonAncestorContainer;
+ */
+ HRESULT commonAncestorContainer([out, retval] IDOMNode** container);
+
+ /*
+ - (void)setStart:(DOMNode *)refNode :(int)offset;
+ */
+ HRESULT setStart([in] IDOMNode* refNode, [in] int offset);
+
+ /*
+ - (void)setEnd:(DOMNode *)refNode :(int)offset;
+ */
+ HRESULT setEnd([in] IDOMNode* refNode, [in] int offset);
+
+ /*
+ - (void)setStartBefore:(DOMNode *)refNode;
+ */
+ HRESULT setStartBefore([in] IDOMNode* refNode);
+
+ /*
+ - (void)setStartAfter:(DOMNode *)refNode;
+ */
+ HRESULT setStartAfter([in] IDOMNode* refNode);
+
+ /*
+ - (void)setEndBefore:(DOMNode *)refNode;
+ */
+ HRESULT setEndBefore([in] IDOMNode* refNode);
+
+ /*
+ - (void)setEndAfter:(DOMNode *)refNode;
+ */
+ HRESULT setEndAfter([in] IDOMNode* refNode);
+
+ /*
+ - (void)collapse:(BOOL)toStart;
+ */
+ HRESULT collapse([in] BOOL toStart);
+
+ /*
+ - (void)selectNode:(DOMNode *)refNode;
+ */
+ HRESULT selectNode([in] IDOMNode* refNode);
+
+ /*
+ - (void)selectNodeContents:(DOMNode *)refNode;
+ */
+ HRESULT selectNodeContents([in] IDOMNode* refNode);
+
+ /*
+ - (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange;
+ */
+ HRESULT compareBoundaryPoints([in] unsigned short how, [in] IDOMRange* sourceRange);
+
+ /*
+ - (void)deleteContents;
+ */
+ HRESULT deleteContents();
+
+ /*
+ - (DOMDocumentFragment *)extractContents;
+ */
+ HRESULT extractContents([out, retval] IDOMDocumentFragment** fragment);
+
+ /*
+ - (DOMDocumentFragment *)cloneContents;
+ */
+ HRESULT cloneContents([out, retval] IDOMDocumentFragment** fragment);
+
+ /*
+ - (void)insertNode:(DOMNode *)newNode;
+ */
+ HRESULT insertNode([in] IDOMNode* newNode);
+
+ /*
+ - (void)surroundContents:(DOMNode *)newParent;
+ */
+ HRESULT surroundContents([in] IDOMNode* newParent);
+
+ /*
+ - (DOMRange *)cloneRange;
+ */
+ HRESULT cloneRange([out, retval] IDOMRange** range);
+
+ /*
+ - (NSString *)toString;
+ */
+ HRESULT toString([out, retval] BSTR* str);
+
+ /*
+ - (void)detach;
+ */
+ HRESULT detach();
+}
diff --git a/WebKit/win/Interfaces/DOMWindow.idl b/WebKit/win/Interfaces/DOMWindow.idl
new file mode 100755
index 0000000..6c24811
--- /dev/null
+++ b/WebKit/win/Interfaces/DOMWindow.idl
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+import "DOMCSS.idl";
+#endif
+
+interface IDOMCSSRuleList;
+interface IDOMDocument;
+interface IDOMElement;
+
+[
+ object,
+ oleautomation,
+ uuid(19126DDF-E82F-46c0-A2F9-16879D7DADC5),
+ pointer_default(unique)
+]
+interface IDOMWindow : IDOMObject
+{
+ // DOM Level 2 AbstractView Interface
+ //readonly attribute Document document;
+ HRESULT document([out, retval] IDOMDocument** result);
+
+ // DOM Level 2 Style Interface
+ //CSSStyleDeclaration getComputedStyle(in Element element,
+ // in DOMString pseudoElement);
+ HRESULT getComputedStyle([in] IDOMElement* element, [in] BSTR pseudoElement);
+
+ // WebKit extensions
+ //CSSRuleList getMatchedCSSRules(in Element element,
+ // in DOMString pseudoElement,
+ // in [Optional] boolean authorOnly);
+ HRESULT getMatchedCSSRules([in] IDOMElement* element, [in] BSTR pseudoElement, [in] BOOL authorOnly, [out, retval] IDOMCSSRuleList** result);
+
+ //readonly attribute double devicePixelRatio;
+ HRESULT devicePixelRatio([out, retval] double* result);
+
+ // Global constructors
+ //attribute CSSPrimitiveValueConstructor CSSPrimitiveValue;
+ //attribute CSSRuleConstructor CSSRule;
+ //attribute CSSStyleDeclarationConstructor CSSStyleDeclaration;
+ //attribute CSSValueConstructor CSSValue;
+ //attribute DocumentConstructor Document;
+ //attribute DocumentFragmentConstructor DocumentFragment;
+ //attribute DOMParserConstructor DOMParser;
+ //attribute ElementConstructor Element;
+ //attribute EventConstructor Event;
+ //attribute HTMLElementConstructor HTMLElement;
+ //attribute HTMLDocumentConstructor HTMLDocument;
+ //attribute MutationEventConstructor MutationEvent;
+ //attribute NodeConstructor Node;
+ //attribute NodeFilterConstructor NodeFilter;
+ //attribute RangeConstructor Range;
+ //attribute RangeExceptionConstructor RangeException;
+
+ // Mozilla has a separate XMLDocument object for XML documents.
+ // We just use Document for this.
+ //attribute DocumentConstructor XMLDocument;
+
+ //attribute XMLSerializerConstructor XMLSerializer;
+
+ //#ifdef XPATH_SUPPORT
+ //attribute XPathEvaluatorConstructor XPathEvaluator;
+ //attribute XPathResultConstructor XPathResult;
+ //#endif
+}
diff --git a/WebKit/win/Interfaces/IGEN_DOMObject.idl b/WebKit/win/Interfaces/IGEN_DOMObject.idl
new file mode 100644
index 0000000..a1efbf4
--- /dev/null
+++ b/WebKit/win/Interfaces/IGEN_DOMObject.idl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(19DD35E3-BFEC-40f5-A69F-02C5D76791E4),
+ pointer_default(unique)
+]
+interface IGEN_DOMObject : IUnknown
+{
+}
diff --git a/WebKit/win/Interfaces/IWebArchive.idl b/WebKit/win/Interfaces/IWebArchive.idl
new file mode 100644
index 0000000..383ce01
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebArchive.idl
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebResource.idl";
+#endif
+
+interface IWebResource;
+
+/*!
+ @class WebArchive
+ @discussion WebArchive represents a main resource as well as all the subresources and subframes associated with the main resource.
+ The main resource can be an entire web page, a portion of a web page, or some other kind of data such as an image.
+ This class can be used for saving standalone web pages, representing portions of a web page on the pasteboard, or any other
+ application where one class is needed to represent rich web content.
+*/
+[
+ object,
+ oleautomation,
+ uuid(F07D5252-F66E-4a4d-B9DC-33BD11DCC138),
+ pointer_default(unique)
+]
+interface IWebArchive : IUnknown
+{
+ /*!
+ @method initWithMainResource:subresources:subframeArchives:
+ @abstract The initializer for WebArchive.
+ @param mainResource The main resource of the archive.
+ @param subresources The subresources of the archive (can be nil).
+ @param subframeArchives The archives representing the subframes of the archive (can be nil).
+ @result An initialized WebArchive.
+ - (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
+ */
+ HRESULT initWithMainResource([in] IWebResource* mainResource, [in, size_is(cSubResources)] IWebResource** subResources, [in] int cSubResources, [in, size_is(cSubFrameArchives)] IWebArchive** subFrameArchives, [in] int cSubFrameArchives);
+
+ /*!
+ @method initWithData:
+ @abstract The initializer for creating a WebArchive from data.
+ @param data The data representing the archive. This can be obtained using WebArchive's data method.
+ @result An initialized WebArchive.
+ - (id)initWithData:(NSData *)data;
+ */
+ HRESULT initWithData([in] IStream* data);
+
+ /*!
+ @method mainResource
+ @result The main resource of the archive.
+ - (WebResource *)mainResource;
+ */
+ HRESULT mainResource([out, retval] IWebResource** resource);
+
+ /*!
+ @method subresources
+ @result The subresource of the archive (can be nil).
+ - (NSArray *)subresources;
+ */
+ HRESULT subResources([out, retval] IEnumVARIANT** enumResources);
+
+ /*!
+ @method subframeArchives
+ @result The archives representing the subframes of the archive (can be nil).
+ - (NSArray *)subframeArchives;
+ */
+ HRESULT subframeArchives([out, retval] IEnumVARIANT** enumSubframes);
+
+ /*!
+ @method data
+ @result The data representation of the archive.
+ @discussion The data returned by this method can be used to save a web archive to a file or to place a web archive on the pasteboard
+ using WebArchivePboardType. To create a WebArchive using the returned data, call initWithData:.
+ - (NSData *)data;
+ */
+ HRESULT data([out, retval] IStream** stream);
+}
diff --git a/WebKit/win/Interfaces/IWebBackForwardList.idl b/WebKit/win/Interfaces/IWebBackForwardList.idl
new file mode 100644
index 0000000..83d4cfb
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebBackForwardList.idl
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebHistoryItem.idl";
+#endif
+
+interface IWebHistoryItem;
+
+/*!
+ @class WebBackForwardList
+ WebBackForwardList holds an ordered list of WebHistoryItems that comprises the back and
+ forward lists.
+
+ Note that the methods which modify instances of this class do not cause
+ navigation to happen in other layers of the stack; they are only for maintaining this data
+ structure.
+*/
+[
+ object,
+ oleautomation,
+ uuid(C278A16D-B502-4131-B551-DCE3F4ED2B36),
+ pointer_default(unique)
+]
+interface IWebBackForwardList : IUnknown
+{
+ /*!
+ @method addItem:
+ @abstract Adds an entry to the list.
+ @param entry The entry to add.
+ @discussion The added entry is inserted immediately after the current entry.
+ If the current position in the list is not at the end of the list, elements in the
+ forward list will be dropped at this point. In addition, entries may be dropped to keep
+ the size of the list within the maximum size.
+ - (void)addItem:(WebHistoryItem *)item;
+ */
+ HRESULT addItem([in] IWebHistoryItem* item);
+
+ /*!
+ @method goBack
+ @abstract Move the current pointer back to the entry before the current entry.
+ - (void)goBack;
+ */
+ HRESULT goBack();
+
+ /*!
+ @method goForward
+ @abstract Move the current pointer ahead to the entry after the current entry.
+ - (void)goForward;
+ */
+ HRESULT goForward();
+
+ /*!
+ @method goToItem:
+ @abstract Move the current pointer to the given entry.
+ @param item The history item to move the pointer to
+ - (void)goToItem:(WebHistoryItem *)item;
+ */
+ HRESULT goToItem([in] IWebHistoryItem* item);
+
+ /*!
+ @method backItem
+ @abstract Returns the entry right before the current entry.
+ @result The entry right before the current entry, or nil if there isn't one.
+ - (WebHistoryItem *)backItem;
+ */
+ HRESULT backItem([out, retval] IWebHistoryItem** item);
+
+ /*!
+ @method currentItem
+ @abstract Returns the current entry.
+ @result The current entry.
+ - (WebHistoryItem *)currentItem;
+ */
+ HRESULT currentItem([out, retval] IWebHistoryItem** item);
+
+ /*!
+ @method forwardItem
+ @abstract Returns the entry right after the current entry.
+ @result The entry right after the current entry, or nil if there isn't one.
+ - (WebHistoryItem *)forwardItem;
+ */
+ HRESULT forwardItem([out, retval] IWebHistoryItem** item);
+
+ /*!
+ @method backListWithLimit:
+ @abstract Returns a portion of the list before the current entry.
+ @param limit A cap on the size of the array returned.
+ @result An array of items before the current entry, or nil if there are none. The entries are in the order that they were originally visited.
+ - (NSArray *)backListWithLimit:(int)limit;
+ */
+ HRESULT backListWithLimit([in] int limit, [out] int* listCount, [in] IWebHistoryItem** list);
+
+ /*!
+ @method forwardListWithLimit:
+ @abstract Returns a portion of the list after the current entry.
+ @param limit A cap on the size of the array returned.
+ @result An array of items after the current entry, or nil if there are none. The entries are in the order that they were originally visited.
+ - (NSArray *)forwardListWithLimit:(int)limit;
+ */
+ HRESULT forwardListWithLimit([in] int limit, [out] int* listCount, [in] IWebHistoryItem** list);
+
+ /*!
+ @method capacity
+ @abstract Returns the list's maximum size.
+ @result The list's maximum size.
+ - (int)capacity;
+ */
+ HRESULT capacity([out, retval] int* result);
+
+ /*!
+ @method setCacpacity
+ @abstract Sets the list's maximum size.
+ @param size The new maximum size for the list.
+ - (void)setCapacity:(int)size;
+ */
+ HRESULT setCapacity([in] int size);
+
+ /*!
+ @method backListCount
+ @abstract Returns the back list's current count.
+ @result The number of items in the list.
+ - (int)backListCount;
+ */
+ HRESULT backListCount([out, retval] int* count);
+
+ /*!
+ @method forwardListCount
+ @abstract Returns the forward list's current count.
+ @result The number of items in the list.
+ - (int)forwardListCount;
+ */
+ HRESULT forwardListCount([out, retval] int* sizecount);
+
+ /*!
+ @method containsItem:
+ @param item The item that will be checked for presence in the WebBackForwardList.
+ @result Returns YES if the item is in the list.
+ - (BOOL)containsItem:(WebHistoryItem *)item;
+ */
+ HRESULT containsItem([in] IWebHistoryItem* item, [out, retval] BOOL* result);
+
+ /*!
+ @method itemAtIndex:
+ @abstract Returns an entry the given distance from the current entry.
+ @param index Index of the desired list item relative to the current item; 0 is current item, -1 is back item, 1 is forward item, etc.
+ @result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned.
+ - (WebHistoryItem *)itemAtIndex:(int)index;
+ */
+ HRESULT itemAtIndex([in] int index, [out, retval] IWebHistoryItem** item);
+}
diff --git a/WebKit/win/Interfaces/IWebBackForwardListPrivate.idl b/WebKit/win/Interfaces/IWebBackForwardListPrivate.idl
new file mode 100755
index 0000000..a9c14f3
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebBackForwardListPrivate.idl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebHistoryItem.idl";
+#endif
+
+interface IWebHistoryItem;
+
+[
+ object,
+ oleautomation,
+ uuid(0296A841-F6B1-4334-B146-7F9542CF24C3),
+ pointer_default(unique)
+]
+interface IWebBackForwardListPrivate : IUnknown
+{
+ HRESULT removeItem([in] IWebHistoryItem* item);
+}
diff --git a/WebKit/win/Interfaces/IWebCache.idl b/WebKit/win/Interfaces/IWebCache.idl
new file mode 100644
index 0000000..3d2bf14
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebCache.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(0673E6F5-AE63-4871-AAC6-6A1E0E6A99AB),
+ pointer_default(unique)
+]
+interface IWebCache : IUnknown
+{
+ HRESULT statistics([in, out] int* count, [in] IPropertyBag** s);
+ HRESULT empty();
+ HRESULT setDisabled([in] BOOL disabled);
+ HRESULT disabled([out, retval] BOOL*);
+}
diff --git a/WebKit/win/Interfaces/IWebDataSource.idl b/WebKit/win/Interfaces/IWebDataSource.idl
new file mode 100644
index 0000000..15bea1a
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebDataSource.idl
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebMutableURLRequest.idl";
+import "IWebURLResponse.idl";
+import "IWebResource.idl";
+import "IWebArchive.idl";
+import "IWebDocument.idl";
+import "IWebFrame.idl";
+#endif
+
+interface IWebMutableURLRequest;
+interface IWebURLConnection;
+interface IWebURLRequest;
+interface IWebURLResponse;
+interface IWebArchive;
+interface IWebDataSourcePrivate;
+interface IWebError;
+interface IWebFrame;
+interface IWebResource;
+
+interface IWebDocumentRepresentation;
+
+/*!
+ @class WebDataSource
+ @discussion A WebDataSource represents the data associated with a web page.
+ A datasource has a WebDocumentRepresentation which holds an appropriate
+ representation of the data. WebDataSources manage a hierarchy of WebFrames.
+ WebDataSources are typically related to a view by their containing WebFrame.
+*/
+[
+ object,
+ oleautomation,
+ uuid(5221A975-AE09-4a7b-A4DF-E3B1B5F38A21),
+ pointer_default(unique)
+]
+interface IWebDataSource : IUnknown
+{
+ /*!
+ @method initWithRequest:
+ @abstract The designated initializer for WebDataSource.
+ @param request The request to use in creating a datasource.
+ @result Returns an initialized WebDataSource.
+ - (id)initWithRequest:(NSURLRequest *)request;
+ */
+ HRESULT initWithRequest([in] IWebURLRequest* request);
+
+ /*!
+ @method data
+ @discussion The data will be incomplete until the datasource has completely loaded.
+ @result Returns the raw data associated with the datasource. Returns nil
+ if the datasource hasn't loaded any data.
+ - (NSData *)data;
+ */
+ HRESULT data([out, retval] IStream** stream);
+
+ /*!
+ @method representation
+ @discussion A representation holds a type specific representation
+ of the datasource's data. The representation class is determined by mapping
+ a MIME type to a class. The representation is created once the MIME type
+ of the datasource content has been determined.
+ @result Returns the representation associated with this datasource.
+ Returns nil if the datasource hasn't created it's representation.
+ - (id <WebDocumentRepresentation>)representation;
+ */
+ HRESULT representation([out, retval] IWebDocumentRepresentation** rep);
+
+ /*!
+ @method webFrame
+ @result Return the frame that represents this data source.
+ - (WebFrame *)webFrame;
+ */
+ HRESULT webFrame([out, retval] IWebFrame** frame);
+
+ /*!
+ @method initialRequest
+ @result Returns a reference to the original request that created the
+ datasource. This request will be unmodified by WebKit.
+ - (NSURLRequest *)initialRequest;
+ */
+ HRESULT initialRequest([out, retval] IWebURLRequest** request);
+
+ /*!
+ @method request
+ @result Returns the request that was used to create this datasource.
+ - (NSMutableURLRequest *)request;
+ */
+ HRESULT request([out, retval] IWebMutableURLRequest** request);
+
+ /*!
+ @method response
+ @result returns the WebResourceResponse for the data source.
+ - (NSURLResponse *)response;
+ */
+ HRESULT response([out, retval] IWebURLResponse** response);
+
+ /*!
+ @method textEncodingName
+ @result Returns either the override encoding, as set on the WebView for this
+ dataSource or the encoding from the response.
+ - (NSString *)textEncodingName;
+ */
+ HRESULT textEncodingName([out, retval] BSTR* name);
+
+ /*!
+ @method isLoading
+ @discussion Returns YES if there are any pending loads.
+ - (BOOL)isLoading;
+ */
+ HRESULT isLoading([out, retval] BOOL* loading);
+
+ /*!
+ @method pageTitle
+ @result Returns nil or the page title.
+ - (NSString *)pageTitle;
+ */
+ HRESULT pageTitle([out, retval] BSTR* title);
+
+ /*!
+ @method unreachableURL
+ @discussion This will be non-nil only for dataSources created by calls to the
+ WebFrame method loadAlternateHTMLString:baseURL:forUnreachableURL:.
+ @result returns the unreachableURL for which this dataSource is showing alternate content, or nil
+ - (NSURL *)unreachableURL;
+ */
+ HRESULT unreachableURL([out, retval] BSTR* url);
+
+ /*!
+ @method webArchive
+ @result A WebArchive representing the data source, its subresources and child frames.
+ @description This method constructs a WebArchive using the original downloaded data.
+ In the case of HTML, if the current state of the document is preferred, webArchive should be
+ called on the DOM document instead.
+ - (WebArchive *)webArchive;
+ */
+ HRESULT webArchive([out, retval] IWebArchive** archive);
+
+ /*!
+ @method mainResource
+ @result A WebResource representing the data source.
+ @description This method constructs a WebResource using the original downloaded data.
+ This method can be used to construct a WebArchive in case the archive returned by
+ WebDataSource's webArchive isn't sufficient.
+ - (WebResource *)mainResource;
+ */
+ HRESULT mainResource([out, retval] IWebResource** resource);
+
+ /*!
+ @method subresources
+ @abstract Returns all the subresources associated with the data source.
+ @description The returned array only contains subresources that have fully downloaded.
+ - (NSArray *)subresources;
+ */
+ HRESULT subresources([out, retval] IEnumVARIANT** enumResources);
+
+ /*!
+ method subresourceForURL:
+ @abstract Returns a subresource for a given URL.
+ @param URL The URL of the subresource.
+ @description Returns non-nil if the data source has fully downloaded a subresource with the given URL.
+ - (WebResource *)subresourceForURL:(NSURL *)URL;
+ */
+ HRESULT subresourceForURL([in] BSTR url, [out, retval] IWebResource** resource);
+
+ /*!
+ @method addSubresource:
+ @abstract Adds a subresource to the data source.
+ @param subresource The subresource to be added.
+ @description addSubresource: adds a subresource to the data source's list of subresources.
+ Later, if something causes the data source to load the URL of the subresource, the data source
+ will load the data from the subresource instead of from the network. For example, if one wants to add
+ an image that is already downloaded to a web page, addSubresource: can be called so that the data source
+ uses the downloaded image rather than accessing the network. NOTE: If the data source already has a
+ subresource with the same URL, addSubresource: will replace it.
+ - (void)addSubresource:(WebResource *)subresource;
+ */
+ HRESULT addSubresource([in] IWebResource* subresource);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(4B80B7D4-98D7-4a80-AF46-2AF84B2F2E8F),
+ pointer_default(unique)
+]
+interface IWebDataSourcePrivate : IUnknown
+{
+ HRESULT overrideEncoding([out, retval] BSTR* encoding);
+ HRESULT setOverrideEncoding([in] BSTR encoding);
+ HRESULT mainDocumentError([out, retval] IWebError** error);
+}
diff --git a/WebKit/win/Interfaces/IWebDatabaseManager.idl b/WebKit/win/Interfaces/IWebDatabaseManager.idl
new file mode 100644
index 0000000..c877c03
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebDatabaseManager.idl
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+interface IWebSecurityOrigin;
+
+cpp_quote("#define WebDatabaseDisplayNameKey TEXT(\"WebDatabaseDisplayNameKey\")")
+cpp_quote("#define WebDatabaseExpectedSizeKey TEXT(\"WebDatabaseExpectedSizeKey\")")
+cpp_quote("#define WebDatabaseUsageKey TEXT(\"WebDatabaseUsageKey\")")
+
+cpp_quote("#define WebDatabaseDidModifyOriginNotification TEXT(\"WebDatabaseDidModifyOriginNotification\")")
+cpp_quote("#define WebDatabaseDidModifyDatabaseNotification TEXT(\"WebDatabaseDidModifyDatabaseNotification\")")
+cpp_quote("#define WebDatabaseNameKey TEXT(\"WebDatabaseNameKey\")")
+
+#ifndef DO_NO_IMPORTS
+import "IWebSecurityOrigin.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(5724f010-a77b-4a42-8f89-a5095b61d469),
+ pointer_default(unique)
+]
+interface IWebDatabaseManager : IUnknown
+{
+ HRESULT sharedWebDatabaseManager([out, retval] IWebDatabaseManager** result);
+
+ HRESULT origins([out, retval] IEnumVARIANT** result);
+ HRESULT databasesWithOrigin([in] IWebSecurityOrigin* origin, [out, retval] IEnumVARIANT** result);
+ HRESULT detailsForDatabase([in] BSTR databaseName, [in] IWebSecurityOrigin* origin, [out, retval] IPropertyBag **result);
+
+ HRESULT deleteAllDatabases();
+ HRESULT deleteOrigin([in] IWebSecurityOrigin* origin);
+ HRESULT deleteDatabase([in] BSTR databaseName, [in] IWebSecurityOrigin* origin);
+}
diff --git a/WebKit/win/Interfaces/IWebDocument.idl b/WebKit/win/Interfaces/IWebDocument.idl
new file mode 100644
index 0000000..24097ce
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebDocument.idl
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebError.idl";
+import "IWebDataSource.idl";
+#endif
+
+interface IWebError;
+interface IWebDataSource;
+
+/*!
+ @protocol WebDocumentView
+ @discussion Protocol implemented by the document view of WebFrameView
+
+ @protocol WebDocumentView <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(0A6397A7-90FE-49a0-B9C1-44693DD779F7),
+ pointer_default(unique)
+]
+interface IWebDocumentView : IUnknown
+{
+ /*!
+ @method setDataSource:
+ @abstract Called when the corresponding data source has been created.
+ @param dataSource The corresponding data source.
+ - (void)setDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT setDataSource([in] IWebDataSource* dataSource);
+
+ /*!
+ @method dataSourceUpdated:
+ @abstract Called when the corresponding data source has received data.
+ @param dataSource The corresponding data source.
+ - (void)dataSourceUpdated:(WebDataSource *)dataSource;
+ */
+ HRESULT dataSourceUpdated([in] IWebDataSource* dataSource);
+
+ /*!
+ @method setNeedsLayout:
+ @discussion Called when WebKit has determined that the document view needs to layout.
+ This method should simply set a flag and call layout from drawRect if the flag is YES.
+ @param flag YES to cause a layout, no to not cause a layout.
+ - (void)setNeedsLayout:(BOOL)flag;
+ */
+ HRESULT setNeedsLayout([in] BOOL flag);
+
+ /*!
+ @method layout
+ @discussion Called when the document view must immediately layout. For simple views,
+ setting the frame is a sufficient implementation of this method.
+ - (void)layout;
+ */
+ HRESULT layout();
+
+ /*!
+ @method viewWillMoveToHostWindow:
+ @param hostWindow The host window for the document view.
+ @abstract Called before the host window is set on the parent web view.
+ - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
+ */
+ HRESULT viewWillMoveToHostWindow([in] OLE_HANDLE hwnd);
+
+ /*!
+ @method viewDidMoveToHostWindow
+ @abstract Called after the host window is set on the parent web view.
+ - (void)viewDidMoveToHostWindow;
+ */
+ HRESULT viewDidMoveToHostWindow();
+}
+
+/*!
+ @protocol WebDocumentSearching
+ @discussion Optional protocol for searching document view of WebFrameView.
+
+ @protocol WebDocumentSearching <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(0213643B-8DF9-4ba4-9534-61D92CB75007),
+ pointer_default(unique)
+]
+interface IWebDocumentSearching : IUnknown
+{
+ /*!
+ @method searchFor:direction:caseSensitive:wrap:
+ @abstract Searches a document view for a string and highlights the string if it is found.
+ @param string The string to search for.
+ @param forward YES to search forward, NO to seach backwards.
+ @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
+ @param wrapFlag YES to wrap around, NO to avoid wrapping.
+ @result YES if found, NO if not found.
+ - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
+ */
+ HRESULT searchFor([in] BSTR str, [in] BOOL forwardDirection, [in] BOOL caseSensitive, [in] BOOL wrap, [out, retval] BOOL* result);
+}
+
+/*!
+ @protocol WebDocumentText
+ @discussion Optional protocol for supporting text operations.
+
+ @protocol WebDocumentText <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(B6282B92-6F31-4948-A3A0-89763C56BBBF),
+ pointer_default(unique)
+]
+interface IWebDocumentText : IUnknown
+{
+ /*!
+ @method supportsTextEncoding
+ @result YES if the document view support text encoding, NO if it doesn't.
+ - (BOOL)supportsTextEncoding;
+ */
+ HRESULT supportsTextEncoding([out, retval] BOOL* result);
+
+ /*!
+ @method string
+ @result String that represents the entire document.
+ - (NSString *)string;
+ */
+ HRESULT string([out, retval] BSTR* result);
+
+ /*!
+ @method selectedString
+ @result String that represents the current selection.
+ - (NSString *)selectedString;
+ */
+ HRESULT selectedString([out, retval] BSTR* result);
+
+ /*!
+ @method selectAll
+ @abstract Selects all the text in the document.
+ - (void)selectAll;
+ */
+ HRESULT selectAll();
+
+ /*!
+ @method deselectText
+ @abstract Causes a text selection to lose its selection.
+ - (void)deselectAll;
+ */
+ HRESULT deselectAll();
+}
+
+/*!
+ @protocol WebDocumentRepresentation
+ @discussion Protocol implemented by the document representation of a data source.
+
+ @protocol WebDocumentRepresentation <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(3C9F6251-CFD8-447a-B429-6B6AE627436C),
+ pointer_default(unique)
+]
+interface IWebDocumentRepresentation : IUnknown
+{
+ /*!
+ @method setDataSource:
+ @abstract Called soon after the document representation is created.
+ @param dataSource The data source that is set.
+ - (void)setDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT setDataSource([in] IWebDataSource* dataSource);
+
+ /*!
+ @method receivedData:withDataSource:
+ @abstract Called when the data source has received data.
+ @param data The data that the data source has received.
+ @param dataSource The data source that has received data.
+ - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT receivedData([in] IStream* data, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method receivedError:withDataSource:
+ @abstract Called when the data source has received an error.
+ @param error The error that the data source has received.
+ @param dataSource The data source that has received the error.
+ - (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT receivedError([in] IWebError* error, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method finishedLoadingWithDataSource:
+ @abstract Called when the data source has finished loading.
+ @param dataSource The datasource that has finished loading.
+ - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT finishedLoadingWithDataSource([in] IWebDataSource* dataSource);
+
+ /*!
+ @method canProvideDocumentSource
+ @result Returns true if the representation can provide document source.
+ - (BOOL)canProvideDocumentSource;
+ */
+ HRESULT canProvideDocumentSource([out, retval] BOOL* result);
+
+ /*!
+ @method documentSource
+ @result Returns the textual source representation of the document. For HTML documents
+ this is the original HTML source.
+ - (NSString *)documentSource;
+ */
+ HRESULT documentSource([out, retval] BSTR* source);
+
+ /*!
+ @method title
+ @result Return the title for the document.
+ - (NSString *)title;
+ */
+ HRESULT title([out, retval] BSTR* docTitle);
+}
diff --git a/WebKit/win/Interfaces/IWebDownload.idl b/WebKit/win/Interfaces/IWebDownload.idl
new file mode 100644
index 0000000..eb644ef
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebDownload.idl
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebError.idl";
+import "IWebMutableURLRequest.idl";
+import "IWebURLAuthenticationChallenge.idl";
+import "IWebURLResponse.idl";
+import "IWebURLRequest.idl";
+#endif
+
+interface IWebDownloadDelegate;
+interface IWebError;
+interface IWebMutableURLRequest;
+interface IWebURLAuthenticationChallenge;
+interface IWebURLRequest;
+interface IWebURLResponse;
+
+/*!
+ @class WebDownload
+ @discussion A WebDownload works just like an NSURLDownload, with
+ one extra feature: if you do not implement the
+ authentication-related delegate methods, it will automatically
+ prompt for authentication using the standard WebKit authentication
+ panel, as either a sheet or window. It provides no extra methods,
+ but does have one additional delegate method.
+*/
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(65EFE83B-A9E4-4516-8F3B-BAA25DA90FFD),
+ pointer_default(unique)
+]
+interface IWebDownload : IUnknown
+{
+ /*
+ + (BOOL)canResumeDownloadDecodedWithEncodingMIMEType:(NSString *)MIMEType
+ */
+ HRESULT canResumeDownloadDecodedWithEncodingMIMEType([in] BSTR mimeType, [out, retval] BOOL* result);
+
+ /*
+ - (void)cancel
+ */
+ HRESULT cancel();
+
+ /*
+ - (void)cancelForResume();
+ */
+ HRESULT cancelForResume();
+
+ /*
+ - (void)start
+ */
+ HRESULT start();
+
+ /*
+ - (BOOL)deletesFileUponFailure
+ */
+ HRESULT deletesFileUponFailure([out, retval] BOOL* result);
+
+ /*
+ - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate
+ */
+ HRESULT initWithRequest([in] IWebURLRequest* request, [in] IWebDownloadDelegate* delegate);
+
+ /*
+ - (id)initWithResumeData:(NSData *)resumeData delegate:(id)delegate path:(NSString *)path
+ */
+ HRESULT initToResumeWithBundle([in] BSTR bundlePath, [in] IWebDownloadDelegate* delegate);
+
+ /*
+ - (String)bundlePathForTargetPath:(String)targetPath
+ */
+ HRESULT bundlePathForTargetPath([in] BSTR target, [out, retval] BSTR* bundle);
+
+ /*
+ - (NSURLRequest *)request
+ */
+ HRESULT request([out, retval] IWebURLRequest** request);
+
+ /*
+ - (void)setDeletesFileUponFailure:(BOOL)deletesFileUponFailure
+ */
+ HRESULT setDeletesFileUponFailure([in] BOOL deletesFileUponFailure);
+
+ /*
+ - (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite
+ */
+ HRESULT setDestination([in] BSTR path, [in] BOOL allowOverwrite);
+}
+
+
+/*!
+ @protocol WebDownloadDelegate
+ @discussion The WebDownloadDelegate delegate has one extra method used to choose
+ the right window when automatically prompting with a sheet.
+ @interface NSObject (WebDownloadDelegate)
+*/
+
+[
+ object,
+ oleautomation,
+ uuid(16A32AE6-C862-40cd-9225-2CAF823F40F9),
+ pointer_default(unique)
+]
+interface IWebDownloadDelegate : IUnknown
+{
+ HRESULT decideDestinationWithSuggestedFilename([in] IWebDownload* download, [in] BSTR filename);
+
+ HRESULT didCancelAuthenticationChallenge([in] IWebDownload* download, [in] IWebURLAuthenticationChallenge* challenge);
+
+ HRESULT didCreateDestination([in] IWebDownload* download, [in] BSTR destination);
+
+ HRESULT didFailWithError([in] IWebDownload* download, [in] IWebError* error);
+
+ HRESULT didReceiveAuthenticationChallenge([in] IWebDownload* download, [in] IWebURLAuthenticationChallenge* challenge);
+
+ HRESULT didReceiveDataOfLength([in] IWebDownload* download, [in] unsigned length);
+
+ HRESULT didReceiveResponse([in] IWebDownload* download, [in] IWebURLResponse* response);
+
+ HRESULT shouldDecodeSourceDataOfMIMEType([in] IWebDownload* download, [in] BSTR encodingType, [out, retval] BOOL* shouldDecode);
+
+ HRESULT willResumeWithResponse([in] IWebDownload* download, [in] IWebURLResponse* response, [in] long long fromByte);
+
+ HRESULT willSendRequest([in] IWebDownload* download, [in] IWebMutableURLRequest* request, [in] IWebURLResponse* redirectResponse, [out] IWebMutableURLRequest** finalRequest);
+
+ HRESULT didBegin([in] IWebDownload* download);
+
+ HRESULT didFinish([in] IWebDownload* download);
+}
diff --git a/WebKit/win/Interfaces/IWebEditingDelegate.idl b/WebKit/win/Interfaces/IWebEditingDelegate.idl
new file mode 100644
index 0000000..b92aad2
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebEditingDelegate.idl
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebNotification.idl";
+import "DOMCore.idl";
+import "DOMCSS.idl";
+import "DOMRange.idl";
+import "IWebUndoManager.idl";
+import "IWebView.idl";
+#endif
+
+interface IDOMCSSStyleDeclaration;
+interface IDOMNode;
+interface IDOMRange;
+interface IWebView;
+interface IWebNotification;
+interface IWebUndoManager;
+
+typedef enum _WebViewInsertAction {
+ WebViewInsertActionTyped,
+ WebViewInsertActionPasted,
+ WebViewInsertActionDropped,
+} WebViewInsertAction;
+
+[
+ object,
+ oleautomation,
+ uuid(B0F960E7-FB81-447f-A958-E02DA02ADBB7),
+ pointer_default(unique)
+]
+interface IEnumSpellingGuesses : IUnknown
+{
+ HRESULT Next(ULONG celt, [out] BSTR* guess, [out] ULONG* pceltFetched);
+ HRESULT Skip(ULONG celt);
+ HRESULT Reset(void);
+ HRESULT Clone([out, retval] IEnumSpellingGuesses** ppenum);
+};
+
+[
+ object,
+ oleautomation,
+ uuid(8B95C1B3-E1B3-4f97-80D6-2240417E3E0C),
+ pointer_default(unique)
+]
+interface IWebGrammarDetail : IUnknown
+{
+ HRESULT location([out, retval] int* value);
+ HRESULT length([out, retval] int* value);
+ HRESULT userDescription([out, retval] BSTR* value);
+ HRESULT guesses([out, retval] IEnumSpellingGuesses** guesses);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(FABCC69A-5917-4242-A19A-42E8B62227A7),
+ pointer_default(unique)
+]
+interface IEnumWebGrammarDetails : IUnknown
+{
+ HRESULT Next(ULONG celt, [out] IWebGrammarDetail** detail, [out] ULONG* pceltFetched);
+ HRESULT Skip(ULONG celt);
+ HRESULT Reset(void);
+ HRESULT Clone([out, retval] IEnumSpellingGuesses** ppenum);
+};
+
+/*
+ @interface NSObject (WebViewEditingDelegate)
+*/
+[
+ object,
+ oleautomation,
+ uuid(2C75A1E3-EE9D-45c8-A385-19DE68AC5675),
+ pointer_default(unique)
+]
+interface IWebEditingDelegate : IUnknown
+{
+ /*
+ - (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range;
+ */
+ HRESULT shouldBeginEditingInDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range;
+ */
+ HRESULT shouldEndEditingInDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
+ */
+ HRESULT shouldInsertNode([in] IWebView* webView, [in] IDOMNode* node, [in] IDOMRange* range, [in] WebViewInsertAction action);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
+ */
+ HRESULT shouldInsertText([in] IWebView* webView, [in] BSTR text, [in] IDOMRange* range, [in] WebViewInsertAction action, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldDeleteDOMRange:(DOMRange *)range;
+ */
+ HRESULT shouldDeleteDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
+ */
+ HRESULT shouldChangeSelectedDOMRange([in] IWebView* webView, [in] IDOMRange* currentRange, [in] IDOMRange* proposedRange, [in] WebSelectionAffinity selectionAffinity, [in] BOOL stillSelecting, [out, retval] BOOL* result);
+ /*
+ - (BOOL)webView:(WebView *)webView shouldApplyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range;
+ */
+ HRESULT shouldApplyStyle([in] IWebView* webView, [in] IDOMCSSStyleDeclaration* style, [in] IDOMRange* range, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle;
+ */
+ HRESULT shouldChangeTypingStyle([in] IWebView* webView, [in] IDOMCSSStyleDeclaration* currentStyle, [in] IDOMCSSStyleDeclaration* proposedStyle, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)webView:(WebView *)webView doCommandBySelector:(SEL)selector;
+ */
+ HRESULT doPlatformCommand([in] IWebView* webView, [in] BSTR command, [out, retval] BOOL* result);
+
+ /*
+ - (void)webViewDidBeginEditing:(NSNotification *)notification;
+ */
+ HRESULT webViewDidBeginEditing([in] IWebNotification* notification);
+
+ /*
+ - (void)webViewDidChange:(NSNotification *)notification;
+ */
+ HRESULT webViewDidChange([in] IWebNotification* notification);
+
+ /*
+ - (void)webViewDidEndEditing:(NSNotification *)notification;
+ */
+ HRESULT webViewDidEndEditing([in] IWebNotification* notification);
+
+ /*
+ - (void)webViewDidChangeTypingStyle:(NSNotification *)notification;
+ */
+ HRESULT webViewDidChangeTypingStyle([in] IWebNotification* notification);
+
+ /*
+ - (void)webViewDidChangeSelection:(NSNotification *)notification;
+ */
+ HRESULT webViewDidChangeSelection([in] IWebNotification* notification);
+
+ /*
+ - (NSUndoManager *)undoManagerForWebView:(WebView *)webView;
+ */
+ HRESULT undoManagerForWebView([in] IWebView* webView, [out, retval] IWebUndoManager** undoManager);
+
+ HRESULT ignoreWordInSpellDocument([in] IWebView* view, [in] BSTR word);
+ HRESULT learnWord([in] BSTR word);
+ HRESULT checkSpellingOfString([in] IWebView* view, [in] LPCTSTR text, [in] int length, [out] int* misspellingLocation, [out] int* misspellingLength);
+ HRESULT checkGrammarOfString([in] IWebView* view, [in] LPCTSTR text, [in] int length, [out] IEnumWebGrammarDetails** grammarDetails, [out] int* badGrammarLocation, [out] int* badGrammarLength);
+ HRESULT updateSpellingUIWithGrammarString([in] BSTR string, [in] int location, [in] int length, [in] BSTR userDescription, [in] BSTR* guesses, [in] int guessesCount);
+ HRESULT updateSpellingUIWithMisspelledWord([in] BSTR word);
+ HRESULT showSpellingUI([in] BOOL show);
+ HRESULT spellingUIIsShowing([out, retval] BOOL* result);
+ HRESULT guessesForWord([in] BSTR word, [out, retval] IEnumSpellingGuesses** guesses);
+ HRESULT closeSpellDocument([in] IWebView* view);
+ HRESULT sharedSpellCheckerExists([out, retval] BOOL* exists);
+ HRESULT preflightChosenSpellServer();
+ HRESULT updateGrammar();
+}
diff --git a/WebKit/win/Interfaces/IWebError.idl b/WebKit/win/Interfaces/IWebError.idl
new file mode 100644
index 0000000..4353ac6
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebError.idl
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("#define WebURLErrorDomain TEXT(\"CFURLErrorDomain\")")
+/*!
+ @enum NSURL-related Error Codes
+ @abstract Constants used by NSError to indicate errors in the WebFoundation domain
+ @discussion Documentation on each constant forthcoming.
+*/
+enum
+{
+ WebURLErrorUnknown = -1,
+ WebURLErrorCancelled = -999,
+ WebURLErrorBadURL = -1000,
+ WebURLErrorTimedOut = -1001,
+ WebURLErrorUnsupportedURL = -1002,
+ WebURLErrorCannotFindHost = -1003,
+ WebURLErrorCannotConnectToHost = -1004,
+ WebURLErrorNetworkConnectionLost = -1005,
+ WebURLErrorDNSLookupFailed = -1006,
+ WebURLErrorHTTPTooManyRedirects = -1007,
+ WebURLErrorResourceUnavailable = -1008,
+ WebURLErrorNotConnectedToInternet = -1009,
+ WebURLErrorRedirectToNonExistentLocation = -1010,
+ WebURLErrorBadServerResponse = -1011,
+ WebURLErrorUserCancelledAuthentication = -1012,
+ WebURLErrorUserAuthenticationRequired = -1013,
+ WebURLErrorZeroByteResource = -1014,
+ WebURLErrorFileDoesNotExist = -1100,
+ WebURLErrorFileIsDirectory = -1101,
+ WebURLErrorNoPermissionsToReadFile = -1102,
+ WebURLErrorSecureConnectionFailed = -1200,
+ WebURLErrorServerCertificateHasBadDate = -1201,
+ WebURLErrorServerCertificateUntrusted = -1202,
+ WebURLErrorServerCertificateHasUnknownRoot = -1203,
+ WebURLErrorServerCertificateNotYetValid = -1204,
+ WebURLErrorClientCertificateRejected = -1205,
+ WebURLErrorClientCertificateRequired = -1206,
+ WebURLErrorCannotLoadFromNetwork = -2000,
+
+ // Download and file I/O errors
+ WebURLErrorCannotCreateFile = -3000,
+ WebURLErrorCannotOpenFile = -3001,
+ WebURLErrorCannotCloseFile = -3002,
+ WebURLErrorCannotWriteToFile = -3003,
+ WebURLErrorCannotRemoveFile = -3004,
+ WebURLErrorCannotMoveFile = -3005,
+ WebURLErrorDownloadDecodingFailedMidStream = -3006,
+ WebURLErrorDownloadDecodingFailedToComplete =-3007,
+};
+
+cpp_quote("#define WebKitErrorDomain TEXT(\"WebKitErrorDomain\")")
+/*!
+ @enum
+ @abstract Policy errors
+ @constant WebKitErrorCannotShowMIMEType
+ @constant WebKitErrorCannotShowURL
+ @constant WebKitErrorFrameLoadInterruptedByPolicyChange
+*/
+enum {
+ WebKitErrorCannotShowMIMEType = 100,
+ WebKitErrorCannotShowURL = 101,
+ WebKitErrorFrameLoadInterruptedByPolicyChange = 102,
+ WebKitErrorCannotUseRestrictedPort = 103,
+};
+
+/*!
+ @enum
+ @abstract Plug-in and java errors
+ @constant WebKitErrorCannotFindPlugIn
+ @constant WebKitErrorCannotLoadPlugIn
+ @constant WebKitErrorJavaUnavailable
+*/
+enum {
+ WebKitErrorCannotFindPlugIn = 200,
+ WebKitErrorCannotLoadPlugIn = 201,
+ WebKitErrorJavaUnavailable = 202,
+};
+
+cpp_quote("#define WebKitErrorMIMETypeKey TEXT(\"WebKitErrorMIMETypeKey\")")
+cpp_quote("#define WebKitErrorPlugInNameKey TEXT(\"WebKitErrorPlugInNameKey\")")
+cpp_quote("#define WebKitErrorPlugInPageURLStringKey TEXT(\"WebKitErrorPlugInPageURLStringKey\")")
+
+cpp_quote("#define WebPOSIXErrorDomain TEXT(\"NSPOSIXErrorDomain\")")
+cpp_quote("#define WebPOSIXErrorECONNRESET 54")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(89E3B189-0B60-4d6b-A87A-3F1172CB5538),
+ pointer_default(unique)
+]
+interface IWebError : IUnknown
+{
+ HRESULT init([in] BSTR domain, [in] int code, [in] BSTR url);
+
+ /*
+ - (int)code
+ */
+ HRESULT code([out, retval] int* result);
+
+ /*
+ - (NSString *)domain
+ */
+ HRESULT domain([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)localizedDescription
+ */
+ HRESULT localizedDescription([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)localizedFailureReason
+ */
+ HRESULT localizedFailureReason([out, retval] BSTR* result);
+
+ /*
+ - (NSArray *)localizedRecoveryOptions
+ */
+ HRESULT localizedRecoveryOptions([out, retval] IEnumVARIANT** enumOptions);
+
+ /*
+ - (NSString *)localizedRecoverySuggestion
+ */
+ HRESULT localizedRecoverySuggestion([out, retval] BSTR* result);
+
+ /*
+ - (id)recoverAttempter
+ */
+ HRESULT recoverAttempter([out, retval] IUnknown** result);
+
+ /*
+ - (NSDictionary *)userInfo
+ */
+ HRESULT userInfo([out, retval] IPropertyBag** result);
+
+ HRESULT failingURL([out, retval] BSTR* result);
+
+ HRESULT isPolicyChangeError([out, retval] BOOL* result);
+}
diff --git a/WebKit/win/Interfaces/IWebErrorPrivate.idl b/WebKit/win/Interfaces/IWebErrorPrivate.idl
new file mode 100644
index 0000000..d450c88
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebErrorPrivate.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("#define WebKitErrorPlugInCancelledConnection 203")
+cpp_quote("// FIXME: WebKitErrorPlugInWillHandleLoad is used for the cancel we do to prevent loading plugin content twice. See <rdar://problem/4258008>")
+cpp_quote("#define WebKitErrorPlugInWillHandleLoad 204")
+
+cpp_quote("#define WebErrorFailingURLKey TEXT(\"WebErrorFailingURLKey\")")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(19FED49C-7016-48a6-B5C6-07ADE116531B),
+ pointer_default(unique)
+]
+
+interface IWebErrorPrivate : IUnknown
+{
+ HRESULT sslPeerCertificate([out, retval] OLE_HANDLE* result);
+}
diff --git a/WebKit/win/Interfaces/IWebFormDelegate.idl b/WebKit/win/Interfaces/IWebFormDelegate.idl
new file mode 100644
index 0000000..bf103c4
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFormDelegate.idl
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMHTML.idl";
+import "IWebFrame.idl";
+#endif
+
+interface IDOMElement;
+interface IDOMHTMLInputElement;
+interface IDOMHTMLTextAreaElement;
+interface IWebFrame;
+
+/*!
+ @protocol WebFormSubmissionListener
+ @discussion .
+*/
+[
+ object,
+ oleautomation,
+ uuid(1911D650-035E-4204-8746-ABECF77A4C9B),
+ pointer_default(unique)
+]
+interface IWebFormSubmissionListener : IUnknown
+{
+ HRESULT continueSubmit();
+}
+
+/*!
+ @class WebFormDelegate
+ @discussion The WebFormDelegate class responds to all WebFormDelegate protocol
+ methods by doing nothing. It's provided for the convenience of clients who only want
+ to implement some of the above methods and ignore others.
+*/
+/*!
+ @protocol WebFormDelegate
+ @discussion .
+
+ Various methods send by controls that edit text to their delegates, which are all
+ analogous to similar methods in AppKit/NSControl.h.
+ These methods are forwarded from widgets used in forms to the WebFormDelegate.
+*/
+[
+ object,
+ oleautomation,
+ uuid(4CBEC1BD-ABC3-4bdb-8E5E-4D3BCF9E8C1E),
+ pointer_default(unique)
+]
+interface IWebFormDelegate : IUnknown
+{
+ //- (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame;
+ HRESULT textFieldDidBeginEditing([in] IDOMHTMLInputElement* element, [in] IWebFrame* frame);
+
+ //- (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame;
+ HRESULT textFieldDidEndEditing([in] IDOMHTMLInputElement* element, [in] IWebFrame* frame);
+
+ //- (void)textDidChangeInTextField:(DOMHTMLInputElement *)element inFrame:(WebFrame *)frame;
+ HRESULT textDidChangeInTextField([in] IDOMHTMLInputElement* element, [in] IWebFrame* frame);
+
+ //- (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element inFrame:(WebFrame *)frame;
+ HRESULT textDidChangeInTextArea([in] IDOMHTMLTextAreaElement* element, [in] IWebFrame* frame);
+
+ //- (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame;
+ HRESULT doPlatformCommand([in] IDOMHTMLInputElement* element, [in] BSTR command, [in] IWebFrame* frame, [out, retval] BOOL* result);
+
+ //- (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event inFrame:(WebFrame *)frame;
+ [local] HRESULT shouldHandleEvent([in] IDOMHTMLInputElement* element, [in] void* event, [in] IWebFrame* frame, [out, retval] BOOL* result);
+
+ // Sent when a form is just about to be submitted (before the load is started)
+ // listener must be sent continue when the delegate is done.
+ //- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
+ HRESULT willSubmitForm([in] IWebFrame* frame, [in] IWebFrame* sourceFrame, [in] IDOMElement* form, [in] IPropertyBag* values, [in] IWebFormSubmissionListener* listener);
+}
diff --git a/WebKit/win/Interfaces/IWebFrame.idl b/WebKit/win/Interfaces/IWebFrame.idl
new file mode 100644
index 0000000..bef3fa3
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFrame.idl
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMHTML.idl";
+import "IWebArchive.idl";
+import "IWebFrameView.idl";
+import "IWebView.idl";
+import "IWebURLRequest.idl";
+import "DOMCore.idl";
+#endif
+
+cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types")
+cpp_quote("#if 0")
+typedef void* JSGlobalContextRef;
+cpp_quote("#else")
+cpp_quote("typedef struct OpaqueJSContext* JSGlobalContextRef;")
+cpp_quote("#endif")
+
+interface IDOMDocument;
+interface IDOMElement;
+interface IDOMHTMLElement;
+interface IWebURLRequest;
+interface IWebArchive;
+interface IWebDataSource;
+interface IWebFramePrivate;
+interface IWebFrameView;
+interface IWebView;
+
+/*!
+ @class WebFrame
+ @discussion Every web page is represented by at least one WebFrame. A WebFrame
+ has a WebFrameView and a WebDataSource.
+ @interface WebFrame : NSObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(B4B22EF7-DD43-4d01-A992-99C4A8B1F845),
+ pointer_default(unique)
+]
+interface IWebFrame : IUnknown
+{
+ /*!
+ @method name
+ @result The frame name.
+ - (NSString *)name;
+ */
+ HRESULT name([out, retval] BSTR* frameName);
+
+ /*!
+ @method webView
+ @result Returns the WebView for the document that includes this frame.
+ - (WebView *)webView;
+ */
+ HRESULT webView([out, retval] IWebView** view);
+
+ /*!
+ @method frameView
+ @result The WebFrameView for this frame.
+ - (WebFrameView *)frameView;
+ */
+ HRESULT frameView([out, retval] IWebFrameView** view);
+
+ /*!
+ @method DOMDocument
+ @abstract Returns the DOM document of the frame.
+ @description Returns nil if the frame does not contain a DOM document such as a standalone image.
+ - (DOMDocument *)DOMDocument;
+ */
+ HRESULT DOMDocument([out, retval] IDOMDocument** document);
+
+ /*!
+ @method frameElement
+ @abstract Returns the frame element of the frame.
+ @description The class of the result is either DOMHTMLFrameElement, DOMHTMLIFrameElement or DOMHTMLObjectElement.
+ Returns nil if the frame is the main frame since there is no frame element for the frame in this case.
+ - (DOMHTMLElement *)frameElement;
+ */
+ HRESULT frameElement([out, retval] IDOMHTMLElement** frameElement);
+
+ /*!
+ @method loadRequest:
+ @param request The web request to load.
+ - (void)loadRequest:(NSURLRequest *)request;
+ */
+ HRESULT loadRequest([in] IWebURLRequest* request);
+
+ /*!
+ @method loadData:MIMEType:textEncodingName:baseURL:
+ @param data The data to use for the main page of the document.
+ @param MIMEType The MIME type of the data.
+ @param encodingName The encoding of the data.
+ @param URL The base URL to apply to relative URLs within the document.
+ - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL;
+ */
+ HRESULT loadData([in] IStream* data, [in] BSTR mimeType, [in] BSTR textEncodingName, [in] BSTR url);
+
+ /*!
+ @method loadHTMLString:baseURL:
+ @param string The string to use for the main page of the document.
+ @param URL The base URL to apply to relative URLs within the document.
+ - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)URL;
+ */
+ HRESULT loadHTMLString([in] BSTR string, [in] BSTR baseURL);
+
+ /*!
+ @method loadAlternateHTMLString:baseURL:forUnreachableURL:
+ @abstract Loads a page to display as a substitute for a URL that could not be reached.
+ @discussion This allows clients to display page-loading errors in the webview itself.
+ This is typically called while processing the WebFrameLoadDelegate method
+ -webView:didFailProvisionalLoadWithError:forFrame: or one of the the WebPolicyDelegate methods
+ -webView:decidePolicyForMIMEType:request:frame:decisionListener: or
+ -webView:unableToImplementPolicyWithError:frame:. If it is called from within one of those
+ three delegate methods then the back/forward list will be maintained appropriately.
+ @param string The string to use for the main page of the document.
+ @param baseURL The baseURL to apply to relative URLs within the document.
+ @param unreachableURL The URL for which this page will serve as alternate content.
+ - (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL;
+ */
+ HRESULT loadAlternateHTMLString([in] BSTR str, [in] BSTR baseURL, [in] BSTR unreachableURL);
+
+ /*!
+ @method loadArchive:
+ @abstract Causes WebFrame to load a WebArchive.
+ @param archive The archive to be loaded.
+ - (void)loadArchive:(WebArchive *)archive;
+ */
+ HRESULT loadArchive([in] IWebArchive* archive);
+
+ /*!
+ @method dataSource
+ @discussion Returns the committed data source. Will return nil if the
+ provisional data source hasn't yet been loaded.
+ @result The datasource for this frame.
+ - (WebDataSource *)dataSource;
+ */
+ HRESULT dataSource([out, retval] IWebDataSource** source);
+
+ /*!
+ @method provisionalDataSource
+ @discussion Will return the provisional data source. The provisional data source will
+ be nil if no data source has been set on the frame, or the data source
+ has successfully transitioned to the committed data source.
+ @result The provisional datasource of this frame.
+ - (WebDataSource *)provisionalDataSource;
+ */
+ HRESULT provisionalDataSource([out, retval] IWebDataSource** source);
+
+ /*!
+ @method stopLoading
+ @discussion Stop any pending loads on the frame's data source,
+ and its children.
+ - (void)stopLoading;
+ */
+ HRESULT stopLoading();
+
+ /*!
+ @method reload
+ - (void)reload;
+ */
+ HRESULT reload();
+
+ /*!
+ @method findFrameNamed:
+ @discussion This method returns a frame with the given name. findFrameNamed returns self
+ for _self and _current, the parent frame for _parent and the main frame for _top.
+ findFrameNamed returns self for _parent and _top if the receiver is the mainFrame.
+ findFrameNamed first searches from the current frame to all descending frames then the
+ rest of the frames in the WebView. If still not found, findFrameNamed searches the
+ frames of the other WebViews.
+ @param name The name of the frame to find.
+ @result The frame matching the provided name. nil if the frame is not found.
+ - (WebFrame *)findFrameNamed:(NSString *)name;
+ */
+ HRESULT findFrameNamed([in] BSTR name, [out, retval] IWebFrame** frame);
+
+ /*!
+ @method parentFrame
+ @result The frame containing this frame, or nil if this is a top level frame.
+ - (WebFrame *)parentFrame;
+ */
+ HRESULT parentFrame([out, retval] IWebFrame** frame);
+
+ /*!
+ @method childFrames
+ @discussion The frames in the array are associated with a frame set or iframe.
+ @result Returns an array of WebFrame.
+ - (NSArray *)childFrames;
+ */
+ HRESULT childFrames([out, retval] IEnumVARIANT** enumFrames);
+
+
+ /* This is a DOMElement on mac, but maybe should be a DOMHTMLFrameElement? */
+ HRESULT currentForm([out, retval] IDOMElement** frameElement);
+
+ /*!
+ @method setAllowsScrolling:
+ @abstract Sets whether the WebFrameView allows its document to be scrolled
+ @param flag YES to allow the document to be scrolled, NO to disallow scrolling
+ - (void)setAllowsScrolling:(BOOL)flag;
+ */
+ HRESULT setAllowsScrolling([in] BOOL flag);
+
+ /*!
+ @method allowsScrolling
+ @abstract Returns whether the WebFrameView allows its document to be scrolled
+ @result YES if the document is allowed to scroll, otherwise NO
+ - (BOOL)allowsScrolling;
+ */
+ HRESULT allowsScrolling([out, retval] BOOL* flag);
+
+ /*!
+ @method globalContext
+ @result The frame's global JavaScript execution context. Use this method to
+ bridge between the WebKit and JavaScriptCore APIs.
+ */
+ [local] JSGlobalContextRef globalContext();
+}
diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl
new file mode 100644
index 0000000..b46ca6d
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFrameLoadDelegate.idl
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScriptObject.idl";
+import "IWebView.idl";
+import "IWebFrame.idl";
+#endif
+
+cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types")
+cpp_quote("#if 0")
+typedef void* JSContextRef;
+typedef void* JSObjectRef;
+cpp_quote("#else")
+cpp_quote("typedef struct OpaqueJSValue* JSObjectRef;")
+cpp_quote("typedef const struct OpaqueJSContext* JSContextRef;")
+cpp_quote("#endif")
+
+
+interface IWebError;
+interface IWebFrame;
+interface IWebScriptObject;
+interface IWebView;
+
+/*!
+ @category WebFrameLoadDelegate
+ @discussion A WebView's WebFrameLoadDelegate tracks the loading progress of its frames.
+ When a data source of a frame starts to load, the data source is considered "provisional".
+ Once at least one byte is received, the data source is considered "committed". This is done
+ so the contents of the frame will not be lost if the new data source fails to successfully load.
+ @interface NSObject (WebFrameLoadDelegate)
+*/
+
+[
+ object,
+ oleautomation,
+ uuid(4CD809C2-73A5-44ee-B0D7-D1863DFE9F57),
+ pointer_default(unique)
+]
+interface IWebFrameLoadDelegate : IUnknown
+{
+ /*!
+ @method webView:didStartProvisionalLoadForFrame:
+ @abstract Notifies the delegate that the provisional load of a frame has started
+ @param webView The WebView sending the message
+ @param frame The frame for which the provisional load has started
+ @discussion This method is called after the provisional data source of a frame
+ has started to load.
+ - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame;
+ */
+ HRESULT didStartProvisionalLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didReceiveServerRedirectForProvisionalLoadForFrame:
+ @abstract Notifies the delegate that a server redirect occurred during the provisional load
+ @param webView The WebView sending the message
+ @param frame The frame for which the redirect occurred
+ - (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame;
+ */
+ HRESULT didReceiveServerRedirectForProvisionalLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didFailProvisionalLoadWithError:forFrame:
+ @abstract Notifies the delegate that the provisional load has failed
+ @param webView The WebView sending the message
+ @param error The error that occurred
+ @param frame The frame for which the error occurred
+ @discussion This method is called after the provisional data source has failed to load.
+ The frame will continue to display the contents of the committed data source if there is one.
+ - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
+ */
+ HRESULT didFailProvisionalLoadWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didCommitLoadForFrame:
+ @abstract Notifies the delegate that the load has changed from provisional to committed
+ @param webView The WebView sending the message
+ @param frame The frame for which the load has committed
+ @discussion This method is called after the provisional data source has become the
+ committed data source.
+
+ In some cases, a single load may be committed more than once. This happens
+ in the case of multipart/x-mixed-replace, also known as "server push". In this case,
+ a single location change leads to multiple documents that are loaded in sequence. When
+ this happens, a new commit will be sent for each document.
+ - (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame;
+ */
+ HRESULT didCommitLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didReceiveTitle:forFrame:
+ @abstract Notifies the delegate that the page title for a frame has been received
+ @param webView The WebView sending the message
+ @param title The new page title
+ @param frame The frame for which the title has been received
+ @discussion The title may update during loading; clients should be prepared for this.
+ - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame;
+ */
+ HRESULT didReceiveTitle([in] IWebView* webView, [in] BSTR title, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didReceiveIcon:forFrame:
+ @abstract Notifies the delegate that a page icon image for a frame has been received
+ @param webView The WebView sending the message
+ @param image The icon image. Also known as a "favicon".
+ @param frame The frame for which a page icon has been received
+ - (void)webView:(WebView *)sender didReceiveIcon:(NSImage *)image forFrame:(WebFrame *)frame;
+ */
+ HRESULT didReceiveIcon([in] IWebView* webView, [in] OLE_HANDLE hBitmap, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didFinishLoadForFrame:
+ @abstract Notifies the delegate that the committed load of a frame has completed
+ @param webView The WebView sending the message
+ @param frame The frame that finished loading
+ @discussion This method is called after the committed data source of a frame has successfully loaded
+ and will only be called when all subresources such as images and stylesheets are done loading.
+ Plug-In content and JavaScript-requested loads may occur after this method is called.
+ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;
+ */
+ HRESULT didFinishLoadForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didFailLoadWithError:forFrame:
+ @abstract Notifies the delegate that the committed load of a frame has failed
+ @param webView The WebView sending the message
+ @param error The error that occurred
+ @param frame The frame that failed to load
+ @discussion This method is called after a data source has committed but failed to completely load.
+ - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
+ */
+ HRESULT didFailLoadWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebFrame* forFrame);
+
+ /*!
+ @method webView:didChangeLocationWithinPageForFrame:
+ @abstract Notifies the delegate that the scroll position in a frame has changed
+ @param webView The WebView sending the message
+ @param frame The frame that scrolled
+ @discussion This method is called when anchors within a page have been clicked.
+ - (void)webView:(WebView *)sender didChangeLocationWithinPageForFrame:(WebFrame *)frame;
+ */
+ HRESULT didChangeLocationWithinPageForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:
+ @abstract Notifies the delegate that a frame will perform a client-side redirect
+ @param webView The WebView sending the message
+ @param URL The URL to be redirected to
+ @param seconds Seconds in which the redirect will happen
+ @param date The fire date
+ @param frame The frame on which the redirect will occur
+ @discussion This method can be used to continue progress feedback while a client-side
+ redirect is pending.
+ - (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame;
+ */
+ HRESULT willPerformClientRedirectToURL([in] IWebView* webView, [in] BSTR url, [in] double delaySeconds, [in] DATE fireDate, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:didCancelClientRedirectForFrame:
+ @abstract Notifies the delegate that a pending client-side redirect has been cancelled
+ @param webView The WebView sending the message
+ @param frame The frame for which the pending redirect was cancelled
+ @discussion A client-side redirect can be cancelled if a frame changes location before the timeout.
+ - (void)webView:(WebView *)sender didCancelClientRedirectForFrame:(WebFrame *)frame;
+ */
+ HRESULT didCancelClientRedirectForFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:willCloseFrame:
+ @abstract Notifies the delegate that a frame will be closed
+ @param webView The WebView sending the message
+ @param frame The frame that will be closed
+ @discussion This method is called right before WebKit is done with the frame
+ and the objects that it contains.
+ - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame;
+ */
+ HRESULT willCloseFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+ /*!
+ @method webView:windowScriptObjectAvailable:
+ @abstract Notifies the delegate that the scripting object for a page is available. This is called
+ before the page is loaded. It may be useful to allow delegates to bind native objects to the window.
+ @param webView The webView sending the message.
+ @param windowScriptObject The WebScriptObject for the window in the scripting environment.
+ - (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject;
+ */
+ [local] HRESULT windowScriptObjectAvailable([in] IWebView* webView, [in] JSContextRef context, [in] JSObjectRef windowScriptObject);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(3354665B-84BA-4fdf-B35E-BF5CF9D96026),
+ pointer_default(unique)
+]
+interface IWebFrameLoadDelegate2 : IWebFrameLoadDelegate
+{
+ [local] HRESULT didClearWindowObject([in] IWebView* webView, [in] JSContextRef context, [in] JSObjectRef windowScriptObject, [in] IWebFrame* frame);
+}
diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl
new file mode 100644
index 0000000..79707a3
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebFrame.idl";
+import "IWebView.idl";
+#endif
+
+interface IWebFrame;
+interface IWebView;
+
+[
+ object,
+ oleautomation,
+ uuid(32DC2531-948D-400e-A82F-FE6668B61A0B),
+ pointer_default(unique)
+]
+interface IWebFrameLoadDelegatePrivate : IUnknown
+{
+ //- (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame;
+ HRESULT didFinishDocumentLoadForFrame([in] IWebView* sender, [in] IWebFrame* frame);
+
+ //- (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
+ HRESULT didFirstLayoutInFrame([in] IWebView* sender, [in] IWebFrame* frame);
+
+ // Addresses 4192534. Private API for now.
+ //- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;
+ HRESULT didHandleOnloadEventsForFrame([in] IWebView* sender, [in] IWebFrame* frame);
+}
diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl
new file mode 100755
index 0000000..2923dfc
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFramePrivate.idl
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebFrame.idl";
+#endif
+
+interface IWebFrame;
+
+typedef enum {
+ WebFrameLoadTypeStandard,
+ WebFrameLoadTypeBack,
+ WebFrameLoadTypeForward,
+ WebFrameLoadTypeIndexedBackForward, // a multi-item hop in the backforward list
+ WebFrameLoadTypeReload,
+ WebFrameLoadTypeReloadAllowingStaleData,
+ WebFrameLoadTypeSame, // user loads same URL again (but not reload button)
+ WebFrameLoadTypeRedirectWithLockedHistory,
+ WebFrameLoadTypeReplace
+} WebFrameLoadType;
+
+[
+ object,
+ oleautomation,
+ uuid(A1657D07-4881-4475-9D10-76548731D448),
+ pointer_default(unique)
+]
+
+interface IWebFramePrivate : IUnknown
+{
+ HRESULT renderTreeAsExternalRepresentation([out, retval] BSTR* result);
+ HRESULT scrollOffset([out, retval] SIZE* offset);
+
+ // FIXME: This shouldn't be needed once IWebDocumentView is implemented.
+ HRESULT layout();
+ HRESULT firstLayoutDone([out, retval] BOOL* result);
+ HRESULT loadType([out, retval] WebFrameLoadType* type);
+
+ HRESULT setInPrintingMode([in] BOOL value, [in] HDC printDC);
+ HRESULT getPrintedPageCount([in] HDC printDC, [out, retval] UINT* pageCount);
+ [local] HRESULT spoolPages([in] HDC printDC, [in] UINT startPage, [in] UINT endPage, [out, retval] void* ctx);
+
+ HRESULT isFrameSet([out, retval] BOOL* result);
+ HRESULT string([out, retval] BSTR* result);
+
+ HRESULT size([out, retval] SIZE* size);
+ HRESULT hasScrollBars([out, retval] BOOL* result);
+ HRESULT contentBounds([out, retval] RECT* result);
+ HRESULT frameBounds([out, retval] RECT* result);
+
+ HRESULT isDescendantOfFrame([in] IWebFrame* ancestor, [out, retval] BOOL* result);
+}
diff --git a/WebKit/win/Interfaces/IWebFrameView.idl b/WebKit/win/Interfaces/IWebFrameView.idl
new file mode 100644
index 0000000..d5c82a1
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebFrameView.idl
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebDocument.idl";
+#endif
+
+/*!
+ @class WebFrameView
+ @interface WebFrameView : NSView
+*/
+interface IWebFrame;
+interface IWebDocumentView;
+
+[
+ object,
+ oleautomation,
+ uuid(E23E1B15-78F6-4e89-AD2E-49992A040A35),
+ pointer_default(unique)
+]
+interface IWebFrameView : IUnknown
+{
+ /*!
+ @method webFrame
+ @abstract Returns the WebFrame associated with this WebFrameView
+ @result The WebFrameView's frame.
+ - (WebFrame *)webFrame;
+ */
+ HRESULT webFrame([out, retval] IWebFrame** frame);
+
+ /*!
+ @method documentView
+ @abstract Returns the WebFrameView's document subview
+ @result The subview that renders the WebFrameView's contents
+ - (NSView <WebDocumentView> *)documentView;
+ */
+ HRESULT documentView([out, retval] IWebDocumentView** view);
+
+ /*!
+ @method setAllowsScrolling:
+ @abstract Sets whether the WebFrameView allows its document to be scrolled
+ @param flag YES to allow the document to be scrolled, NO to disallow scrolling
+ - (void)setAllowsScrolling:(BOOL)flag;
+ */
+ HRESULT setAllowsScrolling([in] BOOL flag);
+
+ /*!
+ @method allowsScrolling
+ @abstract Returns whether the WebFrameView allows its document to be scrolled
+ @result YES if the document is allowed to scroll, otherwise NO
+ - (BOOL)allowsScrolling;
+ */
+ HRESULT allowsScrolling([out, retval] BOOL* flag);
+}
diff --git a/WebKit/win/Interfaces/IWebHTMLRepresentation.idl b/WebKit/win/Interfaces/IWebHTMLRepresentation.idl
new file mode 100644
index 0000000..7fbd451
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebHTMLRepresentation.idl
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "DOMCore.idl";
+#endif
+
+interface IDOMElement;
+interface IDOMNode;
+
+/*!
+ @class WebHTMLRepresentation
+*/
+[
+ object,
+ oleautomation,
+ uuid(E043542A-9545-4de3-8DF0-794FD6811CB1),
+ pointer_default(unique)
+]
+interface IWebHTMLRepresentation : IUnknown
+{
+ /*
+ + (NSArray *)supportedMIMETypes;
+ */
+ HRESULT supportedMIMETypes([in, out] BSTR* types, [in, out] int* cTypes);
+
+ /*
+ + (NSArray *)supportedNonImageMIMETypes;
+ */
+ HRESULT supportedNonImageMIMETypes([in, out] BSTR* types, [in, out] int* cTypes);
+
+ /*
+ + (NSArray *)supportedImageMIMETypes;
+ */
+ HRESULT supportedImageMIMETypes([in, out] BSTR* types, [in, out] int* cTypes);
+
+ /*
+ - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
+ */
+ HRESULT attributedStringFromDOMNodes([in] IDOMNode* startNode, [in] int startOffset, [in] IDOMNode* endNode, [in] int endOffset, [out, retval] IDataObject** attributedString);
+
+ /*
+ - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
+ */
+ HRESULT elementWithName([in] BSTR name, [in] IDOMElement* form, [out, retval] IDOMElement** element);
+
+ /*
+ - (BOOL)elementDoesAutoComplete:(DOMElement *)element;
+ */
+ HRESULT elementDoesAutoComplete([in] IDOMElement* element, [out, retval] BOOL* result);
+
+ /*
+ - (BOOL)elementIsPassword:(DOMElement *)element;
+ */
+ HRESULT elementIsPassword([in] IDOMElement* element, [out, retval] BOOL* result);
+
+ /*
+ - (DOMElement *)formForElement:(DOMElement *)element;
+ */
+ HRESULT formForElement([in] IDOMElement* element, [out, retval] IDOMElement** form);
+
+ /*
+ - (DOMElement *)currentForm;
+ */
+ HRESULT currentForm([out, retval] IDOMElement** form);
+
+ /*
+ - (NSArray *)controlsInForm:(DOMElement *)form;
+ */
+ HRESULT controlsInForm([in] IDOMElement* form, [in, out] IDOMElement** controls, [in, out] int* cControls);
+
+ /*
+ - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+ */
+ HRESULT searchForLabels([in, size_is(cLabels)] BSTR* labels, [in] int cLabels, [in] IDOMElement* beforeElement, [out, retval] BSTR* result);
+
+ /*
+ - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
+ */
+ HRESULT matchLabels([in, size_is(cLabels)] BSTR* labels, [in] int cLabels, [in] IDOMElement* againstElement, [out, retval] BSTR* result);
+}
diff --git a/WebKit/win/Interfaces/IWebHTTPURLResponse.idl b/WebKit/win/Interfaces/IWebHTTPURLResponse.idl
new file mode 100644
index 0000000..dd4219e
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebHTTPURLResponse.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebURLResponse.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(56B54483-FA29-4ce5-96FA-2D9B81D57162),
+ pointer_default(unique)
+]
+interface IWebHTTPURLResponse : IWebURLResponse
+{
+ HRESULT allHeaderFields([out, retval] IPropertyBag** headerFields);
+ HRESULT localizedStringForStatusCode([in] int statusCode, [out, retval] BSTR* statusString);
+ HRESULT statusCode([out, retval] int* statusCode);
+ HRESULT isAttachment([out, retval] BOOL* attachment);
+}
diff --git a/WebKit/win/Interfaces/IWebHistory.idl b/WebKit/win/Interfaces/IWebHistory.idl
new file mode 100644
index 0000000..a8b55d6
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebHistory.idl
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ @discussion Notifications sent when history is modified.
+ @constant WebHistoryItemsAddedNotification Posted from addItems:. This
+ notification comes with a userInfo dictionary that contains the array of
+ items added. The key for the array is WebHistoryItemsKey.
+ @constant WebHistoryItemsRemovedNotification Posted from removeItems:.
+ This notification comes with a userInfo dictionary that contains the array of
+ items removed. The key for the array is WebHistoryItemsKey.
+ @constant WebHistoryAllItemsRemovedNotification Posted from removeAllItems
+ @constant WebHistoryLoadedNotification Posted from loadFromURL:error:.
+*/
+cpp_quote("#define WebHistoryItemsAddedNotification TEXT(\"WebHistoryItemsAddedNotification\")")
+cpp_quote("#define WebHistoryItemsRemovedNotification TEXT(\"WebHistoryItemsRemovedNotification\")")
+cpp_quote("#define WebHistoryAllItemsRemovedNotification TEXT(\"WebHistoryAllItemsRemovedNotification\")")
+cpp_quote("#define WebHistoryLoadedNotification TEXT(\"WebHistoryLoadedNotification\")")
+cpp_quote("#define WebHistoryItemsDiscardedWhileLoadingNotification TEXT(\"WebHistoryItemsDiscardedWhileLoadingNotification\")")
+cpp_quote("#define WebHistorySavedNotification TEXT(\"WebHistorySavedNotification\")")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebError.idl";
+import "IWebHistoryItem.idl";
+#endif
+
+interface IWebError;
+interface IWebHistoryItem;
+
+/*!
+ @class WebHistory
+ @discussion WebHistory is used to track pages that have been loaded
+ by WebKit.
+*/
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(F34E4B1A-361D-4b9f-9A3F-D869DCD97F9A),
+ pointer_default(unique)
+]
+interface IWebHistory : IUnknown
+{
+ /*!
+ @method optionalSharedHistory
+ @abstract Returns a shared WebHistory instance initialized with the default history file.
+ @result A WebHistory object.
+ + (WebHistory *)optionalSharedHistory;
+ */
+ HRESULT optionalSharedHistory([out, retval] IWebHistory** history);
+
+ /*!
+ @method setOptionalSharedHistory:
+ @param history The history to use for the global WebHistory.
+ + (void)setOptionalSharedHistory:(WebHistory *)history;
+ */
+ HRESULT setOptionalSharedHistory([in] IWebHistory* history);
+
+ /*!
+ @method loadFromURL:error:
+ @param URL The URL to use to initialize the WebHistory.
+ @param error Set to nil or an NSError instance if an error occurred.
+ @abstract The designated initializer for WebHistory.
+ @result Returns YES if successful, NO otherwise.
+ - (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error;
+ */
+ HRESULT loadFromURL([in] BSTR url, [out] IWebError** error, [out, retval] BOOL* succeeded);
+
+ /*!
+ @method saveToURL:error:
+ @discussion Save history to URL. It is the client's responsibility to call this at appropriate times.
+ @param URL The URL to use to save the WebHistory.
+ @param error Set to nil or an NSError instance if an error occurred.
+ @result Returns YES if successful, NO otherwise.
+ - (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error;
+ */
+ HRESULT saveToURL([in] BSTR url, [out] IWebError** error, [out, retval] BOOL* succeeded);
+
+ /*!
+ @method addItems:
+ @param newItems An array of WebHistoryItems to add to the WebHistory.
+ - (void)addItems:(NSArray *)newItems;
+ */
+ HRESULT addItems([in] int itemCount, [in] IWebHistoryItem** items);
+
+ /*!
+ @method removeItems:
+ @param items An array of WebHistoryItems to remove from the WebHistory.
+ - (void)removeItems:(NSArray *)items;
+ */
+ HRESULT removeItems([in] int itemCount, [in] IWebHistoryItem** items);
+
+ /*!
+ @method removeAllItems
+ - (void)removeAllItems;
+ */
+ HRESULT removeAllItems();
+
+ /*!
+ @method orderedLastVisitedDays
+ @discussion Get an array of NSCalendarDates, each one representing a unique day that contains one
+ or more history items, ordered from most recent to oldest.
+ @result Returns an array of NSCalendarDates for which history items exist in the WebHistory.
+
+ ADVISORY NOTE: This method may change for the 1.0 SDK.
+ - (NSArray *)orderedLastVisitedDays;
+ */
+ HRESULT orderedLastVisitedDays([in, out] int* count, [in] DATE* calendarDates);
+
+ /*!
+ @method orderedItemsLastVisitedOnDay:
+ @discussion Get an array of WebHistoryItem that were last visited on the day represented by the
+ specified NSCalendarDate, ordered from most recent to oldest.
+ @param calendarDate A date identifying the unique day of interest.
+ @result Returns an array of WebHistoryItems last visited on the indicated day.
+
+ ADVISORY NOTE: This method may change for the 1.0 SDK.
+ - (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate;
+ */
+ HRESULT orderedItemsLastVisitedOnDay([in, out] int* count, [in] IWebHistoryItem** items, [in] DATE calendarDate);
+
+ /*!
+ @method itemForURL:
+ @abstract Get an item for a specific URL
+ @param URL The URL of the history item to search for
+ @result Returns an item matching the URL
+ - (WebHistoryItem *)itemForURL:(NSURL *)URL;
+ */
+ HRESULT itemForURL([in] BSTR url, [out, retval] IWebHistoryItem** item);
+
+ /*!
+ @method setHistoryItemLimit:
+ @discussion Limits the number of items that will be stored by the WebHistory.
+ @param limit The maximum number of items that will be stored by the WebHistory.
+ - (void)setHistoryItemLimit:(int)limit;
+ */
+ HRESULT setHistoryItemLimit([in] int limit);
+
+ /*!
+ @method historyItemLimit
+ @result The maximum number of items that will be stored by the WebHistory.
+ - (int)historyItemLimit;
+ */
+ HRESULT historyItemLimit([out, retval] int* limit);
+
+ /*!
+ @method setHistoryAgeInDaysLimit:
+ @discussion setHistoryAgeInDaysLimit: sets the maximum number of days to be read from
+ stored history.
+ @param limit The maximum number of days to be read from stored history.
+ - (void)setHistoryAgeInDaysLimit:(int)limit;
+ */
+ HRESULT setHistoryAgeInDaysLimit([in] int limit);
+
+ /*!
+ @method historyAgeInDaysLimit
+ @return Returns the maximum number of days to be read from stored history.
+ - (int)historyAgeInDaysLimit;
+ */
+ HRESULT historyAgeInDaysLimit([out, retval] int* limit);
+} \ No newline at end of file
diff --git a/WebKit/win/Interfaces/IWebHistoryItem.idl b/WebKit/win/Interfaces/IWebHistoryItem.idl
new file mode 100644
index 0000000..21703d5
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebHistoryItem.idl
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+/*!
+ @class WebHistoryItem
+ @discussion WebHistoryItems are created by WebKit to represent pages visited.
+ The WebBackForwardList and WebHistory classes both use WebHistoryItems to represent
+ pages visited. With the exception of the displayTitle, the properties of
+ WebHistoryItems are set by WebKit. WebHistoryItems are normally never created directly.
+*/
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(1E2970AE-72B7-4500-A7A0-12B0FFEB91FC),
+ pointer_default(unique)
+]
+interface IWebHistoryItem : IUnknown
+{
+ /*!
+ @method initWithURLString:title:lastVisitedTimeInterval:
+ @param URLString The URL string for the item.
+ @param title The title to use for the item. This is normally the <title> of a page.
+ @param time The time used to indicate when the item was used.
+ @abstract Initialize a new WebHistoryItem
+ @discussion WebHistoryItems are normally created for you by the WebKit.
+ You may use this method to prepopulate a WebBackForwardList, or create
+ 'artificial' items to add to a WebBackForwardList. When first initialized
+ the URLString and originalURLString will be the same.
+ - (id)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time;
+ */
+ HRESULT initWithURLString([in] BSTR urlString, [in] BSTR title, [in] DATE lastVisited);
+
+ /*!
+ @method originalURLString
+ @abstract The string representation of the originial URL of this item.
+ This value is normally set by the WebKit.
+ @result The string corresponding to the initial URL of this item.
+ - (NSString *)originalURLString;
+ */
+ HRESULT originalURLString([out, retval] BSTR* url);
+
+ /*!
+ @method URLString
+ @abstract The string representation of the URL represented by this item.
+ @discussion The URLString may be different than the originalURLString if the page
+ redirected to a new location. This value is normally set by the WebKit.
+ @result The string corresponding to the final URL of this item.
+ - (NSString *)URLString;
+ */
+ HRESULT URLString([out, retval] BSTR* url);
+
+
+ /*!
+ @method title
+ @abstract The title of the page represented by this item.
+ @discussion This title cannot be changed by the client. This value
+ is normally set by the WebKit when a page title for the item is received.
+ @result The title of this item.
+ - (NSString *)title;
+ */
+ HRESULT title([out, retval] BSTR* pageTitle);
+
+ /*!
+ @method lastVisitedTimeInterval
+ @abstract The last time the page represented by this item was visited. The interval
+ is since the reference date as determined by NSDate. This value is normally set by
+ the WebKit.
+ @result The last time this item was visited.
+ - (NSTimeInterval)lastVisitedTimeInterval;
+ */
+ HRESULT lastVisitedTimeInterval([out, retval] DATE* lastVisited);
+
+ /*!
+ @method setAlternateTitle:
+ @param alternateTitle The new display title for this item.
+ @abstract A title that may be used by the client to display this item.
+ - (void)setAlternateTitle:(NSString *)alternateTitle;
+ */
+ HRESULT setAlternateTitle([in] BSTR title);
+
+ /*
+ @method title
+ @abstract A title that may be used by the client to display this item.
+ @result The alternate title for this item.
+ - (NSString *)alternateTitle;
+ */
+ HRESULT alternateTitle([out, retval] BSTR* title);
+
+ /*!
+ @method icon
+ @abstract The favorite icon of the page represented by this item.
+ @discussion This icon returned will be determined by the WebKit.
+ @result The icon associated with this item's URL.
+ - (NSImage *)icon;
+ */
+ HRESULT icon([out, retval] OLE_HANDLE* hBitmap);
+}
diff --git a/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl b/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl
new file mode 100644
index 0000000..aa8c162
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebHistoryItem.idl";
+#endif
+
+interface IWebHistoryItem;
+
+[
+ object,
+ oleautomation,
+ uuid(E9D5DC2C-192F-4795-B0EC-4E770E539D97),
+ pointer_default(unique)
+]
+interface IWebHistoryItemPrivate : IUnknown
+{
+ [local] HRESULT initFromDictionaryRepresentation([in] void* dictionary);
+ [local] HRESULT dictionaryRepresentation([out, retval] void** dictionary);
+ HRESULT visitCount([out, retval] int *count);
+ HRESULT setVisitCount([in] int count);
+ HRESULT hasURLString([out, retval] BOOL* hasURL);
+ HRESULT mergeAutoCompleteHints([in] IWebHistoryItem* otherItem);
+ HRESULT setLastVisitedTimeInterval([in] DATE time);
+ HRESULT setTitle([in] BSTR title);
+ HRESULT RSSFeedReferrer([out, retval] BSTR* url);
+ HRESULT setRSSFeedReferrer([in] BSTR url);
+ HRESULT hasPageCache([out, retval] BOOL* hasCache);
+ HRESULT setHasPageCache([in] BOOL hasCache);
+
+ HRESULT target([out, retval] BSTR* target);
+ HRESULT isTargetItem([out, retval] BOOL* result);
+ [local] HRESULT children([out] unsigned* childCount, [out, retval] SAFEARRAY** children);
+}
diff --git a/WebKit/win/Interfaces/IWebIconDatabase.idl b/WebKit/win/Interfaces/IWebIconDatabase.idl
new file mode 100644
index 0000000..0dfbf1a
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebIconDatabase.idl
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("#define WebIconDatabaseDidAddIconNotification TEXT(\"WebIconDatabaseDidAddIconNotification\")")
+cpp_quote("#define WebIconNotificationUserInfoURLKey TEXT(\"WebIconNotificationUserInfoURLKey\")")
+cpp_quote("#define WebIconDatabaseDidRemoveAllIconsNotification TEXT(\"WebIconDatabaseDidRemoveAllIconsNotification\")")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+/*!
+ @class WebIconDatabase
+ @discussion Features:
+ - memory cache icons at different sizes
+ - disk storage
+ - icon update notification
+
+ Uses:
+ - WebIconLoader to cache icon images
+ - UI elements to retrieve icons that represent site URLs.
+ - Save icons to disk for later use.
+
+ Every icon in the database has a retain count. If an icon has a retain count greater than 0, it will be written to disk for later use. If an icon's retain count equals zero it will be removed from disk. The retain count is not persistent across launches. If the WebKit client wishes to retain an icon it should retain the icon once for every launch. This is best done at initialization time before the database begins removing icons. To make sure that the database does not remove unretained icons prematurely, call delayDatabaseCleanup until all desired icons are retained. Once all are retained, call allowDatabaseCleanup.
+
+ Note that an icon can be retained after the database clean-up has begun. This just has to be done before the icon is removed. Icons are removed from the database whenever new icons are added to it.
+
+ Retention methods can be called for icons that are not yet in the database.
+
+ @interface WebIconDatabase : NSObject
+*/
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(E93F2616-2560-47d9-BD4D-6E2F1E1D3174),
+ pointer_default(unique)
+]
+interface IWebIconDatabase : IUnknown
+{
+ /*!
+ @method sharedIconDatabase
+ @abstract Returns a shared instance of the icon database
+ + (WebIconDatabase *)sharedIconDatabase;
+ */
+ HRESULT sharedIconDatabase([out, retval] IWebIconDatabase** result);
+
+ /*!
+ @method iconForURL:withSize:
+ @discussion Calls iconForURL:withSize:cache: with YES for cache.
+ @param URL
+ @param size
+ - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size;
+ */
+ /*!
+ @method iconForURL:withSize:cache:
+ @discussion Returns an icon for a web site URL from memory or disk. nil if none is found.
+ Usually called by a UI element to determine if a site URL has an associated icon.
+ Often called by the observer of WebIconChangedNotification after the notification is sent.
+ @param URL
+ @param size
+ @param cache If yes, caches the returned image in memory if not already cached
+ - (NSImage *)iconForURL:(NSString *)URL withSize:(NSSize)size cache:(BOOL)cache;
+ */
+ /*!
+ @method iconURLForURL:withSize:cache:
+ @discussion Returns an icon URL for a web site URL from memory or disk. nil if none is found.
+ @param URL
+ - (NSString *)iconURLForURL:(NSString *)URL;
+ */
+ HRESULT iconForURL([in] BSTR url, [in] LPSIZE size, [in] BOOL cache, [out, retval] OLE_HANDLE* hBitmap);
+
+ /*!
+ @method defaultIconWithSize:
+ @param size
+ - (NSImage *)defaultIconWithSize:(NSSize)size;
+ */
+ HRESULT defaultIconWithSize([in] LPSIZE size, [out, retval] OLE_HANDLE* hBitmap);
+
+ /*!
+ @method retainIconForURL:
+ @abstract Increments the retain count of the icon.
+ @param URL
+ - (void)retainIconForURL:(NSString *)URL;
+ */
+ HRESULT retainIconForURL([in] BSTR url);
+
+ /*!
+ @method releaseIconForURL:
+ @abstract Decrements the retain count of the icon.
+ @param URL
+ - (void)releaseIconForURL:(NSString *)URL;
+ */
+ HRESULT releaseIconForURL([in] BSTR url);
+
+ /*!
+ @method removeAllIcons:
+ @abstract Emtpies the Icon Database
+ - (void)removeAllIcons;
+ */
+ HRESULT removeAllIcons();
+
+ /*!
+ @method delayDatabaseCleanup:
+ @discussion Only effective if called before the database begins removing icons.
+ delayDatabaseCleanUp increments an internal counter that when 0 begins the database clean-up.
+ The counter equals 0 at initialization.
+ - (void)delayDatabaseCleanup;
+ */
+ HRESULT delayDatabaseCleanup();
+
+ /*!
+ @method allowDatabaseCleanup:
+ @discussion Informs the database that it now can begin removing icons.
+ allowDatabaseCleanup decrements an internal counter that when 0 begins the database clean-up.
+ The counter equals 0 at initialization.
+ - (void)allowDatabaseCleanup;
+ */
+ HRESULT allowDatabaseCleanup();
+
+ /*!
+ @method iconURLForURL:withSize:cache:
+ @discussion Returns an icon URL for a web site URL from memory or disk. nil if none is found.
+ @param URL
+ - (NSString *)iconURLForURL:(NSString *)URL;
+ */
+ HRESULT iconURLForURL([in] BSTR url, [out, retval] BSTR* iconURL);
+}
diff --git a/WebKit/win/Interfaces/IWebInspector.idl b/WebKit/win/Interfaces/IWebInspector.idl
new file mode 100644
index 0000000..da0fb9b
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebInspector.idl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(68159FF1-9037-45ec-9992-B2E455CF39F3),
+ pointer_default(unique)
+]
+interface IWebInspector : IUnknown
+{
+ HRESULT show();
+ HRESULT showConsole();
+ HRESULT showTimeline();
+ HRESULT close();
+ HRESULT attach();
+ HRESULT detach();
+}
diff --git a/WebKit/win/Interfaces/IWebJavaScriptCollector.idl b/WebKit/win/Interfaces/IWebJavaScriptCollector.idl
new file mode 100644
index 0000000..824cb0b
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebJavaScriptCollector.idl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(E6A1D169-F44A-4d11-B55B-F0A406F47612),
+ pointer_default(unique)
+]
+interface IWebJavaScriptCollector : IUnknown
+{
+ HRESULT collect();
+ HRESULT collectOnAlternateThread([in] BOOL waitUntilDone);
+ HRESULT objectCount([out, retval] UINT* count);
+}
diff --git a/WebKit/win/Interfaces/IWebKitStatistics.idl b/WebKit/win/Interfaces/IWebKitStatistics.idl
new file mode 100644
index 0000000..b989d9c
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebKitStatistics.idl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(955C1042-BCF7-4f51-8AE7-66C2D0D47C44),
+ pointer_default(unique)
+]
+interface IWebKitStatistics : IUnknown
+{
+ HRESULT webViewCount([out, retval] int* count);
+ HRESULT frameCount([out, retval] int* count);
+ HRESULT dataSourceCount([out, retval] int* count);
+ HRESULT viewCount([out, retval] int* count);
+ HRESULT HTMLRepresentationCount([out, retval] int* count);
+ HRESULT comClassCount([out, retval] int* classCount);
+}
diff --git a/WebKit/win/Interfaces/IWebMutableURLRequest.idl b/WebKit/win/Interfaces/IWebMutableURLRequest.idl
new file mode 100644
index 0000000..c1b31be
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebMutableURLRequest.idl
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebURLRequest.idl";
+#endif
+
+interface IWebURLRequest;
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(C4042773-371F-427e-AFA9-9D4B358A0D93),
+ pointer_default(unique)
+]
+interface IWebMutableURLRequest : IWebURLRequest
+{
+ /*
+ - (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field
+ */
+ HRESULT addValue([in] BSTR value, [in] BSTR field);
+
+ /*
+ - (void)setAllHTTPHeaderFields:(NSDictionary *)headerFields
+ */
+ HRESULT setAllHTTPHeaderFields([in] IPropertyBag* headerFields);
+
+ /*
+ - (void)setCachePolicy:(NSURLRequestCachePolicy)policy
+ */
+ HRESULT setCachePolicy([in] WebURLRequestCachePolicy policy);
+
+ /*
+ - (void)setHTTPBody:(NSData *)data
+ */
+ HRESULT setHTTPBody([in] IStream* data);
+
+ /*
+ - (void)setHTTPBodyStream:(NSInputStream *)inputStream
+ */
+ HRESULT setHTTPBodyStream([in] IStream* data);
+
+ /*
+ - (void)setHTTPMethod:(NSString *)method
+ */
+ HRESULT setHTTPMethod([in] BSTR method);
+
+ /*
+ - (void)setHTTPShouldHandleCookies:(BOOL)handleCookies
+ */
+ HRESULT setHTTPShouldHandleCookies([in] BOOL handleCookies);
+
+ /*
+ - (void)setMainDocumentURL:(NSURL *)theURL
+ */
+ HRESULT setMainDocumentURL([in] BSTR theURL);
+
+ /*
+ - (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval
+ */
+ HRESULT setTimeoutInterval([in] double timeoutInterval);
+
+ /*
+ - (void)setURL:(NSURL *)theURL
+ */
+ HRESULT setURL([in] BSTR theURL);
+
+ /*
+ - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field
+ */
+ HRESULT setValue([in] BSTR value, [in] BSTR field);
+
+ HRESULT setAllowsAnyHTTPSCertificate();
+}
diff --git a/WebKit/win/Interfaces/IWebMutableURLRequestPrivate.idl b/WebKit/win/Interfaces/IWebMutableURLRequestPrivate.idl
new file mode 100644
index 0000000..e78dbe5
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebMutableURLRequestPrivate.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(AD675B60-2CE9-478c-B2AA-CAD643FF18AC),
+ pointer_default(unique)
+]
+interface IWebMutableURLRequestPrivate : IUnknown
+{
+ HRESULT setClientCertificate([in] OLE_HANDLE cert);
+}
diff --git a/WebKit/win/Interfaces/IWebNotification.idl b/WebKit/win/Interfaces/IWebNotification.idl
new file mode 100644
index 0000000..0df4ff9
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebNotification.idl
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(93598207-3E34-49ec-97EC-EFA9A1E16335),
+ pointer_default(unique)
+]
+interface IWebNotification : IUnknown
+{
+ /*
+ + (id)notificationWithName:(NSString *)aName object:(id)anObject
+ + (id)notificationWithName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)userInfo
+ */
+ HRESULT notificationWithName([in] BSTR aName, [in] IUnknown* anObject, [in] IPropertyBag* userInfo);
+
+ /*
+ - (NSString *)name
+ */
+ HRESULT name([out, retval] BSTR* result);
+
+ /*
+ - (id)object
+ */
+ HRESULT getObject([out, retval] IUnknown** result);
+
+ /*
+ - (NSDictionary *)userInfo
+ */
+ HRESULT userInfo([out, retval] IPropertyBag** result);
+}
diff --git a/WebKit/win/Interfaces/IWebNotificationCenter.idl b/WebKit/win/Interfaces/IWebNotificationCenter.idl
new file mode 100644
index 0000000..2f8b2aa
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebNotificationCenter.idl
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+interface IWebNotification;
+interface IWebNotificationObserver;
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(1E411ABE-DAA0-4a83-BCCA-D94E0704F193),
+ pointer_default(unique)
+]
+interface IWebNotificationCenter : IUnknown
+{
+#ifndef DO_NO_IMPORTS
+ import "IWebNotification.idl";
+ import "IWebNotificationObserver.idl";
+#endif
+
+ //+ (NSNotificationCenter *)defaultCenter
+ HRESULT defaultCenter([out, retval] IWebNotificationCenter** center);
+
+ //- (void)addObserver:(id)anObserver selector:(SEL)aSelector name:(NSString *)notificationName object:(id)anObject
+ HRESULT addObserver([in] IWebNotificationObserver* observer, [in] BSTR notificationName, [in] IUnknown* anObject);
+
+ //- (void)postNotification:(NSNotification *)notification
+ HRESULT postNotification([in] IWebNotification* notification);
+
+ //- (void)postNotificationName:(NSString *)notificationName object:(id)anObject
+ //- (void)postNotificationName:(NSString *)notificationName object:(id)anObject userInfo:(NSDictionary *)userInfo
+ HRESULT postNotificationName([in] BSTR notificationName, [in] IUnknown* anObject, [in] IPropertyBag* userInfo);
+
+ //- (void)removeObserver:(id)anObserver
+ //- (void)removeObserver:(id)anObserver name:(NSString *)notificationName object:(id)anObject
+ HRESULT removeObserver([in] IWebNotificationObserver* anObserver, [in] BSTR notificationName, [in] IUnknown* anObject);
+}
diff --git a/WebKit/win/Interfaces/IWebNotificationObserver.idl b/WebKit/win/Interfaces/IWebNotificationObserver.idl
new file mode 100644
index 0000000..ff41b1e
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebNotificationObserver.idl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+interface IWebNotification;
+
+[
+ object,
+ oleautomation,
+ uuid(1BA491C4-58A7-4091-9F56-9AED118DB4C1),
+ pointer_default(unique)
+]
+interface IWebNotificationObserver : IUnknown
+{
+#ifndef DO_NO_IMPORTS
+ import "IWebNotification.idl";
+#endif
+
+ HRESULT onNotify([in] IWebNotification* notification);
+}
diff --git a/WebKit/win/Interfaces/IWebPolicyDelegate.idl b/WebKit/win/Interfaces/IWebPolicyDelegate.idl
new file mode 100644
index 0000000..450fe89
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebPolicyDelegate.idl
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebView.idl";
+import "IWebURLRequest.idl";
+#endif
+
+interface IWebError;
+interface IWebURLResponse;
+interface IWebURLRequest;
+interface IWebView;
+interface IWebFrame;
+interface IWebPolicyPrivate;
+
+/*!
+ @enum WebNavigationType
+ @abstract The type of action that triggered a possible navigation.
+ @constant WebNavigationTypeLinkClicked A link with an href was clicked.
+ @constant WebNavigationTypeFormSubmitted A form was submitted.
+ @constant WebNavigationTypeBackForward The user chose back or forward.
+ @constant WebNavigationTypeReload The User hit the reload button.
+ @constant WebNavigationTypeFormResubmitted A form was resubmitted (by virtue of doing back, forward or reload).
+ @constant WebNavigationTypeOther Navigation is taking place for some other reason.
+*/
+
+typedef enum WebNavigationType {
+ WebNavigationTypeLinkClicked,
+ WebNavigationTypeFormSubmitted,
+ WebNavigationTypeBackForward,
+ WebNavigationTypeReload,
+ WebNavigationTypeFormResubmitted,
+ WebNavigationTypeOther
+} WebNavigationType;
+
+cpp_quote("#define WebActionNavigationTypeKey TEXT(\"WebActionNavigationTypeKey\")")
+cpp_quote("#define WebActionElementKey TEXT(\"WebActionElementKey\")")
+cpp_quote("#define WebActionButtonKey TEXT(\"WebActionButtonKey\")")
+cpp_quote("#define WebActionModifierFlagsKey TEXT(\"WebActionModifierFlagsKey\")")
+cpp_quote("#define WebActionOriginalURLKey TEXT(\"WebActionOriginalURLKey\")")
+
+/*
+extern NSString *WebActionNavigationTypeKey; // NSNumber (WebNavigationType)
+extern NSString *WebActionElementKey; // NSDictionary of element info
+extern NSString *WebActionButtonKey; // NSEventType
+extern NSString *WebActionModifierFlagsKey; // NSNumber (unsigned)
+extern NSString *WebActionOriginalURLKey; // NSURL
+*/
+
+/*!
+ @protocol WebPolicyDecisionListener
+ @discussion This protocol is used to call back with the results of a
+ policy decision. This provides the ability to make these decisions
+ asyncrhonously, which means the decision can be made by prompting
+ with a sheet, for example.
+ @protocol WebPolicyDecisionListener <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(DFCDE523-FD96-4f95-958B-151540FE122A),
+ pointer_default(unique)
+]
+interface IWebPolicyDecisionListener : IUnknown
+{
+ /*!
+ @method use
+ @abstract Use the resource
+ @discussion If there remain more policy decisions to be made, then
+ the next policy delegate method gets to decide. This will be
+ either the next navigation policy delegate if there is a redirect,
+ or the content policy delegate. If there are no more policy
+ decisions to be made, the resource will be displayed inline if
+ possible. If there is no view available to display the resource
+ inline, then unableToImplementPolicyWithError:frame: will be
+ called with an appropriate error.
+
+ <p>If a new window is going to be created for this navigation as a
+ result of frame targetting, then it will be created once you call
+ this method.
+ - (void)use;
+ */
+ HRESULT use();
+
+ /*!
+ @method download
+ @abstract Download the resource instead of displaying it.
+ @discussion This method is more than just a convenience because it
+ allows an in-progress navigation to be converted to a download
+ based on content type, without having to stop and restart the
+ load.
+ - (void)download;
+ */
+ HRESULT download();
+
+ /*!
+ @method ignore
+ @abstract Do nothing (but the client may choose to handle the request itself)
+ @discussion A policy of ignore prevents WebKit from doing anything
+ further with the load, however, the client is still free to handle
+ the request in some other way, such as opening a new window,
+ opening a new window behind the current one, opening the URL in an
+ external app, revealing the location in Finder if a file URL, etc.
+ - (void)ignore;
+ */
+ HRESULT ignore();
+}
+
+/*!
+ @category WebPolicyDelegate
+ @discussion While loading a URL, WebKit asks the WebPolicyDelegate for
+ policies that determine the action of what to do with the URL or the data that
+ the URL represents. Typically, the policy handler methods are called in this order:
+
+ decidePolicyForNewWindowAction:request:newFrameName:decisionListener: (at most once)<BR>
+ decidePolicyForNavigationAction:request:frame:decisionListener: (zero or more times)<BR>
+ decidePolicyForMIMEType:request:frame: (zero or more times)<BR>
+
+ New window policy is always checked. Navigation policy is checked
+ for the initial load and every redirect unless blocked by an
+ earlier policy. Content policy is checked once the content type is
+ known, unless an earlier policy prevented it.
+
+ In rare cases, content policy might be checked more than
+ once. This occurs when loading a "multipart/x-mixed-replace"
+ document, also known as "server push". In this case, multiple
+ documents come in one navigation, with each replacing the last. In
+ this case, conent policy will be checked for each one.
+ @interface NSObject (WebPolicyDelegate)
+*/
+[
+ object,
+ oleautomation,
+ uuid(9B0BAE6C-A496-4000-9E22-2E89F0747401),
+ pointer_default(unique)
+]
+interface IWebPolicyDelegate : IUnknown
+{
+ /*!
+ @method webView:decidePolicyForNavigationAction:request:frame:decisionListener:
+ @abstract This method is called to decide what to do with a proposed navigation.
+ @param actionInformation Dictionary that describes the action that triggered this navigation.
+ @param request The request for the proposed navigation
+ @param frame The WebFrame in which the navigation is happening
+ @param listener The object to call when the decision is made
+ @discussion This method will be called before loading starts, and
+ on every redirect.
+ - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
+ request:(NSURLRequest *)request
+ frame:(WebFrame *)frame
+ decisionListener:(id<WebPolicyDecisionListener>)listener;
+ */
+ HRESULT decidePolicyForNavigationAction([in] IWebView* webView, [in] IPropertyBag* actionInformation, [in] IWebURLRequest* request, [in] IWebFrame* frame, [in] IWebPolicyDecisionListener* listener);
+
+ /*!
+ @method webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:
+ @discussion This method is called to decide what to do with an targetted nagivation that would open a new window.
+ @param actionInformation Dictionary that describes the action that triggered this navigation.
+ @param request The request for the proposed navigation
+ @param frame The frame in which the navigation is taking place
+ @param listener The object to call when the decision is made
+ @discussion This method is provided so that modified clicks on a targetted link which
+ opens a new frame can prevent the new window from being opened if they decide to
+ do something else, like download or present the new frame in a specialized way.
+
+ <p>If this method picks a policy of Use, the new window will be
+ opened, and decidePolicyForNavigationAction:request:frame:decisionListner:
+ will be called with a WebNavigationType of WebNavigationTypeOther
+ in its action. This is to avoid possible confusion about the modifiers.
+ - (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation
+ request:(NSURLRequest *)request
+ newFrameName:(NSString *)frameName
+ decisionListener:(id<WebPolicyDecisionListener>)listener;
+ */
+ HRESULT decidePolicyForNewWindowAction([in] IWebView* webView, [in] IPropertyBag* actionInformation, [in] IWebURLRequest* request, [in] BSTR frameName, [in] IWebPolicyDecisionListener* listener);
+
+ /*!
+ @method webView:decidePolicyForMIMEType:request:frame:
+ @discussion Returns the policy for content which has been partially loaded.
+ Sent after webView:didStartProvisionalLoadForFrame: is sent on the WebFrameLoadDelegate.
+ @param type MIME type for the resource.
+ @param request A NSURLRequest for the partially loaded content.
+ @param frame The frame which is loading the URL.
+ @param listener The object to call when the decision is made
+ - (void)webView:(WebView *)webView decidePolicyForMIMEType:(NSString *)type
+ request:(NSURLRequest *)request
+ frame:(WebFrame *)frame
+ decisionListener:(id<IWebPolicyDecisionListener>)listener;
+ */
+ HRESULT decidePolicyForMIMEType([in] IWebView* webView, [in] BSTR type, [in] IWebURLRequest* request, [in] IWebFrame* frame, [in] IWebPolicyDecisionListener* listener);
+
+ /*!
+ @method webView:unableToImplementPolicy:error:forURL:inFrame:
+ @discussion Called when a WebPolicy could not be implemented. It is up to the client to display appropriate feedback.
+ @param policy The policy that could not be implemented.
+ @param error The error that caused the policy to not be implemented.
+ @param URL The URL of the resource for which a particular action was requested but failed.
+ @param frame The frame in which the policy could not be implemented.
+ - (void)webView:(WebView *)webView unableToImplementPolicyWithError:(NSError *)error frame:(WebFrame *)frame;
+ */
+ HRESULT unableToImplementPolicyWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebFrame* frame);
+}
diff --git a/WebKit/win/Interfaces/IWebPreferences.idl b/WebKit/win/Interfaces/IWebPreferences.idl
new file mode 100644
index 0000000..c2ab1f9
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebPreferences.idl
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("#define WebPreferencesChangedNotification TEXT(\"WebPreferencesChangedNotification\")")
+cpp_quote("#define WebPreferencesRemovedNotification TEXT(\"WebPreferencesRemovedNotification\")")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+typedef enum FontSmoothingType {
+ FontSmoothingTypeStandard=0,
+ FontSmoothingTypeLight,
+ FontSmoothingTypeMedium,
+ FontSmoothingTypeStrong,
+ FontSmoothingTypeWindows
+} FontSmoothingType;
+
+typedef enum WebKitEditableLinkBehavior {
+ WebKitEditableLinkDefaultBehavior = 0,
+ WebKitEditableLinkAlwaysLive,
+ WebKitEditableLinkOnlyLiveWithShiftKey,
+ WebKitEditableLinkLiveWhenNotFocused,
+ WebKitEditableLinkNeverLive
+} WebKitEditableLinkBehavior;
+
+typedef enum WebKitCookieStorageAcceptPolicy {
+ WebKitCookieStorageAcceptPolicyAlways = 0,
+ WebKitCookieStorageAcceptPolicyNever,
+ WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain
+} WebKitCookieStorageAcceptPolicy;
+
+typedef enum WebCacheModel {
+ WebCacheModelDocumentViewer = 0,
+ WebCacheModelDocumentBrowser = 1,
+ WebCacheModelPrimaryWebBrowser = 2
+} WebCacheModel;
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(0930D594-A5A3-46e1-858E-AB17A13CD28E),
+ pointer_default(unique)
+]
+interface IWebPreferences : IUnknown
+{
+ HRESULT standardPreferences([out, retval] IWebPreferences** standardPreferences);
+
+ HRESULT initWithIdentifier([in] BSTR anIdentifier, [out, retval] IWebPreferences** preferences);
+ HRESULT identifier([out, retval] BSTR* ident);
+
+ HRESULT standardFontFamily([out, retval] BSTR* family);
+ HRESULT setStandardFontFamily([in] BSTR family);
+
+ HRESULT fixedFontFamily([out, retval] BSTR* family);
+ HRESULT setFixedFontFamily([in] BSTR family);
+
+ HRESULT serifFontFamily([out, retval] BSTR* fontFamily);
+ HRESULT setSerifFontFamily([in] BSTR family);
+
+ HRESULT sansSerifFontFamily([out, retval] BSTR* family);
+ HRESULT setSansSerifFontFamily([in] BSTR family);
+
+ HRESULT cursiveFontFamily([out, retval] BSTR* family);
+ HRESULT setCursiveFontFamily([in] BSTR family);
+
+ HRESULT fantasyFontFamily([out, retval] BSTR* family);
+ HRESULT setFantasyFontFamily([in] BSTR family);
+
+ HRESULT defaultFontSize([out, retval] int* fontSize);
+ HRESULT setDefaultFontSize([in] int fontSize);
+
+ HRESULT defaultFixedFontSize([out, retval] int* fontSize);
+ HRESULT setDefaultFixedFontSize([in] int fontSize);
+
+ HRESULT minimumFontSize([out, retval] int* fontSize);
+ HRESULT setMinimumFontSize([in] int fontSize);
+
+ HRESULT minimumLogicalFontSize([out, retval] int* fontSize);
+ HRESULT setMinimumLogicalFontSize([in] int fontSize);
+
+ HRESULT defaultTextEncodingName([out, retval] BSTR* name);
+ HRESULT setDefaultTextEncodingName([in] BSTR name);
+
+ HRESULT userStyleSheetEnabled([out, retval] BOOL* enabled);
+ HRESULT setUserStyleSheetEnabled([in] BOOL enabled);
+
+ HRESULT userStyleSheetLocation([out, retval] BSTR* location);
+ HRESULT setUserStyleSheetLocation([in] BSTR location);
+
+ HRESULT isJavaEnabled([out, retval] BOOL* enabled);
+ HRESULT setJavaEnabled([in] BOOL enabled);
+
+ HRESULT isJavaScriptEnabled([out, retval] BOOL* enabled);
+ HRESULT setJavaScriptEnabled([in] BOOL enabled);
+
+ HRESULT javaScriptCanOpenWindowsAutomatically([out, retval] BOOL* enabled);
+ HRESULT setJavaScriptCanOpenWindowsAutomatically([in] BOOL enabled);
+
+ HRESULT arePlugInsEnabled([out, retval] BOOL* enabled);
+ HRESULT setPlugInsEnabled([in] BOOL enabled);
+
+ HRESULT allowsAnimatedImages([out, retval] BOOL* enabled);
+ HRESULT setAllowsAnimatedImages([in] BOOL enabled);
+ HRESULT allowAnimatedImageLooping([out, retval] BOOL* enabled);
+ HRESULT setAllowAnimatedImageLooping([in] BOOL enabled);
+
+ HRESULT setLoadsImagesAutomatically([in] BOOL enabled);
+ HRESULT loadsImagesAutomatically([out, retval] BOOL* enabled);
+
+ HRESULT setAutosaves([in] BOOL enabled);
+ HRESULT autosaves([out, retval] BOOL* enabled);
+
+ HRESULT setShouldPrintBackgrounds([in] BOOL enabled);
+ HRESULT shouldPrintBackgrounds([out, retval] BOOL* enabled);
+
+ HRESULT setPrivateBrowsingEnabled([in] BOOL enabled);
+ HRESULT privateBrowsingEnabled([out, retval] BOOL* enabled);
+
+ HRESULT setTabsToLinks([in] BOOL enabled);
+ HRESULT tabsToLinks([out, retval] BOOL* enabled);
+
+ HRESULT textAreasAreResizable([out, retval] BOOL* enabled);
+ HRESULT setTextAreasAreResizable([in] BOOL enabled);
+
+ HRESULT unused1();
+ HRESULT unused2();
+
+ HRESULT iconDatabaseLocation([out, retval] BSTR* location);
+ HRESULT setIconDatabaseLocation([in] BSTR location);
+
+ HRESULT iconDatabaseEnabled([out, retval] BOOL* enabled);
+ HRESULT setIconDatabaseEnabled([in] BOOL enabled);
+
+ HRESULT fontSmoothing([out, retval] FontSmoothingType* smoothingType);
+ HRESULT setFontSmoothing([in] FontSmoothingType smoothingType);
+
+ HRESULT editableLinkBehavior([out, retval] WebKitEditableLinkBehavior* editableLinkBehavior);
+ HRESULT setEditableLinkBehavior([in] WebKitEditableLinkBehavior behavior);
+
+ HRESULT cookieStorageAcceptPolicy([out, retval] WebKitCookieStorageAcceptPolicy* acceptPolicy);
+ HRESULT setCookieStorageAcceptPolicy([in] WebKitCookieStorageAcceptPolicy acceptPolicy);
+
+ HRESULT continuousSpellCheckingEnabled([out, retval] BOOL* enabled);
+ HRESULT setContinuousSpellCheckingEnabled([in] BOOL enabled);
+ HRESULT grammarCheckingEnabled([out, retval] BOOL* enabled);
+ HRESULT setGrammarCheckingEnabled([in] BOOL enabled);
+ HRESULT allowContinuousSpellChecking([out, retval] BOOL *allowed);
+ HRESULT setAllowContinuousSpellChecking([in] BOOL allowed);
+
+ HRESULT isDOMPasteAllowed([out, retval] BOOL *allowed);
+ HRESULT setDOMPasteAllowed([in] BOOL allowed);
+
+ HRESULT usesPageCache([out, retval] BOOL* usesPageCache);
+ HRESULT setUsesPageCache([in] BOOL usesPageCache);
+
+ HRESULT cacheModel([out, retval] WebCacheModel* cacheModel);
+ HRESULT setCacheModel([in] WebCacheModel cacheModel);
+}
diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
new file mode 100644
index 0000000..70defb2
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(1380DE41-42CF-4170-9D5D-7840EDE5B36C),
+ pointer_default(unique)
+]
+interface IWebPreferencesPrivate : IUnknown
+{
+ HRESULT setDeveloperExtrasEnabled([in] BOOL enabled);
+ HRESULT developerExtrasEnabled([out, retval] BOOL* enabled);
+
+ HRESULT setAutomaticallyDetectsCacheModel([in] BOOL automaticallyDetectsCacheModel);
+ HRESULT automaticallyDetectsCacheModel([out, retval] BOOL* automaticallyDetectsCacheModel);
+
+ HRESULT setAuthorAndUserStylesEnabled([in] BOOL enabled);
+ HRESULT authorAndUserStylesEnabled([out, retval] BOOL* enabled);
+}
diff --git a/WebKit/win/Interfaces/IWebResource.idl b/WebKit/win/Interfaces/IWebResource.idl
new file mode 100644
index 0000000..e85f0dc
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebResource.idl
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+/*!
+ @class WebResource
+ @discussion A WebResource represents a fully downloaded URL.
+ It includes the data of the resource as well as the metadata associated with the resource.
+
+ @interface WebResource : NSObject <NSCoding, NSCopying>
+*/
+[
+ object,
+ oleautomation,
+ uuid(09567E0E-7859-494a-B0E4-92C13CFE5574),
+ pointer_default(unique)
+]
+interface IWebResource : IUnknown
+{
+ /*!
+ @method initWithData:URL:MIMEType:textEncodingName:frameName
+ @abstract The initializer for WebResource.
+ @param data The data of the resource.
+ @param URL The URL of the resource.
+ @param MIMEType The MIME type of the resource.
+ @param textEncodingName The text encoding name of the resource (can be nil).
+ @param frameName The frame name of the resource if the resource represents the contents of an entire HTML frame (can be nil).
+ @result An initialized WebResource.
+ - (id)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName;
+ */
+ HRESULT initWithData([in] IStream* data, [in] BSTR url, [in] BSTR mimeType, [in] BSTR textEncodingName, [in] BSTR frameName);
+
+ /*!
+ @method data
+ @result The data of the resource.
+ - (NSData *)data;
+ */
+ HRESULT data([out, retval] IStream** data);
+
+ /*!
+ @method URL
+ @result The URL of the resource.
+ - (NSURL *)URL;
+ */
+ HRESULT URL([out, retval] BSTR* url);
+
+ /*!
+ @method MIMEType
+ @result The MIME type of the resource.
+ - (NSString *)MIMEType;
+ */
+ HRESULT MIMEType([out, retval] BSTR* mime);
+
+ /*!
+ @method textEncodingName
+ @result The text encoding name of the resource (can be nil).
+ - (NSString *)textEncodingName;
+ */
+ HRESULT textEncodingName([out, retval] BSTR* encodingName);
+
+ /*!
+ @method frameName
+ @result The frame name of the resource if the resource represents the contents of an entire HTML frame (can be nil).
+ - (NSString *)frameName;
+ */
+ HRESULT frameName([out, retval] BSTR* name);
+}
diff --git a/WebKit/win/Interfaces/IWebResourceLoadDelegate.idl b/WebKit/win/Interfaces/IWebResourceLoadDelegate.idl
new file mode 100644
index 0000000..87e6f91
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebResourceLoadDelegate.idl
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebURLAuthenticationChallenge.idl";
+import "IWebDataSource.idl";
+import "IWebURLResponse.idl";
+import "IWebError.idl";
+#endif
+
+interface IWebView;
+interface IWebDataSource;
+interface IWebURLAuthenticationChallenge;
+interface IWebURLResponse;
+interface IWebURLRequest;
+
+interface IWebError;
+
+/*!
+ @category WebResourceLoadDelegate
+ @discussion Implementors of this protocol will receive messages indicating
+ that a resource is about to be loaded, data has been received for a resource,
+ an error has been received for a resource, and completion of a resource load.
+ Implementors are also given the opportunity to mutate requests before they are sent.
+ The various progress methods of this protocol all receive an identifier as the
+ parameter. This identifier can be used to track messages associated with a single
+ resource. For example, a single resource may generate multiple
+ resource:willSendRequest:redirectResponse:fromDataSource: messages as it's URL is redirected.
+ @interface NSObject (WebResourceLoadDelegate)
+*/
+
+[
+ object,
+ oleautomation,
+ uuid(AF3289AA-90DB-4ca4-A112-A1E5F0517953),
+ pointer_default(unique)
+]
+interface IWebResourceLoadDelegate : IUnknown
+{
+ /*!
+ @method webView:identifierForInitialRequest:fromDataSource:
+ @param webView The WebView sending the message.
+ @param request The request about to be sent.
+ @param dataSource The datasource that initiated the load.
+ @discussion An implementor of WebResourceLoadDelegate should provide an identifier
+ that can be used to track the load of a single resource. This identifier will be
+ passed as the first argument for all of the other WebResourceLoadDelegate methods. The
+ identifier is useful to track changes to a resources request, which will be
+ provided by one or more calls to resource:willSendRequest:redirectResponse:fromDataSource:.
+ @result An identifier that will be passed back to the implementor for each callback.
+ The identifier will be retained.
+ - (id)webView:(WebView *)sender identifierForInitialRequest:(NSURLRequest *)request fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT identifierForInitialRequest([in] IWebView* webView, [in] IWebURLRequest* request, [in] IWebDataSource* dataSource, [in] unsigned long identifier);
+
+ /*!
+ @method resource:willSendRequest:redirectResponse:fromDataSource:
+ @discussion This message is sent before a load is initiated. The request may be modified
+ as necessary by the receiver.
+ @param webView The WebView sending the message.
+ @param identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param request The request about to be sent.
+ @param redirectResponse If the request is being made in response to a redirect we received,
+ the response that conveyed that redirect.
+ @param dataSource The dataSource that initiated the load.
+ @result Returns the request, which may be mutated by the implementor, although typically
+ will be request.
+ - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT willSendRequest([in] IWebView* webView, [in] unsigned long identifier, [in] IWebURLRequest* request, [in] IWebURLResponse* redirectResponse, [in] IWebDataSource* dataSource, [out, retval] IWebURLRequest** newRequest);
+
+ /*!
+ @method webView:resource:didReceiveAuthenticationChallenge:fromDataSource:
+ @abstract Start authentication for the resource, providing a challenge
+ @discussion Call useCredential::, continueWithoutCredential or
+ cancel on the challenge when done.
+ @param challenge The NSURLAuthenticationChallenge to start authentication for
+ @discussion If you do not implement this delegate method, WebKit will handle authentication
+ automatically by prompting with a sheet on the window that the WebView is associated with.
+ - (void)webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didReceiveAuthenticationChallenge([in] IWebView* webView, [in] unsigned long identifier,[in] IWebURLAuthenticationChallenge* challenge, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:resource:didCancelAuthenticationChallenge:fromDataSource:
+ @abstract Cancel authentication for a given request
+ @param challenge The NSURLAuthenticationChallenge for which to cancel authentication
+ - (void)webView:(WebView *)sender resource:(id)identifier didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didCancelAuthenticationChallenge([in] IWebView* webView, [in] unsigned long identifier, [in] IWebURLAuthenticationChallenge* challenge, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:resource:didReceiveResponse:fromDataSource:
+ @abstract This message is sent after a response has been received for this load.
+ @param webView The WebView sending the message.
+ @param identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param response The response for the request.
+ @param dataSource The dataSource that initiated the load.
+ @discussion In some rare cases, multiple responses may be received for a single load.
+ This occurs with multipart/x-mixed-replace, or "server push". In this case, the client
+ should assume that each new response resets progress so far for the resource back to 0,
+ and should check the new response for the expected content length.
+ - (void)webView:(WebView *)sender resource:(id)identifier didReceiveResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didReceiveResponse([in] IWebView* webView, [in] unsigned long identifier, [in] IWebURLResponse* response, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:resource:didReceiveContentLength:fromDataSource:
+ @discussion Multiple of these messages may be sent as data arrives.
+ @param webView The WebView sending the message.
+ @param identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param length The amount of new data received. This is not the total amount, just the new amount received.
+ @param dataSource The dataSource that initiated the load.
+ - (void)webView:(WebView *)sender resource:(id)identifier didReceiveContentLength:(WebNSInt)length fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didReceiveContentLength([in] IWebView* webView, [in] unsigned long identifier, [in] UINT length, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:resource:didFinishLoadingFromDataSource:
+ @discussion This message is sent after a load has successfully completed.
+ @param webView The WebView sending the message.
+ @param identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param dataSource The dataSource that initiated the load.
+ - (void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didFinishLoadingFromDataSource([in] IWebView* webView, [in] unsigned long identifier, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:resource:didFailLoadingWithError:fromDataSource:
+ @discussion This message is sent after a load has failed to load due to an error.
+ @param webView The WebView sending the message.
+ @param identifier An identifier that can be used to track the progress of a resource load across
+ multiple call backs.
+ @param error The error associated with this load.
+ @param dataSource The dataSource that initiated the load.
+ - (void)webView:(WebView *)sender resource:(id)identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT didFailLoadingWithError([in] IWebView* webView, [in] unsigned long identifier, [in] IWebError* error, [in] IWebDataSource* dataSource);
+
+ /*!
+ @method webView:plugInFailedWithError:dataSource:
+ @discussion Called when a plug-in is not found, fails to load or is not available for some reason.
+ @param webView The WebView sending the message.
+ @param error The plug-in error. In the userInfo dictionary of the error, the object for the
+ NSErrorFailingURLKey key is a URL string of the SRC attribute, the object for the WebKitErrorPlugInNameKey
+ key is a string of the plug-in's name, the object for the WebKitErrorPlugInPageURLStringKey key is a URL string
+ of the PLUGINSPAGE attribute and the object for the WebKitErrorMIMETypeKey key is a string of the TYPE attribute.
+ Some, none or all of the mentioned attributes can be present in the userInfo. The error returns nil for userInfo
+ when none are present.
+ @param dataSource The dataSource that contains the plug-in.
+ - (void)webView:(WebView *)sender plugInFailedWithError:(NSError *)error dataSource:(WebDataSource *)dataSource;
+ */
+ HRESULT plugInFailedWithError([in] IWebView* webView, [in] IWebError* error, [in] IWebDataSource* dataSource);
+}
diff --git a/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl
new file mode 100644
index 0000000..de2bdc0
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebDataSource.idl";
+import "IWebURLResponse.idl";
+#endif
+
+interface IWebView;
+interface IWebDataSource;
+interface IWebURLResponse;
+interface IWebURLRequest;
+
+
+/*!
+ @category WebResourceLoadDelegatePrivate
+*/
+
+[
+ object,
+ oleautomation,
+ uuid(1AE2968D-D756-47e8-8493-EA1040FAA725),
+ pointer_default(unique)
+]
+interface IWebResourceLoadDelegatePrivate : IUnknown
+{
+ /*!
+ @method webView:didLoadResourceFromMemoryCache:request:response:length:fromDataSource:
+ @param request The request for the resource.
+ @param response The response for the resource.
+ @param dataSource The datasource that initiated the load.
+ @discussion This will be called if the resource can be loaded from memory cache. No further resource load delegate
+ methods will be called on it after this.
+ - (id)webView:(WebView *)sender didLoadResourceFromMemoryCache:(NSURLRequest *)request response:(NSURLResponse *)response length:(NSInteger)length fromDataSource:(WebDataSource *)dataSource
+ */
+ HRESULT didLoadResourceFromMemoryCache([in] IWebView* webView, [in] IWebURLRequest* request, [in] IWebURLResponse* response, [in] UINT length, [in] IWebDataSource* dataSource);
+}
diff --git a/WebKit/win/Interfaces/IWebScriptCallFrame.idl b/WebKit/win/Interfaces/IWebScriptCallFrame.idl
new file mode 100644
index 0000000..d3a7f85
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScriptCallFrame.idl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+cpp_quote("// this is done to get midl to treat the WebScriptCallFrame type as a pointer type")
+cpp_quote("#if 0")
+typedef void* WebScriptCallFrame;
+cpp_quote("#else")
+cpp_quote("class WebScriptCallFrame;")
+cpp_quote("#endif")
+
+[
+ object,
+ oleautomation,
+ uuid(029D0676-162A-4140-8917-9574E09F66EB),
+ pointer_default(unique)
+]
+interface IWebScriptCallFrame : IUnknown
+{
+ HRESULT caller([out, retval] IWebScriptCallFrame**);
+ HRESULT functionName([out, retval] BSTR*);
+ HRESULT stringByEvaluatingJavaScriptFromString([in] BSTR script, [out, retval] BSTR*);
+ HRESULT variableNames([out, retval] IEnumVARIANT**);
+ HRESULT valueForVariable([in] BSTR key, [out, retval] BSTR* value);
+}
diff --git a/WebKit/win/Interfaces/IWebScriptDebugListener.idl b/WebKit/win/Interfaces/IWebScriptDebugListener.idl
new file mode 100644
index 0000000..ab6244d
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScriptDebugListener.idl
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScriptCallFrame.idl";
+import "IWebView.idl";
+#endif
+
+interface IWebDataSource;
+interface IWebFrame;
+interface IWebScriptCallFrame;
+interface IWebView;
+
+[
+ object,
+ oleautomation,
+ uuid(09612B56-BE17-4867-A441-1C5C4E0F5302),
+ pointer_default(unique)
+]
+interface IWebScriptDebugListener : IUnknown
+{
+ HRESULT didLoadMainResourceForDataSource([in] IWebView* view, [in] IWebDataSource* dataSource);
+ HRESULT didParseSource([in] IWebView* view, [in] BSTR sourceCode, [in] UINT baseLineNumber, [in] BSTR url, [in] int sourceID, [in] IWebFrame* forWebFrame);
+ HRESULT failedToParseSource([in] IWebView* view, [in] BSTR sourceCode, [in] UINT baseLineNumber, [in] BSTR url, [in] BSTR error, [in] IWebFrame* forWebFrame);
+ HRESULT didEnterCallFrame([in] IWebView* view, [in] IWebScriptCallFrame* frame, [in] int sourceID, [in] int lineNumber, [in] IWebFrame* forWebFrame);
+ HRESULT willExecuteStatement([in] IWebView* view, [in] IWebScriptCallFrame* frame, [in] int sourceID, [in] int lineNumber, [in] IWebFrame* forWebFrame);
+ HRESULT willLeaveCallFrame([in] IWebView* view, [in] IWebScriptCallFrame* frame, [in] int sourceID, [in] int lineNumber, [in] IWebFrame* forWebFrame);
+ HRESULT exceptionWasRaised([in] IWebView* view, [in] IWebScriptCallFrame* frame, [in] int sourceID, [in] int lineNumber, [in] IWebFrame* forWebFrame);
+ HRESULT serverDidDie();
+}
diff --git a/WebKit/win/Interfaces/IWebScriptDebugServer.idl b/WebKit/win/Interfaces/IWebScriptDebugServer.idl
new file mode 100644
index 0000000..975ff68
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScriptDebugServer.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScriptDebugListener.idl";
+#endif
+
+interface IWebScriptDebugListener;
+
+[
+ object,
+ oleautomation,
+ uuid(E24111D6-3668-4c8b-B921-D644524945F8),
+ pointer_default(unique)
+]
+interface IWebScriptDebugServer : IUnknown
+{
+ HRESULT sharedWebScriptDebugServer([out, retval] IWebScriptDebugServer**);
+ HRESULT addListener([in] IWebScriptDebugListener*);
+ HRESULT removeListener([in] IWebScriptDebugListener*);
+ HRESULT step();
+ HRESULT pause();
+ HRESULT resume();
+ HRESULT isPaused([out, retval] BOOL* isPaused);
+}
diff --git a/WebKit/win/Interfaces/IWebScriptObject.idl b/WebKit/win/Interfaces/IWebScriptObject.idl
new file mode 100644
index 0000000..83b502e
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScriptObject.idl
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+/*!
+ @class WebScriptObject
+ @discussion WebScriptObjects are used to wrap script objects passed from
+ script environments to Objective-C. WebScriptObjects cannot be created
+ directly. In normal uses of WebKit, you gain access to the script
+ environment using the "windowScriptObject" method on WebView.
+
+ The following KVC methods are commonly used to access properties of the
+ WebScriptObject:
+
+ - (void)setValue:(id)value forKey:(NSString *)key
+ - (id)valueForKey:(NSString *)key
+
+ As it possible to remove attributes from web script objects the following
+ additional method augments the basic KVC methods:
+
+ - (void)removeWebScriptKey:(NSString *)name;
+
+ Also the sparse array access allowed in web script objects doesn't map well to NSArray, so
+ the following methods can be used to access index based properties:
+
+ - (id)webScriptValueAtIndex:(unsigned int)index;
+ - (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
+
+ @interface WebScriptObject : NSObject
+*/
+[
+ object,
+ oleautomation,
+ uuid(7022340A-649C-43fc-9214-85CA7D3BE3C7),
+ pointer_default(unique)
+]
+interface IWebScriptObject : IUnknown
+{
+ /*!
+ @method throwException:
+ @discussion Throws an exception in the current script execution context.
+ @result Either NO if an exception could not be raised, YES otherwise.
+ + (BOOL)throwException:(NSString *)exceptionMessage;
+ */
+ HRESULT throwException([in] BSTR exceptionMessage, [out, retval] BOOL* result);
+
+ /*!
+ @method callWebScriptMethod:withArguments:
+ @param name The name of the method to call in the script environment.
+ @param args The arguments to pass to the script environment.
+ @discussion Calls the specified method in the script environment using the
+ specified arguments.
+ @result Returns the result of calling the script method.
+ - (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)args;
+ */
+ HRESULT callWebScriptMethod([in] BSTR name, [in, size_is(cArgs)] const VARIANT args[], [in] int cArgs, [out, retval] VARIANT* result);
+
+ /*!
+ @method evaluateWebScript:
+ @param script The script to execute in the target script environment.
+ @discussion The script will be executed in the target script environment. The format
+ of the script is dependent of the target script environment.
+ @result Returns the result of evaluating the script in the script environment.
+ - (id)evaluateWebScript:(NSString *)script;
+ */
+ HRESULT evaluateWebScript([in] BSTR script, [out, retval] VARIANT* result);
+
+ /*!
+ @method removeWebScriptKey:
+ @param name The name of the property to remove.
+ @discussion Removes the property from the object in the script environment.
+ - (void)removeWebScriptKey:(NSString *)name;
+ */
+ HRESULT removeWebScriptKey([in] BSTR name);
+
+ /*!
+ @method toString
+ @discussion Converts the target object to a string representation. The coercion
+ of non string objects type is dependent on the script environment.
+ @result Returns the string representation of the object.
+ - (NSString *)stringRepresentation;
+ */
+ HRESULT stringRepresentation([out, retval] BSTR* stringRepresentation);
+
+ /*!
+ @method propertyAtIndex:
+ @param index The index of the property to return. Index based access is dependent
+ @discussion Gets the value of the property at the specified index.
+ @result The value of the property.
+ - (id)webScriptValueAtIndex:(unsigned int)index;
+ */
+ HRESULT webScriptValueAtIndex([in] unsigned int index, [out, retval] VARIANT* result);
+
+ /*!
+ @method setPropertyAtIndex:value:
+ @param index The index of the property to set.
+ @param value The value of the property to set.
+ @discussion Sets the property value at the specified index.
+ - (void)setWebScriptValueAtIndex:(unsigned int)index value:(id)value;
+ */
+ HRESULT setWebScriptValueAtIndex([in] unsigned int index, [in] VARIANT val);
+
+ /*!
+ @method setException:
+ @param description The description of the exception.
+ @discussion Raises an exception in the script environment in the context of the
+ current object.
+ - (void)setException: (NSString *)description;
+ */
+ HRESULT setException([in] BSTR description);
+}
diff --git a/WebKit/win/Interfaces/IWebScrollBarDelegatePrivate.idl b/WebKit/win/Interfaces/IWebScrollBarDelegatePrivate.idl
new file mode 100644
index 0000000..e054e05
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScrollBarDelegatePrivate.idl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScrollBarPrivate.idl";
+#endif
+
+interface IWebScrollBarPrivate;
+
+[
+ object,
+ oleautomation,
+ uuid(2E8D56AF-3BF5-4e17-BDA6-01692ACBE3D5),
+ pointer_default(unique)
+]
+interface IWebScrollBarDelegatePrivate : IUnknown
+{
+ HRESULT valueChanged([in] IWebScrollBarPrivate* scrollBar);
+}
diff --git a/WebKit/win/Interfaces/IWebScrollBarPrivate.idl b/WebKit/win/Interfaces/IWebScrollBarPrivate.idl
new file mode 100644
index 0000000..c489ada
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebScrollBarPrivate.idl
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebScrollBarDelegatePrivate.idl";
+#endif
+
+interface IWebScrollBarDelegatePrivate;
+
+// NOTE: these enums must be kept in sync with the WebCore versions
+typedef enum WebScrollBarOrientation {
+ WebHorizontalScrollbar = 0,
+ WebVerticalScrollbar
+} WebScrollBarOrientation;
+
+typedef enum WebScrollBarControlSize {
+ WebRegularScrollbar = 0,
+ WebSmallScrollbar,
+ WebMiniScrollbar
+} WebScrollBarControlSize;
+
+typedef enum WebScrollDirection {
+ WebScrollUp = 0,
+ WebScrollDown,
+ WebScrollLeft,
+ WebScrollRight
+} WebScrollDirection;
+
+typedef enum WebScrollGranularity {
+ WebScrollByLine = 0,
+ WebScrollByPage,
+ WebScrollByDocument,
+ WebScrollByWheel
+} WebScrollGranularity;
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(6C585B08-2E4F-4594-9B90-0425E3A33FD0),
+ pointer_default(unique)
+]
+interface IWebScrollBarPrivate : IUnknown
+{
+ HRESULT init([in] IWebScrollBarDelegatePrivate* delegate, [in] OLE_HANDLE containingWindow, [in] WebScrollBarOrientation orientation, [in] WebScrollBarControlSize controlSize);
+
+ HRESULT setEnabled([in] BOOL enabled);
+
+ HRESULT setSteps([in] int lineStep, [in] int pageStep);
+
+ HRESULT setProportion([in] int visibleSize, [in] int totalSize);
+
+ HRESULT setRect([in] RECT bounds);
+
+ HRESULT setValue([in] int value);
+
+ HRESULT value([out, retval] int* value);
+
+ HRESULT paint([in] HDC dc, [in] RECT damageRect);
+
+ HRESULT frameGeometry([out, retval] RECT* bounds);
+
+ HRESULT width([out, retval] int* w);
+
+ HRESULT height([out, retval] int* h);
+
+ HRESULT requestedWidth([out, retval] int* w);
+
+ HRESULT requestedHeight([out, retval] int* h);
+
+ HRESULT handleMouseEvent([in] OLE_HANDLE hwnd, [in] UINT msg, [in] WPARAM wParam, [in] LPARAM lParam);
+
+ HRESULT scroll([in] WebScrollDirection direction, [in] WebScrollGranularity granularity, [in] float multiplier);
+}
diff --git a/WebKit/win/Interfaces/IWebSecurityOrigin.idl b/WebKit/win/Interfaces/IWebSecurityOrigin.idl
new file mode 100644
index 0000000..49302c6
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebSecurityOrigin.idl
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(304d4462-a921-4e85-bc11-bce1462B159d),
+ pointer_default(unique)
+]
+interface IWebSecurityOrigin : IUnknown
+{
+ HRESULT protocol([out, retval] BSTR* result);
+ HRESULT domain([out, retval] BSTR* result);
+ HRESULT port([out, retval] unsigned short* result);
+
+ HRESULT usage([out, retval] unsigned long long* result);
+
+ HRESULT quota([out, retval] unsigned long long* result);
+ HRESULT setQuota([in] unsigned long long quota);
+}
diff --git a/WebKit/win/Interfaces/IWebTextRenderer.idl b/WebKit/win/Interfaces/IWebTextRenderer.idl
new file mode 100644
index 0000000..bdfc54a
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebTextRenderer.idl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(5b26abbb-c27a-4527-a313-cb733e2cd257),
+ pointer_default(unique)
+]
+interface IWebTextRenderer : IUnknown
+{
+ HRESULT registerPrivateFont([in] LPCOLESTR fontFilePath);
+}
diff --git a/WebKit/win/Interfaces/IWebUIDelegate.idl b/WebKit/win/Interfaces/IWebUIDelegate.idl
new file mode 100644
index 0000000..738dffa
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebUIDelegate.idl
@@ -0,0 +1,781 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebUndoTarget.idl";
+import "IWebURLRequest.idl";
+import "IWebFrame.idl";
+#endif
+
+interface IWebFrame;
+interface IWebView;
+interface IWebURLRequest;
+interface IWebUndoTarget;
+
+/*!
+ @enum WebMenuItemTag
+ @discussion Each menu item in the default menu items array passed in
+ contextMenuItemsForElement:defaultMenuItems: has its tag set to one of the WebMenuItemTags.
+ When iterating through the default menu items array, use the tag to differentiate between them.
+*/
+typedef enum WebMenuItemTag {
+ WebMenuItemTagOpenLinkInNewWindow=1,
+ WebMenuItemTagDownloadLinkToDisk,
+ WebMenuItemTagCopyLinkToClipboard,
+ WebMenuItemTagOpenImageInNewWindow,
+ WebMenuItemTagDownloadImageToDisk,
+ WebMenuItemTagCopyImageToClipboard,
+ WebMenuItemTagOpenFrameInNewWindow,
+ WebMenuItemTagCopy,
+ WebMenuItemTagGoBack,
+ WebMenuItemTagGoForward,
+ WebMenuItemTagStop,
+ WebMenuItemTagReload,
+ WebMenuItemTagCut,
+ WebMenuItemTagPaste,
+ WebMenuItemTagSpellingGuess,
+ WebMenuItemTagNoGuessesFound,
+ WebMenuItemTagIgnoreSpelling,
+ WebMenuItemTagLearnSpelling,
+ WebMenuItemTagOther,
+ WebMenuItemTagSearchInSpotlight,
+ WebMenuItemTagSearchWeb,
+ WebMenuItemTagLookUpInDictionary,
+ WebMenuItemTagOpenWithDefaultApplication,
+ WebMenuItemPDFActualSize,
+ WebMenuItemPDFZoomIn,
+ WebMenuItemPDFZoomOut,
+ WebMenuItemPDFAutoSize,
+ WebMenuItemPDFSinglePage,
+ WebMenuItemPDFFacingPages,
+ WebMenuItemPDFContinuous,
+ WebMenuItemPDFNextPage,
+ WebMenuItemPDFPreviousPage,
+ // FIXME: Review these names before release!
+ WebMenuItemTagOpenLink = 2000,
+ WebMenuItemTagIgnoreGrammar,
+ WebtMenuItemTagSpellingMenu,
+ WebMenuItemTagShowSpellingPanel,
+ WebMenuItemTagCheckSpelling,
+ WebMenuItemTagCheckSpellingWhileTyping,
+ WebMenuItemTagCheckGrammarWithSpelling,
+ WebMenuItemTagFontMenu,
+ WebMenuItemTagShowFonts,
+ WebMenuItemTagBold,
+ WebMenuItemTagItalic,
+ WebMenuItemTagUnderline,
+ WebMenuItemTagOutline,
+ WebMenuItemTagStyles,
+ WebMenuItemTagShowColors,
+ WebMenuItemTagSpeechMenu,
+ WebMenuItemTagStartSpeaking,
+ WebMenuItemTagStopSpeaking,
+ WebMenuItemTagWritingDirectionMenu,
+ WebMenuItemTagDefaultDirection,
+ WebMenuItemTagLeftToRight,
+ WebMenuItemTagRightToLeft,
+ WebMenuItemTagPDFSinglePageScrolling,
+ WebMenuItemTagPDFFacingPagesScrolling,
+ WebMenuItemTagInspectElement,
+ WebMenuItemBaseApplicationTag=10000
+} WebMenuItemTag;
+
+/*!
+ @enum WebDragDestinationAction
+ @abstract Actions that the destination of a drag can perform.
+ @constant WebDragDestinationActionNone No action
+ @constant WebDragDestinationActionDHTML Allows DHTML (such as JavaScript) to handle the drag
+ @constant WebDragDestinationActionEdit Allows editable documents to be edited from the drag
+ @constant WebDragDestinationActionLoad Allows a location change from the drag
+ @constant WebDragDestinationActionAny Allows any of the above to occur
+*/
+typedef enum WebDragDestinationAction {
+ WebDragDestinationActionNone = 0,
+ WebDragDestinationActionDHTML = 1,
+ WebDragDestinationActionEdit = 2,
+ WebDragDestinationActionLoad = 4,
+ WebDragDestinationActionAny = (unsigned long)-1
+} WebDragDestinationAction;
+
+/*!
+ @enum WebDragSourceAction
+ @abstract Actions that the source of a drag can perform.
+ @constant WebDragSourceActionNone No action
+ @constant WebDragSourceActionDHTML Allows DHTML (such as JavaScript) to start a drag
+ @constant WebDragSourceActionImage Allows an image drag to occur
+ @constant WebDragSourceActionLink Allows a link drag to occur
+ @constant WebDragSourceActionSelection Allows a selection drag to occur
+ @constant WebDragSourceActionAny Allows any of the above to occur
+*/
+typedef enum WebDragSourceAction {
+ WebDragSourceActionNone = 0,
+ WebDragSourceActionDHTML = 1,
+ WebDragSourceActionImage = 2,
+ WebDragSourceActionLink = 4,
+ WebDragSourceActionSelection = 8,
+ WebDragSourceActionAny = (unsigned long)-1
+} WebDragSourceAction;
+
+
+/*!
+ @protocol WebOpenPanelResultListener
+ @discussion This protocol is used to call back with the results of
+ the file open panel requested by runOpenPanelForFileButtonWithResultListener:
+ @protocol WebOpenPanelResultListener <NSObject>
+*/
+[
+ object,
+ oleautomation,
+ uuid(634198C7-9DFC-4aba-9E8C-90AEEA7A4144),
+ pointer_default(unique)
+]
+interface IWebOpenPanelResultListener : IUnknown
+{
+ /*!
+ @method chooseFilename:
+ @abstract Call this method to return a filename from the file open panel.
+ @param fileName
+ - (void)chooseFilename:(NSString *)fileName;
+ */
+ HRESULT chooseFilename([out, retval] BSTR* fileName);
+
+ /*!
+ @method cancel
+ @abstract Call this method to indicate that the file open panel was cancelled.
+ - (void)cancel;
+ */
+ HRESULT cancel();
+}
+
+/*!
+ @category WebUIDelegate
+ @discussion A class that implements WebUIDelegate provides
+ window-related methods that may be used by Javascript, plugins and
+ other aspects of web pages. These methods are used to open new
+ windows and control aspects of existing windows.
+ @interface NSObject (WebUIDelegate)
+*/
+[
+ object,
+ oleautomation,
+ uuid(2452A889-A74A-4fbc-9617-326A0A953630),
+ pointer_default(unique)
+]
+interface IWebUIDelegate : IUnknown
+{
+ /*!
+ @method webView:createWebViewWithRequest:
+ @abstract Create a new window and begin to load the specified request.
+ @discussion The newly created window is hidden, and the window operations delegate on the
+ new WebViews will get a webViewShow: call.
+ @param sender The WebView sending the delegate method.
+ @param request The request to load.
+ @result The WebView for the new window.
+ - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
+ */
+ HRESULT createWebViewWithRequest([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView** newWebView);
+
+ /*!
+ @method webViewShow:
+ @param sender The WebView sending the delegate method.
+ @abstract Show the window that contains the top level view of the WebView,
+ ordering it frontmost.
+ @discussion This will only be called just after createWindowWithRequest:
+ is used to create a new window.
+ - (void)webViewShow:(WebView *)sender;
+ */
+ HRESULT webViewShow([in] IWebView* sender);
+
+ /*!
+ @method webViewClose:
+ @abstract Close the current window.
+ @param sender The WebView sending the delegate method.
+ @discussion Clients showing multiple views in one window may
+ choose to close only the one corresponding to this
+ WebView. Other clients may choose to ignore this method
+ entirely.
+ - (void)webViewClose:(WebView *)sender;
+ */
+ HRESULT webViewClose([in] IWebView* sender);
+
+ /*!
+ @method webViewFocus:
+ @abstract Focus the current window (i.e. makeKeyAndOrderFront:).
+ @param The WebView sending the delegate method.
+ @discussion Clients showing multiple views in one window may want to
+ also do something to focus the one corresponding to this WebView.
+ - (void)webViewFocus:(WebView *)sender;
+ */
+ HRESULT webViewFocus([in] IWebView* sender);
+
+ /*!
+ @method webViewUnfocus:
+ @abstract Unfocus the current window.
+ @param sender The WebView sending the delegate method.
+ @discussion Clients showing multiple views in one window may want to
+ also do something to unfocus the one corresponding to this WebView.
+ - (void)webViewUnfocus:(WebView *)sender;
+ */
+ HRESULT webViewUnfocus([in] IWebView* sender);
+
+ /*!
+ @method webViewFirstResponder:
+ @abstract Get the first responder for this window.
+ @param sender The WebView sending the delegate method.
+ @discussion This method should return the focused control in the
+ WebView's view, if any. If the view is out of the window
+ hierarchy, this might return something than calling firstResponder
+ on the real NSWindow would. It's OK to return either nil or the
+ real first responder if some control not in the window has focus.
+ - (NSResponder *)webViewFirstResponder:(WebView *)sender;
+ */
+ HRESULT webViewFirstResponder([in] IWebView* sender, [out, retval] OLE_HANDLE* responderHWnd);
+
+ /*!
+ @method webView:makeFirstResponder:
+ @abstract Set the first responder for this window.
+ @param sender The WebView sending the delegate method.
+ @param responder The responder to make first (will always be a view)
+ @discussion responder will always be a view that is in the view
+ subhierarchy of the top-level web view for this WebView. If the
+ WebView's top level view is currently out of the view
+ hierarchy, it may be desirable to save the first responder
+ elsewhere, or possibly ignore this call.
+ - (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
+ */
+ HRESULT makeFirstResponder([in] IWebView* sender, [in] OLE_HANDLE responderHWnd);
+
+ /*!
+ @method webView:setStatusText:
+ @abstract Set the window's status display, if any, to the specified string.
+ @param sender The WebView sending the delegate method.
+ @param text The status text to set
+ - (void)webView:(WebView *)sender setStatusText:(NSString *)text;
+ */
+ HRESULT setStatusText([in] IWebView* sender, [in] BSTR text);
+
+ /*!
+ @method webViewStatusText:
+ @abstract Get the currently displayed status text.
+ @param sender The WebView sending the delegate method.
+ @result The status text
+ - (NSString *)webViewStatusText:(WebView *)sender;
+ */
+ HRESULT webViewStatusText([in] IWebView* sender, [out, retval] BSTR* text);
+
+ /*!
+ @method webViewAreToolbarsVisible:
+ @abstract Determine whether the window's toolbars are currently visible
+ @param sender The WebView sending the delegate method.
+ @discussion This method should return YES if the window has any
+ toolbars that are currently on, besides the status bar. If the app
+ has more than one toolbar per window, for example a regular
+ command toolbar and a favorites bar, it should return YES from
+ this method if at least one is on.
+ @result YES if at least one toolbar is visible, otherwise NO.
+ - (BOOL)webViewAreToolbarsVisible:(WebView *)sender;
+ */
+ HRESULT webViewAreToolbarsVisible([in] IWebView* sender, [out, retval] BOOL* visible);
+
+ /*!
+ @method webView:setToolbarsVisible:
+ @param sender The WebView sending the delegate method.
+ @abstract Set whether the window's toolbars are currently visible.
+ @param visible New value for toolbar visibility
+ @discussion Setting this to YES should turn on all toolbars
+ (except for a possible status bar). Setting it to NO should turn
+ off all toolbars (with the same exception).
+ - (void)webView:(WebView *)sender setToolbarsVisible:(BOOL)visible;
+ */
+ HRESULT setToolbarsVisible([in] IWebView* sender, [in] BOOL visible);
+
+ /*!
+ @method webViewIsStatusBarVisible:
+ @abstract Determine whether the status bar is visible.
+ @param sender The WebView sending the delegate method.
+ @result YES if the status bar is visible, otherwise NO.
+ - (BOOL)webViewIsStatusBarVisible:(WebView *)sender;
+ */
+ HRESULT webViewIsStatusBarVisible([in] IWebView* sender, [out, retval] BOOL* visible);
+
+ /*!
+ @method webView:setStatusBarVisible:
+ @abstract Set whether the status bar is currently visible.
+ @param visible The new visibility value
+ @discussion Setting this to YES should show the status bar,
+ setting it to NO should hide it.
+ - (void)webView:(WebView *)sender setStatusBarVisible:(BOOL)visible;
+ */
+ HRESULT setStatusBarVisible([in] IWebView* sender, [in] BOOL visible);
+
+ /*!
+ @method webViewIsResizable:
+ @abstract Determine whether the window is resizable or not.
+ @param sender The WebView sending the delegate method.
+ @result YES if resizable, NO if not.
+ @discussion If there are multiple views in the same window, they
+ have have their own separate resize controls and this may need to
+ be handled specially.
+ - (BOOL)webViewIsResizable:(WebView *)sender;
+ */
+ HRESULT webViewIsResizable([in] IWebView* sender, [out, retval] BOOL* resizable);
+
+ /*!
+ @method webView:setResizable:
+ @abstract Set the window to resizable or not
+ @param sender The WebView sending the delegate method.
+ @param resizable YES if the window should be made resizable, NO if not.
+ @discussion If there are multiple views in the same window, they
+ have have their own separate resize controls and this may need to
+ be handled specially.
+ - (void)webView:(WebView *)sender setResizable:(BOOL)resizable;
+ */
+ HRESULT setResizable([in] IWebView* sender, [in] BOOL resizable);
+
+ /*!
+ @method webView:setFrame:
+ @abstract Set the window's frame rect
+ @param sender The WebView sending the delegate method.
+ @param frame The new window frame size
+ @discussion Even though a caller could set the frame directly using the NSWindow,
+ this method is provided so implementors of this protocol can do special
+ things on programmatic move/resize, like avoiding autosaving of the size.
+ - (void)webView:(WebView *)sender setFrame:(NSRect)frame;
+ */
+ HRESULT setFrame([in] IWebView* sender, [in] RECT* frame);
+
+ /*!
+ @method webViewFrame:
+ @param sender The WebView sending the delegate method.
+ @abstract REturn the window's frame rect
+ @discussion
+ - (NSRect)webViewFrame:(WebView *)sender;
+ */
+ HRESULT webViewFrame([in] IWebView* sender, [out, retval] RECT* frame);
+
+ /*!
+ @method webView:setContentRect:
+ @abstract Set the window's content rect
+ @param sender The WebView sending the delegate method.
+ @param frame The new window content rect
+ @discussion Even though a caller could set the content rect
+ directly using the NSWindow, this method is provided so
+ implementors of this protocol can do special things on
+ programmatic move/resize, like avoiding autosaving of the size.
+ - (void)webView:(WebView *)sender setContentRect:(NSRect)contentRect;
+ */
+ HRESULT setContentRect([in] IWebView* sender, [in] RECT* contentRect);
+
+ /*!
+ @method webViewContentRect:
+ @abstract Return the window's content rect
+ @discussion
+ - (NSRect)webViewContentRect:(WebView *)sender;
+ */
+ HRESULT webViewContentRect([in] IWebView* sender, [out, retval] RECT* contentRect);
+
+ /*!
+ @method webView:runJavaScriptAlertPanelWithMessage:
+ @abstract Display a JavaScript alert panel
+ @param sender The WebView sending the delegate method.
+ @param message The message to display
+ @discussion Clients should visually indicate that this panel comes
+ from JavaScript. The panel should have a single OK button.
+ - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message;
+ */
+ HRESULT runJavaScriptAlertPanelWithMessage([in] IWebView* sender, [in] BSTR message);
+
+ /*!
+ @method webView:runJavaScriptConfirmPanelWithMessage:
+ @abstract Display a JavaScript confirm panel
+ @param sender The WebView sending the delegate method.
+ @param message The message to display
+ @result YES if the user hit OK, no if the user chose Cancel.
+ @discussion Clients should visually indicate that this panel comes
+ from JavaScript. The panel should have two buttons, e.g. "OK" and
+ "Cancel".
+ - (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message;
+ */
+ HRESULT runJavaScriptConfirmPanelWithMessage([in] IWebView* sender, [in] BSTR message, [out, retval] BOOL* result);
+
+ /*!
+ @method webView:runJavaScriptTextInputPanelWithPrompt:defaultText:
+ @abstract Display a JavaScript text input panel
+ @param sender The WebView sending the delegate method.
+ @param message The message to display
+ @param defaultText The initial text for the text entry area.
+ @result The typed text if the user hit OK, otherwise nil.
+ @discussion Clients should visually indicate that this panel comes
+ from JavaScript. The panel should have two buttons, e.g. "OK" and
+ "Cancel", and an area to type text.
+ - (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText;
+ */
+ HRESULT runJavaScriptTextInputPanelWithPrompt([in] IWebView* sender, [in] BSTR message, [in] BSTR defaultText, [out, retval] BSTR* result);
+
+ /*!
+ @method webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:
+ @abstract Display a confirm panel by an "before unload" event handler.
+ @param sender The WebView sending the delegate method.
+ @param message The message to display.
+ @param frame The WebFrame whose JavaScript initiated this call.
+ @result YES if the user hit OK, NO if the user chose Cancel.
+ @discussion Clients should include a message in addition to the one
+ supplied by the web page that indicates. The panel should have
+ two buttons, e.g. "OK" and "Cancel".
+ - (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
+ */
+ HRESULT runBeforeUnloadConfirmPanelWithMessage([in] IWebView* sender, [in] BSTR message, [in] IWebFrame* initiatedByFrame, [out, retval] BOOL* result);
+
+ /*!
+ @method webView:runOpenPanelForFileButtonWithResultListener:
+ @abstract Display a file open panel for a file input control.
+ @param sender The WebView sending the delegate method.
+ @param resultListener The object to call back with the results.
+ @discussion This method is passed a callback object instead of giving a return
+ value so that it can be handled with a sheet.
+ - (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener;
+ */
+ HRESULT runOpenPanelForFileButtonWithResultListener([in] IWebView* sender, [in] IWebOpenPanelResultListener* resultListener);
+
+ /*!
+ @method webView:mouseDidMoveOverElement:modifierFlags:
+ @abstract Update the window's feedback for mousing over links to reflect a new item the mouse is over
+ or new modifier flags.
+ @param sender The WebView sending the delegate method.
+ @param elementInformation Dictionary that describes the element that the mouse is over, or nil.
+ @param modifierFlags The modifier flags as in NSEvent.
+ - (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(WebNSUInt)modifierFlags;
+ */
+ HRESULT mouseDidMoveOverElement([in] IWebView* sender, [in] IPropertyBag* elementInformation, [in] UINT modifierFlags);
+
+ /*!
+ @method webView:contextMenuItemsForElement:defaultMenuItems:
+ @abstract Returns the menu items to display in an element's contextual menu.
+ @param sender The WebView sending the delegate method.
+ @param element A dictionary representation of the clicked element.
+ @param defaultMenuItems An array of default NSMenuItems to include in all contextual menus.
+ @result An array of NSMenuItems to include in the contextual menu.
+ - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems;
+ */
+ HRESULT contextMenuItemsForElement([in] IWebView* sender, [in] IPropertyBag* element, [in] OLE_HANDLE defaultItemsHMenu, [out, retval] OLE_HANDLE* resultHMenu);
+
+ /*!
+ @method webView:validateUserInterfaceItem:defaultValidation:
+ @abstract Controls UI validation
+ @param webView The WebView sending the delegate method
+ @param item The user interface item being validated
+ @pararm defaultValidation Whether or not the WebView thinks the item is valid
+ @discussion This method allows the UI delegate to control WebView's validation of user interface items.
+ See WebView.h to see the methods to that WebView can currently validate. See NSUserInterfaceValidations and
+ NSValidatedUserInterfaceItem for information about UI validation.
+ - (BOOL)webView:(WebView *)webView validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item defaultValidation:(BOOL)defaultValidation;
+ */
+ HRESULT validateUserInterfaceItem([in] IWebView* webView, [in] UINT itemCommandID, [in] BOOL defaultValidation, [out, retval] BOOL* isValid);
+
+ /*!
+ @method webView:shouldPerformAction:fromSender:
+ @abstract Controls actions
+ @param webView The WebView sending the delegate method
+ @param action The action being sent
+ @param sender The sender of the action
+ @discussion This method allows the UI delegate to control WebView's behavior when an action is being sent.
+ For example, if the action is copy:, the delegate can return YES to allow WebView to perform its default
+ copy behavior or return NO and perform copy: in some other way. See WebView.h to see the actions that
+ WebView can perform.
+ - (BOOL)webView:(WebView *)webView shouldPerformAction:(SEL)action fromSender:(id)sender;
+ */
+ HRESULT shouldPerformAction([in] IWebView* webView, [in] UINT itemCommandID, [in] UINT sender);
+
+ /*!
+ @method webView:dragDestinationActionMaskForDraggingInfo:
+ @abstract Controls behavior when dragging to a WebView
+ @param webView The WebView sending the delegate method
+ @param draggingInfo The dragging info of the drag
+ @discussion This method is called periodically as something is dragged over a WebView. The UI delegate can return a mask
+ indicating which drag destination actions can occur, WebDragDestinationActionAny to allow any kind of action or
+ WebDragDestinationActionNone to not accept the drag.
+ - (unsigned)webView:(WebView *)webView dragDestinationActionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
+ */
+ HRESULT dragDestinationActionMaskForDraggingInfo([in] IWebView* webView, [in] IDataObject* draggingInfo, [out, retval] WebDragDestinationAction* action);
+
+ /*!
+ @method webView:willPerformDragDestinationAction:forDraggingInfo:
+ @abstract Informs that WebView will perform a drag destination action
+ @param webView The WebView sending the delegate method
+ @param action The drag destination action
+ @param draggingInfo The dragging info of the drag
+ @discussion This method is called after the last call to webView:dragDestinationActionMaskForDraggingInfo: after something is dropped on a WebView.
+ This method informs the UI delegate of the drag destination action that WebView will perform.
+ - (void)webView:(WebView *)webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:(id <NSDraggingInfo>)draggingInfo;
+ */
+ HRESULT willPerformDragDestinationAction([in] IWebView* webView, [in] WebDragDestinationAction action, [in] IDataObject* draggingInfo);
+
+ /*!
+ @method webView:dragSourceActionMaskForPoint:
+ @abstract Controls behavior when dragging from a WebView
+ @param webView The WebView sending the delegate method
+ @param point The point where the drag started in the coordinates of the WebView
+ @discussion This method is called after the user has begun a drag from a WebView. The UI delegate can return a mask indicating
+ which drag source actions can occur, WebDragSourceActionAny to allow any kind of action or WebDragSourceActionNone to not begin a drag.
+ - (unsigned)webView:(WebView *)webView dragSourceActionMaskForPoint:(NSPoint)point;
+ */
+ HRESULT dragSourceActionMaskForPoint([in] IWebView* webView, [in] LPPOINT point, [out, retval] WebDragSourceAction* action);
+
+ /*!
+ @method webView:willPerformDragSourceAction:fromPoint:withPasteboard:
+ @abstract Informs that a drag a has begun from a WebView
+ @param webView The WebView sending the delegate method
+ @param action The drag source action
+ @param point The point where the drag started in the coordinates of the WebView
+ @param pasteboard The drag pasteboard
+ @discussion This method is called after webView:dragSourceActionMaskForPoint: is called after the user has begun a drag from a WebView.
+ This method informs the UI delegate of the drag source action that will be performed and gives the delegate an opportunity to modify
+ the contents of the dragging pasteboard.
+ - (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard;
+ */
+ HRESULT willPerformDragSourceAction([in] IWebView* webView, [in] WebDragSourceAction action, [in] LPPOINT point, [in] IDataObject* pasteboard);
+
+ /*!
+ @method webView:contextMenuItemSelected:ForElement:
+ @abstract Perform the action associated with the selected item.
+ @param sender The WebView sending the delegate method.
+ @param item The menu item that was selected.
+ @param element A dictionary representation of the clicked element.
+ */
+ [local] HRESULT contextMenuItemSelected([in] IWebView* sender, [in] void* item, [in] IPropertyBag* element);
+
+ /*
+ @method hasCustomMenuImplementation:
+ @abstract Returns whether the application uses the following functions to create a custom menu impementation.
+ */
+ HRESULT hasCustomMenuImplementation([out, retval] BOOL* hasCustomMenus);
+
+ /*
+ @method webView:trackCutsomPopupMenu
+ @abstract Adds custom draw data to the menu items and calls a custom trackPopupMenu.
+ @param sender The WebView sending the delegate method.
+ @param menu The menu that we want to pop up.
+ @param point The point associated with the context menu event in the coordinates of the WebView
+ */
+ HRESULT trackCustomPopupMenu([in] IWebView* sender, [in] OLE_HANDLE hMenu, [in] LPPOINT point);
+
+ /*
+ @method webView:measureCustomMenuItem
+ @abstract This is called when the WM_MEASUREITEM command is received to measure the custom menu items
+ @param sender The WebView sending the delegate method.
+ @param measureItem The LPMEASUREITEMSTRUCT associated with the item.
+ */
+ [local] HRESULT measureCustomMenuItem([in] IWebView* sender, [in] void* measureItem);
+
+ /*
+ @method webView:drawCustomMenuItem
+ @abstract This is called when the WM_DRAWITEM command is received to draw the custom menu item
+ @param sender The WebView sending the delegate method.
+ @param drawItem The LPDRAWITEMSTRUCT associated with the item.
+ */
+ [local] HRESULT drawCustomMenuItem([in] IWebView* sender, [in] void* drawItem);
+
+ /*
+ @method webView:addCustomMenuDrawingData
+ @abstract Add custom data to the menu that the delegate can use when asked to draw.
+ @param sender The WebView sending the delegate method.
+ @param menu The cutsom menu to clean up.
+ @discussion This method is called for submenus as well.
+ */
+ HRESULT addCustomMenuDrawingData([in] IWebView* sender, [in] OLE_HANDLE hMenu);
+
+ /*
+ @method webView:cleanUpCustomMenuDrawingData
+ @abstract Clean up any custom data added to the menu items
+ @param sender The WebView sending the delegate method.
+ @param menu The cutsom menu to clean up.
+ */
+ HRESULT cleanUpCustomMenuDrawingData([in] IWebView* sender, [in] OLE_HANDLE hMenu);
+
+ /*!
+ @method webView:canTakeFocus:
+ @abstract Informs whether focus can be transferred out of the WebView in the specified direction
+ @param sender The WebView sending the delegate method.
+ @param forward Whether focus is moving forward or backward.
+ */
+ HRESULT canTakeFocus([in] IWebView* sender, [in] BOOL forward, [out] BOOL* result);
+
+ /*!
+ @method webView:takeFocus:
+ @abstract Instructs the delegate to take focus out of the WebView
+ @param sender The WebView sending the delegate method.
+ @param forward Whether focus is moving forward or backward.
+ */
+ HRESULT takeFocus([in] IWebView* sender, [in] BOOL forward);
+
+ /// Undo related UI delegate methods --------------------------------------------------------------------------------
+
+ /*!
+ @method registerUndoWithTarget:
+ @abstract Registers an undo operation of a IWebUndoTarget on the undo/redo stack.
+ @param target The target that will be called back when the action is undone
+ @param actionName The name of the action - this will be passed back to the target when we need to undo the operation
+ @param actionArg An object that target used to save undo information
+ */
+ HRESULT registerUndoWithTarget([in] IWebUndoTarget* target, [in] BSTR actionName, [in] IUnknown* actionArg);
+
+ /*!
+ @method removeAllActionsWithTarget:
+ @abstract remove all the undo operations that are registered for the passed in target on the undo/redo stack.
+ @param target
+ */
+ HRESULT removeAllActionsWithTarget([in] IWebUndoTarget* target);
+
+ /*!
+ @method setActionTitle:
+ @abstract Sets the name of the action for the current group of undo operations
+ @param actionName Name of the action
+ */
+ HRESULT setActionTitle([in] BSTR actionTitle);
+
+ /*!
+ @method undo:
+ @abstract Undo the last group of operations
+ */
+ HRESULT undo();
+
+ /*!
+ @method redo:
+ @abstract Redo the last group of operations
+ */
+ HRESULT redo();
+
+ /*!
+ @method canUndo:
+ @abstract Returns whether there's anything on the undo stack to be undone
+ */
+ HRESULT canUndo([out, retval] BOOL* result);
+
+ /*!
+ @method canRedo:
+ @abstract Returns whether there's anything on the redo stack to be redone
+ */
+ HRESULT canRedo([out, retval] BOOL* result);
+}
+
+/*!
+ @category WebUIDelegate2
+ @discussion A class that supplements the IWebUIDelegate interface
+*/
+[
+ object,
+ oleautomation,
+ uuid(C6FF73E1-304D-4129-A60C-66326C2578DB),
+ pointer_default(unique)
+]
+interface IWebUIDelegate2 : IWebUIDelegate
+{
+/*!
+ @method webView:printFrame:
+ @abstract Informs that a WebFrame needs to be printed
+ @param webView The WebView sending the delegate method
+ @param frame The WebFrame needing to be printed
+ @discussion This method is called when a script or user requests the page to be printed.
+ In this method the delegate can prepare the WebFrame to be printed.
+*/
+ HRESULT printFrame([in] IWebView* webView, [in] IWebFrame* frame);
+
+/*!
+ @method webView:ftpDirectoryTemplatePath
+ @abstract Returns the path to the FTP directory listing template document
+ @param webView The WebView sending the delegate method
+ @param path The path to the template document
+ @discussion This method is called when an FTP directory listing is viewed in a webView.
+ In practice, all WebViews show the same template document data that was loaded for the very
+ first WebView that displayed a directory listing, so this will only be called once.
+*/
+ HRESULT ftpDirectoryTemplatePath([in] IWebView* webView, [out, retval] BSTR* path);
+
+/*!
+ @method webViewHeaderHeight:
+ @param webView The WebView sending the delegate method
+ @abstract Reserve a height for the printed page header.
+ @result The height to reserve for the printed page header, return 0.0 to not reserve any space for a header.
+ @discussion The height returned will be used to calculate the rect passed to webView:drawHeaderInRect:.
+
+ - (float)webViewHeaderHeight:(WebView *)sender;
+*/
+ HRESULT webViewHeaderHeight([in] IWebView* webView, [out, retval] float* result);
+
+/*!
+ @method webViewFooterHeight:
+ @param webView The WebView sending the delegate method
+ @abstract Reserve a height for the printed page footer.
+ @result The height to reserve for the printed page footer, return 0.0 to not reserve any space for a footer.
+ @discussion The height returned will be used to calculate the rect passed to webView:drawFooterInRect:.
+
+ - (float)webViewFooterHeight:(WebView *)sender;
+*/
+ HRESULT webViewFooterHeight([in] IWebView* webView, [out, retval] float* result);
+
+/*!
+ @method webView:drawHeaderInRect:
+ @param webView The WebView sending the delegate method
+ @param rect The NSRect reserved for the header of the page
+ @abstract The delegate should draw a header for the sender in the supplied rect.
+
+ - (void)webView:(WebView *)sender drawHeaderInRect:(NSRect)rect;
+*/
+ HRESULT drawHeaderInRect([in] IWebView* webView, [in] RECT* rect, [in] OLE_HANDLE drawingContext);
+
+/*!
+ @method webView:drawFooterInRect:
+ @param webView The WebView sending the delegate method
+ @param rect The NSRect reserved for the footer of the page
+ @abstract The delegate should draw a footer for the sender in the supplied rect.
+
+ - (void)webView:(WebView *)sender drawFooterInRect:(NSRect)rect;
+*/
+ HRESULT drawFooterInRect([in] IWebView* webView, [in] RECT* rect, [in] OLE_HANDLE drawingContext, [in] UINT pageIndex, [in] UINT pageCount);
+
+ HRESULT webViewPrintingMarginRect([in] IWebView* webView, [out, retval] RECT* rect);
+}
+
+/*!
+ @category WebUIDelegate3
+ @discussion A class that supplements the IWebUIDelegate interface
+*/
+[
+ object,
+ oleautomation,
+ uuid(DD544D90-C233-4562-8EFD-A8D3A0DEBC19),
+ pointer_default(unique)
+]
+interface IWebUIDelegate3 : IWebUIDelegate2
+{
+ HRESULT canRunModal([in] IWebView* webView, [out, retval] BOOL* canRunBoolean);
+ HRESULT createModalDialog([in] IWebView* sender, [in] IWebURLRequest* request, [out, retval] IWebView** newWebView);
+ HRESULT runModal([in] IWebView* webView);
+ HRESULT isMenuBarVisible([in] IWebView* webView, [out, retval] BOOL* visible);
+ HRESULT setMenuBarVisible([in] IWebView* webView, [in] BOOL visible);
+ HRESULT runDatabaseSizeLimitPrompt([in] IWebView* webView, [in] BSTR displayName, [in] IWebFrame* initiatedByFrame, [out, retval] BOOL* allowed);
+}
diff --git a/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl
new file mode 100755
index 0000000..53ce510
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebSecurityOrigin.idl";
+import "IWebView.idl";
+#endif
+
+interface IWebFrame;
+interface IWebSecurityOrigin;
+interface IWebView;
+
+[
+ object,
+ oleautomation,
+ uuid(176711F1-822F-446b-BE9A-64BB38C562F5),
+ pointer_default(unique)
+]
+interface IWebUIDelegatePrivate : IUnknown
+{
+ HRESULT webViewResizerRect([in] IWebView* sender, [out, retval] RECT* rect);
+ HRESULT webViewDrawResizer([in] IWebView* sender, [in] HDC dc, [in] BOOL overlapsContent, [in] RECT* rect);
+ HRESULT webViewScrolled([in] IWebView* sender);
+ HRESULT webViewAddMessageToConsole([in] IWebView* sender, [in] BSTR message, [in] int lineNumber, [in] BSTR url, [in] BOOL isError);
+ HRESULT webViewShouldInterruptJavaScript([in] IWebView* sender, [out, retval] BOOL* result);
+ HRESULT webViewReceivedFocus([in] IWebView* sender);
+ HRESULT webViewLostFocus([in] IWebView* sender, [in] OLE_HANDLE loseFocusToHWnd);
+ HRESULT doDragDrop([in] IWebView* sender, [in] IDataObject* dataObject, [in] IDropSource* dropSource, [in] DWORD okEffect, [out, retval] DWORD* performedEffect);
+ HRESULT webViewGetDlgCode([in] IWebView* sender, [in] UINT keyCode, [out, retval] LONG_PTR* code);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(7518FCCE-EC47-43b9-8C49-51E91C05C944),
+ pointer_default(unique)
+]
+interface IWebUIDelegatePrivate2 : IWebUIDelegatePrivate
+{
+ HRESULT webViewPainted([in] IWebView* sender);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(4E7AECB6-C017-4e98-8FD5-4131C4BAB923),
+ pointer_default(unique)
+]
+interface IWebUIDelegatePrivate3 : IWebUIDelegatePrivate2
+{
+ HRESULT exceededDatabaseQuota([in] IWebView* sender, [in] IWebFrame* frame, [in] IWebSecurityOrigin* origin, [in] BSTR databaseIdentifier);
+}
diff --git a/WebKit/win/Interfaces/IWebURLAuthenticationChallenge.idl b/WebKit/win/Interfaces/IWebURLAuthenticationChallenge.idl
new file mode 100644
index 0000000..68881ab
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebURLAuthenticationChallenge.idl
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebError.idl";
+import "IWebURLResponse.idl";
+#endif
+
+interface IWebError;
+interface IWebURLAuthenticationChallengeSender;
+interface IWebURLCredential;
+interface IWebURLProtectionSpace;
+interface IWebURLResponse;
+
+typedef enum {
+ WebURLCredentialPersistenceNone,
+ WebURLCredentialPersistenceForSession,
+ WebURLCredentialPersistencePermanent
+} WebURLCredentialPersistence;
+
+[
+ object,
+ oleautomation,
+ uuid(5382DABA-C3C3-40c5-AA40-04079F11A844),
+ pointer_default(unique)
+]
+interface IWebURLAuthenticationChallenge : IUnknown
+{
+ /*
+ - (NSError *)error
+ */
+ HRESULT error([out, retval] IWebError** result);
+
+ /*
+ - (NSURLResponse *)failureResponse
+ */
+ HRESULT failureResponse([out, retval] IWebURLResponse** result);
+
+ /*
+ - (id)initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge sender:(id<NSURLAuthenticationChallengeSender>)sender
+ */
+ HRESULT initWithAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge, [in] IWebURLAuthenticationChallengeSender* sender);
+
+ /*
+ - (id)initWithProtectionSpace:(NSURLProtectionSpace *)space proposedCredential:(NSURLCredential *)credential previousFailureCount:(int)count failureResponse:(NSURLResponse *)response error:(NSError *)error sender:(id <NSURLAuthenticationChallengeSender>)sender
+ */
+ HRESULT initWithProtectionSpace([in] IWebURLProtectionSpace* space, [in] IWebURLCredential* proposedCredential, [in] int previousFailureCount, [in] IWebURLResponse* failureResponse, [in] IWebError* error, [in] IWebURLAuthenticationChallengeSender* sender);
+
+ /*
+ -(unsigned)previousFailureCount
+ */
+ HRESULT previousFailureCount([out, retval] UINT* result);
+
+ /*
+ -(NSURLCredential *)proposedCredential
+ */
+ HRESULT proposedCredential([out, retval] IWebURLCredential** result);
+
+ /*
+ - (NSURLProtectionSpace *)protectionSpace
+ */
+ HRESULT protectionSpace([out, retval] IWebURLProtectionSpace** result);
+
+ /*
+ - (id<NSURLAuthenticationChallengeSender>)sender
+ */
+ HRESULT sender([out, retval] IWebURLAuthenticationChallengeSender** sender);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(9360D6FB-186C-4ff7-AE57-D1B973DA0D1C),
+ pointer_default(unique)
+]
+interface IWebURLAuthenticationChallengeSender : IUnknown
+{
+ /*
+ - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+ */
+ HRESULT cancelAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge);
+
+ /*
+ - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+ */
+ HRESULT continueWithoutCredentialForAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge);
+
+ /*
+ - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+ */
+ HRESULT useCredential([in] IWebURLCredential* credential, [in] IWebURLAuthenticationChallenge* challenge);
+}
+
+cpp_quote("#define WebURLProtectionSpaceHTTP TEXT(\"http\")")
+cpp_quote("#define WebURLProtectionSpaceHTTPS TEXT(\"https\")")
+cpp_quote("#define WebURLProtectionSpaceFTP TEXT(\"ftp\")")
+cpp_quote("#define WebURLProtectionSpaceFTPS TEXT(\"ftps\")")
+cpp_quote("#define WebURLProtectionSpaceHTTPProxy TEXT(\"http\")")
+cpp_quote("#define WebURLProtectionSpaceHTTPSProxy TEXT(\"https\")")
+cpp_quote("#define WebURLProtectionSpaceFTPProxy TEXT(\"ftp\")")
+cpp_quote("#define WebURLProtectionSpaceSOCKSProxy TEXT(\"SOCKS\")")
+cpp_quote("#define WebURLAuthenticationMethodDefault TEXT(\"WebURLAuthenticationMethodDefault\")")
+cpp_quote("#define WebURLAuthenticationMethodHTTPBasic TEXT(\"WebURLAuthenticationMethodHTTPBasic\")")
+cpp_quote("#define WebURLAuthenticationMethodHTTPDigest TEXT(\"WebURLAuthenticationMethodHTTPDigest\")")
+cpp_quote("#define WebURLAuthenticationMethodHTMLForm TEXT(\"WebURLAuthenticationMethodHTMLForm\")")
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(71D2622A-3FF2-404b-BD45-C60659C901AF),
+ pointer_default(unique)
+]
+interface IWebURLProtectionSpace : IUnknown
+{
+ /*
+ -(NSString *)authenticationMethod
+ */
+ HRESULT authenticationMethod([out, retval] BSTR* result);
+
+ /*
+ -(NSString *)host
+ */
+ HRESULT host([out, retval] BSTR* result);
+
+ /*
+ -(id)initWithHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
+ */
+ HRESULT initWithHost([in] BSTR host, [in] int port, [in] BSTR protocol, [in] BSTR realm, [in] BSTR authenticationMethod);
+
+ /*
+ -(id)initWithProxyHost:(NSString *)host port:(int)port type:(NSString *)proxyType realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
+ */
+ HRESULT initWithProxyHost([in] BSTR host, [in] int port, [in] BSTR proxyType, [in] BSTR realm, [in] BSTR authenticationMethod);
+
+ /*
+ -(BOOL)isProxy
+ */
+ HRESULT isProxy([out, retval] BOOL* result);
+
+ /*
+ -(int)port
+ */
+ HRESULT port([out, retval] int* result);
+
+ /*
+ -(NSString *)protocol
+ */
+ HRESULT protocol([out, retval] BSTR* result);
+
+ /*
+ -(NSString *)proxyType
+ */
+ HRESULT proxyType([out, retval] BSTR* result);
+
+ /*
+ -(NSString *)realm
+ */
+ HRESULT realm([out, retval] BSTR* result);
+
+ /*
+ -(BOOL)receivesCredentialSecurely
+ */
+ HRESULT receivesCredentialSecurely([out, retval] BOOL* result);
+}
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(A1E9D765-FACE-4189-BBE3-AED7EBF65EBD),
+ pointer_default(unique)
+]
+interface IWebURLCredential : IUnknown
+{
+ /*
+ -(BOOL)hasPassword
+ */
+ HRESULT hasPassword([out, retval] BOOL* result);
+
+ /*
+ -(id)initWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence
+ */
+ HRESULT initWithUser([in] BSTR user, [in] BSTR password, [in] WebURLCredentialPersistence persistence);
+
+ /*
+ -(NSString *)password
+ */
+ HRESULT password([out, retval] BSTR* password);
+
+ /*
+ -(NSURLCredentialPersistence)persistence
+ */
+ HRESULT persistence([out, retval] WebURLCredentialPersistence* result);
+
+ /*
+ -(NSString *)user
+ */
+ HRESULT user([out, retval] BSTR* result);
+}
diff --git a/WebKit/win/Interfaces/IWebURLRequest.idl b/WebKit/win/Interfaces/IWebURLRequest.idl
new file mode 100644
index 0000000..d0fca50
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebURLRequest.idl
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+typedef enum _WebURLRequestCachePolicy
+{
+ WebURLRequestUseProtocolCachePolicy,
+ WebURLRequestReloadIgnoringCacheData,
+ WebURLRequestReturnCacheDataElseLoad,
+ WebURLRequestReturnCacheDataDontLoad
+} WebURLRequestCachePolicy;
+
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(F4B85F1D-F3B2-493d-B786-0930E804A3BA),
+ pointer_default(unique)
+]
+interface IWebURLRequest : IUnknown
+{
+ /*
+ + (id)requestWithURL:(NSURL *)theURL
+ + (id)requestWithURL:(NSURL *)theURL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval
+ */
+ HRESULT requestWithURL([in] BSTR theURL, [in] WebURLRequestCachePolicy cachePolicy, [in] double timeoutInterval);
+
+ /*
+ - (NSDictionary *)allHTTPHeaderFields
+ */
+ HRESULT allHTTPHeaderFields([out, retval] IPropertyBag** result);
+
+ /*
+ - (NSURLRequestCachePolicy)cachePolicy
+ */
+ HRESULT cachePolicy([out, retval] WebURLRequestCachePolicy* result);
+
+ /*
+ - (NSData *)HTTPBody
+ */
+ HRESULT HTTPBody([out, retval] IStream** result);
+
+ /*
+ - (NSInputStream *)HTTPBodyStream
+ */
+ HRESULT HTTPBodyStream([out, retval] IStream** result);
+
+ /*
+ - (NSString *)HTTPMethod
+ */
+ HRESULT HTTPMethod([out, retval] BSTR *result);
+
+ /*
+ - (BOOL)HTTPShouldHandleCookies
+ */
+ HRESULT HTTPShouldHandleCookies([out, retval] BOOL *result);
+
+ /*
+ - (id)initWithURL:(NSURL *)theURL
+ - (id)initWithURL:(NSURL *)theURL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval
+ */
+ HRESULT initWithURL([in] BSTR url, [in] WebURLRequestCachePolicy cachePolicy, [in] double timeoutInterval);
+
+ /*
+ - (NSURL *)mainDocumentURL
+ */
+ HRESULT mainDocumentURL([out, retval] BSTR* result);
+
+ /*
+ -(NSTimeInterval)timeoutInterval
+ */
+ HRESULT timeoutInterval([out, retval] double* result);
+
+ /*
+ -(NSURL *)URL
+ */
+ HRESULT URL([out, retval] BSTR* result);
+
+ /*
+ -(NSString *)valueForHTTPHeaderField:(NSString *)field
+ */
+ HRESULT valueForHTTPHeaderField([in] BSTR field, [out, retval] BSTR* result);
+
+ HRESULT isEmpty([out, retval] BOOL* result);
+}
diff --git a/WebKit/win/Interfaces/IWebURLResponse.idl b/WebKit/win/Interfaces/IWebURLResponse.idl
new file mode 100644
index 0000000..9407457
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebURLResponse.idl
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("#define WebURLResponseUnknownLength -1")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(9814930B-E037-4477-8DF1-4D898B648995),
+ pointer_default(unique)
+]
+
+interface IWebURLResponse : IUnknown
+{
+ /*
+ - (long long)expectedContentLength
+ */
+ HRESULT expectedContentLength([out, retval] long long *result);
+
+ /*
+ - (id)initWithURL:(NSURL *)URL MIMEType:(NSString *)MIMEType expectedContentLength:(int)length textEncodingName:(NSString *)name
+ */
+ HRESULT initWithURL([in] BSTR url, [in] BSTR mimeType, [in] int expectedContentLength, [in] BSTR textEncodingName);
+
+ /*
+ - (NSString *)MIMEType
+ */
+ HRESULT MIMEType([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)suggestedFilename
+ */
+ HRESULT suggestedFilename([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)textEncodingName
+ */
+ HRESULT textEncodingName([out, retval] BSTR* result);
+
+ /*
+ - (NSURL *)URL
+ */
+ HRESULT URL([out, retval] BSTR* result);
+}
diff --git a/WebKit/win/Interfaces/IWebURLResponsePrivate.idl b/WebKit/win/Interfaces/IWebURLResponsePrivate.idl
new file mode 100644
index 0000000..00133a7
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebURLResponsePrivate.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(18730CD8-864E-4898-B775-88905CC8E9DD),
+ pointer_default(unique)
+]
+
+interface IWebURLResponsePrivate : IUnknown
+{
+ HRESULT sslPeerCertificate([out, retval] OLE_HANDLE* result);
+}
diff --git a/WebKit/win/Interfaces/IWebUndoManager.idl b/WebKit/win/Interfaces/IWebUndoManager.idl
new file mode 100644
index 0000000..4cea91a
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebUndoManager.idl
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+interface IWebInvocation;
+interface IWebMethodSignature;
+
+[
+ object,
+ oleautomation,
+ uuid(D25D748C-6C1E-478d-9832-FDA26E8F7EE4),
+ pointer_default(unique)
+]
+interface IWebUndoManager : IUnknown
+{
+ /*
+ - (void)beginUndoGrouping
+ */
+ HRESULT beginUndoGrouping();
+
+ /*
+ - (BOOL)canRedo
+ */
+ HRESULT canRedo([out, retval] BOOL* result);
+
+ /*
+ - (BOOL)canUndo
+ */
+ HRESULT canUndo([out, retval] BOOL* result);
+
+ /*
+ - (void)disableUndoRegistration
+ */
+ HRESULT disableUndoRegistration();
+
+ /*
+ - (void)enableUndoRegistration
+ */
+ HRESULT enableUndoRegistration();
+
+ /*
+ - (void)endUndoGrouping
+ */
+ HRESULT endUndoGrouping();
+
+ /*
+ - (void)forwardInvocation:(NSInvocation *)anInvocation
+ */
+ HRESULT forwardInvocation([in] IWebInvocation* anInvocation);
+
+ /*
+ - (int)groupingLevel
+ */
+ HRESULT groupingLevel([out, retval] int* groupingLevel);
+
+ /*
+ - (BOOL)groupsByEvent
+ */
+ HRESULT groupsByEvent([out, retval] BOOL* result);
+
+ /*
+ - (BOOL)isRedoing
+ */
+ HRESULT isRedoing([out, retval] BOOL* result);
+
+ /*
+ - (BOOL)isUndoing
+ */
+ HRESULT isUndoing([out, retval] BOOL* result);
+
+ /*
+ - (BOOL)isUndoRegistrationEnabled
+ */
+ HRESULT isUndoRegistrationEnabled([out, retval] BOOL* result);
+
+ /*
+ - (unsigned)levelsOfUndo
+ */
+ HRESULT levelsOfUndo([out, retval] UINT* result);
+
+ /*
+ - (id)prepareWithInvocationTarget:(id)target
+ */
+ HRESULT prepareWithInvocationTarget([in] IUnknown* target, [out, retval] IUnknown** result);
+
+ /*
+ - (void)redo
+ */
+ HRESULT redo();
+
+ /*
+ - (NSString *)redoActionName
+ */
+ HRESULT redoActionName([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)redoMenuItemTitle
+ */
+ HRESULT redoMenuItemTitle([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)redoMenuTitleForUndoActionName:(NSString *)actionName
+ */
+ HRESULT redoMenuTitleForUndoActionName([in] BSTR actionName, [out, retval] BSTR* result);
+
+ /*
+ - (void)registerUndoWithTarget:(id)target selector:(SEL)aSelector object:(id)anObject
+ */
+ HRESULT registerUndoWithTarget([in] IUnknown* target, [in] UINT aSelector, [in] IUnknown* anObject);
+
+ /*
+ - (void)removeAllActions
+ */
+ HRESULT removeAllActions();
+
+ /*
+ - (void)removeAllActionsWithTarget:(id)target
+ */
+ HRESULT removeAllActionsWithTarget([in] IUnknown* target);
+
+ /*
+ - (NSArray *)runLoopModes
+ */
+ HRESULT runLoopModes([out, retval] IEnumVARIANT** enumModes);
+
+ /*
+ - (void)setActionName:(NSString *)actionName
+ */
+ HRESULT setActionName([in] BSTR actionName);
+
+ /*
+ - (void)setGroupsByEvent:(BOOL)flag
+ */
+ HRESULT setGroupsByEvent([in] BOOL flag);
+
+ /*
+ - (void)setLevelsOfUndo:(unsigned)anInt
+ */
+ HRESULT setLevelsOfUndo([in] UINT anInt);
+
+ /*
+ - (void)setRunLoopModes:(NSArray *)modes
+ */
+ HRESULT setRunLoopModes([in] int cModes, [in, size_is(cModes)] BSTR* modes);
+
+ /*
+ - (void)undo
+ */
+ HRESULT undo();
+
+ /*
+ - (NSString *)undoActionName
+ */
+ HRESULT undoActionName([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)undoMenuItemTitle
+ */
+ HRESULT undoMenuItemTitle([out, retval] BSTR* result);
+
+ /*
+ - (NSString *)undoMenuTitleForUndoActionName:(NSString *)actionName
+ */
+ HRESULT undoMenuTitleForUndoActionName([in] BSTR actionName, [out, retval] BSTR* result);
+
+ /*
+ - (void)undoNestedGroup
+ */
+ HRESULT undoNestedGroup();
+}
+
+[
+ object,
+ oleautomation,
+ uuid(67B067BE-4DE6-45c2-AD39-A91DFA84FF4E),
+ pointer_default(unique)
+]
+interface IWebInvocation : IUnknown
+{
+ /*
+ + (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)signature
+ */
+ HRESULT invocationWithMethodSignature([in] IWebMethodSignature* signature);
+
+ /*
+ - (BOOL)argumentsRetained
+ */
+ HRESULT argumentsRetained([out, retval] BOOL* result);
+
+ /*
+ - (void)getArgument:(void *)buffer atIndex:(int)index
+ */
+ [local] HRESULT getArgument([in] void* buffer, [in] int index);
+
+ /*
+ - (void)getReturnValue:(void *)buffer
+ */
+ [local] HRESULT getReturnValue([in] void* buffer);
+
+ /*
+ - (void)invoke
+ */
+ HRESULT invoke();
+
+ /*
+ - (void)invokeWithTarget:(id)anObject
+ */
+ HRESULT invokeWithTarget([in] IUnknown* anObject);
+
+ /*
+ - (NSMethodSignature *)methodSignature
+ */
+ HRESULT methodSignature([out, retval] IWebMethodSignature** result);
+
+ /*
+ - (void)retainArguments
+ */
+ HRESULT retainArguments();
+
+ /*
+ - (SEL)selector
+ */
+ HRESULT selector([out, retval] UINT* result);
+
+ /*
+ - (void)setArgument:(void *)buffer atIndex:(int)index
+ */
+ [local] HRESULT setArgument([in] void* buffer, [in] int atIndex);
+
+ /*
+ - (void)setReturnValue:(void *)buffer
+ */
+ [local] HRESULT setReturnValue([in] void* buffer);
+
+ /*
+ - (void)setSelector:(SEL)selector
+ */
+ HRESULT setSelector([in] UINT selector);
+
+ /*
+ - (void)setTarget:(id)anObject
+ */
+ HRESULT setTarget([in] IUnknown* anObject);
+
+ /*
+ - (id)target
+ */
+ HRESULT target([out, retval] IUnknown** result);
+}
+
+[
+ object,
+ oleautomation,
+ uuid(431DD6B2-56BF-4f48-943B-78CCEAC418E4),
+ pointer_default(unique)
+]
+interface IWebMethodSignature : IUnknown
+{
+ /*
+ - (unsigned)frameLength
+ */
+ HRESULT frameLength([out, retval] UINT* result);
+
+ /*
+ - (const char *)getArgumentTypeAtIndex:(unsigned)index
+ */
+ HRESULT getArgumentTypeAtIndex([in] UINT index, [out, retval] BSTR* result);
+
+ /*
+ - (BOOL)isOneway
+ */
+ HRESULT isOneway([out, retval] BOOL* result);
+
+ /*
+ - (unsigned)methodReturnLength
+ */
+ HRESULT methodReturnLength([out, retval] UINT* result);
+
+ /*
+ - (const char *)methodReturnType
+ */
+ HRESULT methodReturnType([out, retval] BSTR* result);
+
+ /*
+ - (unsigned)numberOfArguments
+ */
+ HRESULT numberOfArguments([out, retval] UINT* result);
+}
diff --git a/WebKit/win/Interfaces/IWebUndoTarget.idl b/WebKit/win/Interfaces/IWebUndoTarget.idl
new file mode 100755
index 0000000..01e14d0
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebUndoTarget.idl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+#endif
+
+[
+ object,
+ oleautomation,
+ uuid(BF7F516E-E75D-4e3a-83E2-8F694D83C72D),
+ pointer_default(unique)
+]
+interface IWebUndoTarget : IUnknown
+{
+ HRESULT invoke([in] BSTR actionName, [in] IUnknown* obj);
+}
diff --git a/WebKit/win/Interfaces/IWebView.idl b/WebKit/win/Interfaces/IWebView.idl
new file mode 100644
index 0000000..a992148
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebView.idl
@@ -0,0 +1,1145 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("/* identifiers for commands that can be called by the webview's frame */")
+cpp_quote("enum WebViewCmd { Cut = 100, Copy, Paste, ForwardDelete, SelectAll, Undo, Redo };")
+
+cpp_quote("#define WebViewProgressStartedNotification TEXT(\"WebProgressStartedNotification\")")
+cpp_quote("#define WebViewProgressEstimateChangedNotification TEXT(\"WebProgressEstimateChangedNotification\")")
+cpp_quote("#define WebViewProgressFinishedNotification TEXT(\"WebProgressFinishedNotification\")")
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebUIDelegate.idl";
+import "IWebURLResponse.idl";
+import "IWebResourceLoadDelegate.idl";
+import "IWebDownload.idl";
+import "IWebFrameLoadDelegate.idl";
+import "IWebPolicyDelegate.idl";
+import "IWebBackForwardList.idl";
+import "IWebHistoryItem.idl";
+import "IWebPreferences.idl";
+import "DOMCSS.idl";
+import "IWebUndoManager.idl";
+import "IWebEditingDelegate.idl";
+import "DOMRange.idl";
+#endif
+
+interface IDOMCSSStyleDeclaration;
+interface IDOMDocument;
+interface IDOMElement;
+interface IDOMNode;
+interface IDOMRange;
+
+interface IWebArchive;
+interface IWebBackForwardList;
+interface IWebDataSource;
+interface IWebFrame;
+interface IWebFrameView;
+interface IWebHistoryItem;
+interface IWebPreferences;
+interface IWebScriptObject;
+
+interface IWebUIDelegate;
+interface IWebResourceLoadDelegate;
+interface IWebDownloadDelegate;
+interface IWebEditingDelegate;
+interface IWebFrameLoadDelegate;
+interface IWebPolicyDelegate;
+interface IWebDocumentView;
+interface IWebDocumentRepresentation;
+interface IWebUndoManager;
+
+/* These are the keys for the WebElementPropertyBag */
+const LPCOLESTR WebElementDOMNodeKey = L"WebElementDOMNodeKey";
+const LPCOLESTR WebElementFrameKey = L"WebElementFrameKey";
+const LPCOLESTR WebElementImageAltStringKey = L"WebElementImageAltStringKey";
+const LPCOLESTR WebElementImageKey = L"WebElementImageKey";
+const LPCOLESTR WebElementImageRectKey = L"WebElementImageRectKey";
+const LPCOLESTR WebElementImageURLKey = L"WebElementImageURLKey";
+const LPCOLESTR WebElementIsSelectedKey = L"WebElementIsSelectedKey";
+const LPCOLESTR WebElementSpellingToolTipKey = L"WebElementSpellingToolTipKey";
+const LPCOLESTR WebElementTitleKey = L"WebElementTitleKey";
+const LPCOLESTR WebElementLinkURLKey = L"WebElementLinkURLKey";
+const LPCOLESTR WebElementLinkTargetFrameKey = L"WebElementLinkTargetFrameKey";
+const LPCOLESTR WebElementLinkTitleKey = L"WebElementLinkTitleKey";
+const LPCOLESTR WebElementLinkLabelKey = L"WebElementLinkLabelKey";
+const LPCOLESTR WebElementIsContentEditableKey = L"WebElementIsContentEditableKey";
+
+/*!
+ @class IEnumTextMatches
+*/
+[
+ object,
+ oleautomation,
+ uuid(C0CDE63A-5ED1-453f-B937-93B1A61AD3B3),
+ pointer_default(unique)
+]
+interface IEnumTextMatches : IUnknown
+{
+ HRESULT Next(ULONG celt, RECT* rect, ULONG* pceltFetched);
+ HRESULT Skip(ULONG celt);
+ HRESULT Reset(void);
+ HRESULT Clone(IEnumTextMatches** ppenum);
+};
+
+/*!
+ @class WebView
+ WebView manages the interaction between WebFrameViews and WebDataSources. Modification
+ of the policies and behavior of the WebKit is largely managed by WebViews and their
+ delegates.
+
+ <p>
+ Typical usage:
+ </p>
+ <pre>
+ WebView *webView;
+ WebFrame *mainFrame;
+
+ webView = [[WebView alloc] initWithFrame: NSMakeRect (0,0,640,480)];
+ mainFrame = [webView mainFrame];
+ [mainFrame loadRequest:request];
+ </pre>
+
+ WebViews have the following delegates: WebUIDelegate, WebResourceLoadDelegate,
+ WebFrameLoadDelegate, and WebPolicyDelegate.
+
+ WebKit depends on the WebView's WebUIDelegate for all window
+ related management, including opening new windows and controlling the user interface
+ elements in those windows.
+
+ WebResourceLoadDelegate is used to monitor the progress of resources as they are
+ loaded. This delegate may be used to present users with a progress monitor.
+
+ The WebFrameLoadDelegate receives messages when the URL in a WebFrame is
+ changed.
+
+ WebView's WebPolicyDelegate can make determinations about how
+ content should be handled, based on the resource's URL and MIME type.
+
+ @interface WebView : NSView
+*/
+[
+ object,
+ oleautomation,
+ hidden,
+ uuid(174BBEFD-058E-49c7-91DF-6F110AA4AC28),
+ pointer_default(unique)
+]
+interface IWebView : IUnknown
+{
+ /*!
+ @method canShowMIMEType:
+ @abstract Checks if the WebKit can show content of a certain MIME type.
+ @param MIMEType The MIME type to check.
+ @result YES if the WebKit can show content with MIMEtype.
+ + (BOOL)canShowMIMEType:(NSString *)MIMEType;
+ */
+ HRESULT canShowMIMEType([in] BSTR mimeType, [out, retval] BOOL* canShow);
+
+ /*!
+ @method canShowMIMETypeAsHTML:
+ @abstract Checks if the the MIME type is a type that the WebKit will interpret as HTML.
+ @param MIMEType The MIME type to check.
+ @result YES if the MIMEtype in an HTML type.
+ + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType;
+ */
+ HRESULT canShowMIMETypeAsHTML([in] BSTR mimeType, [out, retval] BOOL* canShow);
+
+ /*!
+ @method MIMETypesShownAsHTML
+ @result Returns an array of NSStrings that describe the MIME types
+ WebKit will attempt to render as HTML.
+ + (NSArray *)MIMETypesShownAsHTML;
+ */
+ HRESULT MIMETypesShownAsHTML([out, retval] IEnumVARIANT** enumVariant);
+
+ /*!
+ @method setMIMETypesShownAsHTML:
+ @discussion Sets the array of NSString MIME types that WebKit will
+ attempt to render as HTML. Typically you will retrieve the built-in
+ array using MIMETypesShownAsHTML and add additional MIME types to that
+ array.
+ + (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes;
+ */
+ HRESULT setMIMETypesShownAsHTML([in, size_is(cMimeTypes)] BSTR* mimeTypes, [in] int cMimeTypes);
+
+ /*!
+ @method URLFromPasteboard:
+ @abstract Returns a URL from a pasteboard
+ @param pasteboard The pasteboard with a URL
+ @result A URL if the pasteboard has one. Nil if it does not.
+ @discussion This method differs than NSURL's URLFromPasteboard method in that it tries multiple pasteboard types
+ including NSURLPboardType to find a URL on the pasteboard.
+ + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteboard;
+ */
+ HRESULT URLFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* url);
+
+ /*!
+ @method URLTitleFromPasteboard:
+ @abstract Returns a URL title from a pasteboard
+ @param pasteboard The pasteboard with a URL title
+ @result A URL title if the pasteboard has one. Nil if it does not.
+ @discussion This method returns a title that refers a URL on the pasteboard. An example of this is the link label
+ which is the text inside the anchor tag.
+ + (NSString *)URLTitleFromPasteboard:(NSPasteboard *)pasteboard;
+ */
+ HRESULT URLTitleFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* urlTitle);
+
+ /*!
+ @method initWithFrame:frameName:groupName:
+ @abstract The designated initializer for WebView.
+ @discussion Initialize a WebView with the supplied parameters. This method will
+ create a main WebFrame with the view. Passing a top level frame name is useful if you
+ handle a targetted frame navigation that would normally open a window in some other
+ way that still ends up creating a new WebView.
+ @param frame The frame used to create the view.
+ @param frameName The name to use for the top level frame. May be nil.
+ @param groupName The name of the webView set to which this webView will be added. May be nil.
+ @result Returns an initialized WebView.
+ - (id)initWithFrame:(NSRect)frame frameName:(NSString *)frameName groupName:(NSString *)groupName;
+ */
+ HRESULT initWithFrame([in] RECT frame, [in] BSTR frameName, [in] BSTR groupName);
+
+ /*!
+ @method setUIDelegate:
+ @abstract Set the WebView's WebUIDelegate.
+ @param delegate The WebUIDelegate to set as the delegate.
+ - (void)setUIDelegate:(id)delegate;
+ */
+ HRESULT setUIDelegate([in] IWebUIDelegate* d);
+
+ /*!
+ @method UIDelegate
+ @abstract Return the WebView's WebUIDelegate.
+ @result The WebView's WebUIDelegate.
+ - (id)UIDelegate;
+ */
+ HRESULT uiDelegate([retval, out] IWebUIDelegate** d);
+
+ /*!
+ @method setResourceLoadDelegate:
+ @abstract Set the WebView's WebResourceLoadDelegate load delegate.
+ @param delegate The WebResourceLoadDelegate to set as the load delegate.
+ - (void)setResourceLoadDelegate:(id)delegate;
+ */
+ HRESULT setResourceLoadDelegate([in] IWebResourceLoadDelegate* d);
+
+ /*!
+ @method resourceLoadDelegate
+ @result Return the WebView's WebResourceLoadDelegate.
+ - (id)resourceLoadDelegate;
+ */
+ HRESULT resourceLoadDelegate([retval, out] IWebResourceLoadDelegate** d);
+
+ /*!
+ @method setDownloadDelegate:
+ @abstract Set the WebView's WebDownloadDelegate.
+ @discussion The download delegate is retained by WebDownload when any downloads are in progress.
+ @param delegate The WebDownloadDelegate to set as the download delegate.
+ - (void)setDownloadDelegate:(id)delegate;
+ */
+ HRESULT setDownloadDelegate([in] IWebDownloadDelegate* d);
+
+ /*!
+ @method downloadDelegate
+ @abstract Return the WebView's WebDownloadDelegate.
+ @result The WebView's WebDownloadDelegate.
+ - (id)downloadDelegate;
+ */
+ HRESULT downloadDelegate([retval, out] IWebDownloadDelegate** d);
+
+ /*!
+ @method setFrameLoadDelegate:
+ @abstract Set the WebView's WebFrameLoadDelegate delegate.
+ @param delegate The WebFrameLoadDelegate to set as the delegate.
+ - (void)setFrameLoadDelegate:(id)delegate;
+ */
+ HRESULT setFrameLoadDelegate([in] IWebFrameLoadDelegate* d);
+
+ /*!
+ @method frameLoadDelegate
+ @abstract Return the WebView's WebFrameLoadDelegate delegate.
+ @result The WebView's WebFrameLoadDelegate delegate.
+ - (id)frameLoadDelegate;
+ */
+ HRESULT frameLoadDelegate([retval, out] IWebFrameLoadDelegate** d);
+
+ /*!
+ @method setPolicyDelegate:
+ @abstract Set the WebView's WebPolicyDelegate delegate.
+ @param delegate The WebPolicyDelegate to set as the delegate.
+ - (void)setPolicyDelegate:(id)delegate;
+ */
+ HRESULT setPolicyDelegate([in] IWebPolicyDelegate* d);
+
+ /*!
+ @method policyDelegate
+ @abstract Return the WebView's WebPolicyDelegate.
+ @result The WebView's WebPolicyDelegate.
+ - (id)policyDelegate;
+ */
+ HRESULT policyDelegate([retval, out] IWebPolicyDelegate** d);
+
+ /*!
+ @method mainFrame
+ @abstract Return the top level frame.
+ @discussion Note that even document that are not framesets will have a
+ mainFrame.
+ @result The main frame.
+ - (WebFrame *)mainFrame;
+ */
+ HRESULT mainFrame([retval, out] IWebFrame** frame);
+
+ /*!
+ @method focusedFrame
+ @abstract Return the frame that has the current focus.
+ */
+ HRESULT focusedFrame([retval, out] IWebFrame** frame);
+
+ /*!
+ @method backForwardList
+ @result The backforward list for this webView.
+ - (WebBackForwardList *)backForwardList;
+ */
+ HRESULT backForwardList([retval, out] IWebBackForwardList** list);
+
+ /*!
+ @method setMaintainsBackForwardList:
+ @abstract Enable or disable the use of a backforward list for this webView.
+ @param flag Turns use of the back forward list on or off
+ - (void)setMaintainsBackForwardList:(BOOL)flag;
+ */
+ HRESULT setMaintainsBackForwardList([in] BOOL flag);
+
+ /*!
+ @method goBack
+ @abstract Go back to the previous URL in the backforward list.
+ @result YES if able to go back in the backforward list, NO otherwise.
+ - (BOOL)goBack;
+ */
+ HRESULT goBack([out, retval] BOOL* succeeded);
+
+ /*!
+ @method goForward
+ @abstract Go forward to the next URL in the backforward list.
+ @result YES if able to go forward in the backforward list, NO otherwise.
+ - (BOOL)goForward;
+ */
+ HRESULT goForward([out, retval] BOOL* succeeded);
+
+ /*!
+ @method goToBackForwardItem:
+ @abstract Go back or forward to an item in the backforward list.
+ @result YES if able to go to the item, NO otherwise.
+ - (BOOL)goToBackForwardItem:(WebHistoryItem *)item;
+ */
+ HRESULT goToBackForwardItem([in] IWebHistoryItem* item, [out, retval] BOOL* succeeded);
+
+ /*!
+ @method setTextSizeMultiplier:
+ @abstract Change the size of the text rendering in views managed by this webView.
+ @param multiplier A fractional percentage value, 1.0 is 100%.
+ - (void)setTextSizeMultiplier:(float)multiplier;
+ */
+ HRESULT setTextSizeMultiplier([in] float multiplier);
+
+ /*!
+ @method textSizeMultiplier
+ @result The text size multipler.
+ - (float)textSizeMultiplier;
+ */
+ HRESULT textSizeMultiplier([out, retval] float* multiplier);
+
+ /*!
+ @method setApplicationNameForUserAgent:
+ @abstract Set the application name.
+ @discussion This name will be used in user-agent strings
+ that are chosen for best results in rendering web pages.
+ @param applicationName The application name
+ - (void)setApplicationNameForUserAgent:(NSString *)applicationName;
+ */
+ HRESULT setApplicationNameForUserAgent([in] BSTR applicationName);
+
+ /*!
+ @method applicationNameForUserAgent
+ @result The name of the application as used in the user-agent string.
+ - (NSString *)applicationNameForUserAgent;
+ */
+ HRESULT applicationNameForUserAgent([out, retval] BSTR* applicationName);
+
+ /*!
+ @method setCustomUserAgent:
+ @abstract Set the user agent.
+ @discussion Setting this means that the webView should use this user-agent string
+ instead of constructing a user-agent string for each URL. Setting it to nil
+ causes the webView to construct the user-agent string for each URL
+ for best results rendering web pages.
+ @param userAgentString The user agent description
+ - (void)setCustomUserAgent:(NSString *)userAgentString;
+ */
+ HRESULT setCustomUserAgent([in] BSTR userAgentString);
+
+ /*!
+ @method customUserAgent
+ @result The custom user-agent string or nil if no custom user-agent string has been set.
+ - (NSString *)customUserAgent;
+ */
+ HRESULT customUserAgent([out, retval] BSTR* userAgentString);
+
+ /*!
+ @method userAgentForURL:
+ @abstract Get the appropriate user-agent string for a particular URL.
+ @param URL The URL.
+ @result The user-agent string for the supplied URL.
+ - (NSString *)userAgentForURL:(NSURL *)URL;
+ */
+ HRESULT userAgentForURL([in] BSTR url, [out, retval] BSTR* userAgent);
+
+ /*!
+ @method supportsTextEncoding
+ @abstract Find out if the current web page supports text encodings.
+ @result YES if the document view of the current web page can
+ support different text encodings.
+ - (BOOL)supportsTextEncoding;
+ */
+ HRESULT supportsTextEncoding([out, retval] BOOL* supports);
+
+ /*!
+ @method setCustomTextEncodingName:
+ @discussion Make the page display with a different text encoding; stops any load in progress.
+ The text encoding passed in overrides the normal text encoding smarts including
+ what's specified in a web page's header or HTTP response.
+ The text encoding automatically goes back to the default when the top level frame
+ changes to a new location.
+ Setting the text encoding name to nil makes the webView use default encoding rules.
+ @param encoding The text encoding name to use to display a page or nil.
+ - (void)setCustomTextEncodingName:(NSString *)encodingName;
+ */
+ HRESULT setCustomTextEncodingName([in] BSTR encodingName);
+
+ /*!
+ @method customTextEncodingName
+ @result The custom text encoding name or nil if no custom text encoding name has been set.
+ - (NSString *)customTextEncodingName;
+ */
+ HRESULT customTextEncodingName([out, retval] BSTR* encodingName);
+
+ /*!
+ @method setMediaStyle:
+ @discussion Set the media style for the WebView. The mediaStyle will override the normal value
+ of the CSS media property. Setting the value to nil will restore the normal value.
+ @param mediaStyle The value to use for the CSS media property.
+ - (void)setMediaStyle:(NSString *)mediaStyle;
+ */
+ HRESULT setMediaStyle([in] BSTR media);
+
+ /*!
+ @method mediaStyle
+ @result mediaStyle The value to use for the CSS media property, as set by setMediaStyle:. It
+ will be nil unless set by that method.
+ - (NSString *)mediaStyle;
+ */
+ HRESULT mediaStyle([out, retval] BSTR* media);
+
+ /*!
+ @method stringByEvaluatingJavaScriptFromString:
+ @param script The text of the JavaScript.
+ @result The result of the script, converted to a string, or nil for failure.
+ - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
+ */
+ HRESULT stringByEvaluatingJavaScriptFromString([in] BSTR script, [out, retval] BSTR* result);
+
+ /*!
+ @method windowScriptObject
+ @discussion windowScriptObject return a WebScriptObject that represents the
+ window object from the script environment.
+ @result Returns the window object from the script environment.
+ - (WebScriptObject *)windowScriptObject;
+ */
+ HRESULT windowScriptObject([out, retval] IWebScriptObject** webScriptObject);
+
+ /*!
+ @method setPreferences:
+ @param preferences The preferences to use for the webView.
+ @abstract Override the standard setting for the webView.
+ - (void)setPreferences: (WebPreferences *)prefs;
+ */
+ HRESULT setPreferences([in] IWebPreferences* prefs);
+
+ /*!
+ @method preferences
+ @result Returns the preferences used by this webView.
+ @discussion This method will return [WebPreferences standardPreferences] if no
+ other instance of WebPreferences has been set.
+ - (WebPreferences *)preferences;
+ */
+ HRESULT preferences([out, retval] IWebPreferences** prefs);
+
+ /*!
+ @method setPreferencesIdentifier:
+ @param anIdentifier The string to use a prefix for storing values for this WebView in the user
+ defaults database.
+ @discussion If the WebPreferences for this WebView are stored in the user defaults database, the
+ string set in this method will be used a key prefix.
+ - (void)setPreferencesIdentifier:(NSString *)anIdentifier;
+ */
+ HRESULT setPreferencesIdentifier([in] BSTR anIdentifier);
+
+ /*!
+ @method preferencesIdentifier
+ @result Returns the WebPreferences key prefix.
+ - (NSString *)preferencesIdentifier;
+ */
+ HRESULT preferencesIdentifier([out, retval] BSTR* anIdentifier);
+
+ /*!
+ @method setHostWindow:
+ @param hostWindow The host window for the web view.
+ @discussion Parts of WebKit (such as plug-ins and JavaScript) depend on a window to function
+ properly. Set a host window so these parts continue to function even when the web view is
+ not in an actual window.
+ - (void)setHostWindow:(NSWindow *)hostWindow;
+ */
+ HRESULT setHostWindow([in] OLE_HANDLE window);
+
+ /*!
+ @method hostWindow
+ @result The host window for the web view.
+ - (NSWindow *)hostWindow;
+ */
+ HRESULT hostWindow([out, retval] OLE_HANDLE* window);
+
+ /*!
+ @method searchFor:direction:caseSensitive:
+ @abstract Searches a document view for a string and highlights the string if it is found.
+ Starts the search from the current selection. Will search across all frames.
+ @param string The string to search for.
+ @param forward YES to search forward, NO to seach backwards.
+ @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
+ @result YES if found, NO if not found.
+ - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
+ */
+ HRESULT searchFor([in] BSTR str, [in] BOOL forward, [in] BOOL caseFlag, [in] BOOL wrapFlag, [out, retval] BOOL* found);
+
+ /*!
+ @method registerViewClass:representationClass:forMIMEType:
+ @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
+ A document class may register for a primary MIME type by excluding
+ a subtype, i.e. "video/" will match the document class with
+ all video types. More specific matching takes precedence
+ over general matching.
+ @param viewClass The WebDocumentView class to use to render data for a given MIME type.
+ @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
+ @param MIMEType The MIME type to represent with an object of the given class.
+ + (void)registerViewClass:(Class)viewClass representationClass:(Class)representationClass forMIMEType:(NSString *)MIMEType;
+ */
+ HRESULT registerViewClass([in] IWebDocumentView* view, [in] IWebDocumentRepresentation* representation, [in] BSTR forMIMEType);
+
+ /*!
+ @method setGroupName:
+ @param groupName The name of the group for this WebView.
+ @discussion JavaScript may access named frames within the same group.
+ - (void)setGroupName:(NSString *)groupName;
+ */
+ HRESULT setGroupName([in] BSTR groupName);
+
+ /*!
+ @method groupName
+ @discussion The group name for this WebView.
+ - (NSString *)groupName;
+ */
+ HRESULT groupName([out, retval] BSTR* groupName);
+
+ /*!
+ @method estimatedProgress
+ @discussion An estimate of the percent complete for a document load. This
+ value will range from 0 to 1.0 and, once a load completes, will remain at 1.0
+ until a new load starts, at which point it will be reset to 0. The value is an
+ estimate based on the total number of bytes expected to be received
+ for a document, including all it's possible subresources. For more accurate progress
+ indication it is recommended that you implement a WebFrameLoadDelegate and a
+ WebResourceLoadDelegate.
+ - (double)estimatedProgress;
+ */
+ HRESULT estimatedProgress([out, retval] double* estimatedProgress);
+
+ /*!
+ @method isLoading
+ @discussion Returns YES if there are any pending loads.
+ - (BOOL)isLoading;
+ */
+ HRESULT isLoading([out, retval] BOOL* isLoading);
+
+ /*!
+ @method elementAtPoint:
+ @param point A point in the coordinates of the WebView
+ @result An element dictionary describing the point
+ - (NSDictionary *)elementAtPoint:(NSPoint)point;
+ */
+ HRESULT elementAtPoint([in] LPPOINT point, [out, retval] IPropertyBag** elementDictionary);
+
+ /*!
+ @method pasteboardTypesForSelection
+ @abstract Returns the pasteboard types that WebView can use for the current selection
+ - (NSArray *)pasteboardTypesForSelection;
+ */
+ HRESULT pasteboardTypesForSelection([out, retval] IEnumVARIANT** enumVariant);
+
+ /*!
+ @method writeSelectionWithPasteboardTypes:toPasteboard:
+ @abstract Writes the current selection to the pasteboard
+ @param types The types that WebView will write to the pasteboard
+ @param pasteboard The pasteboard to write to
+ - (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
+ */
+ HRESULT writeSelectionWithPasteboardTypes([in, size_is(cTypes)] BSTR* types, [in] int cTypes, [in] IDataObject* pasteboard);
+
+ /*!
+ @method pasteboardTypesForElement:
+ @abstract Returns the pasteboard types that WebView can use for an element
+ @param element The element
+ - (NSArray *)pasteboardTypesForElement:(NSDictionary *)element;
+ */
+ HRESULT pasteboardTypesForElement([in] IPropertyBag* elementDictionary, [out, retval] IEnumVARIANT** enumVariant);
+
+ /*!
+ @method writeElement:withPasteboardTypes:toPasteboard:
+ @abstract Writes an element to the pasteboard
+ @param element The element to write to the pasteboard
+ @param types The types that WebView will write to the pasteboard
+ @param pasteboard The pasteboard to write to
+ - (void)writeElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
+ */
+ HRESULT writeElement([in] IPropertyBag* elementDictionary, [in, size_is(cWithPasteboardTypes)] BSTR* withPasteboardTypes, [in] int cWithPasteboardTypes, [in] IDataObject* pasteboard);
+
+ /*!
+ @method selectedText
+ @abstract Returns the selection as a string
+ */
+ HRESULT selectedText([out, retval] BSTR* text);
+
+ /*!
+ @method centerSelectionInVisibleArea
+ @abstract Centers the selected text in the WebView
+ - (void)centerSelectionInVisibleArea:(id)sender;
+ */
+ HRESULT centerSelectionInVisibleArea([in] IUnknown* sender);
+
+ /*!
+ @method moveDragCaretToPoint:
+ @param point A point in the coordinates of the WebView
+ @discussion This method moves the caret that shows where something being dragged will be dropped. It may cause the WebView to scroll
+ to make the new position of the drag caret visible.
+ - (void)moveDragCaretToPoint:(NSPoint)point;
+ */
+ HRESULT moveDragCaretToPoint([in] LPPOINT point);
+
+ /*!
+ @method removeDragCaret
+ @abstract Removes the drag caret from the WebView
+ - (void)removeDragCaret;
+ */
+ HRESULT removeDragCaret();
+
+ /*!
+ @method setDrawsBackground:
+ @param drawsBackround YES to cause the receiver to draw a default white background, NO otherwise.
+ @abstract Sets whether the receiver draws a default white background when the loaded page has no background specified.
+ - (void)setDrawsBackground:(BOOL)drawsBackround;
+ */
+ HRESULT setDrawsBackground([in] BOOL drawsBackground);
+
+ /*!
+ @method drawsBackground
+ @result Returns YES if the receiver draws a default white background, NO otherwise.
+ - (BOOL)drawsBackground;
+ */
+ HRESULT drawsBackground([out, retval] BOOL* drawsBackground);
+
+ /*!
+ @method setMainFrameURL:
+ @param URLString The URL to load in the mainFrame.
+ - (void)setMainFrameURL:(NSString *)URLString;
+ */
+ HRESULT setMainFrameURL([in] BSTR urlString);
+
+ /*!
+ @method mainFrameURL
+ @result Returns the main frame's current URL.
+ - (NSString *)mainFrameURL;
+ */
+ HRESULT mainFrameURL([out, retval] BSTR* urlString);
+
+ /*!
+ @method mainFrameDocument
+ @result Returns the main frame's DOMDocument.
+ - (DOMDocument *)mainFrameDocument;
+ */
+ HRESULT mainFrameDocument([out, retval] IDOMDocument** document);
+
+ /*!
+ @method mainFrameTitle
+ @result Returns the main frame's title if any, otherwise an empty string.
+ - (NSString *)mainFrameTitle;
+ */
+ HRESULT mainFrameTitle([out, retval] BSTR* title);
+
+ /*!
+ @method mainFrameIcon
+ @discussion The methods returns the site icon for the current page loaded in the mainFrame.
+ @result Returns the main frame's icon if any, otherwise nil.
+ - (NSImage *)mainFrameIcon;
+ */
+ HRESULT mainFrameIcon([out, retval] OLE_HANDLE* hBitmap);
+
+ /*!
+ @method registerURLSchemeAsLocal
+ @discussion Adds the scheme to the list of schemes to be treated as local.
+ @param scheme The scheme to register.
+ + (void)registerURLSchemeAsLocal:(NSString *)scheme;
+ */
+ HRESULT registerURLSchemeAsLocal([in] BSTR scheme);
+}
+
+/*
+ @interface WebView (WebIBActions) <NSUserInterfaceValidations>
+*/
+[
+ object,
+ oleautomation,
+ uuid(8F0E3A30-B924-44f8-990A-1AE61ED6C632),
+ pointer_default(unique)
+]
+interface IWebIBActions : IUnknown
+{
+ /*
+ - (IBAction)takeStringURLFrom:(id)sender;
+ */
+ HRESULT takeStringURLFrom([in] IUnknown* sender);
+
+ /*
+ - (IBAction)stopLoading:(id)sender;
+ */
+ HRESULT stopLoading([in] IUnknown* sender);
+
+ /*
+ - (IBAction)reload:(id)sender;
+ */
+ HRESULT reload([in] IUnknown* sender);
+
+ /*
+ - (BOOL)canGoBack;
+ */
+ HRESULT canGoBack([in] IUnknown* sender, [out, retval] BOOL* result);
+
+ /*
+ - (IBAction)goBack:(id)sender;
+ */
+ HRESULT goBack([in] IUnknown* sender);
+
+ /*
+ - (BOOL)canGoForward;
+ */
+ HRESULT canGoForward([in] IUnknown* sender, [out, retval] BOOL* result);
+
+ /*
+ - (IBAction)goForward:(id)sender;
+ */
+ HRESULT goForward([in] IUnknown* sender);
+
+ /*
+ - (BOOL)canMakeTextLarger;
+ */
+ HRESULT canMakeTextLarger([in] IUnknown* sender, [out, retval] BOOL* result);
+
+ /*
+ - (IBAction)makeTextLarger:(id)sender;
+ */
+ HRESULT makeTextLarger([in] IUnknown* sender);
+
+ /*
+ - (BOOL)canMakeTextSmaller;
+ */
+ HRESULT canMakeTextSmaller([in] IUnknown* sender, [out, retval] BOOL* result);
+
+ /*
+ - (IBAction)makeTextSmaller:(id)sender;
+ */
+ HRESULT makeTextSmaller([in] IUnknown* sender);
+
+ /*
+ - (BOOL)canMakeTextStandardSize;
+ */
+ HRESULT canMakeTextStandardSize([in] IUnknown* sender, [out, retval] BOOL* result);
+
+ /*
+ - (IBAction)makeTextStandardSize:(id)sender;
+ */
+ HRESULT makeTextStandardSize([in] IUnknown* sender);
+
+ /*
+ - (IBAction)toggleContinuousSpellChecking:(id)sender;
+ */
+ HRESULT toggleContinuousSpellChecking([in] IUnknown* sender);
+
+ /*
+ - (IBAction)toggleSmartInsertDelete:(id)sender;
+ */
+ HRESULT toggleSmartInsertDelete([in] IUnknown* sender);
+
+ /*
+ - (void)toggleGrammarChecking:(id)sender
+ */
+ HRESULT toggleGrammarChecking([in] IUnknown* sender);
+}
+
+/*
+ @interface WebView (WebViewCSS)
+*/
+[
+ object,
+ oleautomation,
+ uuid(ADF68A8C-336F-405c-A053-3D11A9D5B092),
+ pointer_default(unique)
+]
+interface IWebViewCSS : IUnknown
+{
+ /*
+ - (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement;
+ */
+ HRESULT computedStyleForElement([in] IDOMElement* element, [in] BSTR pseudoElement, [out, retval] IDOMCSSStyleDeclaration** style);
+}
+
+/*
+ @interface WebView (WebViewEditing)
+*/
+[
+ object,
+ oleautomation,
+ uuid(07BDAC9A-19A1-4086-864D-BAD9E0F00D5C),
+ pointer_default(unique)
+]
+interface IWebViewEditing : IUnknown
+{
+ /*
+ - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
+ */
+ HRESULT editableDOMRangeForPoint([in] LPPOINT point, [out, retval] IDOMRange** range);
+
+ /*
+ - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity;
+ */
+ HRESULT setSelectedDOMRange([in] IDOMRange* range, [in] WebSelectionAffinity affinity);
+
+ /*
+ - (DOMRange *)selectedDOMRange;
+ */
+ HRESULT selectedDOMRange([out, retval] IDOMRange** range);
+
+ /*
+ - (NSSelectionAffinity)selectionAffinity;
+ */
+ HRESULT selectionAffinity([out, retval] [out, retval] WebSelectionAffinity* affinity);
+
+ /*
+ - (void)setEditable:(BOOL)flag;
+ */
+ HRESULT setEditable([in] BOOL flag);
+
+ /*
+ - (BOOL)isEditable;
+ */
+ HRESULT isEditable([out, retval] BOOL* isEditable);
+
+ /*
+ - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style;
+ */
+ HRESULT setTypingStyle([in] IDOMCSSStyleDeclaration* style);
+
+ /*
+ - (DOMCSSStyleDeclaration *)typingStyle;
+ */
+ HRESULT typingStyle([out, retval] IDOMCSSStyleDeclaration** style);
+
+ /*
+ - (void)setSmartInsertDeleteEnabled:(BOOL)flag;
+ */
+ HRESULT setSmartInsertDeleteEnabled([in] BOOL flag);
+
+ /*
+ - (BOOL)smartInsertDeleteEnabled;
+ */
+ HRESULT smartInsertDeleteEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (void)setContinuousSpellCheckingEnabled:(BOOL)flag;
+ */
+ HRESULT setContinuousSpellCheckingEnabled([in] BOOL flag);
+
+ /*
+ - (BOOL)isContinuousSpellCheckingEnabled;
+ */
+ HRESULT isContinuousSpellCheckingEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (WebNSInt)spellCheckerDocumentTag;
+ */
+ HRESULT spellCheckerDocumentTag([out, retval] int* tag);
+
+ /*
+ - (NSUndoManager *)undoManager;
+ */
+ HRESULT undoManager([out, retval] IWebUndoManager** manager);
+
+ /*
+ - (void)setEditingDelegate:(id)delegate;
+ */
+ HRESULT setEditingDelegate([in] IWebEditingDelegate* d);
+
+ /*
+ - (id)editingDelegate;
+ */
+ HRESULT editingDelegate([out, retval] IWebEditingDelegate** d);
+
+ /*
+ - (DOMCSSStyleDeclaration *)styleDeclarationWithText:(NSString *)text;
+ */
+ HRESULT styleDeclarationWithText([in] BSTR text, [out, retval] IDOMCSSStyleDeclaration** style);
+
+ /*
+ - (BOOL)hasSelectedRange;
+ */
+ HRESULT hasSelectedRange([out, retval] BOOL* hasSelectedRange);
+
+ /*
+ - (BOOL)cutEnabled;
+ */
+ HRESULT cutEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (BOOL)copyEnabled;
+ */
+ HRESULT copyEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (BOOL)pasteEnabled;
+ */
+ HRESULT pasteEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (BOOL)deleteEnabled;
+ */
+ HRESULT deleteEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (BOOL)editingEnabled;
+ */
+ HRESULT editingEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (BOOL)isGrammarCheckingEnabled
+ */
+ HRESULT isGrammarCheckingEnabled([out, retval] BOOL* enabled);
+
+ /*
+ - (void)setGrammarCheckingEnabled:(BOOL)flag
+ */
+ HRESULT setGrammarCheckingEnabled(BOOL enabled);
+}
+
+/*
+ @interface WebView (WebViewUndoableEditing)
+*/
+[
+ object,
+ oleautomation,
+ uuid(639E7121-13C8-4a12-BC18-6E1F3D68F3C3),
+ pointer_default(unique)
+]
+interface IWebViewUndoableEditing : IUnknown
+{
+ /*
+ - (void)replaceSelectionWithNode:(DOMNode *)node;
+ */
+ HRESULT replaceSelectionWithNode([in] IDOMNode* node);
+
+ /*
+ - (void)replaceSelectionWithText:(NSString *)text;
+ */
+ HRESULT replaceSelectionWithText([in] BSTR text);
+
+ /*
+ - (void)replaceSelectionWithMarkupString:(NSString *)markupString;
+ */
+ HRESULT replaceSelectionWithMarkupString([in] BSTR markupString);
+
+ /*
+ - (void)replaceSelectionWithArchive:(WebArchive *)archive;
+ */
+ HRESULT replaceSelectionWithArchive([in] IWebArchive* archive);
+
+ /*
+ - (void)deleteSelection;
+ */
+ HRESULT deleteSelection();
+
+ /*
+ - (void)clearSelection;
+ */
+ HRESULT clearSelection();
+
+ /*
+ - (void)applyStyle:(DOMCSSStyleDeclaration *)style;
+ */
+ HRESULT applyStyle([in] IDOMCSSStyleDeclaration* style);
+}
+
+/*
+ @interface WebView (WebViewEditingActions)
+*/
+[
+ object,
+ oleautomation,
+ uuid(7E066C42-8E81-4778-888D-D6CC93E27D4C),
+ pointer_default(unique)
+]
+interface IWebViewEditingActions : IUnknown
+{
+ /*
+ - (void)copy:(id)sender;
+ */
+ HRESULT copy([in] IUnknown* sender);
+
+ /*
+ - (void)cut:(id)sender;
+ */
+ HRESULT cut([in] IUnknown* sender);
+
+ /*
+ - (void)paste:(id)sender;
+ */
+ HRESULT paste([in] IUnknown* sender);
+
+ /*
+ - (void)copyURL:(id)sender;
+ */
+ HRESULT copyURL([in] BSTR url);
+
+ /*
+ - (void)copyFont:(id)sender;
+ */
+ HRESULT copyFont([in] IUnknown* sender);
+
+ /*
+ - (void)pasteFont:(id)sender;
+ */
+ HRESULT pasteFont([in] IUnknown* sender);
+
+ /*
+ - (void)delete:(id)sender;
+ */
+ HRESULT delete_([in] IUnknown* sender);
+
+ /*
+ - (void)pasteAsPlainText:(id)sender;
+ */
+ HRESULT pasteAsPlainText([in] IUnknown* sender);
+
+ /*
+ - (void)pasteAsRichText:(id)sender;
+ */
+ HRESULT pasteAsRichText([in] IUnknown* sender);
+
+
+ /*
+ - (void)changeFont:(id)sender;
+ */
+ HRESULT changeFont([in] IUnknown* sender);
+
+ /*
+ - (void)changeAttributes:(id)sender;
+ */
+ HRESULT changeAttributes([in] IUnknown* sender);
+
+ /*
+ - (void)changeDocumentBackgroundColor:(id)sender;
+ */
+ HRESULT changeDocumentBackgroundColor([in] IUnknown* sender);
+
+ /*
+ - (void)changeColor:(id)sender;
+ */
+ HRESULT changeColor([in] IUnknown* sender);
+
+
+ /*
+ - (void)alignCenter:(id)sender;
+ */
+ HRESULT alignCenter([in] IUnknown* sender);
+
+ /*
+ - (void)alignJustified:(id)sender;
+ */
+ HRESULT alignJustified([in] IUnknown* sender);
+
+ /*
+ - (void)alignLeft:(id)sender;
+ */
+ HRESULT alignLeft([in] IUnknown* sender);
+
+ /*
+ - (void)alignRight:(id)sender;
+ */
+ HRESULT alignRight([in] IUnknown* sender);
+
+
+ /*
+ - (void)checkSpelling:(id)sender;
+ */
+ HRESULT checkSpelling([in] IUnknown* sender);
+
+ /*
+ - (void)showGuessPanel:(id)sender;
+ */
+ HRESULT showGuessPanel([in] IUnknown* sender);
+
+ /*
+ - (void)performFindPanelAction:(id)sender;
+ */
+ HRESULT performFindPanelAction([in] IUnknown* sender);
+
+
+ /*
+ - (void)startSpeaking:(id)sender;
+ */
+ HRESULT startSpeaking([in] IUnknown* sender);
+
+ /*
+ - (void)stopSpeaking:(id)sender;
+ */
+ HRESULT stopSpeaking([in] IUnknown* sender);
+}
diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl
new file mode 100644
index 0000000..0916204
--- /dev/null
+++ b/WebKit/win/Interfaces/IWebViewPrivate.idl
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DO_NO_IMPORTS
+import "oaidl.idl";
+import "ocidl.idl";
+import "IWebFormDelegate.idl";
+import "IWebFrameLoadDelegatePrivate.idl";
+import "IWebInspector.idl";
+#endif
+
+interface IEnumTextMatches;
+interface IWebFormDelegate;
+interface IWebFrameLoadDelegatePrivate;
+interface IWebInspector;
+interface IWebURLRequest;
+interface IWebView;
+
+[
+ object,
+ oleautomation,
+ uuid(44914369-DEB5-4fcf-A6A3-30C02E73154F),
+ pointer_default(unique)
+]
+interface IWebViewPrivate : IUnknown
+{
+ /*!
+ @method _setInViewSourceMode:
+ @abstract Used to place a WebView into a special source-viewing mode.
+ - (void)_setInViewSourceMode:(BOOL)flag;
+ */
+ HRESULT setInViewSourceMode([in] BOOL flag);
+
+ /*!
+ @method _inViewSourceMode;
+ @abstract Whether or not the WebView is in source-view mode for HTML.
+ - (BOOL)_inViewSourceMode;
+ */
+ HRESULT inViewSourceMode([out, retval] BOOL* flag);
+
+ HRESULT viewWindow([out, retval] OLE_HANDLE* window);
+
+ // May well become public
+ //- (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
+ HRESULT setFormDelegate([in] IWebFormDelegate* formDelegate);
+
+ //- (id<WebFormDelegate>)_formDelegate;
+ HRESULT formDelegate([out, retval] IWebFormDelegate** formDelegate);
+
+ HRESULT setFrameLoadDelegatePrivate([in] IWebFrameLoadDelegatePrivate* frameLoadDelegatePrivate);
+ HRESULT frameLoadDelegatePrivate([out, retval] IWebFrameLoadDelegatePrivate** frameLoadDelegatePrivate);
+
+ HRESULT scrollOffset([out, retval] LPPOINT offset);
+ HRESULT scrollBy([in] LPPOINT offset);
+ HRESULT visibleContentRect([out, retval] LPRECT rect);
+
+ // SPI for DumpRenderTree
+ HRESULT updateFocusedAndActiveState();
+
+ // Support for displaying multiple text matches.
+ HRESULT markAllMatchesForText([in] BSTR search, [in] BOOL caseSensitive, [in] BOOL highlight, [in] UINT limit, [out] UINT* matches);
+ HRESULT unmarkAllTextMatches();
+ HRESULT rectsForTextMatches([out]IEnumTextMatches** pmatches);
+ HRESULT selectionRect([in, out] RECT* rc);
+ HRESULT generateSelectionImage(BOOL forceWhiteText, [out, retval] OLE_HANDLE* hBitmap);
+
+ HRESULT canHandleRequest([in] IWebURLRequest* request, [out, retval] BOOL* result);
+
+ HRESULT clearFocusNode();
+
+ HRESULT setTabKeyCyclesThroughElements([in] BOOL cycles);
+ HRESULT tabKeyCyclesThroughElements([out, retval] BOOL* result);
+
+ HRESULT setAllowSiteSpecificHacks([in] BOOL allows);
+ HRESULT addAdditionalPluginPath([in] BSTR path);
+
+ HRESULT loadBackForwardListFromOtherView([in] IWebView* otherView);
+
+ HRESULT setCustomDropTarget([in] IDropTarget* dt);
+ HRESULT removeCustomDropTarget();
+
+ HRESULT setInitialFocus([in] BOOL forward);
+
+ HRESULT inspector([out, retval] IWebInspector**);
+
+ HRESULT clearUndoRedoOperations();
+
+ HRESULT setProhibitsMainFrameScrolling([in] BOOL prohibits);
+
+ // SPI for DumpRenderTree. This is global to all WebViews.
+ HRESULT setShouldApplyMacFontAscentHack([in] BOOL shouldApply);
+
+ /*!
+ @method shouldClose:
+ @abstract This function will fire the before unload handler for a page.
+ If the user cancels the closing of a webview from the alert popped up by the
+ before unload handler, then this function will return false.
+ */
+ HRESULT shouldClose([out, retval] BOOL* result);
+
+ // SPI for DumpRenderTree
+ HRESULT executeCoreCommandByName([in] BSTR name, [in] BSTR value);
+
+ HRESULT windowAncestryDidChange();
+}
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
new file mode 100644
index 0000000..db0fbb4
--- /dev/null
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -0,0 +1,438 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+cpp_quote("/*")
+cpp_quote(" * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.")
+cpp_quote(" *")
+cpp_quote(" * Redistribution and use in source and binary forms, with or without")
+cpp_quote(" * modification, are permitted provided that the following conditions")
+cpp_quote(" * are met:")
+cpp_quote(" * 1. Redistributions of source code must retain the above copyright")
+cpp_quote(" * notice, this list of conditions and the following disclaimer.")
+cpp_quote(" * 2. Redistributions in binary form must reproduce the above copyright")
+cpp_quote(" * notice, this list of conditions and the following disclaimer in the")
+cpp_quote(" * documentation and/or other materials provided with the distribution.")
+cpp_quote(" *")
+cpp_quote(" * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY")
+cpp_quote(" * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE")
+cpp_quote(" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR")
+cpp_quote(" * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR")
+cpp_quote(" * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,")
+cpp_quote(" * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,")
+cpp_quote(" * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR")
+cpp_quote(" * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY")
+cpp_quote(" * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT")
+cpp_quote(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE")
+cpp_quote(" * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ")
+cpp_quote(" */")
+
+#include "autoversion.h"
+
+#define DO_NO_IMPORTS
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+#include "IWebScriptObject.idl"
+#include "DOMCSS.idl"
+#include "DOMCore.idl"
+#include "DOMEvents.idl"
+#include "DOMExtensions.idl"
+#include "DOMHTML.idl"
+#include "DOMPrivate.idl"
+#include "DOMRange.idl"
+#include "DOMWindow.idl"
+#include "IWebArchive.idl"
+#include "IWebBackForwardList.idl"
+#include "IWebBackForwardListPrivate.idl"
+#include "IWebCache.idl"
+#include "IWebDataSource.idl"
+#include "IWebDatabaseManager.idl"
+#include "IWebDocument.idl"
+#include "IWebDownload.idl"
+#include "IWebEditingDelegate.idl"
+#include "IWebError.idl"
+#include "IWebErrorPrivate.idl"
+#include "IWebFormDelegate.idl"
+#include "IWebFrame.idl"
+#include "IWebFrameLoadDelegate.idl"
+#include "IWebFrameLoadDelegatePrivate.idl"
+#include "IWebFramePrivate.idl"
+#include "IWebFrameView.idl"
+#include "IWebHTMLRepresentation.idl"
+#include "IWebHTTPURLResponse.idl"
+#include "IWebHistory.idl"
+#include "IWebHistoryItem.idl"
+#include "IWebHistoryItemPrivate.idl"
+#include "IWebIconDatabase.idl"
+#include "IWebInspector.idl"
+#include "IWebJavaScriptCollector.idl"
+#include "IWebKitStatistics.idl"
+#include "IWebMutableURLRequestPrivate.idl"
+#include "IWebNotification.idl"
+#include "IWebNotificationCenter.idl"
+#include "IWebNotificationObserver.idl"
+#include "IWebPolicyDelegate.idl"
+#include "IWebPreferences.idl"
+#include "IWebPreferencesPrivate.idl"
+#include "IWebResource.idl"
+#include "IWebResourceLoadDelegate.idl"
+#include "IWebResourceLoadDelegatePrivate.idl"
+#include "IWebScriptCallFrame.idl"
+#include "IWebScriptDebugListener.idl"
+#include "IWebScriptDebugServer.idl"
+#include "IWebScrollBarDelegatePrivate.idl"
+#include "IWebScrollBarPrivate.idl"
+#include "IWebSecurityOrigin.idl"
+#include "IWebTextRenderer.idl"
+#include "IWebUIDelegate.idl"
+#include "IWebUIDelegatePrivate.idl"
+#include "IWebURLAuthenticationChallenge.idl"
+#include "IWebURLRequest.idl"
+#include "IWebMutableURLRequest.idl"
+#include "IWebURLResponse.idl"
+#include "IWebURLResponsePrivate.idl"
+#include "IWebUndoManager.idl"
+#include "IWebUndoTarget.idl"
+#include "IWebView.idl"
+#include "IWebViewPrivate.idl"
+
+#include "IGEN_DOMObject.idl"
+#include "IGEN_DOMCharacterData.idl"
+#include "IGEN_DOMText.idl"
+#include "IGEN_DOMAttr.idl"
+#include "IGEN_DOMCDATASection.idl"
+#include "IGEN_DOMCSSCharsetRule.idl"
+#include "IGEN_DOMCSSFontFaceRule.idl"
+#include "IGEN_DOMCSSImportRule.idl"
+#include "IGEN_DOMCSSMediaRule.idl"
+#include "IGEN_DOMCSSPageRule.idl"
+#include "IGEN_DOMCSSPrimitiveValue.idl"
+#include "IGEN_DOMCSSRule.idl"
+#include "IGEN_DOMCSSRuleList.idl"
+#include "IGEN_DOMCSSStyleDeclaration.idl"
+#include "IGEN_DOMCSSStyleRule.idl"
+#include "IGEN_DOMCSSStyleSheet.idl"
+#include "IGEN_DOMCSSUnknownRule.idl"
+#include "IGEN_DOMCSSValue.idl"
+#include "IGEN_DOMCSSValueList.idl"
+#include "IGEN_DOMComment.idl"
+#include "IGEN_DOMCounter.idl"
+#include "IGEN_DOMDOMImplementation.idl"
+#include "IGEN_DOMDocument.idl"
+#include "IGEN_DOMDocumentFragment.idl"
+#include "IGEN_DOMDocumentType.idl"
+#include "IGEN_DOMElement.idl"
+#include "IGEN_DOMEntity.idl"
+#include "IGEN_DOMEntityReference.idl"
+#include "IGEN_DOMEvent.idl"
+#include "IGEN_DOMEventListener.idl"
+#include "IGEN_DOMEventTarget.idl"
+#include "IGEN_DOMHTMLAnchorElement.idl"
+#include "IGEN_DOMHTMLAppletElement.idl"
+#include "IGEN_DOMHTMLAreaElement.idl"
+#include "IGEN_DOMHTMLBRElement.idl"
+#include "IGEN_DOMHTMLBaseElement.idl"
+#include "IGEN_DOMHTMLBaseFontElement.idl"
+#include "IGEN_DOMHTMLBlockquoteElement.idl"
+#include "IGEN_DOMHTMLBodyElement.idl"
+#include "IGEN_DOMHTMLButtonElement.idl"
+#include "IGEN_DOMHTMLCollection.idl"
+#include "IGEN_DOMHTMLDListElement.idl"
+#include "IGEN_DOMHTMLDirectoryElement.idl"
+#include "IGEN_DOMHTMLDivElement.idl"
+#include "IGEN_DOMHTMLDocument.idl"
+#include "IGEN_DOMHTMLElement.idl"
+#include "IGEN_DOMHTMLEmbedElement.idl"
+#include "IGEN_DOMHTMLFieldSetElement.idl"
+#include "IGEN_DOMHTMLFontElement.idl"
+#include "IGEN_DOMHTMLFormElement.idl"
+#include "IGEN_DOMHTMLFrameElement.idl"
+#include "IGEN_DOMHTMLFrameSetElement.idl"
+#include "IGEN_DOMHTMLHRElement.idl"
+#include "IGEN_DOMHTMLHeadElement.idl"
+#include "IGEN_DOMHTMLHeadingElement.idl"
+#include "IGEN_DOMHTMLHtmlElement.idl"
+#include "IGEN_DOMHTMLIFrameElement.idl"
+#include "IGEN_DOMHTMLImageElement.idl"
+#include "IGEN_DOMHTMLInputElement.idl"
+#include "IGEN_DOMHTMLIsIndexElement.idl"
+#include "IGEN_DOMHTMLLIElement.idl"
+#include "IGEN_DOMHTMLLabelElement.idl"
+#include "IGEN_DOMHTMLLegendElement.idl"
+#include "IGEN_DOMHTMLLinkElement.idl"
+#include "IGEN_DOMHTMLMapElement.idl"
+#include "IGEN_DOMHTMLMarqueeElement.idl"
+#include "IGEN_DOMHTMLMenuElement.idl"
+#include "IGEN_DOMHTMLMetaElement.idl"
+#include "IGEN_DOMHTMLModElement.idl"
+#include "IGEN_DOMHTMLOListElement.idl"
+#include "IGEN_DOMHTMLObjectElement.idl"
+#include "IGEN_DOMHTMLOptGroupElement.idl"
+#include "IGEN_DOMHTMLOptionElement.idl"
+#include "IGEN_DOMHTMLOptionsCollection.idl"
+#include "IGEN_DOMHTMLParagraphElement.idl"
+#include "IGEN_DOMHTMLParamElement.idl"
+#include "IGEN_DOMHTMLPreElement.idl"
+#include "IGEN_DOMHTMLQuoteElement.idl"
+#include "IGEN_DOMHTMLScriptElement.idl"
+#include "IGEN_DOMHTMLSelectElement.idl"
+#include "IGEN_DOMHTMLStyleElement.idl"
+#include "IGEN_DOMHTMLTableCaptionElement.idl"
+#include "IGEN_DOMHTMLTableCellElement.idl"
+#include "IGEN_DOMHTMLTableColElement.idl"
+#include "IGEN_DOMHTMLTableElement.idl"
+#include "IGEN_DOMHTMLTableRowElement.idl"
+#include "IGEN_DOMHTMLTableSectionElement.idl"
+#include "IGEN_DOMHTMLTextAreaElement.idl"
+#include "IGEN_DOMHTMLTitleElement.idl"
+#include "IGEN_DOMHTMLUListElement.idl"
+#include "IGEN_DOMMediaList.idl"
+#include "IGEN_DOMNamedNodeMap.idl"
+#include "IGEN_DOMNode.idl"
+#include "IGEN_DOMNodeList.idl"
+#include "IGEN_DOMNotation.idl"
+#include "IGEN_DOMProcessingInstruction.idl"
+#include "IGEN_DOMRect.idl"
+#include "IGEN_DOMStyleSheet.idl"
+#include "IGEN_DOMStyleSheetList.idl"
+
+#define __TYPELIB_VERSION__ __BUILD_NUMBER_MAJOR__##.##__BUILD_NUMBER_MINOR__
+
+[
+#if __PRODUCTION__
+ uuid(2a748656-625d-4207-b29f-40c95bfeb3a9),
+ helpstring("WebKit " __BUILD_NUMBER_SHORT__ " Type Library"),
+#else
+ uuid(76E5F7F0-18FD-48a2-B549-1159435B513B),
+ helpstring("OpenSourceWebKit " __BUILD_NUMBER_SHORT__ " Type Library"),
+#endif
+ version(__TYPELIB_VERSION__)
+]
+#if __PRODUCTION__
+library WebKit
+#else
+library OpenSourceWebKit
+#endif
+{
+ // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
+ importlib("STDOLE2.TLB");
+
+#if __PRODUCTION__
+ [uuid(d6bca079-f61c-4e1e-b453-32a0477d02e3)]
+#else
+ [uuid(4FF47097-3FEA-4b47-AC0E-90725C546490)]
+#endif
+ coclass WebView {
+ [default] interface IWebView;
+ interface IWebIBActions;
+ interface IWebViewCSS;
+ interface IWebViewEditing;
+ interface IWebViewUndoableEditing;
+ interface IWebViewEditingActions;
+ interface IWebNotificationObserver;
+ interface IWebViewPrivate;
+ }
+
+#if __PRODUCTION__
+ [uuid(66827ec1-3aef-4241-bac5-f776b44f030f)]
+#else
+ [uuid(BE8EE509-9894-44ba-9E2F-E29780BCB25C)]
+#endif
+ coclass WebIconDatabase {
+ [default] interface IWebIconDatabase;
+ }
+
+#if __PRODUCTION__
+ [uuid(a062ecc3-bb1b-4694-a569-f59e0ad6be0c)]
+#else
+ [uuid(97F3EB52-9EAC-4062-82E1-E5C1E7789DEE)]
+#endif
+ coclass WebMutableURLRequest {
+ [default] interface IWebMutableURLRequest;
+ }
+
+#if __PRODUCTION__
+ [uuid(ba590766-0a6f-46c7-b96e-743490d94cb7)]
+#else
+ [uuid(99B9D99A-060D-4695-8C8F-3AB53156054C)]
+#endif
+ coclass WebNotificationCenter {
+ [default] interface IWebNotificationCenter;
+ }
+
+#if __PRODUCTION__
+ [uuid(a4b9b45d-949f-4c8c-9b92-6fbfcc1caaa2)]
+#else
+ [uuid(4D043991-E844-48b0-8EF7-85FE1AB8829E)]
+#endif
+ coclass WebHistory {
+ [default] interface IWebHistory;
+ }
+
+#if __PRODUCTION__
+ [uuid(dd653964-4d37-4fb2-9cb6-6a9a97719332)]
+#else
+ [uuid(97795891-293D-4855-800E-E21987568537)]
+#endif
+ coclass CFDictionaryPropertyBag {
+ [default] interface IPropertyBag;
+ }
+
+#if __PRODUCTION__
+ [uuid(6be190e9-1725-4e4a-88db-6a9fe242c9e5)]
+#else
+ [uuid(82F6400A-3CD0-40a3-8EA1-7A23B26D6153)]
+#endif
+ coclass WebHistoryItem {
+ [default] interface IWebHistoryItem;
+ }
+
+#if __PRODUCTION__
+ [uuid(f71071fd-a51b-4b69-9eb6-44374405e80c)]
+#else
+ [uuid(CB0111F6-168B-467e-8613-23AB37D0493E)]
+#endif
+ coclass WebCache {
+ [default] interface IWebCache;
+ }
+
+#if __PRODUCTION__
+ [uuid(1820D883-42FE-4b78-88C8-5456BB19D224)]
+#else
+ [uuid(5D911A44-4316-4a02-A2B5-BAE7036357B9)]
+#endif
+ coclass WebJavaScriptCollector {
+ [default] interface IWebJavaScriptCollector;
+ }
+
+#if __PRODUCTION__
+ [uuid(67B89F90-F778-438b-ABBF-34D1ACBF8651)]
+#else
+ [uuid(CC914F49-2385-4943-9B3F-E17501383F5B)]
+#endif
+ coclass WebPreferences {
+ [default] interface IWebPreferences;
+ }
+
+#if __PRODUCTION__
+ [uuid(E93AA8D7-F362-4a4a-A95D-325906BEB5F0)]
+#else
+ [uuid(87689DC6-5F8C-4194-90D5-CE6083837AB5)]
+#endif
+ coclass WebKitStatistics {
+ [default] interface IWebKitStatistics;
+ }
+
+#if __PRODUCTION__
+ [uuid(6C6AF3F9-36B4-4bf7-8BDE-74DCD4AD75A4)]
+#else
+ [uuid(319B38AC-2794-47fa-AE18-A14A7576A6D8)]
+#endif
+ coclass WebError {
+ [default] interface IWebError;
+ }
+
+#if __PRODUCTION__
+ [uuid(7433F53B-7FE9-484a-9432-72909457A646)]
+#else
+ [uuid(BCF988AF-9A2F-403f-A1D8-BD815C46401D)]
+#endif
+ coclass WebURLCredential {
+ [default] interface IWebURLCredential;
+ }
+
+#if __PRODUCTION__
+ [uuid(C0F98BD9-3B1C-413d-904A-E2D1453EAF1F)]
+#else
+ [uuid(3FE547FC-4EC1-4062-9DE2-9FC3DA0A08FF)]
+#endif
+ coclass WebDownload {
+ [default] interface IWebDownload;
+ }
+
+#if __PRODUCTION__
+ [uuid(2FB5499A-BB5D-4469-8517-789FEC8FD9BA)]
+#else
+ [uuid(20B9702D-B41F-449b-84FE-3E32DB5D775F)]
+#endif
+ coclass WebURLRequest {
+ [default] interface IWebURLRequest;
+ }
+
+#if __PRODUCTION__
+ [uuid(F366A6E8-E43C-4fd4-AAB0-8E6E79C73E6E)]
+#else
+ [uuid(41EFBA9A-63E4-4c49-A012-CCC48694D7A5)]
+#endif
+ coclass WebURLProtectionSpace {
+ [default] interface IWebURLProtectionSpace;
+ }
+
+#if __PRODUCTION__
+ [uuid(24A53AD5-AA9F-44e6-AA22-2C7C250B661A)]
+#else
+ [uuid(0F34FB95-301F-4ea1-943E-B5E6E6D94121)]
+#endif
+ coclass WebScrollBar {
+ [default] interface IWebScrollBarPrivate;
+ }
+
+#if __PRODUCTION__
+ [uuid(715636C4-59E7-4b85-BBC5-B555888787D7)]
+#else
+ [uuid(5BE39DBA-5887-4a69-9157-EBEE96BA3309)]
+#endif
+ coclass WebScriptDebugServer {
+ [default] interface IWebScriptDebugServer;
+ }
+
+#if __PRODUCTION__
+ [uuid(AB201196-8DD2-4d45-AEBD-029B6A37AA27)]
+#else
+ [uuid(EA2FCB14-072B-48b5-B9B5-1BBEFBABC7BC)]
+#endif
+ coclass WebURLResponse {
+ [default] interface IWebURLResponse;
+ }
+
+#if __PRODUCTION__
+ [uuid(24040cd6-aff4-4a51-9c8b-71539580ee76)]
+#else
+ [uuid(1fbff564-5ff4-484f-b3d9-217483f9f5fc)]
+#endif
+ coclass WebTextRenderer {
+ [default] interface IWebTextRenderer;
+ }
+
+#if __PRODUCTION__
+ [uuid(C2A1BFC2-1E7C-49fe-8592-D0C7FB440BC0)]
+#else
+ [uuid(1F7B8CEE-5D74-4974-8A47-C5733B422644)]
+#endif
+ coclass WebDatabaseManager {
+ [default] interface IWebDatabaseManager;
+ }
+}
diff --git a/WebKit/win/MarshallingHelpers.cpp b/WebKit/win/MarshallingHelpers.cpp
new file mode 100644
index 0000000..2a3935e
--- /dev/null
+++ b/WebKit/win/MarshallingHelpers.cpp
@@ -0,0 +1,293 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "MarshallingHelpers.h"
+
+#pragma warning(push, 0)
+#include <WebCore/IntRect.h>
+#include <WebCore/KURL.h>
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+static const double secondsPerDay = 60 * 60 * 24;
+
+CFArrayCallBacks MarshallingHelpers::kIUnknownArrayCallBacks = {0, IUnknownRetainCallback, IUnknownReleaseCallback, 0, 0};
+CFDictionaryValueCallBacks MarshallingHelpers::kIUnknownDictionaryValueCallBacks = {0, IUnknownRetainCallback, IUnknownReleaseCallback, 0, 0};
+
+KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr)
+{
+ return KURL(String(urlStr, SysStringLen(urlStr)));
+}
+
+BSTR MarshallingHelpers::KURLToBSTR(const KURL& url)
+{
+ return SysAllocStringLen(url.string().characters(), url.string().length());
+}
+
+CFURLRef MarshallingHelpers::PathStringToFileCFURLRef(const String& string)
+{
+ CFStringRef cfPath = CFStringCreateWithCharactersNoCopy(0, (const UniChar*)string.characters(), string.length(), kCFAllocatorNull);
+ CFURLRef pathURL = CFURLCreateWithFileSystemPath(0, cfPath, kCFURLWindowsPathStyle, false);
+ CFRelease(cfPath);
+ return pathURL;
+}
+
+String MarshallingHelpers::FileCFURLRefToPathString(CFURLRef fileURL)
+{
+ CFStringRef string = CFURLCopyFileSystemPath(fileURL, kCFURLWindowsPathStyle);
+ String result(string);
+ CFRelease(string);
+ return result;
+}
+
+CFURLRef MarshallingHelpers::BSTRToCFURLRef(BSTR urlStr)
+{
+ CFStringRef urlCFString = BSTRToCFStringRef(urlStr);
+ if (!urlCFString)
+ return 0;
+
+ CFURLRef urlRef = CFURLCreateWithString(0, urlCFString, 0);
+ CFRelease(urlCFString);
+
+ return urlRef;
+}
+
+CFStringRef MarshallingHelpers::BSTRToCFStringRef(BSTR str)
+{
+ return CFStringCreateWithCharacters(0, (const UniChar*)(str ? str : TEXT("")), SysStringLen(str));
+}
+
+CFStringRef MarshallingHelpers::LPCOLESTRToCFStringRef(LPCOLESTR str)
+{
+ return CFStringCreateWithCharacters(0, (const UniChar*)(str ? str : TEXT("")), (CFIndex)(str ? wcslen(str) : 0));
+}
+
+BSTR MarshallingHelpers::CFStringRefToBSTR(CFStringRef str)
+{
+ if (!str)
+ return 0;
+
+ const UniChar* uniChars = CFStringGetCharactersPtr(str);
+ if (uniChars)
+ return SysAllocStringLen((LPCTSTR)uniChars, CFStringGetLength(str));
+
+ CFIndex length = CFStringGetLength(str);
+ BSTR bstr = SysAllocStringLen(0, length);
+ if (bstr) {
+ CFStringGetCharacters(str, CFRangeMake(0, length), (UniChar*)bstr);
+ bstr[length] = 0;
+ }
+ return bstr;
+}
+
+int MarshallingHelpers::CFNumberRefToInt(CFNumberRef num)
+{
+ int number;
+ CFNumberGetValue(num, kCFNumberIntType, &number);
+ return number;
+}
+
+CFNumberRef MarshallingHelpers::intToCFNumberRef(int num)
+{
+ return CFNumberCreate(0, kCFNumberSInt32Type, &num);
+}
+
+CFAbsoluteTime MarshallingHelpers::windowsEpochAbsoluteTime()
+{
+ static CFAbsoluteTime windowsEpochAbsoluteTime = 0;
+ if (!windowsEpochAbsoluteTime) {
+ CFGregorianDate windowsEpochDate = {1899, 12, 30, 0, 0, 0.0};
+ windowsEpochAbsoluteTime = CFGregorianDateGetAbsoluteTime(windowsEpochDate, 0) / secondsPerDay;
+ }
+ return windowsEpochAbsoluteTime;
+}
+
+CFAbsoluteTime MarshallingHelpers::DATEToCFAbsoluteTime(DATE date)
+{
+ // <http://msdn2.microsoft.com/en-us/library/ms221627.aspx>
+ // DATE: This is the same numbering system used by most spreadsheet programs,
+ // although some specify incorrectly that February 29, 1900 existed, and thus
+ // set January 1, 1900 to 1.0. The date can be converted to and from an MS-DOS
+ // representation using VariantTimeToDosDateTime, which is discussed in
+ // Conversion and Manipulation Functions.
+
+ // CFAbsoluteTime: Type used to represent a specific point in time relative
+ // to the absolute reference date of 1 Jan 2001 00:00:00 GMT.
+ // Absolute time is measured by the number of seconds between the reference
+ // date and the specified date. Negative values indicate dates/times before
+ // the reference date. Positive values indicate dates/times after the
+ // reference date.
+
+ return (date + windowsEpochAbsoluteTime()) * secondsPerDay;
+}
+
+DATE MarshallingHelpers::CFAbsoluteTimeToDATE(CFAbsoluteTime absoluteTime)
+{
+ return (absoluteTime/secondsPerDay - windowsEpochAbsoluteTime());
+}
+
+// utility method to store a 1-dim string vector into a newly created SAFEARRAY
+SAFEARRAY* MarshallingHelpers::stringArrayToSafeArray(CFArrayRef inArray)
+{
+ CFIndex size = CFArrayGetCount(inArray);
+ SAFEARRAY* sa = ::SafeArrayCreateVectorEx(VT_BSTR, 0, (ULONG) size, 0);
+ long count = 0;
+ for (CFIndex i=0; i<size; i++) {
+ CFStringRef item = (CFStringRef) CFArrayGetValueAtIndex(inArray, i);
+ BSTR bstr = CFStringRefToBSTR(item);
+ ::SafeArrayPutElement(sa, &count, bstr);
+ SysFreeString(bstr); // SafeArrayPutElement() should make a copy of the string
+ count++;
+ }
+ return sa;
+}
+
+// utility method to store a 1-dim int vector into a newly created SAFEARRAY
+SAFEARRAY* MarshallingHelpers::intArrayToSafeArray(CFArrayRef inArray)
+{
+ CFIndex size = CFArrayGetCount(inArray);
+ SAFEARRAY* sa = ::SafeArrayCreateVectorEx(VT_I4, 0, (ULONG) size, 0);
+ long count = 0;
+ for (CFIndex i=0; i<size; i++) {
+ CFNumberRef item = (CFNumberRef) CFArrayGetValueAtIndex(inArray, i);
+ int number = CFNumberRefToInt(item);
+ ::SafeArrayPutElement(sa, &count, &number);
+ count++;
+ }
+ return sa;
+}
+
+SAFEARRAY* MarshallingHelpers::intRectToSafeArray(const WebCore::IntRect& rect)
+{
+ SAFEARRAY* sa = ::SafeArrayCreateVectorEx(VT_I4, 0, 4, 0);
+ long count = 0;
+ int value;
+
+ value = rect.x();
+ ::SafeArrayPutElement(sa, &count, &value);
+ count++;
+
+ value = rect.y();
+ ::SafeArrayPutElement(sa, &count, &value);
+ count++;
+
+ value = rect.width();
+ ::SafeArrayPutElement(sa, &count, &value);
+ count++;
+
+ value = rect.height();
+ ::SafeArrayPutElement(sa, &count, &value);
+ count++;
+
+ return sa;
+}
+
+// utility method to store a 1-dim IUnknown* vector into a newly created SAFEARRAY
+SAFEARRAY* MarshallingHelpers::iunknownArrayToSafeArray(CFArrayRef inArray)
+{
+ CFIndex size = CFArrayGetCount(inArray);
+ SAFEARRAY* sa = ::SafeArrayCreateVectorEx(VT_UNKNOWN, 0, (ULONG) size, (LPVOID)&IID_IUnknown);
+ long count = 0;
+ for (CFIndex i=0; i<size; i++) {
+ IUnknown* item = (IUnknown*) CFArrayGetValueAtIndex(inArray, i);
+ ::SafeArrayPutElement(sa, &count, item); // SafeArrayPutElement() adds a reference to the IUnknown added
+ count++;
+ }
+ return sa;
+}
+
+CFArrayRef MarshallingHelpers::safeArrayToStringArray(SAFEARRAY* inArray)
+{
+ long lBound=0, uBound=-1;
+ HRESULT hr = ::SafeArrayGetLBound(inArray, 1, &lBound);
+ if (SUCCEEDED(hr))
+ hr = ::SafeArrayGetUBound(inArray, 1, &uBound);
+ long len = (SUCCEEDED(hr)) ? (uBound-lBound+1) : 0;
+ CFStringRef* items = 0;
+ if (len > 0) {
+ items = new CFStringRef[len];
+ for (; lBound <= uBound; lBound++) {
+ BSTR str;
+ hr = ::SafeArrayGetElement(inArray, &lBound, &str);
+ items[lBound] = BSTRToCFStringRef(str);
+ SysFreeString(str);
+ }
+ }
+ CFArrayRef result = CFArrayCreate(0, (const void**)items, len, &kCFTypeArrayCallBacks);
+ if (items)
+ delete[] items;
+ return result;
+}
+
+CFArrayRef MarshallingHelpers::safeArrayToIntArray(SAFEARRAY* inArray)
+{
+ long lBound=0, uBound=-1;
+ HRESULT hr = ::SafeArrayGetLBound(inArray, 1, &lBound);
+ if (SUCCEEDED(hr))
+ hr = ::SafeArrayGetUBound(inArray, 1, &uBound);
+ long len = (SUCCEEDED(hr)) ? (uBound-lBound+1) : 0;
+ CFNumberRef* items = 0;
+ if (len > 0) {
+ items = new CFNumberRef[len];
+ for (; lBound <= uBound; lBound++) {
+ int num;
+ hr = ::SafeArrayGetElement(inArray, &lBound, &num);
+ items[lBound] = intToCFNumberRef(num);
+ }
+ }
+ CFArrayRef result = CFArrayCreate(0, (const void**) items, len, &kCFTypeArrayCallBacks);
+ if (items)
+ delete[] items;
+ return result;
+}
+
+CFArrayRef MarshallingHelpers::safeArrayToIUnknownArray(SAFEARRAY* inArray)
+{
+ long lBound=0, uBound=-1;
+ HRESULT hr = ::SafeArrayGetLBound(inArray, 1, &lBound);
+ if (SUCCEEDED(hr))
+ hr = ::SafeArrayGetUBound(inArray, 1, &uBound);
+ long len = (SUCCEEDED(hr)) ? (uBound-lBound+1) : 0;
+ void* items;
+ hr = ::SafeArrayAccessData(inArray, &items);
+ CFArrayRef result = CFArrayCreate(0, (const void**) items, len, &kIUnknownArrayCallBacks);
+ hr = ::SafeArrayUnaccessData(inArray);
+ return result;
+}
+
+const void* MarshallingHelpers::IUnknownRetainCallback(CFAllocatorRef /*allocator*/, const void* value)
+{
+ ((IUnknown*) value)->AddRef();
+ return value;
+}
+
+void MarshallingHelpers::IUnknownReleaseCallback(CFAllocatorRef /*allocator*/, const void* value)
+{
+ ((IUnknown*) value)->Release();
+}
diff --git a/WebKit/win/MarshallingHelpers.h b/WebKit/win/MarshallingHelpers.h
new file mode 100644
index 0000000..bbde61f
--- /dev/null
+++ b/WebKit/win/MarshallingHelpers.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MarshallingHelpers_H
+#define MarshallingHelpers_H
+
+#include <CoreFoundation/CoreFoundation.h>
+
+namespace WebCore {
+ class IntRect;
+ class KURL;
+ class String;
+}
+
+class MarshallingHelpers
+{
+public:
+ static WebCore::KURL BSTRToKURL(BSTR);
+ static BSTR KURLToBSTR(const WebCore::KURL&);
+ static CFURLRef PathStringToFileCFURLRef(const WebCore::String&);
+ static WebCore::String FileCFURLRefToPathString(CFURLRef fileURL);
+ static CFURLRef BSTRToCFURLRef(BSTR);
+ static CFStringRef BSTRToCFStringRef(BSTR);
+ static CFStringRef LPCOLESTRToCFStringRef(LPCOLESTR);
+ static BSTR CFStringRefToBSTR(CFStringRef);
+ static int CFNumberRefToInt(CFNumberRef);
+ static CFNumberRef intToCFNumberRef(int);
+ static CFAbsoluteTime DATEToCFAbsoluteTime(DATE);
+ static DATE CFAbsoluteTimeToDATE(CFAbsoluteTime);
+ static SAFEARRAY* stringArrayToSafeArray(CFArrayRef);
+ static SAFEARRAY* intArrayToSafeArray(CFArrayRef);
+ static SAFEARRAY* intRectToSafeArray(const WebCore::IntRect&);
+ static SAFEARRAY* iunknownArrayToSafeArray(CFArrayRef);
+ static CFArrayRef safeArrayToStringArray(SAFEARRAY*);
+ static CFArrayRef safeArrayToIntArray(SAFEARRAY*);
+ static CFArrayRef safeArrayToIUnknownArray(SAFEARRAY*);
+ static const void* IUnknownRetainCallback(CFAllocatorRef, const void*);
+ static void IUnknownReleaseCallback(CFAllocatorRef, const void*);
+ static CFArrayCallBacks kIUnknownArrayCallBacks;
+ static CFDictionaryValueCallBacks kIUnknownDictionaryValueCallBacks;
+
+private:
+ static CFAbsoluteTime MarshallingHelpers::windowsEpochAbsoluteTime();
+
+private:
+ MarshallingHelpers();
+ ~MarshallingHelpers();
+};
+
+#endif
diff --git a/WebKit/win/MemoryStream.cpp b/WebKit/win/MemoryStream.cpp
new file mode 100644
index 0000000..9279a72
--- /dev/null
+++ b/WebKit/win/MemoryStream.cpp
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "MemoryStream.h"
+
+using std::min;
+using namespace WebCore;
+
+// MemoryStream ---------------------------------------------------------------
+
+MemoryStream::MemoryStream(PassRefPtr<SharedBuffer> buffer)
+: m_refCount(0)
+, m_buffer(buffer)
+, m_pos(0)
+{
+ gClassCount++;
+}
+
+MemoryStream::~MemoryStream()
+{
+ gClassCount--;
+}
+
+MemoryStream* MemoryStream::createInstance(PassRefPtr<SharedBuffer> buffer)
+{
+ MemoryStream* instance = new MemoryStream(buffer);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE MemoryStream::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_ISequentialStream))
+ *ppvObject = static_cast<ISequentialStream*>(this);
+ else if (IsEqualGUID(riid, IID_IStream))
+ *ppvObject = static_cast<IStream*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE MemoryStream::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE MemoryStream::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// ISequentialStream ----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Read(
+ /* [length_is][size_is][out] */ void* pv,
+ /* [in] */ ULONG cb,
+ /* [out] */ ULONG* pcbRead)
+{
+ *pcbRead = 0;
+
+ if (!m_buffer)
+ return E_FAIL;
+
+ if (m_pos >= m_buffer->size())
+ return S_FALSE;
+
+ if (m_pos + cb < m_buffer->size())
+ *pcbRead = cb;
+ else
+ *pcbRead = (ULONG) (m_buffer->size() - m_pos);
+
+ memcpy(pv, m_buffer->data() + m_pos, *pcbRead);
+ m_pos += *pcbRead;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Write(
+ /* [size_is][in] */ const void* /*pv*/,
+ /* [in] */ ULONG /*cb*/,
+ /* [out] */ ULONG* /*pcbWritten*/)
+{
+ // we use this for read-only streams
+ return STG_E_ACCESSDENIED;
+}
+
+// IStream --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Seek(
+ /* [in] */ LARGE_INTEGER dlibMove,
+ /* [in] */ DWORD dwOrigin,
+ /* [out] */ ULARGE_INTEGER* plibNewPosition)
+{
+ if (!m_buffer)
+ return E_FAIL;
+
+ size_t proposedPos = m_pos;
+ size_t lowPartNeg;
+ switch (dwOrigin) {
+ case STREAM_SEEK_SET:
+ proposedPos = dlibMove.LowPart;
+ if (dlibMove.HighPart)
+ return E_FAIL;
+ break;
+ case STREAM_SEEK_CUR:
+ if (!dlibMove.HighPart) {
+ if (dlibMove.LowPart > (m_buffer->size() - m_pos))
+ return E_FAIL;
+ proposedPos += dlibMove.LowPart;
+ } else if (dlibMove.HighPart == -1) {
+ lowPartNeg = (~dlibMove.LowPart)+1;
+ if (lowPartNeg > m_pos)
+ return E_FAIL;
+ proposedPos = m_pos - lowPartNeg;
+ } else
+ return E_FAIL;
+ break;
+ case STREAM_SEEK_END:
+ if (dlibMove.HighPart != -1)
+ return E_FAIL;
+ lowPartNeg = (~dlibMove.LowPart)+1;
+ if (lowPartNeg > m_buffer->size())
+ return E_FAIL;
+ proposedPos = m_buffer->size() - lowPartNeg;
+ break;
+ default:
+ return E_FAIL;
+ }
+
+ if (proposedPos >= m_buffer->size())
+ return E_FAIL;
+
+ if (plibNewPosition) {
+ plibNewPosition->HighPart = 0;
+ plibNewPosition->LowPart = (DWORD) m_pos;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::SetSize(
+ /* [in] */ ULARGE_INTEGER /*libNewSize*/)
+{
+ return STG_E_INVALIDFUNCTION;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::CopyTo(
+ /* [unique][in] */ IStream* pstm,
+ /* [in] */ ULARGE_INTEGER cb,
+ /* [out] */ ULARGE_INTEGER* pcbRead,
+ /* [out] */ ULARGE_INTEGER* pcbWritten)
+{
+ if (!m_buffer)
+ return E_FAIL;
+ if (cb.HighPart) {
+ cb.HighPart = 0;
+ cb.LowPart = (DWORD)-1;
+ }
+
+ ULONG written;
+ ULONG read = min(cb.LowPart, (ULONG)(m_buffer->size()-m_pos));
+ HRESULT hr = pstm->Write(m_buffer->data()+m_pos, read, &written);
+ if (pcbWritten) {
+ pcbWritten->HighPart = 0;
+ pcbWritten->LowPart = written;
+ }
+ if (pcbRead) {
+ pcbRead->HighPart = 0;
+ pcbRead->LowPart = read;
+ }
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Commit(
+ /* [in] */ DWORD /*grfCommitFlags*/)
+{
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Revert( void)
+{
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::LockRegion(
+ /* [in] */ ULARGE_INTEGER /*libOffset*/,
+ /* [in] */ ULARGE_INTEGER /*cb*/,
+ /* [in] */ DWORD /*dwLockType*/)
+{
+ return STG_E_INVALIDFUNCTION;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::UnlockRegion(
+ /* [in] */ ULARGE_INTEGER /*libOffset*/,
+ /* [in] */ ULARGE_INTEGER /*cb*/,
+ /* [in] */ DWORD /*dwLockType*/)
+{
+ return STG_E_INVALIDFUNCTION;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Stat(
+ /* [out] */ STATSTG* pstatstg,
+ /* [in] */ DWORD /*grfStatFlag*/)
+{
+ if (!pstatstg)
+ return E_POINTER;
+
+ if (!m_buffer)
+ return E_FAIL;
+
+ memset(pstatstg, 0, sizeof(STATSTG));
+ pstatstg->type = STGTY_STREAM;
+ pstatstg->cbSize.LowPart = (DWORD) m_buffer->size();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE MemoryStream::Clone(
+ /* [out] */ IStream** ppstm)
+{
+ *ppstm = MemoryStream::createInstance(m_buffer);
+ return (*ppstm) ? S_OK : E_OUTOFMEMORY;
+}
diff --git a/WebKit/win/MemoryStream.h b/WebKit/win/MemoryStream.h
new file mode 100644
index 0000000..22ca0f4
--- /dev/null
+++ b/WebKit/win/MemoryStream.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryStream_H
+#define MemoryStream_H
+
+#include <objidl.h>
+
+#include "COMPtr.h"
+#include <WebCore/SharedBuffer.h>
+#include <WTF/PassRefPtr.h>
+#include <WTF/RefPtr.h>
+
+class MemoryStream : public IStream
+{
+public:
+ static MemoryStream* MemoryStream::createInstance(PassRefPtr<WebCore::SharedBuffer> buffer);
+
+protected:
+ MemoryStream(PassRefPtr<WebCore::SharedBuffer> buffer);
+ ~MemoryStream();
+public:
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // ISequentialStream
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [length_is][size_is][out] */ void* pv,
+ /* [in] */ ULONG cb,
+ /* [out] */ ULONG* pcbRead);
+
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Write(
+ /* [size_is][in] */ const void* pv,
+ /* [in] */ ULONG cb,
+ /* [out] */ ULONG* pcbWritten);
+
+ // IStream
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Seek(
+ /* [in] */ LARGE_INTEGER dlibMove,
+ /* [in] */ DWORD dwOrigin,
+ /* [out] */ ULARGE_INTEGER* plibNewPosition);
+
+ virtual HRESULT STDMETHODCALLTYPE SetSize(
+ /* [in] */ ULARGE_INTEGER libNewSize);
+
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE CopyTo(
+ /* [unique][in] */ IStream* pstm,
+ /* [in] */ ULARGE_INTEGER cb,
+ /* [out] */ ULARGE_INTEGER* pcbRead,
+ /* [out] */ ULARGE_INTEGER* pcbWritten);
+
+ virtual HRESULT STDMETHODCALLTYPE Commit(
+ /* [in] */ DWORD grfCommitFlags);
+
+ virtual HRESULT STDMETHODCALLTYPE Revert( void);
+
+ virtual HRESULT STDMETHODCALLTYPE LockRegion(
+ /* [in] */ ULARGE_INTEGER libOffset,
+ /* [in] */ ULARGE_INTEGER cb,
+ /* [in] */ DWORD dwLockType);
+
+ virtual HRESULT STDMETHODCALLTYPE UnlockRegion(
+ /* [in] */ ULARGE_INTEGER libOffset,
+ /* [in] */ ULARGE_INTEGER cb,
+ /* [in] */ DWORD dwLockType);
+
+ virtual HRESULT STDMETHODCALLTYPE Stat(
+ /* [out] */ STATSTG* pstatstg,
+ /* [in] */ DWORD grfStatFlag);
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IStream** ppstm);
+
+protected:
+ ULONG m_refCount;
+ RefPtr<WebCore::SharedBuffer> m_buffer;
+ size_t m_pos;
+};
+
+#endif
diff --git a/WebKit/win/ProgIDMacros.h b/WebKit/win/ProgIDMacros.h
new file mode 100644
index 0000000..ef9e26f
--- /dev/null
+++ b/WebKit/win/ProgIDMacros.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProgIDMacros_h
+#define ProgIDMacros_h
+
+#define STRINGIFIED_VERSION(version) STRINGIFY(version)
+#define STRINGIFY(s) L###s
+
+#define CURRENT_PROGID_VERSION 526
+#define VERSION_INDEPENDENT_PRODUCTION_PROGID(className) L##"WebKit." L###className
+#define VERSION_INDEPENDENT_OPENSOURCE_PROGID(className) L##"OpenSource" VERSION_INDEPENDENT_PRODUCTION_PROGID(className)
+#define VERSIONED_PROGID(versionIndependentProgID, version) versionIndependentProgID L##"." STRINGIFIED_VERSION(version)
+
+#endif // !defined(ProgIDMacros_h)
diff --git a/WebKit/win/WebActionPropertyBag.cpp b/WebKit/win/WebActionPropertyBag.cpp
new file mode 100644
index 0000000..c863fe7
--- /dev/null
+++ b/WebKit/win/WebActionPropertyBag.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+
+#include "WebKit.h"
+#include "WebActionPropertyBag.h"
+#include "WebElementPropertyBag.h"
+#include "COMPtr.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/EventHandler.h>
+#include <WebCore/MouseEvent.h>
+#include <WebCore/HitTestResult.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebActionPropertyBag ------------------------------------------------
+WebActionPropertyBag::WebActionPropertyBag(const NavigationAction& action, Frame* frame)
+ : m_refCount(0)
+ , m_action(action)
+ , m_frame(frame)
+{
+}
+
+WebActionPropertyBag::~WebActionPropertyBag()
+{
+}
+
+WebActionPropertyBag* WebActionPropertyBag::createInstance(const NavigationAction& action, Frame* frame)
+{
+ WebActionPropertyBag* instance = new WebActionPropertyBag(action, frame);
+ instance->AddRef();
+
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebActionPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebActionPropertyBag::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebActionPropertyBag::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+static bool isEqual(LPCWSTR s1, LPCWSTR s2)
+{
+ return !wcscmp(s1, s2);
+}
+
+static const MouseEvent* findMouseEvent(const Event* event)
+{
+ for (const Event* e = event; e; e = e->underlyingEvent())
+ if (e->isMouseEvent())
+ return static_cast<const MouseEvent*>(e);
+ return 0;
+}
+
+HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog * /*pErrorLog*/)
+{
+ if (!pszPropName)
+ return E_POINTER;
+
+ VariantClear(pVar);
+
+ if (isEqual(pszPropName, WebActionNavigationTypeKey)) {
+ V_VT(pVar) = VT_I4;
+ V_I4(pVar) = m_action.type();
+ return S_OK;
+ } else if (isEqual(pszPropName, WebActionElementKey)) {
+ if (const MouseEvent* mouseEvent = findMouseEvent(m_action.event())) {
+ IntPoint point(mouseEvent->clientX(), mouseEvent->clientY());
+ V_VT(pVar) = VT_UNKNOWN;
+ V_UNKNOWN(pVar) = WebElementPropertyBag::createInstance(m_frame->eventHandler()->hitTestResultAtPoint(point, false));
+ return S_OK;
+ }
+ } else if (isEqual(pszPropName, WebActionButtonKey)) {
+ if (const MouseEvent* mouseEvent = findMouseEvent(m_action.event())) {
+ V_VT(pVar) = VT_I4;
+ V_I4(pVar) = mouseEvent->button();
+ return S_OK;
+ }
+ } else if (isEqual(pszPropName, WebActionOriginalURLKey)) {
+ V_VT(pVar) = VT_BSTR;
+ V_BSTR(pVar) = BString(m_action.url().string()).release();
+ return S_OK;
+ } else if (isEqual(pszPropName, WebActionModifierFlagsKey)) {
+ if (const UIEventWithKeyState* keyEvent = findEventWithKeyState(const_cast<Event*>(m_action.event()))) {
+ int modifiers = 0;
+
+ if (keyEvent->ctrlKey())
+ modifiers |= MK_CONTROL;
+ if (keyEvent->shiftKey())
+ modifiers |= MK_SHIFT;
+ if (keyEvent->altKey())
+ modifiers |= MK_ALT;
+
+ V_VT(pVar) = VT_I4;
+ V_I4(pVar) = modifiers;
+ return S_OK;
+ }
+ }
+ return E_INVALIDARG;
+}
+
+HRESULT STDMETHODCALLTYPE WebActionPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+
+ return E_FAIL;
+}
diff --git a/WebKit/win/WebActionPropertyBag.h b/WebKit/win/WebActionPropertyBag.h
new file mode 100644
index 0000000..3c2f19e
--- /dev/null
+++ b/WebKit/win/WebActionPropertyBag.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebActionPropertyBag_h
+#define WebActionPropertyBag_h
+
+#include "ocidl.h"
+#include <WTF/OwnPtr.h>
+
+#pragma warning(push, 0)
+#include <WebCore/Frame.h>
+#include <WebCore/NavigationAction.h>
+#pragma warning(pop)
+
+class WebActionPropertyBag : public IPropertyBag
+{
+public:
+ static WebActionPropertyBag* createInstance(const WebCore::NavigationAction&, WebCore::Frame*);
+
+protected:
+ WebActionPropertyBag(const WebCore::NavigationAction&, WebCore::Frame*);
+ ~WebActionPropertyBag();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IPropertyBag
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [out][in] */ VARIANT *pVar,
+ /* [in] */ IErrorLog *pErrorLog);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [in] */ VARIANT *pVar);
+
+private:
+ ULONG m_refCount;
+ WebCore::NavigationAction m_action;
+ RefPtr<WebCore::Frame> m_frame;
+};
+
+#endif \ No newline at end of file
diff --git a/WebKit/win/WebBackForwardList.cpp b/WebKit/win/WebBackForwardList.cpp
new file mode 100644
index 0000000..3c08b9a
--- /dev/null
+++ b/WebKit/win/WebBackForwardList.cpp
@@ -0,0 +1,303 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebBackForwardList.h"
+
+#include "COMPtr.h"
+#include "WebFrame.h"
+#include "WebKit.h"
+#include "WebPreferences.h"
+
+#include <WebCore/BackForwardList.h>
+#include <WebCore/HistoryItem.h>
+
+using std::min;
+using namespace WebCore;
+
+// WebBackForwardList ----------------------------------------------------------------
+
+static HashMap<BackForwardList*, WebBackForwardList*>& backForwardListWrappers()
+{
+ static HashMap<BackForwardList*, WebBackForwardList*> staticBackForwardListWrappers;
+ return staticBackForwardListWrappers;
+}
+
+WebBackForwardList::WebBackForwardList(PassRefPtr<BackForwardList> backForwardList)
+ : m_refCount(0)
+ , m_backForwardList(backForwardList)
+{
+ ASSERT(!backForwardListWrappers().contains(m_backForwardList.get()));
+ backForwardListWrappers().set(m_backForwardList.get(), this);
+
+ gClassCount++;
+}
+
+WebBackForwardList::~WebBackForwardList()
+{
+ ASSERT(m_backForwardList->closed());
+
+ ASSERT(backForwardListWrappers().contains(m_backForwardList.get()));
+ backForwardListWrappers().remove(m_backForwardList.get());
+
+ gClassCount--;
+}
+
+WebBackForwardList* WebBackForwardList::createInstance(PassRefPtr<BackForwardList> backForwardList)
+{
+ WebBackForwardList* instance;
+
+ instance = backForwardListWrappers().get(backForwardList.get());
+
+ if (!instance)
+ instance = new WebBackForwardList(backForwardList);
+
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebBackForwardList*>(this);
+ else if (IsEqualGUID(riid, IID_IWebBackForwardList))
+ *ppvObject = static_cast<IWebBackForwardList*>(this);
+ else if (IsEqualGUID(riid, IID_IWebBackForwardListPrivate))
+ *ppvObject = static_cast<IWebBackForwardListPrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebBackForwardList::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebBackForwardList::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebBackForwardList ---------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::addItem(
+ /* [in] */ IWebHistoryItem* item)
+{
+ COMPtr<WebHistoryItem> webHistoryItem;
+
+ if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
+ return E_FAIL;
+
+ m_backForwardList->addItem(webHistoryItem->historyItem());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::goBack( void)
+{
+ m_backForwardList->goBack();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::goForward( void)
+{
+ m_backForwardList->goForward();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::goToItem(
+ /* [in] */ IWebHistoryItem* item)
+{
+ COMPtr<WebHistoryItem> webHistoryItem;
+
+ if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
+ return E_FAIL;
+
+ m_backForwardList->goToItem(webHistoryItem->historyItem());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::backItem(
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ if (!item)
+ return E_POINTER;
+
+ HistoryItem* historyItem = m_backForwardList->backItem();
+
+ if (!historyItem)
+ return E_FAIL;
+
+ *item = WebHistoryItem::createInstance(historyItem);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::currentItem(
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ if (!item)
+ return E_POINTER;
+
+ HistoryItem* historyItem = m_backForwardList->currentItem();
+
+ if (!historyItem)
+ return E_FAIL;
+
+ *item = WebHistoryItem::createInstance(historyItem);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::forwardItem(
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ if (!item)
+ return E_POINTER;
+
+ HistoryItem* historyItem = m_backForwardList->forwardItem();
+
+ if (!historyItem)
+ return E_FAIL;
+
+ *item = WebHistoryItem::createInstance(historyItem);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::backListWithLimit(
+ /* [in] */ int limit,
+ /* [out] */ int* listCount,
+ /* [retval][out] */ IWebHistoryItem** list)
+{
+ HistoryItemVector historyItemVector;
+ m_backForwardList->backListWithLimit(limit, historyItemVector);
+
+ *listCount = static_cast<int>(historyItemVector.size());
+
+ if (list)
+ for (unsigned i = 0; i < historyItemVector.size(); i++)
+ list[i] = WebHistoryItem::createInstance(historyItemVector[i].get());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::forwardListWithLimit(
+ /* [in] */ int limit,
+ /* [out] */ int* listCount,
+ /* [retval][out] */ IWebHistoryItem** list)
+{
+ HistoryItemVector historyItemVector;
+ m_backForwardList->forwardListWithLimit(limit, historyItemVector);
+
+ *listCount = static_cast<int>(historyItemVector.size());
+
+ if (list)
+ for (unsigned i = 0; i < historyItemVector.size(); i++)
+ list[i] = WebHistoryItem::createInstance(historyItemVector[i].get());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::capacity(
+ /* [retval][out] */ int* result)
+{
+ *result = (int)m_backForwardList->capacity();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::setCapacity(
+ /* [in] */ int size)
+{
+ if (size < 0)
+ return E_FAIL;
+
+ m_backForwardList->setCapacity(size);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::backListCount(
+ /* [retval][out] */ int* count)
+{
+ *count = m_backForwardList->backListCount();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::forwardListCount(
+ /* [retval][out] */ int* count)
+{
+ *count = m_backForwardList->forwardListCount();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::containsItem(
+ /* [in] */ IWebHistoryItem* item,
+ /* [retval][out] */ BOOL* result)
+{
+ COMPtr<WebHistoryItem> webHistoryItem;
+
+ if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
+ return E_FAIL;
+
+ *result = m_backForwardList->containsItem(webHistoryItem->historyItem());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::itemAtIndex(
+ /* [in] */ int index,
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ if (!item)
+ return E_POINTER;
+
+ HistoryItem* historyItem = m_backForwardList->itemAtIndex(index);
+
+ if (!historyItem)
+ return E_FAIL;
+
+ *item = WebHistoryItem::createInstance(historyItem);
+ return S_OK;
+}
+
+// IWebBackForwardListPrivate --------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebBackForwardList::removeItem(
+ /* [in] */ IWebHistoryItem* item)
+{
+ COMPtr<WebHistoryItem> webHistoryItem;
+
+ if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
+ return E_FAIL;
+
+ m_backForwardList->removeItem(webHistoryItem->historyItem());
+ return S_OK;
+}
diff --git a/WebKit/win/WebBackForwardList.h b/WebKit/win/WebBackForwardList.h
new file mode 100644
index 0000000..9375193
--- /dev/null
+++ b/WebKit/win/WebBackForwardList.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBackForwardList_H
+#define WebBackForwardList_H
+
+#include "WebKit.h"
+
+#include "WebHistoryItem.h"
+
+#include <WTF/PassRefPtr.h>
+#include <WTF/RefPtr.h>
+
+namespace WebCore {
+ class BackForwardList;
+}
+
+class WebBackForwardList : public IWebBackForwardList, IWebBackForwardListPrivate
+{
+public:
+ static WebBackForwardList* createInstance(PassRefPtr<WebCore::BackForwardList>);
+protected:
+ WebBackForwardList(PassRefPtr<WebCore::BackForwardList>);
+ ~WebBackForwardList();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebBackForwardList
+ virtual HRESULT STDMETHODCALLTYPE addItem(
+ /* [in] */ IWebHistoryItem *item);
+
+ virtual HRESULT STDMETHODCALLTYPE goBack( void);
+
+ virtual HRESULT STDMETHODCALLTYPE goForward( void);
+
+ virtual HRESULT STDMETHODCALLTYPE goToItem(
+ /* [in] */ IWebHistoryItem *item);
+
+ virtual HRESULT STDMETHODCALLTYPE backItem(
+ /* [retval][out] */ IWebHistoryItem **item);
+
+ virtual HRESULT STDMETHODCALLTYPE currentItem(
+ /* [retval][out] */ IWebHistoryItem **item);
+
+ virtual HRESULT STDMETHODCALLTYPE forwardItem(
+ /* [retval][out] */ IWebHistoryItem **item);
+
+ virtual HRESULT STDMETHODCALLTYPE backListWithLimit(
+ /* [in] */ int limit,
+ /* [out] */ int *listCount,
+ /* [in] */ IWebHistoryItem **list);
+
+ virtual HRESULT STDMETHODCALLTYPE forwardListWithLimit(
+ /* [in] */ int limit,
+ /* [out] */ int *listCount,
+ /* [in] */ IWebHistoryItem **list);
+
+ virtual HRESULT STDMETHODCALLTYPE capacity(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setCapacity(
+ /* [in] */ int size);
+
+ virtual HRESULT STDMETHODCALLTYPE backListCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE forwardListCount(
+ /* [retval][out] */ int *sizecount);
+
+ virtual HRESULT STDMETHODCALLTYPE containsItem(
+ /* [in] */ IWebHistoryItem *item,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE itemAtIndex(
+ /* [in] */ int index,
+ /* [retval][out] */ IWebHistoryItem **item);
+
+ // IWebBackForwardListPrivate
+ virtual HRESULT STDMETHODCALLTYPE removeItem(
+ /* [in] */ IWebHistoryItem* item);
+
+ // WebBackForwardList
+
+protected:
+ ULONG m_refCount;
+ RefPtr<WebCore::BackForwardList> m_backForwardList;
+};
+
+#endif
diff --git a/WebKit/win/WebCache.cpp b/WebKit/win/WebCache.cpp
new file mode 100644
index 0000000..f974e23
--- /dev/null
+++ b/WebKit/win/WebCache.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebCache.h"
+
+#include "CFDictionaryPropertyBag.h"
+
+#pragma warning(push, 0)
+#include <WebCore/Cache.h>
+#pragma warning(pop)
+
+// WebCache ---------------------------------------------------------------------------
+
+WebCache::WebCache()
+: m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebCache::~WebCache()
+{
+ gClassCount--;
+}
+
+WebCache* WebCache::createInstance()
+{
+ WebCache* instance = new WebCache();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebCache::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<WebCache*>(this);
+ else if (IsEqualGUID(riid, IID_IWebCache))
+ *ppvObject = static_cast<WebCache*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebCache::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebCache::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebCache ------------------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebCache::statistics(
+ /* [in][out] */ int* count,
+ /* [retval][out] */ IPropertyBag ** s)
+{
+ if (!count || (s && *count < 2))
+ return E_FAIL;
+
+ *count = 2;
+ if (!s)
+ return S_OK;
+
+ WebCore::Cache::Statistics stat = WebCore::cache()->getStatistics();
+
+ static CFStringRef imagesKey = CFSTR("images");
+ static CFStringRef stylesheetsKey = CFSTR("style sheets");
+ static CFStringRef scriptsKey = CFSTR("scripts");
+
+ RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
+ CFDictionaryCreateMutable(0, 0, 0, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFNumberRef> value(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &stat.images.count));
+ CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
+
+ value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.count));
+ CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
+
+ value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.count));
+ CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
+
+ CFDictionaryPropertyBag* propBag = CFDictionaryPropertyBag::createInstance();
+ propBag->setDictionary(dictionary.get());
+ s[0] = propBag;
+
+ dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, 0, &kCFTypeDictionaryValueCallBacks));
+
+ value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.size));
+ CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
+
+ value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.size));
+ CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
+
+ value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.size));
+ CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
+
+ propBag = CFDictionaryPropertyBag::createInstance();
+ propBag->setDictionary(dictionary.get());
+ s[1] = propBag;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebCache::empty( void)
+{
+ if (WebCore::cache()->disabled())
+ return S_OK;
+ WebCore::cache()->setDisabled(true);
+ WebCore::cache()->setDisabled(false);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebCache::setDisabled(
+ /* [in] */ BOOL disabled)
+{
+ WebCore::cache()->setDisabled(!!disabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebCache::disabled(
+ /* [out][retval] */ BOOL* disabled)
+{
+ if (!disabled)
+ return E_POINTER;
+ *disabled = WebCore::cache()->disabled();
+ return S_OK;
+}
diff --git a/WebKit/win/WebCache.h b/WebKit/win/WebCache.h
new file mode 100644
index 0000000..89575cf
--- /dev/null
+++ b/WebKit/win/WebCache.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCache_H
+#define WebCache_H
+
+#include "WebKit.h"
+
+class WebCache : public IWebCache
+{
+public:
+ static WebCache* createInstance();
+protected:
+ WebCache();
+ ~WebCache();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebCache
+ virtual HRESULT STDMETHODCALLTYPE statistics(
+ /* [in][out] */ int* count,
+ /* [retval][out] */ IPropertyBag **s);
+
+ virtual HRESULT STDMETHODCALLTYPE empty( void);
+
+ virtual HRESULT STDMETHODCALLTYPE setDisabled(
+ /* [in] */ BOOL disabled);
+
+ virtual HRESULT STDMETHODCALLTYPE disabled(
+ /* [out][retval] */ BOOL*);
+
+protected:
+ ULONG m_refCount;
+};
+
+#endif
diff --git a/WebKit/win/WebCachedPagePlatformData.h b/WebKit/win/WebCachedPagePlatformData.h
new file mode 100644
index 0000000..f5a5388
--- /dev/null
+++ b/WebKit/win/WebCachedPagePlatformData.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebCachedPagePlatformData_h
+#define WebCachedPagePlatformData_h
+
+#include "WebDataSource.h"
+
+#include <WebCore/CachedPagePlatformData.h>
+
+class WebCachedPagePlatformData : public WebCore::CachedPagePlatformData {
+public:
+ WebCachedPagePlatformData(IWebDataSource* webDataSource) : m_webDataSource(webDataSource) { }
+
+ IWebDataSource* webDataSource() { return m_webDataSource.get(); }
+
+private:
+ COMPtr<IWebDataSource> m_webDataSource;
+};
+
+#endif // CachedPagePlatformData_h
diff --git a/WebKit/win/WebCoreLocalizedStrings.cpp b/WebKit/win/WebCoreLocalizedStrings.cpp
new file mode 100644
index 0000000..aceea5c
--- /dev/null
+++ b/WebKit/win/WebCoreLocalizedStrings.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebLocalizableStrings.h"
+#include <WebCore/IntSize.h>
+#include <WebCore/LocalizedStrings.h>
+#include <WebCore/PlatformString.h>
+#include <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
+String WebCore::searchableIndexIntroduction() { return String(LPCTSTR_UI_STRING("This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'")); }
+String WebCore::submitButtonDefaultLabel() { return String(LPCTSTR_UI_STRING("Submit", "default label for Submit buttons in forms on web pages")); }
+String WebCore::inputElementAltText() { return String(LPCTSTR_UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value")); }
+String WebCore::resetButtonDefaultLabel() { return String(LPCTSTR_UI_STRING("Reset", "default label for Reset buttons in forms on web pages")); }
+String WebCore::fileButtonChooseFileLabel() { return String(LPCTSTR_UI_STRING("Choose File", "title for file button used in HTML forms")); }
+String WebCore::fileButtonNoFileSelectedLabel() { return String(LPCTSTR_UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected")); }
+String WebCore::contextMenuItemTagOpenLinkInNewWindow() { return String(LPCTSTR_UI_STRING("Open Link in New Window", "Open in New Window context menu item")); }
+String WebCore::contextMenuItemTagDownloadLinkToDisk() { return String(LPCTSTR_UI_STRING("Download Linked File", "Download Linked File context menu item")); }
+String WebCore::contextMenuItemTagCopyLinkToClipboard() { return String(LPCTSTR_UI_STRING("Copy Link", "Copy Link context menu item")); }
+String WebCore::contextMenuItemTagOpenImageInNewWindow() { return String(LPCTSTR_UI_STRING("Open Image in New Window", "Open Image in New Window context menu item")); }
+String WebCore::contextMenuItemTagDownloadImageToDisk() { return String(LPCTSTR_UI_STRING("Download Image", "Download Image context menu item")); }
+String WebCore::contextMenuItemTagCopyImageToClipboard() { return String(LPCTSTR_UI_STRING("Copy Image", "Copy Image context menu item")); }
+String WebCore::contextMenuItemTagOpenFrameInNewWindow() { return String(LPCTSTR_UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item")); }
+String WebCore::contextMenuItemTagCopy() { return String(LPCTSTR_UI_STRING("Copy", "Copy context menu item")); }
+String WebCore::contextMenuItemTagGoBack() { return String(LPCTSTR_UI_STRING("Back", "Back context menu item")); }
+String WebCore::contextMenuItemTagGoForward() { return String(LPCTSTR_UI_STRING("Forward", "Forward context menu item")); }
+String WebCore::contextMenuItemTagStop() { return String(LPCTSTR_UI_STRING("Stop", "Stop context menu item")); }
+String WebCore::contextMenuItemTagReload() { return String(LPCTSTR_UI_STRING("Reload", "Reload context menu item")); }
+String WebCore::contextMenuItemTagCut() { return String(LPCTSTR_UI_STRING("Cut", "Cut context menu item")); }
+String WebCore::contextMenuItemTagPaste() { return String(LPCTSTR_UI_STRING("Paste", "Paste context menu item")); }
+String WebCore::contextMenuItemTagNoGuessesFound() { return String(LPCTSTR_UI_STRING("No Guesses Found", "No Guesses Found context menu item")); }
+String WebCore::contextMenuItemTagIgnoreSpelling() { return String(LPCTSTR_UI_STRING("Ignore Spelling", "Ignore Spelling context menu item")); }
+String WebCore::contextMenuItemTagLearnSpelling() { return String(LPCTSTR_UI_STRING("Learn Spelling", "Learn Spelling context menu item")); }
+String WebCore::contextMenuItemTagSearchWeb() { return String(LPCTSTR_UI_STRING("Search with Google", "Search in Google context menu item")); }
+String WebCore::contextMenuItemTagLookUpInDictionary() { return String(LPCTSTR_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item")); }
+String WebCore::contextMenuItemTagOpenLink() { return String(LPCTSTR_UI_STRING("Open Link", "Open Link context menu item")); }
+String WebCore::contextMenuItemTagIgnoreGrammar() { return String(LPCTSTR_UI_STRING("Ignore Grammar", "Ignore Grammar context menu item")); }
+String WebCore::contextMenuItemTagSpellingMenu() { return String(LPCTSTR_UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item")); }
+String WebCore::contextMenuItemTagCheckSpelling() { return String(LPCTSTR_UI_STRING("Check Document Now", "Check spelling context menu item")); }
+String WebCore::contextMenuItemTagCheckSpellingWhileTyping() { return String(LPCTSTR_UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item")); }
+String WebCore::contextMenuItemTagCheckGrammarWithSpelling() { return String(LPCTSTR_UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item")); }
+String WebCore::contextMenuItemTagFontMenu() { return String(LPCTSTR_UI_STRING("Font", "Font context sub-menu item")); }
+String WebCore::contextMenuItemTagBold() { return String(LPCTSTR_UI_STRING("Bold", "Bold context menu item")); }
+String WebCore::contextMenuItemTagItalic() { return String(LPCTSTR_UI_STRING("Italic", "Italic context menu item")); }
+String WebCore::contextMenuItemTagUnderline() { return String(LPCTSTR_UI_STRING("Underline", "Underline context menu item")); }
+String WebCore::contextMenuItemTagOutline() { return String(LPCTSTR_UI_STRING("Outline", "Outline context menu item")); }
+String WebCore::contextMenuItemTagWritingDirectionMenu() { return String(LPCTSTR_UI_STRING("Writing Direction", "Writing direction context sub-menu item")); }
+String WebCore::contextMenuItemTagDefaultDirection() { return String(LPCTSTR_UI_STRING("Default", "Default writing direction context menu item")); }
+String WebCore::contextMenuItemTagLeftToRight() { return String(LPCTSTR_UI_STRING("Left to Right", "Left to Right context menu item")); }
+String WebCore::contextMenuItemTagRightToLeft() { return String(LPCTSTR_UI_STRING("Right to Left", "Right to Left context menu item")); }
+String WebCore::contextMenuItemTagShowSpellingPanel(bool show) { return String(show ? LPCTSTR_UI_STRING("Show Spelling and Grammar", "menu item title") : LPCTSTR_UI_STRING("Hide Spelling and Grammar", "menu item title")); }
+String WebCore::contextMenuItemTagInspectElement() { return String(LPCTSTR_UI_STRING("Inspect Element", "Inspect Element context menu item")); }
+String WebCore::searchMenuNoRecentSearchesText() { return String(LPCTSTR_UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed")); }
+String WebCore::searchMenuRecentSearchesText() { return String(LPCTSTR_UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title")); }
+String WebCore::searchMenuClearRecentSearchesText() { return String(LPCTSTR_UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents")); }
+String WebCore::AXWebAreaText() { return String(LPCTSTR_UI_STRING("web area", "accessibility role description for web area")); }
+String WebCore::AXLinkText() { return String(LPCTSTR_UI_STRING("link", "accessibility role description for link")); }
+String WebCore::AXListMarkerText() { return String(LPCTSTR_UI_STRING("list marker", "accessibility role description for list marker")); }
+String WebCore::AXImageMapText() { return String(LPCTSTR_UI_STRING("image map", "accessibility role description for image map")); }
+String WebCore::AXHeadingText() { return String(LPCTSTR_UI_STRING("heading", "accessibility role description for headings")); }
+String WebCore::unknownFileSizeText() { return String(LPCTSTR_UI_STRING("Unknown", "Unknown filesize FTP directory listing item")); }
+String WebCore::uploadFileText() { return String(LPCTSTR_UI_STRING("Upload file", "(Windows) Form submit file upload dialog title")); }
+String WebCore::allFilesText() { return String(LPCTSTR_UI_STRING("All Files", "(Windows) Form submit file upload all files pop-up")); }
+
+String WebCore::imageTitle(const String& filename, const IntSize& size)
+{
+ static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"));
+
+ RetainPtr<CFStringRef> filenameCF(AdoptCF, filename.createCFString());
+ RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), filenameCF.get(), size.width(), size.height()));
+
+ return result.get();
+}
diff --git a/WebKit/win/WebCoreSupport/FormValuesPropertyBag.cpp b/WebKit/win/WebCoreSupport/FormValuesPropertyBag.cpp
new file mode 100644
index 0000000..56bdd74
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/FormValuesPropertyBag.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "FormValuesPropertyBag.h"
+
+using namespace WebCore;
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag2))
+ *ppvObject = static_cast<IPropertyBag2*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE FormValuesPropertyBag::AddRef(void)
+{
+ return 1;
+}
+
+ULONG STDMETHODCALLTYPE FormValuesPropertyBag::Release(void)
+{
+ return 0;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* /*pErrorLog*/)
+{
+ HRESULT hr = S_OK;
+
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+
+ String key(pszPropName);
+ if (!m_formValues->contains(key))
+ return E_INVALIDARG;
+
+ String value = m_formValues->get(key);
+
+ VARTYPE requestedType = V_VT(pVar);
+ VariantClear(pVar);
+ V_VT(pVar) = VT_BSTR;
+ V_BSTR(pVar) = SysAllocStringLen(value.characters(), value.length());
+ if (value.length() && !V_BSTR(pVar))
+ return E_OUTOFMEMORY;
+
+ if (requestedType != VT_BSTR && requestedType != VT_EMPTY)
+ hr = VariantChangeType(pVar, pVar, VARIANT_NOUSEROVERRIDE | VARIANT_ALPHABOOL, requestedType);
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+ VariantClear(pVar);
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::Read(
+ /* [in] */ ULONG cProperties,
+ /* [in] */ PROPBAG2* pPropBag,
+ /* [in] */ IErrorLog* pErrLog,
+ /* [out] */ VARIANT* pvarValue,
+ /* [out] */ HRESULT* phrError)
+{
+ if (cProperties > (size_t)m_formValues->size())
+ return E_INVALIDARG;
+ if (!pPropBag || !pvarValue || !phrError)
+ return E_POINTER;
+
+ for (ULONG i=0; i<cProperties; i++) {
+ VariantInit(&pvarValue[i]);
+ phrError[i] = Read(pPropBag->pstrName, &pvarValue[i], pErrLog);
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::Write(
+ /* [in] */ ULONG /*cProperties*/,
+ /* [in] */ PROPBAG2* pPropBag,
+ /* [in] */ VARIANT* pvarValue)
+{
+ if (!pPropBag || !pvarValue)
+ return E_POINTER;
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::CountProperties(
+ /* [out] */ ULONG* pcProperties)
+{
+ *pcProperties = m_formValues->size();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::GetPropertyInfo(
+ /* [in] */ ULONG iProperty,
+ /* [in] */ ULONG cProperties,
+ /* [out] */ PROPBAG2* pPropBag,
+ /* [out] */ ULONG* pcProperties)
+{
+ if (iProperty > (size_t)m_formValues->size() || iProperty+cProperties > (size_t)m_formValues->size())
+ return E_INVALIDARG;
+ if (!pPropBag || !pcProperties)
+ return E_POINTER;
+
+ *pcProperties = 0;
+ ULONG i = 0;
+ ULONG endProperty = iProperty + cProperties;
+ for (HashMap<String, String>::iterator it = m_formValues->begin(); i<endProperty; i++) {
+ if (i >= iProperty) {
+ int storeIndex = (*pcProperties)++;
+ pPropBag[storeIndex].dwType = PROPBAG2_TYPE_DATA;
+ pPropBag[storeIndex].vt = VT_BSTR;
+ pPropBag[storeIndex].cfType = CF_TEXT;
+ pPropBag[storeIndex].dwHint = 0;
+ pPropBag[storeIndex].pstrName = const_cast<LPOLESTR>(it->first.charactersWithNullTermination());
+ }
+ ++it;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE FormValuesPropertyBag::LoadObject(
+ /* [in] */ LPCOLESTR pstrName,
+ /* [in] */ DWORD /*dwHint*/,
+ /* [in] */ IUnknown* pUnkObject,
+ /* [in] */ IErrorLog* /*pErrLog*/)
+{
+ if (!pstrName || !pUnkObject)
+ return E_POINTER;
+ return E_FAIL;
+}
diff --git a/WebKit/win/WebCoreSupport/FormValuesPropertyBag.h b/WebKit/win/WebCoreSupport/FormValuesPropertyBag.h
new file mode 100644
index 0000000..89dc728
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/FormValuesPropertyBag.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 FormValuesPropertyBag_h
+#define FormValuesPropertyBag_h
+
+#pragma warning(push, 0)
+#include <WebCore/StringHash.h>
+#pragma warning(pop)
+#include <wtf/HashMap.h>
+
+class FormValuesPropertyBag : public IPropertyBag, public IPropertyBag2 {
+public:
+ FormValuesPropertyBag(HashMap<WebCore::String, WebCore::String>* formValues)
+ : m_formValues(formValues)
+ {
+ }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IPropertyBag
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [out][in] */ VARIANT*,
+ /* [in] */ IErrorLog*);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [in] */ VARIANT*);
+
+ // IPropertyBag2
+ virtual HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ ULONG cProperties,
+ /* [in] */ PROPBAG2*,
+ /* [in] */ IErrorLog*,
+ /* [out] */ VARIANT* pvarValue,
+ /* [out] */ HRESULT* phrError);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ ULONG cProperties,
+ /* [in] */ PROPBAG2*,
+ /* [in] */ VARIANT*);
+
+ virtual HRESULT STDMETHODCALLTYPE CountProperties(
+ /* [out] */ ULONG* pcProperties);
+
+ virtual HRESULT STDMETHODCALLTYPE GetPropertyInfo(
+ /* [in] */ ULONG iProperty,
+ /* [in] */ ULONG cProperties,
+ /* [out] */ PROPBAG2* pPropBag,
+ /* [out] */ ULONG* pcProperties);
+
+ virtual HRESULT STDMETHODCALLTYPE LoadObject(
+ /* [in] */ LPCOLESTR pstrName,
+ /* [in] */ DWORD dwHint,
+ /* [in] */ IUnknown*,
+ /* [in] */ IErrorLog*);
+
+protected:
+ HashMap<WebCore::String, WebCore::String>* m_formValues;
+};
+
+#endif // FormValuesPropertyBag_h
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
new file mode 100644
index 0000000..ce8d6de
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
@@ -0,0 +1,514 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebChromeClient.h"
+
+#include "WebElementPropertyBag.h"
+#include "WebFrame.h"
+#include "WebMutableURLRequest.h"
+#include "WebSecurityOrigin.h"
+#include "WebView.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/ContextMenu.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/FrameLoadRequest.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/WindowFeatures.h>
+#pragma warning(pop)
+
+#include <tchar.h>
+
+using namespace WebCore;
+
+WebChromeClient::WebChromeClient(WebView* webView)
+ : m_webView(webView)
+{
+}
+
+void WebChromeClient::chromeDestroyed()
+{
+ delete this;
+}
+
+void WebChromeClient::setWindowRect(const FloatRect& r)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ RECT rect = IntRect(r);
+ uiDelegate->setFrame(m_webView, &rect);
+ uiDelegate->Release();
+ }
+}
+
+FloatRect WebChromeClient::windowRect()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ RECT rect;
+ HRESULT retval = uiDelegate->webViewFrame(m_webView, &rect);
+
+ uiDelegate->Release();
+
+ if (SUCCEEDED(retval))
+ return rect;
+ }
+
+ return FloatRect();
+}
+
+FloatRect WebChromeClient::pageRect()
+{
+ RECT rect;
+ m_webView->frameRect(&rect);
+ return rect;
+}
+
+float WebChromeClient::scaleFactor()
+{
+ // Windows doesn't support UI scaling.
+ return 1.0;
+}
+
+void WebChromeClient::focus()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->webViewFocus(m_webView);
+ uiDelegate->Release();
+ }
+}
+
+void WebChromeClient::unfocus()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->webViewUnfocus(m_webView);
+ uiDelegate->Release();
+ }
+}
+
+bool WebChromeClient::canTakeFocus(FocusDirection direction)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ BOOL bForward = (direction == FocusDirectionForward) ? TRUE : FALSE;
+ BOOL result = FALSE;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->canTakeFocus(m_webView, bForward, &result);
+ uiDelegate->Release();
+ }
+
+ return !!result;
+}
+
+void WebChromeClient::takeFocus(FocusDirection direction)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ BOOL bForward = (direction == FocusDirectionForward) ? TRUE : FALSE;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->takeFocus(m_webView, bForward);
+ uiDelegate->Release();
+ }
+}
+
+Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features)
+{
+ if (features.dialog) {
+ COMPtr<IWebUIDelegate3> delegate = uiDelegate3();
+ if (!delegate)
+ return 0;
+ COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest()));
+ COMPtr<IWebView> dialog;
+ if (FAILED(delegate->createModalDialog(m_webView, request.get(), &dialog)))
+ return 0;
+ return core(dialog.get());
+ }
+
+ Page* page = 0;
+ IWebUIDelegate* uiDelegate = 0;
+ IWebMutableURLRequest* request = WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest());
+
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ IWebView* webView = 0;
+ if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) {
+ page = core(webView);
+ webView->Release();
+ }
+
+ uiDelegate->Release();
+ }
+
+ request->Release();
+ return page;
+}
+
+void WebChromeClient::show()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->webViewShow(m_webView);
+ uiDelegate->Release();
+ }
+}
+
+bool WebChromeClient::canRunModal()
+{
+ BOOL result = FALSE;
+ if (COMPtr<IWebUIDelegate3> delegate = uiDelegate3())
+ delegate->canRunModal(m_webView, &result);
+ return result;
+}
+
+void WebChromeClient::runModal()
+{
+ if (COMPtr<IWebUIDelegate3> delegate = uiDelegate3())
+ delegate->runModal(m_webView);
+}
+
+void WebChromeClient::setToolbarsVisible(bool visible)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->setToolbarsVisible(m_webView, visible);
+ uiDelegate->Release();
+ }
+}
+
+bool WebChromeClient::toolbarsVisible()
+{
+ BOOL result = false;
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->webViewAreToolbarsVisible(m_webView, &result);
+ uiDelegate->Release();
+ }
+ return result != false;
+}
+
+void WebChromeClient::setStatusbarVisible(bool visible)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->setStatusBarVisible(m_webView, visible);
+ uiDelegate->Release();
+ }
+}
+
+bool WebChromeClient::statusbarVisible()
+{
+ BOOL result = false;
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->webViewIsStatusBarVisible(m_webView, &result);
+ uiDelegate->Release();
+ }
+ return result != false;
+}
+
+void WebChromeClient::setScrollbarsVisible(bool b)
+{
+ WebFrame* webFrame = m_webView->topLevelFrame();
+ if (webFrame) {
+ webFrame->setAllowsScrolling(b);
+ FrameView* frameView = core(webFrame)->view();
+ frameView->setHScrollbarMode(frameView->hScrollbarMode()); // I know this looks weird but the call to v/hScrollbarMode goes to ScrollView
+ frameView->setVScrollbarMode(frameView->vScrollbarMode()); // and the call to setV/hScrollbarMode goes to FrameView.
+ // This oddity is a result of matching a design in the mac code.
+ }
+}
+
+bool WebChromeClient::scrollbarsVisible()
+{
+ WebFrame* webFrame = m_webView->topLevelFrame();
+ BOOL b = false;
+ if (webFrame)
+ webFrame->allowsScrolling(&b);
+
+ return !!b;
+}
+
+void WebChromeClient::setMenubarVisible(bool visible)
+{
+ COMPtr<IWebUIDelegate3> delegate = uiDelegate3();
+ if (!delegate)
+ return;
+ delegate->setMenuBarVisible(m_webView, visible);
+}
+
+bool WebChromeClient::menubarVisible()
+{
+ COMPtr<IWebUIDelegate3> delegate = uiDelegate3();
+ if (!delegate)
+ return true;
+ BOOL result = true;
+ delegate->isMenuBarVisible(m_webView, &result);
+ return result;
+}
+
+void WebChromeClient::setResizable(bool resizable)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->setResizable(m_webView, resizable);
+ uiDelegate->Release();
+ }
+}
+
+void WebChromeClient::addMessageToConsole(const String& message, unsigned line, const String& url)
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ COMPtr<IWebUIDelegatePrivate> uiPrivate;
+ if (SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate)))
+ uiPrivate->webViewAddMessageToConsole(m_webView, BString(message), line, BString(url), true);
+ }
+}
+
+bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
+{
+ IWebUIDelegate* ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui)) && ui) {
+ ui->Release();
+ return true;
+ }
+ return false;
+}
+
+bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
+{
+ BOOL result = TRUE;
+ IWebUIDelegate* ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui)) && ui) {
+ WebFrame* webFrame = kit(frame);
+ ui->runBeforeUnloadConfirmPanelWithMessage(m_webView, BString(message), webFrame, &result);
+ ui->Release();
+ }
+ return !!result;
+}
+
+void WebChromeClient::closeWindowSoon()
+{
+ // We need to remove the parent WebView from WebViewSets here, before it actually
+ // closes, to make sure that JavaScript code that executes before it closes
+ // can't find it. Otherwise, window.open will select a closed WebView instead of
+ // opening a new one <rdar://problem/3572585>.
+
+ // We also need to stop the load to prevent further parsing or JavaScript execution
+ // after the window has torn down <rdar://problem/4161660>.
+
+ // FIXME: This code assumes that the UI delegate will respond to a webViewClose
+ // message by actually closing the WebView. Safari guarantees this behavior, but other apps might not.
+ // This approach is an inherent limitation of not making a close execute immediately
+ // after a call to window.close.
+
+ m_webView->setGroupName(0);
+ m_webView->stopLoading(0);
+ m_webView->closeWindowSoon();
+}
+
+void WebChromeClient::runJavaScriptAlert(Frame*, const String& message)
+{
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui)))
+ ui->runJavaScriptAlertPanelWithMessage(m_webView, BString(message));
+}
+
+bool WebChromeClient::runJavaScriptConfirm(Frame*, const String& message)
+{
+ BOOL result = FALSE;
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui)))
+ ui->runJavaScriptConfirmPanelWithMessage(m_webView, BString(message), &result);
+ return !!result;
+}
+
+bool WebChromeClient::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result)
+{
+ COMPtr<IWebUIDelegate> ui;
+ if (FAILED(m_webView->uiDelegate(&ui)))
+ return false;
+
+ TimerBase::fireTimersInNestedEventLoop();
+
+ BSTR resultBSTR = 0;
+ if (FAILED(ui->runJavaScriptTextInputPanelWithPrompt(m_webView, BString(message), BString(defaultValue), &resultBSTR)))
+ return false;
+
+ if (resultBSTR) {
+ result = String(resultBSTR, SysStringLen(resultBSTR));
+ SysFreeString(resultBSTR);
+ return true;
+ }
+
+ return false;
+}
+
+void WebChromeClient::setStatusbarText(const String& statusText)
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->setStatusText(m_webView, BString(statusText));
+ }
+}
+
+bool WebChromeClient::shouldInterruptJavaScript()
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ COMPtr<IWebUIDelegatePrivate> uiPrivate;
+ if (SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) {
+ BOOL result;
+ if (SUCCEEDED(uiPrivate->webViewShouldInterruptJavaScript(m_webView, &result)))
+ return !!result;
+ }
+ }
+ return false;
+}
+
+bool WebChromeClient::tabsToLinks() const
+{
+ BOOL enabled = FALSE;
+ IWebPreferences* preferences;
+ if (SUCCEEDED(m_webView->preferences(&preferences)))
+ preferences->tabsToLinks(&enabled);
+
+ return !!enabled;
+}
+
+IntRect WebChromeClient::windowResizerRect() const
+{
+ IntRect intRect;
+
+ IWebUIDelegate* ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui)) && ui) {
+ IWebUIDelegatePrivate* uiPrivate;
+ if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) {
+ RECT r;
+ if (SUCCEEDED(uiPrivate->webViewResizerRect(m_webView, &r)))
+ intRect = IntRect(r.left, r.top, r.right-r.left, r.bottom-r.top);
+ uiPrivate->Release();
+ }
+ ui->Release();
+ }
+ return intRect;
+}
+
+void WebChromeClient::addToDirtyRegion(const IntRect& dirtyRect)
+{
+ m_webView->addToDirtyRegion(dirtyRect);
+}
+
+void WebChromeClient::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
+{
+ ASSERT(core(m_webView->topLevelFrame()));
+
+ m_webView->scrollBackingStore(core(m_webView->topLevelFrame())->view(), dx, dy, scrollViewRect, clipRect);
+}
+
+void WebChromeClient::updateBackingStore()
+{
+ ASSERT(core(m_webView->topLevelFrame()));
+
+ m_webView->updateBackingStore(core(m_webView->topLevelFrame())->view(), 0, false);
+}
+
+void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (FAILED(m_webView->uiDelegate(&uiDelegate)))
+ return;
+
+ COMPtr<WebElementPropertyBag> element;
+ element.adoptRef(WebElementPropertyBag::createInstance(result));
+
+ uiDelegate->mouseDidMoveOverElement(m_webView, element.get(), modifierFlags);
+}
+
+void WebChromeClient::setToolTip(const String& toolTip)
+{
+ m_webView->setToolTip(toolTip);
+}
+
+void WebChromeClient::print(Frame* frame)
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ COMPtr<IWebUIDelegate2> uiDelegate2;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate)))
+ if (SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegate2, (void**)&uiDelegate2)))
+ uiDelegate2->printFrame(m_webView, kit(frame));
+}
+
+void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseIdentifier)
+{
+ COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(frame->document()->securityOrigin()));
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ COMPtr<IWebUIDelegatePrivate3> uiDelegatePrivate3(Query, uiDelegate);
+ if (uiDelegatePrivate3)
+ uiDelegatePrivate3->exceededDatabaseQuota(m_webView, kit(frame), origin.get(), BString(databaseIdentifier));
+ else {
+ // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
+ TCHAR path[MAX_PATH];
+ HMODULE safariHandle = GetModuleHandle(TEXT("Safari.exe"));
+ if (!safariHandle)
+ return;
+ GetModuleFileName(safariHandle, path, ARRAYSIZE(path));
+ DWORD handle;
+ DWORD versionSize = GetFileVersionInfoSize(path, &handle);
+ if (!versionSize)
+ return;
+ Vector<char> data(versionSize);
+ if (!GetFileVersionInfo(path, 0, versionSize, data.data()))
+ return;
+
+ LPCTSTR productVersion;
+ UINT productVersionLength;
+ if (!VerQueryValue(data.data(), TEXT("\\StringFileInfo\\040904b0\\ProductVersion"), (void**)&productVersion, &productVersionLength))
+ return;
+ if (_tcsncmp(TEXT("3.1"), productVersion, productVersionLength) > 0) {
+ const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
+ origin->setQuota(defaultQuota);
+ }
+ }
+ }
+}
+
+COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate()
+{
+ COMPtr<IWebUIDelegate> delegate;
+ m_webView->uiDelegate(&delegate);
+ return delegate;
+}
+
+COMPtr<IWebUIDelegate2> WebChromeClient::uiDelegate2()
+{
+ return COMPtr<IWebUIDelegate2>(Query, uiDelegate());
+}
+
+COMPtr<IWebUIDelegate3> WebChromeClient::uiDelegate3()
+{
+ return COMPtr<IWebUIDelegate3>(Query, uiDelegate());
+}
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h
new file mode 100644
index 0000000..6132475
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <WebCore/ChromeClient.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/FocusDirection.h>
+#include <wtf/Forward.h>
+
+class WebView;
+
+interface IWebUIDelegate;
+interface IWebUIDelegate2;
+interface IWebUIDelegate3;
+
+class WebChromeClient : public WebCore::ChromeClient {
+public:
+ WebChromeClient(WebView*);
+
+ virtual void chromeDestroyed();
+
+ virtual void setWindowRect(const WebCore::FloatRect&);
+ virtual WebCore::FloatRect windowRect();
+
+ virtual WebCore::FloatRect pageRect();
+
+ virtual float scaleFactor();
+
+ virtual void focus();
+ virtual void unfocus();
+
+ virtual bool canTakeFocus(WebCore::FocusDirection);
+ virtual void takeFocus(WebCore::FocusDirection);
+
+ virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
+ virtual void show();
+
+ virtual bool canRunModal();
+ virtual void runModal();
+
+ virtual void setToolbarsVisible(bool);
+ virtual bool toolbarsVisible();
+
+ virtual void setStatusbarVisible(bool);
+ virtual bool statusbarVisible();
+
+ virtual void setScrollbarsVisible(bool);
+ virtual bool scrollbarsVisible();
+
+ virtual void setMenubarVisible(bool);
+ virtual bool menubarVisible();
+
+ virtual void setResizable(bool);
+
+ virtual void addMessageToConsole(const WebCore::String& message, unsigned line, const WebCore::String& url);
+
+ virtual bool canRunBeforeUnloadConfirmPanel();
+ virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, WebCore::Frame* frame);
+
+ virtual void closeWindowSoon();
+
+ virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
+ virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
+ virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
+ virtual void setStatusbarText(const WebCore::String&);
+ virtual bool shouldInterruptJavaScript();
+
+ virtual bool tabsToLinks() const;
+ virtual WebCore::IntRect windowResizerRect() const;
+ virtual void addToDirtyRegion(const WebCore::IntRect&);
+ virtual void scrollBackingStore(int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
+ virtual void updateBackingStore();
+
+ virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
+
+ virtual void setToolTip(const WebCore::String&);
+
+ virtual void print(WebCore::Frame*);
+
+ virtual void exceededDatabaseQuota(WebCore::Frame*, const WebCore::String&);
+
+ virtual WebView* webView() const { return m_webView; }
+
+private:
+ COMPtr<IWebUIDelegate> uiDelegate();
+ COMPtr<IWebUIDelegate2> uiDelegate2();
+ COMPtr<IWebUIDelegate3> uiDelegate3();
+
+ WebView* m_webView;
+};
diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
new file mode 100644
index 0000000..349d1b3
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebContextMenuClient.h"
+
+#include "WebDownload.h"
+#include "WebElementPropertyBag.h"
+#include "WebLocalizableStrings.h"
+#include "WebView.h"
+
+#pragma warning(push, 0)
+#include <WebCore/ContextMenu.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameLoadRequest.h>
+#include <WebCore/Page.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/NotImplemented.h>
+#pragma warning(pop)
+
+#include <tchar.h>
+
+using namespace WebCore;
+
+WebContextMenuClient::WebContextMenuClient(WebView* webView)
+ : m_webView(webView)
+{
+}
+
+void WebContextMenuClient::contextMenuDestroyed()
+{
+ delete this;
+}
+
+static bool isPreInspectElementTagSafari(IWebUIDelegate* uiDelegate)
+{
+ if (!uiDelegate)
+ return false;
+
+ // We assume anyone who implements IWebUIDelegate2 also knows about the Inspect Element item.
+ COMPtr<IWebUIDelegate2> uiDelegate2;
+ if (SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegate2, (void**)&uiDelegate2)))
+ return false;
+
+ TCHAR modulePath[MAX_PATH];
+ DWORD length = ::GetModuleFileName(0, modulePath, _countof(modulePath));
+ if (!length)
+ return false;
+
+ return String(modulePath, length).endsWith("Safari.exe", false);
+}
+
+static HMENU fixMenuReceivedFromOldSafari(IWebUIDelegate* uiDelegate, ContextMenu* originalMenu, HMENU menuFromClient)
+{
+ ASSERT_ARG(originalMenu, originalMenu);
+ if (!isPreInspectElementTagSafari(uiDelegate))
+ return menuFromClient;
+
+ int count = ::GetMenuItemCount(originalMenu->platformDescription());
+ if (count < 1)
+ return menuFromClient;
+
+ if (::GetMenuItemID(originalMenu->platformDescription(), count - 1) != WebMenuItemTagInspectElement)
+ return menuFromClient;
+
+ count = ::GetMenuItemCount(menuFromClient);
+ if (count < 1)
+ return menuFromClient;
+
+ if (::GetMenuItemID(menuFromClient, count - 1) == WebMenuItemTagInspectElement)
+ return menuFromClient;
+
+ originalMenu->setPlatformDescription(menuFromClient);
+ originalMenu->addInspectElementItem();
+ return originalMenu->platformDescription();
+}
+
+HMENU WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu)
+{
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (FAILED(m_webView->uiDelegate(&uiDelegate)))
+ return menu->platformDescription();
+
+ ASSERT(uiDelegate);
+
+ HMENU newMenu = 0;
+ COMPtr<WebElementPropertyBag> propertyBag;
+ propertyBag.adoptRef(WebElementPropertyBag::createInstance(menu->hitTestResult()));
+ // FIXME: We need to decide whether to do the default before calling this delegate method
+ if (FAILED(uiDelegate->contextMenuItemsForElement(m_webView, propertyBag.get(), (OLE_HANDLE)(ULONG64)menu->platformDescription(), (OLE_HANDLE*)&newMenu)))
+ return menu->platformDescription();
+ return fixMenuReceivedFromOldSafari(uiDelegate.get(), menu, newMenu);
+}
+
+void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem* item, const ContextMenu* parentMenu)
+{
+ ASSERT(item->type() == ActionType || item->type() == CheckableActionType);
+
+ COMPtr<IWebUIDelegate> uiDelegate;
+ if (FAILED(m_webView->uiDelegate(&uiDelegate)))
+ return;
+
+ ASSERT(uiDelegate);
+
+ COMPtr<WebElementPropertyBag> propertyBag;
+ propertyBag.adoptRef(WebElementPropertyBag::createInstance(parentMenu->hitTestResult()));
+
+ uiDelegate->contextMenuItemSelected(m_webView, item->releasePlatformDescription(), propertyBag.get());
+}
+
+void WebContextMenuClient::downloadURL(const KURL& url)
+{
+ COMPtr<IWebDownloadDelegate> downloadDelegate;
+ if (FAILED(m_webView->downloadDelegate(&downloadDelegate))) {
+ // If the WebView doesn't successfully provide a download delegate we'll pass a null one
+ // into the WebDownload - which may or may not decide to use a DefaultDownloadDelegate
+ LOG_ERROR("Failed to get downloadDelegate from WebView");
+ downloadDelegate = 0;
+ }
+
+ // Its the delegate's job to ref the WebDownload to keep it alive - otherwise it will be destroyed
+ // when this method returns
+ COMPtr<WebDownload> download;
+ download.adoptRef(WebDownload::createInstance(url, downloadDelegate.get()));
+ download->start();
+}
+
+void WebContextMenuClient::searchWithGoogle(const Frame* frame)
+{
+ String searchString = frame->selectedText();
+ searchString.stripWhiteSpace();
+ String encoded = encodeWithURLEscapeSequences(searchString);
+ encoded.replace("%20", "+");
+
+ String url("http://www.google.com/search?q=");
+ url.append(encoded);
+ url.append("&ie=UTF-8&oe=UTF-8");
+
+ ResourceRequest request = ResourceRequest(url);
+ if (Page* page = frame->page())
+ page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false, true);
+}
+
+void WebContextMenuClient::lookUpInDictionary(Frame*)
+{
+ notImplemented();
+}
+
+void WebContextMenuClient::speak(const String&)
+{
+ notImplemented();
+}
+
+void WebContextMenuClient::stopSpeaking()
+{
+ notImplemented();
+}
diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.h b/WebKit/win/WebCoreSupport/WebContextMenuClient.h
new file mode 100644
index 0000000..a981f4e
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <WebCore/ContextMenuClient.h>
+#include <wtf/Forward.h>
+
+namespace WebCore {
+ class String;
+}
+class WebView;
+
+class WebContextMenuClient : public WebCore::ContextMenuClient {
+public:
+ WebContextMenuClient(WebView*);
+
+ virtual void contextMenuDestroyed();
+
+ virtual HMENU getCustomMenuFromDefaultItems(WebCore::ContextMenu*);
+ virtual void contextMenuItemSelected(WebCore::ContextMenuItem*, const WebCore::ContextMenu*);
+
+ virtual void downloadURL(const WebCore::KURL&);
+ virtual void searchWithGoogle(const WebCore::Frame*);
+ virtual void lookUpInDictionary(WebCore::Frame*);
+ virtual void speak(const WebCore::String&);
+ virtual void stopSpeaking();
+
+private:
+ WebView* m_webView;
+};
diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp
new file mode 100644
index 0000000..5a09529
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDragClient.h"
+#include "WebDropSource.h"
+#include "WebKitGraphics.h"
+#include "WebView.h"
+
+#include <shlobj.h>
+#include <CoreGraphics/CoreGraphics.h>
+
+#pragma warning(push, 0)
+#include <WebCore/ClipboardWin.h>
+#include <WebCore/DragData.h>
+#include <WebCore/Font.h>
+#include <WebCore/FontDescription.h>
+#include <WebCore/FontSelector.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+#include <WebCore/StringTruncator.h>
+#include <WebCore/WebCoreTextRenderer.h>
+#pragma warning(pop)
+
+namespace WebCore {
+ HBITMAP allocImage(HDC dc, IntSize size, CGContextRef *targetRef);
+}
+
+
+#define DRAG_LABEL_BORDER_X 4
+// Keep border_y in synch with DragController::LinkDragBorderInset
+#define DRAG_LABEL_BORDER_Y 2
+#define DRAG_LABEL_RADIUS 5
+#define DRAG_LABEL_BORDER_Y_OFFSET 2
+
+#define MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP 120
+
+// Observation says max size is 200x200
+#define MAX_DRAG_LABEL_WIDTH 200
+#define MAX_DRAG_LABEL_STRING_WIDTH (MAX_DRAG_LABEL_WIDTH - 2 * DRAG_LABEL_BORDER_X)
+
+#define DRAG_LINK_LABEL_FONT_SIZE 11
+#define DRAG_LINK_URL_FONT_SIZE 10
+
+using namespace WebCore;
+
+WebDragClient::WebDragClient(WebView* webView)
+ : m_webView(webView)
+{
+ ASSERT(webView);
+}
+
+DragDestinationAction WebDragClient::actionMaskForDrag(DragData* dragData)
+{
+ COMPtr<IWebUIDelegate> delegateRef = 0;
+ //Default behaviour (eg. no delegate, or callback not implemented) is to allow
+ //any action
+ WebDragDestinationAction mask = WebDragDestinationActionAny;
+ if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
+ delegateRef->dragDestinationActionMaskForDraggingInfo(m_webView, dragData->platformData(), &mask);
+
+ return (DragDestinationAction)mask;
+}
+
+void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData* dragData)
+{
+ //Default delegate for willPerformDragDestinationAction has no side effects
+ //so we just call the delegate, and don't worry about whether it's implemented
+ COMPtr<IWebUIDelegate> delegateRef = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
+ delegateRef->willPerformDragDestinationAction(m_webView, (WebDragDestinationAction)action, dragData->platformData());
+}
+
+DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& windowPoint)
+{
+ COMPtr<IWebUIDelegate> delegateRef = 0;
+ WebDragSourceAction action = WebDragSourceActionAny;
+ POINT localpt = core(m_webView)->mainFrame()->view()->windowToContents(windowPoint);
+ if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
+ delegateRef->dragSourceActionMaskForPoint(m_webView, &localpt, &action);
+ return (DragSourceAction)action;
+}
+
+void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
+{
+}
+
+void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, Clipboard* clipboard, Frame* frame, bool isLink)
+{
+ //FIXME: Allow UIDelegate to override behaviour <rdar://problem/5015953>
+
+ //We liberally protect everything, to protect against a load occurring mid-drag
+ RefPtr<Frame> frameProtector = frame;
+ COMPtr<IDragSourceHelper> helper;
+ COMPtr<IDataObject> dataObject;
+ COMPtr<WebView> viewProtector = m_webView;
+ COMPtr<IDropSource> source;
+ if (FAILED(WebDropSource::createInstance(m_webView, &source)))
+ return;
+
+ dataObject = static_cast<ClipboardWin*>(clipboard)->dataObject();
+ if (source && (image || dataObject)) {
+ if (image) {
+ if(SUCCEEDED(CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
+ IID_IDragSourceHelper,(LPVOID*)&helper))) {
+ BITMAP b;
+ GetObject(image, sizeof(BITMAP), &b);
+ SHDRAGIMAGE sdi;
+ sdi.sizeDragImage.cx = b.bmWidth;
+ sdi.sizeDragImage.cy = b.bmHeight;
+ sdi.crColorKey = 0xffffffff;
+ sdi.hbmpDragImage = image;
+ sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
+ sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
+ if (isLink)
+ sdi.ptOffset.y = b.bmHeight - sdi.ptOffset.y;
+
+ helper->InitializeFromBitmap(&sdi, dataObject.get());
+ }
+ }
+
+ //FIXME: Ensure correct drag ops are available <rdar://problem/5015957>
+ DWORD okEffect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
+ DWORD effect;
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(m_webView->uiDelegate(&ui))) {
+ COMPtr<IWebUIDelegatePrivate> uiPrivate;
+ if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate)))
+ if (SUCCEEDED(uiPrivate->doDragDrop(m_webView, dataObject.get(), source.get(), okEffect, &effect)))
+ return;
+ }
+
+ DoDragDrop(dataObject.get(), source.get(), okEffect, &effect);
+ }
+}
+
+static Font dragLabelFont(int size, bool bold)
+{
+ FontDescription desc;
+ desc.setBold(bold);
+ FontFamily family;
+ family.setFamily("Lucida Grande");
+ desc.setFamily(family);
+ desc.setSpecifiedSize((float)size);
+ desc.setComputedSize((float)size);
+ Font result = Font(desc, 0, 0);
+ result.update(0);
+ return result;
+}
+
+DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLabel, Frame*)
+{
+ //This is more or less an exact match for the MacOS code
+ static const Font labelFont = dragLabelFont(DRAG_LINK_LABEL_FONT_SIZE, true);
+ static const Font urlFont = dragLabelFont(DRAG_LINK_URL_FONT_SIZE, false);
+ bool drawURLString = true;
+ bool clipURLString = false;
+ bool clipLabelString = false;
+
+ String urlString = url.string();
+ String label = inLabel;
+ if (label.isEmpty()) {
+ drawURLString = false;
+ label = urlString;
+ }
+
+ //First step in drawing the link drag image width
+ TextRun labelRun(label.impl());
+ TextRun urlRun(urlString.impl());
+ IntSize labelSize(labelFont.width(labelRun), labelFont.ascent() + labelFont.descent());
+
+ if (labelSize.width() > MAX_DRAG_LABEL_STRING_WIDTH){
+ labelSize.setWidth(MAX_DRAG_LABEL_STRING_WIDTH);
+ clipLabelString = true;
+ }
+
+ IntSize urlStringSize;
+ IntSize imageSize(labelSize.width() + DRAG_LABEL_BORDER_X * 2,
+ labelSize.height() + DRAG_LABEL_BORDER_Y * 2);
+
+ if (drawURLString) {
+ urlStringSize.setWidth(urlFont.width(urlRun));
+ urlStringSize.setHeight(urlFont.ascent() + urlFont.descent());
+ imageSize.setHeight(imageSize.height() + urlStringSize.height());
+ if (urlStringSize.width() > MAX_DRAG_LABEL_STRING_WIDTH) {
+ imageSize.setWidth(MAX_DRAG_LABEL_WIDTH);
+ clipURLString = true;
+ } else {
+ imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()) + DRAG_LABEL_BORDER_X * 2);
+ }
+ }
+
+ // We now know how big the image needs to be, so we create and
+ // fill the background
+ HBITMAP image = 0;
+ HDC dc = GetDC(0);
+ HDC workingDC = CreateCompatibleDC(dc);
+ if (!workingDC) {
+ ReleaseDC(0, dc);
+ return 0;
+ }
+
+ CGContextRef contextRef;
+ image = allocImage(workingDC, imageSize, &contextRef);
+ if (!image) {
+ DeleteDC(workingDC);
+ ReleaseDC(0, dc);
+ return 0;
+ }
+
+ ::SelectObject(workingDC, image);
+ GraphicsContext context(contextRef);
+ // On Mac alpha is {0.7, 0.7, 0.7, 0.8}, however we can't control alpha
+ // for drag images on win, so we use 1
+ static const Color backgroundColor(140, 140, 140);
+ static const IntSize radii(DRAG_LABEL_RADIUS, DRAG_LABEL_RADIUS);
+ context.setFont(labelFont);
+ IntRect rect(0, 0, imageSize.width(), imageSize.height());
+ context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor);
+
+ // Draw the text
+ static const Color topColor(0, 0, 0, 255); //original alpha = 0.75
+ static const Color bottomColor(255, 255, 255, 127); //original alpha = 0.5
+ if (drawURLString) {
+ if (clipURLString)
+ urlString = StringTruncator::rightTruncate(urlString, imageSize.width() - (DRAG_LABEL_BORDER_X * 2.0f), urlFont, false);
+ IntPoint textPos(DRAG_LABEL_BORDER_X, imageSize.height() - (DRAG_LABEL_BORDER_Y_OFFSET + urlFont.descent()));
+ WebCoreDrawDoubledTextAtPoint(context, urlString, textPos, urlFont, topColor, bottomColor);
+ }
+
+ if (clipLabelString)
+ label = StringTruncator::rightTruncate(label, imageSize.width() - (DRAG_LABEL_BORDER_X * 2.0f), labelFont, false);
+
+ IntPoint textPos(DRAG_LABEL_BORDER_X, DRAG_LABEL_BORDER_Y + labelFont.pixelSize());
+ WebCoreDrawDoubledTextAtPoint(context, label, textPos, labelFont, topColor, bottomColor);
+
+ CGContextRelease(contextRef);
+ DeleteDC(workingDC);
+ ReleaseDC(0, dc);
+ return image;
+}
+
+void WebDragClient::dragControllerDestroyed()
+{
+ delete this;
+}
diff --git a/WebKit/win/WebCoreSupport/WebDragClient.h b/WebKit/win/WebCoreSupport/WebDragClient.h
new file mode 100644
index 0000000..f7ca139
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebDragClient.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 <WebCore/DragClient.h>
+
+class WebView;
+
+class WebDragClient : public WebCore::DragClient {
+public:
+ WebDragClient(WebView*);
+ virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
+ virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
+ virtual void dragControllerDestroyed();
+ virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
+ virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
+ virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, WebCore::Clipboard*, WebCore::Frame*, bool);
+ virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WebCore::String&, WebCore::Frame*);
+private:
+ WebView* m_webView;
+};
+
diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp
new file mode 100644
index 0000000..523bbb4
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp
@@ -0,0 +1,762 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebEditorClient.h"
+
+#include "WebKit.h"
+#include "WebLocalizableStrings.h"
+#include "WebView.h"
+#include "DOMCoreClasses.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/Document.h>
+#include <WebCore/EditCommand.h>
+#include <WebCore/HTMLElement.h>
+#include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLNames.h>
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/Range.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+// {09A11D2B-FAFB-4ca0-A6F7-791EE8932C88}
+static const GUID IID_IWebUndoCommand =
+{ 0x9a11d2b, 0xfafb, 0x4ca0, { 0xa6, 0xf7, 0x79, 0x1e, 0xe8, 0x93, 0x2c, 0x88 } };
+
+class IWebUndoCommand : public IUnknown {
+public:
+ virtual void execute() = 0;
+};
+
+// WebEditorUndoTarget -------------------------------------------------------------
+
+class WebEditorUndoTarget : public IWebUndoTarget
+{
+public:
+ WebEditorUndoTarget();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebUndoTarget
+ virtual HRESULT STDMETHODCALLTYPE invoke(
+ /* [in] */ BSTR actionName,
+ /* [in] */ IUnknown *obj);
+
+private:
+ ULONG m_refCount;
+};
+
+WebEditorUndoTarget::WebEditorUndoTarget()
+: m_refCount(1)
+{
+}
+
+HRESULT STDMETHODCALLTYPE WebEditorUndoTarget::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebUndoTarget*>(this);
+ else if (IsEqualGUID(riid, IID_IWebUndoTarget))
+ *ppvObject = static_cast<IWebUndoTarget*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebEditorUndoTarget::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebEditorUndoTarget::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE WebEditorUndoTarget::invoke(
+ /* [in] */ BSTR /*actionName*/,
+ /* [in] */ IUnknown *obj)
+{
+ IWebUndoCommand* undoCommand = 0;
+ if (SUCCEEDED(obj->QueryInterface(IID_IWebUndoCommand, (void**)&undoCommand))) {
+ undoCommand->execute();
+ undoCommand->Release();
+ }
+ return S_OK;
+}
+
+// WebEditorClient ------------------------------------------------------------------
+
+WebEditorClient::WebEditorClient(WebView* webView)
+ : m_webView(webView)
+ , m_undoTarget(0)
+{
+ m_undoTarget = new WebEditorUndoTarget();
+}
+
+WebEditorClient::~WebEditorClient()
+{
+ if (m_undoTarget)
+ m_undoTarget->Release();
+}
+
+void WebEditorClient::pageDestroyed()
+{
+ delete this;
+}
+
+bool WebEditorClient::isContinuousSpellCheckingEnabled()
+{
+ BOOL enabled;
+ if (FAILED(m_webView->isContinuousSpellCheckingEnabled(&enabled)))
+ return false;
+ return !!enabled;
+}
+
+void WebEditorClient::toggleContinuousSpellChecking()
+{
+ m_webView->toggleContinuousSpellChecking(0);
+}
+
+bool WebEditorClient::isGrammarCheckingEnabled()
+{
+ BOOL enabled;
+ if (FAILED(m_webView->isGrammarCheckingEnabled(&enabled)))
+ return false;
+ return !!enabled;
+}
+
+void WebEditorClient::toggleGrammarChecking()
+{
+ m_webView->toggleGrammarChecking(0);
+}
+
+static void initViewSpecificSpelling(IWebViewEditing* viewEditing)
+{
+ // we just use this as a flag to indicate that we've spell checked the document
+ // and need to close the spell checker out when the view closes.
+ int tag;
+ viewEditing->spellCheckerDocumentTag(&tag);
+}
+
+int WebEditorClient::spellCheckerDocumentTag()
+{
+ // we don't use the concept of spelling tags
+ notImplemented();
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool WebEditorClient::shouldBeginEditing(Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool WebEditorClient::shouldEndEditing(Range*)
+{
+ notImplemented();
+ return true;
+}
+
+void WebEditorClient::didBeginEditing()
+{
+ notImplemented();
+}
+
+void WebEditorClient::respondToChangedContents()
+{
+ notImplemented();
+}
+
+void WebEditorClient::respondToChangedSelection()
+{
+ m_webView->selectionChanged();
+}
+
+void WebEditorClient::didEndEditing()
+{
+ notImplemented();
+}
+
+void WebEditorClient::didWriteSelectionToPasteboard()
+{
+ notImplemented();
+}
+
+void WebEditorClient::didSetSelectionTypesForPasteboard()
+{
+ notImplemented();
+}
+
+bool WebEditorClient::shouldDeleteRange(Range* /*range*/)
+{
+ notImplemented();
+ return true;
+
+ // FIXME: calling m_webView->editingDelegate() will cause an assertion failure so we don't want to enable this code until that's implemented.
+ //BOOL result = false;
+ //IWebViewEditingDelegate* editingDelegate;
+ //// FIXME: DOMRange needs to be implemented before anything meaningful can be done here
+ //IDOMRange* domRange(0);
+ //if (SUCCEEDED(m_webView->editingDelegate(&editingDelegate))) {
+ // editingDelegate->shouldDeleteDOMRange(m_webView, domRange, &result);
+ // editingDelegate->Release();
+ //}
+ //return !!result;
+}
+
+bool WebEditorClient::shouldInsertNode(Node* /*node*/, Range* /*replacingRange*/, EditorInsertAction /*givenAction*/)
+{
+ notImplemented();
+ return true;
+}
+
+bool WebEditorClient::shouldInsertText(String /*str*/, Range* /* replacingRange */, EditorInsertAction /*givenAction*/)
+{
+ notImplemented();
+ return true;
+
+ // FIXME: calling m_webView->editingDelegate() will cause an assertion failure so we don't want to enable this code until that's implemented.
+ //BOOL result = false;
+ //IWebViewEditingDelegate* editingDelegate;
+ //// FIXME: DOMRange needs to be implemented before anything meaningful can be done here
+ //IDOMRange* domRange(0); // make a DOMRange from replacingRange
+ //BString text(str);
+ //if (SUCCEEDED(m_webView->editingDelegate(&editingDelegate))) {
+ // editingDelegate->shouldInsertText(m_webView, text, domRange, (WebViewInsertAction) givenAction, &result);
+ // editingDelegate->Release();
+ //}
+ //return !!result;
+}
+
+//bool WebEditorClient::shouldChangeSelectedRange(Range *currentRange, Range *toProposedRange, SelectionAffinity selectionAffinity, bool stillSelecting)
+//{ notImplemented(); return false; }
+
+bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* /*style*/, Range* /*toElementsInDOMRange*/)
+{ notImplemented(); return true; }
+
+bool WebEditorClient::shouldMoveRangeAfterDelete(Range* /*range*/, Range* /*rangeToBeReplaced*/)
+{ notImplemented(); return true; }
+
+bool WebEditorClient::shouldChangeTypingStyle(CSSStyleDeclaration* /*currentStyle*/, CSSStyleDeclaration* /*toProposedStyle*/)
+{ notImplemented(); return false; }
+
+void WebEditorClient::webViewDidChangeTypingStyle(WebNotification* /*notification*/)
+{ notImplemented(); }
+
+void WebEditorClient::webViewDidChangeSelection(WebNotification* /*notification*/)
+{ notImplemented(); }
+
+bool WebEditorClient::shouldShowDeleteInterface(HTMLElement* /*element*/)
+{ notImplemented(); return false; }
+
+bool WebEditorClient::smartInsertDeleteEnabled(void)
+{
+ BOOL enabled = FALSE;
+ m_webView->smartInsertDeleteEnabled(&enabled);
+ return !!enabled;
+}
+
+bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range*, WebCore::Range*, WebCore::EAffinity, bool)
+{ notImplemented(); return true; }
+
+void WebEditorClient::textFieldDidBeginEditing(Element* e)
+{
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLInputElement* domInputElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLInputElement, (void**)&domInputElement))) {
+ formDelegate->textFieldDidBeginEditing(domInputElement, kit(e->document()->frame()));
+ domInputElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+}
+
+void WebEditorClient::textFieldDidEndEditing(Element* e)
+{
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLInputElement* domInputElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLInputElement, (void**)&domInputElement))) {
+ formDelegate->textFieldDidEndEditing(domInputElement, kit(e->document()->frame()));
+ domInputElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+}
+
+void WebEditorClient::textDidChangeInTextField(Element* e)
+{
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLInputElement* domInputElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLInputElement, (void**)&domInputElement))) {
+ formDelegate->textDidChangeInTextField(domInputElement, kit(e->document()->frame()));
+ domInputElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+}
+
+bool WebEditorClient::doTextFieldCommandFromEvent(Element* e, KeyboardEvent* ke)
+{
+ BOOL result = FALSE;
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLInputElement* domInputElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLInputElement, (void**)&domInputElement))) {
+ String command = m_webView->interpretKeyEvent(ke);
+ // We allow empty commands here because the app code actually depends on this being called for all key presses.
+ // We may want to revisit this later because it doesn't really make sense to send an empty command.
+ formDelegate->doPlatformCommand(domInputElement, BString(command), kit(e->document()->frame()), &result);
+ domInputElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+ return !!result;
+}
+
+void WebEditorClient::textWillBeDeletedInTextField(Element* e)
+{
+ // We're using the deleteBackward command for all deletion operations since the autofill code treats all deletions the same way.
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLInputElement* domInputElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLInputElement, (void**)&domInputElement))) {
+ BOOL result;
+ formDelegate->doPlatformCommand(domInputElement, BString(L"DeleteBackward"), kit(e->document()->frame()), &result);
+ domInputElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+}
+
+void WebEditorClient::textDidChangeInTextArea(Element* e)
+{
+ IWebFormDelegate* formDelegate;
+ if (SUCCEEDED(m_webView->formDelegate(&formDelegate)) && formDelegate) {
+ IDOMElement* domElement = DOMElement::createInstance(e);
+ if (domElement) {
+ IDOMHTMLTextAreaElement* domTextAreaElement;
+ if (SUCCEEDED(domElement->QueryInterface(IID_IDOMHTMLTextAreaElement, (void**)&domTextAreaElement))) {
+ formDelegate->textDidChangeInTextArea(domTextAreaElement, kit(e->document()->frame()));
+ domTextAreaElement->Release();
+ }
+ domElement->Release();
+ }
+ formDelegate->Release();
+ }
+}
+
+class WebEditorUndoCommand : public IWebUndoCommand
+{
+public:
+ WebEditorUndoCommand(PassRefPtr<EditCommand> editCommand, bool isUndo);
+ void execute();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+private:
+ ULONG m_refCount;
+ RefPtr<EditCommand> m_editCommand;
+ bool m_isUndo;
+};
+
+WebEditorUndoCommand::WebEditorUndoCommand(PassRefPtr<EditCommand> editCommand, bool isUndo)
+ : m_editCommand(editCommand)
+ , m_isUndo(isUndo)
+ , m_refCount(1)
+{
+}
+
+void WebEditorUndoCommand::execute()
+{
+ if (m_isUndo)
+ m_editCommand->unapply();
+ else
+ m_editCommand->reapply();
+}
+
+HRESULT STDMETHODCALLTYPE WebEditorUndoCommand::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebUndoCommand*>(this);
+ else if (IsEqualGUID(riid, IID_IWebUndoCommand))
+ *ppvObject = static_cast<IWebUndoCommand*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebEditorUndoCommand::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebEditorUndoCommand::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+static LPCTSTR undoNameForEditAction(EditAction editAction)
+{
+ switch (editAction) {
+ case EditActionUnspecified: return 0;
+ case EditActionSetColor: return LPCTSTR_UI_STRING_KEY("Set Color", "Set Color (Undo action name)", "Undo action name");
+ case EditActionSetBackgroundColor: return LPCTSTR_UI_STRING_KEY("Set Background Color", "Set Background Color (Undo action name)", "Undo action name");
+ case EditActionTurnOffKerning: return LPCTSTR_UI_STRING_KEY("Turn Off Kerning", "Turn Off Kerning (Undo action name)", "Undo action name");
+ case EditActionTightenKerning: return LPCTSTR_UI_STRING_KEY("Tighten Kerning", "Tighten Kerning (Undo action name)", "Undo action name");
+ case EditActionLoosenKerning: return LPCTSTR_UI_STRING_KEY("Loosen Kerning", "Loosen Kerning (Undo action name)", "Undo action name");
+ case EditActionUseStandardKerning: return LPCTSTR_UI_STRING_KEY("Use Standard Kerning", "Use Standard Kerning (Undo action name)", "Undo action name");
+ case EditActionTurnOffLigatures: return LPCTSTR_UI_STRING_KEY("Turn Off Ligatures", "Turn Off Ligatures (Undo action name)", "Undo action name");
+ case EditActionUseStandardLigatures: return LPCTSTR_UI_STRING_KEY("Use Standard Ligatures", "Use Standard Ligatures (Undo action name)", "Undo action name");
+ case EditActionUseAllLigatures: return LPCTSTR_UI_STRING_KEY("Use All Ligatures", "Use All Ligatures (Undo action name)", "Undo action name");
+ case EditActionRaiseBaseline: return LPCTSTR_UI_STRING_KEY("Raise Baseline", "Raise Baseline (Undo action name)", "Undo action name");
+ case EditActionLowerBaseline: return LPCTSTR_UI_STRING_KEY("Lower Baseline", "Lower Baseline (Undo action name)", "Undo action name");
+ case EditActionSetTraditionalCharacterShape: return LPCTSTR_UI_STRING_KEY("Set Traditional Character Shape", "Set Traditional Character Shape (Undo action name)", "Undo action name");
+ case EditActionSetFont: return LPCTSTR_UI_STRING_KEY("Set Font", "Set Font (Undo action name)", "Undo action name");
+ case EditActionChangeAttributes: return LPCTSTR_UI_STRING_KEY("Change Attributes", "Change Attributes (Undo action name)", "Undo action name");
+ case EditActionAlignLeft: return LPCTSTR_UI_STRING_KEY("Align Left", "Align Left (Undo action name)", "Undo action name");
+ case EditActionAlignRight: return LPCTSTR_UI_STRING_KEY("Align Right", "Align Right (Undo action name)", "Undo action name");
+ case EditActionCenter: return LPCTSTR_UI_STRING_KEY("Center", "Center (Undo action name)", "Undo action name");
+ case EditActionJustify: return LPCTSTR_UI_STRING_KEY("Justify", "Justify (Undo action name)", "Undo action name");
+ case EditActionSetWritingDirection: return LPCTSTR_UI_STRING_KEY("Set Writing Direction", "Set Writing Direction (Undo action name)", "Undo action name");
+ case EditActionSubscript: return LPCTSTR_UI_STRING_KEY("Subscript", "Subscript (Undo action name)", "Undo action name");
+ case EditActionSuperscript: return LPCTSTR_UI_STRING_KEY("Superscript", "Superscript (Undo action name)", "Undo action name");
+ case EditActionUnderline: return LPCTSTR_UI_STRING_KEY("Underline", "Underline (Undo action name)", "Undo action name");
+ case EditActionOutline: return LPCTSTR_UI_STRING_KEY("Outline", "Outline (Undo action name)", "Undo action name");
+ case EditActionUnscript: return LPCTSTR_UI_STRING_KEY("Unscript", "Unscript (Undo action name)", "Undo action name");
+ case EditActionDrag: return LPCTSTR_UI_STRING_KEY("Drag", "Drag (Undo action name)", "Undo action name");
+ case EditActionCut: return LPCTSTR_UI_STRING_KEY("Cut", "Cut (Undo action name)", "Undo action name");
+ case EditActionPaste: return LPCTSTR_UI_STRING_KEY("Paste", "Paste (Undo action name)", "Undo action name");
+ case EditActionPasteFont: return LPCTSTR_UI_STRING_KEY("Paste Font", "Paste Font (Undo action name)", "Undo action name");
+ case EditActionPasteRuler: return LPCTSTR_UI_STRING_KEY("Paste Ruler", "Paste Ruler (Undo action name)", "Undo action name");
+ case EditActionTyping: return LPCTSTR_UI_STRING_KEY("Typing", "Typing (Undo action name)", "Undo action name");
+ case EditActionCreateLink: return LPCTSTR_UI_STRING_KEY("Create Link", "Create Link (Undo action name)", "Undo action name");
+ case EditActionUnlink: return LPCTSTR_UI_STRING_KEY("Unlink", "Unlink (Undo action name)", "Undo action name");
+ case EditActionInsertList: return LPCTSTR_UI_STRING_KEY("Insert List", "Insert List (Undo action name)", "Undo action name");
+ case EditActionFormatBlock: return LPCTSTR_UI_STRING_KEY("Formatting", "Format Block (Undo action name)", "Undo action name");
+ case EditActionIndent: return LPCTSTR_UI_STRING_KEY("Indent", "Indent (Undo action name)", "Undo action name");
+ case EditActionOutdent: return LPCTSTR_UI_STRING_KEY("Outdent", "Outdent (Undo action name)", "Undo action name");
+ }
+ return 0;
+}
+
+void WebEditorClient::registerCommandForUndo(PassRefPtr<EditCommand> command)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ LPCTSTR actionName = undoNameForEditAction(command->editingAction());
+ WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(command, true);
+ if (!undoCommand)
+ return;
+ uiDelegate->registerUndoWithTarget(m_undoTarget, 0, undoCommand);
+ undoCommand->Release(); // the undo manager owns the reference
+ BSTR actionNameBSTR = SysAllocString(actionName);
+ if (actionNameBSTR) {
+ uiDelegate->setActionTitle(actionNameBSTR);
+ SysFreeString(actionNameBSTR);
+ }
+ uiDelegate->Release();
+ }
+}
+
+void WebEditorClient::registerCommandForRedo(PassRefPtr<EditCommand> command)
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(command, false);
+ if (!undoCommand)
+ return;
+ uiDelegate->registerUndoWithTarget(m_undoTarget, 0, undoCommand);
+ undoCommand->Release(); // the undo manager owns the reference
+ uiDelegate->Release();
+ }
+}
+
+void WebEditorClient::clearUndoRedoOperations()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->removeAllActionsWithTarget(m_undoTarget);
+ uiDelegate->Release();
+ }
+}
+
+bool WebEditorClient::canUndo() const
+{
+ BOOL result = FALSE;
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->canUndo(&result);
+ uiDelegate->Release();
+ }
+ return !!result;
+}
+
+bool WebEditorClient::canRedo() const
+{
+ BOOL result = FALSE;
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->canRedo(&result);
+ uiDelegate->Release();
+ }
+ return !!result;
+}
+
+void WebEditorClient::undo()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->undo();
+ uiDelegate->Release();
+ }
+}
+
+void WebEditorClient::redo()
+{
+ IWebUIDelegate* uiDelegate = 0;
+ if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
+ uiDelegate->redo();
+ uiDelegate->Release();
+ }
+}
+
+void WebEditorClient::handleKeyboardEvent(KeyboardEvent* evt)
+{
+ if (m_webView->handleEditingKeyboardEvent(evt))
+ evt->setDefaultHandled();
+}
+
+void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* )
+{
+}
+
+bool WebEditorClient::isEditable()
+{
+ return false;
+}
+
+void WebEditorClient::ignoreWordInSpellDocument(const String& word)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ initViewSpecificSpelling(m_webView);
+ ed->ignoreWordInSpellDocument(m_webView, BString(word));
+}
+
+void WebEditorClient::learnWord(const String& word)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ ed->learnWord(BString(word));
+}
+
+void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
+{
+ *misspellingLocation = -1;
+ *misspellingLength = 0;
+
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ initViewSpecificSpelling(m_webView);
+ ed->checkSpellingOfString(m_webView, text, length, misspellingLocation, misspellingLength);
+}
+
+void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
+{
+ details.clear();
+ *badGrammarLocation = -1;
+ *badGrammarLength = 0;
+
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ initViewSpecificSpelling(m_webView);
+ COMPtr<IEnumWebGrammarDetails> enumDetailsObj;
+ if (FAILED(ed->checkGrammarOfString(m_webView, text, length, &enumDetailsObj, badGrammarLocation, badGrammarLength)))
+ return;
+
+ while (true) {
+ ULONG fetched;
+ COMPtr<IWebGrammarDetail> detailObj;
+ if (enumDetailsObj->Next(1, &detailObj, &fetched) != S_OK)
+ break;
+
+ GrammarDetail detail;
+ if (FAILED(detailObj->length(&detail.length)))
+ continue;
+ if (FAILED(detailObj->location(&detail.location)))
+ continue;
+ BSTR userDesc;
+ if (FAILED(detailObj->userDescription(&userDesc)))
+ continue;
+ detail.userDescription = String(userDesc, SysStringLen(userDesc));
+ SysFreeString(userDesc);
+
+ COMPtr<IEnumSpellingGuesses> enumGuessesObj;
+ if (FAILED(detailObj->guesses(&enumGuessesObj)))
+ continue;
+ while (true) {
+ BSTR guess;
+ if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
+ break;
+ detail.guesses.append(String(guess, SysStringLen(guess)));
+ SysFreeString(guess);
+ }
+
+ details.append(detail);
+ }
+}
+
+void WebEditorClient::updateSpellingUIWithGrammarString(const String& string, const WebCore::GrammarDetail& detail)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ Vector<BSTR> guessesBSTRs;
+ for (unsigned i = 0; i < detail.guesses.size(); i++) {
+ BString guess(detail.guesses[i]);
+ guessesBSTRs.append(guess.release());
+ }
+ BString userDescriptionBSTR(detail.userDescription);
+ ed->updateSpellingUIWithGrammarString(BString(string), detail.location, detail.length, userDescriptionBSTR, guessesBSTRs.data(), (int)guessesBSTRs.size());
+ for (unsigned i = 0; i < guessesBSTRs.size(); i++)
+ SysFreeString(guessesBSTRs[i]);
+}
+
+void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& word)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ ed->updateSpellingUIWithMisspelledWord(BString(word));
+}
+
+void WebEditorClient::showSpellingUI(bool show)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ ed->showSpellingUI(show);
+}
+
+bool WebEditorClient::spellingUIIsShowing()
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return false;
+
+ BOOL showing;
+ if (FAILED(ed->spellingUIIsShowing(&showing)))
+ return false;
+
+ return !!showing;
+}
+
+void WebEditorClient::getGuessesForWord(const String& word, Vector<String>& guesses)
+{
+ guesses.clear();
+
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return;
+
+ COMPtr<IEnumSpellingGuesses> enumGuessesObj;
+ if (FAILED(ed->guessesForWord(BString(word), &enumGuessesObj)))
+ return;
+
+ while (true) {
+ ULONG fetched;
+ BSTR guess;
+ if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
+ break;
+ guesses.append(String(guess, SysStringLen(guess)));
+ SysFreeString(guess);
+ }
+}
+
+void WebEditorClient::setInputMethodState(bool enabled)
+{
+ m_webView->setInputMethodState(enabled);
+}
diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.h b/WebKit/win/WebCoreSupport/WebEditorClient.h
new file mode 100644
index 0000000..0f1e57a
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebEditorClient.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebEditorClient_H
+#define WebEditorClient_H
+
+#include "WebKit.h"
+#pragma warning(push, 0)
+#include <WebCore/EditorClient.h>
+#include <wtf/OwnPtr.h>
+#pragma warning(pop)
+
+class WebView;
+class WebNotification;
+class WebEditorUndoTarget;
+
+class WebEditorClient : public WebCore::EditorClient {
+public:
+ WebEditorClient(WebView*);
+ ~WebEditorClient();
+
+ virtual void pageDestroyed();
+
+ virtual bool isContinuousSpellCheckingEnabled();
+ virtual void toggleGrammarChecking();
+ virtual bool isGrammarCheckingEnabled();
+ virtual void toggleContinuousSpellChecking();
+ virtual int spellCheckerDocumentTag();
+
+ virtual bool isEditable();
+
+ virtual bool shouldBeginEditing(WebCore::Range*);
+ virtual bool shouldEndEditing(WebCore::Range*);
+ virtual bool shouldInsertText(WebCore::String, WebCore::Range*, WebCore::EditorInsertAction);
+
+ virtual void didBeginEditing();
+ virtual void didEndEditing();
+ virtual void didWriteSelectionToPasteboard();
+ virtual void didSetSelectionTypesForPasteboard();
+
+ virtual void respondToChangedContents();
+ virtual void respondToChangedSelection();
+
+ bool shouldShowDeleteInterface(WebCore::HTMLElement*);
+ bool shouldDeleteRange(WebCore::Range*);
+
+ bool shouldInsertNode(WebCore::Node*, WebCore::Range* replacingRange, WebCore::EditorInsertAction);
+ bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
+ bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
+ bool shouldChangeTypingStyle(WebCore::CSSStyleDeclaration* currentStyle, WebCore::CSSStyleDeclaration* toProposedStyle);
+
+ void webViewDidChangeTypingStyle(WebNotification*);
+ void webViewDidChangeSelection(WebNotification*);
+
+ bool smartInsertDeleteEnabled();
+
+ void registerCommandForUndo(PassRefPtr<WebCore::EditCommand>);
+ void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>);
+ void clearUndoRedoOperations();
+
+ bool canUndo() const;
+ bool canRedo() const;
+
+ void undo();
+ void redo();
+
+ virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting);
+ virtual void textFieldDidBeginEditing(WebCore::Element*);
+ virtual void textFieldDidEndEditing(WebCore::Element*);
+ virtual void textDidChangeInTextField(WebCore::Element*);
+ virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*);
+ virtual void textWillBeDeletedInTextField(WebCore::Element* input);
+ virtual void textDidChangeInTextArea(WebCore::Element*);
+
+ void handleKeyboardEvent(WebCore::KeyboardEvent*);
+ void handleInputMethodKeydown(WebCore::KeyboardEvent*);
+
+ virtual void ignoreWordInSpellDocument(const WebCore::String&);
+ virtual void learnWord(const WebCore::String&);
+ virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
+ virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
+ virtual void updateSpellingUIWithGrammarString(const WebCore::String&, const WebCore::GrammarDetail& detail);
+ virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&);
+ virtual void showSpellingUI(bool show);
+ virtual bool spellingUIIsShowing();
+ virtual void getGuessesForWord(const WebCore::String&, Vector<WebCore::String>& guesses);
+
+ virtual void setInputMethodState(bool);
+
+private:
+ WebView* m_webView;
+ WebEditorUndoTarget* m_undoTarget;
+};
+
+#endif // WebEditorClient_H
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
new file mode 100644
index 0000000..be1505f
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -0,0 +1,715 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebFrameLoaderClient.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "MarshallingHelpers.h"
+#include "WebCachedPagePlatformData.h"
+#include "WebChromeClient.h"
+#include "WebDocumentLoader.h"
+#include "WebError.h"
+#include "WebFrame.h"
+#include "WebHistory.h"
+#include "WebMutableURLRequest.h"
+#include "WebNotificationCenter.h"
+#include "WebScriptDebugServer.h"
+#include "WebURLAuthenticationChallenge.h"
+#include "WebURLResponse.h"
+#include "WebView.h"
+#pragma warning(push, 0)
+#include <WebCore/DocumentLoader.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameTree.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/HTMLFrameElement.h>
+#include <WebCore/HTMLFrameOwnerElement.h>
+#include <WebCore/HTMLNames.h>
+#include <WebCore/HistoryItem.h>
+#include <WebCore/Page.h>
+#include <WebCore/PluginPackage.h>
+#include <WebCore/PluginView.h>
+#include <WebCore/RenderPart.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+WebView* kit(Page* page)
+{
+ return page ? static_cast<WebChromeClient*>(page->chrome()->client())->webView() : 0;
+}
+
+static WebDataSource* getWebDataSource(DocumentLoader* loader)
+{
+ return loader ? static_cast<WebDocumentLoader*>(loader)->dataSource() : 0;
+}
+
+WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* webFrame)
+ : m_webFrame(webFrame)
+ , m_pluginView(0)
+ , m_hasSentResponseToPlugin(false)
+{
+ ASSERT_ARG(webFrame, webFrame);
+}
+
+WebFrameLoaderClient::~WebFrameLoaderClient()
+{
+}
+
+bool WebFrameLoaderClient::hasWebView() const
+{
+ return m_webFrame->webView();
+}
+
+bool WebFrameLoaderClient::hasFrameView() const
+{
+ return core(m_webFrame)->view();
+}
+
+void WebFrameLoaderClient::forceLayout()
+{
+ core(m_webFrame)->forceLayout(true);
+}
+
+void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ COMPtr<WebMutableURLRequest> webURLRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
+ resourceLoadDelegate->identifierForInitialRequest(webView, webURLRequest.get(), getWebDataSource(loader), identifier);
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge)
+{
+ ASSERT(challenge.sourceHandle());
+
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (SUCCEEDED(webView->resourceLoadDelegate(&resourceLoadDelegate))) {
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(AdoptCOM, WebURLAuthenticationChallenge::createInstance(challenge));
+ if (SUCCEEDED(resourceLoadDelegate->didReceiveAuthenticationChallenge(webView, identifier, webChallenge.get(), getWebDataSource(loader))))
+ return;
+ }
+
+ // If the ResourceLoadDelegate doesn't exist or fails to handle the call, we tell the ResourceHandle
+ // to continue without credential - this is the best approximation of Mac behavior
+ challenge.sourceHandle()->receivedRequestToContinueWithoutCredential(challenge);
+}
+
+void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(AdoptCOM, WebURLAuthenticationChallenge::createInstance(challenge));
+ resourceLoadDelegate->didCancelAuthenticationChallenge(webView, identifier, webChallenge.get(), getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ COMPtr<WebMutableURLRequest> webURLRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
+ COMPtr<WebURLResponse> webURLRedirectResponse(AdoptCOM, WebURLResponse::createInstance(redirectResponse));
+
+ COMPtr<IWebURLRequest> newWebURLRequest;
+ if (FAILED(resourceLoadDelegate->willSendRequest(webView, identifier, webURLRequest.get(), webURLRedirectResponse.get(), getWebDataSource(loader), &newWebURLRequest)))
+ return;
+
+ if (webURLRequest == newWebURLRequest)
+ return;
+
+ COMPtr<WebMutableURLRequest> newWebURLRequestImpl(Query, newWebURLRequest);
+ if (!newWebURLRequestImpl)
+ return;
+
+ request = newWebURLRequestImpl->resourceRequest();
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ COMPtr<WebURLResponse> webURLResponse(AdoptCOM, WebURLResponse::createInstance(response));
+ resourceLoadDelegate->didReceiveResponse(webView, identifier, webURLResponse.get(), getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int length)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ resourceLoadDelegate->didReceiveContentLength(webView, identifier, length, getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ resourceLoadDelegate->didFinishLoadingFromDataSource(webView, identifier, getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return;
+
+ COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(error));
+ resourceLoadDelegate->didFailLoadingWithError(webView, identifier, webError.get(), getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::dispatchDidHandleOnloadEvents()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
+ if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) && frameLoadDelegatePriv)
+ frameLoadDelegatePriv->didHandleOnloadEventsForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didReceiveServerRedirectForProvisionalLoadForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didCancelClientRedirectForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url, double delay, double fireDate)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->willPerformClientRedirectToURL(webView, BString(url.string()), delay, MarshallingHelpers::CFAbsoluteTimeToDATE(fireDate), m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didChangeLocationWithinPageForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchWillClose()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->willCloseFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveIcon()
+{
+ m_webFrame->webView()->dispatchDidReceiveIconFromWebFrame(m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didStartProvisionalLoadForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title)
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didReceiveTitle(webView, BString(title), m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidCommitLoad()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didCommitLoadForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidFinishDocumentLoad()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
+ if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) && frameLoadDelegatePriv)
+ frameLoadDelegatePriv->didFinishDocumentLoadForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidFinishLoad()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
+ frameLoadDelegate->didFinishLoadForFrame(webView, m_webFrame);
+}
+
+void WebFrameLoaderClient::dispatchDidFirstLayout()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv;
+ if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) && frameLoadDelegatePriv)
+ frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame);
+}
+
+Frame* WebFrameLoaderClient::dispatchCreatePage()
+{
+ WebView* webView = m_webFrame->webView();
+
+ COMPtr<IWebUIDelegate> ui;
+ if (FAILED(webView->uiDelegate(&ui)))
+ return 0;
+
+ COMPtr<IWebView> newWebView;
+ if (FAILED(ui->createWebViewWithRequest(webView, 0, &newWebView)))
+ return 0;
+
+ COMPtr<IWebFrame> mainFrame;
+ if (FAILED(newWebView->mainFrame(&mainFrame)))
+ return 0;
+
+ COMPtr<WebFrame> mainFrameImpl(Query, mainFrame);
+ return core(mainFrameImpl.get());
+}
+
+void WebFrameLoaderClient::dispatchShow()
+{
+ WebView* webView = m_webFrame->webView();
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(webView->uiDelegate(&ui)))
+ ui->webViewShow(webView);
+}
+
+void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader* loader)
+{
+ if (WebScriptDebugServer::listenerCount() <= 0)
+ return;
+
+ Frame* coreFrame = core(m_webFrame);
+ if (!coreFrame)
+ return;
+
+ WebScriptDebugServer::sharedWebScriptDebugServer()->didLoadMainResourceForDataSource(kit(coreFrame->page()), getWebDataSource(loader));
+}
+
+void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error)
+{
+ if (!m_pluginView)
+ return;
+
+ if (m_pluginView->status() == PluginStatusLoadedSuccessfully)
+ m_pluginView->didFail(error);
+ m_pluginView = 0;
+ m_hasSentResponseToPlugin = false;
+}
+
+void WebFrameLoaderClient::postProgressStartedNotification()
+{
+ static BSTR progressStartedName = SysAllocString(WebViewProgressStartedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressStartedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
+
+void WebFrameLoaderClient::postProgressEstimateChangedNotification()
+{
+ static BSTR progressEstimateChangedName = SysAllocString(WebViewProgressEstimateChangedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressEstimateChangedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
+
+void WebFrameLoaderClient::postProgressFinishedNotification()
+{
+ static BSTR progressFinishedName = SysAllocString(WebViewProgressFinishedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressFinishedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
+
+void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
+{
+ // FIXME: This should probably go through the data source.
+ const String& textEncoding = loader->response().textEncodingName();
+
+ if (!m_pluginView)
+ receivedData(data, length, textEncoding);
+
+ if (!m_pluginView || m_pluginView->status() != PluginStatusLoadedSuccessfully)
+ return;
+
+ if (!m_hasSentResponseToPlugin) {
+ m_pluginView->didReceiveResponse(core(m_webFrame)->loader()->documentLoader()->response());
+ // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in
+ // setting up this stream can cause the main document load to be cancelled, setting m_pluginView
+ // to null
+ if (!m_pluginView)
+ return;
+ m_hasSentResponseToPlugin = true;
+ }
+ m_pluginView->didReceiveData(data, length);
+}
+
+void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding)
+{
+ Frame* coreFrame = core(m_webFrame);
+ if (!coreFrame)
+ return;
+
+ // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
+ String encoding = coreFrame->loader()->documentLoader()->overrideEncoding();
+ bool userChosen = !encoding.isNull();
+ if (encoding.isNull())
+ encoding = textEncoding;
+ coreFrame->loader()->setEncoding(encoding, userChosen);
+
+ coreFrame->loader()->addData(data, length);
+}
+
+void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
+{
+ // Telling the frame we received some data and passing 0 as the data is our
+ // way to get work done that is normally done when the first bit of data is
+ // received, even for the case of a document with no data (like about:blank)
+ if (!m_pluginView) {
+ committedLoad(loader, 0, 0);
+ return;
+ }
+
+ if (m_pluginView->status() == PluginStatusLoadedSuccessfully)
+ m_pluginView->didFinishLoading();
+ m_pluginView = 0;
+ m_hasSentResponseToPlugin = false;
+}
+
+void WebFrameLoaderClient::updateGlobalHistory(const KURL& url)
+{
+ COMPtr<WebHistory> history = webHistory();
+ if (!history)
+ return;
+ history->addItemForURL(BString(url.string()), 0);
+}
+
+bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
+{
+ return true;
+}
+
+PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
+{
+ RefPtr<WebDocumentLoader> loader = new WebDocumentLoader(request, substituteData);
+
+ COMPtr<WebDataSource> dataSource(AdoptCOM, WebDataSource::createInstance(loader.get()));
+
+ loader->setDataSource(dataSource.get());
+ return loader.release();
+}
+
+void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
+{
+ BOOL privateBrowsingEnabled = FALSE;
+ COMPtr<IWebPreferences> preferences;
+ if (SUCCEEDED(m_webFrame->webView()->preferences(&preferences)))
+ preferences->privateBrowsingEnabled(&privateBrowsingEnabled);
+ if (privateBrowsingEnabled)
+ return;
+
+ // update title in global history
+ COMPtr<WebHistory> history = webHistory();
+ if (!history)
+ return;
+
+ COMPtr<IWebHistoryItem> item;
+ if (FAILED(history->itemForURL(BString(url.string()), &item)))
+ return;
+
+ COMPtr<IWebHistoryItemPrivate> itemPrivate(Query, item);
+ if (!itemPrivate)
+ return;
+
+ itemPrivate->setTitle(BString(title));
+}
+
+void WebFrameLoaderClient::savePlatformDataToCachedPage(CachedPage* cachedPage)
+{
+ Frame* coreFrame = core(m_webFrame);
+ if (!coreFrame)
+ return;
+
+ ASSERT(coreFrame->loader()->documentLoader() == cachedPage->documentLoader());
+
+ WebCachedPagePlatformData* webPlatformData = new WebCachedPagePlatformData(static_cast<IWebDataSource*>(getWebDataSource(coreFrame->loader()->documentLoader())));
+ cachedPage->setCachedPagePlatformData(webPlatformData);
+}
+
+void WebFrameLoaderClient::transitionToCommittedForNewPage()
+{
+ Frame* frame = core(m_webFrame);
+ ASSERT(frame);
+
+ Page* page = frame->page();
+ ASSERT(page);
+
+ bool isMainFrame = frame == page->mainFrame();
+
+ if (isMainFrame && frame->view())
+ frame->view()->detachFromWindow();
+
+ frame->setView(0);
+
+ WebView* webView = m_webFrame->webView();
+
+ FrameView* frameView;
+ if (isMainFrame) {
+ RECT rect;
+ webView->frameRect(&rect);
+ frameView = new FrameView(frame, IntRect(rect).size());
+ } else
+ frameView = new FrameView(frame);
+
+ frame->setView(frameView);
+ frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.
+
+ HWND viewWindow;
+ if (SUCCEEDED(webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))))
+ frameView->setContainingWindow(viewWindow);
+
+ if (isMainFrame)
+ frameView->attachToWindow();
+
+ if (frame->ownerRenderer())
+ frame->ownerRenderer()->setWidget(frameView);
+
+ if (HTMLFrameOwnerElement* owner = frame->ownerElement())
+ frame->view()->setScrollbarsMode(owner->scrollingMode());
+}
+
+bool WebFrameLoaderClient::canCachePage() const
+{
+ return true;
+}
+
+PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool /*allowsScrolling*/, int /*marginWidth*/, int /*marginHeight*/)
+{
+ RefPtr<Frame> result = createFrame(url, name, ownerElement, referrer);
+ if (!result)
+ return 0;
+
+ // Propagate the marginwidth/height and scrolling modes to the view.
+ if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
+ HTMLFrameElement* frameElt = static_cast<HTMLFrameElement*>(ownerElement);
+ if (frameElt->scrollingMode() == ScrollbarAlwaysOff)
+ result->view()->setScrollbarsMode(ScrollbarAlwaysOff);
+ int marginWidth = frameElt->getMarginWidth();
+ int marginHeight = frameElt->getMarginHeight();
+ if (marginWidth != -1)
+ result->view()->setMarginWidth(marginWidth);
+ if (marginHeight != -1)
+ result->view()->setMarginHeight(marginHeight);
+ }
+
+ return result.release();
+}
+
+PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& URL, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer)
+{
+ Frame* coreFrame = core(m_webFrame);
+ ASSERT(coreFrame);
+
+ COMPtr<WebFrame> webFrame(AdoptCOM, WebFrame::createInstance());
+
+ webFrame->initWithWebFrameView(0, m_webFrame->webView(), coreFrame->page(), ownerElement);
+
+ RefPtr<Frame> childFrame(adoptRef(core(webFrame.get()))); // We have to adopt, because Frames start out with a refcount of 1.
+ ASSERT(childFrame);
+
+ coreFrame->tree()->appendChild(childFrame);
+ childFrame->tree()->setName(name);
+ childFrame->init();
+
+ loadURLIntoChild(URL, referrer, webFrame.get());
+
+ // The frame's onload handler may have removed it from the document.
+ if (!childFrame->tree()->parent())
+ return 0;
+
+ return childFrame.release();
+}
+
+void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const String& referrer, WebFrame* childFrame)
+{
+ ASSERT(childFrame);
+ ASSERT(core(childFrame));
+
+ Frame* coreFrame = core(m_webFrame);
+ ASSERT(coreFrame);
+
+ HistoryItem* parentItem = coreFrame->loader()->currentHistoryItem();
+ FrameLoadType loadType = coreFrame->loader()->loadType();
+ FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedHistory;
+
+ KURL url = originalURL;
+
+ // If we're moving in the backforward list, we might want to replace the content
+ // of this child frame with whatever was there at that point.
+ // Reload will maintain the frame contents, LoadSame will not.
+ if (parentItem && parentItem->children().size() &&
+ (isBackForwardLoadType(loadType)
+ || loadType == FrameLoadTypeReload
+ || loadType == FrameLoadTypeReloadAllowingStaleData))
+ {
+ if (HistoryItem* childItem = parentItem->childItemWithName(core(childFrame)->tree()->name())) {
+ // Use the original URL to ensure we get all the side-effects, such as
+ // onLoad handlers, of any redirects that happened. An example of where
+ // this is needed is Radar 3213556.
+ url = childItem->originalURL();
+ // These behaviors implied by these loadTypes should apply to the child frames
+ childLoadType = loadType;
+
+ if (isBackForwardLoadType(loadType))
+ // For back/forward, remember this item so we can traverse any child items as child frames load
+ core(childFrame)->loader()->setProvisionalHistoryItem(childItem);
+ else
+ // For reload, just reinstall the current item, since a new child frame was created but we won't be creating a new BF item
+ core(childFrame)->loader()->setCurrentHistoryItem(childItem);
+ }
+ }
+
+ // FIXME: Handle loading WebArchives here
+
+ core(childFrame)->loader()->load(url, referrer, childLoadType, String(), 0, 0);
+}
+
+Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+{
+ Frame* frame = core(m_webFrame);
+ PluginView* pluginView = PluginView::create(frame, pluginSize, element, url, paramNames, paramValues, mimeType, loadManually);
+
+ if (pluginView->status() == PluginStatusLoadedSuccessfully)
+ return pluginView;
+
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+
+ WebView* webView = m_webFrame->webView();
+ if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return pluginView;
+
+ RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ unsigned count = (unsigned)paramNames.size();
+ for (unsigned i = 0; i < count; i++) {
+ if (paramNames[i] == "pluginspage") {
+ static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInPageURLStringKey);
+ RetainPtr<CFStringRef> str(AdoptCF, paramValues[i].createCFString());
+ CFDictionarySetValue(userInfo.get(), key, str.get());
+ break;
+ }
+ }
+
+ if (!mimeType.isNull()) {
+ static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorMIMETypeKey);
+
+ RetainPtr<CFStringRef> str(AdoptCF, mimeType.createCFString());
+ CFDictionarySetValue(userInfo.get(), key, str.get());
+ }
+
+ String pluginName;
+ if (pluginView->plugin())
+ pluginName = pluginView->plugin()->name();
+ if (!pluginName.isNull()) {
+ static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInNameKey);
+ RetainPtr<CFStringRef> str(AdoptCF, pluginName.createCFString());
+ CFDictionarySetValue(userInfo.get(), key, str.get());
+ }
+
+ COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+ userInfoBag->setDictionary(userInfo.get());
+
+ int errorCode = 0;
+ switch (pluginView->status()) {
+ case PluginStatusCanNotFindPlugin:
+ errorCode = WebKitErrorCannotFindPlugIn;
+ break;
+ case PluginStatusCanNotLoadPlugin:
+ errorCode = WebKitErrorCannotLoadPlugIn;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ ResourceError resourceError(String(WebKitErrorDomain), errorCode, url.string(), String());
+ COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get()));
+
+ resourceLoadDelegate->plugInFailedWithError(webView, error.get(), getWebDataSource(frame->loader()->documentLoader()));
+
+ return pluginView;
+}
+
+void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
+{
+ // Ideally, this function shouldn't be necessary, see <rdar://problem/4852889>
+
+ m_pluginView = static_cast<PluginView*>(pluginWidget);
+}
+
+COMPtr<WebHistory> WebFrameLoaderClient::webHistory() const
+{
+ if (m_webFrame != m_webFrame->webView()->topLevelFrame())
+ return 0;
+
+ IWebHistoryPrivate* historyInternal = WebHistory::optionalSharedHistoryInternal(); // does not add a ref
+ if (!historyInternal)
+ return 0;
+
+ return COMPtr<WebHistory>(Query, historyInternal);
+}
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
new file mode 100644
index 0000000..dfef4ba
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebFrameLoaderClient_h
+#define WebFrameLoaderClient_h
+
+#pragma warning(push, 0)
+#include <WebCore/FrameLoaderClient.h>
+#pragma warning(pop)
+
+namespace WebCore {
+ class PluginView;
+}
+
+template <typename T> class COMPtr;
+class WebFrame;
+
+class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
+public:
+ virtual bool hasWebView() const;
+ virtual bool hasFrameView() const;
+
+ virtual void forceLayout();
+
+ virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&);
+
+ virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
+ virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
+ virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
+ virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&);
+ virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived);
+ virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier);
+ virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&);
+
+ virtual void dispatchDidHandleOnloadEvents();
+ virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
+ virtual void dispatchDidCancelClientRedirect();
+ virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate);
+ virtual void dispatchDidChangeLocationWithinPage();
+ virtual void dispatchWillClose();
+ virtual void dispatchDidReceiveIcon();
+ virtual void dispatchDidStartProvisionalLoad();
+ virtual void dispatchDidReceiveTitle(const WebCore::String&);
+ virtual void dispatchDidCommitLoad();
+ virtual void dispatchDidFinishDocumentLoad();
+ virtual void dispatchDidFinishLoad();
+ virtual void dispatchDidFirstLayout();
+
+ virtual WebCore::Frame* dispatchCreatePage();
+ virtual void dispatchShow();
+
+ virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*);
+ virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&);
+
+ virtual void postProgressStartedNotification();
+ virtual void postProgressEstimateChangedNotification();
+ virtual void postProgressFinishedNotification();
+
+ virtual void committedLoad(WebCore::DocumentLoader*, const char*, int);
+ virtual void finishedLoading(WebCore::DocumentLoader*);
+
+ virtual void updateGlobalHistory(const WebCore::KURL&);
+ virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
+
+ virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+ virtual void setTitle(const WebCore::String& title, const WebCore::KURL&);
+
+ virtual void savePlatformDataToCachedPage(WebCore::CachedPage*);
+ virtual void transitionToCommittedForNewPage();
+
+ virtual bool canCachePage() const;
+
+ virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement* ownerElement,
+ const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+ virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&, const Vector<WebCore::String>&, const WebCore::String&, bool loadManually);
+ virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
+
+protected:
+ WebFrameLoaderClient(WebFrame*);
+ ~WebFrameLoaderClient();
+
+private:
+ PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WebCore::String& name, WebCore::HTMLFrameOwnerElement*, const WebCore::String& referrer);
+ void loadURLIntoChild(const WebCore::KURL&, const WebCore::String& referrer, WebFrame* childFrame);
+ void receivedData(const char*, int, const WebCore::String&);
+ COMPtr<WebHistory> webHistory() const;
+
+ WebFrame* m_webFrame;
+
+ // Points to the plugin view that data should be redirected to.
+ WebCore::PluginView* m_pluginView;
+
+ bool m_hasSentResponseToPlugin;
+};
+
+#endif // WebFrameLoaderClient_h
diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
new file mode 100644
index 0000000..d74e87a
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
@@ -0,0 +1,413 @@
+/*
+ * Copyright (C) 2006, 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebInspectorClient.h"
+
+#include "WebInspectorDelegate.h"
+#include "WebKit.h"
+#include "WebMutableURLRequest.h"
+#include "WebNodeHighlight.h"
+#include "WebView.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/Element.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/InspectorController.h>
+#include <WebCore/Page.h>
+#include <WebCore/RenderObject.h>
+#pragma warning(pop)
+
+#include <tchar.h>
+#include <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
+static LPCTSTR kWebInspectorWindowClassName = TEXT("WebInspectorWindowClass");
+static ATOM registerWindowClass();
+static LPCTSTR kWebInspectorPointerProp = TEXT("WebInspectorPointer");
+
+static const unsigned defaultAttachedHeight = 300;
+
+static const IntRect& defaultWindowRect()
+{
+ static IntRect rect(60, 200, 750, 650);
+ return rect;
+}
+
+static CFBundleRef getWebKitBundle()
+{
+ return CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"));
+}
+
+WebInspectorClient::WebInspectorClient(WebView* webView)
+ : m_inspectedWebView(webView)
+ , m_hwnd(0)
+ , m_webViewHwnd(0)
+ , m_originalWebViewWndProc(0)
+ , m_attached(false)
+{
+ ASSERT(m_inspectedWebView);
+
+ m_inspectedWebView->viewWindow((OLE_HANDLE*)&m_inspectedWebViewHwnd);
+
+ // FIXME: Implement window size/position save/restore
+#if 0
+ [self setWindowFrameAutosaveName:@"Web Inspector"];
+#endif
+}
+
+WebInspectorClient::~WebInspectorClient()
+{
+ if (m_hwnd)
+ ::DestroyWindow(m_hwnd);
+}
+
+void WebInspectorClient::inspectorDestroyed()
+{
+ delete this;
+}
+
+Page* WebInspectorClient::createPage()
+{
+ if (m_webView)
+ return core(m_webView.get());
+
+ ASSERT(!m_hwnd);
+
+ registerWindowClass();
+
+ m_hwnd = ::CreateWindowEx(0, kWebInspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW,
+ defaultWindowRect().x(), defaultWindowRect().y(), defaultWindowRect().width(), defaultWindowRect().height(),
+ 0, 0, 0, 0);
+
+ if (!m_hwnd)
+ return 0;
+
+ ::SetProp(m_hwnd, kWebInspectorPointerProp, reinterpret_cast<HANDLE>(this));
+
+ m_webView.adoptRef(WebView::createInstance());
+
+ if (FAILED(m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd)))
+ return 0;
+
+ RECT rect;
+ GetClientRect(m_hwnd, &rect);
+ if (FAILED(m_webView->initWithFrame(rect, 0, 0)))
+ return 0;
+
+ COMPtr<WebInspectorDelegate> delegate(AdoptCOM, WebInspectorDelegate::createInstance());
+ if (FAILED(m_webView->setUIDelegate(delegate.get())))
+ return 0;
+
+ // Keep preferences separate from the rest of the client, making sure we are using expected preference values.
+ // One reason this is good is that it keeps the inspector out of history via "private browsing".
+ // FIXME: It's crazy that we have to do this song and dance to end up with
+ // a private WebPreferences object, even within WebKit. We should make this
+ // process simpler, and consider whether we can make it simpler for WebKit
+ // clients as well.
+ COMPtr<WebPreferences> tempPreferences(AdoptCOM, WebPreferences::createInstance());
+ COMPtr<IWebPreferences> iPreferences;
+ if (FAILED(tempPreferences->initWithIdentifier(BString(L"WebInspectorPreferences"), &iPreferences)))
+ return 0;
+ COMPtr<WebPreferences> preferences(Query, iPreferences);
+ if (!preferences)
+ return 0;
+ if (FAILED(preferences->setAutosaves(FALSE)))
+ return 0;
+ if (FAILED(preferences->setPrivateBrowsingEnabled(TRUE)))
+ return 0;
+ if (FAILED(preferences->setLoadsImagesAutomatically(TRUE)))
+ return 0;
+ if (FAILED(preferences->setAuthorAndUserStylesEnabled(TRUE)))
+ return 0;
+ if (FAILED(preferences->setAllowsAnimatedImages(TRUE)))
+ return 0;
+ if (FAILED(preferences->setLoadsImagesAutomatically(TRUE)))
+ return 0;
+ if (FAILED(preferences->setPlugInsEnabled(FALSE)))
+ return 0;
+ if (FAILED(preferences->setJavaEnabled(FALSE)))
+ return 0;
+ if (FAILED(preferences->setUserStyleSheetEnabled(FALSE)))
+ return 0;
+ if (FAILED(preferences->setTabsToLinks(FALSE)))
+ return 0;
+ if (FAILED(preferences->setMinimumFontSize(0)))
+ return 0;
+ if (FAILED(preferences->setMinimumLogicalFontSize(9)))
+ return 0;
+
+ if (FAILED(m_webView->setPreferences(preferences.get())))
+ return 0;
+
+ m_webView->setProhibitsMainFrameScrolling(TRUE);
+
+ if (FAILED(m_webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&m_webViewHwnd))))
+ return 0;
+
+ COMPtr<WebMutableURLRequest> request;
+ request.adoptRef(WebMutableURLRequest::createInstance());
+
+ RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
+ if (!htmlURLRef)
+ return 0;
+
+ CFStringRef urlStringRef = ::CFURLGetString(htmlURLRef.get());
+ if (FAILED(request->initWithURL(BString(urlStringRef), WebURLRequestUseProtocolCachePolicy, 60)))
+ return 0;
+
+ if (FAILED(m_webView->topLevelFrame()->loadRequest(request.get())))
+ return 0;
+
+ return core(m_webView.get());
+}
+
+
+String WebInspectorClient::localizedStringsURL()
+{
+ RetainPtr<CFURLRef> url(AdoptCF, CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("InspectorLocalizedStrings"), CFSTR("js"), 0));
+ if (!url)
+ return String();
+
+ return CFURLGetString(url.get());
+}
+
+void WebInspectorClient::showWindow()
+{
+ if (!m_hwnd)
+ return;
+
+ updateWindowTitle();
+ ::SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
+ m_inspectedWebView->page()->inspectorController()->setWindowVisible(true);
+}
+
+void WebInspectorClient::closeWindow()
+{
+ if (!m_webView)
+ return;
+
+ ::ShowWindow(m_hwnd, SW_HIDE);
+ m_inspectedWebView->page()->inspectorController()->setWindowVisible(false);
+}
+
+bool WebInspectorClient::windowVisible()
+{
+ return !!::IsWindowVisible(m_hwnd);
+}
+
+void WebInspectorClient::attachWindow()
+{
+ ASSERT(m_hwnd);
+ ASSERT(m_webView);
+ ASSERT(!m_attached);
+ ASSERT(m_inspectedWebViewHwnd);
+
+ if (!m_originalWebViewWndProc) {
+ ::SetProp(m_inspectedWebViewHwnd, kWebInspectorPointerProp, reinterpret_cast<HANDLE>(this));
+#pragma warning(disable: 4244 4312)
+ m_originalWebViewWndProc = (WNDPROC)::SetWindowLongPtr(m_inspectedWebViewHwnd, GWLP_WNDPROC, (LONG_PTR)SubclassedWebViewWndProc);
+ }
+
+ HWND hostWindow;
+ if (FAILED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow)))
+ return;
+
+ m_webView->setHostWindow((OLE_HANDLE)(ULONG64)hostWindow);
+ ::ShowWindow(m_hwnd, SW_HIDE);
+ m_attached = true;
+
+ ::SendMessage(hostWindow, WM_SIZE, 0, 0);
+
+ if (m_highlight && m_highlight->visible())
+ m_highlight->updateWindow();
+}
+
+void WebInspectorClient::detachWindow()
+{
+ ASSERT(m_attached);
+ ASSERT(m_originalWebViewWndProc);
+
+ ::SetWindowLongPtr(m_inspectedWebViewHwnd, GWLP_WNDPROC, (LONG_PTR)m_originalWebViewWndProc);
+ ::RemoveProp(m_inspectedWebViewHwnd, kWebInspectorPointerProp);
+ m_originalWebViewWndProc = 0;
+
+ m_attached = false;
+
+ m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd);
+ ::ShowWindow(m_hwnd, SW_SHOW);
+ ::SendMessage(m_hwnd, WM_SIZE, 0, 0);
+
+ HWND hostWindow;
+ if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow)))
+ ::SendMessage(hostWindow, WM_SIZE, 0, 0);
+
+ if (m_highlight && m_highlight->visible())
+ m_highlight->updateWindow();
+}
+
+void WebInspectorClient::highlight(Node*)
+{
+ if (!m_highlight)
+ m_highlight.set(new WebNodeHighlight(m_inspectedWebView));
+
+ m_highlight->show();
+}
+
+void WebInspectorClient::hideHighlight()
+{
+ if (m_highlight)
+ m_highlight->hide();
+}
+
+void WebInspectorClient::inspectedURLChanged(const String& newURL)
+{
+ m_inspectedURL = newURL;
+ updateWindowTitle();
+}
+
+void WebInspectorClient::updateWindowTitle()
+{
+ // FIXME: The series of appends should be replaced with a call to String::format()
+ // when it can be figured out how to get the unicode em-dash to show up.
+ String title = "Web Inspector ";
+ title.append((UChar)0x2014); // em-dash
+ title.append(' ');
+ title.append(m_inspectedURL);
+ ::SetWindowText(m_hwnd, title.charactersWithNullTermination());
+}
+
+LRESULT WebInspectorClient::onGetMinMaxInfo(WPARAM, LPARAM lParam)
+{
+ MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(lParam);
+ POINT size = {400, 400};
+ info->ptMinTrackSize = size;
+
+ return 0;
+}
+
+LRESULT WebInspectorClient::onSize(WPARAM, LPARAM)
+{
+ RECT rect;
+ ::GetClientRect(m_hwnd, &rect);
+
+ ::SetWindowPos(m_webViewHwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
+
+ return 0;
+}
+
+LRESULT WebInspectorClient::onClose(WPARAM, LPARAM)
+{
+ ::ShowWindow(m_hwnd, SW_HIDE);
+ m_inspectedWebView->page()->inspectorController()->setWindowVisible(false);
+
+ hideHighlight();
+
+ return 0;
+}
+
+void WebInspectorClient::onWebViewWindowPosChanging(WPARAM, LPARAM lParam)
+{
+ ASSERT(m_attached);
+
+ WINDOWPOS* windowPos = reinterpret_cast<WINDOWPOS*>(lParam);
+ ASSERT_ARG(lParam, windowPos);
+
+ if (windowPos->flags & SWP_NOSIZE)
+ return;
+
+ windowPos->cy -= defaultAttachedHeight;
+
+ ::SetWindowPos(m_webViewHwnd, 0, windowPos->x, windowPos->y + windowPos->cy, windowPos->cx, defaultAttachedHeight, SWP_NOZORDER);
+}
+
+static LRESULT CALLBACK WebInspectorWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WebInspectorClient* client = reinterpret_cast<WebInspectorClient*>(::GetProp(hwnd, kWebInspectorPointerProp));
+ if (!client)
+ return ::DefWindowProc(hwnd, msg, wParam, lParam);
+
+ switch (msg) {
+ case WM_GETMINMAXINFO:
+ return client->onGetMinMaxInfo(wParam, lParam);
+ case WM_SIZE:
+ return client->onSize(wParam, lParam);
+ case WM_CLOSE:
+ return client->onClose(wParam, lParam);
+ default:
+ break;
+ }
+
+ return ::DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+static LRESULT CALLBACK SubclassedWebViewWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WebInspectorClient* client = reinterpret_cast<WebInspectorClient*>(::GetProp(hwnd, kWebInspectorPointerProp));
+ ASSERT(client);
+
+ switch (msg) {
+ case WM_WINDOWPOSCHANGING:
+ client->onWebViewWindowPosChanging(wParam, lParam);
+ default:
+ break;
+ }
+
+ return ::CallWindowProc(client->m_originalWebViewWndProc, hwnd, msg, wParam, lParam);
+}
+
+static ATOM registerWindowClass()
+{
+ static bool haveRegisteredWindowClass = false;
+
+ if (haveRegisteredWindowClass)
+ return true;
+
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = 0;
+ wcex.lpfnWndProc = WebInspectorWndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = 0;
+ wcex.hIcon = 0;
+ wcex.hCursor = LoadCursor(0, IDC_ARROW);
+ wcex.hbrBackground = 0;
+ wcex.lpszMenuName = 0;
+ wcex.lpszClassName = kWebInspectorWindowClassName;
+ wcex.hIconSm = 0;
+
+ haveRegisteredWindowClass = true;
+
+ return ::RegisterClassEx(&wcex);
+}
diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h
new file mode 100644
index 0000000..335f29d
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2006, 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebInspectorClient_h
+#define WebInspectorClient_h
+
+#include <WebCore/COMPtr.h>
+#include <WebCore/InspectorClient.h>
+#include <WebCore/PlatformString.h>
+#include <wtf/OwnPtr.h>
+#include <windows.h>
+
+class WebNodeHighlight;
+class WebView;
+
+class WebInspectorClient : public WebCore::InspectorClient {
+public:
+ WebInspectorClient(WebView*);
+
+ // InspectorClient
+ virtual void inspectorDestroyed();
+
+ virtual WebCore::Page* createPage();
+
+ virtual WebCore::String localizedStringsURL();
+
+ virtual void showWindow();
+ virtual void closeWindow();
+ virtual bool windowVisible();
+
+ virtual void attachWindow();
+ virtual void detachWindow();
+
+ virtual void highlight(WebCore::Node*);
+ virtual void hideHighlight();
+
+ virtual void inspectedURLChanged(const WebCore::String& newURL);
+
+private:
+ ~WebInspectorClient();
+
+ void updateWindowTitle();
+
+ LRESULT onGetMinMaxInfo(WPARAM, LPARAM);
+ LRESULT onSize(WPARAM, LPARAM);
+ LRESULT onClose(WPARAM, LPARAM);
+
+ void onWebViewWindowPosChanging(WPARAM, LPARAM);
+
+ WebView* m_inspectedWebView;
+ HWND m_inspectedWebViewHwnd;
+ HWND m_hwnd;
+ COMPtr<WebView> m_webView;
+ HWND m_webViewHwnd;
+ WNDPROC m_originalWebViewWndProc;
+
+ bool m_attached;
+
+ OwnPtr<WebNodeHighlight> m_highlight;
+
+ WebCore::String m_inspectedURL;
+
+ static friend LRESULT CALLBACK WebInspectorWndProc(HWND, UINT, WPARAM, LPARAM);
+ static friend LRESULT CALLBACK SubclassedWebViewWndProc(HWND, UINT, WPARAM, LPARAM);
+};
+
+#endif // !defined(WebInspectorClient_h)
diff --git a/WebKit/win/WebCoreSupport/WebInspectorDelegate.cpp b/WebKit/win/WebCoreSupport/WebInspectorDelegate.cpp
new file mode 100644
index 0000000..3ed8c9d
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebInspectorDelegate.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebInspectorDelegate.h"
+
+WebInspectorDelegate::WebInspectorDelegate()
+ :m_refCount(0)
+{
+}
+
+WebInspectorDelegate* WebInspectorDelegate::createInstance()
+{
+ WebInspectorDelegate* instance = new WebInspectorDelegate;
+ instance->AddRef();
+ return instance;
+}
+
+ULONG STDMETHODCALLTYPE WebInspectorDelegate::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebInspectorDelegate::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspectorDelegate::dragDestinationActionMaskForDraggingInfo(
+ /* [in] */ IWebView*,
+ /* [in] */ IDataObject*,
+ /* [retval][out] */ WebDragDestinationAction* action)
+{
+ *action = WebDragDestinationActionNone;
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebCoreSupport/WebInspectorDelegate.h b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h
new file mode 100644
index 0000000..a14c5fc
--- /dev/null
+++ b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebInspectorDelegate_h
+#define WebInspectorDelegate_h
+
+struct IDataObject;
+struct IPropertyBag;
+struct IWebView;
+struct IWebFrame;
+struct IWebError;
+struct IWebURLRequest;
+struct IWebOpenPanelResultListener;
+
+class WebInspectorDelegate : public IWebUIDelegate {
+public:
+ static WebInspectorDelegate* createInstance();
+
+ // IUnknown
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**) { return E_NOTIMPL; };
+
+ // IWebUIDelegate
+ virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo(
+ /* [in] */ IWebView*,
+ /* [in] */ IDataObject*,
+ /* [retval][out] */ WebDragDestinationAction* action);
+
+ // Not implemented
+ virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(
+ /* [in] */ IWebView*,
+ /* [in] */ IWebURLRequest*,
+ /* [retval][out] */ IWebView**) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewShow(
+ /* [in] */ IWebView*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewClose(
+ /* [in] */ IWebView*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewFocus(
+ /* [in] */ IWebView*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewUnfocus(
+ /* [in] */ IWebView*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ OLE_HANDLE*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE makeFirstResponder(
+ /* [in] */ IWebView*,
+ /* [in] */ OLE_HANDLE) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setStatusText(
+ /* [in] */ IWebView*,
+ /* [in] */ BSTR) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewStatusText(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ BSTR*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible(
+ /* [in] */ IWebView*,
+ /* [in] */ BOOL) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible(
+ /* [in] */ IWebView*,
+ /* [in] */ BOOL) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewIsResizable(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setResizable(
+ /* [in] */ IWebView*,
+ /* [in] */ BOOL) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setFrame(
+ /* [in] */ IWebView*,
+ /* [in] */ RECT*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewFrame(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ RECT*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setContentRect(
+ /* [in] */ IWebView*,
+ /* [in] */ RECT*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE webViewContentRect(
+ /* [in] */ IWebView*,
+ /* [retval][out] */ RECT*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage(
+ /* [in] */ IWebView*,
+ /* [in] */ BSTR) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage(
+ /* [in] */ IWebView*,
+ /* [in] */ BSTR,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt(
+ /* [in] */ IWebView*,
+ /* [in] */ BSTR /*message*/,
+ /* [in] */ BSTR /*defaultText*/,
+ /* [retval][out] */ BSTR*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage(
+ /* [in] */ IWebView*,
+ /* [in] */ BSTR /*message*/,
+ /* [in] */ IWebFrame* /*initiatedByFrame*/,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener(
+ /* [in] */ IWebView*,
+ /* [in] */ IWebOpenPanelResultListener*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement(
+ /* [in] */ IWebView*,
+ /* [in] */ IPropertyBag*,
+ /* [in] */ UINT /*modifierFlags*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement(
+ /* [in] */ IWebView*,
+ /* [in] */ IPropertyBag*,
+ /* [in] */ OLE_HANDLE,
+ /* [retval][out] */ OLE_HANDLE*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem(
+ /* [in] */ IWebView*,
+ /* [in] */ UINT,
+ /* [in] */ BOOL,
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE shouldPerformAction(
+ /* [in] */ IWebView*,
+ /* [in] */ UINT /*itemCommandID*/,
+ /* [in] */ UINT /*sender*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction(
+ /* [in] */ IWebView*,
+ /* [in] */ WebDragDestinationAction,
+ /* [in] */ IDataObject*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint(
+ /* [in] */ IWebView*,
+ /* [in] */ LPPOINT,
+ /* [retval][out] */ WebDragSourceAction*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction(
+ /* [in] */ IWebView*,
+ /* [in] */ WebDragSourceAction,
+ /* [in] */ LPPOINT,
+ /* [in] */ IDataObject*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected(
+ /* [in] */ IWebView*,
+ /* [in] */ void* /*item*/,
+ /* [in] */ IPropertyBag*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation(
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu(
+ /* [in] */ IWebView*,
+ /* [in] */ OLE_HANDLE,
+ /* [in] */ LPPOINT) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem(
+ /* [in] */ IWebView*,
+ /* [in] */ void* /*measureItem*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem(
+ /* [in] */ IWebView*,
+ /* [in] */ void* /*drawItem*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData(
+ /* [in] */ IWebView*,
+ /* [in] */ OLE_HANDLE) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData(
+ /* [in] */ IWebView*,
+ /* [in] */ OLE_HANDLE) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE canTakeFocus(
+ /* [in] */ IWebView*,
+ /* [in] */ BOOL /*forward*/,
+ /* [out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE takeFocus(
+ /* [in] */ IWebView*,
+ /* [in] */ BOOL /*forward*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget(
+ /* [in] */ IWebUndoTarget*,
+ /* [in] */ BSTR /*actionName*/,
+ /* [in] */ IUnknown* /*actionArg*/) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget(
+ /* [in] */ IWebUndoTarget*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE setActionTitle(
+ /* [in] */ BSTR) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE undo() { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE redo() { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE canUndo(
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+ virtual HRESULT STDMETHODCALLTYPE canRedo(
+ /* [retval][out] */ BOOL*) { return E_NOTIMPL; }
+
+private:
+ WebInspectorDelegate();
+
+ ULONG m_refCount;
+};
+
+#endif // WebInspectorDelegate_h
diff --git a/WebKit/win/WebDataSource.cpp b/WebKit/win/WebDataSource.cpp
new file mode 100644
index 0000000..153994f
--- /dev/null
+++ b/WebKit/win/WebDataSource.cpp
@@ -0,0 +1,305 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebDataSource.h"
+
+#include "WebKit.h"
+#include "MemoryStream.h"
+#include "WebDocumentLoader.h"
+#include "WebError.h"
+#include "WebFrame.h"
+#include "WebKit.h"
+#include "WebHTMLRepresentation.h"
+#include "WebKitStatisticsPrivate.h"
+#include "WebMutableURLRequest.h"
+#include "WebResource.h"
+#include "WebURLResponse.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/DocLoader.h>
+#include <WebCore/Document.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/KURL.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebDataSource ----------------------------------------------------------------
+
+// {F230854D-7091-428a-8DB5-37CABA44C105}
+const GUID IID_WebDataSource =
+{ 0x5c2f9099, 0xe65e, 0x4a0f, { 0x9c, 0xa0, 0x6a, 0xd6, 0x92, 0x52, 0xa6, 0x2a } };
+
+WebDataSource::WebDataSource(WebDocumentLoader* loader)
+ : m_refCount(0)
+ , m_loader(loader)
+{
+ WebDataSourceCount++;
+ gClassCount++;
+}
+
+WebDataSource::~WebDataSource()
+{
+ if (m_loader)
+ m_loader->detachDataSource();
+ WebDataSourceCount--;
+ gClassCount--;
+}
+
+WebDataSource* WebDataSource::createInstance(WebDocumentLoader* loader)
+{
+ WebDataSource* instance = new WebDataSource(loader);
+ instance->AddRef();
+ return instance;
+}
+
+WebDocumentLoader* WebDataSource::documentLoader() const
+{
+ return m_loader.get();
+}
+
+// IWebDataSourcePrivate ------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDataSource::overrideEncoding(
+ /* [retval][out] */ BSTR* /*encoding*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::setOverrideEncoding(
+ /* [in] */ BSTR /*encoding*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::mainDocumentError(
+ /* [retval][out] */ IWebError** error)
+{
+ if (!error) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *error = 0;
+
+ if (!m_loader)
+ return E_FAIL;
+
+ if (m_loader->mainDocumentError().isNull())
+ return S_OK;
+
+ *error = WebError::createInstance(m_loader->mainDocumentError());
+ return S_OK;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDataSource::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_WebDataSource))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebDataSource*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDataSource))
+ *ppvObject = static_cast<IWebDataSource*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDataSourcePrivate))
+ *ppvObject = static_cast<IWebDataSourcePrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebDataSource::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebDataSource::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebDataSource --------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDataSource::initWithRequest(
+ /* [in] */ IWebURLRequest* /*request*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::data(
+ /* [retval][out] */ IStream** stream)
+{
+ *stream = 0;
+ if (!m_loader)
+ return E_FAIL;
+
+ *stream = MemoryStream::createInstance(m_loader->mainResourceData());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::representation(
+ /* [retval][out] */ IWebDocumentRepresentation** rep)
+{
+ HRESULT hr = S_OK;
+ if (!m_representation) {
+ WebHTMLRepresentation* htmlRep = WebHTMLRepresentation::createInstance(static_cast<WebFrame*>(m_loader->frameLoader()->client()));
+ hr = htmlRep->QueryInterface(IID_IWebDocumentRepresentation, (void**) &m_representation);
+ htmlRep->Release();
+ }
+
+ return m_representation.copyRefTo(rep);
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::webFrame(
+ /* [retval][out] */ IWebFrame** frame)
+{
+ *frame = static_cast<WebFrame*>(m_loader->frameLoader()->client());
+ (*frame)->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::initialRequest(
+ /* [retval][out] */ IWebURLRequest** request)
+{
+ *request = WebMutableURLRequest::createInstance(m_loader->initialRequest());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::request(
+ /* [retval][out] */ IWebMutableURLRequest** request)
+{
+ *request = WebMutableURLRequest::createInstance(m_loader->request());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::response(
+ /* [retval][out] */ IWebURLResponse** response)
+{
+ *response = WebURLResponse::createInstance(m_loader->response());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::textEncodingName(
+ /* [retval][out] */ BSTR* name)
+{
+ String encoding = m_loader->overrideEncoding();
+ if (encoding.isNull())
+ encoding = m_loader->response().textEncodingName();
+
+ *name = BString(encoding).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::isLoading(
+ /* [retval][out] */ BOOL* loading)
+{
+ *loading = m_loader->isLoadingInAPISense();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::pageTitle(
+ /* [retval][out] */ BSTR* title)
+{
+ *title = BString(m_loader->title()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::unreachableURL(
+ /* [retval][out] */ BSTR* url)
+{
+ KURL unreachableURL = m_loader->unreachableURL();
+ BString urlString((LPOLESTR)unreachableURL.string().characters(), unreachableURL.string().length());
+
+ *url = urlString.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::webArchive(
+ /* [retval][out] */ IWebArchive** /*archive*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::mainResource(
+ /* [retval][out] */ IWebResource** /*resource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::subresources(
+ /* [retval][out] */ IEnumVARIANT** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::subresourceForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ IWebResource** resource)
+{
+ if (!resource) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *resource = 0;
+
+ Document *doc = m_loader->frameLoader()->frame()->document();
+
+ if (!doc)
+ return E_FAIL;
+
+ CachedResource *cachedResource = doc->docLoader()->cachedResource(String(url));
+
+ if (!cachedResource)
+ return E_FAIL;
+
+ *resource = WebResource::createInstance(cachedResource->data(), cachedResource->response());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDataSource::addSubresource(
+ /* [in] */ IWebResource* /*subresource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
diff --git a/WebKit/win/WebDataSource.h b/WebKit/win/WebDataSource.h
new file mode 100644
index 0000000..70998ae
--- /dev/null
+++ b/WebKit/win/WebDataSource.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebDataSource_H
+#define WebDataSource_H
+
+#include "WebKit.h"
+#include "COMPtr.h"
+#include <WTF/RefPtr.h>
+
+class WebDocumentLoader;
+class WebMutableURLRequest;
+
+extern const GUID IID_WebDataSource;
+
+class WebDataSource : public IWebDataSource, public IWebDataSourcePrivate
+{
+public:
+ static WebDataSource* createInstance(WebDocumentLoader*);
+protected:
+ WebDataSource(WebDocumentLoader*);
+ ~WebDataSource();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebDataSource
+ virtual HRESULT STDMETHODCALLTYPE initWithRequest(
+ /* [in] */ IWebURLRequest *request);
+
+ virtual HRESULT STDMETHODCALLTYPE data(
+ /* [retval][out] */ IStream **stream);
+
+ virtual HRESULT STDMETHODCALLTYPE representation(
+ /* [retval][out] */ IWebDocumentRepresentation **rep);
+
+ virtual HRESULT STDMETHODCALLTYPE webFrame(
+ /* [retval][out] */ IWebFrame **frame);
+
+ virtual HRESULT STDMETHODCALLTYPE initialRequest(
+ /* [retval][out] */ IWebURLRequest **request);
+
+ virtual HRESULT STDMETHODCALLTYPE request(
+ /* [retval][out] */ IWebMutableURLRequest **request);
+
+ virtual HRESULT STDMETHODCALLTYPE response(
+ /* [retval][out] */ IWebURLResponse **response);
+
+ virtual HRESULT STDMETHODCALLTYPE textEncodingName(
+ /* [retval][out] */ BSTR *name);
+
+ virtual HRESULT STDMETHODCALLTYPE isLoading(
+ /* [retval][out] */ BOOL *loading);
+
+ virtual HRESULT STDMETHODCALLTYPE pageTitle(
+ /* [retval][out] */ BSTR *title);
+
+ virtual HRESULT STDMETHODCALLTYPE unreachableURL(
+ /* [retval][out] */ BSTR *url);
+
+ virtual HRESULT STDMETHODCALLTYPE webArchive(
+ /* [retval][out] */ IWebArchive **archive);
+
+ virtual HRESULT STDMETHODCALLTYPE mainResource(
+ /* [retval][out] */ IWebResource **resource);
+
+ virtual HRESULT STDMETHODCALLTYPE subresources(
+ /* [retval][out] */ IEnumVARIANT **enumResources);
+
+ virtual HRESULT STDMETHODCALLTYPE subresourceForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ IWebResource **resource);
+
+ virtual HRESULT STDMETHODCALLTYPE addSubresource(
+ /* [in] */ IWebResource *subresource);
+
+ // IWebDataSourcePrivate
+
+ virtual HRESULT STDMETHODCALLTYPE overrideEncoding(
+ /* [retval][out] */ BSTR *encoding);
+
+ virtual HRESULT STDMETHODCALLTYPE setOverrideEncoding(
+ /* [in] */ BSTR encoding);
+
+ virtual HRESULT STDMETHODCALLTYPE mainDocumentError(
+ /* [retval][out] */ IWebError** error);
+
+ // WebDataSource
+ WebDocumentLoader* documentLoader() const;
+protected:
+ ULONG m_refCount;
+ RefPtr<WebDocumentLoader> m_loader;
+ COMPtr<IWebDocumentRepresentation> m_representation;
+};
+
+#endif
diff --git a/WebKit/win/WebDatabaseManager.cpp b/WebKit/win/WebDatabaseManager.cpp
new file mode 100644
index 0000000..5b83d6e
--- /dev/null
+++ b/WebKit/win/WebDatabaseManager.cpp
@@ -0,0 +1,364 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebDatabaseManager.h"
+#include "WebKitDLL.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "COMEnumVariant.h"
+#include "MarshallingHelpers.h"
+#include "WebNotificationCenter.h"
+#include "WebSecurityOrigin.h"
+
+#include <WebCore/BString.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/DatabaseTracker.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/SecurityOrigin.h>
+
+using namespace WebCore;
+
+static inline bool isEqual(LPCWSTR s1, LPCWSTR s2)
+{
+ return !wcscmp(s1, s2);
+}
+
+class DatabaseDetailsPropertyBag : public IPropertyBag, Noncopyable {
+public:
+ static DatabaseDetailsPropertyBag* createInstance(const DatabaseDetails&);
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IPropertyBag
+ virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
+ virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT* pVar);
+private:
+ DatabaseDetailsPropertyBag(const DatabaseDetails& details)
+ : m_refCount(0)
+ , m_details(details) { }
+ ~DatabaseDetailsPropertyBag() { }
+
+ ULONG m_refCount;
+ DatabaseDetails m_details;
+};
+
+// DatabaseDetailsPropertyBag ------------------------------------------------------
+DatabaseDetailsPropertyBag* DatabaseDetailsPropertyBag::createInstance(const DatabaseDetails& details)
+{
+ DatabaseDetailsPropertyBag* instance = new DatabaseDetailsPropertyBag(details);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown ------------------------------------------------------------------------
+ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+// IPropertyBag --------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog*)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+
+ VariantInit(pVar);
+
+ if (isEqual(pszPropName, WebDatabaseDisplayNameKey)) {
+ COMVariantSetter<String>::setVariant(pVar, m_details.displayName());
+ return S_OK;
+ } else if (isEqual(pszPropName, WebDatabaseExpectedSizeKey)) {
+ COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.expectedUsage());
+ return S_OK;
+ } else if (isEqual(pszPropName, WebDatabaseUsageKey)) {
+ COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.currentUsage());
+ return S_OK;
+ }
+
+ return E_INVALIDARG;
+}
+
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+
+ return E_FAIL;
+}
+
+static COMPtr<WebDatabaseManager> s_sharedWebDatabaseManager;
+
+// WebDatabaseManager --------------------------------------------------------------
+WebDatabaseManager* WebDatabaseManager::createInstance()
+{
+ WebDatabaseManager* manager = new WebDatabaseManager();
+ manager->AddRef();
+ return manager;
+}
+
+WebDatabaseManager::WebDatabaseManager()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebDatabaseManager::~WebDatabaseManager()
+{
+ gClassCount--;
+}
+
+// IUnknown ------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<WebDatabaseManager*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDatabaseManager))
+ *ppvObject = static_cast<WebDatabaseManager*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebDatabaseManager::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebDatabaseManager::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+template<> struct COMVariantSetter<RefPtr<SecurityOrigin> > : COMIUnknownVariantSetter<WebSecurityOrigin, RefPtr<SecurityOrigin> > {};
+
+// IWebDatabaseManager -------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::sharedWebDatabaseManager(
+ /* [retval][out] */ IWebDatabaseManager** result)
+{
+ if (!s_sharedWebDatabaseManager) {
+ s_sharedWebDatabaseManager.adoptRef(WebDatabaseManager::createInstance());
+ DatabaseTracker::tracker().setClient(s_sharedWebDatabaseManager.get());
+ }
+
+ return s_sharedWebDatabaseManager.copyRefTo(result);
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::origins(
+ /* [retval][out] */ IEnumVARIANT** result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = 0;
+
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ Vector<RefPtr<SecurityOrigin> > origins;
+ DatabaseTracker::tracker().origins(origins);
+ COMPtr<COMEnumVariant<Vector<RefPtr<SecurityOrigin> > > > enumVariant(AdoptCOM, COMEnumVariant<Vector<RefPtr<SecurityOrigin> > >::adopt(origins));
+
+ *result = enumVariant.releaseRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::databasesWithOrigin(
+ /* [in] */ IWebSecurityOrigin* origin,
+ /* [retval][out] */ IEnumVARIANT** result)
+{
+ if (!origin || !result)
+ return E_POINTER;
+
+ *result = 0;
+
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+ if (!webSecurityOrigin)
+ return E_FAIL;
+
+ Vector<String> databaseNames;
+ DatabaseTracker::tracker().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
+
+ COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::adopt(databaseNames));
+
+ *result = enumVariant.releaseRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabase(
+ /* [in] */ BSTR databaseName,
+ /* [in] */ IWebSecurityOrigin* origin,
+ /* [retval][out] */ IPropertyBag** result)
+{
+ if (!origin || !result)
+ return E_POINTER;
+
+ *result = 0;
+
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+ if (!webSecurityOrigin)
+ return E_FAIL;
+
+ DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
+ webSecurityOrigin->securityOrigin());
+
+ if (details.name().isNull())
+ return E_INVALIDARG;
+
+ *result = DatabaseDetailsPropertyBag::createInstance(details);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteAllDatabases()
+{
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ DatabaseTracker::tracker().deleteAllDatabases();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteOrigin(
+ /* [in] */ IWebSecurityOrigin* origin)
+{
+ if (!origin)
+ return E_POINTER;
+
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+ if (!webSecurityOrigin)
+ return E_FAIL;
+
+ DatabaseTracker::tracker().deleteOrigin(webSecurityOrigin->securityOrigin());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabase(
+ /* [in] */ BSTR databaseName,
+ /* [in] */ IWebSecurityOrigin* origin)
+{
+ if (!origin)
+ return E_POINTER;
+
+ if (!databaseName)
+ return E_INVALIDARG;
+
+ if (this != s_sharedWebDatabaseManager)
+ return E_FAIL;
+
+ COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+ if (!webSecurityOrigin)
+ return E_FAIL;
+
+ DatabaseTracker::tracker().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
+
+ return S_OK;
+}
+
+void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
+{
+ static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyOriginNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+
+ COMPtr<WebSecurityOrigin> securityOrigin(AdoptCOM, WebSecurityOrigin::createInstance(origin));
+ notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), 0);
+}
+
+void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseName)
+{
+ static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyDatabaseNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+
+ COMPtr<WebSecurityOrigin> securityOrigin(AdoptCOM, WebSecurityOrigin::createInstance(origin));
+
+ RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ static CFStringRef databaseNameKey = MarshallingHelpers::LPCOLESTRToCFStringRef(WebDatabaseNameKey);
+ RetainPtr<CFStringRef> str(AdoptCF, databaseName.createCFString());
+ CFDictionarySetValue(userInfo.get(), databaseNameKey, str.get());
+
+ COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+ userInfoBag->setDictionary(userInfo.get());
+
+ notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
+}
+
+void WebKitSetWebDatabasesPathIfNecessary()
+{
+ static bool pathSet = false;
+ if (pathSet)
+ return;
+
+ WebCore::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
+ WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databasesDirectory);
+
+ pathSet = true;
+}
diff --git a/WebKit/win/WebDatabaseManager.h b/WebKit/win/WebDatabaseManager.h
new file mode 100644
index 0000000..303f1e8
--- /dev/null
+++ b/WebKit/win/WebDatabaseManager.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebDatabaseManager_h
+#define WebDatabaseManager_h
+
+#include <WebCore/DatabaseTrackerClient.h>
+
+#include "WebKit.h"
+
+class WebDatabaseManager : public IWebDatabaseManager, private WebCore::DatabaseTrackerClient {
+public:
+ static WebDatabaseManager* createInstance();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebDatabaseManager
+ virtual HRESULT STDMETHODCALLTYPE sharedWebDatabaseManager(
+ /* [retval][out] */ IWebDatabaseManager** result);
+
+ virtual HRESULT STDMETHODCALLTYPE origins(
+ /* [retval][out] */ IEnumVARIANT** result);
+
+ virtual HRESULT STDMETHODCALLTYPE databasesWithOrigin(
+ /* [in] */ IWebSecurityOrigin* origin,
+ /* [retval][out] */ IEnumVARIANT** result);
+
+ virtual HRESULT STDMETHODCALLTYPE detailsForDatabase(
+ /* [in] */ BSTR databaseName,
+ /* [in] */ IWebSecurityOrigin* origin,
+ /* [retval][out] */ IPropertyBag** result);
+
+ virtual HRESULT STDMETHODCALLTYPE deleteAllDatabases();
+
+ virtual HRESULT STDMETHODCALLTYPE deleteOrigin(
+ /* [in] */ IWebSecurityOrigin* origin);
+
+ virtual HRESULT STDMETHODCALLTYPE deleteDatabase(
+ /* [in] */ BSTR databaseName,
+ /* [in] */ IWebSecurityOrigin* origin);
+
+ // DatabaseTrackerClient
+ virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
+ virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WebCore::String& databaseName);
+
+private:
+ WebDatabaseManager();
+ ~WebDatabaseManager();
+
+ ULONG m_refCount;
+};
+
+void WebKitSetWebDatabasesPathIfNecessary();
+
+#endif
diff --git a/WebKit/win/WebDocumentLoader.cpp b/WebKit/win/WebDocumentLoader.cpp
new file mode 100644
index 0000000..f333c67
--- /dev/null
+++ b/WebKit/win/WebDocumentLoader.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WebDocumentLoader.h"
+
+using namespace WebCore;
+
+WebDocumentLoader::WebDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
+ : DocumentLoader(request, substituteData)
+ , m_dataSource(0)
+ , m_detachedDataSource(0)
+{
+}
+
+WebDocumentLoader::~WebDocumentLoader()
+{
+ if (m_dataSource) {
+ ASSERT(!m_detachedDataSource);
+ m_dataSource->Release();
+ }
+}
+
+void WebDocumentLoader::setDataSource(WebDataSource *dataSource)
+{
+ ASSERT(!m_dataSource);
+ m_dataSource = dataSource;
+ if (m_dataSource)
+ m_dataSource->AddRef();
+}
+
+WebDataSource* WebDocumentLoader::dataSource() const
+{
+ return m_dataSource;
+}
+
+void WebDocumentLoader::detachDataSource()
+{
+ // we only call detachDataSource when the WebDataSource is freed - and we won't get there if m_dataSource is not
+ // null (because that would mean the loader still has a reference to the data source)
+ ASSERT(!m_dataSource);
+ m_detachedDataSource = 0;
+}
+
+void WebDocumentLoader::attachToFrame()
+{
+ DocumentLoader::attachToFrame();
+ if (m_detachedDataSource) {
+ ASSERT(!m_dataSource);
+ setDataSource(m_detachedDataSource);
+ m_detachedDataSource = 0;
+ }
+}
+
+void WebDocumentLoader::detachFromFrame()
+{
+ DocumentLoader::detachFromFrame();
+ m_detachedDataSource = m_dataSource;
+ if (m_dataSource) {
+ WebDataSource* dataSourceToBeReleased = m_dataSource;
+ // It's important to null out m_dataSource before calling release on the data source. That release can cause the data
+ // source to be deleted - which ends up calling loader->detachDataSource() which makes the assumption that the loader no
+ // longer holds a reference to the data source.
+ m_dataSource = 0;
+ dataSourceToBeReleased->Release();
+ }
+}
diff --git a/WebKit/win/WebDocumentLoader.h b/WebKit/win/WebDocumentLoader.h
new file mode 100644
index 0000000..e6e628a
--- /dev/null
+++ b/WebKit/win/WebDocumentLoader.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebDataSource.h"
+
+#pragma warning(push, 0)
+#include <WebCore/DocumentLoader.h>
+#pragma warning(pop)
+
+class WebDocumentLoader : public WebCore::DocumentLoader
+{
+public:
+ WebDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+ ~WebDocumentLoader();
+
+ void setDataSource(WebDataSource*);
+ WebDataSource* dataSource() const;
+ void detachDataSource();
+
+ virtual void attachToFrame();
+ virtual void detachFromFrame();
+
+private:
+ WebDataSource* m_dataSource;
+ WebDataSource* m_detachedDataSource; // not retained
+};
diff --git a/WebKit/win/WebDownload.cpp b/WebKit/win/WebDownload.cpp
new file mode 100644
index 0000000..8f7f18a
--- /dev/null
+++ b/WebKit/win/WebDownload.cpp
@@ -0,0 +1,796 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebDownload.h"
+
+#include "CString.h"
+#include "DefaultDownloadDelegate.h"
+#include "MarshallingHelpers.h"
+#include "WebError.h"
+#include "WebKit.h"
+#include "WebKitLogging.h"
+#include "WebMutableURLRequest.h"
+#include "WebURLAuthenticationChallenge.h"
+#include "WebURLCredential.h"
+#include "WebURLResponse.h"
+
+#include <io.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#pragma warning(push, 0)
+#include <WebCore/AuthenticationCF.h>
+#include <WebCore/BString.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceHandle.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/ResourceResponse.h>
+#include <WebCore/SystemTime.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// CFURLDownload Callbacks ----------------------------------------------------------------
+static void didStartCallback(CFURLDownloadRef download, const void *clientInfo);
+static CFURLRequestRef willSendRequestCallback(CFURLDownloadRef download, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo);
+static void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef download, CFURLAuthChallengeRef challenge, const void *clientInfo);
+static void didReceiveResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, const void *clientInfo);
+static void willResumeWithResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo);
+static void didReceiveDataCallback(CFURLDownloadRef download, CFIndex length, const void *clientInfo);
+static Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef download, CFStringRef encodingType, const void *clientInfo);
+static void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef download, CFStringRef objectName, const void *clientInfo);
+static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef path, const void *clientInfo);
+static void didFinishCallback(CFURLDownloadRef download, const void *clientInfo);
+static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void *clientInfo);
+
+// Download Bundle file utilities ----------------------------------------------------------------
+static const String BundleExtension(".download");
+static UInt32 BundleMagicNumber = 0xDECAF4EA;
+
+static CFDataRef extractResumeDataFromBundle(const String& bundlePath);
+static HRESULT appendResumeDataToBundle(CFDataRef resumeData, const String& bundlePath);
+
+// WebDownload ----------------------------------------------------------------
+
+WebDownload::WebDownload()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+void WebDownload::init(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response, IWebDownloadDelegate* delegate)
+{
+ m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance();
+ CFURLConnectionRef connection = handle->connection();
+ if (!connection) {
+ LOG_ERROR("WebDownload::WebDownload(ResourceHandle*,...) called with an inactive ResourceHandle");
+ return;
+ }
+
+ CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback,
+ didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback,
+ decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
+
+ m_request.adoptRef(WebMutableURLRequest::createInstance(request));
+ m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, request.cfURLRequest(), response.cfURLResponse(), &client));
+
+ // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state"
+ // However, we should never hit that case
+ if (!m_download) {
+ ASSERT_NOT_REACHED();
+ LOG_ERROR("WebDownload - Failed to create WebDownload from existing connection (%s)", request.url().string().utf8().data());
+ } else
+ LOG(Download, "WebDownload - Created WebDownload %p from existing connection (%s)", this, request.url().string().utf8().data());
+
+ // The CFURLDownload either starts successfully and retains the CFURLConnection,
+ // or it fails to creating and we have a now-useless connection with a dangling ref.
+ // Either way, we need to release the connection to balance out ref counts
+ handle->releaseConnectionForDownload();
+ CFRelease(connection);
+}
+
+void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate)
+{
+ m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance();
+ LOG_ERROR("Delegate is %p", m_delegate.get());
+
+ ResourceRequest request(url);
+ CFURLRequestRef cfRequest = request.cfURLRequest();
+
+ CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback,
+ didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback,
+ decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
+ m_request.adoptRef(WebMutableURLRequest::createInstance(request));
+ m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client));
+
+ CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get());
+ CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode);
+
+ LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.string().utf8().data(), this);
+}
+
+WebDownload::~WebDownload()
+{
+ LOG(Download, "WebDownload - Destroying download (%p)", this);
+ cancel();
+ gClassCount--;
+}
+
+WebDownload* WebDownload::createInstance()
+{
+ WebDownload* instance = new WebDownload();
+ instance->AddRef();
+ return instance;
+}
+
+WebDownload* WebDownload::createInstance(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response, IWebDownloadDelegate* delegate)
+{
+ WebDownload* instance = new WebDownload();
+ instance->AddRef();
+ instance->init(handle, request, response, delegate);
+ return instance;
+}
+
+WebDownload* WebDownload::createInstance(const KURL& url, IWebDownloadDelegate* delegate)
+{
+ WebDownload* instance = new WebDownload();
+ instance->AddRef();
+ instance->init(url, delegate);
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDownload::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebDownload*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDownload))
+ *ppvObject = static_cast<IWebDownload*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLAuthenticationChallengeSender))
+ *ppvObject = static_cast<IWebURLAuthenticationChallengeSender*>(this);
+ else if (IsEqualGUID(riid, CLSID_WebDownload))
+ *ppvObject = static_cast<WebDownload*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebDownload::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebDownload::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebDownload -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest(
+ /* [in] */ IWebURLRequest* request,
+ /* [in] */ IWebDownloadDelegate* delegate)
+{
+ COMPtr<WebMutableURLRequest> webRequest;
+ if (!request || FAILED(request->QueryInterface(&webRequest))) {
+ LOG(Download, "WebDownload - initWithRequest failed - not a WebMutableURLRequest");
+ return E_FAIL;
+ }
+
+ if (!delegate)
+ return E_FAIL;
+ m_delegate = delegate;
+ LOG(Download, "Delegate is %p", m_delegate.get());
+
+ RetainPtr<CFURLRequestRef> cfRequest = webRequest->resourceRequest().cfURLRequest();
+
+ CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback,
+ didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback,
+ decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
+ m_request.adoptRef(WebMutableURLRequest::createInstance(webRequest.get()));
+ m_download.adoptCF(CFURLDownloadCreate(0, cfRequest.get(), &client));
+
+ // If for some reason the download failed to create,
+ // we have particular cleanup to do
+ if (!m_download) {
+ m_request = 0;
+ return E_FAIL;
+ }
+
+ CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get());
+ CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode);
+
+ LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().string().utf8().data());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle(
+ /* [in] */ BSTR bundlePath,
+ /* [in] */ IWebDownloadDelegate* delegate)
+{
+ LOG(Download, "Attempting resume of download bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data());
+
+ RetainPtr<CFDataRef> resumeData(AdoptCF, extractResumeDataFromBundle(String(bundlePath, SysStringLen(bundlePath))));
+
+ if (!resumeData)
+ return E_FAIL;
+
+ if (!delegate)
+ return E_FAIL;
+ m_delegate = delegate;
+ LOG(Download, "Delegate is %p", m_delegate.get());
+
+ CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback,
+ didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback,
+ decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
+
+ RetainPtr<CFURLRef> pathURL(AdoptCF, MarshallingHelpers::PathStringToFileCFURLRef(String(bundlePath, SysStringLen(bundlePath))));
+ ASSERT(pathURL);
+
+ m_download.adoptCF(CFURLDownloadCreateWithResumeData(0, resumeData.get(), pathURL.get(), &client));
+
+ if (!m_download) {
+ LOG(Download, "Failed to create CFURLDownloadRef for resume");
+ return E_FAIL;
+ }
+
+ m_bundlePath = String(bundlePath, SysStringLen(bundlePath));
+ // Attempt to remove the ".download" extension from the bundle for the final file destination
+ // Failing that, we clear m_destination and will ask the delegate later once the download starts
+ if (m_bundlePath.endsWith(BundleExtension, false)) {
+ m_destination = m_bundlePath.copy();
+ m_destination.truncate(m_destination.length() - BundleExtension.length());
+ } else
+ m_destination = String();
+
+ CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get());
+ CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode);
+
+ LOG(Download, "WebDownload - initWithRequest complete, resumed download of bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::canResumeDownloadDecodedWithEncodingMIMEType(
+ /* [in] */ BSTR,
+ /* [out, retval] */ BOOL*)
+{
+ notImplemented();
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::start()
+{
+ LOG(Download, "WebDownload - Starting download (%p)", this);
+ if (!m_download)
+ return E_FAIL;
+
+ CFURLDownloadStart(m_download.get());
+ // FIXME: 4950477 - CFURLDownload neglects to make the didStart() client call upon starting the download.
+ // This is a somewhat critical call, so we'll fake it for now!
+ didStart();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::cancel()
+{
+ LOG(Download, "WebDownload - Cancelling download (%p)", this);
+ if (!m_download)
+ return E_FAIL;
+
+ CFURLDownloadCancel(m_download.get());
+ m_download = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::cancelForResume()
+{
+ LOG(Download, "WebDownload - Cancelling download (%p), writing resume information to file if possible", this);
+ ASSERT(m_download);
+ if (!m_download)
+ return E_FAIL;
+
+ HRESULT hr = S_OK;
+ RetainPtr<CFDataRef> resumeData;
+ if (m_destination.isEmpty())
+ goto exit;
+
+ CFURLDownloadSetDeletesUponFailure(m_download.get(), false);
+ CFURLDownloadCancel(m_download.get());
+
+ resumeData = CFURLDownloadCopyResumeData(m_download.get());
+ if (!resumeData) {
+ LOG(Download, "WebDownload - Unable to create resume data for download (%p)", this);
+ goto exit;
+ }
+
+ appendResumeDataToBundle(resumeData.get(), m_bundlePath);
+
+exit:
+ m_download = 0;
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::deletesFileUponFailure(
+ /* [out, retval] */ BOOL* result)
+{
+ if (!m_download)
+ return E_FAIL;
+ *result = CFURLDownloadDeletesUponFailure(m_download.get());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::bundlePathForTargetPath(
+ /* [in] */ BSTR targetPath,
+ /* [out, retval] */ BSTR* bundlePath)
+{
+ if (!targetPath)
+ return E_INVALIDARG;
+
+ String bundle(targetPath, SysStringLen(targetPath));
+ if (bundle.isEmpty())
+ return E_INVALIDARG;
+
+ if (bundle[bundle.length()-1] == '/')
+ bundle.truncate(1);
+
+ bundle += BundleExtension;
+ *bundlePath = SysAllocStringLen(bundle.characters(), bundle.length());
+ if (!*bundlePath)
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::request(
+ /* [out, retval] */ IWebURLRequest** request)
+{
+ if (request) {
+ *request = m_request.get();
+ if (*request)
+ (*request)->AddRef();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::setDeletesFileUponFailure(
+ /* [in] */ BOOL deletesFileUponFailure)
+{
+ if (!m_download)
+ return E_FAIL;
+ CFURLDownloadSetDeletesUponFailure(m_download.get(), !!deletesFileUponFailure);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::setDestination(
+ /* [in] */ BSTR path,
+ /* [in] */ BOOL allowOverwrite)
+{
+ if (!m_download)
+ return E_FAIL;
+
+ m_destination = String(path, SysStringLen(path));
+ m_bundlePath = m_destination + BundleExtension;
+
+ CFURLRef pathURL = MarshallingHelpers::PathStringToFileCFURLRef(m_bundlePath);
+ CFURLDownloadSetDestination(m_download.get(), pathURL, !!allowOverwrite);
+ CFRelease(pathURL);
+
+ LOG(Download, "WebDownload - Set destination to %s", m_bundlePath.ascii().data());
+
+ return S_OK;
+}
+
+// IWebURLAuthenticationChallengeSender -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebDownload::cancelAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge*)
+{
+ if (m_download) {
+ CFURLDownloadCancel(m_download.get());
+ m_download = 0;
+ }
+
+ // FIXME: Do we need a URL or description for this error code?
+ ResourceError error(String(WebURLErrorDomain), WebURLErrorUserCancelledAuthentication, "", "");
+ COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(error));
+ m_delegate->didFailWithError(this, webError.get());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::continueWithoutCredentialForAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge)
+{
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_NOINTERFACE;
+
+ if (m_download)
+ CFURLDownloadUseCredential(m_download.get(), 0, webChallenge->authenticationChallenge().cfURLAuthChallengeRef());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDownload::useCredential(
+ /* [in] */ IWebURLCredential* credential,
+ /* [in] */ IWebURLAuthenticationChallenge* challenge)
+{
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_NOINTERFACE;
+
+ COMPtr<WebURLCredential> webCredential(Query, credential);
+ if (!webCredential)
+ return E_NOINTERFACE;
+
+ RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(webCredential->credential()));
+
+ if (m_download)
+ CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), webChallenge->authenticationChallenge().cfURLAuthChallengeRef());
+ return S_OK;
+}
+
+// CFURLDownload Callbacks -------------------------------------------------------------------
+void WebDownload::didStart()
+{
+#ifndef NDEBUG
+ m_startTime = m_dataTime = currentTime();
+ m_received = 0;
+ LOG(Download, "DOWNLOAD - Started %p at %.3f seconds", this, m_startTime);
+#endif
+ if (FAILED(m_delegate->didBegin(this)))
+ LOG_ERROR("DownloadDelegate->didBegin failed");
+}
+
+CFURLRequestRef WebDownload::willSendRequest(CFURLRequestRef request, CFURLResponseRef response)
+{
+ COMPtr<WebMutableURLRequest> webRequest(AdoptCOM, WebMutableURLRequest::createInstance(ResourceRequest(request)));
+ COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response)));
+ COMPtr<IWebMutableURLRequest> finalRequest;
+
+ if (FAILED(m_delegate->willSendRequest(this, webRequest.get(), webResponse.get(), &finalRequest)))
+ LOG_ERROR("DownloadDelegate->willSendRequest failed");
+
+ if (!finalRequest)
+ return 0;
+
+ COMPtr<WebMutableURLRequest> finalWebRequest(AdoptCOM, WebMutableURLRequest::createInstance(finalRequest.get()));
+ m_request = finalWebRequest.get();
+ CFURLRequestRef result = finalWebRequest->resourceRequest().cfURLRequest();
+ CFRetain(result);
+ return result;
+}
+
+void WebDownload::didReceiveAuthenticationChallenge(CFURLAuthChallengeRef challenge)
+{
+ COMPtr<IWebURLAuthenticationChallenge> webChallenge(AdoptCOM,
+ WebURLAuthenticationChallenge::createInstance(AuthenticationChallenge(challenge, 0), this));
+
+ if (SUCCEEDED(m_delegate->didReceiveAuthenticationChallenge(this, webChallenge.get())))
+ return;
+
+ cancelAuthenticationChallenge(webChallenge.get());
+}
+
+void WebDownload::didReceiveResponse(CFURLResponseRef response)
+{
+ COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response)));
+ if (FAILED(m_delegate->didReceiveResponse(this, webResponse.get())))
+ LOG_ERROR("DownloadDelegate->didReceiveResponse failed");
+}
+
+void WebDownload::willResumeWithResponse(CFURLResponseRef response, UInt64 fromByte)
+{
+ COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response)));
+ if (FAILED(m_delegate->willResumeWithResponse(this, webResponse.get(), fromByte)))
+ LOG_ERROR("DownloadDelegate->willResumeWithResponse failed");
+}
+
+void WebDownload::didReceiveData(CFIndex length)
+{
+#ifndef NDEBUG
+ m_received += length;
+ double current = currentTime();
+ if (current - m_dataTime > 2.0)
+ LOG(Download, "DOWNLOAD - %p hanged for %.3f seconds - Received %i bytes for a total of %i", this, current - m_dataTime, length, m_received);
+ m_dataTime = current;
+#endif
+ if (FAILED(m_delegate->didReceiveDataOfLength(this, length)))
+ LOG_ERROR("DownloadDelegate->didReceiveData failed");
+}
+
+bool WebDownload::shouldDecodeDataOfMIMEType(CFStringRef mimeType)
+{
+ BOOL result;
+ if (FAILED(m_delegate->shouldDecodeSourceDataOfMIMEType(this, BString(mimeType), &result))) {
+ LOG_ERROR("DownloadDelegate->shouldDecodeSourceDataOfMIMEType failed");
+ return false;
+ }
+ return !!result;
+}
+
+void WebDownload::decideDestinationWithSuggestedObjectName(CFStringRef name)
+{
+ if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, BString(name))))
+ LOG_ERROR("DownloadDelegate->decideDestinationWithSuggestedObjectName failed");
+}
+
+void WebDownload::didCreateDestination(CFURLRef destination)
+{
+ // The concept of the ".download bundle" is internal to the WebDownload, so therefore
+ // we try to mask the delegate from its existence as much as possible by telling it the final
+ // destination was created, when in reality the bundle was created
+
+ String createdDestination = MarshallingHelpers::FileCFURLRefToPathString(destination);
+
+ // At this point in receiving CFURLDownload callbacks, we should definitely have the bundle path stored locally
+ // and it should match with the file that CFURLDownload created
+ ASSERT(createdDestination == m_bundlePath);
+ // And we should also always have the final-destination stored
+ ASSERT(!m_destination.isEmpty());
+
+ BString path(m_destination);
+ if (FAILED(m_delegate->didCreateDestination(this, path)))
+ LOG_ERROR("DownloadDelegate->didCreateDestination failed");
+}
+
+void WebDownload::didFinish()
+{
+#ifndef NDEBUG
+ LOG(Download, "DOWNLOAD - Finished %p after %i bytes and %.3f seconds", this, m_received, currentTime() - m_startTime);
+#endif
+
+ ASSERT(!m_bundlePath.isEmpty() && !m_destination.isEmpty());
+ LOG(Download, "WebDownload - Moving file from bundle %s to destination %s", m_bundlePath.ascii().data(), m_destination.ascii().data());
+
+ // We try to rename the bundle to the final file name. If that fails, we give the delegate one more chance to chose
+ // the final file name, then we just leave it
+ if (!MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0)) {
+ LOG_ERROR("Failed to move bundle %s to %s on completion\nError - %i", m_bundlePath.ascii().data(), m_destination.ascii().data(), GetLastError());
+
+ bool reportBundlePathAsFinalPath = true;
+
+ BString destinationBSTR(m_destination.characters(), m_destination.length());
+ if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, destinationBSTR)))
+ LOG_ERROR("delegate->decideDestinationWithSuggestedFilename() failed");
+
+ // The call to m_delegate->decideDestinationWithSuggestedFilename() should have changed our destination, so we'll try the move
+ // one last time.
+ if (!m_destination.isEmpty())
+ if (MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0))
+ reportBundlePathAsFinalPath = false;
+
+ // We either need to tell the delegate our final filename is the bundle filename, or is the file name they just told us to use
+ if (reportBundlePathAsFinalPath) {
+ BString bundleBSTR(m_bundlePath);
+ m_delegate->didCreateDestination(this, bundleBSTR);
+ } else {
+ BString finalDestinationBSTR = BString(m_destination);
+ m_delegate->didCreateDestination(this, finalDestinationBSTR);
+ }
+ }
+
+ // It's extremely likely the call to delegate->didFinish() will deref this, so lets not let that cause our destruction just yet
+ COMPtr<WebDownload> protect = this;
+ if (FAILED(m_delegate->didFinish(this)))
+ LOG_ERROR("DownloadDelegate->didFinish failed");
+
+ m_download = 0;
+}
+
+void WebDownload::didFail(CFErrorRef error)
+{
+ COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(ResourceError(error)));
+ if (FAILED(m_delegate->didFailWithError(this, webError.get())))
+ LOG_ERROR("DownloadDelegate->didFailWithError failed");
+}
+
+// CFURLDownload Callbacks ----------------------------------------------------------------
+void didStartCallback(CFURLDownloadRef, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didStart(); }
+
+CFURLRequestRef willSendRequestCallback(CFURLDownloadRef, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo)
+{ return ((WebDownload*)clientInfo)->willSendRequest(request, redirectionResponse); }
+
+void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef, CFURLAuthChallengeRef challenge, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didReceiveAuthenticationChallenge(challenge); }
+
+void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didReceiveResponse(response); }
+
+void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->willResumeWithResponse(response, startingByte); }
+
+void didReceiveDataCallback(CFURLDownloadRef, CFIndex length, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didReceiveData(length); }
+
+Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodingType, const void *clientInfo)
+{ return ((WebDownload*)clientInfo)->shouldDecodeDataOfMIMEType(encodingType); }
+
+void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->decideDestinationWithSuggestedObjectName(objectName); }
+
+void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef path, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didCreateDestination(path); }
+
+void didFinishCallback(CFURLDownloadRef, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didFinish(); }
+
+void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void *clientInfo)
+{ ((WebDownload*)clientInfo)->didFail(error); }
+
+// Download Bundle file utilities ----------------------------------------------------------------
+
+static CFDataRef extractResumeDataFromBundle(const String& bundlePath)
+{
+ if (bundlePath.isEmpty()) {
+ LOG_ERROR("Cannot create resume data from empty download bundle path");
+ return 0;
+ }
+
+ // Open a handle to the bundle file
+ String nullifiedPath = bundlePath;
+ FILE* bundle = 0;
+ if (_wfopen_s(&bundle, nullifiedPath.charactersWithNullTermination(), TEXT("r+b")) || !bundle) {
+ LOG_ERROR("Failed to open file %s to get resume data", bundlePath.ascii().data());
+ return 0;
+ }
+
+ CFDataRef result = 0;
+ Vector<UInt8> footerBuffer;
+
+ // Stat the file to get its size
+ struct _stat64 fileStat;
+ if (_fstat64(_fileno(bundle), &fileStat))
+ goto exit;
+
+ // Check for the bundle magic number at the end of the file
+ fpos_t footerMagicNumberPosition = fileStat.st_size - 4;
+ ASSERT(footerMagicNumberPosition >= 0);
+ if (footerMagicNumberPosition < 0)
+ goto exit;
+ if (fsetpos(bundle, &footerMagicNumberPosition))
+ goto exit;
+
+ UInt32 footerMagicNumber = 0;
+ if (fread(&footerMagicNumber, 4, 1, bundle) != 1) {
+ LOG_ERROR("Failed to read footer magic number from the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ if (footerMagicNumber != BundleMagicNumber) {
+ LOG_ERROR("Footer's magic number does not match 0x%X - errno(%i)", BundleMagicNumber, errno);
+ goto exit;
+ }
+
+ // Now we're *reasonably* sure this is a .download bundle we actually wrote.
+ // Get the length of the resume data
+ fpos_t footerLengthPosition = fileStat.st_size - 8;
+ ASSERT(footerLengthPosition >= 0);
+ if (footerLengthPosition < 0)
+ goto exit;
+
+ if (fsetpos(bundle, &footerLengthPosition))
+ goto exit;
+
+ UInt32 footerLength = 0;
+ if (fread(&footerLength, 4, 1, bundle) != 1) {
+ LOG_ERROR("Failed to read ResumeData length from the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ // Make sure theres enough bytes to read in for the resume data, and perform the read
+ fpos_t footerStartPosition = fileStat.st_size - 8 - footerLength;
+ ASSERT(footerStartPosition >= 0);
+ if (footerStartPosition < 0)
+ goto exit;
+ if (fsetpos(bundle, &footerStartPosition))
+ goto exit;
+
+ footerBuffer.resize(footerLength);
+ if (fread(footerBuffer.data(), 1, footerLength, bundle) != footerLength) {
+ LOG_ERROR("Failed to read ResumeData from the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ // CFURLDownload will seek to the appropriate place in the file (before our footer) and start overwriting from there
+ // However, say we were within a few hundred bytes of the end of a download when it was paused -
+ // The additional footer extended the length of the file beyond its final length, and there will be junk data leftover
+ // at the end. Therefore, now that we've retrieved the footer data, we need to truncate it.
+ if (errno_t resizeError = _chsize_s(_fileno(bundle), footerStartPosition)) {
+ LOG_ERROR("Failed to truncate the resume footer off the end of the file - errno(%i)", resizeError);
+ goto exit;
+ }
+
+ // Finally, make the resume data. Now, it is possible by some twist of fate the bundle magic number
+ // was naturally at the end of the file and its not actually a valid bundle. That, or someone engineered
+ // it that way to try to attack us. In that cause, this CFData will successfully create but when we
+ // actually try to start the CFURLDownload using this bogus data, it will fail and we will handle that gracefully
+ result = CFDataCreate(0, footerBuffer.data(), footerLength);
+exit:
+ fclose(bundle);
+ return result;
+}
+
+static HRESULT appendResumeDataToBundle(CFDataRef resumeData, const String& bundlePath)
+{
+ if (!resumeData) {
+ LOG_ERROR("Invalid resume data to write to bundle path");
+ return E_FAIL;
+ }
+ if (bundlePath.isEmpty()) {
+ LOG_ERROR("Cannot write resume data to empty download bundle path");
+ return E_FAIL;
+ }
+
+ String nullifiedPath = bundlePath;
+ FILE* bundle = 0;
+ if (_wfopen_s(&bundle, nullifiedPath.charactersWithNullTermination(), TEXT("ab")) || !bundle) {
+ LOG_ERROR("Failed to open file %s to append resume data", bundlePath.ascii().data());
+ return E_FAIL;
+ }
+
+ HRESULT hr = E_FAIL;
+
+ const UInt8* resumeBytes = CFDataGetBytePtr(resumeData);
+ ASSERT(resumeBytes);
+ if (!resumeBytes)
+ goto exit;
+
+ UInt32 resumeLength = CFDataGetLength(resumeData);
+ ASSERT(resumeLength > 0);
+ if (resumeLength < 1)
+ goto exit;
+
+ if (fwrite(resumeBytes, 1, resumeLength, bundle) != resumeLength) {
+ LOG_ERROR("Failed to write resume data to the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ if (fwrite(&resumeLength, 4, 1, bundle) != 1) {
+ LOG_ERROR("Failed to write footer length to the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ if (fwrite(&BundleMagicNumber, 4, 1, bundle) != 1) {
+ LOG_ERROR("Failed to write footer magic number to the bundle - errno(%i)", errno);
+ goto exit;
+ }
+
+ hr = S_OK;
+exit:
+ fclose(bundle);
+ return hr;
+}
diff --git a/WebKit/win/WebDownload.h b/WebKit/win/WebDownload.h
new file mode 100644
index 0000000..6e8e3ee
--- /dev/null
+++ b/WebKit/win/WebDownload.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebDownload_h
+#define WebDownload_h
+
+#include "COMPtr.h"
+#include "WebKit.h"
+
+#include <CFNetwork/CFURLDownloadPriv.h>
+#include <WebCore/PlatformString.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+ class KURL;
+ class ResourceHandle;
+ struct ResourceRequest;
+ class ResourceResponse;
+}
+
+class WebDownload : public IWebDownload, public IWebURLAuthenticationChallengeSender
+{
+public:
+ static WebDownload* createInstance(const WebCore::KURL&, IWebDownloadDelegate*);
+ static WebDownload* createInstance(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, IWebDownloadDelegate*);
+ static WebDownload* createInstance();
+private:
+ WebDownload();
+ void init(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, IWebDownloadDelegate*);
+ void init(const WebCore::KURL&, IWebDownloadDelegate*);
+ ~WebDownload();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebDownload
+ virtual HRESULT STDMETHODCALLTYPE initWithRequest(
+ /* [in] */ IWebURLRequest* request,
+ /* [in] */ IWebDownloadDelegate* delegate);
+
+ virtual HRESULT STDMETHODCALLTYPE initToResumeWithBundle(
+ /* [in] */ BSTR bundlePath,
+ /* [in] */ IWebDownloadDelegate* delegate);
+
+ virtual HRESULT STDMETHODCALLTYPE canResumeDownloadDecodedWithEncodingMIMEType(
+ /* [in] */ BSTR mimeType,
+ /* [out, retval] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE start();
+
+ virtual HRESULT STDMETHODCALLTYPE cancel();
+
+ virtual HRESULT STDMETHODCALLTYPE cancelForResume();
+
+ virtual HRESULT STDMETHODCALLTYPE deletesFileUponFailure(
+ /* [out, retval] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE bundlePathForTargetPath(
+ /* [in] */ BSTR target,
+ /* [out, retval] */ BSTR* bundle);
+
+ virtual HRESULT STDMETHODCALLTYPE request(
+ /* [out, retval] */ IWebURLRequest** request);
+
+ virtual HRESULT STDMETHODCALLTYPE setDeletesFileUponFailure(
+ /* [in] */ BOOL deletesFileUponFailure);
+
+ virtual HRESULT STDMETHODCALLTYPE setDestination(
+ /* [in] */ BSTR path,
+ /* [in] */ BOOL allowOverwrite);
+
+ // IWebURLAuthenticationChallengeSender
+ virtual HRESULT STDMETHODCALLTYPE cancelAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ virtual HRESULT STDMETHODCALLTYPE continueWithoutCredentialForAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ virtual HRESULT STDMETHODCALLTYPE useCredential(
+ /* [in] */ IWebURLCredential* credential,
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ // CFURLDownload Callbacks
+ void didStart();
+ CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef);
+ void didReceiveAuthenticationChallenge(CFURLAuthChallengeRef);
+ void didReceiveResponse(CFURLResponseRef);
+ void willResumeWithResponse(CFURLResponseRef, UInt64);
+ void didReceiveData(CFIndex);
+ bool shouldDecodeDataOfMIMEType(CFStringRef);
+ void decideDestinationWithSuggestedObjectName(CFStringRef);
+ void didCreateDestination(CFURLRef);
+ void didFinish();
+ void didFail(CFErrorRef);
+
+protected:
+ ULONG m_refCount;
+
+ WebCore::String m_destination;
+ WebCore::String m_bundlePath;
+ RetainPtr<CFURLDownloadRef> m_download;
+ COMPtr<IWebMutableURLRequest> m_request;
+ COMPtr<IWebDownloadDelegate> m_delegate;
+
+#ifndef NDEBUG
+ double m_startTime;
+ double m_dataTime;
+ int m_received;
+#endif
+};
+
+
+#endif
diff --git a/WebKit/win/WebDropSource.cpp b/WebKit/win/WebDropSource.cpp
new file mode 100644
index 0000000..b69aefb
--- /dev/null
+++ b/WebKit/win/WebDropSource.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebDropSource.h"
+#include "WebView.h"
+
+#include <WebCore/DragActions.h>
+#include <WebCore/EventHandler.h>
+#include <WebCore/Frame.h>
+#include <WebCore/Page.h>
+#include <WebCore/PlatformMouseEvent.h>
+#include <WebCore/SystemTime.h>
+
+#include <Windows.h>
+
+using namespace WebCore;
+
+
+HRESULT WebDropSource::createInstance(WebView* webView, IDropSource** result)
+{
+ if (!webView || !result)
+ return E_INVALIDARG;
+ *result = new WebDropSource(webView);
+ return S_OK;
+}
+
+WebDropSource::WebDropSource(WebView* webView)
+: m_ref(1)
+, m_dropped(false)
+, m_webView(webView)
+{
+
+}
+
+STDMETHODIMP WebDropSource::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualIID(riid, IID_IUnknown) ||
+ IsEqualIID(riid, IID_IDropSource)) {
+ *ppvObject = this;
+ AddRef();
+
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+STDMETHODIMP_(ULONG) WebDropSource::AddRef(void)
+{
+ return InterlockedIncrement(&m_ref);
+}
+
+STDMETHODIMP_(ULONG) WebDropSource::Release(void)
+{
+ long c = InterlockedDecrement(&m_ref);
+ if (c == 0)
+ delete this;
+ return c;
+}
+
+PlatformMouseEvent generateMouseEvent(WebView* webView, bool isDrag) {
+ POINTL pt;
+ ::GetCursorPos((LPPOINT)&pt);
+ POINTL localpt = pt;
+ HWND viewWindow;
+ if (SUCCEEDED(webView->viewWindow((OLE_HANDLE*)&viewWindow)))
+ ::ScreenToClient(viewWindow, (LPPOINT)&localpt);
+ return PlatformMouseEvent(IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y),
+ isDrag ? LeftButton : NoButton, MouseEventMoved, 0, false, false, false, false, currentTime());
+}
+
+STDMETHODIMP WebDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
+{
+ if(fEscapePressed)
+ return DRAGDROP_S_CANCEL;
+
+ if(!(grfKeyState & (MK_LBUTTON|MK_RBUTTON))) {
+ m_dropped = true;
+ if (Page* page = m_webView->page())
+ if (Frame* frame = page->mainFrame())
+ //FIXME: We need to figure out how to find out what actually happened in the drag <rdar://problem/5015961>
+ frame->eventHandler()->dragSourceEndedAt(generateMouseEvent(m_webView.get(), false), DragOperationCopy);
+ return DRAGDROP_S_DROP;
+ } else if (Page* page = m_webView->page())
+ if (Frame* frame = page->mainFrame())
+ frame->eventHandler()->dragSourceMovedTo(generateMouseEvent(m_webView.get(), true));
+
+ return S_OK;
+
+}
+
+STDMETHODIMP WebDropSource::GiveFeedback(DWORD)
+{
+ return DRAGDROP_S_USEDEFAULTCURSORS;
+}
diff --git a/WebKit/win/WebDropSource.h b/WebKit/win/WebDropSource.h
new file mode 100644
index 0000000..4bed7f4
--- /dev/null
+++ b/WebKit/win/WebDropSource.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef WebDropSource_h
+#define WebDropSource_h
+
+#include "COMPtr.h"
+#include <objidl.h>
+
+class WebView;
+
+class WebDropSource : public IDropSource
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+ virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
+ virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
+
+ static HRESULT createInstance(WebView* webView, IDropSource** result);
+private:
+ WebDropSource(WebView* webView);
+ long m_ref;
+ bool m_dropped;
+ COMPtr<WebView> m_webView;
+
+};
+
+#endif //!WebDropSource_h
diff --git a/WebKit/win/WebElementPropertyBag.cpp b/WebKit/win/WebElementPropertyBag.cpp
new file mode 100644
index 0000000..d335b38
--- /dev/null
+++ b/WebKit/win/WebElementPropertyBag.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebElementPropertyBag.h"
+
+#include "MarshallingHelpers.h"
+#include "DOMCoreClasses.h"
+#include "WebFrame.h"
+#pragma warning(push, 0)
+#include <WebCore/Document.h>
+#include <WebCore/Frame.h>
+#include <WebCore/HitTestResult.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/Image.h>
+#include <WebCore/KURL.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebElementPropertyBag -----------------------------------------------
+WebElementPropertyBag::WebElementPropertyBag(const HitTestResult& result)
+ : m_result(new HitTestResult(result))
+ , m_refCount(0)
+{
+}
+
+WebElementPropertyBag::~WebElementPropertyBag()
+{
+}
+
+WebElementPropertyBag* WebElementPropertyBag::createInstance(const HitTestResult& result)
+{
+ WebElementPropertyBag* instance = new WebElementPropertyBag(result);
+ instance->AddRef();
+
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebElementPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else if (IsEqualGUID(riid, IID_IPropertyBag))
+ *ppvObject = static_cast<IPropertyBag*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebElementPropertyBag::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebElementPropertyBag::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+static bool isEqual(LPCWSTR s1, LPCWSTR s2)
+{
+ return !wcscmp(s1, s2);
+}
+
+static HRESULT convertStringToVariant(VARIANT* pVar, const String& string)
+{
+ V_VT(pVar) = VT_BSTR;
+ V_BSTR(pVar) = SysAllocStringLen(string.characters(), string.length());
+ if (string.length() && !V_BSTR(pVar))
+ return E_OUTOFMEMORY;
+
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebElementPropertyBag::Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog * /*pErrorLog*/)
+{
+ if (!pszPropName)
+ return E_POINTER;
+
+ if (!m_result)
+ return E_FAIL;
+
+ BSTR key = (BSTR)pszPropName;
+ VariantClear(pVar);
+ if (isEqual(WebElementDOMNodeKey, key)) {
+ IDOMNode* node = DOMNode::createInstance(m_result->innerNonSharedNode());
+ V_VT(pVar) = VT_UNKNOWN;
+ V_UNKNOWN(pVar) = node;
+ return S_OK;
+ } else if (isEqual(WebElementFrameKey, key)) {
+ if (!(m_result->innerNonSharedNode() && m_result->innerNonSharedNode()->document()
+ && m_result->innerNonSharedNode()->document()->frame()))
+ return E_FAIL;
+ Frame* coreFrame = m_result->innerNonSharedNode()->document()->frame();
+ WebFrame* webFrame = static_cast<WebFrame*>(coreFrame->loader()->client());
+ IWebFrame* iWebFrame;
+ if (FAILED(webFrame->QueryInterface(IID_IWebFrame, (void**)&iWebFrame)))
+ return E_FAIL;
+ V_VT(pVar) = VT_UNKNOWN;
+ V_UNKNOWN(pVar) = iWebFrame;
+ return S_OK;
+ } else if (isEqual(WebElementImageAltStringKey, key))
+ return convertStringToVariant(pVar, m_result->altDisplayString());
+ else if (isEqual(WebElementImageKey, key)) {
+ V_VT(pVar) = VT_BYREF;
+ V_BYREF(pVar) = m_result->image();
+ return S_OK;
+ } else if (isEqual(WebElementImageRectKey, key)) {
+ V_VT(pVar) = VT_ARRAY;
+ V_ARRAY(pVar) = MarshallingHelpers::intRectToSafeArray(m_result->boundingBox());
+ return S_OK;
+ } else if (isEqual(WebElementImageURLKey, key))
+ return convertStringToVariant(pVar, m_result->absoluteImageURL().string());
+ else if (isEqual(WebElementIsSelectedKey, key)) {
+ V_VT(pVar) = VT_BOOL;
+ if (m_result->isSelected())
+ V_BOOL(pVar) = VARIANT_TRUE;
+ else
+ V_BOOL(pVar) = VARIANT_FALSE;
+ return S_OK;
+ } else if (isEqual(WebElementSpellingToolTipKey, key))
+ return convertStringToVariant(pVar, m_result->spellingToolTip());
+ else if (isEqual(WebElementTitleKey, key))
+ return convertStringToVariant(pVar, m_result->title());
+ else if (isEqual(WebElementLinkURLKey, key))
+ return convertStringToVariant(pVar, m_result->absoluteLinkURL().string());
+ else if (isEqual(WebElementLinkTargetFrameKey, key)) {
+ if (!m_result->targetFrame())
+ return E_FAIL;
+ WebFrame* webFrame = kit(m_result->targetFrame());
+ IWebFrame* iWebFrame;
+ if (FAILED(webFrame->QueryInterface(IID_IWebFrame, (void**)&iWebFrame)))
+ return E_FAIL;
+ V_VT(pVar) = VT_UNKNOWN;
+ V_UNKNOWN(pVar) = iWebFrame;
+ return S_OK;
+ } else if (isEqual(WebElementLinkTitleKey, key))
+ return convertStringToVariant(pVar, m_result->titleDisplayString());
+ else if (isEqual(WebElementLinkLabelKey, key))
+ return convertStringToVariant(pVar, m_result->textContent());
+ else if (isEqual(WebElementIsContentEditableKey, key)) {
+ V_VT(pVar) = VT_BOOL;
+ if (m_result->isContentEditable())
+ V_BOOL(pVar) = VARIANT_TRUE;
+ else
+ V_BOOL(pVar) = VARIANT_FALSE;
+ return S_OK;
+ }
+
+ return E_INVALIDARG;
+}
+
+HRESULT STDMETHODCALLTYPE WebElementPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ if (!pszPropName || !pVar)
+ return E_POINTER;
+
+ return E_FAIL;
+}
diff --git a/WebKit/win/WebElementPropertyBag.h b/WebKit/win/WebElementPropertyBag.h
new file mode 100644
index 0000000..3d96a65
--- /dev/null
+++ b/WebKit/win/WebElementPropertyBag.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebElementPropertyBag_H
+#define WebElementPropertyBag_H
+
+#include "ocidl.h"
+
+#include <WTF/OwnPtr.h>
+
+namespace WebCore {
+ class HitTestResult;
+}
+
+class WebElementPropertyBag : public IPropertyBag
+{
+public:
+ static WebElementPropertyBag* createInstance(const WebCore::HitTestResult&);
+
+protected:
+ WebElementPropertyBag(const WebCore::HitTestResult&);
+ ~WebElementPropertyBag();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IPropertyBag
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [out][in] */ VARIANT *pVar,
+ /* [in] */ IErrorLog *pErrorLog);
+
+ virtual HRESULT STDMETHODCALLTYPE Write(
+ /* [in] */ LPCOLESTR pszPropName,
+ /* [in] */ VARIANT *pVar);
+
+private:
+ OwnPtr<WebCore::HitTestResult> m_result;
+ ULONG m_refCount;
+};
+
+#endif // WebElementPropertyBag_H
diff --git a/WebKit/win/WebError.cpp b/WebKit/win/WebError.cpp
new file mode 100644
index 0000000..9c080f6
--- /dev/null
+++ b/WebKit/win/WebError.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebError.h"
+#include "WebKit.h"
+
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebError ---------------------------------------------------------------------
+
+WebError::WebError(const ResourceError& error, IPropertyBag* userInfo)
+ : m_refCount(0)
+ , m_error(error)
+ , m_userInfo(userInfo)
+{
+ gClassCount++;
+}
+
+WebError::~WebError()
+{
+ gClassCount--;
+}
+
+WebError* WebError::createInstance(const ResourceError& error, IPropertyBag* userInfo)
+{
+ WebError* instance = new WebError(error, userInfo);
+ instance->AddRef();
+ return instance;
+}
+
+WebError* WebError::createInstance()
+{
+ return createInstance(ResourceError());
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebError::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebError*>(this);
+ else if (IsEqualGUID(riid, CLSID_WebError))
+ *ppvObject = static_cast<WebError*>(this);
+ else if (IsEqualGUID(riid, IID_IWebError))
+ *ppvObject = static_cast<IWebError*>(this);
+ else if (IsEqualGUID(riid, IID_IWebErrorPrivate))
+ *ppvObject = static_cast<IWebErrorPrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebError::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebError::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebError ------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebError::init(
+ /* [in] */ BSTR domain,
+ /* [in] */ int code,
+ /* [in] */ BSTR url)
+{
+ m_error = ResourceError(String(domain, SysStringLen(domain)), code, String(url, SysStringLen(url)), String());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::code(
+ /* [retval][out] */ int* result)
+{
+ *result = m_error.errorCode();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::domain(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_error.domain()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::localizedDescription(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_error.localizedDescription()).release();
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebError::localizedFailureReason(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::localizedRecoveryOptions(
+ /* [retval][out] */ IEnumVARIANT** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::localizedRecoverySuggestion(
+ /* [retval][out] */ BSTR* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::recoverAttempter(
+ /* [retval][out] */ IUnknown** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::userInfo(
+ /* [retval][out] */ IPropertyBag** result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+
+ if (!m_userInfo)
+ return E_FAIL;
+
+ return m_userInfo.copyRefTo(result);
+}
+
+HRESULT STDMETHODCALLTYPE WebError::failingURL(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_error.failingURL()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::isPolicyChangeError(
+ /* [retval][out] */ BOOL *result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = m_error.domain() == String(WebKitErrorDomain)
+ && m_error.errorCode() == WebKitErrorFrameLoadInterruptedByPolicyChange;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebError::sslPeerCertificate(
+ /* [retval][out] */ OLE_HANDLE* result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+
+ if (!m_cfErrorUserInfoDict) {
+ // copy userinfo from CFErrorRef
+ CFErrorRef cfError = m_error;
+ m_cfErrorUserInfoDict.adoptCF(CFErrorCopyUserInfo(cfError));
+ }
+
+ if (!m_cfErrorUserInfoDict)
+ return E_FAIL;
+
+ void* data = wkGetSSLPeerCertificateData(m_cfErrorUserInfoDict.get());
+ if (!data)
+ return E_FAIL;
+ *result = (OLE_HANDLE)(ULONG64)data;
+ return *result ? S_OK : E_FAIL;
+}
+
+const ResourceError& WebError::resourceError() const
+{
+ return m_error;
+}
diff --git a/WebKit/win/WebError.h b/WebKit/win/WebError.h
new file mode 100644
index 0000000..44a6a3a
--- /dev/null
+++ b/WebKit/win/WebError.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebError_h
+#define WebError_h
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#include <WebCore/ResourceError.h>
+#pragma warning(pop)
+
+class WebError : public IWebError, IWebErrorPrivate {
+public:
+ static WebError* createInstance(const WebCore::ResourceError&, IPropertyBag* userInfo = 0);
+ static WebError* createInstance();
+protected:
+ WebError(const WebCore::ResourceError&, IPropertyBag* userInfo);
+ ~WebError();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebError
+ virtual HRESULT STDMETHODCALLTYPE init(
+ /* [in] */ BSTR domain,
+ /* [in] */ int code,
+ /* [in] */ BSTR url);
+
+ virtual HRESULT STDMETHODCALLTYPE code(
+ /* [retval][out] */ int *result);
+
+ virtual HRESULT STDMETHODCALLTYPE domain(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE localizedDescription(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE localizedFailureReason(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE localizedRecoveryOptions(
+ /* [retval][out] */ IEnumVARIANT **result);
+
+ virtual HRESULT STDMETHODCALLTYPE localizedRecoverySuggestion(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE recoverAttempter(
+ /* [retval][out] */ IUnknown **result);
+
+ virtual HRESULT STDMETHODCALLTYPE userInfo(
+ /* [retval][out] */ IPropertyBag **result);
+
+ virtual HRESULT STDMETHODCALLTYPE failingURL(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE isPolicyChangeError(
+ /* [retval][out] */ BOOL *result);
+
+ // IWebErrorPrivate
+ virtual HRESULT STDMETHODCALLTYPE sslPeerCertificate(
+ /* [retval][out] */ OLE_HANDLE *result);
+
+ const WebCore::ResourceError& resourceError() const;
+
+private:
+ ULONG m_refCount;
+ COMPtr<IPropertyBag> m_userInfo;
+ RetainPtr<CFDictionaryRef> m_cfErrorUserInfoDict;
+ WebCore::ResourceError m_error;
+};
+
+#endif
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
new file mode 100644
index 0000000..0a87263
--- /dev/null
+++ b/WebKit/win/WebFrame.cpp
@@ -0,0 +1,1969 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebFrame.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "COMPtr.h"
+#include "DefaultPolicyDelegate.h"
+#include "DOMCoreClasses.h"
+#include "FormValuesPropertyBag.h"
+#include "MarshallingHelpers.h"
+#include "WebActionPropertyBag.h"
+#include "WebChromeClient.h"
+#include "WebDocumentLoader.h"
+#include "WebDownload.h"
+#include "WebError.h"
+#include "WebMutableURLRequest.h"
+#include "WebEditorClient.h"
+#include "WebFramePolicyListener.h"
+#include "WebHistory.h"
+#include "WebKit.h"
+#include "WebKitStatisticsPrivate.h"
+#include "WebNotificationCenter.h"
+#include "WebView.h"
+#include "WebDataSource.h"
+#include "WebHistoryItem.h"
+#include "WebScriptDebugger.h"
+#include "WebScriptDebugServer.h"
+#include "WebURLResponse.h"
+#pragma warning( push, 0 )
+#include <WebCore/BString.h>
+#include <WebCore/Cache.h>
+#include <WebCore/Document.h>
+#include <WebCore/DocumentLoader.h>
+#include <WebCore/DOMImplementation.h>
+#include <WebCore/DOMWindow.h>
+#include <WebCore/Event.h>
+#include <WebCore/FormState.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameLoadRequest.h>
+#include <WebCore/FrameTree.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/FrameWin.h>
+#include <WebCore/GDIObjectCounter.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/HistoryItem.h>
+#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HTMLGenericFormElement.h>
+#include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLNames.h>
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/MIMETypeRegistry.h>
+#include <WebCore/MouseRelatedEvent.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/Page.h>
+#include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/PluginInfoStore.h>
+#include <WebCore/PluginDatabase.h>
+#include <WebCore/PluginView.h>
+#include <WebCore/ResourceHandle.h>
+#include <WebCore/ResourceHandleWin.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/RenderFrame.h>
+#include <WebCore/RenderTreeAsText.h>
+#include <WebCore/Settings.h>
+#include <WebCore/TextIterator.h>
+#include <WebCore/kjs_binding.h>
+#include <WebCore/kjs_proxy.h>
+#include <WebCore/kjs_window.h>
+#include <JavaScriptCore/APICast.h>
+#include <wtf/MathExtras.h>
+#pragma warning(pop)
+
+#include <CoreGraphics/CoreGraphics.h>
+
+// CG SPI used for printing
+extern "C" {
+ CGAffineTransform CGContextGetBaseCTM(CGContextRef c);
+ void CGContextSetBaseCTM(CGContextRef c, CGAffineTransform m);
+}
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+#define FLASH_REDRAW 0
+
+
+// By imaging to a width a little wider than the available pixels,
+// thin pages will be scaled down a little, matching the way they
+// print in IE and Camino. This lets them use fewer sheets than they
+// would otherwise, which is presumably why other browsers do this.
+// Wide pages will be scaled down more than this.
+const float PrintingMinimumShrinkFactor = 1.25f;
+
+// This number determines how small we are willing to reduce the page content
+// in order to accommodate the widest line. If the page would have to be
+// reduced smaller to make the widest line fit, we just clip instead (this
+// behavior matches MacIE and Mozilla, at least)
+const float PrintingMaximumShrinkFactor = 2.0f;
+
+//-----------------------------------------------------------------------------
+// Helpers to convert from WebCore to WebKit type
+WebFrame* kit(Frame* frame)
+{
+ if (!frame)
+ return 0;
+
+ FrameLoaderClient* frameLoaderClient = frame->loader()->client();
+ if (frameLoaderClient)
+ return static_cast<WebFrame*>(frameLoaderClient); // eek, is there a better way than static cast?
+ return 0;
+}
+
+Frame* core(WebFrame* webFrame)
+{
+ if (!webFrame)
+ return 0;
+ return webFrame->impl();
+}
+
+// This function is not in WebFrame.h because we don't want to advertise the ability to get a non-const Frame from a const WebFrame
+Frame* core(const WebFrame* webFrame)
+{
+ if (!webFrame)
+ return 0;
+ return const_cast<WebFrame*>(webFrame)->impl();
+}
+
+//-----------------------------------------------------------------------------
+
+static Element *elementFromDOMElement(IDOMElement *element)
+{
+ if (!element)
+ return 0;
+
+ COMPtr<IDOMElementPrivate> elePriv;
+ HRESULT hr = element->QueryInterface(IID_IDOMElementPrivate, (void**) &elePriv);
+ if (SUCCEEDED(hr)) {
+ Element* ele;
+ hr = elePriv->coreElement((void**)&ele);
+ if (SUCCEEDED(hr))
+ return ele;
+ }
+ return 0;
+}
+
+static HTMLFormElement *formElementFromDOMElement(IDOMElement *element)
+{
+ if (!element)
+ return 0;
+
+ IDOMElementPrivate* elePriv;
+ HRESULT hr = element->QueryInterface(IID_IDOMElementPrivate, (void**) &elePriv);
+ if (SUCCEEDED(hr)) {
+ Element* ele;
+ hr = elePriv->coreElement((void**)&ele);
+ elePriv->Release();
+ if (SUCCEEDED(hr) && ele && ele->hasTagName(formTag))
+ return static_cast<HTMLFormElement*>(ele);
+ }
+ return 0;
+}
+
+static HTMLInputElement* inputElementFromDOMElement(IDOMElement* element)
+{
+ if (!element)
+ return 0;
+
+ IDOMElementPrivate* elePriv;
+ HRESULT hr = element->QueryInterface(IID_IDOMElementPrivate, (void**) &elePriv);
+ if (SUCCEEDED(hr)) {
+ Element* ele;
+ hr = elePriv->coreElement((void**)&ele);
+ elePriv->Release();
+ if (SUCCEEDED(hr) && ele && ele->hasTagName(inputTag))
+ return static_cast<HTMLInputElement*>(ele);
+ }
+ return 0;
+}
+
+// WebFramePrivate ------------------------------------------------------------
+
+class WebFrame::WebFramePrivate {
+public:
+ WebFramePrivate()
+ : frame(0)
+ , webView(0)
+ , m_policyFunction(0)
+ {
+ }
+
+ ~WebFramePrivate() { }
+ FrameView* frameView() { return frame ? frame->view() : 0; }
+
+ Frame* frame;
+ WebView* webView;
+ FramePolicyFunction m_policyFunction;
+ COMPtr<WebFramePolicyListener> m_policyListener;
+};
+
+// WebFrame ----------------------------------------------------------------
+
+WebFrame::WebFrame()
+ : WebFrameLoaderClient(this)
+ , m_refCount(0)
+ , d(new WebFrame::WebFramePrivate)
+ , m_quickRedirectComing(false)
+ , m_inPrintingMode(false)
+ , m_pageHeight(0)
+ , m_scriptDebugger(0)
+{
+ WebFrameCount++;
+ gClassCount++;
+}
+
+WebFrame::~WebFrame()
+{
+ delete d;
+ WebFrameCount--;
+ gClassCount--;
+}
+
+WebFrame* WebFrame::createInstance()
+{
+ WebFrame* instance = new WebFrame();
+ instance->AddRef();
+ return instance;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::setAllowsScrolling(
+ /* [in] */ BOOL flag)
+{
+ if (Frame* frame = core(this))
+ if (FrameView* view = frame->view())
+ view->setAllowsScrolling(!!flag);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::allowsScrolling(
+ /* [retval][out] */ BOOL *flag)
+{
+ if (flag)
+ if (Frame* frame = core(this))
+ if (FrameView* view = frame->view())
+ *flag = view->allowsScrolling();
+
+ return S_OK;
+}
+
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFrame::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, __uuidof(WebFrame)))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebFrame*>(this);
+ else if (IsEqualGUID(riid, IID_IWebFrame))
+ *ppvObject = static_cast<IWebFrame*>(this);
+ else if (IsEqualGUID(riid, IID_IWebFramePrivate))
+ *ppvObject = static_cast<IWebFramePrivate*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDocumentText))
+ *ppvObject = static_cast<IWebDocumentText*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebFrame::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebFrame::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebFrame -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFrame::name(
+ /* [retval][out] */ BSTR* frameName)
+{
+ if (!frameName) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *frameName = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *frameName = BString(coreFrame->tree()->name()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::webView(
+ /* [retval][out] */ IWebView** view)
+{
+ *view = 0;
+ if (!d->webView)
+ return E_FAIL;
+ *view = d->webView;
+ (*view)->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::frameView(
+ /* [retval][out] */ IWebFrameView** /*view*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::DOMDocument(
+ /* [retval][out] */ IDOMDocument** result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ if (Frame* coreFrame = core(this))
+ if (Document* document = coreFrame->document())
+ *result = DOMDocument::createInstance(document);
+
+ return *result ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::frameElement(
+ /* [retval][out] */ IDOMHTMLElement** /*frameElement*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::currentForm(
+ /* [retval][out] */ IDOMElement **currentForm)
+{
+ if (!currentForm) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *currentForm = 0;
+
+ if (Frame* coreFrame = core(this))
+ if (HTMLFormElement* formElement = coreFrame->currentForm())
+ *currentForm = DOMElement::createInstance(formElement);
+
+ return *currentForm ? S_OK : E_FAIL;
+}
+
+JSGlobalContextRef STDMETHODCALLTYPE WebFrame::globalContext()
+{
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return 0;
+
+ return toGlobalRef(coreFrame->scriptProxy()->globalObject()->globalExec());
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadRequest(
+ /* [in] */ IWebURLRequest* request)
+{
+ COMPtr<WebMutableURLRequest> requestImpl;
+
+ HRESULT hr = request->QueryInterface(&requestImpl);
+ if (FAILED(hr))
+ return hr;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ coreFrame->loader()->load(requestImpl->resourceRequest());
+ return S_OK;
+}
+
+void WebFrame::loadData(PassRefPtr<WebCore::SharedBuffer> data, BSTR mimeType, BSTR textEncodingName, BSTR baseURL, BSTR failingURL)
+{
+ String mimeTypeString(mimeType, SysStringLen(mimeType));
+ if (!mimeType)
+ mimeTypeString = "text/html";
+
+ String encodingString(textEncodingName, SysStringLen(textEncodingName));
+ KURL baseKURL(String(baseURL ? baseURL : L"", SysStringLen(baseURL)));
+ KURL failingKURL(String(failingURL, SysStringLen(failingURL)));
+
+ ResourceRequest request(baseKURL);
+ SubstituteData substituteData(data, mimeTypeString, encodingString, failingKURL);
+
+ // This method is only called from IWebFrame methods, so don't ASSERT that the Frame pointer isn't null.
+ if (Frame* coreFrame = core(this))
+ coreFrame->loader()->load(request, substituteData);
+}
+
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadData(
+ /* [in] */ IStream* data,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ BSTR textEncodingName,
+ /* [in] */ BSTR url)
+{
+ RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer();
+
+ STATSTG stat;
+ if (SUCCEEDED(data->Stat(&stat, STATFLAG_NONAME))) {
+ if (!stat.cbSize.HighPart && stat.cbSize.LowPart) {
+ Vector<char> dataBuffer(stat.cbSize.LowPart);
+ ULONG read;
+ // FIXME: this does a needless copy, would be better to read right into the SharedBuffer
+ // or adopt the Vector or something.
+ if (SUCCEEDED(data->Read(dataBuffer.data(), static_cast<ULONG>(dataBuffer.size()), &read)))
+ sharedBuffer->append(dataBuffer.data(), static_cast<int>(dataBuffer.size()));
+ }
+ }
+
+ loadData(sharedBuffer, mimeType, textEncodingName, url, 0);
+ return S_OK;
+}
+
+void WebFrame::loadHTMLString(BSTR string, BSTR baseURL, BSTR unreachableURL)
+{
+ RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(reinterpret_cast<char*>(string), sizeof(UChar) * SysStringLen(string));
+ BString utf16Encoding(TEXT("utf-16"), 6);
+ loadData(sharedBuffer.release(), 0, utf16Encoding, baseURL, unreachableURL);
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadHTMLString(
+ /* [in] */ BSTR string,
+ /* [in] */ BSTR baseURL)
+{
+ loadHTMLString(string, baseURL, 0);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadAlternateHTMLString(
+ /* [in] */ BSTR str,
+ /* [in] */ BSTR baseURL,
+ /* [in] */ BSTR unreachableURL)
+{
+ loadHTMLString(str, baseURL, unreachableURL);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadArchive(
+ /* [in] */ IWebArchive* /*archive*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+static inline WebDataSource *getWebDataSource(DocumentLoader* loader)
+{
+ return loader ? static_cast<WebDocumentLoader*>(loader)->dataSource() : 0;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::dataSource(
+ /* [retval][out] */ IWebDataSource** source)
+{
+ if (!source) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *source = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ WebDataSource* webDataSource = getWebDataSource(coreFrame->loader()->documentLoader());
+
+ *source = webDataSource;
+
+ if (webDataSource)
+ webDataSource->AddRef();
+
+ return *source ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::provisionalDataSource(
+ /* [retval][out] */ IWebDataSource** source)
+{
+ if (!source) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *source = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ WebDataSource* webDataSource = getWebDataSource(coreFrame->loader()->provisionalDocumentLoader());
+
+ *source = webDataSource;
+
+ if (webDataSource)
+ webDataSource->AddRef();
+
+ return *source ? S_OK : E_FAIL;
+}
+
+KURL WebFrame::url() const
+{
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return KURL();
+
+ return coreFrame->loader()->url();
+}
+
+void WebFrame::attachScriptDebugger()
+{
+ if (!m_scriptDebugger && core(this)->scriptProxy()->haveGlobalObject())
+ m_scriptDebugger.set(new WebScriptDebugger(this));
+}
+
+void WebFrame::detachScriptDebugger()
+{
+ m_scriptDebugger.clear();
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::stopLoading( void)
+{
+ if (Frame* coreFrame = core(this))
+ coreFrame->loader()->stopAllLoaders();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::reload( void)
+{
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ coreFrame->loader()->reload();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::findFrameNamed(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IWebFrame** frame)
+{
+ if (!frame) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *frame = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ Frame* foundFrame = coreFrame->tree()->find(AtomicString(name, SysStringLen(name)));
+ if (!foundFrame)
+ return S_OK;
+
+ WebFrame* foundWebFrame = kit(foundFrame);
+ if (!foundWebFrame)
+ return E_FAIL;
+
+ return foundWebFrame->QueryInterface(IID_IWebFrame, (void**)frame);
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::parentFrame(
+ /* [retval][out] */ IWebFrame** frame)
+{
+ HRESULT hr = S_OK;
+ *frame = 0;
+ if (Frame* coreFrame = core(this))
+ if (WebFrame* webFrame = kit(coreFrame->tree()->parent()))
+ hr = webFrame->QueryInterface(IID_IWebFrame, (void**) frame);
+
+ return hr;
+}
+
+class EnumChildFrames : public IEnumVARIANT
+{
+public:
+ EnumChildFrames(Frame* f) : m_refCount(1), m_frame(f), m_curChild(f ? f->tree()->firstChild() : 0) { }
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
+ {
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IEnumVARIANT))
+ *ppvObject = this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+ }
+
+ virtual ULONG STDMETHODCALLTYPE AddRef(void)
+ {
+ return ++m_refCount;
+ }
+
+ virtual ULONG STDMETHODCALLTYPE Release(void)
+ {
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+ return newRef;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched)
+ {
+ if (pCeltFetched)
+ *pCeltFetched = 0;
+ if (!rgVar)
+ return E_POINTER;
+ VariantInit(rgVar);
+ if (!celt || celt > 1)
+ return S_FALSE;
+ if (!m_frame || !m_curChild)
+ return S_FALSE;
+
+ WebFrame* webFrame = kit(m_curChild);
+ IUnknown* unknown;
+ HRESULT hr = webFrame->QueryInterface(IID_IUnknown, (void**)&unknown);
+ if (FAILED(hr))
+ return hr;
+
+ V_VT(rgVar) = VT_UNKNOWN;
+ V_UNKNOWN(rgVar) = unknown;
+
+ m_curChild = m_curChild->tree()->nextSibling();
+ if (pCeltFetched)
+ *pCeltFetched = 1;
+ return S_OK;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt)
+ {
+ if (!m_frame)
+ return S_FALSE;
+ for (unsigned i = 0; i < celt && m_curChild; i++)
+ m_curChild = m_curChild->tree()->nextSibling();
+ return m_curChild ? S_OK : S_FALSE;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Reset(void)
+ {
+ if (!m_frame)
+ return S_FALSE;
+ m_curChild = m_frame->tree()->firstChild();
+ return S_OK;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT**)
+ {
+ return E_NOTIMPL;
+ }
+
+private:
+ ULONG m_refCount;
+ Frame* m_frame;
+ Frame* m_curChild;
+};
+
+HRESULT STDMETHODCALLTYPE WebFrame::childFrames(
+ /* [retval][out] */ IEnumVARIANT **enumFrames)
+{
+ if (!enumFrames)
+ return E_POINTER;
+
+ *enumFrames = new EnumChildFrames(core(this));
+ return S_OK;
+}
+
+// IWebFramePrivate ------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFrame::renderTreeAsExternalRepresentation(
+ /* [retval][out] */ BSTR *result)
+{
+ if (!result)
+ return E_POINTER;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *result = BString(externalRepresentation(coreFrame->renderer())).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::scrollOffset(
+ /* [retval][out] */ SIZE* offset)
+{
+ if (!offset) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+
+ *offset = view->scrollOffset();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::layout()
+{
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+
+ view->layout();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::firstLayoutDone(
+ /* [retval][out] */ BOOL* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *result = coreFrame->loader()->firstLayoutDone();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::loadType(
+ /* [retval][out] */ WebFrameLoadType* type)
+{
+ if (!type) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *type = (WebFrameLoadType)0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *type = (WebFrameLoadType)coreFrame->loader()->loadType();
+ return S_OK;
+}
+
+// IWebDocumentText -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFrame::supportsTextEncoding(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::selectedString(
+ /* [retval][out] */ BSTR* result)
+{
+ *result = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ String text = coreFrame->selectedText();
+ text.replace('\\', coreFrame->backslashAsCurrencySymbol());
+
+ *result = BString(text).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::selectAll()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::deselectAll()
+{
+ return E_NOTIMPL;
+}
+
+// WebFrame ---------------------------------------------------------------
+
+void WebFrame::initWithWebFrameView(IWebFrameView* /*view*/, IWebView* webView, Page* page, HTMLFrameOwnerElement* ownerElement)
+{
+ if (FAILED(webView->QueryInterface(&d->webView)))
+ return;
+ d->webView->Release(); // don't hold the extra ref
+
+ HWND viewWindow;
+ d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
+
+ this->AddRef(); // We release this ref in frameLoaderDestroyed()
+ Frame* frame = new Frame(page, ownerElement, this);
+ d->frame = frame;
+}
+
+Frame* WebFrame::impl()
+{
+ return d->frame;
+}
+
+void WebFrame::invalidate()
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ if (Document* document = coreFrame->document())
+ document->recalcStyle(Node::Force);
+}
+
+void WebFrame::setTextSizeMultiplier(float multiplier)
+{
+ int newZoomFactor = (int)round(multiplier * 100);
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ if (coreFrame->zoomFactor() == newZoomFactor)
+ return;
+
+ coreFrame->setZoomFactor(newZoomFactor);
+}
+
+HRESULT WebFrame::inViewSourceMode(BOOL* flag)
+{
+ if (!flag) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *flag = FALSE;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *flag = coreFrame->inViewSourceMode() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT WebFrame::setInViewSourceMode(BOOL flag)
+{
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ coreFrame->setInViewSourceMode(!!flag);
+ return S_OK;
+}
+
+HRESULT WebFrame::elementWithName(BSTR name, IDOMElement* form, IDOMElement** element)
+{
+ if (!form)
+ return E_INVALIDARG;
+
+ HTMLFormElement *formElement = formElementFromDOMElement(form);
+ if (formElement) {
+ Vector<HTMLGenericFormElement*>& elements = formElement->formElements;
+ AtomicString targetName((UChar*)name, SysStringLen(name));
+ for (unsigned int i = 0; i < elements.size(); i++) {
+ HTMLGenericFormElement *elt = elements[i];
+ // Skip option elements, other duds
+ if (elt->name() == targetName) {
+ *element = DOMElement::createInstance(elt);
+ return S_OK;
+ }
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT WebFrame::formForElement(IDOMElement* element, IDOMElement** form)
+{
+ if (!element)
+ return E_INVALIDARG;
+
+ HTMLInputElement *inputElement = inputElementFromDOMElement(element);
+ if (!inputElement)
+ return E_FAIL;
+
+ HTMLFormElement *formElement = inputElement->form();
+ if (!formElement)
+ return E_FAIL;
+
+ *form = DOMElement::createInstance(formElement);
+ return S_OK;
+}
+
+HRESULT WebFrame::elementDoesAutoComplete(IDOMElement *element, bool *result)
+{
+ *result = false;
+ if (!element)
+ return E_INVALIDARG;
+
+ HTMLInputElement *inputElement = inputElementFromDOMElement(element);
+ if (!inputElement)
+ *result = false;
+ else
+ *result = (inputElement->inputType() == HTMLInputElement::TEXT && inputElement->autoComplete());
+
+ return S_OK;
+}
+
+HRESULT WebFrame::controlsInForm(IDOMElement* form, IDOMElement** controls, int* cControls)
+{
+ if (!form)
+ return E_INVALIDARG;
+
+ HTMLFormElement *formElement = formElementFromDOMElement(form);
+ if (!formElement)
+ return E_FAIL;
+
+ int inCount = *cControls;
+ int count = (int) formElement->formElements.size();
+ *cControls = count;
+ if (!controls)
+ return S_OK;
+ if (inCount < count)
+ return E_FAIL;
+
+ *cControls = 0;
+ Vector<HTMLGenericFormElement*>& elements = formElement->formElements;
+ for (int i = 0; i < count; i++) {
+ if (elements.at(i)->isEnumeratable()) { // Skip option elements, other duds
+ controls[*cControls] = DOMElement::createInstance(elements.at(i));
+ (*cControls)++;
+ }
+ }
+ return S_OK;
+}
+
+HRESULT WebFrame::elementIsPassword(IDOMElement *element, bool *result)
+{
+ HTMLInputElement *inputElement = inputElementFromDOMElement(element);
+ *result = inputElement != 0
+ && inputElement->inputType() == HTMLInputElement::PASSWORD;
+ return S_OK;
+}
+
+HRESULT WebFrame::searchForLabelsBeforeElement(const BSTR* labels, int cLabels, IDOMElement* beforeElement, BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ if (!cLabels)
+ return S_OK;
+ if (cLabels < 1)
+ return E_INVALIDARG;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ Vector<String> labelStrings(cLabels);
+ for (int i=0; i<cLabels; i++)
+ labelStrings[i] = String(labels[i], SysStringLen(labels[i]));
+ Element *coreElement = elementFromDOMElement(beforeElement);
+ if (!coreElement)
+ return E_FAIL;
+
+ String label = coreFrame->searchForLabelsBeforeElement(labelStrings, coreElement);
+
+ *result = SysAllocStringLen(label.characters(), label.length());
+ if (label.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT WebFrame::matchLabelsAgainstElement(const BSTR* labels, int cLabels, IDOMElement* againstElement, BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ if (!cLabels)
+ return S_OK;
+ if (cLabels < 1)
+ return E_INVALIDARG;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ Vector<String> labelStrings(cLabels);
+ for (int i=0; i<cLabels; i++)
+ labelStrings[i] = String(labels[i], SysStringLen(labels[i]));
+ Element *coreElement = elementFromDOMElement(againstElement);
+ if (!coreElement)
+ return E_FAIL;
+
+ String label = coreFrame->matchLabelsAgainstElement(labelStrings, coreElement);
+
+ *result = SysAllocStringLen(label.characters(), label.length());
+ if (label.length() && !*result)
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT WebFrame::canProvideDocumentSource(bool* result)
+{
+ HRESULT hr = S_OK;
+ *result = false;
+
+ COMPtr<IWebDataSource> dataSource;
+ hr = WebFrame::dataSource(&dataSource);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<IWebURLResponse> urlResponse;
+ hr = dataSource->response(&urlResponse);
+ if (SUCCEEDED(hr) && urlResponse) {
+ BSTR mimeTypeBStr;
+ if (SUCCEEDED(urlResponse->MIMEType(&mimeTypeBStr))) {
+ String mimeType(mimeTypeBStr, SysStringLen(mimeTypeBStr));
+ *result = mimeType == "text/html" || WebCore::DOMImplementation::isXMLMIMEType(mimeType);
+ SysFreeString(mimeTypeBStr);
+ }
+ }
+ return hr;
+}
+
+void WebFrame::frameLoaderDestroyed()
+{
+ // The FrameLoader going away is equivalent to the Frame going away,
+ // so we now need to clear our frame pointer.
+ d->frame = 0;
+
+ this->Release();
+}
+
+void WebFrame::makeRepresentation(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::forceLayoutForNonHTML()
+{
+ notImplemented();
+}
+
+void WebFrame::setCopiesOnScroll()
+{
+ notImplemented();
+}
+
+void WebFrame::detachedFromParent2()
+{
+ notImplemented();
+}
+
+void WebFrame::detachedFromParent3()
+{
+ notImplemented();
+}
+
+void WebFrame::detachedFromParent4()
+{
+ notImplemented();
+}
+
+void WebFrame::cancelPolicyCheck()
+{
+ if (d->m_policyListener) {
+ d->m_policyListener->invalidate();
+ d->m_policyListener = 0;
+ }
+
+ d->m_policyFunction = 0;
+}
+
+void WebFrame::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ COMPtr<IWebFormDelegate> formDelegate;
+
+ if (FAILED(d->webView->formDelegate(&formDelegate))) {
+ (coreFrame->loader()->*function)(PolicyUse);
+ return;
+ }
+
+ COMPtr<IDOMElement> formElement(AdoptCOM, DOMElement::createInstance(formState->form()));
+
+ // FIXME: The FormValuesPropertyBag constructor should take a const pointer
+ FormValuesPropertyBag formValuesPropBag(const_cast<HashMap<String, String>*>(&formState->values()));
+
+ COMPtr<WebFrame> sourceFrame(kit(formState->sourceFrame()));
+ if (SUCCEEDED(formDelegate->willSubmitForm(this, sourceFrame.get(), formElement.get(), &formValuesPropBag, setUpPolicyListener(function).get())))
+ return;
+
+ // FIXME: Add a sane default implementation
+ (coreFrame->loader()->*function)(PolicyUse);
+}
+
+void WebFrame::revertToProvisionalState(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::clearUnarchivingState(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::setMainFrameDocumentReady(bool)
+{
+ notImplemented();
+}
+
+void WebFrame::willChangeTitle(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::didChangeTitle(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::finalSetupForReplace(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::setDefersLoading(bool)
+{
+ notImplemented();
+}
+
+bool WebFrame::isArchiveLoadPending(ResourceLoader*) const
+{
+ notImplemented();
+ return false;
+}
+
+void WebFrame::cancelPendingArchiveLoad(ResourceLoader*)
+{
+ notImplemented();
+}
+
+void WebFrame::clearArchivedResources()
+{
+ notImplemented();
+}
+
+bool WebFrame::canHandleRequest(const ResourceRequest& request) const
+{
+ return WebView::canHandleRequest(request);
+}
+
+bool WebFrame::canShowMIMEType(const String& /*MIMEType*/) const
+{
+ notImplemented();
+ return true;
+}
+
+bool WebFrame::representationExistsForURLScheme(const String& /*URLScheme*/) const
+{
+ notImplemented();
+ return false;
+}
+
+String WebFrame::generatedMIMETypeForURLScheme(const String& /*URLScheme*/) const
+{
+ notImplemented();
+ ASSERT_NOT_REACHED();
+ return String();
+}
+
+void WebFrame::frameLoadCompleted()
+{
+ if (Frame* coreFrame = core(this))
+ coreFrame->loader()->setPreviousHistoryItem(0);
+}
+
+void WebFrame::restoreViewState()
+{
+}
+
+void WebFrame::provisionalLoadStarted()
+{
+ notImplemented();
+}
+
+bool WebFrame::shouldTreatURLAsSameAsCurrent(const KURL&) const
+{
+ notImplemented();
+ return false;
+}
+
+void WebFrame::addHistoryItemForFragmentScroll()
+{
+ notImplemented();
+}
+
+void WebFrame::didFinishLoad()
+{
+ notImplemented();
+}
+
+void WebFrame::prepareForDataSourceReplacement()
+{
+ notImplemented();
+}
+
+String WebFrame::userAgent(const KURL& url)
+{
+ return d->webView->userAgentForKURL(url);
+}
+
+void WebFrame::transitionToCommittedFromCachedPage(CachedPage*)
+{
+}
+
+void WebFrame::saveViewStateToItem(HistoryItem*)
+{
+}
+
+ResourceError WebFrame::cancelledError(const ResourceRequest& request)
+{
+ // FIXME: Need ChickenCat to include CFNetwork/CFURLError.h to get these values
+ // Alternatively, we could create our own error domain/codes.
+ return ResourceError(String(WebURLErrorDomain), -999, request.url().string(), String());
+}
+
+ResourceError WebFrame::blockedError(const ResourceRequest& request)
+{
+ // FIXME: Need to implement the String descriptions for errors in the WebKitErrorDomain and have them localized
+ return ResourceError(String(WebKitErrorDomain), WebKitErrorCannotUseRestrictedPort, request.url().string(), String());
+}
+
+ResourceError WebFrame::cannotShowURLError(const ResourceRequest&)
+{
+ notImplemented();
+ return ResourceError();
+}
+
+ResourceError WebFrame::interruptForPolicyChangeError(const ResourceRequest& request)
+{
+ // FIXME: Need to implement the String descriptions for errors in the WebKitErrorDomain and have them localized
+ return ResourceError(String(WebKitErrorDomain), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
+}
+
+ResourceError WebFrame::cannotShowMIMETypeError(const ResourceResponse&)
+{
+ notImplemented();
+ return ResourceError();
+}
+
+ResourceError WebFrame::fileDoesNotExistError(const ResourceResponse&)
+{
+ notImplemented();
+ return ResourceError();
+}
+
+bool WebFrame::shouldFallBack(const ResourceError& error)
+{
+ return error.errorCode() != WebURLErrorCancelled;
+}
+
+COMPtr<WebFramePolicyListener> WebFrame::setUpPolicyListener(WebCore::FramePolicyFunction function)
+{
+ // FIXME: <rdar://5634381> We need to support multiple active policy listeners.
+
+ if (d->m_policyListener)
+ d->m_policyListener->invalidate();
+
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ d->m_policyListener.adoptRef(WebFramePolicyListener::createInstance(coreFrame));
+ d->m_policyFunction = function;
+
+ return d->m_policyListener;
+}
+
+void WebFrame::receivedPolicyDecision(PolicyAction action)
+{
+ ASSERT(d->m_policyListener);
+ ASSERT(d->m_policyFunction);
+
+ FramePolicyFunction function = d->m_policyFunction;
+
+ d->m_policyListener = 0;
+ d->m_policyFunction = 0;
+
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ (coreFrame->loader()->*function)(action);
+}
+
+void WebFrame::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimeType, const ResourceRequest& request)
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ COMPtr<IWebPolicyDelegate> policyDelegate;
+ if (FAILED(d->webView->policyDelegate(&policyDelegate)))
+ policyDelegate = DefaultPolicyDelegate::sharedInstance();
+
+ COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
+
+ if (SUCCEEDED(policyDelegate->decidePolicyForMIMEType(d->webView, BString(mimeType), urlRequest.get(), this, setUpPolicyListener(function).get())))
+ return;
+
+ (coreFrame->loader()->*function)(PolicyUse);
+}
+
+void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, const String& frameName)
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ COMPtr<IWebPolicyDelegate> policyDelegate;
+ if (FAILED(d->webView->policyDelegate(&policyDelegate)))
+ policyDelegate = DefaultPolicyDelegate::sharedInstance();
+
+ COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
+ COMPtr<WebActionPropertyBag> actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame));
+
+ if (SUCCEEDED(policyDelegate->decidePolicyForNewWindowAction(d->webView, actionInformation.get(), urlRequest.get(), BString(frameName), setUpPolicyListener(function).get())))
+ return;
+
+ (coreFrame->loader()->*function)(PolicyUse);
+}
+
+void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request)
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ COMPtr<IWebPolicyDelegate> policyDelegate;
+ if (FAILED(d->webView->policyDelegate(&policyDelegate)))
+ policyDelegate = DefaultPolicyDelegate::sharedInstance();
+
+ COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(request));
+ COMPtr<WebActionPropertyBag> actionInformation(AdoptCOM, WebActionPropertyBag::createInstance(action, coreFrame));
+
+ if (SUCCEEDED(policyDelegate->decidePolicyForNavigationAction(d->webView, actionInformation.get(), urlRequest.get(), this, setUpPolicyListener(function).get())))
+ return;
+
+ (coreFrame->loader()->*function)(PolicyUse);
+}
+
+void WebFrame::dispatchUnableToImplementPolicy(const ResourceError& error)
+{
+ COMPtr<IWebPolicyDelegate> policyDelegate;
+ if (FAILED(d->webView->policyDelegate(&policyDelegate)))
+ policyDelegate = DefaultPolicyDelegate::sharedInstance();
+
+ COMPtr<IWebError> webError(AdoptCOM, WebError::createInstance(error));
+ policyDelegate->unableToImplementPolicyWithError(d->webView, webError.get(), this);
+}
+
+void WebFrame::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response)
+{
+ COMPtr<IWebDownloadDelegate> downloadDelegate;
+ COMPtr<IWebView> webView;
+ if (SUCCEEDED(this->webView(&webView))) {
+ if (FAILED(webView->downloadDelegate(&downloadDelegate))) {
+ // If the WebView doesn't successfully provide a download delegate we'll pass a null one
+ // into the WebDownload - which may or may not decide to use a DefaultDownloadDelegate
+ LOG_ERROR("Failed to get downloadDelegate from WebView");
+ downloadDelegate = 0;
+ }
+ }
+
+ // Its the delegate's job to ref the WebDownload to keep it alive - otherwise it will be destroyed
+ // when this method returns
+ COMPtr<WebDownload> download;
+ download.adoptRef(WebDownload::createInstance(handle, request, response, downloadDelegate.get()));
+}
+
+bool WebFrame::willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL&) const
+{
+ notImplemented();
+ return false;
+}
+
+bool WebFrame::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int /*length*/)
+{
+ notImplemented();
+ return false;
+}
+
+void WebFrame::dispatchDidFailProvisionalLoad(const ResourceError& error)
+{
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) {
+ COMPtr<IWebError> webError;
+ webError.adoptRef(WebError::createInstance(error));
+ frameLoadDelegate->didFailProvisionalLoadWithError(d->webView, webError.get(), this);
+ }
+}
+
+void WebFrame::dispatchDidFailLoad(const ResourceError& error)
+{
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) {
+ COMPtr<IWebError> webError;
+ webError.adoptRef(WebError::createInstance(error));
+ frameLoadDelegate->didFailLoadWithError(d->webView, webError.get(), this);
+ }
+}
+
+void WebFrame::startDownload(const ResourceRequest&)
+{
+ notImplemented();
+}
+
+Widget* WebFrame::createJavaAppletWidget(const IntSize& pluginSize, Element* element, const KURL& /*baseURL*/, const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ PluginView* pluginView = PluginView::create(core(this), pluginSize, element, KURL(), paramNames, paramValues, "application/x-java-applet", false);
+
+ // Check if the plugin can be loaded successfully
+ if (pluginView->plugin() && pluginView->plugin()->load())
+ return pluginView;
+
+ COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate;
+ if (FAILED(d->webView->resourceLoadDelegate(&resourceLoadDelegate)))
+ return pluginView;
+
+ COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+
+ ResourceError resourceError(String(WebKitErrorDomain), WebKitErrorJavaUnavailable, String(), String());
+ COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get()));
+
+ resourceLoadDelegate->plugInFailedWithError(d->webView, error.get(), getWebDataSource(d->frame->loader()->documentLoader()));
+
+ return pluginView;
+}
+
+ObjectContentType WebFrame::objectContentType(const KURL& url, const String& mimeTypeIn)
+{
+ String mimeType = mimeTypeIn;
+ if (mimeType.isEmpty())
+ mimeType = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1));
+
+ if (mimeType.isEmpty())
+ return ObjectContentFrame; // Go ahead and hope that we can display the content.
+
+ if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
+ return WebCore::ObjectContentImage;
+
+ if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType))
+ return WebCore::ObjectContentNetscapePlugin;
+
+ if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
+ return WebCore::ObjectContentFrame;
+
+ return WebCore::ObjectContentNone;
+}
+
+String WebFrame::overrideMediaType() const
+{
+ notImplemented();
+ return String();
+}
+
+void WebFrame::windowObjectCleared()
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+
+ Settings* settings = coreFrame->settings();
+ if (!settings || !settings->isJavaScriptEnabled())
+ return;
+
+ COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
+ if (SUCCEEDED(d->webView->frameLoadDelegate(&frameLoadDelegate))) {
+ COMPtr<IWebFrameLoadDelegate2> frameLoadDelegate2(Query, frameLoadDelegate);
+
+ JSContextRef context = toRef(coreFrame->scriptProxy()->globalObject()->globalExec());
+ JSObjectRef windowObject = toRef(KJS::Window::retrieve(coreFrame)->getObject());
+ ASSERT(windowObject);
+
+ if (!frameLoadDelegate2 ||
+ FAILED(frameLoadDelegate2->didClearWindowObject(d->webView, context, windowObject, this)))
+ frameLoadDelegate->windowScriptObjectAvailable(d->webView, context, windowObject);
+ }
+
+ if (WebScriptDebugServer::listenerCount() > 0) {
+ detachScriptDebugger();
+ attachScriptDebugger();
+ }
+}
+
+void WebFrame::didPerformFirstNavigation() const
+{
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(d->webView->preferences(&preferences)))
+ return;
+
+ COMPtr<IWebPreferencesPrivate> preferencesPrivate(Query, preferences);
+ if (!preferencesPrivate)
+ return;
+ BOOL automaticallyDetectsCacheModel;
+ if (FAILED(preferencesPrivate->automaticallyDetectsCacheModel(&automaticallyDetectsCacheModel)))
+ return;
+
+ WebCacheModel cacheModel;
+ if (FAILED(preferences->cacheModel(&cacheModel)))
+ return;
+
+ if (automaticallyDetectsCacheModel && cacheModel < WebCacheModelDocumentBrowser)
+ preferences->setCacheModel(WebCacheModelDocumentBrowser);
+}
+
+void WebFrame::registerForIconNotification(bool listen)
+{
+ d->webView->registerForIconNotification(listen);
+}
+
+static IntRect printerRect(HDC printDC)
+{
+ return IntRect(0, 0,
+ GetDeviceCaps(printDC, PHYSICALWIDTH) - 2 * GetDeviceCaps(printDC, PHYSICALOFFSETX),
+ GetDeviceCaps(printDC, PHYSICALHEIGHT) - 2 * GetDeviceCaps(printDC, PHYSICALOFFSETY));
+}
+
+void WebFrame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize)
+{
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+ coreFrame->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize);
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::setInPrintingMode(
+ /* [in] */ BOOL value,
+ /* [in] */ HDC printDC)
+{
+ if (m_inPrintingMode == !!value)
+ return S_OK;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ m_inPrintingMode = !!value;
+
+ // If we are a frameset just print with the layout we have onscreen, otherwise relayout
+ // according to the paper size
+ float minLayoutWidth = 0.0f;
+ float maxLayoutWidth = 0.0f;
+ if (m_inPrintingMode && !coreFrame->isFrameSet()) {
+ if (!printDC) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ const int desiredHorizontalPixelsPerInch = 72;
+ int paperHorizontalPixelsPerInch = ::GetDeviceCaps(printDC, LOGPIXELSX);
+ int paperWidth = printerRect(printDC).width() * desiredHorizontalPixelsPerInch / paperHorizontalPixelsPerInch;
+ minLayoutWidth = paperWidth * PrintingMinimumShrinkFactor;
+ maxLayoutWidth = paperWidth * PrintingMaximumShrinkFactor;
+ }
+
+ setPrinting(m_inPrintingMode, minLayoutWidth, maxLayoutWidth, true);
+
+ if (!m_inPrintingMode)
+ m_pageRects.clear();
+
+ return S_OK;
+}
+
+void WebFrame::headerAndFooterHeights(float* headerHeight, float* footerHeight)
+{
+ if (headerHeight)
+ *headerHeight = 0;
+ if (footerHeight)
+ *footerHeight = 0;
+ float height = 0;
+ COMPtr<IWebUIDelegate> ui;
+ if (FAILED(d->webView->uiDelegate(&ui)))
+ return;
+ COMPtr<IWebUIDelegate2> ui2;
+ if (FAILED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2)))
+ return;
+ if (headerHeight && SUCCEEDED(ui2->webViewHeaderHeight(d->webView, &height)))
+ *headerHeight = height;
+ if (footerHeight && SUCCEEDED(ui2->webViewFooterHeight(d->webView, &height)))
+ *footerHeight = height;
+}
+
+IntRect WebFrame::printerMarginRect(HDC printDC)
+{
+ IntRect emptyRect(0, 0, 0, 0);
+
+ COMPtr<IWebUIDelegate> ui;
+ if (FAILED(d->webView->uiDelegate(&ui)))
+ return emptyRect;
+ COMPtr<IWebUIDelegate2> ui2;
+ if (FAILED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2)))
+ return emptyRect;
+
+ RECT rect;
+ if (FAILED(ui2->webViewPrintingMarginRect(d->webView, &rect)))
+ return emptyRect;
+
+ rect.left = MulDiv(rect.left, ::GetDeviceCaps(printDC, LOGPIXELSX), 1000);
+ rect.top = MulDiv(rect.top, ::GetDeviceCaps(printDC, LOGPIXELSY), 1000);
+ rect.right = MulDiv(rect.right, ::GetDeviceCaps(printDC, LOGPIXELSX), 1000);
+ rect.bottom = MulDiv(rect.bottom, ::GetDeviceCaps(printDC, LOGPIXELSY), 1000);
+
+ return IntRect(rect.left, rect.top, (rect.right - rect.left), rect.bottom - rect.top);
+}
+
+const Vector<WebCore::IntRect>& WebFrame::computePageRects(HDC printDC)
+{
+ ASSERT(m_inPrintingMode);
+
+ Frame* coreFrame = core(this);
+ ASSERT(coreFrame);
+ ASSERT(coreFrame->document());
+
+ if (!printDC)
+ return m_pageRects;
+
+ // adjust the page rect by the header and footer
+ float headerHeight = 0, footerHeight = 0;
+ headerAndFooterHeights(&headerHeight, &footerHeight);
+ IntRect pageRect = printerRect(printDC);
+ IntRect marginRect = printerMarginRect(printDC);
+ IntRect adjustedRect = IntRect(
+ pageRect.x() + marginRect.x(),
+ pageRect.y() + marginRect.y(),
+ pageRect.width() - marginRect.x() - marginRect.right(),
+ pageRect.height() - marginRect.y() - marginRect.bottom());
+
+ computePageRectsForFrame(coreFrame, adjustedRect, headerHeight, footerHeight, 1.0,m_pageRects, m_pageHeight);
+
+ return m_pageRects;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::getPrintedPageCount(
+ /* [in] */ HDC printDC,
+ /* [retval][out] */ UINT *pageCount)
+{
+ if (!pageCount || !printDC) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *pageCount = 0;
+
+ if (!m_inPrintingMode) {
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame || !coreFrame->document())
+ return E_FAIL;
+
+ const Vector<IntRect>& pages = computePageRects(printDC);
+ *pageCount = (UINT) pages.size();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::spoolPages(
+ /* [in] */ HDC printDC,
+ /* [in] */ UINT startPage,
+ /* [in] */ UINT endPage,
+ /* [retval][out] */ void* ctx)
+{
+ if (!printDC || !ctx) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ if (!m_inPrintingMode) {
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame || !coreFrame->document())
+ return E_FAIL;
+
+ UINT pageCount = (UINT) m_pageRects.size();
+ PlatformGraphicsContext* pctx = (PlatformGraphicsContext*)ctx;
+
+ if (!pageCount || startPage > pageCount) {
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ if (startPage > 0)
+ startPage--;
+
+ if (endPage == 0)
+ endPage = pageCount;
+
+ COMPtr<IWebUIDelegate> ui;
+ if (FAILED(d->webView->uiDelegate(&ui)))
+ return E_FAIL;
+ // FIXME: we can return early after the updated app is released
+ COMPtr<IWebUIDelegate2> ui2;
+ if (FAILED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2)))
+ ui2 = 0;
+
+ float headerHeight = 0, footerHeight = 0;
+ headerAndFooterHeights(&headerHeight, &footerHeight);
+ GraphicsContext spoolCtx(pctx);
+
+ for (UINT ii = startPage; ii < endPage; ii++) {
+ IntRect pageRect = m_pageRects[ii];
+
+ CGContextSaveGState(pctx);
+
+ IntRect printRect = printerRect(printDC);
+ CGRect mediaBox = CGRectMake(CGFloat(0),
+ CGFloat(0),
+ CGFloat(printRect.width()),
+ CGFloat(printRect.height()));
+
+ CGContextBeginPage(pctx, &mediaBox);
+
+ CGFloat scale = (float)mediaBox.size.width/ (float)pageRect.width();
+ CGAffineTransform ctm = CGContextGetBaseCTM(pctx);
+ ctm = CGAffineTransformScale(ctm, -scale, -scale);
+ ctm = CGAffineTransformTranslate(ctm, CGFloat(-pageRect.x()), CGFloat(-pageRect.y()+headerHeight)); // reserves space for header
+ CGContextScaleCTM(pctx, scale, scale);
+ CGContextTranslateCTM(pctx, CGFloat(-pageRect.x()), CGFloat(-pageRect.y()+headerHeight)); // reserves space for header
+ CGContextSetBaseCTM(pctx, ctm);
+
+ coreFrame->paint(&spoolCtx, pageRect);
+
+ if (ui2) {
+ CGContextTranslateCTM(pctx, CGFloat(pageRect.x()), CGFloat(pageRect.y())-headerHeight);
+
+ int x = pageRect.x();
+ int y = 0;
+ if (headerHeight) {
+ RECT headerRect = {x, y, x+pageRect.width(), y+(int)headerHeight};
+ ui2->drawHeaderInRect(d->webView, &headerRect, (OLE_HANDLE)(LONG64)pctx);
+ }
+
+ if (footerHeight) {
+ y = max((int)headerHeight+pageRect.height(), m_pageHeight-(int)footerHeight);
+ RECT footerRect = {x, y, x+pageRect.width(), y+(int)footerHeight};
+ ui2->drawFooterInRect(d->webView, &footerRect, (OLE_HANDLE)(LONG64)pctx, ii+1, pageCount);
+ }
+ }
+
+ CGContextEndPage(pctx);
+ CGContextRestoreGState(pctx);
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::isFrameSet(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = FALSE;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *result = coreFrame->isFrameSet() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::string(
+ /* [retval][out] */ BSTR *result)
+{
+ *result = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ RefPtr<Range> allRange(rangeOfContents(coreFrame->document()));
+ String allString = plainText(allRange.get());
+ *result = BString(allString).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::size(
+ /* [retval][out] */ SIZE *size)
+{
+ if (!size)
+ return E_POINTER;
+ size->cx = size->cy = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+ size->cx = view->width();
+ size->cy = view->height();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::hasScrollBars(
+ /* [retval][out] */ BOOL *result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = FALSE;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+
+ if (view->vScrollbarMode() == ScrollbarAlwaysOn || view->visibleHeight() < view->contentsHeight() ||
+ view->hScrollbarMode() == ScrollbarAlwaysOn || view->visibleWidth() < view->contentsWidth())
+ *result = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::contentBounds(
+ /* [retval][out] */ RECT *result)
+{
+ if (!result)
+ return E_POINTER;
+ ::SetRectEmpty(result);
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+
+ result->bottom = view->contentsHeight();
+ result->right = view->contentsWidth();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::frameBounds(
+ /* [retval][out] */ RECT *result)
+{
+ if (!result)
+ return E_POINTER;
+ ::SetRectEmpty(result);
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ FrameView* view = coreFrame->view();
+ if (!view)
+ return E_FAIL;
+
+ FloatRect bounds = view->visibleContentRectConsideringExternalScrollers();
+ result->bottom = (LONG) bounds.height();
+ result->right = (LONG) bounds.width();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFrame::isDescendantOfFrame(
+ /* [in] */ IWebFrame *ancestor,
+ /* [retval][out] */ BOOL *result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = FALSE;
+
+ Frame* coreFrame = core(this);
+ COMPtr<WebFrame> ancestorWebFrame(Query, ancestor);
+ if (!ancestorWebFrame)
+ return S_OK;
+
+ *result = (coreFrame && coreFrame->tree()->isDescendantOf(core(ancestorWebFrame.get()))) ? TRUE : FALSE;
+ return S_OK;
+}
+
+void WebFrame::unmarkAllMisspellings()
+{
+ Frame* coreFrame = core(this);
+ for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
+ Document *doc = frame->document();
+ if (!doc)
+ return;
+
+ doc->removeMarkers(DocumentMarker::Spelling);
+ }
+}
+
+void WebFrame::unmarkAllBadGrammar()
+{
+ Frame* coreFrame = core(this);
+ for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
+ Document *doc = frame->document();
+ if (!doc)
+ return;
+
+ doc->removeMarkers(DocumentMarker::Grammar);
+ }
+}
+
+WebView* WebFrame::webView() const
+{
+ return d->webView;
+}
diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h
new file mode 100644
index 0000000..917399e
--- /dev/null
+++ b/WebKit/win/WebFrame.h
@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebFrame_H
+#define WebFrame_H
+
+#include "WebFrameLoaderClient.h"
+
+#include "WebKit.h"
+#include "WebDataSource.h"
+
+#pragma warning(push, 0)
+#include <WebCore/FrameWin.h>
+#include <WebCore/KURL.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/ResourceHandleClient.h>
+#pragma warning(pop)
+
+#include <WTF/RefPtr.h>
+#include <WTF/HashMap.h>
+#include <WTF/OwnPtr.h>
+
+namespace WebCore {
+ class AuthenticationChallenge;
+ class DocumentLoader;
+ class Element;
+ class Frame;
+ class HTMLFrameOwnerElement;
+ class IntRect;
+ class Page;
+ class ResourceError;
+ class SharedBuffer;
+}
+
+typedef const struct OpaqueJSContext* JSContextRef;
+typedef struct OpaqueJSValue* JSObjectRef;
+
+class WebFrame;
+class WebFramePolicyListener;
+class WebHistory;
+class WebScriptDebugger;
+class WebView;
+
+interface IWebHistoryItemPrivate;
+
+WebFrame* kit(WebCore::Frame*);
+WebCore::Frame* core(WebFrame*);
+
+class DECLSPEC_UUID("{A3676398-4485-4a9d-87DC-CB5A40E6351D}") WebFrame : public IWebFrame, IWebFramePrivate, IWebDocumentText
+ , public WebFrameLoaderClient
+{
+public:
+ static WebFrame* createInstance();
+protected:
+ WebFrame();
+ ~WebFrame();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ //IWebFrame
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *frameName);
+
+ virtual HRESULT STDMETHODCALLTYPE webView(
+ /* [retval][out] */ IWebView **view);
+
+ virtual HRESULT STDMETHODCALLTYPE frameView(
+ /* [retval][out] */ IWebFrameView **view);
+
+ virtual HRESULT STDMETHODCALLTYPE DOMDocument(
+ /* [retval][out] */ IDOMDocument** document);
+
+ virtual HRESULT STDMETHODCALLTYPE frameElement(
+ /* [retval][out] */ IDOMHTMLElement **frameElement);
+
+ virtual HRESULT STDMETHODCALLTYPE loadRequest(
+ /* [in] */ IWebURLRequest *request);
+
+ virtual HRESULT STDMETHODCALLTYPE loadData(
+ /* [in] */ IStream *data,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ BSTR textEncodingName,
+ /* [in] */ BSTR url);
+
+ virtual HRESULT STDMETHODCALLTYPE loadHTMLString(
+ /* [in] */ BSTR string,
+ /* [in] */ BSTR baseURL);
+
+ virtual HRESULT STDMETHODCALLTYPE loadAlternateHTMLString(
+ /* [in] */ BSTR str,
+ /* [in] */ BSTR baseURL,
+ /* [in] */ BSTR unreachableURL);
+
+ virtual HRESULT STDMETHODCALLTYPE loadArchive(
+ /* [in] */ IWebArchive *archive);
+
+ virtual HRESULT STDMETHODCALLTYPE dataSource(
+ /* [retval][out] */ IWebDataSource **source);
+
+ virtual HRESULT STDMETHODCALLTYPE provisionalDataSource(
+ /* [retval][out] */ IWebDataSource **source);
+
+ virtual HRESULT STDMETHODCALLTYPE stopLoading( void);
+
+ virtual HRESULT STDMETHODCALLTYPE reload( void);
+
+ virtual HRESULT STDMETHODCALLTYPE findFrameNamed(
+ /* [in] */ BSTR name,
+ /* [retval][out] */ IWebFrame **frame);
+
+ virtual HRESULT STDMETHODCALLTYPE parentFrame(
+ /* [retval][out] */ IWebFrame **frame);
+
+ virtual HRESULT STDMETHODCALLTYPE childFrames(
+ /* [retval][out] */ IEnumVARIANT **enumFrames);
+
+ virtual HRESULT STDMETHODCALLTYPE currentForm(
+ /* [retval][out] */ IDOMElement **formElement);
+
+ virtual /* [local] */ JSGlobalContextRef STDMETHODCALLTYPE globalContext();
+
+ // IWebFramePrivate
+ virtual HRESULT STDMETHODCALLTYPE renderTreeAsExternalRepresentation(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollOffset(
+ /* [retval][out] */ SIZE* offset);
+
+ virtual HRESULT STDMETHODCALLTYPE layout();
+
+ virtual HRESULT STDMETHODCALLTYPE firstLayoutDone(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE loadType(
+ /* [retval][out] */ WebFrameLoadType* type);
+
+ virtual HRESULT STDMETHODCALLTYPE setInPrintingMode(
+ /* [in] */ BOOL value,
+ /* [in] */ HDC printDC);
+
+ virtual HRESULT STDMETHODCALLTYPE getPrintedPageCount(
+ /* [in] */ HDC printDC,
+ /* [retval][out] */ UINT *pageCount);
+
+ virtual HRESULT STDMETHODCALLTYPE spoolPages(
+ /* [in] */ HDC printDC,
+ /* [in] */ UINT startPage,
+ /* [in] */ UINT endPage,
+ /* [retval][out] */ void* ctx);
+
+ virtual HRESULT STDMETHODCALLTYPE isFrameSet(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE string(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE size(
+ /* [retval][out] */ SIZE *size);
+
+ virtual HRESULT STDMETHODCALLTYPE hasScrollBars(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE contentBounds(
+ /* [retval][out] */ RECT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE frameBounds(
+ /* [retval][out] */ RECT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE isDescendantOfFrame(
+ /* [in] */ IWebFrame *ancestor,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowsScrolling(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE allowsScrolling(
+ /* [retval][out] */ BOOL *flag);
+
+ // IWebDocumentText
+ virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE selectedString(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE selectAll();
+
+ virtual HRESULT STDMETHODCALLTYPE deselectAll();
+
+ // FrameLoaderClient
+ virtual void frameLoaderDestroyed();
+ virtual void makeRepresentation(WebCore::DocumentLoader*);
+ virtual void forceLayoutForNonHTML();
+ virtual void setCopiesOnScroll();
+ virtual void detachedFromParent2();
+ virtual void detachedFromParent3();
+ virtual void detachedFromParent4();
+ virtual void cancelPolicyCheck();
+ virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>);
+ virtual void revertToProvisionalState(WebCore::DocumentLoader*);
+ virtual void clearUnarchivingState(WebCore::DocumentLoader*);
+ virtual void setMainFrameDocumentReady(bool);
+ virtual void willChangeTitle(WebCore::DocumentLoader*);
+ virtual void didChangeTitle(WebCore::DocumentLoader*);
+ virtual void finalSetupForReplace(WebCore::DocumentLoader*);
+ virtual void setDefersLoading(bool);
+ virtual bool isArchiveLoadPending(WebCore::ResourceLoader*) const;
+ virtual void cancelPendingArchiveLoad(WebCore::ResourceLoader*);
+ virtual void clearArchivedResources();
+ virtual bool canHandleRequest(const WebCore::ResourceRequest&) const;
+ virtual bool canShowMIMEType(const WebCore::String& MIMEType) const;
+ virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const;
+ virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const;
+ virtual void frameLoadCompleted();
+ virtual void restoreViewState();
+ virtual void provisionalLoadStarted();
+ virtual bool shouldTreatURLAsSameAsCurrent(const WebCore::KURL&) const;
+ virtual void addHistoryItemForFragmentScroll();
+ virtual void didFinishLoad();
+ virtual void prepareForDataSourceReplacement();
+ virtual WebCore::String userAgent(const WebCore::KURL&);
+ virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
+ virtual void saveViewStateToItem(WebCore::HistoryItem *);
+ virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
+ virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
+ virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
+ virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&);
+ virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&);
+ virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&);
+ virtual bool shouldFallBack(const WebCore::ResourceError&);
+ virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WebCore::String& MIMEType, const WebCore::ResourceRequest&);
+ virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::String& frameName);
+ virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&);
+ virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&);
+ virtual bool willUseArchive(WebCore::ResourceLoader*, const WebCore::ResourceRequest&, const WebCore::KURL& originalURL) const;
+ virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+
+ virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length);
+ virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&);
+ virtual void dispatchDidFailLoad(const WebCore::ResourceError&);
+ virtual void startDownload(const WebCore::ResourceRequest&);
+
+ virtual WebCore::Widget* createJavaAppletWidget(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL& baseURL, const Vector<WebCore::String>& paramNames, const Vector<WebCore::String>& paramValues);
+
+ virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType);
+ virtual WebCore::String overrideMediaType() const;
+
+ virtual void windowObjectCleared();
+ virtual void didPerformFirstNavigation() const;
+
+ virtual void registerForIconNotification(bool listen);
+
+ // WebFrame
+ void initWithWebFrameView(IWebFrameView*, IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*);
+ WebCore::Frame* impl();
+ void invalidate();
+ void unmarkAllMisspellings();
+ void unmarkAllBadGrammar();
+
+ // WebFrame (matching WebCoreFrameBridge)
+ void setTextSizeMultiplier(float multiplier);
+ HRESULT inViewSourceMode(BOOL *flag);
+ HRESULT setInViewSourceMode(BOOL flag);
+ HRESULT elementWithName(BSTR name, IDOMElement* form, IDOMElement** element);
+ HRESULT formForElement(IDOMElement* element, IDOMElement** form);
+ HRESULT elementDoesAutoComplete(IDOMElement* element, bool* result);
+ HRESULT controlsInForm(IDOMElement* form, IDOMElement** controls, int* cControls);
+ HRESULT elementIsPassword(IDOMElement* element, bool* result);
+ HRESULT searchForLabelsBeforeElement(const BSTR* labels, int cLabels, IDOMElement* beforeElement, BSTR* result);
+ HRESULT matchLabelsAgainstElement(const BSTR* labels, int cLabels, IDOMElement* againstElement, BSTR* result);
+ HRESULT canProvideDocumentSource(bool* result);
+
+ COMPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction function);
+ void receivedPolicyDecision(WebCore::PolicyAction);
+
+ WebCore::KURL url() const;
+
+ virtual void attachScriptDebugger();
+ virtual void detachScriptDebugger();
+
+ WebView* webView() const;
+
+protected:
+ void loadHTMLString(BSTR string, BSTR baseURL, BSTR unreachableURL);
+ void loadData(PassRefPtr<WebCore::SharedBuffer>, BSTR mimeType, BSTR textEncodingName, BSTR baseURL, BSTR failingURL);
+ const Vector<WebCore::IntRect>& computePageRects(HDC printDC);
+ void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize);
+ void headerAndFooterHeights(float*, float*);
+ WebCore::IntRect printerMarginRect(HDC);
+
+protected:
+ ULONG m_refCount;
+ class WebFramePrivate;
+ WebFramePrivate* d;
+ bool m_quickRedirectComing;
+ WebCore::KURL m_originalRequestURL;
+ bool m_inPrintingMode;
+ Vector<WebCore::IntRect> m_pageRects;
+ int m_pageHeight; // height of the page adjusted by margins
+
+private:
+ OwnPtr<WebScriptDebugger> m_scriptDebugger;
+};
+
+#endif
diff --git a/WebKit/win/WebFramePolicyListener.cpp b/WebKit/win/WebFramePolicyListener.cpp
new file mode 100644
index 0000000..40cb1f9
--- /dev/null
+++ b/WebKit/win/WebFramePolicyListener.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebFramePolicyListener.h"
+
+#include "WebFrame.h"
+
+#pragma warning(push, 0)
+#include <WebCore/Frame.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameLoaderClient.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebFramePolicyListener ----------------------------------------------------------------
+
+WebFramePolicyListener::WebFramePolicyListener(PassRefPtr<Frame> frame)
+ : m_refCount(0)
+ , m_frame(frame)
+{
+ gClassCount++;
+}
+
+WebFramePolicyListener::~WebFramePolicyListener()
+{
+ gClassCount--;
+}
+
+WebFramePolicyListener* WebFramePolicyListener::createInstance(PassRefPtr<Frame> frame)
+{
+ WebFramePolicyListener* instance = new WebFramePolicyListener(frame);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFramePolicyListener::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebPolicyDecisionListener*>(this);
+ else if (IsEqualGUID(riid, IID_IWebPolicyDecisionListener))
+ *ppvObject = static_cast<IWebPolicyDecisionListener*>(this);
+ else if (IsEqualGUID(riid, IID_IWebFormSubmissionListener))
+ *ppvObject = static_cast<IWebFormSubmissionListener*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebFramePolicyListener::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebFramePolicyListener::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebPolicyDecisionListener ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFramePolicyListener::use(void)
+{
+ receivedPolicyDecision(PolicyUse);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFramePolicyListener::download(void)
+{
+ receivedPolicyDecision(PolicyDownload);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebFramePolicyListener::ignore(void)
+{
+ receivedPolicyDecision(PolicyIgnore);
+ return S_OK;
+}
+
+// IWebFormSubmissionListener ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebFramePolicyListener::continueSubmit(void)
+{
+ receivedPolicyDecision(PolicyUse);
+ return S_OK;
+}
+
+// WebFramePolicyListener ----------------------------------------------------------------
+void WebFramePolicyListener::receivedPolicyDecision(PolicyAction action)
+{
+ RefPtr<Frame> frame = m_frame.release();
+ if (frame)
+ static_cast<WebFrame*>(frame->loader()->client())->receivedPolicyDecision(action);
+}
+
+void WebFramePolicyListener::invalidate()
+{
+ m_frame = 0;
+}
+
diff --git a/WebKit/win/WebFramePolicyListener.h b/WebKit/win/WebFramePolicyListener.h
new file mode 100644
index 0000000..42f6d94
--- /dev/null
+++ b/WebKit/win/WebFramePolicyListener.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebFramePolicyListener_h
+#define WebFramePolicyListener_h
+
+#include "WebKit.h"
+
+#include <WTF/PassRefPtr.h>
+#include <WTF/RefPtr.h>
+
+#pragma warning(push, 0)
+#include <WebCore/FrameLoaderTypes.h>
+#pragma warning(pop)
+
+namespace WebCore {
+ class Frame;
+}
+
+class WebFramePolicyListener : public IWebPolicyDecisionListener, public IWebFormSubmissionListener {
+public:
+ static WebFramePolicyListener* createInstance(PassRefPtr<WebCore::Frame>);
+protected:
+ WebFramePolicyListener(PassRefPtr<WebCore::Frame>);
+ ~WebFramePolicyListener();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebPolicyDecisionListener
+ virtual HRESULT STDMETHODCALLTYPE use(void);
+ virtual HRESULT STDMETHODCALLTYPE download(void);
+ virtual HRESULT STDMETHODCALLTYPE ignore(void);
+
+ // IWebFormSubmissionListener
+ virtual HRESULT STDMETHODCALLTYPE continueSubmit(void);
+
+ // WebFramePolicyListener
+ void receivedPolicyDecision(WebCore::PolicyAction);
+ void invalidate();
+private:
+ ULONG m_refCount;
+ RefPtr<WebCore::Frame> m_frame;
+};
+
+#endif
diff --git a/WebKit/win/WebHTMLRepresentation.cpp b/WebKit/win/WebHTMLRepresentation.cpp
new file mode 100644
index 0000000..2d541ff
--- /dev/null
+++ b/WebKit/win/WebHTMLRepresentation.cpp
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebHTMLRepresentation.h"
+
+#include "WebKit.h"
+#include "WebFrame.h"
+#include "WebKitStatisticsPrivate.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/HTMLInputElement.h>
+#include <WebCore/TextResourceDecoder.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebHTMLRepresentation ------------------------------------------------------
+
+WebHTMLRepresentation::WebHTMLRepresentation()
+ : m_refCount(0)
+ , m_frame(0)
+{
+ WebHTMLRepresentationCount++;
+ gClassCount++;
+}
+
+WebHTMLRepresentation::~WebHTMLRepresentation()
+{
+ if (m_frame) {
+ m_frame->Release();
+ m_frame = 0;
+ }
+
+ WebHTMLRepresentationCount--;
+ gClassCount--;
+}
+
+WebHTMLRepresentation* WebHTMLRepresentation::createInstance(WebFrame* frame)
+{
+ WebHTMLRepresentation* instance = new WebHTMLRepresentation();
+ instance->m_frame = frame;
+ frame->AddRef();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebHTMLRepresentation*>(this);
+ else if (IsEqualGUID(riid, IID_IWebHTMLRepresentation))
+ *ppvObject = static_cast<IWebHTMLRepresentation*>(this);
+ else if (IsEqualGUID(riid, IID_IWebDocumentRepresentation))
+ *ppvObject = static_cast<IWebDocumentRepresentation*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebHTMLRepresentation::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebHTMLRepresentation::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebHTMLRepresentation --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedMIMETypes(
+ /* [out][in] */ BSTR* /*types*/,
+ /* [out][in] */ int* /*cTypes*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedNonImageMIMETypes(
+ /* [out][in] */ BSTR* /*types*/,
+ /* [out][in] */ int* /*cTypes*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedImageMIMETypes(
+ /* [out][in] */ BSTR* /*types*/,
+ /* [out][in] */ int* /*cTypes*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::attributedStringFromDOMNodes(
+ /* [in] */ IDOMNode* /*startNode*/,
+ /* [in] */ int /*startOffset*/,
+ /* [in] */ IDOMNode* /*endNode*/,
+ /* [in] */ int /*endOffset*/,
+ /* [retval][out] */ IDataObject** /*attributedString*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementWithName(
+ /* [in] */ BSTR name,
+ /* [in] */ IDOMElement* form,
+ /* [retval][out] */ IDOMElement** element)
+{
+ if (!m_frame)
+ return E_FAIL;
+
+ return m_frame->elementWithName(name, form, element);
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementDoesAutoComplete(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ BOOL* result)
+{
+ bool doesAutoComplete;
+ HRESULT hr = m_frame->elementDoesAutoComplete(element, &doesAutoComplete);
+ *result = doesAutoComplete ? TRUE : FALSE;
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementIsPassword(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ BOOL* result)
+{
+ bool isPassword;
+ HRESULT hr = m_frame->elementIsPassword(element, &isPassword);
+ *result = isPassword ? TRUE : FALSE;
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::formForElement(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ IDOMElement** form)
+{
+ if (!m_frame)
+ return E_FAIL;
+
+ return m_frame->formForElement(element, form);
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::currentForm(
+ /* [retval][out] */ IDOMElement** form)
+{
+ if (!m_frame)
+ return E_FAIL;
+
+ return m_frame->currentForm(form);
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::controlsInForm(
+ /* [in] */ IDOMElement* form,
+ /* [out][in] */ IDOMElement** controls,
+ /* [out][in] */ int* cControls)
+{
+ return m_frame->controlsInForm(form, controls, cControls);
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::searchForLabels(
+ /* [size_is][in] */ BSTR* labels,
+ /* [in] */ int cLabels,
+ /* [in] */ IDOMElement* beforeElement,
+ /* [retval][out] */ BSTR* result)
+{
+ return m_frame->searchForLabelsBeforeElement(labels, cLabels, beforeElement, result);
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::matchLabels(
+ /* [size_is][in] */ BSTR* labels,
+ /* [in] */ int cLabels,
+ /* [in] */ IDOMElement* againstElement,
+ /* [retval][out] */ BSTR* result)
+{
+ return m_frame->matchLabelsAgainstElement(labels, cLabels, againstElement, result);
+}
+
+// IWebDocumentRepresentation ----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::setDataSource(
+ /* [in] */ IWebDataSource* /*dataSource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedData(
+ /* [in] */ IStream* /*data*/,
+ /* [in] */ IWebDataSource* /*dataSource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedError(
+ /* [in] */ IWebError* /*error*/,
+ /* [in] */ IWebDataSource* /*dataSource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::finishedLoadingWithDataSource(
+ /* [in] */ IWebDataSource* /*dataSource*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::canProvideDocumentSource(
+ /* [retval][out] */ BOOL* result)
+{
+ bool canProvideSource;
+ HRESULT hr = this->m_frame->canProvideDocumentSource(&canProvideSource);
+ *result = canProvideSource ? TRUE : FALSE;
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::documentSource(
+ /* [retval][out] */ BSTR* source)
+{
+ if (!source)
+ return E_FAIL;
+
+ *source = 0;
+
+ HRESULT hr = S_OK;
+
+ COMPtr<IWebDataSource> dataSource;
+ hr = m_frame->dataSource(&dataSource);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<IStream> data;
+ hr = dataSource->data(&data);
+ if (FAILED(hr))
+ return hr;
+
+ STATSTG stat;
+ hr = data->Stat(&stat, STATFLAG_NONAME);
+ if (FAILED(hr))
+ return hr;
+
+ if (stat.cbSize.HighPart || !stat.cbSize.LowPart)
+ return E_FAIL;
+
+ Vector<char> dataBuffer(stat.cbSize.LowPart);
+ ULONG read;
+
+ hr = data->Read(dataBuffer.data(), static_cast<ULONG>(dataBuffer.size()), &read);
+ if (FAILED(hr))
+ return hr;
+
+ WebCore::Frame* frame = core(m_frame);
+ if (!frame)
+ return E_FAIL;
+
+ WebCore::Document* doc = frame->document();
+ if (!doc)
+ return E_FAIL;
+
+ WebCore::TextResourceDecoder* decoder = doc->decoder();
+ if (!decoder)
+ return E_FAIL;
+
+ *source = WebCore::BString(decoder->encoding().decode(dataBuffer.data(), dataBuffer.size())).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::title(
+ /* [retval][out] */ BSTR* /*docTitle*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
diff --git a/WebKit/win/WebHTMLRepresentation.h b/WebKit/win/WebHTMLRepresentation.h
new file mode 100644
index 0000000..01b8988
--- /dev/null
+++ b/WebKit/win/WebHTMLRepresentation.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebHTMLRepresentation_H
+#define WebHTMLRepresentation_H
+
+#include "WebKit.h"
+
+class WebFrame;
+
+class WebHTMLRepresentation : public IWebHTMLRepresentation, IWebDocumentRepresentation
+{
+public:
+ static WebHTMLRepresentation* createInstance(WebFrame* frame);
+protected:
+ WebHTMLRepresentation();
+ ~WebHTMLRepresentation();
+public:
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebHTMLRepresentation
+ virtual HRESULT STDMETHODCALLTYPE supportedMIMETypes(
+ /* [out][in] */ BSTR* types,
+ /* [out][in] */ int* cTypes);
+
+ virtual HRESULT STDMETHODCALLTYPE supportedNonImageMIMETypes(
+ /* [out][in] */ BSTR* types,
+ /* [out][in] */ int* cTypes);
+
+ virtual HRESULT STDMETHODCALLTYPE supportedImageMIMETypes(
+ /* [out][in] */ BSTR* types,
+ /* [out][in] */ int* cTypes);
+
+ virtual HRESULT STDMETHODCALLTYPE attributedStringFromDOMNodes(
+ /* [in] */ IDOMNode* startNode,
+ /* [in] */ int startOffset,
+ /* [in] */ IDOMNode* endNode,
+ /* [in] */ int endOffset,
+ /* [retval][out] */ IDataObject** attributedString);
+
+ virtual HRESULT STDMETHODCALLTYPE elementWithName(
+ /* [in] */ BSTR name,
+ /* [in] */ IDOMElement* form,
+ /* [retval][out] */ IDOMElement** element);
+
+ virtual HRESULT STDMETHODCALLTYPE elementDoesAutoComplete(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE elementIsPassword(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE formForElement(
+ /* [in] */ IDOMElement* element,
+ /* [retval][out] */ IDOMElement** form);
+
+ virtual HRESULT STDMETHODCALLTYPE currentForm(
+ /* [retval][out] */ IDOMElement** form);
+
+ virtual HRESULT STDMETHODCALLTYPE controlsInForm(
+ /* [in] */ IDOMElement* form,
+ /* [out][in] */ IDOMElement** controls,
+ /* [out][in] */ int* cControls);
+
+ virtual HRESULT STDMETHODCALLTYPE searchForLabels(
+ /* [size_is][in] */ BSTR *labels,
+ /* [in] */ int cLabels,
+ /* [in] */ IDOMElement *beforeElement,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE matchLabels(
+ /* [size_is][in] */ BSTR *labels,
+ /* [in] */ int cLabels,
+ /* [in] */ IDOMElement *againstElement,
+ /* [retval][out] */ BSTR *result);
+
+ // IWebDocumentRepresentation
+ virtual HRESULT STDMETHODCALLTYPE setDataSource(
+ /* [in] */ IWebDataSource* dataSource);
+
+ virtual HRESULT STDMETHODCALLTYPE receivedData(
+ /* [in] */ IStream* data,
+ /* [in] */ IWebDataSource* dataSource);
+
+ virtual HRESULT STDMETHODCALLTYPE receivedError(
+ /* [in] */ IWebError* error,
+ /* [in] */ IWebDataSource* dataSource);
+
+ virtual HRESULT STDMETHODCALLTYPE finishedLoadingWithDataSource(
+ /* [in] */ IWebDataSource* dataSource);
+
+ virtual HRESULT STDMETHODCALLTYPE canProvideDocumentSource(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE documentSource(
+ /* [retval][out] */ BSTR* source);
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR* docTitle);
+
+protected:
+ ULONG m_refCount;
+ WebFrame* m_frame;
+};
+
+#endif
diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp
new file mode 100644
index 0000000..16b4e48
--- /dev/null
+++ b/WebKit/win/WebHistory.cpp
@@ -0,0 +1,956 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebHistory.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "WebKit.h"
+#include "MarshallingHelpers.h"
+#include "WebHistoryItem.h"
+#include "WebKit.h"
+#include "WebNotificationCenter.h"
+#include "WebPreferences.h"
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/WebCoreHistory.h>
+#pragma warning( push, 0 )
+#include <wtf/Vector.h>
+#pragma warning( pop )
+
+CFStringRef DatesArrayKey = CFSTR("WebHistoryDates");
+CFStringRef FileVersionKey = CFSTR("WebHistoryFileVersion");
+
+const IID IID_IWebHistoryPrivate = { 0x3de04e59, 0x93f9, 0x4369, { 0x8b, 0x43, 0x97, 0x64, 0x58, 0xd7, 0xe3, 0x19 } };
+
+#define currentFileVersion 1
+
+class _WebCoreHistoryProvider : public WebCore::WebCoreHistoryProvider {
+public:
+ _WebCoreHistoryProvider(IWebHistory* history);
+ ~_WebCoreHistoryProvider();
+
+ virtual bool containsURL(const UChar* unicode, unsigned length);
+
+private:
+ IWebHistory* m_history;
+ IWebHistoryPrivate* m_historyPrivate;
+};
+
+static bool areEqualOrClose(double d1, double d2)
+{
+ double diff = d1-d2;
+ return (diff < .000001 && diff > -.000001);
+}
+
+static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
+{
+ RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
+ CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFStringRef> key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr));
+ CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem);
+
+ CFDictionaryPropertyBag* result = CFDictionaryPropertyBag::createInstance();
+ result->setDictionary(dictionary.get());
+ return result;
+}
+
+static CFDictionaryPropertyBag* createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
+{
+ // reference counting of item added to the array is managed by the CFArray value callbacks
+ RetainPtr<CFArrayRef> itemList(AdoptCF, CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks));
+ CFDictionaryPropertyBag* info = createUserInfoFromArray(notificationStr, itemList.get());
+ return info;
+}
+
+static void releaseUserInfo(CFDictionaryPropertyBag* userInfo)
+{
+ // free the dictionary
+ userInfo->setDictionary(0);
+ int result = userInfo->Release();
+ (void)result;
+ ASSERT(result == 0); // make sure no one else holds a reference to the userInfo.
+}
+
+// WebHistory -----------------------------------------------------------------
+
+IWebHistory* WebHistory::m_optionalSharedHistory = 0;
+
+WebHistory::WebHistory()
+: m_refCount(0)
+, m_preferences(0)
+{
+ gClassCount++;
+
+ m_entriesByURL.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &MarshallingHelpers::kIUnknownDictionaryValueCallBacks));
+ m_datesWithEntries.adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+ m_entriesByDate.adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+
+ m_preferences = WebPreferences::sharedStandardPreferences();
+}
+
+WebHistory::~WebHistory()
+{
+ gClassCount--;
+}
+
+WebHistory* WebHistory::createInstance()
+{
+ WebHistory* instance = new WebHistory();
+ instance->AddRef();
+ return instance;
+}
+
+HRESULT WebHistory::postNotification(NotificationType notifyType, IPropertyBag* userInfo /*=0*/)
+{
+ IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
+ HRESULT hr = nc->postNotificationName(getNotificationString(notifyType), static_cast<IWebHistory*>(this), userInfo);
+ if (FAILED(hr))
+ return hr;
+
+ return S_OK;
+}
+
+BSTR WebHistory::getNotificationString(NotificationType notifyType)
+{
+ static BSTR keys[6] = {0};
+ if (!keys[0]) {
+ keys[0] = SysAllocString(WebHistoryItemsAddedNotification);
+ keys[1] = SysAllocString(WebHistoryItemsRemovedNotification);
+ keys[2] = SysAllocString(WebHistoryAllItemsRemovedNotification);
+ keys[3] = SysAllocString(WebHistoryLoadedNotification);
+ keys[4] = SysAllocString(WebHistoryItemsDiscardedWhileLoadingNotification);
+ keys[5] = SysAllocString(WebHistorySavedNotification);
+ }
+ return keys[notifyType];
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHistory::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, CLSID_WebHistory))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebHistory*>(this);
+ else if (IsEqualGUID(riid, IID_IWebHistory))
+ *ppvObject = static_cast<IWebHistory*>(this);
+ else if (IsEqualGUID(riid, IID_IWebHistoryPrivate))
+ *ppvObject = static_cast<IWebHistoryPrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebHistory::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebHistory::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebHistory ----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHistory::optionalSharedHistory(
+ /* [retval][out] */ IWebHistory** history)
+{
+ *history = m_optionalSharedHistory;
+ if (m_optionalSharedHistory)
+ m_optionalSharedHistory->AddRef();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::setOptionalSharedHistory(
+ /* [in] */ IWebHistory* history)
+{
+ if (m_optionalSharedHistory) {
+ m_optionalSharedHistory->Release();
+ m_optionalSharedHistory = 0;
+ }
+
+ _WebCoreHistoryProvider* coreHistory = 0;
+ m_optionalSharedHistory = history;
+ if (history) {
+ history->AddRef();
+ coreHistory = new _WebCoreHistoryProvider(history);
+ }
+ WebCore::WebCoreHistory::setHistoryProvider(coreHistory);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::loadFromURL(
+ /* [in] */ BSTR url,
+ /* [out] */ IWebError** error,
+ /* [retval][out] */ BOOL* succeeded)
+{
+ HRESULT hr = S_OK;
+ RetainPtr<CFMutableArrayRef> discardedItems(AdoptCF,
+ CFArrayCreateMutable(0, 0, &MarshallingHelpers::kIUnknownArrayCallBacks));
+
+ RetainPtr<CFURLRef> urlRef(AdoptCF, MarshallingHelpers::BSTRToCFURLRef(url));
+
+ hr = loadHistoryGutsFromURL(urlRef.get(), discardedItems.get(), error);
+ if (FAILED(hr))
+ goto exit;
+
+ hr = postNotification(kWebHistoryLoadedNotification);
+ if (FAILED(hr))
+ goto exit;
+
+ if (CFArrayGetCount(discardedItems.get()) > 0) {
+ CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
+ hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo);
+ releaseUserInfo(userInfo);
+ if (FAILED(hr))
+ goto exit;
+ }
+
+exit:
+ if (succeeded)
+ *succeeded = SUCCEEDED(hr);
+ return hr;
+}
+
+static CFDictionaryRef createHistoryListFromStream(CFReadStreamRef stream, CFPropertyListFormat format)
+{
+ return (CFDictionaryRef)CFPropertyListCreateFromStream(0, stream, 0, kCFPropertyListImmutable, &format, 0);
+}
+
+HRESULT WebHistory::loadHistoryGutsFromURL(CFURLRef url, CFMutableArrayRef discardedItems, IWebError** /*error*/) //FIXME
+{
+ CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0 | kCFPropertyListXMLFormat_v1_0;
+ HRESULT hr = S_OK;
+ int numberOfItemsLoaded = 0;
+
+ RetainPtr<CFReadStreamRef> stream(AdoptCF, CFReadStreamCreateWithFile(0, url));
+ if (!stream)
+ return E_FAIL;
+
+ if (!CFReadStreamOpen(stream.get()))
+ return E_FAIL;
+
+ RetainPtr<CFDictionaryRef> historyList(AdoptCF, createHistoryListFromStream(stream.get(), format));
+ CFReadStreamClose(stream.get());
+
+ if (!historyList)
+ return E_FAIL;
+
+ CFNumberRef fileVersionObject = (CFNumberRef)CFDictionaryGetValue(historyList.get(), FileVersionKey);
+ int fileVersion;
+ if (!CFNumberGetValue(fileVersionObject, kCFNumberIntType, &fileVersion))
+ return E_FAIL;
+
+ if (fileVersion > currentFileVersion)
+ return E_FAIL;
+
+ CFArrayRef datesArray = (CFArrayRef)CFDictionaryGetValue(historyList.get(), DatesArrayKey);
+
+ int itemCountLimit;
+ hr = historyItemLimit(&itemCountLimit);
+ if (FAILED(hr))
+ return hr;
+
+ CFAbsoluteTime limitDate;
+ hr = ageLimitDate(&limitDate);
+ if (FAILED(hr))
+ return hr;
+
+ bool ageLimitPassed = false;
+ bool itemLimitPassed = false;
+
+ CFIndex itemCount = CFArrayGetCount(datesArray);
+ for (CFIndex i = 0; i < itemCount; ++i) {
+ CFDictionaryRef itemAsDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(datesArray, i);
+ COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance());
+ hr = item->initFromDictionaryRepresentation((void*)itemAsDictionary);
+ if (FAILED(hr))
+ return hr;
+
+ // item without URL is useless; data on disk must have been bad; ignore
+ BOOL hasURL;
+ hr = item->hasURLString(&hasURL);
+ if (FAILED(hr))
+ return hr;
+
+ if (hasURL) {
+ // Test against date limit. Since the items are ordered newest to oldest, we can stop comparing
+ // once we've found the first item that's too old.
+ if (!ageLimitPassed) {
+ DATE lastVisitedTime;
+ hr = item->lastVisitedTimeInterval(&lastVisitedTime);
+ if (FAILED(hr))
+ return hr;
+ if (timeToDate(MarshallingHelpers::DATEToCFAbsoluteTime(lastVisitedTime)) <= limitDate)
+ ageLimitPassed = true;
+ }
+ if (ageLimitPassed || itemLimitPassed)
+ CFArrayAppendValue(discardedItems, item.get());
+ else {
+ addItem(item.get()); // ref is added inside addItem
+ ++numberOfItemsLoaded;
+ if (numberOfItemsLoaded == itemCountLimit)
+ itemLimitPassed = true;
+ }
+ }
+ }
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::saveToURL(
+ /* [in] */ BSTR url,
+ /* [out] */ IWebError** error,
+ /* [retval][out] */ BOOL* succeeded)
+{
+ HRESULT hr = S_OK;
+ RetainPtr<CFURLRef> urlRef(AdoptCF, MarshallingHelpers::BSTRToCFURLRef(url));
+
+ hr = saveHistoryGuts(urlRef.get(), error);
+
+ if (succeeded)
+ *succeeded = SUCCEEDED(hr);
+ if (SUCCEEDED(hr))
+ hr = postNotification(kWebHistorySavedNotification);
+
+ return hr;
+}
+
+HRESULT WebHistory::saveHistoryGuts(CFURLRef url, IWebError** error)
+{
+ HRESULT hr = S_OK;
+
+ // FIXME: Correctly report error when new API is ready.
+ if (error)
+ *error = 0;
+
+ RetainPtr<CFWriteStreamRef> stream(AdoptCF, CFWriteStreamCreateWithFile(kCFAllocatorDefault, url));
+ if (!stream)
+ return E_FAIL;
+
+ CFMutableArrayRef rawEntries;
+ hr = datesArray(&rawEntries);
+ if (FAILED(hr))
+ return hr;
+ RetainPtr<CFMutableArrayRef> entries(AdoptCF, rawEntries);
+
+ // create the outer dictionary
+ CFTypeRef keys[2];
+ CFTypeRef values[2];
+ keys[0] = DatesArrayKey;
+ values[0] = entries.get();
+ keys[1] = FileVersionKey;
+
+ int version = currentFileVersion;
+ RetainPtr<CFNumberRef> versionCF(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &version));
+ values[1] = versionCF.get();
+
+ RetainPtr<CFDictionaryRef> dictionary(AdoptCF,
+ CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ if (!CFWriteStreamOpen(stream.get()))
+ return E_FAIL;
+
+ if (!CFPropertyListWriteToStream(dictionary.get(), stream.get(), kCFPropertyListXMLFormat_v1_0, 0))
+ hr = E_FAIL;
+
+ CFWriteStreamClose(stream.get());
+
+ return hr;
+}
+
+HRESULT WebHistory::datesArray(CFMutableArrayRef* datesArray)
+{
+ HRESULT hr = S_OK;
+
+ RetainPtr<CFMutableArrayRef> result(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+
+ // for each date with entries
+ int dateCount = CFArrayGetCount(m_entriesByDate.get());
+ for (int i = 0; i < dateCount; ++i) {
+ // get the entries for that date
+ CFArrayRef entries = (CFArrayRef)CFArrayGetValueAtIndex(m_entriesByDate.get(), i);
+ int entriesCount = CFArrayGetCount(entries);
+ for (int j = entriesCount - 1; j >= 0; --j) {
+ IWebHistoryItem* item = (IWebHistoryItem*) CFArrayGetValueAtIndex(entries, j);
+ IWebHistoryItemPrivate* webHistoryItem;
+ hr = item->QueryInterface(IID_IWebHistoryItemPrivate, (void**)&webHistoryItem);
+ if (FAILED(hr))
+ return E_FAIL;
+
+ CFDictionaryRef itemDict;
+ hr = webHistoryItem->dictionaryRepresentation((void**)&itemDict);
+ webHistoryItem->Release();
+ if (FAILED(hr))
+ return E_FAIL;
+
+ CFArrayAppendValue(result.get(), itemDict);
+ CFRelease(itemDict);
+ }
+ }
+
+ if (SUCCEEDED(hr))
+ *datesArray = result.releaseRef();
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::addItems(
+ /* [in] */ int itemCount,
+ /* [in] */ IWebHistoryItem** items)
+{
+ // There is no guarantee that the incoming entries are in any particular
+ // order, but if this is called with a set of entries that were created by
+ // iterating through the results of orderedLastVisitedDays and orderedItemsLastVisitedOnDay
+ // then they will be ordered chronologically from newest to oldest. We can make adding them
+ // faster (fewer compares) by inserting them from oldest to newest.
+
+ HRESULT hr;
+ for (int i = itemCount - 1; i >= 0; --i) {
+ hr = addItem(items[i]);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::removeItems(
+ /* [in] */ int itemCount,
+ /* [in] */ IWebHistoryItem** items)
+{
+ HRESULT hr;
+ for (int i = 0; i < itemCount; ++i) {
+ hr = removeItem(items[i]);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void)
+{
+ CFArrayRemoveAllValues(m_entriesByDate.get());
+ CFArrayRemoveAllValues(m_datesWithEntries.get());
+ CFDictionaryRemoveAllValues(m_entriesByURL.get());
+
+ return postNotification(kWebHistoryAllItemsRemovedNotification);
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays(
+ /* [out][in] */ int* count,
+ /* [in] */ DATE* calendarDates)
+{
+ int dateCount = CFArrayGetCount(m_datesWithEntries.get());
+ if (!calendarDates) {
+ *count = dateCount;
+ return S_OK;
+ }
+
+ if (*count < dateCount) {
+ *count = dateCount;
+ return E_FAIL;
+ }
+
+ *count = dateCount;
+ for (int i = 0; i < dateCount; i++) {
+ CFNumberRef absoluteTimeNumberRef = (CFNumberRef)CFArrayGetValueAtIndex(m_datesWithEntries.get(), i);
+ CFAbsoluteTime absoluteTime;
+ if (!CFNumberGetValue(absoluteTimeNumberRef, kCFNumberDoubleType, &absoluteTime))
+ return E_FAIL;
+ calendarDates[i] = MarshallingHelpers::CFAbsoluteTimeToDATE(absoluteTime);
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::orderedItemsLastVisitedOnDay(
+ /* [out][in] */ int* count,
+ /* [in] */ IWebHistoryItem** items,
+ /* [in] */ DATE calendarDate)
+{
+ int index;
+ if (!findIndex(&index, MarshallingHelpers::DATEToCFAbsoluteTime(calendarDate))) {
+ *count = 0;
+ return 0;
+ }
+
+ CFArrayRef entries = (CFArrayRef)CFArrayGetValueAtIndex(m_entriesByDate.get(), index);
+ if (!entries) {
+ *count = 0;
+ return 0;
+ }
+
+ int newCount = CFArrayGetCount(entries);
+
+ if (!items) {
+ *count = newCount;
+ return S_OK;
+ }
+
+ if (*count < newCount) {
+ *count = newCount;
+ return E_FAIL;
+ }
+
+ *count = newCount;
+ for (int i = 0; i < newCount; i++) {
+ IWebHistoryItem* item = (IWebHistoryItem*)CFArrayGetValueAtIndex(entries, i);
+ if (!item)
+ return E_FAIL;
+ item->AddRef();
+ items[newCount-i-1] = item; // reverse when inserting to get the list sorted oldest to newest
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::setHistoryItemLimit(
+ /* [in] */ int limit)
+{
+ if (!m_preferences)
+ return E_FAIL;
+ return m_preferences->setHistoryItemLimit(limit);
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::historyItemLimit(
+ /* [retval][out] */ int* limit)
+{
+ if (!m_preferences)
+ return E_FAIL;
+ return m_preferences->historyItemLimit(limit);
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::setHistoryAgeInDaysLimit(
+ /* [in] */ int limit)
+{
+ if (!m_preferences)
+ return E_FAIL;
+ return m_preferences->setHistoryAgeInDaysLimit(limit);
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::historyAgeInDaysLimit(
+ /* [retval][out] */ int* limit)
+{
+ if (!m_preferences)
+ return E_FAIL;
+ return m_preferences->historyAgeInDaysLimit(limit);
+}
+
+HRESULT WebHistory::removeItem(IWebHistoryItem* entry)
+{
+ HRESULT hr = S_OK;
+ BSTR urlBStr = 0;
+
+ hr = entry->URLString(&urlBStr);
+ if (FAILED(hr))
+ return hr;
+
+ RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
+ SysFreeString(urlBStr);
+
+ // If this exact object isn't stored, then make no change.
+ // FIXME: Is this the right behavior if this entry isn't present, but another entry for the same URL is?
+ // Maybe need to change the API to make something like removeEntryForURLString public instead.
+ IWebHistoryItem *matchingEntry = (IWebHistoryItem*)CFDictionaryGetValue(m_entriesByURL.get(), urlString.get());
+ if (matchingEntry != entry)
+ return E_FAIL;
+
+ hr = removeItemForURLString(urlString.get());
+ if (FAILED(hr))
+ return hr;
+
+ CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+ getNotificationString(kWebHistoryItemsRemovedNotification), entry);
+ hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo);
+ releaseUserInfo(userInfo);
+
+ return hr;
+}
+
+HRESULT WebHistory::addItem(IWebHistoryItem* entry)
+{
+ HRESULT hr = S_OK;
+
+ if (!entry)
+ return E_FAIL;
+
+ BSTR urlBStr = 0;
+ hr = entry->URLString(&urlBStr);
+ if (FAILED(hr))
+ return hr;
+
+ RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
+ SysFreeString(urlBStr);
+
+ COMPtr<IWebHistoryItem> oldEntry((IWebHistoryItem*) CFDictionaryGetValue(
+ m_entriesByURL.get(), urlString.get()));
+
+ if (oldEntry) {
+ removeItemForURLString(urlString.get());
+
+ // If we already have an item with this URL, we need to merge info that drives the
+ // URL autocomplete heuristics from that item into the new one.
+ IWebHistoryItemPrivate* entryPriv;
+ hr = entry->QueryInterface(IID_IWebHistoryItemPrivate, (void**)&entryPriv);
+ if (SUCCEEDED(hr)) {
+ entryPriv->mergeAutoCompleteHints(oldEntry.get());
+ entryPriv->Release();
+ }
+ }
+
+ hr = addItemToDateCaches(entry);
+ if (FAILED(hr))
+ return hr;
+
+ CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry);
+
+ CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+ getNotificationString(kWebHistoryItemsAddedNotification), entry);
+ hr = postNotification(kWebHistoryItemsAddedNotification, userInfo);
+ releaseUserInfo(userInfo);
+
+ return hr;
+}
+
+HRESULT WebHistory::addItemForURL(BSTR url, BSTR title)
+{
+ COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance());
+ if (!item)
+ return E_FAIL;
+
+ SYSTEMTIME currentTime;
+ GetSystemTime(&currentTime);
+ DATE lastVisited;
+ if (!SystemTimeToVariantTime(&currentTime, &lastVisited))
+ return E_FAIL;
+
+ HRESULT hr = item->initWithURLString(url, title, 0);
+ if (FAILED(hr))
+ return hr;
+
+ hr = item->setLastVisitedTimeInterval(lastVisited); // also increments visitedCount
+ if (FAILED(hr))
+ return hr;
+
+ return addItem(item.get());
+}
+
+HRESULT WebHistory::itemForURLString(
+ /* [in] */ CFStringRef urlString,
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ if (!item)
+ return E_FAIL;
+ *item = 0;
+
+ IWebHistoryItem* foundItem = (IWebHistoryItem*) CFDictionaryGetValue(m_entriesByURL.get(), urlString);
+ if (!foundItem)
+ return E_FAIL;
+
+ foundItem->AddRef();
+ *item = foundItem;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistory::itemForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ IWebHistoryItem** item)
+{
+ RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(url));
+ return itemForURLString(urlString.get(), item);
+}
+
+HRESULT WebHistory::containsItemForURLString(
+ /* [in] */ void* urlCFString,
+ /* [retval][out] */ BOOL* contains)
+{
+ IWebHistoryItem* item = 0;
+ HRESULT hr;
+ if (SUCCEEDED(hr = itemForURLString((CFStringRef)urlCFString, &item))) {
+ *contains = TRUE;
+ // itemForURLString refs the returned item, so we need to balance that
+ item->Release();
+ } else
+ *contains = FALSE;
+
+ return hr;
+}
+
+HRESULT WebHistory::removeItemForURLString(CFStringRef urlString)
+{
+ IWebHistoryItem* entry = (IWebHistoryItem*) CFDictionaryGetValue(m_entriesByURL.get(), urlString);
+ if (!entry)
+ return E_FAIL;
+
+ HRESULT hr = removeItemFromDateCaches(entry);
+ CFDictionaryRemoveValue(m_entriesByURL.get(), urlString);
+
+ return hr;
+}
+
+HRESULT WebHistory::addItemToDateCaches(IWebHistoryItem* entry)
+{
+ HRESULT hr = S_OK;
+
+ DATE lastVisitedCOMTime;
+ entry->lastVisitedTimeInterval(&lastVisitedCOMTime);
+ CFAbsoluteTime lastVisitedDate = timeToDate(MarshallingHelpers::DATEToCFAbsoluteTime(lastVisitedCOMTime));
+
+ int dateIndex;
+ if (findIndex(&dateIndex, lastVisitedDate)) {
+ // other entries already exist for this date
+ hr = insertItem(entry, dateIndex);
+ } else {
+ // no other entries exist for this date
+ RetainPtr<CFNumberRef> lastVisitedDateRef(AdoptCF, CFNumberCreate(0, kCFNumberDoubleType, &lastVisitedDate));
+ CFArrayInsertValueAtIndex(m_datesWithEntries.get(), dateIndex, lastVisitedDateRef.get());
+ RetainPtr<CFMutableArrayRef> entryArray(AdoptCF,
+ CFArrayCreateMutable(0, 0, &MarshallingHelpers::kIUnknownArrayCallBacks));
+ CFArrayAppendValue(entryArray.get(), entry);
+ CFArrayInsertValueAtIndex(m_entriesByDate.get(), dateIndex, entryArray.get());
+ }
+
+ return hr;
+}
+
+HRESULT WebHistory::removeItemFromDateCaches(IWebHistoryItem* entry)
+{
+ HRESULT hr = S_OK;
+
+ DATE lastVisitedCOMTime;
+ entry->lastVisitedTimeInterval(&lastVisitedCOMTime);
+ CFAbsoluteTime lastVisitedDate = timeToDate(MarshallingHelpers::DATEToCFAbsoluteTime(lastVisitedCOMTime));
+
+ int dateIndex;
+ if (!findIndex(&dateIndex, lastVisitedDate))
+ return E_FAIL;
+
+ CFMutableArrayRef entriesForDate = (CFMutableArrayRef) CFArrayGetValueAtIndex(m_entriesByDate.get(), dateIndex);
+ CFIndex count = CFArrayGetCount(entriesForDate);
+ for (int i = count - 1; i >= 0; --i) {
+ if ((IWebHistoryItem*)CFArrayGetValueAtIndex(entriesForDate, i) == entry)
+ CFArrayRemoveValueAtIndex(entriesForDate, i);
+ }
+
+ // remove this date entirely if there are no other entries on it
+ if (CFArrayGetCount(entriesForDate) == 0) {
+ CFArrayRemoveValueAtIndex(m_entriesByDate.get(), dateIndex);
+ CFArrayRemoveValueAtIndex(m_datesWithEntries.get(), dateIndex);
+ }
+
+ return hr;
+}
+
+// Returns whether the day is already in the list of days,
+// and fills in *index with the found or proposed index.
+bool WebHistory::findIndex(int* index, CFAbsoluteTime forDay)
+{
+ CFAbsoluteTime forDayInDays = timeToDate(forDay);
+
+ //FIXME: just does linear search through days; inefficient if many days
+ int count = CFArrayGetCount(m_datesWithEntries.get());
+ for (*index = 0; *index < count; ++*index) {
+ CFNumberRef entryTimeNumberRef = (CFNumberRef) CFArrayGetValueAtIndex(m_datesWithEntries.get(), *index);
+ CFAbsoluteTime entryTime;
+ CFNumberGetValue(entryTimeNumberRef, kCFNumberDoubleType, &entryTime);
+ CFAbsoluteTime entryInDays = timeToDate(entryTime);
+ if (areEqualOrClose(forDayInDays, entryInDays))
+ return true;
+ else if (forDayInDays > entryInDays)
+ return false;
+ }
+ return false;
+}
+
+HRESULT WebHistory::insertItem(IWebHistoryItem* entry, int dateIndex)
+{
+ HRESULT hr = S_OK;
+
+ if (!entry)
+ return E_FAIL;
+ if (dateIndex < 0 || dateIndex >= CFArrayGetCount(m_entriesByDate.get()))
+ return E_FAIL;
+
+ //FIXME: just does linear search through entries; inefficient if many entries for this date
+ DATE entryTime;
+ entry->lastVisitedTimeInterval(&entryTime);
+ CFMutableArrayRef entriesForDate = (CFMutableArrayRef) CFArrayGetValueAtIndex(m_entriesByDate.get(), dateIndex);
+ int count = CFArrayGetCount(entriesForDate);
+ // optimized for inserting oldest to youngest
+ int index;
+ for (index = 0; index < count; ++index) {
+ IWebHistoryItem* indEntry = (IWebHistoryItem*) CFArrayGetValueAtIndex(entriesForDate, index);
+ DATE indTime;
+ hr = indEntry->lastVisitedTimeInterval(&indTime);
+ if (FAILED(hr))
+ return hr;
+ if (entryTime < indTime)
+ break;
+ }
+ CFArrayInsertValueAtIndex(entriesForDate, index, entry);
+ return S_OK;
+}
+
+CFAbsoluteTime WebHistory::timeToDate(CFAbsoluteTime time)
+{
+ // can't just divide/round since the day boundaries depend on our current time zone
+ const double secondsPerDay = 60 * 60 * 24;
+ CFTimeZoneRef timeZone = CFTimeZoneCopySystem();
+ CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(time, timeZone);
+ date.hour = date.minute = 0;
+ date.second = 0.0;
+ CFAbsoluteTime timeInDays = CFGregorianDateGetAbsoluteTime(date, timeZone);
+ if (areEqualOrClose(time - timeInDays, secondsPerDay))
+ timeInDays += secondsPerDay;
+ return timeInDays;
+}
+
+// Return a date that marks the age limit for history entries saved to or
+// loaded from disk. Any entry older than this item should be rejected.
+HRESULT WebHistory::ageLimitDate(CFAbsoluteTime* time)
+{
+ // get the current date as a CFAbsoluteTime
+ CFAbsoluteTime currentDate = timeToDate(CFAbsoluteTimeGetCurrent());
+
+ CFGregorianUnits ageLimit = {0};
+ int historyLimitDays;
+ HRESULT hr = historyAgeInDaysLimit(&historyLimitDays);
+ if (FAILED(hr))
+ return hr;
+ ageLimit.days = -historyLimitDays;
+ *time = CFAbsoluteTimeAddGregorianUnits(currentDate, CFTimeZoneCopySystem(), ageLimit);
+ return S_OK;
+}
+
+IWebHistoryPrivate* WebHistory::optionalSharedHistoryInternal()
+{
+ if (!m_optionalSharedHistory)
+ return 0;
+
+ IWebHistoryPrivate* historyPrivate;
+ if (FAILED(m_optionalSharedHistory->QueryInterface(IID_IWebHistoryPrivate, (void**)&historyPrivate)))
+ return 0;
+
+ historyPrivate->Release(); // don't add an additional ref for this internal call
+ return historyPrivate;
+}
+
+// _WebCoreHistoryProvider ----------------------------------------------------------------
+
+_WebCoreHistoryProvider::_WebCoreHistoryProvider(IWebHistory* history)
+ : m_history(history)
+ , m_historyPrivate(0)
+{
+}
+
+_WebCoreHistoryProvider::~_WebCoreHistoryProvider()
+{
+}
+
+static inline bool matchLetter(char c, char lowercaseLetter)
+{
+ return (c | 0x20) == lowercaseLetter;
+}
+
+static inline bool matchUnicodeLetter(UniChar c, UniChar lowercaseLetter)
+{
+ return (c | 0x20) == lowercaseLetter;
+}
+
+bool _WebCoreHistoryProvider::containsURL(const UChar* unicode, unsigned length)
+{
+ const int bufferSize = 1024;
+ const UChar *unicodeStr = unicode;
+ UChar staticStrBuffer[bufferSize];
+ UChar *strBuffer = 0;
+ bool needToAddSlash = false;
+
+ if (length >= 6 &&
+ matchUnicodeLetter(unicode[0], 'h') &&
+ matchUnicodeLetter(unicode[1], 't') &&
+ matchUnicodeLetter(unicode[2], 't') &&
+ matchUnicodeLetter(unicode[3], 'p') &&
+ (unicode[4] == ':'
+ || (matchUnicodeLetter(unicode[4], 's') && unicode[5] == ':'))) {
+
+ unsigned pos = unicode[4] == ':' ? 5 : 6;
+
+ // skip possible initial two slashes
+ if (pos + 1 < length && unicode[pos] == '/' && unicode[pos + 1] == '/')
+ pos += 2;
+
+ while (pos < length && unicode[pos] != '/')
+ pos++;
+
+ if (pos == length)
+ needToAddSlash = true;
+ }
+
+ if (needToAddSlash) {
+ if (length + 1 <= bufferSize)
+ strBuffer = staticStrBuffer;
+ else
+ strBuffer = (UChar*)malloc(sizeof(UChar) * (length + 1));
+ memcpy(strBuffer, unicode, 2 * length);
+ strBuffer[length] = '/';
+ length++;
+
+ unicodeStr = strBuffer;
+ }
+
+ if (!m_historyPrivate) {
+ if (SUCCEEDED(m_history->QueryInterface(IID_IWebHistoryPrivate, (void**)&m_historyPrivate))) {
+ // don't hold a ref - we're owned by IWebHistory/IWebHistoryPrivate
+ m_historyPrivate->Release();
+ } else {
+ if (strBuffer != staticStrBuffer)
+ free(strBuffer);
+ m_historyPrivate = 0;
+ return false;
+ }
+ }
+
+ CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, (const UniChar*)unicodeStr, length, kCFAllocatorNull);
+ BOOL result = FALSE;
+ m_historyPrivate->containsItemForURLString((void*)str, &result);
+ CFRelease(str);
+
+ if (strBuffer != staticStrBuffer)
+ free(strBuffer);
+
+ return !!result;
+}
diff --git a/WebKit/win/WebHistory.h b/WebKit/win/WebHistory.h
new file mode 100644
index 0000000..36e3148
--- /dev/null
+++ b/WebKit/win/WebHistory.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebHistory_H
+#define WebHistory_H
+
+#include "WebKit.h"
+
+#include "COMPtr.h"
+#include <CoreFoundation/CoreFoundation.h>
+#include <wtf/RetainPtr.h>
+
+//-----------------------------------------------------------------------------
+
+// {3DE04E59-93F9-4369-8B43-976458D7E319}
+DEFINE_GUID(IID_IWebHistoryPrivate, 0x3de04e59, 0x93f9, 0x4369, 0x8b, 0x43, 0x97, 0x64, 0x58, 0xd7, 0xe3, 0x19);
+
+interface IWebHistoryPrivate : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE addItemForURL(
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR title) = 0;
+ virtual HRESULT STDMETHODCALLTYPE containsItemForURLString(
+ /* [in] */ void* urlCFString,
+ /* [retval][out] */ BOOL* contains) = 0;
+};
+
+//-----------------------------------------------------------------------------
+
+class WebPreferences;
+
+class WebHistory : public IWebHistory, IWebHistoryPrivate
+{
+public:
+ static WebHistory* createInstance();
+protected:
+ WebHistory();
+ ~WebHistory();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebHistory
+ virtual HRESULT STDMETHODCALLTYPE optionalSharedHistory(
+ /* [retval][out] */ IWebHistory** history);
+
+ virtual HRESULT STDMETHODCALLTYPE setOptionalSharedHistory(
+ /* [in] */ IWebHistory* history);
+
+ virtual HRESULT STDMETHODCALLTYPE loadFromURL(
+ /* [in] */ BSTR url,
+ /* [out] */ IWebError** error,
+ /* [retval][out] */ BOOL* succeeded);
+
+ virtual HRESULT STDMETHODCALLTYPE saveToURL(
+ /* [in] */ BSTR url,
+ /* [out] */ IWebError** error,
+ /* [retval][out] */ BOOL* succeeded);
+
+ virtual HRESULT STDMETHODCALLTYPE addItems(
+ /* [in] */ int itemCount,
+ /* [in] */ IWebHistoryItem** items);
+
+ virtual HRESULT STDMETHODCALLTYPE removeItems(
+ /* [in] */ int itemCount,
+ /* [in] */ IWebHistoryItem** items);
+
+ virtual HRESULT STDMETHODCALLTYPE removeAllItems( void);
+
+ virtual HRESULT STDMETHODCALLTYPE orderedLastVisitedDays(
+ /* [out][in] */ int* count,
+ /* [in] */ DATE* calendarDates);
+
+ virtual HRESULT STDMETHODCALLTYPE orderedItemsLastVisitedOnDay(
+ /* [out][in] */ int* count,
+ /* [in] */ IWebHistoryItem** items,
+ /* [in] */ DATE calendarDate);
+
+ virtual HRESULT STDMETHODCALLTYPE itemForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ IWebHistoryItem** item);
+
+ virtual HRESULT STDMETHODCALLTYPE setHistoryItemLimit(
+ /* [in] */ int limit);
+
+ virtual HRESULT STDMETHODCALLTYPE historyItemLimit(
+ /* [retval][out] */ int* limit);
+
+ virtual HRESULT STDMETHODCALLTYPE setHistoryAgeInDaysLimit(
+ /* [in] */ int limit);
+
+ virtual HRESULT STDMETHODCALLTYPE historyAgeInDaysLimit(
+ /* [retval][out] */ int* limit);
+
+ // WebHistory
+ static IWebHistoryPrivate* optionalSharedHistoryInternal();
+ virtual HRESULT STDMETHODCALLTYPE addItemForURL(BSTR url, BSTR title);
+ virtual HRESULT STDMETHODCALLTYPE containsItemForURLString(void* urlCFString, BOOL* contains);
+
+protected:
+ enum NotificationType
+ {
+ kWebHistoryItemsAddedNotification = 0,
+ kWebHistoryItemsRemovedNotification = 1,
+ kWebHistoryAllItemsRemovedNotification = 2,
+ kWebHistoryLoadedNotification = 3,
+ kWebHistoryItemsDiscardedWhileLoadingNotification = 4,
+ kWebHistorySavedNotification = 5
+ };
+
+ HRESULT loadHistoryGutsFromURL(CFURLRef url, CFMutableArrayRef discardedItems, IWebError** error);
+ HRESULT saveHistoryGuts(CFURLRef url, IWebError** error);
+ HRESULT postNotification(NotificationType notifyType, IPropertyBag* userInfo = 0);
+ HRESULT removeItem(IWebHistoryItem* entry);
+ HRESULT addItem(IWebHistoryItem* entry);
+ HRESULT removeItemForURLString(CFStringRef urlString);
+ HRESULT addItemToDateCaches(IWebHistoryItem* entry);
+ HRESULT removeItemFromDateCaches(IWebHistoryItem* entry);
+ HRESULT insertItem(IWebHistoryItem* entry, int dateIndex);
+ HRESULT ageLimitDate(CFAbsoluteTime* time);
+ HRESULT datesArray(CFMutableArrayRef* datesArray);
+ bool findIndex(int* index, CFAbsoluteTime forDay);
+ static CFAbsoluteTime timeToDate(CFAbsoluteTime time);
+ BSTR getNotificationString(NotificationType notifyType);
+ HRESULT itemForURLString(CFStringRef urlString, IWebHistoryItem** item);
+
+protected:
+ ULONG m_refCount;
+ RetainPtr<CFMutableDictionaryRef> m_entriesByURL;
+ RetainPtr<CFMutableArrayRef> m_datesWithEntries;
+ RetainPtr<CFMutableArrayRef> m_entriesByDate;
+ COMPtr<WebPreferences> m_preferences;
+ static IWebHistory* m_optionalSharedHistory;
+};
+
+#endif
diff --git a/WebKit/win/WebHistoryItem.cpp b/WebKit/win/WebHistoryItem.cpp
new file mode 100644
index 0000000..a4993bf
--- /dev/null
+++ b/WebKit/win/WebHistoryItem.cpp
@@ -0,0 +1,452 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebHistoryItem.h"
+
+#include "COMPtr.h"
+#include "MarshallingHelpers.h"
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/HistoryItem.h>
+#pragma warning(pop)
+
+#include <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
+// WebHistoryItem ----------------------------------------------------------------
+
+static HashMap<HistoryItem*, WebHistoryItem*>& historyItemWrappers()
+{
+ static HashMap<HistoryItem*, WebHistoryItem*> staticHistoryItemWrappers;
+ return staticHistoryItemWrappers;
+}
+
+WebHistoryItem::WebHistoryItem(PassRefPtr<HistoryItem> historyItem)
+: m_refCount(0)
+, m_historyItem(historyItem)
+{
+ ASSERT(!historyItemWrappers().contains(m_historyItem.get()));
+ historyItemWrappers().set(m_historyItem.get(), this);
+
+ gClassCount++;
+}
+
+WebHistoryItem::~WebHistoryItem()
+{
+ ASSERT(historyItemWrappers().contains(m_historyItem.get()));
+ historyItemWrappers().remove(m_historyItem.get());
+
+ gClassCount--;
+}
+
+WebHistoryItem* WebHistoryItem::createInstance()
+{
+ WebHistoryItem* instance = new WebHistoryItem(new HistoryItem);
+ instance->AddRef();
+ return instance;
+}
+
+WebHistoryItem* WebHistoryItem::createInstance(PassRefPtr<HistoryItem> historyItem)
+{
+ WebHistoryItem* instance;
+
+ instance = historyItemWrappers().get(historyItem.get());
+
+ if (!instance)
+ instance = new WebHistoryItem(historyItem);
+
+ instance->AddRef();
+ return instance;
+}
+
+// IWebHistoryItemPrivate -----------------------------------------------------
+
+static CFStringRef urlKey = CFSTR("");
+static CFStringRef lastVisitedDateKey = CFSTR("lastVisitedDate");
+static CFStringRef titleKey = CFSTR("title");
+static CFStringRef visitCountKey = CFSTR("visitCount");
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::initFromDictionaryRepresentation(void* dictionary)
+{
+ CFDictionaryRef dictionaryRef = (CFDictionaryRef) dictionary;
+ HRESULT hr = S_OK;
+ int visitedCount = 0;
+ CFAbsoluteTime lastVisitedTime = 0.0;
+
+ CFStringRef urlStringRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, urlKey);
+ if (urlStringRef && CFGetTypeID(urlStringRef) != CFStringGetTypeID()) {
+ hr = E_FAIL;
+ goto exit;
+ }
+
+ CFStringRef lastVisitedRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, lastVisitedDateKey);
+ if (!lastVisitedRef || CFGetTypeID(lastVisitedRef) != CFStringGetTypeID()) {
+ hr = E_FAIL;
+ goto exit;
+ }
+ lastVisitedTime = CFStringGetDoubleValue(lastVisitedRef);
+
+ CFStringRef titleRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, titleKey);
+ if (titleRef && CFGetTypeID(titleRef) != CFStringGetTypeID()) {
+ hr = E_FAIL;
+ goto exit;
+ }
+
+ CFNumberRef visitCountRef = (CFNumberRef) CFDictionaryGetValue(dictionaryRef, visitCountKey);
+ if (!visitCountRef || CFGetTypeID(visitCountRef) != CFNumberGetTypeID()) {
+ hr = E_FAIL;
+ goto exit;
+ }
+
+ historyItemWrappers().remove(m_historyItem.get());
+ m_historyItem = new HistoryItem(urlStringRef, titleRef, lastVisitedTime);
+ historyItemWrappers().set(m_historyItem.get(), this);
+
+ if (!CFNumberGetValue(visitCountRef, kCFNumberIntType, &visitedCount)) {
+ hr = E_FAIL;
+ goto exit;
+ }
+
+ m_historyItem->setVisitCount(visitedCount);
+exit:
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::dictionaryRepresentation(void** dictionary)
+{
+ CFDictionaryRef* dictionaryRef = (CFDictionaryRef*) dictionary;
+ static CFStringRef lastVisitedFormat = CFSTR("%.1lf");
+ CFStringRef lastVisitedStringRef =
+ CFStringCreateWithFormat(0, 0, lastVisitedFormat, m_historyItem->lastVisitedTime());
+ if (!lastVisitedStringRef)
+ return E_FAIL;
+
+ int keyCount = 0;
+ CFTypeRef keys[4];
+ CFTypeRef values[4];
+ if (!m_historyItem->urlString().isEmpty()) {
+ keys[keyCount] = urlKey;
+ values[keyCount++] = m_historyItem->urlString().createCFString();
+ }
+
+ keys[keyCount] = lastVisitedDateKey;
+ values[keyCount++] = lastVisitedStringRef;
+
+ if (!m_historyItem->title().isEmpty()) {
+ keys[keyCount] = titleKey;
+ values[keyCount++] = m_historyItem->title().createCFString();
+ }
+
+ keys[keyCount] = visitCountKey;
+ int visitCount = m_historyItem->visitCount();
+ values[keyCount++] = CFNumberCreate(0, kCFNumberIntType, &visitCount);
+
+ *dictionaryRef = CFDictionaryCreate(0, keys, values, keyCount, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+
+ for (int i = 0; i < keyCount; ++i)
+ CFRelease(values[i]);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::hasURLString(BOOL *hasURL)
+{
+ *hasURL = m_historyItem->urlString().isEmpty() ? FALSE : TRUE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::visitCount(int *count)
+{
+ *count = m_historyItem->visitCount();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setVisitCount(int count)
+{
+ m_historyItem->setVisitCount(count);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::mergeAutoCompleteHints(IWebHistoryItem* otherItem)
+{
+ if (!otherItem)
+ return E_FAIL;
+
+ if (otherItem == this)
+ return S_OK;
+
+ IWebHistoryItemPrivate* otherItemPriv;
+ HRESULT hr = otherItem->QueryInterface(IID_IWebHistoryItemPrivate, (void**)&otherItemPriv);
+ if (FAILED(hr))
+ return hr;
+
+ int otherVisitCount;
+ hr = otherItemPriv->visitCount(&otherVisitCount);
+ otherItemPriv->Release();
+ if (FAILED(hr))
+ return hr;
+
+ m_historyItem->setVisitCount(otherVisitCount);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitedTimeInterval(DATE time)
+{
+ m_historyItem->setLastVisitedTime(MarshallingHelpers::DATEToCFAbsoluteTime(time));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setTitle(BSTR title)
+{
+ m_historyItem->setTitle(String(title, SysStringLen(title)));
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::RSSFeedReferrer(BSTR* url)
+{
+ BString str(m_historyItem->rssFeedReferrer());
+ *url = str.release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setRSSFeedReferrer(BSTR url)
+{
+ m_historyItem->setRSSFeedReferrer(String(url, SysStringLen(url)));
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::hasPageCache(BOOL* /*hasCache*/)
+{
+ // FIXME - TODO
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setHasPageCache(BOOL /*hasCache*/)
+{
+ // FIXME - TODO
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::target(BSTR* target)
+{
+ if (!target) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *target = BString(m_historyItem->target()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::isTargetItem(BOOL* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = m_historyItem->isTargetItem() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::children(unsigned* outChildCount, SAFEARRAY** outChildren)
+{
+ if (!outChildCount || !outChildren) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *outChildCount = 0;
+ *outChildren = 0;
+
+ const HistoryItemVector& coreChildren = m_historyItem->children();
+ if (coreChildren.isEmpty())
+ return S_OK;
+ size_t childCount = coreChildren.size();
+
+ SAFEARRAY* children = SafeArrayCreateVector(VT_UNKNOWN, 0, static_cast<ULONG>(childCount));
+ if (!children)
+ return E_OUTOFMEMORY;
+
+ for (unsigned i = 0; i < childCount; ++i) {
+ WebHistoryItem* item = WebHistoryItem::createInstance(coreChildren[i]);
+ if (!item) {
+ SafeArrayDestroy(children);
+ return E_OUTOFMEMORY;
+ }
+
+ COMPtr<IUnknown> unknown;
+ HRESULT hr = item->QueryInterface(IID_IUnknown, (void**)&unknown);
+ if (FAILED(hr)) {
+ SafeArrayDestroy(children);
+ return hr;
+ }
+
+ LONG longI = i;
+ hr = SafeArrayPutElement(children, &longI, unknown.get());
+ if (FAILED(hr)) {
+ SafeArrayDestroy(children);
+ return hr;
+ }
+ }
+
+ *outChildCount = static_cast<unsigned>(childCount);
+ *outChildren = children;
+ return S_OK;
+
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, CLSID_WebHistoryItem))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebHistoryItem*>(this);
+ else if (IsEqualGUID(riid, IID_IWebHistoryItem))
+ *ppvObject = static_cast<IWebHistoryItem*>(this);
+ else if (IsEqualGUID(riid, IID_IWebHistoryItemPrivate))
+ *ppvObject = static_cast<IWebHistoryItemPrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebHistoryItem::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebHistoryItem::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebHistoryItem -------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::initWithURLString(
+ /* [in] */ BSTR urlString,
+ /* [in] */ BSTR title,
+ /* [in] */ DATE lastVisited)
+{
+ historyItemWrappers().remove(m_historyItem.get());
+ m_historyItem = new HistoryItem(String(urlString, SysStringLen(urlString)), String(title, SysStringLen(title)), MarshallingHelpers::DATEToCFAbsoluteTime(lastVisited));
+ historyItemWrappers().set(m_historyItem.get(), this);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::originalURLString(
+ /* [retval][out] */ BSTR* url)
+{
+ if (!url)
+ return E_POINTER;
+
+ BString str = m_historyItem->originalURLString();
+ *url = str.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::URLString(
+ /* [retval][out] */ BSTR* url)
+{
+ if (!url)
+ return E_POINTER;
+
+ BString str = m_historyItem->urlString();
+ *url = str.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::title(
+ /* [retval][out] */ BSTR* pageTitle)
+{
+ if (!pageTitle)
+ return E_POINTER;
+
+ BString str(m_historyItem->title());
+ *pageTitle = str.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitedTimeInterval(
+ /* [retval][out] */ DATE* lastVisited)
+{
+ if (!lastVisited)
+ return E_POINTER;
+
+ *lastVisited = MarshallingHelpers::CFAbsoluteTimeToDATE(m_historyItem->lastVisitedTime());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::setAlternateTitle(
+ /* [in] */ BSTR title)
+{
+ m_alternateTitle = String(title, SysStringLen(title));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::alternateTitle(
+ /* [retval][out] */ BSTR* title)
+{
+ if (!title) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *title = BString(m_alternateTitle).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebHistoryItem::icon(
+ /* [out, retval] */ OLE_HANDLE* /*hBitmap*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// WebHistoryItem -------------------------------------------------------------
+HistoryItem* WebHistoryItem::historyItem() const
+{
+ return m_historyItem.get();
+}
diff --git a/WebKit/win/WebHistoryItem.h b/WebKit/win/WebHistoryItem.h
new file mode 100644
index 0000000..6734ff0
--- /dev/null
+++ b/WebKit/win/WebHistoryItem.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebHistoryItem_H
+#define WebHistoryItem_H
+
+#include "WebKit.h"
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/PlatformString.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+ class HistoryItem;
+}
+
+//-----------------------------------------------------------------------------
+
+class WebHistoryItem : public IWebHistoryItem, IWebHistoryItemPrivate
+{
+public:
+ static WebHistoryItem* createInstance();
+ static WebHistoryItem* createInstance(PassRefPtr<WebCore::HistoryItem>);
+protected:
+ WebHistoryItem(PassRefPtr<WebCore::HistoryItem>);
+ ~WebHistoryItem();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebHistoryItem
+ virtual HRESULT STDMETHODCALLTYPE initWithURLString(
+ /* [in] */ BSTR urlString,
+ /* [in] */ BSTR title,
+ /* [in] */ DATE lastVisited);
+
+ virtual HRESULT STDMETHODCALLTYPE originalURLString(
+ /* [retval][out] */ BSTR *url);
+
+ virtual HRESULT STDMETHODCALLTYPE URLString(
+ /* [retval][out] */ BSTR *url);
+
+ virtual HRESULT STDMETHODCALLTYPE title(
+ /* [retval][out] */ BSTR *pageTitle);
+
+ virtual HRESULT STDMETHODCALLTYPE lastVisitedTimeInterval(
+ /* [retval][out] */ DATE *lastVisited);
+
+ virtual HRESULT STDMETHODCALLTYPE setAlternateTitle(
+ /* [in] */ BSTR title);
+
+ virtual HRESULT STDMETHODCALLTYPE alternateTitle(
+ /* [retval][out] */ BSTR* title);
+
+ virtual HRESULT STDMETHODCALLTYPE icon(
+ /* [out, retval] */ OLE_HANDLE *hBitmap);
+
+ // IWebHistoryItemPrivate
+ virtual HRESULT STDMETHODCALLTYPE initFromDictionaryRepresentation(void* dictionary);
+ virtual HRESULT STDMETHODCALLTYPE dictionaryRepresentation(void** dictionary);
+ virtual HRESULT STDMETHODCALLTYPE visitCount(int *count);
+ virtual HRESULT STDMETHODCALLTYPE setVisitCount(int count);
+ virtual HRESULT STDMETHODCALLTYPE hasURLString(BOOL* hasURL);
+ virtual HRESULT STDMETHODCALLTYPE mergeAutoCompleteHints(IWebHistoryItem* otherItem);
+ virtual HRESULT STDMETHODCALLTYPE setLastVisitedTimeInterval(DATE time);
+ virtual HRESULT STDMETHODCALLTYPE setTitle(BSTR title);
+ virtual HRESULT STDMETHODCALLTYPE RSSFeedReferrer(BSTR* url);
+ virtual HRESULT STDMETHODCALLTYPE setRSSFeedReferrer(BSTR url);
+ virtual HRESULT STDMETHODCALLTYPE hasPageCache(BOOL *hasCache);
+ virtual HRESULT STDMETHODCALLTYPE setHasPageCache(BOOL hasCache);
+ virtual HRESULT STDMETHODCALLTYPE target(BSTR* target);
+ virtual HRESULT STDMETHODCALLTYPE isTargetItem(BOOL* result);
+ virtual HRESULT STDMETHODCALLTYPE children(unsigned* childCount, SAFEARRAY** children);
+
+ // WebHistoryItem
+ WebCore::HistoryItem* historyItem() const;
+protected:
+ ULONG m_refCount;
+
+ RefPtr<WebCore::HistoryItem> m_historyItem;
+ WebCore::String m_alternateTitle;
+};
+
+#endif
diff --git a/WebKit/win/WebIconDatabase.cpp b/WebKit/win/WebIconDatabase.cpp
new file mode 100644
index 0000000..e15309a
--- /dev/null
+++ b/WebKit/win/WebIconDatabase.cpp
@@ -0,0 +1,362 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebIconDatabase.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "COMPtr.h"
+#include "WebPreferences.h"
+#include "WebNotificationCenter.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/IconDatabase.h>
+#include <WebCore/Image.h>
+#include <WebCore/MainThread.h>
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+#include "shlobj.h"
+
+using namespace WebCore;
+using namespace WTF;
+
+// WebIconDatabase ----------------------------------------------------------------
+
+WebIconDatabase* WebIconDatabase::m_sharedWebIconDatabase = 0;
+
+WebIconDatabase::WebIconDatabase()
+: m_refCount(0)
+, m_deliveryRequested(false)
+{
+ gClassCount++;
+}
+
+WebIconDatabase::~WebIconDatabase()
+{
+ gClassCount--;
+}
+
+void WebIconDatabase::init()
+{
+ WebPreferences* standardPrefs = WebPreferences::sharedStandardPreferences();
+ BOOL enabled = FALSE;
+ if (FAILED(standardPrefs->iconDatabaseEnabled(&enabled))) {
+ enabled = FALSE;
+ LOG_ERROR("Unable to get icon database enabled preference");
+ }
+ iconDatabase()->setEnabled(!!enabled);
+
+ iconDatabase()->setClient(this);
+
+ BSTR prefDatabasePath = 0;
+ if (FAILED(standardPrefs->iconDatabaseLocation(&prefDatabasePath)))
+ LOG_ERROR("Unable to get icon database location preference");
+
+ String databasePath(prefDatabasePath, SysStringLen(prefDatabasePath));
+ SysFreeString(prefDatabasePath);
+
+ if (databasePath.isEmpty()) {
+ databasePath = localUserSpecificStorageDirectory();
+ if (databasePath.isEmpty())
+ LOG_ERROR("Failed to construct default icon database path");
+ }
+
+ if (!iconDatabase()->open(databasePath))
+ LOG_ERROR("Failed to open icon database path");
+}
+
+WebIconDatabase* WebIconDatabase::createInstance()
+{
+ WebIconDatabase* instance = new WebIconDatabase();
+ instance->AddRef();
+ return instance;
+}
+
+WebIconDatabase* WebIconDatabase::sharedWebIconDatabase()
+{
+ if (m_sharedWebIconDatabase) {
+ m_sharedWebIconDatabase->AddRef();
+ return m_sharedWebIconDatabase;
+ }
+ m_sharedWebIconDatabase = createInstance();
+ m_sharedWebIconDatabase->init();
+ return m_sharedWebIconDatabase;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebIconDatabase*>(this);
+ else if (IsEqualGUID(riid, IID_IWebIconDatabase))
+ *ppvObject = static_cast<IWebIconDatabase*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebIconDatabase::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebIconDatabase::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebIconDatabase --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::sharedIconDatabase(
+ /* [retval][out] */ IWebIconDatabase** result)
+{
+ *result = sharedWebIconDatabase();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::iconForURL(
+ /* [in] */ BSTR url,
+ /* [optional][in] */ LPSIZE size,
+ /* [optional][in] */ BOOL /*cache*/,
+ /* [retval][out] */ OLE_HANDLE* bitmap)
+{
+ IntSize intSize(*size);
+
+ Image* icon = 0;
+ if (url)
+ icon = iconDatabase()->iconForPageURL(String(url, SysStringLen(url)), intSize);
+
+ // Make sure we check for the case of an "empty image"
+ if (icon && icon->width()) {
+ *bitmap = (OLE_HANDLE)(ULONG64)getOrCreateSharedBitmap(size);
+ if (!icon->getHBITMAPOfSize((HBITMAP)(ULONG64)*bitmap, size)) {
+ LOG_ERROR("Failed to draw Image to HBITMAP");
+ *bitmap = 0;
+ return E_FAIL;
+ }
+ return S_OK;
+ }
+
+ return defaultIconWithSize(size, bitmap);
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::defaultIconWithSize(
+ /* [in] */ LPSIZE size,
+ /* [retval][out] */ OLE_HANDLE* result)
+{
+ *result = (OLE_HANDLE)(ULONG64)getOrCreateDefaultIconBitmap(size);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::retainIconForURL(
+ /* [in] */ BSTR url)
+{
+ iconDatabase()->retainIconForPageURL(String(url, SysStringLen(url)));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::releaseIconForURL(
+ /* [in] */ BSTR url)
+{
+ iconDatabase()->releaseIconForPageURL(String(url, SysStringLen(url)));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::removeAllIcons(void)
+{
+ iconDatabase()->removeAllIcons();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::delayDatabaseCleanup(void)
+{
+ IconDatabase::delayDatabaseCleanup();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::allowDatabaseCleanup(void)
+{
+ IconDatabase::allowDatabaseCleanup();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebIconDatabase::iconURLForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ BSTR* iconURL)
+{
+ if (!url || !iconURL)
+ return E_POINTER;
+ BString iconURLBSTR(iconDatabase()->iconURLForPageURL(String(url, SysStringLen(url))));
+ *iconURL = iconURLBSTR.release();
+ return S_OK;
+}
+
+HBITMAP createDIB(LPSIZE size)
+{
+ HBITMAP result;
+
+ BITMAPINFO bmInfo = {0};
+ bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo.bmiHeader.biWidth = size->cx;
+ bmInfo.bmiHeader.biHeight = size->cy;
+ bmInfo.bmiHeader.biPlanes = 1;
+ bmInfo.bmiHeader.biBitCount = 32;
+ bmInfo.bmiHeader.biCompression = BI_RGB;
+
+ HDC dc = GetDC(0);
+ result = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
+ ReleaseDC(0, dc);
+
+ return result;
+}
+
+HBITMAP WebIconDatabase::getOrCreateSharedBitmap(LPSIZE size)
+{
+ HBITMAP result = m_sharedIconMap.get(*size);
+ if (result)
+ return result;
+ result = createDIB(size);
+ m_sharedIconMap.set(*size, result);
+ return result;
+}
+
+HBITMAP WebIconDatabase::getOrCreateDefaultIconBitmap(LPSIZE size)
+{
+ HBITMAP result = m_defaultIconMap.get(*size);
+ if (result)
+ return result;
+
+ result = createDIB(size);
+ static Image* defaultIconImage = 0;
+ if (!defaultIconImage) {
+ defaultIconImage = Image::loadPlatformResource("urlIcon");
+ }
+ m_defaultIconMap.set(*size, result);
+ if (!defaultIconImage->getHBITMAPOfSize(result, size)) {
+ LOG_ERROR("Failed to draw Image to HBITMAP");
+ return 0;
+ }
+ return result;
+}
+
+// IconDatabaseClient
+
+void WebIconDatabase::dispatchDidRemoveAllIcons()
+{
+ // Queueing the empty string is a special way of saying "this queued notification is the didRemoveAllIcons notification"
+ MutexLocker locker(m_notificationMutex);
+ m_notificationQueue.append(String());
+ scheduleNotificationDelivery();
+}
+
+void WebIconDatabase::dispatchDidAddIconForPageURL(const String& pageURL)
+{
+ MutexLocker locker(m_notificationMutex);
+ m_notificationQueue.append(pageURL.copy());
+ scheduleNotificationDelivery();
+}
+
+void WebIconDatabase::scheduleNotificationDelivery()
+{
+ // Caller of this method must hold the m_notificationQueue lock
+ ASSERT(!m_notificationMutex.tryLock());
+
+ if (!m_deliveryRequested) {
+ m_deliveryRequested = true;
+ callOnMainThread(deliverNotifications, 0);
+ }
+}
+
+BSTR WebIconDatabase::iconDatabaseDidAddIconNotification()
+{
+ static BSTR didAddIconName = SysAllocString(WebIconDatabaseDidAddIconNotification);
+ return didAddIconName;
+}
+
+CFStringRef WebIconDatabase::iconDatabaseNotificationUserInfoURLKey()
+{
+ static CFStringRef iconUserInfoURLKey = String(WebIconNotificationUserInfoURLKey).createCFString();
+ return iconUserInfoURLKey;
+}
+
+BSTR WebIconDatabase::iconDatabaseDidRemoveAllIconsNotification()
+{
+ static BSTR didRemoveAllIconsName = SysAllocString(WebIconDatabaseDidRemoveAllIconsNotification);
+ return didRemoveAllIconsName;
+}
+
+static void postDidRemoveAllIconsNotification(WebIconDatabase* iconDB)
+{
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(WebIconDatabase::iconDatabaseDidRemoveAllIconsNotification(), static_cast<IWebIconDatabase*>(iconDB), 0);
+}
+
+static void postDidAddIconNotification(const String& pageURL, WebIconDatabase* iconDB)
+{
+ RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
+ CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFStringRef> url(AdoptCF, pageURL.createCFString());
+ CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), url.get());
+
+ COMPtr<CFDictionaryPropertyBag> userInfo(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+ userInfo->setDictionary(dictionary.get());
+
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(WebIconDatabase::iconDatabaseDidAddIconNotification(), static_cast<IWebIconDatabase*>(iconDB), userInfo.get());
+}
+
+void WebIconDatabase::deliverNotifications(void*)
+{
+ ASSERT(m_sharedWebIconDatabase);
+ if (!m_sharedWebIconDatabase)
+ return;
+
+ ASSERT(m_sharedWebIconDatabase->m_deliveryRequested);
+
+ Vector<String> queue;
+ {
+ MutexLocker locker(m_sharedWebIconDatabase->m_notificationMutex);
+ queue.swap(m_sharedWebIconDatabase->m_notificationQueue);
+ m_sharedWebIconDatabase->m_deliveryRequested = false;
+ }
+
+ for (unsigned i = 0; i < queue.size(); ++i) {
+ if (queue[i].isNull())
+ postDidRemoveAllIconsNotification(m_sharedWebIconDatabase);
+ else
+ postDidAddIconNotification(queue[i], m_sharedWebIconDatabase);
+ }
+}
diff --git a/WebKit/win/WebIconDatabase.h b/WebKit/win/WebIconDatabase.h
new file mode 100644
index 0000000..85f57b7
--- /dev/null
+++ b/WebKit/win/WebIconDatabase.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebIconDatabase_H
+#define WebIconDatabase_H
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/IconDatabaseClient.h>
+#include <WebCore/IntSize.h>
+#include <WebCore/IntSizeHash.h>
+#pragma warning(pop)
+
+#include <wtf/Vector.h>
+#include <wtf/Threading.h>
+
+#include <windows.h>
+
+typedef const struct __CFString * CFStringRef;
+
+namespace WebCore
+{
+ class IconDatabase;
+}; //namespace WebCore
+using namespace WebCore;
+using namespace WTF;
+
+class WebIconDatabase : public IWebIconDatabase, public WebCore::IconDatabaseClient
+{
+public:
+ static WebIconDatabase* createInstance();
+ static WebIconDatabase* sharedWebIconDatabase();
+private:
+ WebIconDatabase();
+ ~WebIconDatabase();
+ void init();
+public:
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebIconDatabase
+ virtual HRESULT STDMETHODCALLTYPE sharedIconDatabase(
+ /* [retval][out] */ IWebIconDatabase **result);
+
+ virtual HRESULT STDMETHODCALLTYPE iconForURL(
+ /* [in] */ BSTR url,
+ /* [optional][in] */ LPSIZE size,
+ /* [optional][in] */ BOOL cache,
+ /* [retval][out] */ OLE_HANDLE *image);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultIconWithSize(
+ /* [in] */ LPSIZE size,
+ /* [retval][out] */ OLE_HANDLE *result);
+
+ virtual HRESULT STDMETHODCALLTYPE retainIconForURL(
+ /* [in] */ BSTR url);
+
+ virtual HRESULT STDMETHODCALLTYPE releaseIconForURL(
+ /* [in] */ BSTR url);
+
+ virtual HRESULT STDMETHODCALLTYPE removeAllIcons( void);
+
+ virtual HRESULT STDMETHODCALLTYPE delayDatabaseCleanup( void);
+
+ virtual HRESULT STDMETHODCALLTYPE allowDatabaseCleanup( void);
+
+ virtual HRESULT STDMETHODCALLTYPE iconURLForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ BSTR *iconURL);
+
+ // IconDatabaseClient
+ virtual void dispatchDidRemoveAllIcons();
+ virtual void dispatchDidAddIconForPageURL(const WebCore::String&);
+
+ static BSTR iconDatabaseDidAddIconNotification();
+ static BSTR iconDatabaseDidRemoveAllIconsNotification();
+ static CFStringRef iconDatabaseNotificationUserInfoURLKey();
+protected:
+ ULONG m_refCount;
+ static WebIconDatabase* m_sharedWebIconDatabase;
+
+ // Keep a set of HBITMAPs around for the default icon, and another
+ // to share amongst present site icons
+ HBITMAP getOrCreateSharedBitmap(LPSIZE size);
+ HBITMAP getOrCreateDefaultIconBitmap(LPSIZE size);
+ HashMap<IntSize, HBITMAP> m_defaultIconMap;
+ HashMap<IntSize, HBITMAP> m_sharedIconMap;
+
+ Mutex m_notificationMutex;
+ Vector<String> m_notificationQueue;
+ void scheduleNotificationDelivery();
+ bool m_deliveryRequested;
+
+ static void deliverNotifications(void*);
+};
+
+#endif
diff --git a/WebKit/win/WebInspector.cpp b/WebKit/win/WebInspector.cpp
new file mode 100644
index 0000000..d188e4f
--- /dev/null
+++ b/WebKit/win/WebInspector.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebInspector.h"
+
+#include "WebKitDLL.h"
+#include "WebView.h"
+#pragma warning(push, 0)
+#include <WebCore/InspectorController.h>
+#include <WebCore/Page.h>
+#pragma warning(pop)
+#include <wtf/Assertions.h>
+
+using namespace WebCore;
+
+WebInspector* WebInspector::createInstance(WebView* webView)
+{
+ WebInspector* inspector = new WebInspector(webView);
+ inspector->AddRef();
+ return inspector;
+}
+
+WebInspector::WebInspector(WebView* webView)
+ : m_refCount(0)
+ , m_webView(webView)
+{
+ ASSERT_ARG(webView, webView);
+
+ gClassCount++;
+}
+
+WebInspector::~WebInspector()
+{
+ gClassCount--;
+}
+
+void WebInspector::webViewClosed()
+{
+ m_webView = 0;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IWebInspector))
+ *ppvObject = static_cast<IWebInspector*>(this);
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebInspector*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebInspector::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebInspector::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::show()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->show();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::showConsole()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->showConsole();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::showTimeline()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->showTimeline();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::close()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->close();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::attach()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->attachWindow();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::detach()
+{
+ if (m_webView)
+ if (Page* page = m_webView->page())
+ page->inspectorController()->detachWindow();
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebInspector.h b/WebKit/win/WebInspector.h
new file mode 100644
index 0000000..8966963
--- /dev/null
+++ b/WebKit/win/WebInspector.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebInspector_h
+#define WebInspector_h
+
+#include "WebKit.h"
+#include <wtf/Noncopyable.h>
+
+class WebView;
+
+class WebInspector : public IWebInspector, Noncopyable {
+public:
+ static WebInspector* createInstance(WebView*);
+
+ void webViewClosed();
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ virtual HRESULT STDMETHODCALLTYPE show();
+ virtual HRESULT STDMETHODCALLTYPE showConsole();
+ virtual HRESULT STDMETHODCALLTYPE showTimeline();
+ virtual HRESULT STDMETHODCALLTYPE close();
+ virtual HRESULT STDMETHODCALLTYPE attach();
+ virtual HRESULT STDMETHODCALLTYPE detach();
+
+private:
+ WebInspector(WebView*);
+ ~WebInspector();
+
+ ULONG m_refCount;
+ WebView* m_webView;
+};
+
+#endif // !defined(WebInspector_h)
diff --git a/WebKit/win/WebJavaScriptCollector.cpp b/WebKit/win/WebJavaScriptCollector.cpp
new file mode 100644
index 0000000..60e3821
--- /dev/null
+++ b/WebKit/win/WebJavaScriptCollector.cpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebJavaScriptCollector.h"
+
+#pragma warning(push, 0)
+#include <JavaScriptCore/collector.h>
+#include <WebCore/GCController.h>
+#pragma warning(pop)
+
+using namespace KJS;
+using namespace WebCore;
+
+// WebJavaScriptCollector ---------------------------------------------------------------------------
+
+WebJavaScriptCollector::WebJavaScriptCollector()
+: m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebJavaScriptCollector::~WebJavaScriptCollector()
+{
+ gClassCount--;
+}
+
+WebJavaScriptCollector* WebJavaScriptCollector::createInstance()
+{
+ WebJavaScriptCollector* instance = new WebJavaScriptCollector();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebJavaScriptCollector::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebJavaScriptCollector*>(this);
+ else if (IsEqualGUID(riid, IID_IWebJavaScriptCollector))
+ *ppvObject = static_cast<IWebJavaScriptCollector*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebJavaScriptCollector::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebJavaScriptCollector::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebJavaScriptCollector ------------------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebJavaScriptCollector::collect()
+{
+ gcController().garbageCollectNow();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebJavaScriptCollector::collectOnAlternateThread(
+ /* [in] */ BOOL waitUntilDone)
+{
+ gcController().garbageCollectOnAlternateThreadForDebugging(!!waitUntilDone);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebJavaScriptCollector::objectCount(
+ /* [retval][out] */ UINT* count)
+{
+ if (!count) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *count = (UINT)Collector::size();
+ return S_OK;
+}
diff --git a/WebKit/win/WebJavaScriptCollector.h b/WebKit/win/WebJavaScriptCollector.h
new file mode 100644
index 0000000..0ac696c
--- /dev/null
+++ b/WebKit/win/WebJavaScriptCollector.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebJavaScriptCollector_H
+#define WebJavaScriptCollector_H
+
+#include "WebKit.h"
+
+class WebJavaScriptCollector : public IWebJavaScriptCollector
+{
+public:
+ static WebJavaScriptCollector* createInstance();
+protected:
+ WebJavaScriptCollector();
+ ~WebJavaScriptCollector();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebJavaScriptCollector
+ virtual HRESULT STDMETHODCALLTYPE collect();
+
+ virtual HRESULT STDMETHODCALLTYPE collectOnAlternateThread(
+ /* [in] */ BOOL waitUntilDone);
+
+ virtual HRESULT STDMETHODCALLTYPE objectCount(
+ /* [retaval][out] */ UINT* count);
+
+protected:
+ ULONG m_refCount;
+};
+
+#endif
diff --git a/WebKit/win/WebKit.resources/Info.plist b/WebKit/win/WebKit.resources/Info.plist
new file mode 100644
index 0000000..859ce3d
--- /dev/null
+++ b/WebKit/win/WebKit.resources/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>WebKit</string>
+ <key>CFBundleGetInfoString</key>
+ <string>522+, Copyright 2003-2007 Apple Inc.</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.WebKit</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>WebKit</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>522+</string>
+ <key>CFBundleVersion</key>
+ <string>522+</string>
+</dict>
+</plist>
diff --git a/WebKit/win/WebKit.vcproj/DerivedSources.make b/WebKit/win/WebKit.vcproj/DerivedSources.make
new file mode 100644
index 0000000..ce2d670
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/DerivedSources.make
@@ -0,0 +1,149 @@
+# Copyright (C) 2007 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.
+# 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+
+PREFIX = IGEN_DOM
+
+.PHONY : all
+all : \
+ $(PREFIX)Node.idl \
+ $(PREFIX)Attr.idl \
+ $(PREFIX)NodeList.idl \
+ $(PREFIX)Element.idl \
+ $(PREFIX)Document.idl \
+ $(PREFIX)CharacterData.idl \
+ $(PREFIX)CDATASection.idl \
+ $(PREFIX)Comment.idl \
+ $(PREFIX)Text.idl \
+ $(PREFIX)DocumentFragment.idl \
+ $(PREFIX)DocumentType.idl \
+ $(PREFIX)DOMImplementation.idl \
+ $(PREFIX)Entity.idl \
+ $(PREFIX)EntityReference.idl \
+ $(PREFIX)NamedNodeMap.idl \
+ $(PREFIX)Notation.idl \
+ $(PREFIX)ProcessingInstruction.idl \
+ \
+ $(PREFIX)HTMLAnchorElement.idl \
+ $(PREFIX)HTMLAppletElement.idl \
+ $(PREFIX)HTMLAreaElement.idl \
+ $(PREFIX)HTMLBRElement.idl \
+ $(PREFIX)HTMLBaseElement.idl \
+ $(PREFIX)HTMLBaseFontElement.idl \
+ $(PREFIX)HTMLBlockquoteElement.idl \
+ $(PREFIX)HTMLBodyElement.idl \
+ $(PREFIX)HTMLButtonElement.idl \
+ $(PREFIX)HTMLCollection.idl \
+ $(PREFIX)HTMLDListElement.idl \
+ $(PREFIX)HTMLDirectoryElement.idl \
+ $(PREFIX)HTMLDivElement.idl \
+ $(PREFIX)HTMLDocument.idl \
+ $(PREFIX)HTMLElement.idl \
+ $(PREFIX)HTMLEmbedElement.idl \
+ $(PREFIX)HTMLFieldSetElement.idl \
+ $(PREFIX)HTMLFontElement.idl \
+ $(PREFIX)HTMLFormElement.idl \
+ $(PREFIX)HTMLFrameElement.idl \
+ $(PREFIX)HTMLFrameSetElement.idl \
+ $(PREFIX)HTMLHRElement.idl \
+ $(PREFIX)HTMLHeadElement.idl \
+ $(PREFIX)HTMLHeadingElement.idl \
+ $(PREFIX)HTMLHtmlElement.idl \
+ $(PREFIX)HTMLIFrameElement.idl \
+ $(PREFIX)HTMLImageElement.idl \
+ $(PREFIX)HTMLInputElement.idl \
+ $(PREFIX)HTMLIsIndexElement.idl \
+ $(PREFIX)HTMLLIElement.idl \
+ $(PREFIX)HTMLLabelElement.idl \
+ $(PREFIX)HTMLLegendElement.idl \
+ $(PREFIX)HTMLLinkElement.idl \
+ $(PREFIX)HTMLMapElement.idl \
+ $(PREFIX)HTMLMarqueeElement.idl \
+ $(PREFIX)HTMLMenuElement.idl \
+ $(PREFIX)HTMLMetaElement.idl \
+ $(PREFIX)HTMLModElement.idl \
+ $(PREFIX)HTMLOListElement.idl \
+ $(PREFIX)HTMLObjectElement.idl \
+ $(PREFIX)HTMLOptGroupElement.idl \
+ $(PREFIX)HTMLOptionElement.idl \
+ $(PREFIX)HTMLOptionsCollection.idl \
+ $(PREFIX)HTMLParagraphElement.idl \
+ $(PREFIX)HTMLParamElement.idl \
+ $(PREFIX)HTMLPreElement.idl \
+ $(PREFIX)HTMLQuoteElement.idl \
+ $(PREFIX)HTMLScriptElement.idl \
+ $(PREFIX)HTMLSelectElement.idl \
+ $(PREFIX)HTMLStyleElement.idl \
+ $(PREFIX)HTMLTableCaptionElement.idl \
+ $(PREFIX)HTMLTableCellElement.idl \
+ $(PREFIX)HTMLTableColElement.idl \
+ $(PREFIX)HTMLTableElement.idl \
+ $(PREFIX)HTMLTableRowElement.idl \
+ $(PREFIX)HTMLTableSectionElement.idl \
+ $(PREFIX)HTMLTextAreaElement.idl \
+ $(PREFIX)HTMLTitleElement.idl \
+ $(PREFIX)HTMLUListElement.idl \
+ \
+ $(PREFIX)CSSCharsetRule.idl \
+ $(PREFIX)CSSFontFaceRule.idl \
+ $(PREFIX)CSSImportRule.idl \
+ $(PREFIX)CSSMediaRule.idl \
+ $(PREFIX)CSSPageRule.idl \
+ $(PREFIX)CSSPrimitiveValue.idl \
+ $(PREFIX)CSSRule.idl \
+ $(PREFIX)CSSRuleList.idl \
+ $(PREFIX)CSSStyleDeclaration.idl \
+ $(PREFIX)CSSStyleRule.idl \
+ $(PREFIX)CSSStyleSheet.idl \
+ $(PREFIX)CSSUnknownRule.idl \
+ $(PREFIX)CSSValue.idl \
+ $(PREFIX)CSSValueList.idl \
+ $(PREFIX)Counter.idl \
+ $(PREFIX)MediaList.idl \
+ $(PREFIX)Rect.idl \
+ $(PREFIX)StyleSheet.idl \
+ $(PREFIX)StyleSheetList.idl \
+ \
+ $(PREFIX)Event.idl \
+ $(PREFIX)EventTarget.idl \
+ $(PREFIX)EventListener.idl \
+#
+
+# $(PREFIX)CanvasGradient.idl \
+# $(PREFIX)CanvasPattern.idl \
+# $(PREFIX)CanvasRenderingContext2D.idl \
+# $(PREFIX)HTMLCanvasElement.idl \
+# $(PREFIX)RGBColor.idl \
+
+COM_BINDINGS_SCRIPTS = \
+ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/CodeGenerator.pm \
+ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/CodeGeneratorCOM.pm \
+ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/IDLParser.pm \
+ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/IDLStructure.pm \
+ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/generate-bindings.pl \
+#
+
+$(PREFIX)%.idl : $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/%.idl $(COM_BINDINGS_SCRIPTS)
+ perl -I $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/ $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_COM" --generator COM --include $(WEBKIT_OUTPUT)/obj/WebKit/DOMInterfaces/ --outputdir . $<
diff --git a/WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl b/WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl
new file mode 100644
index 0000000..863e1dd
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl
@@ -0,0 +1,76 @@
+#! /usr/bin/perl -w
+
+# Copyright (C) 2007 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.
+# 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+
+# This script cleans up the headers that MIDL (Microsoft's IDL Parser/Generator)
+# outputs to only #include the parent interface avoiding circular dependencies
+# that MIDL creates.
+
+use File::Find;
+use strict;
+use warnings;
+
+my $dir = $ARGV[0];
+
+$dir = `cygpath -u '$dir'`;
+chomp($dir);
+
+find(\&finder, $dir);
+
+sub finder
+{
+ my $fileName = $_;
+
+ return unless ($fileName =~ /IGEN_DOM(.*)\.h/);
+
+ open(IN, "<", $fileName);
+ my @contents = <IN>;
+ close(IN);
+
+ open(OUT, ">", $fileName);
+
+ my $state = 0;
+ foreach my $line (@contents) {
+ if ($line =~ /^\/\* header files for imported files \*\//) {
+ $state = 1;
+ } elsif ($line =~ /^#include "oaidl\.h"/) {
+ die "#include \"oaidl.h\" did not come second" if $state != 1;
+ $state = 2;
+ } elsif ($line =~ /^#include "ocidl\.h"/) {
+ die "#include \"ocidl.h\" did not come third" if $state != 2;
+ $state = 3;
+ } elsif ($line =~ /^#include "IGEN_DOM/ && $state == 3) {
+ $state = 4;
+ } elsif ($line =~ /^#include "(IGEN_DOM.*)\.h"/ && $state == 4) {
+ next;
+ }
+
+ print OUT $line;
+ }
+
+ close(OUT);
+}
diff --git a/WebKit/win/WebKit.vcproj/Interfaces.vcproj b/WebKit/win/WebKit.vcproj/Interfaces.vcproj
new file mode 100644
index 0000000..46fa06f
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/Interfaces.vcproj
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Interfaces"
+ ProjectGUID="{91762BE2-87EF-4F5A-A480-48B90EB3F406}"
+ RootNamespace="Interfaces"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(WebKitOutputDir)\include\WebKit"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\obj\WebKit\$(ProjectName)&quot;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;;..\Interfaces;&quot;$(IntDir)\include&quot;"
+ GenerateTypeLibrary="false"
+ TypeLibraryName="$(ProjectDir)\WebKit.tlb"
+ OutputDirectory="$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;perl FixMIDLHeaders.pl &quot;$(WebkitOutputDir)/include/webkit/&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\include\WebKit"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\obj\WebKit\$(ProjectName)&quot;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;;..\Interfaces;&quot;$(IntDir)\include&quot;"
+ GenerateTypeLibrary="false"
+ TypeLibraryName="$(ProjectDir)\WebKit.tlb"
+ OutputDirectory="$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;perl FixMIDLHeaders.pl &quot;$(WebkitOutputDir)/include/webkit/&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\Interfaces\WebKit.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateTypeLibrary="true"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ GenerateTypeLibrary="true"
+ />
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj b/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj
new file mode 100644
index 0000000..65950b5
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="InterfacesGenerated"
+ ProjectGUID="{62C897BE-E207-4BC4-B37D-6F9F9116F166}"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot;&#x0D;&#x0A;"
+ ReBuildCommandLine="del /s /q &quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;&#x0D;&#x0A;set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot;&#x0D;&#x0A;"
+ CleanCommandLine="del /s /q &quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;&#x0D;&#x0A;"
+ Output=""
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-generated-files.sh"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKit/win/WebKit.vcproj/WebKit.def b/WebKit/win/WebKit.vcproj/WebKit.def
new file mode 100644
index 0000000..539a018
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.def
@@ -0,0 +1,109 @@
+LIBRARY "WebKit"
+
+EXPORTS
+ DllGetClassObject PRIVATE
+ DllCanUnloadNow PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
+ RunAsLocalServer PRIVATE
+ LocalServerDidDie PRIVATE
+ JSCheckScriptSyntax
+ JSClassCreate
+ JSClassRelease
+ JSClassRetain
+ JSContextGetGlobalObject
+ JSEvaluateScript
+ JSGarbageCollect
+ JSGlobalContextCreate
+ JSGlobalContextRelease
+ JSGlobalContextRetain
+ JSObjectCallAsConstructor
+ JSObjectCallAsFunction
+ JSObjectCopyPropertyNames
+ JSObjectDeleteProperty
+ JSObjectGetPrivate
+ JSObjectGetProperty
+ JSObjectGetPropertyAtIndex
+ JSObjectGetPrototype
+ JSObjectHasProperty
+ JSObjectIsConstructor
+ JSObjectIsFunction
+ JSObjectMake
+ JSObjectMakeConstructor
+ JSObjectMakeFunction
+ JSObjectMakeFunction
+ JSObjectMakeFunctionWithCallback
+ JSObjectSetPrivate
+ JSObjectSetProperty
+ JSObjectSetPropertyAtIndex
+ JSObjectSetPrototype
+ JSPropertyNameAccumulatorAddName
+ JSPropertyNameArrayGetCount
+ JSPropertyNameArrayGetNameAtIndex
+ JSPropertyNameArrayRelease
+ JSPropertyNameArrayRetain
+ JSStringCopyBSTR
+ JSStringCopyCFString
+ JSStringCreateWithBSTR
+ JSStringCreateWithCFString
+ JSStringCreateWithCharacters
+ JSStringCreateWithUTF8CString
+ JSStringGetCharactersPtr
+ JSStringGetLength
+ JSStringGetMaximumUTF8CStringSize
+ JSStringGetUTF8CString
+ JSStringIsEqual
+ JSStringIsEqualToUTF8CString
+ JSStringRelease
+ JSStringRetain
+ JSValueGetType
+ JSValueIsBoolean
+ JSValueIsEqual
+ JSValueIsInstanceOfConstructor
+ JSValueIsNull
+ JSValueIsNumber
+ JSValueIsObject
+ JSValueIsObjectOfClass
+ JSValueIsStrictEqual
+ JSValueIsString
+ JSValueIsUndefined
+ JSValueMakeBoolean
+ JSValueMakeNull
+ JSValueMakeNumber
+ JSValueMakeString
+ JSValueMakeUndefined
+ JSValueProtect
+ JSValueToBoolean
+ JSValueToNumber
+ JSValueToObject
+ JSValueToStringCopy
+ JSValueUnprotect
+; KJS_JSCreateNativeJSObject
+; KJS_JSObject_JSFinalize
+; KJS_JSObject_JSObjectCall
+; KJS_JSObject_JSObjectEval
+; KJS_JSObject_JSObjectGetMember
+; KJS_JSObject_JSObjectGetSlot
+; KJS_JSObject_JSObjectRemoveMember
+; KJS_JSObject_JSObjectSetMember
+; KJS_JSObject_JSObjectSetSlot
+; KJS_JSObject_JSObjectToString
+ setUseOpenSourceWebKit
+ progIDForClass
+ WebLocalizedStringUTF8
+ WebLocalizedLPCTSTRUTF8
+ DrawTextAtPoint
+ WebDrawText
+ FontMetrics
+ TextFloatWidth
+ CenterTruncateStringToWidth
+ RightTruncateStringToWidth
+ ?fastMalloc@WTF@@YAPAXI@Z
+ ?fastZeroedMalloc@WTF@@YAPAXI@Z
+ ?fastFree@WTF@@YAXPAX@Z
+ ?fastCalloc@WTF@@YAPAXII@Z
+
+ ; These functions are deprecated
+ WebLocalizedString
+ WebLocalizedLPCTSTR
+ SetWebLocalizedStringMainBundle
diff --git a/WebKit/win/WebKit.vcproj/WebKit.make b/WebKit/win/WebKit.vcproj/WebKit.make
new file mode 100755
index 0000000..29802a7
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.make
@@ -0,0 +1,18 @@
+!IF !defined(BUILDSTYLE)
+BUILDSTYLE=Release
+!ELSEIF "$(BUILDSTYLE)"=="DEBUG"
+BUILDSTYLE=Debug_Internal
+!ENDIF
+
+install:
+ set WebKitLibrariesDir=$(SRCROOT)\AppleInternal
+ set WebKitOutputDir=$(OBJROOT)
+ set PRODUCTION=1
+ xcopy "$(SRCROOT)\AppleInternal\obj\WebKit\DOMInterfaces\*" "$(OBJROOT)\obj\WebKit\DOMInterfaces" /e/v/i/h/y
+ devenv "WebKit.submit.sln" /rebuild $(BUILDSTYLE)
+ -xcopy "$(OBJROOT)\bin\*.exe" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ xcopy "$(OBJROOT)\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ xcopy "$(OBJROOT)\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ xcopy "$(OBJROOT)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y
+ xcopy "$(OBJROOT)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y
+ xcopy "$(OBJROOT)\bin\WebKit.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit.resources" /e/v/i/h/y
diff --git a/WebKit/win/WebKit.vcproj/WebKit.rc b/WebKit/win/WebKit.vcproj/WebKit.rc
new file mode 100644
index 0000000..5d0a957
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.rc
@@ -0,0 +1,72 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+#include "autoversion.h"
+#include "winres.h"
+
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TYPELIB
+//
+
+IDR_WEBKIT TYPELIB "WebKit.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __VERSION_MAJOR__,__BUILD_NUMBER_MAJOR__,__BUILD_NUMBER_MINOR__,__BUILD_NUMBER_VARIANT__
+ PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "WebKit Dynamic Link Library"
+ VALUE "FileVersion", __VERSION_TEXT__
+ VALUE "CompanyName", "Apple Inc."
+ VALUE "InternalName", "WebKit"
+ VALUE "LegalCopyright", "Copyright Apple Inc. 2003-2008"
+ VALUE "OriginalFilename", "WebKit.dll"
+ VALUE "ProductName", " WebKit"
+ VALUE "ProductVersion", __BUILD_NUMBER_SHORT__
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// PNG
+//
+
+IDR_RESIZE_CORNER PNG "textAreaResizeCorner.png"
+IDR_MISSING_IMAGE PNG "missingImage.png"
+IDR_URL_ICON PNG "urlIcon.png"
+IDR_NULL_PLUGIN PNG "nullplugin.png"
+IDR_DELETE_BUTTON PNG "deleteButton.png"
+IDR_DELETE_BUTTON_PRESSED PNG "deleteButtonPressed.png"
+IDR_ZOOM_IN_CURSOR PNG "zoomInCursor.png"
+IDR_ZOOM_OUT_CURSOR PNG "zoomOutCursor.png"
+IDR_VERTICAL_TEXT_CURSOR PNG "verticalTextCursor.png"
+
diff --git a/WebKit/win/WebKit.vcproj/WebKit.sln b/WebKit/win/WebKit.vcproj/WebKit.sln
new file mode 100644
index 0000000..1e521a5
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.sln
@@ -0,0 +1,193 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit", "WebKit.vcproj", "{0662A8A9-82A3-4638-97D8-EC425D8D87C9}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406} = {91762BE2-87EF-4F5A-A480-48B90EB3F406}
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
+ {B8437A41-67BC-4769-9452-45203827F821} = {B8437A41-67BC-4769-9452-45203827F821}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitGUID", "WebKitGUID.vcproj", "{B8437A41-67BC-4769-9452-45203827F821}"
+ ProjectSection(ProjectDependencies) = postProject
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406} = {91762BE2-87EF-4F5A-A480-48B90EB3F406}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Interfaces", "Interfaces.vcproj", "{91762BE2-87EF-4F5A-A480-48B90EB3F406}"
+ ProjectSection(ProjectDependencies) = postProject
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166} = {62C897BE-E207-4BC4-B37D-6F9F9116F166}
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebCore", "..\..\..\WebCore\WebCore.vcproj\WebCore.vcproj", "{1C16337B-ACF3-4D03-AA90-851C5B5EADA6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B} = {0A324352-B3B6-496C-9E5B-4C7E923E628B}
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325} = {E498CA9D-3BD2-4D52-8E37-C8DC76526325}
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTree", "..\..\..\WebKitTools\DumpRenderTree\win\DumpRenderTree.vcproj", "{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9} = {0662A8A9-82A3-4638-97D8-EC425D8D87C9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestNetscapePlugin", "..\..\..\WebKitTools\DumpRenderTree\win\TestNetscapePlugin\TestNetscapePlugin.vcproj", "{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9} = {0662A8A9-82A3-4638-97D8-EC425D8D87C9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testkjs", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\testkjs\testkjs.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindSafari", "..\..\..\WebKitTools\FindSafari\FindSafari.vcproj", "{DA31DA52-6675-48D4-89E0-333A7144397C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageDiff", "..\..\..\WebKitTools\DumpRenderTree\win\ImageDiff.vcproj", "{59CC0547-70AC-499C-9B19-EC01C6F61137}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Drosera", "..\..\..\WebKitTools\Drosera\win\Drosera.vcproj\Drosera.vcproj", "{91671475-2114-4D8F-A051-9A1B270F6467}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9} = {0662A8A9-82A3-4638-97D8-EC425D8D87C9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCoreGenerated", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\JavaScriptCore\JavaScriptCoreGenerated.vcproj", "{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InterfacesGenerated", "InterfacesGenerated.vcproj", "{62C897BE-E207-4BC4-B37D-6F9F9116F166}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6} = {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebCoreGenerated", "..\..\..\WebCore\WebCore.vcproj\WebCoreGenerated.vcproj", "{0A324352-B3B6-496C-9E5B-4C7E923E628B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QTMovieWin", "..\..\..\WebCore\WebCore.vcproj\QTMovieWin.vcproj", "{E498CA9D-3BD2-4D52-8E37-C8DC76526325}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug_Internal|Win32 = Debug_Internal|Win32
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug|Win32.Build.0 = Debug|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Release|Win32.ActiveCfg = Release|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Release|Win32.Build.0 = Release|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug|Win32.Build.0 = Debug|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Release|Win32.ActiveCfg = Release|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Release|Win32.Build.0 = Release|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug_Internal|Win32.Build.0 = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug|Win32.ActiveCfg = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug|Win32.Build.0 = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Release|Win32.ActiveCfg = Release|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Release|Win32.Build.0 = Release|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Debug|Win32.Build.0 = Debug|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Release|Win32.ActiveCfg = Release|Win32
+ {1C16337B-ACF3-4D03-AA90-851C5B5EADA6}.Release|Win32.Build.0 = Release|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Debug|Win32.Build.0 = Debug|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.ActiveCfg = Release|Win32
+ {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.Build.0 = Release|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.Build.0 = Debug|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.ActiveCfg = Release|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.Build.0 = Release|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.Build.0 = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.ActiveCfg = Release|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.Build.0 = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.Build.0 = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.ActiveCfg = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.Build.0 = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_Internal|Win32.Build.0 = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.Build.0 = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.ActiveCfg = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.Build.0 = Debug|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug_Internal|Win32.Build.0 = Debug|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.ActiveCfg = Debug|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Debug|Win32.Build.0 = Debug|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.ActiveCfg = Release|Win32
+ {59CC0547-70AC-499C-9B19-EC01C6F61137}.Release|Win32.Build.0 = Release|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Debug|Win32.ActiveCfg = Debug|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Debug|Win32.Build.0 = Debug|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Release|Win32.ActiveCfg = Release|Win32
+ {91671475-2114-4D8F-A051-9A1B270F6467}.Release|Win32.Build.0 = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_Internal|Win32.ActiveCfg = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_Internal|Win32.Build.0 = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.ActiveCfg = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.Build.0 = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.ActiveCfg = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug_Internal|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug_Internal|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Release|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Release|Win32.Build.0 = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Debug_Internal|Win32.ActiveCfg = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Debug_Internal|Win32.Build.0 = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Debug|Win32.ActiveCfg = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Debug|Win32.Build.0 = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Release|Win32.ActiveCfg = Release|Win32
+ {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Release|Win32.Build.0 = Release|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug|Win32.Build.0 = Debug|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.ActiveCfg = Release|Win32
+ {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/WebKit/win/WebKit.vcproj/WebKit.submit.sln b/WebKit/win/WebKit.vcproj/WebKit.submit.sln
new file mode 100644
index 0000000..b6c785c
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.submit.sln
@@ -0,0 +1,57 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKit", "WebKit.vcproj", "{0662A8A9-82A3-4638-97D8-EC425D8D87C9}"
+ ProjectSection(ProjectDependencies) = postProject
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406} = {91762BE2-87EF-4F5A-A480-48B90EB3F406}
+ {B8437A41-67BC-4769-9452-45203827F821} = {B8437A41-67BC-4769-9452-45203827F821}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitGUID", "WebKitGUID.vcproj", "{B8437A41-67BC-4769-9452-45203827F821}"
+ ProjectSection(ProjectDependencies) = postProject
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406} = {91762BE2-87EF-4F5A-A480-48B90EB3F406}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Interfaces", "Interfaces.vcproj", "{91762BE2-87EF-4F5A-A480-48B90EB3F406}"
+ ProjectSection(ProjectDependencies) = postProject
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166} = {62C897BE-E207-4BC4-B37D-6F9F9116F166}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InterfacesGenerated", "InterfacesGenerated.vcproj", "{62C897BE-E207-4BC4-B37D-6F9F9116F166}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug_Internal|Win32 = Debug_Internal|Win32
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Debug|Win32.Build.0 = Debug|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Release|Win32.ActiveCfg = Release|Win32
+ {0662A8A9-82A3-4638-97D8-EC425D8D87C9}.Release|Win32.Build.0 = Release|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Debug|Win32.Build.0 = Debug|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Release|Win32.ActiveCfg = Release|Win32
+ {B8437A41-67BC-4769-9452-45203827F821}.Release|Win32.Build.0 = Release|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug_Internal|Win32.Build.0 = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug|Win32.ActiveCfg = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Debug|Win32.Build.0 = Debug|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Release|Win32.ActiveCfg = Release|Win32
+ {91762BE2-87EF-4F5A-A480-48B90EB3F406}.Release|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug_Internal|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug_Internal|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Debug|Win32.Build.0 = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Release|Win32.ActiveCfg = Release|Win32
+ {62C897BE-E207-4BC4-B37D-6F9F9116F166}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj
new file mode 100644
index 0000000..7d55855
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj
@@ -0,0 +1,1705 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WebKit"
+ ProjectGUID="{0662A8A9-82A3-4638-97D8-EC425D8D87C9}"
+ RootNamespace="WebKit"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\include\JavaScriptCore\JavaScriptCore\*&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include\WebKit&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)\..\WebCoreSupport&quot;;&quot;$(IntDir)\include&quot;;&quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_CROSS_DOCUMENT_MESSAGING;ENABLE_XSLT;ENABLE_XPATH;ENABLE_SVG;FRAMEWORK_NAME=WebKit"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="WebKitPrefix.h"
+ ForcedIncludeFiles="WebKitPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
+ AdditionalLibraryDirectories=""
+ ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
+ DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebLocalizableStrings.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebKitGraphics.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForEachCoClass.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ProgIDMacros.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\WebCore\npfunctions.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npapi.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npruntime.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\$(ProjectName).resources\*&quot; &quot;$(OutDir)\$(ProjectName).resources&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\English.lproj\Localizable.strings&quot; &quot;$(OutDir)\WebKit.resources\en.lproj\&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\include\JavaScriptCore\JavaScriptCore\*&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include\WebKit&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)\..\WebCoreSupport&quot;;&quot;$(IntDir)\include&quot;;&quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_CROSS_DOCUMENT_MESSAGING;ENABLE_XSLT;ENABLE_XPATH;ENABLE_SVG;FRAMEWORK_NAME=WebKit"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="WebKitPrefix.h"
+ ForcedIncludeFiles="WebKitPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
+ AdditionalLibraryDirectories=""
+ ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
+ DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebLocalizableStrings.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebKitGraphics.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForEachCoClass.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ProgIDMacros.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\WebCore\npfunctions.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npapi.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npruntime.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\$(ProjectName).resources\*&quot; &quot;$(OutDir)\$(ProjectName).resources&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\English.lproj\Localizable.strings&quot; &quot;$(OutDir)\WebKit.resources\en.lproj\&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Internal|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;touch &quot;$(WebKitOutputDir)\tmp.cpp&quot;&#x0D;&#x0A;cl /analyze /nologo /c &quot;$(WebKitOutputDir)\tmp.cpp&quot; 2&gt;&amp;1 | findstr D9040&#x0D;&#x0A;if ERRORLEVEL 0 set EnablePREfast=&quot;false&quot; else set EnablePREfast=&quot;true&quot;&#x0D;&#x0A;if ERRORLEVEL 0 set AnalyzeWithLargeStack=&quot;&quot; AnalyzeWithLargeStack=&quot;/analyze:65536&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitLibrariesDir)\include\JavaScriptCore\JavaScriptCore\*&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;bash &quot;$(WebKitLibrariesDir)\tools\scripts\auto-version.sh&quot; &quot;$(IntDir)&quot;&#x0D;&#x0A;"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\include\WebKit&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\WebCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\Include\icu&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(ProjectDir)\..&quot;;&quot;$(ProjectDir)&quot;;&quot;$(ProjectDir)\..\WebCoreSupport&quot;;&quot;$(IntDir)\include&quot;;&quot;$(WebKitOutputDir)\obj\WebKit\DerivedSources&quot;"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_CROSS_DOCUMENT_MESSAGING;ENABLE_XSLT;ENABLE_XPATH;ENABLE_SVG;FRAMEWORK_NAME=WebKit"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="WebKitPrefix.h"
+ Detect64BitPortabilityProblems="true"
+ ForcedIncludeFiles="WebKitPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
+ AdditionalLibraryDirectories=""
+ ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
+ DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebLocalizableStrings.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\WebKitGraphics.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForEachCoClass.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ProgIDMacros.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\WebCore\npfunctions.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npapi.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\include\JavaScriptCore\npruntime.h&quot; &quot;$(WebKitOutputDir)\include\WebKit&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\$(ProjectName).resources\*&quot; &quot;$(OutDir)\$(ProjectName).resources&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(OutDir)\WebKit.resources\en.lproj&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\English.lproj\Localizable.strings&quot; &quot;$(OutDir)\WebKit.resources\en.lproj\&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\MarshallingHelpers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreLocalizedStrings.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitClassFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitDLL.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitSystemBits.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNodeHighlight.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\autoversion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\CFDictionaryPropertyBag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\CodeAnalysisConfig.h"
+ >
+ </File>
+ <File
+ RelativePath="..\COMEnumVariant.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DefaultDownloadDelegate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DefaultPolicyDelegate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMCoreClasses.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMCSSClasses.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMEventsClasses.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMHTMLClasses.h"
+ >
+ </File>
+ <File
+ RelativePath="..\ForEachCoClass.h"
+ >
+ </File>
+ <File
+ RelativePath="..\HTTPHeaderPropertyBag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\MarshallingHelpers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\MemoryStream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\ProgIDMacros.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebActionPropertyBag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebBackForwardList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCachedPagePlatformData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDatabaseManager.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDataSource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDocumentLoader.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDownload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDropSource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebElementPropertyBag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebError.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebFramePolicyListener.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHistory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHistoryItem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHTMLRepresentation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebIconDatabase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebInspector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebJavaScriptCollector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitClassFactory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitDLL.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitGraphics.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitLogging.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitStatistics.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitStatisticsPrivate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitSystemBits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebLocalizableStrings.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebMutableURLRequest.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNodeHighlight.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNotification.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNotificationCenter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebPreferenceKeysPrivate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebPreferences.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebResource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptCallFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptDebugger.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptDebugServer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScrollBar.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebSecurityOrigin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebTextRenderer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLAuthenticationChallenge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLAuthenticationChallengeSender.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLCredential.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLProtectionSpace.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLResponse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebView.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Classes"
+ >
+ <File
+ RelativePath="..\CFDictionaryPropertyBag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DefaultDownloadDelegate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DefaultPolicyDelegate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMCoreClasses.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMCSSClasses.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMEventsClasses.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMHTMLClasses.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\ForEachCoClass.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\HTTPHeaderPropertyBag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\MemoryStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebActionPropertyBag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebBackForwardList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCache.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDatabaseManager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDataSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDocumentLoader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDownload.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebDropSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebElementPropertyBag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebError.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebFramePolicyListener.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHistory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHistoryItem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebHTMLRepresentation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebIconDatabase.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebInspector.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebJavaScriptCollector.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitLogging.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitStatistics.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebMutableURLRequest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNotification.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebNotificationCenter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebPreferences.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebResource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptCallFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptDebugger.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptDebugServer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScriptObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebScrollBar.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebSecurityOrigin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebTextRenderer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLAuthenticationChallenge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLAuthenticationChallengeSender.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLCredential.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLProtectionSpace.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebURLResponse.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebView.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resources"
+ >
+ <File
+ RelativePath=".\missingImage.png"
+ >
+ </File>
+ <File
+ RelativePath=".\nullplugin.png"
+ >
+ </File>
+ <File
+ RelativePath=".\textAreaResizeCorner.png"
+ >
+ </File>
+ <File
+ RelativePath=".\verticalTextCursor.png"
+ >
+ </File>
+ <File
+ RelativePath=".\WebKit.rc"
+ >
+ </File>
+ <File
+ RelativePath=".\WebKit.tlb"
+ >
+ </File>
+ <File
+ RelativePath=".\zoomInCursor.png"
+ >
+ </File>
+ <File
+ RelativePath=".\zoomOutCursor.png"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="API"
+ >
+ <File
+ RelativePath=".\WebKit.def"
+ >
+ </File>
+ <File
+ RelativePath=".\WebKit_debug.def"
+ >
+ </File>
+ <File
+ RelativePath="..\WebKitGraphics.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebLocalizableStrings.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="DOM"
+ >
+ <File
+ RelativePath="..\DOMCreateInstance.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DOMCreateInstance.h"
+ >
+ </File>
+ <File
+ RelativePath="..\GEN_DOMObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\GEN_DOMObject.h"
+ >
+ </File>
+ <Filter
+ Name="DerivedSources"
+ >
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMAttr.cpp"
+ >
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ShowIncludes="false"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMAttr.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCDATASection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCDATASection.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCharacterData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCharacterData.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMComment.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMComment.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCounter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCounter.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSCharsetRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSCharsetRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSFontFaceRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSFontFaceRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSImportRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSImportRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSMediaRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSMediaRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSPageRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSPageRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSPrimitiveValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSPrimitiveValue.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSRuleList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSRuleList.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleDeclaration.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleDeclaration.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleSheet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSStyleSheet.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSUnknownRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSUnknownRule.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSValue.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSValueList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMCSSValueList.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocument.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocumentFragment.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocumentFragment.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocumentType.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDocumentType.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDOMImplementation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMDOMImplementation.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEntity.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEntity.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEntityReference.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEntityReference.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEvent.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEventListener.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEventListener.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEventTarget.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAnchorElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAnchorElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAppletElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAppletElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAreaElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLAreaElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBaseElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBaseElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBaseFontElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBaseFontElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBlockquoteElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBlockquoteElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBodyElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBodyElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBRElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLBRElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLButtonElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLButtonElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLCollection.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDirectoryElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDirectoryElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDivElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDivElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDListElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDListElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLDocument.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLEmbedElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLEmbedElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFieldSetElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFieldSetElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFontElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFontElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFormElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFormElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFrameElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFrameElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFrameSetElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLFrameSetElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHeadElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHeadElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHeadingElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHeadingElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHRElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHRElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHtmlElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLHtmlElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLIFrameElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLIFrameElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLImageElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLImageElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLInputElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLInputElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLIsIndexElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLIsIndexElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLabelElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLabelElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLegendElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLegendElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLIElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLIElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLinkElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLLinkElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMapElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMapElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMarqueeElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMarqueeElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMenuElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMenuElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMetaElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLMetaElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLModElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLModElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLObjectElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLObjectElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOListElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOListElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptGroupElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptGroupElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptionElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptionElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptionsCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLOptionsCollection.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLParagraphElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLParagraphElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLParamElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLParamElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLPreElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLPreElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLQuoteElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLQuoteElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLScriptElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLScriptElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLSelectElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLSelectElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLStyleElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLStyleElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableCaptionElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableCaptionElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableCellElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableCellElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableColElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableColElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableRowElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableRowElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableSectionElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTableSectionElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTextAreaElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTextAreaElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTitleElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLTitleElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLUListElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMHTMLUListElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMMediaList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMMediaList.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNamedNodeMap.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNamedNodeMap.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNode.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNode.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNodeList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNodeList.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNotation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMNotation.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMProcessingInstruction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMProcessingInstruction.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMRect.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMRect.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMStyleSheet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMStyleSheet.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMStyleSheetList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMStyleSheetList.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMText.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMText.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="WebCoreSupport"
+ >
+ <File
+ RelativePath="..\WebCoreSupport\FormValuesPropertyBag.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\FormValuesPropertyBag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebChromeClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebChromeClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebContextMenuClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebContextMenuClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebDragClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebDragClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebEditorClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebEditorClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebFrameLoaderClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebFrameLoaderClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebInspectorClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebInspectorClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebInspectorDelegate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebInspectorDelegate.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="..\WebKitPrefix.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ PrecompiledHeaderThrough="WebKitPrefix.h"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\WebKitPrefix.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj b/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj
new file mode 100644
index 0000000..f9b4e30
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WebKitGUID"
+ ProjectGUID="{B8437A41-67BC-4769-9452-45203827F821}"
+ RootNamespace="WebKitGUID"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ AdditionalIncludeDirectories="Interfaces"
+ OutputDirectory="Debug"
+ HeaderFileName="$(InputName).h"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(WebKitOutputDir)\$(ConfigurationName)\WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKITGUID_EXPORTS"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ AdditionalIncludeDirectories="Interfaces"
+ OutputDirectory="Release"
+ HeaderFileName="$(InputName).h"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(WebKitOutputDir)\$(ConfigurationName)\WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKITGUID_EXPORTS"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Internal|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ AdditionalIncludeDirectories="Interfaces"
+ OutputDirectory="Debug"
+ HeaderFileName="$(InputName).h"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(WebKitOutputDir)\$(ConfigurationName)\WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKITGUID_EXPORTS"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\WebKit\Interfaces\WebKit_i.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKit/win/WebKit.vcproj/WebKit_debug.def b/WebKit/win/WebKit.vcproj/WebKit_debug.def
new file mode 100644
index 0000000..ff5c0ea
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/WebKit_debug.def
@@ -0,0 +1,111 @@
+LIBRARY "WebKit_debug"
+
+EXPORTS
+ DllGetClassObject PRIVATE
+ DllCanUnloadNow PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
+ RunAsLocalServer PRIVATE
+ LocalServerDidDie PRIVATE
+ JSCheckScriptSyntax
+ JSClassCreate
+ JSClassRelease
+ JSClassRetain
+ JSContextGetGlobalObject
+ JSEvaluateScript
+ JSGarbageCollect
+ JSGlobalContextCreate
+ JSGlobalContextRelease
+ JSGlobalContextRetain
+ JSObjectCallAsConstructor
+ JSObjectCallAsFunction
+ JSObjectCopyPropertyNames
+ JSObjectDeleteProperty
+ JSObjectGetPrivate
+ JSObjectGetProperty
+ JSObjectGetPropertyAtIndex
+ JSObjectGetPrototype
+ JSObjectHasProperty
+ JSObjectIsConstructor
+ JSObjectIsFunction
+ JSObjectMake
+ JSObjectMakeConstructor
+ JSObjectMakeFunction
+ JSObjectMakeFunction
+ JSObjectMakeFunctionWithCallback
+ JSObjectSetPrivate
+ JSObjectSetProperty
+ JSObjectSetPropertyAtIndex
+ JSObjectSetPrototype
+ JSPropertyNameAccumulatorAddName
+ JSPropertyNameArrayGetCount
+ JSPropertyNameArrayGetNameAtIndex
+ JSPropertyNameArrayRelease
+ JSPropertyNameArrayRetain
+ JSStringCopyBSTR
+ JSStringCopyCFString
+ JSStringCreateWithBSTR
+ JSStringCreateWithCFString
+ JSStringCreateWithCharacters
+ JSStringCreateWithUTF8CString
+ JSStringGetCharactersPtr
+ JSStringGetLength
+ JSStringGetMaximumUTF8CStringSize
+ JSStringGetUTF8CString
+ JSStringIsEqual
+ JSStringIsEqualToUTF8CString
+ JSStringRelease
+ JSStringRetain
+ JSValueGetType
+ JSValueIsBoolean
+ JSValueIsEqual
+ JSValueIsInstanceOfConstructor
+ JSValueIsNull
+ JSValueIsNumber
+ JSValueIsObject
+ JSValueIsObjectOfClass
+ JSValueIsStrictEqual
+ JSValueIsString
+ JSValueIsUndefined
+ JSValueMakeBoolean
+ JSValueMakeNull
+ JSValueMakeNumber
+ JSValueMakeString
+ JSValueMakeUndefined
+ JSValueProtect
+ JSValueToBoolean
+ JSValueToNumber
+ JSValueToObject
+ JSValueToStringCopy
+ JSValueUnprotect
+; KJS_JSCreateNativeJSObject
+; KJS_JSObject_JSFinalize
+; KJS_JSObject_JSObjectCall
+; KJS_JSObject_JSObjectEval
+; KJS_JSObject_JSObjectGetMember
+; KJS_JSObject_JSObjectGetSlot
+; KJS_JSObject_JSObjectRemoveMember
+; KJS_JSObject_JSObjectSetMember
+; KJS_JSObject_JSObjectSetSlot
+; KJS_JSObject_JSObjectToString
+ setUseOpenSourceWebKit
+ progIDForClass
+ WebLocalizedStringUTF8
+ WebLocalizedLPCTSTRUTF8
+ DrawTextAtPoint
+ WebDrawText
+ FontMetrics
+ TextFloatWidth
+ CenterTruncateStringToWidth
+ RightTruncateStringToWidth
+ ?fastMalloc@WTF@@YAPAXI@Z
+ ?fastZeroedMalloc@WTF@@YAPAXI@Z
+ ?fastFree@WTF@@YAXPAX@Z
+ ?fastCalloc@WTF@@YAPAXII@Z
+ WTFReportAssertionFailure
+ WTFReportError
+
+ ; These functions are deprecated
+ WebLocalizedString
+ WebLocalizedLPCTSTR
+ SetWebLocalizedStringMainBundle
diff --git a/WebKit/win/WebKit.vcproj/build-generated-files.sh b/WebKit/win/WebKit.vcproj/build-generated-files.sh
new file mode 100644
index 0000000..ac26fd2
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/build-generated-files.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/bash
+
+# Copyright (C) 2007 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.
+# 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+
+NUMCPUPATH="../../../WebKitTools/Scripts/num-cpus"
+if [ -x $NUMCPUPATH ]; then
+ NUMCPUS=`$NUMCPUPATH`
+else
+ NUMCPUS=1
+fi
+
+XSRCROOT="`pwd`/.."
+XSRCROOT=`realpath "$XSRCROOT"`
+# Do a little dance to get the path into 8.3 form to make it safe for gnu make
+# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
+XSRCROOT=`cygpath -m -s "$XSRCROOT"`
+XSRCROOT=`cygpath -u "$XSRCROOT"`
+export XSRCROOT
+export SOURCE_ROOT=$XSRCROOT
+
+XDSTROOT="$1"
+export XDSTROOT
+# Do a little dance to get the path into 8.3 form to make it safe for gnu make
+# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
+XDSTROOT=`cygpath -m -s "$XDSTROOT"`
+XDSTROOT=`cygpath -u "$XDSTROOT"`
+export XDSTROOT
+
+export BUILT_PRODUCTS_DIR="$XDSTROOT/obj/WebKit"
+
+mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources"
+cd "${BUILT_PRODUCTS_DIR}/DerivedSources"
+
+export WEBKIT=$XSRCROOT
+export WEBKIT_OUTPUT=$XDSTROOT
+
+export FEATURE_DEFINES="ENABLE_XPATH ENABLE_SVG"
+make -f "$WEBKIT/WebKit.vcproj/DerivedSources.make" -j ${NUMCPUS} || exit 1
diff --git a/WebKit/win/WebKit.vcproj/deleteButton.png b/WebKit/win/WebKit.vcproj/deleteButton.png
new file mode 100644
index 0000000..8f1b881
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/deleteButton.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/deleteButtonPressed.png b/WebKit/win/WebKit.vcproj/deleteButtonPressed.png
new file mode 100644
index 0000000..77d31ca
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/deleteButtonPressed.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/missingImage.png b/WebKit/win/WebKit.vcproj/missingImage.png
new file mode 100644
index 0000000..f49a98d
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/missingImage.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/nullplugin.png b/WebKit/win/WebKit.vcproj/nullplugin.png
new file mode 100644
index 0000000..a4195f6
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/nullplugin.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/resource.h b/WebKit/win/WebKit.vcproj/resource.h
new file mode 100644
index 0000000..696dad8
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/resource.h
@@ -0,0 +1,25 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by WebKit.rc
+//
+#define IDR_WEBKIT 1
+#define IDR_RESIZE_CORNER 2
+#define IDR_MISSING_IMAGE 3
+#define IDR_URL_ICON 4
+#define IDR_NULL_PLUGIN 5
+#define IDR_ZOOM_IN_CURSOR 6
+#define IDR_ZOOM_OUT_CURSOR 7
+#define IDR_VERTICAL_TEXT_CURSOR 8
+
+#define BUILD_NUMBER 1
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 6
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/WebKit/win/WebKit.vcproj/textAreaResizeCorner.png b/WebKit/win/WebKit.vcproj/textAreaResizeCorner.png
new file mode 100644
index 0000000..023615e
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/textAreaResizeCorner.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/urlIcon.png b/WebKit/win/WebKit.vcproj/urlIcon.png
new file mode 100755
index 0000000..53cb354
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/urlIcon.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/verticalTextCursor.png b/WebKit/win/WebKit.vcproj/verticalTextCursor.png
new file mode 100644
index 0000000..0f2877c
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/verticalTextCursor.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/zoomInCursor.png b/WebKit/win/WebKit.vcproj/zoomInCursor.png
new file mode 100644
index 0000000..feec9bc
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/zoomInCursor.png
Binary files differ
diff --git a/WebKit/win/WebKit.vcproj/zoomOutCursor.png b/WebKit/win/WebKit.vcproj/zoomOutCursor.png
new file mode 100644
index 0000000..f4a954e
--- /dev/null
+++ b/WebKit/win/WebKit.vcproj/zoomOutCursor.png
Binary files differ
diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp
new file mode 100644
index 0000000..babff03
--- /dev/null
+++ b/WebKit/win/WebKitClassFactory.cpp
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebKitClassFactory.h"
+
+#include "ForEachCoClass.h"
+#include "CFDictionaryPropertyBag.h"
+#include "WebCache.h"
+#include "WebDatabaseManager.h"
+#include "WebDownload.h"
+#include "WebError.h"
+#include "WebFrame.h"
+#include "WebHistory.h"
+#include "WebHistoryItem.h"
+#include "WebIconDatabase.h"
+#include "WebJavaScriptCollector.h"
+#include "WebKit.h"
+#include "WebScrollBar.h"
+#include "WebKitStatistics.h"
+#include "WebMutableURLRequest.h"
+#include "WebNotificationCenter.h"
+#include "WebPreferences.h"
+#include "WebTextRenderer.h"
+#include "WebURLCredential.h"
+#include "WebURLProtectionSpace.h"
+#include "WebURLResponse.h"
+#include "WebScriptDebugServer.h"
+#include "WebView.h"
+#pragma warning(push, 0)
+#include <WebCore/FontDatabase.h>
+#include <WebCore/SoftLinking.h>
+#pragma warning(pop)
+
+// WebKitClassFactory ---------------------------------------------------------
+
+#if !defined(NDEBUG) && defined(USE_DEBUG_SAFARI_THEME)
+SOFT_LINK_DEBUG_LIBRARY(SafariTheme)
+#else
+SOFT_LINK_LIBRARY(SafariTheme)
+#endif
+
+SOFT_LINK(SafariTheme, STInitialize, void, APIENTRY, (), ())
+
+WebKitClassFactory::WebKitClassFactory(CLSID targetClass)
+: m_targetClass(targetClass)
+, m_refCount(0)
+{
+ static bool didInitializeSafariTheme;
+ if (!didInitializeSafariTheme) {
+ if (SafariThemeLibrary())
+ STInitialize();
+ didInitializeSafariTheme = true;
+ }
+
+ WebCore::populateFontDatabase();
+
+ gClassCount++;
+}
+
+WebKitClassFactory::~WebKitClassFactory()
+{
+ gClassCount--;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebKitClassFactory::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IClassFactory))
+ *ppvObject = static_cast<IClassFactory*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebKitClassFactory::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebKitClassFactory::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef && !gLockCount)
+ delete(this);
+
+ return newRef;
+}
+
+// IClassFactory --------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject)
+{
+ IUnknown* unknown = 0;
+ *ppvObject = 0;
+
+ if (pUnkOuter)
+ return CLASS_E_NOAGGREGATION;
+
+#define INITIALIZE_IF_CLASS(cls) \
+ if (IsEqualGUID(m_targetClass, CLSID_##cls)) \
+ unknown = static_cast<I##cls*>(cls::createInstance()); \
+ else \
+ // end of macro
+
+ // These #defines are needed to appease the INITIALIZE_IF_CLASS macro.
+ // There is no ICFDictionaryPropertyBag, we use IPropertyBag instead.
+#define ICFDictionaryPropertyBag IPropertyBag
+ // There is no IWebScrollBar, we only have IWebScrollBarPrivate.
+#define IWebScrollBar IWebScrollBarPrivate
+ // There is no class called WebURLRequest -- WebMutableURLRequest implements it for us.
+#define WebURLRequest WebMutableURLRequest
+
+ FOR_EACH_COCLASS(INITIALIZE_IF_CLASS)
+ // This is the final else case
+ return CLASS_E_CLASSNOTAVAILABLE;
+
+#undef ICFDictionaryPropertyBag
+#undef IWebScrollBar
+#undef WebURLRequest
+#undef INITIALIZE_IF_CLASS
+
+ if (!unknown)
+ return E_OUTOFMEMORY;
+
+ HRESULT hr = unknown->QueryInterface(riid, ppvObject);
+ if (FAILED(hr))
+ delete unknown;
+ else
+ unknown->Release(); // both createInstance() and QueryInterface() added refs
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitClassFactory::LockServer(BOOL fLock)
+{
+ if (fLock)
+ gLockCount++;
+ else
+ gLockCount--;
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebKitClassFactory.h b/WebKit/win/WebKitClassFactory.h
new file mode 100644
index 0000000..90a43c2
--- /dev/null
+++ b/WebKit/win/WebKitClassFactory.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitClassFactory_H
+#define WebKitClassFactory_H
+
+class WebKitClassFactory : public IClassFactory
+{
+public:
+ WebKitClassFactory(CLSID targetClass);
+ ~WebKitClassFactory();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IClassFactory
+ virtual HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject);
+ virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock);
+
+protected:
+ ULONG m_refCount;
+ CLSID m_targetClass;
+};
+
+#endif
diff --git a/WebKit/win/WebKitDLL.cpp b/WebKit/win/WebKitDLL.cpp
new file mode 100644
index 0000000..51ad33b
--- /dev/null
+++ b/WebKit/win/WebKitDLL.cpp
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+
+#include "autoversion.h"
+#include "ForEachCoClass.h"
+#include "ProgIDMacros.h"
+#include "resource.h"
+#include "WebKit.h"
+#include "WebKitClassFactory.h"
+#include "WebScriptDebugServer.h"
+#pragma warning( push, 0 )
+#include <WebCore/COMPtr.h>
+#include <WebCore/IconDatabase.h>
+#include <WebCore/Page.h>
+#include <WebCore/SharedBuffer.h>
+#include <WebCore/Widget.h>
+#include <wtf/Vector.h>
+#pragma warning(pop)
+#include <tchar.h>
+#include <olectl.h>
+
+ULONG gLockCount;
+ULONG gClassCount;
+HINSTANCE gInstance;
+
+#define CLSID_FOR_CLASS(cls) CLSID_##cls,
+static CLSID gRegCLSIDs[] = {
+ FOR_EACH_COCLASS(CLSID_FOR_CLASS)
+};
+#undef CLSID_FOR_CLASS
+
+void shutDownWebKit()
+{
+ WebCore::iconDatabase()->close();
+}
+
+STDAPI_(BOOL) DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
+{
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ gLockCount = gClassCount = 0;
+ gInstance = hModule;
+ WebCore::Page::setInstanceHandle(hModule);
+ return TRUE;
+
+ case DLL_PROCESS_DETACH:
+ shutDownWebKit();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ }
+ return FALSE;
+}
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ bool found = false;
+ for (int i = 0; i < ARRAYSIZE(gRegCLSIDs); i++) {
+ if (IsEqualGUID(rclsid, gRegCLSIDs[i])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return E_FAIL;
+
+ if (!IsEqualGUID(riid, IID_IUnknown) && !IsEqualGUID(riid, IID_IClassFactory))
+ return E_NOINTERFACE;
+
+ WebKitClassFactory* factory = new WebKitClassFactory(rclsid);
+ *ppv = reinterpret_cast<LPVOID>(factory);
+ if (!factory)
+ return E_OUTOFMEMORY;
+
+ factory->AddRef();
+ return S_OK;
+}
+
+STDAPI DllCanUnloadNow(void)
+{
+ if (!gClassCount && !gLockCount)
+ return S_OK;
+
+ return S_FALSE;
+}
+
+#if __PRODUCTION__
+#define VERSION_INDEPENDENT_PROGID(className) VERSION_INDEPENDENT_PRODUCTION_PROGID(className)
+#else
+#define VERSION_INDEPENDENT_PROGID(className) VERSION_INDEPENDENT_OPENSOURCE_PROGID(className)
+#endif
+#define CURRENT_VERSIONED_PROGID(className) VERSIONED_PROGID(VERSION_INDEPENDENT_PROGID(className), CURRENT_PROGID_VERSION)
+#define VERSIONED_303_PROGID(className) VERSIONED_PROGID(VERSION_INDEPENDENT_PROGID(className), 3)
+
+// FIXME: The last line of this macro only here for the benefit of Safari 3.0.3. Once a newer version
+// is released, the last line should be removed and gSlotsPerEntry should be decremented by 1.
+//key value name value }
+#define KEYS_FOR_CLASS(cls) \
+{ TEXT("CLSID\\{########-####-####-####-############}"), 0, TEXT(#cls) }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\InprocServer32"), 0, (LPCTSTR)-1 }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\InprocServer32"), TEXT("ThreadingModel"), TEXT("Apartment") }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\ProgID"), 0, CURRENT_VERSIONED_PROGID(cls) }, \
+{ CURRENT_VERSIONED_PROGID(cls), 0, TEXT(#cls) }, \
+{ CURRENT_VERSIONED_PROGID(cls) TEXT("\\CLSID"), 0, TEXT("{########-####-####-####-############}") }, \
+{ TEXT("CLSID\\{########-####-####-####-############}\\VersionIndependentProgID"), 0, VERSION_INDEPENDENT_PROGID(cls) }, \
+{ VERSION_INDEPENDENT_PROGID(cls), 0, TEXT(#cls) }, \
+{ VERSION_INDEPENDENT_PROGID(cls) TEXT("\\CLSID"), 0, TEXT("{########-####-####-####-############}") }, \
+{ VERSION_INDEPENDENT_PROGID(cls) TEXT("\\CurVer"), 0, STRINGIFIED_VERSION(CURRENT_PROGID_VERSION) }, \
+{ VERSIONED_303_PROGID(cls), 0, TEXT(#cls) }, \
+{ VERSIONED_303_PROGID(cls) TEXT("\\CLSID"), 0, TEXT("{########-####-####-####-############}") }, \
+// end of macro
+
+static const int gSlotsPerEntry = 12;
+static LPCTSTR gRegTable[][3] = {
+ FOR_EACH_COCLASS(KEYS_FOR_CLASS)
+};
+#undef KEYS_FOR_CLASS
+
+static void substituteGUID(LPTSTR str, const UUID* guid)
+{
+ if (!guid || !str)
+ return;
+
+ TCHAR uuidString[40];
+ _stprintf_s(uuidString, ARRAYSIZE(uuidString), TEXT("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"), guid->Data1, guid->Data2, guid->Data3,
+ guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+
+ LPCTSTR guidPattern = TEXT("########-####-####-####-############");
+ size_t patternLength = _tcslen(guidPattern);
+ size_t strLength = _tcslen(str);
+ LPTSTR guidSubStr = str;
+ while (strLength) {
+ guidSubStr = _tcsstr(guidSubStr, guidPattern);
+ if (!guidSubStr)
+ break;
+ _tcsncpy(guidSubStr, uuidString, patternLength);
+ guidSubStr += patternLength;
+ strLength -= (guidSubStr - str);
+ }
+}
+
+STDAPI DllUnregisterServer(void)
+{
+ HRESULT hr = S_OK;
+ HKEY userClasses;
+
+#if __PRODUCTION__
+ const GUID libID = LIBID_WebKit;
+#else
+ const GUID libID = LIBID_OpenSourceWebKit;
+#endif
+
+ typedef HRESULT (WINAPI *UnRegisterTypeLibForUserPtr)(REFGUID, unsigned short, unsigned short, LCID, SYSKIND);
+ if (UnRegisterTypeLibForUserPtr unRegisterTypeLibForUser = reinterpret_cast<UnRegisterTypeLibForUserPtr>(GetProcAddress(GetModuleHandle(TEXT("oleaut32.dll")), "UnRegisterTypeLibForUser")))
+ unRegisterTypeLibForUser(libID, __BUILD_NUMBER_MAJOR__, __BUILD_NUMBER_MINOR__, 0, SYS_WIN32);
+ else
+ UnRegisterTypeLib(libID, __BUILD_NUMBER_MAJOR__, __BUILD_NUMBER_MINOR__, 0, SYS_WIN32);
+
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\CLASSES"), 0, KEY_WRITE, &userClasses) != ERROR_SUCCESS)
+ userClasses = 0;
+
+ int nEntries = ARRAYSIZE(gRegTable);
+ for (int i = nEntries - 1; i >= 0; i--) {
+ LPTSTR pszKeyName = _tcsdup(gRegTable[i][0]);
+ if (pszKeyName) {
+ substituteGUID(pszKeyName, &gRegCLSIDs[i/gSlotsPerEntry]);
+ RegDeleteKey(HKEY_CLASSES_ROOT, pszKeyName);
+ if (userClasses)
+ RegDeleteKey(userClasses, pszKeyName);
+ free(pszKeyName);
+ } else
+ hr = E_OUTOFMEMORY;
+ }
+
+ if (userClasses)
+ RegCloseKey(userClasses);
+ return hr;
+}
+
+STDAPI DllRegisterServer(void)
+{
+ HRESULT hr = S_OK;
+
+ // look up server's file name
+ TCHAR szFileName[MAX_PATH];
+ GetModuleFileName(gInstance, szFileName, MAX_PATH);
+
+ typedef HRESULT (WINAPI *RegisterTypeLibForUserPtr)(ITypeLib*, OLECHAR*, OLECHAR*);
+ COMPtr<ITypeLib> typeLib;
+ LoadTypeLibEx(szFileName, REGKIND_NONE, &typeLib);
+ if (RegisterTypeLibForUserPtr registerTypeLibForUser = reinterpret_cast<RegisterTypeLibForUserPtr>(GetProcAddress(GetModuleHandle(TEXT("oleaut32.dll")), "RegisterTypeLibForUser")))
+ registerTypeLibForUser(typeLib.get(), szFileName, 0);
+ else
+ RegisterTypeLib(typeLib.get(), szFileName, 0);
+
+ HKEY userClasses;
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\CLASSES"), 0, KEY_WRITE, &userClasses) != ERROR_SUCCESS)
+ userClasses = 0;
+
+ // register entries from table
+ int nEntries = ARRAYSIZE(gRegTable);
+ for (int i = 0; SUCCEEDED(hr) && i < nEntries; i++) {
+ LPTSTR pszKeyName = _tcsdup(gRegTable[i][0]);
+ LPTSTR pszValueName = gRegTable[i][1] ? _tcsdup(gRegTable[i][1]) : 0;
+ LPTSTR allocatedValue = (gRegTable[i][2] != (LPTSTR)-1) ? _tcsdup(gRegTable[i][2]) : (LPTSTR)-1;
+ LPTSTR pszValue = allocatedValue;
+
+ if (pszKeyName && pszValue) {
+
+ int clsidIndex = i/gSlotsPerEntry;
+ substituteGUID(pszKeyName, &gRegCLSIDs[clsidIndex]);
+ substituteGUID(pszValueName, &gRegCLSIDs[clsidIndex]);
+
+ // map rogue value to module file name
+ if (pszValue == (LPTSTR)-1)
+ pszValue = szFileName;
+ else
+ substituteGUID(pszValue, &gRegCLSIDs[clsidIndex]);
+
+ // create the key
+ HKEY hkey;
+ LONG err = RegCreateKey(HKEY_CLASSES_ROOT, pszKeyName, &hkey);
+ if (err != ERROR_SUCCESS && userClasses)
+ err = RegCreateKey(userClasses, pszKeyName, &hkey);
+ if (err == ERROR_SUCCESS) {
+ // set the value
+ err = RegSetValueEx(hkey, pszValueName, 0, REG_SZ, (const BYTE*)pszValue, (DWORD) sizeof(pszValue[0])*(_tcslen(pszValue) + 1));
+ RegCloseKey(hkey);
+ }
+ }
+ if (pszKeyName)
+ free(pszKeyName);
+ if (pszValueName)
+ free(pszValueName);
+ if (allocatedValue && allocatedValue != (LPTSTR)-1)
+ free(allocatedValue);
+ }
+
+ if (userClasses)
+ RegCloseKey(userClasses);
+
+ return hr;
+}
+
+STDAPI RunAsLocalServer()
+{
+ DWORD reg;
+ COMPtr<IUnknown> classFactory;
+ DllGetClassObject(CLSID_WebScriptDebugServer, IID_IUnknown, (void**)&classFactory);
+ CoRegisterClassObject(CLSID_WebScriptDebugServer, classFactory.get(), CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &reg);
+ return 0;
+}
+
+STDAPI LocalServerDidDie()
+{
+ WebScriptDebugServer::sharedWebScriptDebugServer()->serverDidDie();
+ return 0;
+}
+
+//FIXME: We should consider moving this to a new file for cross-project functionality
+PassRefPtr<WebCore::SharedBuffer> loadResourceIntoBuffer(const char* name)
+{
+ int idr;
+ // temporary hack to get resource id
+ if (!strcmp(name, "textAreaResizeCorner"))
+ idr = IDR_RESIZE_CORNER;
+ else if (!strcmp(name, "missingImage"))
+ idr = IDR_MISSING_IMAGE;
+ else if (!strcmp(name, "urlIcon"))
+ idr = IDR_URL_ICON;
+ else if (!strcmp(name, "nullPlugin"))
+ idr = IDR_NULL_PLUGIN;
+ else if (!strcmp(name, "zoomInCursor"))
+ idr = IDR_ZOOM_IN_CURSOR;
+ else if (!strcmp(name, "zoomOutCursor"))
+ idr = IDR_ZOOM_OUT_CURSOR;
+ else if (!strcmp(name, "verticalTextCursor"))
+ idr = IDR_VERTICAL_TEXT_CURSOR;
+ else
+ return 0;
+
+ HRSRC resInfo = FindResource(gInstance, MAKEINTRESOURCE(idr), L"PNG");
+ if (!resInfo)
+ return 0;
+ HANDLE res = LoadResource(gInstance, resInfo);
+ if (!res)
+ return 0;
+ void* resource = LockResource(res);
+ if (!resource)
+ return 0;
+ int size = SizeofResource(gInstance, resInfo);
+
+ return new WebCore::SharedBuffer(reinterpret_cast<const char*>(resource), size);
+}
diff --git a/WebKit/win/WebKitDLL.h b/WebKit/win/WebKitDLL.h
new file mode 100644
index 0000000..469a6f6
--- /dev/null
+++ b/WebKit/win/WebKitDLL.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitDLL_H
+#define WebKitDLL_H
+
+#ifndef _HAS_EXCEPTIONS
+#define _HAS_EXCEPTIONS 0
+#endif
+
+#include <winsock2.h>
+#include <windows.h>
+
+#ifdef WEBKIT_EXPORTS
+#define WEBKIT_API __declspec(dllexport)
+#else
+#define WEBKIT_API __declspec(dllimport)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern ULONG gLockCount;
+extern ULONG gClassCount;
+extern HINSTANCE gInstance;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WebKitDLL_H
diff --git a/WebKit/win/WebKitGraphics.cpp b/WebKit/win/WebKitGraphics.cpp
new file mode 100644
index 0000000..5953644
--- /dev/null
+++ b/WebKit/win/WebKitGraphics.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitGraphics.h"
+
+#include "WebKit.h"
+#include "WebKitDLL.h"
+
+#pragma warning(push, 0)
+#include <WebCore/CharacterNames.h>
+#include <WebCore/Font.h>
+#include <WebCore/FontDatabase.h>
+#include <WebCore/FontDescription.h>
+#include <WebCore/FontSelector.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/StringTruncator.h>
+#include <WebCore/WebCoreTextRenderer.h>
+
+#include <CoreGraphics/CoreGraphics.h>
+#pragma warning(pop)
+
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+
+using namespace WebCore;
+
+static Font makeFont(const WebFontDescription& description)
+{
+ AtomicString::init();
+ populateFontDatabase();
+
+ String fontFamilyString(description.family, description.familyLength);
+
+ FontDescription f;
+ FontFamily family;
+ family.setFamily(fontFamilyString);
+ f.setFamily(family);
+ f.setSpecifiedSize(description.size);
+ f.setComputedSize(description.size);
+ f.setItalic(description.italic);
+ f.setBold(description.bold);
+ f.setIsAbsoluteSize(true);
+
+ Font font(f, 0, 0);
+ font.update(0);
+
+ return font;
+}
+
+void DrawTextAtPoint(CGContextRef cgContext, LPCTSTR text, int length, POINT point, const WebFontDescription& description, CGColorRef color, int underlinedIndex, bool drawAsPassword)
+{
+ GraphicsContext context(cgContext);
+
+ String drawString(text, length);
+ if (drawAsPassword)
+ drawString = drawString.impl()->secure(WebCore::bullet);
+ WebCoreDrawTextAtPoint(context, drawString, point, makeFont(description), color, underlinedIndex);
+}
+
+void WebDrawText(WebTextRenderInfo* info)
+{
+ if (!info || info->structSize != sizeof(WebTextRenderInfo) || !info->cgContext || !info->description)
+ return;
+
+ int oldFontSmoothingLevel = -1;
+ if (info->overrideSmoothingLevel >= 0) {
+ oldFontSmoothingLevel = wkGetFontSmoothingLevel();
+ wkSetFontSmoothingLevel(info->overrideSmoothingLevel);
+ }
+
+ DrawTextAtPoint(info->cgContext, info->text, info->length, info->pt, *(info->description), info->color, info->underlinedIndex, info->drawAsPassword);
+
+ if (info->overrideSmoothingLevel >= 0)
+ wkSetFontSmoothingLevel(oldFontSmoothingLevel);
+}
+
+float TextFloatWidth(LPCTSTR text, int length, const WebFontDescription& description)
+{
+ return WebCoreTextFloatWidth(String(text, length), makeFont(description));
+}
+
+void FontMetrics(const WebFontDescription& description, int* ascent, int* descent, int* lineSpacing)
+{
+ if (!ascent && !descent && !lineSpacing)
+ return;
+
+ Font font(makeFont(description));
+
+ if (ascent)
+ *ascent = font.ascent();
+
+ if (descent)
+ *descent = font.descent();
+
+ if (lineSpacing)
+ *lineSpacing = font.lineSpacing();
+}
+
+void CenterTruncateStringToWidth(LPCTSTR text, int length, const WebFontDescription& description, float width, WCHAR* buffer)
+{
+ ASSERT(buffer);
+
+ String result = StringTruncator::centerTruncate(String(text, length), width, makeFont(description), false);
+ memcpy(buffer, result.characters(), result.length() * sizeof(UChar));
+ buffer[result.length()] = '\0';
+}
+
+void RightTruncateStringToWidth(LPCTSTR text, int length, const WebFontDescription& description, float width, WCHAR* buffer)
+{
+ ASSERT(buffer);
+
+ String result = StringTruncator::rightTruncate(String(text, length), width, makeFont(description), false);
+ memcpy(buffer, result.characters(), result.length() * sizeof(UChar));
+ buffer[result.length()] = '\0';
+}
diff --git a/WebKit/win/WebKitGraphics.h b/WebKit/win/WebKitGraphics.h
new file mode 100644
index 0000000..1994698
--- /dev/null
+++ b/WebKit/win/WebKitGraphics.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitGraphics_h
+#define WebKitGraphics_h
+
+#include <windows.h>
+
+typedef struct CGColor* CGColorRef;
+typedef struct CGContext* CGContextRef;
+
+typedef wchar_t WCHAR;
+typedef __nullterminated const WCHAR* LPCWSTR;
+typedef LPCWSTR LPCTSTR;
+
+struct WebFontDescription {
+ LPCTSTR family;
+ unsigned familyLength;
+ float size;
+ bool bold;
+ bool italic;
+};
+
+struct WebTextRenderInfo
+{
+ DWORD structSize;
+ CGContextRef cgContext;
+ LPCTSTR text;
+ int length;
+ POINT pt;
+ const WebFontDescription* description;
+ CGColorRef color;
+ int underlinedIndex;
+ bool drawAsPassword;
+ int overrideSmoothingLevel; // pass in -1 if caller does not want to override smoothing level
+};
+
+void DrawTextAtPoint(CGContextRef, LPCTSTR text, int length, POINT, const WebFontDescription&, CGColorRef, int underlinedIndex = -1, bool drawAsPassword = false);
+void WebDrawText(WebTextRenderInfo*);
+float TextFloatWidth(LPCTSTR text, int length, const WebFontDescription&);
+void FontMetrics(const WebFontDescription&, int* ascent, int* descent, int* lineSpacing);
+
+// buffer must be large enough to hold all of "text", including its null terminator.
+void CenterTruncateStringToWidth(LPCTSTR text, int length, const WebFontDescription&, float width, WCHAR* buffer);
+void RightTruncateStringToWidth(LPCTSTR text, int length, const WebFontDescription&, float width, WCHAR* buffer);
+
+#endif // !defined(WebKitGraphics_h)
diff --git a/WebKit/win/WebKitLogging.cpp b/WebKit/win/WebKitLogging.cpp
new file mode 100644
index 0000000..f7a333c
--- /dev/null
+++ b/WebKit/win/WebKitLogging.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitLogging.h"
+
+WTFLogChannel WebKitLogNetwork = { 0x00000010, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogTiming = { 0x00000020, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogLoading = { 0x00000040, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogFontCache = { 0x00000100, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogFontSubstitution = { 0x00000200, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogDownload = { 0x00000800, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogDocumentLoad = { 0x00001000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogPlugins = { 0x00002000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogEvents = { 0x00010000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogView = { 0x00020000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogRedirect = { 0x00040000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogPageCache = { 0x00080000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogCacheSizes = { 0x00100000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogFormDelegate = { 0x00200000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogFileDatabaseActivity = { 0x00400000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogHistory = { 0x00800000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogBindings = { 0x01000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogFontSelection = { 0x02000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogEncoding = { 0x04000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogLiveConnect = { 0x08000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogBackForward = { 0x10000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogProgress = { 0x20000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogPluginEvents = { 0x40000000, "WebKitLogLevel", WTFLogChannelOff };
+WTFLogChannel WebKitLogIconDatabase = { 0x80000000, "WebKitLogLevel", WTFLogChannelOff };
+
+static void initializeLogChannel(WTFLogChannel *)
+{
+ // FIXME: Get the LogChannel preferences from somewhere, otherwise people will have to hard code
+ // the logging channels they want to WTFLogChannelOn
+/*
+ channel->state = WTFLogChannelOff;
+ NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]];
+ if (logLevelString) {
+ unsigned logLevel;
+ if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
+ NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString);
+ if ((logLevel & channel->mask) == channel->mask)
+ channel->state = WTFLogChannelOn;
+ }
+*/
+}
+
+void WebKitInitializeLoggingChannelsIfNecessary()
+{
+ static bool haveInitializedLoggingChannels = false;
+ if (haveInitializedLoggingChannels)
+ return;
+ haveInitializedLoggingChannels = true;
+
+ initializeLogChannel(&WebKitLogTiming);
+ initializeLogChannel(&WebKitLogLoading);
+ initializeLogChannel(&WebKitLogFontCache);
+ initializeLogChannel(&WebKitLogFontSubstitution);
+ initializeLogChannel(&WebKitLogDownload);
+ initializeLogChannel(&WebKitLogDocumentLoad);
+ initializeLogChannel(&WebKitLogPlugins);
+ initializeLogChannel(&WebKitLogEvents);
+ initializeLogChannel(&WebKitLogView);
+ initializeLogChannel(&WebKitLogRedirect);
+ initializeLogChannel(&WebKitLogPageCache);
+ initializeLogChannel(&WebKitLogCacheSizes);
+ initializeLogChannel(&WebKitLogFormDelegate);
+ initializeLogChannel(&WebKitLogFileDatabaseActivity);
+ initializeLogChannel(&WebKitLogHistory);
+ initializeLogChannel(&WebKitLogBindings);
+ initializeLogChannel(&WebKitLogFontSelection);
+ initializeLogChannel(&WebKitLogEncoding);
+ initializeLogChannel(&WebKitLogLiveConnect);
+ initializeLogChannel(&WebKitLogBackForward);
+ initializeLogChannel(&WebKitLogProgress);
+ initializeLogChannel(&WebKitLogPluginEvents);
+ initializeLogChannel(&WebKitLogIconDatabase);
+}
+
diff --git a/WebKit/win/WebKitLogging.h b/WebKit/win/WebKitLogging.h
new file mode 100644
index 0000000..0aafb51
--- /dev/null
+++ b/WebKit/win/WebKitLogging.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebKitLogging_h
+#define WebKitLogging_h
+
+#include <wtf/Assertions.h>
+
+#ifndef LOG_CHANNEL_PREFIX
+#define LOG_CHANNEL_PREFIX WebKitLog
+#endif
+
+
+extern WTFLogChannel WebKitLogNetwork;
+extern WTFLogChannel WebKitLogTiming;
+extern WTFLogChannel WebKitLogLoading;
+extern WTFLogChannel WebKitLogFontCache;
+extern WTFLogChannel WebKitLogFontSubstitution;
+extern WTFLogChannel WebKitLogFontSelection;
+extern WTFLogChannel WebKitLogDownload;
+extern WTFLogChannel WebKitLogDocumentLoad;
+extern WTFLogChannel WebKitLogPlugins;
+extern WTFLogChannel WebKitLogEvents;
+extern WTFLogChannel WebKitLogView;
+extern WTFLogChannel WebKitLogRedirect;
+extern WTFLogChannel WebKitLogPageCache;
+extern WTFLogChannel WebKitLogCacheSizes;
+extern WTFLogChannel WebKitLogFormDelegate;
+extern WTFLogChannel WebKitLogFileDatabaseActivity;
+extern WTFLogChannel WebKitLogHistory;
+extern WTFLogChannel WebKitLogBindings;
+extern WTFLogChannel WebKitLogEncoding;
+extern WTFLogChannel WebKitLogLiveConnect;
+extern WTFLogChannel WebKitLogBackForward;
+extern WTFLogChannel WebKitLogProgress;
+extern WTFLogChannel WebKitLogPluginEvents;
+extern WTFLogChannel WebKitLogIconDatabase;
+
+void WebKitInitializeLoggingChannelsIfNecessary(void);
+
+#endif
diff --git a/WebKit/win/WebKitPrefix.cpp b/WebKit/win/WebKitPrefix.cpp
new file mode 100644
index 0000000..52d08ec
--- /dev/null
+++ b/WebKit/win/WebKitPrefix.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitPrefix.h"
diff --git a/WebKit/win/WebKitPrefix.h b/WebKit/win/WebKitPrefix.h
new file mode 100644
index 0000000..13cf8e0
--- /dev/null
+++ b/WebKit/win/WebKitPrefix.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
+
+// If we don't define these, they get defined in windef.h.
+// We want to use std::min and std::max.
+#ifndef max
+#define max max
+#endif
+#ifndef min
+#define min min
+#endif
+
+#ifndef _WINSOCKAPI_
+#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
+#endif
+
+#include <WebKit/WebKit.h>
diff --git a/WebKit/win/WebKitStatistics.cpp b/WebKit/win/WebKitStatistics.cpp
new file mode 100644
index 0000000..8a83cd7
--- /dev/null
+++ b/WebKit/win/WebKitStatistics.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitDLL.h"
+#include "WebKitStatistics.h"
+
+#include "WebKitStatisticsPrivate.h"
+
+int WebViewCount;
+int WebDataSourceCount;
+int WebFrameCount;
+int WebHTMLRepresentationCount;
+int WebFrameViewCount;
+
+// WebKitStatistics ---------------------------------------------------------------------------
+
+WebKitStatistics::WebKitStatistics()
+: m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebKitStatistics::~WebKitStatistics()
+{
+ gClassCount--;
+}
+
+WebKitStatistics* WebKitStatistics::createInstance()
+{
+ WebKitStatistics* instance = new WebKitStatistics();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<WebKitStatistics*>(this);
+ else if (IsEqualGUID(riid, IID_IWebKitStatistics))
+ *ppvObject = static_cast<WebKitStatistics*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebKitStatistics::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebKitStatistics::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebKitStatistics ------------------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::webViewCount(
+ /* [retval][out] */ int *count)
+{
+ *count = WebViewCount;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::frameCount(
+ /* [retval][out] */ int *count)
+{
+ *count = WebFrameCount;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::dataSourceCount(
+ /* [retval][out] */ int *count)
+{
+ *count = WebDataSourceCount;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::viewCount(
+ /* [retval][out] */ int *count)
+{
+ *count = WebFrameViewCount;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::HTMLRepresentationCount(
+ /* [retval][out] */ int *count)
+{
+ *count = WebHTMLRepresentationCount;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebKitStatistics::comClassCount(
+ /* [retval][out] */ int *classCount)
+{
+ *classCount = gClassCount;
+ return S_OK;
+}
diff --git a/WebKit/win/WebKitStatistics.h b/WebKit/win/WebKitStatistics.h
new file mode 100644
index 0000000..a97e96d
--- /dev/null
+++ b/WebKit/win/WebKitStatistics.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebKitStatistics_h
+#define WebkitStatistics_h
+
+#include "WebKit.h"
+
+class WebKitStatistics : public IWebKitStatistics {
+public:
+ static WebKitStatistics* createInstance();
+protected:
+ WebKitStatistics();
+ ~WebKitStatistics();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebKitStatistics
+ virtual HRESULT STDMETHODCALLTYPE webViewCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE frameCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE dataSourceCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE viewCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE HTMLRepresentationCount(
+ /* [retval][out] */ int *count);
+
+ virtual HRESULT STDMETHODCALLTYPE comClassCount(
+ /* [retval][out] */ int *classCount);
+
+protected:
+ ULONG m_refCount;
+};
+
+#endif
diff --git a/WebKit/win/WebKitStatisticsPrivate.h b/WebKit/win/WebKitStatisticsPrivate.h
new file mode 100644
index 0000000..eea668b
--- /dev/null
+++ b/WebKit/win/WebKitStatisticsPrivate.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+extern int WebViewCount;
+extern int WebDataSourceCount;
+extern int WebFrameCount;
+extern int WebHTMLRepresentationCount;
+extern int WebFrameViewCount;
diff --git a/WebKit/win/WebKitSystemBits.cpp b/WebKit/win/WebKitSystemBits.cpp
new file mode 100644
index 0000000..e8ee0e9
--- /dev/null
+++ b/WebKit/win/WebKitSystemBits.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitSystemBits.h"
+
+#pragma warning(push, 0)
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+#include <windows.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+unsigned long long WebMemorySize()
+{
+ MEMORYSTATUSEX statex;
+ statex.dwLength = sizeof(statex);
+ GlobalMemoryStatusEx(&statex);
+ return statex.ullTotalPhys;
+}
+
+unsigned long long WebVolumeFreeSize(CFStringRef cfstringPath)
+{
+ WebCore::String path(cfstringPath);
+ ULARGE_INTEGER freeBytesToCaller;
+ BOOL result = GetDiskFreeSpaceExW((LPCWSTR)path.charactersWithNullTermination(), &freeBytesToCaller, 0, 0);
+ if (!result)
+ return 0;
+
+ return freeBytesToCaller.QuadPart;
+}
diff --git a/WebKit/win/WebKitSystemBits.h b/WebKit/win/WebKitSystemBits.h
new file mode 100644
index 0000000..7461696
--- /dev/null
+++ b/WebKit/win/WebKitSystemBits.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebKitSystemBits_h
+#define WebKitSystemBits_h
+
+typedef const struct __CFString* CFStringRef;
+
+unsigned long long WebMemorySize();
+unsigned long long WebVolumeFreeSize(CFStringRef path);
+
+#endif // WebKitSystemBits_h
diff --git a/WebKit/win/WebLocalizableStrings.cpp b/WebKit/win/WebLocalizableStrings.cpp
new file mode 100644
index 0000000..df70bd4
--- /dev/null
+++ b/WebKit/win/WebLocalizableStrings.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+
+#include "WebLocalizableStrings.h"
+
+#pragma warning(push, 0)
+#include <WebCore/CString.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/StringHash.h>
+#pragma warning(pop)
+
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/RetainPtr.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+class LocalizedString;
+
+using namespace WebCore;
+
+WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
+
+static HashMap<String, LocalizedString*> mainBundleLocStrings;
+static HashMap<String, LocalizedString*> frameworkLocStrings;
+
+class LocalizedString : Noncopyable {
+public:
+ LocalizedString(CFStringRef string)
+ : m_cfString(string)
+ {
+ ASSERT_ARG(string, string);
+ }
+
+ operator LPCTSTR() const;
+ operator CFStringRef() const { return m_cfString; }
+
+private:
+ CFStringRef m_cfString;
+ mutable String m_string;
+};
+
+LocalizedString::operator LPCTSTR() const
+{
+ if (!m_string.isEmpty())
+ return m_string.charactersWithNullTermination();
+
+ m_string = m_cfString;
+
+ for (unsigned int i = 1; i < m_string.length(); i++)
+ if (m_string[i] == '@' && (m_string[i - 1] == '%' || (i > 2 && m_string[i - 1] == '$' && m_string[i - 2] >= '1' && m_string[i - 2] <= '9' && m_string[i - 3] == '%')))
+ m_string.replace(i, 1, "s");
+
+ return m_string.charactersWithNullTermination();
+}
+
+static CFBundleRef createWebKitBundle()
+{
+ static CFBundleRef bundle;
+ static bool initialized;
+
+ if (initialized)
+ return bundle;
+ initialized = true;
+
+ WCHAR pathStr[MAX_PATH];
+ DWORD length = ::GetModuleFileNameW(gInstance, pathStr, MAX_PATH);
+ if (!length || (length == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER))
+ return 0;
+
+ bool found = false;
+ for (int i = length - 1; i >= 0; i--) {
+ // warning C6385: Invalid data: accessing 'pathStr', the readable size is '520' bytes, but '2000' bytes might be read
+ #pragma warning(suppress: 6385)
+ if (pathStr[i] == L'\\') {
+ // warning C6386: Buffer overrun: accessing 'pathStr', the writable size is '520' bytes, but '1996' bytes might be written
+ #pragma warning(suppress: 6386)
+ pathStr[i] = 0;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ return 0;
+
+ if (wcscat_s(pathStr, MAX_PATH, L"\\WebKit.resources"))
+ return 0;
+
+ String bundlePathString(pathStr);
+ CFStringRef bundlePathCFString = bundlePathString.createCFString();
+ if (!bundlePathCFString)
+ return 0;
+
+ CFURLRef bundleURLRef = CFURLCreateWithFileSystemPath(0, bundlePathCFString, kCFURLWindowsPathStyle, true);
+ CFRelease(bundlePathCFString);
+ if (!bundleURLRef)
+ return 0;
+
+ bundle = CFBundleCreate(0, bundleURLRef);
+ CFRelease(bundleURLRef);
+ return bundle;
+}
+
+static CFBundleRef cfBundleForStringsBundle(WebLocalizableStringsBundle* stringsBundle)
+{
+ if (!stringsBundle) {
+ static CFBundleRef mainBundle = CFBundleGetMainBundle();
+ return mainBundle;
+ }
+
+ createWebKitBundle();
+
+ if (!stringsBundle->bundle)
+ stringsBundle->bundle = CFBundleGetBundleWithIdentifier(RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithCString(0, stringsBundle->identifier, kCFStringEncodingASCII)).get());
+ return stringsBundle->bundle;
+}
+
+static CFStringRef copyLocalizedStringFromBundle(WebLocalizableStringsBundle* stringsBundle, const String& key)
+{
+ static CFStringRef notFound = CFSTR("localized string not found");
+
+ CFBundleRef bundle = cfBundleForStringsBundle(stringsBundle);
+ if (!bundle)
+ return notFound;
+
+ RetainPtr<CFStringRef> keyString(AdoptCF, key.createCFString());
+ CFStringRef result = CFCopyLocalizedStringWithDefaultValue(keyString.get(), 0, bundle, notFound, 0);
+
+ ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
+ return result;
+}
+
+static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBundle, const String& key)
+{
+ if (!stringsBundle)
+ return mainBundleLocStrings.get(key);
+
+ if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle)
+ return frameworkLocStrings.get(key);
+
+ return 0;
+}
+
+static void cacheString(WebLocalizableStringsBundle* stringsBundle, const String& key, LocalizedString* value)
+{
+ if (!stringsBundle) {
+ mainBundleLocStrings.set(key, value);
+ return;
+ }
+
+ frameworkLocStrings.set(key, value);
+}
+
+static const LocalizedString& localizedString(WebLocalizableStringsBundle* stringsBundle, const String& key)
+{
+ LocalizedString* string = findCachedString(stringsBundle, key);
+ if (string)
+ return *string;
+
+ string = new LocalizedString(copyLocalizedStringFromBundle(stringsBundle, key));
+ cacheString(stringsBundle, key, string);
+
+ return *string;
+}
+
+CFStringRef WebLocalizedStringUTF8(WebLocalizableStringsBundle* stringsBundle, LPCSTR key)
+{
+ if (!key)
+ return 0;
+
+ return localizedString(stringsBundle, String::fromUTF8(key));
+}
+
+LPCTSTR WebLocalizedLPCTSTRUTF8(WebLocalizableStringsBundle* stringsBundle, LPCSTR key)
+{
+ if (!key)
+ return 0;
+
+ return localizedString(stringsBundle, String::fromUTF8(key));
+}
+
+// These functions are deprecated.
+
+CFStringRef WebLocalizedString(WebLocalizableStringsBundle* stringsBundle, LPCTSTR key)
+{
+ if (!key)
+ return 0;
+
+ return localizedString(stringsBundle, String(key));
+}
+
+LPCTSTR WebLocalizedLPCTSTR(WebLocalizableStringsBundle* stringsBundle, LPCTSTR key)
+{
+ if (!key)
+ return 0;
+
+ return localizedString(stringsBundle, String(key));
+}
+
+void SetWebLocalizedStringMainBundle(CFBundleRef)
+{
+}
diff --git a/WebKit/win/WebLocalizableStrings.h b/WebKit/win/WebLocalizableStrings.h
new file mode 100644
index 0000000..68cba32
--- /dev/null
+++ b/WebKit/win/WebLocalizableStrings.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebLocalizableStrings_H
+#define WebLocalizableStrings_H
+
+#include <CoreFoundation/CoreFoundation.h>
+
+typedef struct {
+ const char *identifier;
+ CFBundleRef bundle;
+} WebLocalizableStringsBundle;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CFStringRef WebLocalizedStringUTF8(WebLocalizableStringsBundle*, LPCSTR key);
+LPCTSTR WebLocalizedLPCTSTRUTF8(WebLocalizableStringsBundle*, LPCSTR key);
+
+void SetWebLocalizedStringMainBundle(CFBundleRef bundle);
+
+// These functions are deprecated. Use the UTF-8 versions instead.
+CFStringRef WebLocalizedString(WebLocalizableStringsBundle *bundle, LPCTSTR key);
+LPCTSTR WebLocalizedLPCTSTR(WebLocalizableStringsBundle *bundle, LPCTSTR key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef FRAMEWORK_NAME
+
+#define LOCALIZABLE_STRINGS_BUNDLE(F) LOCALIZABLE_STRINGS_BUNDLE_HELPER(F)
+#define LOCALIZABLE_STRINGS_BUNDLE_HELPER(F) F ## LocalizableStringsBundle
+extern WebLocalizableStringsBundle LOCALIZABLE_STRINGS_BUNDLE(FRAMEWORK_NAME);
+
+#define UI_STRING(string, comment) WebLocalizedStringUTF8(&LOCALIZABLE_STRINGS_BUNDLE(FRAMEWORK_NAME), string)
+#define UI_STRING_KEY(string, key, comment) WebLocalizedStringUTF8(&LOCALIZABLE_STRINGS_BUNDLE(FRAMEWORK_NAME), key)
+#define LPCTSTR_UI_STRING(string, comment) WebLocalizedLPCTSTRUTF8(&LOCALIZABLE_STRINGS_BUNDLE(FRAMEWORK_NAME), string)
+#define LPCTSTR_UI_STRING_KEY(string, key, comment) WebLocalizedLPCTSTRUTF8(&LOCALIZABLE_STRINGS_BUNDLE(FRAMEWORK_NAME), key)
+
+#else
+
+#define UI_STRING(string, comment) WebLocalizedStringUTF8(0, string)
+#define UI_STRING_KEY(string, key, comment) WebLocalizedStringUTF8(0, key)
+#define LPCTSTR_UI_STRING(string, comment) WebLocalizedLPCTSTRUTF8(0, string)
+#define LPCTSTR_UI_STRING_KEY(string, key, comment) WebLocalizedLPCTSTRUTF8(0, key)
+
+#endif
+
+#endif
diff --git a/WebKit/win/WebMutableURLRequest.cpp b/WebKit/win/WebMutableURLRequest.cpp
new file mode 100644
index 0000000..83cbcd9
--- /dev/null
+++ b/WebKit/win/WebMutableURLRequest.cpp
@@ -0,0 +1,382 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebMutableURLRequest.h"
+
+#include "WebKit.h"
+#include "MarshallingHelpers.h"
+#include "WebKit.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/CString.h>
+#include <WebCore/FormData.h>
+#include <WebCore/ResourceHandle.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// IWebURLRequest ----------------------------------------------------------------
+
+WebMutableURLRequest::WebMutableURLRequest(bool isMutable)
+ : m_refCount(0)
+ , m_isMutable(isMutable)
+{
+ gClassCount++;
+}
+
+WebMutableURLRequest* WebMutableURLRequest::createInstance()
+{
+ WebMutableURLRequest* instance = new WebMutableURLRequest(true);
+ instance->AddRef();
+ return instance;
+}
+
+WebMutableURLRequest* WebMutableURLRequest::createInstance(IWebMutableURLRequest* req)
+{
+ WebMutableURLRequest* instance = new WebMutableURLRequest(true);
+ instance->AddRef();
+ instance->m_request = static_cast<WebMutableURLRequest*>(req)->m_request;
+ return instance;
+}
+
+WebMutableURLRequest* WebMutableURLRequest::createInstance(const ResourceRequest& request)
+{
+ WebMutableURLRequest* instance = new WebMutableURLRequest(true);
+ instance->AddRef();
+ instance->m_request = request;
+ return instance;
+}
+
+WebMutableURLRequest* WebMutableURLRequest::createImmutableInstance()
+{
+ WebMutableURLRequest* instance = new WebMutableURLRequest(false);
+ instance->AddRef();
+ return instance;
+}
+
+WebMutableURLRequest* WebMutableURLRequest::createImmutableInstance(const ResourceRequest& request)
+{
+ WebMutableURLRequest* instance = new WebMutableURLRequest(false);
+ instance->AddRef();
+ instance->m_request = request;
+ return instance;
+}
+
+WebMutableURLRequest::~WebMutableURLRequest()
+{
+ gClassCount--;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, CLSID_WebMutableURLRequest))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebURLRequest*>(this);
+ else if (IsEqualGUID(riid, IID_IWebMutableURLRequest) && m_isMutable)
+ *ppvObject = static_cast<IWebMutableURLRequest*>(this);
+ else if (IsEqualGUID(riid, __uuidof(IWebMutableURLRequestPrivate)) && m_isMutable)
+ *ppvObject = static_cast<IWebMutableURLRequestPrivate*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLRequest))
+ *ppvObject = static_cast<IWebURLRequest*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebMutableURLRequest::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebMutableURLRequest::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLRequest --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::requestWithURL(
+ /* [in] */ BSTR /*theURL*/,
+ /* [optional][in] */ WebURLRequestCachePolicy /*cachePolicy*/,
+ /* [optional][in] */ double /*timeoutInterval*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::allHTTPHeaderFields(
+ /* [retval][out] */ IPropertyBag** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::cachePolicy(
+ /* [retval][out] */ WebURLRequestCachePolicy* result)
+{
+ *result = kit(m_request.cachePolicy());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::HTTPBody(
+ /* [retval][out] */ IStream** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::HTTPBodyStream(
+ /* [retval][out] */ IStream** /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::HTTPMethod(
+ /* [retval][out] */ BSTR* result)
+{
+ BString httpMethod = BString(m_request.httpMethod());
+ *result = httpMethod.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::HTTPShouldHandleCookies(
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::initWithURL(
+ /* [in] */ BSTR url,
+ /* [optional][in] */ WebURLRequestCachePolicy cachePolicy,
+ /* [optional][in] */ double timeoutInterval)
+{
+ m_request.setURL(MarshallingHelpers::BSTRToKURL(url));
+ m_request.setCachePolicy(core(cachePolicy));
+ m_request.setTimeoutInterval(timeoutInterval);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::mainDocumentURL(
+ /* [retval][out] */ BSTR* result)
+{
+ *result = MarshallingHelpers::KURLToBSTR(m_request.url());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::timeoutInterval(
+ /* [retval][out] */ double* result)
+{
+ *result = m_request.timeoutInterval();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::URL(
+ /* [retval][out] */ BSTR* result)
+{
+ *result = MarshallingHelpers::KURLToBSTR(m_request.url());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::valueForHTTPHeaderField(
+ /* [in] */ BSTR field,
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = BString(m_request.httpHeaderField(String(field, SysStringLen(field)))).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::isEmpty(
+ /* [retval][out] */ BOOL* result)
+{
+ *result = m_request.isEmpty();
+ return S_OK;
+}
+
+// IWebMutableURLRequest --------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::addValue(
+ /* [in] */ BSTR /*value*/,
+ /* [in] */ BSTR /*field*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setAllHTTPHeaderFields(
+ /* [in] */ IPropertyBag* /*headerFields*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setCachePolicy(
+ /* [in] */ WebURLRequestCachePolicy policy)
+{
+ m_request.setCachePolicy(core(policy));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPBody(
+ /* [in] */ IStream* /*data*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPBodyStream(
+ /* [in] */ IStream* /*data*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPMethod(
+ /* [in] */ BSTR method)
+{
+ m_request.setHTTPMethod(String(method));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPShouldHandleCookies(
+ /* [in] */ BOOL /*handleCookies*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setMainDocumentURL(
+ /* [in] */ BSTR /*theURL*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setTimeoutInterval(
+ /* [in] */ double /*timeoutInterval*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setURL(
+ /* [in] */ BSTR url)
+{
+ m_request.setURL(MarshallingHelpers::BSTRToKURL(url));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setValue(
+ /* [in] */ BSTR /*value*/,
+ /* [in] */ BSTR /*field*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setAllowsAnyHTTPSCertificate(void)
+{
+ ResourceHandle::setHostAllowsAnyHTTPSCertificate(m_request.url().host());
+
+ return S_OK;
+}
+
+static void deallocCertContext(void* ptr, void* info)
+{
+ if (ptr)
+ CertFreeCertificateContext(reinterpret_cast<PCCERT_CONTEXT>(ptr));
+}
+
+static CFDataRef copyCert(PCCERT_CONTEXT cert)
+{
+ static CFAllocatorRef certDealloc;
+ PCCERT_CONTEXT certCopy = 0;
+ if (!certDealloc) {
+ CFAllocatorContext allocContext = {
+ 0, 0, 0, 0, 0, 0, 0, deallocCertContext, 0
+ };
+ certDealloc = CFAllocatorCreate(kCFAllocatorDefault, &allocContext);
+ }
+ certCopy = CertDuplicateCertificateContext(cert);
+ return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(certCopy), sizeof(*certCopy), certDealloc);
+}
+
+HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setClientCertificate(
+ /* [in] */ OLE_HANDLE cert)
+{
+ if (!cert)
+ return E_POINTER;
+
+ PCCERT_CONTEXT certContext = reinterpret_cast<PCCERT_CONTEXT>((ULONG64)cert);
+ RetainPtr<CFDataRef> certData(AdoptCF, copyCert(certContext));
+ ResourceHandle::setClientCertificate(m_request.url().host(), certData.get());
+ return S_OK;
+}
+
+// IWebMutableURLRequest ----------------------------------------------------
+
+void WebMutableURLRequest::setFormData(const PassRefPtr<FormData> data)
+{
+ m_request.setHTTPBody(data);
+}
+
+const PassRefPtr<FormData> WebMutableURLRequest::formData() const
+{
+ return m_request.httpBody();
+}
+
+void WebMutableURLRequest::addHTTPHeaderFields(const HTTPHeaderMap& headerFields)
+{
+ m_request.addHTTPHeaderFields(headerFields);
+}
+
+const HTTPHeaderMap& WebMutableURLRequest::httpHeaderFields() const
+{
+ return m_request.httpHeaderFields();
+}
+
+const ResourceRequest& WebMutableURLRequest::resourceRequest() const
+{
+ return m_request;
+}
diff --git a/WebKit/win/WebMutableURLRequest.h b/WebKit/win/WebMutableURLRequest.h
new file mode 100644
index 0000000..610b3d0
--- /dev/null
+++ b/WebKit/win/WebMutableURLRequest.h
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMutableURLRequest_H
+#define WebMutableURLRequest_H
+
+#include "WebKit.h"
+#pragma warning(push, 0)
+#include <WebCore/ResourceRequest.h>
+#pragma warning(pop)
+
+namespace WebCore
+{
+ class FormData;
+}
+
+inline WebCore::ResourceRequestCachePolicy core(WebURLRequestCachePolicy policy)
+{
+ return static_cast<WebCore::ResourceRequestCachePolicy>(policy);
+}
+
+inline WebURLRequestCachePolicy kit(WebCore::ResourceRequestCachePolicy policy)
+{
+ return static_cast<WebURLRequestCachePolicy>(policy);
+}
+
+class WebMutableURLRequest : public IWebMutableURLRequest, IWebMutableURLRequestPrivate
+{
+public:
+ static WebMutableURLRequest* createInstance();
+ static WebMutableURLRequest* createInstance(IWebMutableURLRequest* req);
+ static WebMutableURLRequest* createInstance(const WebCore::ResourceRequest&);
+
+ static WebMutableURLRequest* createImmutableInstance();
+ static WebMutableURLRequest* createImmutableInstance(const WebCore::ResourceRequest&);
+protected:
+ WebMutableURLRequest(bool isMutable);
+ ~WebMutableURLRequest();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLRequest
+ virtual HRESULT STDMETHODCALLTYPE requestWithURL(
+ /* [in] */ BSTR theURL,
+ /* [optional][in] */ WebURLRequestCachePolicy cachePolicy,
+ /* [optional][in] */ double timeoutInterval);
+
+ virtual HRESULT STDMETHODCALLTYPE allHTTPHeaderFields(
+ /* [retval][out] */ IPropertyBag **result);
+
+ virtual HRESULT STDMETHODCALLTYPE cachePolicy(
+ /* [retval][out] */ WebURLRequestCachePolicy *result);
+
+ virtual HRESULT STDMETHODCALLTYPE HTTPBody(
+ /* [retval][out] */ IStream **result);
+
+ virtual HRESULT STDMETHODCALLTYPE HTTPBodyStream(
+ /* [retval][out] */ IStream **result);
+
+ virtual HRESULT STDMETHODCALLTYPE HTTPMethod(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE HTTPShouldHandleCookies(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithURL(
+ /* [in] */ BSTR url,
+ /* [optional][in] */ WebURLRequestCachePolicy cachePolicy,
+ /* [optional][in] */ double timeoutInterval);
+
+ virtual HRESULT STDMETHODCALLTYPE mainDocumentURL(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE timeoutInterval(
+ /* [retval][out] */ double *result);
+
+ virtual HRESULT STDMETHODCALLTYPE URL(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE valueForHTTPHeaderField(
+ /* [in] */ BSTR field,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE isEmpty(
+ /* [retval][out] */ BOOL* result);
+
+ // IWebMutableURLRequest
+ virtual HRESULT STDMETHODCALLTYPE addValue(
+ /* [in] */ BSTR value,
+ /* [in] */ BSTR field);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllHTTPHeaderFields(
+ /* [in] */ IPropertyBag *headerFields);
+
+ virtual HRESULT STDMETHODCALLTYPE setCachePolicy(
+ /* [in] */ WebURLRequestCachePolicy policy);
+
+ virtual HRESULT STDMETHODCALLTYPE setHTTPBody(
+ /* [in] */ IStream *data);
+
+ virtual HRESULT STDMETHODCALLTYPE setHTTPBodyStream(
+ /* [in] */ IStream *data);
+
+ virtual HRESULT STDMETHODCALLTYPE setHTTPMethod(
+ /* [in] */ BSTR method);
+
+ virtual HRESULT STDMETHODCALLTYPE setHTTPShouldHandleCookies(
+ /* [in] */ BOOL handleCookies);
+
+ virtual HRESULT STDMETHODCALLTYPE setMainDocumentURL(
+ /* [in] */ BSTR theURL);
+
+ virtual HRESULT STDMETHODCALLTYPE setTimeoutInterval(
+ /* [in] */ double timeoutInterval);
+
+ virtual HRESULT STDMETHODCALLTYPE setURL(
+ /* [in] */ BSTR theURL);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ BSTR value,
+ /* [in] */ BSTR field);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowsAnyHTTPSCertificate(void);
+
+ // IWebMutableURLRequestPrivate
+
+ virtual HRESULT STDMETHODCALLTYPE setClientCertificate(
+ /* [in] */ OLE_HANDLE cert);
+
+ // WebMutableURLRequest
+ void setFormData(const PassRefPtr<WebCore::FormData> data);
+ const PassRefPtr<WebCore::FormData> formData() const;
+
+ void addHTTPHeaderFields(const WebCore::HTTPHeaderMap& headerFields);
+ const WebCore::HTTPHeaderMap& httpHeaderFields() const;
+
+ const WebCore::ResourceRequest& resourceRequest() const;
+protected:
+ ULONG m_refCount;
+ bool m_isMutable;
+ WebCore::ResourceRequest m_request;
+};
+
+#endif
diff --git a/WebKit/win/WebNodeHighlight.cpp b/WebKit/win/WebNodeHighlight.cpp
new file mode 100644
index 0000000..d2ba30d
--- /dev/null
+++ b/WebKit/win/WebNodeHighlight.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebNodeHighlight.h"
+
+#include "WebView.h"
+#pragma warning(push, 0)
+#include <WebCore/Color.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/InspectorController.h>
+#include <WebCore/Page.h>
+#include <WebCore/WindowMessageBroadcaster.h>
+#pragma warning(pop)
+#include <wtf/OwnPtr.h>
+#include <wtf/HashSet.h>
+
+using namespace WebCore;
+
+static LPCTSTR kOverlayWindowClassName = TEXT("WebNodeHighlightWindowClass");
+static ATOM registerOverlayClass();
+static LPCTSTR kWebNodeHighlightPointerProp = TEXT("WebNodeHighlightPointer");
+
+WebNodeHighlight::WebNodeHighlight(WebView* webView)
+ : m_inspectedWebView(webView)
+ , m_inspectedWebViewWindow(0)
+ , m_overlay(0)
+ , m_observedWindow(0)
+{
+}
+
+WebNodeHighlight::~WebNodeHighlight()
+{
+ if (m_observedWindow)
+ WindowMessageBroadcaster::removeListener(m_observedWindow, this);
+
+ if (m_overlay)
+ ::DestroyWindow(m_overlay);
+}
+
+void WebNodeHighlight::show()
+{
+ if (!m_overlay) {
+ if (FAILED(m_inspectedWebView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&m_inspectedWebViewWindow))) || !IsWindow(m_inspectedWebViewWindow))
+ return;
+
+ registerOverlayClass();
+
+ m_overlay = ::CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, kOverlayWindowClassName, 0, WS_POPUP | WS_VISIBLE,
+ 0, 0, 0, 0,
+ m_inspectedWebViewWindow, 0, 0, 0);
+ if (!m_overlay)
+ return;
+
+ ::SetProp(m_overlay, kWebNodeHighlightPointerProp, reinterpret_cast<HANDLE>(this));
+ ::SetWindowPos(m_overlay, m_inspectedWebViewWindow, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+
+ m_observedWindow = GetAncestor(m_inspectedWebViewWindow, GA_ROOT);
+ WindowMessageBroadcaster::addListener(m_observedWindow, this);
+ }
+
+ updateWindow();
+ ::ShowWindow(m_overlay, SW_SHOW);
+}
+
+void WebNodeHighlight::hide()
+{
+ if (m_overlay)
+ ::ShowWindow(m_overlay, SW_HIDE);
+}
+
+bool WebNodeHighlight::visible() const
+{
+ return m_overlay && ::IsWindowVisible(m_overlay);
+}
+
+void WebNodeHighlight::updateWindow()
+{
+ ASSERT(m_overlay);
+
+ HDC hdc = ::CreateCompatibleDC(::GetDC(m_overlay));
+ if (!hdc)
+ return;
+
+ RECT webViewRect;
+ ::GetWindowRect(m_inspectedWebViewWindow, &webViewRect);
+
+ SIZE size;
+ size.cx = webViewRect.right - webViewRect.left;
+ size.cy = webViewRect.bottom - webViewRect.top;
+
+ BITMAPINFO bitmapInfo;
+ bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapInfo.bmiHeader.biWidth = size.cx;
+ bitmapInfo.bmiHeader.biHeight = -size.cy;
+ bitmapInfo.bmiHeader.biPlanes = 1;
+ bitmapInfo.bmiHeader.biBitCount = 32;
+ bitmapInfo.bmiHeader.biCompression = BI_RGB;
+ bitmapInfo.bmiHeader.biSizeImage = 0;
+ bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biClrUsed = 0;
+ bitmapInfo.bmiHeader.biClrImportant = 0;
+
+ void* pixels = 0;
+ OwnPtr<HBITMAP> hbmp(::CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0));
+
+ ::SelectObject(hdc, hbmp.get());
+
+ GraphicsContext context(hdc);
+
+ m_inspectedWebView->page()->inspectorController()->drawNodeHighlight(context);
+
+ BLENDFUNCTION bf;
+ bf.BlendOp = AC_SRC_OVER;
+ bf.BlendFlags = 0;
+ bf.SourceConstantAlpha = 255;
+ bf.AlphaFormat = AC_SRC_ALPHA;
+
+ POINT srcPoint;
+ srcPoint.x = 0;
+ srcPoint.y = 0;
+
+ POINT dstPoint;
+ dstPoint.x = webViewRect.left;
+ dstPoint.y = webViewRect.top;
+
+ ::UpdateLayeredWindow(m_overlay, ::GetDC(0), &dstPoint, &size, hdc, &srcPoint, 0, &bf, ULW_ALPHA);
+
+ ::DeleteDC(hdc);
+}
+
+static ATOM registerOverlayClass()
+{
+ static bool haveRegisteredWindowClass = false;
+
+ if (haveRegisteredWindowClass)
+ return true;
+
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = 0;
+ wcex.lpfnWndProc = OverlayWndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = 0;
+ wcex.hIcon = 0;
+ wcex.hCursor = LoadCursor(0, IDC_ARROW);
+ wcex.hbrBackground = 0;
+ wcex.lpszMenuName = 0;
+ wcex.lpszClassName = kOverlayWindowClassName;
+ wcex.hIconSm = 0;
+
+ haveRegisteredWindowClass = true;
+
+ return ::RegisterClassEx(&wcex);
+}
+
+LRESULT CALLBACK OverlayWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WebNodeHighlight* highlight = reinterpret_cast<WebNodeHighlight*>(::GetProp(hwnd, kWebNodeHighlightPointerProp));
+ if (!highlight)
+ return ::DefWindowProc(hwnd, msg, wParam, lParam);
+
+ return ::DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+void WebNodeHighlight::windowReceivedMessage(HWND, UINT msg, WPARAM, LPARAM)
+{
+ switch (msg) {
+ case WM_WINDOWPOSCHANGED:
+ if (visible())
+ updateWindow();
+ break;
+ default:
+ break;
+ }
+}
diff --git a/WebKit/win/WebNodeHighlight.h b/WebKit/win/WebNodeHighlight.h
new file mode 100644
index 0000000..fcb2f18
--- /dev/null
+++ b/WebKit/win/WebNodeHighlight.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebNodeHighlight_h
+#define WebNodeHighlight_h
+
+#pragma warning(push, 0)
+#include <WebCore/WindowMessageListener.h>
+#pragma warning(pop)
+
+#include <windows.h>
+
+class WebView;
+
+class WebNodeHighlight : WebCore::WindowMessageListener {
+public:
+ WebNodeHighlight(WebView*);
+ ~WebNodeHighlight();
+
+ void show();
+ void hide();
+
+ void updateWindow();
+ bool visible() const;
+
+private:
+ virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
+
+ WebView* m_inspectedWebView;
+ HWND m_inspectedWebViewWindow;
+ HWND m_overlay;
+ HWND m_observedWindow;
+
+ friend static LRESULT CALLBACK OverlayWndProc(HWND, UINT, WPARAM, LPARAM);
+};
+
+#endif // !defined(WebNodeHighlight_h)
diff --git a/WebKit/win/WebNotification.cpp b/WebKit/win/WebNotification.cpp
new file mode 100644
index 0000000..1420faa
--- /dev/null
+++ b/WebKit/win/WebNotification.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+
+#include "WebNotification.h"
+
+#include <wtf/Assertions.h>
+
+// WebNotification ------------------------------------------------------------
+
+WebNotification::WebNotification(BSTR name, IUnknown* anObject, IPropertyBag* userInfo)
+: m_refCount(0)
+, m_name(0)
+, m_anObject(anObject)
+, m_userInfo(userInfo)
+{
+ if (name)
+ m_name = SysAllocString(name);
+ if (m_anObject)
+ m_anObject->AddRef();
+ if (m_userInfo)
+ m_userInfo->AddRef();
+
+ gClassCount++;
+}
+
+WebNotification::~WebNotification()
+{
+ if (m_name)
+ SysFreeString(m_name);
+ if (m_anObject)
+ m_anObject->Release();
+ if (m_userInfo)
+ m_userInfo->Release();
+
+ gClassCount--;
+}
+
+WebNotification* WebNotification::createInstance(BSTR name /*=0*/, IUnknown* anObject /*=0*/, IPropertyBag* userInfo /*=0*/)
+{
+ WebNotification* instance = new WebNotification(name, anObject, userInfo);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebNotification::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebNotification*>(this);
+ else if (IsEqualGUID(riid, IID_IWebNotification))
+ *ppvObject = static_cast<IWebNotification*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebNotification::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebNotification::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebNotification -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebNotification::notificationWithName(
+ /* [in] */ BSTR /*aName*/,
+ /* [in] */ IUnknown* /*anObject*/,
+ /* [optional][in] */ IPropertyBag* /*userInfo*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotification::name(
+ /* [retval][out] */ BSTR* result)
+{
+ *result = 0;
+ if (m_name) {
+ *result = SysAllocString(m_name);
+ if (!*result)
+ return E_OUTOFMEMORY;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotification::getObject(
+ /* [retval][out] */ IUnknown** result)
+{
+ *result = m_anObject;
+
+ if (*result)
+ (*result)->AddRef();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotification::userInfo(
+ /* [retval][out] */ IPropertyBag** result)
+{
+ *result = m_userInfo;
+
+ if (*result)
+ (*result)->AddRef();
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebNotification.h b/WebKit/win/WebNotification.h
new file mode 100644
index 0000000..f95018e
--- /dev/null
+++ b/WebKit/win/WebNotification.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebNotification_H
+#define WebNotification_H
+
+#include "WebKit.h"
+
+class WebNotification : public IWebNotification
+{
+public:
+ static WebNotification* createInstance(BSTR name = 0, IUnknown* anObject = 0, IPropertyBag* userInfo = 0);
+protected:
+ WebNotification(BSTR name, IUnknown* anObject, IPropertyBag* userInfo);
+ ~WebNotification();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebNotification
+ virtual HRESULT STDMETHODCALLTYPE notificationWithName(
+ /* [in] */ BSTR aName,
+ /* [in] */ IUnknown *anObject,
+ /* [optional][in] */ IPropertyBag *userInfo);
+
+ virtual HRESULT STDMETHODCALLTYPE name(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE getObject(
+ /* [retval][out] */ IUnknown **result);
+
+ virtual HRESULT STDMETHODCALLTYPE userInfo(
+ /* [retval][out] */ IPropertyBag **result);
+
+protected:
+ ULONG m_refCount;
+ BSTR m_name;
+ IUnknown* m_anObject;
+ IPropertyBag* m_userInfo;
+};
+
+#endif
diff --git a/WebKit/win/WebNotificationCenter.cpp b/WebKit/win/WebNotificationCenter.cpp
new file mode 100644
index 0000000..cc27795
--- /dev/null
+++ b/WebKit/win/WebNotificationCenter.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebNotificationCenter.h"
+
+#include "WebNotification.h"
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/StringHash.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashTraits.h>
+#include <wtf/Vector.h>
+#pragma warning(pop)
+#include <tchar.h>
+#include <utility>
+
+using namespace WebCore;
+
+typedef std::pair<COMPtr<IUnknown>, COMPtr<IWebNotificationObserver> > ObjectObserverPair;
+typedef Vector<ObjectObserverPair> ObjectObserverList;
+typedef ObjectObserverList::iterator ObserverListIterator;
+typedef HashMap<String, ObjectObserverList> MappedObservers;
+
+struct WebNotificationCenterPrivate {
+ MappedObservers m_mappedObservers;
+};
+
+// WebNotificationCenter ----------------------------------------------------------------
+
+IWebNotificationCenter* WebNotificationCenter::m_defaultCenter = 0;
+
+WebNotificationCenter::WebNotificationCenter()
+ : m_refCount(0)
+ , d(new WebNotificationCenterPrivate)
+{
+ gClassCount++;
+}
+
+WebNotificationCenter::~WebNotificationCenter()
+{
+ gClassCount--;
+}
+
+WebNotificationCenter* WebNotificationCenter::createInstance()
+{
+ WebNotificationCenter* instance = new WebNotificationCenter();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebNotificationCenter*>(this);
+ else if (IsEqualGUID(riid, IID_IWebNotificationCenter))
+ *ppvObject = static_cast<IWebNotificationCenter*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebNotificationCenter::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebNotificationCenter::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+IWebNotificationCenter* WebNotificationCenter::defaultCenterInternal()
+{
+ if (!m_defaultCenter)
+ m_defaultCenter = WebNotificationCenter::createInstance();
+ return m_defaultCenter;
+}
+
+void WebNotificationCenter::postNotificationInternal(IWebNotification* notification, BSTR notificationName, IUnknown* anObject)
+{
+ String name(notificationName, SysStringLen(notificationName));
+ MappedObservers::iterator it = d->m_mappedObservers.find(name);
+ if (it == d->m_mappedObservers.end())
+ return;
+
+ // Intentionally make a copy of the list to avoid the possibility of errors
+ // from a mutation of the list in the onNotify callback.
+ ObjectObserverList list = it->second;
+
+ ObserverListIterator end = list.end();
+ for (ObserverListIterator it2 = list.begin(); it2 != end; ++it2) {
+ IUnknown* observedObject = it2->first.get();
+ IWebNotificationObserver* observer = it2->second.get();
+ if (!observedObject || !anObject || observedObject == anObject)
+ observer->onNotify(notification);
+ }
+}
+
+// IWebNotificationCenter -----------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::defaultCenter(
+ /* [retval][out] */ IWebNotificationCenter** center)
+{
+ *center = defaultCenterInternal();
+ (*center)->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::addObserver(
+ /* [in] */ IWebNotificationObserver* observer,
+ /* [in] */ BSTR notificationName,
+ /* [in] */ IUnknown* anObject)
+{
+ String name(notificationName, SysStringLen(notificationName));
+ MappedObservers::iterator it = d->m_mappedObservers.find(name);
+ if (it != d->m_mappedObservers.end())
+ it->second.append(ObjectObserverPair(anObject, observer));
+ else {
+ ObjectObserverList list;
+ list.append(ObjectObserverPair(anObject, observer));
+ d->m_mappedObservers.add(name, list);
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::postNotification(
+ /* [in] */ IWebNotification* notification)
+{
+ BSTR name;
+ HRESULT hr = notification->name(&name);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<IUnknown> obj;
+ hr = notification->getObject(&obj);
+ if (FAILED(hr))
+ return hr;
+
+ postNotificationInternal(notification, name, obj.get());
+ SysFreeString(name);
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::postNotificationName(
+ /* [in] */ BSTR notificationName,
+ /* [in] */ IUnknown* anObject,
+ /* [optional][in] */ IPropertyBag* userInfo)
+{
+ COMPtr<WebNotification> notification(AdoptCOM, WebNotification::createInstance(notificationName, anObject, userInfo));
+ postNotificationInternal(notification.get(), notificationName, anObject);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebNotificationCenter::removeObserver(
+ /* [in] */ IWebNotificationObserver* anObserver,
+ /* [in] */ BSTR notificationName,
+ /* [optional][in] */ IUnknown* anObject)
+{
+ String name(notificationName, SysStringLen(notificationName));
+ MappedObservers::iterator it = d->m_mappedObservers.find(name);
+ if (it == d->m_mappedObservers.end())
+ return E_FAIL;
+
+ ObjectObserverList& observerList = it->second;
+ ObserverListIterator end = observerList.end();
+
+ int i = 0;
+ for (ObserverListIterator it2 = observerList.begin(); it2 != end; ++it2, ++i) {
+ IUnknown* observedObject = it2->first.get();
+ IWebNotificationObserver* observer = it2->second.get();
+ if (observer == anObserver && (!anObject || anObject == observedObject)) {
+ observerList.remove(i);
+ break;
+ }
+ }
+
+ if (observerList.isEmpty())
+ d->m_mappedObservers.remove(name);
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebNotificationCenter.h b/WebKit/win/WebNotificationCenter.h
new file mode 100644
index 0000000..4e909a7
--- /dev/null
+++ b/WebKit/win/WebNotificationCenter.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebNotificationCenter_H
+#define WebNotificationCenter_H
+
+#include "WebKit.h"
+#include <wtf/OwnPtr.h>
+
+struct WebNotificationCenterPrivate;
+
+class WebNotificationCenter : public IWebNotificationCenter {
+public:
+ static WebNotificationCenter* createInstance();
+
+protected:
+ WebNotificationCenter();
+ ~WebNotificationCenter();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebNotificationCenter
+ virtual HRESULT STDMETHODCALLTYPE defaultCenter(
+ /* [retval][out] */ IWebNotificationCenter **center);
+
+ virtual HRESULT STDMETHODCALLTYPE addObserver(
+ /* [in] */ IWebNotificationObserver *observer,
+ /* [in] */ BSTR notificationName,
+ /* [in] */ IUnknown *anObject);
+
+ virtual HRESULT STDMETHODCALLTYPE postNotification(
+ /* [in] */ IWebNotification *notification);
+
+ virtual HRESULT STDMETHODCALLTYPE postNotificationName(
+ /* [in] */ BSTR notificationName,
+ /* [in] */ IUnknown *anObject,
+ /* [optional][in] */ IPropertyBag *userInfo);
+
+ virtual HRESULT STDMETHODCALLTYPE removeObserver(
+ /* [in] */ IWebNotificationObserver *anObserver,
+ /* [in] */ BSTR notificationName,
+ /* [optional][in] */ IUnknown *anObject);
+
+ // WebNotificationCenter
+ static IWebNotificationCenter* defaultCenterInternal();
+ void postNotificationInternal(IWebNotification* notification, BSTR notificationName, IUnknown* anObject);
+
+protected:
+ ULONG m_refCount;
+ OwnPtr<WebNotificationCenterPrivate> d;
+ static IWebNotificationCenter* m_defaultCenter;
+};
+
+#endif // WebNotificationCenter_H
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
new file mode 100644
index 0000000..12a3b74
--- /dev/null
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2005, 2006, 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple" nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+// These are private because callers should be using the cover methods. They are in
+// a Private (as opposed to Internal) header file because Safari uses some of them
+// for managed preferences.
+#define WebKitLogLevelPreferenceKey "WebKitLogLevel"
+#define WebKitStandardFontPreferenceKey "WebKitStandardFont"
+#define WebKitFixedFontPreferenceKey "WebKitFixedFont"
+#define WebKitSerifFontPreferenceKey "WebKitSerifFont"
+#define WebKitSansSerifFontPreferenceKey "WebKitSansSerifFont"
+#define WebKitCursiveFontPreferenceKey "WebKitCursiveFont"
+#define WebKitFantasyFontPreferenceKey "WebKitFantasyFont"
+#define WebKitMinimumFontSizePreferenceKey "WebKitMinimumFontSize"
+#define WebKitMinimumLogicalFontSizePreferenceKey "WebKitMinimumLogicalFontSize"
+#define WebKitDefaultFontSizePreferenceKey "WebKitDefaultFontSize"
+#define WebKitDefaultFixedFontSizePreferenceKey "WebKitDefaultFixedFontSize"
+#define WebKitDefaultTextEncodingNamePreferenceKey "WebKitDefaultTextEncodingName"
+#define WebKitUserStyleSheetEnabledPreferenceKey "WebKitUserStyleSheetEnabledPreferenceKey"
+#define WebKitUserStyleSheetLocationPreferenceKey "WebKitUserStyleSheetLocationPreferenceKey"
+#define WebKitShouldPrintBackgroundsPreferenceKey "WebKitShouldPrintBackgroundsPreferenceKey"
+#define WebKitTextAreasAreResizablePreferenceKey "WebKitTextAreasAreResizable"
+#define WebKitJavaEnabledPreferenceKey "WebKitJavaEnabled"
+#define WebKitJavaScriptEnabledPreferenceKey "WebKitJavaScriptEnabled"
+#define WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey "WebKitJavaScriptCanOpenWindowsAutomatically"
+#define WebKitPluginsEnabledPreferenceKey "WebKitPluginsEnabled"
+#define WebKitAllowAnimatedImagesPreferenceKey "WebKitAllowAnimatedImagesPreferenceKey"
+#define WebKitAllowAnimatedImageLoopingPreferenceKey "WebKitAllowAnimatedImageLoopingPreferenceKey"
+#define WebKitDisplayImagesKey "WebKitDisplayImagesKey"
+#define WebKitBackForwardCacheExpirationIntervalKey "WebKitBackForwardCacheExpirationIntervalKey"
+#define WebKitTabToLinksPreferenceKey "WebKitTabToLinksPreferenceKey"
+#define WebKitPrivateBrowsingEnabledPreferenceKey "WebKitPrivateBrowsingEnabled"
+#define WebKitIconDatabaseLocationKey "WebKitIconDatabaseLocation"
+#define WebKitIconDatabaseEnabledPreferenceKey "WebKitIconDatabaseEnabled"
+#define WebKitUsesPageCachePreferenceKey "WebKitUsesPageCachePreferenceKey"
+#define WebKitCacheModelPreferenceKey "WebKitCacheModelPreferenceKey"
+
+// These are private both because callers should be using the cover methods and because the
+// cover methods themselves are private.
+#define WebKitRespectStandardStyleKeyEquivalentsPreferenceKey "WebKitRespectStandardStyleKeyEquivalents"
+#define WebKitShowsURLsInToolTipsPreferenceKey "WebKitShowsURLsInToolTips"
+#define WebKitPDFDisplayModePreferenceKey "WebKitPDFDisplayMode"
+#define WebKitPDFScaleFactorPreferenceKey "WebKitPDFScaleFactor"
+#define WebKitEditableLinkBehaviorPreferenceKey "WebKitEditableLinkBehavior"
+
+// Window display is throttled to 60 frames per second if WebKitThrottleWindowDisplayPreferenceKey
+// is set to YES. The window display throttle is OFF by default for compatibility with Mac OS X
+// 10.4.6.
+#define WebKitThrottleWindowDisplayPreferenceKey "WebKitThrottleWindowDisplay"
+
+// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
+// to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
+// default.
+#define WebKitEnableDeferredUpdatesPreferenceKey "WebKitEnableDeferredUpdates"
+
+// For debugging only. Don't use these.
+#define WebKitPageCacheSizePreferenceKey "WebKitPageCacheSizePreferenceKey"
+#define WebKitObjectCacheSizePreferenceKey "WebKitObjectCacheSizePreferenceKey"
+
+// From WebHistory.h
+#define WebKitHistoryItemLimitKey "WebKitHistoryItemLimit" // default: "1000"
+#define WebKitHistoryAgeInDaysLimitKey "WebKitHistoryAgeInDaysLimit" // default: "7"
+
+// Windows-specific keys
+#define WebKitFontSmoothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2)
+#define WebKitCookieStorageAcceptPolicyPreferenceKey "WebKitCookieStorageAcceptPolicy" // default: WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain
+
+#define WebContinuousSpellCheckingEnabledPreferenceKey "WebContinuousSpellCheckingEnabled" // default: false
+#define WebGrammarCheckingEnabledPreferenceKey "WebGrammarCheckingEnabled" // default: false
+
+#define AllowContinuousSpellCheckingPreferenceKey "AllowContinuousSpellCheckingPreferenceKey" // default: true
+
+#define WebKitDOMPasteAllowedPreferenceKey "WebKitDOMPasteAllowedPreferenceKey" // default: false
+
+// If this key is present and has a value of true, we have already removed the default values from the user's preferences <rdar://problem/5214504>
+#define WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey "WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey"
+
+#define WebKitDidMigrateWebKitPreferencesToCFPreferencesPreferenceKey "WebKitDidMigrateWebKitPreferencesToCFPreferences"
+
+#define WebKitDeveloperExtrasEnabledPreferenceKey "WebKitDeveloperExtras"
+#define DisableWebKitDeveloperExtrasPreferenceKey "DisableWebKitDeveloperExtras"
+
+#define WebKitAuthorAndUserStylesEnabledPreferenceKey "WebKitAuthorAndUserStylesEnabled"
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
new file mode 100644
index 0000000..689efc0
--- /dev/null
+++ b/WebKit/win/WebPreferences.cpp
@@ -0,0 +1,1132 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKit.h"
+#include "WebKitDLL.h"
+#include "WebPreferences.h"
+#include "WebKit.h"
+
+#include "WebNotificationCenter.h"
+#include "WebPreferenceKeysPrivate.h"
+
+#pragma warning( push, 0 )
+#include <WebCore/CString.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/Font.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/StringHash.h>
+#include "WebLocalizableStrings.h"
+#pragma warning( pop )
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <shlobj.h>
+#include <shfolder.h>
+#include <tchar.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/HashMap.h>
+#include <wtf/OwnArrayPtr.h>
+
+using namespace WebCore;
+
+static const String& oldPreferencesPath()
+{
+ static String path = pathByAppendingComponent(roamingUserSpecificStorageDirectory(), "WebKitPreferences.plist");
+ return path;
+}
+
+template<typename NumberType> struct CFNumberTraits { static const unsigned Type; };
+template<> struct CFNumberTraits<int> { static const unsigned Type = kCFNumberSInt32Type; };
+template<> struct CFNumberTraits<LONGLONG> { static const unsigned Type = kCFNumberLongLongType; };
+template<> struct CFNumberTraits<float> { static const unsigned Type = kCFNumberFloat32Type; };
+
+template<typename NumberType>
+static NumberType numberValueForPreferencesValue(CFPropertyListRef value)
+{
+ if (!value)
+ return 0;
+
+ CFTypeID cfType = CFGetTypeID(value);
+ if (cfType == CFStringGetTypeID())
+ return static_cast<NumberType>(CFStringGetIntValue(static_cast<CFStringRef>(value)));
+ else if (cfType == CFBooleanGetTypeID()) {
+ Boolean boolVal = CFBooleanGetValue(static_cast<CFBooleanRef>(value));
+ return boolVal ? 1 : 0;
+ } else if (cfType == CFNumberGetTypeID()) {
+ NumberType val = 0;
+ CFNumberGetValue(static_cast<CFNumberRef>(value), CFNumberTraits<NumberType>::Type, &val);
+ return val;
+ }
+
+ return 0;
+}
+
+template<typename NumberType>
+static RetainPtr<CFNumberRef> cfNumber(NumberType value)
+{
+ return RetainPtr<CFNumberRef>(AdoptCF, CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
+}
+
+static bool booleanValueForPreferencesValue(CFPropertyListRef value)
+{
+ return numberValueForPreferencesValue<int>(value);
+}
+
+// WebPreferences ----------------------------------------------------------------
+
+static CFDictionaryRef defaultSettings;
+
+static HashMap<WebCore::String, WebPreferences*> webPreferencesInstances;
+
+WebPreferences* WebPreferences::sharedStandardPreferences()
+{
+ static WebPreferences* standardPreferences;
+ if (!standardPreferences) {
+ standardPreferences = WebPreferences::createInstance();
+ standardPreferences->setAutosaves(TRUE);
+ standardPreferences->load();
+ }
+
+ return standardPreferences;
+}
+
+WebPreferences::WebPreferences()
+ : m_refCount(0)
+ , m_autoSaves(0)
+ , m_automaticallyDetectsCacheModel(true)
+ , m_numWebViews(0)
+{
+ gClassCount++;
+}
+
+WebPreferences::~WebPreferences()
+{
+ gClassCount--;
+}
+
+WebPreferences* WebPreferences::createInstance()
+{
+ WebPreferences* instance = new WebPreferences();
+ instance->AddRef();
+ return instance;
+}
+
+HRESULT WebPreferences::postPreferencesChangesNotification()
+{
+ IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
+ HRESULT hr = nc->postNotificationName(webPreferencesChangedNotification(), static_cast<IWebPreferences*>(this), 0);
+ if (FAILED(hr))
+ return hr;
+
+ return S_OK;
+}
+
+WebPreferences* WebPreferences::getInstanceForIdentifier(BSTR identifier)
+{
+ if (!identifier)
+ return sharedStandardPreferences();
+
+ WebCore::String identifierString(identifier, SysStringLen(identifier));
+ return webPreferencesInstances.get(identifierString);
+}
+
+void WebPreferences::setInstance(WebPreferences* instance, BSTR identifier)
+{
+ if (!identifier || !instance)
+ return;
+ WebCore::String identifierString(identifier, SysStringLen(identifier));
+ webPreferencesInstances.add(identifierString, instance);
+}
+
+void WebPreferences::removeReferenceForIdentifier(BSTR identifier)
+{
+ if (!identifier || webPreferencesInstances.isEmpty())
+ return;
+
+ WebCore::String identifierString(identifier, SysStringLen(identifier));
+ WebPreferences* webPreference = webPreferencesInstances.get(identifierString);
+ if (webPreference && webPreference->m_refCount == 1)
+ webPreferencesInstances.remove(identifierString);
+}
+
+void WebPreferences::initializeDefaultSettings()
+{
+ if (defaultSettings)
+ return;
+
+ CFMutableDictionaryRef defaults = CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+
+ CFDictionaryAddValue(defaults, CFSTR(WebKitStandardFontPreferenceKey), CFSTR("Times New Roman"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitFixedFontPreferenceKey), CFSTR("Courier New"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitSerifFontPreferenceKey), CFSTR("Times New Roman"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitSansSerifFontPreferenceKey), CFSTR("Arial"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitCursiveFontPreferenceKey), CFSTR("Comic Sans MS"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitFantasyFontPreferenceKey), CFSTR("Comic Sans MS"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumFontSizePreferenceKey), CFSTR("1"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumLogicalFontSizePreferenceKey), CFSTR("9"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFontSizePreferenceKey), CFSTR("16"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFixedFontSizePreferenceKey), CFSTR("13"));
+ WebCore::String defaultDefaultEncoding(LPCTSTR_UI_STRING("ISO-8859-1", "The default, default character encoding"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultTextEncodingNamePreferenceKey), defaultDefaultEncoding.createCFString());
+
+ CFDictionaryAddValue(defaults, CFSTR(WebKitUserStyleSheetEnabledPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitUserStyleSheetLocationPreferenceKey), CFSTR(""));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitShouldPrintBackgroundsPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitTextAreasAreResizablePreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitJavaEnabledPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptEnabledPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitPluginsEnabledPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImagesPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitDisplayImagesKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitBackForwardCacheExpirationIntervalKey), CFSTR("1800"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitTabToLinksPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitPrivateBrowsingEnabledPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitRespectStandardStyleKeyEquivalentsPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitShowsURLsInToolTipsPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitPDFDisplayModePreferenceKey), CFSTR("1"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitPDFScaleFactorPreferenceKey), CFSTR("0"));
+
+ RetainPtr<CFStringRef> linkBehaviorStringRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebKitEditableLinkDefaultBehavior));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitEditableLinkBehaviorPreferenceKey), linkBehaviorStringRef.get());
+
+ CFDictionaryAddValue(defaults, CFSTR(WebKitHistoryItemLimitKey), CFSTR("1000"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitHistoryAgeInDaysLimitKey), CFSTR("7"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseLocationKey), CFSTR(""));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseEnabledPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingTypePreferenceKey), CFSTR("2"));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), CFSTR("2"));
+ CFDictionaryAddValue(defaults, CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebGrammarCheckingEnabledPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(AllowContinuousSpellCheckingPreferenceKey), kCFBooleanTrue);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitUsesPageCachePreferenceKey), kCFBooleanTrue);
+
+ RetainPtr<CFStringRef> cacheModelRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebCacheModelDocumentViewer));
+ CFDictionaryAddValue(defaults, CFSTR(WebKitCacheModelPreferenceKey), cacheModelRef.get());
+
+ CFDictionaryAddValue(defaults, CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey), kCFBooleanTrue);
+
+ defaultSettings = defaults;
+}
+
+RetainPtr<CFPropertyListRef> WebPreferences::valueForKey(CFStringRef key)
+{
+ RetainPtr<CFPropertyListRef> value = CFDictionaryGetValue(m_privatePrefs.get(), key);
+ if (value)
+ return value;
+
+ value.adoptCF(CFPreferencesCopyAppValue(key, kCFPreferencesCurrentApplication));
+ if (value)
+ return value;
+
+ return CFDictionaryGetValue(defaultSettings, key);
+}
+
+void WebPreferences::setValueForKey(CFStringRef key, CFPropertyListRef value)
+{
+ CFDictionarySetValue(m_privatePrefs.get(), key, value);
+ if (m_autoSaves) {
+ CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication);
+ save();
+ }
+}
+
+BSTR WebPreferences::stringValueForKey(CFStringRef key)
+{
+ RetainPtr<CFPropertyListRef> value = valueForKey(key);
+
+ if (!value || (CFGetTypeID(value.get()) != CFStringGetTypeID()))
+ return 0;
+
+ CFStringRef str = static_cast<CFStringRef>(value.get());
+
+ CFIndex length = CFStringGetLength(str);
+ const UniChar* uniChars = CFStringGetCharactersPtr(str);
+ if (uniChars)
+ return SysAllocStringLen((LPCTSTR)uniChars, length);
+
+ BSTR bstr = SysAllocStringLen(0, length);
+ if (!bstr)
+ return 0;
+
+ if (!CFStringGetCString(str, (char*)bstr, (length+1)*sizeof(WCHAR), kCFStringEncodingUTF16)) {
+ SysFreeString(bstr);
+ return 0;
+ }
+
+ bstr[length] = 0;
+ return bstr;
+}
+
+int WebPreferences::integerValueForKey(CFStringRef key)
+{
+ return numberValueForPreferencesValue<int>(valueForKey(key).get());
+}
+
+BOOL WebPreferences::boolValueForKey(CFStringRef key)
+{
+ return booleanValueForPreferencesValue(valueForKey(key).get());
+}
+
+float WebPreferences::floatValueForKey(CFStringRef key)
+{
+ return numberValueForPreferencesValue<float>(valueForKey(key).get());
+}
+
+LONGLONG WebPreferences::longlongValueForKey(CFStringRef key)
+{
+ return numberValueForPreferencesValue<LONGLONG>(valueForKey(key).get());
+}
+
+void WebPreferences::setStringValue(CFStringRef key, LPCTSTR value)
+{
+ BSTR val = stringValueForKey(key);
+ if (val && !_tcscmp(val, value))
+ return;
+ SysFreeString(val);
+
+ RetainPtr<CFStringRef> valueRef(AdoptCF,
+ CFStringCreateWithCharactersNoCopy(0, (UniChar*)_wcsdup(value), (CFIndex)_tcslen(value), kCFAllocatorMalloc));
+ setValueForKey(key, valueRef.get());
+
+ postPreferencesChangesNotification();
+}
+
+void WebPreferences::setIntegerValue(CFStringRef key, int value)
+{
+ if (integerValueForKey(key) == value)
+ return;
+
+ setValueForKey(key, cfNumber(value).get());
+
+ postPreferencesChangesNotification();
+}
+
+void WebPreferences::setBoolValue(CFStringRef key, BOOL value)
+{
+ if (boolValueForKey(key) == value)
+ return;
+
+ setValueForKey(key, value ? kCFBooleanTrue : kCFBooleanFalse);
+
+ postPreferencesChangesNotification();
+}
+
+void WebPreferences::setLongLongValue(CFStringRef key, LONGLONG value)
+{
+ if (longlongValueForKey(key) == value)
+ return;
+
+ setValueForKey(key, cfNumber(value).get());
+
+ postPreferencesChangesNotification();
+}
+
+BSTR WebPreferences::webPreferencesChangedNotification()
+{
+ static BSTR webPreferencesChangedNotification = SysAllocString(WebPreferencesChangedNotification);
+ return webPreferencesChangedNotification;
+}
+
+BSTR WebPreferences::webPreferencesRemovedNotification()
+{
+ static BSTR webPreferencesRemovedNotification = SysAllocString(WebPreferencesRemovedNotification);
+ return webPreferencesRemovedNotification;
+}
+
+void WebPreferences::save()
+{
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+}
+
+void WebPreferences::load()
+{
+ initializeDefaultSettings();
+
+ m_privatePrefs.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ migrateWebKitPreferencesToCFPreferences();
+}
+
+void WebPreferences::migrateWebKitPreferencesToCFPreferences()
+{
+ CFStringRef didMigrateKey = CFSTR(WebKitDidMigrateWebKitPreferencesToCFPreferencesPreferenceKey);
+ if (boolValueForKey(didMigrateKey))
+ return;
+ bool oldValue = m_autoSaves;
+ m_autoSaves = true;
+ setBoolValue(didMigrateKey, TRUE);
+ m_autoSaves = oldValue;
+
+ CString path = oldPreferencesPath().utf8();
+
+ RetainPtr<CFURLRef> urlRef(AdoptCF, CFURLCreateFromFileSystemRepresentation(0, reinterpret_cast<const UInt8*>(path.data()), path.length(), false));
+ if (!urlRef)
+ return;
+
+ RetainPtr<CFReadStreamRef> stream(AdoptCF, CFReadStreamCreateWithFile(0, urlRef.get()));
+ if (!stream)
+ return;
+
+ if (!CFReadStreamOpen(stream.get()))
+ return;
+
+ CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0 | kCFPropertyListXMLFormat_v1_0;
+ RetainPtr<CFPropertyListRef> plist(AdoptCF, CFPropertyListCreateFromStream(0, stream.get(), 0, kCFPropertyListMutableContainersAndLeaves, &format, 0));
+ CFReadStreamClose(stream.get());
+
+ if (!plist || CFGetTypeID(plist.get()) != CFDictionaryGetTypeID())
+ return;
+
+ copyWebKitPreferencesToCFPreferences(static_cast<CFDictionaryRef>(plist.get()));
+
+ deleteFile(oldPreferencesPath());
+}
+
+void WebPreferences::copyWebKitPreferencesToCFPreferences(CFDictionaryRef dict)
+{
+ ASSERT_ARG(dict, dict);
+
+ int count = CFDictionaryGetCount(dict);
+ if (count <= 0)
+ return;
+
+ CFStringRef didRemoveDefaultsKey = CFSTR(WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey);
+ bool omitDefaults = !booleanValueForPreferencesValue(CFDictionaryGetValue(dict, didRemoveDefaultsKey));
+
+ OwnArrayPtr<CFTypeRef> keys(new CFTypeRef[count]);
+ OwnArrayPtr<CFTypeRef> values(new CFTypeRef[count]);
+ CFDictionaryGetKeysAndValues(dict, keys.get(), values.get());
+
+ for (int i = 0; i < count; ++i) {
+ if (!keys[i] || !values[i] || CFGetTypeID(keys[i]) != CFStringGetTypeID())
+ continue;
+
+ if (omitDefaults) {
+ CFTypeRef defaultValue = CFDictionaryGetValue(defaultSettings, keys[i]);
+ if (defaultValue && CFEqual(defaultValue, values[i]))
+ continue;
+ }
+
+ setValueForKey(static_cast<CFStringRef>(keys[i]), values[i]);
+ }
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebPreferences::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebPreferences*>(this);
+ else if (IsEqualGUID(riid, IID_IWebPreferences))
+ *ppvObject = static_cast<IWebPreferences*>(this);
+ else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate))
+ *ppvObject = static_cast<IWebPreferencesPrivate*>(this);
+ else if (IsEqualGUID(riid, CLSID_WebPreferences))
+ *ppvObject = this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebPreferences::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebPreferences::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebPreferences ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebPreferences::standardPreferences(
+ /* [retval][out] */ IWebPreferences** standardPreferences)
+{
+ if (!standardPreferences)
+ return E_POINTER;
+ *standardPreferences = sharedStandardPreferences();
+ (*standardPreferences)->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::initWithIdentifier(
+ /* [in] */ BSTR anIdentifier,
+ /* [retval][out] */ IWebPreferences** preferences)
+{
+ WebPreferences *instance = getInstanceForIdentifier(anIdentifier);
+ if (instance) {
+ *preferences = instance;
+ instance->AddRef();
+ return S_OK;
+ }
+
+ load();
+
+ *preferences = this;
+ AddRef();
+
+ if (anIdentifier) {
+ m_identifier = anIdentifier;
+ setInstance(this, m_identifier);
+ }
+
+ this->postPreferencesChangesNotification();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::identifier(
+ /* [retval][out] */ BSTR* ident)
+{
+ if (!ident)
+ return E_POINTER;
+ *ident = m_identifier ? SysAllocString(m_identifier) : 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::standardFontFamily(
+ /* [retval][out] */ BSTR* family)
+{
+ *family = stringValueForKey(CFSTR(WebKitStandardFontPreferenceKey));
+ return (*family) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setStandardFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitStandardFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::fixedFontFamily(
+ /* [retval][out] */ BSTR* family)
+{
+ *family = stringValueForKey(CFSTR(WebKitFixedFontPreferenceKey));
+ return (*family) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setFixedFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitFixedFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::serifFontFamily(
+ /* [retval][out] */ BSTR* fontFamily)
+{
+ *fontFamily = stringValueForKey(CFSTR(WebKitSerifFontPreferenceKey));
+ return (*fontFamily) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setSerifFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitSerifFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::sansSerifFontFamily(
+ /* [retval][out] */ BSTR* family)
+{
+ *family = stringValueForKey(CFSTR(WebKitSansSerifFontPreferenceKey));
+ return (*family) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setSansSerifFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitSansSerifFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::cursiveFontFamily(
+ /* [retval][out] */ BSTR* family)
+{
+ *family = stringValueForKey(CFSTR(WebKitCursiveFontPreferenceKey));
+ return (*family) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setCursiveFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitCursiveFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::fantasyFontFamily(
+ /* [retval][out] */ BSTR* family)
+{
+ *family = stringValueForKey(CFSTR(WebKitFantasyFontPreferenceKey));
+ return (*family) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setFantasyFontFamily(
+ /* [in] */ BSTR family)
+{
+ setStringValue(CFSTR(WebKitFantasyFontPreferenceKey), family);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::defaultFontSize(
+ /* [retval][out] */ int* fontSize)
+{
+ *fontSize = integerValueForKey(CFSTR(WebKitDefaultFontSizePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setDefaultFontSize(
+ /* [in] */ int fontSize)
+{
+ setIntegerValue(CFSTR(WebKitDefaultFontSizePreferenceKey), fontSize);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::defaultFixedFontSize(
+ /* [retval][out] */ int* fontSize)
+{
+ *fontSize = integerValueForKey(CFSTR(WebKitDefaultFixedFontSizePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setDefaultFixedFontSize(
+ /* [in] */ int fontSize)
+{
+ setIntegerValue(CFSTR(WebKitDefaultFixedFontSizePreferenceKey), fontSize);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::minimumFontSize(
+ /* [retval][out] */ int* fontSize)
+{
+ *fontSize = integerValueForKey(CFSTR(WebKitMinimumFontSizePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setMinimumFontSize(
+ /* [in] */ int fontSize)
+{
+ setIntegerValue(CFSTR(WebKitMinimumFontSizePreferenceKey), fontSize);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::minimumLogicalFontSize(
+ /* [retval][out] */ int* fontSize)
+{
+ *fontSize = integerValueForKey(CFSTR(WebKitMinimumLogicalFontSizePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setMinimumLogicalFontSize(
+ /* [in] */ int fontSize)
+{
+ setIntegerValue(CFSTR(WebKitMinimumLogicalFontSizePreferenceKey), fontSize);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::defaultTextEncodingName(
+ /* [retval][out] */ BSTR* name)
+{
+ *name = stringValueForKey(CFSTR(WebKitDefaultTextEncodingNamePreferenceKey));
+ return (*name) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setDefaultTextEncodingName(
+ /* [in] */ BSTR name)
+{
+ setStringValue(CFSTR(WebKitDefaultTextEncodingNamePreferenceKey), name);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::userStyleSheetEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitUserStyleSheetEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setUserStyleSheetEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitUserStyleSheetEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::userStyleSheetLocation(
+ /* [retval][out] */ BSTR* location)
+{
+ *location = stringValueForKey(CFSTR(WebKitUserStyleSheetLocationPreferenceKey));
+ return (*location) ? S_OK : E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setUserStyleSheetLocation(
+ /* [in] */ BSTR location)
+{
+ setStringValue(CFSTR(WebKitUserStyleSheetLocationPreferenceKey), location);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::isJavaEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitJavaEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setJavaEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitJavaEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::isJavaScriptEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitJavaScriptEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setJavaScriptEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitJavaScriptEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::javaScriptCanOpenWindowsAutomatically(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setJavaScriptCanOpenWindowsAutomatically(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::arePlugInsEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitPluginsEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setPlugInsEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitPluginsEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::allowsAnimatedImages(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitAllowAnimatedImagesPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setAllowsAnimatedImages(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitAllowAnimatedImagesPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::allowAnimatedImageLooping(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setAllowAnimatedImageLooping(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setLoadsImagesAutomatically(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitDisplayImagesKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::loadsImagesAutomatically(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitDisplayImagesKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setAutosaves(
+ /* [in] */ BOOL enabled)
+{
+ m_autoSaves = !!enabled;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::autosaves(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = m_autoSaves ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setShouldPrintBackgrounds(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitShouldPrintBackgroundsPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::shouldPrintBackgrounds(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitShouldPrintBackgroundsPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setPrivateBrowsingEnabled(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitPrivateBrowsingEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::privateBrowsingEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitPrivateBrowsingEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setTabsToLinks(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitTabToLinksPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::tabsToLinks(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitTabToLinksPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setUsesPageCache(
+ /* [in] */ BOOL usesPageCache)
+{
+ setBoolValue(CFSTR(WebKitUsesPageCachePreferenceKey), usesPageCache);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::usesPageCache(
+ /* [retval][out] */ BOOL* usesPageCache)
+{
+ *usesPageCache = boolValueForKey(CFSTR(WebKitUsesPageCachePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::textAreasAreResizable(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitTextAreasAreResizablePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setTextAreasAreResizable(
+ /* [in] */ BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitTextAreasAreResizablePreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::historyItemLimit(int* limit)
+{
+ *limit = integerValueForKey(CFSTR(WebKitHistoryItemLimitKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setHistoryItemLimit(int limit)
+{
+ setIntegerValue(CFSTR(WebKitHistoryItemLimitKey), limit);
+ return S_OK;
+}
+
+HRESULT WebPreferences::historyAgeInDaysLimit(int* limit)
+{
+ *limit = integerValueForKey(CFSTR(WebKitHistoryAgeInDaysLimitKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setHistoryAgeInDaysLimit(int limit)
+{
+ setIntegerValue(CFSTR(WebKitHistoryAgeInDaysLimitKey), limit);
+ return S_OK;
+}
+
+HRESULT WebPreferences::unused1()
+{
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+}
+
+HRESULT WebPreferences::unused2()
+{
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+}
+
+HRESULT WebPreferences::iconDatabaseLocation(
+ /* [out] */ BSTR* location)
+{
+ *location = stringValueForKey(CFSTR(WebKitIconDatabaseLocationKey));
+ return (*location) ? S_OK : E_FAIL;
+}
+
+HRESULT WebPreferences::setIconDatabaseLocation(
+ /* [in] */ BSTR location)
+{
+ setStringValue(CFSTR(WebKitIconDatabaseLocationKey), location);
+ return S_OK;
+}
+
+HRESULT WebPreferences::iconDatabaseEnabled(BOOL* enabled)//location)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitIconDatabaseEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setIconDatabaseEnabled(BOOL enabled )//location)
+{
+ setBoolValue(CFSTR(WebKitIconDatabaseEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::fontSmoothing(
+ /* [retval][out] */ FontSmoothingType* smoothingType)
+{
+ *smoothingType = (FontSmoothingType) integerValueForKey(CFSTR(WebKitFontSmoothingTypePreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothing(
+ /* [in] */ FontSmoothingType smoothingType)
+{
+ setIntegerValue(CFSTR(WebKitFontSmoothingTypePreferenceKey), smoothingType);
+ if (smoothingType == FontSmoothingTypeWindows)
+ smoothingType = FontSmoothingTypeStandard;
+ wkSetFontSmoothingLevel((int)smoothingType);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::editableLinkBehavior(
+ /* [out, retval] */ WebKitEditableLinkBehavior* editableLinkBehavior)
+{
+ WebKitEditableLinkBehavior value = (WebKitEditableLinkBehavior) integerValueForKey(CFSTR(WebKitEditableLinkBehaviorPreferenceKey));
+ switch (value) {
+ case WebKitEditableLinkDefaultBehavior:
+ case WebKitEditableLinkAlwaysLive:
+ case WebKitEditableLinkOnlyLiveWithShiftKey:
+ case WebKitEditableLinkLiveWhenNotFocused:
+ case WebKitEditableLinkNeverLive:
+ *editableLinkBehavior = value;
+ break;
+ default: // ensure that a valid result is returned
+ *editableLinkBehavior = WebKitEditableLinkDefaultBehavior;
+ break;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setEditableLinkBehavior(
+ /* [in] */ WebKitEditableLinkBehavior behavior)
+{
+ setIntegerValue(CFSTR(WebKitEditableLinkBehaviorPreferenceKey), behavior);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::cookieStorageAcceptPolicy(
+ /* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy )
+{
+ if (!acceptPolicy)
+ return E_POINTER;
+
+ *acceptPolicy = (WebKitCookieStorageAcceptPolicy)integerValueForKey(CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setCookieStorageAcceptPolicy(
+ /* [in] */ WebKitCookieStorageAcceptPolicy acceptPolicy)
+{
+ setIntegerValue(CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), acceptPolicy);
+ return S_OK;
+}
+
+
+HRESULT WebPreferences::continuousSpellCheckingEnabled(BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setContinuousSpellCheckingEnabled(BOOL enabled)
+{
+ setBoolValue(CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::grammarCheckingEnabled(BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebGrammarCheckingEnabledPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setGrammarCheckingEnabled(BOOL enabled)
+{
+ setBoolValue(CFSTR(WebGrammarCheckingEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::allowContinuousSpellChecking(BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(AllowContinuousSpellCheckingPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setAllowContinuousSpellChecking(BOOL enabled)
+{
+ setBoolValue(CFSTR(AllowContinuousSpellCheckingPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::isDOMPasteAllowed(BOOL* enabled)
+{
+ *enabled = boolValueForKey(CFSTR(WebKitDOMPasteAllowedPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setDOMPasteAllowed(BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitDOMPasteAllowedPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::cacheModel(WebCacheModel* cacheModel)
+{
+ if (!cacheModel)
+ return E_POINTER;
+
+ *cacheModel = (WebCacheModel)integerValueForKey(CFSTR(WebKitCacheModelPreferenceKey));
+ return S_OK;
+}
+
+HRESULT WebPreferences::setCacheModel(WebCacheModel cacheModel)
+{
+ setIntegerValue(CFSTR(WebKitCacheModelPreferenceKey), cacheModel);
+ return S_OK;
+}
+
+HRESULT WebPreferences::setDeveloperExtrasEnabled(BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitDeveloperExtrasEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT WebPreferences::developerExtrasEnabled(BOOL* enabled)
+{
+ if (!enabled)
+ return E_POINTER;
+
+ *enabled = boolValueForKey(CFSTR(WebKitDeveloperExtrasEnabledPreferenceKey));
+ return S_OK;
+}
+
+bool WebPreferences::developerExtrasDisabledByOverride()
+{
+ return !!boolValueForKey(CFSTR(DisableWebKitDeveloperExtrasPreferenceKey));
+}
+
+HRESULT WebPreferences::setAutomaticallyDetectsCacheModel(BOOL automaticallyDetectsCacheModel)
+{
+ m_automaticallyDetectsCacheModel = !!automaticallyDetectsCacheModel;
+ return S_OK;
+}
+
+HRESULT WebPreferences::automaticallyDetectsCacheModel(BOOL* automaticallyDetectsCacheModel)
+{
+ if (!automaticallyDetectsCacheModel)
+ return E_POINTER;
+
+ *automaticallyDetectsCacheModel = m_automaticallyDetectsCacheModel;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setAuthorAndUserStylesEnabled(BOOL enabled)
+{
+ setBoolValue(CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey), enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::authorAndUserStylesEnabled(BOOL* enabled)
+{
+ if (!enabled)
+ return E_POINTER;
+
+ *enabled = boolValueForKey(CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey));
+ return S_OK;
+}
+
+void WebPreferences::willAddToWebView()
+{
+ ++m_numWebViews;
+}
+
+void WebPreferences::didRemoveFromWebView()
+{
+ ASSERT(m_numWebViews);
+ if (--m_numWebViews == 0) {
+ IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
+ nc->postNotificationName(webPreferencesRemovedNotification(), static_cast<IWebPreferences*>(this), 0);
+ }
+}
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
new file mode 100644
index 0000000..91bc558
--- /dev/null
+++ b/WebKit/win/WebPreferences.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPreferences_H
+#define WebPreferences_H
+
+#include "WebKit.h"
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/BString.h>
+#include <wtf/RetainPtr.h>
+
+class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate {
+public:
+ static WebPreferences* createInstance();
+protected:
+ WebPreferences();
+ ~WebPreferences();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebPreferences
+ virtual HRESULT STDMETHODCALLTYPE standardPreferences(
+ /* [retval][out] */ IWebPreferences** standardPreferences);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithIdentifier(
+ /* [in] */ BSTR anIdentifier,
+ /* [retval][out] */ IWebPreferences** preferences);
+
+ virtual HRESULT STDMETHODCALLTYPE identifier(
+ /* [retval][out] */ BSTR* ident);
+
+ virtual HRESULT STDMETHODCALLTYPE standardFontFamily(
+ /* [retval][out] */ BSTR* family);
+
+ virtual HRESULT STDMETHODCALLTYPE setStandardFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE fixedFontFamily(
+ /* [retval][out] */ BSTR* family);
+
+ virtual HRESULT STDMETHODCALLTYPE setFixedFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE serifFontFamily(
+ /* [retval][out] */ BSTR* fontFamily);
+
+ virtual HRESULT STDMETHODCALLTYPE setSerifFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE sansSerifFontFamily(
+ /* [retval][out] */ BSTR* family);
+
+ virtual HRESULT STDMETHODCALLTYPE setSansSerifFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE cursiveFontFamily(
+ /* [retval][out] */ BSTR* family);
+
+ virtual HRESULT STDMETHODCALLTYPE setCursiveFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE fantasyFontFamily(
+ /* [retval][out] */ BSTR* family);
+
+ virtual HRESULT STDMETHODCALLTYPE setFantasyFontFamily(
+ /* [in] */ BSTR family);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultFontSize(
+ /* [retval][out] */ int* fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultFontSize(
+ /* [in] */ int fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultFixedFontSize(
+ /* [retval][out] */ int* fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultFixedFontSize(
+ /* [in] */ int fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE minimumFontSize(
+ /* [retval][out] */ int* fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setMinimumFontSize(
+ /* [in] */ int fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE minimumLogicalFontSize(
+ /* [retval][out] */ int* fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setMinimumLogicalFontSize(
+ /* [in] */ int fontSize);
+
+ virtual HRESULT STDMETHODCALLTYPE defaultTextEncodingName(
+ /* [retval][out] */ BSTR* name);
+
+ virtual HRESULT STDMETHODCALLTYPE setDefaultTextEncodingName(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE userStyleSheetEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setUserStyleSheetEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE userStyleSheetLocation(
+ /* [retval][out] */ BSTR* location);
+
+ virtual HRESULT STDMETHODCALLTYPE setUserStyleSheetLocation(
+ /* [in] */ BSTR location);
+
+ virtual HRESULT STDMETHODCALLTYPE isJavaEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setJavaEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE isJavaScriptEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setJavaScriptEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE javaScriptCanOpenWindowsAutomatically(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setJavaScriptCanOpenWindowsAutomatically(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE arePlugInsEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setPlugInsEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE allowsAnimatedImages(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowsAnimatedImages(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE allowAnimatedImageLooping(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowAnimatedImageLooping(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setLoadsImagesAutomatically(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE loadsImagesAutomatically(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setAutosaves(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE autosaves(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setShouldPrintBackgrounds(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE shouldPrintBackgrounds(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setPrivateBrowsingEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE privateBrowsingEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setTabsToLinks(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE tabsToLinks(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE textAreasAreResizable(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setTextAreasAreResizable(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE usesPageCache(
+ /* [retval][out] */ BOOL *usesPageCache);
+
+ virtual HRESULT STDMETHODCALLTYPE setUsesPageCache(
+ /* [in] */ BOOL usesPageCache);
+
+ virtual HRESULT STDMETHODCALLTYPE unused1();
+ virtual HRESULT STDMETHODCALLTYPE unused2();
+
+ virtual HRESULT STDMETHODCALLTYPE iconDatabaseLocation(
+ /* [retval][out] */ BSTR* location);
+
+ virtual HRESULT STDMETHODCALLTYPE setIconDatabaseLocation(
+ /* [in] */ BSTR location);
+
+ virtual HRESULT STDMETHODCALLTYPE iconDatabaseEnabled(
+ /* [retval][out] */ BOOL* enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setIconDatabaseEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE fontSmoothing(
+ /* [retval][out] */ FontSmoothingType* smoothingType);
+
+ virtual HRESULT STDMETHODCALLTYPE setFontSmoothing(
+ /* [in] */ FontSmoothingType smoothingType);
+
+ virtual HRESULT STDMETHODCALLTYPE editableLinkBehavior(
+ /* [retval][out] */ WebKitEditableLinkBehavior* behavior);
+
+ virtual HRESULT STDMETHODCALLTYPE setEditableLinkBehavior(
+ /* [in] */ WebKitEditableLinkBehavior behavior);
+
+ virtual HRESULT STDMETHODCALLTYPE cookieStorageAcceptPolicy(
+ /* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy);
+
+ virtual HRESULT STDMETHODCALLTYPE setCookieStorageAcceptPolicy(
+ /* [in] */ WebKitCookieStorageAcceptPolicy acceptPolicy);
+
+ virtual HRESULT STDMETHODCALLTYPE continuousSpellCheckingEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setContinuousSpellCheckingEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE grammarCheckingEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setGrammarCheckingEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE allowContinuousSpellChecking(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowContinuousSpellChecking(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE isDOMPasteAllowed(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setDOMPasteAllowed(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE cacheModel(
+ /* [retval][out] */ WebCacheModel* cacheModel);
+
+ virtual HRESULT STDMETHODCALLTYPE setCacheModel(
+ /* [in] */ WebCacheModel cacheModel);
+
+ // IWebPreferencesPrivate
+ virtual HRESULT STDMETHODCALLTYPE setDeveloperExtrasEnabled(
+ /* [in] */ BOOL);
+
+ virtual HRESULT STDMETHODCALLTYPE developerExtrasEnabled(
+ /* [retval][out] */ BOOL*);
+
+ virtual HRESULT STDMETHODCALLTYPE setAutomaticallyDetectsCacheModel(
+ /* [in] */ BOOL automaticallyDetectsCacheModel);
+
+ virtual HRESULT STDMETHODCALLTYPE automaticallyDetectsCacheModel(
+ /* [out, retval] */ BOOL* automaticallyDetectsCacheModel);
+
+ virtual HRESULT STDMETHODCALLTYPE setAuthorAndUserStylesEnabled(BOOL);
+ virtual HRESULT STDMETHODCALLTYPE authorAndUserStylesEnabled(BOOL*);
+
+ // WebPreferences
+
+ // This method accesses a different preference key than developerExtrasEnabled.
+ // See <rdar://5343767> for the justification.
+ bool developerExtrasDisabledByOverride();
+
+ static BSTR webPreferencesChangedNotification();
+ static BSTR webPreferencesRemovedNotification();
+
+ static void setInstance(WebPreferences* instance, BSTR identifier);
+ static void removeReferenceForIdentifier(BSTR identifier);
+ static WebPreferences* sharedStandardPreferences();
+
+ // From WebHistory.h
+ HRESULT historyItemLimit(int* limit);
+ HRESULT setHistoryItemLimit(int limit);
+ HRESULT historyAgeInDaysLimit(int* limit);
+ HRESULT setHistoryAgeInDaysLimit(int limit);
+
+ void willAddToWebView();
+ void didRemoveFromWebView();
+
+ HRESULT postPreferencesChangesNotification();
+
+protected:
+ void setValueForKey(CFStringRef key, CFPropertyListRef value);
+ RetainPtr<CFPropertyListRef> valueForKey(CFStringRef key);
+ BSTR stringValueForKey(CFStringRef key);
+ int integerValueForKey(CFStringRef key);
+ BOOL boolValueForKey(CFStringRef key);
+ float floatValueForKey(CFStringRef key);
+ LONGLONG longlongValueForKey(CFStringRef key);
+ void setStringValue(CFStringRef key, LPCTSTR value);
+ void setIntegerValue(CFStringRef key, int value);
+ void setBoolValue(CFStringRef key, BOOL value);
+ void setLongLongValue(CFStringRef key, LONGLONG value);
+ static WebPreferences* getInstanceForIdentifier(BSTR identifier);
+ static void initializeDefaultSettings();
+ void save();
+ void load();
+ void migrateWebKitPreferencesToCFPreferences();
+ void copyWebKitPreferencesToCFPreferences(CFDictionaryRef);
+
+protected:
+ ULONG m_refCount;
+ RetainPtr<CFMutableDictionaryRef> m_privatePrefs;
+ WebCore::BString m_identifier;
+ bool m_autoSaves;
+ bool m_automaticallyDetectsCacheModel;
+ unsigned m_numWebViews;
+};
+
+#endif
diff --git a/WebKit/win/WebResource.cpp b/WebKit/win/WebResource.cpp
new file mode 100644
index 0000000..3f708ea
--- /dev/null
+++ b/WebKit/win/WebResource.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebResource.h"
+
+#include "MemoryStream.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebResource ---------------------------------------------------------------------
+
+WebResource::WebResource(IStream* data, const WebCore::KURL& url, const WebCore::String& mimeType, const WebCore::String& textEncodingName, const WebCore::String& frameName)
+ : m_refCount(0)
+ , m_data(data)
+ , m_url(url)
+ , m_mimeType(mimeType)
+ , m_textEncodingName(textEncodingName)
+ , m_frameName(frameName)
+{
+ gClassCount++;
+}
+
+WebResource::~WebResource()
+{
+ gClassCount--;
+}
+
+WebResource* WebResource::createInstance(PassRefPtr<WebCore::SharedBuffer> data, const WebCore::ResourceResponse& response)
+{
+ COMPtr<IStream> memoryStream;
+ memoryStream.adoptRef(MemoryStream::createInstance(data));
+
+ WebResource* instance = new WebResource(memoryStream.get(), response.url(), response.mimeType(), response.textEncodingName(), String());
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebResource::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IWebResource))
+ *ppvObject = static_cast<IWebResource*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebResource::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebResource::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// WebResource ------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebResource::initWithData(
+ /* [in] */ IStream *data,
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ BSTR textEncodingName,
+ /* [in] */ BSTR frameName)
+{
+ m_data = data;
+ m_url = KURL(String(url));
+ m_mimeType = String(mimeType);
+ m_textEncodingName = String(textEncodingName);
+ m_frameName = String(frameName);
+
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebResource::data(
+ /* [retval][out] */ IStream **data)
+{
+ return m_data.copyRefTo(data);
+}
+
+HRESULT STDMETHODCALLTYPE WebResource::URL(
+ /* [retval][out] */ BSTR *url)
+{
+ if (!url) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *url = BString(String(m_url.string())).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebResource::MIMEType(
+ /* [retval][out] */ BSTR *mime)
+{
+ if (!mime) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *mime = BString(m_mimeType).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebResource::textEncodingName(
+ /* [retval][out] */ BSTR *encodingName)
+{
+ if (!encodingName) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *encodingName = BString(m_textEncodingName).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebResource::frameName(
+ /* [retval][out] */ BSTR *name)
+{
+ if (!name) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *name = BString(m_frameName).release();
+ return S_OK;
+}
diff --git a/WebKit/win/WebResource.h b/WebKit/win/WebResource.h
new file mode 100644
index 0000000..d67cb56
--- /dev/null
+++ b/WebKit/win/WebResource.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebResource_h
+#define WebResource_h
+
+#include "WebKit.h"
+#include "COMPtr.h"
+
+#pragma warning(push, 0)
+#include <WebCore/KURL.h>
+#include <WebCore/PlatformString.h>
+#include <WebCore/ResourceResponse.h>
+#include <WebCore/SharedBuffer.h>
+#include <wtf/PassRefPtr.h>
+#pragma warning(pop)
+
+class WebResource : public IWebResource {
+public:
+ static WebResource* createInstance(PassRefPtr<WebCore::SharedBuffer> data, const WebCore::ResourceResponse& response);
+protected:
+ WebResource(IStream* data, const WebCore::KURL& url, const WebCore::String& mimeType, const WebCore::String& textEncodingName, const WebCore::String& frameName);
+ ~WebResource();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebResource
+ virtual HRESULT STDMETHODCALLTYPE initWithData(
+ /* [in] */ IStream *data,
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ BSTR textEncodingName,
+ /* [in] */ BSTR frameName);
+
+ virtual HRESULT STDMETHODCALLTYPE data(
+ /* [retval][out] */ IStream **data);
+
+ virtual HRESULT STDMETHODCALLTYPE URL(
+ /* [retval][out] */ BSTR *url);
+
+ virtual HRESULT STDMETHODCALLTYPE MIMEType(
+ /* [retval][out] */ BSTR *mime);
+
+ virtual HRESULT STDMETHODCALLTYPE textEncodingName(
+ /* [retval][out] */ BSTR *encodingName);
+
+ virtual HRESULT STDMETHODCALLTYPE frameName(
+ /* [retval][out] */ BSTR *name);
+
+private:
+ ULONG m_refCount;
+ COMPtr<IStream> m_data;
+ WebCore::KURL m_url;
+ WebCore::String m_mimeType;
+ WebCore::String m_textEncodingName;
+ WebCore::String m_frameName;
+};
+
+#endif
diff --git a/WebKit/win/WebScriptCallFrame.cpp b/WebKit/win/WebScriptCallFrame.cpp
new file mode 100644
index 0000000..48c79c1
--- /dev/null
+++ b/WebKit/win/WebScriptCallFrame.cpp
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebKitDLL.h"
+#include "WebScriptCallFrame.h"
+
+#include "COMEnumVariant.h"
+#include "Function.h"
+
+#include <JavaScriptCore/Interpreter.h>
+#include <JavaScriptCore/JSGlobalObject.h>
+#include <JavaScriptCore/JSStringRefBSTR.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/PropertyNameArray.h>
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+#include <wtf/Assertions.h>
+
+using namespace KJS;
+
+UString WebScriptCallFrame::jsValueToString(KJS::ExecState* state, JSValue* jsvalue)
+{
+ if (!jsvalue)
+ return "undefined";
+
+ switch (jsvalue->type()) {
+ case NullType:
+ case UndefinedType:
+ case UnspecifiedType:
+ case GetterSetterType:
+ break;
+ case StringType:
+ return jsvalue->getString();
+ break;
+ case NumberType:
+ return UString::from(jsvalue->getNumber());
+ break;
+ case BooleanType:
+ return jsvalue->getBoolean() ? "True" : "False";
+ break;
+ case ObjectType:
+ jsvalue = jsvalue->getObject()->defaultValue(state, StringType);
+ return jsvalue->getString();
+ break;
+ }
+
+ return "undefined";
+}
+
+// WebScriptCallFrame -----------------------------------------------------------
+
+WebScriptCallFrame::WebScriptCallFrame(ExecState* state, IWebScriptCallFrame* caller)
+ : m_refCount(0)
+{
+ m_state = state;
+ m_caller = caller;
+
+ gClassCount++;
+}
+
+WebScriptCallFrame::~WebScriptCallFrame()
+{
+ gClassCount--;
+}
+
+WebScriptCallFrame* WebScriptCallFrame::createInstance(ExecState* state, IWebScriptCallFrame* caller)
+{
+ WebScriptCallFrame* instance = new WebScriptCallFrame(state, caller);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown ------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebScriptCallFrame*>(this);
+ else if (IsEqualGUID(riid, IID_IWebScriptCallFrame))
+ *ppvObject = static_cast<IWebScriptCallFrame*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptCallFrame::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptCallFrame::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebScriptCallFrame -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::caller(
+ /* [out, retval] */ IWebScriptCallFrame** callFrame)
+{
+ return m_caller.copyRefTo(callFrame);
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::functionName(
+ /* [out, retval] */ BSTR* funcName)
+{
+ if (!funcName)
+ return E_POINTER;
+
+ *funcName = 0;
+
+ if (!m_state->scopeNode())
+ return S_OK;
+
+ FunctionImp* func = m_state->function();
+ if (!func)
+ return E_FAIL;
+
+ const Identifier& funcIdent = func->functionName();
+ if (!funcIdent.isEmpty())
+ *funcName = WebCore::BString(funcIdent).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::stringByEvaluatingJavaScriptFromString(
+ /* [in] */ BSTR script,
+ /* [out, retval] */ BSTR* result)
+{
+ if (!script)
+ return E_FAIL;
+
+ if (!result)
+ return E_POINTER;
+
+ *result = 0;
+
+ JSLock lock;
+
+ JSValue* scriptExecutionResult = valueByEvaluatingJavaScriptFromString(script);
+ *result = WebCore::BString(jsValueToString(m_state, scriptExecutionResult)).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::variableNames(
+ /* [out, retval] */ IEnumVARIANT** variableNames)
+{
+ if (!variableNames)
+ return E_POINTER;
+
+ *variableNames = 0;
+
+ PropertyNameArray propertyNames;
+
+ m_state->scopeChain().top()->getPropertyNames(m_state, propertyNames);
+ *variableNames = COMEnumVariant<PropertyNameArray>::adopt(propertyNames);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptCallFrame::valueForVariable(
+ /* [in] */ BSTR key,
+ /* [out, retval] */ BSTR* value)
+{
+ if (!key)
+ return E_FAIL;
+
+ if (!value)
+ return E_POINTER;
+
+ *value = 0;
+
+ Identifier identKey(reinterpret_cast<KJS::UChar*>(key), SysStringLen(key));
+
+ JSValue* jsvalue = 0;
+ ScopeChain scopeChain = m_state->scopeChain();
+ for (ScopeChainIterator it = scopeChain.begin(); it != scopeChain.end() && !jsvalue; ++it)
+ jsvalue = (*it)->get(m_state, identKey);
+
+ *value = WebCore::BString(jsValueToString(m_state, jsvalue)).release();
+
+ return S_OK;
+}
+
+JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script)
+{
+ ExecState* state = m_state;
+ JSGlobalObject* globObj = state->dynamicGlobalObject();
+
+ // find "eval"
+ JSObject* eval = 0;
+ if (state->scopeNode()) { // "eval" won't work without context (i.e. at global scope)
+ JSValue* v = globObj->get(state, "eval");
+ if (v->isObject() && static_cast<JSObject*>(v)->implementsCall())
+ eval = static_cast<JSObject*>(v);
+ else
+ // no "eval" - fallback operates on global exec state
+ state = globObj->globalExec();
+ }
+
+ JSValue* savedException = state->exception();
+ state->clearException();
+
+ UString code(reinterpret_cast<KJS::UChar*>(script), SysStringLen(script));
+
+ // evaluate
+ JSValue* scriptExecutionResult;
+ if (eval) {
+ List args;
+ args.append(jsString(code));
+ scriptExecutionResult = eval->call(state, 0, args);
+ } else
+ // no "eval", or no context (i.e. global scope) - use global fallback
+ scriptExecutionResult = Interpreter::evaluate(state, UString(), 0, code.data(), code.size(), globObj).value();
+
+ if (state->hadException())
+ scriptExecutionResult = state->exception(); // (may be redundant depending on which eval path was used)
+ state->setException(savedException);
+
+ return scriptExecutionResult;
+}
+
+template<> struct COMVariantSetter<Identifier>
+{
+ static void setVariant(VARIANT* variant, const Identifier& value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VT_BSTR;
+ V_BSTR(variant) = WebCore::BString(reinterpret_cast<const wchar_t*>(value.data()), value.size()).release();
+ }
+};
diff --git a/WebKit/win/WebScriptCallFrame.h b/WebKit/win/WebScriptCallFrame.h
new file mode 100644
index 0000000..311227a
--- /dev/null
+++ b/WebKit/win/WebScriptCallFrame.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebScriptCallFrame_h
+#define WebScriptCallFrame_h
+
+#include "WebKit.h"
+
+#include <JavaScriptCore/ExecState.h>
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#pragma warning(pop)
+
+namespace KJS {
+ class ExecState;
+ class JSValue;
+ class UString;
+}
+
+class WebScriptCallFrame : public IWebScriptCallFrame {
+public:
+ static WebScriptCallFrame* createInstance(KJS::ExecState*, IWebScriptCallFrame* caller);
+
+private:
+ WebScriptCallFrame(KJS::ExecState*, IWebScriptCallFrame* caller);
+ virtual ~WebScriptCallFrame();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID,
+ /* [retval][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebScriptCallFrame
+ virtual HRESULT STDMETHODCALLTYPE caller(
+ /* [out, retval] */ IWebScriptCallFrame**);
+
+ virtual HRESULT STDMETHODCALLTYPE functionName(
+ /* [out, retval] */ BSTR*);
+
+ virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptFromString(
+ /* [in] */ BSTR script,
+ /* [out, retval] */ BSTR*);
+
+ virtual HRESULT STDMETHODCALLTYPE variableNames(
+ /* [retval][out] */ IEnumVARIANT**);
+
+ virtual HRESULT STDMETHODCALLTYPE valueForVariable(
+ /* [in] */ BSTR key,
+ /* [out, retval] */ BSTR* value);
+
+ // Helper and accessors
+ virtual KJS::JSValue* valueByEvaluatingJavaScriptFromString(BSTR script);
+ virtual KJS::ExecState* state() const { return m_state; }
+
+ static KJS::UString jsValueToString(KJS::ExecState*, KJS::JSValue*);
+
+private:
+ ULONG m_refCount;
+
+ KJS::ExecState* m_state;
+ COMPtr<IWebScriptCallFrame> m_caller;
+};
+
+#endif
diff --git a/WebKit/win/WebScriptDebugServer.cpp b/WebKit/win/WebScriptDebugServer.cpp
new file mode 100644
index 0000000..734505d
--- /dev/null
+++ b/WebKit/win/WebScriptDebugServer.cpp
@@ -0,0 +1,361 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKit.h"
+#include "WebKitDLL.h"
+#include "WebScriptDebugServer.h"
+
+#include "WebView.h"
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+
+typedef HashSet<COMPtr<IWebScriptDebugListener> > ListenerSet;
+
+static ListenerSet s_Listeners;
+static unsigned s_ListenerCount = 0;
+static OwnPtr<WebScriptDebugServer> s_SharedWebScriptDebugServer;
+static bool s_dying = false;
+
+unsigned WebScriptDebugServer::listenerCount() { return s_ListenerCount; };
+
+// WebScriptDebugServer ------------------------------------------------------------
+
+WebScriptDebugServer::WebScriptDebugServer()
+ : m_refCount(0)
+ , m_paused(false)
+ , m_step(false)
+{
+ gClassCount++;
+}
+
+WebScriptDebugServer::~WebScriptDebugServer()
+{
+ gClassCount--;
+}
+
+WebScriptDebugServer* WebScriptDebugServer::createInstance()
+{
+ WebScriptDebugServer* instance = new WebScriptDebugServer;
+ instance->AddRef();
+ return instance;
+}
+
+WebScriptDebugServer* WebScriptDebugServer::sharedWebScriptDebugServer()
+{
+ if (!s_SharedWebScriptDebugServer) {
+ s_dying = false;
+ s_SharedWebScriptDebugServer.set(WebScriptDebugServer::createInstance());
+ }
+
+ return s_SharedWebScriptDebugServer.get();
+}
+
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<WebScriptDebugServer*>(this);
+ else if (IsEqualGUID(riid, IID_IWebScriptDebugServer))
+ *ppvObject = static_cast<WebScriptDebugServer*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptDebugServer::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptDebugServer::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebScriptDebugServer -----------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::sharedWebScriptDebugServer(
+ /* [retval][out] */ IWebScriptDebugServer** server)
+{
+ if (!server)
+ return E_POINTER;
+
+ *server = WebScriptDebugServer::sharedWebScriptDebugServer();
+ (*server)->AddRef();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::addListener(
+ /* [in] */ IWebScriptDebugListener* listener)
+{
+ if (s_dying)
+ return E_FAIL;
+
+ if (!listener)
+ return E_POINTER;
+
+ ++s_ListenerCount;
+ s_Listeners.add(listener);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::removeListener(
+ /* [in] */ IWebScriptDebugListener* listener)
+{
+ if (s_dying)
+ return S_OK;
+
+ if (!listener)
+ return E_POINTER;
+
+ if (!s_Listeners.contains(listener))
+ return S_OK;
+
+ s_Listeners.remove(listener);
+
+ ASSERT(s_ListenerCount >= 1);
+ if (--s_ListenerCount == 0)
+ resume();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::step()
+{
+ m_step = true;
+ m_paused = false;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::pause()
+{
+ m_paused = true;
+ m_step = false;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::resume()
+{
+ m_paused = false;
+ m_step = false;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::isPaused(
+ /* [out, retval] */ BOOL* isPaused)
+{
+ if (!isPaused)
+ return E_POINTER;
+
+ *isPaused = m_paused;
+ return S_OK;
+}
+
+
+void WebScriptDebugServer::suspendProcessIfPaused()
+{
+ static bool alreadyHere = false;
+
+ if (alreadyHere)
+ return;
+
+ alreadyHere = true;
+
+ MSG msg;
+ while (m_paused && GetMessage(&msg, 0, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ if (m_step) {
+ m_step = false;
+ m_paused = true;
+ }
+
+ alreadyHere = false;
+}
+
+// IWebScriptDebugListener
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::didLoadMainResourceForDataSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebDataSource* dataSource)
+{
+ if (!webView || !dataSource)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).didLoadMainResourceForDataSource(webView, dataSource);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::didParseSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ BSTR sourceCode,
+ /* [in] */ UINT baseLineNumber,
+ /* [in] */ BSTR url,
+ /* [in] */ int sourceID,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !sourceCode || !url || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).didParseSource(webView, sourceCode, baseLineNumber, url, sourceID, webFrame);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::failedToParseSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ BSTR sourceCode,
+ /* [in] */ UINT baseLineNumber,
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR error,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !sourceCode || !url || !error || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).failedToParseSource(webView, sourceCode, baseLineNumber, url, error, webFrame);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::didEnterCallFrame(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !frame || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).didEnterCallFrame(webView, frame, sourceID, lineNumber, webFrame);
+
+ suspendProcessIfPaused();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::willExecuteStatement(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !frame || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).willExecuteStatement(webView, frame, sourceID, lineNumber, webFrame);
+
+ suspendProcessIfPaused();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::willLeaveCallFrame(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !frame || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).willLeaveCallFrame(webView, frame, sourceID, lineNumber, webFrame);
+
+ suspendProcessIfPaused();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::exceptionWasRaised(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame* webFrame)
+{
+ if (!webView || !frame || !webFrame)
+ return E_FAIL;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it)
+ (**it).exceptionWasRaised(webView, frame, sourceID, lineNumber, webFrame);
+
+ suspendProcessIfPaused();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptDebugServer::serverDidDie()
+{
+ s_dying = true;
+
+ ListenerSet listenersCopy = s_Listeners;
+ ListenerSet::iterator end = listenersCopy.end();
+ for (ListenerSet::iterator it = listenersCopy.begin(); it != end; ++it) {
+ (**it).serverDidDie();
+ s_Listeners.remove((*it).get());
+ }
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebScriptDebugServer.h b/WebKit/win/WebScriptDebugServer.h
new file mode 100644
index 0000000..7c2d9a5
--- /dev/null
+++ b/WebKit/win/WebScriptDebugServer.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScriptDebugServer_H
+#define WebScriptDebugServer_H
+
+#include "WebKit.h"
+
+#include <wtf/HashSet.h>
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#pragma warning(pop)
+
+interface IWebView;
+
+class WebScriptDebugServer : public IWebScriptDebugServer, public IWebScriptDebugListener
+{
+public:
+ static WebScriptDebugServer* createInstance();
+ static WebScriptDebugServer* sharedWebScriptDebugServer();
+
+private:
+ WebScriptDebugServer();
+
+public:
+ virtual ~WebScriptDebugServer();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebScriptDebugServer
+ virtual HRESULT STDMETHODCALLTYPE sharedWebScriptDebugServer(
+ /* [retval][out] */ IWebScriptDebugServer** server);
+
+ virtual HRESULT STDMETHODCALLTYPE addListener(
+ /* [in] */ IWebScriptDebugListener*);
+
+ virtual HRESULT STDMETHODCALLTYPE removeListener(
+ /* [in] */ IWebScriptDebugListener*);
+
+ virtual HRESULT STDMETHODCALLTYPE step();
+
+ virtual HRESULT STDMETHODCALLTYPE pause();
+
+ virtual HRESULT STDMETHODCALLTYPE resume();
+
+ virtual HRESULT STDMETHODCALLTYPE isPaused(
+ /* [out, retval] */ BOOL* isPaused);
+
+ // IWebScriptDebugListener
+ virtual HRESULT STDMETHODCALLTYPE didLoadMainResourceForDataSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebDataSource* dataSource);
+
+ virtual HRESULT STDMETHODCALLTYPE didParseSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ BSTR sourceCode,
+ /* [in] */ UINT baseLineNumber,
+ /* [in] */ BSTR url,
+ /* [in] */ int sourceID,
+ /* [in] */ IWebFrame* webFrame);
+
+ virtual HRESULT STDMETHODCALLTYPE failedToParseSource(
+ /* [in] */ IWebView* webView,
+ /* [in] */ BSTR sourceCode,
+ /* [in] */ UINT baseLineNumber,
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR error,
+ /* [in] */ IWebFrame*);
+
+ virtual HRESULT STDMETHODCALLTYPE didEnterCallFrame(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame*);
+
+ virtual HRESULT STDMETHODCALLTYPE willExecuteStatement(
+ /* [in] */ IWebView*,
+ /* [in] */ IWebScriptCallFrame*,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame*);
+
+ virtual HRESULT STDMETHODCALLTYPE willLeaveCallFrame(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame* frame,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame*);
+
+ virtual HRESULT STDMETHODCALLTYPE exceptionWasRaised(
+ /* [in] */ IWebView* webView,
+ /* [in] */ IWebScriptCallFrame*,
+ /* [in] */ int sourceID,
+ /* [in] */ int lineNumber,
+ /* [in] */ IWebFrame*);
+
+ virtual HRESULT STDMETHODCALLTYPE serverDidDie();
+
+ void suspendProcessIfPaused();
+ static unsigned listenerCount();
+
+private:
+ bool m_paused;
+ bool m_step;
+
+ ULONG m_refCount;
+};
+
+#endif
diff --git a/WebKit/win/WebScriptDebugger.cpp b/WebKit/win/WebScriptDebugger.cpp
new file mode 100644
index 0000000..abb2203
--- /dev/null
+++ b/WebKit/win/WebScriptDebugger.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 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 "WebKitDLL.h"
+#include "WebScriptDebugger.h"
+
+#include "WebKit.h"
+#include "WebFrame.h"
+#include "WebScriptCallFrame.h"
+#include "WebScriptDebugServer.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/kjs_binding.h>
+#include <WebCore/kjs_proxy.h>
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+using namespace KJS;
+
+WebScriptDebugger::WebScriptDebugger(WebFrame* frame)
+ : m_frame(frame)
+{
+ ASSERT(m_frame);
+
+ m_callingServer = true;
+
+ KJSProxy* proxy = core(m_frame)->scriptProxy();
+ if (!proxy)
+ return;
+
+ JSGlobalObject* globalObject = proxy->globalObject();
+ attach(globalObject);
+
+ m_frame->webView(&m_webView);
+ ASSERT(m_webView);
+
+ callEvent(globalObject->globalExec(), -1, -1, 0, List());
+ m_callingServer = false;
+}
+
+bool WebScriptDebugger::sourceParsed(ExecState*, int sourceId, const UString& sourceURL,
+ const UString& source, int startingLineNumber, int errorLine, const UString& /*errorMsg*/)
+{
+ if (m_callingServer)
+ return true;
+
+ m_callingServer = true;
+
+ if (WebScriptDebugServer::listenerCount() <= 0)
+ return true;
+
+ BString bSource = String(source);
+ BString bSourceURL = String(sourceURL);
+
+ if (errorLine == -1) {
+ WebScriptDebugServer::sharedWebScriptDebugServer()->didParseSource(m_webView.get(),
+ bSource,
+ startingLineNumber,
+ bSourceURL,
+ sourceId,
+ m_frame);
+ } else {
+ // FIXME: the error var should be made with the information in the errorMsg. It is not a simple
+ // UString to BSTR conversion there is some logic involved that I don't fully understand yet.
+ BString error(L"An Error Occurred.");
+ WebScriptDebugServer::sharedWebScriptDebugServer()->failedToParseSource(m_webView.get(),
+ bSource,
+ startingLineNumber,
+ bSourceURL,
+ error,
+ m_frame);
+ }
+
+ m_callingServer = false;
+ return true;
+}
+
+bool WebScriptDebugger::callEvent(ExecState* state, int sourceId, int lineno, JSObject* /*function*/, const List &/*args*/)
+{
+ if (m_callingServer)
+ return true;
+
+ m_callingServer = true;
+
+ enterFrame(state);
+ WebScriptDebugServer::sharedWebScriptDebugServer()->didEnterCallFrame(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
+
+ m_callingServer = false;
+
+ return true;
+}
+
+bool WebScriptDebugger::atStatement(ExecState*, int sourceId, int firstLine, int /*lastLine*/)
+{
+ if (m_callingServer)
+ return true;
+
+ m_callingServer = true;
+
+ WebScriptDebugServer::sharedWebScriptDebugServer()->willExecuteStatement(m_webView.get(), m_topStackFrame.get(), sourceId, firstLine, m_frame);
+
+ m_callingServer = false;
+
+ return true;
+}
+
+bool WebScriptDebugger::returnEvent(ExecState*, int sourceId, int lineno, JSObject* /*function*/)
+{
+ if (m_callingServer)
+ return true;
+
+ m_callingServer = true;
+
+ leaveFrame();
+ WebScriptDebugServer::sharedWebScriptDebugServer()->willLeaveCallFrame(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
+
+ m_callingServer = false;
+
+ return true;
+}
+
+bool WebScriptDebugger::exception(ExecState*, int sourceId, int lineno, JSValue* /*exception */)
+{
+ if (m_callingServer)
+ return true;
+
+ m_callingServer = true;
+
+ WebScriptDebugServer::sharedWebScriptDebugServer()->exceptionWasRaised(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
+
+ m_callingServer = false;
+
+ return true;
+}
+
+void WebScriptDebugger::enterFrame(ExecState* state)
+{
+ m_topStackFrame = WebScriptCallFrame::createInstance(state, m_topStackFrame.get()); // Set the top as the caller
+}
+
+void WebScriptDebugger::leaveFrame()
+{
+ if (!m_topStackFrame)
+ return;
+
+ COMPtr<IWebScriptCallFrame> caller;
+ if (FAILED(m_topStackFrame->caller(&caller)))
+ return;
+
+ m_topStackFrame = caller;
+}
diff --git a/WebKit/win/WebScriptDebugger.h b/WebKit/win/WebScriptDebugger.h
new file mode 100644
index 0000000..bb91c25
--- /dev/null
+++ b/WebKit/win/WebScriptDebugger.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 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 WebScriptDebugger_H
+#define WebScriptDebugger_H
+
+#include "WebKit.h"
+
+#include <JavaScriptCore/debugger.h>
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#pragma warning(pop)
+
+class WebFrame;
+interface IWebScriptCallFrame;
+
+namespace KJS {
+ class ExecState;
+ class JSObject;
+ class JSValue;
+ class List;
+}
+
+class WebScriptDebugger : public KJS::Debugger {
+public:
+ WebScriptDebugger(WebFrame*);
+
+ bool sourceParsed(KJS::ExecState*, int sourceId, const KJS::UString& sourceURL,
+ const KJS::UString& source, int startingLineNumber, int errorLine, const KJS::UString& errorMsg);
+
+ bool callEvent(KJS::ExecState*, int sourceId, int lineno, KJS::JSObject* function, const KJS::List& args);
+ bool atStatement(KJS::ExecState*, int sourceId, int firstLine, int lastLine);
+ bool returnEvent(KJS::ExecState*, int sourceId, int lineno, KJS::JSObject* function);
+ bool exception(KJS::ExecState*, int sourceId, int lineno, KJS::JSValue* exception);
+
+private:
+ void enterFrame(KJS::ExecState*);
+ void leaveFrame();
+ bool m_callingServer;
+
+ WebFrame* m_frame;
+ COMPtr<IWebView> m_webView;
+ COMPtr<IWebScriptCallFrame> m_topStackFrame;
+};
+
+#endif
diff --git a/WebKit/win/WebScriptObject.cpp b/WebKit/win/WebScriptObject.cpp
new file mode 100644
index 0000000..83f9e67
--- /dev/null
+++ b/WebKit/win/WebScriptObject.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebKitDLL.h"
+
+#include "WebScriptObject.h"
+
+#include <wtf/Assertions.h>
+
+// WebScriptObject ------------------------------------------------------------
+
+WebScriptObject::WebScriptObject()
+: m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebScriptObject::~WebScriptObject()
+{
+ gClassCount--;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebScriptObject*>(this);
+ else if (IsEqualGUID(riid, IID_IWebScriptObject))
+ *ppvObject = static_cast<IWebScriptObject*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptObject::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebScriptObject::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// WebScriptObject ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::throwException(
+ /* [in] */ BSTR /*exceptionMessage*/,
+ /* [retval][out] */ BOOL* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::callWebScriptMethod(
+ /* [in] */ BSTR /*name*/,
+ /* [size_is][in] */ const VARIANT /*args*/[ ],
+ /* [in] */ int /*cArgs*/,
+ /* [retval][out] */ VARIANT* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::evaluateWebScript(
+ /* [in] */ BSTR /*script*/,
+ /* [retval][out] */ VARIANT* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::removeWebScriptKey(
+ /* [in] */ BSTR /*name*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::stringRepresentation(
+ /* [retval][out] */ BSTR* /*stringRepresentation*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::webScriptValueAtIndex(
+ /* [in] */ unsigned int /*index*/,
+ /* [retval][out] */ VARIANT* /*result*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::setWebScriptValueAtIndex(
+ /* [in] */ unsigned int /*index*/,
+ /* [in] */ VARIANT /*val*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebScriptObject::setException(
+ /* [in] */ BSTR /*description*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
diff --git a/WebKit/win/WebScriptObject.h b/WebKit/win/WebScriptObject.h
new file mode 100644
index 0000000..5716393
--- /dev/null
+++ b/WebKit/win/WebScriptObject.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScriptObject_H
+#define WebScriptObject_H
+
+#include "WebKit.h"
+
+class WebScriptObject : public IWebScriptObject
+{
+public:
+ WebScriptObject();
+ virtual ~WebScriptObject();
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(
+ /* [in] */ BSTR exceptionMessage,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
+ /* [in] */ BSTR name,
+ /* [size_is][in] */ const VARIANT args[ ],
+ /* [in] */ int cArgs,
+ /* [retval][out] */ VARIANT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ VARIANT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
+ /* [in] */ BSTR name);
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
+ /* [retval][out] */ BSTR* stringRepresentation);
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [retval][out] */ VARIANT *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
+ /* [in] */ unsigned int index,
+ /* [in] */ VARIANT val);
+
+ virtual HRESULT STDMETHODCALLTYPE setException(
+ /* [in] */ BSTR description);
+
+protected:
+ ULONG m_refCount;
+};
+
+#endif
diff --git a/WebKit/win/WebScrollBar.cpp b/WebKit/win/WebScrollBar.cpp
new file mode 100644
index 0000000..43c0ee9
--- /dev/null
+++ b/WebKit/win/WebScrollBar.cpp
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebKit.h"
+#include "WebScrollBar.h"
+
+#pragma warning(push, 0)
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/PlatformMouseEvent.h>
+#include <WebCore/PlatformScrollBar.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebScrollBar ---------------------------------------------------------------------
+
+WebScrollBar::WebScrollBar()
+ : m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebScrollBar::~WebScrollBar()
+{
+ gClassCount--;
+}
+
+WebScrollBar* WebScrollBar::createInstance()
+{
+ WebScrollBar* instance = new WebScrollBar();
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, IID_IWebScrollBarPrivate))
+ *ppvObject = static_cast<IWebScrollBarPrivate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebScrollBar::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebScrollBar::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebScrollBarPrivate ------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebScrollBar::init(
+ /* [in] */ IWebScrollBarDelegatePrivate* delegate,
+ /* [in] */ OLE_HANDLE containingWindow,
+ /* [in] */ WebScrollBarOrientation orientation,
+ /* [in] */ WebScrollBarControlSize controlSize)
+{
+ if (!delegate || !containingWindow)
+ return E_FAIL;
+ ScrollbarOrientation webCoreOrientation = (ScrollbarOrientation) orientation;
+ ScrollbarControlSize webCoreControlSize = (ScrollbarControlSize) controlSize;
+ m_delegate = delegate;
+ m_scrollBar = new PlatformScrollbar(this, webCoreOrientation, webCoreControlSize);
+ if (!m_scrollBar)
+ return E_FAIL;
+ m_scrollBar->setContainingWindow((HWND)(ULONG64)containingWindow);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::setEnabled(
+ /* [in] */ BOOL enabled)
+{
+ m_scrollBar->setEnabled(!!enabled);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::setSteps(
+ /* [in] */ int lineStep,
+ /* [in] */ int pageStep)
+{
+ m_scrollBar->setSteps(lineStep, pageStep);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::setProportion(
+ /* [in] */ int visibleSize,
+ /* [in] */ int totalSize)
+{
+ m_scrollBar->setProportion(visibleSize, totalSize);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::setRect(
+ /* [in] */ RECT bounds)
+{
+ IntRect rect(bounds.left, bounds.top, bounds.right-bounds.left, bounds.bottom-bounds.top);
+ m_scrollBar->setRect(rect);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::setValue(
+ /* [in] */ int value)
+{
+ m_scrollBar->setValue(value);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::value(
+ /* [retval][out] */ int* value)
+{
+ if (!value)
+ return E_POINTER;
+ *value = m_scrollBar->value();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::paint(
+ /* [in] */ HDC dc,
+ /* [in] */ RECT damageRect)
+{
+ GraphicsContext context(dc);
+ IntRect rect(damageRect.left, damageRect.top, damageRect.right-damageRect.left, damageRect.bottom-damageRect.top);
+ m_scrollBar->paint(&context, rect);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::frameGeometry(
+ /* [retval][out] */ RECT* bounds)
+{
+ if (!bounds)
+ return E_POINTER;
+ IntRect rect = m_scrollBar->frameGeometry();
+ bounds->left = rect.x();
+ bounds->right = rect.right();
+ bounds->top = rect.y();
+ bounds->bottom = rect.bottom();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::width(
+ /* [retval][out] */ int* w)
+{
+ if (!w)
+ return E_POINTER;
+ *w = m_scrollBar->width();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::height(
+ /* [retval][out] */ int* h)
+{
+ if (!h)
+ return E_POINTER;
+ *h = m_scrollBar->height();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::requestedWidth(
+ /* [retval][out] */ int* w)
+{
+ if (!w)
+ return E_POINTER;
+
+ *w = m_scrollBar->orientation() == VerticalScrollbar ? PlatformScrollbar::verticalScrollbarWidth(m_scrollBar->controlSize()) : -1;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::requestedHeight(
+ /* [retval][out] */ int* h)
+{
+ if (!h)
+ return E_POINTER;
+
+ *h = m_scrollBar->orientation() == HorizontalScrollbar ? PlatformScrollbar::horizontalScrollbarHeight(m_scrollBar->controlSize()) : -1;
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::handleMouseEvent(
+ OLE_HANDLE window,
+ UINT msg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ PlatformMouseEvent mouseEvent((HWND)(ULONG64)window, msg, wParam, lParam);
+ switch (msg) {
+ case WM_LBUTTONDOWN:
+ m_scrollBar->handleMousePressEvent(mouseEvent);
+ break;
+ case WM_LBUTTONUP:
+ m_scrollBar->handleMouseReleaseEvent(mouseEvent);
+ break;
+ case WM_MOUSEMOVE:
+ m_scrollBar->handleMouseMoveEvent(mouseEvent);
+ break;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebScrollBar::scroll(
+ WebScrollDirection direction,
+ WebScrollGranularity granularity,
+ float multiplier)
+{
+ ScrollDirection webCoreScrollDirection = (ScrollDirection) direction;
+ ScrollGranularity webCoreGranularity = (ScrollGranularity) granularity;
+ m_scrollBar->scroll(webCoreScrollDirection, webCoreGranularity, multiplier);
+ return S_OK;
+}
+
+// ScrollbarClient -------------------------------------------------------
+void WebScrollBar::valueChanged(Scrollbar* scrollBar)
+{
+ if (m_scrollBar != scrollBar) {
+ ASSERT(false); // shouldn't happen
+ return;
+ }
+ m_delegate->valueChanged(this);
+}
+
+IntRect WebScrollBar::windowClipRect() const
+{
+ HWND sbContainingWindow = m_scrollBar->containingWindow();
+ RECT clientRect;
+ ::GetClientRect(sbContainingWindow, &clientRect);
+ return IntRect(clientRect.left, clientRect.top, clientRect.right-clientRect.left, clientRect.bottom-clientRect.top);
+}
diff --git a/WebKit/win/WebScrollBar.h b/WebKit/win/WebScrollBar.h
new file mode 100644
index 0000000..8e17445
--- /dev/null
+++ b/WebKit/win/WebScrollBar.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebScrollBar_h
+#define WebScrollBar_h
+
+#include "WebKit.h"
+
+#include <wtf/RefPtr.h>
+#include <wtf/OwnPtr.h>
+
+#pragma warning(push, 0)
+#include <WebCore/COMPtr.h>
+#include <WebCore/ScrollBar.h>
+#pragma warning(pop)
+
+namespace WebCore {
+class PlatformScrollbar;
+}
+
+using namespace WebCore;
+
+class WebScrollBar : public IWebScrollBarPrivate, ScrollbarClient
+{
+public:
+ static WebScrollBar* createInstance();
+protected:
+ WebScrollBar();
+ ~WebScrollBar();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebScrollBarPrivate
+ virtual HRESULT STDMETHODCALLTYPE init(
+ /* [in] */ IWebScrollBarDelegatePrivate* delegate,
+ /* [in] */ OLE_HANDLE containingWindow,
+ /* [in] */ WebScrollBarOrientation orientation,
+ /* [in] */ WebScrollBarControlSize controlSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setEnabled(
+ /* [in] */ BOOL enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setSteps(
+ /* [in] */ int lineStep,
+ /* [in] */ int pageStep);
+
+ virtual HRESULT STDMETHODCALLTYPE setProportion(
+ /* [in] */ int visibleSize,
+ /* [in] */ int totalSize);
+
+ virtual HRESULT STDMETHODCALLTYPE setRect(
+ /* [in] */ RECT bounds);
+
+ virtual HRESULT STDMETHODCALLTYPE setValue(
+ /* [in] */ int value);
+
+ virtual HRESULT STDMETHODCALLTYPE value(
+ /* [retval][out] */ int* value);
+
+ virtual HRESULT STDMETHODCALLTYPE paint(
+ /* [in] */ HDC dc,
+ /* [in] */ RECT damageRect);
+
+ virtual HRESULT STDMETHODCALLTYPE frameGeometry(
+ /* [retval][out] */ RECT* bounds);
+
+ virtual HRESULT STDMETHODCALLTYPE width(
+ /* [retval][out] */ int* w);
+
+ virtual HRESULT STDMETHODCALLTYPE height(
+ /* [retval][out] */ int* h);
+
+ virtual HRESULT STDMETHODCALLTYPE requestedWidth(
+ /* [retval][out] */ int* w);
+
+ virtual HRESULT STDMETHODCALLTYPE requestedHeight(
+ /* [retval][out] */ int* h);
+
+ virtual HRESULT STDMETHODCALLTYPE handleMouseEvent(
+ /* [in] */ OLE_HANDLE window,
+ /* [in] */ UINT msg,
+ /* [in] */ WPARAM wParam,
+ /* [in] */ LPARAM lParam);
+
+ virtual HRESULT STDMETHODCALLTYPE scroll(
+ /* [in] */ WebScrollDirection direction,
+ /* [in] */ WebScrollGranularity granularity,
+ /* [in] */ float multiplier);
+
+protected:
+ // ScrollbarClient
+ virtual void valueChanged(Scrollbar*);
+ virtual IntRect windowClipRect() const;
+
+ // FIXME: We should provide a way to set this value.
+ virtual bool isActive() const { return true; }
+
+ ULONG m_refCount;
+ RefPtr<WebCore::PlatformScrollbar> m_scrollBar;
+ COMPtr<IWebScrollBarDelegatePrivate> m_delegate;
+};
+
+#endif
diff --git a/WebKit/win/WebSecurityOrigin.cpp b/WebKit/win/WebSecurityOrigin.cpp
new file mode 100644
index 0000000..33a3a3a
--- /dev/null
+++ b/WebKit/win/WebSecurityOrigin.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebSecurityOrigin.h"
+#include "WebKitDLL.h"
+
+#include <WebCore/BString.h>
+#include <WebCore/DatabaseTracker.h>
+
+using namespace WebCore;
+
+// WebSecurityOrigin ---------------------------------------------------------------
+WebSecurityOrigin* WebSecurityOrigin::createInstance(SecurityOrigin* securityOrigin)
+{
+ WebSecurityOrigin* origin = new WebSecurityOrigin(securityOrigin);
+ origin->AddRef();
+ return origin;
+}
+
+WebSecurityOrigin::WebSecurityOrigin(SecurityOrigin* securityOrigin)
+ : m_refCount(0)
+ , m_securityOrigin(securityOrigin)
+{
+ gClassCount++;
+}
+
+WebSecurityOrigin::~WebSecurityOrigin()
+{
+ gClassCount--;
+}
+
+// IUnknown ------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebSecurityOrigin*>(this);
+ else if (IsEqualGUID(riid, IID_IWebSecurityOrigin))
+ *ppvObject = static_cast<IWebSecurityOrigin*>(this);
+ else if (IsEqualGUID(riid, __uuidof(this)))
+ *ppvObject = this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebSecurityOrigin::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebSecurityOrigin::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+// IWebSecurityOrigin --------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::protocol(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_securityOrigin->protocol()).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::domain(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = BString(m_securityOrigin->host()).release();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::port(
+ /* [retval][out] */ unsigned short* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = m_securityOrigin->port();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::usage(
+ /* [retval][out] */ unsigned long long* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = DatabaseTracker::tracker().usageForOrigin(m_securityOrigin.get());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::quota(
+ /* [retval][out] */ unsigned long long* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = DatabaseTracker::tracker().quotaForOrigin(m_securityOrigin.get());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebSecurityOrigin::setQuota(
+ /* [in] */ unsigned long long quota)
+{
+ DatabaseTracker::tracker().setQuota(m_securityOrigin.get(), quota);
+
+ return S_OK;
+}
diff --git a/WebKit/win/WebSecurityOrigin.h b/WebKit/win/WebSecurityOrigin.h
new file mode 100644
index 0000000..e86957b
--- /dev/null
+++ b/WebKit/win/WebSecurityOrigin.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebSecurityOrigin_h
+#define WebSecurityOrigin_h
+
+#include "WebKit.h"
+#include <WebCore/SecurityOrigin.h>
+
+class DECLSPEC_UUID("6EB8D98F-2723-4472-88D3-5936F9D6E631") WebSecurityOrigin : public IWebSecurityOrigin {
+public:
+ // WebSecurityOrigin
+ static WebSecurityOrigin* createInstance(WebCore::SecurityOrigin* origin);
+ static WebSecurityOrigin* createInstance(RefPtr<WebCore::SecurityOrigin> origin) { return createInstance(origin.get()); }
+ WebCore::SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ // IWebSecurityOrigin
+ virtual HRESULT STDMETHODCALLTYPE protocol(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE domain(
+ /* [retval][out] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE port(
+ /* [retval][out] */ unsigned short* result);
+
+ virtual HRESULT STDMETHODCALLTYPE usage(
+ /* [retval][out] */ unsigned long long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE quota(
+ /* [retval][out] */ unsigned long long* result);
+
+ virtual HRESULT STDMETHODCALLTYPE setQuota(
+ /* [in] */ unsigned long long quota);
+private:
+ WebSecurityOrigin(WebCore::SecurityOrigin*);
+ ~WebSecurityOrigin();
+
+ ULONG m_refCount;
+ RefPtr<WebCore::SecurityOrigin> m_securityOrigin;
+};
+
+#endif // WebSecurityOrigin_h
diff --git a/WebKit/win/WebTextRenderer.cpp b/WebKit/win/WebTextRenderer.cpp
new file mode 100644
index 0000000..43a0c82
--- /dev/null
+++ b/WebKit/win/WebTextRenderer.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "WebTextRenderer.h"
+
+#include <CoreFoundation/CFString.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/RetainPtr.h>
+
+WebTextRenderer* WebTextRenderer::createInstance()
+{
+ WebTextRenderer* instance = new WebTextRenderer;
+ instance->AddRef();
+ return instance;
+}
+
+WebTextRenderer::WebTextRenderer()
+ : m_refCount(0)
+{
+}
+
+WebTextRenderer::~WebTextRenderer()
+{
+}
+
+HRESULT STDMETHODCALLTYPE WebTextRenderer::QueryInterface(const IID &riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebTextRenderer*>(this);
+ else if (IsEqualGUID(riid, IID_IWebTextRenderer))
+ *ppvObject = static_cast<IWebTextRenderer*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebTextRenderer::AddRef()
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebTextRenderer::Release()
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE WebTextRenderer::registerPrivateFont(
+ /* [in] */ LPCOLESTR fontFilePath)
+{
+ if (!AddFontResourceEx(fontFilePath, FR_PRIVATE, 0))
+ return E_FAIL;
+
+ RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(fontFilePath), static_cast<CFIndex>(wcslen(fontFilePath))));
+ wkAddFontsAtPath(string.get());
+ return S_OK;
+}
diff --git a/WebKit/win/WebTextRenderer.h b/WebKit/win/WebTextRenderer.h
new file mode 100644
index 0000000..3348948
--- /dev/null
+++ b/WebKit/win/WebTextRenderer.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 WebTextRenderer_h
+#define WebTextRenderer_h
+
+#include "WebKit.h"
+
+class WebTextRenderer : public IWebTextRenderer {
+public:
+ static WebTextRenderer* createInstance();
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void** ppvObject);
+
+ virtual ULONG STDMETHODCALLTYPE AddRef();
+
+ virtual ULONG STDMETHODCALLTYPE Release();
+
+ virtual HRESULT STDMETHODCALLTYPE registerPrivateFont(
+ /* [in] */ LPCOLESTR fontFilePath);
+
+private:
+ WebTextRenderer();
+ ~WebTextRenderer();
+
+ ULONG m_refCount;
+};
+
+#endif // !defined(WebTextRenderer_h)
diff --git a/WebKit/win/WebURLAuthenticationChallenge.cpp b/WebKit/win/WebURLAuthenticationChallenge.cpp
new file mode 100644
index 0000000..b6d31fc
--- /dev/null
+++ b/WebKit/win/WebURLAuthenticationChallenge.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebURLAuthenticationChallenge.h"
+
+#include "COMPtr.h"
+#include "WebError.h"
+#include "WebKit.h"
+#include "WebURLAuthenticationChallengeSender.h"
+#include "WebURLCredential.h"
+#include "WebURLProtectionSpace.h"
+#include "WebURLResponse.h"
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/ResourceHandle.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebURLAuthenticationChallenge ----------------------------------------------------------------
+
+WebURLAuthenticationChallenge::WebURLAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge,
+ IWebURLAuthenticationChallengeSender* sender)
+ : m_refCount(0)
+ , m_authenticationChallenge(authenticationChallenge)
+ , m_sender(sender)
+{
+ gClassCount++;
+}
+
+WebURLAuthenticationChallenge::~WebURLAuthenticationChallenge()
+{
+ gClassCount--;
+}
+
+WebURLAuthenticationChallenge* WebURLAuthenticationChallenge::createInstance(const AuthenticationChallenge& authenticationChallenge)
+{
+ WebURLAuthenticationChallenge* instance = new WebURLAuthenticationChallenge(authenticationChallenge, 0);
+ instance->AddRef();
+ return instance;
+}
+
+WebURLAuthenticationChallenge* WebURLAuthenticationChallenge::createInstance(const AuthenticationChallenge& authenticationChallenge,
+ IWebURLAuthenticationChallengeSender* sender)
+{
+ WebURLAuthenticationChallenge* instance = new WebURLAuthenticationChallenge(authenticationChallenge, sender);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, __uuidof(this)))
+ *ppvObject = static_cast<WebURLAuthenticationChallenge*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLAuthenticationChallenge))
+ *ppvObject = static_cast<IWebURLAuthenticationChallenge*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebURLAuthenticationChallenge::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebURLAuthenticationChallenge::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLAuthenticationChallenge -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::initWithProtectionSpace(
+ /* [in] */ IWebURLProtectionSpace* space,
+ /* [in] */ IWebURLCredential* proposedCredential,
+ /* [in] */ int previousFailureCount,
+ /* [in] */ IWebURLResponse* failureResponse,
+ /* [in] */ IWebError* error,
+ /* [in] */ IWebURLAuthenticationChallengeSender* sender)
+{
+ LOG_ERROR("Calling the ala carte init for WebURLAuthenticationChallenge - is this really what you want to do?");
+
+ if (!space || !proposedCredential || !failureResponse || !sender)
+ return E_POINTER;
+
+ HRESULT hr = S_OK;
+ COMPtr<WebURLProtectionSpace> webSpace;
+ hr = space->QueryInterface(&webSpace);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<WebURLCredential> webCredential(Query, proposedCredential);
+ if (!webCredential)
+ return E_NOINTERFACE;
+
+ COMPtr<WebURLResponse> webResponse;
+ hr = failureResponse->QueryInterface(&webResponse);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<WebError> webError;
+ hr = error->QueryInterface(CLSID_WebError, (void**)&webError);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<WebURLAuthenticationChallengeSender> webSender(Query, sender);
+ if (!webSender)
+ return E_NOINTERFACE;
+
+ // FIXME: After we change AuthenticationChallenge to use "ResourceHandle" as the abstract "Sender" or "Source of this Auth Challenge", then we'll
+ // construct the AuthenticationChallenge with that as obtained from the webSender
+
+ m_authenticationChallenge = AuthenticationChallenge(webSpace->protectionSpace(), webCredential->credential(),
+ previousFailureCount, webResponse->resourceResponse(), webError->resourceError());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::initWithAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge,
+ /* [in] */ IWebURLAuthenticationChallengeSender* sender)
+{
+ if (!challenge || !sender)
+ return E_POINTER;
+
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_NOINTERFACE;
+
+ COMPtr<WebURLAuthenticationChallengeSender> webSender(Query, sender);
+ if (!webSender)
+ return E_NOINTERFACE;
+
+ m_authenticationChallenge = AuthenticationChallenge(webChallenge->authenticationChallenge().cfURLAuthChallengeRef(), webSender->resourceHandle());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::error(
+ /* [out, retval] */ IWebError** result)
+{
+ *result = WebError::createInstance(m_authenticationChallenge.error());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::failureResponse(
+ /* [out, retval] */ IWebURLResponse** result)
+{
+ *result = WebURLResponse::createInstance(m_authenticationChallenge.failureResponse());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::previousFailureCount(
+ /* [out, retval] */ UINT* result)
+{
+ *result = m_authenticationChallenge.previousFailureCount();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::proposedCredential(
+ /* [out, retval] */ IWebURLCredential** result)
+{
+ *result = WebURLCredential::createInstance(m_authenticationChallenge.proposedCredential());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::protectionSpace(
+ /* [out, retval] */ IWebURLProtectionSpace** result)
+{
+ *result = WebURLProtectionSpace::createInstance(m_authenticationChallenge.protectionSpace());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::sender(
+ /* [out, retval] */ IWebURLAuthenticationChallengeSender** sender)
+{
+ if (!m_sender) {
+ ResourceHandle* handle = m_authenticationChallenge.sourceHandle();
+ m_sender.adoptRef(WebURLAuthenticationChallengeSender::createInstance(handle));
+ }
+
+ return m_sender.copyRefTo(sender);
+}
+
+// WebURLAuthenticationChallenge -------------------------------------------------------------------
+const AuthenticationChallenge& WebURLAuthenticationChallenge::authenticationChallenge() const
+{
+ return m_authenticationChallenge;
+}
diff --git a/WebKit/win/WebURLAuthenticationChallenge.h b/WebKit/win/WebURLAuthenticationChallenge.h
new file mode 100644
index 0000000..d0eba20
--- /dev/null
+++ b/WebKit/win/WebURLAuthenticationChallenge.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebURLAuthenticationChallenge_h
+#define WebURLAuthenticationChallenge_h
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/COMPtr.h>
+#pragma warning(pop)
+
+class DECLSPEC_UUID("FD3B2381-0BB6-4B59-AF09-0E599C8901CF") WebURLAuthenticationChallenge : public IWebURLAuthenticationChallenge {
+public:
+ static WebURLAuthenticationChallenge* createInstance(const WebCore::AuthenticationChallenge&);
+ static WebURLAuthenticationChallenge* createInstance(const WebCore::AuthenticationChallenge&, IWebURLAuthenticationChallengeSender*);
+private:
+ WebURLAuthenticationChallenge(const WebCore::AuthenticationChallenge&, IWebURLAuthenticationChallengeSender*);
+ ~WebURLAuthenticationChallenge();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLAuthenticationChallenge
+ virtual HRESULT STDMETHODCALLTYPE initWithProtectionSpace(
+ /* [in] */ IWebURLProtectionSpace* space,
+ /* [in] */ IWebURLCredential* proposedCredential,
+ /* [in] */ int previousFailureCount,
+ /* [in] */ IWebURLResponse* failureResponse,
+ /* [in] */ IWebError* error,
+ /* [in] */ IWebURLAuthenticationChallengeSender* sender);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge,
+ /* [in] */ IWebURLAuthenticationChallengeSender* sender);
+
+ virtual HRESULT STDMETHODCALLTYPE error(
+ /* [out, retval] */ IWebError** result);
+
+ virtual HRESULT STDMETHODCALLTYPE failureResponse(
+ /* [out, retval] */ IWebURLResponse** result);
+
+ virtual HRESULT STDMETHODCALLTYPE previousFailureCount(
+ /* [out, retval] */ UINT* result);
+
+ virtual HRESULT STDMETHODCALLTYPE proposedCredential(
+ /* [out, retval] */ IWebURLCredential** result);
+
+ virtual HRESULT STDMETHODCALLTYPE protectionSpace(
+ /* [out, retval] */ IWebURLProtectionSpace** result);
+
+ virtual HRESULT STDMETHODCALLTYPE sender(
+ /* [out, retval] */ IWebURLAuthenticationChallengeSender** sender);
+
+ // WebURLAuthenticationChallenge
+ const WebCore::AuthenticationChallenge& authenticationChallenge() const;
+
+protected:
+ ULONG m_refCount;
+
+ WebCore::AuthenticationChallenge m_authenticationChallenge;
+ COMPtr<IWebURLAuthenticationChallengeSender> m_sender;
+};
+
+
+#endif
diff --git a/WebKit/win/WebURLAuthenticationChallengeSender.cpp b/WebKit/win/WebURLAuthenticationChallengeSender.cpp
new file mode 100644
index 0000000..eb6bf67
--- /dev/null
+++ b/WebKit/win/WebURLAuthenticationChallengeSender.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include <initguid.h>
+#include "WebURLAuthenticationChallengeSender.h"
+
+#include "COMPtr.h"
+#include "WebKit.h"
+#include "WebURLAuthenticationChallenge.h"
+#include "WebURLCredential.h"
+
+#pragma warning(push, 0)
+#include <WebCore/ResourceHandle.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebURLAuthenticationChallengeSender ----------------------------------------------------------------
+
+WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender(PassRefPtr<ResourceHandle> handle)
+ : m_refCount(0)
+ , m_handle(handle)
+{
+ ASSERT(m_handle);
+ gClassCount++;
+}
+
+WebURLAuthenticationChallengeSender::~WebURLAuthenticationChallengeSender()
+{
+ gClassCount--;
+}
+
+WebURLAuthenticationChallengeSender* WebURLAuthenticationChallengeSender::createInstance(PassRefPtr<WebCore::ResourceHandle> handle)
+{
+ WebURLAuthenticationChallengeSender* instance = new WebURLAuthenticationChallengeSender(handle);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, __uuidof(this)))
+ *ppvObject = static_cast<WebURLAuthenticationChallengeSender*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLAuthenticationChallengeSender))
+ *ppvObject = static_cast<IWebURLAuthenticationChallengeSender*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLAuthenticationChallengeSender -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge)
+{
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_FAIL;
+
+ m_handle->receivedCancellation(webChallenge->authenticationChallenge());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge)
+{
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_FAIL;
+
+ m_handle->receivedRequestToContinueWithoutCredential(webChallenge->authenticationChallenge());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::useCredential(
+ /* [in] */ IWebURLCredential* credential,
+ /* [in] */ IWebURLAuthenticationChallenge* challenge)
+{
+ COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge);
+ if (!webChallenge)
+ return E_FAIL;
+
+ COMPtr<WebURLCredential> webCredential;
+ if (!credential || FAILED(credential->QueryInterface(__uuidof(WebURLCredential), (void**)&webCredential)))
+ return E_FAIL;
+
+ m_handle->receivedCredential(webChallenge->authenticationChallenge(), webCredential->credential());
+ return S_OK;
+}
+
+// WebURLAuthenticationChallengeSender ----------------------------------------------------------------
+
+ResourceHandle* WebURLAuthenticationChallengeSender::resourceHandle() const
+{
+ return m_handle.get();
+}
+
diff --git a/WebKit/win/WebURLAuthenticationChallengeSender.h b/WebKit/win/WebURLAuthenticationChallengeSender.h
new file mode 100644
index 0000000..cfb8cc3
--- /dev/null
+++ b/WebKit/win/WebURLAuthenticationChallengeSender.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebURLAuthenticationChallengeSender_h
+#define WebURLAuthenticationChallengeSender_h
+
+#include "WebKit.h"
+
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+ class ResourceHandle;
+}
+
+class DECLSPEC_UUID("5CACD637-F82F-491F-947A-5DCA38AA0FEA") WebURLAuthenticationChallengeSender
+ : public IWebURLAuthenticationChallengeSender
+{
+public:
+ static WebURLAuthenticationChallengeSender* createInstance(PassRefPtr<WebCore::ResourceHandle>);
+private:
+ WebURLAuthenticationChallengeSender(PassRefPtr<WebCore::ResourceHandle>);
+ ~WebURLAuthenticationChallengeSender();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLAuthenticationChallengeSender
+ virtual HRESULT STDMETHODCALLTYPE cancelAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ virtual HRESULT STDMETHODCALLTYPE continueWithoutCredentialForAuthenticationChallenge(
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ virtual HRESULT STDMETHODCALLTYPE useCredential(
+ /* [in] */ IWebURLCredential* credential,
+ /* [in] */ IWebURLAuthenticationChallenge* challenge);
+
+ WebCore::ResourceHandle* resourceHandle() const;
+
+private:
+ ULONG m_refCount;
+
+ RefPtr<WebCore::ResourceHandle> m_handle;
+};
+
+#endif
diff --git a/WebKit/win/WebURLCredential.cpp b/WebKit/win/WebURLCredential.cpp
new file mode 100644
index 0000000..a6cc35c
--- /dev/null
+++ b/WebKit/win/WebURLCredential.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebURLCredential.h"
+
+#include "WebKit.h"
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebURLCredential ----------------------------------------------------------------
+
+WebURLCredential::WebURLCredential(const Credential& credential)
+ : m_refCount(0)
+ , m_credential(credential)
+{
+ gClassCount++;
+}
+
+WebURLCredential::~WebURLCredential()
+{
+ gClassCount--;
+}
+
+WebURLCredential* WebURLCredential::createInstance()
+{
+ WebURLCredential* instance = new WebURLCredential(Credential());
+ instance->AddRef();
+ return instance;
+}
+
+WebURLCredential* WebURLCredential::createInstance(const Credential& credential)
+{
+ WebURLCredential* instance = new WebURLCredential(credential);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLCredential::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, __uuidof(WebURLCredential)))
+ *ppvObject = static_cast<WebURLCredential*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLCredential))
+ *ppvObject = static_cast<IWebURLCredential*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebURLCredential::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebURLCredential::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLCredential -------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebURLCredential::hasPassword(
+ /* [out, retval] */ BOOL* result)
+{
+ *result = m_credential.hasPassword();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLCredential::initWithUser(
+ /* [in] */ BSTR user,
+ /* [in] */ BSTR password,
+ /* [in] */ WebURLCredentialPersistence persistence)
+{
+ CredentialPersistence corePersistence = CredentialPersistenceNone;
+ switch (persistence) {
+ case WebURLCredentialPersistenceNone:
+ break;
+ case WebURLCredentialPersistenceForSession:
+ corePersistence = CredentialPersistenceForSession;
+ break;
+ case WebURLCredentialPersistencePermanent:
+ corePersistence = CredentialPersistencePermanent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ m_credential = Credential(String(user, SysStringLen(user)), String(password, SysStringLen(password)), corePersistence);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLCredential::password(
+ /* [out, retval] */ BSTR* password)
+{
+ BString str = m_credential.password();
+ *password = str.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLCredential::persistence(
+ /* [out, retval] */ WebURLCredentialPersistence* result)
+{
+ switch (m_credential.persistence()) {
+ case CredentialPersistenceNone:
+ *result = WebURLCredentialPersistenceNone;
+ break;
+ case CredentialPersistenceForSession:
+ *result = WebURLCredentialPersistenceForSession;
+ break;
+ case CredentialPersistencePermanent:
+ *result = WebURLCredentialPersistencePermanent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLCredential::user(
+ /* [out, retval] */ BSTR* result)
+{
+ BString str = m_credential.user();
+ *result = str.release();
+ return S_OK;
+}
+
+const WebCore::Credential& WebURLCredential::credential() const
+{
+ return m_credential;
+}
+
diff --git a/WebKit/win/WebURLCredential.h b/WebKit/win/WebURLCredential.h
new file mode 100644
index 0000000..094c966
--- /dev/null
+++ b/WebKit/win/WebURLCredential.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebURLCredential_h
+#define WebURLCredential_h
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/Credential.h>
+#pragma warning(pop)
+
+class WebURLCredential : public IWebURLCredential
+{
+public:
+ static WebURLCredential* createInstance();
+ static WebURLCredential* createInstance(const WebCore::Credential&);
+private:
+ WebURLCredential(const WebCore::Credential&);
+ ~WebURLCredential();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLCredential
+ virtual HRESULT STDMETHODCALLTYPE hasPassword(
+ /* [out, retval] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithUser(
+ /* [in] */ BSTR user,
+ /* [in] */ BSTR password,
+ /* [in] */ WebURLCredentialPersistence persistence);
+
+ virtual HRESULT STDMETHODCALLTYPE password(
+ /* [out, retval] */ BSTR* password);
+
+ virtual HRESULT STDMETHODCALLTYPE persistence(
+ /* [out, retval] */ WebURLCredentialPersistence* result);
+
+ virtual HRESULT STDMETHODCALLTYPE user(
+ /* [out, retval] */ BSTR* result);
+
+ // WebURLCredential
+ const WebCore::Credential& credential() const;
+
+protected:
+ ULONG m_refCount;
+
+ WebCore::Credential m_credential;
+};
+
+
+#endif
diff --git a/WebKit/win/WebURLProtectionSpace.cpp b/WebKit/win/WebURLProtectionSpace.cpp
new file mode 100644
index 0000000..9b1913c
--- /dev/null
+++ b/WebKit/win/WebURLProtectionSpace.cpp
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKit.h"
+#include "WebKitDLL.h"
+#include "WebURLProtectionSpace.h"
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#pragma warning(pop)
+
+using namespace WebCore;
+
+// WebURLProtectionSpace ----------------------------------------------------------------
+
+WebURLProtectionSpace::WebURLProtectionSpace(const ProtectionSpace& protectionSpace)
+ : m_refCount(0)
+ , m_protectionSpace(protectionSpace)
+{
+ gClassCount++;
+}
+
+WebURLProtectionSpace::~WebURLProtectionSpace()
+{
+ gClassCount--;
+}
+
+WebURLProtectionSpace* WebURLProtectionSpace::createInstance()
+{
+ WebURLProtectionSpace* instance = new WebURLProtectionSpace(ProtectionSpace());
+ instance->AddRef();
+ return instance;
+}
+
+WebURLProtectionSpace* WebURLProtectionSpace::createInstance(const ProtectionSpace& protectionSpace)
+{
+ WebURLProtectionSpace* instance = new WebURLProtectionSpace(protectionSpace);
+ instance->AddRef();
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IUnknown*>(this);
+ else if (IsEqualGUID(riid, CLSID_WebURLProtectionSpace))
+ *ppvObject = static_cast<WebURLProtectionSpace*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLProtectionSpace))
+ *ppvObject = static_cast<IWebURLProtectionSpace*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebURLProtectionSpace::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebURLProtectionSpace::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLProtectionSpace -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::authenticationMethod(
+ /* [out, retval] */ BSTR* result)
+{
+ switch (m_protectionSpace.authenticationScheme()) {
+ case ProtectionSpaceAuthenticationSchemeDefault:
+ *result = SysAllocString(WebURLAuthenticationMethodDefault);
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTTPBasic:
+ *result = SysAllocString(WebURLAuthenticationMethodHTTPBasic);
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTTPDigest:
+ *result = SysAllocString(WebURLAuthenticationMethodHTTPDigest);
+ break;
+ case ProtectionSpaceAuthenticationSchemeHTMLForm:
+ *result = SysAllocString(WebURLAuthenticationMethodHTMLForm);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::host(
+ /* [out, retval] */ BSTR* result)
+{
+ BString str = m_protectionSpace.host();
+ *result = str.release();
+ return S_OK;
+}
+
+static ProtectionSpaceAuthenticationScheme coreScheme(BSTR authenticationMethod)
+{
+ ProtectionSpaceAuthenticationScheme scheme = ProtectionSpaceAuthenticationSchemeDefault;
+ if (BString(authenticationMethod) == BString(WebURLAuthenticationMethodDefault))
+ scheme = ProtectionSpaceAuthenticationSchemeDefault;
+ else if (BString(authenticationMethod) == BString(WebURLAuthenticationMethodHTTPBasic))
+ scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
+ else if (BString(authenticationMethod) == BString(WebURLAuthenticationMethodHTTPDigest))
+ scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
+ else if (BString(authenticationMethod) == BString(WebURLAuthenticationMethodHTMLForm))
+ scheme = ProtectionSpaceAuthenticationSchemeHTMLForm;
+ else
+ ASSERT_NOT_REACHED();
+ return scheme;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::initWithHost(
+ /* [in] */ BSTR host,
+ /* [in] */ int port,
+ /* [in] */ BSTR protocol,
+ /* [in] */ BSTR realm,
+ /* [in] */ BSTR authenticationMethod)
+{
+ ProtectionSpaceServerType serverType = ProtectionSpaceServerHTTP;
+ if (BString(protocol) == WebURLProtectionSpaceHTTP)
+ serverType = ProtectionSpaceServerHTTP;
+ else if (BString(protocol) == WebURLProtectionSpaceHTTPS)
+ serverType = ProtectionSpaceServerHTTPS;
+ else if (BString(protocol) == WebURLProtectionSpaceFTP)
+ serverType = ProtectionSpaceServerFTP;
+ else if (BString(protocol) == WebURLProtectionSpaceFTPS)
+ serverType = ProtectionSpaceServerFTPS;
+ else
+ ASSERT_NOT_REACHED();
+
+ m_protectionSpace = ProtectionSpace(String(host, SysStringLen(host)), port, serverType,
+ String(realm, SysStringLen(realm)), coreScheme(authenticationMethod));
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::initWithProxyHost(
+ /* [in] */ BSTR host,
+ /* [in] */ int port,
+ /* [in] */ BSTR proxyType,
+ /* [in] */ BSTR realm,
+ /* [in] */ BSTR authenticationMethod)
+{
+ ProtectionSpaceServerType serverType = ProtectionSpaceProxyHTTP;
+ if (BString(proxyType) == WebURLProtectionSpaceHTTPProxy)
+ serverType = ProtectionSpaceProxyHTTP;
+ else if (BString(proxyType) == WebURLProtectionSpaceHTTPSProxy)
+ serverType = ProtectionSpaceProxyHTTPS;
+ else if (BString(proxyType) == WebURLProtectionSpaceFTPProxy)
+ serverType = ProtectionSpaceProxyFTP;
+ else if (BString(proxyType) == WebURLProtectionSpaceSOCKSProxy)
+ serverType = ProtectionSpaceProxySOCKS;
+ else
+ ASSERT_NOT_REACHED();
+
+ m_protectionSpace = ProtectionSpace(String(host, SysStringLen(host)), port, serverType,
+ String(realm, SysStringLen(realm)), coreScheme(authenticationMethod));
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::isProxy(
+ /* [out, retval] */ BOOL* result)
+{
+ *result = m_protectionSpace.isProxy();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::port(
+ /* [out, retval] */ int* result)
+{
+ *result = m_protectionSpace.port();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::protocol(
+ /* [out, retval] */ BSTR* result)
+{
+ switch (m_protectionSpace.serverType()) {
+ case ProtectionSpaceServerHTTP:
+ *result = SysAllocString(WebURLProtectionSpaceHTTP);
+ break;
+ case ProtectionSpaceServerHTTPS:
+ *result = SysAllocString(WebURLProtectionSpaceHTTPS);
+ break;
+ case ProtectionSpaceServerFTP:
+ *result = SysAllocString(WebURLProtectionSpaceFTP);
+ break;
+ case ProtectionSpaceServerFTPS:
+ *result = SysAllocString(WebURLProtectionSpaceFTPS);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::proxyType(
+ /* [out, retval] */ BSTR* result)
+{
+ switch (m_protectionSpace.serverType()) {
+ case ProtectionSpaceProxyHTTP:
+ *result = SysAllocString(WebURLProtectionSpaceHTTPProxy);
+ break;
+ case ProtectionSpaceProxyHTTPS:
+ *result = SysAllocString(WebURLProtectionSpaceHTTPSProxy);
+ break;
+ case ProtectionSpaceProxyFTP:
+ *result = SysAllocString(WebURLProtectionSpaceFTPProxy);
+ break;
+ case ProtectionSpaceProxySOCKS:
+ *result = SysAllocString(WebURLProtectionSpaceSOCKSProxy);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::realm(
+ /* [out, retval] */ BSTR* result)
+{
+ BString bstring = m_protectionSpace.realm();
+ *result = bstring.release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::receivesCredentialSecurely(
+ /* [out, retval] */ BOOL* result)
+{
+ *result = m_protectionSpace.receivesCredentialSecurely();
+ return S_OK;
+}
+
+// WebURLProtectionSpace -------------------------------------------------------------------
+const ProtectionSpace& WebURLProtectionSpace::protectionSpace() const
+{
+ return m_protectionSpace;
+}
diff --git a/WebKit/win/WebURLProtectionSpace.h b/WebKit/win/WebURLProtectionSpace.h
new file mode 100644
index 0000000..579d21b
--- /dev/null
+++ b/WebKit/win/WebURLProtectionSpace.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebURLProtectionSpace_h
+#define WebURLProtectionSpace_h
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/ProtectionSpace.h>
+#pragma warning(pop)
+
+class WebURLProtectionSpace : public IWebURLProtectionSpace
+{
+public:
+ static WebURLProtectionSpace* createInstance();
+ static WebURLProtectionSpace* createInstance(const WebCore::ProtectionSpace&);
+private:
+ WebURLProtectionSpace(const WebCore::ProtectionSpace&);
+ ~WebURLProtectionSpace();
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLProtectionSpace
+ virtual HRESULT STDMETHODCALLTYPE authenticationMethod(
+ /* [out, retval] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE host(
+ /* [out, retval] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithHost(
+ /* [in] */ BSTR host,
+ /* [in] */ int port,
+ /* [in] */ BSTR protocol,
+ /* [in] */ BSTR realm,
+ /* [in] */ BSTR authenticationMethod);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithProxyHost(
+ /* [in] */ BSTR host,
+ /* [in] */ int port,
+ /* [in] */ BSTR proxyType,
+ /* [in] */ BSTR realm,
+ /* [in] */ BSTR authenticationMethod);
+
+ virtual HRESULT STDMETHODCALLTYPE isProxy(
+ /* [out, retval] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE port(
+ /* [out, retval] */ int* result);
+
+ virtual HRESULT STDMETHODCALLTYPE protocol(
+ /* [out, retval] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE proxyType(
+ /* [out, retval] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE realm(
+ /* [out, retval] */ BSTR* result);
+
+ virtual HRESULT STDMETHODCALLTYPE receivesCredentialSecurely(
+ /* [out, retval] */ BOOL* result);
+
+ // WebURLProtectionSpace
+ const WebCore::ProtectionSpace& protectionSpace() const;
+
+protected:
+ ULONG m_refCount;
+
+ WebCore::ProtectionSpace m_protectionSpace;
+};
+
+
+#endif
diff --git a/WebKit/win/WebURLResponse.cpp b/WebKit/win/WebURLResponse.cpp
new file mode 100644
index 0000000..ca28927
--- /dev/null
+++ b/WebKit/win/WebURLResponse.cpp
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebKit.h"
+
+#include "HTTPHeaderPropertyBag.h"
+#include "MarshallingHelpers.h"
+#include "WebLocalizableStrings.h"
+
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/platform.h>
+#pragma warning( push, 0 )
+#include <WebCore/BString.h>
+#include <WebCore/KURL.h>
+#include <WebCore/ResourceHandle.h>
+#pragma warning( pop )
+#include <shlobj.h>
+#include <shlwapi.h>
+#include <tchar.h>
+
+using namespace WebCore;
+
+static LPCTSTR CFHTTPMessageCopyLocalizedShortDescriptionForStatusCode(CFIndex statusCode)
+{
+ LPCTSTR result = 0;
+ if (statusCode < 100 || statusCode >= 600)
+ result = LPCTSTR_UI_STRING("server error", "HTTP result code string");
+ else if (statusCode >= 100 && statusCode <= 199) {
+ switch (statusCode) {
+ case 100:
+ result = LPCTSTR_UI_STRING("continue", "HTTP result code string");
+ break;
+ case 101:
+ result = LPCTSTR_UI_STRING("switching protocols", "HTTP result code string");
+ break;
+ default:
+ result = LPCTSTR_UI_STRING("informational", "HTTP result code string");
+ break;
+ }
+ } else if (statusCode >= 200 && statusCode <= 299) {
+ switch (statusCode) {
+ case 200:
+ result = LPCTSTR_UI_STRING("no error", "HTTP result code string");
+ break;
+ case 201:
+ result = LPCTSTR_UI_STRING("created", "HTTP result code string");
+ break;
+ case 202:
+ result = LPCTSTR_UI_STRING("accepted", "HTTP result code string");
+ break;
+ case 203:
+ result = LPCTSTR_UI_STRING("non-authoritative information", "HTTP result code string");
+ break;
+ case 204:
+ result = LPCTSTR_UI_STRING("no content", "HTTP result code string");
+ break;
+ case 205:
+ result = LPCTSTR_UI_STRING("reset content", "HTTP result code string");
+ break;
+ case 206:
+ result = LPCTSTR_UI_STRING("partial content", "HTTP result code string");
+ break;
+ default:
+ result = LPCTSTR_UI_STRING("success", "HTTP result code string");
+ break;
+ }
+ } else if (statusCode >= 300 && statusCode <= 399) {
+ switch (statusCode) {
+ case 300:
+ result = LPCTSTR_UI_STRING("multiple choices", "HTTP result code string");
+ break;
+ case 301:
+ result = LPCTSTR_UI_STRING("moved permanently", "HTTP result code string");
+ break;
+ case 302:
+ result = LPCTSTR_UI_STRING("found", "HTTP result code string");
+ break;
+ case 303:
+ result = LPCTSTR_UI_STRING("see other", "HTTP result code string");
+ break;
+ case 304:
+ result = LPCTSTR_UI_STRING("not modified", "HTTP result code string");
+ break;
+ case 305:
+ result = LPCTSTR_UI_STRING("needs proxy", "HTTP result code string");
+ break;
+ case 307:
+ result = LPCTSTR_UI_STRING("temporarily redirected", "HTTP result code string");
+ break;
+ case 306: // 306 status code unused in HTTP
+ default:
+ result = LPCTSTR_UI_STRING("redirected", "HTTP result code string");
+ break;
+ }
+ } else if (statusCode >= 400 && statusCode <= 499) {
+ switch (statusCode) {
+ case 400:
+ result = LPCTSTR_UI_STRING("bad request", "HTTP result code string");
+ break;
+ case 401:
+ result = LPCTSTR_UI_STRING("unauthorized", "HTTP result code string");
+ break;
+ case 402:
+ result = LPCTSTR_UI_STRING("payment required", "HTTP result code string");
+ break;
+ case 403:
+ result = LPCTSTR_UI_STRING("forbidden", "HTTP result code string");
+ break;
+ case 404:
+ result = LPCTSTR_UI_STRING("not found", "HTTP result code string");
+ break;
+ case 405:
+ result = LPCTSTR_UI_STRING("method not allowed", "HTTP result code string");
+ break;
+ case 406:
+ result = LPCTSTR_UI_STRING("unacceptable", "HTTP result code string");
+ break;
+ case 407:
+ result = LPCTSTR_UI_STRING("proxy authentication required", "HTTP result code string");
+ break;
+ case 408:
+ result = LPCTSTR_UI_STRING("request timed out", "HTTP result code string");
+ break;
+ case 409:
+ result = LPCTSTR_UI_STRING("conflict", "HTTP result code string");
+ break;
+ case 410:
+ result = LPCTSTR_UI_STRING("no longer exists", "HTTP result code string");
+ break;
+ case 411:
+ result = LPCTSTR_UI_STRING("length required", "HTTP result code string");
+ break;
+ case 412:
+ result = LPCTSTR_UI_STRING("precondition failed", "HTTP result code string");
+ break;
+ case 413:
+ result = LPCTSTR_UI_STRING("request too large", "HTTP result code string");
+ break;
+ case 414:
+ result = LPCTSTR_UI_STRING("requested URL too long", "HTTP result code string");
+ break;
+ case 415:
+ result = LPCTSTR_UI_STRING("unsupported media type", "HTTP result code string");
+ break;
+ case 416:
+ result = LPCTSTR_UI_STRING("requested range not satisfiable", "HTTP result code string");
+ break;
+ case 417:
+ result = LPCTSTR_UI_STRING("expectation failed", "HTTP result code string");
+ break;
+ default:
+ result = LPCTSTR_UI_STRING("client error", "HTTP result code string");
+ break;
+ }
+ } else if (statusCode >= 500 && statusCode <= 599) {
+ switch (statusCode) {
+ case 500:
+ result = LPCTSTR_UI_STRING("internal server error", "HTTP result code string");
+ break;
+ case 501:
+ result = LPCTSTR_UI_STRING("unimplemented", "HTTP result code string");
+ break;
+ case 502:
+ result = LPCTSTR_UI_STRING("bad gateway", "HTTP result code string");
+ break;
+ case 503:
+ result = LPCTSTR_UI_STRING("service unavailable", "HTTP result code string");
+ break;
+ case 504:
+ result = LPCTSTR_UI_STRING("gateway timed out", "HTTP result code string");
+ break;
+ case 505:
+ result = LPCTSTR_UI_STRING("unsupported version", "HTTP result code string");
+ break;
+ default:
+ result = LPCTSTR_UI_STRING("server error", "HTTP result code string");
+ break;
+ }
+ }
+ return result;
+}
+
+// IWebURLResponse ----------------------------------------------------------------
+
+WebURLResponse::WebURLResponse()
+ :m_refCount(0)
+{
+ gClassCount++;
+}
+
+WebURLResponse::~WebURLResponse()
+{
+ gClassCount--;
+}
+
+WebURLResponse* WebURLResponse::createInstance()
+{
+ WebURLResponse* instance = new WebURLResponse();
+ // fake an http response - so it has the IWebHTTPURLResponse interface
+ instance->m_response = ResourceResponse(KURL("http://"), String(), 0, String(), String());
+ instance->AddRef();
+ return instance;
+}
+
+WebURLResponse* WebURLResponse::createInstance(const ResourceResponse& response)
+{
+ if (response.isNull())
+ return 0;
+
+ WebURLResponse* instance = new WebURLResponse();
+ instance->AddRef();
+ instance->m_response = response;
+
+ return instance;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebURLResponse*>(this);
+ else if (IsEqualGUID(riid, __uuidof(this)))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IWebURLResponse))
+ *ppvObject = static_cast<IWebURLResponse*>(this);
+ else if (IsEqualGUID(riid, IID_IWebURLResponsePrivate))
+ *ppvObject = static_cast<IWebURLResponsePrivate*>(this);
+ else if (m_response.isHTTP() && IsEqualGUID(riid, IID_IWebHTTPURLResponse))
+ *ppvObject = static_cast<IWebHTTPURLResponse*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebURLResponse::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebURLResponse::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebURLResponse --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::expectedContentLength(
+ /* [retval][out] */ long long* result)
+{
+ *result = m_response.expectedContentLength();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::initWithURL(
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ int expectedContentLength,
+ /* [in] */ BSTR textEncodingName)
+{
+ m_response = ResourceResponse(KURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::MIMEType(
+ /* [retval][out] */ BSTR* result)
+{
+ BString mimeType(m_response.mimeType());
+ *result = mimeType.release();
+ if (!m_response.mimeType().isNull() && !*result)
+ return E_OUTOFMEMORY;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::suggestedFilename(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ if (m_response.url().isEmpty())
+ return E_FAIL;
+
+ *result = BString(m_response.suggestedFilename()).release();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::textEncodingName(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_INVALIDARG;
+
+ BString textEncodingName(m_response.textEncodingName());
+ *result = textEncodingName.release();
+ if (!m_response.textEncodingName().isNull() && !*result)
+ return E_OUTOFMEMORY;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::URL(
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result)
+ return E_INVALIDARG;
+
+ BString url(m_response.url().string());
+ *result = url.release();
+ if (!m_response.url().isEmpty() && !*result)
+ return E_OUTOFMEMORY;
+
+ return S_OK;
+}
+
+// IWebHTTPURLResponse --------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::allHeaderFields(
+ /* [retval][out] */ IPropertyBag** headerFields)
+{
+ ASSERT(m_response.isHTTP());
+ *headerFields = HTTPHeaderPropertyBag::createInstance(this);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::localizedStringForStatusCode(
+ /* [in] */ int statusCode,
+ /* [retval][out] */ BSTR* statusString)
+{
+ ASSERT(m_response.isHTTP());
+ if (statusString)
+ *statusString = 0;
+ LPCTSTR statusText = CFHTTPMessageCopyLocalizedShortDescriptionForStatusCode(statusCode);
+ if (!statusText)
+ return E_FAIL;
+ if (statusString)
+ *statusString = SysAllocString(statusText);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::statusCode(
+ /* [retval][out] */ int* statusCode)
+{
+ ASSERT(m_response.isHTTP());
+ if (statusCode)
+ *statusCode = m_response.httpStatusCode();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::isAttachment(
+ /* [retval][out] */ BOOL *attachment)
+{
+ *attachment = m_response.isAttachment();
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebURLResponse::sslPeerCertificate(
+ /* [retval][out] */ OLE_HANDLE* result)
+{
+ if (!result)
+ return E_POINTER;
+ *result = 0;
+ CFDictionaryRef dict = certificateDictionary();
+ if (!dict)
+ return E_FAIL;
+ void* data = wkGetSSLPeerCertificateData(dict);
+ if (!data)
+ return E_FAIL;
+ *result = (OLE_HANDLE)(ULONG64)data;
+ return *result ? S_OK : E_FAIL;
+}
+
+// WebURLResponse -------------------------------------------------------------
+
+HRESULT WebURLResponse::suggestedFileExtension(BSTR *result)
+{
+ if (!result)
+ return E_POINTER;
+
+ *result = 0;
+
+ if (m_response.mimeType().isEmpty())
+ return E_FAIL;
+
+ BString mimeType(m_response.mimeType());
+ HKEY key;
+ LONG err = RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("MIME\\Database\\Content Type"), 0, KEY_QUERY_VALUE, &key);
+ if (!err) {
+ HKEY subKey;
+ err = RegOpenKeyEx(key, mimeType, 0, KEY_QUERY_VALUE, &subKey);
+ if (!err) {
+ DWORD keyType = REG_SZ;
+ TCHAR extension[MAX_PATH];
+ DWORD keySize = sizeof(extension)/sizeof(extension[0]);
+ err = RegQueryValueEx(subKey, TEXT("Extension"), 0, &keyType, (LPBYTE)extension, &keySize);
+ if (!err && keyType != REG_SZ)
+ err = ERROR_INVALID_DATA;
+ if (err) {
+ // fallback handlers
+ if (!_tcscmp(mimeType, TEXT("text/html"))) {
+ _tcscpy(extension, TEXT(".html"));
+ err = 0;
+ } else if (!_tcscmp(mimeType, TEXT("application/xhtml+xml"))) {
+ _tcscpy(extension, TEXT(".xhtml"));
+ err = 0;
+ } else if (!_tcscmp(mimeType, TEXT("image/svg+xml"))) {
+ _tcscpy(extension, TEXT(".svg"));
+ err = 0;
+ }
+ }
+ if (!err) {
+ *result = SysAllocString(extension);
+ if (!*result)
+ err = ERROR_OUTOFMEMORY;
+ }
+ RegCloseKey(subKey);
+ }
+ RegCloseKey(key);
+ }
+
+ return HRESULT_FROM_WIN32(err);
+}
+
+const ResourceResponse& WebURLResponse::resourceResponse() const
+{
+ return m_response;
+}
+
+CFDictionaryRef WebURLResponse::certificateDictionary() const
+{
+ if (m_SSLCertificateInfo)
+ return m_SSLCertificateInfo.get();
+
+ CFURLResponseRef cfResponse = m_response.cfURLResponse();
+ if (!cfResponse)
+ return 0;
+ m_SSLCertificateInfo = wkGetSSLCertificateInfo(cfResponse);
+ return m_SSLCertificateInfo.get();
+}
diff --git a/WebKit/win/WebURLResponse.h b/WebKit/win/WebURLResponse.h
new file mode 100644
index 0000000..be54a3e
--- /dev/null
+++ b/WebKit/win/WebURLResponse.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebURLResponse_H
+#define WebURLResponse_H
+
+#include "WebKit.h"
+
+#pragma warning(push, 0)
+#include <WebCore/ResourceResponse.h>
+#pragma warning(pop)
+
+class WebURLResponse : public IWebHTTPURLResponse, IWebURLResponsePrivate
+{
+public:
+ static WebURLResponse* createInstance();
+ static WebURLResponse* createInstance(const WebCore::ResourceResponse& response);
+protected:
+ WebURLResponse();
+ ~WebURLResponse();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebURLResponse
+ virtual HRESULT STDMETHODCALLTYPE expectedContentLength(
+ /* [retval][out] */ long long *result);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithURL(
+ /* [in] */ BSTR url,
+ /* [in] */ BSTR mimeType,
+ /* [in] */ int expectedContentLength,
+ /* [in] */ BSTR textEncodingName);
+
+ virtual HRESULT STDMETHODCALLTYPE MIMEType(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE suggestedFilename(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE textEncodingName(
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE URL(
+ /* [retval][out] */ BSTR *result);
+
+ // IWebHTTPURLResponse
+ virtual HRESULT STDMETHODCALLTYPE allHeaderFields(
+ /* [retval][out] */ IPropertyBag **headerFields);
+
+ virtual HRESULT STDMETHODCALLTYPE localizedStringForStatusCode(
+ /* [in] */ int statusCode,
+ /* [retval][out] */ BSTR *statusString);
+
+ virtual HRESULT STDMETHODCALLTYPE statusCode(
+ /* [retval][out] */ int *statusCode);
+
+ virtual HRESULT STDMETHODCALLTYPE isAttachment(
+ /* [retval][out] */ BOOL *attachment);
+
+ // IWebURLResponsePrivate
+ virtual HRESULT STDMETHODCALLTYPE sslPeerCertificate(
+ /* [retval][out] */ OLE_HANDLE *result);
+
+ const WebCore::ResourceResponse& resourceResponse() const;
+
+protected:
+ HRESULT suggestedFileExtension(BSTR* result);
+ CFDictionaryRef certificateDictionary() const;
+
+protected:
+ ULONG m_refCount;
+ WebCore::ResourceResponse m_response;
+ mutable RetainPtr<CFDictionaryRef> m_SSLCertificateInfo; // this ensures certificate contexts are valid for the lifetime of this WebURLResponse.
+};
+
+#endif
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
new file mode 100644
index 0000000..545ea5e
--- /dev/null
+++ b/WebKit/win/WebView.cpp
@@ -0,0 +1,4704 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitDLL.h"
+#include "WebView.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "DOMCoreClasses.h"
+#include "WebDatabaseManager.h"
+#include "WebDocumentLoader.h"
+#include "WebEditorClient.h"
+#include "WebElementPropertyBag.h"
+#include "WebFrame.h"
+#include "WebBackForwardList.h"
+#include "WebChromeClient.h"
+#include "WebContextMenuClient.h"
+#include "WebDragClient.h"
+#include "WebIconDatabase.h"
+#include "WebInspector.h"
+#include "WebInspectorClient.h"
+#include "WebKit.h"
+#include "WebKitStatisticsPrivate.h"
+#include "WebKitSystemBits.h"
+#include "WebMutableURLRequest.h"
+#include "WebNotificationCenter.h"
+#include "WebPreferences.h"
+#include "WebScriptDebugServer.h"
+#pragma warning( push, 0 )
+#include <CoreGraphics/CGContext.h>
+#include <WebCore/BString.h>
+#include <WebCore/Cache.h>
+#include <WebCore/ContextMenu.h>
+#include <WebCore/ContextMenuController.h>
+#include <WebCore/CString.h>
+#include <WebCore/Cursor.h>
+#include <WebCore/Document.h>
+#include <WebCore/DragController.h>
+#include <WebCore/DragData.h>
+#include <WebCore/Editor.h>
+#include <WebCore/EventHandler.h>
+#include <WebCore/EventNames.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/FocusController.h>
+#include <WebCore/FrameLoader.h>
+#include <WebCore/FrameTree.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/FrameWin.h>
+#include <WebCore/GDIObjectCounter.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/HistoryItem.h>
+#include <WebCore/HitTestResult.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/KeyboardEvent.h>
+#include <WebCore/Language.h>
+#include <WebCore/MIMETypeRegistry.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/Page.h>
+#include <WebCore/PageCache.h>
+#include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/PlatformMouseEvent.h>
+#include <WebCore/PlatformWheelEvent.h>
+#include <WebCore/PluginDatabase.h>
+#include <WebCore/PluginInfoStore.h>
+#include <WebCore/PluginView.h>
+#include <WebCore/ProgressTracker.h>
+#include <WebCore/ResourceHandle.h>
+#include <WebCore/ResourceHandleClient.h>
+#include <WebCore/SelectionController.h>
+#include <WebCore/Settings.h>
+#include <WebCore/SimpleFontData.h>
+#include <WebCore/TypingCommand.h>
+#include <WebCore/WindowMessageBroadcaster.h>
+#pragma warning(pop)
+#include <JavaScriptCore/collector.h>
+#include <JavaScriptCore/value.h>
+#include <CFNetwork/CFURLCachePriv.h>
+#include <CFNetwork/CFURLProtocolPriv.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/HashSet.h>
+#include <tchar.h>
+#include <dimm.h>
+#include <windowsx.h>
+#include <ShlObj.h>
+
+using namespace WebCore;
+using namespace WebCore::EventNames;
+using KJS::JSLock;
+using std::min;
+using std::max;
+
+class PreferencesChangedOrRemovedObserver : public IWebNotificationObserver {
+public:
+ static PreferencesChangedOrRemovedObserver* sharedInstance();
+
+private:
+ PreferencesChangedOrRemovedObserver() {}
+ ~PreferencesChangedOrRemovedObserver() {}
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**) { return E_FAIL; }
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 0; }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return 0; }
+
+public:
+ // IWebNotificationObserver
+ virtual HRESULT STDMETHODCALLTYPE onNotify(
+ /* [in] */ IWebNotification* notification);
+
+private:
+ HRESULT notifyPreferencesChanged(WebCacheModel);
+ HRESULT notifyPreferencesRemoved(WebCacheModel);
+};
+
+PreferencesChangedOrRemovedObserver* PreferencesChangedOrRemovedObserver::sharedInstance()
+{
+ static PreferencesChangedOrRemovedObserver* shared = new PreferencesChangedOrRemovedObserver;
+ return shared;
+}
+
+HRESULT PreferencesChangedOrRemovedObserver::onNotify(IWebNotification* notification)
+{
+ HRESULT hr = S_OK;
+
+ COMPtr<IUnknown> unkPrefs;
+ hr = notification->getObject(&unkPrefs);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<IWebPreferences> preferences(Query, unkPrefs);
+ if (!preferences)
+ return E_NOINTERFACE;
+
+ WebCacheModel cacheModel;
+ hr = preferences->cacheModel(&cacheModel);
+ if (FAILED(hr))
+ return hr;
+
+ BSTR nameBSTR;
+ hr = notification->name(&nameBSTR);
+ if (FAILED(hr))
+ return hr;
+ BString name;
+ name.adoptBSTR(nameBSTR);
+
+ if (wcscmp(name, WebPreferences::webPreferencesChangedNotification()) == 0)
+ return notifyPreferencesChanged(cacheModel);
+
+ if (wcscmp(name, WebPreferences::webPreferencesRemovedNotification()) == 0)
+ return notifyPreferencesRemoved(cacheModel);
+
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+}
+
+HRESULT PreferencesChangedOrRemovedObserver::notifyPreferencesChanged(WebCacheModel cacheModel)
+{
+ HRESULT hr = S_OK;
+
+ if (WebView::didSetCacheModel() || cacheModel > WebView::cacheModel())
+ WebView::setCacheModel(cacheModel);
+ else if (cacheModel < WebView::cacheModel()) {
+ WebCacheModel sharedPreferencesCacheModel;
+ hr = WebPreferences::sharedStandardPreferences()->cacheModel(&sharedPreferencesCacheModel);
+ if (FAILED(hr))
+ return hr;
+ WebView::setCacheModel(max(sharedPreferencesCacheModel, WebView::maxCacheModelInAnyInstance()));
+ }
+
+ return hr;
+}
+
+HRESULT PreferencesChangedOrRemovedObserver::notifyPreferencesRemoved(WebCacheModel cacheModel)
+{
+ HRESULT hr = S_OK;
+
+ if (cacheModel == WebView::cacheModel()) {
+ WebCacheModel sharedPreferencesCacheModel;
+ hr = WebPreferences::sharedStandardPreferences()->cacheModel(&sharedPreferencesCacheModel);
+ if (FAILED(hr))
+ return hr;
+ WebView::setCacheModel(max(sharedPreferencesCacheModel, WebView::maxCacheModelInAnyInstance()));
+ }
+
+ return hr;
+}
+
+
+const LPCWSTR kWebViewWindowClassName = L"WebViewWindowClass";
+
+const int WM_XP_THEMECHANGED = 0x031A;
+const int WM_VISTA_MOUSEHWHEEL = 0x020E;
+
+static const int maxToolTipWidth = 250;
+
+static ATOM registerWebView();
+static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+static void initializeStaticObservers();
+
+static HRESULT updateSharedSettingsFromPreferencesIfNeeded(IWebPreferences*);
+
+HRESULT createMatchEnumerator(Vector<IntRect>* rects, IEnumTextMatches** matches);
+
+static bool continuousSpellCheckingEnabled;
+static bool grammarCheckingEnabled;
+
+static bool s_didSetCacheModel;
+static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;
+
+enum {
+ UpdateActiveStateTimer = 1,
+};
+
+// WebView ----------------------------------------------------------------
+
+bool WebView::s_allowSiteSpecificHacks = false;
+
+WebView::WebView()
+: m_refCount(0)
+, m_hostWindow(0)
+, m_viewWindow(0)
+, m_mainFrame(0)
+, m_page(0)
+, m_hasCustomDropTarget(false)
+, m_useBackForwardList(true)
+, m_userAgentOverridden(false)
+, m_textSizeMultiplier(1)
+, m_mouseActivated(false)
+, m_dragData(0)
+, m_currentCharacterCode(0)
+, m_isBeingDestroyed(false)
+, m_paintCount(0)
+, m_hasSpellCheckerDocumentTag(false)
+, m_smartInsertDeleteEnabled(false)
+, m_didClose(false)
+, m_inIMEComposition(0)
+, m_toolTipHwnd(0)
+, m_closeWindowTimer(this, &WebView::closeWindowTimerFired)
+, m_topLevelParent(0)
+{
+ KJS::Collector::registerAsMainThread();
+
+ m_backingStoreSize.cx = m_backingStoreSize.cy = 0;
+
+ CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper,(void**)&m_dropTargetHelper);
+
+ initializeStaticObservers();
+
+ WebPreferences* sharedPreferences = WebPreferences::sharedStandardPreferences();
+ BOOL enabled;
+ if (SUCCEEDED(sharedPreferences->continuousSpellCheckingEnabled(&enabled)))
+ continuousSpellCheckingEnabled = !!enabled;
+ if (SUCCEEDED(sharedPreferences->grammarCheckingEnabled(&enabled)))
+ grammarCheckingEnabled = !!enabled;
+
+ WebViewCount++;
+ gClassCount++;
+}
+
+WebView::~WebView()
+{
+ deleteBackingStore();
+
+ // <rdar://4958382> m_viewWindow will be destroyed when m_hostWindow is destroyed, but if
+ // setHostWindow was never called we will leak our HWND. If we still have a valid HWND at
+ // this point, we should just destroy it ourselves.
+ if (::IsWindow(m_viewWindow))
+ ::DestroyWindow(m_viewWindow);
+
+ ASSERT(!m_page);
+ ASSERT(!m_preferences);
+
+ WebViewCount--;
+ gClassCount--;
+}
+
+WebView* WebView::createInstance()
+{
+ WebView* instance = new WebView();
+ instance->AddRef();
+ return instance;
+}
+
+void initializeStaticObservers()
+{
+ static bool initialized;
+ if (initialized)
+ return;
+ initialized = true;
+
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->addObserver(PreferencesChangedOrRemovedObserver::sharedInstance(), WebPreferences::webPreferencesChangedNotification(), 0);
+ notifyCenter->addObserver(PreferencesChangedOrRemovedObserver::sharedInstance(), WebPreferences::webPreferencesRemovedNotification(), 0);
+}
+
+static HashSet<WebView*>& allWebViewsSet()
+{
+ static HashSet<WebView*> allWebViewsSet;
+ return allWebViewsSet;
+}
+
+void WebView::addToAllWebViewsSet()
+{
+ allWebViewsSet().add(this);
+}
+
+void WebView::removeFromAllWebViewsSet()
+{
+ allWebViewsSet().remove(this);
+}
+
+void WebView::setCacheModel(WebCacheModel cacheModel)
+{
+ if (s_didSetCacheModel && cacheModel == s_cacheModel)
+ return;
+
+ RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory());
+ if (!cfurlCacheDirectory)
+ cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString());
+
+
+ CFURLCacheRef cfurlSharedCache = CFURLCacheSharedURLCache();
+
+ // As a fudge factor, use 1000 instead of 1024, in case the reported byte
+ // count doesn't align exactly to a megabyte boundary.
+ unsigned long long memSize = WebMemorySize() / 1024 / 1000;
+ unsigned long long diskFreeSize = WebVolumeFreeSize(cfurlCacheDirectory.get()) / 1024 / 1000;
+
+ unsigned cacheTotalCapacity = 0;
+ unsigned cacheMinDeadCapacity = 0;
+ unsigned cacheMaxDeadCapacity = 0;
+
+ unsigned pageCacheCapacity = 0;
+
+ CFIndex cfurlCacheMemoryCapacity = 0;
+ CFIndex cfurlCacheDiskCapacity = 0;
+
+ switch (cacheModel) {
+ case WebCacheModelDocumentViewer: {
+ // Page cache capacity (in pages)
+ pageCacheCapacity = 0;
+
+ // Object cache capacities (in bytes)
+ if (memSize >= 4096)
+ cacheTotalCapacity = 256 * 1024 * 1024;
+ else if (memSize >= 3072)
+ cacheTotalCapacity = 192 * 1024 * 1024;
+ else if (memSize >= 2048)
+ cacheTotalCapacity = 128 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 86 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+ else if (memSize >= 256)
+ cacheTotalCapacity = 16 * 1024 * 1024;
+
+ cacheMinDeadCapacity = 0;
+ cacheMaxDeadCapacity = 0;
+
+ // Foundation memory cache capacity (in bytes)
+ cfurlCacheMemoryCapacity = 0;
+
+ // Foundation disk cache capacity (in bytes)
+ cfurlCacheDiskCapacity = CFURLCacheDiskCapacity(cfurlSharedCache);
+
+ break;
+ }
+ case WebCacheModelDocumentBrowser: {
+ // Page cache capacity (in pages)
+ if (memSize >= 1024)
+ pageCacheCapacity = 3;
+ else if (memSize >= 512)
+ pageCacheCapacity = 2;
+ else if (memSize >= 256)
+ pageCacheCapacity = 1;
+ else
+ pageCacheCapacity = 0;
+
+ // Object cache capacities (in bytes)
+ if (memSize >= 4096)
+ cacheTotalCapacity = 256 * 1024 * 1024;
+ else if (memSize >= 3072)
+ cacheTotalCapacity = 192 * 1024 * 1024;
+ else if (memSize >= 2048)
+ cacheTotalCapacity = 128 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 86 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+ else if (memSize >= 256)
+ cacheTotalCapacity = 16 * 1024 * 1024;
+
+ cacheMinDeadCapacity = cacheTotalCapacity / 8;
+ cacheMaxDeadCapacity = cacheTotalCapacity / 4;
+
+ // Foundation memory cache capacity (in bytes)
+ if (memSize >= 2048)
+ cfurlCacheMemoryCapacity = 4 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cfurlCacheMemoryCapacity = 2 * 1024 * 1024;
+ else if (memSize >= 512)
+ cfurlCacheMemoryCapacity = 1 * 1024 * 1024;
+ else
+ cfurlCacheMemoryCapacity = 512 * 1024;
+
+ // Foundation disk cache capacity (in bytes)
+ if (diskFreeSize >= 16384)
+ cfurlCacheDiskCapacity = 50 * 1024 * 1024;
+ else if (diskFreeSize >= 8192)
+ cfurlCacheDiskCapacity = 40 * 1024 * 1024;
+ else if (diskFreeSize >= 4096)
+ cfurlCacheDiskCapacity = 30 * 1024 * 1024;
+ else
+ cfurlCacheDiskCapacity = 20 * 1024 * 1024;
+
+ break;
+ }
+ case WebCacheModelPrimaryWebBrowser: {
+ // Page cache capacity (in pages)
+ // (Research indicates that value / page drops substantially after 3 pages.)
+ if (memSize >= 8192)
+ pageCacheCapacity = 7;
+ if (memSize >= 4096)
+ pageCacheCapacity = 6;
+ else if (memSize >= 2048)
+ pageCacheCapacity = 5;
+ else if (memSize >= 1024)
+ pageCacheCapacity = 4;
+ else if (memSize >= 512)
+ pageCacheCapacity = 3;
+ else if (memSize >= 256)
+ pageCacheCapacity = 2;
+ else
+ pageCacheCapacity = 1;
+
+ // Object cache capacities (in bytes)
+ // (Testing indicates that value / MB depends heavily on content and
+ // browsing pattern. Even growth above 128MB can have substantial
+ // value / MB for some content / browsing patterns.)
+ if (memSize >= 4096)
+ cacheTotalCapacity = 512 * 1024 * 1024;
+ else if (memSize >= 3072)
+ cacheTotalCapacity = 384 * 1024 * 1024;
+ else if (memSize >= 2048)
+ cacheTotalCapacity = 256 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 172 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 128 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 256)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+
+ cacheMinDeadCapacity = cacheTotalCapacity / 4;
+ cacheMaxDeadCapacity = cacheTotalCapacity / 2;
+
+ // This code is here to avoid a PLT regression. We can remove it if we
+ // can prove that the overall system gain would justify the regression.
+ cacheMaxDeadCapacity = max(24u, cacheMaxDeadCapacity);
+
+ // Foundation memory cache capacity (in bytes)
+ // (These values are small because WebCore does most caching itself.)
+ if (memSize >= 1024)
+ cfurlCacheMemoryCapacity = 4 * 1024 * 1024;
+ else if (memSize >= 512)
+ cfurlCacheMemoryCapacity = 2 * 1024 * 1024;
+ else if (memSize >= 256)
+ cfurlCacheMemoryCapacity = 1 * 1024 * 1024;
+ else
+ cfurlCacheMemoryCapacity = 512 * 1024;
+
+ // Foundation disk cache capacity (in bytes)
+ if (diskFreeSize >= 16384)
+ cfurlCacheDiskCapacity = 175 * 1024 * 1024;
+ else if (diskFreeSize >= 8192)
+ cfurlCacheDiskCapacity = 150 * 1024 * 1024;
+ else if (diskFreeSize >= 4096)
+ cfurlCacheDiskCapacity = 125 * 1024 * 1024;
+ else if (diskFreeSize >= 2048)
+ cfurlCacheDiskCapacity = 100 * 1024 * 1024;
+ else if (diskFreeSize >= 1024)
+ cfurlCacheDiskCapacity = 75 * 1024 * 1024;
+ else
+ cfurlCacheDiskCapacity = 50 * 1024 * 1024;
+
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ };
+
+ // Don't shrink a big disk cache, since that would cause churn.
+ cfurlCacheDiskCapacity = max(cfurlCacheDiskCapacity, CFURLCacheDiskCapacity(cfurlSharedCache));
+
+ cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+ pageCache()->setCapacity(pageCacheCapacity);
+
+ CFURLCacheSetMemoryCapacity(cfurlSharedCache, cfurlCacheMemoryCapacity);
+ CFURLCacheSetDiskCapacity(cfurlSharedCache, cfurlCacheDiskCapacity);
+
+ s_didSetCacheModel = true;
+ s_cacheModel = cacheModel;
+ return;
+}
+
+WebCacheModel WebView::cacheModel()
+{
+ return s_cacheModel;
+}
+
+bool WebView::didSetCacheModel()
+{
+ return s_didSetCacheModel;
+}
+
+WebCacheModel WebView::maxCacheModelInAnyInstance()
+{
+ WebCacheModel cacheModel = WebCacheModelDocumentViewer;
+
+ HashSet<WebView*>::iterator end = allWebViewsSet().end();
+ for (HashSet<WebView*>::iterator it = allWebViewsSet().begin(); it != end; ++it) {
+ COMPtr<IWebPreferences> pref;
+ if (FAILED((*it)->preferences(&pref)))
+ continue;
+ WebCacheModel prefCacheModel = WebCacheModelDocumentViewer;
+ if (FAILED(pref->cacheModel(&prefCacheModel)))
+ continue;
+
+ cacheModel = max(cacheModel, prefCacheModel);
+ }
+
+ return cacheModel;
+}
+
+void WebView::close()
+{
+ if (m_didClose)
+ return;
+
+ m_didClose = true;
+
+ removeFromAllWebViewsSet();
+
+ Frame* frame = m_page->mainFrame();
+ if (frame)
+ frame->loader()->detachFromParent();
+
+ if (m_mouseOutTracker) {
+ m_mouseOutTracker->dwFlags = TME_CANCEL;
+ ::TrackMouseEvent(m_mouseOutTracker.get());
+ m_mouseOutTracker.set(0);
+ }
+
+ m_page->setGroupName(String());
+ setHostWindow(0);
+
+ setDownloadDelegate(0);
+ setEditingDelegate(0);
+ setFrameLoadDelegate(0);
+ setFrameLoadDelegatePrivate(0);
+ setPolicyDelegate(0);
+ setResourceLoadDelegate(0);
+ setUIDelegate(0);
+ setFormDelegate(0);
+
+ if (m_webInspector)
+ m_webInspector->webViewClosed();
+
+ delete m_page;
+ m_page = 0;
+
+ registerForIconNotification(false);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->removeObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
+
+ BSTR identifier = 0;
+ if (SUCCEEDED(m_preferences->identifier(&identifier)))
+ WebPreferences::removeReferenceForIdentifier(identifier);
+ if (identifier)
+ SysFreeString(identifier);
+
+ COMPtr<WebPreferences> preferences = m_preferences;
+ m_preferences = 0;
+ preferences->didRemoveFromWebView();
+
+ deleteBackingStore();
+}
+
+void WebView::deleteBackingStore()
+{
+ m_backingStoreBitmap.clear();
+ m_backingStoreDirtyRegion.clear();
+
+ m_backingStoreSize.cx = m_backingStoreSize.cy = 0;
+}
+
+bool WebView::ensureBackingStore()
+{
+ RECT windowRect;
+ ::GetClientRect(m_viewWindow, &windowRect);
+ LONG width = windowRect.right - windowRect.left;
+ LONG height = windowRect.bottom - windowRect.top;
+ if (width > 0 && height > 0 && (width != m_backingStoreSize.cx || height != m_backingStoreSize.cy)) {
+ deleteBackingStore();
+
+ m_backingStoreSize.cx = width;
+ m_backingStoreSize.cy = height;
+ BITMAPINFO bitmapInfo;
+ bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapInfo.bmiHeader.biWidth = width;
+ bitmapInfo.bmiHeader.biHeight = -height;
+ bitmapInfo.bmiHeader.biPlanes = 1;
+ bitmapInfo.bmiHeader.biBitCount = 32;
+ bitmapInfo.bmiHeader.biCompression = BI_RGB;
+ bitmapInfo.bmiHeader.biSizeImage = 0;
+ bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
+ bitmapInfo.bmiHeader.biClrUsed = 0;
+ bitmapInfo.bmiHeader.biClrImportant = 0;
+
+ void* pixels = NULL;
+ m_backingStoreBitmap.set(::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, NULL, 0));
+ return true;
+ }
+
+ return false;
+}
+
+void WebView::addToDirtyRegion(const IntRect& dirtyRect)
+{
+ HRGN newRegion = ::CreateRectRgn(dirtyRect.x(), dirtyRect.y(),
+ dirtyRect.right(), dirtyRect.bottom());
+ addToDirtyRegion(newRegion);
+}
+
+void WebView::addToDirtyRegion(HRGN newRegion)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+
+ if (m_backingStoreDirtyRegion) {
+ HRGN combinedRegion = ::CreateRectRgn(0,0,0,0);
+ ::CombineRgn(combinedRegion, m_backingStoreDirtyRegion.get(), newRegion, RGN_OR);
+ ::DeleteObject(newRegion);
+ m_backingStoreDirtyRegion.set(combinedRegion);
+ } else
+ m_backingStoreDirtyRegion.set(newRegion);
+}
+
+void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+
+ // If there's no backing store we don't need to update it
+ if (!m_backingStoreBitmap) {
+ if (m_uiDelegatePrivate)
+ m_uiDelegatePrivate->webViewScrolled(this);
+
+ return;
+ }
+
+ // Make a region to hold the invalidated scroll area.
+ HRGN updateRegion = ::CreateRectRgn(0, 0, 0, 0);
+
+ // Collect our device context info and select the bitmap to scroll.
+ HDC windowDC = ::GetDC(m_viewWindow);
+ HDC bitmapDC = ::CreateCompatibleDC(windowDC);
+ ::SelectObject(bitmapDC, m_backingStoreBitmap.get());
+
+ // Scroll the bitmap.
+ RECT scrollRectWin(scrollViewRect);
+ RECT clipRectWin(clipRect);
+ ::ScrollDC(bitmapDC, dx, dy, &scrollRectWin, &clipRectWin, updateRegion, 0);
+ RECT regionBox;
+ ::GetRgnBox(updateRegion, &regionBox);
+
+ // Flush.
+ GdiFlush();
+
+ // Add the dirty region to the backing store's dirty region.
+ addToDirtyRegion(updateRegion);
+
+ if (m_uiDelegatePrivate)
+ m_uiDelegatePrivate->webViewScrolled(this);
+
+ // Update the backing store.
+ updateBackingStore(frameView, bitmapDC, false);
+
+ // Clean up.
+ ::DeleteDC(bitmapDC);
+ ::ReleaseDC(m_viewWindow, windowDC);
+
+}
+
+// This emulates the Mac smarts for painting rects intelligently. This is very
+// important for us, since we double buffer based off dirty rects.
+static void getUpdateRects(HRGN region, const IntRect& dirtyRect, Vector<IntRect>& rects)
+{
+ ASSERT_ARG(region, region);
+
+ const int cRectThreshold = 10;
+ const float cWastedSpaceThreshold = 0.75f;
+
+ rects.clear();
+
+ DWORD regionDataSize = GetRegionData(region, sizeof(RGNDATA), NULL);
+ if (!regionDataSize) {
+ rects.append(dirtyRect);
+ return;
+ }
+
+ Vector<unsigned char> buffer(regionDataSize);
+ RGNDATA* regionData = reinterpret_cast<RGNDATA*>(buffer.data());
+ GetRegionData(region, regionDataSize, regionData);
+ if (regionData->rdh.nCount > cRectThreshold) {
+ rects.append(dirtyRect);
+ return;
+ }
+
+ double singlePixels = 0.0;
+ unsigned i;
+ RECT* rect;
+ for (i = 0, rect = reinterpret_cast<RECT*>(regionData->Buffer); i < regionData->rdh.nCount; i++, rect++)
+ singlePixels += (rect->right - rect->left) * (rect->bottom - rect->top);
+
+ double unionPixels = dirtyRect.width() * dirtyRect.height();
+ double wastedSpace = 1.0 - (singlePixels / unionPixels);
+ if (wastedSpace <= cWastedSpaceThreshold) {
+ rects.append(dirtyRect);
+ return;
+ }
+
+ for (i = 0, rect = reinterpret_cast<RECT*>(regionData->Buffer); i < regionData->rdh.nCount; i++, rect++)
+ rects.append(*rect);
+}
+
+void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStoreCompletelyDirty)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+
+ HDC windowDC = 0;
+ HDC bitmapDC = dc;
+ if (!dc) {
+ windowDC = ::GetDC(m_viewWindow);
+ bitmapDC = ::CreateCompatibleDC(windowDC);
+ ::SelectObject(bitmapDC, m_backingStoreBitmap.get());
+ }
+
+ if (m_backingStoreBitmap && (m_backingStoreDirtyRegion || backingStoreCompletelyDirty)) {
+ // Do a layout first so that everything we render to the backing store is always current.
+ if (Frame* coreFrame = core(m_mainFrame))
+ if (FrameView* view = coreFrame->view())
+ view->layoutIfNeededRecursive();
+
+ Vector<IntRect> paintRects;
+ if (!backingStoreCompletelyDirty) {
+ RECT regionBox;
+ ::GetRgnBox(m_backingStoreDirtyRegion.get(), &regionBox);
+ getUpdateRects(m_backingStoreDirtyRegion.get(), regionBox, paintRects);
+ } else {
+ RECT clientRect;
+ ::GetClientRect(m_viewWindow, &clientRect);
+ paintRects.append(clientRect);
+ }
+
+ for (unsigned i = 0; i < paintRects.size(); ++i)
+ paintIntoBackingStore(frameView, bitmapDC, paintRects[i]);
+
+ if (m_uiDelegatePrivate) {
+ COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, m_uiDelegatePrivate);
+ if (uiDelegatePrivate2)
+ uiDelegatePrivate2->webViewPainted(this);
+ }
+
+ m_backingStoreDirtyRegion.clear();
+ }
+
+ if (!dc) {
+ ::DeleteDC(bitmapDC);
+ ::ReleaseDC(m_viewWindow, windowDC);
+ }
+
+ GdiFlush();
+}
+
+void WebView::paint(HDC dc, LPARAM options)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+
+ Frame* coreFrame = core(m_mainFrame);
+ if (!coreFrame)
+ return;
+ FrameView* frameView = coreFrame->view();
+
+ m_paintCount++;
+
+ RECT rcPaint;
+ HDC hdc;
+ OwnPtr<HRGN> region;
+ int regionType = NULLREGION;
+ PAINTSTRUCT ps;
+ if (!dc) {
+ region.set(CreateRectRgn(0,0,0,0));
+ regionType = GetUpdateRgn(m_viewWindow, region.get(), false);
+ hdc = BeginPaint(m_viewWindow, &ps);
+ rcPaint = ps.rcPaint;
+ } else {
+ hdc = dc;
+ ::GetClientRect(m_viewWindow, &rcPaint);
+ if (options & PRF_ERASEBKGND)
+ ::FillRect(hdc, &rcPaint, (HBRUSH)GetStockObject(WHITE_BRUSH));
+ }
+
+ HDC bitmapDC = ::CreateCompatibleDC(hdc);
+ bool backingStoreCompletelyDirty = ensureBackingStore();
+ ::SelectObject(bitmapDC, m_backingStoreBitmap.get());
+
+ // Update our backing store if needed.
+ updateBackingStore(frameView, bitmapDC, backingStoreCompletelyDirty);
+
+ // Now we blit the updated backing store
+ IntRect windowDirtyRect = rcPaint;
+
+ // Apply the same heuristic for this update region too.
+ Vector<IntRect> blitRects;
+ if (region && regionType == COMPLEXREGION)
+ getUpdateRects(region.get(), windowDirtyRect, blitRects);
+ else
+ blitRects.append(windowDirtyRect);
+
+ for (unsigned i = 0; i < blitRects.size(); ++i)
+ paintIntoWindow(bitmapDC, hdc, blitRects[i]);
+
+ ::DeleteDC(bitmapDC);
+
+ // Paint the gripper.
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(uiDelegate(&ui))) {
+ COMPtr<IWebUIDelegatePrivate> uiPrivate;
+ if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) {
+ RECT r;
+ if (SUCCEEDED(uiPrivate->webViewResizerRect(this, &r))) {
+ LOCAL_GDI_COUNTER(2, __FUNCTION__" webViewDrawResizer delegate call");
+ uiPrivate->webViewDrawResizer(this, hdc, (frameView->resizerOverlapsContent() ? true : false), &r);
+ }
+ }
+ }
+
+ if (!dc)
+ EndPaint(m_viewWindow, &ps);
+
+ m_paintCount--;
+}
+
+void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const IntRect& dirtyRect)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+
+ RECT rect = dirtyRect;
+
+#if FLASH_BACKING_STORE_REDRAW
+ HDC dc = ::GetDC(m_viewWindow);
+ OwnPtr<HBRUSH> yellowBrush = CreateSolidBrush(RGB(255, 255, 0));
+ FillRect(dc, &rect, yellowBrush.get());
+ GdiFlush();
+ Sleep(50);
+ paintIntoWindow(bitmapDC, dc, dirtyRect);
+ ::ReleaseDC(m_viewWindow, dc);
+#endif
+
+ FillRect(bitmapDC, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
+ if (frameView && frameView->frame() && frameView->frame()->renderer()) {
+ GraphicsContext gc(bitmapDC);
+ gc.save();
+ gc.clip(dirtyRect);
+ frameView->paint(&gc, dirtyRect);
+ gc.restore();
+ }
+}
+
+void WebView::paintIntoWindow(HDC bitmapDC, HDC windowDC, const IntRect& dirtyRect)
+{
+ LOCAL_GDI_COUNTER(0, __FUNCTION__);
+#if FLASH_WINDOW_REDRAW
+ OwnPtr<HBRUSH> greenBrush = CreateSolidBrush(RGB(0, 255, 0));
+ RECT rect = dirtyRect;
+ FillRect(windowDC, &rect, greenBrush.get());
+ GdiFlush();
+ Sleep(50);
+#endif
+
+ // Blit the dirty rect from the backing store into the same position
+ // in the destination DC.
+ BitBlt(windowDC, dirtyRect.x(), dirtyRect.y(), dirtyRect.width(), dirtyRect.height(), bitmapDC,
+ dirtyRect.x(), dirtyRect.y(), SRCCOPY);
+}
+
+void WebView::frameRect(RECT* rect)
+{
+ ::GetWindowRect(m_viewWindow, rect);
+}
+
+void WebView::closeWindowSoon()
+{
+ m_closeWindowTimer.startOneShot(0);
+ AddRef();
+}
+
+void WebView::closeWindowTimerFired(WebCore::Timer<WebView>*)
+{
+ closeWindow();
+ Release();
+}
+
+void WebView::closeWindow()
+{
+ if (m_hasSpellCheckerDocumentTag) {
+ if (m_editingDelegate)
+ m_editingDelegate->closeSpellDocument(this);
+ m_hasSpellCheckerDocumentTag = false;
+ }
+
+ COMPtr<IWebUIDelegate> ui;
+ if (SUCCEEDED(uiDelegate(&ui)))
+ ui->webViewClose(this);
+}
+
+bool WebView::canHandleRequest(const WebCore::ResourceRequest& request)
+{
+ // On the mac there's an about url protocol implementation but CFNetwork doesn't have that.
+ if (equalIgnoringCase(String(request.url().protocol()), "about"))
+ return true;
+
+ if (CFURLProtocolCanHandleRequest(request.cfURLRequest()))
+ return true;
+
+ // FIXME: Mac WebKit calls _representationExistsForURLScheme here
+ return false;
+}
+
+Page* WebView::page()
+{
+ return m_page;
+}
+
+bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam)
+{
+ static const int contextMenuMargin = 1;
+
+ // Translate the screen coordinates into window coordinates
+ POINT coords = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ if (coords.x == -1 || coords.y == -1) {
+ FrameView* view = m_page->mainFrame()->view();
+ if (!view)
+ return false;
+
+ int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT);
+ IntPoint location;
+
+ // The context menu event was generated from the keyboard, so show the context menu by the current selection.
+ Position start = m_page->mainFrame()->selectionController()->selection().start();
+ Position end = m_page->mainFrame()->selectionController()->selection().end();
+
+ if (!start.node() || !end.node())
+ location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin);
+ else {
+ RenderObject* renderer = start.node()->renderer();
+ if (!renderer)
+ return false;
+
+ // Calculate the rect of the first line of the selection (cribbed from -[WebCoreFrameBridge firstRectForDOMRange:]).
+ int extraWidthToEndOfLine = 0;
+ IntRect startCaretRect = renderer->caretRect(start.offset(), DOWNSTREAM, &extraWidthToEndOfLine);
+ IntRect endCaretRect = renderer->caretRect(end.offset(), UPSTREAM);
+
+ IntRect firstRect;
+ if (startCaretRect.y() == endCaretRect.y())
+ firstRect = IntRect(min(startCaretRect.x(), endCaretRect.x()), startCaretRect.y(), abs(endCaretRect.x() - startCaretRect.x()), max(startCaretRect.height(), endCaretRect.height()));
+ else
+ firstRect = IntRect(startCaretRect.x(), startCaretRect.y(), startCaretRect.width() + extraWidthToEndOfLine, startCaretRect.height());
+
+ location = IntPoint(rightAligned ? firstRect.right() : firstRect.x(), firstRect.bottom());
+ }
+
+ location = view->contentsToWindow(location);
+ // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element.
+ // Ideally we'd have the position of a context menu event be separate from its target node.
+ coords = location + IntSize(0, -1);
+ } else {
+ if (!::ScreenToClient(m_viewWindow, &coords))
+ return false;
+ }
+
+ lParam = MAKELPARAM(coords.x, coords.y);
+
+ // The contextMenuController() holds onto the last context menu that was popped up on the
+ // page until a new one is created. We need to clear this menu before propagating the event
+ // through the DOM so that we can detect if we create a new menu for this event, since we
+ // won't create a new menu if the DOM swallows the event and the defaultEventHandler does
+ // not run.
+ m_page->contextMenuController()->clearContextMenu();
+
+ IntPoint documentPoint(m_page->mainFrame()->view()->windowToContents(coords));
+ HitTestResult result = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(documentPoint, false);
+ Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
+
+ targetFrame->view()->setCursor(pointerCursor());
+ PlatformMouseEvent mouseEvent(m_viewWindow, WM_RBUTTONUP, wParam, lParam);
+ bool handledEvent = targetFrame->eventHandler()->sendContextMenuEvent(mouseEvent);
+ if (!handledEvent)
+ return false;
+
+ // Show the menu
+ ContextMenu* coreMenu = m_page->contextMenuController()->contextMenu();
+ if (!coreMenu)
+ return false;
+
+ Node* node = coreMenu->hitTestResult().innerNonSharedNode();
+ if (!node)
+ return false;
+
+ Frame* frame = node->document()->frame();
+ if (!frame)
+ return false;
+
+ FrameView* view = frame->view();
+ if (!view)
+ return false;
+
+ POINT point(view->contentsToWindow(coreMenu->hitTestResult().point()));
+
+ // Translate the point to screen coordinates
+ if (!::ClientToScreen(view->containingWindow(), &point))
+ return false;
+
+ BOOL hasCustomMenus = false;
+ if (m_uiDelegate)
+ m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
+
+ if (hasCustomMenus)
+ m_uiDelegate->trackCustomPopupMenu((IWebView*)this, (OLE_HANDLE)(ULONG64)coreMenu->platformDescription(), &point);
+ else {
+ // Surprisingly, TPM_RIGHTBUTTON means that items are selectable with either the right OR left mouse button
+ UINT flags = TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_VERPOSANIMATION | TPM_HORIZONTAL
+ | TPM_LEFTALIGN | TPM_HORPOSANIMATION;
+ ::TrackPopupMenuEx(coreMenu->platformDescription(), flags, point.x, point.y, view->containingWindow(), 0);
+ }
+
+ return true;
+}
+
+bool WebView::onMeasureItem(WPARAM /*wParam*/, LPARAM lParam)
+{
+ if (!m_uiDelegate)
+ return false;
+
+ BOOL hasCustomMenus = false;
+ m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
+ if (!hasCustomMenus)
+ return false;
+
+ m_uiDelegate->measureCustomMenuItem((IWebView*)this, (void*)lParam);
+ return true;
+}
+
+bool WebView::onDrawItem(WPARAM /*wParam*/, LPARAM lParam)
+{
+ if (!m_uiDelegate)
+ return false;
+
+ BOOL hasCustomMenus = false;
+ m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
+ if (!hasCustomMenus)
+ return false;
+
+ m_uiDelegate->drawCustomMenuItem((IWebView*)this, (void*)lParam);
+ return true;
+}
+
+bool WebView::onInitMenuPopup(WPARAM wParam, LPARAM /*lParam*/)
+{
+ if (!m_uiDelegate)
+ return false;
+
+ HMENU menu = (HMENU)wParam;
+ if (!menu)
+ return false;
+
+ BOOL hasCustomMenus = false;
+ m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
+ if (!hasCustomMenus)
+ return false;
+
+ m_uiDelegate->addCustomMenuDrawingData((IWebView*)this, (OLE_HANDLE)(ULONG64)menu);
+ return true;
+}
+
+bool WebView::onUninitMenuPopup(WPARAM wParam, LPARAM /*lParam*/)
+{
+ if (!m_uiDelegate)
+ return false;
+
+ HMENU menu = (HMENU)wParam;
+ if (!menu)
+ return false;
+
+ BOOL hasCustomMenus = false;
+ m_uiDelegate->hasCustomMenuImplementation(&hasCustomMenus);
+ if (!hasCustomMenus)
+ return false;
+
+ m_uiDelegate->cleanUpCustomMenuDrawingData((IWebView*)this, (OLE_HANDLE)(ULONG64)menu);
+ return true;
+}
+
+void WebView::performContextMenuAction(WPARAM wParam, LPARAM lParam, bool byPosition)
+{
+ ContextMenu* menu = m_page->contextMenuController()->contextMenu();
+ ASSERT(menu);
+
+ ContextMenuItem* item = byPosition ? menu->itemAtIndex((unsigned)wParam, (HMENU)lParam) : menu->itemWithAction((ContextMenuAction)wParam);
+ if (!item)
+ return;
+ m_page->contextMenuController()->contextMenuItemSelected(item);
+ delete item;
+}
+
+bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static LONG globalClickCount;
+ static IntPoint globalPrevPoint;
+ static MouseButton globalPrevButton;
+ static LONG globalPrevMouseDownTime;
+
+ // Create our event.
+ // On WM_MOUSELEAVE we need to create a mouseout event, so we force the position
+ // of the event to be at (MINSHORT, MINSHORT).
+ LPARAM position = (message == WM_MOUSELEAVE) ? ((MINSHORT << 16) | MINSHORT) : lParam;
+ PlatformMouseEvent mouseEvent(m_viewWindow, message, wParam, position, m_mouseActivated);
+
+ bool insideThreshold = abs(globalPrevPoint.x() - mouseEvent.pos().x()) < ::GetSystemMetrics(SM_CXDOUBLECLK) &&
+ abs(globalPrevPoint.y() - mouseEvent.pos().y()) < ::GetSystemMetrics(SM_CYDOUBLECLK);
+ LONG messageTime = ::GetMessageTime();
+
+ bool handled = false;
+ if (message == WM_LBUTTONDOWN || message == WM_MBUTTONDOWN || message == WM_RBUTTONDOWN) {
+ // FIXME: I'm not sure if this is the "right" way to do this
+ // but without this call, we never become focused since we don't allow
+ // the default handling of mouse events.
+ SetFocus(m_viewWindow);
+
+ // Always start capturing events when the mouse goes down in our HWND.
+ ::SetCapture(m_viewWindow);
+
+ if (((messageTime - globalPrevMouseDownTime) < (LONG)::GetDoubleClickTime()) &&
+ insideThreshold &&
+ mouseEvent.button() == globalPrevButton)
+ globalClickCount++;
+ else
+ // Reset the click count.
+ globalClickCount = 1;
+ globalPrevMouseDownTime = messageTime;
+ globalPrevButton = mouseEvent.button();
+ globalPrevPoint = mouseEvent.pos();
+
+ mouseEvent.setClickCount(globalClickCount);
+ handled = m_page->mainFrame()->eventHandler()->handleMousePressEvent(mouseEvent);
+ } else if (message == WM_LBUTTONDBLCLK || message == WM_MBUTTONDBLCLK || message == WM_RBUTTONDBLCLK) {
+ globalClickCount++;
+ mouseEvent.setClickCount(globalClickCount);
+ handled = m_page->mainFrame()->eventHandler()->handleMousePressEvent(mouseEvent);
+ } else if (message == WM_LBUTTONUP || message == WM_MBUTTONUP || message == WM_RBUTTONUP) {
+ // Record the global position and the button of the up.
+ globalPrevButton = mouseEvent.button();
+ globalPrevPoint = mouseEvent.pos();
+ mouseEvent.setClickCount(globalClickCount);
+ m_page->mainFrame()->eventHandler()->handleMouseReleaseEvent(mouseEvent);
+ ::ReleaseCapture();
+ } else if (message == WM_MOUSELEAVE && m_mouseOutTracker) {
+ // Once WM_MOUSELEAVE is fired windows clears this tracker
+ // so there is no need to disable it ourselves.
+ m_mouseOutTracker.set(0);
+ m_page->mainFrame()->eventHandler()->mouseMoved(mouseEvent);
+ handled = true;
+ } else if (message == WM_MOUSEMOVE) {
+ if (!insideThreshold)
+ globalClickCount = 0;
+ mouseEvent.setClickCount(globalClickCount);
+ handled = m_page->mainFrame()->eventHandler()->mouseMoved(mouseEvent);
+ if (!m_mouseOutTracker) {
+ m_mouseOutTracker.set(new TRACKMOUSEEVENT);
+ m_mouseOutTracker->cbSize = sizeof(TRACKMOUSEEVENT);
+ m_mouseOutTracker->dwFlags = TME_LEAVE;
+ m_mouseOutTracker->hwndTrack = m_viewWindow;
+ ::TrackMouseEvent(m_mouseOutTracker.get());
+ }
+ }
+ setMouseActivated(false);
+ return handled;
+}
+
+bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isHorizontal)
+{
+ // Ctrl+Mouse wheel doesn't ever go into WebCore. It is used to
+ // zoom instead (Mac zooms the whole Desktop, but Windows browsers trigger their
+ // own local zoom modes for Ctrl+wheel).
+ if (wParam & MK_CONTROL) {
+ short delta = short(HIWORD(wParam));
+ if (delta < 0)
+ makeTextLarger(0);
+ else
+ makeTextSmaller(0);
+ return true;
+ }
+
+ PlatformWheelEvent wheelEvent(m_viewWindow, wParam, lParam, isHorizontal);
+ Frame* coreFrame = core(m_mainFrame);
+ if (!coreFrame)
+ return false;
+
+ return coreFrame->eventHandler()->handleWheelEvent(wheelEvent);
+}
+
+bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ switch (LOWORD(wParam)) {
+ case SelectAll:
+ return frame->editor()->command("SelectAll").execute();
+ case Undo:
+ return frame->editor()->command("Undo").execute();
+ case Redo:
+ return frame->editor()->command("Redo").execute();
+ }
+ return false;
+}
+
+bool WebView::keyUp(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
+{
+ PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, PlatformKeyboardEvent::KeyUp, systemKeyDown);
+
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ m_currentCharacterCode = 0;
+
+ return frame->eventHandler()->keyEvent(keyEvent);
+}
+
+static const unsigned CtrlKey = 1 << 0;
+static const unsigned AltKey = 1 << 1;
+static const unsigned ShiftKey = 1 << 2;
+
+
+struct KeyDownEntry {
+ unsigned virtualKey;
+ unsigned modifiers;
+ const char* name;
+};
+
+struct KeyPressEntry {
+ unsigned charCode;
+ unsigned modifiers;
+ const char* name;
+};
+
+static const KeyDownEntry keyDownEntries[] = {
+ { VK_LEFT, 0, "MoveLeft" },
+ { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" },
+ { VK_LEFT, CtrlKey, "MoveWordLeft" },
+ { VK_LEFT, CtrlKey | ShiftKey, "MoveWordLeftAndModifySelection" },
+ { VK_RIGHT, 0, "MoveRight" },
+ { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" },
+ { VK_RIGHT, CtrlKey, "MoveWordRight" },
+ { VK_RIGHT, CtrlKey | ShiftKey, "MoveWordRightAndModifySelection" },
+ { VK_UP, 0, "MoveUp" },
+ { VK_UP, ShiftKey, "MoveUpAndModifySelection" },
+ { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" },
+ { VK_DOWN, 0, "MoveDown" },
+ { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" },
+ { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" },
+ { VK_PRIOR, 0, "MovePageUp" },
+ { VK_NEXT, 0, "MovePageDown" },
+ { VK_HOME, 0, "MoveToBeginningOfLine" },
+ { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" },
+ { VK_HOME, CtrlKey, "MoveToBeginningOfDocument" },
+ { VK_HOME, CtrlKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" },
+
+ { VK_END, 0, "MoveToEndOfLine" },
+ { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" },
+ { VK_END, CtrlKey, "MoveToEndOfDocument" },
+ { VK_END, CtrlKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" },
+
+ { VK_BACK, 0, "DeleteBackward" },
+ { VK_BACK, ShiftKey, "DeleteBackward" },
+ { VK_DELETE, 0, "DeleteForward" },
+ { VK_BACK, CtrlKey, "DeleteWordBackward" },
+ { VK_DELETE, CtrlKey, "DeleteWordForward" },
+
+ { 'B', CtrlKey, "ToggleBold" },
+ { 'I', CtrlKey, "ToggleItalic" },
+
+ { VK_ESCAPE, 0, "Cancel" },
+ { VK_OEM_PERIOD, CtrlKey, "Cancel" },
+ { VK_TAB, 0, "InsertTab" },
+ { VK_TAB, ShiftKey, "InsertBacktab" },
+ { VK_RETURN, 0, "InsertNewline" },
+ { VK_RETURN, CtrlKey, "InsertNewline" },
+ { VK_RETURN, AltKey, "InsertNewline" },
+ { VK_RETURN, AltKey | ShiftKey, "InsertNewline" },
+
+ // It's not quite clear whether clipboard shortcuts and Undo/Redo should be handled
+ // in the application or in WebKit. We chose WebKit.
+ { 'C', CtrlKey, "Copy" },
+ { 'V', CtrlKey, "Paste" },
+ { 'X', CtrlKey, "Cut" },
+ { 'A', CtrlKey, "SelectAll" },
+ { VK_INSERT, CtrlKey, "Copy" },
+ { VK_DELETE, ShiftKey, "Cut" },
+ { VK_INSERT, ShiftKey, "Paste" },
+ { 'Z', CtrlKey, "Undo" },
+ { 'Z', CtrlKey | ShiftKey, "Redo" },
+};
+
+static const KeyPressEntry keyPressEntries[] = {
+ { '\t', 0, "InsertTab" },
+ { '\t', ShiftKey, "InsertBacktab" },
+ { '\r', 0, "InsertNewline" },
+ { '\r', CtrlKey, "InsertNewline" },
+ { '\r', AltKey, "InsertNewline" },
+ { '\r', AltKey | ShiftKey, "InsertNewline" },
+};
+
+const char* WebView::interpretKeyEvent(const KeyboardEvent* evt)
+{
+ ASSERT(evt->type() == keydownEvent || evt->type() == keypressEvent);
+
+ static HashMap<int, const char*>* keyDownCommandsMap = 0;
+ static HashMap<int, const char*>* keyPressCommandsMap = 0;
+
+ if (!keyDownCommandsMap) {
+ keyDownCommandsMap = new HashMap<int, const char*>;
+ keyPressCommandsMap = new HashMap<int, const char*>;
+
+ for (unsigned i = 0; i < _countof(keyDownEntries); i++)
+ keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);
+
+ for (unsigned i = 0; i < _countof(keyPressEntries); i++)
+ keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
+ }
+
+ unsigned modifiers = 0;
+ if (evt->shiftKey())
+ modifiers |= ShiftKey;
+ if (evt->altKey())
+ modifiers |= AltKey;
+ if (evt->ctrlKey())
+ modifiers |= CtrlKey;
+
+ if (evt->type() == keydownEvent) {
+ int mapKey = modifiers << 16 | evt->keyCode();
+ return mapKey ? keyDownCommandsMap->get(mapKey) : 0;
+ }
+
+ int mapKey = modifiers << 16 | evt->charCode();
+ return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
+}
+
+bool WebView::handleEditingKeyboardEvent(KeyboardEvent* evt)
+{
+ Node* node = evt->target()->toNode();
+ ASSERT(node);
+ Frame* frame = node->document()->frame();
+ ASSERT(frame);
+
+ const PlatformKeyboardEvent* keyEvent = evt->keyEvent();
+ if (!keyEvent || keyEvent->isSystemKey()) // do not treat this as text input if it's a system key event
+ return false;
+
+ Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+
+ if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
+ // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
+ // (e.g. Tab that inserts a Tab character, or Enter).
+ return !command.isTextInsertion() && command.execute(evt);
+ }
+
+ if (command.execute(evt))
+ return true;
+
+ // Don't insert null or control characters as they can result in unexpected behaviour
+ if (evt->charCode() < ' ')
+ return false;
+
+ return frame->editor()->insertText(evt->keyEvent()->text(), evt);
+}
+
+bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ if (virtualKeyCode == VK_CAPITAL)
+ frame->eventHandler()->capsLockStateMayHaveChanged();
+
+ PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, PlatformKeyboardEvent::RawKeyDown, systemKeyDown);
+ bool handled = frame->eventHandler()->keyEvent(keyEvent);
+
+ // These events cannot be canceled, and we have no default handling for them.
+ // FIXME: match IE list more closely, see <http://msdn2.microsoft.com/en-us/library/ms536938.aspx>.
+ if (systemKeyDown && virtualKeyCode != VK_RETURN)
+ return false;
+
+ if (handled) {
+ // FIXME: remove WM_UNICHAR, too
+ MSG msg;
+ // WM_SYSCHAR events should not be removed, because access keys are implemented in WebCore in WM_SYSCHAR handler.
+ if (!systemKeyDown)
+ ::PeekMessage(&msg, m_viewWindow, WM_CHAR, WM_CHAR, PM_REMOVE);
+ return true;
+ }
+
+ // We need to handle back/forward using either Backspace(+Shift) or Ctrl+Left/Right Arrow keys.
+ if ((virtualKeyCode == VK_BACK && keyEvent.shiftKey()) || (virtualKeyCode == VK_RIGHT && keyEvent.ctrlKey()))
+ m_page->goForward();
+ else if (virtualKeyCode == VK_BACK || (virtualKeyCode == VK_LEFT && keyEvent.ctrlKey()))
+ m_page->goBack();
+
+ // Need to scroll the page if the arrow keys, pgup/dn, or home/end are hit.
+ ScrollDirection direction;
+ ScrollGranularity granularity;
+ switch (virtualKeyCode) {
+ case VK_LEFT:
+ granularity = ScrollByLine;
+ direction = ScrollLeft;
+ break;
+ case VK_RIGHT:
+ granularity = ScrollByLine;
+ direction = ScrollRight;
+ break;
+ case VK_UP:
+ granularity = ScrollByLine;
+ direction = ScrollUp;
+ break;
+ case VK_DOWN:
+ granularity = ScrollByLine;
+ direction = ScrollDown;
+ break;
+ case VK_HOME:
+ granularity = ScrollByDocument;
+ direction = ScrollUp;
+ break;
+ case VK_END:
+ granularity = ScrollByDocument;
+ direction = ScrollDown;
+ break;
+ case VK_PRIOR:
+ granularity = ScrollByPage;
+ direction = ScrollUp;
+ break;
+ case VK_NEXT:
+ granularity = ScrollByPage;
+ direction = ScrollDown;
+ break;
+ default:
+ return false;
+ }
+
+ if (!frame->eventHandler()->scrollOverflow(direction, granularity)) {
+ handled = frame->view()->scroll(direction, granularity);
+ Frame* parent = frame->tree()->parent();
+ while(!handled && parent) {
+ handled = parent->view()->scroll(direction, granularity);
+ parent = parent->tree()->parent();
+ }
+ }
+ return handled;
+}
+
+bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ PlatformKeyboardEvent keyEvent(m_viewWindow, charCode, keyData, PlatformKeyboardEvent::Char, systemKeyDown);
+ // IE does not dispatch keypress event for WM_SYSCHAR.
+ if (systemKeyDown)
+ return frame->eventHandler()->handleAccessKey(keyEvent);
+ if (frame->eventHandler()->keyEvent(keyEvent))
+ return true;
+
+ // Need to scroll the page if space is hit.
+ if (charCode == ' ') {
+ ScrollDirection direction = keyEvent.shiftKey() ? ScrollUp : ScrollDown;
+ if (!frame->eventHandler()->scrollOverflow(direction, ScrollByPage))
+ frame->view()->scroll(direction, ScrollByPage);
+ return true;
+ }
+ return false;
+}
+
+bool WebView::inResizer(LPARAM lParam)
+{
+ if (!m_uiDelegatePrivate)
+ return false;
+
+ RECT r;
+ if (FAILED(m_uiDelegatePrivate->webViewResizerRect(this, &r)))
+ return false;
+
+ POINT pt;
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
+ return !!PtInRect(&r, pt);
+}
+
+static bool registerWebViewWindowClass()
+{
+ static bool haveRegisteredWindowClass = false;
+ if (haveRegisteredWindowClass)
+ return true;
+
+ haveRegisteredWindowClass = true;
+
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_DBLCLKS;
+ wcex.lpfnWndProc = WebViewWndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 4; // 4 bytes for the IWebView pointer
+ wcex.hInstance = gInstance;
+ wcex.hIcon = 0;
+ wcex.hCursor = ::LoadCursor(0, IDC_ARROW);
+ wcex.hbrBackground = 0;
+ wcex.lpszMenuName = 0;
+ wcex.lpszClassName = kWebViewWindowClassName;
+ wcex.hIconSm = 0;
+
+ return !!RegisterClassEx(&wcex);
+}
+
+namespace WebCore {
+ extern HCURSOR lastSetCursor;
+}
+
+static HWND findTopLevelParent(HWND window)
+{
+ if (!window)
+ return 0;
+
+ HWND current = window;
+ for (HWND parent = GetParent(current); current; current = parent, parent = GetParent(parent))
+ if (!parent || !(GetWindowLongPtr(current, GWL_STYLE) & (WS_POPUP | WS_CHILD)))
+ return current;
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = 0;
+ LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0);
+ WebView* webView = reinterpret_cast<WebView*>(longPtr);
+ WebFrame* mainFrameImpl = webView ? webView->topLevelFrame() : 0;
+ if (!mainFrameImpl || webView->isBeingDestroyed())
+ return DefWindowProc(hWnd, message, wParam, lParam);
+
+ ASSERT(webView);
+
+ // Windows Media Player has a modal message loop that will deliver messages
+ // to us at inappropriate times and we will crash if we handle them when
+ // they are delivered. We repost paint messages so that we eventually get
+ // a chance to paint once the modal loop has exited, but other messages
+ // aren't safe to repost, so we just drop them.
+ if (PluginView::isCallingPlugin()) {
+ if (message == WM_PAINT)
+ PostMessage(hWnd, message, wParam, lParam);
+ return 0;
+ }
+
+ bool handled = true;
+
+ switch (message) {
+ case WM_PAINT: {
+ webView->paint(0, 0);
+ break;
+ }
+ case WM_PRINTCLIENT:
+ webView->paint((HDC)wParam, lParam);
+ break;
+ case WM_DESTROY:
+ webView->close();
+ webView->setIsBeingDestroyed();
+ webView->revokeDragDrop();
+ break;
+ case WM_MOUSEMOVE:
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_MBUTTONDBLCLK:
+ case WM_RBUTTONDBLCLK:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MOUSELEAVE:
+ if (Frame* coreFrame = core(mainFrameImpl))
+ if (coreFrame->view()->didFirstLayout())
+ handled = webView->handleMouseEvent(message, wParam, lParam);
+ break;
+ case WM_MOUSEWHEEL:
+ case WM_VISTA_MOUSEHWHEEL:
+ if (Frame* coreFrame = core(mainFrameImpl))
+ if (coreFrame->view()->didFirstLayout())
+ handled = webView->mouseWheel(wParam, lParam, (wParam & MK_SHIFT) || message == WM_VISTA_MOUSEHWHEEL);
+ break;
+ case WM_SYSKEYDOWN:
+ handled = webView->keyDown(wParam, lParam, true);
+ break;
+ case WM_KEYDOWN:
+ handled = webView->keyDown(wParam, lParam);
+ break;
+ case WM_SYSKEYUP:
+ handled = webView->keyUp(wParam, lParam, true);
+ break;
+ case WM_KEYUP:
+ handled = webView->keyUp(wParam, lParam);
+ break;
+ case WM_SYSCHAR:
+ handled = webView->keyPress(wParam, lParam, true);
+ break;
+ case WM_CHAR:
+ handled = webView->keyPress(wParam, lParam);
+ break;
+ // FIXME: We need to check WM_UNICHAR to support supplementary characters (that don't fit in 16 bits).
+ case WM_SIZE:
+ if (webView->isBeingDestroyed())
+ // If someone has sent us this message while we're being destroyed, we should bail out so we don't crash.
+ break;
+
+ if (lParam != 0) {
+ webView->deleteBackingStore();
+ if (Frame* coreFrame = core(mainFrameImpl))
+ coreFrame->view()->resize(LOWORD(lParam), HIWORD(lParam));
+ }
+ break;
+ case WM_SHOWWINDOW:
+ lResult = DefWindowProc(hWnd, message, wParam, lParam);
+ if (wParam == 0)
+ // The window is being hidden (e.g., because we switched tabs.
+ // Null out our backing store.
+ webView->deleteBackingStore();
+ break;
+ case WM_SETFOCUS: {
+ COMPtr<IWebUIDelegate> uiDelegate;
+ COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
+ SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
+ uiDelegatePrivate->webViewReceivedFocus(webView);
+
+ FocusController* focusController = webView->page()->focusController();
+ if (Frame* frame = focusController->focusedFrame()) {
+ // Send focus events unless the previously focused window is a
+ // child of ours (for example a plugin).
+ if (!IsChild(hWnd, reinterpret_cast<HWND>(wParam)))
+ frame->selectionController()->setFocused(true);
+ } else
+ focusController->setFocusedFrame(webView->page()->mainFrame());
+ break;
+ }
+ case WM_KILLFOCUS: {
+ COMPtr<IWebUIDelegate> uiDelegate;
+ COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
+ HWND newFocusWnd = reinterpret_cast<HWND>(wParam);
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
+ SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
+ uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd);
+
+ FocusController* focusController = webView->page()->focusController();
+ Frame* frame = focusController->focusedOrMainFrame();
+ webView->resetIME(frame);
+ // Send blur events unless we're losing focus to a child of ours.
+ if (!IsChild(hWnd, newFocusWnd))
+ frame->selectionController()->setFocused(false);
+ break;
+ }
+ case WM_WINDOWPOSCHANGED:
+ if (reinterpret_cast<WINDOWPOS*>(lParam)->flags & SWP_SHOWWINDOW)
+ webView->updateActiveStateSoon();
+ handled = false;
+ break;
+ case WM_CUT:
+ webView->cut(0);
+ break;
+ case WM_COPY:
+ webView->copy(0);
+ break;
+ case WM_PASTE:
+ webView->paste(0);
+ break;
+ case WM_CLEAR:
+ webView->delete_(0);
+ break;
+ case WM_COMMAND:
+ if (HIWORD(wParam))
+ handled = webView->execCommand(wParam, lParam);
+ else // If the high word of wParam is 0, the message is from a menu
+ webView->performContextMenuAction(wParam, lParam, false);
+ break;
+ case WM_MENUCOMMAND:
+ webView->performContextMenuAction(wParam, lParam, true);
+ break;
+ case WM_CONTEXTMENU:
+ handled = webView->handleContextMenuEvent(wParam, lParam);
+ break;
+ case WM_INITMENUPOPUP:
+ handled = webView->onInitMenuPopup(wParam, lParam);
+ break;
+ case WM_MEASUREITEM:
+ handled = webView->onMeasureItem(wParam, lParam);
+ break;
+ case WM_DRAWITEM:
+ handled = webView->onDrawItem(wParam, lParam);
+ break;
+ case WM_UNINITMENUPOPUP:
+ handled = webView->onUninitMenuPopup(wParam, lParam);
+ break;
+ case WM_XP_THEMECHANGED:
+ if (Frame* coreFrame = core(mainFrameImpl)) {
+ webView->deleteBackingStore();
+ coreFrame->view()->themeChanged();
+ }
+ break;
+ case WM_MOUSEACTIVATE:
+ webView->setMouseActivated(true);
+ break;
+ case WM_GETDLGCODE: {
+ COMPtr<IWebUIDelegate> uiDelegate;
+ COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
+ LONG_PTR dlgCode = 0;
+ UINT keyCode = 0;
+ if (lParam) {
+ LPMSG lpMsg = (LPMSG)lParam;
+ if (lpMsg->message == WM_KEYDOWN)
+ keyCode = (UINT) lpMsg->wParam;
+ }
+ if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
+ SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate &&
+ SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode)))
+ return dlgCode;
+ handled = false;
+ break;
+ }
+
+ case WM_IME_STARTCOMPOSITION:
+ handled = webView->onIMEStartComposition();
+ break;
+ case WM_IME_REQUEST:
+ webView->onIMERequest(wParam, lParam, &lResult);
+ break;
+ case WM_IME_COMPOSITION:
+ handled = webView->onIMEComposition(lParam);
+ break;
+ case WM_IME_ENDCOMPOSITION:
+ handled = webView->onIMEEndComposition();
+ break;
+ case WM_IME_CHAR:
+ handled = webView->onIMEChar(wParam, lParam);
+ break;
+ case WM_IME_NOTIFY:
+ handled = webView->onIMENotify(wParam, lParam, &lResult);
+ break;
+ case WM_IME_SELECT:
+ handled = webView->onIMESelect(wParam, lParam);
+ break;
+ case WM_IME_SETCONTEXT:
+ handled = webView->onIMESetContext(wParam, lParam);
+ break;
+ case WM_TIMER:
+ switch (wParam) {
+ case UpdateActiveStateTimer:
+ KillTimer(hWnd, UpdateActiveStateTimer);
+ webView->updateActiveState();
+ break;
+ }
+ break;
+ case WM_SETCURSOR:
+ if (lastSetCursor) {
+ SetCursor(lastSetCursor);
+ break;
+ }
+ __fallthrough;
+ default:
+ handled = false;
+ break;
+ }
+
+ if (!handled)
+ lResult = DefWindowProc(hWnd, message, wParam, lParam);
+
+ // Let the client know whether we consider this message handled.
+ return (message == WM_KEYDOWN || message == WM_SYSKEYDOWN || message == WM_KEYUP || message == WM_SYSKEYUP) ? !handled : lResult;
+}
+
+bool WebView::developerExtrasEnabled() const
+{
+ if (m_preferences->developerExtrasDisabledByOverride())
+ return false;
+
+#ifdef NDEBUG
+ BOOL enabled;
+ return SUCCEEDED(m_preferences->developerExtrasEnabled(&enabled)) && enabled;
+#else
+ return true;
+#endif
+}
+
+static String osVersion()
+{
+ String osVersion;
+ OSVERSIONINFO versionInfo = {0};
+ versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
+ GetVersionEx(&versionInfo);
+
+ if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
+ if (versionInfo.dwMajorVersion == 4) {
+ if (versionInfo.dwMinorVersion == 0)
+ osVersion = "Windows 95";
+ else if (versionInfo.dwMinorVersion == 10)
+ osVersion = "Windows 98";
+ else if (versionInfo.dwMinorVersion == 90)
+ osVersion = "Windows 98; Win 9x 4.90";
+ }
+ } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ osVersion = String::format("Windows NT %d.%d", versionInfo.dwMajorVersion, versionInfo.dwMinorVersion);
+
+ if (!osVersion.length())
+ osVersion = String::format("Windows %d.%d", versionInfo.dwMajorVersion, versionInfo.dwMinorVersion);
+
+ return osVersion;
+}
+
+static String webKitVersion()
+{
+ String versionStr = "420+";
+ void* data = 0;
+
+ struct LANGANDCODEPAGE {
+ WORD wLanguage;
+ WORD wCodePage;
+ } *lpTranslate;
+
+ TCHAR path[MAX_PATH];
+ GetModuleFileName(gInstance, path, ARRAYSIZE(path));
+ DWORD handle;
+ DWORD versionSize = GetFileVersionInfoSize(path, &handle);
+ if (!versionSize)
+ goto exit;
+ data = malloc(versionSize);
+ if (!data)
+ goto exit;
+ if (!GetFileVersionInfo(path, 0, versionSize, data))
+ goto exit;
+ UINT cbTranslate;
+ if (!VerQueryValue(data, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate))
+ goto exit;
+ TCHAR key[256];
+ _stprintf_s(key, ARRAYSIZE(key), TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), lpTranslate[0].wLanguage, lpTranslate[0].wCodePage);
+ LPCTSTR productVersion;
+ UINT productVersionLength;
+ if (!VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&productVersion, &productVersionLength))
+ goto exit;
+ versionStr = String(productVersion, productVersionLength);
+
+exit:
+ if (data)
+ free(data);
+ return versionStr;
+}
+
+const String& WebView::userAgentForKURL(const KURL&)
+{
+ if (m_userAgentOverridden)
+ return m_userAgentCustom;
+
+ if (!m_userAgentStandard.length())
+ m_userAgentStandard = String::format("Mozilla/5.0 (Windows; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko)%s%s", osVersion().latin1().data(), defaultLanguage().latin1().data(), webKitVersion().latin1().data(), (m_applicationName.length() ? " " : ""), m_applicationName.latin1().data());
+ return m_userAgentStandard;
+}
+
+// IUnknown -------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualGUID(riid, CLSID_WebView))
+ *ppvObject = this;
+ else if (IsEqualGUID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebView*>(this);
+ else if (IsEqualGUID(riid, IID_IWebView))
+ *ppvObject = static_cast<IWebView*>(this);
+ else if (IsEqualGUID(riid, IID_IWebViewPrivate))
+ *ppvObject = static_cast<IWebViewPrivate*>(this);
+ else if (IsEqualGUID(riid, IID_IWebIBActions))
+ *ppvObject = static_cast<IWebIBActions*>(this);
+ else if (IsEqualGUID(riid, IID_IWebViewCSS))
+ *ppvObject = static_cast<IWebViewCSS*>(this);
+ else if (IsEqualGUID(riid, IID_IWebViewEditing))
+ *ppvObject = static_cast<IWebViewEditing*>(this);
+ else if (IsEqualGUID(riid, IID_IWebViewUndoableEditing))
+ *ppvObject = static_cast<IWebViewUndoableEditing*>(this);
+ else if (IsEqualGUID(riid, IID_IWebViewEditingActions))
+ *ppvObject = static_cast<IWebViewEditingActions*>(this);
+ else if (IsEqualGUID(riid, IID_IWebNotificationObserver))
+ *ppvObject = static_cast<IWebNotificationObserver*>(this);
+ else if (IsEqualGUID(riid, IID_IDropTarget))
+ *ppvObject = static_cast<IDropTarget*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebView::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebView::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete(this);
+
+ return newRef;
+}
+
+// IWebView --------------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::canShowMIMEType(
+ /* [in] */ BSTR mimeType,
+ /* [retval][out] */ BOOL* canShow)
+{
+ String mimeTypeStr(mimeType, SysStringLen(mimeType));
+
+ if (!canShow)
+ return E_POINTER;
+
+ *canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr) ||
+ MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr) ||
+ PluginInfoStore::supportsMIMEType(mimeTypeStr);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canShowMIMETypeAsHTML(
+ /* [in] */ BSTR /*mimeType*/,
+ /* [retval][out] */ BOOL* canShow)
+{
+ // FIXME
+ *canShow = TRUE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::MIMETypesShownAsHTML(
+ /* [retval][out] */ IEnumVARIANT** /*enumVariant*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setMIMETypesShownAsHTML(
+ /* [size_is][in] */ BSTR* /*mimeTypes*/,
+ /* [in] */ int /*cMimeTypes*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::URLFromPasteboard(
+ /* [in] */ IDataObject* /*pasteboard*/,
+ /* [retval][out] */ BSTR* /*url*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::URLTitleFromPasteboard(
+ /* [in] */ IDataObject* /*pasteboard*/,
+ /* [retval][out] */ BSTR* /*urlTitle*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
+ /* [in] */ RECT frame,
+ /* [in] */ BSTR frameName,
+ /* [in] */ BSTR groupName)
+{
+ HRESULT hr = S_OK;
+
+ if (m_viewWindow)
+ return E_FAIL;
+
+ registerWebViewWindowClass();
+
+ if (!::IsWindow(m_hostWindow)) {
+ ASSERT_NOT_REACHED();
+ return E_FAIL;
+ }
+
+ m_viewWindow = CreateWindowEx(0, kWebViewWindowClassName, 0, WS_CHILD | WS_CLIPCHILDREN,
+ frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top, m_hostWindow, 0, gInstance, 0);
+ ASSERT(::IsWindow(m_viewWindow));
+
+ hr = registerDragDrop();
+ if (FAILED(hr))
+ return hr;
+
+ WebPreferences* sharedPreferences = WebPreferences::sharedStandardPreferences();
+ sharedPreferences->willAddToWebView();
+ m_preferences = sharedPreferences;
+
+ m_groupName = String(groupName, SysStringLen(groupName));
+
+ WebKitSetWebDatabasesPathIfNecessary();
+
+ m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this));
+
+ if (m_uiDelegate) {
+ COMPtr<IWebUIDelegate2> uiDelegate2;
+ if (SUCCEEDED(m_uiDelegate->QueryInterface(IID_IWebUIDelegate2, (void**)&uiDelegate2))) {
+ BSTR path;
+ if (SUCCEEDED(uiDelegate2->ftpDirectoryTemplatePath(this, &path))) {
+ m_page->settings()->setFTPDirectoryTemplatePath(String(path, SysStringLen(path)));
+ SysFreeString(path);
+ }
+ }
+ }
+
+ WebFrame* webFrame = WebFrame::createInstance();
+ webFrame->initWithWebFrameView(0 /*FIXME*/, this, m_page, 0);
+ m_mainFrame = webFrame;
+ webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
+
+ m_page->mainFrame()->tree()->setName(String(frameName, SysStringLen(frameName)));
+ m_page->mainFrame()->init();
+ m_page->setGroupName(m_groupName);
+
+ addToAllWebViewsSet();
+
+ #pragma warning(suppress: 4244)
+ SetWindowLongPtr(m_viewWindow, 0, (LONG_PTR)this);
+ ShowWindow(m_viewWindow, SW_SHOW);
+
+ initializeToolTipWindow();
+ windowAncestryDidChange();
+
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->addObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
+ m_preferences->postPreferencesChangesNotification();
+
+ setSmartInsertDeleteEnabled(TRUE);
+ return hr;
+}
+
+static bool initCommonControls()
+{
+ static bool haveInitialized = false;
+ if (haveInitialized)
+ return true;
+
+ INITCOMMONCONTROLSEX init;
+ init.dwSize = sizeof(init);
+ init.dwICC = ICC_TREEVIEW_CLASSES;
+ haveInitialized = !!::InitCommonControlsEx(&init);
+ return haveInitialized;
+}
+
+void WebView::initializeToolTipWindow()
+{
+ if (!initCommonControls())
+ return;
+
+ m_toolTipHwnd = CreateWindowEx(0, TOOLTIPS_CLASS, 0, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ m_viewWindow, 0, 0, 0);
+ if (!m_toolTipHwnd)
+ return;
+
+ TOOLINFO info = {0};
+ info.cbSize = sizeof(info);
+ info.uFlags = TTF_IDISHWND | TTF_SUBCLASS ;
+ info.uId = reinterpret_cast<UINT_PTR>(m_viewWindow);
+
+ ::SendMessage(m_toolTipHwnd, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&info));
+ ::SendMessage(m_toolTipHwnd, TTM_SETMAXTIPWIDTH, 0, maxToolTipWidth);
+
+ ::SetWindowPos(m_toolTipHwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+}
+
+void WebView::setToolTip(const String& toolTip)
+{
+ if (!m_toolTipHwnd)
+ return;
+
+ if (toolTip == m_toolTip)
+ return;
+
+ m_toolTip = toolTip;
+
+ if (!m_toolTip.isEmpty()) {
+ TOOLINFO info = {0};
+ info.cbSize = sizeof(info);
+ info.uFlags = TTF_IDISHWND;
+ info.uId = reinterpret_cast<UINT_PTR>(m_viewWindow);
+ info.lpszText = const_cast<UChar*>(m_toolTip.charactersWithNullTermination());
+ ::SendMessage(m_toolTipHwnd, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info));
+ }
+
+ ::SendMessage(m_toolTipHwnd, TTM_ACTIVATE, !m_toolTip.isEmpty(), 0);
+}
+
+HRESULT WebView::notifyDidAddIcon(IWebNotification* notification)
+{
+ COMPtr<IPropertyBag> propertyBag;
+ HRESULT hr = notification->userInfo(&propertyBag);
+ if (FAILED(hr))
+ return hr;
+ if (!propertyBag)
+ return E_FAIL;
+
+ COMPtr<CFDictionaryPropertyBag> dictionaryPropertyBag;
+ hr = propertyBag->QueryInterface(&dictionaryPropertyBag);
+ if (FAILED(hr))
+ return hr;
+
+ CFDictionaryRef dictionary = dictionaryPropertyBag->dictionary();
+ if (!dictionary)
+ return E_FAIL;
+
+ CFTypeRef value = CFDictionaryGetValue(dictionary, WebIconDatabase::iconDatabaseNotificationUserInfoURLKey());
+ if (!value)
+ return E_FAIL;
+ if (CFGetTypeID(value) != CFStringGetTypeID())
+ return E_FAIL;
+
+ String mainFrameURL;
+ if (m_mainFrame)
+ mainFrameURL = m_mainFrame->url().string();
+
+ if (!mainFrameURL.isEmpty() && mainFrameURL == String((CFStringRef)value))
+ dispatchDidReceiveIconFromWebFrame(m_mainFrame);
+
+ return hr;
+}
+
+void WebView::registerForIconNotification(bool listen)
+{
+ IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
+ if (listen)
+ nc->addObserver(this, WebIconDatabase::iconDatabaseDidAddIconNotification(), 0);
+ else
+ nc->removeObserver(this, WebIconDatabase::iconDatabaseDidAddIconNotification(), 0);
+}
+
+void WebView::dispatchDidReceiveIconFromWebFrame(WebFrame* frame)
+{
+ registerForIconNotification(false);
+
+ if (m_frameLoadDelegate)
+ // FIXME: <rdar://problem/5491010> - Pass in the right HBITMAP.
+ m_frameLoadDelegate->didReceiveIcon(this, 0, frame);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setUIDelegate(
+ /* [in] */ IWebUIDelegate* d)
+{
+ m_uiDelegate = d;
+
+ if (m_uiDelegatePrivate)
+ m_uiDelegatePrivate = 0;
+
+ if (d) {
+ if (FAILED(d->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&m_uiDelegatePrivate)))
+ m_uiDelegatePrivate = 0;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::uiDelegate(
+ /* [out][retval] */ IWebUIDelegate** d)
+{
+ if (!m_uiDelegate)
+ return E_FAIL;
+
+ return m_uiDelegate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setResourceLoadDelegate(
+ /* [in] */ IWebResourceLoadDelegate* d)
+{
+ m_resourceLoadDelegate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::resourceLoadDelegate(
+ /* [out][retval] */ IWebResourceLoadDelegate** d)
+{
+ if (!m_resourceLoadDelegate)
+ return E_FAIL;
+
+ return m_resourceLoadDelegate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setDownloadDelegate(
+ /* [in] */ IWebDownloadDelegate* d)
+{
+ m_downloadDelegate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::downloadDelegate(
+ /* [out][retval] */ IWebDownloadDelegate** d)
+{
+ if (!m_downloadDelegate)
+ return E_FAIL;
+
+ return m_downloadDelegate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setFrameLoadDelegate(
+ /* [in] */ IWebFrameLoadDelegate* d)
+{
+ m_frameLoadDelegate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::frameLoadDelegate(
+ /* [out][retval] */ IWebFrameLoadDelegate** d)
+{
+ if (!m_frameLoadDelegate)
+ return E_FAIL;
+
+ return m_frameLoadDelegate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setPolicyDelegate(
+ /* [in] */ IWebPolicyDelegate* d)
+{
+ m_policyDelegate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::policyDelegate(
+ /* [out][retval] */ IWebPolicyDelegate** d)
+{
+ if (!m_policyDelegate)
+ return E_FAIL;
+ return m_policyDelegate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mainFrame(
+ /* [out][retval] */ IWebFrame** frame)
+{
+ if (!frame) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *frame = m_mainFrame;
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ m_mainFrame->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::focusedFrame(
+ /* [out][retval] */ IWebFrame** frame)
+{
+ if (!frame) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *frame = 0;
+ Frame* f = m_page->focusController()->focusedFrame();
+ if (!f)
+ return E_FAIL;
+
+ WebFrame* webFrame = kit(f);
+ if (!webFrame)
+ return E_FAIL;
+
+ return webFrame->QueryInterface(IID_IWebFrame, (void**) frame);
+}
+HRESULT STDMETHODCALLTYPE WebView::backForwardList(
+ /* [out][retval] */ IWebBackForwardList** list)
+{
+ if (!m_useBackForwardList)
+ return E_FAIL;
+
+ *list = WebBackForwardList::createInstance(m_page->backForwardList());
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setMaintainsBackForwardList(
+ /* [in] */ BOOL flag)
+{
+ m_useBackForwardList = !!flag;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::goBack(
+ /* [retval][out] */ BOOL* succeeded)
+{
+ *succeeded = m_page->goBack();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::goForward(
+ /* [retval][out] */ BOOL* succeeded)
+{
+ *succeeded = m_page->goForward();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::goToBackForwardItem(
+ /* [in] */ IWebHistoryItem* item,
+ /* [retval][out] */ BOOL* succeeded)
+{
+ *succeeded = FALSE;
+
+ COMPtr<WebHistoryItem> webHistoryItem;
+ HRESULT hr = item->QueryInterface(&webHistoryItem);
+ if (FAILED(hr))
+ return hr;
+
+ m_page->goToItem(webHistoryItem->historyItem(), FrameLoadTypeIndexedBackForward);
+ *succeeded = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setTextSizeMultiplier(
+ /* [in] */ float multiplier)
+{
+ if (m_textSizeMultiplier != multiplier)
+ m_textSizeMultiplier = multiplier;
+
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ m_mainFrame->setTextSizeMultiplier(multiplier);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::textSizeMultiplier(
+ /* [retval][out] */ float* multiplier)
+{
+ *multiplier = m_textSizeMultiplier;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setApplicationNameForUserAgent(
+ /* [in] */ BSTR applicationName)
+{
+ m_applicationName = String(applicationName, SysStringLen(applicationName));
+ m_userAgentStandard = String();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::applicationNameForUserAgent(
+ /* [retval][out] */ BSTR* applicationName)
+{
+ *applicationName = SysAllocStringLen(m_applicationName.characters(), m_applicationName.length());
+ if (!*applicationName && m_applicationName.length())
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setCustomUserAgent(
+ /* [in] */ BSTR userAgentString)
+{
+ m_userAgentOverridden = userAgentString;
+ m_userAgentCustom = String(userAgentString, SysStringLen(userAgentString));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::customUserAgent(
+ /* [retval][out] */ BSTR* userAgentString)
+{
+ *userAgentString = 0;
+ if (!m_userAgentOverridden)
+ return S_OK;
+ *userAgentString = SysAllocStringLen(m_userAgentCustom.characters(), m_userAgentCustom.length());
+ if (!*userAgentString && m_userAgentCustom.length())
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::userAgentForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ BSTR* userAgent)
+{
+ String urlStr(url, SysStringLen(url));
+ String userAgentString = this->userAgentForKURL(KURL(urlStr));
+ *userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length());
+ if (!*userAgent && userAgentString.length())
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::supportsTextEncoding(
+ /* [retval][out] */ BOOL* supports)
+{
+ *supports = TRUE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setCustomTextEncodingName(
+ /* [in] */ BSTR encodingName)
+{
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ HRESULT hr;
+ BSTR oldEncoding;
+ hr = customTextEncodingName(&oldEncoding);
+ if (FAILED(hr))
+ return hr;
+
+ if (oldEncoding != encodingName && (!oldEncoding || !encodingName || _tcscmp(oldEncoding, encodingName))) {
+ if (Frame* coreFrame = core(m_mainFrame))
+ coreFrame->loader()->reloadAllowingStaleData(String(encodingName, SysStringLen(encodingName)));
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::customTextEncodingName(
+ /* [retval][out] */ BSTR* encodingName)
+{
+ HRESULT hr = S_OK;
+ COMPtr<IWebDataSource> dataSource;
+ COMPtr<WebDataSource> dataSourceImpl;
+ *encodingName = 0;
+
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ if (FAILED(m_mainFrame->provisionalDataSource(&dataSource)) || !dataSource) {
+ hr = m_mainFrame->dataSource(&dataSource);
+ if (FAILED(hr) || !dataSource)
+ return hr;
+ }
+
+ hr = dataSource->QueryInterface(IID_WebDataSource, (void**)&dataSourceImpl);
+ if (FAILED(hr))
+ return hr;
+
+ BString str = dataSourceImpl->documentLoader()->overrideEncoding();
+ if (FAILED(hr))
+ return hr;
+
+ if (!*encodingName)
+ *encodingName = SysAllocStringLen(m_overrideEncoding.characters(), m_overrideEncoding.length());
+
+ if (!*encodingName && m_overrideEncoding.length())
+ return E_OUTOFMEMORY;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setMediaStyle(
+ /* [in] */ BSTR /*media*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mediaStyle(
+ /* [retval][out] */ BSTR* /*media*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::stringByEvaluatingJavaScriptFromString(
+ /* [in] */ BSTR script, // assumes input does not have "JavaScript" at the begining.
+ /* [retval][out] */ BSTR* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = 0;
+
+ Frame* coreFrame = core(m_mainFrame);
+ if (!coreFrame)
+ return E_FAIL;
+
+ KJS::JSValue* scriptExecutionResult = coreFrame->loader()->executeScript(WebCore::String(script), true);
+ if(!scriptExecutionResult)
+ return E_FAIL;
+ else if (scriptExecutionResult->isString()) {
+ JSLock lock;
+ *result = BString(String(scriptExecutionResult->getString()));
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::windowScriptObject(
+ /* [retval][out] */ IWebScriptObject** /*webScriptObject*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setPreferences(
+ /* [in] */ IWebPreferences* prefs)
+{
+ if (!prefs)
+ prefs = WebPreferences::sharedStandardPreferences();
+
+ if (m_preferences == prefs)
+ return S_OK;
+
+ COMPtr<WebPreferences> webPrefs(Query, prefs);
+ if (!webPrefs)
+ return E_NOINTERFACE;
+ webPrefs->willAddToWebView();
+
+ COMPtr<WebPreferences> oldPrefs = m_preferences;
+
+ IWebNotificationCenter* nc = WebNotificationCenter::defaultCenterInternal();
+ nc->removeObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
+
+ BSTR identifierBSTR = 0;
+ HRESULT hr = oldPrefs->identifier(&identifierBSTR);
+ oldPrefs->didRemoveFromWebView();
+ oldPrefs = 0; // Make sure we release the reference, since WebPreferences::removeReferenceForIdentifier will check for last reference to WebPreferences
+ if (SUCCEEDED(hr)) {
+ BString identifier;
+ identifier.adoptBSTR(identifierBSTR);
+ WebPreferences::removeReferenceForIdentifier(identifier);
+ }
+
+ m_preferences = webPrefs;
+
+ nc->addObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
+
+ m_preferences->postPreferencesChangesNotification();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::preferences(
+ /* [retval][out] */ IWebPreferences** prefs)
+{
+ if (!prefs)
+ return E_POINTER;
+ *prefs = m_preferences.get();
+ if (m_preferences)
+ m_preferences->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setPreferencesIdentifier(
+ /* [in] */ BSTR /*anIdentifier*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::preferencesIdentifier(
+ /* [retval][out] */ BSTR* /*anIdentifier*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+void WebView::windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM)
+{
+ switch (message) {
+ case WM_NCACTIVATE:
+ updateActiveStateSoon();
+ break;
+ }
+}
+
+void WebView::updateActiveStateSoon() const
+{
+ SetTimer(m_viewWindow, UpdateActiveStateTimer, 0, 0);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setHostWindow(
+ /* [in] */ OLE_HANDLE oleWindow)
+{
+ HWND window = (HWND)(ULONG64)oleWindow;
+ if (m_viewWindow && window)
+ SetParent(m_viewWindow, window);
+
+ m_hostWindow = window;
+
+ if (m_viewWindow)
+ windowAncestryDidChange();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::hostWindow(
+ /* [retval][out] */ OLE_HANDLE* window)
+{
+ *window = (OLE_HANDLE)(ULONG64)m_hostWindow;
+ return S_OK;
+}
+
+
+static Frame *incrementFrame(Frame *curr, bool forward, bool wrapFlag)
+{
+ return forward
+ ? curr->tree()->traverseNextWithWrap(wrapFlag)
+ : curr->tree()->traversePreviousWithWrap(wrapFlag);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::searchFor(
+ /* [in] */ BSTR str,
+ /* [in] */ BOOL forward,
+ /* [in] */ BOOL caseFlag,
+ /* [in] */ BOOL wrapFlag,
+ /* [retval][out] */ BOOL* found)
+{
+ if (!found)
+ return E_INVALIDARG;
+
+ if (!m_page || !m_page->mainFrame())
+ return E_UNEXPECTED;
+
+ if (!str || !SysStringLen(str))
+ return E_INVALIDARG;
+
+ String search(str, SysStringLen(str));
+
+
+ WebCore::Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ WebCore::Frame* startFrame = frame;
+ do {
+ *found = frame->findString(search, !!forward, !!caseFlag, false, true);
+ if (*found) {
+ if (frame != startFrame)
+ startFrame->selectionController()->clear();
+ m_page->focusController()->setFocusedFrame(frame);
+ return S_OK;
+ }
+ frame = incrementFrame(frame, !!forward, !!wrapFlag);
+ } while (frame && frame != startFrame);
+
+ // Search contents of startFrame, on the other side of the selection that we did earlier.
+ // We cheat a bit and just research with wrap on
+ if (wrapFlag && !startFrame->selectionController()->isNone()) {
+ *found = startFrame->findString(search, !!forward, !!caseFlag, true, true);
+ m_page->focusController()->setFocusedFrame(frame);
+ }
+
+ return S_OK;
+}
+
+void WebView::updateActiveState()
+{
+ HWND activeWindow = GetActiveWindow();
+ m_page->focusController()->setActive(activeWindow && m_topLevelParent == findTopLevelParent(activeWindow));
+}
+
+HRESULT STDMETHODCALLTYPE WebView::updateFocusedAndActiveState()
+{
+ updateActiveState();
+
+ bool active = m_page->focusController()->isActive();
+ Frame* mainFrame = m_page->mainFrame();
+ Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
+ mainFrame->selectionController()->setFocused(active && mainFrame == focusedFrame);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR bName, BSTR bValue)
+{
+ String name(bName, SysStringLen(bName));
+ String value(bValue, SysStringLen(bValue));
+
+ m_page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::markAllMatchesForText(
+ BSTR str, BOOL caseSensitive, BOOL highlight, UINT limit, UINT* matches)
+{
+ if (!matches)
+ return E_INVALIDARG;
+
+ if (!m_page || !m_page->mainFrame())
+ return E_UNEXPECTED;
+
+ if (!str || !SysStringLen(str))
+ return E_INVALIDARG;
+
+ String search(str, SysStringLen(str));
+ *matches = 0;
+
+ WebCore::Frame* frame = m_page->mainFrame();
+ do {
+ frame->setMarkedTextMatchesAreHighlighted(!!highlight);
+ *matches += frame->markAllMatchesForText(search, !!caseSensitive, (limit == 0)? 0 : (limit - *matches));
+ frame = incrementFrame(frame, true, false);
+ } while (frame);
+
+ return S_OK;
+
+}
+
+HRESULT STDMETHODCALLTYPE WebView::unmarkAllTextMatches()
+{
+ if (!m_page || !m_page->mainFrame())
+ return E_UNEXPECTED;
+
+ WebCore::Frame* frame = m_page->mainFrame();
+ do {
+ if (Document* document = frame->document())
+ document->removeMarkers(DocumentMarker::TextMatch);
+ frame = incrementFrame(frame, true, false);
+ } while (frame);
+
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::rectsForTextMatches(
+ IEnumTextMatches** pmatches)
+{
+ Vector<IntRect> allRects;
+ WebCore::Frame* frame = m_page->mainFrame();
+ do {
+ if (Document* document = frame->document()) {
+ IntRect visibleRect = enclosingIntRect(frame->view()->visibleContentRect());
+ Vector<IntRect> frameRects = document->renderedRectsForMarkers(DocumentMarker::TextMatch);
+ IntPoint frameOffset(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height());
+ frameOffset = frame->view()->convertToContainingWindow(frameOffset);
+
+ Vector<IntRect>::iterator end = frameRects.end();
+ for (Vector<IntRect>::iterator it = frameRects.begin(); it < end; it++) {
+ it->intersect(visibleRect);
+ it->move(frameOffset.x(), frameOffset.y());
+ allRects.append(*it);
+ }
+ }
+ frame = incrementFrame(frame, true, false);
+ } while (frame);
+
+ return createMatchEnumerator(&allRects, pmatches);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::generateSelectionImage(BOOL forceWhiteText, OLE_HANDLE* hBitmap)
+{
+ *hBitmap = 0;
+
+ WebCore::Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ HBITMAP bitmap = imageFromSelection(frame, forceWhiteText ? TRUE : FALSE);
+ *hBitmap = (OLE_HANDLE)(ULONG64)bitmap;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::selectionRect(RECT* rc)
+{
+ WebCore::Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ IntRect ir = enclosingIntRect(frame->selectionRect());
+ ir = frame->view()->convertToContainingWindow(ir);
+ ir.move(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height());
+ rc->left = ir.x();
+ rc->top = ir.y();
+ rc->bottom = rc->top + ir.height();
+ rc->right = rc->left + ir.width();
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::registerViewClass(
+ /* [in] */ IWebDocumentView* /*view*/,
+ /* [in] */ IWebDocumentRepresentation* /*representation*/,
+ /* [in] */ BSTR /*forMIMEType*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setGroupName(
+ /* [in] */ BSTR groupName)
+{
+ m_groupName = String(groupName, SysStringLen(groupName));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::groupName(
+ /* [retval][out] */ BSTR* groupName)
+{
+ *groupName = SysAllocStringLen(m_groupName.characters(), m_groupName.length());
+ if (!*groupName && m_groupName.length())
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::estimatedProgress(
+ /* [retval][out] */ double* estimatedProgress)
+{
+ *estimatedProgress = m_page->progress()->estimatedProgress();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::isLoading(
+ /* [retval][out] */ BOOL* isLoading)
+{
+ COMPtr<IWebDataSource> dataSource;
+ COMPtr<IWebDataSource> provisionalDataSource;
+
+ if (!isLoading)
+ return E_POINTER;
+
+ *isLoading = FALSE;
+
+ if (SUCCEEDED(m_mainFrame->dataSource(&dataSource)))
+ dataSource->isLoading(isLoading);
+
+ if (*isLoading)
+ return S_OK;
+
+ if (SUCCEEDED(m_mainFrame->provisionalDataSource(&provisionalDataSource)))
+ provisionalDataSource->isLoading(isLoading);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::elementAtPoint(
+ /* [in] */ LPPOINT point,
+ /* [retval][out] */ IPropertyBag** elementDictionary)
+{
+ if (!elementDictionary) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *elementDictionary = 0;
+
+ Frame* frame = core(m_mainFrame);
+ if (!frame)
+ return E_FAIL;
+
+ IntPoint webCorePoint = IntPoint(point->x, point->y);
+ HitTestResult result = HitTestResult(webCorePoint);
+ if (frame->renderer())
+ result = frame->eventHandler()->hitTestResultAtPoint(webCorePoint, false);
+ *elementDictionary = WebElementPropertyBag::createInstance(result);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteboardTypesForSelection(
+ /* [retval][out] */ IEnumVARIANT** /*enumVariant*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::writeSelectionWithPasteboardTypes(
+ /* [size_is][in] */ BSTR* /*types*/,
+ /* [in] */ int /*cTypes*/,
+ /* [in] */ IDataObject* /*pasteboard*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteboardTypesForElement(
+ /* [in] */ IPropertyBag* /*elementDictionary*/,
+ /* [retval][out] */ IEnumVARIANT** /*enumVariant*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::writeElement(
+ /* [in] */ IPropertyBag* /*elementDictionary*/,
+ /* [size_is][in] */ BSTR* /*withPasteboardTypes*/,
+ /* [in] */ int /*cWithPasteboardTypes*/,
+ /* [in] */ IDataObject* /*pasteboard*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::selectedText(
+ /* [out, retval] */ BSTR* text)
+{
+ if (!text) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *text = 0;
+
+ Frame* focusedFrame = (m_page && m_page->focusController()) ? m_page->focusController()->focusedOrMainFrame() : 0;
+ if (!focusedFrame)
+ return E_FAIL;
+
+ String frameSelectedText = focusedFrame->selectedText();
+ *text = SysAllocStringLen(frameSelectedText.characters(), frameSelectedText.length());
+ if (!*text && frameSelectedText.length())
+ return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::centerSelectionInVisibleArea(
+ /* [in] */ IUnknown* /* sender */)
+{
+ Frame* coreFrame = core(m_mainFrame);
+ if (!coreFrame)
+ return E_FAIL;
+
+ coreFrame->revealSelection(RenderLayer::gAlignCenterAlways);
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebView::moveDragCaretToPoint(
+ /* [in] */ LPPOINT /*point*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::removeDragCaret( void)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setDrawsBackground(
+ /* [in] */ BOOL /*drawsBackground*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::drawsBackground(
+ /* [retval][out] */ BOOL* /*drawsBackground*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setMainFrameURL(
+ /* [in] */ BSTR /*urlString*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mainFrameURL(
+ /* [retval][out] */ BSTR* /*urlString*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mainFrameDocument(
+ /* [retval][out] */ IDOMDocument** document)
+{
+ if (document)
+ *document = 0;
+ if (!m_mainFrame)
+ return E_FAIL;
+ return m_mainFrame->DOMDocument(document);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mainFrameTitle(
+ /* [retval][out] */ BSTR* /*title*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::mainFrameIcon(
+ /* [retval][out] */ OLE_HANDLE* /*hBitmap*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::registerURLSchemeAsLocal(
+ /* [in] */ BSTR scheme)
+{
+ if (!scheme)
+ return E_POINTER;
+
+ FrameLoader::registerURLSchemeAsLocal(String(scheme, ::SysStringLen(scheme)));
+
+ return S_OK;
+}
+
+// IWebIBActions ---------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::takeStringURLFrom(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::stopLoading(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ return m_mainFrame->stopLoading();
+}
+
+HRESULT STDMETHODCALLTYPE WebView::reload(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ return m_mainFrame->reload();
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canGoBack(
+ /* [in] */ IUnknown* /*sender*/,
+ /* [retval][out] */ BOOL* result)
+{
+ *result = !!m_page->backForwardList()->backItem();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::goBack(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canGoForward(
+ /* [in] */ IUnknown* /*sender*/,
+ /* [retval][out] */ BOOL* result)
+{
+ *result = !!m_page->backForwardList()->forwardItem();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::goForward(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+#define MinimumTextSizeMultiplier 0.5f
+#define MaximumTextSizeMultiplier 3.0f
+#define TextSizeMultiplierRatio 1.2f
+
+HRESULT STDMETHODCALLTYPE WebView::canMakeTextLarger(
+ /* [in] */ IUnknown* /*sender*/,
+ /* [retval][out] */ BOOL* result)
+{
+ bool canGrowMore = m_textSizeMultiplier*TextSizeMultiplierRatio < MaximumTextSizeMultiplier;
+ *result = canGrowMore ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::makeTextLarger(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ float newScale = m_textSizeMultiplier*TextSizeMultiplierRatio;
+ bool canGrowMore = newScale < MaximumTextSizeMultiplier;
+ if (!canGrowMore)
+ return E_FAIL;
+ return setTextSizeMultiplier(newScale);
+
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canMakeTextSmaller(
+ /* [in] */ IUnknown* /*sender*/,
+ /* [retval][out] */ BOOL* result)
+{
+ bool canShrinkMore = m_textSizeMultiplier/TextSizeMultiplierRatio > MinimumTextSizeMultiplier;
+ *result = canShrinkMore ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::makeTextSmaller(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ float newScale = m_textSizeMultiplier/TextSizeMultiplierRatio;
+ bool canShrinkMore = newScale > MinimumTextSizeMultiplier;
+ if (!canShrinkMore)
+ return E_FAIL;
+ return setTextSizeMultiplier(newScale);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canMakeTextStandardSize(
+ /* [in] */ IUnknown* /*sender*/,
+ /* [retval][out] */ BOOL* result)
+{
+ bool notAlreadyStandard = m_textSizeMultiplier != 1.0f;
+ *result = notAlreadyStandard ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::makeTextStandardSize(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ bool notAlreadyStandard = m_textSizeMultiplier != 1.0f;
+ if (notAlreadyStandard)
+ return setTextSizeMultiplier(1.0f);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::toggleContinuousSpellChecking(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ HRESULT hr;
+ BOOL enabled;
+ if (FAILED(hr = isContinuousSpellCheckingEnabled(&enabled)))
+ return hr;
+ return setContinuousSpellCheckingEnabled(enabled ? FALSE : TRUE);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::toggleSmartInsertDelete(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ BOOL enabled = FALSE;
+ HRESULT hr = smartInsertDeleteEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+
+ return setSmartInsertDeleteEnabled(enabled ? FALSE : TRUE);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::toggleGrammarChecking(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ BOOL enabled;
+ HRESULT hr = isGrammarCheckingEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+
+ return setGrammarCheckingEnabled(enabled ? FALSE : TRUE);
+}
+
+// IWebViewCSS -----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::computedStyleForElement(
+ /* [in] */ IDOMElement* /*element*/,
+ /* [in] */ BSTR /*pseudoElement*/,
+ /* [retval][out] */ IDOMCSSStyleDeclaration** /*style*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// IWebViewEditing -------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::editableDOMRangeForPoint(
+ /* [in] */ LPPOINT /*point*/,
+ /* [retval][out] */ IDOMRange** /*range*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setSelectedDOMRange(
+ /* [in] */ IDOMRange* /*range*/,
+ /* [in] */ WebSelectionAffinity /*affinity*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::selectedDOMRange(
+ /* [retval][out] */ IDOMRange** /*range*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::selectionAffinity(
+ /* [retval][out][retval][out] */ WebSelectionAffinity* /*affinity*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setEditable(
+ /* [in] */ BOOL /*flag*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::isEditable(
+ /* [retval][out] */ BOOL* /*isEditable*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setTypingStyle(
+ /* [in] */ IDOMCSSStyleDeclaration* /*style*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::typingStyle(
+ /* [retval][out] */ IDOMCSSStyleDeclaration** /*style*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setSmartInsertDeleteEnabled(
+ /* [in] */ BOOL flag)
+{
+ m_smartInsertDeleteEnabled = !!flag;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::smartInsertDeleteEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = m_smartInsertDeleteEnabled ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setContinuousSpellCheckingEnabled(
+ /* [in] */ BOOL flag)
+{
+ if (continuousSpellCheckingEnabled != !!flag) {
+ continuousSpellCheckingEnabled = !!flag;
+ COMPtr<IWebPreferences> prefs;
+ if (SUCCEEDED(preferences(&prefs)))
+ prefs->setContinuousSpellCheckingEnabled(flag);
+ }
+
+ BOOL spellCheckingEnabled;
+ if (SUCCEEDED(isContinuousSpellCheckingEnabled(&spellCheckingEnabled)) && spellCheckingEnabled)
+ preflightSpellChecker();
+ else
+ m_mainFrame->unmarkAllMisspellings();
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::isContinuousSpellCheckingEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = (continuousSpellCheckingEnabled && continuousCheckingAllowed()) ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::spellCheckerDocumentTag(
+ /* [retval][out] */ int* tag)
+{
+ // we just use this as a flag to indicate that we've spell checked the document
+ // and need to close the spell checker out when the view closes.
+ *tag = 0;
+ m_hasSpellCheckerDocumentTag = true;
+ return S_OK;
+}
+
+static COMPtr<IWebEditingDelegate> spellingDelegateForTimer;
+
+static void preflightSpellCheckerNow()
+{
+ spellingDelegateForTimer->preflightChosenSpellServer();
+ spellingDelegateForTimer = 0;
+}
+
+static void CALLBACK preflightSpellCheckerTimerCallback(HWND, UINT, UINT_PTR id, DWORD)
+{
+ ::KillTimer(0, id);
+ preflightSpellCheckerNow();
+}
+
+void WebView::preflightSpellChecker()
+{
+ // As AppKit does, we wish to delay tickling the shared spellchecker into existence on application launch.
+ if (!m_editingDelegate)
+ return;
+
+ BOOL exists;
+ spellingDelegateForTimer = m_editingDelegate;
+ if (SUCCEEDED(m_editingDelegate->sharedSpellCheckerExists(&exists)) && exists)
+ preflightSpellCheckerNow();
+ else
+ ::SetTimer(0, 0, 2000, preflightSpellCheckerTimerCallback);
+}
+
+bool WebView::continuousCheckingAllowed()
+{
+ static bool allowContinuousSpellChecking = true;
+ static bool readAllowContinuousSpellCheckingDefault = false;
+ if (!readAllowContinuousSpellCheckingDefault) {
+ COMPtr<IWebPreferences> prefs;
+ if (SUCCEEDED(preferences(&prefs))) {
+ BOOL allowed;
+ prefs->allowContinuousSpellChecking(&allowed);
+ allowContinuousSpellChecking = !!allowed;
+ }
+ readAllowContinuousSpellCheckingDefault = true;
+ }
+ return allowContinuousSpellChecking;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::undoManager(
+ /* [retval][out] */ IWebUndoManager** /*manager*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setEditingDelegate(
+ /* [in] */ IWebEditingDelegate* d)
+{
+ m_editingDelegate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::editingDelegate(
+ /* [retval][out] */ IWebEditingDelegate** d)
+{
+ if (!d) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *d = m_editingDelegate.get();
+ if (!*d)
+ return E_FAIL;
+
+ (*d)->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::styleDeclarationWithText(
+ /* [in] */ BSTR /*text*/,
+ /* [retval][out] */ IDOMCSSStyleDeclaration** /*style*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::hasSelectedRange(
+ /* [retval][out] */ BOOL* hasSelectedRange)
+{
+ *hasSelectedRange = m_page->mainFrame()->selectionController()->isRange();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::cutEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor->canCut() || editor->canDHTMLCut();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::copyEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor->canCopy() || editor->canDHTMLCopy();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ *enabled = editor->canPaste() || editor->canDHTMLPaste();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::deleteEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canDelete();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::editingEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = m_page->focusController()->focusedOrMainFrame()->editor()->canEdit();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::isGrammarCheckingEnabled(
+ /* [retval][out] */ BOOL* enabled)
+{
+ *enabled = grammarCheckingEnabled ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setGrammarCheckingEnabled(
+ BOOL enabled)
+{
+ if (!m_editingDelegate) {
+ LOG_ERROR("No NSSpellChecker");
+ return E_FAIL;
+ }
+
+ if (grammarCheckingEnabled == !!enabled)
+ return S_OK;
+
+ grammarCheckingEnabled = !!enabled;
+ COMPtr<IWebPreferences> prefs;
+ if (SUCCEEDED(preferences(&prefs)))
+ prefs->setGrammarCheckingEnabled(enabled);
+
+ m_editingDelegate->updateGrammar();
+
+ // We call _preflightSpellChecker when turning continuous spell checking on, but we don't need to do that here
+ // because grammar checking only occurs on code paths that already preflight spell checking appropriately.
+
+ BOOL grammarEnabled;
+ if (SUCCEEDED(isGrammarCheckingEnabled(&grammarEnabled)) && !grammarEnabled)
+ m_mainFrame->unmarkAllBadGrammar();
+
+ return S_OK;
+}
+
+// IWebViewUndoableEditing -----------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithNode(
+ /* [in] */ IDOMNode* /*node*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithText(
+ /* [in] */ BSTR text)
+{
+ String textString(text, ::SysStringLen(text));
+ Position start = m_page->mainFrame()->selectionController()->selection().start();
+ m_page->focusController()->focusedOrMainFrame()->editor()->insertText(textString, 0);
+ m_page->mainFrame()->selectionController()->setBase(start);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithMarkupString(
+ /* [in] */ BSTR /*markupString*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithArchive(
+ /* [in] */ IWebArchive* /*archive*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::deleteSelection( void)
+{
+ Editor* editor = m_page->focusController()->focusedOrMainFrame()->editor();
+ editor->deleteSelectionWithSmartDelete(editor->canSmartCopyOrDelete());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::clearSelection( void)
+{
+ m_page->focusController()->focusedOrMainFrame()->selectionController()->clear();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::applyStyle(
+ /* [in] */ IDOMCSSStyleDeclaration* /*style*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// IWebViewEditingActions ------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::copy(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ m_page->focusController()->focusedOrMainFrame()->editor()->command("Copy").execute();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::cut(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ m_page->focusController()->focusedOrMainFrame()->editor()->command("Cut").execute();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::paste(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ m_page->focusController()->focusedOrMainFrame()->editor()->command("Paste").execute();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::copyURL(
+ /* [in] */ BSTR url)
+{
+ String temp(url, SysStringLen(url));
+ m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp), "");
+ return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE WebView::copyFont(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteFont(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::delete_(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ m_page->focusController()->focusedOrMainFrame()->editor()->command("Delete").execute();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteAsPlainText(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::pasteAsRichText(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::changeFont(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::changeAttributes(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::changeDocumentBackgroundColor(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::changeColor(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::alignCenter(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::alignJustified(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::alignLeft(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::alignRight(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::checkSpelling(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ if (!m_editingDelegate) {
+ LOG_ERROR("No NSSpellChecker");
+ return E_FAIL;
+ }
+
+ core(m_mainFrame)->editor()->advanceToNextMisspelling();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::showGuessPanel(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ if (!m_editingDelegate) {
+ LOG_ERROR("No NSSpellChecker");
+ return E_FAIL;
+ }
+
+ // Post-Tiger, this menu item is a show/hide toggle, to match AppKit. Leave Tiger behavior alone
+ // to match rest of OS X.
+ BOOL showing;
+ if (SUCCEEDED(m_editingDelegate->spellingUIIsShowing(&showing)) && showing) {
+ m_editingDelegate->showSpellingUI(FALSE);
+ }
+
+ core(m_mainFrame)->editor()->advanceToNextMisspelling(true);
+ m_editingDelegate->showSpellingUI(TRUE);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::performFindPanelAction(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::startSpeaking(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::stopSpeaking(
+ /* [in] */ IUnknown* /*sender*/)
+{
+ ASSERT_NOT_REACHED();
+ return E_NOTIMPL;
+}
+
+// IWebNotificationObserver -----------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::onNotify(
+ /* [in] */ IWebNotification* notification)
+{
+ BSTR nameBSTR;
+ HRESULT hr = notification->name(&nameBSTR);
+ if (FAILED(hr))
+ return hr;
+
+ BString name;
+ name.adoptBSTR(nameBSTR);
+
+ if (!wcscmp(name, WebIconDatabase::iconDatabaseDidAddIconNotification()))
+ return notifyDidAddIcon(notification);
+
+ if (!wcscmp(name, WebPreferences::webPreferencesChangedNotification()))
+ return notifyPreferencesChanged(notification);
+
+ return hr;
+}
+
+HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
+{
+ HRESULT hr;
+
+ COMPtr<IUnknown> unkPrefs;
+ hr = notification->getObject(&unkPrefs);
+ if (FAILED(hr))
+ return hr;
+
+ COMPtr<IWebPreferences> preferences(Query, unkPrefs);
+ if (!preferences)
+ return E_NOINTERFACE;
+
+ ASSERT(preferences == m_preferences);
+
+ BSTR str;
+ int size;
+ BOOL enabled;
+
+ Settings* settings = m_page->settings();
+
+ hr = preferences->cursiveFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setCursiveFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->defaultFixedFontSize(&size);
+ if (FAILED(hr))
+ return hr;
+ settings->setDefaultFixedFontSize(size);
+
+ hr = preferences->defaultFontSize(&size);
+ if (FAILED(hr))
+ return hr;
+ settings->setDefaultFontSize(size);
+
+ hr = preferences->defaultTextEncodingName(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setDefaultTextEncodingName(String(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->fantasyFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setFantasyFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->fixedFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setFixedFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->isJavaEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setJavaEnabled(!!enabled);
+
+ hr = preferences->isJavaScriptEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setJavaScriptEnabled(!!enabled);
+
+ hr = preferences->javaScriptCanOpenWindowsAutomatically(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setJavaScriptCanOpenWindowsAutomatically(!!enabled);
+
+ hr = preferences->minimumFontSize(&size);
+ if (FAILED(hr))
+ return hr;
+ settings->setMinimumFontSize(size);
+
+ hr = preferences->minimumLogicalFontSize(&size);
+ if (FAILED(hr))
+ return hr;
+ settings->setMinimumLogicalFontSize(size);
+
+ hr = preferences->arePlugInsEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setPluginsEnabled(!!enabled);
+
+ hr = preferences->privateBrowsingEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setPrivateBrowsingEnabled(!!enabled);
+
+ hr = preferences->sansSerifFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setSansSerifFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->serifFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setSerifFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->standardFontFamily(&str);
+ if (FAILED(hr))
+ return hr;
+ settings->setStandardFontFamily(AtomicString(str, SysStringLen(str)));
+ SysFreeString(str);
+
+ hr = preferences->loadsImagesAutomatically(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setLoadsImagesAutomatically(!!enabled);
+
+ hr = preferences->userStyleSheetEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ if (enabled) {
+ hr = preferences->userStyleSheetLocation(&str);
+ if (FAILED(hr))
+ return hr;
+
+ RetainPtr<CFStringRef> urlString(AdoptCF, String(str, SysStringLen(str)).createCFString());
+ RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(kCFAllocatorDefault, urlString.get(), 0));
+
+ // Check if the passed in string is a path and convert it to a URL.
+ // FIXME: This is a workaround for nightly builds until we can get Safari to pass
+ // in an URL here. See <rdar://problem/5478378>
+ if (!url) {
+ DWORD len = SysStringLen(str) + 1;
+
+ int result = WideCharToMultiByte(CP_UTF8, 0, str, len, 0, 0, 0, 0);
+ Vector<UInt8> utf8Path(result);
+ if (!WideCharToMultiByte(CP_UTF8, 0, str, len, (LPSTR)utf8Path.data(), result, 0, 0))
+ return E_FAIL;
+
+ url.adoptCF(CFURLCreateFromFileSystemRepresentation(0, utf8Path.data(), result - 1, false));
+ }
+
+ settings->setUserStyleSheetLocation(url.get());
+ SysFreeString(str);
+ } else {
+ settings->setUserStyleSheetLocation(KURL());
+ }
+
+ hr = preferences->shouldPrintBackgrounds(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setShouldPrintBackgrounds(!!enabled);
+
+ hr = preferences->textAreasAreResizable(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setTextAreasAreResizable(!!enabled);
+
+ WebKitEditableLinkBehavior behavior;
+ hr = preferences->editableLinkBehavior(&behavior);
+ if (FAILED(hr))
+ return hr;
+ settings->setEditableLinkBehavior((EditableLinkBehavior)behavior);
+
+ hr = preferences->usesPageCache(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setUsesPageCache(!!enabled);
+
+ hr = preferences->isDOMPasteAllowed(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setDOMPasteAllowed(!!enabled);
+
+ settings->setShowsURLsInToolTips(false);
+ settings->setForceFTPDirectoryListings(true);
+ settings->setDeveloperExtrasEnabled(developerExtrasEnabled());
+ settings->setNeedsSiteSpecificQuirks(s_allowSiteSpecificHacks);
+
+ FontSmoothingType smoothingType;
+ hr = preferences->fontSmoothing(&smoothingType);
+ if (FAILED(hr))
+ return hr;
+ settings->setFontRenderingMode(smoothingType != FontSmoothingTypeWindows ? NormalRenderingMode : AlternateRenderingMode);
+
+ COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+ if (prefsPrivate) {
+ hr = prefsPrivate->authorAndUserStylesEnabled(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setAuthorAndUserStylesEnabled(enabled);
+ }
+
+ m_mainFrame->invalidate(); // FIXME
+
+ hr = updateSharedSettingsFromPreferencesIfNeeded(preferences.get());
+ if (FAILED(hr))
+ return hr;
+
+ return S_OK;
+}
+
+HRESULT updateSharedSettingsFromPreferencesIfNeeded(IWebPreferences* preferences)
+{
+ if (preferences != WebPreferences::sharedStandardPreferences())
+ return S_OK;
+
+ WebKitCookieStorageAcceptPolicy acceptPolicy;
+ HRESULT hr = preferences->cookieStorageAcceptPolicy(&acceptPolicy);
+ if (FAILED(hr))
+ return hr;
+
+ // Set cookie storage accept policy
+ if (CFHTTPCookieStorageRef defaultCookieStorage = wkGetDefaultHTTPCookieStorage())
+ CFHTTPCookieStorageSetCookieAcceptPolicy(defaultCookieStorage, acceptPolicy);
+
+ return S_OK;
+}
+
+// IWebViewPrivate ------------------------------------------------------------
+
+HRESULT STDMETHODCALLTYPE WebView::setCustomDropTarget(
+ /* [in] */ IDropTarget* dt)
+{
+ ASSERT(::IsWindow(m_viewWindow));
+ if (!dt)
+ return E_POINTER;
+ m_hasCustomDropTarget = true;
+ revokeDragDrop();
+ return ::RegisterDragDrop(m_viewWindow,dt);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::removeCustomDropTarget()
+{
+ if (!m_hasCustomDropTarget)
+ return S_OK;
+ m_hasCustomDropTarget = false;
+ revokeDragDrop();
+ return registerDragDrop();
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setInViewSourceMode(
+ /* [in] */ BOOL flag)
+{
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ return m_mainFrame->setInViewSourceMode(flag);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::inViewSourceMode(
+ /* [retval][out] */ BOOL* flag)
+{
+ if (!m_mainFrame)
+ return E_FAIL;
+
+ return m_mainFrame->inViewSourceMode(flag);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::viewWindow(
+ /* [retval][out] */ OLE_HANDLE *window)
+{
+ *window = (OLE_HANDLE)(ULONG64)m_viewWindow;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setFormDelegate(
+ /* [in] */ IWebFormDelegate *formDelegate)
+{
+ m_formDelegate = formDelegate;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::formDelegate(
+ /* [retval][out] */ IWebFormDelegate **formDelegate)
+{
+ if (!m_formDelegate)
+ return E_FAIL;
+
+ return m_formDelegate.copyRefTo(formDelegate);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setFrameLoadDelegatePrivate(
+ /* [in] */ IWebFrameLoadDelegatePrivate* d)
+{
+ m_frameLoadDelegatePrivate = d;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::frameLoadDelegatePrivate(
+ /* [out][retval] */ IWebFrameLoadDelegatePrivate** d)
+{
+ if (!m_frameLoadDelegatePrivate)
+ return E_FAIL;
+
+ return m_frameLoadDelegatePrivate.copyRefTo(d);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::scrollOffset(
+ /* [retval][out] */ LPPOINT offset)
+{
+ if (!offset)
+ return E_POINTER;
+ IntSize offsetIntSize = m_page->mainFrame()->view()->scrollOffset();
+ offset->x = offsetIntSize.width();
+ offset->y = offsetIntSize.height();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::scrollBy(
+ /* [in] */ LPPOINT offset)
+{
+ if (!offset)
+ return E_POINTER;
+ m_page->mainFrame()->view()->scrollBy(offset->x, offset->y);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::visibleContentRect(
+ /* [retval][out] */ LPRECT rect)
+{
+ if (!rect)
+ return E_POINTER;
+ FloatRect visibleContent = m_page->mainFrame()->view()->visibleContentRect();
+ rect->left = (LONG) visibleContent.x();
+ rect->top = (LONG) visibleContent.y();
+ rect->right = (LONG) visibleContent.right();
+ rect->bottom = (LONG) visibleContent.bottom();
+ return S_OK;
+}
+
+static DWORD dragOperationToDragCursor(DragOperation op) {
+ DWORD res = DROPEFFECT_NONE;
+ if (op & DragOperationCopy)
+ res = DROPEFFECT_COPY;
+ else if (op & DragOperationLink)
+ res = DROPEFFECT_LINK;
+ else if (op & DragOperationMove)
+ res = DROPEFFECT_MOVE;
+ else if (op & DragOperationGeneric)
+ res = DROPEFFECT_MOVE; //This appears to be the Firefox behaviour
+ return res;
+}
+
+static DragOperation keyStateToDragOperation(DWORD) {
+ //FIXME: This is currently very simple, it may need to actually
+ //work out an appropriate DragOperation in future -- however this
+ //behaviour appears to match FireFox
+ return (DragOperation)(DragOperationCopy | DragOperationLink);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragEnter(
+ IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ m_dragData = 0;
+
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragEnter(m_viewWindow, pDataObject, (POINT*)&pt, *pdwEffect);
+
+ POINTL localpt = pt;
+ ::ScreenToClient(m_viewWindow, (LPPOINT)&localpt);
+ DragData data(pDataObject, IntPoint(localpt.x, localpt.y),
+ IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragEntered(&data));
+
+ m_dragData = pDataObject;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragOver(
+ DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragOver((POINT*)&pt, *pdwEffect);
+
+ if (m_dragData) {
+ POINTL localpt = pt;
+ ::ScreenToClient(m_viewWindow, (LPPOINT)&localpt);
+ DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y),
+ IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragUpdated(&data));
+ } else
+ *pdwEffect = DROPEFFECT_NONE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::DragLeave()
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->DragLeave();
+
+ if (m_dragData) {
+ DragData data(m_dragData.get(), IntPoint(), IntPoint(),
+ DragOperationNone);
+ m_page->dragController()->dragExited(&data);
+ m_dragData = 0;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::Drop(
+ IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
+{
+ if (m_dropTargetHelper)
+ m_dropTargetHelper->Drop(pDataObject, (POINT*)&pt, *pdwEffect);
+
+ m_dragData = 0;
+ *pdwEffect = DROPEFFECT_NONE;
+ POINTL localpt = pt;
+ ::ScreenToClient(m_viewWindow, (LPPOINT)&localpt);
+ DragData data(pDataObject, IntPoint(localpt.x, localpt.y),
+ IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
+ m_page->dragController()->performDrag(&data);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::canHandleRequest(
+ IWebURLRequest *request,
+ BOOL *result)
+{
+ COMPtr<WebMutableURLRequest> requestImpl;
+
+ HRESULT hr = request->QueryInterface(&requestImpl);
+ if (FAILED(hr))
+ return hr;
+
+ *result = !!canHandleRequest(requestImpl->resourceRequest());
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::clearFocusNode()
+{
+ if (m_page && m_page->focusController())
+ m_page->focusController()->setFocusedNode(0, 0);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setInitialFocus(
+ /* [in] */ BOOL forward)
+{
+ if (m_page && m_page->focusController()) {
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ frame->document()->setFocusedNode(0);
+ m_page->focusController()->setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0);
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setTabKeyCyclesThroughElements(
+ /* [in] */ BOOL cycles)
+{
+ if (m_page)
+ m_page->setTabKeyCyclesThroughElements(!!cycles);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::tabKeyCyclesThroughElements(
+ /* [retval][out] */ BOOL* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = m_page && m_page->tabKeyCyclesThroughElements() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::setAllowSiteSpecificHacks(
+ /* [in] */ BOOL allow)
+{
+ s_allowSiteSpecificHacks = !!allow;
+ // FIXME: This sets a global so it needs to call notifyPreferencesChanged
+ // on all WebView objects (not just itself).
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::addAdditionalPluginPath(
+ /* [in] */ BSTR path)
+{
+ PluginDatabase::installedPlugins()->addExtraPluginPath(String(path, SysStringLen(path)));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::loadBackForwardListFromOtherView(
+ /* [in] */ IWebView* otherView)
+{
+ if (!m_page)
+ return E_FAIL;
+
+ // It turns out the right combination of behavior is done with the back/forward load
+ // type. (See behavior matrix at the top of WebFramePrivate.) So we copy all the items
+ // in the back forward list, and go to the current one.
+ BackForwardList* backForwardList = m_page->backForwardList();
+ ASSERT(!backForwardList->currentItem()); // destination list should be empty
+
+ COMPtr<WebView> otherWebView;
+ if (FAILED(otherView->QueryInterface(&otherWebView)))
+ return E_FAIL;
+ BackForwardList* otherBackForwardList = otherWebView->m_page->backForwardList();
+ if (!otherBackForwardList->currentItem())
+ return S_OK; // empty back forward list, bail
+
+ HistoryItem* newItemToGoTo = 0;
+
+ int lastItemIndex = otherBackForwardList->forwardListCount();
+ for (int i = -otherBackForwardList->backListCount(); i <= lastItemIndex; ++i) {
+ if (!i) {
+ // If this item is showing , save away its current scroll and form state,
+ // since that might have changed since loading and it is normally not saved
+ // until we leave that page.
+ otherWebView->m_page->mainFrame()->loader()->saveDocumentAndScrollState();
+ }
+ RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
+ if (!i)
+ newItemToGoTo = newItem.get();
+ backForwardList->addItem(newItem.release());
+ }
+
+ ASSERT(newItemToGoTo);
+ m_page->goToItem(newItemToGoTo, FrameLoadTypeIndexedBackForward);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::clearUndoRedoOperations()
+{
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame())
+ frame->editor()->clearUndoRedoOperations();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::shouldClose(
+ /* [retval][out] */ BOOL* result)
+{
+ if (!result) {
+ ASSERT_NOT_REACHED();
+ return E_POINTER;
+ }
+
+ *result = TRUE;
+ if (Frame* frame = m_page->focusController()->focusedOrMainFrame())
+ *result = frame->shouldClose() ? TRUE : FALSE;
+ return S_OK;
+}
+
+HRESULT WebView::registerDragDrop()
+{
+ ASSERT(::IsWindow(m_viewWindow));
+ return ::RegisterDragDrop(m_viewWindow, this);
+}
+
+HRESULT WebView::revokeDragDrop()
+{
+ ASSERT(::IsWindow(m_viewWindow));
+ return ::RevokeDragDrop(m_viewWindow);
+}
+
+HRESULT WebView::setProhibitsMainFrameScrolling(BOOL b)
+{
+ if (!m_page)
+ return E_FAIL;
+
+ m_page->mainFrame()->setProhibitsScrolling(b);
+ return S_OK;
+}
+
+HRESULT WebView::setShouldApplyMacFontAscentHack(BOOL b)
+{
+ SimpleFontData::setShouldApplyMacAscentHack(b);
+ return S_OK;
+}
+
+class IMMDict {
+ typedef HIMC (CALLBACK *getContextPtr)(HWND);
+ typedef BOOL (CALLBACK *releaseContextPtr)(HWND, HIMC);
+ typedef LONG (CALLBACK *getCompositionStringPtr)(HIMC, DWORD, LPVOID, DWORD);
+ typedef BOOL (CALLBACK *setCandidateWindowPtr)(HIMC, LPCANDIDATEFORM);
+ typedef BOOL (CALLBACK *setOpenStatusPtr)(HIMC, BOOL);
+ typedef BOOL (CALLBACK *notifyIMEPtr)(HIMC, DWORD, DWORD, DWORD);
+ typedef BOOL (CALLBACK *associateContextExPtr)(HWND, HIMC, DWORD);
+
+public:
+ getContextPtr getContext;
+ releaseContextPtr releaseContext;
+ getCompositionStringPtr getCompositionString;
+ setCandidateWindowPtr setCandidateWindow;
+ setOpenStatusPtr setOpenStatus;
+ notifyIMEPtr notifyIME;
+ associateContextExPtr associateContextEx;
+
+ static const IMMDict& dict();
+private:
+ IMMDict();
+ HMODULE m_instance;
+};
+
+const IMMDict& IMMDict::dict()
+{
+ static IMMDict instance;
+ return instance;
+}
+
+IMMDict::IMMDict()
+{
+ m_instance = ::LoadLibrary(TEXT("IMM32.DLL"));
+ getContext = reinterpret_cast<getContextPtr>(::GetProcAddress(m_instance, "ImmGetContext"));
+ ASSERT(getContext);
+ releaseContext = reinterpret_cast<releaseContextPtr>(::GetProcAddress(m_instance, "ImmReleaseContext"));
+ ASSERT(releaseContext);
+ getCompositionString = reinterpret_cast<getCompositionStringPtr>(::GetProcAddress(m_instance, "ImmGetCompositionStringW"));
+ ASSERT(getCompositionString);
+ setCandidateWindow = reinterpret_cast<setCandidateWindowPtr>(::GetProcAddress(m_instance, "ImmSetCandidateWindow"));
+ ASSERT(setCandidateWindow);
+ setOpenStatus = reinterpret_cast<setOpenStatusPtr>(::GetProcAddress(m_instance, "ImmSetOpenStatus"));
+ ASSERT(setOpenStatus);
+ notifyIME = reinterpret_cast<notifyIMEPtr>(::GetProcAddress(m_instance, "ImmNotifyIME"));
+ ASSERT(notifyIME);
+ associateContextEx = reinterpret_cast<associateContextExPtr>(::GetProcAddress(m_instance, "ImmAssociateContextEx"));
+ ASSERT(associateContextEx);
+}
+
+HIMC WebView::getIMMContext()
+{
+ HIMC context = IMMDict::dict().getContext(m_viewWindow);
+ return context;
+}
+
+void WebView::releaseIMMContext(HIMC hIMC)
+{
+ if (!hIMC)
+ return;
+ IMMDict::dict().releaseContext(m_viewWindow, hIMC);
+}
+
+void WebView::prepareCandidateWindow(Frame* targetFrame, HIMC hInputContext)
+{
+ IntRect caret;
+ if (RefPtr<Range> range = targetFrame->selectionController()->selection().toRange()) {
+ ExceptionCode ec = 0;
+ RefPtr<Range> tempRange = range->cloneRange(ec);
+ caret = targetFrame->firstRectForRange(tempRange.get());
+ }
+ caret = targetFrame->view()->contentsToWindow(caret);
+ CANDIDATEFORM form;
+ form.dwIndex = 0;
+ form.dwStyle = CFS_EXCLUDE;
+ form.ptCurrentPos.x = caret.x();
+ form.ptCurrentPos.y = caret.y() + caret.height();
+ form.rcArea.top = caret.y();
+ form.rcArea.bottom = caret.bottom();
+ form.rcArea.left = caret.x();
+ form.rcArea.right = caret.right();
+ IMMDict::dict().setCandidateWindow(hInputContext, &form);
+}
+
+void WebView::resetIME(Frame* targetFrame)
+{
+ if (targetFrame)
+ targetFrame->editor()->confirmCompositionWithoutDisturbingSelection();
+
+ if (HIMC hInputContext = getIMMContext()) {
+ IMMDict::dict().notifyIME(hInputContext, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ releaseIMMContext(hInputContext);
+ }
+}
+
+void WebView::updateSelectionForIME()
+{
+ Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
+ if (!targetFrame || !targetFrame->editor()->hasComposition())
+ return;
+
+ if (targetFrame->editor()->ignoreCompositionSelectionChange())
+ return;
+
+ unsigned start;
+ unsigned end;
+ if (!targetFrame->editor()->getCompositionSelection(start, end))
+ resetIME(targetFrame);
+}
+
+void WebView::setInputMethodState(bool enabled)
+{
+ IMMDict::dict().associateContextEx(m_viewWindow, 0, enabled ? IACE_DEFAULT : 0);
+}
+
+void WebView::selectionChanged()
+{
+ updateSelectionForIME();
+}
+
+bool WebView::onIMEStartComposition()
+{
+ m_inIMEComposition++;
+ Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
+ if (!targetFrame)
+ return true;
+
+ HIMC hInputContext = getIMMContext();
+ prepareCandidateWindow(targetFrame, hInputContext);
+ releaseIMMContext(hInputContext);
+ return true;
+}
+
+static bool getCompositionString(HIMC hInputContext, DWORD type, String& result)
+{
+ int compositionLength = IMMDict::dict().getCompositionString(hInputContext, type, 0, 0);
+ if (compositionLength <= 0)
+ return false;
+ Vector<UChar> compositionBuffer(compositionLength / 2);
+ compositionLength = IMMDict::dict().getCompositionString(hInputContext, type, (LPVOID)compositionBuffer.data(), compositionLength);
+ result = String(compositionBuffer.data(), compositionLength / 2);
+ ASSERT(!compositionLength || compositionBuffer[0]);
+ ASSERT(!compositionLength || compositionBuffer[compositionLength / 2 - 1]);
+ return true;
+}
+
+static void compositionToUnderlines(const Vector<DWORD>& clauses, const Vector<BYTE>& attributes, Vector<CompositionUnderline>& underlines)
+{
+ if (clauses.isEmpty()) {
+ underlines.clear();
+ return;
+ }
+
+ const size_t numBoundaries = clauses.size() - 1;
+ underlines.resize(numBoundaries);
+ for (unsigned i = 0; i < numBoundaries; i++) {
+ underlines[i].startOffset = clauses[i];
+ underlines[i].endOffset = clauses[i + 1];
+ BYTE attribute = attributes[clauses[i]];
+ underlines[i].thick = attribute == ATTR_TARGET_CONVERTED || attribute == ATTR_TARGET_NOTCONVERTED;
+ underlines[i].color = Color(0,0,0);
+ }
+}
+
+bool WebView::onIMEComposition(LPARAM lparam)
+{
+ HIMC hInputContext = getIMMContext();
+ if (!hInputContext)
+ return true;
+
+ Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
+ if (!targetFrame || !targetFrame->editor()->canEdit())
+ return true;
+
+ prepareCandidateWindow(targetFrame, hInputContext);
+
+ if (lparam & GCS_RESULTSTR || !lparam) {
+ String compositionString;
+ if (!getCompositionString(hInputContext, GCS_RESULTSTR, compositionString) && lparam)
+ return true;
+
+ targetFrame->editor()->confirmComposition(compositionString);
+ } else {
+ String compositionString;
+ if (!getCompositionString(hInputContext, GCS_COMPSTR, compositionString))
+ return true;
+
+ // Composition string attributes
+ int numAttributes = IMMDict::dict().getCompositionString(hInputContext, GCS_COMPATTR, 0, 0);
+ Vector<BYTE> attributes(numAttributes);
+ IMMDict::dict().getCompositionString(hInputContext, GCS_COMPATTR, attributes.data(), numAttributes);
+
+ // Get clauses
+ int numClauses = IMMDict::dict().getCompositionString(hInputContext, GCS_COMPCLAUSE, 0, 0);
+ Vector<DWORD> clauses(numClauses / sizeof(DWORD));
+ IMMDict::dict().getCompositionString(hInputContext, GCS_COMPCLAUSE, clauses.data(), numClauses);
+
+ Vector<CompositionUnderline> underlines;
+ compositionToUnderlines(clauses, attributes, underlines);
+
+ int cursorPosition = LOWORD(IMMDict::dict().getCompositionString(hInputContext, GCS_CURSORPOS, 0, 0));
+
+ targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0);
+ }
+
+ return true;
+}
+
+bool WebView::onIMEEndComposition()
+{
+ if (m_inIMEComposition)
+ m_inIMEComposition--;
+ return true;
+}
+
+bool WebView::onIMEChar(WPARAM, LPARAM)
+{
+ return true;
+}
+
+bool WebView::onIMENotify(WPARAM, LPARAM, LRESULT*)
+{
+ return false;
+}
+
+bool WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* charPos, LRESULT* result)
+{
+ IntRect caret;
+ ASSERT(charPos->dwCharPos == 0 || targetFrame->editor()->hasComposition());
+ if (RefPtr<Range> range = targetFrame->editor()->hasComposition() ? targetFrame->editor()->compositionRange() : targetFrame->selectionController()->selection().toRange()) {
+ ExceptionCode ec = 0;
+ RefPtr<Range> tempRange = range->cloneRange(ec);
+ tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + charPos->dwCharPos, ec);
+ caret = targetFrame->firstRectForRange(tempRange.get());
+ }
+ caret = targetFrame->view()->contentsToWindow(caret);
+ charPos->pt.x = caret.x();
+ charPos->pt.y = caret.y();
+ ::ClientToScreen(m_viewWindow, &charPos->pt);
+ charPos->cLineHeight = caret.height();
+ ::GetWindowRect(m_viewWindow, &charPos->rcDocument);
+ *result = TRUE;
+ return true;
+}
+
+bool WebView::onIMERequestReconvertString(Frame* targetFrame, RECONVERTSTRING* reconvertString, LRESULT* result)
+{
+ RefPtr<Range> selectedRange = targetFrame->selectionController()->toRange();
+ String text = selectedRange->text();
+ if (!reconvertString) {
+ *result = sizeof(RECONVERTSTRING) + text.length() * sizeof(UChar);
+ return true;
+ }
+
+ unsigned totalSize = sizeof(RECONVERTSTRING) + text.length() * sizeof(UChar);
+ *result = totalSize;
+ if (totalSize > reconvertString->dwSize) {
+ *result = 0;
+ return false;
+ }
+ reconvertString->dwCompStrLen = text.length();
+ reconvertString->dwStrLen = text.length();
+ reconvertString->dwTargetStrLen = text.length();
+ reconvertString->dwStrOffset = sizeof(RECONVERTSTRING);
+ memcpy(reconvertString + 1, text.characters(), text.length() * sizeof(UChar));
+ return true;
+}
+
+bool WebView::onIMERequest(WPARAM request, LPARAM data, LRESULT* result)
+{
+ Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
+ if (!targetFrame || !targetFrame->editor()->canEdit())
+ return true;
+
+ switch (request) {
+ case IMR_RECONVERTSTRING:
+ return onIMERequestReconvertString(targetFrame, (RECONVERTSTRING*)data, result);
+
+ case IMR_QUERYCHARPOSITION:
+ return onIMERequestCharPosition(targetFrame, (IMECHARPOSITION*)data, result);
+ }
+ return false;
+}
+
+bool WebView::onIMESelect(WPARAM, LPARAM)
+{
+ return false;
+}
+
+bool WebView::onIMESetContext(WPARAM, LPARAM)
+{
+ return false;
+}
+
+HRESULT STDMETHODCALLTYPE WebView::inspector(IWebInspector** inspector)
+{
+ if (!m_webInspector)
+ m_webInspector.adoptRef(WebInspector::createInstance(this));
+
+ return m_webInspector.copyRefTo(inspector);
+}
+
+HRESULT STDMETHODCALLTYPE WebView::windowAncestryDidChange()
+{
+ HWND newParent = findTopLevelParent(m_hostWindow);
+ if (newParent == m_topLevelParent)
+ return S_OK;
+
+ if (m_topLevelParent)
+ WindowMessageBroadcaster::removeListener(m_topLevelParent, this);
+
+ m_topLevelParent = newParent;
+
+ if (m_topLevelParent)
+ WindowMessageBroadcaster::addListener(m_topLevelParent, this);
+
+ updateActiveState();
+
+ return S_OK;
+}
+
+class EnumTextMatches : public IEnumTextMatches
+{
+ long m_ref;
+ UINT m_index;
+ Vector<IntRect> m_rects;
+public:
+ EnumTextMatches(Vector<IntRect>* rects) : m_index(0), m_ref(1)
+ {
+ m_rects = *rects;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv)
+ {
+ if (riid == IID_IUnknown || riid == IID_IEnumTextMatches) {
+ *ppv = this;
+ AddRef();
+ }
+
+ return *ppv?S_OK:E_NOINTERFACE;
+ }
+
+ virtual ULONG STDMETHODCALLTYPE AddRef()
+ {
+ return m_ref++;
+ }
+
+ virtual ULONG STDMETHODCALLTYPE Release()
+ {
+ if (m_ref == 1) {
+ delete this;
+ return 0;
+ }
+ else
+ return m_ref--;
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE Next(ULONG, RECT* rect, ULONG* pceltFetched)
+ {
+ if (m_index < m_rects.size()) {
+ if (pceltFetched)
+ *pceltFetched = 1;
+ *rect = m_rects[m_index];
+ m_index++;
+ return S_OK;
+ }
+
+ if (pceltFetched)
+ *pceltFetched = 0;
+
+ return S_FALSE;
+ }
+ virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt)
+ {
+ m_index += celt;
+ return S_OK;
+ }
+ virtual HRESULT STDMETHODCALLTYPE Reset(void)
+ {
+ m_index = 0;
+ return S_OK;
+ }
+ virtual HRESULT STDMETHODCALLTYPE Clone(IEnumTextMatches**)
+ {
+ return E_NOTIMPL;
+ }
+};
+
+HRESULT createMatchEnumerator(Vector<IntRect>* rects, IEnumTextMatches** matches)
+{
+ *matches = new EnumTextMatches(rects);
+ return (*matches)?S_OK:E_OUTOFMEMORY;
+}
+
+Page* core(IWebView* iWebView)
+{
+ Page* page = 0;
+
+ COMPtr<WebView> webView;
+ if (SUCCEEDED(iWebView->QueryInterface(&webView)) && webView)
+ page = webView->page();
+
+ return page;
+}
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
new file mode 100644
index 0000000..e5c5345
--- /dev/null
+++ b/WebKit/win/WebView.h
@@ -0,0 +1,787 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebView_H
+#define WebView_H
+
+#include "COMPtr.h"
+#include "WebKit.h"
+#include "WebFrame.h"
+#include "WebPreferences.h"
+
+#include <WebCore/IntRect.h>
+#include <WebCore/Timer.h>
+#include <WebCore/WindowMessageListener.h>
+#include <wtf/OwnPtr.h>
+
+class WebFrame;
+class WebBackForwardList;
+class WebInspector;
+class WebInspectorClient;
+
+WebCore::Page* core(IWebView*);
+
+interface IDropTargetHelper;
+
+class WebView
+ : public IWebView
+ , public IWebViewPrivate
+ , public IWebIBActions
+ , public IWebViewCSS
+ , public IWebViewEditing
+ , public IWebViewUndoableEditing
+ , public IWebViewEditingActions
+ , public IWebNotificationObserver
+ , public IDropTarget
+ , WebCore::WindowMessageListener
+{
+public:
+ static WebView* createInstance();
+protected:
+ WebView();
+ ~WebView();
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebView
+
+ virtual HRESULT STDMETHODCALLTYPE canShowMIMEType(
+ /* [in] */ BSTR mimeType,
+ /* [retval][out] */ BOOL *canShow);
+
+ virtual HRESULT STDMETHODCALLTYPE canShowMIMETypeAsHTML(
+ /* [in] */ BSTR mimeType,
+ /* [retval][out] */ BOOL *canShow);
+
+ virtual HRESULT STDMETHODCALLTYPE MIMETypesShownAsHTML(
+ /* [retval][out] */ IEnumVARIANT **enumVariant);
+
+ virtual HRESULT STDMETHODCALLTYPE setMIMETypesShownAsHTML(
+ /* [size_is][in] */ BSTR *mimeTypes,
+ /* [in] */ int cMimeTypes);
+
+ virtual HRESULT STDMETHODCALLTYPE URLFromPasteboard(
+ /* [in] */ IDataObject *pasteboard,
+ /* [retval][out] */ BSTR *url);
+
+ virtual HRESULT STDMETHODCALLTYPE URLTitleFromPasteboard(
+ /* [in] */ IDataObject *pasteboard,
+ /* [retval][out] */ BSTR *urlTitle);
+
+ virtual HRESULT STDMETHODCALLTYPE initWithFrame(
+ /* [in] */ RECT frame,
+ /* [in] */ BSTR frameName,
+ /* [in] */ BSTR groupName);
+
+ virtual HRESULT STDMETHODCALLTYPE setUIDelegate(
+ /* [in] */ IWebUIDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE uiDelegate(
+ /* [out][retval] */ IWebUIDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE setResourceLoadDelegate(
+ /* [in] */ IWebResourceLoadDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE resourceLoadDelegate(
+ /* [out][retval] */ IWebResourceLoadDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE setDownloadDelegate(
+ /* [in] */ IWebDownloadDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE downloadDelegate(
+ /* [out][retval] */ IWebDownloadDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegate(
+ /* [in] */ IWebFrameLoadDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE frameLoadDelegate(
+ /* [out][retval] */ IWebFrameLoadDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE setPolicyDelegate(
+ /* [in] */ IWebPolicyDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE policyDelegate(
+ /* [out][retval] */ IWebPolicyDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE mainFrame(
+ /* [out][retval] */ IWebFrame **frame);
+
+ virtual HRESULT STDMETHODCALLTYPE focusedFrame(
+ /* [out][retval] */ IWebFrame **frame);
+
+ virtual HRESULT STDMETHODCALLTYPE backForwardList(
+ /* [out][retval] */ IWebBackForwardList **list);
+
+ virtual HRESULT STDMETHODCALLTYPE setMaintainsBackForwardList(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE goBack(
+ /* [retval][out] */ BOOL *succeeded);
+
+ virtual HRESULT STDMETHODCALLTYPE goForward(
+ /* [retval][out] */ BOOL *succeeded);
+
+ virtual HRESULT STDMETHODCALLTYPE goToBackForwardItem(
+ /* [in] */ IWebHistoryItem *item,
+ /* [retval][out] */ BOOL *succeeded);
+
+ virtual HRESULT STDMETHODCALLTYPE setTextSizeMultiplier(
+ /* [in] */ float multiplier);
+
+ virtual HRESULT STDMETHODCALLTYPE textSizeMultiplier(
+ /* [retval][out] */ float *multiplier);
+
+ virtual HRESULT STDMETHODCALLTYPE setApplicationNameForUserAgent(
+ /* [in] */ BSTR applicationName);
+
+ virtual HRESULT STDMETHODCALLTYPE applicationNameForUserAgent(
+ /* [retval][out] */ BSTR *applicationName);
+
+ virtual HRESULT STDMETHODCALLTYPE setCustomUserAgent(
+ /* [in] */ BSTR userAgentString);
+
+ virtual HRESULT STDMETHODCALLTYPE customUserAgent(
+ /* [retval][out] */ BSTR *userAgentString);
+
+ virtual HRESULT STDMETHODCALLTYPE userAgentForURL(
+ /* [in] */ BSTR url,
+ /* [retval][out] */ BSTR *userAgent);
+
+ virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding(
+ /* [retval][out] */ BOOL *supports);
+
+ virtual HRESULT STDMETHODCALLTYPE setCustomTextEncodingName(
+ /* [in] */ BSTR encodingName);
+
+ virtual HRESULT STDMETHODCALLTYPE customTextEncodingName(
+ /* [retval][out] */ BSTR *encodingName);
+
+ virtual HRESULT STDMETHODCALLTYPE setMediaStyle(
+ /* [in] */ BSTR media);
+
+ virtual HRESULT STDMETHODCALLTYPE mediaStyle(
+ /* [retval][out] */ BSTR *media);
+
+ virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptFromString(
+ /* [in] */ BSTR script,
+ /* [retval][out] */ BSTR *result);
+
+ virtual HRESULT STDMETHODCALLTYPE windowScriptObject(
+ /* [retval][out] */ IWebScriptObject **webScriptObject);
+
+ virtual HRESULT STDMETHODCALLTYPE setPreferences(
+ /* [in] */ IWebPreferences *prefs);
+
+ virtual HRESULT STDMETHODCALLTYPE preferences(
+ /* [retval][out] */ IWebPreferences **prefs);
+
+ virtual HRESULT STDMETHODCALLTYPE setPreferencesIdentifier(
+ /* [in] */ BSTR anIdentifier);
+
+ virtual HRESULT STDMETHODCALLTYPE preferencesIdentifier(
+ /* [retval][out] */ BSTR *anIdentifier);
+
+ virtual HRESULT STDMETHODCALLTYPE setHostWindow(
+ /* [in] */ OLE_HANDLE window);
+
+ virtual HRESULT STDMETHODCALLTYPE hostWindow(
+ /* [retval][out] */ OLE_HANDLE *window);
+
+ virtual HRESULT STDMETHODCALLTYPE searchFor(
+ /* [in] */ BSTR str,
+ /* [in] */ BOOL forward,
+ /* [in] */ BOOL caseFlag,
+ /* [in] */ BOOL wrapFlag,
+ /* [retval][out] */ BOOL *found);
+
+ virtual HRESULT STDMETHODCALLTYPE registerViewClass(
+ /* [in] */ IWebDocumentView *view,
+ /* [in] */ IWebDocumentRepresentation *representation,
+ /* [in] */ BSTR forMIMEType);
+
+ virtual HRESULT STDMETHODCALLTYPE setGroupName(
+ /* [in] */ BSTR groupName);
+
+ virtual HRESULT STDMETHODCALLTYPE groupName(
+ /* [retval][out] */ BSTR *groupName);
+
+ virtual HRESULT STDMETHODCALLTYPE estimatedProgress(
+ /* [retval][out] */ double *estimatedProgress);
+
+ virtual HRESULT STDMETHODCALLTYPE isLoading(
+ /* [retval][out] */ BOOL *isLoading);
+
+ virtual HRESULT STDMETHODCALLTYPE elementAtPoint(
+ /* [in] */ LPPOINT point,
+ /* [retval][out] */ IPropertyBag **elementDictionary);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForSelection(
+ /* [retval][out] */ IEnumVARIANT **enumVariant);
+
+ virtual HRESULT STDMETHODCALLTYPE writeSelectionWithPasteboardTypes(
+ /* [size_is][in] */ BSTR *types,
+ /* [in] */ int cTypes,
+ /* [in] */ IDataObject *pasteboard);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForElement(
+ /* [in] */ IPropertyBag *elementDictionary,
+ /* [retval][out] */ IEnumVARIANT **enumVariant);
+
+ virtual HRESULT STDMETHODCALLTYPE writeElement(
+ /* [in] */ IPropertyBag *elementDictionary,
+ /* [size_is][in] */ BSTR *withPasteboardTypes,
+ /* [in] */ int cWithPasteboardTypes,
+ /* [in] */ IDataObject *pasteboard);
+
+ virtual HRESULT STDMETHODCALLTYPE selectedText(
+ /* [out, retval] */ BSTR* str);
+
+ virtual HRESULT STDMETHODCALLTYPE centerSelectionInVisibleArea(
+ /* [in] */ IUnknown* sender);
+
+ virtual HRESULT STDMETHODCALLTYPE moveDragCaretToPoint(
+ /* [in] */ LPPOINT point);
+
+ virtual HRESULT STDMETHODCALLTYPE removeDragCaret( void);
+
+ virtual HRESULT STDMETHODCALLTYPE setDrawsBackground(
+ /* [in] */ BOOL drawsBackground);
+
+ virtual HRESULT STDMETHODCALLTYPE drawsBackground(
+ /* [retval][out] */ BOOL *drawsBackground);
+
+ virtual HRESULT STDMETHODCALLTYPE setMainFrameURL(
+ /* [in] */ BSTR urlString);
+
+ virtual HRESULT STDMETHODCALLTYPE mainFrameURL(
+ /* [retval][out] */ BSTR *urlString);
+
+ virtual HRESULT STDMETHODCALLTYPE mainFrameDocument(
+ /* [retval][out] */ IDOMDocument **document);
+
+ virtual HRESULT STDMETHODCALLTYPE mainFrameTitle(
+ /* [retval][out] */ BSTR *title);
+
+ virtual HRESULT STDMETHODCALLTYPE mainFrameIcon(
+ /* [retval][out] */ OLE_HANDLE *hBitmap);
+
+ virtual HRESULT STDMETHODCALLTYPE registerURLSchemeAsLocal(
+ /* [in] */ BSTR scheme);
+
+ // IWebIBActions
+
+ virtual HRESULT STDMETHODCALLTYPE takeStringURLFrom(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE stopLoading(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE reload(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE canGoBack(
+ /* [in] */ IUnknown *sender,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE goBack(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE canGoForward(
+ /* [in] */ IUnknown *sender,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE goForward(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE canMakeTextLarger(
+ /* [in] */ IUnknown *sender,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE makeTextLarger(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE canMakeTextSmaller(
+ /* [in] */ IUnknown *sender,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE makeTextSmaller(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE canMakeTextStandardSize(
+ /* [in] */ IUnknown *sender,
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE makeTextStandardSize(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE toggleContinuousSpellChecking(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE toggleSmartInsertDelete(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE toggleGrammarChecking(
+ /* [in] */ IUnknown *sender);
+
+ // IWebViewCSS
+
+ virtual HRESULT STDMETHODCALLTYPE computedStyleForElement(
+ /* [in] */ IDOMElement *element,
+ /* [in] */ BSTR pseudoElement,
+ /* [retval][out] */ IDOMCSSStyleDeclaration **style);
+
+ // IWebViewEditing
+
+ virtual HRESULT STDMETHODCALLTYPE editableDOMRangeForPoint(
+ /* [in] */ LPPOINT point,
+ /* [retval][out] */ IDOMRange **range);
+
+ virtual HRESULT STDMETHODCALLTYPE setSelectedDOMRange(
+ /* [in] */ IDOMRange *range,
+ /* [in] */ WebSelectionAffinity affinity);
+
+ virtual HRESULT STDMETHODCALLTYPE selectedDOMRange(
+ /* [retval][out] */ IDOMRange **range);
+
+ virtual HRESULT STDMETHODCALLTYPE selectionAffinity(
+ /* [retval][out][retval][out] */ WebSelectionAffinity *affinity);
+
+ virtual HRESULT STDMETHODCALLTYPE setEditable(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE isEditable(
+ /* [retval][out] */ BOOL *isEditable);
+
+ virtual HRESULT STDMETHODCALLTYPE setTypingStyle(
+ /* [in] */ IDOMCSSStyleDeclaration *style);
+
+ virtual HRESULT STDMETHODCALLTYPE typingStyle(
+ /* [retval][out] */ IDOMCSSStyleDeclaration **style);
+
+ virtual HRESULT STDMETHODCALLTYPE setSmartInsertDeleteEnabled(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE smartInsertDeleteEnabled(
+ /* [in] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setContinuousSpellCheckingEnabled(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE isContinuousSpellCheckingEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE spellCheckerDocumentTag(
+ /* [retval][out] */ int *tag);
+
+ virtual HRESULT STDMETHODCALLTYPE undoManager(
+ /* [retval][out] */ IWebUndoManager **manager);
+
+ virtual HRESULT STDMETHODCALLTYPE setEditingDelegate(
+ /* [in] */ IWebEditingDelegate *d);
+
+ virtual HRESULT STDMETHODCALLTYPE editingDelegate(
+ /* [retval][out] */ IWebEditingDelegate **d);
+
+ virtual HRESULT STDMETHODCALLTYPE styleDeclarationWithText(
+ /* [in] */ BSTR text,
+ /* [retval][out] */ IDOMCSSStyleDeclaration **style);
+
+ virtual HRESULT STDMETHODCALLTYPE hasSelectedRange(
+ /* [retval][out] */ BOOL *hasSelectedRange);
+
+ virtual HRESULT STDMETHODCALLTYPE cutEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE copyEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE deleteEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE editingEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE isGrammarCheckingEnabled(
+ /* [retval][out] */ BOOL *enabled);
+
+ virtual HRESULT STDMETHODCALLTYPE setGrammarCheckingEnabled(
+ BOOL enabled);
+
+ // IWebViewUndoableEditing
+
+ virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithNode(
+ /* [in] */ IDOMNode *node);
+
+ virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithText(
+ /* [in] */ BSTR text);
+
+ virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithMarkupString(
+ /* [in] */ BSTR markupString);
+
+ virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithArchive(
+ /* [in] */ IWebArchive *archive);
+
+ virtual HRESULT STDMETHODCALLTYPE deleteSelection( void);
+
+ virtual HRESULT STDMETHODCALLTYPE clearSelection(void);
+
+ virtual HRESULT STDMETHODCALLTYPE applyStyle(
+ /* [in] */ IDOMCSSStyleDeclaration *style);
+
+ // IWebViewEditingActions
+
+ virtual HRESULT STDMETHODCALLTYPE copy(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE cut(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE paste(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE copyURL(
+ /* [in] */ BSTR url);
+
+ virtual HRESULT STDMETHODCALLTYPE copyFont(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteFont(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE delete_(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteAsPlainText(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE pasteAsRichText(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE changeFont(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE changeAttributes(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE changeDocumentBackgroundColor(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE changeColor(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE alignCenter(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE alignJustified(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE alignLeft(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE alignRight(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE checkSpelling(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE showGuessPanel(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE performFindPanelAction(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE startSpeaking(
+ /* [in] */ IUnknown *sender);
+
+ virtual HRESULT STDMETHODCALLTYPE stopSpeaking(
+ /* [in] */ IUnknown *sender);
+
+ // IWebNotificationObserver
+
+ virtual HRESULT STDMETHODCALLTYPE onNotify(
+ /* [in] */ IWebNotification *notification);
+
+ // IWebViewPrivate
+ virtual HRESULT STDMETHODCALLTYPE setCustomDropTarget(
+ /* [in] */ IDropTarget* dt);
+
+ virtual HRESULT STDMETHODCALLTYPE removeCustomDropTarget();
+
+ virtual HRESULT STDMETHODCALLTYPE setInViewSourceMode(
+ /* [in] */ BOOL flag);
+
+ virtual HRESULT STDMETHODCALLTYPE inViewSourceMode(
+ /* [retval][out] */ BOOL* flag);
+
+ virtual HRESULT STDMETHODCALLTYPE viewWindow(
+ /* [retval][out] */ OLE_HANDLE *window);
+
+ virtual HRESULT STDMETHODCALLTYPE setFormDelegate(
+ /* [in] */ IWebFormDelegate *formDelegate);
+
+ virtual HRESULT STDMETHODCALLTYPE formDelegate(
+ /* [retval][out] */ IWebFormDelegate **formDelegate);
+
+ virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegatePrivate(
+ /* [in] */ IWebFrameLoadDelegatePrivate *frameLoadDelegatePrivate);
+
+ virtual HRESULT STDMETHODCALLTYPE frameLoadDelegatePrivate(
+ /* [retval][out] */ IWebFrameLoadDelegatePrivate **frameLoadDelegatePrivate);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollOffset(
+ /* [retval][out] */ LPPOINT offset);
+
+ virtual HRESULT STDMETHODCALLTYPE scrollBy(
+ /* [in] */ LPPOINT offset);
+
+ virtual HRESULT STDMETHODCALLTYPE visibleContentRect(
+ /* [retval][out] */ LPRECT rect);
+
+ virtual HRESULT STDMETHODCALLTYPE updateFocusedAndActiveState();
+
+ virtual HRESULT STDMETHODCALLTYPE executeCoreCommandByName(BSTR name, BSTR value);
+
+ virtual HRESULT STDMETHODCALLTYPE markAllMatchesForText(
+ BSTR search, BOOL caseSensitive, BOOL highlight, UINT limit, UINT* matches);
+
+ virtual HRESULT STDMETHODCALLTYPE unmarkAllTextMatches();
+
+ virtual HRESULT STDMETHODCALLTYPE rectsForTextMatches(
+ IEnumTextMatches** pmatches);
+
+ virtual HRESULT STDMETHODCALLTYPE generateSelectionImage(
+ BOOL forceWhiteText, OLE_HANDLE* hBitmap);
+
+ virtual HRESULT STDMETHODCALLTYPE selectionRect(
+ RECT* rc);
+
+ virtual HRESULT STDMETHODCALLTYPE DragEnter(
+ IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
+
+ virtual HRESULT STDMETHODCALLTYPE DragOver(
+ DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
+
+ virtual HRESULT STDMETHODCALLTYPE DragLeave();
+
+ virtual HRESULT STDMETHODCALLTYPE Drop(
+ IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
+
+ virtual HRESULT STDMETHODCALLTYPE canHandleRequest(
+ IWebURLRequest *request,
+ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE clearFocusNode();
+
+ virtual HRESULT STDMETHODCALLTYPE setInitialFocus(
+ /* [in] */ BOOL forward);
+
+ virtual HRESULT STDMETHODCALLTYPE setTabKeyCyclesThroughElements(
+ /* [in] */ BOOL cycles);
+
+ virtual HRESULT STDMETHODCALLTYPE tabKeyCyclesThroughElements(
+ /* [retval][out] */ BOOL *result);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowSiteSpecificHacks(
+ /* [in] */ BOOL allows);
+
+ virtual HRESULT STDMETHODCALLTYPE addAdditionalPluginPath(
+ /* [in] */ BSTR path);
+
+ virtual HRESULT STDMETHODCALLTYPE loadBackForwardListFromOtherView(
+ /* [in] */ IWebView *otherView);
+
+ virtual HRESULT STDMETHODCALLTYPE inspector(
+ /* [retval][out] */ IWebInspector**);
+
+ virtual HRESULT STDMETHODCALLTYPE clearUndoRedoOperations( void);
+ virtual HRESULT STDMETHODCALLTYPE shouldClose(
+ /* [retval][out] */ BOOL* result);
+
+ virtual HRESULT STDMETHODCALLTYPE setProhibitsMainFrameScrolling(BOOL);
+ virtual HRESULT STDMETHODCALLTYPE setShouldApplyMacFontAscentHack(BOOL);
+
+ virtual HRESULT STDMETHODCALLTYPE windowAncestryDidChange();
+
+ // WebView
+ WebCore::Page* page();
+ bool handleMouseEvent(UINT, WPARAM, LPARAM);
+ void setMouseActivated(bool flag) { m_mouseActivated = flag; }
+ bool handleContextMenuEvent(WPARAM, LPARAM);
+ bool onMeasureItem(WPARAM, LPARAM);
+ bool onDrawItem(WPARAM, LPARAM);
+ bool onInitMenuPopup(WPARAM, LPARAM);
+ bool onUninitMenuPopup(WPARAM, LPARAM);
+ void performContextMenuAction(WPARAM, LPARAM, bool byPosition);
+ bool mouseWheel(WPARAM, LPARAM, bool isHorizontal);
+ bool execCommand(WPARAM wParam, LPARAM lParam);
+ bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false);
+ bool keyUp(WPARAM, LPARAM, bool systemKeyDown = false);
+ bool keyPress(WPARAM, LPARAM, bool systemKeyDown = false);
+ bool inResizer(LPARAM lParam);
+ void paint(HDC, LPARAM);
+ void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect);
+ void paintIntoWindow(HDC bitmapDC, HDC windowDC, const WebCore::IntRect& dirtyRect);
+ bool ensureBackingStore();
+ void addToDirtyRegion(const WebCore::IntRect&);
+ void addToDirtyRegion(HRGN);
+ void scrollBackingStore(WebCore::FrameView*, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
+ void updateBackingStore(WebCore::FrameView*, HDC, bool backingStoreCompletelyDirty);
+ void deleteBackingStore();
+ void frameRect(RECT* rect);
+ void closeWindow();
+ void closeWindowSoon();
+ void close();
+ bool didClose() const { return m_didClose; }
+
+ bool onIMEStartComposition();
+ bool onIMEComposition(LPARAM);
+ bool onIMEEndComposition();
+ bool onIMEChar(WPARAM, LPARAM);
+ bool onIMENotify(WPARAM, LPARAM, LRESULT*);
+ bool onIMERequest(WPARAM, LPARAM, LRESULT*);
+ bool onIMESelect(WPARAM, LPARAM);
+ bool onIMESetContext(WPARAM, LPARAM);
+ void selectionChanged();
+ void resetIME(WebCore::Frame*);
+ void setInputMethodState(bool);
+
+ HRESULT registerDragDrop();
+ HRESULT revokeDragDrop();
+
+ // Convenient to be able to violate the rules of COM here for easy movement to the frame.
+ WebFrame* topLevelFrame() { return m_mainFrame; }
+ const WebCore::String& userAgentForKURL(const WebCore::KURL& url);
+
+ static bool canHandleRequest(const WebCore::ResourceRequest&);
+
+ void setIsBeingDestroyed() { m_isBeingDestroyed = true; }
+ bool isBeingDestroyed() const { return m_isBeingDestroyed; }
+
+ const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
+ bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
+
+ bool isPainting() const { return m_paintCount > 0; }
+
+ void setToolTip(const WebCore::String&);
+
+ void registerForIconNotification(bool listen);
+ void dispatchDidReceiveIconFromWebFrame(WebFrame*);
+
+ HRESULT notifyDidAddIcon(IWebNotification*);
+ HRESULT notifyPreferencesChanged(IWebNotification*);
+
+ static void setCacheModel(WebCacheModel);
+ static WebCacheModel cacheModel();
+ static bool didSetCacheModel();
+ static WebCacheModel maxCacheModelInAnyInstance();
+
+ void updateActiveStateSoon() const;
+
+ HWND topLevelParent() const { return m_topLevelParent; }
+
+ void updateActiveState();
+
+protected:
+ HIMC getIMMContext();
+ void releaseIMMContext(HIMC);
+ static bool allowSiteSpecificHacks() { return s_allowSiteSpecificHacks; }
+ void preflightSpellChecker();
+ bool continuousCheckingAllowed();
+ void initializeToolTipWindow();
+ void closeWindowTimerFired(WebCore::Timer<WebView>*);
+ void prepareCandidateWindow(WebCore::Frame*, HIMC);
+ void updateSelectionForIME();
+ bool onIMERequestCharPosition(WebCore::Frame*, IMECHARPOSITION*, LRESULT*);
+ bool onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*, LRESULT*);
+ bool developerExtrasEnabled() const;
+
+ // AllWebViewSet functions
+ void addToAllWebViewsSet();
+ void removeFromAllWebViewsSet();
+
+ virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
+
+ ULONG m_refCount;
+ WebCore::String m_groupName;
+ HWND m_hostWindow;
+ HWND m_viewWindow;
+ WebFrame* m_mainFrame;
+ WebCore::Page* m_page;
+
+ OwnPtr<HBITMAP> m_backingStoreBitmap;
+ SIZE m_backingStoreSize;
+ OwnPtr<HRGN> m_backingStoreDirtyRegion;
+
+ COMPtr<IWebEditingDelegate> m_editingDelegate;
+ COMPtr<IWebFrameLoadDelegate> m_frameLoadDelegate;
+ COMPtr<IWebFrameLoadDelegatePrivate> m_frameLoadDelegatePrivate;
+ COMPtr<IWebUIDelegate> m_uiDelegate;
+ COMPtr<IWebUIDelegatePrivate> m_uiDelegatePrivate;
+ COMPtr<IWebFormDelegate> m_formDelegate;
+ COMPtr<IWebPolicyDelegate> m_policyDelegate;
+ COMPtr<IWebResourceLoadDelegate> m_resourceLoadDelegate;
+ COMPtr<IWebDownloadDelegate> m_downloadDelegate;
+ COMPtr<WebPreferences> m_preferences;
+ COMPtr<WebInspector> m_webInspector;
+
+ bool m_userAgentOverridden;
+ bool m_useBackForwardList;
+ WebCore::String m_userAgentCustom;
+ WebCore::String m_userAgentStandard;
+ float m_textSizeMultiplier;
+ WebCore::String m_overrideEncoding;
+ WebCore::String m_applicationName;
+ bool m_mouseActivated;
+ // WebCore dragging logic needs to be able to inspect the drag data
+ // this is updated in DragEnter/Leave/Drop
+ COMPtr<IDataObject> m_dragData;
+ COMPtr<IDropTargetHelper> m_dropTargetHelper;
+ UChar m_currentCharacterCode;
+ bool m_isBeingDestroyed;
+ unsigned m_paintCount;
+ bool m_hasSpellCheckerDocumentTag;
+ bool m_smartInsertDeleteEnabled;
+ bool m_didClose;
+ bool m_hasCustomDropTarget;
+ unsigned m_inIMEComposition;
+ HWND m_toolTipHwnd;
+ WebCore::String m_toolTip;
+
+ static bool s_allowSiteSpecificHacks;
+
+ WebCore::Timer<WebView> m_closeWindowTimer;
+ OwnPtr<TRACKMOUSEEVENT> m_mouseOutTracker;
+
+ HWND m_topLevelParent;
+};
+
+#endif