diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/win')
31 files changed, 0 insertions, 6874 deletions
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp deleted file mode 100644 index b6e45f2..0000000 --- a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "AccessibilityController.h" - -#include "AccessibilityUIElement.h" -#include "DumpRenderTree.h" -#include <JavaScriptCore/Assertions.h> -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <oleacc.h> - -AccessibilityController::AccessibilityController() -{ -} - -AccessibilityController::~AccessibilityController() -{ -} - -AccessibilityUIElement AccessibilityController::focusedElement() -{ - COMPtr<IAccessible> rootAccessible = rootElement().platformUIElement(); - - VARIANT vFocus; - if (FAILED(rootAccessible->get_accFocus(&vFocus))) - return 0; - - if (V_VT(&vFocus) == VT_I4) { - ASSERT(V_I4(&vFocus) == CHILDID_SELF); - // The root accessible object is the focused object. - return rootAccessible; - } - - ASSERT(V_VT(&vFocus) == VT_DISPATCH); - // We have an IDispatch; query for IAccessible. - return COMPtr<IAccessible>(Query, V_DISPATCH(&vFocus)); -} - -AccessibilityUIElement AccessibilityController::rootElement() -{ - COMPtr<IWebView> view; - if (FAILED(frame->webView(&view))) - return 0; - - COMPtr<IWebViewPrivate> viewPrivate(Query, view); - if (!viewPrivate) - return 0; - - HWND webViewWindow; - if (FAILED(viewPrivate->viewWindow((OLE_HANDLE*)&webViewWindow))) - return 0; - - // Get the root accessible object by querying for the accessible object for the - // WebView's window. - COMPtr<IAccessible> rootAccessible; - if (FAILED(AccessibleObjectFromWindow(webViewWindow, static_cast<DWORD>(OBJID_CLIENT), __uuidof(IAccessible), reinterpret_cast<void**>(&rootAccessible)))) - return 0; - - return rootAccessible; -} diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp deleted file mode 100644 index d835bb3..0000000 --- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "AccessibilityUIElement.h" - -#include <JavaScriptCore/JSStringRef.h> -#include <tchar.h> -#include <string> - -using std::wstring; - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) -{ -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) -{ -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ -} - -void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>&) -{ -} - -void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&) -{ -} - -void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children) -{ - long childCount; - if (FAILED(m_element->get_accChildCount(&childCount))) - return; - for (long i = 0; i < childCount; ++i) - children.append(getChildAtIndex(i)); -} - -AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) -{ - COMPtr<IDispatch> child; - VARIANT vChild; - ::VariantInit(&vChild); - V_VT(&vChild) = VT_I4; - // In MSAA, index 0 is the object itself. - V_I4(&vChild) = index + 1; - if (FAILED(m_element->get_accChild(vChild, &child))) - return 0; - return COMPtr<IAccessible>(Query, child); -} - -JSStringRef AccessibilityUIElement::allAttributes() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfDocumentLinks() -{ - return JSStringCreateWithCharacters(0, 0); -} -AccessibilityUIElement AccessibilityUIElement::titleUIElement() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfChildren() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::parameterizedAttributeNames() -{ - return JSStringCreateWithCharacters(0, 0); -} - -static VARIANT& self() -{ - static VARIANT vSelf; - static bool haveInitialized; - - if (!haveInitialized) { - ::VariantInit(&vSelf); - V_VT(&vSelf) = VT_I4; - V_I4(&vSelf) = CHILDID_SELF; - } - return vSelf; -} - -JSStringRef AccessibilityUIElement::role() -{ - VARIANT vRole; - if (FAILED(m_element->get_accRole(self(), &vRole))) - return JSStringCreateWithCharacters(0, 0); - ASSERT(V_VT(&vRole) == VT_I4); - TCHAR roleText[64] = {0}; - ::GetRoleText(V_I4(&vRole), roleText, ARRAYSIZE(roleText)); - return JSStringCreateWithCharacters(roleText, _tcslen(roleText)); -} - -JSStringRef AccessibilityUIElement::title() -{ - BSTR titleBSTR; - if (FAILED(m_element->get_accName(self(), &titleBSTR)) || !titleBSTR) - return JSStringCreateWithCharacters(0, 0); - wstring title(titleBSTR, SysStringLen(titleBSTR)); - ::SysFreeString(titleBSTR); - return JSStringCreateWithCharacters(title.data(), title.length()); -} - -JSStringRef AccessibilityUIElement::description() -{ - BSTR descriptionBSTR; - if (FAILED(m_element->get_accName(self(), &descriptionBSTR)) || !descriptionBSTR) - return JSStringCreateWithCharacters(0, 0); - wstring description(descriptionBSTR, SysStringLen(descriptionBSTR)); - ::SysFreeString(descriptionBSTR); - return JSStringCreateWithCharacters(description.data(), description.length()); -} - -double AccessibilityUIElement::width() -{ - long x, y, width, height; - if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) - return 0; - return width; -} - -double AccessibilityUIElement::height() -{ - long x, y, width, height; - if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) - return 0; - return height; -} - -double AccessibilityUIElement::intValue() -{ - BSTR valueBSTR; - if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) - return 0; - wstring value(valueBSTR, SysStringLen(valueBSTR)); - ::SysFreeString(valueBSTR); - TCHAR* ignored; - return _tcstod(value.data(), &ignored); -} - -double AccessibilityUIElement::minValue() -{ - return 0; -} - -double AccessibilityUIElement::maxValue() -{ - return 0; -} - -bool AccessibilityUIElement::supportsPressAction() -{ - return false; -} - -int AccessibilityUIElement::insertionPointLineNumber() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfRowHeaders() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfColumns() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfRows() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfVisibleCells() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributesOfHeader() -{ - return JSStringCreateWithCharacters(0, 0); -} - -int AccessibilityUIElement::indexInTable() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::rowIndexRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::columnIndexRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -int AccessibilityUIElement::lineForIndex(int) -{ - return 0; -} - -JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) -{ - return JSStringCreateWithCharacters(0, 0); -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) -{ - return 0; -} - -JSStringRef AccessibilityUIElement::selectedTextRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) -{ -} diff --git a/WebKitTools/DumpRenderTree/win/DraggingInfo.h b/WebKitTools/DumpRenderTree/win/DraggingInfo.h deleted file mode 100644 index 2ead457..0000000 --- a/WebKitTools/DumpRenderTree/win/DraggingInfo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 DraggingInfo_h -#define DraggingInfo_h - -#include <objidl.h> - -class DraggingInfo { -public: - DraggingInfo(IDataObject* object, IDropSource* source) - : m_object(object) - , m_source(source) - { - m_object->AddRef(); - m_source->AddRef(); - } - - ~DraggingInfo() - { - if (m_object) - m_object->Release(); - m_object = 0; - if (m_source) - m_source->Release(); - m_source = 0; - } - - IDataObject* dataObject() const { return m_object; } - IDropSource* dropSource() const { return m_source; } - -private: - IDataObject* m_object; - IDropSource* m_source; -}; - -#endif // !defined(DraggingInfo_h) diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp deleted file mode 100644 index b3b73a9..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ /dev/null @@ -1,1127 +0,0 @@ -/* - * Copyright (C) 2005, 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 "DumpRenderTree.h" - -#include "EditingDelegate.h" -#include "FrameLoadDelegate.h" -#include "LayoutTestController.h" -#include "PixelDumpSupport.h" -#include "PolicyDelegate.h" -#include "ResourceLoadDelegate.h" -#include "UIDelegate.h" -#include "WorkQueueItem.h" -#include "WorkQueue.h" - -#include <fcntl.h> -#include <io.h> -#include <math.h> -#include <pthread.h> -#include <shlwapi.h> -#include <stdio.h> -#include <string.h> -#include <tchar.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.h> -#include <windows.h> -#include <CFNetwork/CFURLCachePriv.h> -#include <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebCore/COMPtr.h> -#include <WebKit/ForEachCoClass.h> -#include <WebKit/WebKit.h> - -using namespace std; - -#ifndef NDEBUG -const LPWSTR TestPluginDir = L"TestNetscapePlugin_Debug"; -#else -const LPWSTR TestPluginDir = L"TestNetscapePlugin"; -#endif - -static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS"; -#define USE_MAC_FONTS - -const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow"; - -static bool dumpTree = true; -static bool dumpPixels; -static bool dumpAllPixels; -static bool printSeparators; -static bool leakChecking = false; -static bool threaded = false; -static bool forceComplexText = false; -static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; - -volatile bool done; -// This is the topmost frame that is loading, during a given load, or nil when no load is -// in progress. Usually this is the same as the main frame, but not always. In the case -// where a frameset is loaded, and then new content is loaded into one of the child frames, -// that child frame is the "topmost frame that is loading". -IWebFrame* topLoadingFrame; // !nil iff a load is in progress -static COMPtr<IWebHistoryItem> prevTestBFItem; // current b/f item at the end of the previous test -IWebPolicyDelegate* policyDelegate; -COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; -COMPtr<UIDelegate> sharedUIDelegate; -COMPtr<EditingDelegate> sharedEditingDelegate; -COMPtr<ResourceLoadDelegate> sharedResourceLoadDelegate; - -IWebFrame* frame; -HWND webViewWindow; - -LayoutTestController* gLayoutTestController = 0; -CFRunLoopTimerRef waitToDumpWatchdog = 0; - -const unsigned maxViewWidth = 800; -const unsigned maxViewHeight = 600; - -void setPersistentUserStyleSheetLocation(CFStringRef url) -{ - persistentUserStyleSheetLocation = url; -} - -wstring urlSuitableForTestResult(const wstring& url) -{ - if (!url.c_str() || url.find(L"file://") == wstring::npos) - return url; - - return PathFindFileNameW(url.c_str()); -} - -static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_DESTROY: - for (unsigned i = openWindows().size() - 1; i >= 0; --i) { - if (openWindows()[i] == hWnd) { - openWindows().remove(i); - windowToWebViewMap().remove(hWnd); - break; - } - } - return 0; - break; - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } -} - -static const wstring& exePath() -{ - static wstring path; - static bool initialized; - - if (initialized) - return path; - initialized = true; - - TCHAR buffer[MAX_PATH]; - GetModuleFileName(GetModuleHandle(0), buffer, ARRAYSIZE(buffer)); - path = buffer; - int lastSlash = path.rfind('\\'); - if (lastSlash != -1 && lastSlash + 1 < path.length()) - path = path.substr(0, lastSlash + 1); - - return path; -} - -static const wstring& fontsPath() -{ - static wstring path; - static bool initialized; - - if (initialized) - return path; - initialized = true; - - DWORD size = GetEnvironmentVariable(fontsEnvironmentVariable, 0, 0); - Vector<TCHAR> buffer(size); - if (GetEnvironmentVariable(fontsEnvironmentVariable, buffer.data(), buffer.size())) { - path = buffer.data(); - if (path[path.length() - 1] != '\\') - path.append(L"\\"); - return path; - } - - path = exePath() + TEXT("DumpRenderTree.resources\\"); - return path; -} - -#ifdef DEBUG_WEBKIT_HAS_SUFFIX -#define WEBKITDLL TEXT("WebKit_debug.dll") -#else -#define WEBKITDLL TEXT("WebKit.dll") -#endif - -static void initialize() -{ - if (HMODULE webKitModule = LoadLibrary(WEBKITDLL)) - if (FARPROC dllRegisterServer = GetProcAddress(webKitModule, "DllRegisterServer")) - dllRegisterServer(); - - // Init COM - OleInitialize(0); - - static LPCTSTR fontsToInstall[] = { - TEXT("AHEM____.ttf"), - TEXT("Apple Chancery.ttf"), - TEXT("Courier Bold.ttf"), - TEXT("Courier.ttf"), - TEXT("Helvetica Bold Oblique.ttf"), - TEXT("Helvetica Bold.ttf"), - TEXT("Helvetica Oblique.ttf"), - TEXT("Helvetica.ttf"), - TEXT("Helvetica Neue Bold Italic.ttf"), - TEXT("Helvetica Neue Bold.ttf"), - TEXT("Helvetica Neue Condensed Black.ttf"), - TEXT("Helvetica Neue Condensed Bold.ttf"), - TEXT("Helvetica Neue Italic.ttf"), - TEXT("Helvetica Neue Light Italic.ttf"), - TEXT("Helvetica Neue Light.ttf"), - TEXT("Helvetica Neue UltraLight Italic.ttf"), - TEXT("Helvetica Neue UltraLight.ttf"), - TEXT("Helvetica Neue.ttf"), - TEXT("Lucida Grande.ttf"), - TEXT("Lucida Grande Bold.ttf"), - TEXT("Monaco.ttf"), - TEXT("Papyrus.ttf"), - TEXT("Times Bold Italic.ttf"), - TEXT("Times Bold.ttf"), - TEXT("Times Italic.ttf"), - TEXT("Times Roman.ttf"), - TEXT("WebKit Layout Tests.ttf"), - TEXT("WebKitWeightWatcher100.ttf"), - TEXT("WebKitWeightWatcher200.ttf"), - TEXT("WebKitWeightWatcher300.ttf"), - TEXT("WebKitWeightWatcher400.ttf"), - TEXT("WebKitWeightWatcher500.ttf"), - TEXT("WebKitWeightWatcher600.ttf"), - TEXT("WebKitWeightWatcher700.ttf"), - TEXT("WebKitWeightWatcher800.ttf"), - TEXT("WebKitWeightWatcher900.ttf") - }; - - wstring resourcesPath = fontsPath(); - - COMPtr<IWebTextRenderer> textRenderer; - if (SUCCEEDED(CoCreateInstance(CLSID_WebTextRenderer, 0, CLSCTX_ALL, IID_IWebTextRenderer, (void**)&textRenderer))) - for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i) - textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str()); - - // Register a host window - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = DumpRenderTreeWndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = GetModuleHandle(0); - wcex.hIcon = 0; - wcex.hCursor = LoadCursor(0, IDC_ARROW); - wcex.hbrBackground = 0; - wcex.lpszMenuName = 0; - wcex.lpszClassName = kDumpRenderTreeClassName; - wcex.hIconSm = 0; - - RegisterClassEx(&wcex); -} - -void displayWebView() -{ - ::InvalidateRect(webViewWindow, 0, TRUE); - ::UpdateWindow(webViewWindow); -} - -void dumpFrameScrollPosition(IWebFrame* frame) -{ - if (!frame) - return; - - COMPtr<IWebFramePrivate> framePrivate; - if (FAILED(frame->QueryInterface(&framePrivate))) - return; - - SIZE scrollPosition; - if (FAILED(framePrivate->scrollOffset(&scrollPosition))) - return; - - if (abs(scrollPosition.cx) > 0.00000001 || abs(scrollPosition.cy) > 0.00000001) { - COMPtr<IWebFrame> parent; - if (FAILED(frame->parentFrame(&parent))) - return; - if (parent) { - BSTR name; - if (FAILED(frame->name(&name))) - return; - printf("frame '%S' ", name ? name : L""); - SysFreeString(name); - } - printf("scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy); - } - - if (::gLayoutTestController->dumpChildFrameScrollPositions()) { - COMPtr<IEnumVARIANT> enumKids; - if (FAILED(frame->childFrames(&enumKids))) - return; - VARIANT var; - VariantInit(&var); - while (enumKids->Next(1, &var, 0) == S_OK) { - ASSERT(V_VT(&var) == VT_UNKNOWN); - COMPtr<IWebFrame> framePtr; - V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr); - dumpFrameScrollPosition(framePtr.get()); - VariantClear(&var); - } - } -} - -static wstring dumpFramesAsText(IWebFrame* frame) -{ - if (!frame) - return L""; - - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return L""; - - COMPtr<IDOMElement> documentElement; - if (FAILED(document->documentElement(&documentElement))) - return L""; - - wstring result; - - // Add header for all but the main frame. - COMPtr<IWebFrame> parent; - if (FAILED(frame->parentFrame(&parent))) - return L""; - if (parent) { - BSTR name = L""; - if (FAILED(frame->name(&name))) - return L""; - - result.append(L"\n--------\nFrame: '"); - result.append(name ? name : L"", SysStringLen(name)); - result.append(L"'\n--------\n"); - - SysFreeString(name); - } - - BSTR innerText = 0; - COMPtr<IDOMElementPrivate> docPrivate; - if (SUCCEEDED(documentElement->QueryInterface(&docPrivate))) - docPrivate->innerText(&innerText); - - result.append(innerText ? innerText : L"", SysStringLen(innerText)); - result.append(L"\n"); - - SysFreeString(innerText); - - if (::gLayoutTestController->dumpChildFramesAsText()) { - COMPtr<IEnumVARIANT> enumKids; - if (FAILED(frame->childFrames(&enumKids))) - return L""; - VARIANT var; - VariantInit(&var); - while (enumKids->Next(1, &var, 0) == S_OK) { - ASSERT(V_VT(&var) == VT_UNKNOWN); - COMPtr<IWebFrame> framePtr; - V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr); - result.append(dumpFramesAsText(framePtr.get())); - VariantClear(&var); - } - } - - return result; -} - -static int compareHistoryItems(const void* item1, const void* item2) -{ - COMPtr<IWebHistoryItemPrivate> itemA; - if (FAILED((*(COMPtr<IUnknown>*)item1)->QueryInterface(&itemA))) - return 0; - - COMPtr<IWebHistoryItemPrivate> itemB; - if (FAILED((*(COMPtr<IUnknown>*)item2)->QueryInterface(&itemB))) - return 0; - - BSTR targetA; - if (FAILED(itemA->target(&targetA))) - return 0; - - BSTR targetB; - if (FAILED(itemB->target(&targetB))) { - SysFreeString(targetA); - return 0; - } - - int result = wcsicmp(wstring(targetA, SysStringLen(targetA)).c_str(), wstring(targetB, SysStringLen(targetB)).c_str()); - SysFreeString(targetA); - SysFreeString(targetB); - return result; -} - -static void dumpHistoryItem(IWebHistoryItem* item, int indent, bool current) -{ - assert(item); - - int start = 0; - if (current) { - printf("curr->"); - start = 6; - } - for (int i = start; i < indent; i++) - putchar(' '); - - BSTR url; - if (FAILED(item->URLString(&url))) - return; - printf("%S", url ? url : L""); - SysFreeString(url); - - COMPtr<IWebHistoryItemPrivate> itemPrivate; - if (FAILED(item->QueryInterface(&itemPrivate))) - return; - - BSTR target; - if (FAILED(itemPrivate->target(&target))) - return; - if (SysStringLen(target)) - printf(" (in frame \"%S\")", target); - SysFreeString(target); - BOOL isTargetItem = FALSE; - if (FAILED(itemPrivate->isTargetItem(&isTargetItem))) - return; - if (isTargetItem) - printf(" **nav target**"); - putchar('\n'); - - unsigned kidsCount; - SAFEARRAY* arrPtr; - if (FAILED(itemPrivate->children(&kidsCount, &arrPtr)) || !kidsCount) - return; - - Vector<COMPtr<IUnknown> > kidsVector; - - LONG lowerBound; - if (FAILED(::SafeArrayGetLBound(arrPtr, 1, &lowerBound))) - goto exit; - - LONG upperBound; - if (FAILED(::SafeArrayGetUBound(arrPtr, 1, &upperBound))) - goto exit; - - LONG length = upperBound - lowerBound + 1; - if (!length) - goto exit; - ASSERT(length == kidsCount); - - IUnknown** safeArrayData; - if (FAILED(::SafeArrayAccessData(arrPtr, (void**)&safeArrayData))) - goto exit; - - for (int i = 0; i < length; ++i) - kidsVector.append(safeArrayData[i]); - ::SafeArrayUnaccessData(arrPtr); - - // must sort to eliminate arbitrary result ordering which defeats reproducible testing - qsort(kidsVector.data(), kidsCount, sizeof(kidsVector[0]), compareHistoryItems); - - for (unsigned i = 0; i < kidsCount; ++i) { - COMPtr<IWebHistoryItem> item; - kidsVector[i]->QueryInterface(&item); - dumpHistoryItem(item.get(), indent + 4, false); - } - -exit: - if (arrPtr && SUCCEEDED(::SafeArrayUnlock(arrPtr))) - ::SafeArrayDestroy(arrPtr); -} - -static void dumpBackForwardList(IWebView* webView) -{ - ASSERT(webView); - - printf("\n============== Back Forward List ==============\n"); - - COMPtr<IWebBackForwardList> bfList; - if (FAILED(webView->backForwardList(&bfList))) - return; - - // Print out all items in the list after prevTestBFItem, which was from the previous test - // Gather items from the end of the list, the print them out from oldest to newest - - Vector<COMPtr<IUnknown> > itemsToPrint; - - int forwardListCount; - if (FAILED(bfList->forwardListCount(&forwardListCount))) - return; - - for (int i = forwardListCount; i > 0; --i) { - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(i, &item))) - return; - // something is wrong if the item from the last test is in the forward part of the b/f list - assert(item != prevTestBFItem); - COMPtr<IUnknown> itemUnknown; - item->QueryInterface(&itemUnknown); - itemsToPrint.append(itemUnknown); - } - - COMPtr<IWebHistoryItem> currentItem; - if (FAILED(bfList->currentItem(¤tItem))) - return; - - assert(currentItem != prevTestBFItem); - COMPtr<IUnknown> currentItemUnknown; - currentItem->QueryInterface(¤tItemUnknown); - itemsToPrint.append(currentItemUnknown); - int currentItemIndex = itemsToPrint.size() - 1; - - int backListCount; - if (FAILED(bfList->backListCount(&backListCount))) - return; - - for (int i = -1; i >= -backListCount; --i) { - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(i, &item))) - return; - if (item == prevTestBFItem) - break; - COMPtr<IUnknown> itemUnknown; - item->QueryInterface(&itemUnknown); - itemsToPrint.append(itemUnknown); - } - - for (int i = itemsToPrint.size() - 1; i >= 0; --i) { - COMPtr<IWebHistoryItem> historyItemToPrint; - itemsToPrint[i]->QueryInterface(&historyItemToPrint); - dumpHistoryItem(historyItemToPrint.get(), 8, i == currentItemIndex); - } - - printf("===============================================\n"); -} - -static void dumpBackForwardListForAllWindows() -{ - unsigned count = openWindows().size(); - for (unsigned i = 0; i < count; i++) { - HWND window = openWindows()[i]; - IWebView* webView = windowToWebViewMap().get(window); - dumpBackForwardList(webView); - } -} - -void dump() -{ - COMPtr<IWebDataSource> dataSource; - if (SUCCEEDED(frame->dataSource(&dataSource))) { - COMPtr<IWebURLResponse> response; - if (SUCCEEDED(dataSource->response(&response)) && response) { - BSTR mimeType; - if (SUCCEEDED(response->MIMEType(&mimeType))) - ::gLayoutTestController->setDumpAsText(::gLayoutTestController->dumpAsText() | !_tcscmp(mimeType, TEXT("text/plain"))); - SysFreeString(mimeType); - } - } - - BSTR resultString = 0; - - if (dumpTree) { - if (::gLayoutTestController->dumpAsText()) { - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); - wstring result = dumpFramesAsText(frame); - resultString = SysAllocStringLen(result.data(), result.size()); - } else { - bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg\\W3C-SVG-1.1") != string::npos); - unsigned width; - unsigned height; - if (isSVGW3CTest) { - width = 480; - height = 360; - } else { - width = maxViewWidth; - height = maxViewHeight; - } - - ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); - ::InvalidateRect(webViewWindow, 0, TRUE); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); - - COMPtr<IWebFramePrivate> framePrivate; - if (FAILED(frame->QueryInterface(&framePrivate))) - goto fail; - framePrivate->renderTreeAsExternalRepresentation(&resultString); - } - - if (!resultString) - printf("ERROR: nil result from %s", ::gLayoutTestController->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation"); - else { - unsigned stringLength = SysStringLen(resultString); - int bufferSize = ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, 0, 0, 0, 0); - char* buffer = (char*)malloc(bufferSize + 1); - ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, buffer, bufferSize + 1, 0, 0); - fwrite(buffer, 1, bufferSize, stdout); - free(buffer); - if (!::gLayoutTestController->dumpAsText()) - dumpFrameScrollPosition(frame); - } - if (::gLayoutTestController->dumpBackForwardList()) - dumpBackForwardListForAllWindows(); - } - - if (printSeparators) { - puts("#EOF"); // terminate the content block - fputs("#EOF\n", stderr); - fflush(stdout); - fflush(stderr); - } - - if (dumpPixels) { - if (!gLayoutTestController->dumpAsText() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive()) - dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash()); - } - - printf("#EOF\n"); // terminate the (possibly empty) pixels block - fflush(stdout); - -fail: - SysFreeString(resultString); - // This will exit from our message loop - PostQuitMessage(0); - done = true; -} - -static bool shouldLogFrameLoadDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "loading/"); -} - -static void resetWebViewToConsistentStateBeforeTesting() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - webView->setPolicyDelegate(0); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (webIBActions) { - webIBActions->makeTextStandardSize(0); - webIBActions->resetPageZoom(0); - } - - COMPtr<IWebPreferences> preferences; - if (SUCCEEDED(webView->preferences(&preferences))) { - preferences->setPrivateBrowsingEnabled(FALSE); - preferences->setJavaScriptCanOpenWindowsAutomatically(TRUE); - - if (persistentUserStyleSheetLocation) { - Vector<wchar_t> urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get())); - CFStringGetCharacters(persistentUserStyleSheetLocation.get(), CFRangeMake(0, CFStringGetLength(persistentUserStyleSheetLocation.get())), (UniChar *)urlCharacters.data()); - BSTR url = SysAllocStringLen(urlCharacters.data(), urlCharacters.size()); - preferences->setUserStyleSheetLocation(url); - SysFreeString(url); - preferences->setUserStyleSheetEnabled(TRUE); - } else - preferences->setUserStyleSheetEnabled(FALSE); - - COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); - if (prefsPrivate) { - prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); - prefsPrivate->setDeveloperExtrasEnabled(FALSE); - } - } - - COMPtr<IWebViewEditing> viewEditing; - if (SUCCEEDED(webView->QueryInterface(&viewEditing))) - viewEditing->setSmartInsertDeleteEnabled(TRUE); - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (SUCCEEDED(webViewPrivate->inspector(&inspector))) - inspector->setJavaScriptProfilingEnabled(FALSE); - - HWND viewWindow; - if (SUCCEEDED(webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))) && viewWindow) - SetFocus(viewWindow); - - webViewPrivate->clearMainFrameName(); -} - -static void runTest(const string& testPathOrURL) -{ - static BSTR methodBStr = SysAllocString(TEXT("GET")); - - // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows. - string pathOrURL(testPathOrURL); - string expectedPixelHash; - - size_t separatorPos = pathOrURL.find("'"); - if (separatorPos != string::npos) { - pathOrURL = string(testPathOrURL, 0, separatorPos); - expectedPixelHash = string(testPathOrURL, separatorPos + 1); - } - - BSTR urlBStr; - - CFStringRef str = CFStringCreateWithCString(0, pathOrURL.c_str(), kCFStringEncodingWindowsLatin1); - CFURLRef url = CFURLCreateWithString(0, str, 0); - - if (!url) - url = CFURLCreateWithFileSystemPath(0, str, kCFURLWindowsPathStyle, false); - - CFRelease(str); - - str = CFURLGetString(url); - - CFIndex length = CFStringGetLength(str); - UniChar* buffer = new UniChar[length]; - - CFStringGetCharacters(str, CFRangeMake(0, length), buffer); - urlBStr = SysAllocStringLen((OLECHAR*)buffer, length); - delete[] buffer; - - CFRelease(url); - - ::gLayoutTestController = new LayoutTestController(pathOrURL, expectedPixelHash); - done = false; - topLoadingFrame = 0; - - if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) - gLayoutTestController->setDumpFrameLoadCallbacks(true); - - COMPtr<IWebHistory> history(Create, CLSID_WebHistory); - if (history) - history->setOptionalSharedHistory(0); - - resetWebViewToConsistentStateBeforeTesting(); - sharedUIDelegate->resetUndoManager(); - - prevTestBFItem = 0; - COMPtr<IWebView> webView; - if (SUCCEEDED(frame->webView(&webView))) { - COMPtr<IWebBackForwardList> bfList; - if (SUCCEEDED(webView->backForwardList(&bfList))) - bfList->currentItem(&prevTestBFItem); - } - - WorkQueue::shared()->clear(); - WorkQueue::shared()->setFrozen(false); - - HWND hostWindow; - webView->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - - COMPtr<IWebMutableURLRequest> request; - HRESULT hr = CoCreateInstance(CLSID_WebMutableURLRequest, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request); - if (FAILED(hr)) - goto exit; - - request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 60); - - request->setHTTPMethod(methodBStr); - frame->loadRequest(request.get()); - - MSG msg; - while (GetMessage(&msg, 0, 0, 0)) { - // We get spurious WM_MOUSELEAVE events which make event handling machinery think that mouse button - // is released during dragging (see e.g. fast\dynamic\layer-hit-test-crash.html). - // Mouse can never leave WebView during normal DumpRenderTree operation, so we just ignore all such events. - if (msg.message == WM_MOUSELEAVE) - continue; - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - frame->stopLoading(); - - if (::gLayoutTestController->closeRemainingWindowsWhenComplete()) { - Vector<HWND> windows = openWindows(); - unsigned size = windows.size(); - for (unsigned i = 0; i < size; i++) { - HWND window = windows[i]; - - // Don't try to close the main window - if (window == hostWindow) - continue; - - DestroyWindow(window); - } - } - -exit: - SysFreeString(urlBStr); - ::gLayoutTestController->deref(); - ::gLayoutTestController = 0; - - return; -} - -static void initializePreferences(IWebPreferences* preferences) -{ -#ifdef USE_MAC_FONTS - BSTR standardFamily = SysAllocString(TEXT("Times")); - BSTR fixedFamily = SysAllocString(TEXT("Courier")); - BSTR sansSerifFamily = SysAllocString(TEXT("Helvetica")); - BSTR cursiveFamily = SysAllocString(TEXT("Apple Chancery")); - BSTR fantasyFamily = SysAllocString(TEXT("Papyrus")); -#else - BSTR standardFamily = SysAllocString(TEXT("Times New Roman")); - BSTR fixedFamily = SysAllocString(TEXT("Courier New")); - BSTR sansSerifFamily = SysAllocString(TEXT("Arial")); - BSTR cursiveFamily = SysAllocString(TEXT("Comic Sans MS")); // Not actually cursive, but it's what IE and Firefox use. - BSTR fantasyFamily = SysAllocString(TEXT("Times New Roman")); -#endif - - preferences->setStandardFontFamily(standardFamily); - preferences->setFixedFontFamily(fixedFamily); - preferences->setSerifFontFamily(standardFamily); - preferences->setSansSerifFontFamily(sansSerifFamily); - preferences->setCursiveFontFamily(cursiveFamily); - preferences->setFantasyFontFamily(fantasyFamily); - - preferences->setAutosaves(FALSE); - preferences->setJavaEnabled(FALSE); - preferences->setPlugInsEnabled(TRUE); - preferences->setDOMPasteAllowed(TRUE); - preferences->setEditableLinkBehavior(WebKitEditableLinkOnlyLiveWithShiftKey); - preferences->setFontSmoothing(FontSmoothingTypeStandard); - preferences->setUsesPageCache(FALSE); - - SysFreeString(standardFamily); - SysFreeString(fixedFamily); - SysFreeString(sansSerifFamily); - SysFreeString(cursiveFamily); - SysFreeString(fantasyFamily); -} - -static Boolean pthreadEqualCallback(const void* value1, const void* value2) -{ - return (Boolean)pthread_equal(*(pthread_t*)value1, *(pthread_t*)value2); -} - -static CFDictionaryKeyCallBacks pthreadKeyCallbacks = { 0, 0, 0, 0, pthreadEqualCallback, 0 }; - -static pthread_mutex_t javaScriptThreadsMutex = PTHREAD_MUTEX_INITIALIZER; -static bool javaScriptThreadsShouldTerminate; - -static const int javaScriptThreadsCount = 4; -static CFMutableDictionaryRef javaScriptThreads() -{ - assert(pthread_mutex_trylock(&javaScriptThreadsMutex) == EBUSY); - static CFMutableDictionaryRef staticJavaScriptThreads; - if (!staticJavaScriptThreads) - staticJavaScriptThreads = CFDictionaryCreateMutable(0, 0, &pthreadKeyCallbacks, 0); - return staticJavaScriptThreads; -} - -// Loops forever, running a script and randomly respawning, until -// javaScriptThreadsShouldTerminate becomes true. -void* runJavaScriptThread(void* arg) -{ - const char* const script = - " \ - var array = []; \ - for (var i = 0; i < 10; i++) { \ - array.push(String(i)); \ - } \ - "; - - while (true) { - JSGlobalContextRef ctx = JSGlobalContextCreate(0); - JSStringRef scriptRef = JSStringCreateWithUTF8CString(script); - - JSValueRef exception = 0; - JSEvaluateScript(ctx, scriptRef, 0, 0, 1, &exception); - assert(!exception); - - JSGlobalContextRelease(ctx); - JSStringRelease(scriptRef); - - JSGarbageCollect(ctx); - - pthread_mutex_lock(&javaScriptThreadsMutex); - - // Check for cancellation. - if (javaScriptThreadsShouldTerminate) { - pthread_mutex_unlock(&javaScriptThreadsMutex); - return 0; - } - - // Respawn probabilistically. - if (rand() % 5 == 0) { - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - - pthread_t self = pthread_self(); - CFDictionaryRemoveValue(javaScriptThreads(), self.p); - CFDictionaryAddValue(javaScriptThreads(), pthread.p, 0); - - pthread_mutex_unlock(&javaScriptThreadsMutex); - return 0; - } - - pthread_mutex_unlock(&javaScriptThreadsMutex); - } -} - -static void startJavaScriptThreads(void) -{ - pthread_mutex_lock(&javaScriptThreadsMutex); - - for (int i = 0; i < javaScriptThreadsCount; i++) { - pthread_t pthread; - pthread_create(&pthread, 0, &runJavaScriptThread, 0); - pthread_detach(pthread); - CFDictionaryAddValue(javaScriptThreads(), pthread.p, 0); - } - - pthread_mutex_unlock(&javaScriptThreadsMutex); -} - -static void stopJavaScriptThreads(void) -{ - pthread_mutex_lock(&javaScriptThreadsMutex); - - javaScriptThreadsShouldTerminate = true; - - pthread_t* pthreads[javaScriptThreadsCount] = {0}; - int threadDictCount = CFDictionaryGetCount(javaScriptThreads()); - assert(threadDictCount == javaScriptThreadsCount); - CFDictionaryGetKeysAndValues(javaScriptThreads(), (const void**)pthreads, 0); - - pthread_mutex_unlock(&javaScriptThreadsMutex); - - for (int i = 0; i < javaScriptThreadsCount; i++) { - pthread_t* pthread = pthreads[i]; - pthread_join(*pthread, 0); - free(pthread); - } -} - -Vector<HWND>& openWindows() -{ - static Vector<HWND> vector; - return vector; -} - -HashMap<HWND, IWebView*>& windowToWebViewMap() -{ - static HashMap<HWND, IWebView*> map; - return map; -} - -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) -{ - HWND hostWindow = CreateWindowEx(WS_EX_TOOLWINDOW, kDumpRenderTreeClassName, TEXT("DumpRenderTree"), WS_POPUP, - -maxViewWidth, -maxViewHeight, maxViewWidth, maxViewHeight, 0, 0, GetModuleHandle(0), 0); - - IWebView* webView; - - HRESULT hr = CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void**)&webView); - if (FAILED(hr)) { - fprintf(stderr, "Failed to create CLSID_WebView instance, error 0x%x\n", hr); - return 0; - } - - if (FAILED(webView->setHostWindow((OLE_HANDLE)(ULONG64)hostWindow))) - return 0; - - RECT clientRect; - clientRect.bottom = clientRect.left = clientRect.top = clientRect.right = 0; - BSTR groupName = SysAllocString(L"org.webkit.DumpRenderTree"); - bool failed = FAILED(webView->initWithFrame(clientRect, 0, groupName)); - SysFreeString(groupName); - if (failed) - return 0; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return 0; - - viewPrivate->setShouldApplyMacFontAscentHack(TRUE); - viewPrivate->setAlwaysUsesComplexTextCodePath(forceComplexText); - - BSTR pluginPath = SysAllocStringLen(0, exePath().length() + _tcslen(TestPluginDir)); - _tcscpy(pluginPath, exePath().c_str()); - _tcscat(pluginPath, TestPluginDir); - failed = FAILED(viewPrivate->addAdditionalPluginDirectory(pluginPath)); - SysFreeString(pluginPath); - if (failed) - return 0; - - HWND viewWindow; - if (FAILED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) - return 0; - if (webViewWindow) - *webViewWindow = viewWindow; - - SetWindowPos(viewWindow, 0, 0, 0, maxViewWidth, maxViewHeight, 0); - ShowWindow(hostWindow, SW_SHOW); - - if (FAILED(webView->setFrameLoadDelegate(sharedFrameLoadDelegate.get()))) - return 0; - - if (FAILED(viewPrivate->setFrameLoadDelegatePrivate(sharedFrameLoadDelegate.get()))) - return 0; - - if (FAILED(webView->setUIDelegate(sharedUIDelegate.get()))) - return 0; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return 0; - - if (FAILED(viewEditing->setEditingDelegate(sharedEditingDelegate.get()))) - return 0; - - if (FAILED(webView->setResourceLoadDelegate(sharedResourceLoadDelegate.get()))) - return 0; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return 0; - - initializePreferences(preferences.get()); - - openWindows().append(hostWindow); - windowToWebViewMap().set(hostWindow, webView); - return webView; -} - -int main(int argc, char* argv[]) -{ - leakChecking = false; - - _setmode(1, _O_BINARY); - _setmode(2, _O_BINARY); - - initialize(); - - Vector<const char*> tests; - - for (int i = 1; i < argc; ++i) { - if (!stricmp(argv[i], "--threaded")) { - threaded = true; - continue; - } - - if (!stricmp(argv[i], "--dump-all-pixels")) { - dumpAllPixels = true; - continue; - } - - if (!stricmp(argv[i], "--pixel-tests")) { - dumpPixels = true; - continue; - } - - if (!stricmp(argv[i], "--complex-text")) { - forceComplexText = true; - continue; - } - - tests.append(argv[i]); - } - - policyDelegate = new PolicyDelegate(); - sharedFrameLoadDelegate.adoptRef(new FrameLoadDelegate); - sharedUIDelegate.adoptRef(new UIDelegate); - sharedEditingDelegate.adoptRef(new EditingDelegate); - sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate); - - COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow)); - if (!webView) - return -1; - - COMPtr<IWebIconDatabase> iconDatabase; - COMPtr<IWebIconDatabase> tmpIconDatabase; - if (FAILED(CoCreateInstance(CLSID_WebIconDatabase, 0, CLSCTX_ALL, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) - return -1; - if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) - return -1; - - if (FAILED(webView->mainFrame(&frame))) - return -1; - - CFURLCacheRemoveAllCachedResponses(CFURLCacheSharedURLCache()); - -#ifdef _DEBUG - _CrtMemState entryToMainMemCheckpoint; - if (leakChecking) - _CrtMemCheckpoint(&entryToMainMemCheckpoint); -#endif - - if (threaded) - startJavaScriptThreads(); - - if (tests.size() == 1 && !strcmp(tests[0], "-")) { - char filenameBuffer[2048]; - printSeparators = true; - while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { - char* newLineCharacter = strchr(filenameBuffer, '\n'); - if (newLineCharacter) - *newLineCharacter = '\0'; - - if (strlen(filenameBuffer) == 0) - continue; - - runTest(filenameBuffer); - } - } else { - printSeparators = tests.size() > 1; - for (int i = 0; i < tests.size(); i++) - runTest(tests[i]); - } - - if (threaded) - stopJavaScriptThreads(); - - delete policyDelegate; - frame->Release(); - -#ifdef _DEBUG - if (leakChecking) { - // dump leaks to stderr - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtMemDumpAllObjectsSince(&entryToMainMemCheckpoint); - } -#endif - - shutDownWebKit(); - - return 0; -} diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj deleted file mode 100644 index e094bde..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj +++ /dev/null @@ -1,411 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTree"
- ProjectGUID="{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
- RootNamespace="DumpRenderTree"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ProjectDir)\..\cg";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_CONSOLE"
- DisableSpecificWarnings="4146"
- ForcedIncludeFiles="DumpRenderTreePrefix.h"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
- AdditionalLibraryDirectories=""
- DelayLoadDLLs=""
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
- ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if "$(ARCHIVE_BUILD)"=="" (if not "$(PRODUCTION)"=="" exit /b)

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CFNetwork.resources" "$(WebKitOutputDir)\bin\CFNetwork.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\dnssd.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- 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%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ProjectDir)\..\cg";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_CONSOLE"
- DisableSpecificWarnings="4146"
- ForcedIncludeFiles="DumpRenderTreePrefix.h"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
- AdditionalLibraryDirectories=""
- DelayLoadDLLs=""
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
- ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if "$(ARCHIVE_BUILD)"=="" (if not "$(PRODUCTION)"=="" exit /b)

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CFNetwork.resources" "$(WebKitOutputDir)\bin\CFNetwork.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\dnssd.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
- />
- </Configuration>
- <Configuration
- Name="Debug_Internal|Win32"
- ConfigurationType="1"
- 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%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"

xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\DumpRenderTree\ForwardingHeaders\wtf"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(ProjectDir)\..\cg";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_CONSOLE;DEBUG_WEBKIT_HAS_SUFFIX"
- DisableSpecificWarnings="4146"
- ForcedIncludeFiles="DumpRenderTreePrefix.h"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib"
- AdditionalLibraryDirectories=""
- DelayLoadDLLs=""
- SubSystem="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- TypeLibraryFile="$(WebKitOutputDir)\lib\WebKit.tlb"
- ComponentFileName="WebKit$(WebKitDLLConfigSuffix)"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if "$(ARCHIVE_BUILD)"=="" (if not "$(PRODUCTION)"=="" exit /b)

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CFNetwork.resources" "$(WebKitOutputDir)\bin\CFNetwork.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\dnssd.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Controllers"
- >
- <File
- RelativePath="..\AccessibilityController.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityController.h"
- >
- </File>
- <File
- RelativePath=".\AccessibilityControllerWin.cpp"
- >
- </File>
- <File
- RelativePath=".\EventSender.cpp"
- >
- </File>
- <File
- RelativePath=".\EventSender.h"
- >
- </File>
- <File
- RelativePath="..\GCController.cpp"
- >
- </File>
- <File
- RelativePath="..\GCController.h"
- >
- </File>
- <File
- RelativePath=".\GCControllerWin.cpp"
- >
- </File>
- <File
- RelativePath="..\LayoutTestController.cpp"
- >
- </File>
- <File
- RelativePath="..\LayoutTestController.h"
- >
- </File>
- <File
- RelativePath=".\LayoutTestControllerWin.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Delegates"
- >
- <File
- RelativePath=".\EditingDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\EditingDelegate.h"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.h"
- >
- </File>
- <File
- RelativePath=".\PolicyDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\PolicyDelegate.h"
- >
- </File>
- <File
- RelativePath=".\ResourceLoadDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\ResourceLoadDelegate.h"
- >
- </File>
- <File
- RelativePath=".\UIDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\UIDelegate.h"
- >
- </File>
- </Filter>
- <File
- RelativePath="..\AccessibilityUIElement.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityUIElement.h"
- >
- </File>
- <File
- RelativePath=".\AccessibilityUIElementWin.cpp"
- >
- </File>
- <File
- RelativePath=".\DraggingInfo.h"
- >
- </File>
- <File
- RelativePath=".\DumpRenderTree.cpp"
- >
- </File>
- <File
- RelativePath="..\DumpRenderTree.h"
- >
- </File>
- <File
- RelativePath="..\DumpRenderTreePrefix.h"
- >
- </File>
- <File
- RelativePath=".\DumpRenderTreeWin.h"
- >
- </File>
- <File
- RelativePath=".\MD5.cpp"
- >
- </File>
- <File
- RelativePath=".\MD5.h"
- >
- </File>
- <File
- RelativePath=".\PixelDumpSupport.h"
- >
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.cpp"
- >
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.h"
- >
- </File>
- <File
- RelativePath=".\PixelDumpSupportWin.cpp"
- >
- </File>
- <File
- RelativePath="..\WorkQueue.cpp"
- >
- </File>
- <File
- RelativePath="..\WorkQueue.h"
- >
- </File>
- <File
- RelativePath="..\WorkQueueItem.h"
- >
- </File>
- <File
- RelativePath=".\WorkQueueItemWin.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h deleted file mode 100644 index 45ce0dc..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 DumpRenderTreeWin_h -#define DumpRenderTreeWin_h - -struct IWebFrame; -struct IWebPolicyDelegate; -struct IWebView; -typedef const struct __CFString* CFStringRef; -typedef struct HWND__* HWND; - -extern IWebFrame* topLoadingFrame; -extern IWebFrame* frame; -extern IWebPolicyDelegate* policyDelegate; - -extern HWND webViewWindow; - -#include <string> -#include <wtf/HashMap.h> -#include <wtf/Vector.h> - -std::wstring urlSuitableForTestResult(const std::wstring& url); -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); -Vector<HWND>& openWindows(); -HashMap<HWND, IWebView*>& windowToWebViewMap(); - -void setPersistentUserStyleSheetLocation(CFStringRef); - -#endif // DumpRenderTreeWin_h diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp b/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp deleted file mode 100644 index 32c02bd..0000000 --- a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* - * 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 "EditingDelegate.h" - -#include "DumpRenderTree.h" -#include "LayoutTestController.h" -#include <WebCore/COMPtr.h> -#include <wtf/Platform.h> -#include <JavaScriptCore/Assertions.h> -#include <string> -#include <tchar.h> - -using std::wstring; - -EditingDelegate::EditingDelegate() - : m_refCount(1) - , m_acceptsEditing(true) -{ -} - -// IUnknown -HRESULT STDMETHODCALLTYPE EditingDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebEditingDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebEditingDelegate)) - *ppvObject = static_cast<IWebEditingDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE EditingDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE EditingDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete this; - - return newRef; -} - -static wstring dumpPath(IDOMNode* node) -{ - ASSERT(node); - - wstring result; - - BSTR name; - if (FAILED(node->nodeName(&name))) - return result; - result.assign(name, SysStringLen(name)); - SysFreeString(name); - - COMPtr<IDOMNode> parent; - if (SUCCEEDED(node->parentNode(&parent))) - result += TEXT(" > ") + dumpPath(parent.get()); - - return result; -} - -static wstring dump(IDOMRange* range) -{ - ASSERT(range); - - int startOffset; - if (FAILED(range->startOffset(&startOffset))) - return 0; - - int endOffset; - if (FAILED(range->endOffset(&endOffset))) - return 0; - - COMPtr<IDOMNode> startContainer; - if (FAILED(range->startContainer(&startContainer))) - return 0; - - COMPtr<IDOMNode> endContainer; - if (FAILED(range->endContainer(&endContainer))) - return 0; - - wchar_t buffer[1024]; - _snwprintf(buffer, ARRAYSIZE(buffer), L"range from %ld of %s to %ld of %s", startOffset, dumpPath(startContainer.get()), endOffset, dumpPath(endContainer.get())); - return buffer; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldBeginEditingInDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldEndEditingInDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertNode( - /* [in] */ IWebView* webView, - /* [in] */ IDOMNode* node, - /* [in] */ IDOMRange* range, - /* [in] */ WebViewInsertAction action) -{ - static LPCTSTR insertactionstring[] = { - TEXT("WebViewInsertActionTyped"), - TEXT("WebViewInsertActionPasted"), - TEXT("WebViewInsertActionDropped"), - }; - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n"), dumpPath(node), dump(range), insertactionstring[action]); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldInsertText( - /* [in] */ IWebView* webView, - /* [in] */ BSTR text, - /* [in] */ IDOMRange* range, - /* [in] */ WebViewInsertAction action, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - static LPCTSTR insertactionstring[] = { - TEXT("WebViewInsertActionTyped"), - TEXT("WebViewInsertActionPasted"), - TEXT("WebViewInsertActionDropped"), - }; - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n"), text ? text : TEXT(""), dump(range), insertactionstring[action]); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldDeleteDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldDeleteDOMRange:%s\n"), dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeSelectedDOMRange( - /* [in] */ IWebView* webView, - /* [in] */ IDOMRange* currentRange, - /* [in] */ IDOMRange* proposedRange, - /* [in] */ WebSelectionAffinity selectionAffinity, - /* [in] */ BOOL stillSelecting, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - static LPCTSTR affinitystring[] = { - TEXT("NSSelectionAffinityUpstream"), - TEXT("NSSelectionAffinityDownstream") - }; - static LPCTSTR boolstring[] = { - TEXT("FALSE"), - TEXT("TRUE") - }; - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n"), dump(currentRange), dump(proposedRange), affinitystring[selectionAffinity], boolstring[stillSelecting]); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldApplyStyle( - /* [in] */ IWebView* webView, - /* [in] */ IDOMCSSStyleDeclaration* style, - /* [in] */ IDOMRange* range, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n"), TEXT("'style description'")/*[[style description] UTF8String]*/, dump(range)); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::shouldChangeTypingStyle( - /* [in] */ IWebView* webView, - /* [in] */ IDOMCSSStyleDeclaration* currentStyle, - /* [in] */ IDOMCSSStyleDeclaration* proposedStyle, - /* [retval][out] */ BOOL* result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n"), TEXT("'currentStyle description'"), TEXT("'proposedStyle description'")); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::doPlatformCommand( - /* [in] */ IWebView *webView, - /* [in] */ BSTR command, - /* [retval][out] */ BOOL *result) -{ - if (!result) { - ASSERT_NOT_REACHED(); - return E_POINTER; - } - - if (::gLayoutTestController->dumpEditingCallbacks() && !done) - _tprintf(TEXT("EDITING DELEGATE: doPlatformCommand:%s\n"), command ? command : TEXT("")); - - *result = m_acceptsEditing; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidBeginEditing( - /* [in] */ IWebNotification* notification) -{ - if (::gLayoutTestController->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChange( - /* [in] */ IWebNotification *notification) -{ - if (::gLayoutTestController->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidEndEditing( - /* [in] */ IWebNotification *notification) -{ - if (::gLayoutTestController->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidEndEditing:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeTypingStyle( - /* [in] */ IWebNotification *notification) -{ - if (::gLayoutTestController->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeSelection( - /* [in] */ IWebNotification *notification) -{ - if (::gLayoutTestController->dumpEditingCallbacks() && !done) { - BSTR name; - notification->name(&name); - _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeSelection:%s\n"), name ? name : TEXT("")); - SysFreeString(name); - } - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.h b/WebKitTools/DumpRenderTree/win/EditingDelegate.h deleted file mode 100644 index 6dba675..0000000 --- a/WebKitTools/DumpRenderTree/win/EditingDelegate.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 EditingDelegate_h -#define EditingDelegate_h - -#include <WebKit/WebKit.h> - -class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate { -public: - EditingDelegate(); - - void setAcceptsEditing(bool b) { m_acceptsEditing = b; } - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebEditingDelegate - virtual HRESULT STDMETHODCALLTYPE shouldBeginEditingInDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldEndEditingInDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldInsertNode( - /* [in] */ IWebView *webView, - /* [in] */ IDOMNode *node, - /* [in] */ IDOMRange *range, - /* [in] */ WebViewInsertAction action); - - virtual HRESULT STDMETHODCALLTYPE shouldInsertText( - /* [in] */ IWebView *webView, - /* [in] */ BSTR text, - /* [in] */ IDOMRange *range, - /* [in] */ WebViewInsertAction action, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldDeleteDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldChangeSelectedDOMRange( - /* [in] */ IWebView *webView, - /* [in] */ IDOMRange *currentRange, - /* [in] */ IDOMRange *proposedRange, - /* [in] */ WebSelectionAffinity selectionAffinity, - /* [in] */ BOOL stillSelecting, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldApplyStyle( - /* [in] */ IWebView *webView, - /* [in] */ IDOMCSSStyleDeclaration *style, - /* [in] */ IDOMRange *range, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE shouldChangeTypingStyle( - /* [in] */ IWebView *webView, - /* [in] */ IDOMCSSStyleDeclaration *currentStyle, - /* [in] */ IDOMCSSStyleDeclaration *proposedStyle, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE doPlatformCommand( - /* [in] */ IWebView *webView, - /* [in] */ BSTR command, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE webViewDidBeginEditing( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChange( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidEndEditing( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChangeTypingStyle( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE webViewDidChangeSelection( - /* [in] */ IWebNotification *notification); - - virtual HRESULT STDMETHODCALLTYPE undoManagerForWebView( - /* [in] */ IWebView *webView, - /* [retval][out] */ IWebUndoManager **undoManager) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE ignoreWordInSpellDocument( - /* [in] */ IWebView *view, - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE learnWord( - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE checkSpellingOfString( - /* [in] */ IWebView *view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ int *misspellingLocation, - /* [out] */ int *misspellingLength) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE checkGrammarOfString( - /* [in] */ IWebView *view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ IEnumWebGrammarDetails **grammarDetails, - /* [out] */ int *badGrammarLocation, - /* [out] */ int *badGrammarLength) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithGrammarString( - /* [in] */ BSTR string, - /* [in] */ int location, - /* [in] */ int length, - /* [in] */ BSTR userDescription, - /* [in] */ BSTR *guesses, - /* [in] */ int guessesCount) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithMisspelledWord( - /* [in] */ BSTR word) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE showSpellingUI( - /* [in] */ BOOL show) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE spellingUIIsShowing( - /* [retval][out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE guessesForWord( - /* [in] */ BSTR word, - /* [retval][out] */ IEnumSpellingGuesses **guesses) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE closeSpellDocument( - /* [in] */ IWebView *view) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE sharedSpellCheckerExists( - /* [retval][out] */ BOOL *exists) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE preflightChosenSpellServer( void) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE updateGrammar( void) { return E_NOTIMPL; } - -private: - bool m_acceptsEditing; - ULONG m_refCount; -}; - -#endif // !defined(EditingDelegate_h) diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp deleted file mode 100644 index efecc03..0000000 --- a/WebKitTools/DumpRenderTree/win/EventSender.cpp +++ /dev/null @@ -1,597 +0,0 @@ -/* - * 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 "EventSender.h" - -#include "DraggingInfo.h" -#include "DumpRenderTree.h" - -#include <WebCore/COMPtr.h> -#include <wtf/ASCIICType.h> -#include <wtf/Platform.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <JavaScriptCore/Assertions.h> -#include <WebKit/WebKit.h> -#include <windows.h> - -#define WM_DRT_SEND_QUEUED_EVENT (WM_APP+1) - -static bool down; -static bool dragMode = true; -static bool replayingSavedEvents; -static int timeOffset; -static POINT lastMousePosition; - -struct DelayedMessage { - MSG msg; - unsigned delay; -}; - -static DelayedMessage msgQueue[1024]; -static unsigned endOfQueue; -static unsigned startOfQueue; - -static bool didDragEnter; -DraggingInfo* draggingInfo = 0; - -static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - return JSValueMakeBoolean(context, dragMode); -} - -static bool setDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) -{ - dragMode = JSValueToBoolean(context, value); - return true; -} - -static JSValueRef getConstantCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) -{ - if (JSStringIsEqualToUTF8CString(propertyName, "WM_KEYDOWN")) - return JSValueMakeNumber(context, WM_KEYDOWN); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_KEYUP")) - return JSValueMakeNumber(context, WM_KEYUP); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_CHAR")) - return JSValueMakeNumber(context, WM_CHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_DEADCHAR")) - return JSValueMakeNumber(context, WM_DEADCHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSKEYDOWN")) - return JSValueMakeNumber(context, WM_SYSKEYDOWN); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSKEYUP")) - return JSValueMakeNumber(context, WM_SYSKEYUP); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSCHAR")) - return JSValueMakeNumber(context, WM_SYSCHAR); - if (JSStringIsEqualToUTF8CString(propertyName, "WM_SYSDEADCHAR")) - return JSValueMakeNumber(context, WM_SYSDEADCHAR); - ASSERT_NOT_REACHED(); - return JSValueMakeUndefined(context); -} - -static JSValueRef leapForwardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount > 0) { - msgQueue[endOfQueue].delay = JSValueToNumber(context, arguments[0], exception); - ASSERT(!exception || !*exception); - } - - return JSValueMakeUndefined(context); -} - -static DWORD currentEventTime() -{ - return ::GetTickCount() + timeOffset; -} - -static MSG makeMsg(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - MSG result = {0}; - result.hwnd = hwnd; - result.message = message; - result.wParam = wParam; - result.lParam = lParam; - result.time = currentEventTime(); - result.pt = lastMousePosition; - - return result; -} - -static LRESULT dispatchMessage(const MSG* msg) -{ - ASSERT(msg); - ::TranslateMessage(msg); - return ::DispatchMessage(msg); -} - -static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - down = true; - MSG msg = makeMsg(webViewWindow, WM_RBUTTONDOWN, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - dispatchMessage(&msg); - down = false; - msg = makeMsg(webViewWindow, WM_RBUTTONUP, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - dispatchMessage(&msg); - - return JSValueMakeUndefined(context); -} - -static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - down = true; - MSG msg = makeMsg(webViewWindow, WM_LBUTTONDOWN, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - if (!msgQueue[endOfQueue].delay) - dispatchMessage(&msg); - else { - // replaySavedEvents has the required logic to make leapForward delays work - msgQueue[endOfQueue++].msg = msg; - replaySavedEvents(); - } - - return JSValueMakeUndefined(context); -} - -static inline POINTL pointl(const POINT& point) -{ - POINTL result; - result.x = point.x; - result.y = point.y; - return result; -} - -static void doMouseUp(MSG msg) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - dispatchMessage(&msg); - down = false; - - if (draggingInfo) { - COMPtr<IWebView> webView; - COMPtr<IDropTarget> webViewDropTarget; - if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { - POINT screenPoint = msg.pt; - DWORD effect = 0; - ::ClientToScreen(webViewWindow, &screenPoint); - if (!didDragEnter) { - webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - didDragEnter = true; - } - HRESULT hr = draggingInfo->dropSource()->QueryContinueDrag(0, 0); - webViewDropTarget->DragOver(0, pointl(screenPoint), &effect); - if (hr == DRAGDROP_S_DROP && effect != DROPEFFECT_NONE) { - DWORD effect = 0; - webViewDropTarget->Drop(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - } else - webViewDropTarget->DragLeave(); - - delete draggingInfo; - draggingInfo = 0; - } - } -} - -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - MSG msg = makeMsg(webViewWindow, WM_LBUTTONUP, 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - - if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) { - msgQueue[endOfQueue++].msg = msg; - replaySavedEvents(); - } else - doMouseUp(msg); - - return JSValueMakeUndefined(context); -} - -static void doMouseMove(MSG msg) -{ - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - dispatchMessage(&msg); - - if (down && draggingInfo) { - POINT screenPoint = msg.pt; - ::ClientToScreen(webViewWindow, &screenPoint); - - IWebView* webView; - COMPtr<IDropTarget> webViewDropTarget; - if (SUCCEEDED(frame->webView(&webView)) && SUCCEEDED(webView->QueryInterface(IID_IDropTarget, (void**)&webViewDropTarget))) { - DWORD effect = 0; - if (didDragEnter) - webViewDropTarget->DragOver(MK_LBUTTON, pointl(screenPoint), &effect); - else { - webViewDropTarget->DragEnter(draggingInfo->dataObject(), 0, pointl(screenPoint), &effect); - didDragEnter = true; - } - draggingInfo->dropSource()->GiveFeedback(effect); - } - } -} - -static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 2) - return JSValueMakeUndefined(context); - - lastMousePosition.x = (int)JSValueToNumber(context, arguments[0], exception); - ASSERT(!exception || !*exception); - lastMousePosition.y = (int)JSValueToNumber(context, arguments[1], exception); - ASSERT(!exception || !*exception); - - MSG msg = makeMsg(webViewWindow, WM_MOUSEMOVE, down ? MK_LBUTTON : 0, MAKELPARAM(lastMousePosition.x, lastMousePosition.y)); - - if (dragMode && down && !replayingSavedEvents) { - msgQueue[endOfQueue++].msg = msg; - return JSValueMakeUndefined(context); - } - - doMouseMove(msg); - - return JSValueMakeUndefined(context); -} - -void replaySavedEvents() -{ - replayingSavedEvents = true; - - MSG msg = { 0 }; - - while (startOfQueue < endOfQueue && !msgQueue[startOfQueue].delay) { - msg = msgQueue[startOfQueue++].msg; - switch (msg.message) { - case WM_LBUTTONUP: - doMouseUp(msg); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - dispatchMessage(&msg); - break; - default: - // Not reached - break; - } - } - - int numQueuedMessages = endOfQueue - startOfQueue; - if (!numQueuedMessages) { - startOfQueue = 0; - endOfQueue = 0; - replayingSavedEvents = false; - ASSERT(!down); - return; - } - - if (msgQueue[startOfQueue].delay) { - ::Sleep(msgQueue[startOfQueue].delay); - msgQueue[startOfQueue].delay = 0; - } - - ::PostMessage(webViewWindow, WM_DRT_SEND_QUEUED_EVENT, 0, 0); - while (::GetMessage(&msg, webViewWindow, 0, 0)) { - // FIXME: Why do we get a WM_MOUSELEAVE? it breaks tests - if (msg.message == WM_MOUSELEAVE) - continue; - if (msg.message != WM_DRT_SEND_QUEUED_EVENT) { - dispatchMessage(&msg); - continue; - } - msg = msgQueue[startOfQueue++].msg; - switch (msg.message) { - case WM_LBUTTONUP: - doMouseUp(msg); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - dispatchMessage(&msg); - break; - default: - // Not reached - break; - } - if (startOfQueue >= endOfQueue) - break; - ::Sleep(msgQueue[startOfQueue].delay); - msgQueue[startOfQueue].delay = 0; - ::PostMessage(webViewWindow, WM_DRT_SEND_QUEUED_EVENT, 0, 0); - } - startOfQueue = 0; - endOfQueue = 0; - - replayingSavedEvents = false; -} - -static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 1) - return JSValueMakeUndefined(context); - - static const JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length"); - - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - JSStringRef character = JSValueToStringCopy(context, arguments[0], exception); - ASSERT(!*exception); - int virtualKeyCode; - int charCode = 0; - int keyData = 1; - bool needsShiftKeyModifier = false; - if (JSStringIsEqualToUTF8CString(character, "leftArrow")) { - virtualKeyCode = VK_LEFT; - keyData += KF_EXTENDED << 16; // In this case, extended means "not keypad". - } else if (JSStringIsEqualToUTF8CString(character, "rightArrow")) { - virtualKeyCode = VK_RIGHT; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "upArrow")) { - virtualKeyCode = VK_UP; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "downArrow")) { - virtualKeyCode = VK_DOWN; - keyData += KF_EXTENDED << 16; - } else if (JSStringIsEqualToUTF8CString(character, "pageUp")) - virtualKeyCode = VK_PRIOR; - else if (JSStringIsEqualToUTF8CString(character, "pageDown")) - virtualKeyCode = VK_NEXT; - else if (JSStringIsEqualToUTF8CString(character, "home")) - virtualKeyCode = VK_HOME; - else if (JSStringIsEqualToUTF8CString(character, "end")) - virtualKeyCode = VK_END; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - virtualKeyCode = VK_BACK; - else { - charCode = JSStringGetCharactersPtr(character)[0]; - virtualKeyCode = LOBYTE(VkKeyScan(charCode)); - if (WTF::isASCIIUpper(charCode)) - needsShiftKeyModifier = true; - } - JSStringRelease(character); - - BYTE keyState[256]; - if (argumentCount > 1 || needsShiftKeyModifier) { - ::GetKeyboardState(keyState); - - BYTE newKeyState[256]; - memcpy(newKeyState, keyState, sizeof(keyState)); - - if (needsShiftKeyModifier) - newKeyState[VK_SHIFT] = 0x80; - - if (argumentCount > 1) { - JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], exception); - if (modifiersArray) { - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); - for (int i = 0; i < modifiersCount; ++i) { - JSValueRef value = JSObjectGetPropertyAtIndex(context, modifiersArray, i, 0); - JSStringRef string = JSValueToStringCopy(context, value, 0); - if (JSStringIsEqualToUTF8CString(string, "ctrlKey")) - newKeyState[VK_CONTROL] = 0x80; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey")) - newKeyState[VK_SHIFT] = 0x80; - else if (JSStringIsEqualToUTF8CString(string, "altKey")) - newKeyState[VK_MENU] = 0x80; - - JSStringRelease(string); - } - } - } - - ::SetKeyboardState(newKeyState); - } - - MSG msg = makeMsg(webViewWindow, (::GetKeyState(VK_MENU) & 0x8000) ? WM_SYSKEYDOWN : WM_KEYDOWN, virtualKeyCode, keyData); - if (virtualKeyCode != 255) - dispatchMessage(&msg); - else { - // For characters that do not exist in the active keyboard layout, - // ::Translate will not work, so we post an WM_CHAR event ourselves. - ::PostMessage(webViewWindow, WM_CHAR, charCode, 0); - } - - // Tests expect that all messages are processed by the time keyDown() returns. - if (::PeekMessage(&msg, webViewWindow, WM_CHAR, WM_CHAR, PM_REMOVE) || ::PeekMessage(&msg, webViewWindow, WM_SYSCHAR, WM_SYSCHAR, PM_REMOVE)) - ::DispatchMessage(&msg); - - MSG msgUp = makeMsg(webViewWindow, (::GetKeyState(VK_MENU) & 0x8000) ? WM_SYSKEYUP : WM_KEYUP, virtualKeyCode, keyData); - ::DispatchMessage(&msgUp); - - if (argumentCount > 1 || needsShiftKeyModifier) - ::SetKeyboardState(keyState); - - return JSValueMakeUndefined(context); -} - -// eventSender.dispatchMessage(message, wParam, lParam, time = currentEventTime(), x = lastMousePosition.x, y = lastMousePosition.y) -static JSValueRef dispatchMessageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - if (argumentCount < 3) - return JSValueMakeUndefined(context); - - COMPtr<IWebFramePrivate> framePrivate; - if (SUCCEEDED(frame->QueryInterface(&framePrivate))) - framePrivate->layout(); - - MSG msg = {}; - msg.hwnd = webViewWindow; - msg.message = JSValueToNumber(context, arguments[0], exception); - ASSERT(!*exception); - msg.wParam = JSValueToNumber(context, arguments[1], exception); - ASSERT(!*exception); - msg.lParam = static_cast<ULONG_PTR>(JSValueToNumber(context, arguments[2], exception)); - ASSERT(!*exception); - if (argumentCount >= 4) { - msg.time = JSValueToNumber(context, arguments[3], exception); - ASSERT(!*exception); - } - if (!msg.time) - msg.time = currentEventTime(); - if (argumentCount >= 6) { - msg.pt.x = JSValueToNumber(context, arguments[4], exception); - ASSERT(!*exception); - msg.pt.y = JSValueToNumber(context, arguments[5], exception); - ASSERT(!*exception); - } else - msg.pt = lastMousePosition; - - ::DispatchMessage(&msg); - - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->makeTextLarger(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef textZoomOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->makeTextSmaller(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageInCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->zoomPageIn(0); - return JSValueMakeUndefined(context); -} - -static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return JSValueMakeUndefined(context); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (!webIBActions) - return JSValueMakeUndefined(context); - - webIBActions->zoomPageOut(0); - return JSValueMakeUndefined(context); -} - -static JSStaticFunction staticFunctions[] = { - { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "leapForward", leapForwardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "dispatchMessage", dispatchMessageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -static JSStaticValue staticValues[] = { - { "dragMode", getDragModeCallback, setDragModeCallback, kJSPropertyAttributeNone }, - { "WM_KEYDOWN", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_KEYUP", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_CHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_DEADCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSKEYDOWN", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSKEYUP", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { "WM_SYSDEADCHAR", getConstantCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } -}; - -static JSClassRef getClass(JSContextRef context) -{ - static JSClassRef eventSenderClass = 0; - - if (!eventSenderClass) { - JSClassDefinition classDefinition = {0}; - classDefinition.staticFunctions = staticFunctions; - classDefinition.staticValues = staticValues; - - eventSenderClass = JSClassCreate(&classDefinition); - } - - return eventSenderClass; -} - -JSObjectRef makeEventSender(JSContextRef context) -{ - down = false; - dragMode = true; - replayingSavedEvents = false; - timeOffset = 0; - lastMousePosition.x = 0; - lastMousePosition.y = 0; - - endOfQueue = 0; - startOfQueue = 0; - - didDragEnter = false; - draggingInfo = 0; - - return JSObjectMake(context, getClass(context), 0); -} diff --git a/WebKitTools/DumpRenderTree/win/EventSender.h b/WebKitTools/DumpRenderTree/win/EventSender.h deleted file mode 100644 index 9ae0aec..0000000 --- a/WebKitTools/DumpRenderTree/win/EventSender.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 EventSender_h -#define EventSender_h - -class DraggingInfo; - -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeEventSender(JSContextRef context); -void replaySavedEvents(); - -extern DraggingInfo* draggingInfo; - -#endif diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp deleted file mode 100644 index b18b961..0000000 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "FrameLoadDelegate.h" - -#include "AccessibilityController.h" -#include "DumpRenderTree.h" -#include "EventSender.h" -#include "GCController.h" -#include "LayoutTestController.h" -#include "WorkQueueItem.h" -#include "WorkQueue.h" -#include <WebCore/COMPtr.h> -#include <JavaScriptCore/Assertions.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <wtf/Vector.h> -#include <stdio.h> -#include <string> - -using std::string; - -static FrameLoadDelegate* g_delegateWaitingOnTimer; - -string BSTRtoString(BSTR bstr) -{ - int result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return string(); - - return string(utf8Vector.data(), utf8Vector.size() - 1); -} - -string descriptionSuitableForTestResult(IWebFrame* webFrame) -{ - COMPtr<IWebView> webView; - if (FAILED(webFrame->webView(&webView))) - return string(); - - COMPtr<IWebFrame> mainFrame; - if (FAILED(webView->mainFrame(&mainFrame))) - return string(); - - BSTR frameNameBSTR; - if (FAILED(webFrame->name(&frameNameBSTR)) || BSTRtoString(frameNameBSTR).empty() ) - return (webFrame == mainFrame) ? "main frame" : string(); - - string frameName = (webFrame == mainFrame) ? "main frame" : "frame"; - frameName += " \"" + BSTRtoString(frameNameBSTR) + "\""; - - SysFreeString(frameNameBSTR); - - return frameName; -} - -FrameLoadDelegate::FrameLoadDelegate() - : m_refCount(1) - , m_gcController(new GCController) - , m_accessibilityController(new AccessibilityController) -{ -} - -FrameLoadDelegate::~FrameLoadDelegate() -{ -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate)) - *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate2)) - *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate)) - *ppvObject = static_cast<IWebFrameLoadDelegatePrivate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE FrameLoadDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE FrameLoadDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didStartProvisionalLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - // Make sure we only set this once per test. If it gets cleared, and then set again, we might - // end up doing two dumps for one test. - if (!topLoadingFrame && !done) - topLoadingFrame = frame; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFailProvisionalLoadWithError\n", - descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - COMPtr<IWebViewPrivate> webViewPrivate; - HRESULT hr = webView->QueryInterface(&webViewPrivate); - if (FAILED(hr)) - return hr; - webViewPrivate->updateFocusedAndActiveState(); - - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didCommitLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame) -{ - if (::gLayoutTestController->dumpTitleChanges() && !done) - printf("TITLE CHANGED: %S\n", title ? title : L""); - return S_OK; -} - -void FrameLoadDelegate::processWork() -{ - // quit doing work once a load is in progress - while (!topLoadingFrame && WorkQueue::shared()->count()) { - WorkQueueItem* item = WorkQueue::shared()->dequeue(); - ASSERT(item); - item->invoke(); - } - - // if we didn't start a new load, then we finished all the commands, so we're ready to dump state - if (!topLoadingFrame && !::gLayoutTestController->waitToDump()) - dump(); -} - -static void CALLBACK processWorkTimer(HWND, UINT, UINT_PTR id, DWORD) -{ - ::KillTimer(0, id); - FrameLoadDelegate* d = g_delegateWaitingOnTimer; - g_delegateWaitingOnTimer = 0; - d->processWork(); -} - -void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame) -{ - if (frame != topLoadingFrame) - return; - - topLoadingFrame = 0; - WorkQueue::shared()->setFrozen(true); - - if (::gLayoutTestController->waitToDump()) - return; - - if (WorkQueue::shared()->count()) { - ASSERT(!g_delegateWaitingOnTimer); - g_delegateWaitingOnTimer = this; - ::SetTimer(0, 0, 0, processWorkTimer); - return; - } - - dump(); -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFinishLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - locationChangeDone(0, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailLoadWithError( - /* [in] */ IWebView* webView, - /* [in] */ IWebError* error, - /* [in] */ IWebFrame* forFrame) -{ - locationChangeDone(error, forFrame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didClearWindowObject( - /* [in] */ IWebView*webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame) -{ - JSValueRef exception = 0; - - ::gLayoutTestController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_gcController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - m_accessibilityController->makeWindowObject(context, windowObject, &exception); - ASSERT(!exception); - - JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); - JSValueRef eventSender = makeEventSender(context); - JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - JSStringRelease(eventSenderStr); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishDocumentLoadForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFinishDocumentLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - if (!done) { - COMPtr<IWebFramePrivate> webFramePrivate; - HRESULT hr = frame->QueryInterface(&webFramePrivate); - if (FAILED(hr)) - return hr; - unsigned pendingFrameUnloadEvents; - hr = webFramePrivate->pendingFrameUnloadEventCount(&pendingFrameUnloadEvents); - if (FAILED(hr)) - return hr; - if (pendingFrameUnloadEvents) - printf("%s - has %u onunload handler(s)\n", - descriptionSuitableForTestResult(frame).c_str(), pendingFrameUnloadEvents); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didHandleOnloadEventsForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didHandleOnloadEventsForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h deleted file mode 100644 index 1a134fc..0000000 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#ifndef FrameLoadDelegate_h -#define FrameLoadDelegate_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> - -class AccessibilityController; -class GCController; - -class FrameLoadDelegate : public IWebFrameLoadDelegate2, public IWebFrameLoadDelegatePrivate { -public: - FrameLoadDelegate(); - virtual ~FrameLoadDelegate(); - - void processWork(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebFrameLoadDelegate - virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didReceiveIcon( - /* [in] */ IWebView *webView, - /* [in] */ OLE_HANDLE image, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *forFrame); - - virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL( - /* [in] */ IWebView *webView, - /* [in] */ BSTR url, - /* [in] */ double delaySeconds, - /* [in] */ DATE fireDate, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( - /* [in] */ IWebView *sender, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; } - - // IWebFrameLoadDelegatePrivate - virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - // IWebFrameLoadDelegate2 - virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( - /* [in] */ IWebView* webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame); - -protected: - void locationChangeDone(IWebError*, IWebFrame*); - - ULONG m_refCount; - OwnPtr<GCController> m_gcController; - OwnPtr<AccessibilityController> m_accessibilityController; -}; - -#endif // FrameLoadDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp b/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp deleted file mode 100644 index 547aabc..0000000 --- a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 "GCController.h" - -#include "DumpRenderTree.h" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> - -void GCController::collect() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collect(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collectOnAlternateThread(waitUntilDone ? TRUE : FALSE); -} - -size_t GCController::getJSObjectCount() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) - return 0; - UINT objects = 0; - collector->objectCount(&objects); - return objects; -} diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj deleted file mode 100644 index 9da1a56..0000000 --- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj +++ /dev/null @@ -1,163 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiff"
- ProjectGUID="{59CC0547-70AC-499C-9B19-EC01C6F61137}"
- RootNamespace="ImageDiff"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
- AdditionalLibraryDirectories=""
- SubSystem="1"
- />
- <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="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if "$(ARCHIVE_BUILD)"=="" (if not "$(PRODUCTION)"=="" exit /b)

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt38.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\release.vsprops;$(WebKitLibrariesDir)\tools\vsprops\common.vsprops"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
- AdditionalLibraryDirectories=""
- SubSystem="1"
- />
- <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="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\bin"

