diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/DumpRenderTree/win | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/DumpRenderTree/win')
34 files changed, 0 insertions, 9814 deletions
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp deleted file mode 100644 index f03c102..0000000 --- a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010 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 "FrameLoadDelegate.h" -#include <JavaScriptCore/Assertions.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRef.h> -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <oleacc.h> -#include <string> - -using namespace std; - -AccessibilityController::AccessibilityController() - : m_focusEventHook(0) - , m_scrollingStartEventHook(0) - , m_valueChangeEventHook(0) - , m_allEventsHook(0) -{ -} - -AccessibilityController::~AccessibilityController() -{ - setLogFocusEvents(false); - setLogValueChangeEvents(false); - - if (m_allEventsHook) - UnhookWinEvent(m_allEventsHook); - - for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) - JSValueUnprotect(frame->globalContext(), it->second); -} - -AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y) -{ - // FIXME: implement - return 0; -} - -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; -} - -static void CALLBACK logEventProc(HWINEVENTHOOK, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD) -{ - // Get the accessible object for this event. - COMPtr<IAccessible> parentObject; - - VARIANT vChild; - VariantInit(&vChild); - - HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &parentObject, &vChild); - ASSERT(SUCCEEDED(hr)); - - // Get the name of the focused element, and log it to stdout. - BSTR nameBSTR; - hr = parentObject->get_accName(vChild, &nameBSTR); - ASSERT(SUCCEEDED(hr)); - wstring name(nameBSTR, ::SysStringLen(nameBSTR)); - SysFreeString(nameBSTR); - - switch (event) { - case EVENT_OBJECT_FOCUS: - printf("Received focus event for object '%S'.\n", name.c_str()); - break; - - case EVENT_OBJECT_VALUECHANGE: { - BSTR valueBSTR; - hr = parentObject->get_accValue(vChild, &valueBSTR); - ASSERT(SUCCEEDED(hr)); - wstring value(valueBSTR, ::SysStringLen(valueBSTR)); - SysFreeString(valueBSTR); - - printf("Received value change event for object '%S', value '%S'.\n", name.c_str(), value.c_str()); - break; - } - - case EVENT_SYSTEM_SCROLLINGSTART: - printf("Received scrolling start event for object '%S'.\n", name.c_str()); - break; - - default: - printf("Received unknown event for object '%S'.\n", name.c_str()); - break; - } - - VariantClear(&vChild); -} - -void AccessibilityController::setLogFocusEvents(bool logFocusEvents) -{ - if (!!m_focusEventHook == logFocusEvents) - return; - - if (!logFocusEvents) { - UnhookWinEvent(m_focusEventHook); - m_focusEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_focusEventHook = SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_focusEventHook); -} - -void AccessibilityController::setLogValueChangeEvents(bool logValueChangeEvents) -{ - if (!!m_valueChangeEventHook == logValueChangeEvents) - return; - - if (!logValueChangeEvents) { - UnhookWinEvent(m_valueChangeEventHook); - m_valueChangeEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_valueChangeEventHook = SetWinEventHook(EVENT_OBJECT_VALUECHANGE, EVENT_OBJECT_VALUECHANGE, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_valueChangeEventHook); -} - -void AccessibilityController::setLogScrollingStartEvents(bool logScrollingStartEvents) -{ - if (!!m_scrollingStartEventHook == logScrollingStartEvents) - return; - - if (!logScrollingStartEvents) { - UnhookWinEvent(m_scrollingStartEventHook); - m_scrollingStartEventHook = 0; - return; - } - - // Ensure that accessibility is initialized for the WebView by querying for - // the root accessible object. - rootElement(); - - m_scrollingStartEventHook = SetWinEventHook(EVENT_SYSTEM_SCROLLINGSTART, EVENT_SYSTEM_SCROLLINGSTART, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - ASSERT(m_scrollingStartEventHook); -} - -static string stringEvent(DWORD event) -{ - switch(event) { - case EVENT_OBJECT_VALUECHANGE: - return "value change event"; - default: - return "unknown event"; - } -} - -static void CALLBACK notificationListenerProc(HWINEVENTHOOK, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD, DWORD) -{ - // Get the accessible object for this event. - COMPtr<IAccessible> parentObject; - - VARIANT vChild; - VariantInit(&vChild); - - HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &parentObject, &vChild); - if (FAILED(hr) || !parentObject) - return; - - COMPtr<IDispatch> childDispatch; - if (FAILED(parentObject->get_accChild(vChild, &childDispatch))) { - VariantClear(&vChild); - return; - } - - COMPtr<IAccessible> childAccessible(Query, childDispatch); - - sharedFrameLoadDelegate->accessibilityController()->notificationReceived(childAccessible, stringEvent(event)); - - VariantClear(&vChild); -} - -static COMPtr<IAccessibleComparable> comparableObject(const COMPtr<IServiceProvider>& serviceProvider) -{ - COMPtr<IAccessibleComparable> comparable; - serviceProvider->QueryService(SID_AccessibleComparable, __uuidof(IAccessibleComparable), reinterpret_cast<void**>(&comparable)); - return comparable; -} - -void AccessibilityController::notificationReceived(PlatformUIElement element, const string& eventName) -{ - for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) { - COMPtr<IServiceProvider> thisServiceProvider(Query, it->first); - if (!thisServiceProvider) - continue; - - COMPtr<IAccessibleComparable> thisComparable = comparableObject(thisServiceProvider); - if (!thisComparable) - continue; - - COMPtr<IServiceProvider> elementServiceProvider(Query, element); - if (!elementServiceProvider) - continue; - - COMPtr<IAccessibleComparable> elementComparable = comparableObject(elementServiceProvider); - if (!elementComparable) - continue; - - BOOL isSame = FALSE; - thisComparable->isSameObject(elementComparable.get(), &isSame); - if (!isSame) - continue; - - JSRetainPtr<JSStringRef> jsNotification(Adopt, JSStringCreateWithUTF8CString(eventName.c_str())); - JSValueRef argument = JSValueMakeString(frame->globalContext(), jsNotification.get()); - JSObjectCallAsFunction(frame->globalContext(), it->second, NULL, 1, &argument, NULL); - } -} - -void AccessibilityController::addNotificationListener(PlatformUIElement element, JSObjectRef functionCallback) -{ - if (!m_allEventsHook) - m_allEventsHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), notificationListenerProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); - - JSValueProtect(frame->globalContext(), functionCallback); - m_notificationListeners.add(element, functionCallback); -} diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp deleted file mode 100644 index 5b771b2..0000000 --- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ /dev/null @@ -1,669 +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 "AccessibilityController.h" -#include "DumpRenderTree.h" -#include "FrameLoadDelegate.h" -#include <JavaScriptCore/JSStringRef.h> -#include <tchar.h> -#include <string> - -using std::wstring; - -static COMPtr<IAccessibleComparable> comparableObject(IAccessible* accessible) -{ - COMPtr<IServiceProvider> serviceProvider(Query, accessible); - if (!serviceProvider) - return 0; - COMPtr<IAccessibleComparable> comparable; - serviceProvider->QueryService(SID_AccessibleComparable, __uuidof(IAccessibleComparable), reinterpret_cast<void**>(&comparable)); - return comparable; -} - -AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) - : m_element(element) -{ -} - -AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) - : m_element(other.m_element) -{ -} - -AccessibilityUIElement::~AccessibilityUIElement() -{ -} - -bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement) -{ - COMPtr<IAccessibleComparable> comparable = comparableObject(m_element.get()); - COMPtr<IAccessibleComparable> otherComparable = comparableObject(otherElement->m_element.get()); - if (!comparable || !otherComparable) - return false; - BOOL isSame = FALSE; - if (FAILED(comparable->isSameObject(otherComparable.get(), &isSame))) - return false; - return isSame; -} - -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)); -} - -void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned location, unsigned length) -{ - long childCount; - unsigned appendedCount = 0; - if (FAILED(m_element->get_accChildCount(&childCount))) - return; - for (long i = location; i < childCount && appendedCount < length; ++i, ++appendedCount) - elementVector.append(getChildAtIndex(i)); -} - -int AccessibilityUIElement::childrenCount() -{ - long childCount; - m_element->get_accChildCount(&childCount); - return childCount; -} - -int AccessibilityUIElement::rowCount() -{ - // FIXME: implement - return 0; -} - -int AccessibilityUIElement::columnCount() -{ - // FIXME: implement - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) -{ - // FIXME: implement - return 0; -} - -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); -} - -unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) -{ - // FIXME: implement - return 0; -} - -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; -} - -AccessibilityUIElement AccessibilityUIElement::parentElement() -{ - COMPtr<IDispatch> parent; - m_element->get_accParent(&parent); - - COMPtr<IAccessible> parentAccessible(Query, parent); - return parentAccessible; -} - -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 || V_VT(&vRole) == VT_BSTR); - - wstring result; - if (V_VT(&vRole) == VT_I4) { - unsigned roleTextLength = ::GetRoleText(V_I4(&vRole), 0, 0) + 1; - - Vector<TCHAR> roleText(roleTextLength); - - ::GetRoleText(V_I4(&vRole), roleText.data(), roleTextLength); - - result = roleText.data(); - } else if (V_VT(&vRole) == VT_BSTR) - result = wstring(V_BSTR(&vRole), ::SysStringLen(V_BSTR(&vRole))); - - ::VariantClear(&vRole); - - return JSStringCreateWithCharacters(result.data(), result.length()); -} - -JSStringRef AccessibilityUIElement::subrole() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::roleDescription() -{ - return 0; -} - -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_accDescription(self(), &descriptionBSTR)) || !descriptionBSTR) - return JSStringCreateWithCharacters(0, 0); - wstring description(descriptionBSTR, SysStringLen(descriptionBSTR)); - ::SysFreeString(descriptionBSTR); - return JSStringCreateWithCharacters(description.data(), description.length()); -} - -JSStringRef AccessibilityUIElement::stringValue() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::language() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::helpText() const -{ - return 0; -} - -double AccessibilityUIElement::x() -{ - long x, y, width, height; - if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) - return 0; - return x; -} - -double AccessibilityUIElement::y() -{ - long x, y, width, height; - if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) - return 0; - return y; -} - -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::clickPointX() -{ - return 0; -} - -double AccessibilityUIElement::clickPointY() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::valueDescription() -{ - return 0; -} - -static DWORD accessibilityState(COMPtr<IAccessible> element) -{ - VARIANT state; - element->get_accState(self(), &state); - - ASSERT(V_VT(&state) == VT_I4); - - DWORD result = state.lVal; - VariantClear(&state); - - return result; -} - -bool AccessibilityUIElement::isSelected() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_SELECTED) == STATE_SYSTEM_SELECTED; -} - -int AccessibilityUIElement::hierarchicalLevel() const -{ - return 0; -} - -bool AccessibilityUIElement::ariaIsGrabbed() const -{ - return false; -} - -JSStringRef AccessibilityUIElement::ariaDropEffects() const -{ - return 0; -} - -bool AccessibilityUIElement::isExpanded() const -{ - return false; -} - -bool AccessibilityUIElement::isChecked() const -{ - VARIANT vState; - if (FAILED(m_element->get_accState(self(), &vState))) - return false; - - return vState.lVal & STATE_SYSTEM_CHECKED; -} - -JSStringRef AccessibilityUIElement::orientation() const -{ - return 0; -} - -double AccessibilityUIElement::intValue() const -{ - 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::isActionSupported(JSStringRef action) -{ - return false; -} - -bool AccessibilityUIElement::isEnabled() -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_UNAVAILABLE) != STATE_SYSTEM_UNAVAILABLE; -} - -bool AccessibilityUIElement::isRequired() const -{ - 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); -} - -JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) -{ - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) -{ - return false; -} - -AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) -{ - return 0; -} - -JSStringRef AccessibilityUIElement::selectedTextRange() -{ - return JSStringCreateWithCharacters(0, 0); -} - -void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) -{ -} - -JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) -{ - return false; -} - -bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) -{ - return false; -} - -void AccessibilityUIElement::increment() -{ -} - -void AccessibilityUIElement::decrement() -{ -} - -void AccessibilityUIElement::showMenu() -{ - ASSERT(hasPopup()); - m_element->accDoDefaultAction(self()); -} - -void AccessibilityUIElement::press() -{ - // FIXME: implement -} - -AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index) -{ - return 0; -} - -AccessibilityUIElement AccessibilityUIElement::disclosedByRow() -{ - return 0; -} - -JSStringRef AccessibilityUIElement::accessibilityValue() const -{ - BSTR valueBSTR; - if (FAILED(m_element->get_accValue(self(), &valueBSTR)) || !valueBSTR) - return JSStringCreateWithCharacters(0, 0); - - wstring value(valueBSTR, SysStringLen(valueBSTR)); - ::SysFreeString(valueBSTR); - - return JSStringCreateWithCharacters(value.data(), value.length()); -} - - -JSStringRef AccessibilityUIElement::documentEncoding() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::documentURI() -{ - return JSStringCreateWithCharacters(0, 0); -} - -JSStringRef AccessibilityUIElement::url() -{ - // FIXME: implement - return JSStringCreateWithCharacters(0, 0); -} - -bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) -{ - if (!functionCallback) - return false; - - sharedFrameLoadDelegate->accessibilityController()->addNotificationListener(m_element, functionCallback); - return true; -} - -void AccessibilityUIElement::removeNotificationListener() -{ - // FIXME: implement -} - -bool AccessibilityUIElement::isSelectable() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_SELECTABLE) == STATE_SYSTEM_SELECTABLE; -} - -bool AccessibilityUIElement::isMultiSelectable() const -{ - DWORD multiSelectable = STATE_SYSTEM_EXTSELECTABLE | STATE_SYSTEM_MULTISELECTABLE; - DWORD state = accessibilityState(m_element); - return (state & multiSelectable) == multiSelectable; -} - -bool AccessibilityUIElement::isVisible() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_INVISIBLE) != STATE_SYSTEM_INVISIBLE; -} - -bool AccessibilityUIElement::isOffScreen() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_OFFSCREEN) == STATE_SYSTEM_OFFSCREEN; -} - -bool AccessibilityUIElement::isCollapsed() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_COLLAPSED) == STATE_SYSTEM_COLLAPSED; -} - -bool AccessibilityUIElement::isIgnored() const -{ - // FIXME: implement - return false; -} - -bool AccessibilityUIElement::hasPopup() const -{ - DWORD state = accessibilityState(m_element); - return (state & STATE_SYSTEM_HASPOPUP) == STATE_SYSTEM_HASPOPUP; -} - -void AccessibilityUIElement::takeFocus() -{ - m_element->accSelect(SELFLAG_TAKEFOCUS, self()); -} - -void AccessibilityUIElement::takeSelection() -{ - m_element->accSelect(SELFLAG_TAKESELECTION, self()); -} - -void AccessibilityUIElement::addSelection() -{ - m_element->accSelect(SELFLAG_ADDSELECTION, self()); -} - -void AccessibilityUIElement::removeSelection() -{ - m_element->accSelect(SELFLAG_REMOVESELECTION, self()); -} diff --git a/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp b/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp deleted file mode 100644 index 1bc4678..0000000 --- a/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2009 Google 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT - * OWNER 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 "DRTDesktopNotificationPresenter.h" - -#include "DumpRenderTree.h" -#include "LayoutTestController.h" -#include <JavaScriptCore/JSStringRef.h> -#include <JavaScriptCore/JSStringRefBSTR.h> -#include <WebCore/NotificationPresenter.h> - -DRTDesktopNotificationPresenter::DRTDesktopNotificationPresenter() - : m_refCount(1) {} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<DRTDesktopNotificationPresenter*>(this); - else if (IsEqualGUID(riid, IID_IWebDesktopNotificationsDelegate)) - *ppvObject = static_cast<DRTDesktopNotificationPresenter*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG STDMETHODCALLTYPE DRTDesktopNotificationPresenter::AddRef() -{ - return ++m_refCount; -} - -ULONG STDMETHODCALLTYPE DRTDesktopNotificationPresenter::Release() -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::showDesktopNotification( - /* [in] */ IWebDesktopNotification* notification) -{ - BSTR title, text, url; - BOOL html; - - if (!notification->isHTML(&html) && html) { - notification->contentsURL(&url); - printf("DESKTOP NOTIFICATION: contents at %S\n", url ? url : L""); - } else { - notification->iconURL(&url); - notification->title(&title); - notification->text(&text); - printf("DESKTOP NOTIFICATION: icon %S, title %S, text %S\n", - url ? url : L"", - title ? title : L"", - text ? text : L""); - } - - // In this stub implementation, the notification is displayed immediately; - // we dispatch the display event to mimic that. - notification->notifyDisplay(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::cancelDesktopNotification( - /* [in] */ IWebDesktopNotification* notification) -{ - BSTR identifier; - BOOL html; - notification->isHTML(&html); - if (html) - notification->contentsURL(&identifier); - else - notification->title(&identifier); - - printf("DESKTOP NOTIFICATION CLOSED: %S\n", identifier ? identifier : L""); - notification->notifyClose(false); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::notificationDestroyed( - /* [in] */ IWebDesktopNotification* notification) -{ - // Since in these tests events happen immediately, we don't hold on to - // Notification pointers. So there's no cleanup to do. - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::checkNotificationPermission( - /* [in] */ BSTR origin, - /* [out, retval] */ int* result) -{ -#if ENABLE(NOTIFICATIONS) - JSStringRef jsOrigin = JSStringCreateWithBSTR(origin); - bool allowed = ::gLayoutTestController->checkDesktopNotificationPermission(jsOrigin); - - if (allowed) - *result = WebCore::NotificationPresenter::PermissionAllowed; - else - *result = WebCore::NotificationPresenter::PermissionDenied; - - JSStringRelease(jsOrigin); -#endif - return S_OK; -} - -HRESULT STDMETHODCALLTYPE DRTDesktopNotificationPresenter::requestNotificationPermission( - /* [in] */ BSTR origin) -{ - printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %S\n", origin ? origin : L""); - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h b/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h deleted file mode 100644 index 5679845..0000000 --- a/WebKitTools/DumpRenderTree/win/DRTDesktopNotificationPresenter.h +++ /dev/null @@ -1,66 +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 DRTDesktopNotificationPresenter_h -#define DRTDesktopNotificationPresenter_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> -#include <windef.h> - -class DRTDesktopNotificationPresenter : public IWebDesktopNotificationsDelegate { -public: - DRTDesktopNotificationPresenter(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebDesktopNotificationsDelegate - virtual HRESULT STDMETHODCALLTYPE showDesktopNotification( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE cancelDesktopNotification( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE notificationDestroyed( - /* [in] */ IWebDesktopNotification* notification); - - virtual HRESULT STDMETHODCALLTYPE checkNotificationPermission( - /* [in] */ BSTR origin, - /* [out, retval] */ int* result); - - virtual HRESULT STDMETHODCALLTYPE requestNotificationPermission( - /* [in] */ BSTR origin); - -private: - ULONG m_refCount; -}; - -#endif diff --git a/WebKitTools/DumpRenderTree/win/DraggingInfo.h b/WebKitTools/DumpRenderTree/win/DraggingInfo.h deleted file mode 100644 index 98982bc..0000000 --- a/WebKitTools/DumpRenderTree/win/DraggingInfo.h +++ /dev/null @@ -1,67 +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_performedDropEffect(DROPEFFECT_NONE) - { - 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; } - - DWORD performedDropEffect() const { return m_performedDropEffect; } - void setPerformedDropEffect(DWORD effect) { m_performedDropEffect = effect; } - -private: - IDataObject* m_object; - IDropSource* m_source; - DWORD m_performedDropEffect; -}; - -#endif // !defined(DraggingInfo_h) diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp deleted file mode 100644 index a8028c5..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ /dev/null @@ -1,1392 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2008, 2009 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 "HistoryDelegate.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 <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> - -#if USE(CFNETWORK) -#include <CFNetwork/CFURLCachePriv.h> -#endif - -#if USE(CFNETWORK) -#include <CFNetwork/CFHTTPCookiesPriv.h> -#endif - -using namespace std; - -#ifdef DEBUG_ALL -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 bool printSupportedFeatures = 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 -PolicyDelegate* policyDelegate; -COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; -COMPtr<UIDelegate> sharedUIDelegate; -COMPtr<EditingDelegate> sharedEditingDelegate; -COMPtr<HistoryDelegate> sharedHistoryDelegate; - -IWebFrame* frame; -HWND webViewWindow; - -RefPtr<LayoutTestController> gLayoutTestController; - -UINT_PTR waitToDumpWatchdog = 0; - -void setPersistentUserStyleSheetLocation(CFStringRef url) -{ - persistentUserStyleSheetLocation = url; -} - -bool setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ -#if USE(CFNETWORK) - COMPtr<IWebCookieManager> cookieManager; - if (FAILED(WebKitCreateInstance(CLSID_WebCookieManager, 0, IID_IWebCookieManager, reinterpret_cast<void**>(&cookieManager)))) - return false; - CFHTTPCookieStorageRef cookieStorage = 0; - if (FAILED(cookieManager->cookieStorage(&cookieStorage)) || !cookieStorage) - return false; - - WebKitCookieStorageAcceptPolicy cookieAcceptPolicy = alwaysAcceptCookies ? WebKitCookieStorageAcceptPolicyAlways : WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain; - CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage, cookieAcceptPolicy); - return true; -#else - // FIXME: Implement! - return false; -#endif -} - -wstring urlSuitableForTestResult(const wstring& url) -{ - if (url.find(L"file://") == wstring::npos) - return url; - - return lastPathComponent(url); -} - -wstring lastPathComponent(const wstring& url) -{ - if (url.empty()) - return url; - - return PathFindFileNameW(url.c_str()); -} - -static string toUTF8(const wchar_t* wideString, size_t length) -{ - int result = WideCharToMultiByte(CP_UTF8, 0, wideString, length + 1, 0, 0, 0, 0); - Vector<char> utf8Vector(result); - result = WideCharToMultiByte(CP_UTF8, 0, wideString, length + 1, utf8Vector.data(), result, 0, 0); - if (!result) - return string(); - - return string(utf8Vector.data(), utf8Vector.size() - 1); -} - -string toUTF8(BSTR bstr) -{ - return toUTF8(bstr, SysStringLen(bstr)); -} - -string toUTF8(const wstring& wideString) -{ - return toUTF8(wideString.c_str(), wideString.length()); -} - -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; -} - -static void addQTDirToPATH() -{ - static LPCWSTR pathEnvironmentVariable = L"PATH"; - static LPCWSTR quickTimeKeyName = L"Software\\Apple Computer, Inc.\\QuickTime"; - static LPCWSTR quickTimeSysDir = L"QTSysDir"; - static bool initialized; - - if (initialized) - return; - initialized = true; - - // Get the QuickTime dll directory from the registry. The key can be in either HKLM or HKCU. - WCHAR qtPath[MAX_PATH]; - DWORD qtPathBufferLen = sizeof(qtPath); - DWORD keyType; - HRESULT result = SHGetValue(HKEY_LOCAL_MACHINE, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen); - if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) { - qtPathBufferLen = sizeof(qtPath); - result = SHGetValue(HKEY_CURRENT_USER, quickTimeKeyName, quickTimeSysDir, &keyType, (LPVOID)qtPath, &qtPathBufferLen); - if (result != ERROR_SUCCESS || !qtPathBufferLen || keyType != REG_SZ) - return; - } - - // Read the current PATH. - DWORD pathSize = GetEnvironmentVariableW(pathEnvironmentVariable, 0, 0); - Vector<WCHAR> oldPath(pathSize); - if (!GetEnvironmentVariableW(pathEnvironmentVariable, oldPath.data(), oldPath.size())) - return; - - // And add the QuickTime dll. - wstring newPath; - newPath.append(qtPath); - newPath.append(L";"); - newPath.append(oldPath.data(), oldPath.size()); - SetEnvironmentVariableW(pathEnvironmentVariable, newPath.data()); -} - -#ifdef DEBUG_ALL -#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 2.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(WebKitCreateInstance(CLSID_WebTextRenderer, 0, IID_IWebTextRenderer, (void**)&textRenderer))) - for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i) - textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str()); - - // Add the QuickTime dll directory to PATH or QT 7.6 will fail to initialize on systems - // linked with older versions of qtmlclientlib.dll. - addQTDirToPATH(); - - // 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); - ::SendMessage(webViewWindow, WM_PAINT, 0, 0); -} - -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; - - if (wcsstr(url, L"file:/") == url) { - static wchar_t* layoutTestsString = L"/LayoutTests/"; - static wchar_t* fileTestString = L"(file test):"; - - wchar_t* result = wcsstr(url, layoutTestsString); - if (result == NULL) - return; - wchar_t* start = result + wcslen(layoutTestsString); - - BSTR newURL = SysAllocStringLen(NULL, SysStringLen(url)); - wcscpy(newURL, fileTestString); - wcscpy(newURL + wcslen(fileTestString), start); - - SysFreeString(url); - url = newURL; - } - - 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).get(); - dumpBackForwardList(webView); - } -} - -static void invalidateAnyPreviousWaitToDumpWatchdog() -{ - if (!waitToDumpWatchdog) - return; - - KillTimer(0, waitToDumpWatchdog); - waitToDumpWatchdog = 0; -} - -void dump() -{ - invalidateAnyPreviousWaitToDumpWatchdog(); - - COMPtr<IWebDataSource> dataSource; - if (SUCCEEDED(frame->dataSource(&dataSource))) { - COMPtr<IWebURLResponse> response; - if (SUCCEEDED(dataSource->response(&response)) && response) { - BSTR mimeType; - if (SUCCEEDED(response->MIMEType(&mimeType)) && !_tcscmp(mimeType, TEXT("text/plain"))) { - ::gLayoutTestController->setDumpAsText(true); - ::gLayoutTestController->setGeneratePixelResults(false); - } - 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 = LayoutTestController::maxViewWidth; - height = LayoutTestController::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(gLayoutTestController->isPrinting(), &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 - && gLayoutTestController->generatePixelResults() - && !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/") || strstr(pathOrURL, "\\loading\\"); -} - -static bool shouldLogHistoryDelegates(const char* pathOrURL) -{ - return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\"); -} - -static bool shouldOpenWebInspector(const char* pathOrURL) -{ - return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\"); -} - -static bool shouldEnableDeveloperExtras(const char* pathOrURL) -{ - return true; -} - -static void resetDefaultsToConsistentValues(IWebPreferences* preferences) -{ -#ifdef USE_MAC_FONTS - static BSTR standardFamily = SysAllocString(TEXT("Times")); - static BSTR fixedFamily = SysAllocString(TEXT("Courier")); - static BSTR sansSerifFamily = SysAllocString(TEXT("Helvetica")); - static BSTR cursiveFamily = SysAllocString(TEXT("Apple Chancery")); - static BSTR fantasyFamily = SysAllocString(TEXT("Papyrus")); -#else - static BSTR standardFamily = SysAllocString(TEXT("Times New Roman")); - static BSTR fixedFamily = SysAllocString(TEXT("Courier New")); - static BSTR sansSerifFamily = SysAllocString(TEXT("Arial")); - static BSTR cursiveFamily = SysAllocString(TEXT("Comic Sans MS")); // Not actually cursive, but it's what IE and Firefox use. - static 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->setDefaultFontSize(16); - preferences->setDefaultFixedFontSize(13); - preferences->setMinimumFontSize(0); - preferences->setJavaEnabled(FALSE); - preferences->setPlugInsEnabled(TRUE); - preferences->setDOMPasteAllowed(TRUE); - preferences->setEditableLinkBehavior(WebKitEditableLinkOnlyLiveWithShiftKey); - preferences->setFontSmoothing(FontSmoothingTypeStandard); - preferences->setUsesPageCache(FALSE); - preferences->setPrivateBrowsingEnabled(FALSE); - preferences->setJavaScriptCanOpenWindowsAutomatically(TRUE); - preferences->setJavaScriptEnabled(TRUE); - preferences->setTabsToLinks(FALSE); - preferences->setShouldPrintBackgrounds(TRUE); - preferences->setLoadsImagesAutomatically(TRUE); - preferences->setEditingBehavior(WebKitEditingWinBehavior); - - 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->setAllowUniversalAccessFromFileURLs(TRUE); - prefsPrivate->setAllowFileAccessFromFileURLs(TRUE); - prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); - prefsPrivate->setDeveloperExtrasEnabled(FALSE); - prefsPrivate->setExperimentalNotificationsEnabled(TRUE); - prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> - prefsPrivate->setJavaScriptCanAccessClipboard(TRUE); - prefsPrivate->setXSSAuditorEnabled(FALSE); - prefsPrivate->setFrameFlatteningEnabled(FALSE); - prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); - } - setAlwaysAcceptCookies(false); - - setlocale(LC_ALL, ""); -} - -static void resetWebViewToConsistentStateBeforeTesting() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - webView->setPolicyDelegate(0); - policyDelegate->setPermissive(false); - policyDelegate->setControllerToNotifyDone(0); - - COMPtr<IWebIBActions> webIBActions(Query, webView); - if (webIBActions) { - webIBActions->makeTextStandardSize(0); - webIBActions->resetPageZoom(0); - } - - - COMPtr<IWebPreferences> preferences; - if (SUCCEEDED(webView->preferences(&preferences))) - resetDefaultsToConsistentValues(preferences.get()); - - 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(); - webViewPrivate->resetOriginAccessWhitelists(); - - BSTR groupName; - if (SUCCEEDED(webView->groupName(&groupName))) { - webViewPrivate->removeAllUserContentFromGroup(groupName); - SysFreeString(groupName); - } - - sharedUIDelegate->resetUndoManager(); - - sharedFrameLoadDelegate->resetToConsistentState(); -} - -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 = LayoutTestController::create(pathOrURL, expectedPixelHash); - done = false; - topLoadingFrame = 0; - - gLayoutTestController->setIconDatabaseEnabled(false); - - if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) - gLayoutTestController->setDumpFrameLoadCallbacks(true); - - COMPtr<IWebView> webView; - if (SUCCEEDED(frame->webView(&webView))) { - COMPtr<IWebViewPrivate> viewPrivate; - if (SUCCEEDED(webView->QueryInterface(&viewPrivate))) { - if (shouldLogHistoryDelegates(pathOrURL.c_str())) { - gLayoutTestController->setDumpHistoryDelegateCallbacks(true); - viewPrivate->setHistoryDelegate(sharedHistoryDelegate.get()); - } else - viewPrivate->setHistoryDelegate(0); - } - } - COMPtr<IWebHistory> history; - if (SUCCEEDED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - history->setOptionalSharedHistory(0); - - resetWebViewToConsistentStateBeforeTesting(); - - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gLayoutTestController->setDeveloperExtrasEnabled(true); - if (shouldOpenWebInspector(pathOrURL.c_str())) - gLayoutTestController->showWebInspector(); - } - - prevTestBFItem = 0; - if (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 = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, 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); - } - - if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { - gLayoutTestController->closeWebInspector(); - gLayoutTestController->setDeveloperExtrasEnabled(false); - } - - resetWebViewToConsistentStateBeforeTesting(); - - 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.clear(); - - return; -} - -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; -} - -WindowToWebViewMap& windowToWebViewMap() -{ - static WindowToWebViewMap map; - return map; -} - -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) -{ - unsigned maxViewWidth = LayoutTestController::maxViewWidth; - unsigned maxViewHeight = LayoutTestController::maxViewHeight; - HWND hostWindow = CreateWindowEx(WS_EX_TOOLWINDOW, kDumpRenderTreeClassName, TEXT("DumpRenderTree"), WS_POPUP, - -maxViewWidth, -maxViewHeight, maxViewWidth, maxViewHeight, 0, 0, GetModuleHandle(0), 0); - - IWebView* webView; - - HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, 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; - - ResourceLoadDelegate* resourceLoadDelegate = new ResourceLoadDelegate(); - HRESULT result = webView->setResourceLoadDelegate(resourceLoadDelegate); - resourceLoadDelegate->Release(); // The delegate is owned by the WebView, so release our reference to it. - if (FAILED(result)) - return 0; - - openWindows().append(hostWindow); - windowToWebViewMap().set(hostWindow, webView); - return webView; -} - -#if USE(CFNETWORK) -RetainPtr<CFURLCacheRef> sharedCFURLCache() -{ -#ifndef DEBUG_ALL - HMODULE module = GetModuleHandle(TEXT("CFNetwork.dll")); -#else - HMODULE module = GetModuleHandle(TEXT("CFNetwork_debug.dll")); -#endif - if (!module) - return 0; - - typedef CFURLCacheRef (*CFURLCacheCopySharedURLCacheProcPtr)(void); - if (CFURLCacheCopySharedURLCacheProcPtr copyCache = reinterpret_cast<CFURLCacheCopySharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheCopySharedURLCache"))) - return RetainPtr<CFURLCacheRef>(AdoptCF, copyCache()); - - typedef CFURLCacheRef (*CFURLCacheSharedURLCacheProcPtr)(void); - if (CFURLCacheSharedURLCacheProcPtr sharedCache = reinterpret_cast<CFURLCacheSharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheSharedURLCache"))) - return sharedCache(); - - return 0; -} -#endif - -static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*) -{ - fputs("#CRASHED\n", stderr); - fflush(stderr); - return EXCEPTION_CONTINUE_SEARCH; -} - -int main(int argc, char* argv[]) -{ - ::SetUnhandledExceptionFilter(exceptionFilter); - - 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; - } - - if (!stricmp(argv[i], "--print-supported-features")) { - printSupportedFeatures = true; - continue; - } - - tests.append(argv[i]); - } - - policyDelegate = new PolicyDelegate(); - sharedFrameLoadDelegate.adoptRef(new FrameLoadDelegate); - sharedUIDelegate.adoptRef(new UIDelegate); - sharedEditingDelegate.adoptRef(new EditingDelegate); - sharedHistoryDelegate.adoptRef(new HistoryDelegate); - - // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> - COMPtr<IWebPreferences> tmpPreferences; - if (FAILED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, reinterpret_cast<void**>(&tmpPreferences)))) - return -1; - COMPtr<IWebPreferences> standardPreferences; - if (FAILED(tmpPreferences->standardPreferences(&standardPreferences))) - return -1; - COMPtr<IWebPreferencesPrivate> standardPreferencesPrivate; - if (FAILED(standardPreferences->QueryInterface(&standardPreferencesPrivate))) - return -1; - standardPreferencesPrivate->setShouldPaintNativeControls(FALSE); - standardPreferences->setJavaScriptEnabled(TRUE); - standardPreferences->setDefaultFontSize(16); - standardPreferences->setAcceleratedCompositingEnabled(true); - standardPreferences->setContinuousSpellCheckingEnabled(TRUE); - - if (printSupportedFeatures) { - BOOL acceleratedCompositingAvailable; - standardPreferences->acceleratedCompositingEnabled(&acceleratedCompositingAvailable); - -#if ENABLE(3D_RENDERING) - // In theory, we could have a software-based 3D rendering implementation that we use when - // hardware-acceleration is not available. But we don't have any such software - // implementation, so 3D rendering is only available when hardware-acceleration is. - BOOL threeDRenderingAvailable = acceleratedCompositingAvailable; -#else - BOOL threeDRenderingAvailable = FALSE; -#endif - - printf("SupportedFeatures:%s %s\n", acceleratedCompositingAvailable ? "AcceleratedCompositing" : "", threeDRenderingAvailable ? "3DRendering" : ""); - return 0; - } - - COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow)); - if (!webView) - return -1; - - COMPtr<IWebIconDatabase> iconDatabase; - COMPtr<IWebIconDatabase> tmpIconDatabase; - if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) - return -1; - if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) - return -1; - - if (FAILED(webView->mainFrame(&frame))) - return -1; - -#if USE(CFNETWORK) - RetainPtr<CFURLCacheRef> urlCache = sharedCFURLCache(); - CFURLCacheRemoveAllCachedResponses(urlCache.get()); -#endif - -#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 e94897c..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj +++ /dev/null @@ -1,721 +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="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\cURL.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeCairo.vsprops;.\DumpRenderTreeCFLite.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_LTCG|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\DumpRenderTreeCommon.vsprops;.\DumpRenderTreeApple.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </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=".\DRTDesktopNotificationPresenter.cpp"
- >
- </File>
- <File
- RelativePath=".\DRTDesktopNotificationPresenter.h"
- >
- </File>
- <File
- RelativePath=".\EditingDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\EditingDelegate.h"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\FrameLoadDelegate.h"
- >
- </File>
- <File
- RelativePath=".\HistoryDelegate.cpp"
- >
- </File>
- <File
- RelativePath=".\HistoryDelegate.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="..\AccessibilityTextMarker.cpp"
- >
- </File>
- <File
- RelativePath="..\AccessibilityTextMarker.h"
- >
- </File>
- <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"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\MD5.h"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\PixelDumpSupport.cpp"
- >
- </File>
- <File
- RelativePath="..\PixelDumpSupport.h"
- >
- </File>
- <File
- RelativePath="..\cairo\PixelDumpSupportCairo.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_LTCG|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cairo\PixelDumpSupportCairo.h"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug_All|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_LTCG|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.cpp"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\cg\PixelDumpSupportCG.h"
- >
- <FileConfiguration
- Name="Debug_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo_CFLite|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </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/DumpRenderTreeApple.vsprops b/WebKitTools/DumpRenderTree/win/DumpRenderTreeApple.vsprops deleted file mode 100644 index a6db765..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeApple.vsprops +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeApple"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..\cg";"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops b/WebKitTools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops deleted file mode 100644 index 7e47f38..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCFLite.vsprops +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCFLite"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="CFLite$(LibraryConfigSuffix).lib"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops b/WebKitTools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops deleted file mode 100644 index 827bcd0..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCairo.vsprops +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCairo"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\..\cairo";"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops b/WebKitTools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops deleted file mode 100644 index ff572a5..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeCommon.vsprops +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="DumpRenderTreeCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)\.";"$(ProjectDir)\..";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitOutputDir)\Include\DumpRenderTree\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore""
- PreprocessorDefinitions="_CONSOLE"
- DisableSpecificWarnings="4146"
- ForcedIncludeFiles="DumpRenderTreePrefix.h"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib shlwapi.lib oleacc.lib comsuppw.lib"
- SubSystem="1"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

