diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree')
75 files changed, 1140 insertions, 368 deletions
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp index 13c642a..52d238d 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp @@ -128,6 +128,16 @@ static JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef functio return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber)); } +static JSValueRef rangeForLineCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + int indexNumber = -1; + if (argumentCount == 1) + indexNumber = JSValueToNumber(context, arguments[0], exception); + + JSRetainPtr<JSStringRef> rangeLine(Adopt, toAXElement(thisObject)->rangeForLine(indexNumber)); + return JSValueMakeString(context, rangeLine.get()); +} + static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { unsigned location = UINT_MAX, length = 0; @@ -679,6 +689,12 @@ static JSValueRef isIgnoredCallback(JSContextRef context, JSObjectRef thisObject return JSValueMakeBoolean(context, toAXElement(thisObject)->isIgnored()); } +static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) +{ + JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak()); + return JSValueMakeString(context, speakString.get()); +} + static JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) { return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup()); @@ -737,6 +753,12 @@ static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObj // Implementation +// Unsupported methods on various platforms. +#if !PLATFORM(MAC) +JSStringRef AccessibilityUIElement::speak() { return 0; } +JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; } +#endif + #if !SUPPORTS_AX_TEXTMARKERS AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*) @@ -837,6 +859,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { 0, 0, 0, 0 } }; @@ -847,6 +870,7 @@ JSClassRef AccessibilityUIElement::getJSClass() { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "rangeForLine", rangeForLineCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h index 5170f20..9311dfd 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h @@ -147,6 +147,9 @@ public: JSStringRef documentURI(); JSStringRef url(); + // CSS3-speech properties. + JSStringRef speak(); + // Table-specific attributes JSStringRef attributesOfColumnHeaders(); JSStringRef attributesOfRowHeaders(); @@ -176,6 +179,7 @@ public: // Parameterized attributes int lineForIndex(int); + JSStringRef rangeForLine(int); JSStringRef boundsForRange(unsigned location, unsigned length); void setSelectedTextRange(unsigned location, unsigned length); JSStringRef stringForRange(unsigned location, unsigned length); diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi index 58ccaae..b437eaf 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.gypi +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.gypi @@ -44,6 +44,20 @@ 'chromium/WebViewHost.cpp', 'chromium/WebViewHost.h', ], + 'test_plugin_files': [ + 'TestNetscapePlugIn/PluginObject.cpp', + 'TestNetscapePlugIn/PluginObject.h', + 'TestNetscapePlugIn/PluginObjectMac.mm', + 'TestNetscapePlugIn/PluginTest.cpp', + 'TestNetscapePlugIn/PluginTest.h', + 'TestNetscapePlugIn/TestObject.cpp', + 'TestNetscapePlugIn/TestObject.h', + 'TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp', + 'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp', + 'TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp', + 'TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp', + 'TestNetscapePlugIn/main.cpp', + ], 'conditions': [ ['OS=="win"', { 'drt_files': [ diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj index c01ca4e..51d8e7f 100644 --- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj +++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj @@ -48,6 +48,8 @@ 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; }; 3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; }; 3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; }; + 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */; }; + 4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */; }; 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; }; 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F69E10714A57007AA393 /* HistoryDelegate.h */; }; 5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */ = {isa = PBXBuildFile; fileRef = AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */; }; @@ -128,6 +130,7 @@ BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */; }; BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */; }; BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF6C64F0C98E9C000AC063E /* GCController.cpp */; }; + C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */; }; E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; }; E1B7816711AF31C3007E1BC2 /* MockGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */; }; /* End PBXBuildFile section */ @@ -220,6 +223,8 @@ 375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; }; 375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; }; 375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; }; + 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = mac/WebArchiveDumpSupport.h; sourceTree = "<group>"; }; + 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupport.mm; path = mac/WebArchiveDumpSupport.mm; sourceTree = "<group>"; }; 5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; }; 5185F69F10714A57007AA393 /* HistoryDelegate.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = HistoryDelegate.mm; path = mac/HistoryDelegate.mm; sourceTree = "<group>"; }; 8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = PixelDumpSupport.cpp; sourceTree = "<group>"; }; @@ -298,6 +303,7 @@ BCD08B390E1057EF00A7D0C1 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; }; BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = "<group>"; }; BCF6C64F0C98E9C000AC063E /* GCController.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = GCController.cpp; sourceTree = "<group>"; }; + C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PassDifferentNPPStruct.cpp; sourceTree = "<group>"; }; E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; }; E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -358,6 +364,8 @@ BCA18B740C9B08F100114369 /* DumpRenderTreeDraggingInfo.mm */, A8D79CE80FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.h */, A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */, + 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */, + 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */, BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */, BC9D90220C97472E0099A4A3 /* WorkQueue.h */, BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */, @@ -451,6 +459,7 @@ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */, 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */, 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */, + C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */, 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */, ); path = Tests; @@ -590,6 +599,7 @@ BCA18B670C9B08C200114369 /* ResourceLoadDelegate.h in Headers */, BCA18B3C0C9B024900114369 /* TextInputController.h in Headers */, BCA18B690C9B08C200114369 /* UIDelegate.h in Headers */, + 4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */, BC9D90250C97472E0099A4A3 /* WorkQueue.h in Headers */, BC9D90260C97472E0099A4A3 /* WorkQueueItem.h in Headers */, 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */, @@ -726,6 +736,7 @@ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */, 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */, 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */, + C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -764,6 +775,7 @@ BCA18B680C9B08C200114369 /* ResourceLoadDelegate.mm in Sources */, BCA18B490C9B02C400114369 /* TextInputController.m in Sources */, BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */, + 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.mm in Sources */, BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */, BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */, 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index ee44325..b5cc874 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -1219,6 +1219,7 @@ static JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef static JSValueRef setSpatialNavigationEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { + // Has mac implementation. if (argumentCount < 1) return JSValueMakeUndefined(context); @@ -1722,6 +1723,19 @@ static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, return JSValueMakeUndefined(context); } +static JSValueRef hasSpellingMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 2) + return JSValueMakeUndefined(context); + + int from = JSValueToNumber(context, arguments[0], 0); + int length = JSValueToNumber(context, arguments[1], 0); + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + bool ok = controller->hasSpellingMarker(from, length); + + return JSValueMakeBoolean(context, ok); +} + static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); @@ -1890,6 +1904,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "hasSpellingMarker", hasSpellingMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 755a2b2..689e114 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -279,6 +279,8 @@ public: void abortModal(); + bool hasSpellingMarker(int from, int length); + // The following API test functions should probably be moved to platform-specific // unit tests outside of DRT once they exist. void apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index 83eda3a..d435a2e 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -75,6 +75,11 @@ NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid) return browser->getintidentifier(intid); } +NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value) +{ + return browser->getvalue(m_npp, variable, value); +} + NPObject* PluginTest::NPN_CreateObject(NPClass* npClass) { return browser->createobject(m_npp, npClass); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h index 2e896a6..cbc7934 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -62,6 +62,7 @@ public: // NPN functions. NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name); NPIdentifier NPN_GetIntIdentifier(int32_t intid); + NPError NPN_GetValue(NPNVariable, void* value); NPObject* NPN_CreateObject(NPClass*); bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp new file mode 100644 index 0000000..e464996 --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginTest.h" + +#include "PluginObject.h" + +using namespace std; + +// Passing a different NPP struct that has the same ndata value as the one passed to NPP_New should +// not trigger an assertion failure. + +class PassDifferentNPPStruct : public PluginTest { +public: + PassDifferentNPPStruct(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + , m_didReceiveInitialSetWindowCall(false) + { + } + +private: + virtual NPError NPP_SetWindow(NPP instance, NPWindow* window) + { + if (m_didReceiveInitialSetWindowCall) + return NPERR_NO_ERROR; + m_didReceiveInitialSetWindowCall = true; + + NPP oldNPP = m_npp; + NPP_t differentNPP = *m_npp; + m_npp = &differentNPP; + + NPBool privateMode; + NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); + + m_npp = oldNPP; + + if (error != NPERR_NO_ERROR) { + pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct failed with error %d", error); + return NPERR_GENERIC_ERROR; + } + pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succeeded"); + return NPERR_NO_ERROR; + } + + bool m_didReceiveInitialSetWindowCall; +}; + +static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass-different-npp-struct"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp new file mode 100644 index 0000000..32fd99b --- /dev/null +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "PluginTest.h" + +#include "PluginObject.h" + +using namespace std; + +// NPN_GetValue(NPNVnetscapeWindow) should return a valid HWND. + +class GetValueNetscapeWindow : public PluginTest { +public: + GetValueNetscapeWindow(NPP npp, const string& identifier) + : PluginTest(npp, identifier) + , m_didReceiveInitialSetWindowCall(false) + { + } + +private: + virtual NPError NPP_SetWindow(NPP instance, NPWindow* window) + { + if (m_didReceiveInitialSetWindowCall) + return NPERR_NO_ERROR; + m_didReceiveInitialSetWindowCall = true; + + HWND hwnd; + NPError error = NPN_GetValue(NPNVnetscapeWindow, &hwnd); + if (error != NPERR_NO_ERROR) { + pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) failed with error %d", error); + return NPERR_GENERIC_ERROR; + } + + if (!::IsWindow(hwnd)) { + pluginLog(instance, "::IsWindow returned FALSE"); + return NPERR_GENERIC_ERROR; + } + + if (hwnd == window->window) { + pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) returned the same value as NPWindow::window"); + return NPERR_GENERIC_ERROR; + } + + pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) succeeded"); + return NPERR_NO_ERROR; + } + + bool m_didReceiveInitialSetWindowCall; +}; + +static PluginTest::Register<GetValueNetscapeWindow> getValueNetscapeWindow("get-value-netscape-window"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp index 40bceb9..8054497 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp @@ -35,12 +35,17 @@ class WindowGeometryInitializedBeforeSetWindow : public PluginTest { public: WindowGeometryInitializedBeforeSetWindow(NPP npp, const string& identifier) : PluginTest(npp, identifier) + , m_didReceiveInitialSetWindowCall(false) { } private: virtual NPError NPP_SetWindow(NPP instance, NPWindow* window) { + if (m_didReceiveInitialSetWindowCall) + return NPERR_NO_ERROR; + m_didReceiveInitialSetWindowCall = true; + if (window->type != NPWindowTypeWindow) { pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type); return NPERR_GENERIC_ERROR; @@ -77,7 +82,9 @@ private: pluginLog(instance, "Plugin's HWND has been sized and positioned before NPP_SetWindow was called"); return NPERR_NO_ERROR; - } + } + + bool m_didReceiveInitialSetWindowCall; }; static PluginTest::Register<WindowGeometryInitializedBeforeSetWindow> windowGeometryInitializedBeforeSetWindow("window-geometry-initialized-before-set-window"); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp index dd894f4..e240c42 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp @@ -75,7 +75,7 @@ NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) { getEntryPointsWasCalled = true; -#if XP_MACOSX +#ifdef XP_MACOSX // Simulate Silverlight's behavior of crashing when NP_GetEntryPoints is called before NP_Initialize. if (!initializeWasCalled) CRASH(); @@ -111,7 +111,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc { bool forceCarbon = false; -#if XP_MACOSX +#ifdef XP_MACOSX NPEventModel eventModel; // Always turn on the CG model @@ -158,7 +158,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); instance->pdata = obj; -#if XP_MACOSX +#ifdef XP_MACOSX obj->eventModel = eventModel; #if !defined(BUILDING_ON_TIGER) obj->coreAnimationLayer = 0; @@ -198,7 +198,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc else if (strcasecmp(argn[i], "testwindowopen") == 0) obj->testWindowOpen = TRUE; else if (strcasecmp(argn[i], "drawingmodel") == 0) { -#if XP_MACOSX && !defined(BUILDING_ON_TIGER) +#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER) const char* value = argv[i]; if (strcasecmp(value, "coreanimation") == 0) { if (supportsCoreAnimation) @@ -234,7 +234,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc } } -#if XP_MACOSX +#ifdef XP_MACOSX browser->setvalue(instance, NPPVpluginDrawingModel, (void *)drawingModelToUse); #if !defined(BUILDING_ON_TIGER) if (drawingModelToUse == NPDrawingModelCoreAnimation) @@ -276,7 +276,7 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save) if (obj->logDestroy) pluginLog(instance, "NPP_Destroy"); -#if XP_MACOSX && !defined(BUILDING_ON_TIGER) +#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER) if (obj->coreAnimationLayer) CFRelease(obj->coreAnimationLayer); #endif @@ -400,7 +400,7 @@ void NPP_Print(NPP instance, NPPrint *platformPrint) { } -#if XP_MACOSX +#ifdef XP_MACOSX #ifndef NP_NO_CARBON static int16_t handleEventCarbon(NPP instance, PluginObject* obj, EventRecord* event) { @@ -462,13 +462,13 @@ static int16_t handleEventCarbon(NPP instance, PluginObject* obj, EventRecord* e pluginLog(instance, "kHighLevelEvent"); break; // NPAPI events - case getFocusEvent: + case NPEventType_GetFocusEvent: pluginLog(instance, "getFocusEvent"); break; - case loseFocusEvent: + case NPEventType_LoseFocusEvent: pluginLog(instance, "loseFocusEvent"); break; - case adjustCursorEvent: + case NPEventType_AdjustCursorEvent: pluginLog(instance, "adjustCursorEvent"); break; default: @@ -548,7 +548,7 @@ int16_t NPP_HandleEvent(NPP instance, void *event) if (!obj->eventLogging) return 0; -#if XP_MACOSX +#ifdef XP_MACOSX #ifndef NP_NO_CARBON if (obj->eventModel == NPEventModelCarbon) return handleEventCarbon(instance, obj, static_cast<EventRecord*>(event)); @@ -588,7 +588,7 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) return NPERR_NO_ERROR; } -#if XP_MACOSX && !defined(BUILDING_ON_TIGER) +#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER) if (variable == NPPVpluginCoreAnimationLayer) { if (!obj->coreAnimationLayer) return NPERR_GENERIC_ERROR; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj index 5ffb832..cdd7729 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj @@ -383,6 +383,10 @@ >
</File>
<File
+ RelativePath="..\Tests\PassDifferentNPPStruct.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
>
</File>
@@ -390,6 +394,10 @@ Name="win"
>
<File
+ RelativePath="..\Tests\win\GetValueNetscapeWindow.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\win\WindowGeometryInitializedBeforeSetWindow.cpp"
>
</File>
diff --git a/WebKitTools/DumpRenderTree/chromium/AccessibilityController.cpp b/WebKitTools/DumpRenderTree/chromium/AccessibilityController.cpp index 2487e1a..5601d9d 100644 --- a/WebKitTools/DumpRenderTree/chromium/AccessibilityController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/AccessibilityController.cpp @@ -32,11 +32,11 @@ #include "AccessibilityController.h" #include "TestShell.h" -#include "public/WebAccessibilityCache.h" -#include "public/WebAccessibilityObject.h" -#include "public/WebFrame.h" -#include "public/WebString.h" -#include "public/WebView.h" +#include "WebAccessibilityCache.h" +#include "WebAccessibilityObject.h" +#include "WebFrame.h" +#include "WebString.h" +#include "WebView.h" using namespace WebKit; diff --git a/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.cpp index 8698e25..dbd025a 100644 --- a/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.cpp +++ b/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "AccessibilityUIElement.h" -#include "public/WebAccessibilityObject.h" -#include "public/WebCString.h" -#include "public/WebString.h" +#include "WebAccessibilityObject.h" +#include "WebCString.h" +#include "WebString.h" #include <wtf/Assertions.h> using namespace WebKit; diff --git a/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.h index df3f5b9..366ed42 100644 --- a/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.h +++ b/WebKitTools/DumpRenderTree/chromium/AccessibilityUIElement.h @@ -32,7 +32,7 @@ #define AccessibilityUIElement_h #include "CppBoundClass.h" -#include "public/WebAccessibilityObject.h" +#include "WebAccessibilityObject.h" #include <wtf/Vector.h> class AccessibilityUIElement : public CppBoundClass { diff --git a/WebKitTools/DumpRenderTree/chromium/CppBoundClass.cpp b/WebKitTools/DumpRenderTree/chromium/CppBoundClass.cpp index 839787a..1348bbf 100644 --- a/WebKitTools/DumpRenderTree/chromium/CppBoundClass.cpp +++ b/WebKitTools/DumpRenderTree/chromium/CppBoundClass.cpp @@ -42,9 +42,9 @@ #include "config.h" #include "CppBoundClass.h" -#include "public/WebBindings.h" -#include "public/WebFrame.h" -#include "public/WebString.h" +#include "WebBindings.h" +#include "WebFrame.h" +#include "WebString.h" #include <wtf/Assertions.h> #include <wtf/OwnPtr.h> diff --git a/WebKitTools/DumpRenderTree/chromium/CppVariant.cpp b/WebKitTools/DumpRenderTree/chromium/CppVariant.cpp index 9539907..22e0013 100644 --- a/WebKitTools/DumpRenderTree/chromium/CppVariant.cpp +++ b/WebKitTools/DumpRenderTree/chromium/CppVariant.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "CppVariant.h" -#include "public/WebBindings.h" +#include "WebBindings.h" #include <limits> #include <wtf/Assertions.h> #include <wtf/StringExtras.h> diff --git a/WebKitTools/DumpRenderTree/chromium/CppVariant.h b/WebKitTools/DumpRenderTree/chromium/CppVariant.h index 3aa5abb..3032310 100644 --- a/WebKitTools/DumpRenderTree/chromium/CppVariant.h +++ b/WebKitTools/DumpRenderTree/chromium/CppVariant.h @@ -42,7 +42,7 @@ #ifndef CppVariant_h #define CppVariant_h -#include "public/WebBindings.h" +#include "WebBindings.h" #include "webkit/support/webkit_support.h" #include <string> #include <wtf/Vector.h> diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp index a9a891b..78c86e7 100644 --- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp +++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp @@ -34,10 +34,10 @@ #include "DRTDevToolsCallArgs.h" #include "DRTDevToolsClient.h" -#include "public/WebCString.h" -#include "public/WebDevToolsAgent.h" -#include "public/WebString.h" -#include "public/WebView.h" +#include "WebCString.h" +#include "WebDevToolsAgent.h" +#include "WebString.h" +#include "WebView.h" #include "webkit/support/webkit_support.h" using namespace WebKit; diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h index c988fa1..e1478d0 100644 --- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h +++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h @@ -33,7 +33,7 @@ #include "DRTDevToolsCallArgs.h" #include "Task.h" -#include "public/WebDevToolsAgentClient.h" +#include "WebDevToolsAgentClient.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h index b1ac2ec..a548159 100644 --- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h +++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h @@ -31,7 +31,7 @@ #ifndef DRTDevToolsCallArgs_h #define DRTDevToolsCallArgs_h -#include "public/WebString.h" +#include "WebString.h" #include <wtf/Assertions.h> class DRTDevToolsCallArgs { diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp index a53f0db..acccf18 100644 --- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp +++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp @@ -34,19 +34,19 @@ #include "DRTDevToolsAgent.h" #include "DRTDevToolsCallArgs.h" -#include "public/WebDevToolsAgent.h" -#include "public/WebDevToolsFrontend.h" -#include "public/WebFrame.h" -#include "public/WebScriptSource.h" -#include "public/WebString.h" -#include "public/WebView.h" +#include "WebDevToolsAgent.h" +#include "WebDevToolsFrontend.h" +#include "WebFrame.h" +#include "WebScriptSource.h" +#include "WebString.h" +#include "WebView.h" #include "webkit/support/webkit_support.h" using namespace WebKit; DRTDevToolsClient::DRTDevToolsClient(DRTDevToolsAgent* agent, WebView* webView) - : m_drtDevToolsAgent(agent) - , m_webView(webView) + : m_webView(webView) + , m_drtDevToolsAgent(agent) { m_webDevToolsFrontend.set(WebDevToolsFrontend::create(m_webView, this, diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h index f7c8fbf..9ca1402 100644 --- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h +++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h @@ -33,7 +33,7 @@ #include "DRTDevToolsCallArgs.h" #include "Task.h" -#include "public/WebDevToolsFrontendClient.h" +#include "WebDevToolsFrontendClient.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp index b2e50f7..72c0c3c 100644 --- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -48,6 +48,7 @@ static const char optionTestShell[] = "--test-shell"; static const char optionAllowExternalPages[] = "--allow-external-pages"; static const char optionStartupDialog[] = "--testshell-startup-dialog"; static const char optionCheckLayoutTestSystemDeps[] = "--check-layout-test-sys-deps"; +static const char optionEnableAcceleratedCompositing[] = "--enable-accelerated-compositing"; static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-canvas"; static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode) @@ -93,6 +94,7 @@ int main(int argc, char* argv[]) bool testShellMode = false; bool allowExternalPages = false; bool startupDialog = false; + bool acceleratedCompositingEnabled = false; bool accelerated2DCanvasEnabled = false; for (int i = 1; i < argc; ++i) { string argument(argv[i]); @@ -114,6 +116,8 @@ int main(int argc, char* argv[]) startupDialog = true; else if (argument == optionCheckLayoutTestSystemDeps) exit(checkLayoutTestSystemDependencies() ? EXIT_SUCCESS : EXIT_FAILURE); + else if (argument == optionEnableAcceleratedCompositing) + acceleratedCompositingEnabled = true; else if (argument == optionEnableAccelerated2DCanvas) accelerated2DCanvasEnabled = true; else if (argument.size() && argument[0] == '-') @@ -132,6 +136,7 @@ int main(int argc, char* argv[]) { // Explicit scope for the TestShell instance. TestShell shell(testShellMode); shell.setAllowExternalPages(allowExternalPages); + shell.setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); shell.setAccelerated2dCanvasEnabled(accelerated2DCanvasEnabled); if (serverMode && !tests.size()) { params.printSeparators = true; diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp index 5f51553..e250dfc 100644 --- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp @@ -44,18 +44,18 @@ #include "EventSender.h" #include "TestShell.h" -#include "public/WebDragData.h" -#include "public/WebDragOperation.h" -#include "public/WebPoint.h" -#include "public/WebString.h" -#include "public/WebTouchPoint.h" -#include "public/WebView.h" +#include "WebDragData.h" +#include "WebDragOperation.h" +#include "WebPoint.h" +#include "WebString.h" +#include "WebTouchPoint.h" +#include "WebView.h" #include "webkit/support/webkit_support.h" #include <wtf/Deque.h> #include <wtf/StringExtras.h> #if OS(WINDOWS) -#include "public/win/WebInputEventFactory.h" +#include "win/WebInputEventFactory.h" #endif // FIXME: layout before each event? @@ -779,7 +779,7 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian currentDragData.initialize(); Vector<string> files = arguments[0].toStringVector(); for (size_t i = 0; i < files.size(); ++i) - currentDragData.appendToFileNames(webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i])); + currentDragData.appendToFilenames(webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i])); currentDragEffectsAllowed = WebKit::WebDragOperationCopy; // Provide a drag source. diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.h b/WebKitTools/DumpRenderTree/chromium/EventSender.h index 399a132..118509b 100644 --- a/WebKitTools/DumpRenderTree/chromium/EventSender.h +++ b/WebKitTools/DumpRenderTree/chromium/EventSender.h @@ -39,9 +39,9 @@ #include "CppBoundClass.h" #include "Task.h" -#include "public/WebDragOperation.h" -#include "public/WebInputEvent.h" -#include "public/WebPoint.h" +#include "WebDragOperation.h" +#include "WebInputEvent.h" +#include "WebPoint.h" class TestShell; diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp index 3d3c204..82fd085 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -34,27 +34,27 @@ #include "DRTDevToolsAgent.h" #include "TestShell.h" +#include "WebAnimationController.h" +#include "WebBindings.h" +#include "WebConsoleMessage.h" +#include "WebData.h" +#include "WebDeviceOrientation.h" +#include "WebDeviceOrientationClientMock.h" +#include "WebDocument.h" +#include "WebElement.h" +#include "WebFrame.h" +#include "WebGeolocationServiceMock.h" +#include "WebInputElement.h" +#include "WebKit.h" +#include "WebNotificationPresenter.h" +#include "WebScriptSource.h" +#include "WebSecurityPolicy.h" +#include "WebSettings.h" +#include "WebSize.h" +#include "WebSpeechInputControllerMock.h" +#include "WebURL.h" +#include "WebView.h" #include "WebViewHost.h" -#include "public/WebAnimationController.h" -#include "public/WebBindings.h" -#include "public/WebConsoleMessage.h" -#include "public/WebData.h" -#include "public/WebDeviceOrientation.h" -#include "public/WebDeviceOrientationClientMock.h" -#include "public/WebDocument.h" -#include "public/WebElement.h" -#include "public/WebFrame.h" -#include "public/WebGeolocationServiceMock.h" -#include "public/WebInputElement.h" -#include "public/WebKit.h" -#include "public/WebNotificationPresenter.h" -#include "public/WebScriptSource.h" -#include "public/WebSecurityPolicy.h" -#include "public/WebSettings.h" -#include "public/WebSize.h" -#include "public/WebSpeechInputControllerMock.h" -#include "public/WebURL.h" -#include "public/WebView.h" #include "webkit/support/webkit_support.h" #include <algorithm> #include <cstdlib> @@ -106,7 +106,9 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors); bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission); bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); + bindMethod("layerTreeAsText", &LayoutTestController::layerTreeAsText); bindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem); + bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker); bindMethod("notifyDone", &LayoutTestController::notifyDone); bindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAnimations); bindMethod("numberOfPages", &LayoutTestController::numberOfPages); @@ -1537,6 +1539,11 @@ WebKit::WebSpeechInputController* LayoutTestController::speechInputController(We return m_speechInputControllerMock.get(); } +void LayoutTestController::layerTreeAsText(const CppArgumentList& args, CppVariant* result) +{ + result->set(m_shell->webView()->mainFrame()->layerTreeAsText().utf8()); +} + void LayoutTestController::markerTextForListItem(const CppArgumentList& args, CppVariant* result) { WebElement element; @@ -1552,3 +1559,10 @@ WebDeviceOrientationClient* LayoutTestController::deviceOrientationClient() m_deviceOrientationClientMock.set(WebDeviceOrientationClientMock::create()); return m_deviceOrientationClientMock.get(); } + +void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, CppVariant* result) +{ + if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) + return; + result->set(m_shell->webView()->mainFrame()->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32())); +} diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h index 8467097..ae1a7a2 100644 --- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h @@ -43,8 +43,8 @@ #include "CppBoundClass.h" #include "Task.h" -#include "public/WebString.h" -#include "public/WebURL.h" +#include "WebString.h" +#include "WebURL.h" #include <wtf/Deque.h> #include <wtf/OwnPtr.h> @@ -325,7 +325,10 @@ public: // Speech input related functions. void setMockSpeechInputResult(const CppArgumentList&, CppVariant*); + void layerTreeAsText(const CppArgumentList& args, CppVariant* result); + void markerTextForListItem(const CppArgumentList&, CppVariant*); + void hasSpellingMarker(const CppArgumentList&, CppVariant*); public: // The following methods are not exposed to JavaScript. diff --git a/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.cpp b/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.cpp index 0bf3802..bf39f60 100644 --- a/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.cpp +++ b/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.cpp @@ -31,12 +31,11 @@ #include "config.h" #include "MockSpellCheck.h" +#include "WebString.h" #include <wtf/ASCIICType.h> #include <wtf/Assertions.h> #include <wtf/text/WTFString.h> -#include "public/WebString.h" - using namespace WebKit; MockSpellCheck::MockSpellCheck() diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp index 7d4cbe3..7e7053b 100644 --- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp +++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp @@ -31,14 +31,14 @@ #include "config.h" #include "NotificationPresenter.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebNotification.h" +#include "WebNotificationPermissionCallback.h" +#include "WebSecurityOrigin.h" +#include "WebString.h" +#include "WebURL.h" #include "googleurl/src/gurl.h" -#include "public/WebKit.h" -#include "public/WebKitClient.h" -#include "public/WebNotification.h" -#include "public/WebNotificationPermissionCallback.h" -#include "public/WebSecurityOrigin.h" -#include "public/WebString.h" -#include "public/WebURL.h" #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h index 896f345..689a908 100644 --- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h +++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h @@ -31,8 +31,8 @@ #ifndef NotificationPresenter_h #define NotificationPresenter_h -#include "public/WebNotification.h" -#include "public/WebNotificationPresenter.h" +#include "WebNotification.h" +#include "WebNotificationPresenter.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/text/StringHash.h> diff --git a/WebKitTools/DumpRenderTree/chromium/PlainTextController.cpp b/WebKitTools/DumpRenderTree/chromium/PlainTextController.cpp index 6e6cf11..c8bdabd 100644 --- a/WebKitTools/DumpRenderTree/chromium/PlainTextController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/PlainTextController.cpp @@ -33,9 +33,9 @@ #include "PlainTextController.h" #include "TestShell.h" -#include "public/WebBindings.h" -#include "public/WebRange.h" -#include "public/WebString.h" +#include "WebBindings.h" +#include "WebRange.h" +#include "WebString.h" using namespace WebKit; diff --git a/WebKitTools/DumpRenderTree/chromium/Task.cpp b/WebKitTools/DumpRenderTree/chromium/Task.cpp index 3f90d8c..5719bac 100644 --- a/WebKitTools/DumpRenderTree/chromium/Task.cpp +++ b/WebKitTools/DumpRenderTree/chromium/Task.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "Task.h" -#include "public/WebKit.h" -#include "public/WebKitClient.h" +#include "WebKit.h" +#include "WebKitClient.h" #include "webkit/support/webkit_support.h" WebTask::WebTask(TaskList* list): m_taskList(list) { m_taskList->registerTask(this); } diff --git a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h index d75c3bf..b671489 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h +++ b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h @@ -31,10 +31,10 @@ #ifndef TestNavigationController_h #define TestNavigationController_h -#include "public/WebDataSource.h" -#include "public/WebHistoryItem.h" -#include "public/WebString.h" -#include "public/WebURL.h" +#include "WebDataSource.h" +#include "WebHistoryItem.h" +#include "WebString.h" +#include "WebURL.h" #include "webkit/support/webkit_support.h" #include <string> #include <wtf/RefCounted.h> diff --git a/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h new file mode 100644 index 0000000..49f72a6 --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npapi.h @@ -0,0 +1 @@ +#include "bindings/npapi.h" diff --git a/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h new file mode 100644 index 0000000..61588ca --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npfunctions.h @@ -0,0 +1,7 @@ +#include "bindings/npfunctions.h" + +// Non-standard event types can be passed to HandleEvent. +// npapi.h that comes with WebKit.framework adds these events. +#define getFocusEvent (osEvt + 16) +#define loseFocusEvent (osEvt + 17) +#define adjustCursorEvent (osEvt + 18) diff --git a/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h new file mode 100644 index 0000000..597d4ad --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders/WebKit/npruntime.h @@ -0,0 +1 @@ +#include "bindings/npruntime.h" diff --git a/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist new file mode 100644 index 0000000..663f058 --- /dev/null +++ b/WebKitTools/DumpRenderTree/chromium/TestNetscapePlugIn/Info.plist @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>WebKitTestNetscapePlugIn</string> + <key>CFBundleGetInfoString</key> + <string>420+, Copyright 2006-2009 Apple Inc.</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>com.apple.testnetscapeplugin</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>BRPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>CFPlugInDynamicRegisterFunction</key> + <string></string> + <key>CFPlugInDynamicRegistration</key> + <string>NO</string> + <key>CFPlugInFactories</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <string>MyFactoryFunction</string> + </dict> + <key>CFPlugInTypes</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <array> + <string>00000000-0000-0000-0000-000000000000</string> + </array> + </dict> + <key>CFPlugInUnloadFunction</key> + <string></string> + <key>WebPluginDescription</key> + <string>Simple Netscape plug-in that handles test content for WebKit</string> + <key>WebPluginMIMETypes</key> + <dict> + <key>application/x-webkit-test-netscape</key> + <dict> + <key>WebPluginExtensions</key> + <array> + <string>testnetscape</string> + </array> + <key>WebPluginTypeDescription</key> + <string>test netscape content</string> + </dict> + </dict> + <key>WebPluginName</key> + <string>WebKit Test PlugIn</string> +</dict> +</plist> diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp index 1a99b7d..0b27c78 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp @@ -34,22 +34,22 @@ #include "DRTDevToolsAgent.h" #include "DRTDevToolsClient.h" #include "LayoutTestController.h" +#include "WebDataSource.h" +#include "WebDocument.h" +#include "WebElement.h" +#include "WebFrame.h" +#include "WebHistoryItem.h" +#include "WebKit.h" +#include "WebRuntimeFeatures.h" +#include "WebScriptController.h" +#include "WebSettings.h" +#include "WebSize.h" +#include "WebSpeechInputControllerMock.h" +#include "WebString.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" +#include "WebView.h" #include "WebViewHost.h" -#include "public/WebDataSource.h" -#include "public/WebDocument.h" -#include "public/WebElement.h" -#include "public/WebFrame.h" -#include "public/WebHistoryItem.h" -#include "public/WebKit.h" -#include "public/WebRuntimeFeatures.h" -#include "public/WebScriptController.h" -#include "public/WebSettings.h" -#include "public/WebSize.h" -#include "public/WebSpeechInputControllerMock.h" -#include "public/WebString.h" -#include "public/WebURLRequest.h" -#include "public/WebURLResponse.h" -#include "public/WebView.h" #include "skia/ext/bitmap_platform_device.h" #include "skia/ext/platform_canvas.h" #include "webkit/support/webkit_support.h" @@ -82,9 +82,10 @@ TestShell::TestShell(bool testShellMode) , m_testIsPreparing(false) , m_focusedWidget(0) , m_testShellMode(testShellMode) + , m_devTools(0) , m_allowExternalPages(false) + , m_acceleratedCompositingEnabled(false) , m_accelerated2dCanvasEnabled(false) - , m_devTools(0) { WebRuntimeFeatures::enableGeolocation(true); WebRuntimeFeatures::enableIndexedDatabase(true); @@ -156,6 +157,7 @@ void TestShell::closeDevTools() void TestShell::resetWebSettings(WebView& webView) { m_prefs.reset(); + m_prefs.acceleratedCompositingEnabled = m_acceleratedCompositingEnabled; m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled; m_prefs.applyTo(&webView); } diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h index 4d022dc..a15d9ec 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestShell.h +++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h @@ -123,6 +123,7 @@ public: bool allowExternalPages() const { return m_allowExternalPages; } void setAllowExternalPages(bool allowExternalPages) { m_allowExternalPages = allowExternalPages; } + void setAcceleratedCompositingEnabled(bool enabled) { m_acceleratedCompositingEnabled = enabled; } void setAccelerated2dCanvasEnabled(bool enabled) { m_accelerated2dCanvasEnabled = enabled; } #if defined(OS_WIN) @@ -178,6 +179,7 @@ private: TestParams m_params; int m_timeout; // timeout value in millisecond bool m_allowExternalPages; + bool m_acceleratedCompositingEnabled; bool m_accelerated2dCanvasEnabled; WebPreferences m_prefs; diff --git a/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h b/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h index 9470804..a29e45f 100644 --- a/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h +++ b/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h @@ -31,9 +31,9 @@ #ifndef TestWebWorker_h #define TestWebWorker_h -#include "public/WebMessagePortChannel.h" -#include "public/WebWorker.h" -#include "public/WebWorkerClient.h" +#include "WebMessagePortChannel.h" +#include "WebWorker.h" +#include "WebWorkerClient.h" #include <wtf/RefCounted.h> namespace WebKit { diff --git a/WebKitTools/DumpRenderTree/chromium/TextInputController.cpp b/WebKitTools/DumpRenderTree/chromium/TextInputController.cpp index 4f06874..7af4e9f 100644 --- a/WebKitTools/DumpRenderTree/chromium/TextInputController.cpp +++ b/WebKitTools/DumpRenderTree/chromium/TextInputController.cpp @@ -32,11 +32,11 @@ #include "TextInputController.h" #include "TestShell.h" -#include "public/WebBindings.h" -#include "public/WebFrame.h" -#include "public/WebRange.h" -#include "public/WebString.h" -#include "public/WebView.h" +#include "WebBindings.h" +#include "WebFrame.h" +#include "WebRange.h" +#include "WebString.h" +#include "WebView.h" #include <wtf/StringExtras.h> #include <string> @@ -58,7 +58,6 @@ TextInputController::TextInputController(TestShell* shell) bindMethod("doCommand", &TextInputController::doCommand); bindMethod("firstRectForCharacterRange", &TextInputController::firstRectForCharacterRange); bindMethod("hasMarkedText", &TextInputController::hasMarkedText); - bindMethod("hasSpellingMarker", &TextInputController::hasSpellingMarker); bindMethod("insertText", &TextInputController::insertText); bindMethod("makeAttributedString", &TextInputController::makeAttributedString); bindMethod("markedRange", &TextInputController::markedRange); @@ -233,14 +232,3 @@ void TextInputController::makeAttributedString(const CppArgumentList&, CppVarian // FIXME: Implement this. result->setNull(); } - -void TextInputController::hasSpellingMarker(const CppArgumentList& arguments, CppVariant* result) -{ - if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) - return; - WebFrame* mainFrame = getMainFrame(); - if (!mainFrame) - return; - // Returns as a number for a compatibility reason. - result->set(mainFrame->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32()) ? 1 : 0); -} diff --git a/WebKitTools/DumpRenderTree/chromium/TextInputController.h b/WebKitTools/DumpRenderTree/chromium/TextInputController.h index ddacefe..9896be5 100644 --- a/WebKitTools/DumpRenderTree/chromium/TextInputController.h +++ b/WebKitTools/DumpRenderTree/chromium/TextInputController.h @@ -61,7 +61,6 @@ public: void characterIndexForPoint(const CppArgumentList&, CppVariant*); void validAttributesForMarkedText(const CppArgumentList&, CppVariant*); void makeAttributedString(const CppArgumentList&, CppVariant*); - void hasSpellingMarker(const CppArgumentList&, CppVariant*); private: // Returns the test shell's main WebFrame. diff --git a/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp b/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp index 35247ef..948b448 100644 --- a/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp +++ b/WebKitTools/DumpRenderTree/chromium/WebPreferences.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebPreferences.h" -#include "public/WebView.h" +#include "WebView.h" using namespace WebKit; @@ -102,6 +102,7 @@ void WebPreferences::reset() tabsToLinks = false; hyperlinkAuditingEnabled = false; + acceleratedCompositingEnabled = false; accelerated2dCanvasEnabled = false; } @@ -159,10 +160,7 @@ void WebPreferences::applyTo(WebView* webView) settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); settings->setUsesEncodingDetector(false); settings->setImagesEnabled(true); - - // FIXME: crbug.com/51879 - settings->setAcceleratedCompositingEnabled(false); - + settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled); settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled); } diff --git a/WebKitTools/DumpRenderTree/chromium/WebPreferences.h b/WebKitTools/DumpRenderTree/chromium/WebPreferences.h index c0ea70f..46877c0 100644 --- a/WebKitTools/DumpRenderTree/chromium/WebPreferences.h +++ b/WebKitTools/DumpRenderTree/chromium/WebPreferences.h @@ -31,9 +31,9 @@ #ifndef WebPreferences_h #define WebPerferences_h -#include "public/WebSettings.h" -#include "public/WebString.h" -#include "public/WebURL.h" +#include "WebSettings.h" +#include "WebString.h" +#include "WebURL.h" namespace WebKit { class WebView; @@ -77,6 +77,7 @@ struct WebPreferences { bool tabsToLinks; bool hyperlinkAuditingEnabled; bool caretBrowsingEnabled; + bool acceleratedCompositingEnabled; bool accelerated2dCanvasEnabled; WebPreferences() { reset(); } diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp index ef6c26a..6a8af81 100755 --- a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "WebThemeEngineDRT.h" +#include "WebRect.h" #include "WebThemeControlDRT.h" -#include "public/WebRect.h" #include "third_party/skia/include/core/SkRect.h" // Although all this code is generic, we include these headers diff --git a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h index c731540..e50886b 100644 --- a/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h +++ b/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.h @@ -47,7 +47,7 @@ #ifndef WebThemeEngineDRT_h #define WebThemeEngineDRT_h -#include "public/WebThemeEngine.h" +#include "win/WebThemeEngine.h" #include <wtf/Noncopyable.h> class WebThemeEngineDRT : public WebKit::WebThemeEngine, public Noncopyable { diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp index 9a086e4..ab8dbf0 100644 --- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp @@ -35,25 +35,25 @@ #include "TestNavigationController.h" #include "TestShell.h" #include "TestWebWorker.h" -#include "public/WebCString.h" -#include "public/WebConsoleMessage.h" -#include "public/WebContextMenuData.h" -#include "public/WebDataSource.h" -#include "public/WebDragData.h" -#include "public/WebElement.h" -#include "public/WebFrame.h" -#include "public/WebGeolocationServiceMock.h" -#include "public/WebHistoryItem.h" -#include "public/WebNode.h" -#include "public/WebRange.h" -#include "public/WebRect.h" -#include "public/WebScreenInfo.h" -#include "public/WebSize.h" -#include "public/WebStorageNamespace.h" -#include "public/WebURLRequest.h" -#include "public/WebURLResponse.h" -#include "public/WebView.h" -#include "public/WebWindowFeatures.h" +#include "WebCString.h" +#include "WebConsoleMessage.h" +#include "WebContextMenuData.h" +#include "WebDataSource.h" +#include "WebDragData.h" +#include "WebElement.h" +#include "WebFrame.h" +#include "WebGeolocationServiceMock.h" +#include "WebHistoryItem.h" +#include "WebNode.h" +#include "WebRange.h" +#include "WebRect.h" +#include "WebScreenInfo.h" +#include "WebSize.h" +#include "WebStorageNamespace.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" +#include "WebView.h" +#include "WebWindowFeatures.h" #include "skia/ext/platform_canvas.h" #include "webkit/support/webkit_support.h" #include <wtf/Assertions.h> @@ -124,7 +124,7 @@ static string descriptionSuitableForTestResult(const string& url) // dragging a file. static void addDRTFakeFileToDataObject(WebDragData* dragData) { - dragData->appendToFileNames(WebString::fromUTF8("DRTFakeFile")); + dragData->appendToFilenames(WebString::fromUTF8("DRTFakeFile")); } // Get a debugging string from a WebNavigationType. @@ -485,13 +485,11 @@ int WebViewHost::historyForwardListCount() return navigationController()->entryCount() - currentIndex - 1; } -void WebViewHost::focusAccessibilityObject(const WebAccessibilityObject& object) -{ - m_shell->accessibilityController()->setFocusedElement(object); -} - void WebViewHost::postAccessibilityNotification(const WebAccessibilityObject& obj, WebAccessibilityNotification notification) { + if (notification == WebAccessibilityNotificationFocusedUIElementChanged) + m_shell->accessibilityController()->setFocusedElement(obj); + if (m_shell->accessibilityController()->shouldDumpAccessibilityNotifications()) { printf("AccessibilityNotification - "); @@ -541,6 +539,8 @@ void WebViewHost::postAccessibilityNotification(const WebAccessibilityObject& ob case WebAccessibilityNotificationRowExpanded: printf("RowExpanded"); break; + default: + break; } WebKit::WebNode node = obj.node(); @@ -559,12 +559,14 @@ WebNotificationPresenter* WebViewHost::notificationPresenter() return m_shell->notificationPresenter(); } +#if !ENABLE(CLIENT_BASED_GEOLOCATION) WebKit::WebGeolocationService* WebViewHost::geolocationService() { if (!m_geolocationServiceMock.get()) m_geolocationServiceMock.set(WebGeolocationServiceMock::createWebGeolocationServiceMock()); return m_geolocationServiceMock.get(); } +#endif WebSpeechInputController* WebViewHost::speechInputController(WebKit::WebSpeechInputListener* listener) { @@ -592,6 +594,13 @@ void WebViewHost::didScrollRect(int, int, const WebRect& clipRect) didInvalidateRect(clipRect); } +void WebViewHost::scheduleComposite() +{ + WebSize widgetSize = webWidget()->size(); + WebRect clientRect(0, 0, widgetSize.width, widgetSize.height); + didInvalidateRect(clientRect); +} + void WebViewHost::didFocus() { m_shell->setFocus(webWidget(), true); @@ -628,6 +637,10 @@ void WebViewHost::closeWidgetSoon() { m_hasWindow = false; m_shell->closeWindow(this); + if (m_inModalLoop) { + m_inModalLoop = false; + webkit_support::QuitMessageLoop(); + } } void WebViewHost::didChangeCursor(const WebCursorInfo& cursorInfo) @@ -670,7 +683,11 @@ WebRect WebViewHost::windowResizerRect() void WebViewHost::runModal() { - // FIXME: Should we implement this in DRT? + bool oldState = webkit_support::MessageLoopNestableTasksAllowed(); + webkit_support::MessageLoopSetNestableTasksAllowed(true); + m_inModalLoop = true; + webkit_support::RunMessageLoop(); + webkit_support::MessageLoopSetNestableTasksAllowed(oldState); } // WebFrameClient ------------------------------------------------------------ @@ -1041,10 +1058,12 @@ WebViewHost::WebViewHost(TestShell* shell) , m_policyDelegateIsPermissive(false) , m_policyDelegateShouldNotifyDone(false) , m_shell(shell) + , m_webWidget(0) , m_topLoadingFrame(0) - , m_hasWindow(false) , m_pageId(-1) , m_lastPageIdUpdated(-1) + , m_hasWindow(false) + , m_inModalLoop(false) , m_smartInsertDeleteEnabled(true) #if OS(WINDOWS) , m_selectTrailingWhitespaceEnabled(true) @@ -1054,7 +1073,6 @@ WebViewHost::WebViewHost(TestShell* shell) , m_blocksRedirects(false) , m_requestReturnNull(false) , m_isPainting(false) - , m_webWidget(0) { m_navigationController.set(new TestNavigationController(this)); } diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h index bbb132d..429d3ab 100644 --- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h +++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h @@ -33,10 +33,10 @@ #include "MockSpellCheck.h" #include "TestNavigationController.h" -#include "public/WebAccessibilityNotification.h" -#include "public/WebCursorInfo.h" -#include "public/WebFrameClient.h" -#include "public/WebViewClient.h" +#include "WebAccessibilityNotification.h" +#include "WebCursorInfo.h" +#include "WebFrameClient.h" +#include "WebViewClient.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Vector.h> @@ -127,16 +127,18 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient, virtual void navigateBackForwardSoon(int offset); virtual int historyBackListCount(); virtual int historyForwardListCount(); - virtual void focusAccessibilityObject(const WebKit::WebAccessibilityObject&); virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification); virtual WebKit::WebNotificationPresenter* notificationPresenter(); +#if !ENABLE(CLIENT_BASED_GEOLOCATION) virtual WebKit::WebGeolocationService* geolocationService(); +#endif virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*); virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); // WebKit::WebWidgetClient virtual void didInvalidateRect(const WebKit::WebRect&); virtual void didScrollRect(int dx, int dy, const WebKit::WebRect&); + virtual void scheduleComposite(); virtual void didFocus(); virtual void didBlur(); virtual void didChangeCursor(const WebKit::WebCursorInfo&); @@ -257,6 +259,7 @@ private: WebKit::WebCursorInfo m_currentCursor; bool m_hasWindow; + bool m_inModalLoop; WebKit::WebRect m_windowRect; // true if we want to enable smart insert/delete. @@ -286,8 +289,10 @@ private: WebKit::WebRect m_paintRect; bool m_isPainting; +#if !ENABLE(CLIENT_BASED_GEOLOCATION) // Geolocation OwnPtr<WebKit::WebGeolocationServiceMock> m_geolocationServiceMock; +#endif OwnPtr<TestNavigationController*> m_navigationController; }; diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 521a0e1..e115683 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -131,9 +131,29 @@ static void appendString(gchar*& target, gchar* string) g_free(oldString); } -static void initializeFonts() +static void initializeGtkFontSettings(const char* testURL) +{ + GtkSettings* settings = gtk_settings_get_default(); + if (!settings) + return; + g_object_set(settings, "gtk-xft-antialias", 1, NULL); + g_object_set(settings, "gtk-xft-hinting", 1, NULL); + g_object_set(settings, "gtk-xft-hintstyle", "hintfull", NULL); + g_object_set(settings, "gtk-font-name", "Liberation Sans 16", NULL); + + // One test needs subpixel anti-aliasing turned on, but generally we + // want all text in other tests to use to grayscale anti-aliasing. + if (testURL && strstr(testURL, "xsettings_antialias_settings.html")) + g_object_set(settings, "gtk-xft-rgba", "rgb", NULL); + else + g_object_set(settings, "gtk-xft-rgba", "none", NULL); +} + +static void initializeFonts(const char* testURL = 0) { #if PLATFORM(X11) + initializeGtkFontSettings(testURL); + FcInit(); // If a test resulted a font being added or removed via the @font-face rule, then @@ -177,6 +197,8 @@ static void initializeFonts() "/usr/share/fonts/liberation/LiberationSerif-Regular.ttf", }, { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", "/usr/share/fonts/dejavu/DejaVuSans.ttf", }, + { "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf", + "/usr/share/fonts/dejavu/DejaVuSerif.ttf", }, }; // TODO: Some tests use Lucida. We should load these as well, once it becomes @@ -363,6 +385,7 @@ static void resetDefaultsToConsistentValues() "enable-html5-local-storage", TRUE, "enable-xss-auditor", FALSE, "enable-spatial-navigation", FALSE, + "enable-frame-flattening", FALSE, "javascript-can-access-clipboard", TRUE, "javascript-can-open-windows-automatically", TRUE, "enable-offline-web-application-cache", TRUE, @@ -373,6 +396,8 @@ static void resetDefaultsToConsistentValues() "monospace-font-family", "Courier", "serif-font-family", "Times", "sans-serif-font-family", "Helvetica", + "cursive-font-family", "cursive", + "fantasy-font-family", "fantasy", "default-font-size", 16, "default-monospace-font-size", 13, "minimum-font-size", 1, @@ -394,6 +419,9 @@ static void resetDefaultsToConsistentValues() webkit_reset_origin_access_white_lists(); + WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); + webkit_web_back_forward_list_clear(list); + #ifdef HAVE_LIBSOUP_2_29_90 SoupSession* session = webkit_get_default_session(); SoupCookieJar* jar = reinterpret_cast<SoupCookieJar*>(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR)); @@ -610,7 +638,7 @@ static void runTest(const string& testPathOrURL) if (prevTestBFItem) g_object_ref(prevTestBFItem); - initializeFonts(); + initializeFonts(testURL.c_str()); // Focus the web view before loading the test to avoid focusing problems gtk_widget_grab_focus(GTK_WIDGET(webView)); diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index d831076..181ef9f 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -183,8 +183,16 @@ JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pa size_t LayoutTestController::webHistoryItemCount() { - // FIXME: implement - return 0; + WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame); + WebKitWebBackForwardList* list = webkit_web_view_get_back_forward_list(webView); + + if (!list) + return -1; + + // We do not add the current page to the total count as it's not + // considered in DRT tests + return webkit_web_back_forward_list_get_back_length(list) + + webkit_web_back_forward_list_get_forward_length(list); } unsigned LayoutTestController::workerThreadCount() const @@ -423,7 +431,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool flag) void LayoutTestController::setFrameFlatteningEnabled(bool flag) { - // FIXME: implement + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + WebKitWebSettings* settings = webkit_web_view_get_settings(view); + g_object_set(G_OBJECT(settings), "enable-frame-flattening", flag, NULL); } void LayoutTestController::setSpatialNavigationEnabled(bool flag) @@ -804,3 +816,9 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) void LayoutTestController::abortModal() { } + +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement this. + return false; +} diff --git a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp b/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp index f0f461c..4073403 100644 --- a/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp @@ -36,15 +36,24 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); - GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0); gint width, height; +#ifdef GTK_API_VERSION_2 + GdkPixmap* pixmap = gtk_widget_get_snapshot(GTK_WIDGET(view), 0); gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height); +#else + width = gtk_widget_get_allocated_width(GTK_WIDGET(view)); + height = gtk_widget_get_allocated_height(GTK_WIDGET(view)); +#endif cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cairo_t* context = cairo_create(imageSurface); +#ifdef GTK_API_VERSION_2 gdk_cairo_set_source_pixmap(context, pixmap, 0, 0); cairo_paint(context); g_object_unref(pixmap); +#else + gtk_widget_draw(GTK_WIDGET(view), context); +#endif return BitmapContext::createByAdoptingBitmapAndContext(0, context); } diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf index 520f96e..6eb057e 100644 --- a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf +++ b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf @@ -28,6 +28,25 @@ </edit> </match> + <!-- Until we find good fonts to use for cursive and fantasy + just use our serif font. --> + <match target="pattern"> + <test qual="any" name="family"> + <string>cursive</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Serif</string> + </edit> + </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>fantasy</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Serif</string> + </edit> + </match> + <!-- The sans-serif font should be Liberation Sans --> <match target="pattern"> <test qual="any" name="family"> @@ -55,6 +74,22 @@ <string>Liberation Sans</string> </edit> </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>Arial</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Sans</string> + </edit> + </match> + <match target="pattern"> + <test qual="any" name="family"> + <string>Lucida Grande</string> + </test> + <edit name="family" mode="assign"> + <string>Liberation Sans</string> + </edit> + </match> <!-- The Monospace font should be Liberation Mono --> <match target="pattern"> @@ -214,6 +249,54 @@ </edit> </match> + <!-- We need to enable simulated bold to for DejaVu Serif to ensure that we interpret + this property correctly in: platform/gtk/fonts/fontconfig-synthetic-bold.html --> + <match target="font"> + <test qual="any" name="family"> + <string>DejaVu Serif</string> + </test> + <test name="weight" compare="less_eq"> + <const>medium</const> + </test> + <test target="pattern" name="weight" compare="more"> + <const>medium</const> + </test> + <edit name="embolden" mode="assign"> + <bool>true</bool> + </edit> + <edit name="weight" mode="assign"> + <const>bold</const> + </edit> + </match> + + <!-- We need to enable simulated oblique to for DejaVu Serif to ensure that we interpret + this property correctly in: platform/gtk/fonts/fontconfig-synthetic-oblique.html --> + <match target="font"> + <test qual="any" name="family"> + <string>DejaVu Serif</string> + </test> + <test name="slant"> + <const>roman</const> + </test> + <test target="pattern" name="slant" compare="not_eq"> + <const>roman</const> + </test> + <edit name="matrix" mode="assign"> + <times> + <name>matrix</name> + <matrix><double>1</double><double>0.2</double> + <double>0</double><double>1</double> + </matrix> + </times> + </edit> + <edit name="slant" mode="assign"> + <const>oblique</const> + </edit> + <edit name="embeddedbitmap" mode="assign"> + <bool>false</bool> + </edit> + </match> + <config> <!-- These are the default Unicode chars that are expected to be blank in fonts. All other blank chars are assumed to be broken and won't diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm index 5f9705a..2ca5755 100644 --- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm +++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm @@ -780,6 +780,17 @@ int AccessibilityUIElement::hierarchicalLevel() const return 0; } +JSStringRef AccessibilityUIElement::speak() +{ + BEGIN_AX_OBJC_EXCEPTIONS + id value = [m_element accessibilityAttributeValue:@"AXDRTSpeechAttribute"]; + if ([value isKindOfClass:[NSString class]]) + return [value createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + bool AccessibilityUIElement::ariaIsGrabbed() const { BEGIN_AX_OBJC_EXCEPTIONS @@ -824,6 +835,18 @@ int AccessibilityUIElement::lineForIndex(int index) return -1; } +JSStringRef AccessibilityUIElement::rangeForLine(int line) +{ + BEGIN_AX_OBJC_EXCEPTIONS + id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForLineParameterizedAttribute forParameter:[NSNumber numberWithInt:line]]; + if ([value isKindOfClass:[NSValue class]]) { + return [NSStringFromRange([value rangeValue]) createJSStringRef]; + } + END_AX_OBJC_EXCEPTIONS + + return 0; +} + JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) { NSRange range = NSMakeRange(location, length); diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 3732247..68765f6 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -49,6 +49,7 @@ #import "PolicyDelegate.h" #import "ResourceLoadDelegate.h" #import "UIDelegate.h" +#import "WebArchiveDumpSupport.h" #import "WorkQueue.h" #import "WorkQueueItem.h" #import <Carbon/Carbon.h> @@ -56,6 +57,7 @@ #import <WebKit/DOMElement.h> #import <WebKit/DOMExtensions.h> #import <WebKit/DOMRange.h> +#import <WebKit/WebArchive.h> #import <WebKit/WebBackForwardList.h> #import <WebKit/WebCache.h> #import <WebKit/WebCoreStatistics.h> @@ -65,7 +67,6 @@ #import <WebKit/WebDeviceOrientationProviderMock.h> #import <WebKit/WebEditingDelegate.h> #import <WebKit/WebFrameView.h> -#import <WebKit/WebHTMLRepresentationInternal.h> #import <WebKit/WebHistory.h> #import <WebKit/WebHistoryItemPrivate.h> #import <WebKit/WebInspector.h> @@ -822,176 +823,6 @@ static NSData *dumpFrameAsPDF(WebFrame *frame) return pdfData; } -static void convertMIMEType(NSMutableString *mimeType) -{ -#ifdef BUILDING_ON_LEOPARD - // Workaround for <rdar://problem/5539824> on Leopard - if ([mimeType isEqualToString:@"text/xml"]) - [mimeType setString:@"application/xml"]; -#endif - // Workaround for <rdar://problem/6234318> with Dashcode 2.0 - if ([mimeType isEqualToString:@"application/x-javascript"]) - [mimeType setString:@"text/javascript"]; -} - -static void convertWebResourceDataToString(NSMutableDictionary *resource) -{ - NSMutableString *mimeType = [resource objectForKey:@"WebResourceMIMEType"]; - convertMIMEType(mimeType); - - if ([mimeType hasPrefix:@"text/"] || [[WebHTMLRepresentation supportedNonImageMIMETypes] containsObject:mimeType]) { - NSString *textEncodingName = [resource objectForKey:@"WebResourceTextEncodingName"]; - NSStringEncoding stringEncoding; - if ([textEncodingName length] > 0) - stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)textEncodingName)); - else - stringEncoding = NSUTF8StringEncoding; - - NSData *data = [resource objectForKey:@"WebResourceData"]; - NSString *dataAsString = [[NSString alloc] initWithData:data encoding:stringEncoding]; - if (dataAsString) - [resource setObject:dataAsString forKey:@"WebResourceData"]; - [dataAsString release]; - } -} - -static void normalizeHTTPResponseHeaderFields(NSMutableDictionary *fields) -{ - // Normalize headers - if ([fields objectForKey:@"Date"]) - [fields setObject:@"Sun, 16 Nov 2008 17:00:00 GMT" forKey:@"Date"]; - if ([fields objectForKey:@"Last-Modified"]) - [fields setObject:@"Sun, 16 Nov 2008 16:55:00 GMT" forKey:@"Last-Modified"]; - if ([fields objectForKey:@"Etag"]) - [fields setObject:@"\"301925-21-45c7d72d3e780\"" forKey:@"Etag"]; - if ([fields objectForKey:@"Server"]) - [fields setObject:@"Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6" forKey:@"Server"]; - - // Remove headers - if ([fields objectForKey:@"Connection"]) - [fields removeObjectForKey:@"Connection"]; - if ([fields objectForKey:@"Keep-Alive"]) - [fields removeObjectForKey:@"Keep-Alive"]; -} - -static void normalizeWebResourceURL(NSMutableString *webResourceURL) -{ - static int fileUrlLength = [(NSString *)@"file://" length]; - NSRange layoutTestsWebArchivePathRange = [webResourceURL rangeOfString:@"/LayoutTests/" options:NSBackwardsSearch]; - if (layoutTestsWebArchivePathRange.location == NSNotFound) - return; - NSRange currentWorkingDirectoryRange = NSMakeRange(fileUrlLength, layoutTestsWebArchivePathRange.location - fileUrlLength); - [webResourceURL replaceCharactersInRange:currentWorkingDirectoryRange withString:@""]; -} - -static void convertWebResourceResponseToDictionary(NSMutableDictionary *propertyList) -{ - NSURLResponse *response = nil; - NSData *responseData = [propertyList objectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m - if ([responseData isKindOfClass:[NSData class]]) { - // Decode NSURLResponse - NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:responseData]; - response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m - [unarchiver finishDecoding]; - [unarchiver release]; - } - - NSMutableDictionary *responseDictionary = [[NSMutableDictionary alloc] init]; - - NSMutableString *urlString = [[[response URL] description] mutableCopy]; - normalizeWebResourceURL(urlString); - [responseDictionary setObject:urlString forKey:@"URL"]; - [urlString release]; - - NSMutableString *mimeTypeString = [[response MIMEType] mutableCopy]; - convertMIMEType(mimeTypeString); - [responseDictionary setObject:mimeTypeString forKey:@"MIMEType"]; - [mimeTypeString release]; - - NSString *textEncodingName = [response textEncodingName]; - if (textEncodingName) - [responseDictionary setObject:textEncodingName forKey:@"textEncodingName"]; - [responseDictionary setObject:[NSNumber numberWithLongLong:[response expectedContentLength]] forKey:@"expectedContentLength"]; - - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - - NSMutableDictionary *allHeaderFields = [[httpResponse allHeaderFields] mutableCopy]; - normalizeHTTPResponseHeaderFields(allHeaderFields); - [responseDictionary setObject:allHeaderFields forKey:@"allHeaderFields"]; - [allHeaderFields release]; - - [responseDictionary setObject:[NSNumber numberWithInt:[httpResponse statusCode]] forKey:@"statusCode"]; - } - - [propertyList setObject:responseDictionary forKey:@"WebResourceResponse"]; - [responseDictionary release]; -} - -static NSInteger compareResourceURLs(id resource1, id resource2, void *context) -{ - NSString *url1 = [resource1 objectForKey:@"WebResourceURL"]; - NSString *url2 = [resource2 objectForKey:@"WebResourceURL"]; - - return [url1 compare:url2]; -} - -static NSString *serializeWebArchiveToXML(WebArchive *webArchive) -{ - NSString *errorString; - NSMutableDictionary *propertyList = [NSPropertyListSerialization propertyListFromData:[webArchive data] - mutabilityOption:NSPropertyListMutableContainersAndLeaves - format:NULL - errorDescription:&errorString]; - if (!propertyList) - return errorString; - - NSMutableArray *resources = [NSMutableArray arrayWithCapacity:1]; - [resources addObject:propertyList]; - - while ([resources count]) { - NSMutableDictionary *resourcePropertyList = [resources objectAtIndex:0]; - [resources removeObjectAtIndex:0]; - - NSMutableDictionary *mainResource = [resourcePropertyList objectForKey:@"WebMainResource"]; - normalizeWebResourceURL([mainResource objectForKey:@"WebResourceURL"]); - convertWebResourceDataToString(mainResource); - - // Add subframeArchives to list for processing - NSMutableArray *subframeArchives = [resourcePropertyList objectForKey:@"WebSubframeArchives"]; // WebSubframeArchivesKey in WebArchive.m - if (subframeArchives) - [resources addObjectsFromArray:subframeArchives]; - - NSMutableArray *subresources = [resourcePropertyList objectForKey:@"WebSubresources"]; // WebSubresourcesKey in WebArchive.m - NSEnumerator *enumerator = [subresources objectEnumerator]; - NSMutableDictionary *subresourcePropertyList; - while ((subresourcePropertyList = [enumerator nextObject])) { - normalizeWebResourceURL([subresourcePropertyList objectForKey:@"WebResourceURL"]); - convertWebResourceResponseToDictionary(subresourcePropertyList); - convertWebResourceDataToString(subresourcePropertyList); - } - - // Sort the subresources so they're always in a predictable order for the dump - if (NSArray *sortedSubresources = [subresources sortedArrayUsingFunction:compareResourceURLs context:nil]) - [resourcePropertyList setObject:sortedSubresources forKey:@"WebSubresources"]; - } - - NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:propertyList - format:NSPropertyListXMLFormat_v1_0 - errorDescription:&errorString]; - if (!xmlData) - return errorString; - - NSMutableString *string = [[[NSMutableString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease]; - - // Replace "Apple Computer" with "Apple" in the DTD declaration. - NSRange range = [string rangeOfString:@"-//Apple Computer//"]; - if (range.location != NSNotFound) - [string replaceCharactersInRange:range withString:@"-//Apple//"]; - - return string; -} - static void dumpBackForwardListForWebView(WebView *view) { printf("\n============== Back Forward List ==============\n"); diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index d2a6f79..c5d5a90 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -422,7 +422,7 @@ void LayoutTestController::setFrameFlatteningEnabled(bool enabled) void LayoutTestController::setSpatialNavigationEnabled(bool enabled) { - // FIXME: Implement for SpatialNavigation layout tests. + [[[mainFrame webView] preferences] setSpatialNavigationEnabled:enabled]; } void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) @@ -944,3 +944,8 @@ void LayoutTestController::abortModal() { [NSApp abortModal]; } + +bool LayoutTestController::hasSpellingMarker(int from, int length) +{ + return [mainFrame hasSpellingMarker:from length:length]; +} diff --git a/WebKitTools/DumpRenderTree/mac/TextInputController.m b/WebKitTools/DumpRenderTree/mac/TextInputController.m index a049ac5..f780794 100644 --- a/WebKitTools/DumpRenderTree/mac/TextInputController.m +++ b/WebKitTools/DumpRenderTree/mac/TextInputController.m @@ -170,8 +170,7 @@ || aSelector == @selector(characterIndexForPointX:Y:) || aSelector == @selector(validAttributesForMarkedText) || aSelector == @selector(attributedStringWithString:) - || aSelector == @selector(setInputMethodHandler:) - || aSelector == @selector(hasSpellingMarker:length:)) + || aSelector == @selector(setInputMethodHandler:)) return NO; return YES; } @@ -196,8 +195,6 @@ return @"makeAttributedString"; // just a factory method, doesn't call into NSTextInput else if (aSelector == @selector(setInputMethodHandler:)) return @"setInputMethodHandler"; - else if (aSelector == @selector(hasSpellingMarker:length:)) - return @"hasSpellingMarker"; return nil; } @@ -431,9 +428,4 @@ return YES; } -- (BOOL)hasSpellingMarker:(int)from length:(int)length -{ - return [[webView mainFrame] hasSpellingMarker:from length:length]; -} - @end diff --git a/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.h b/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.h new file mode 100644 index 0000000..8654dd5 --- /dev/null +++ b/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + * + * 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 WebArchiveDumpSupport_h +#define WebArchiveDumpSupport_h + +@class NSString; +@class WebArchive; + +NSString *serializeWebArchiveToXML(WebArchive *webArchive); + +#endif /* WebArchiveDumpSupport_h */ diff --git a/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.mm b/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.mm new file mode 100644 index 0000000..7c52c6a --- /dev/null +++ b/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.mm @@ -0,0 +1,200 @@ +/* + * Copyright (C) 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. + * + * 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. + */ + +#import "WebArchiveDumpSupport.h" + +#import <Foundation/Foundation.h> +#import <WebKit/WebArchive.h> +#import <WebKit/WebHTMLRepresentationInternal.h> + +static void convertMIMEType(NSMutableString *mimeType) +{ +#ifdef BUILDING_ON_LEOPARD + // Workaround for <rdar://problem/5539824> on Leopard + if ([mimeType isEqualToString:@"text/xml"]) + [mimeType setString:@"application/xml"]; +#endif + // Workaround for <rdar://problem/6234318> with Dashcode 2.0 + if ([mimeType isEqualToString:@"application/x-javascript"]) + [mimeType setString:@"text/javascript"]; +} + +static void convertWebResourceDataToString(NSMutableDictionary *resource) +{ + NSMutableString *mimeType = [resource objectForKey:@"WebResourceMIMEType"]; + convertMIMEType(mimeType); + + if ([mimeType hasPrefix:@"text/"] || [[WebHTMLRepresentation supportedNonImageMIMETypes] containsObject:mimeType]) { + NSString *textEncodingName = [resource objectForKey:@"WebResourceTextEncodingName"]; + NSStringEncoding stringEncoding; + if ([textEncodingName length] > 0) + stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)textEncodingName)); + else + stringEncoding = NSUTF8StringEncoding; + + NSData *data = [resource objectForKey:@"WebResourceData"]; + NSString *dataAsString = [[NSString alloc] initWithData:data encoding:stringEncoding]; + if (dataAsString) + [resource setObject:dataAsString forKey:@"WebResourceData"]; + [dataAsString release]; + } +} + +static void normalizeHTTPResponseHeaderFields(NSMutableDictionary *fields) +{ + // Normalize headers + if ([fields objectForKey:@"Date"]) + [fields setObject:@"Sun, 16 Nov 2008 17:00:00 GMT" forKey:@"Date"]; + if ([fields objectForKey:@"Last-Modified"]) + [fields setObject:@"Sun, 16 Nov 2008 16:55:00 GMT" forKey:@"Last-Modified"]; + if ([fields objectForKey:@"Etag"]) + [fields setObject:@"\"301925-21-45c7d72d3e780\"" forKey:@"Etag"]; + if ([fields objectForKey:@"Server"]) + [fields setObject:@"Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l PHP/5.2.6" forKey:@"Server"]; + + // Remove headers + if ([fields objectForKey:@"Connection"]) + [fields removeObjectForKey:@"Connection"]; + if ([fields objectForKey:@"Keep-Alive"]) + [fields removeObjectForKey:@"Keep-Alive"]; +} + +static void normalizeWebResourceURL(NSMutableString *webResourceURL) +{ + static int fileUrlLength = [(NSString *)@"file://" length]; + NSRange layoutTestsWebArchivePathRange = [webResourceURL rangeOfString:@"/LayoutTests/" options:NSBackwardsSearch]; + if (layoutTestsWebArchivePathRange.location == NSNotFound) + return; + NSRange currentWorkingDirectoryRange = NSMakeRange(fileUrlLength, layoutTestsWebArchivePathRange.location - fileUrlLength); + [webResourceURL replaceCharactersInRange:currentWorkingDirectoryRange withString:@""]; +} + +static void convertWebResourceResponseToDictionary(NSMutableDictionary *propertyList) +{ + NSURLResponse *response = nil; + NSData *responseData = [propertyList objectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m + if ([responseData isKindOfClass:[NSData class]]) { + // Decode NSURLResponse + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:responseData]; + response = [unarchiver decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m + [unarchiver finishDecoding]; + [unarchiver release]; + } + + NSMutableDictionary *responseDictionary = [[NSMutableDictionary alloc] init]; + + NSMutableString *urlString = [[[response URL] description] mutableCopy]; + normalizeWebResourceURL(urlString); + [responseDictionary setObject:urlString forKey:@"URL"]; + [urlString release]; + + NSMutableString *mimeTypeString = [[response MIMEType] mutableCopy]; + convertMIMEType(mimeTypeString); + [responseDictionary setObject:mimeTypeString forKey:@"MIMEType"]; + [mimeTypeString release]; + + NSString *textEncodingName = [response textEncodingName]; + if (textEncodingName) + [responseDictionary setObject:textEncodingName forKey:@"textEncodingName"]; + [responseDictionary setObject:[NSNumber numberWithLongLong:[response expectedContentLength]] forKey:@"expectedContentLength"]; + + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; + + NSMutableDictionary *allHeaderFields = [[httpResponse allHeaderFields] mutableCopy]; + normalizeHTTPResponseHeaderFields(allHeaderFields); + [responseDictionary setObject:allHeaderFields forKey:@"allHeaderFields"]; + [allHeaderFields release]; + + [responseDictionary setObject:[NSNumber numberWithInt:[httpResponse statusCode]] forKey:@"statusCode"]; + } + + [propertyList setObject:responseDictionary forKey:@"WebResourceResponse"]; + [responseDictionary release]; +} + +static NSInteger compareResourceURLs(id resource1, id resource2, void *context) +{ + NSString *url1 = [resource1 objectForKey:@"WebResourceURL"]; + NSString *url2 = [resource2 objectForKey:@"WebResourceURL"]; + + return [url1 compare:url2]; +} + +NSString *serializeWebArchiveToXML(WebArchive *webArchive) +{ + NSString *errorString; + NSMutableDictionary *propertyList = [NSPropertyListSerialization propertyListFromData:[webArchive data] + mutabilityOption:NSPropertyListMutableContainersAndLeaves + format:NULL + errorDescription:&errorString]; + if (!propertyList) + return errorString; + + NSMutableArray *resources = [NSMutableArray arrayWithCapacity:1]; + [resources addObject:propertyList]; + + while ([resources count]) { + NSMutableDictionary *resourcePropertyList = [resources objectAtIndex:0]; + [resources removeObjectAtIndex:0]; + + NSMutableDictionary *mainResource = [resourcePropertyList objectForKey:@"WebMainResource"]; + normalizeWebResourceURL([mainResource objectForKey:@"WebResourceURL"]); + convertWebResourceDataToString(mainResource); + + // Add subframeArchives to list for processing + NSMutableArray *subframeArchives = [resourcePropertyList objectForKey:@"WebSubframeArchives"]; // WebSubframeArchivesKey in WebArchive.m + if (subframeArchives) + [resources addObjectsFromArray:subframeArchives]; + + NSMutableArray *subresources = [resourcePropertyList objectForKey:@"WebSubresources"]; // WebSubresourcesKey in WebArchive.m + NSEnumerator *enumerator = [subresources objectEnumerator]; + NSMutableDictionary *subresourcePropertyList; + while ((subresourcePropertyList = [enumerator nextObject])) { + normalizeWebResourceURL([subresourcePropertyList objectForKey:@"WebResourceURL"]); + convertWebResourceResponseToDictionary(subresourcePropertyList); + convertWebResourceDataToString(subresourcePropertyList); + } + + // Sort the subresources so they're always in a predictable order for the dump + if (NSArray *sortedSubresources = [subresources sortedArrayUsingFunction:compareResourceURLs context:nil]) + [resourcePropertyList setObject:sortedSubresources forKey:@"WebSubresources"]; + } + + NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:propertyList + format:NSPropertyListXMLFormat_v1_0 + errorDescription:&errorString]; + if (!xmlData) + return errorString; + + NSMutableString *string = [[[NSMutableString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease]; + + // Replace "Apple Computer" with "Apple" in the DTD declaration. + NSRange range = [string rangeOfString:@"-//Apple Computer//"]; + if (range.location != NSNotFound) + [string replaceCharactersInRange:range withString:@"-//Apple//"]; + + return string; +} diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro index 801251d..54d5af7 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro @@ -27,12 +27,14 @@ HEADERS = $$BASEDIR/WorkQueue.h \ WorkQueueItemQt.h \ LayoutTestControllerQt.h \ GCControllerQt.h \ + PlainTextControllerQt.h \ testplugin.h SOURCES = ../../../JavaScriptCore/wtf/Assertions.cpp \ $$BASEDIR/WorkQueue.cpp \ DumpRenderTreeQt.cpp \ EventSenderQt.cpp \ TextInputControllerQt.cpp \ + PlainTextControllerQt.cpp \ WorkQueueItemQt.cpp \ LayoutTestControllerQt.cpp \ GCControllerQt.cpp \ diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 80fa441..50ae605 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -37,6 +37,7 @@ #include "GCControllerQt.h" #include "LayoutTestControllerQt.h" #include "TextInputControllerQt.h" +#include "PlainTextControllerQt.h" #include "testplugin.h" #include "WorkQueue.h" @@ -450,6 +451,9 @@ DumpRenderTree::DumpRenderTree() view->setPage(m_page); m_mainView = view; } + // Use a frame group name for all pages created by DumpRenderTree to allow + // testing of cross-page frame lookup. + DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree"); m_mainView->setContextMenuPolicy(Qt::NoContextMenu); m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight)); @@ -470,6 +474,7 @@ DumpRenderTree::DumpRenderTree() connect(m_controller, SIGNAL(done()), this, SLOT(dump())); m_eventSender = new EventSender(m_page); m_textInputController = new TextInputController(m_page); + m_plainTextController = new PlainTextController(m_page); m_gcController = new GCController(m_page); // now connect our different signals @@ -752,6 +757,7 @@ void DumpRenderTree::initJSObjects() frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController); + frame->addToJavaScriptWindowObject(QLatin1String("plainText"), m_plainTextController); } void DumpRenderTree::showPage() @@ -827,7 +833,7 @@ static QString dumpHistoryItem(const QWebHistoryItem& item, int indent, bool cur for (int i = start; i < indent; i++) result.append(' '); - QString url = item.url().toString(); + QString url = item.url().toEncoded(); if (url.contains("file://")) { static QString layoutTestsString("/LayoutTests/"); static QString fileTestString("(file test):"); @@ -1059,6 +1065,11 @@ QWebPage *DumpRenderTree::createWindow() connectFrame(page->mainFrame()); connect(page, SIGNAL(loadFinished(bool)), m_controller, SLOT(maybeDump(bool))); connect(page, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); + + // Use a frame group name for all pages created by DumpRenderTree to allow + // testing of cross-page frame lookup. + DumpRenderTreeSupportQt::webPageSetGroupName(page, "org.webkit.qt.DumpRenderTree"); + return page; } @@ -1067,6 +1078,9 @@ void DumpRenderTree::windowCloseRequested() QWebPage* page = qobject_cast<QWebPage*>(sender()); QObject* container = page->parent(); windows.removeAll(container); + // Our use of container->deleteLater() means we need to remove closed pages + // from the org.webkit.qt.DumpRenderTree group explicitly. + DumpRenderTreeSupportQt::webPageSetGroupName(page, ""); container->deleteLater(); } diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index 3d34443..b3e4e32 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -60,6 +60,7 @@ class DumpRenderTreeSupportQt; class EventSender; class TextInputController; class GCController; +class PlainTextController; namespace WebCore { @@ -148,6 +149,7 @@ private: EventSender *m_eventSender; TextInputController *m_textInputController; GCController* m_gcController; + PlainTextController* m_plainTextController; NetworkAccessManager* m_networkAccessManager; QFile *m_stdin; diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index fd7c925..6fb75a5 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -254,9 +254,18 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u modifs = Qt::ControlModifier; s = QString(); } else if (code == 'o' && modifs == Qt::ControlModifier) { + // Mimic the emacs ctrl-o binding on Mac by inserting a paragraph + // separator and then putting the cursor back to its original + // position. Allows us to pass emacs-ctrl-o.html s = QLatin1String("\n"); code = '\n'; modifs = 0; + QKeyEvent event(QEvent::KeyPress, code, modifs, s); + sendEvent(m_page, &event); + QKeyEvent event2(QEvent::KeyRelease, code, modifs, s); + sendEvent(m_page, &event2); + s = QString(); + code = Qt::Key_Left; } else if (code == 'y' && modifs == Qt::ControlModifier) { s = QLatin1String("c"); code = 'c'; diff --git a/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp index ba7e2c3..3aa507f 100644 --- a/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp @@ -48,7 +48,7 @@ void GCController::collectOnAlternateThread(bool waitUntilDone) const DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone); } -size_t GCController::getJSObjectCount() const +unsigned int GCController::getJSObjectCount() const { return DumpRenderTreeSupportQt::javaScriptObjectsCount(); } diff --git a/WebKitTools/DumpRenderTree/qt/GCControllerQt.h b/WebKitTools/DumpRenderTree/qt/GCControllerQt.h index ed2a858..d3c83b9 100644 --- a/WebKitTools/DumpRenderTree/qt/GCControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/GCControllerQt.h @@ -43,7 +43,7 @@ public: public slots: void collect() const; void collectOnAlternateThread(bool waitUntilDone) const; - size_t getJSObjectCount() const; + unsigned int getJSObjectCount() const; }; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 90a04c4..d36a074 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -284,13 +284,15 @@ void LayoutTestController::setDeferMainResourceDataLoad(bool defer) void LayoutTestController::queueBackNavigation(int howFarBackward) { //qDebug() << ">>>queueBackNavigation" << howFarBackward; - WorkQueue::shared()->queue(new BackItem(howFarBackward, m_drt->webPage())); + for (int i = 0; i != howFarBackward; ++i) + WorkQueue::shared()->queue(new BackItem(1, m_drt->webPage())); } void LayoutTestController::queueForwardNavigation(int howFarForward) { //qDebug() << ">>>queueForwardNavigation" << howFarForward; - WorkQueue::shared()->queue(new ForwardItem(howFarForward, m_drt->webPage())); + for (int i = 0; i != howFarForward; ++i) + WorkQueue::shared()->queue(new ForwardItem(1, m_drt->webPage())); } void LayoutTestController::queueLoad(const QString& url, const QString& target) @@ -796,5 +798,11 @@ void LayoutTestController::removeAllVisitedLinks() DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true); } +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement. + return false; +} + const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index ec89acb..3684946 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -219,6 +219,7 @@ public slots: // Empty stub method to keep parity with object model exposed by global LayoutTestController. void abortModal() {} + bool hasSpellingMarker(int from, int length); /* Policy values: 'on', 'auto' or 'off'. diff --git a/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp new file mode 100644 index 0000000..441a37c --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 "PlainTextControllerQt.h" + +#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include <QApplication> +#include <QInputMethodEvent> +#include <QKeyEvent> + +PlainTextController::PlainTextController(QWebPage* parent) + : QObject(parent) +{ +} + +QString PlainTextController::plainText(const QVariant& range) +{ + return DumpRenderTreeSupportQt::plainText(range); +} diff --git a/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h new file mode 100644 index 0000000..e78e110 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must 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 PlainTextControllerQt_h +#define PlainTextControllerQt_h + +#include <QList> +#include <QObject> +#include <QString> +#include <QVariant> + +#include "qwebpage.h" + +class PlainTextController : public QObject { + Q_OBJECT +public: + PlainTextController(QWebPage* parent); + +public slots: + QString plainText(const QVariant& range); +}; + +#endif // PlainTextControllerQt_h diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index e48b035..740ebb8 100644 --- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -31,6 +31,7 @@ SOURCES = PluginObject.cpp \ Tests/DocumentOpenInDestroyStream.cpp \ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ Tests/NPRuntimeRemoveProperty.cpp \ + Tests/PassDifferentNPPStruct.cpp \ Tests/PluginScriptableNPObjectInvokeDefault.cpp mac { diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp index 255bfc3..f03c102 100644 --- a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp @@ -232,7 +232,8 @@ static void CALLBACK notificationListenerProc(HWINEVENTHOOK, DWORD event, HWND h VariantInit(&vChild); HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &parentObject, &vChild); - ASSERT(SUCCEEDED(hr)); + if (FAILED(hr) || !parentObject) + return; COMPtr<IDispatch> childDispatch; if (FAILED(parentObject->get_accChild(vChild, &childDispatch))) { diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj index 0a02110..fde5e47 100644 --- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj +++ b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj @@ -287,6 +287,76 @@ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

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

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

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

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
/>
</Configuration>
+ <Configuration
+ Name="Debug_Cairo|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops"
+ CharacterSet="2"
+ >
+ <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"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private""
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/NXCOMPAT"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib"
+ AdditionalLibraryDirectories=""
+ SubSystem="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"

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

if not defined ARCHIVE_BUILD (if defined PRODUCTION exit /b)

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

xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d /e /i "$(WebKitLibrariesDir)\bin\CoreFoundation.resources" "$(WebKitOutputDir)\bin\CoreFoundation.resources"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 6dd609c..d2140d1 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -1390,3 +1390,9 @@ void LayoutTestController::setEditingBehavior(const char* editingBehavior) void LayoutTestController::abortModal() { } + +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement this. + return false; +} diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 5fba1cf..eefc587 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -505,6 +505,12 @@ void LayoutTestController::abortModal() { } +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement + return false; +} + JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const { // FIXME: Implement |