if "$(ARCHIVE_BUILD)"=="" (if not "$(PRODUCTION)"=="" exit /b)

if not exist "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" exit /b

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CharacterSets" "$(WebKitOutputDir)\bin\CharacterSets"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt38.dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin38$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc38$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\cg\ImageDiffCG.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp deleted file mode 100644 index 275fcd3..0000000 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ /dev/null @@ -1,630 +0,0 @@ -/* - * 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 "LayoutTestController.h" - -#include "DumpRenderTree.h" -#include "EditingDelegate.h" -#include "PolicyDelegate.h" -#include "WorkQueue.h" -#include "WorkQueueItem.h" -#include <WebCore/COMPtr.h> -#include <wtf/Platform.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.h> -#include <JavaScriptCore/Assertions.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <WebKit/WebKit.h> -#include <string> -#include <CoreFoundation/CoreFoundation.h> -#include <shlwapi.h> -#include <shlguid.h> -#include <shobjidl.h> - -using std::string; -using std::wstring; - -static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath); - -LayoutTestController::~LayoutTestController() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - // reset webview-related states back to default values in preparation for next test - - COMPtr<IWebViewPrivate> viewPrivate; - if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) - viewPrivate->setTabKeyCyclesThroughElements(TRUE); - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - COMPtr<IWebEditingDelegate> delegate; - if (FAILED(viewEditing->editingDelegate(&delegate))) - return; - COMPtr<EditingDelegate> editingDelegate(Query, viewEditing.get()); - if (editingDelegate) - editingDelegate->setAcceptsEditing(TRUE); -} - -void LayoutTestController::addDisallowedURL(JSStringRef url) -{ - // FIXME: Implement! -} - -void LayoutTestController::clearBackForwardList() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebBackForwardList> backForwardList; - if (FAILED(webView->backForwardList(&backForwardList))) - return; - - COMPtr<IWebHistoryItem> item; - if (FAILED(backForwardList->currentItem(&item))) - return; - - // We clear the history by setting the back/forward list's capacity to 0 - // then restoring it back and adding back the current item. - int capacity; - if (FAILED(backForwardList->capacity(&capacity))) - return; - - backForwardList->setCapacity(0); - backForwardList->setCapacity(capacity); - backForwardList->addItem(item.get()); - backForwardList->goToItem(item.get()); -} - -JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name) -{ - // FIXME: Implement! - return 0; -} - -JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) -{ - // FIXME: Implement! - return 0; -} - -void LayoutTestController::display() -{ - displayWebView(); -} - -void LayoutTestController::keepWebHistory() -{ - COMPtr<IWebHistory> history(Create, CLSID_WebHistory); - if (!history) - return; - - COMPtr<IWebHistory> sharedHistory(Create, CLSID_WebHistory); - if (!sharedHistory) - return; - - history->setOptionalSharedHistory(sharedHistory.get()); -} - -void LayoutTestController::notifyDone() -{ - // Same as on mac. This can be shared. - if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count()) - dump(); - m_waitToDump = false; -} - -JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url) -{ - wstring input(JSStringGetCharactersPtr(url), JSStringGetLength(url)); - - wstring localPath; - if (!resolveCygwinPath(input, localPath)) { - printf("ERROR: Failed to resolve Cygwin path %S\n", input.c_str()); - return 0; - } - - return JSStringCreateWithCharacters(localPath.c_str(), localPath.length()); -} - -void LayoutTestController::queueBackNavigation(int howFarBack) -{ - // Same as on mac. This can be shared. - WorkQueue::shared()->queue(new BackItem(howFarBack)); -} - -void LayoutTestController::queueForwardNavigation(int howFarForward) -{ - // Same as on mac. This can be shared. - WorkQueue::shared()->queue(new ForwardItem(howFarForward)); -} - -static wstring jsStringRefToWString(JSStringRef jsStr) -{ - size_t length = JSStringGetLength(jsStr); - Vector<WCHAR> buffer(length + 1); - memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); - buffer[length] = '\0'; - - return buffer.data(); -} - -void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target) -{ - COMPtr<IWebDataSource> dataSource; - if (FAILED(frame->dataSource(&dataSource))) - return; - - COMPtr<IWebURLResponse> response; - if (FAILED(dataSource->response(&response)) || !response) - return; - - BSTR responseURLBSTR; - if (FAILED(response->URL(&responseURLBSTR))) - return; - wstring responseURL(responseURLBSTR, SysStringLen(responseURLBSTR)); - SysFreeString(responseURLBSTR); - - // FIXME: We should do real relative URL resolution here. - int lastSlash = responseURL.rfind('/'); - if (lastSlash != -1) - responseURL = responseURL.substr(0, lastSlash); - - wstring wURL = jsStringRefToWString(url); - wstring wAbsoluteURL = responseURL + TEXT("/") + wURL; - JSRetainPtr<JSStringRef> jsAbsoluteURL(Adopt, JSStringCreateWithCharacters(wAbsoluteURL.data(), wAbsoluteURL.length())); - - WorkQueue::shared()->queue(new LoadItem(jsAbsoluteURL.get(), target)); -} - -void LayoutTestController::queueReload() -{ - WorkQueue::shared()->queue(new ReloadItem); -} - -void LayoutTestController::queueScript(JSStringRef script) -{ - WorkQueue::shared()->queue(new ScriptItem(script)); -} - -void LayoutTestController::setAcceptsEditing(bool acceptsEditing) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - COMPtr<IWebEditingDelegate> delegate; - if (FAILED(viewEditing->editingDelegate(&delegate))) - return; - - EditingDelegate* editingDelegate = (EditingDelegate*)(IWebEditingDelegate*)delegate.get(); - editingDelegate->setAcceptsEditing(acceptsEditing); -} - -void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); - if (!prefsPrivate) - return; - - prefsPrivate->setAuthorAndUserStylesEnabled(flag); -} - -void LayoutTestController::setCustomPolicyDelegate(bool setDelegate) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - if (setDelegate) - webView->setPolicyDelegate(policyDelegate); - else - webView->setPolicyDelegate(NULL); -} - -void LayoutTestController::setMainFrameIsFirstResponder(bool flag) -{ - // FIXME: Implement! -} - -void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setPrivateBrowsingEnabled(privateBrowsingEnabled); -} - -void LayoutTestController::setPopupBlockingEnabled(bool privateBrowsingEnabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setJavaScriptCanOpenWindowsAutomatically(!privateBrowsingEnabled); -} - -void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - viewPrivate->setTabKeyCyclesThroughElements(shouldCycle ? TRUE : FALSE); -} - -void LayoutTestController::setUseDashboardCompatibilityMode(bool flag) -{ - // FIXME: Implement! -} - -void LayoutTestController::setUserStyleSheetEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setUserStyleSheetEnabled(flag); -} - -bool appendComponentToPath(wstring& path, const wstring& component) -{ - WCHAR buffer[MAX_PATH]; - - if (path.size() + 1 > MAX_PATH) - return false; - - memcpy(buffer, path.data(), path.size() * sizeof(WCHAR)); - buffer[path.size()] = '\0'; - - if (!PathAppendW(buffer, component.c_str())) - return false; - - path = wstring(buffer); - return true; -} - -static bool followShortcuts(wstring& path) -{ - if (PathFileExists(path.c_str())) - return true; - - // Do we have a shortcut? - wstring linkPath = path; - linkPath.append(TEXT(".lnk")); - if (!PathFileExists(linkPath.c_str())) - return true; - - // We have a shortcut, find its target. - COMPtr<IShellLink> shortcut(Create, CLSID_ShellLink); - if (!shortcut) - return false; - COMPtr<IPersistFile> persistFile(Query, shortcut); - if (!shortcut) - return false; - if (FAILED(persistFile->Load(linkPath.c_str(), STGM_READ))) - return false; - if (FAILED(shortcut->Resolve(0, 0))) - return false; - WCHAR targetPath[MAX_PATH]; - DWORD targetPathLen = _countof(targetPath); - if (FAILED(shortcut->GetPath(targetPath, targetPathLen, 0, 0))) - return false; - if (!PathFileExists(targetPath)) - return false; - // Use the target path as the result path instead. - path = wstring(targetPath); - - return true; -} - -static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath) -{ - wstring fileProtocol = L"file://"; - bool isFileProtocol = cygwinPath.find(fileProtocol) != string::npos; - if (cygwinPath[isFileProtocol ? 7 : 0] != '/') // ensure path is absolute - return false; - - // Get the Root path. - WCHAR rootPath[MAX_PATH]; - DWORD rootPathSize = _countof(rootPath); - DWORD keyType; - DWORD result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), &keyType, &rootPath, &rootPathSize); - - if (result != ERROR_SUCCESS || keyType != REG_SZ) - return false; - - windowsPath = wstring(rootPath, rootPathSize); - - int oldPos = isFileProtocol ? 8 : 1; - while (1) { - int newPos = cygwinPath.find('/', oldPos); - - if (newPos == -1) { - wstring pathComponent = cygwinPath.substr(oldPos); - - if (!appendComponentToPath(windowsPath, pathComponent)) - return false; - - if (!followShortcuts(windowsPath)) - return false; - - break; - } - - wstring pathComponent = cygwinPath.substr(oldPos, newPos - oldPos); - if (!appendComponentToPath(windowsPath, pathComponent)) - return false; - - if (!followShortcuts(windowsPath)) - return false; - - oldPos = newPos + 1; - } - - if (isFileProtocol) - windowsPath = fileProtocol + windowsPath; - - return true; -} - -static wstring cfStringRefToWString(CFStringRef cfStr) -{ - Vector<wchar_t> v(CFStringGetLength(cfStr)); - CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data()); - - return wstring(v.data(), v.size()); -} - -void LayoutTestController::setUserStyleSheetLocation(JSStringRef jsURL) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); - RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, urlString.get(), 0)); - if (!url) - return; - - // Now copy the file system path, POSIX style. - RetainPtr<CFStringRef> pathCF(AdoptCF, CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle)); - if (!pathCF) - return; - - wstring path = cfStringRefToWString(pathCF.get()); - - wstring resultPath; - if (!resolveCygwinPath(path, resultPath)) - return; - - // The path has been resolved, now convert it back to a CFURL. - int result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return; - - url = CFURLCreateFromFileSystemRepresentation(0, (const UInt8*)utf8Vector.data(), utf8Vector.size() - 1, false); - if (!url) - return; - - resultPath = cfStringRefToWString(CFURLGetString(url.get())); - - BSTR resultPathBSTR = SysAllocStringLen(resultPath.data(), resultPath.size()); - preferences->setUserStyleSheetLocation(resultPathBSTR); - SysFreeString(resultPathBSTR); -} - -void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL) -{ - RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL)); - ::setPersistentUserStyleSheetLocation(urlString.get()); -} - -void LayoutTestController::clearPersistentUserStyleSheet() -{ - ::setPersistentUserStyleSheetLocation(0); -} - -void LayoutTestController::setWindowIsKey(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - HWND webViewWindow; - if (FAILED(viewPrivate->viewWindow((OLE_HANDLE*)&webViewWindow))) - return; - - ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0); -} - -void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - viewEditing->setSmartInsertDeleteEnabled(flag ? TRUE : FALSE); -} - -void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); - if (!prefsPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - prefsPrivate->setDeveloperExtrasEnabled(flag); - inspector->setJavaScriptProfilingEnabled(flag); -} - -static const CFTimeInterval waitToDumpWatchdogInterval = 10.0; - -static void waitUntilDoneWatchdogFired(CFRunLoopTimerRef timer, void* info) -{ - const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; - fprintf(stderr, message); - fprintf(stdout, message); - dump(); -} - -void LayoutTestController::setWaitToDump(bool waitUntilDone) -{ - // Same as on mac. This can be shared. - m_waitToDump = waitUntilDone; - if (m_waitToDump && !waitToDumpWatchdog) { - waitToDumpWatchdog = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogInterval, 0, 0, 0, waitUntilDoneWatchdogFired, NULL); - CFRunLoopAddTimer(CFRunLoopGetCurrent(), waitToDumpWatchdog, kCFRunLoopCommonModes); - } -} - -int LayoutTestController::windowCount() -{ - return openWindows().size(); -} - -bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - wstring idWstring = jsStringRefToWString(id); - BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); - COMPtr<IDOMElement> element; - HRESULT result = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - - if (FAILED(result)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BOOL autoCompletes; - if (FAILED(framePrivate->elementDoesAutoComplete(element.get(), &autoCompletes))) - return false; - - return autoCompletes; -} - -void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) -{ - wstring wName = jsStringRefToWString(name); - wstring wValue = jsStringRefToWString(value); - - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - BSTR nameBSTR = SysAllocStringLen((OLECHAR*)wName.c_str(), wName.length()); - BSTR valueBSTR = SysAllocStringLen((OLECHAR*)wValue.c_str(), wValue.length()); - viewPrivate->executeCoreCommandByName(nameBSTR, valueBSTR); - - SysFreeString(nameBSTR); - SysFreeString(valueBSTR); -} - -void LayoutTestController::clearAllDatabases() -{ - printf("ERROR: LayoutTestController::clearAllDatabases() not implemented\n"); -} - -void LayoutTestController::setDatabaseQuota(unsigned long long quota) -{ - printf("ERROR: LayoutTestController::setDatabaseQuota() not implemented\n"); -} diff --git a/WebKitTools/DumpRenderTree/win/MD5.cpp b/WebKitTools/DumpRenderTree/win/MD5.cpp deleted file mode 100644 index 1bfc9c7..0000000 --- a/WebKitTools/DumpRenderTree/win/MD5.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 "MD5.h" - -#include <windows.h> - -typedef void (WINAPI*initPtr)(MD5_CTX*); -typedef void (WINAPI*updatePtr)(MD5_CTX*, unsigned char*, unsigned); -typedef void (WINAPI*finalPtr)(MD5_CTX*); - -static HMODULE cryptDLL() -{ - static HMODULE module = LoadLibraryW(L"Cryptdll.dll"); - return module; -} - -static initPtr init() -{ - static initPtr ptr = reinterpret_cast<initPtr>(GetProcAddress(cryptDLL(), "MD5Init")); - return ptr; -} - -static updatePtr update() -{ - static updatePtr ptr = reinterpret_cast<updatePtr>(GetProcAddress(cryptDLL(), "MD5Update")); - return ptr; -} - -static finalPtr final() -{ - static finalPtr ptr = reinterpret_cast<finalPtr>(GetProcAddress(cryptDLL(), "MD5Final")); - return ptr; -} - -void MD5_Init(MD5_CTX* context) -{ - init()(context); -} - -void MD5_Update(MD5_CTX* context, unsigned char* input, unsigned length) -{ - update()(context, input, length); -} - -void MD5_Final(unsigned char hash[16], MD5_CTX* context) -{ - final()(context); - - for (int i = 0; i < 16; ++i) - hash[i] = context->digest[i]; -} diff --git a/WebKitTools/DumpRenderTree/win/MD5.h b/WebKitTools/DumpRenderTree/win/MD5.h deleted file mode 100644 index 326e21d..0000000 --- a/WebKitTools/DumpRenderTree/win/MD5.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 MD5_h -#define MD5_h - -typedef unsigned long ULONG; - -struct MD5_CTX { - ULONG i[2]; - ULONG buf[4]; - unsigned char in[64]; - unsigned char digest[16]; -}; - -void MD5_Init(MD5_CTX*); -void MD5_Update(MD5_CTX*, unsigned char* input, unsigned length); -void MD5_Final(unsigned char hash[16], MD5_CTX*); - -#endif // MD5_h diff --git a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp deleted file mode 100644 index d0b79e1..0000000 --- a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 "PixelDumpSupportCG.h" - -#include "DumpRenderTree.h" -#include <CoreGraphics/CGBitmapContext.h> -#include <wtf/Assertions.h> -#include <wtf/RetainPtr.h> - -PassRefPtr<BitmapContext> getBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect) -{ - RECT frame; - if (!GetWindowRect(webViewWindow, &frame)) - return 0; - - BITMAPINFO bmp = {0}; - bmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmp.bmiHeader.biWidth = frame.right - frame.left; - bmp.bmiHeader.biHeight = -(frame.bottom - frame.top); - bmp.bmiHeader.biPlanes = 1; - bmp.bmiHeader.biBitCount = 32; - bmp.bmiHeader.biCompression = BI_RGB; - - void* bits = 0; - HBITMAP bitmap = CreateDIBSection(0, &bmp, DIB_RGB_COLORS, &bits, 0, 0); - - HDC memoryDC = CreateCompatibleDC(0); - SelectObject(memoryDC, bitmap); - SendMessage(webViewWindow, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(memoryDC), PRF_CLIENT | PRF_CHILDREN | PRF_OWNED); - DeleteDC(memoryDC); - - BITMAP info = {0}; - GetObject(bitmap, sizeof(info), &info); - ASSERT(info.bmBitsPixel == 32); - - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); - CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, - info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst); - - return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context); -} diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp deleted file mode 100644 index 99a1fd7..0000000 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 "PolicyDelegate.h" - -#include "DumpRenderTree.h" - -#include <string> - -using std::wstring; - -PolicyDelegate::PolicyDelegate() - : m_refCount(1) -{ -} - -// IUnknown -HRESULT STDMETHODCALLTYPE PolicyDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebPolicyDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebPolicyDelegate)) - *ppvObject = static_cast<IWebPolicyDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE PolicyDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE PolicyDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete this; - - return newRef; -} - -HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction( - /*[in]*/ IWebView* /*webView*/, - /*[in]*/ IPropertyBag* /*actionInformation*/, - /*[in]*/ IWebURLRequest* request, - /*[in]*/ IWebFrame* frame, - /*[in]*/ IWebPolicyDecisionListener* listener) -{ - BSTR url; - request->URL(&url); - - printf("Policy delegate: attempt to load %S\n", url ? url : TEXT("")); - SysFreeString(url); - listener->ignore(); - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h deleted file mode 100644 index b9844f4..0000000 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 PolicyDelegate_h -#define PolicyDelegate_h - -#include <WebKit/WebKit.h> - -class PolicyDelegate : public IWebPolicyDelegate { -public: - PolicyDelegate(); - - // 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){ return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE decidePolicyForMIMEType( - /* [in] */ IWebView *webView, - /* [in] */ BSTR type, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebPolicyDecisionListener *listener){ return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unableToImplementPolicyWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame){ return E_NOTIMPL; } - -private: - ULONG m_refCount; -}; - -#endif // PolicyDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp deleted file mode 100644 index 1e77eda..0000000 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* - * 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 "ResourceLoadDelegate.h" - -#include "DumpRenderTree.h" -#include "LayoutTestController.h" -#include <wtf/HashMap.h> -#include <wtf/Vector.h> -#include <sstream> - -using std::wstring; -using std::wiostream; - -static inline wstring wstringFromBSTR(BSTR str) -{ - return wstring(str, ::SysStringLen(str)); -} - -wstring wstringFromInt(int i) -{ - std::wostringstream ss; - ss << i; - return ss.str(); -} - -typedef HashMap<unsigned long, wstring> IdentifierMap; - -IdentifierMap& urlMap() -{ - static IdentifierMap urlMap; - - return urlMap; -} - -static wstring descriptionSuitableForTestResult(unsigned long identifier) -{ - IdentifierMap::iterator it = urlMap().find(identifier); - - if (it == urlMap().end()) - return L"<unknown>"; - - return urlSuitableForTestResult(it->second); -} - -static wstring descriptionSuitableForTestResult(IWebURLRequest* request) -{ - if (!request) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(request->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - return L"<NSURLRequest " + url + L">"; -} - -static wstring descriptionSuitableForTestResult(IWebURLResponse* response) -{ - if (!response) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(response->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - return L"<NSURLResponse " + url + L">"; -} - -static wstring descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) -{ - wstring result = L"<NSError "; - - BSTR domainSTR; - if (FAILED(error->domain(&domainSTR))) - return wstring(); - - wstring domain = wstringFromBSTR(domainSTR); - ::SysFreeString(domainSTR); - - int code; - if (FAILED(error->code(&code))) - return wstring(); - - if (domain == L"CFURLErrorDomain") { - domain = L"NSURLErrorDomain"; - - // Convert kCFURLErrorUnknown to NSURLErrorUnknown - if (code == -998) - code = -1; - } else if (domain == L"kCFErrorDomainWinSock") { - domain = L"NSURLErrorDomain"; - - // Convert the winsock error code to an NSURLError code. - if (code == WSAEADDRNOTAVAIL) - code = -1004; // NSURLErrorCannotConnectToHose; - } - - result += L"domain " + domain; - result += L", code " + wstringFromInt(code); - - BSTR failingURLSTR; - if (FAILED(error->failingURL(&failingURLSTR))) - return wstring(); - - wstring failingURL; - - // If the error doesn't have a failing URL, we fake one by using the URL the resource had - // at creation time. This seems to work fine for now. - // See <rdar://problem/5064234> CFErrors should have failingURL key. - if (failingURLSTR) - failingURL = wstringFromBSTR(failingURLSTR); - else - failingURL = descriptionSuitableForTestResult(identifier); - - ::SysFreeString(failingURLSTR); - - result += L", failing URL \"" + urlSuitableForTestResult(failingURL) + L"\">"; - - return result; -} - -ResourceLoadDelegate::ResourceLoadDelegate() - : m_refCount(1) -{ -} - -ResourceLoadDelegate::~ResourceLoadDelegate() -{ -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebResourceLoadDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebResourceLoadDelegate)) - *ppvObject = static_cast<IWebResourceLoadDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE ResourceLoadDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE ResourceLoadDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::identifierForInitialRequest( - /* [in] */ IWebView* webView, - /* [in] */ IWebURLRequest* request, - /* [in] */ IWebDataSource* dataSource, - /* [in] */ unsigned long identifier) -{ - if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { - BSTR urlStr; - if (FAILED(request->URL(&urlStr))) - return E_FAIL; - - urlMap().set(identifier, wstringFromBSTR(urlStr)); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLRequest* request, - /* [in] */ IWebURLResponse* redirectResponse, - /* [in] */ IWebDataSource* dataSource, - /* [retval][out] */ IWebURLRequest **newRequest) -{ - if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { - printf("%S - willSendRequest %S redirectResponse %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(request).c_str(), - descriptionSuitableForTestResult(redirectResponse).c_str()); - } - - request->AddRef(); - *newRequest = request; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { - printf("%S - didFinishLoading\n", - descriptionSuitableForTestResult(identifier).c_str()), - urlMap().remove(identifier); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFailLoadingWithError( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebError* error, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { - printf("%S - didFailLoadingWithError: %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(error, identifier).c_str()); - urlMap().remove(identifier); - } - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h deleted file mode 100644 index e259adc..0000000 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 ResourceLoadDelegate_h -#define ResourceLoadDelegate_h - -#include <WebKit/WebKit.h> - -class ResourceLoadDelegate : public IWebResourceLoadDelegate { -public: - ResourceLoadDelegate(); - virtual ~ResourceLoadDelegate(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebResourceLoadDelegate - virtual HRESULT STDMETHODCALLTYPE identifierForInitialRequest( - /* [in] */ IWebView *webView, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebDataSource *dataSource, - /* [in] */ unsigned long identifier); - - virtual HRESULT STDMETHODCALLTYPE willSendRequest( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLRequest *request, - /* [in] */ IWebURLResponse *redirectResponse, - /* [in] */ IWebDataSource *dataSource, - /* [retval][out] */ IWebURLRequest **newRequest); - - virtual HRESULT STDMETHODCALLTYPE didReceiveAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didCancelAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didReceiveResponse( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLResponse *response, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didReceiveContentLength( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ UINT length, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didFinishLoadingFromDataSource( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE didFailLoadingWithError( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebError *error, - /* [in] */ IWebDataSource *dataSource); - - virtual HRESULT STDMETHODCALLTYPE plugInFailedWithError( - /* [in] */ IWebView *webView, - /* [in] */ IWebError *error, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } - -protected: - ULONG m_refCount; -}; - -#endif // ResourceLoadDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def deleted file mode 100644 index 92cdb12..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY "TestNetscapePlugin"
-
-EXPORTS
- NP_GetEntryPoints @1
- NP_Initialize @2
- NP_Shutdown @3
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc deleted file mode 100644 index 7801de9..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc +++ /dev/null @@ -1,101 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904e4"
- BEGIN
- VALUE "CompanyName", "Apple Inc."
- VALUE "FileDescription", "TestNetscapePlugIn"
- VALUE "FileOpenName", "test netscape content"
- VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2008"
- VALUE "MIMEType", "application/x-webkit-test-netscape"
- VALUE "OriginalFilename", "npTestNetscapePlugin.dll"
- VALUE "ProductName", "TestNetscapePlugIn"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1252
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj deleted file mode 100644 index eced57e..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj +++ /dev/null @@ -1,263 +0,0 @@ -<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="TestNetscapePlugin"
- ProjectGUID="{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
- RootNamespace="TestNetscapePlugin"
- 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%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
- ModuleDefinitionFile="TestNetscapePlugin.def"
- />
- <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="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
- />
- </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%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
- ModuleDefinitionFile="TestNetscapePlugin.def"
- />
- <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="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
- />
- </Configuration>
- <Configuration
- Name="Debug_Internal|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility""
- PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix)\np$(ProjectName)$(WebKitConfigSuffix).dll"
- ModuleDefinitionFile="TestNetscapePlugin.def"
- />
- <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="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\main.cpp"
- >
- </File>
- <File
- RelativePath="..\..\TestNetscapePlugIn.subproj\PluginObject.cpp"
- >
- </File>
- <File
- RelativePath="..\..\TestNetscapePlugIn.subproj\PluginObject.h"
- >
- </File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.def"
- >
- </File>
- <File
- RelativePath=".\TestNetscapePlugin.rc"
- >
- </File>
- <File
- RelativePath="..\..\TestNetscapePlugIn.subproj\TestObject.cpp"
- >
- </File>
- <File
- RelativePath="..\..\TestNetscapePlugIn.subproj\TestObject.h"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c deleted file mode 100644 index 829a32c..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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 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 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 "PluginObject.h" - -#include <stdio.h> - -extern "C" -NPError __stdcall NP_Initialize(NPNetscapeFuncs* browserFuncs) -{ - browser = browserFuncs; - return NPERR_NO_ERROR; -} - -extern "C" -NPError __stdcall NP_GetEntryPoints(NPPluginFuncs* pluginFuncs) -{ - pluginFuncs->version = 11; - pluginFuncs->size = sizeof(pluginFuncs); - pluginFuncs->newp = NPP_New; - pluginFuncs->destroy = NPP_Destroy; - pluginFuncs->setwindow = NPP_SetWindow; - pluginFuncs->newstream = NPP_NewStream; - pluginFuncs->destroystream = NPP_DestroyStream; - pluginFuncs->asfile = NPP_StreamAsFile; - pluginFuncs->writeready = NPP_WriteReady; - pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; - pluginFuncs->print = NPP_Print; - pluginFuncs->event = NPP_HandleEvent; - pluginFuncs->urlnotify = NPP_URLNotify; - pluginFuncs->getvalue = NPP_GetValue; - pluginFuncs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - - -extern "C" -NPError __stdcall NP_Shutdown() -{ - return NPERR_NO_ERROR; -} - - -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved) -{ - if (browser->version >= 14) { - PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); - - obj->onStreamLoad = NULL; - - for (int16 i = 0; i < argc; i++) { - if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) - obj->onStreamLoad = _strdup(argv[i]); - } - - instance->pdata = obj; - } - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData **save) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (obj) { - if (obj->onStreamLoad) - free(obj->onStreamLoad); - - if (obj->logDestroy) - printf("PLUGIN: NPP_Destroy\n"); - - browser->releaseobject(&obj->header); - } - return NPERR_NO_ERROR; -} - -NPError NPP_SetWindow(NPP instance, NPWindow *window) -{ - return NPERR_NO_ERROR; -} - -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) -{ - PluginObject* obj = (PluginObject*)instance->pdata; - obj->stream = stream; - *stype = NP_ASFILEONLY; - - if (obj->onStreamLoad) { - NPObject *windowScriptObject; - browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); - - NPString script; - script.UTF8Characters = obj->onStreamLoad; - script.UTF8Length = strlen(obj->onStreamLoad); - - NPVariant browserResult; - browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult); - browser->releasevariantvalue(&browserResult); - } - - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) -{ - return NPERR_NO_ERROR; -} - -int32 NPP_WriteReady(NPP instance, NPStream *stream) -{ - return 0; -} - -int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - return 0; -} - -void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname) -{ -} - -void NPP_Print(NPP instance, NPPrint *platformPrint) -{ -} - -int16 NPP_HandleEvent(NPP instance, void *event) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (!obj->eventLogging) - return 0; - - // FIXME: Implement this - return 0; -} - -void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - - handleCallback(obj, url, reason, notifyData); -} - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - if (variable == NPPVpluginScriptableNPObject) { - void **v = (void **)value; - PluginObject *obj = (PluginObject*)instance->pdata; - // Return value is expected to be retained - browser->retainobject((NPObject *)obj); - *v = obj; - return NPERR_NO_ERROR; - } - return NPERR_GENERIC_ERROR; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp deleted file mode 100644 index ab54872..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in - consideration of your agreement to the following terms, and your use, installation, - modification or redistribution of this Apple software constitutes acceptance of these - terms. If you do not agree with these terms, please do not use, install, modify or - redistribute this Apple software. - - In consideration of your agreement to abide by the following terms, and subject to these - terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in - this original Apple software (the "Apple Software"), to use, reproduce, modify and - redistribute the Apple Software, with or without modifications, in source and/or binary - forms; provided that if you redistribute the Apple Software in its entirety and without - modifications, you must retain this notice and the following text and disclaimers in all - such redistributions of the Apple Software. Neither the name, trademarks, service marks - or logos of Apple Computer, Inc. may be used to endorse or promote products derived from - the Apple Software without specific prior written permission from Apple. Except as expressly - stated in this notice, no other rights or licenses, express or implied, are granted by Apple - herein, including but not limited to any patent rights that may be infringed by your - derivative works or by other works in which the Apple Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, - EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS - USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, - REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND - WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR - OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginObject.h" - -#include <stdio.h> - -extern "C" -NPError __stdcall NP_Initialize(NPNetscapeFuncs* browserFuncs) -{ - browser = browserFuncs; - return NPERR_NO_ERROR; -} - -extern "C" -NPError __stdcall NP_GetEntryPoints(NPPluginFuncs* pluginFuncs) -{ - pluginFuncs->version = 11; - pluginFuncs->size = sizeof(pluginFuncs); - pluginFuncs->newp = NPP_New; - pluginFuncs->destroy = NPP_Destroy; - pluginFuncs->setwindow = NPP_SetWindow; - pluginFuncs->newstream = NPP_NewStream; - pluginFuncs->destroystream = NPP_DestroyStream; - pluginFuncs->asfile = NPP_StreamAsFile; - pluginFuncs->writeready = NPP_WriteReady; - pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; - pluginFuncs->print = NPP_Print; - pluginFuncs->event = NPP_HandleEvent; - pluginFuncs->urlnotify = NPP_URLNotify; - pluginFuncs->getvalue = NPP_GetValue; - pluginFuncs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - - -extern "C" -NPError __stdcall NP_Shutdown() -{ - return NPERR_NO_ERROR; -} - - -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved) -{ - if (browser->version >= 14) { - PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); - - for (int16 i = 0; i < argc; i++) { - if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) - obj->onStreamLoad = _strdup(argv[i]); - else if (_stricmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy) - obj->onStreamDestroy = _strdup(argv[i]); - else if (_stricmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) - obj->onURLNotify = _strdup(argv[i]); - } - - instance->pdata = obj; - } - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData **save) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (obj) { - if (obj->onStreamLoad) - free(obj->onStreamLoad); - - if (obj->onURLNotify) - free(obj->onURLNotify); - - if (obj->onStreamDestroy) - free(obj->onStreamDestroy); - - if (obj->logDestroy) - printf("PLUGIN: NPP_Destroy\n"); - - browser->releaseobject(&obj->header); - } - return NPERR_NO_ERROR; -} - -NPError NPP_SetWindow(NPP instance, NPWindow *window) -{ - return NPERR_NO_ERROR; -} - -static void executeScript(const PluginObject* obj, const char* script) -{ - NPObject *windowScriptObject; - browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); - - NPString npScript; - npScript.UTF8Characters = script; - npScript.UTF8Length = strlen(script); - - NPVariant browserResult; - browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); - browser->releasevariantvalue(&browserResult); -} - -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) -{ - PluginObject* obj = (PluginObject*)instance->pdata; - - if (obj->returnErrorFromNewStream) - return NPERR_GENERIC_ERROR; - - obj->stream = stream; - *stype = NP_ASFILEONLY; - - if (obj->onStreamLoad) - executeScript(obj, obj->onStreamLoad); - - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) -{ - PluginObject* obj = (PluginObject*)instance->pdata; - - if (obj->onStreamDestroy) - executeScript(obj, obj->onStreamDestroy); - - return NPERR_NO_ERROR; -} - -int32 NPP_WriteReady(NPP instance, NPStream *stream) -{ - return 0; -} - -int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - return 0; -} - -void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname) -{ -} - -void NPP_Print(NPP instance, NPPrint *platformPrint) -{ -} - -int16 NPP_HandleEvent(NPP instance, void *event) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (!obj->eventLogging) - return 0; - - // FIXME: Implement this - return 0; -} - -void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - - if (obj->onURLNotify) - executeScript(obj, obj->onURLNotify); - - handleCallback(obj, url, reason, notifyData); -} - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - if (variable == NPPVpluginScriptableNPObject) { - void **v = (void **)value; - PluginObject *obj = (PluginObject*)instance->pdata; - // Return value is expected to be retained - browser->retainobject((NPObject *)obj); - *v = obj; - return NPERR_NO_ERROR; - } - return NPERR_GENERIC_ERROR; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/resource.h b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/resource.h deleted file mode 100644 index b0ce340..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by TestNetscapePlugin.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp deleted file mode 100755 index a2532a5..0000000 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (C) 2005, 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 "UIDelegate.h" - -#include "DumpRenderTree.h" -#include "DraggingInfo.h" -#include "EventSender.h" -#include "LayoutTestController.h" - -#include <WebCore/COMPtr.h> -#include <wtf/Platform.h> -#include <wtf/Vector.h> -#include <JavaScriptCore/Assertions.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <stdio.h> - -using std::wstring; - -class DRTUndoObject { -public: - DRTUndoObject(IWebUndoTarget* target, BSTR actionName, IUnknown* obj) - : m_target(target) - , m_actionName(SysAllocString(actionName)) - , m_obj(obj) - { - } - - ~DRTUndoObject() - { - SysFreeString(m_actionName); - } - - void invoke() - { - m_target->invoke(m_actionName, m_obj.get()); - } - -private: - IWebUndoTarget* m_target; - BSTR m_actionName; - COMPtr<IUnknown> m_obj; -}; - -class DRTUndoStack { -public: - ~DRTUndoStack() { deleteAllValues(m_undoVector); } - - bool isEmpty() const { return m_undoVector.isEmpty(); } - void clear() { deleteAllValues(m_undoVector); m_undoVector.clear(); } - - void push(DRTUndoObject* undoObject) { m_undoVector.append(undoObject); } - DRTUndoObject* pop() { DRTUndoObject* top = m_undoVector.last(); m_undoVector.removeLast(); return top; } - -private: - Vector<DRTUndoObject*> m_undoVector; -}; - -class DRTUndoManager { -public: - DRTUndoManager(); - - void removeAllActions(); - void registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj); - void redo(); - void undo(); - bool canRedo() { return !m_redoStack->isEmpty(); } - bool canUndo() { return !m_undoStack->isEmpty(); } - -private: - OwnPtr<DRTUndoStack> m_redoStack; - OwnPtr<DRTUndoStack> m_undoStack; - bool m_isRedoing; - bool m_isUndoing; -}; - -DRTUndoManager::DRTUndoManager() - : m_redoStack(new DRTUndoStack) - , m_undoStack(new DRTUndoStack) - , m_isRedoing(false) - , m_isUndoing(false) -{ -} - -void DRTUndoManager::removeAllActions() -{ - m_redoStack->clear(); - m_undoStack->clear(); -} - -void DRTUndoManager::registerUndoWithTarget(IWebUndoTarget* target, BSTR actionName, IUnknown* obj) -{ - if (!m_isUndoing && !m_isRedoing) - m_redoStack->clear(); - - DRTUndoStack* stack = m_isUndoing ? m_redoStack.get() : m_undoStack.get(); - stack->push(new DRTUndoObject(target, actionName, obj)); -} - -void DRTUndoManager::redo() -{ - if (!canRedo()) - return; - - m_isRedoing = true; - - DRTUndoObject* redoObject = m_redoStack->pop(); - redoObject->invoke(); - delete redoObject; - - m_isRedoing = false; -} - -void DRTUndoManager::undo() -{ - if (!canUndo()) - return; - - m_isUndoing = true; - - DRTUndoObject* undoObject = m_undoStack->pop(); - undoObject->invoke(); - delete undoObject; - - m_isUndoing = false; -} - -UIDelegate::UIDelegate() - : m_refCount(1) - , m_undoManager(new DRTUndoManager) -{ - m_frame.bottom = 0; - m_frame.top = 0; - m_frame.left = 0; - m_frame.right = 0; -} - -void UIDelegate::resetUndoManager() -{ - m_undoManager.set(new DRTUndoManager); -} - -HRESULT STDMETHODCALLTYPE UIDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebUIDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegate)) - *ppvObject = static_cast<IWebUIDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate)) - *ppvObject = static_cast<IWebUIDelegatePrivate*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate2)) - *ppvObject = static_cast<IWebUIDelegatePrivate2*>(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate3)) - *ppvObject = static_cast<IWebUIDelegatePrivate3*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE UIDelegate::AddRef() -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE UIDelegate::Release() -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::hasCustomMenuImplementation( - /* [retval][out] */ BOOL *hasCustomMenus) -{ - *hasCustomMenus = TRUE; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::trackCustomPopupMenu( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu, - /* [in] */ LPPOINT point) -{ - // Do nothing - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::registerUndoWithTarget( - /* [in] */ IWebUndoTarget* target, - /* [in] */ BSTR actionName, - /* [in] */ IUnknown* actionArg) -{ - m_undoManager->registerUndoWithTarget(target, actionName, actionArg); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::removeAllActionsWithTarget( - /* [in] */ IWebUndoTarget*) -{ - m_undoManager->removeAllActions(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setActionTitle( - /* [in] */ BSTR actionTitle) -{ - // It is not neccessary to implement this for DRT because there is - // menu to write out the title to. - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::undo() -{ - m_undoManager->undo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::redo() -{ - m_undoManager->redo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canUndo( - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - - *result = m_undoManager->canUndo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canRedo( - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - - *result = m_undoManager->canRedo(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setFrame( - /* [in] */ IWebView* /*sender*/, - /* [in] */ RECT* frame) -{ - m_frame = *frame; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFrame( - /* [in] */ IWebView* /*sender*/, - /* [retval][out] */ RECT* frame) -{ - *frame = m_frame; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptAlertPanelWithMessage( - /* [in] */ IWebView* /*sender*/, - /* [in] */ BSTR message) -{ - printf("ALERT: %S\n", message ? message : L""); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptConfirmPanelWithMessage( - /* [in] */ IWebView* sender, - /* [in] */ BSTR message, - /* [retval][out] */ BOOL* result) -{ - printf("CONFIRM: %S\n", message ? message : L""); - *result = TRUE; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runJavaScriptTextInputPanelWithPrompt( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ BSTR defaultText, - /* [retval][out] */ BSTR *result) -{ - printf("PROMPT: %S, default text: %S\n", message ? message : L"", defaultText ? defaultText : L""); - *result = SysAllocString(defaultText); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runBeforeUnloadConfirmPanelWithMessage( - /* [in] */ IWebView* /*sender*/, - /* [in] */ BSTR /*message*/, - /* [in] */ IWebFrame* /*initiatedByFrame*/, - /* [retval][out] */ BOOL* result) -{ - if (!result) - return E_POINTER; - *result = TRUE; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewAddMessageToConsole( - /* [in] */ IWebView* sender, - /* [in] */ BSTR message, - /* [in] */ int lineNumber, - /* [in] */ BSTR url, - /* [in] */ BOOL isError) -{ - wstring newMessage; - if (message) { - newMessage = message; - size_t fileProtocol = newMessage.find(L"file://"); - if (fileProtocol != wstring::npos) - newMessage = newMessage.substr(0, fileProtocol) + urlSuitableForTestResult(newMessage.substr(fileProtocol)); - } - - printf("CONSOLE MESSAGE: line %d: %S\n", lineNumber, newMessage.c_str()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::doDragDrop( - /* [in] */ IWebView* sender, - /* [in] */ IDataObject* object, - /* [in] */ IDropSource* source, - /* [in] */ DWORD okEffect, - /* [retval][out] */ DWORD* performedEffect) -{ - if (!performedEffect) - return E_POINTER; - - *performedEffect = 0; - - draggingInfo = new DraggingInfo(object, source); - replaySavedEvents(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewGetDlgCode( - /* [in] */ IWebView* /*sender*/, - /* [in] */ UINT /*keyCode*/, - /* [retval][out] */ LONG_PTR *code) -{ - if (!code) - return E_POINTER; - *code = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView) -{ - if (!::gLayoutTestController->canOpenWindows()) - return E_FAIL; - *newWebView = createWebViewAndOffscreenWindow(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewClose( - /* [in] */ IWebView *sender) -{ - HWND hostWindow; - sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - DestroyWindow(hostWindow); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFocus( - /* [in] */ IWebView *sender) -{ - HWND hostWindow; - sender->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)); - SetForegroundWindow(hostWindow); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewUnfocus( - /* [in] */ IWebView *sender) -{ - SetForegroundWindow(GetDesktopWindow()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewPainted( - /* [in] */ IWebView *sender) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebSecurityOrigin *origin, - /* [in] */ BSTR databaseIdentifier) -{ - static const unsigned long long defaultQuota = 5 * 1024 * 1024; - origin->setQuota(defaultQuota); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text) -{ - if (gLayoutTestController->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", text ? text : L""); - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.h b/WebKitTools/DumpRenderTree/win/UIDelegate.h deleted file mode 100755 index 2113957..0000000 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.h +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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. - */ - -#ifndef UIDelegate_h -#define UIDelegate_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> -#include <windef.h> - -class DRTUndoManager; - -class UIDelegate : public IWebUIDelegate, IWebUIDelegatePrivate3 { -public: - UIDelegate(); - - void resetUndoManager(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebUIDelegate - virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView); - - virtual HRESULT STDMETHODCALLTYPE webViewShow( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewClose( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewFocus( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewUnfocus( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder( - /* [in] */ IWebView *sender, - /* [retval][out] */ OLE_HANDLE *responder) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE makeFirstResponder( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE responder) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setStatusText( - /* [in] */ IWebView *sender, - /* [in] */ BSTR text); - - virtual HRESULT STDMETHODCALLTYPE webViewStatusText( - /* [in] */ IWebView *sender, - /* [retval][out] */ BSTR *text) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible( - /* [in] */ IWebView *sender, - /* [in] */ BOOL visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible( - /* [in] */ IWebView *sender, - /* [in] */ BOOL visible) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewIsResizable( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *resizable) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setResizable( - /* [in] */ IWebView *sender, - /* [in] */ BOOL resizable) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE setFrame( - /* [in] */ IWebView *sender, - /* [in] */ RECT *frame); - - virtual HRESULT STDMETHODCALLTYPE webViewFrame( - /* [in] */ IWebView *sender, - /* [retval][out] */ RECT *frame); - - virtual HRESULT STDMETHODCALLTYPE setContentRect( - /* [in] */ IWebView *sender, - /* [in] */ RECT *contentRect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewContentRect( - /* [in] */ IWebView *sender, - /* [retval][out] */ RECT *contentRect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message); - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ BSTR defaultText, - /* [retval][out] */ BSTR *result); - - virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener( - /* [in] */ IWebView *sender, - /* [in] */ IWebOpenPanelResultListener *resultListener) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement( - /* [in] */ IWebView *sender, - /* [in] */ IPropertyBag *elementInformation, - /* [in] */ UINT modifierFlags) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement( - /* [in] */ IWebView *sender, - /* [in] */ IPropertyBag *element, - /* [in] */ OLE_HANDLE defaultItems, - /* [retval][out] */ OLE_HANDLE *resultMenu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem( - /* [in] */ IWebView *webView, - /* [in] */ UINT itemCommandID, - /* [in] */ BOOL defaultValidation, - /* [retval][out] */ BOOL *isValid) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE shouldPerformAction( - /* [in] */ IWebView *webView, - /* [in] */ UINT itemCommandID, - /* [in] */ UINT sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo( - /* [in] */ IWebView *webView, - /* [in] */ IDataObject *draggingInfo, - /* [retval][out] */ WebDragDestinationAction *action) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction( - /* [in] */ IWebView *webView, - /* [in] */ WebDragDestinationAction action, - /* [in] */ IDataObject *draggingInfo) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint( - /* [in] */ IWebView *webView, - /* [in] */ LPPOINT point, - /* [retval][out] */ WebDragSourceAction *action) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction( - /* [in] */ IWebView *webView, - /* [in] */ WebDragSourceAction action, - /* [in] */ LPPOINT point, - /* [in] */ IDataObject *pasteboard) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected( - /* [in] */ IWebView *sender, - /* [in] */ void *item, - /* [in] */ IPropertyBag *element) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation( - /* [retval][out] */ BOOL *hasCustomMenus); - - virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu, - /* [in] */ LPPOINT point); - - virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem( - /* [in] */ IWebView *sender, - /* [in] */ void *measureItem) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem( - /* [in] */ IWebView *sender, - /* [in] */ void *drawItem) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE menu) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE canTakeFocus( - /* [in] */ IWebView *sender, - /* [in] */ BOOL forward, - /* [out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE takeFocus( - /* [in] */ IWebView *sender, - /* [in] */ BOOL forward) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget( - /* [in] */ IWebUndoTarget *target, - /* [in] */ BSTR actionName, - /* [in] */ IUnknown *actionArg); - - virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget( - /* [in] */ IWebUndoTarget *target); - - virtual HRESULT STDMETHODCALLTYPE setActionTitle( - /* [in] */ BSTR actionTitle); - - virtual HRESULT STDMETHODCALLTYPE undo(); - - virtual HRESULT STDMETHODCALLTYPE redo(); - - virtual HRESULT STDMETHODCALLTYPE canUndo( - /* [retval][out] */ BOOL *result); - - virtual HRESULT STDMETHODCALLTYPE canRedo( - /* [retval][out] */ BOOL *result); - -protected: - // IWebUIDelegatePrivate - - virtual HRESULT STDMETHODCALLTYPE webViewResizerRect( - /* [in] */ IWebView *sender, - /* [retval][out] */ RECT *rect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewSendResizeMessage( - /* [in] */ UINT uMsg, - /* [in] */ WPARAM wParam, - /* [in] */ LPARAM lParam) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewDrawResizer( - /* [in] */ IWebView *sender, - /* [in] */ HDC dc, - /* [in] */ BOOL overlapsContent, - /* [in] */ RECT *rect) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewScrolled( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewAddMessageToConsole( - /* [in] */ IWebView *sender, - /* [in] */ BSTR message, - /* [in] */ int lineNumber, - /* [in] */ BSTR url, - /* [in] */ BOOL isError); - - virtual HRESULT STDMETHODCALLTYPE webViewShouldInterruptJavaScript( - /* [in] */ IWebView *sender, - /* [retval][out] */ BOOL *result) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewReceivedFocus( - /* [in] */ IWebView *sender) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE webViewLostFocus( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE loseFocusTo) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE doDragDrop( - /* [in] */ IWebView *sender, - /* [in] */ IDataObject *dataObject, - /* [in] */ IDropSource *dropSource, - /* [in] */ DWORD okEffect, - /* [retval][out] */ DWORD *performedEffect); - - virtual HRESULT STDMETHODCALLTYPE webViewGetDlgCode( - /* [in] */ IWebView *sender, - /* [in] */ UINT keyCode, - /* [retval][out] */ LONG_PTR *code); - - // IWebUIDelegatePrivate2 - - virtual HRESULT STDMETHODCALLTYPE webViewPainted( - /* [in] */ IWebView *sender); - - // IWebUIDelegatePrivate3 - - virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebSecurityOrigin *origin, - /* [in] */ BSTR databaseIdentifier); - - ULONG m_refCount; - -private: - RECT m_frame; - OwnPtr<DRTUndoManager> m_undoManager; -}; - -#endif diff --git a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp deleted file mode 100644 index a489498..0000000 --- a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 "WorkQueueItem.h" - -#include "DumpRenderTree.h" -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSStringRefCF.h> -#include <JavaScriptCore/RetainPtr.h> -#include <wtf/Vector.h> -#include <string> - -using std::wstring; - -static wstring jsStringRefToWString(JSStringRef jsStr) -{ - size_t length = JSStringGetLength(jsStr); - Vector<WCHAR> buffer(length + 1); - memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); - buffer[length] = '\0'; - - return buffer.data(); -} - -void LoadItem::invoke() const -{ - wstring targetString = jsStringRefToWString(target()); - - COMPtr<IWebFrame> targetFrame; - if (targetString.empty()) - targetFrame = frame; - else { - BSTR targetBSTR = SysAllocString(targetString.c_str()); - bool failed = FAILED(frame->findFrameNamed(targetBSTR, &targetFrame)); - SysFreeString(targetBSTR); - if (failed) - return; - } - - COMPtr<IWebURLRequest> request; - if (FAILED(CoCreateInstance(CLSID_WebURLRequest, 0, CLSCTX_ALL, IID_IWebURLRequest, (void**)&request))) - return; - - wstring urlString = jsStringRefToWString(url()); - BSTR urlBSTR = SysAllocString(urlString.c_str()); - bool failed = FAILED(request->initWithURL(urlBSTR, WebURLRequestUseProtocolCachePolicy, 60)); - SysFreeString(urlBSTR); - if (failed) - return; - - targetFrame->loadRequest(request.get()); -} - -void ReloadItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebIBActions> webActions; - if (SUCCEEDED(webView->QueryInterface(&webActions))) - webActions->reload(0); -} - -void ScriptItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - wstring scriptString = jsStringRefToWString(script()); - - BSTR result; - BSTR scriptBSTR = SysAllocString(scriptString.c_str()); - webView->stringByEvaluatingJavaScriptFromString(scriptBSTR, &result); - SysFreeString(result); - SysFreeString(scriptBSTR); -} - -void BackForwardItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - BOOL result; - if (m_howFar == 1) { - webView->goForward(&result); - return; - } - - if (m_howFar == -1) { - webView->goBack(&result); - return; - } - - COMPtr<IWebBackForwardList> bfList; - if (FAILED(webView->backForwardList(&bfList))) - return; - - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(m_howFar, &item))) - return; - - webView->goToBackForwardItem(item.get(), &result); -} |