#include "LayoutTestController.h"
#include "TestNavigationController.h"
#include "TestShell.h"
+#include "TestWebPlugin.h"
#include "TestWebWorker.h"
#include "WebCString.h"
#include "WebCompositor.h"
#include "WebKit.h"
#include "WebKitPlatformSupport.h"
#include "WebNode.h"
+#include "WebPluginParams.h"
#include "WebPopupMenu.h"
#include "WebPopupType.h"
#include "WebRange.h"
// WebViewClient -------------------------------------------------------------
-WebView* WebViewHost::createView(WebFrame*, const WebURLRequest&, const WebWindowFeatures&, const WebString&)
+WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&)
{
if (!layoutTestController()->canOpenWindows())
return 0;
+ if (layoutTestController()->shouldDumpCreateView())
+ fprintf(stdout, "createView(%s)\n", URLDescription(request.url()).c_str());
return m_shell->createNewWindow(WebURL())->webView();
}
void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine)
{
// This matches win DumpRenderTree's UIDelegate.cpp.
+ if (!m_logConsoleOutput)
+ return;
string newMessage;
if (!message.text.isEmpty()) {
newMessage = message.text.utf8();
break;
results.append(WebTextCheckingResult(WebTextCheckingResult::ErrorSpelling, offset + misspelledPosition, misspelledLength));
text = text.substring(misspelledPosition + misspelledLength);
- offset += misspelledPosition;
+ offset += misspelledPosition + misspelledLength;
}
m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results);
case WebAccessibilityNotificationActiveDescendantChanged:
notificationName = "ActiveDescendantChanged";
break;
+ case WebAccessibilityNotificationAutocorrectionOccured:
+ notificationName = "AutocorrectionOccured";
+ break;
case WebAccessibilityNotificationCheckedStateChanged:
notificationName = "CheckedStateChanged";
break;
case WebAccessibilityNotificationLiveRegionChanged:
notificationName = "LiveRegionChanged";
break;
+ case WebAccessibilityNotificationMenuListItemSelected:
+ notificationName = "MenuListItemSelected";
+ break;
case WebAccessibilityNotificationMenuListValueChanged:
notificationName = "MenuListValueChanged";
break;
case WebAccessibilityNotificationRowExpanded:
notificationName = "RowExpanded";
break;
+ case WebAccessibilityNotificationInvalidStatusChanged:
+ notificationName = "InvalidStatusChanged";
+ break;
default:
notificationName = "UnknownNotification";
break;
webkit_support::MessageLoopSetNestableTasksAllowed(oldState);
}
+bool WebViewHost::enterFullScreen()
+{
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::enterFullScreenNow), 0);
+ return true;
+}
+
+void WebViewHost::exitFullScreen()
+{
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::exitFullScreenNow), 0);
+}
+
// WebFrameClient ------------------------------------------------------------
WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& params)
{
+ if (params.mimeType == TestWebPlugin::mimeType())
+ return new TestWebPlugin(frame, params);
+
return webkit_support::CreateWebPlugin(frame, params);
}
fputs("didRunInsecureContent\n", stdout);
}
+void WebViewHost::didDetectXSS(WebFrame*, const WebURL&, bool)
+{
+ if (m_shell->shouldDumpFrameLoadCallbacks())
+ fputs("didDetectXSS\n", stdout);
+}
+
void WebViewHost::openFileSystem(WebFrame* frame, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks)
{
webkit_support::OpenFileSystem(frame, type, size, create, callbacks);
m_hasWindow = false;
m_inModalLoop = false;
m_smartInsertDeleteEnabled = true;
+ m_logConsoleOutput = true;
#if OS(WINDOWS)
m_selectTrailingWhitespaceEnabled = true;
#else
// allows both.
}
+void WebViewHost::setLogConsoleOutput(bool enabled)
+{
+ m_logConsoleOutput = enabled;
+}
+
void WebViewHost::setCustomPolicyDelegate(bool isCustom, bool isPermissive)
{
m_policyDelegateEnabled = isCustom;
// Nothing to do in layout test.
}
+void WebViewHost::enterFullScreenNow()
+{
+ webView()->willEnterFullScreen();
+ webView()->didEnterFullScreen();
+}
+
+void WebViewHost::exitFullScreenNow()
+{
+ webView()->willExitFullScreen();
+ webView()->didExitFullScreen();
+}
+
// Painting functions ---------------------------------------------------------
void WebViewHost::updatePaintRect(const WebRect& rect)
ASSERT(m_paintRect.isEmpty());
}
+void WebViewHost::paintPagesWithBoundaries()
+{
+ ASSERT(!m_isPainting);
+ ASSERT(canvas());
+ m_isPainting = true;
+
+ WebSize pageSizeInPixels = webWidget()->size();
+ WebFrame* webFrame = webView()->mainFrame();
+
+ int pageCount = webFrame->printBegin(pageSizeInPixels);
+ int totalHeight = pageCount * (pageSizeInPixels.height + 1) - 1;
+
+ SkCanvas* testCanvas = skia::TryCreateBitmapCanvas(pageSizeInPixels.width, totalHeight, true);
+ if (testCanvas) {
+ discardBackingStore();
+ m_canvas = adoptPtr(testCanvas);
+ } else {
+ webFrame->printEnd();
+ 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->printEnd();
+
+ m_isPainting = false;
+}
+
SkCanvas* WebViewHost::canvas()
{
if (m_canvas)