summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/chromium
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
commit8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch)
treecdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Tools/DumpRenderTree/chromium
parent1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff)
downloadqtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.cpp34
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.h9
-rw-r--r--Tools/DumpRenderTree/chromium/TestShellLinux.cpp46
-rw-r--r--Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm13
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp34
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h5
6 files changed, 85 insertions, 56 deletions
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
index a56f4c35b..d2823afdb 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -49,6 +49,7 @@
#include "WebGeolocationClientMock.h"
#include "WebIDBFactory.h"
#include "WebInputElement.h"
+#include "WebIntent.h"
#include "WebIntentRequest.h"
#include "WebKit.h"
#include "WebNotificationPresenter.h"
@@ -79,12 +80,23 @@ using namespace WebCore;
using namespace WebKit;
using namespace std;
+class EmptyWebDeliveredIntentClient : public WebKit::WebDeliveredIntentClient {
+public:
+ EmptyWebDeliveredIntentClient() { }
+ ~EmptyWebDeliveredIntentClient() { }
+
+ virtual void postResult(const WebSerializedScriptValue& data) const { }
+ virtual void postFailure(const WebSerializedScriptValue& data) const { }
+ virtual void destroy() { }
+};
+
LayoutTestController::LayoutTestController(TestShell* shell)
: m_shell(shell)
, m_closeRemainingWindows(false)
, m_deferMainResourceDataLoad(false)
, m_showDebugLayerTree(false)
, m_workQueue(this)
+ , m_intentClient(adoptPtr(new EmptyWebDeliveredIntentClient))
, m_shouldStayOnPageAfterHandlingBeforeUnload(false)
{
@@ -271,6 +283,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindProperty("interceptPostMessage", &m_interceptPostMessage);
bindProperty("workerThreadCount", &LayoutTestController::workerThreadCount);
bindMethod("sendWebIntentResponse", &LayoutTestController::sendWebIntentResponse);
+ bindMethod("deliverWebIntent", &LayoutTestController::deliverWebIntent);
}
LayoutTestController::~LayoutTestController()
@@ -2153,6 +2166,27 @@ void LayoutTestController::sendWebIntentResponse(const CppArgumentList& argument
result->setNull();
}
+void LayoutTestController::deliverWebIntent(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() < 3)
+ return;
+
+ v8::HandleScope scope;
+ v8::Local<v8::Context> ctx = m_shell->webView()->mainFrame()->mainWorldScriptContext();
+ result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8());
+ v8::Context::Scope cscope(ctx);
+
+ WebString action = cppVariantToWebString(arguments[0]);
+ WebString type = cppVariantToWebString(arguments[1]);
+ WebKit::WebCString data = cppVariantToWebString(arguments[2]).utf8();
+ WebSerializedScriptValue serializedData = WebSerializedScriptValue::serialize(
+ v8::String::New(data.data(), data.length()));
+
+ WebIntent intent(action, type, serializedData.toString());
+
+ m_shell->webView()->mainFrame()->deliverIntent(intent, m_intentClient.get());
+}
+
void LayoutTestController::setPluginsEnabled(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h
index 7bdb4e143..793afdfb9 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h
@@ -43,6 +43,7 @@
#include "CppBoundClass.h"
#include "Task.h"
+#include "WebDeliveredIntentClient.h"
#include "platform/WebArrayBufferView.h"
#include "platform/WebString.h"
#include "WebTextDirection.h"
@@ -438,9 +439,12 @@ public:
void workerThreadCount(CppVariant*);
// Expects one string argument for sending successful result, zero
- // for sending a failure result.
+ // arguments for sending a failure result.
void sendWebIntentResponse(const CppArgumentList&, CppVariant*);
+ // Cause the web intent to be delivered to this context.
+ void deliverWebIntent(const CppArgumentList&, CppVariant*);
+
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
@@ -705,6 +709,9 @@ private:
// WAV audio data is stored here.
WebKit::WebArrayBufferView m_audioData;
+ // Mock object for testing delivering web intents.
+ OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;
+
bool m_shouldStayOnPageAfterHandlingBeforeUnload;
// If true, calls to WebViewHost::enter/exitFullScreenNow will not result in
diff --git a/Tools/DumpRenderTree/chromium/TestShellLinux.cpp b/Tools/DumpRenderTree/chromium/TestShellLinux.cpp
index 82db69a2f..b8259b6e7 100644
--- a/Tools/DumpRenderTree/chromium/TestShellLinux.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShellLinux.cpp
@@ -80,6 +80,25 @@ void TestShell::waitTestFinished()
}
#if !OS(ANDROID)
+static bool checkAndLoadFontFile(FcConfig* fontcfg, const char* path1, const char* path2)
+{
+ const char* font = path1;
+ if (access(font, R_OK) < 0) {
+ font = path2;
+ if (access(font, R_OK) < 0) {
+ fprintf(stderr, "You are missing %s or %s. Without this, some layout tests may fail. "
+ "See http://code.google.com/p/chromium/wiki/LayoutTestsLinux "
+ "for more.\n", path1, path2);
+ return false;
+ }
+ }
+ if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) {
+ fprintf(stderr, "Failed to load font %s\n", font);
+ return false;
+ }
+ return true;
+}
+
static void setupFontconfig()
{
// We wish to make the layout tests reproducable with respect to fonts. Skia
@@ -147,7 +166,6 @@ static void setupFontconfig()
"/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf",
"/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf",
"/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf",
- "/usr/share/fonts/truetype/thai/Garuda.ttf",
// The DejaVuSans font is used by the css2.1 tests.
"/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
"/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf",
@@ -167,28 +185,14 @@ static void setupFontconfig()
}
}
+ if (!checkAndLoadFontFile(fontcfg, "/usr/share/fonts/truetype/thai/Garuda.ttf",
+ "/usr/share/fonts/truetype/tlwg/Garuda.ttf"))
+ exit(1);
+
// We special case these fonts because they're only needed in a
// few layout tests.
- static const char* const optionalFonts[] = {
- "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf",
- };
- for (size_t i = 0; i < arraysize(optionalFonts); ++i) {
- const char* font = optionalFonts[i];
-
- // This font changed paths across Ubuntu releases, so try checking in both locations.
- if (!strcmp(font, "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf")
- && access(font, R_OK) < 0)
- font = "/usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf";
-
- if (access(font, R_OK) < 0) {
- fprintf(stderr, "You are missing %s. Without this, some layout tests may fail. "
- "See http://code.google.com/p/chromium/wiki/LayoutTestsLinux "
- "for more.\n", font);
- } else if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) {
- fprintf(stderr, "Failed to load font %s\n", font);
- exit(1);
- }
- }
+ checkAndLoadFontFile(fontcfg, "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf",
+ "/usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf");
// Also load the layout-test-specific "Ahem" font.
std::string ahemPath = drtDirPath + "AHEM____.TTF";
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm
index 9a1c30857..6f9c4b66d 100644
--- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm
+++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTMac.mm
@@ -30,6 +30,7 @@
#include "WebThemeEngineDRTMac.h"
+#include "skia/ext/skia_utils_mac.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#import <AppKit/NSAffineTransform.h>
@@ -38,10 +39,6 @@
#import <AppKit/NSWindow.h>
#include <Carbon/Carbon.h>
-#if WEBKIT_USING_SKIA
-#include "skia/ext/skia_utils_mac.h"
-#endif
-
using WebKit::WebCanvas;
using WebKit::WebRect;
using WebKit::WebThemeEngine;
@@ -144,12 +141,8 @@ void WebThemeEngineDRTMac::paintHIThemeScrollbarThumb(
trackInfo.trackInfo.scrollbar.pressState =
state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0;
trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
-#if WEBKIT_USING_SKIA
gfx::SkiaBitLocker bitLocker(canvas);
CGContextRef cgContext = bitLocker.cgContext();
-#else
- CGContextRef cgContext = canvas;
-#endif
HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
}
@@ -176,12 +169,8 @@ void WebThemeEngineDRTMac::paintNSScrollerScrollbarThumb(
float knobProportion = float(scrollbarInfo.visibleSize) / float(scrollbarInfo.totalSize);
[scroller setKnobProportion: knobProportion];
-#if WEBKIT_USING_SKIA
gfx::SkiaBitLocker bitLocker(canvas);
CGContextRef cgContext = bitLocker.cgContext();
-#else
- CGContextRef cgContext = canvas;
-#endif
NSGraphicsContext* nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES];
[NSGraphicsContext setCurrentContext:nsGraphicsContext];
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index 732bc7a9b..366546015 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -58,6 +58,7 @@
#include "WebRange.h"
#include "platform/WebRect.h"
#include "WebScreenInfo.h"
+#include "platform/WebSerializedScriptValue.h"
#include "platform/WebSize.h"
#include "WebStorageNamespace.h"
#include "WebTextCheckingCompletion.h"
@@ -547,7 +548,7 @@ void WebViewHost::setStatusText(const WebString& text)
printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text.utf8().data());
}
-void WebViewHost::startDragging(const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&)
+void WebViewHost::startDragging(WebFrame*, const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&)
{
WebDragData mutableDragData = data;
if (layoutTestController()->shouldAddFileToPasteboard()) {
@@ -1354,6 +1355,16 @@ void WebViewHost::dispatchIntent(WebFrame* source, const WebIntentRequest& reque
}
}
+void WebViewHost::deliveredIntentResult(WebFrame* frame, int id, const WebSerializedScriptValue& data)
+{
+ printf("Web intent success for id %d\n", id);
+}
+
+void WebViewHost::deliveredIntentFailure(WebFrame* frame, int id, const WebSerializedScriptValue& data)
+{
+ printf("Web intent failure for id %d\n", id);
+}
+
// Public functions -----------------------------------------------------------
WebViewHost::WebViewHost(TestShell* shell)
@@ -1735,12 +1746,7 @@ void WebViewHost::paintRect(const WebRect& rect)
ASSERT(!m_isPainting);
ASSERT(canvas());
m_isPainting = true;
-#if USE(CG)
- webWidget()->paint(skia::BeginPlatformPaint(canvas()), rect);
- skia::EndPlatformPaint(canvas());
-#else
webWidget()->paint(canvas(), rect);
-#endif
m_isPainting = false;
}
@@ -1799,21 +1805,7 @@ void WebViewHost::paintPagesWithBoundaries()
return;
}
-#if WEBKIT_USING_SKIA
- WebCanvas* webCanvas = canvas();
-#elif WEBKIT_USING_CG
- const SkBitmap& canvasBitmap = canvas()->getDevice()->accessBitmap(false);
- WebCanvas* webCanvas = CGBitmapContextCreate(canvasBitmap.getPixels(),
- pageSizeInPixels.width, totalHeight,
- 8, pageSizeInPixels.width * 4,
- CGColorSpaceCreateDeviceRGB(),
- kCGImageAlphaPremultipliedFirst |
- kCGBitmapByteOrder32Host);
- CGContextTranslateCTM(webCanvas, 0.0, totalHeight);
- CGContextScaleCTM(webCanvas, 1.0, -1.0f);
-#endif
-
- webFrame->printPagesWithBoundaries(webCanvas, pageSizeInPixels);
+ webFrame->printPagesWithBoundaries(canvas(), pageSizeInPixels);
webFrame->printEnd();
m_isPainting = false;
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index 62bd04cf7..a830f593c 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -58,6 +58,7 @@ class WebGeolocationClient;
class WebGeolocationClientMock;
class WebGeolocationServiceMock;
class WebIntentServiceInfo;
+class WebSerializedScriptValue;
class WebSharedWorkerClient;
class WebSpeechInputController;
class WebSpeechInputListener;
@@ -155,7 +156,7 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl
virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame*, const WebKit::WebString&);
virtual void showContextMenu(WebKit::WebFrame*, const WebKit::WebContextMenuData&);
virtual void setStatusText(const WebKit::WebString&);
- virtual void startDragging(const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&);
+ virtual void startDragging(WebKit::WebFrame*, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&);
virtual void didUpdateLayout();
virtual void navigateBackForwardSoon(int offset);
virtual int historyBackListCount();
@@ -242,6 +243,8 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl
virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* source, WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent);
virtual void registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo&);
virtual void dispatchIntent(WebKit::WebFrame*, const WebKit::WebIntentRequest&);
+ virtual void deliveredIntentResult(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&);
+ virtual void deliveredIntentFailure(WebKit::WebFrame*, int, const WebKit::WebSerializedScriptValue&);
WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();