if not defined ARCHIVE_BUILD (if defined 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\CoreVideo$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreVideo$(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"
if exist "$(WebKitLibrariesDir)\bin\icudt40.dll" xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40.dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icudt42.dll" xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt42.dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icudt42$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icudt42$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuin42$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin42$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuin42$(LibraryConfigSuffix).pdb"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin42$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuuc42$(LibraryConfigSuffix).dll"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc42$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
if exist "$(WebKitLibrariesDir)\bin\icuuc42$(LibraryConfigSuffix).pdb"xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc42$(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"
"
- />
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
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"
if "$(ConfigurationName)"=="Debug_Cairo" xcopy /y /d "$(TargetDir)\..\include\WebCore\ForwardingHeaders\wtf\MD5.h"
if "$(ConfigurationName)"=="Release_Cairo" xcopy /y /d "$(TargetDir)\..\include\WebCore\ForwardingHeaders\wtf\MD5.h"
"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h b/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h deleted file mode 100644 index 27edaa6..0000000 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h +++ /dev/null @@ -1,69 +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 IWebScriptWorld; -struct IWebView; -struct FrameLoadDelegate; -struct PolicyDelegate; -typedef const struct __CFString* CFStringRef; -typedef struct HWND__* HWND; - -extern IWebFrame* topLoadingFrame; -extern IWebFrame* frame; -extern PolicyDelegate* policyDelegate; - -extern HWND webViewWindow; - -#include <WebCore/COMPtr.h> -#include <string> -#include <wtf/HashMap.h> -#include <wtf/Vector.h> - -std::wstring urlSuitableForTestResult(const std::wstring& url); -std::wstring lastPathComponent(const std::wstring&); -std::string toUTF8(BSTR); -std::string toUTF8(const std::wstring&); -IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0); -Vector<HWND>& openWindows(); -typedef HashMap<HWND, COMPtr<IWebView> > WindowToWebViewMap; -WindowToWebViewMap& windowToWebViewMap(); - -void setPersistentUserStyleSheetLocation(CFStringRef); -bool setAlwaysAcceptCookies(bool alwaysAcceptCookies); - -unsigned worldIDForWorld(IWebScriptWorld*); - -extern UINT_PTR waitToDumpWatchdog; - -extern COMPtr<FrameLoadDelegate> sharedFrameLoadDelegate; - -#endif // DumpRenderTreeWin_h diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp b/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp deleted file mode 100644 index 71859cb..0000000 --- a/WebKitTools/DumpRenderTree/win/EditingDelegate.cpp +++ /dev/null @@ -1,424 +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; -} - -static int indexOfFirstWordCharacter(const TCHAR* text) -{ - const TCHAR* cursor = text; - while (*cursor && !isalpha(*cursor)) - ++cursor; - return *cursor ? (cursor - text) : -1; -}; - -static int wordLength(const TCHAR* text) -{ - const TCHAR* cursor = text; - while (*cursor && isalpha(*cursor)) - ++cursor; - return cursor - text; -}; - -HRESULT STDMETHODCALLTYPE EditingDelegate::checkSpellingOfString( - /* [in] */ IWebView* view, - /* [in] */ LPCTSTR text, - /* [in] */ int length, - /* [out] */ int* misspellingLocation, - /* [out] */ int* misspellingLength) -{ - static const TCHAR* misspelledWords[] = { - // These words are known misspelled words in webkit tests. - // If there are other misspelled words in webkit tests, please add them in - // this array. - TEXT("foo"), - TEXT("Foo"), - TEXT("baz"), - TEXT("fo"), - TEXT("LibertyF"), - TEXT("chello"), - TEXT("xxxtestxxx"), - TEXT("XXxxx"), - TEXT("Textx"), - TEXT("blockquoted"), - TEXT("asd"), - TEXT("Lorem"), - TEXT("Nunc"), - TEXT("Curabitur"), - TEXT("eu"), - TEXT("adlj"), - TEXT("adaasj"), - TEXT("sdklj"), - TEXT("jlkds"), - TEXT("jsaada"), - TEXT("jlda"), - TEXT("zz"), - TEXT("contentEditable"), - 0, - }; - - wstring textString(text, length); - int wordStart = indexOfFirstWordCharacter(textString.c_str()); - if (-1 == wordStart) - return S_OK; - wstring word = textString.substr(wordStart, wordLength(textString.c_str() + wordStart)); - for (size_t i = 0; misspelledWords[i]; ++i) { - if (word == misspelledWords[i]) { - *misspellingLocation = wordStart; - *misspellingLength = word.size(); - break; - } - } - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/EditingDelegate.h b/WebKitTools/DumpRenderTree/win/EditingDelegate.h deleted file mode 100644 index 7b7f418..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); - - 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 94f0945..0000000 --- a/WebKitTools/DumpRenderTree/win/EventSender.cpp +++ /dev/null @@ -1,691 +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 WPARAM buildModifierFlags(JSContextRef context, const JSValueRef modifiers) -{ - JSObjectRef modifiersArray = JSValueToObject(context, modifiers, 0); - if (!modifiersArray) - return 0; - - WPARAM flags = 0; - int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, JSStringCreateWithUTF8CString("length"), 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") - || JSStringIsEqualToUTF8CString(string, "addSelectionKey")) - flags |= MK_CONTROL; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey") - || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey")) - flags |= MK_SHIFT; - // No way to specifiy altKey in a MSG. - - JSStringRelease(string); - } - return flags; -} - -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; - int mouseType = WM_LBUTTONDOWN; - if (argumentCount >= 1) { - int mouseNumber = JSValueToNumber(context, arguments[0], exception); - switch (mouseNumber) { - case 0: - mouseType = WM_LBUTTONDOWN; - break; - case 1: - mouseType = WM_MBUTTONDOWN; - break; - case 2: - mouseType = WM_RBUTTONDOWN; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button has event.button = 1, so send an WM_BUTTONDOWN - mouseType = WM_MBUTTONDOWN; - break; - default: - mouseType = WM_LBUTTONDOWN; - break; - } - } - - WPARAM wparam = 0; - if (argumentCount >= 2) - wparam |= buildModifierFlags(context, arguments[1]); - - MSG msg = makeMsg(webViewWindow, mouseType, wparam, 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, HRESULT* oleDragAndDropReturnValue = 0) -{ - 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); - if (oleDragAndDropReturnValue) - *oleDragAndDropReturnValue = hr; - 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); - draggingInfo->setPerformedDropEffect(effect); - } else - webViewDropTarget->DragLeave(); - - // Reset didDragEnter so that another drag started within the same frame works properly. - didDragEnter = false; - } - } -} - -static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) -{ - int mouseType = WM_LBUTTONUP; - if (argumentCount >= 1) { - int mouseNumber = JSValueToNumber(context, arguments[0], exception); - switch (mouseNumber) { - case 0: - mouseType = WM_LBUTTONUP; - break; - case 1: - mouseType = WM_MBUTTONUP; - break; - case 2: - mouseType = WM_RBUTTONUP; - break; - case 3: - // fast/events/mouse-click-events expects the 4th button has event.button = 1, so send an WM_MBUTTONUP - mouseType = WM_MBUTTONUP; - break; - default: - mouseType = WM_LBUTTONUP; - break; - } - } - - WPARAM wparam = 0; - if (argumentCount >= 2) - wparam |= buildModifierFlags(context, arguments[1]); - - MSG msg = makeMsg(webViewWindow, mouseType, wparam, 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(HRESULT* oleDragAndDropReturnValue) -{ - replayingSavedEvents = true; - - MSG msg = { 0 }; - - while (startOfQueue < endOfQueue && !msgQueue[startOfQueue].delay) { - msg = msgQueue[startOfQueue++].msg; - switch (msg.message) { - case WM_LBUTTONUP: - case WM_RBUTTONUP: - case WM_MBUTTONUP: - doMouseUp(msg, oleDragAndDropReturnValue); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_MBUTTONDOWN: - 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: - case WM_RBUTTONUP: - case WM_MBUTTONUP: - doMouseUp(msg, oleDragAndDropReturnValue); - break; - case WM_MOUSEMOVE: - doMouseMove(msg); - break; - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_MBUTTONDOWN: - 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, "insert")) - virtualKeyCode = VK_INSERT; - else if (JSStringIsEqualToUTF8CString(character, "delete")) - virtualKeyCode = VK_DELETE; - else if (JSStringIsEqualToUTF8CString(character, "printScreen")) - virtualKeyCode = VK_SNAPSHOT; - 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], 0); - 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") || JSStringIsEqualToUTF8CString(string, "addSelectionKey")) - newKeyState[VK_CONTROL] = 0x80; - else if (JSStringIsEqualToUTF8CString(string, "shiftKey") || JSStringIsEqualToUTF8CString(string, "rangeSelectionKey")) - 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, bool isTopFrame) -{ - if (isTopFrame) { - 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 a0add85..0000000 --- a/WebKitTools/DumpRenderTree/win/EventSender.h +++ /dev/null @@ -1,43 +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 long HRESULT; -typedef const struct OpaqueJSContext* JSContextRef; -typedef struct OpaqueJSValue* JSObjectRef; - -JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame); -void replaySavedEvents(HRESULT* oleDragAndDropReturnValue = 0); - -extern DraggingInfo* draggingInfo; - -#endif diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp deleted file mode 100644 index a84e0f3..0000000 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. 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 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)) || toUTF8(frameNameBSTR).empty()) - return (webFrame == mainFrame) ? "main frame" : string(); - - string frameName = (webFrame == mainFrame) ? "main frame" : "frame"; - frameName += " \"" + toUTF8(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_IWebFrameLoadDelegatePrivate)) - *ppvObject = static_cast<IWebFrameLoadDelegatePrivate*>(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate2)) - *ppvObject = static_cast<IWebFrameLoadDelegatePrivate2*>(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::didReceiveServerRedirectForProvisionalLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - 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()); - - locationChangeDone(error, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didCommitLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - COMPtr<IWebViewPrivate> webViewPrivate; - HRESULT hr = webView->QueryInterface(&webViewPrivate); - if (FAILED(hr)) - return hr; - webViewPrivate->updateFocusedAndActiveState(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didReceiveTitle: %S\n", descriptionSuitableForTestResult(frame).c_str(), title); - - if (::gLayoutTestController->dumpTitleChanges() && !done) - printf("TITLE CHANGED: %S\n", title ? title : L""); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didChangeIcons( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) -{ - if (!done && gLayoutTestController->dumpIconChanges()) - printf("%s - didChangeIcons\n", descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - -void FrameLoadDelegate::processWork() -{ - // if another load started, then wait for it to complete. - if (topLoadingFrame) - return; - - // if we finish all the commands, we're ready to dump state - if (WorkQueue::shared()->processWork() && !::gLayoutTestController->waitToDump()) - dump(); -} - -void FrameLoadDelegate::resetToConsistentState() -{ - m_accessibilityController->resetToConsistentState(); -} - -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* frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFailLoadWithError\n", descriptionSuitableForTestResult(frame).c_str()); - - locationChangeDone(error, frame); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willPerformClientRedirectToURL( - /* [in] */ IWebView *webView, - /* [in] */ BSTR url, - /* [in] */ double delaySeconds, - /* [in] */ DATE fireDate, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - willPerformClientRedirectToURL: %S \n", descriptionSuitableForTestResult(frame).c_str(), - urlSuitableForTestResult(std::wstring(url, ::SysStringLen(url))).c_str()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCancelClientRedirectForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didCancelClientRedirectForFrame\n", descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - return E_NOTIMPL; -} - -HRESULT FrameLoadDelegate::didClearWindowObject(IWebView*, JSContextRef, JSObjectRef, IWebFrame*) -{ - return E_NOTIMPL; -} - -HRESULT FrameLoadDelegate::didClearWindowObjectForFrameInScriptWorld(IWebView* webView, IWebFrame* frame, IWebScriptWorld* world) -{ - ASSERT_ARG(webView, webView); - ASSERT_ARG(frame, frame); - ASSERT_ARG(world, world); - if (!webView || !frame || !world) - return E_POINTER; - - COMPtr<IWebScriptWorld> standardWorld; - if (FAILED(world->standardWorld(&standardWorld))) - return S_OK; - - if (world == standardWorld) - didClearWindowObjectForFrameInStandardWorld(frame); - else - didClearWindowObjectForFrameInIsolatedWorld(frame, world); - return S_OK; -} - -void FrameLoadDelegate::didClearWindowObjectForFrameInIsolatedWorld(IWebFrame* frame, IWebScriptWorld* world) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - JSGlobalContextRef ctx = framePrivate->globalContextForScriptWorld(world); - if (!ctx) - return; - - JSObjectRef globalObject = JSContextGetGlobalObject(ctx); - if (!globalObject) - return; - - JSObjectSetProperty(ctx, globalObject, JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString("__worldID")).get(), JSValueMakeNumber(ctx, worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0); - return; -} - -void FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld(IWebFrame* frame) -{ - JSGlobalContextRef context = frame->globalContext(); - JSObjectRef windowObject = JSContextGetGlobalObject(context); - - IWebFrame* parentFrame = 0; - frame->parentFrame(&parentFrame); - - 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, !parentFrame); - JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); - JSStringRelease(eventSenderStr); -} - -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; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFirstVisuallyNonEmptyLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didDisplayInsecureContent( - /* [in] */ IWebView *sender) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("didDisplayInsecureContent\n"); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didRunInsecureContent( - /* [in] */ IWebView *sender, - /* [in] */ IWebSecurityOrigin *origin) -{ - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); - - return S_OK; -} - diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h deleted file mode 100644 index 4cd5e11..0000000 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h +++ /dev/null @@ -1,175 +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 IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate2 { -public: - FrameLoadDelegate(); - virtual ~FrameLoadDelegate(); - - void processWork(); - - void resetToConsistentState(); - - AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); } - - // 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); - - 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 didChangeIcons( - /* [in] */ IWebView *webView, - /* [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); - - virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - 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; } - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( - /* [in] */ IWebView* webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame); - - // 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); - - virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame); - - // IWebFrameLoadDelegatePrivate2 - virtual HRESULT STDMETHODCALLTYPE didDisplayInsecureContent( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE didRunInsecureContent( - /* [in] */ IWebView *sender, - /* [in] */ IWebSecurityOrigin *origin); - - virtual HRESULT STDMETHODCALLTYPE didClearWindowObjectForFrameInScriptWorld(IWebView*, IWebFrame*, IWebScriptWorld*); - - virtual HRESULT STDMETHODCALLTYPE didPushStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didReplaceStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE didPopStateWithinPageForFrame( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } - -private: - void didClearWindowObjectForFrameInIsolatedWorld(IWebFrame*, IWebScriptWorld*); - void didClearWindowObjectForFrameInStandardWorld(IWebFrame*); - - 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 b867250..0000000 --- a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp +++ /dev/null @@ -1,61 +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> -#include <WebKit/WebKitCOMAPI.h> - -void GCController::collect() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collect(); -} - -void GCController::collectOnAlternateThread(bool waitUntilDone) const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return; - collector->collectOnAlternateThread(waitUntilDone ? TRUE : FALSE); -} - -size_t GCController::getJSObjectCount() const -{ - COMPtr<IWebJavaScriptCollector> collector; - if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) - return 0; - UINT objects = 0; - collector->objectCount(&objects); - return objects; -} diff --git a/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp b/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp deleted file mode 100644 index 8a41fac..0000000 --- a/WebKitTools/DumpRenderTree/win/HistoryDelegate.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "HistoryDelegate.h" - -#include "DumpRenderTree.h" -#include "DumpRenderTreeWin.h" -#include "LayoutTestController.h" -#include <string> -#include <WebKit/WebKit.h> - -using std::wstring; - -static inline wstring wstringFromBSTR(BSTR str) -{ - return wstring(str, ::SysStringLen(str)); -} - -HistoryDelegate::HistoryDelegate() - : m_refCount(1) -{ -} - -HistoryDelegate::~HistoryDelegate() -{ -} - - // IUnknown -HRESULT HistoryDelegate::QueryInterface(REFIID riid, void** ppvObject) -{ - *ppvObject = 0; - if (IsEqualGUID(riid, IID_IUnknown)) - *ppvObject = static_cast<IWebHistoryDelegate*>(this); - else if (IsEqualGUID(riid, IID_IWebHistoryDelegate)) - *ppvObject = static_cast<IWebHistoryDelegate*>(this); - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} - -ULONG HistoryDelegate::AddRef(void) -{ - return ++m_refCount; -} - -ULONG HistoryDelegate::Release(void) -{ - ULONG newRef = --m_refCount; - if (!newRef) - delete(this); - - return newRef; -} - -// IWebHistoryDelegate -HRESULT HistoryDelegate::didNavigateWithNavigationData(IWebView* webView, IWebNavigationData* navigationData, IWebFrame* webFrame) -{ - if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) - return S_OK; - - BSTR urlBSTR; - if (FAILED(navigationData->url(&urlBSTR))) - return E_FAIL; - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - SysFreeString(urlBSTR); - - BSTR titleBSTR; - if (FAILED(navigationData->title(&titleBSTR))) - return E_FAIL; - wstring title; - if (titleBSTR) - title = wstringFromBSTR(titleBSTR); - SysFreeString(titleBSTR); - - COMPtr<IWebURLRequest> request; - if (FAILED(navigationData->originalRequest(&request))) - return E_FAIL; - - BSTR httpMethodBSTR; - if (FAILED(request->HTTPMethod(&httpMethodBSTR))) - return E_FAIL; - wstring httpMethod; - if (httpMethodBSTR) - httpMethod = wstringFromBSTR(httpMethodBSTR); - SysFreeString(httpMethodBSTR); - - COMPtr<IWebURLResponse> response; - if (FAILED(navigationData->response(&response))) - return E_FAIL; - - COMPtr<IWebHTTPURLResponse> httpResponse; - if (FAILED(response->QueryInterface(&httpResponse))) - return E_FAIL; - - int statusCode = 0; - if (FAILED(httpResponse->statusCode(&statusCode))) - return E_FAIL; - - BOOL hasSubstituteData; - if (FAILED(navigationData->hasSubstituteData(&hasSubstituteData))) - return E_FAIL; - - BSTR clientRedirectSourceBSTR; - if (FAILED(navigationData->clientRedirectSource(&clientRedirectSourceBSTR))) - return E_FAIL; - bool hasClientRedirect = clientRedirectSourceBSTR && SysStringLen(clientRedirectSourceBSTR); - wstring redirectSource; - if (clientRedirectSourceBSTR) - redirectSource = urlSuitableForTestResult(wstringFromBSTR(clientRedirectSourceBSTR)); - SysFreeString(clientRedirectSourceBSTR); - - bool wasFailure = hasSubstituteData || (httpResponse && statusCode >= 400); - - printf("WebView navigated to url \"%S\" with title \"%S\" with HTTP equivalent method \"%S\". The navigation was %s and was %s%S.\n", - url.c_str(), - title.c_str(), - httpMethod.c_str(), - wasFailure ? "a failure" : "successful", - hasClientRedirect ? "a client redirect from " : "not a client redirect", - redirectSource.c_str()); - - return S_OK; -} - -HRESULT HistoryDelegate::didPerformClientRedirectFromURL(IWebView*, BSTR sourceURL, BSTR destinationURL, IWebFrame*) -{ - if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring source; - if (sourceURL) - source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); - - wstring destination; - if (destinationURL) - destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); - - printf("WebView performed a client redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::didPerformServerRedirectFromURL(IWebView* webView, BSTR sourceURL, BSTR destinationURL, IWebFrame* webFrame) -{ - if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring source; - if (sourceURL) - source = urlSuitableForTestResult(wstringFromBSTR(sourceURL)); - - wstring destination; - if (destinationURL) - destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL)); - - printf("WebView performed a server redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::updateHistoryTitle(IWebView* webView, BSTR titleBSTR, BSTR urlBSTR) -{ - if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) - return S_OK; - - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - - wstring title; - if (titleBSTR) - title = wstringFromBSTR(titleBSTR); - - printf("WebView updated the title for history URL \"%S\" to \"%S\".\n", url.c_str(), title.c_str()); - return S_OK; -} - -HRESULT HistoryDelegate::populateVisitedLinksForWebView(IWebView* webView) -{ - if (!gLayoutTestController->dumpHistoryDelegateCallbacks()) - return S_OK; - - BSTR urlBSTR; - if (FAILED(webView->mainFrameURL(&urlBSTR))) - return E_FAIL; - - wstring url; - if (urlBSTR) - url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - SysFreeString(urlBSTR); - - if (gLayoutTestController->dumpVisitedLinksCallback()) - printf("Asked to populate visited links for WebView \"%S\"\n", url.c_str()); - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/HistoryDelegate.h b/WebKitTools/DumpRenderTree/win/HistoryDelegate.h deleted file mode 100644 index 41be670..0000000 --- a/WebKitTools/DumpRenderTree/win/HistoryDelegate.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef HistoryDelegate_h -#define HistoryDelegate_h - -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> - -class HistoryDelegate : public IWebHistoryDelegate { -public: - HistoryDelegate(); - virtual ~HistoryDelegate(); - - // IUnknown - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); - virtual ULONG STDMETHODCALLTYPE AddRef(void); - virtual ULONG STDMETHODCALLTYPE Release(void); - - // IWebHistoryDelegate - virtual HRESULT STDMETHODCALLTYPE didNavigateWithNavigationData( - /* [in] */ IWebView* webView, - /* [in] */ IWebNavigationData* navigationData, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE didPerformClientRedirectFromURL( - /* [in] */ IWebView* webView, - /* [in] */ BSTR sourceURL, - /* [in] */ BSTR destinationURL, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE didPerformServerRedirectFromURL( - /* [in] */ IWebView* webView, - /* [in] */ BSTR sourceURL, - /* [in] */ BSTR destinationURL, - /* [in] */ IWebFrame* webFrame); - - virtual HRESULT STDMETHODCALLTYPE updateHistoryTitle( - /* [in] */ IWebView* webView, - /* [in] */ BSTR title, - /* [in] */ BSTR url); - - virtual HRESULT STDMETHODCALLTYPE populateVisitedLinksForWebView( - /* [in] */ IWebView* webView); - -private: - ULONG m_refCount; -}; - -#endif // HistoryDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj deleted file mode 100644 index 2da8f13..0000000 --- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj +++ /dev/null @@ -1,396 +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="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_All|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_LTCG|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release_Cairo_CFLite|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\ImageDiffCommon.vsprops"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\cg\ImageDiffCG.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/WebKitTools/DumpRenderTree/win/ImageDiffCommon.vsprops b/WebKitTools/DumpRenderTree/win/ImageDiffCommon.vsprops deleted file mode 100644 index bbb8da8..0000000 --- a/WebKitTools/DumpRenderTree/win/ImageDiffCommon.vsprops +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="ImageDiffCommon"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private""
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/NXCOMPAT"
- AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
- SubSystem="1"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
- />
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
- />
-</VisualStudioPropertySheet>
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp deleted file mode 100644 index bc76139..0000000 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ /dev/null @@ -1,1411 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009, 2010 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 <CoreFoundation/CoreFoundation.h> -#include <JavaScriptCore/Assertions.h> -#include <JavaScriptCore/JSRetainPtr.h> -#include <JavaScriptCore/JSStringRefBSTR.h> -#include <JavaScriptCore/JavaScriptCore.h> -#include <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <WebKit/WebKitCOMAPI.h> -#include <comutil.h> -#include <shlwapi.h> -#include <shlguid.h> -#include <shobjidl.h> -#include <string> -#include <wtf/Platform.h> -#include <wtf/RetainPtr.h> -#include <wtf/Vector.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()); -} - -bool LayoutTestController::callShouldCloseOnWebView() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return false; - - BOOL result; - viewPrivate->shouldClose(&result); - return result; -} - -JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name) -{ - // FIXME: Implement! - return 0; -} - -JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) -{ - // FIXME: Implement! - return 0; -} - -void LayoutTestController::disableImageLoading() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setLoadsImagesAutomatically(FALSE); -} - -void LayoutTestController::dispatchPendingLoadRequests() -{ - // FIXME: Implement for testing fix for 6727495 -} - -void LayoutTestController::display() -{ - displayWebView(); -} - -void LayoutTestController::keepWebHistory() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(sharedHistory), reinterpret_cast<void**>(&sharedHistory)))) - return; - - history->setOptionalSharedHistory(sharedHistory.get()); -} - -JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) -{ - // FIXME: Implement this. - return JSValueMakeUndefined(context); -} - -JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) -{ - // FIXME: Implement this. - return JSValueMakeUndefined(context); -} - -JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR textBSTR = 0; - HRESULT hr = framePrivate->layerTreeAsText(&textBSTR); - - wstring text(textBSTR, SysStringLen(textBSTR)); - SysFreeString(textBSTR); - JSRetainPtr<JSStringRef> textValueJS(Adopt, JSStringCreateWithCharacters(text.data(), text.length())); - return textValueJS; -} - -JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return 0; - - COMPtr<IWebViewPrivate> webViewPrivate(Query, webView); - if (!webViewPrivate) - return 0; - - COMPtr<IDOMElement> element; - if (FAILED(webViewPrivate->elementFromJS(context, nodeObject, &element))) - return 0; - - COMPtr<IDOMElementPrivate> elementPrivate(Query, element); - if (!elementPrivate) - return 0; - - BSTR textBSTR = 0; - if (FAILED(elementPrivate->markerTextForListItem(&textBSTR))) - return 0; - - JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithBSTR(textBSTR)); - SysFreeString(textBSTR); - return markerText; -} - -void LayoutTestController::waitForPolicyDelegate() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - setWaitToDump(true); - policyDelegate->setControllerToNotifyDone(this); - webView->setPolicyDelegate(policyDelegate); -} - -size_t LayoutTestController::webHistoryItemCount() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return 0; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) - return 0; - - COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; - if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) - return 0; - - int count; - if (FAILED(sharedHistoryPrivate->allItems(&count, 0))) - return 0; - - return count; -} - -unsigned LayoutTestController::workerThreadCount() const -{ - COMPtr<IWebWorkersPrivate> workers; - if (FAILED(WebKitCreateInstance(CLSID_WebWorkersPrivate, 0, __uuidof(workers), reinterpret_cast<void**>(&workers)))) - return 0; - unsigned count; - if (FAILED(workers->workerThreadCount(&count))) - return 0; - return count; -} - -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()); -} - -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::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::setAlwaysAcceptCookies(bool alwaysAcceptCookies) -{ - if (alwaysAcceptCookies == m_alwaysAcceptCookies) - return; - - if (!::setAlwaysAcceptCookies(alwaysAcceptCookies)) - return; - m_alwaysAcceptCookies = alwaysAcceptCookies; -} - -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, bool permissive) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - if (setDelegate) { - policyDelegate->setPermissive(permissive); - webView->setPolicyDelegate(policyDelegate); - } else - webView->setPolicyDelegate(0); -} - -void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) -{ - // FIXME: Implement for DeviceOrientation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=30335. -} - -void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) -{ - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. -} - -void LayoutTestController::setMockGeolocationError(int code, JSStringRef message) -{ - // FIXME: Implement for Geolocation layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=28264. -} - -void LayoutTestController::setGeolocationPermission(bool allow) -{ - // FIXME: Implement for Geolocation layout tests. - setGeolocationPermissionCommon(allow); -} - -void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) -{ - // FIXME: Implement for speech input layout tests. - // See https://bugs.webkit.org/show_bug.cgi?id=39485. -} - -void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) -{ - // See also <rdar://problem/6480108> - COMPtr<IWebIconDatabase> iconDatabase; - COMPtr<IWebIconDatabase> tmpIconDatabase; - if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) - return; - if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) - return; - - iconDatabase->setEnabled(iconDatabaseEnabled); -} - -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::setXSSAuditorEnabled(bool enabled) -{ - 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->setXSSAuditorEnabled(enabled); -} - -void LayoutTestController::setFrameFlatteningEnabled(bool enabled) -{ - 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->setFrameFlatteningEnabled(enabled); -} - -void LayoutTestController::setSpatialNavigationEnabled(bool enabled) -{ - // FIXME: Implement for SpatialNavigation layout tests. -} - -void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) -{ - 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->setAllowUniversalAccessFromFileURLs(enabled); -} - -void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) -{ - 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->setAllowFileAccessFromFileURLs(enabled); -} - -void LayoutTestController::setPopupBlockingEnabled(bool enabled) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - preferences->setJavaScriptCanOpenWindowsAutomatically(!enabled); -} - -void LayoutTestController::setPluginsEnabled(bool flag) -{ - // FIXME: Implement -} - -void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled) -{ - 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->setJavaScriptCanAccessClipboard(enabled); -} - -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::setTimelineProfilingEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate; - if (FAILED(webView->QueryInterface(&viewPrivate))) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - inspector->setTimelineProfilingEnabled(flag); -} - -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) { - // Cygwin 1.7 doesn't store Cygwin's root as a mount point anymore, because mount points are now stored in /etc/fstab. - // However, /etc/fstab doesn't contain any information about where / is located as a Windows path, so we need to use Cygwin's - // new registry key that has the root. - result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygwin\\setup"), TEXT("rootdir"), &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::setViewModeMediaFeature(JSStringRef mode) -{ - // FIXME: implement -} - -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<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - setDeveloperExtrasEnabled(flag); - inspector->setJavaScriptProfilingEnabled(flag); -} - -void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewEditing> viewEditing; - if (FAILED(webView->QueryInterface(&viewEditing))) - return; - - viewEditing->setSelectTrailingWhitespaceEnabled(flag ? TRUE : FALSE); -} - -static const CFTimeInterval waitToDumpWatchdogInterval = 30.0; - -static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD) -{ - gLayoutTestController->waitToDumpWatchdogTimerFired(); -} - -void LayoutTestController::setWaitToDump(bool waitUntilDone) -{ - m_waitToDump = waitUntilDone; - if (m_waitToDump && !waitToDumpWatchdog) - waitToDumpWatchdog = SetTimer(0, 0, waitToDumpWatchdogInterval * 1000, waitUntilDoneWatchdogFired); -} - -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::setCacheModel(int) -{ - // FIXME: Implement -} - -bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) -{ - printf("ERROR: LayoutTestController::isCommandEnabled() not implemented\n"); - return false; -} - -void LayoutTestController::clearAllApplicationCaches() -{ - // FIXME: implement to support Application Cache quotas. -} - -void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) -{ - // FIXME: implement to support Application Cache quotas. -} - -void LayoutTestController::clearAllDatabases() -{ - COMPtr<IWebDatabaseManager> databaseManager; - COMPtr<IWebDatabaseManager> tmpDatabaseManager; - if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) - return; - if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) - return; - - databaseManager->deleteAllDatabases(); -} - -void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value) -{ - 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; - - BSTR keyBSTR = JSStringCopyBSTR(key); - BSTR valueBSTR = JSStringCopyBSTR(value); - prefsPrivate->setPreferenceForTest(keyBSTR, valueBSTR); - SysFreeString(keyBSTR); - SysFreeString(valueBSTR); -} - -void LayoutTestController::setDatabaseQuota(unsigned long long quota) -{ - COMPtr<IWebDatabaseManager> databaseManager; - COMPtr<IWebDatabaseManager> tmpDatabaseManager; - - if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) - return; - if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) - return; - - databaseManager->setQuota(TEXT("file:///"), quota); -} - -void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - BSTR schemeBSTR = JSStringCopyBSTR(scheme); - webView->setDomainRelaxationForbiddenForURLScheme(forbidden, schemeBSTR); - SysFreeString(schemeBSTR); -} - -void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) -{ - printf("ERROR: LayoutTestController::setAppCacheMaximumSize() not implemented\n"); -} - -bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(elementId); - COMPtr<IDOMElement> element; - HRESULT hr = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - if (FAILED(hr)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR nameBSTR = JSStringCopyBSTR(animationName); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseAnimation(nameBSTR, element.get(), time, &wasRunning); - SysFreeString(nameBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - -bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(elementId); - COMPtr<IDOMElement> element; - HRESULT hr = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - if (FAILED(hr)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR nameBSTR = JSStringCopyBSTR(propertyName); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseTransition(nameBSTR, element.get(), time, &wasRunning); - SysFreeString(nameBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - -bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) -{ - COMPtr<IDOMDocument> document; - if (FAILED(frame->DOMDocument(&document))) - return false; - - BSTR idBSTR = JSStringCopyBSTR(animationId); - COMPtr<IDOMElement> element; - HRESULT hr = document->getElementById(idBSTR, &element); - SysFreeString(idBSTR); - if (FAILED(hr)) - return false; - - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - - BSTR elementIdBSTR = JSStringCopyBSTR(elementId); - BOOL wasRunning = FALSE; - hr = framePrivate->pauseSVGAnimation(elementIdBSTR, element.get(), time, &wasRunning); - SysFreeString(elementIdBSTR); - - return SUCCEEDED(hr) && wasRunning; -} - -unsigned LayoutTestController::numberOfActiveAnimations() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return 0; - - UINT number = 0; - if (FAILED(framePrivate->numberOfActiveAnimations(&number))) - return 0; - - return number; -} - -void LayoutTestController::suspendAnimations() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - framePrivate->suspendAnimations(); -} - -void LayoutTestController::resumeAnimations() const -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - framePrivate->resumeAnimations(); -} - -static _bstr_t bstrT(JSStringRef jsString) -{ - // The false parameter tells the _bstr_t constructor to adopt the BSTR we pass it. - return _bstr_t(JSStringCopyBSTR(jsString), false); -} - -void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - webView->addOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); -} - -void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - webView->removeOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); -} - -void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) -{ - // FIXME: implement -} - -void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - COMPtr<IWebScriptWorld> world; - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - - webView->addUserScriptToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), 0, 0, 0, 0, 0, runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd); -} - - -void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames) -{ - COMPtr<IWebViewPrivate> webView; - if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) - return; - - COMPtr<IWebScriptWorld> world; - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - - webView->addUserStyleSheetToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), 0, 0, 0, 0, 0); -} - -void LayoutTestController::setDeveloperExtrasEnabled(bool enabled) -{ - 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->setDeveloperExtrasEnabled(enabled); -} - -void LayoutTestController::showWebInspector() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (SUCCEEDED(viewPrivate->inspector(&inspector))) - inspector->show(); -} - -void LayoutTestController::closeWebInspector() -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - inspector->close(); -} - -void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebViewPrivate> viewPrivate(Query, webView); - if (!viewPrivate) - return; - - COMPtr<IWebInspector> inspector; - if (FAILED(viewPrivate->inspector(&inspector))) - return; - - COMPtr<IWebInspectorPrivate> inspectorPrivate(Query, inspector); - if (!inspectorPrivate) - return; - - inspectorPrivate->evaluateInFrontend(callId, bstrT(script).GetBSTR()); -} - -typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap; -static WorldMap& worldMap() -{ - static WorldMap& map = *new WorldMap; - return map; -} - -unsigned worldIDForWorld(IWebScriptWorld* world) -{ - WorldMap::const_iterator end = worldMap().end(); - for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { - if (it->second == world) - return it->first; - } - - return 0; -} - -void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return; - - // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world - // that is created once and cached forever. - COMPtr<IWebScriptWorld> world; - if (!worldID) { - if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) - return; - } else { - COMPtr<IWebScriptWorld>& worldSlot = worldMap().add(worldID, 0).first->second; - if (!worldSlot && FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(worldSlot), reinterpret_cast<void**>(&worldSlot)))) - return; - world = worldSlot; - } - - BSTR result; - if (FAILED(framePrivate->stringByEvaluatingJavaScriptInScriptWorld(world.get(), globalObject, bstrT(script).GetBSTR(), &result))) - return; - SysFreeString(result); -} - -void LayoutTestController::removeAllVisitedLinks() -{ - COMPtr<IWebHistory> history; - if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) - return; - - COMPtr<IWebHistory> sharedHistory; - if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) - return; - - COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; - if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) - return; - - sharedHistoryPrivate->removeAllVisitedLinks(); -} - -JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return 0; - - wstring idWstring = jsStringRefToWString(id); - BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); - BSTR counterValueBSTR; - if (FAILED(framePrivate->counterValueForElementById(idBSTR, &counterValueBSTR))) - return 0; - - wstring counterValue(counterValueBSTR, SysStringLen(counterValueBSTR)); - SysFreeString(idBSTR); - SysFreeString(counterValueBSTR); - JSRetainPtr<JSStringRef> counterValueJS(Adopt, JSStringCreateWithCharacters(counterValue.data(), counterValue.length())); - return counterValueJS; -} - -int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return 0; - - wstring idWstring = jsStringRefToWString(id); - BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); - int pageNumber = -1; - if (FAILED(framePrivate->pageNumberForElementById(idBSTR, pageWidthInPixels, pageHeightInPixels, &pageNumber))) - pageNumber = -1; - SysFreeString(idBSTR); - return pageNumber; -} - -int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return 0; - - int pageNumber = -1; - if (FAILED(framePrivate->numberOfPages(pageWidthInPixels, pageHeightInPixels, &pageNumber))) - pageNumber = -1; - return pageNumber; -} - -JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const -{ - // FIXME: Implement this. - return JSRetainPtr<JSStringRef>(); -} - -void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) -{ - -} - -bool LayoutTestController::isPageBoxVisible(int pageNumber) const -{ - // FIXME: implement - return false; -} - -JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const -{ - // FIXME: implement - return JSRetainPtr<JSStringRef>(); -} - -void LayoutTestController::apiTestGoToCurrentBackForwardItem() -{ - 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; - - BOOL success; - webView->goToBackForwardItem(item.get(), &success); -} - -void LayoutTestController::setWebViewEditable(bool) -{ -} - -void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef) -{ -} - -void LayoutTestController::setEditingBehavior(const char* editingBehavior) -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return; - - COMPtr<IWebPreferences> preferences; - if (FAILED(webView->preferences(&preferences))) - return; - - string behaviorString(editingBehavior); - if (behaviorString == "mac") - preferences->setEditingBehavior(WebKitEditingMacBehavior); - else if (behaviorString == "win") - preferences->setEditingBehavior(WebKitEditingWinBehavior); - else if (behaviorString == "unix") - preferences->setEditingBehavior(WebKitEditingUnixBehavior); -} - -void LayoutTestController::abortModal() -{ -} - -bool LayoutTestController::hasSpellingMarker(int from, int length) -{ - COMPtr<IWebFramePrivate> framePrivate(Query, frame); - if (!framePrivate) - return false; - BOOL ret = FALSE; - if (FAILED(framePrivate->hasSpellingMarker(from, length, &ret))) - return false; - return ret; -} 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 752cc39..0000000 --- a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ /dev/null @@ -1,85 +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" - -#if PLATFORM(CG) -#include "PixelDumpSupportCG.h" -#elif PLATFORM(CAIRO) -#include "PixelDumpSupportCairo.h" -#endif - -#include "DumpRenderTree.h" - -#if PLATFORM(CG) -// Note: Must be included *after* DumpRenderTree.h to avoid compile error. -#include <CoreGraphics/CGBitmapContext.h> -#endif - -#include <wtf/Assertions.h> -#include <wtf/RetainPtr.h> - -PassRefPtr<BitmapContext> createBitmapContextFromWebView(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_PRINT, reinterpret_cast<WPARAM>(memoryDC), PRF_CLIENT | PRF_CHILDREN | PRF_OWNED); - DeleteDC(memoryDC); - - BITMAP info = {0}; - GetObject(bitmap, sizeof(info), &info); - ASSERT(info.bmBitsPixel == 32); - -#if PLATFORM(CG) - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); - CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, - info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); -#elif PLATFORM(CAIRO) - cairo_surface_t* image = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, CAIRO_FORMAT_ARGB32, - info.bmWidth, info.bmHeight, info.bmWidthBytes); - cairo_t* context = cairo_create(image); - cairo_surface_destroy(image); -#endif - - return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context); -} diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp deleted file mode 100644 index 7d87c45..0000000 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2007, 2009 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 "LayoutTestController.h" -#include <string> - -using std::wstring; - -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; -} - -PolicyDelegate::PolicyDelegate() - : m_refCount(1) - , m_permissiveDelegate(false) - , m_controllerToNotifyDone(0) -{ -} - -// 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); - wstring wurl = urlSuitableForTestResult(wstring(url, SysStringLen(url))); - - int navType = 0; - VARIANT var; - if (SUCCEEDED(actionInformation->Read(WebActionNavigationTypeKey, &var, 0))) { - V_VT(&var) = VT_I4; - navType = V_I4(&var); - } - - LPCTSTR typeDescription; - switch (navType) { - case WebNavigationTypeLinkClicked: - typeDescription = TEXT("link clicked"); - break; - case WebNavigationTypeFormSubmitted: - typeDescription = TEXT("form submitted"); - break; - case WebNavigationTypeBackForward: - typeDescription = TEXT("back/forward"); - break; - case WebNavigationTypeReload: - typeDescription = TEXT("reload"); - break; - case WebNavigationTypeFormResubmitted: - typeDescription = TEXT("form resubmitted"); - break; - case WebNavigationTypeOther: - typeDescription = TEXT("other"); - break; - default: - typeDescription = TEXT("illegal value"); - } - - wstring message = TEXT("Policy delegate: attempt to load ") + wurl + TEXT(" with navigation type '") + typeDescription + TEXT("'"); - - VARIANT actionElementVar; - if (SUCCEEDED(actionInformation->Read(WebActionElementKey, &actionElementVar, 0))) { - COMPtr<IPropertyBag> actionElement(Query, V_UNKNOWN(&actionElementVar)); - VARIANT originatingNodeVar; - if (SUCCEEDED(actionElement->Read(WebElementDOMNodeKey, &originatingNodeVar, 0))) { - COMPtr<IDOMNode> originatingNode(Query, V_UNKNOWN(&originatingNodeVar)); - message += TEXT(" originating from ") + dumpPath(originatingNode.get()); - } - } - - printf("%S\n", message.c_str()); - - SysFreeString(url); - - if (m_permissiveDelegate) - listener->use(); - else - listener->ignore(); - - if (m_controllerToNotifyDone) { - m_controllerToNotifyDone->notifyDone(); - m_controllerToNotifyDone = 0; - } - - return S_OK; -} - - -HRESULT STDMETHODCALLTYPE PolicyDelegate::unableToImplementPolicyWithError( - /*[in]*/ IWebView* /*webView*/, - /*[in]*/ IWebError* error, - /*[in]*/ IWebFrame* frame) -{ - BSTR domainStr; - error->domain(&domainStr); - wstring domainMessage = domainStr; - - int code; - error->code(&code); - - BSTR frameName; - frame->name(&frameName); - wstring frameNameMessage = frameName; - - printf("Policy delegate: unable to implement policy with error domain '%S', error code %d, in frame '%S'", domainMessage.c_str(), code, frameNameMessage.c_str()); - - SysFreeString(domainStr); - SysFreeString(frameName); - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h deleted file mode 100644 index c808dc9..0000000 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007, 2009 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 LayoutTestController; - -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); - - // PolicyDelegate - void setPermissive(bool permissive) { m_permissiveDelegate = permissive; } - void setControllerToNotifyDone(LayoutTestController* controller) { m_controllerToNotifyDone = controller; } - -private: - ULONG m_refCount; - bool m_permissiveDelegate; - LayoutTestController* m_controllerToNotifyDone; -}; - -#endif // PolicyDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp deleted file mode 100644 index 09b07d6..0000000 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ /dev/null @@ -1,379 +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 <WebKit/WebKitCOMAPI.h> -#include <comutil.h> -#include <sstream> -#include <tchar.h> -#include <wtf/Vector.h> - -using namespace std; - -static inline wstring wstringFromBSTR(BSTR str) -{ - return wstring(str, ::SysStringLen(str)); -} - -static inline wstring wstringFromInt(int i) -{ - wostringstream ss; - ss << i; - return ss.str(); -} - -static inline BSTR BSTRFromString(const string& str) -{ - int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0); - BSTR result = ::SysAllocStringLen(0, length); - ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length); - return result; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const -{ - IdentifierMap::const_iterator it = m_urlMap.find(identifier); - - if (it == m_urlMap.end()) - return L"<unknown>"; - - return urlSuitableForTestResult(it->second); -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLRequest* request) -{ - if (!request) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(request->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - BSTR mainDocumentURLBSTR; - if (FAILED(request->mainDocumentURL(&mainDocumentURLBSTR))) - return wstring(); - - wstring mainDocumentURL = urlSuitableForTestResult(wstringFromBSTR(mainDocumentURLBSTR)); - ::SysFreeString(mainDocumentURLBSTR); - - BSTR httpMethodBSTR; - if (FAILED(request->HTTPMethod(&httpMethodBSTR))) - return wstring(); - - wstring httpMethod = wstringFromBSTR(httpMethodBSTR); - ::SysFreeString(httpMethodBSTR); - - return L"<NSURLRequest URL " + url + L", main document URL " + mainDocumentURL + L", http method " + httpMethod + L">"; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebURLResponse* response) -{ - if (!response) - return L"(null)"; - - BSTR urlBSTR; - if (FAILED(response->URL(&urlBSTR))) - return wstring(); - - wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); - ::SysFreeString(urlBSTR); - - int statusCode = 0; - COMPtr<IWebHTTPURLResponse> httpResponse; - if (response && SUCCEEDED(response->QueryInterface(&httpResponse))) - httpResponse->statusCode(&statusCode); - - return L"<NSURLResponse " + url + L", http status code " + wstringFromInt(statusCode) + L">"; -} - -wstring ResourceLoadDelegate::descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) const -{ - 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 if (IsEqualGUID(riid, IID_IWebResourceLoadDelegatePrivate2)) - *ppvObject = static_cast<IWebResourceLoadDelegatePrivate2*>(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; - - ASSERT(!urlMap().contains(identifier)); - urlMap().set(identifier, wstringFromBSTR(urlStr)); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::removeIdentifierForRequest( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier) -{ - urlMap().remove(identifier); - - 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()); - } - - if (!done && !gLayoutTestController->deferMainResourceDataLoad()) { - COMPtr<IWebDataSourcePrivate> dataSourcePrivate(Query, dataSource); - if (!dataSourcePrivate) - return E_FAIL; - dataSourcePrivate->setDeferMainResourceDataLoad(FALSE); - } - - if (!done && gLayoutTestController->willSendRequestReturnsNull()) { - *newRequest = 0; - return S_OK; - } - - if (!done && gLayoutTestController->willSendRequestReturnsNullOnRedirect() && redirectResponse) { - printf("Returning null for this redirect\n"); - *newRequest = 0; - return S_OK; - } - - IWebMutableURLRequest* requestCopy = 0; - request->mutableCopy(&requestCopy); - const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders(); - for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header) { - BSTR bstrHeader = BSTRFromString(*header); - requestCopy->setValue(0, bstrHeader); - SysFreeString(bstrHeader); - } - - *newRequest = requestCopy; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveAuthenticationChallenge( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLAuthenticationChallenge *challenge, - /* [in] */ IWebDataSource *dataSource) -{ - COMPtr<IWebURLAuthenticationChallengeSender> sender; - if (!challenge || FAILED(challenge->sender(&sender))) - return E_FAIL; - - if (!gLayoutTestController->handlesAuthenticationChallenges()) { - printf("%S - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n", descriptionSuitableForTestResult(identifier).c_str()); - sender->continueWithoutCredentialForAuthenticationChallenge(challenge); - return S_OK; - } - - const char* user = gLayoutTestController->authenticationUsername().c_str(); - const char* password = gLayoutTestController->authenticationPassword().c_str(); - - printf("%S - didReceiveAuthenticationChallenge - Responding with %s:%s\n", descriptionSuitableForTestResult(identifier).c_str(), user, password); - - COMPtr<IWebURLCredential> credential; - if (FAILED(WebKitCreateInstance(CLSID_WebURLCredential, 0, IID_IWebURLCredential, (void**)&credential))) - return E_FAIL; - credential->initWithUser(_bstr_t(user), _bstr_t(password), WebURLCredentialPersistenceForSession); - - sender->useCredential(credential.get(), challenge); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse( - /* [in] */ IWebView* webView, - /* [in] */ unsigned long identifier, - /* [in] */ IWebURLResponse* response, - /* [in] */ IWebDataSource* dataSource) -{ - if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { - printf("%S - didReceiveResponse %S\n", - descriptionSuitableForTestResult(identifier).c_str(), - descriptionSuitableForTestResult(response).c_str()); - } - if (!done && gLayoutTestController->dumpResourceResponseMIMETypes()) { - BSTR mimeTypeBSTR; - if (FAILED(response->MIMEType(&mimeTypeBSTR))) - E_FAIL; - - wstring mimeType = wstringFromBSTR(mimeTypeBSTR); - ::SysFreeString(mimeTypeBSTR); - - BSTR urlBSTR; - if (FAILED(response->URL(&urlBSTR))) - E_FAIL; - - wstring url = wstringFromBSTR(urlBSTR); - ::SysFreeString(urlBSTR); - - printf("%S has MIME type %S\n", lastPathComponent(url).c_str(), mimeType.c_str()); - } - - 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()); - } - - removeIdentifierForRequest(webView, 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()); - } - - removeIdentifierForRequest(webView, identifier); - - return S_OK; -} diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h deleted file mode 100644 index 3f20f47..0000000 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h +++ /dev/null @@ -1,119 +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> -#include <string> -#include <wtf/HashMap.h> - -class ResourceLoadDelegate : public IWebResourceLoadDelegate, public IWebResourceLoadDelegatePrivate2 { -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); - - 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); - - 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; } - - // IWebResourceLoadDelegatePrivate2 - virtual HRESULT STDMETHODCALLTYPE removeIdentifierForRequest( - /* [in] */ IWebView *webView, - /* [in] */ unsigned long identifier); - -private: - static std::wstring descriptionSuitableForTestResult(IWebURLRequest*); - static std::wstring descriptionSuitableForTestResult(IWebURLResponse*); - std::wstring descriptionSuitableForTestResult(unsigned long) const; - std::wstring descriptionSuitableForTestResult(IWebError*, unsigned long) const; - - typedef HashMap<unsigned long, std::wstring> IdentifierMap; - IdentifierMap& urlMap() { return m_urlMap; } - IdentifierMap m_urlMap; - - ULONG m_refCount; -}; - -#endif // ResourceLoadDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp deleted file mode 100755 index 1e7669f..0000000 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp +++ /dev/null @@ -1,662 +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 "DRTDesktopNotificationPresenter.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_desktopNotifications(new DRTDesktopNotificationPresenter) -{ - 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_IWebUIDelegate2)) - *ppvObject = static_cast<IWebUIDelegate2*>(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::printFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::ftpDirectoryTemplatePath( - /* [in] */ IWebView *webView, - /* [retval][out] */ BSTR *path) -{ - if (!path) - return E_POINTER; - *path = 0; - return E_NOTIMPL; -} - - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewHeaderHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result) -{ - if (!result) - return E_POINTER; - *result = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewFooterHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result) -{ - if (!result) - return E_POINTER; - *result = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawHeaderInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawFooterInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext, - /* [in] */ UINT pageIndex, - /* [in] */ UINT pageCount) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewPrintingMarginRect( - /* [in] */ IWebView *webView, - /* [retval][out] */ RECT *rect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::canRunModal( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *canRunBoolean) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createModalDialog( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runModal( - /* [in] */ IWebView *webView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::isMenuBarVisible( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *visible) -{ - if (!visible) - return E_POINTER; - *visible = false; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setMenuBarVisible( - /* [in] */ IWebView *webView, - /* [in] */ BOOL visible) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::runDatabaseSizeLimitPrompt( - /* [in] */ IWebView *webView, - /* [in] */ BSTR displayName, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *allowed) -{ - if (!allowed) - return E_POINTER; - *allowed = false; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollbar( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect, - /* [in] */ WebScrollBarControlSize size, - /* [in] */ WebScrollbarControlState state, - /* [in] */ WebScrollbarControlPart pressedPart, - /* [in] */ BOOL vertical, - /* [in] */ float value, - /* [in] */ float proportion, - /* [in] */ WebScrollbarControlPartMask parts) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollCorner( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect) -{ - return E_NOTIMPL; -} - -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, toUTF8(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); - HRESULT oleDragAndDropReturnValue = DRAGDROP_S_CANCEL; - replaySavedEvents(&oleDragAndDropReturnValue); - if (draggingInfo) { - *performedEffect = draggingInfo->performedDropEffect(); - delete draggingInfo; - draggingInfo = 0; - } - return oleDragAndDropReturnValue; -} - -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) -{ - BSTR protocol; - BSTR host; - unsigned short port; - - origin->protocol(&protocol); - origin->host(&host); - origin->port(&port); - - if (!done && gLayoutTestController->dumpDatabaseCallbacks()) - printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%S, %S, %i} database:%S\n", protocol, host, port, databaseIdentifier); - - SysFreeString(protocol); - SysFreeString(host); - - static const unsigned long long defaultQuota = 5 * 1024 * 1024; - origin->setQuota(defaultQuota); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::embeddedViewWithArguments( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IPropertyBag *arguments, - /* [retval][out] */ IWebEmbeddedView **view) -{ - if (!view) - return E_POINTER; - *view = 0; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewClosing( - /* [in] */ IWebView *sender) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewSetCursor( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE cursor) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::webViewDidInvalidate( - /* [in] */ IWebView *sender) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text) -{ - if (gLayoutTestController->dumpStatusCallbacks()) - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text ? toUTF8(text).c_str() : ""); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::desktopNotificationsDelegate(IWebDesktopNotificationsDelegate** result) -{ - m_desktopNotifications.copyRefTo(result); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE UIDelegate::didPressMissingPluginButton(IDOMElement* element) -{ - printf("MISSING PLUGIN BUTTON PRESSED\n"); - return S_OK; -} - diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.h b/WebKitTools/DumpRenderTree/win/UIDelegate.h deleted file mode 100755 index 0c9fdaf..0000000 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.h +++ /dev/null @@ -1,415 +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 <WebCore/COMPtr.h> -#include <WebKit/WebKit.h> -#include <wtf/OwnPtr.h> -#include <windef.h> - -class DRTUndoManager; -class DRTDesktopNotificationPresenter; - -class UIDelegate : public IWebUIDelegate2, 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, - /* [retval][out] */ IDataObject **newPasteboard) { 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); - - virtual HRESULT STDMETHODCALLTYPE printFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame); - - virtual HRESULT STDMETHODCALLTYPE ftpDirectoryTemplatePath( - /* [in] */ IWebView *webView, - /* [retval][out] */ BSTR *path); - - virtual HRESULT STDMETHODCALLTYPE webViewHeaderHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result); - - virtual HRESULT STDMETHODCALLTYPE webViewFooterHeight( - /* [in] */ IWebView *webView, - /* [retval][out] */ float *result); - - virtual HRESULT STDMETHODCALLTYPE drawHeaderInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext); - - virtual HRESULT STDMETHODCALLTYPE drawFooterInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, - /* [in] */ OLE_HANDLE drawingContext, - /* [in] */ UINT pageIndex, - /* [in] */ UINT pageCount); - - virtual HRESULT STDMETHODCALLTYPE webViewPrintingMarginRect( - /* [in] */ IWebView *webView, - /* [retval][out] */ RECT *rect); - - virtual HRESULT STDMETHODCALLTYPE canRunModal( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *canRunBoolean); - - virtual HRESULT STDMETHODCALLTYPE createModalDialog( - /* [in] */ IWebView *sender, - /* [in] */ IWebURLRequest *request, - /* [retval][out] */ IWebView **newWebView); - - virtual HRESULT STDMETHODCALLTYPE runModal( - /* [in] */ IWebView *webView); - - virtual HRESULT STDMETHODCALLTYPE isMenuBarVisible( - /* [in] */ IWebView *webView, - /* [retval][out] */ BOOL *visible); - - virtual HRESULT STDMETHODCALLTYPE setMenuBarVisible( - /* [in] */ IWebView *webView, - /* [in] */ BOOL visible); - - virtual HRESULT STDMETHODCALLTYPE runDatabaseSizeLimitPrompt( - /* [in] */ IWebView *webView, - /* [in] */ BSTR displayName, - /* [in] */ IWebFrame *initiatedByFrame, - /* [retval][out] */ BOOL *allowed); - - virtual HRESULT STDMETHODCALLTYPE paintCustomScrollbar( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect, - /* [in] */ WebScrollBarControlSize size, - /* [in] */ WebScrollbarControlState state, - /* [in] */ WebScrollbarControlPart pressedPart, - /* [in] */ BOOL vertical, - /* [in] */ float value, - /* [in] */ float proportion, - /* [in] */ WebScrollbarControlPartMask parts); - - virtual HRESULT STDMETHODCALLTYPE paintCustomScrollCorner( - /* [in] */ IWebView *webView, - /* [in] */ HDC hDC, - /* [in] */ RECT rect); - - virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView* sender, IWebURLRequest* request, IPropertyBag* windowFeatures, IWebView** newWebView); - - virtual HRESULT STDMETHODCALLTYPE drawBackground(IWebView* sender, OLE_HANDLE hdc, const RECT* dirtyRect); - - virtual HRESULT STDMETHODCALLTYPE decidePolicyForGeolocationRequest(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, IWebGeolocationPolicyListener* listener); - - virtual HRESULT STDMETHODCALLTYPE didPressMissingPluginButton(IDOMElement*); - -protected: - // IWebUIDelegatePrivate - - virtual HRESULT STDMETHODCALLTYPE unused1() { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unused2() { return E_NOTIMPL; } - - virtual HRESULT STDMETHODCALLTYPE unused3() { 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); - - virtual HRESULT STDMETHODCALLTYPE webViewPainted( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IWebSecurityOrigin *origin, - /* [in] */ BSTR databaseIdentifier); - - virtual HRESULT STDMETHODCALLTYPE embeddedViewWithArguments( - /* [in] */ IWebView *sender, - /* [in] */ IWebFrame *frame, - /* [in] */ IPropertyBag *arguments, - /* [retval][out] */ IWebEmbeddedView **view); - - virtual HRESULT STDMETHODCALLTYPE webViewClosing( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE webViewSetCursor( - /* [in] */ IWebView *sender, - /* [in] */ OLE_HANDLE cursor); - - virtual HRESULT STDMETHODCALLTYPE webViewDidInvalidate( - /* [in] */ IWebView *sender); - - virtual HRESULT STDMETHODCALLTYPE desktopNotificationsDelegate( - /* [out] */ IWebDesktopNotificationsDelegate** result); - - ULONG m_refCount; - -private: - RECT m_frame; - OwnPtr<DRTUndoManager> m_undoManager; - - COMPtr<IWebDesktopNotificationsDelegate> m_desktopNotifications; -}; - -#endif diff --git a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp deleted file mode 100644 index a24ca37..0000000 --- a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2007, 2009 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 <WebKit/WebKitCOMAPI.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(); -} - -bool LoadItem::invoke() const -{ - wstring targetString = jsStringRefToWString(m_target.get()); - - 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 false; - } - - COMPtr<IWebURLRequest> request; - if (FAILED(WebKitCreateInstance(CLSID_WebURLRequest, 0, IID_IWebURLRequest, (void**)&request))) - return false; - - wstring urlString = jsStringRefToWString(m_url.get()); - BSTR urlBSTR = SysAllocString(urlString.c_str()); - bool failed = FAILED(request->initWithURL(urlBSTR, WebURLRequestUseProtocolCachePolicy, 60)); - SysFreeString(urlBSTR); - if (failed) - return false; - - targetFrame->loadRequest(request.get()); - return true; -} - -bool LoadHTMLStringItem::invoke() const -{ - wstring content = jsStringRefToWString(m_content.get()); - wstring baseURL = jsStringRefToWString(m_baseURL.get()); - - BSTR contentBSTR = SysAllocString(content.c_str()); - BSTR baseURLBSTR = SysAllocString(baseURL.c_str()); - - frame->loadHTMLString(contentBSTR, baseURLBSTR); - - SysFreeString(contentBSTR); - SysFreeString(baseURLBSTR); - - return true; -} - -bool ReloadItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - COMPtr<IWebIBActions> webActions; - if (FAILED(webView->QueryInterface(&webActions))) - return false; - - webActions->reload(0); - return true; -} - -bool ScriptItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - wstring scriptString = jsStringRefToWString(m_script.get()); - - BSTR result; - BSTR scriptBSTR = SysAllocString(scriptString.c_str()); - webView->stringByEvaluatingJavaScriptFromString(scriptBSTR, &result); - SysFreeString(result); - SysFreeString(scriptBSTR); - - return true; -} - -bool BackForwardItem::invoke() const -{ - COMPtr<IWebView> webView; - if (FAILED(frame->webView(&webView))) - return false; - - BOOL result; - if (m_howFar == 1) { - webView->goForward(&result); - return true; - } - - if (m_howFar == -1) { - webView->goBack(&result); - return true; - } - - COMPtr<IWebBackForwardList> bfList; - if (FAILED(webView->backForwardList(&bfList))) - return false; - - COMPtr<IWebHistoryItem> item; - if (FAILED(bfList->itemAtIndex(m_howFar, &item))) - return false; - - webView->goToBackForwardItem(item.get(), &result); - return true; -} |