diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Tools/DumpRenderTree/chromium | |
parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Tools/DumpRenderTree/chromium')
-rw-r--r-- | Tools/DumpRenderTree/chromium/EventSender.cpp | 19 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/EventSender.h | 2 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/LayoutTestController.cpp | 51 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/LayoutTestController.h | 7 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/PlainTextController.cpp | 79 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/PlainTextController.h | 52 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/TestShell.cpp | 3 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/TestShell.h | 2 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/TestWebPlugin.cpp | 56 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/TestWebPlugin.h | 6 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/WebViewHost.cpp | 11 | ||||
-rw-r--r-- | Tools/DumpRenderTree/chromium/WebViewHost.h | 7 |
12 files changed, 135 insertions, 160 deletions
diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp index cc73b2dbd..aaae2c320 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.cpp +++ b/Tools/DumpRenderTree/chromium/EventSender.cpp @@ -330,7 +330,7 @@ void EventSender::reset() touchModifiers = 0; touchPoints.clear(); m_taskList.revokeAll(); - m_gestureStartLocation = WebPoint(0, 0); + m_currentGestureLocation = WebPoint(0, 0); } WebView* EventSender::webview() @@ -1100,14 +1100,23 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList& case WebInputEvent::GestureScrollUpdate: event.deltaX = static_cast<float>(arguments[0].toDouble()); event.deltaY = static_cast<float>(arguments[1].toDouble()); - event.x = m_gestureStartLocation.x + event.deltaX; - event.y = m_gestureStartLocation.y + event.deltaY; + event.x = m_currentGestureLocation.x; + event.y = m_currentGestureLocation.y; + m_currentGestureLocation.x = m_currentGestureLocation.x + event.deltaX; + m_currentGestureLocation.y = m_currentGestureLocation.y + event.deltaY; break; case WebInputEvent::GestureScrollBegin: - m_gestureStartLocation = WebPoint(point.x, point.y); - // Fallthrough + m_currentGestureLocation = WebPoint(point.x, point.y); + event.x = m_currentGestureLocation.x; + event.y = m_currentGestureLocation.y; + break; case WebInputEvent::GestureScrollEnd: + event.deltaX = static_cast<float>(arguments[0].toDouble()); + event.deltaY = static_cast<float>(arguments[1].toDouble()); + event.x = m_currentGestureLocation.x; + event.y = m_currentGestureLocation.y; + break; case WebInputEvent::GestureTap: event.x = point.x; event.y = point.y; diff --git a/Tools/DumpRenderTree/chromium/EventSender.h b/Tools/DumpRenderTree/chromium/EventSender.h index bbecc5488..d57a0830e 100644 --- a/Tools/DumpRenderTree/chromium/EventSender.h +++ b/Tools/DumpRenderTree/chromium/EventSender.h @@ -162,7 +162,7 @@ private: TestShell* m_shell; // Location of the touch point that initiated a gesture. - WebKit::WebPoint m_gestureStartLocation; + WebKit::WebPoint m_currentGestureLocation; // Location of last mouseMoveTo event. static WebKit::WebPoint lastMousePos; diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp index 3c3b83ba2..9c68dffdc 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp @@ -49,16 +49,19 @@ #include "WebGeolocationClientMock.h" #include "WebIDBFactory.h" #include "WebInputElement.h" +#include "WebIntentRequest.h" #include "WebKit.h" #include "WebNotificationPresenter.h" #include "WebPermissions.h" #include "WebScriptSource.h" #include "WebSecurityPolicy.h" +#include "platform/WebSerializedScriptValue.h" #include "WebSettings.h" #include "platform/WebSize.h" #include "platform/WebURL.h" #include "WebView.h" #include "WebViewHost.h" +#include "v8/include/v8.h" #include "webkit/support/webkit_support.h" #include <algorithm> #include <cctype> @@ -101,6 +104,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) #if ENABLE(POINTER_LOCK) bindMethod("didLosePointerLock", &LayoutTestController::didLosePointerLock); #endif + bindMethod("disableAutoResizeMode", &LayoutTestController::disableAutoResizeMode); bindMethod("disableImageLoading", &LayoutTestController::disableImageLoading); bindMethod("display", &LayoutTestController::display); bindMethod("displayInvalidatedRegion", &LayoutTestController::displayInvalidatedRegion); @@ -247,6 +251,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindMethod("setShouldStayOnPageAfterHandlingBeforeUnload", &LayoutTestController::setShouldStayOnPageAfterHandlingBeforeUnload); bindMethod("enableFixedLayoutMode", &LayoutTestController::enableFixedLayoutMode); bindMethod("setFixedLayoutSize", &LayoutTestController::setFixedLayoutSize); + bindMethod("selectionAsMarkup", &LayoutTestController::selectionAsMarkup); // The fallback method is called when an unknown method is invoked. bindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -261,6 +266,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) bindProperty("platformName", &m_platformName); bindProperty("interceptPostMessage", &m_interceptPostMessage); bindProperty("workerThreadCount", &LayoutTestController::workerThreadCount); + bindMethod("sendWebIntentResponse", &LayoutTestController::sendWebIntentResponse); } LayoutTestController::~LayoutTestController() @@ -1124,7 +1130,23 @@ void LayoutTestController::enableAutoResizeMode(const CppArgumentList& arguments int maxHeight = cppVariantToInt32(arguments[3]); WebKit::WebSize maxSize(maxWidth, maxHeight); - m_shell->webView()->enableAutoResizeMode(true, minSize, maxSize); + m_shell->webView()->enableAutoResizeMode(minSize, maxSize); + result->set(true); +} + +void LayoutTestController::disableAutoResizeMode(const CppArgumentList& arguments, CppVariant* result) +{ + if (arguments.size() !=2) { + result->set(false); + return; + } + int newWidth = cppVariantToInt32(arguments[0]); + int newHeight = cppVariantToInt32(arguments[1]); + WebKit::WebSize newSize(newWidth, newHeight); + + m_shell->webViewHost()->setWindowRect(WebRect(0, 0, newSize.width, newSize.height)); + m_shell->webView()->disableAutoResizeMode(); + m_shell->webView()->resize(newSize); result->set(true); } @@ -2115,11 +2137,38 @@ void LayoutTestController::setFixedLayoutSize(const CppArgumentList& arguments, m_shell->webView()->setFixedLayoutSize(WebSize(width, height)); } +void LayoutTestController::selectionAsMarkup(const CppArgumentList& arguments, CppVariant* result) +{ + result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8()); +} + void LayoutTestController::workerThreadCount(CppVariant* result) { result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount())); } +void LayoutTestController::sendWebIntentResponse(const CppArgumentList& arguments, CppVariant* result) +{ + 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); + + WebKit::WebIntentRequest* request = m_shell->webViewHost()->currentIntentRequest(); + if (request->isNull()) + return; + + if (arguments.size() == 1) { + WebKit::WebCString reply = cppVariantToWebString(arguments[0]).utf8(); + v8::Handle<v8::Value> v8value = v8::String::New(reply.data(), reply.length()); + request->postResult(WebKit::WebSerializedScriptValue::serialize(v8value)); + } else { + v8::Handle<v8::Value> v8value = v8::String::New("ERROR"); + request->postFailure(WebKit::WebSerializedScriptValue::serialize(v8value)); + } + result->setNull(); +} + 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 99bd0c469..0f5059b2c 100644 --- a/Tools/DumpRenderTree/chromium/LayoutTestController.h +++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h @@ -241,6 +241,7 @@ public: void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*); void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*); void enableAutoResizeMode(const CppArgumentList&, CppVariant*); + void disableAutoResizeMode(const CppArgumentList&, CppVariant*); void numberOfActiveAnimations(const CppArgumentList&, CppVariant*); void suspendAnimations(const CppArgumentList&, CppVariant*); void resumeAnimations(const CppArgumentList&, CppVariant*); @@ -427,6 +428,8 @@ public: void enableFixedLayoutMode(const CppArgumentList&, CppVariant*); void setFixedLayoutSize(const CppArgumentList&, CppVariant*); + void selectionAsMarkup(const CppArgumentList&, CppVariant*); + #if ENABLE(POINTER_LOCK) void didLosePointerLock(const CppArgumentList&, CppVariant*); void setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant*); @@ -435,6 +438,10 @@ public: void workerThreadCount(CppVariant*); + // Expects one string argument for sending successful result, zero + // for sending a failure result. + void sendWebIntentResponse(const CppArgumentList&, CppVariant*); + public: // The following methods are not exposed to JavaScript. void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); } diff --git a/Tools/DumpRenderTree/chromium/PlainTextController.cpp b/Tools/DumpRenderTree/chromium/PlainTextController.cpp deleted file mode 100644 index 7287c2c83..000000000 --- a/Tools/DumpRenderTree/chromium/PlainTextController.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2009 Pawel Hajdan (phajdan.jr@chromium.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "PlainTextController.h" - -#include "TestShell.h" -#include "WebBindings.h" -#include "WebRange.h" -#include "platform/WebString.h" - -using namespace WebKit; - -PlainTextController::PlainTextController() -{ - // Initialize the map that associates methods of this class with the names - // they will use when called by JavaScript. The actual binding of those - // names to their methods will be done by calling bindToJavaScript() (defined - // by CppBoundClass, the parent to PlainTextController). - bindMethod("plainText", &PlainTextController::plainText); - - // The fallback method is called when an unknown method is invoked. - bindFallbackMethod(&PlainTextController::fallbackMethod); -} - -void PlainTextController::plainText(const CppArgumentList& arguments, CppVariant* result) -{ - result->setNull(); - - if (arguments.size() < 1 || !arguments[0].isObject()) - return; - - // Check that passed-in object is, in fact, a range. - NPObject* npobject = NPVARIANT_TO_OBJECT(arguments[0]); - if (!npobject) - return; - WebRange range; - if (!WebBindings::getRange(npobject, &range)) - return; - - // Extract the text using the Range's text() method - WebString text = range.toPlainText(); - result->set(text.utf8()); -} - -void PlainTextController::fallbackMethod(const CppArgumentList&, CppVariant* result) -{ - printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on PlainTextController\n"); - result->setNull(); -} - diff --git a/Tools/DumpRenderTree/chromium/PlainTextController.h b/Tools/DumpRenderTree/chromium/PlainTextController.h deleted file mode 100644 index 3d3a04c61..000000000 --- a/Tools/DumpRenderTree/chromium/PlainTextController.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef PlainTextController_h -#define PlainTextController_h - -#include "CppBoundClass.h" - -class TestShell; - -class PlainTextController : public CppBoundClass { -public: - // Builds the property and method lists needed to bind this class to a JS - // object. - explicit PlainTextController(); - - // JS callback methods. - void plainText(const CppArgumentList&, CppVariant*); - - // Fall-back method: called if an unknown method is invoked. - void fallbackMethod(const CppArgumentList&, CppVariant*); -}; - -#endif // PlainTextController_h - diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp index c175fda99..aa668694d 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.cpp +++ b/Tools/DumpRenderTree/chromium/TestShell.cpp @@ -130,13 +130,13 @@ TestShell::TestShell(bool testShellMode) WebRuntimeFeatures::enableGamepad(true); WebRuntimeFeatures::enableShadowDOM(true); WebRuntimeFeatures::enableStyleScoped(true); + WebRuntimeFeatures::enableScriptedSpeech(true); m_webPermissions = adoptPtr(new WebPermissions(this)); m_accessibilityController = adoptPtr(new AccessibilityController(this)); m_gamepadController = adoptPtr(new GamepadController(this)); m_layoutTestController = adoptPtr(new LayoutTestController(this)); m_eventSender = adoptPtr(new EventSender(this)); - m_plainTextController = adoptPtr(new PlainTextController()); m_textInputController = adoptPtr(new TextInputController(this)); #if ENABLE(NOTIFICATIONS) m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); @@ -697,7 +697,6 @@ void TestShell::bindJSObjectsToWindow(WebFrame* frame) m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController")); m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController")); m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender")); - m_plainTextController->bindToJavascript(frame, WebString::fromUTF8("plainText")); m_textInputController->bindToJavascript(frame, WebString::fromUTF8("textInputController")); } diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h index 4bbaf61fb..c35ec94b1 100644 --- a/Tools/DumpRenderTree/chromium/TestShell.h +++ b/Tools/DumpRenderTree/chromium/TestShell.h @@ -36,7 +36,6 @@ #include "GamepadController.h" #include "LayoutTestController.h" #include "NotificationPresenter.h" -#include "PlainTextController.h" #include "TestEventPrinter.h" #include "TextInputController.h" #include "WebPreferences.h" @@ -215,7 +214,6 @@ private: OwnPtr<GamepadController> m_gamepadController; OwnPtr<EventSender> m_eventSender; OwnPtr<LayoutTestController> m_layoutTestController; - OwnPtr<PlainTextController> m_plainTextController; OwnPtr<TextInputController> m_textInputController; OwnPtr<NotificationPresenter> m_notificationPresenter; OwnPtr<WebViewHost> m_webViewHost; diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp index da12fa706..570192cbb 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp @@ -32,7 +32,6 @@ #include "platform/WebKitPlatformSupport.h" #include "WebPluginContainer.h" #include "WebPluginParams.h" -#include "WebViewClient.h" #include <wtf/Assertions.h> #include <wtf/text/CString.h> @@ -44,15 +43,29 @@ using namespace WebKit; #define GL_ONE 1 #define GL_TRIANGLES 0x0004 #define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DEPTH_TEST 0x0B71 #define GL_BLEND 0x0BE2 +#define GL_SCISSOR_TEST 0x0B90 +#define GL_TEXTURE_2D 0x0DE1 #define GL_FLOAT 0x1406 +#define GL_RGBA 0x1908 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_NEAREST 0x2600 #define GL_COLOR_BUFFER_BIT 0x4000 +#define GL_CLAMP_TO_EDGE 0x812F #define GL_ARRAY_BUFFER 0x8892 #define GL_STATIC_DRAW 0x88E4 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_COMPILE_STATUS 0x8B81 #define GL_LINK_STATUS 0x8B82 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER 0x8D40 static void premultiplyAlpha(const unsigned colorIn[3], float alpha, float colorOut[4]) { @@ -62,11 +75,9 @@ static void premultiplyAlpha(const unsigned colorIn[3], float alpha, float color colorOut[3] = alpha; } -TestWebPlugin::TestWebPlugin(WebKit::WebViewClient* webViewClient, - WebKit::WebFrame* frame, +TestWebPlugin::TestWebPlugin(WebKit::WebFrame* frame, const WebKit::WebPluginParams& params) - : m_webViewClient(webViewClient) - , m_frame(frame) + : m_frame(frame) , m_container(0) , m_context(0) { @@ -105,7 +116,7 @@ const WebString& TestWebPlugin::mimeType() bool TestWebPlugin::initialize(WebPluginContainer* container) { WebGraphicsContext3D::Attributes attrs; - m_context = m_webViewClient->createGraphicsContext3D(attrs, false); + m_context = webKitPlatformSupport()->createOffscreenGraphicsContext3D(attrs); if (!m_context) return false; @@ -116,7 +127,7 @@ bool TestWebPlugin::initialize(WebPluginContainer* container) return false; m_container = container; - m_container->setBackingTextureId(m_context->getPlatformTextureId()); + m_container->setBackingTextureId(m_colorTexture); return true; } @@ -141,9 +152,20 @@ void TestWebPlugin::updateGeometry(const WebRect& frameRect, m_rect = clipRect; m_context->reshape(m_rect.width, m_rect.height); + m_context->viewport(0, 0, m_rect.width, m_rect.height); + + m_context->bindTexture(GL_TEXTURE_2D, m_colorTexture); + m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rect.width, m_rect.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + m_context->bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); + m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorTexture, 0); + drawScene(); - m_context->prepareTexture(); + m_context->flush(); m_container->commitBackingTexture(); } @@ -189,6 +211,14 @@ bool TestWebPlugin::initScene() { float color[4]; premultiplyAlpha(m_scene.backgroundColor, m_scene.opacity, color); + + m_colorTexture = m_context->createTexture(); + m_framebuffer = m_context->createFramebuffer(); + + m_context->viewport(0, 0, m_rect.width, m_rect.height); + m_context->disable(GL_DEPTH_TEST); + m_context->disable(GL_SCISSOR_TEST); + m_context->clearColor(color[0], color[1], color[2], color[3]); m_context->enable(GL_BLEND); @@ -216,6 +246,16 @@ void TestWebPlugin::destroyScene() m_context->deleteBuffer(m_scene.vbo); m_scene.vbo = 0; } + + if (m_framebuffer) { + m_context->deleteFramebuffer(m_framebuffer); + m_framebuffer = 0; + } + + if (m_colorTexture) { + m_context->deleteTexture(m_colorTexture); + m_colorTexture = 0; + } } bool TestWebPlugin::initProgram() diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.h b/Tools/DumpRenderTree/chromium/TestWebPlugin.h index 926b3e833..8581288ac 100644 --- a/Tools/DumpRenderTree/chromium/TestWebPlugin.h +++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.h @@ -31,7 +31,6 @@ namespace WebKit { class WebGraphicsContext3D; -class WebViewClient; } // A fake implemention of WebKit::WebPlugin for testing purposes. @@ -45,7 +44,7 @@ class WebViewClient; // opacity: [0.0 - 1.0]. Default is 1.0. class TestWebPlugin : public WebKit::WebPlugin { public: - TestWebPlugin(WebKit::WebViewClient*, WebKit::WebFrame*, const WebKit::WebPluginParams&); + TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&); virtual ~TestWebPlugin(); static const WebKit::WebString& mimeType(); @@ -116,12 +115,13 @@ private: unsigned loadProgram(const WTF::CString& vertexSource, const WTF::CString& fragmentSource); - WebKit::WebViewClient* m_webViewClient; WebKit::WebFrame* m_frame; WebKit::WebPluginContainer* m_container; WebKit::WebRect m_rect; WebKit::WebGraphicsContext3D* m_context; + unsigned m_colorTexture; + unsigned m_framebuffer; Scene m_scene; }; diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp index 81603b37f..fde2d6801 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp +++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp @@ -242,7 +242,7 @@ static string textAffinityDescription(WebTextAffinity affinity) // WebViewClient ------------------------------------------------------------- -WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&) +WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy) { if (!layoutTestController()->canOpenWindows()) return 0; @@ -255,6 +255,7 @@ WebWidget* WebViewHost::createPopupMenu(WebPopupType type) { switch (type) { case WebKit::WebPopupTypeNone: + case WebKit::WebPopupTypePage: break; case WebKit::WebPopupTypeSelect: case WebKit::WebPopupTypeSuggestion: @@ -273,14 +274,14 @@ WebWidget* WebViewHost::createPopupMenu(const WebPopupMenuInfo&) WebStorageNamespace* WebViewHost::createSessionStorageNamespace(unsigned quota) { - return WebKit::WebStorageNamespace::createSessionStorageNamespace(quota); + return webkit_support::CreateSessionStorageNamespace(quota); } -WebKit::WebGraphicsContext3D* WebViewHost::createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes& attributes, bool direct) +WebKit::WebGraphicsContext3D* WebViewHost::createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes& attributes) { if (!webView()) return 0; - return webkit_support::CreateGraphicsContext3D(attributes, webView(), direct); + return webkit_support::CreateGraphicsContext3D(attributes, webView(), true); } void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine) @@ -932,7 +933,7 @@ void WebViewHost::exitFullScreen() WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& params) { if (params.mimeType == TestWebPlugin::mimeType()) - return new TestWebPlugin(this, frame, params); + return new TestWebPlugin(frame, params); return webkit_support::CreateWebPlugin(frame, params); } diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h index f80f438ad..a990ae319 100644 --- a/Tools/DumpRenderTree/chromium/WebViewHost.h +++ b/Tools/DumpRenderTree/chromium/WebViewHost.h @@ -126,11 +126,11 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&); // WebKit::WebViewClient - virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&); + virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString&, WebKit::WebNavigationPolicy); virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType); virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&); virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota); - virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes&, bool direct); + virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(const WebKit::WebGraphicsContext3D::Attributes&); virtual void didAddMessageToConsole(const WebKit::WebConsoleMessage&, const WebKit::WebString& sourceName, unsigned sourceLine); virtual void didStartLoading(); virtual void didStopLoading(); @@ -252,6 +252,9 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl // Pending task list, Note taht the method is referred from MethodTask class. TaskList* taskList() { return &m_taskList; } + // The current web intents request. + WebKit::WebIntentRequest* currentIntentRequest() { return &m_currentRequest; } + private: class HostMethodTask : public MethodTask<WebViewHost> { |