From ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 16 May 2011 16:25:10 +0100 Subject: Merge WebKit at r76408: Initial merge by git. Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53 --- Source/WebKit/chromium/src/AssertMatchingEnums.cpp | 22 +- .../chromium/src/AutoFillPopupMenuClient.cpp | 4 +- .../WebKit/chromium/src/AutoFillPopupMenuClient.h | 2 +- Source/WebKit/chromium/src/BoundObject.h | 3 +- Source/WebKit/chromium/src/ChromeClientImpl.cpp | 17 +- Source/WebKit/chromium/src/ChromeClientImpl.h | 9 +- Source/WebKit/chromium/src/ChromiumBridge.cpp | 1005 ------------------- Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp | 7 - Source/WebKit/chromium/src/DOMUtilitiesPrivate.h | 5 - .../WebKit/chromium/src/DebuggerAgentManager.cpp | 3 +- Source/WebKit/chromium/src/DebuggerAgentManager.h | 3 +- Source/WebKit/chromium/src/EditorClientImpl.cpp | 6 + .../chromium/src/InspectorFrontendClientImpl.h | 4 +- Source/WebKit/chromium/src/PlatformBridge.cpp | 1048 ++++++++++++++++++++ Source/WebKit/chromium/src/ResourceHandle.cpp | 4 +- .../WebKit/chromium/src/SpeechInputClientImpl.cpp | 6 +- Source/WebKit/chromium/src/SpeechInputClientImpl.h | 3 +- .../WebKit/chromium/src/VideoFrameChromiumImpl.cpp | 1 + .../WebKit/chromium/src/WebDevToolsFrontendImpl.h | 4 +- Source/WebKit/chromium/src/WebFontImpl.cpp | 1 + Source/WebKit/chromium/src/WebFrameImpl.cpp | 23 +- .../src/WebGeolocationPermissionRequest.cpp | 2 +- Source/WebKit/chromium/src/WebPopupMenuImpl.cpp | 8 + Source/WebKit/chromium/src/WebPopupMenuImpl.h | 3 + Source/WebKit/chromium/src/WebRuntimeFeatures.cpp | 16 + Source/WebKit/chromium/src/WebScriptController.cpp | 2 +- Source/WebKit/chromium/src/WebScrollbarImpl.cpp | 135 +-- Source/WebKit/chromium/src/WebScrollbarImpl.h | 13 +- Source/WebKit/chromium/src/WebSettingsImpl.cpp | 5 + Source/WebKit/chromium/src/WebSettingsImpl.h | 1 + .../src/WebSpeechInputControllerMockImpl.cpp | 6 +- .../src/WebSpeechInputControllerMockImpl.h | 2 +- Source/WebKit/chromium/src/WebViewImpl.cpp | 28 +- Source/WebKit/chromium/src/WebViewImpl.h | 1 + Source/WebKit/chromium/src/WebWorkerClientImpl.cpp | 12 +- Source/WebKit/chromium/src/js/Tests.js | 31 +- 36 files changed, 1272 insertions(+), 1173 deletions(-) delete mode 100644 Source/WebKit/chromium/src/ChromiumBridge.cpp create mode 100644 Source/WebKit/chromium/src/PlatformBridge.cpp (limited to 'Source/WebKit/chromium/src') diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index e1ee4a1..e89fb74 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -80,7 +80,7 @@ #include #if OS(DARWIN) -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "mac/WebThemeEngine.h" #endif @@ -398,17 +398,17 @@ COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPermissionDenied, Geoloca COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPositionUnavailable, GeolocationError::PositionUnavailable); #if OS(DARWIN) -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateDisabled, ChromiumBridge::StateDisabled); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateInactive, ChromiumBridge::StateInactive); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateActive, ChromiumBridge::StateActive); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StatePressed, ChromiumBridge::StatePressed); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateDisabled, PlatformBridge::StateDisabled); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateInactive, PlatformBridge::StateInactive); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateActive, PlatformBridge::StateActive); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StatePressed, PlatformBridge::StatePressed); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeRegular, ChromiumBridge::SizeRegular); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeSmall, ChromiumBridge::SizeSmall); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeRegular, PlatformBridge::SizeRegular); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeSmall, PlatformBridge::SizeSmall); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationHorizontal, ChromiumBridge::ScrollbarOrientationHorizontal); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, ChromiumBridge::ScrollbarOrientationVertical); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationHorizontal, PlatformBridge::ScrollbarOrientationHorizontal); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, PlatformBridge::ScrollbarOrientationVertical); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, ChromiumBridge::ScrollbarParentScrollView); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, ChromiumBridge::ScrollbarParentRenderLayer); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, PlatformBridge::ScrollbarParentScrollView); +COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, PlatformBridge::ScrollbarParentRenderLayer); #endif diff --git a/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp b/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp index 4f57994..2ce31a9 100644 --- a/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp +++ b/Source/WebKit/chromium/src/AutoFillPopupMenuClient.cpp @@ -254,11 +254,11 @@ HostWindow* AutoFillPopupMenuClient::hostWindow() const } PassRefPtr AutoFillPopupMenuClient::createScrollbar( - ScrollbarClient* client, + ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) { - return Scrollbar::createNativeScrollbar(client, orientation, size); + return Scrollbar::createNativeScrollbar(scrollableArea, orientation, size); } void AutoFillPopupMenuClient::initialize( diff --git a/Source/WebKit/chromium/src/AutoFillPopupMenuClient.h b/Source/WebKit/chromium/src/AutoFillPopupMenuClient.h index 0129a81..0071121 100644 --- a/Source/WebKit/chromium/src/AutoFillPopupMenuClient.h +++ b/Source/WebKit/chromium/src/AutoFillPopupMenuClient.h @@ -97,7 +97,7 @@ public: virtual WebCore::FontSelector* fontSelector() const; virtual WebCore::HostWindow* hostWindow() const; virtual PassRefPtr createScrollbar( - WebCore::ScrollbarClient* client, + WebCore::ScrollableArea* client, WebCore::ScrollbarOrientation orientation, WebCore::ScrollbarControlSize size); diff --git a/Source/WebKit/chromium/src/BoundObject.h b/Source/WebKit/chromium/src/BoundObject.h index 769e83f..394ff7c 100644 --- a/Source/WebKit/chromium/src/BoundObject.h +++ b/Source/WebKit/chromium/src/BoundObject.h @@ -39,7 +39,8 @@ namespace WebKit { // BoundObject is a helper class that lets you map JavaScript method calls // directly to C++ method calls. It should be destroyed once JS object is // built. -class BoundObject : public Noncopyable { +class BoundObject { + WTF_MAKE_NONCOPYABLE(BoundObject); public: BoundObject(v8::Handle context, void* v8This, const char* objectName); virtual ~BoundObject(); diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 1a984c1..a63a625 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -436,11 +436,6 @@ void ChromeClientImpl::closeWindowSoon() void ChromeClientImpl::runJavaScriptAlert(Frame* frame, const String& message) { if (m_webView->client()) { -#if USE(V8) - // Before showing the JavaScript dialog, we give the proxy implementation - // a chance to process any pending console messages. - V8Proxy::processConsoleMessages(); -#endif m_webView->client()->runModalAlertDialog( WebFrameImpl::fromFrame(frame), message); } @@ -532,6 +527,13 @@ void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect invalidateContentsAndWindow(updateRect, immediate); } +#if ENABLE(REQUEST_ANIMATION_FRAME) +void ChromeClientImpl::scheduleAnimation() +{ + m_webView->client()->scheduleAnimation(); +} +#endif + void ChromeClientImpl::scroll( const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) @@ -700,6 +702,11 @@ void ChromeClientImpl::popupClosed(WebCore::PopupContainer* popupContainer) m_webView->popupClosed(popupContainer); } +void ChromeClientImpl::setCursor(const WebCore::Cursor& cursor) +{ + setCursor(WebCursorInfo(cursor)); +} + void ChromeClientImpl::setCursor(const WebCursorInfo& cursor) { if (m_webView->client()) diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index b024bc0..07f7d1f 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -105,6 +105,9 @@ public: virtual void invalidateWindow(const WebCore::IntRect&, bool); virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation(); +#endif virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); @@ -132,7 +135,7 @@ public: virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void runOpenPanel(WebCore::Frame*, PassRefPtr); virtual void chooseIconForFiles(const Vector&, WebCore::FileChooser*); - virtual void setCursor(const WebCore::Cursor&) { } + virtual void setCursor(const WebCore::Cursor&); virtual void formStateDidChange(const WebCore::Node*); virtual PassOwnPtr createHTMLParserQuirks() { return 0; } #if ENABLE(TOUCH_EVENTS) @@ -167,8 +170,7 @@ public: virtual void postAccessibilityNotification(WebCore::AccessibilityObject*, WebCore::AXObjectCache::AXNotification); // ChromeClientImpl: - void setCursor(const WebCursorInfo& cursor); - void setCursorForPlugin(const WebCursorInfo& cursor); + void setCursorForPlugin(const WebCursorInfo&); virtual bool selectItemWritingDirectionIsNatural(); virtual PassRefPtr createPopupMenu(WebCore::PopupMenuClient*) const; @@ -180,6 +182,7 @@ public: private: void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); + void setCursor(const WebCursorInfo&); WebViewImpl* m_webView; // weak pointer bool m_toolbarsVisible; diff --git a/Source/WebKit/chromium/src/ChromiumBridge.cpp b/Source/WebKit/chromium/src/ChromiumBridge.cpp deleted file mode 100644 index e16025c..0000000 --- a/Source/WebKit/chromium/src/ChromiumBridge.cpp +++ /dev/null @@ -1,1005 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ChromiumBridge.h" - -#include - -#include "Chrome.h" -#include "ChromeClientImpl.h" -#include "WebAudioBus.h" -#include "WebClipboard.h" -#include "WebCookie.h" -#include "WebCookieJar.h" -#include "WebCursorInfo.h" -#include "WebData.h" -#include "WebDragData.h" -#include "WebFileUtilities.h" -#include "WebFrameClient.h" -#include "WebFrameImpl.h" -#include "WebIDBKey.h" -#include "WebImage.h" -#include "WebKit.h" -#include "WebKitClient.h" -#include "WebMimeRegistry.h" -#include "WebPluginContainerImpl.h" -#include "WebPluginListBuilderImpl.h" -#include "WebSandboxSupport.h" -#include "WebSerializedScriptValue.h" -#include "WebScreenInfo.h" -#include "WebString.h" -#include "WebURL.h" -#include "WebVector.h" -#include "WebViewClient.h" -#include "WebViewImpl.h" -#include "WebWorkerClientImpl.h" - -#if PLATFORM(CG) -#include -#endif - -#if OS(WINDOWS) -#include "WebRect.h" -#include "win/WebThemeEngine.h" -#endif - -#if OS(LINUX) || OS(FREEBSD) -#include "linux/WebThemeEngine.h" -#include "WebFontInfo.h" -#include "WebFontRenderStyle.h" -#endif - -#if OS(DARWIN) -#include "mac/WebThemeEngine.h" -#endif - -#if WEBKIT_USING_SKIA -#include "NativeImageSkia.h" -#endif - -#include "BitmapImage.h" -#include "Cookie.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "IDBFactoryBackendProxy.h" -#include "KURL.h" -#include "NotImplemented.h" -#include "PlatformContextSkia.h" -#include "PluginData.h" -#include "SharedBuffer.h" - -#include "Worker.h" -#include "WorkerContextProxy.h" -#include - -// We are part of the WebKit implementation. -using namespace WebKit; - -namespace WebCore { - -static ChromeClientImpl* toChromeClientImpl(Widget* widget) -{ - if (!widget) - return 0; - - FrameView* view; - if (widget->isFrameView()) - view = static_cast(widget); - else if (widget->parent() && widget->parent()->isFrameView()) - view = static_cast(widget->parent()); - else - return 0; - - Page* page = view->frame() ? view->frame()->page() : 0; - if (!page) - return 0; - - return static_cast(page->chrome()->client()); -} - -static WebWidgetClient* toWebWidgetClient(Widget* widget) -{ - ChromeClientImpl* chromeClientImpl = toChromeClientImpl(widget); - if (!chromeClientImpl || !chromeClientImpl->webView()) - return 0; - return chromeClientImpl->webView()->client(); -} - -static WebCookieJar* getCookieJar(const Document* document) -{ - WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); - if (!frameImpl || !frameImpl->client()) - return 0; - WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl); - if (!cookieJar) - cookieJar = webKitClient()->cookieJar(); - return cookieJar; -} - -// Cache ---------------------------------------------------------------------- - -void ChromiumBridge::cacheMetadata(const KURL& url, double responseTime, const Vector& data) -{ - webKitClient()->cacheMetadata(url, responseTime, data.data(), data.size()); -} - -// Clipboard ------------------------------------------------------------------ - -bool ChromiumBridge::clipboardIsFormatAvailable( - PasteboardPrivate::ClipboardFormat format, - PasteboardPrivate::ClipboardBuffer buffer) -{ - return webKitClient()->clipboard()->isFormatAvailable( - static_cast(format), - static_cast(buffer)); -} - -String ChromiumBridge::clipboardReadPlainText( - PasteboardPrivate::ClipboardBuffer buffer) -{ - return webKitClient()->clipboard()->readPlainText( - static_cast(buffer)); -} - -void ChromiumBridge::clipboardReadHTML( - PasteboardPrivate::ClipboardBuffer buffer, - String* htmlText, KURL* sourceURL) -{ - WebURL url; - *htmlText = webKitClient()->clipboard()->readHTML( - static_cast(buffer), &url); - *sourceURL = url; -} - -void ChromiumBridge::clipboardWriteSelection(const String& htmlText, - const KURL& sourceURL, - const String& plainText, - bool writeSmartPaste) -{ - webKitClient()->clipboard()->writeHTML( - htmlText, sourceURL, plainText, writeSmartPaste); -} - -void ChromiumBridge::clipboardWritePlainText(const String& plainText) -{ - webKitClient()->clipboard()->writePlainText(plainText); -} - -void ChromiumBridge::clipboardWriteURL(const KURL& url, const String& title) -{ - webKitClient()->clipboard()->writeURL(url, title); -} - -void ChromiumBridge::clipboardWriteImage(NativeImagePtr image, - const KURL& sourceURL, - const String& title) -{ -#if WEBKIT_USING_SKIA - WebImage webImage(*image); -#else - WebImage webImage(image); -#endif - webKitClient()->clipboard()->writeImage(webImage, sourceURL, title); -} - -void ChromiumBridge::clipboardWriteData(const String& type, - const String& data, - const String& metadata) -{ - webKitClient()->clipboard()->writeData(type, data, metadata); -} - -HashSet ChromiumBridge::clipboardReadAvailableTypes( - PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) -{ - WebVector result = webKitClient()->clipboard()->readAvailableTypes( - static_cast(buffer), containsFilenames); - HashSet types; - for (size_t i = 0; i < result.size(); ++i) - types.add(result[i]); - return types; -} - -bool ChromiumBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, - const String& type, String& data, String& metadata) -{ - WebString resultData; - WebString resultMetadata; - bool succeeded = webKitClient()->clipboard()->readData( - static_cast(buffer), type, &resultData, &resultMetadata); - if (succeeded) { - data = resultData; - metadata = resultMetadata; - } - return succeeded; -} - -Vector ChromiumBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) -{ - WebVector result = webKitClient()->clipboard()->readFilenames( - static_cast(buffer)); - Vector convertedResult; - for (size_t i = 0; i < result.size(); ++i) - convertedResult.append(result[i]); - return convertedResult; -} - -// Cookies -------------------------------------------------------------------- - -void ChromiumBridge::setCookies(const Document* document, const KURL& url, - const String& value) -{ - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - cookieJar->setCookie(url, document->firstPartyForCookies(), value); -} - -String ChromiumBridge::cookies(const Document* document, const KURL& url) -{ - String result; - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - result = cookieJar->cookies(url, document->firstPartyForCookies()); - return result; -} - -String ChromiumBridge::cookieRequestHeaderFieldValue(const Document* document, - const KURL& url) -{ - String result; - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); - return result; -} - -bool ChromiumBridge::rawCookies(const Document* document, const KURL& url, Vector& rawCookies) -{ - rawCookies.clear(); - WebVector webCookies; - - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies); - - for (unsigned i = 0; i < webCookies.size(); ++i) { - const WebCookie& webCookie = webCookies[i]; - Cookie cookie(webCookie.name, - webCookie.value, - webCookie.domain, - webCookie.path, - webCookie.expires, - webCookie.httpOnly, - webCookie.secure, - webCookie.session); - rawCookies.append(cookie); - } - return true; -} - -void ChromiumBridge::deleteCookie(const Document* document, const KURL& url, const String& cookieName) -{ - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - cookieJar->deleteCookie(url, cookieName); -} - -bool ChromiumBridge::cookiesEnabled(const Document* document) -{ - bool result = false; - WebCookieJar* cookieJar = getCookieJar(document); - if (cookieJar) - result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); - return result; -} - -// DNS ------------------------------------------------------------------------ - -void ChromiumBridge::prefetchDNS(const String& hostname) -{ - webKitClient()->prefetchHostName(hostname); -} - -// File ------------------------------------------------------------------------ - -bool ChromiumBridge::fileExists(const String& path) -{ - return webKitClient()->fileUtilities()->fileExists(path); -} - -bool ChromiumBridge::deleteFile(const String& path) -{ - return webKitClient()->fileUtilities()->deleteFile(path); -} - -bool ChromiumBridge::deleteEmptyDirectory(const String& path) -{ - return webKitClient()->fileUtilities()->deleteEmptyDirectory(path); -} - -bool ChromiumBridge::getFileSize(const String& path, long long& result) -{ - return webKitClient()->fileUtilities()->getFileSize(path, result); -} - -void ChromiumBridge::revealFolderInOS(const String& path) -{ - webKitClient()->fileUtilities()->revealFolderInOS(path); -} - -bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) -{ - double modificationTime; - if (!webKitClient()->fileUtilities()->getFileModificationTime(path, modificationTime)) - return false; - result = static_cast(modificationTime); - return true; -} - -String ChromiumBridge::directoryName(const String& path) -{ - return webKitClient()->fileUtilities()->directoryName(path); -} - -String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) -{ - return webKitClient()->fileUtilities()->pathByAppendingComponent(path, component); -} - -bool ChromiumBridge::makeAllDirectories(const String& path) -{ - return webKitClient()->fileUtilities()->makeAllDirectories(path); -} - -String ChromiumBridge::getAbsolutePath(const String& path) -{ - return webKitClient()->fileUtilities()->getAbsolutePath(path); -} - -bool ChromiumBridge::isDirectory(const String& path) -{ - return webKitClient()->fileUtilities()->isDirectory(path); -} - -KURL ChromiumBridge::filePathToURL(const String& path) -{ - return webKitClient()->fileUtilities()->filePathToURL(path); -} - -PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) -{ - return webKitClient()->fileUtilities()->openFile(path, mode); -} - -void ChromiumBridge::closeFile(PlatformFileHandle& handle) -{ - webKitClient()->fileUtilities()->closeFile(handle); -} - -long long ChromiumBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) -{ - return webKitClient()->fileUtilities()->seekFile(handle, offset, origin); -} - -bool ChromiumBridge::truncateFile(PlatformFileHandle handle, long long offset) -{ - return webKitClient()->fileUtilities()->truncateFile(handle, offset); -} - -int ChromiumBridge::readFromFile(PlatformFileHandle handle, char* data, int length) -{ - return webKitClient()->fileUtilities()->readFromFile(handle, data, length); -} - -int ChromiumBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) -{ - return webKitClient()->fileUtilities()->writeToFile(handle, data, length); -} - -// Font ----------------------------------------------------------------------- - -#if OS(WINDOWS) -bool ChromiumBridge::ensureFontLoaded(HFONT font) -{ - WebSandboxSupport* ss = webKitClient()->sandboxSupport(); - - // if there is no sandbox, then we can assume the font - // was able to be loaded successfully already - return ss ? ss->ensureFontLoaded(font) : true; -} -#endif - -#if OS(LINUX) || OS(FREEBSD) -String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters) -{ - if (webKitClient()->sandboxSupport()) - return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters); - - WebCString family = WebFontInfo::familyForChars(characters, numCharacters); - if (family.data()) - return WebString::fromUTF8(family.data()); - - return WebString(); -} - -void ChromiumBridge::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) -{ - WebFontRenderStyle style; - - if (webKitClient()->sandboxSupport()) - webKitClient()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); - else - WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); - - style.toFontRenderStyle(result); -} -#endif - -#if OS(DARWIN) -bool ChromiumBridge::loadFont(NSFont* srcFont, ATSFontContainerRef* out) -{ - WebSandboxSupport* ss = webKitClient()->sandboxSupport(); - if (ss) - return ss->loadFont(srcFont, out); - - // This function should only be called in response to an error loading a - // font due to being blocked by the sandbox. - // This by definition shouldn't happen if there is no sandbox support. - ASSERT_NOT_REACHED(); - *out = 0; - return false; -} -#endif - -// Databases ------------------------------------------------------------------ - -PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags) -{ - return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags); -} - -int ChromiumBridge::databaseDeleteFile(const String& vfsFileName, bool syncDir) -{ - return webKitClient()->databaseDeleteFile(WebString(vfsFileName), syncDir); -} - -long ChromiumBridge::databaseGetFileAttributes(const String& vfsFileName) -{ - return webKitClient()->databaseGetFileAttributes(WebString(vfsFileName)); -} - -long long ChromiumBridge::databaseGetFileSize(const String& vfsFileName) -{ - return webKitClient()->databaseGetFileSize(WebString(vfsFileName)); -} - -// Indexed Database ----------------------------------------------------------- - -PassRefPtr ChromiumBridge::idbFactory() -{ - // There's no reason why we need to allocate a new proxy each time, but - // there's also no strong reason not to. - return IDBFactoryBackendProxy::create(); -} - -void ChromiumBridge::idbShutdown() -{ - // In the browser process, this shuts down the utility process. In the renderer process, it does nothing. - webKitClient()->idbShutdown(); -} - -void ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector >& values, const String& keyPath, Vector >& keys) -{ - WebVector webValues = values; - WebVector webKeys; - webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys); - - size_t webKeysSize = webKeys.size(); - keys.reserveCapacity(webKeysSize); - for (size_t i = 0; i < webKeysSize; ++i) - keys.append(PassRefPtr(webKeys[i])); -} - -// Keygen --------------------------------------------------------------------- - -String ChromiumBridge::signedPublicKeyAndChallengeString( - unsigned keySizeIndex, const String& challenge, const KURL& url) -{ - return webKitClient()->signedPublicKeyAndChallengeString(keySizeIndex, - WebString(challenge), - WebURL(url)); -} - -// Language ------------------------------------------------------------------- - -String ChromiumBridge::computedDefaultLanguage() -{ - return webKitClient()->defaultLocale(); -} - -// LayoutTestMode ------------------------------------------------------------- - -bool ChromiumBridge::layoutTestMode() -{ - return WebKit::layoutTestMode(); -} - -// MimeType ------------------------------------------------------------------- - -bool ChromiumBridge::isSupportedImageMIMEType(const String& mimeType) -{ - return webKitClient()->mimeRegistry()->supportsImageMIMEType(mimeType) - != WebMimeRegistry::IsNotSupported; -} - -bool ChromiumBridge::isSupportedJavaScriptMIMEType(const String& mimeType) -{ - return webKitClient()->mimeRegistry()->supportsJavaScriptMIMEType(mimeType) - != WebMimeRegistry::IsNotSupported; -} - -bool ChromiumBridge::isSupportedNonImageMIMEType(const String& mimeType) -{ - return webKitClient()->mimeRegistry()->supportsNonImageMIMEType(mimeType) - != WebMimeRegistry::IsNotSupported; -} - -String ChromiumBridge::mimeTypeForExtension(const String& extension) -{ - return webKitClient()->mimeRegistry()->mimeTypeForExtension(extension); -} - -String ChromiumBridge::mimeTypeFromFile(const String& path) -{ - return webKitClient()->mimeRegistry()->mimeTypeFromFile(path); -} - -String ChromiumBridge::preferredExtensionForMIMEType(const String& mimeType) -{ - return webKitClient()->mimeRegistry()->preferredExtensionForMIMEType(mimeType); -} - -// Plugin --------------------------------------------------------------------- - -bool ChromiumBridge::plugins(bool refresh, Vector* results) -{ - WebPluginListBuilderImpl builder(results); - webKitClient()->getPluginList(refresh, &builder); - return true; // FIXME: There is no need for this function to return a value. -} - -NPObject* ChromiumBridge::pluginScriptableObject(Widget* widget) -{ - if (!widget || !widget->isPluginContainer()) - return 0; - - return static_cast(widget)->scriptableObject(); -} - -// Resources ------------------------------------------------------------------ - -PassRefPtr ChromiumBridge::loadPlatformImageResource(const char* name) -{ - const WebData& resource = webKitClient()->loadResource(name); - if (resource.isEmpty()) - return Image::nullImage(); - - RefPtr image = BitmapImage::create(); - image->setData(resource, true); - return image; -} - -#if ENABLE(WEB_AUDIO) - -PassOwnPtr ChromiumBridge::loadPlatformAudioResource(const char* name, double sampleRate) -{ - const WebData& resource = webKitClient()->loadResource(name); - if (resource.isEmpty()) - return 0; - - return decodeAudioFileData(resource.data(), resource.size(), sampleRate); -} - -PassOwnPtr ChromiumBridge::decodeAudioFileData(const char* data, size_t size, double sampleRate) -{ - WebAudioBus webAudioBus; - if (webKitClient()->loadAudioResource(&webAudioBus, data, size, sampleRate)) - return webAudioBus.release(); - return 0; -} - -#endif // ENABLE(WEB_AUDIO) - -// Sandbox -------------------------------------------------------------------- - -bool ChromiumBridge::sandboxEnabled() -{ - return webKitClient()->sandboxEnabled(); -} - -// SharedTimers --------------------------------------------------------------- - -void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) -{ - webKitClient()->setSharedTimerFiredFunction(func); -} - -void ChromiumBridge::setSharedTimerFireTime(double fireTime) -{ - webKitClient()->setSharedTimerFireTime(fireTime); -} - -void ChromiumBridge::stopSharedTimer() -{ - webKitClient()->stopSharedTimer(); -} - -// StatsCounters -------------------------------------------------------------- - -void ChromiumBridge::decrementStatsCounter(const char* name) -{ - webKitClient()->decrementStatsCounter(name); -} - -void ChromiumBridge::incrementStatsCounter(const char* name) -{ - webKitClient()->incrementStatsCounter(name); -} - -void ChromiumBridge::histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) -{ - webKitClient()->histogramCustomCounts(name, sample, min, max, bucketCount); -} - -void ChromiumBridge::histogramEnumeration(const char* name, int sample, int boundaryValue) -{ - webKitClient()->histogramEnumeration(name, sample, boundaryValue); -} - -// Sudden Termination --------------------------------------------------------- - -void ChromiumBridge::suddenTerminationChanged(bool enabled) -{ - webKitClient()->suddenTerminationChanged(enabled); -} - -// SystemTime ----------------------------------------------------------------- - -double ChromiumBridge::currentTime() -{ - return webKitClient()->currentTime(); -} - -// Theming -------------------------------------------------------------------- - -#if OS(WINDOWS) - -void ChromiumBridge::paintButton( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintButton( - gc->platformContext()->canvas(), part, state, classicState, rect); -} - -void ChromiumBridge::paintMenuList( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintMenuList( - gc->platformContext()->canvas(), part, state, classicState, rect); -} - -void ChromiumBridge::paintScrollbarArrow( - GraphicsContext* gc, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintScrollbarArrow( - gc->platformContext()->canvas(), state, classicState, rect); -} - -void ChromiumBridge::paintScrollbarThumb( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintScrollbarThumb( - gc->platformContext()->canvas(), part, state, classicState, rect); -} - -void ChromiumBridge::paintScrollbarTrack( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect, const IntRect& alignRect) -{ - webKitClient()->themeEngine()->paintScrollbarTrack( - gc->platformContext()->canvas(), part, state, classicState, rect, - alignRect); -} - -void ChromiumBridge::paintSpinButton( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintSpinButton( - gc->platformContext()->canvas(), part, state, classicState, rect); -} - -void ChromiumBridge::paintTextField( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect, const Color& color, bool fillContentArea, - bool drawEdges) -{ - // Fallback to white when |color| is invalid. - RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white; - - webKitClient()->themeEngine()->paintTextField( - gc->platformContext()->canvas(), part, state, classicState, rect, - backgroundColor, fillContentArea, drawEdges); -} - -void ChromiumBridge::paintTrackbar( - GraphicsContext* gc, int part, int state, int classicState, - const IntRect& rect) -{ - webKitClient()->themeEngine()->paintTrackbar( - gc->platformContext()->canvas(), part, state, classicState, rect); -} - -void ChromiumBridge::paintProgressBar( - GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds) -{ - webKitClient()->themeEngine()->paintProgressBar( - gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); -} - -#elif OS(LINUX) - -static WebThemeEngine::Part WebThemePart(ChromiumBridge::ThemePart part) -{ - switch (part) { - case ChromiumBridge::PartScrollbarDownArrow: return WebThemeEngine::PartScrollbarDownArrow; - case ChromiumBridge::PartScrollbarLeftArrow: return WebThemeEngine::PartScrollbarLeftArrow; - case ChromiumBridge::PartScrollbarRightArrow: return WebThemeEngine::PartScrollbarRightArrow; - case ChromiumBridge::PartScrollbarUpArrow: return WebThemeEngine::PartScrollbarUpArrow; - case ChromiumBridge::PartScrollbarHorizontalThumb: return WebThemeEngine::PartScrollbarHorizontalThumb; - case ChromiumBridge::PartScrollbarVerticalThumb: return WebThemeEngine::PartScrollbarVerticalThumb; - case ChromiumBridge::PartScrollbarHorizontalTrack: return WebThemeEngine::PartScrollbarHorizontalTrack; - case ChromiumBridge::PartScrollbarVerticalTrack: return WebThemeEngine::PartScrollbarVerticalTrack; - } - ASSERT_NOT_REACHED(); - return WebThemeEngine::PartScrollbarDownArrow; -} - -static WebThemeEngine::State WebThemeState(ChromiumBridge::ThemePaintState state) -{ - switch (state) { - case ChromiumBridge::StateDisabled: return WebThemeEngine::StateDisabled; - case ChromiumBridge::StateHover: return WebThemeEngine::StateHover; - case ChromiumBridge::StateNormal: return WebThemeEngine::StateNormal; - case ChromiumBridge::StatePressed: return WebThemeEngine::StatePressed; - } - ASSERT_NOT_REACHED(); - return WebThemeEngine::StateDisabled; -} - -static void GetWebThemeExtraParams(ChromiumBridge::ThemePart part, ChromiumBridge::ThemePaintState state, const ChromiumBridge::ThemePaintExtraParams* extraParams, WebThemeEngine::ExtraParams* webThemeExtraParams) -{ - if (part == ChromiumBridge::PartScrollbarHorizontalTrack || part == ChromiumBridge::PartScrollbarVerticalTrack) { - webThemeExtraParams->scrollbarTrack.trackX = extraParams->scrollbarTrack.trackX; - webThemeExtraParams->scrollbarTrack.trackY = extraParams->scrollbarTrack.trackY; - webThemeExtraParams->scrollbarTrack.trackWidth = extraParams->scrollbarTrack.trackWidth; - webThemeExtraParams->scrollbarTrack.trackHeight = extraParams->scrollbarTrack.trackHeight; - } -} - -IntSize ChromiumBridge::getThemePartSize(ThemePart part) -{ - return webKitClient()->themeEngine()->getSize(WebThemePart(part)); -} - -void ChromiumBridge::paintThemePart( - GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams) -{ - WebThemeEngine::ExtraParams webThemeExtraParams; - GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams); - webKitClient()->themeEngine()->paint( - gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams); -} - -#elif OS(DARWIN) - -void ChromiumBridge::paintScrollbarThumb( - GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo) -{ - WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo; - - webThemeScrollbarInfo.orientation = static_cast(scrollbarInfo.orientation); - webThemeScrollbarInfo.parent = static_cast(scrollbarInfo.parent); - webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue; - webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue; - webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize; - webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; - - webKitClient()->themeEngine()->paintScrollbarThumb( - gc->platformContext(), - static_cast(state), - static_cast(size), - rect, - webThemeScrollbarInfo); -} - -#endif - -// Trace Event ---------------------------------------------------------------- - -void ChromiumBridge::traceEventBegin(const char* name, void* id, const char* extra) -{ - webKitClient()->traceEventBegin(name, id, extra); -} - -void ChromiumBridge::traceEventEnd(const char* name, void* id, const char* extra) -{ - webKitClient()->traceEventEnd(name, id, extra); -} - -// Visited Links -------------------------------------------------------------- - -LinkHash ChromiumBridge::visitedLinkHash(const UChar* url, unsigned length) -{ - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed)) - return 0; // Invalid URLs are unvisited. - return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); -} - -LinkHash ChromiumBridge::visitedLinkHash(const KURL& base, - const AtomicString& attributeURL) -{ - // Resolve the relative URL using googleurl and pass the absolute URL up to - // the embedder. We could create a GURL object from the base and resolve - // the relative URL that way, but calling the lower-level functions - // directly saves us the string allocation in most cases. - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - -#if USE(GOOGLEURL) - const CString& cstr = base.utf8String(); - const char* data = cstr.data(); - int length = cstr.length(); - const url_parse::Parsed& srcParsed = base.parsed(); -#else - // When we're not using GoogleURL, first canonicalize it so we can resolve it - // below. - url_canon::RawCanonOutput<2048> srcCanon; - url_parse::Parsed srcParsed; - String str = base.string(); - if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed)) - return 0; - const char* data = srcCanon.data(); - int length = srcCanon.length(); -#endif - - if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), - attributeURL.length(), 0, &buffer, &parsed)) - return 0; // Invalid resolved URL. - - return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); -} - -bool ChromiumBridge::isLinkVisited(LinkHash visitedLinkHash) -{ - return webKitClient()->isLinkVisited(visitedLinkHash); -} - -// These are temporary methods that the WebKit layer can use to call to the -// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these -// methods will be deleted. - -void ChromiumBridge::notifyJSOutOfMemory(Frame* frame) -{ - if (!frame) - return; - - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - if (!webFrame->client()) - return; - webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); -} - -int ChromiumBridge::memoryUsageMB() -{ - return static_cast(webKitClient()->memoryUsageMB()); -} - -int ChromiumBridge::actualMemoryUsageMB() -{ - return static_cast(webKitClient()->actualMemoryUsageMB()); -} - -int ChromiumBridge::screenDepth(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().depth; -} - -int ChromiumBridge::screenDepthPerComponent(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().depthPerComponent; -} - -bool ChromiumBridge::screenIsMonochrome(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().isMonochrome; -} - -IntRect ChromiumBridge::screenRect(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return IntRect(); - return client->screenInfo().rect; -} - -IntRect ChromiumBridge::screenAvailableRect(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return IntRect(); - return client->screenInfo().availableRect; -} - -bool ChromiumBridge::popupsAllowed(NPP npp) -{ - // FIXME: Give the embedder a way to control this. - return false; -} - -void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) -{ - ChromeClientImpl* client = toChromeClientImpl(widget); - if (client) - client->setCursor(WebCursorInfo(cursor)); -} - -WorkerContextProxy* WorkerContextProxy::create(Worker* worker) -{ - return WebWorkerClientImpl::createWorkerContextProxy(worker); -} - -} // namespace WebCore diff --git a/Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp b/Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp index 6f952f7..e688bfa 100644 --- a/Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp +++ b/Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp @@ -39,8 +39,6 @@ #include "HTMLOptionElement.h" #include "Node.h" -#include "WebInputElement.h" - using namespace WebCore; namespace { @@ -79,11 +77,6 @@ HTMLOptionElement* toHTMLOptionElement(Node* node) return toHTMLElement(node, HTMLNames::optionTag); } -String nameOfInputElement(HTMLInputElement* element) -{ - return WebInputElement(element).nameForAutofill(); -} - bool elementHasLegalLinkAttribute(const Element* element, const QualifiedName& attrName) { diff --git a/Source/WebKit/chromium/src/DOMUtilitiesPrivate.h b/Source/WebKit/chromium/src/DOMUtilitiesPrivate.h index f5d03a5..99e3d9c 100644 --- a/Source/WebKit/chromium/src/DOMUtilitiesPrivate.h +++ b/Source/WebKit/chromium/src/DOMUtilitiesPrivate.h @@ -31,8 +31,6 @@ #ifndef DOMUtilitiesPrivate_h #define DOMUtilitiesPrivate_h -#include - namespace WebCore { class Element; class HTMLInputElement; @@ -53,9 +51,6 @@ WebCore::HTMLLinkElement* toHTMLLinkElement(WebCore::Node*); WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node*); WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*); -// FIXME: Deprecate. Use WebInputElement::nameForAutofill instead. -WTF::String nameOfInputElement(WebCore::HTMLInputElement*); - // For img, script, iframe, frame element, when attribute name is src, // for link, a, area element, when attribute name is href, // for form element, when attribute name is action, diff --git a/Source/WebKit/chromium/src/DebuggerAgentManager.cpp b/Source/WebKit/chromium/src/DebuggerAgentManager.cpp index 0860cb1..b76bcfe 100644 --- a/Source/WebKit/chromium/src/DebuggerAgentManager.cpp +++ b/Source/WebKit/chromium/src/DebuggerAgentManager.cpp @@ -55,7 +55,8 @@ bool DebuggerAgentManager::s_exposeV8DebuggerProtocol = false; namespace { -class CallerIdWrapper : public v8::Debug::ClientData, public Noncopyable { +class CallerIdWrapper : public v8::Debug::ClientData { + WTF_MAKE_NONCOPYABLE(CallerIdWrapper); public: CallerIdWrapper() : m_callerIsMananager(true), m_callerId(0) { } explicit CallerIdWrapper(int callerId) diff --git a/Source/WebKit/chromium/src/DebuggerAgentManager.h b/Source/WebKit/chromium/src/DebuggerAgentManager.h index 66bd714..a323311 100644 --- a/Source/WebKit/chromium/src/DebuggerAgentManager.h +++ b/Source/WebKit/chromium/src/DebuggerAgentManager.h @@ -63,7 +63,8 @@ class WebViewImpl; // would expect some actions from the handler. If there is no appropriate // debugger agent to handle such messages the manager will perform the action // itself, otherwise v8 may hang waiting for the action. -class DebuggerAgentManager : public Noncopyable { +class DebuggerAgentManager { + WTF_MAKE_NONCOPYABLE(DebuggerAgentManager); public: static void debugAttach(DebuggerAgentImpl* debuggerAgent); static void debugDetach(DebuggerAgentImpl* debuggerAgent); diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 19b5873..68694c2 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -45,6 +45,7 @@ #include "WebAutoFillClient.h" #include "WebEditingAction.h" #include "WebElement.h" +#include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebKit.h" #include "WebInputElement.h" @@ -161,6 +162,11 @@ void EditorClientImpl::toggleContinuousSpellChecking() m_spellCheckThisFieldStatus = SpellCheckForcedOff; else m_spellCheckThisFieldStatus = SpellCheckForcedOn; + + WebFrameImpl* webframe = WebFrameImpl::fromFrame( + m_webView->focusedWebCoreFrame()); + if (webframe) + webframe->client()->didToggleContinuousSpellChecking(webframe); } bool EditorClientImpl::isGrammarCheckingEnabled() diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h index fc21f3e..2867917 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -44,8 +44,8 @@ namespace WebKit { class WebDevToolsFrontendClient; class WebDevToolsFrontendImpl; -class InspectorFrontendClientImpl : public WebCore::InspectorFrontendClient - , public Noncopyable { +class InspectorFrontendClientImpl : public WebCore::InspectorFrontendClient { + WTF_MAKE_NONCOPYABLE(InspectorFrontendClientImpl); public: InspectorFrontendClientImpl(WebCore::Page*, WebDevToolsFrontendClient*, WebDevToolsFrontendImpl*); virtual ~InspectorFrontendClientImpl(); diff --git a/Source/WebKit/chromium/src/PlatformBridge.cpp b/Source/WebKit/chromium/src/PlatformBridge.cpp new file mode 100644 index 0000000..04016fc --- /dev/null +++ b/Source/WebKit/chromium/src/PlatformBridge.cpp @@ -0,0 +1,1048 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PlatformBridge.h" + +#include + +#include "Chrome.h" +#include "ChromeClientImpl.h" +#include "WebAudioBus.h" +#include "WebClipboard.h" +#include "WebCookie.h" +#include "WebCookieJar.h" +#include "WebData.h" +#include "WebDragData.h" +#include "WebFileUtilities.h" +#include "WebFrameClient.h" +#include "WebFrameImpl.h" +#include "WebIDBKey.h" +#include "WebImage.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebMimeRegistry.h" +#include "WebPluginContainerImpl.h" +#include "WebPluginListBuilderImpl.h" +#include "WebSandboxSupport.h" +#include "WebSerializedScriptValue.h" +#include "WebScreenInfo.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" +#include "WebViewClient.h" +#include "WebViewImpl.h" +#include "WebWorkerClientImpl.h" + +#if PLATFORM(CG) +#include +#endif + +#if OS(WINDOWS) +#include "WebRect.h" +#include "win/WebThemeEngine.h" +#endif + +#if OS(LINUX) || OS(FREEBSD) +#include "linux/WebThemeEngine.h" +#include "WebFontInfo.h" +#include "WebFontRenderStyle.h" +#endif + +#if OS(DARWIN) +#include "mac/WebThemeEngine.h" +#endif + +#if WEBKIT_USING_SKIA +#include "NativeImageSkia.h" +#endif + +#include "BitmapImage.h" +#include "Cookie.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "IDBFactoryBackendProxy.h" +#include "KURL.h" +#include "NotImplemented.h" +#include "PlatformContextSkia.h" +#include "PluginData.h" +#include "SharedBuffer.h" + +#include "Worker.h" +#include "WorkerContextProxy.h" +#include + +// We are part of the WebKit implementation. +using namespace WebKit; + +namespace WebCore { + +static ChromeClientImpl* toChromeClientImpl(Widget* widget) +{ + if (!widget) + return 0; + + FrameView* view; + if (widget->isFrameView()) + view = static_cast(widget); + else if (widget->parent() && widget->parent()->isFrameView()) + view = static_cast(widget->parent()); + else + return 0; + + Page* page = view->frame() ? view->frame()->page() : 0; + if (!page) + return 0; + + return static_cast(page->chrome()->client()); +} + +static WebWidgetClient* toWebWidgetClient(Widget* widget) +{ + ChromeClientImpl* chromeClientImpl = toChromeClientImpl(widget); + if (!chromeClientImpl || !chromeClientImpl->webView()) + return 0; + return chromeClientImpl->webView()->client(); +} + +static WebCookieJar* getCookieJar(const Document* document) +{ + WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); + if (!frameImpl || !frameImpl->client()) + return 0; + WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl); + if (!cookieJar) + cookieJar = webKitClient()->cookieJar(); + return cookieJar; +} + +// Cache ---------------------------------------------------------------------- + +void PlatformBridge::cacheMetadata(const KURL& url, double responseTime, const Vector& data) +{ + webKitClient()->cacheMetadata(url, responseTime, data.data(), data.size()); +} + +// Clipboard ------------------------------------------------------------------ + +bool PlatformBridge::clipboardIsFormatAvailable( + PasteboardPrivate::ClipboardFormat format, + PasteboardPrivate::ClipboardBuffer buffer) +{ + return webKitClient()->clipboard()->isFormatAvailable( + static_cast(format), + static_cast(buffer)); +} + +String PlatformBridge::clipboardReadPlainText( + PasteboardPrivate::ClipboardBuffer buffer) +{ + return webKitClient()->clipboard()->readPlainText( + static_cast(buffer)); +} + +void PlatformBridge::clipboardReadHTML( + PasteboardPrivate::ClipboardBuffer buffer, + String* htmlText, KURL* sourceURL) +{ + WebURL url; + *htmlText = webKitClient()->clipboard()->readHTML( + static_cast(buffer), &url); + *sourceURL = url; +} + +void PlatformBridge::clipboardWriteSelection(const String& htmlText, + const KURL& sourceURL, + const String& plainText, + bool writeSmartPaste) +{ + webKitClient()->clipboard()->writeHTML( + htmlText, sourceURL, plainText, writeSmartPaste); +} + +void PlatformBridge::clipboardWritePlainText(const String& plainText) +{ + webKitClient()->clipboard()->writePlainText(plainText); +} + +void PlatformBridge::clipboardWriteURL(const KURL& url, const String& title) +{ + webKitClient()->clipboard()->writeURL(url, title); +} + +void PlatformBridge::clipboardWriteImage(NativeImagePtr image, + const KURL& sourceURL, + const String& title) +{ +#if WEBKIT_USING_SKIA + WebImage webImage(*image); +#else + WebImage webImage(image); +#endif + webKitClient()->clipboard()->writeImage(webImage, sourceURL, title); +} + +void PlatformBridge::clipboardWriteData(const String& type, + const String& data, + const String& metadata) +{ + webKitClient()->clipboard()->writeData(type, data, metadata); +} + +HashSet PlatformBridge::clipboardReadAvailableTypes( + PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) +{ + WebVector result = webKitClient()->clipboard()->readAvailableTypes( + static_cast(buffer), containsFilenames); + HashSet types; + for (size_t i = 0; i < result.size(); ++i) + types.add(result[i]); + return types; +} + +bool PlatformBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, + const String& type, String& data, String& metadata) +{ + WebString resultData; + WebString resultMetadata; + bool succeeded = webKitClient()->clipboard()->readData( + static_cast(buffer), type, &resultData, &resultMetadata); + if (succeeded) { + data = resultData; + metadata = resultMetadata; + } + return succeeded; +} + +Vector PlatformBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) +{ + WebVector result = webKitClient()->clipboard()->readFilenames( + static_cast(buffer)); + Vector convertedResult; + for (size_t i = 0; i < result.size(); ++i) + convertedResult.append(result[i]); + return convertedResult; +} + +// Cookies -------------------------------------------------------------------- + +void PlatformBridge::setCookies(const Document* document, const KURL& url, + const String& value) +{ + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->setCookie(url, document->firstPartyForCookies(), value); +} + +String PlatformBridge::cookies(const Document* document, const KURL& url) +{ + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookies(url, document->firstPartyForCookies()); + return result; +} + +String PlatformBridge::cookieRequestHeaderFieldValue(const Document* document, + const KURL& url) +{ + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); + return result; +} + +bool PlatformBridge::rawCookies(const Document* document, const KURL& url, Vector& rawCookies) +{ + rawCookies.clear(); + WebVector webCookies; + + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies); + + for (unsigned i = 0; i < webCookies.size(); ++i) { + const WebCookie& webCookie = webCookies[i]; + Cookie cookie(webCookie.name, + webCookie.value, + webCookie.domain, + webCookie.path, + webCookie.expires, + webCookie.httpOnly, + webCookie.secure, + webCookie.session); + rawCookies.append(cookie); + } + return true; +} + +void PlatformBridge::deleteCookie(const Document* document, const KURL& url, const String& cookieName) +{ + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->deleteCookie(url, cookieName); +} + +bool PlatformBridge::cookiesEnabled(const Document* document) +{ + bool result = false; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); + return result; +} + +// DNS ------------------------------------------------------------------------ + +void PlatformBridge::prefetchDNS(const String& hostname) +{ + webKitClient()->prefetchHostName(hostname); +} + +// File ------------------------------------------------------------------------ + +bool PlatformBridge::fileExists(const String& path) +{ + return webKitClient()->fileUtilities()->fileExists(path); +} + +bool PlatformBridge::deleteFile(const String& path) +{ + return webKitClient()->fileUtilities()->deleteFile(path); +} + +bool PlatformBridge::deleteEmptyDirectory(const String& path) +{ + return webKitClient()->fileUtilities()->deleteEmptyDirectory(path); +} + +bool PlatformBridge::getFileSize(const String& path, long long& result) +{ + return webKitClient()->fileUtilities()->getFileSize(path, result); +} + +void PlatformBridge::revealFolderInOS(const String& path) +{ + webKitClient()->fileUtilities()->revealFolderInOS(path); +} + +bool PlatformBridge::getFileModificationTime(const String& path, time_t& result) +{ + double modificationTime; + if (!webKitClient()->fileUtilities()->getFileModificationTime(path, modificationTime)) + return false; + result = static_cast(modificationTime); + return true; +} + +String PlatformBridge::directoryName(const String& path) +{ + return webKitClient()->fileUtilities()->directoryName(path); +} + +String PlatformBridge::pathByAppendingComponent(const String& path, const String& component) +{ + return webKitClient()->fileUtilities()->pathByAppendingComponent(path, component); +} + +bool PlatformBridge::makeAllDirectories(const String& path) +{ + return webKitClient()->fileUtilities()->makeAllDirectories(path); +} + +String PlatformBridge::getAbsolutePath(const String& path) +{ + return webKitClient()->fileUtilities()->getAbsolutePath(path); +} + +bool PlatformBridge::isDirectory(const String& path) +{ + return webKitClient()->fileUtilities()->isDirectory(path); +} + +KURL PlatformBridge::filePathToURL(const String& path) +{ + return webKitClient()->fileUtilities()->filePathToURL(path); +} + +PlatformFileHandle PlatformBridge::openFile(const String& path, FileOpenMode mode) +{ + return webKitClient()->fileUtilities()->openFile(path, mode); +} + +void PlatformBridge::closeFile(PlatformFileHandle& handle) +{ + webKitClient()->fileUtilities()->closeFile(handle); +} + +long long PlatformBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) +{ + return webKitClient()->fileUtilities()->seekFile(handle, offset, origin); +} + +bool PlatformBridge::truncateFile(PlatformFileHandle handle, long long offset) +{ + return webKitClient()->fileUtilities()->truncateFile(handle, offset); +} + +int PlatformBridge::readFromFile(PlatformFileHandle handle, char* data, int length) +{ + return webKitClient()->fileUtilities()->readFromFile(handle, data, length); +} + +int PlatformBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + return webKitClient()->fileUtilities()->writeToFile(handle, data, length); +} + +// Font ----------------------------------------------------------------------- + +#if OS(WINDOWS) +bool PlatformBridge::ensureFontLoaded(HFONT font) +{ + WebSandboxSupport* ss = webKitClient()->sandboxSupport(); + + // if there is no sandbox, then we can assume the font + // was able to be loaded successfully already + return ss ? ss->ensureFontLoaded(font) : true; +} +#endif + +#if OS(LINUX) || OS(FREEBSD) +String PlatformBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters) +{ + if (webKitClient()->sandboxSupport()) + return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters); + + WebCString family = WebFontInfo::familyForChars(characters, numCharacters); + if (family.data()) + return WebString::fromUTF8(family.data()); + + return WebString(); +} + +void PlatformBridge::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) +{ + WebFontRenderStyle style; + + if (webKitClient()->sandboxSupport()) + webKitClient()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); + else + WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); + + style.toFontRenderStyle(result); +} +#endif + +#if OS(DARWIN) +bool PlatformBridge::loadFont(NSFont* srcFont, ATSFontContainerRef* out) +{ + WebSandboxSupport* ss = webKitClient()->sandboxSupport(); + if (ss) + return ss->loadFont(srcFont, out); + + // This function should only be called in response to an error loading a + // font due to being blocked by the sandbox. + // This by definition shouldn't happen if there is no sandbox support. + ASSERT_NOT_REACHED(); + *out = 0; + return false; +} +#endif + +// Databases ------------------------------------------------------------------ + +PlatformFileHandle PlatformBridge::databaseOpenFile(const String& vfsFileName, int desiredFlags) +{ + return webKitClient()->databaseOpenFile(WebString(vfsFileName), desiredFlags); +} + +int PlatformBridge::databaseDeleteFile(const String& vfsFileName, bool syncDir) +{ + return webKitClient()->databaseDeleteFile(WebString(vfsFileName), syncDir); +} + +long PlatformBridge::databaseGetFileAttributes(const String& vfsFileName) +{ + return webKitClient()->databaseGetFileAttributes(WebString(vfsFileName)); +} + +long long PlatformBridge::databaseGetFileSize(const String& vfsFileName) +{ + return webKitClient()->databaseGetFileSize(WebString(vfsFileName)); +} + +// Indexed Database ----------------------------------------------------------- + +PassRefPtr PlatformBridge::idbFactory() +{ + // There's no reason why we need to allocate a new proxy each time, but + // there's also no strong reason not to. + return IDBFactoryBackendProxy::create(); +} + +void PlatformBridge::idbShutdown() +{ + // In the browser process, this shuts down the utility process. In the renderer process, it does nothing. + webKitClient()->idbShutdown(); +} + +void PlatformBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector >& values, const String& keyPath, Vector >& keys) +{ + WebVector webValues = values; + WebVector webKeys; + webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys); + + size_t webKeysSize = webKeys.size(); + keys.reserveCapacity(webKeysSize); + for (size_t i = 0; i < webKeysSize; ++i) + keys.append(PassRefPtr(webKeys[i])); +} + +// Keygen --------------------------------------------------------------------- + +String PlatformBridge::signedPublicKeyAndChallengeString( + unsigned keySizeIndex, const String& challenge, const KURL& url) +{ + return webKitClient()->signedPublicKeyAndChallengeString(keySizeIndex, + WebString(challenge), + WebURL(url)); +} + +// Language ------------------------------------------------------------------- + +String PlatformBridge::computedDefaultLanguage() +{ + return webKitClient()->defaultLocale(); +} + +// LayoutTestMode ------------------------------------------------------------- + +bool PlatformBridge::layoutTestMode() +{ + return WebKit::layoutTestMode(); +} + +// MimeType ------------------------------------------------------------------- + +bool PlatformBridge::isSupportedImageMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsImageMIMEType(mimeType) + != WebMimeRegistry::IsNotSupported; +} + +bool PlatformBridge::isSupportedJavaScriptMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsJavaScriptMIMEType(mimeType) + != WebMimeRegistry::IsNotSupported; +} + +bool PlatformBridge::isSupportedNonImageMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsNonImageMIMEType(mimeType) + != WebMimeRegistry::IsNotSupported; +} + +String PlatformBridge::mimeTypeForExtension(const String& extension) +{ + return webKitClient()->mimeRegistry()->mimeTypeForExtension(extension); +} + +String PlatformBridge::mimeTypeFromFile(const String& path) +{ + return webKitClient()->mimeRegistry()->mimeTypeFromFile(path); +} + +String PlatformBridge::preferredExtensionForMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->preferredExtensionForMIMEType(mimeType); +} + +// Plugin --------------------------------------------------------------------- + +bool PlatformBridge::plugins(bool refresh, Vector* results) +{ + WebPluginListBuilderImpl builder(results); + webKitClient()->getPluginList(refresh, &builder); + return true; // FIXME: There is no need for this function to return a value. +} + +NPObject* PlatformBridge::pluginScriptableObject(Widget* widget) +{ + if (!widget || !widget->isPluginContainer()) + return 0; + + return static_cast(widget)->scriptableObject(); +} + +// Resources ------------------------------------------------------------------ + +PassRefPtr PlatformBridge::loadPlatformImageResource(const char* name) +{ + const WebData& resource = webKitClient()->loadResource(name); + if (resource.isEmpty()) + return Image::nullImage(); + + RefPtr image = BitmapImage::create(); + image->setData(resource, true); + return image; +} + +#if ENABLE(WEB_AUDIO) + +PassOwnPtr PlatformBridge::loadPlatformAudioResource(const char* name, double sampleRate) +{ + const WebData& resource = webKitClient()->loadResource(name); + if (resource.isEmpty()) + return 0; + + return decodeAudioFileData(resource.data(), resource.size(), sampleRate); +} + +PassOwnPtr PlatformBridge::decodeAudioFileData(const char* data, size_t size, double sampleRate) +{ + WebAudioBus webAudioBus; + if (webKitClient()->loadAudioResource(&webAudioBus, data, size, sampleRate)) + return webAudioBus.release(); + return 0; +} + +#endif // ENABLE(WEB_AUDIO) + +// Sandbox -------------------------------------------------------------------- + +bool PlatformBridge::sandboxEnabled() +{ + return webKitClient()->sandboxEnabled(); +} + +// SharedTimers --------------------------------------------------------------- + +void PlatformBridge::setSharedTimerFiredFunction(void (*func)()) +{ + webKitClient()->setSharedTimerFiredFunction(func); +} + +void PlatformBridge::setSharedTimerFireTime(double fireTime) +{ + webKitClient()->setSharedTimerFireTime(fireTime); +} + +void PlatformBridge::stopSharedTimer() +{ + webKitClient()->stopSharedTimer(); +} + +// StatsCounters -------------------------------------------------------------- + +void PlatformBridge::decrementStatsCounter(const char* name) +{ + webKitClient()->decrementStatsCounter(name); +} + +void PlatformBridge::incrementStatsCounter(const char* name) +{ + webKitClient()->incrementStatsCounter(name); +} + +void PlatformBridge::histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) +{ + webKitClient()->histogramCustomCounts(name, sample, min, max, bucketCount); +} + +void PlatformBridge::histogramEnumeration(const char* name, int sample, int boundaryValue) +{ + webKitClient()->histogramEnumeration(name, sample, boundaryValue); +} + +// Sudden Termination --------------------------------------------------------- + +void PlatformBridge::suddenTerminationChanged(bool enabled) +{ + webKitClient()->suddenTerminationChanged(enabled); +} + +// SystemTime ----------------------------------------------------------------- + +double PlatformBridge::currentTime() +{ + return webKitClient()->currentTime(); +} + +// Theming -------------------------------------------------------------------- + +#if OS(WINDOWS) + +void PlatformBridge::paintButton( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintButton( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void PlatformBridge::paintMenuList( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintMenuList( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void PlatformBridge::paintScrollbarArrow( + GraphicsContext* gc, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintScrollbarArrow( + gc->platformContext()->canvas(), state, classicState, rect); +} + +void PlatformBridge::paintScrollbarThumb( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintScrollbarThumb( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void PlatformBridge::paintScrollbarTrack( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect, const IntRect& alignRect) +{ + webKitClient()->themeEngine()->paintScrollbarTrack( + gc->platformContext()->canvas(), part, state, classicState, rect, + alignRect); +} + +void PlatformBridge::paintSpinButton( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintSpinButton( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void PlatformBridge::paintTextField( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect, const Color& color, bool fillContentArea, + bool drawEdges) +{ + // Fallback to white when |color| is invalid. + RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white; + + webKitClient()->themeEngine()->paintTextField( + gc->platformContext()->canvas(), part, state, classicState, rect, + backgroundColor, fillContentArea, drawEdges); +} + +void PlatformBridge::paintTrackbar( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintTrackbar( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void PlatformBridge::paintProgressBar( + GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds) +{ + webKitClient()->themeEngine()->paintProgressBar( + gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); +} + +#elif OS(LINUX) + +static WebThemeEngine::Part WebThemePart(PlatformBridge::ThemePart part) +{ + switch (part) { + case PlatformBridge::PartScrollbarDownArrow: return WebThemeEngine::PartScrollbarDownArrow; + case PlatformBridge::PartScrollbarLeftArrow: return WebThemeEngine::PartScrollbarLeftArrow; + case PlatformBridge::PartScrollbarRightArrow: return WebThemeEngine::PartScrollbarRightArrow; + case PlatformBridge::PartScrollbarUpArrow: return WebThemeEngine::PartScrollbarUpArrow; + case PlatformBridge::PartScrollbarHorizontalThumb: return WebThemeEngine::PartScrollbarHorizontalThumb; + case PlatformBridge::PartScrollbarVerticalThumb: return WebThemeEngine::PartScrollbarVerticalThumb; + case PlatformBridge::PartScrollbarHorizontalTrack: return WebThemeEngine::PartScrollbarHorizontalTrack; + case PlatformBridge::PartScrollbarVerticalTrack: return WebThemeEngine::PartScrollbarVerticalTrack; + case PlatformBridge::PartCheckbox: return WebThemeEngine::PartCheckbox; + case PlatformBridge::PartRadio: return WebThemeEngine::PartRadio; + case PlatformBridge::PartButton: return WebThemeEngine::PartButton; + case PlatformBridge::PartTextField: return WebThemeEngine::PartTextField; + case PlatformBridge::PartMenuList: return WebThemeEngine::PartMenuList; + case PlatformBridge::PartSliderTrack: return WebThemeEngine::PartSliderTrack; + case PlatformBridge::PartSliderThumb: return WebThemeEngine::PartSliderThumb; + case PlatformBridge::PartInnerSpinButton: return WebThemeEngine::PartInnerSpinButton; + case PlatformBridge::PartProgressBar: return WebThemeEngine::PartProgressBar; + } + ASSERT_NOT_REACHED(); + return WebThemeEngine::PartScrollbarDownArrow; +} + +static WebThemeEngine::State WebThemeState(PlatformBridge::ThemePaintState state) +{ + switch (state) { + case PlatformBridge::StateDisabled: return WebThemeEngine::StateDisabled; + case PlatformBridge::StateHover: return WebThemeEngine::StateHover; + case PlatformBridge::StateNormal: return WebThemeEngine::StateNormal; + case PlatformBridge::StatePressed: return WebThemeEngine::StatePressed; + } + ASSERT_NOT_REACHED(); + return WebThemeEngine::StateDisabled; +} + +static void GetWebThemeExtraParams(PlatformBridge::ThemePart part, PlatformBridge::ThemePaintState state, const PlatformBridge::ThemePaintExtraParams* extraParams, WebThemeEngine::ExtraParams* webThemeExtraParams) +{ + switch (part) { + case PlatformBridge::PartScrollbarHorizontalTrack: + case PlatformBridge::PartScrollbarVerticalTrack: + webThemeExtraParams->scrollbarTrack.trackX = extraParams->scrollbarTrack.trackX; + webThemeExtraParams->scrollbarTrack.trackY = extraParams->scrollbarTrack.trackY; + webThemeExtraParams->scrollbarTrack.trackWidth = extraParams->scrollbarTrack.trackWidth; + webThemeExtraParams->scrollbarTrack.trackHeight = extraParams->scrollbarTrack.trackHeight; + break; + case PlatformBridge::PartCheckbox: + webThemeExtraParams->button.checked = extraParams->button.checked; + webThemeExtraParams->button.indeterminate = extraParams->button.indeterminate; + break; + case PlatformBridge::PartRadio: + webThemeExtraParams->button.checked = extraParams->button.checked; + break; + case PlatformBridge::PartButton: + webThemeExtraParams->button.isDefault = extraParams->button.isDefault; + webThemeExtraParams->button.backgroundColor = extraParams->button.backgroundColor; + break; + case PlatformBridge::PartTextField: + webThemeExtraParams->textField.isTextArea = extraParams->textField.isTextArea; + webThemeExtraParams->textField.isListbox = extraParams->textField.isListbox; + webThemeExtraParams->textField.backgroundColor = extraParams->textField.backgroundColor; + break; + case PlatformBridge::PartMenuList: + webThemeExtraParams->menuList.arrowX = extraParams->menuList.arrowX; + webThemeExtraParams->menuList.arrowY = extraParams->menuList.arrowY; + webThemeExtraParams->menuList.backgroundColor = extraParams->menuList.backgroundColor; + break; + case PlatformBridge::PartSliderTrack: + case PlatformBridge::PartSliderThumb: + webThemeExtraParams->slider.vertical = extraParams->slider.vertical; + webThemeExtraParams->slider.inDrag = extraParams->slider.inDrag; + break; + case PlatformBridge::PartInnerSpinButton: + webThemeExtraParams->innerSpin.spinUp = extraParams->innerSpin.spinUp; + webThemeExtraParams->innerSpin.readOnly = extraParams->innerSpin.readOnly; + break; + case PlatformBridge::PartProgressBar: + webThemeExtraParams->progressBar.determinate = extraParams->progressBar.determinate; + webThemeExtraParams->progressBar.valueRectX = extraParams->progressBar.valueRectX; + webThemeExtraParams->progressBar.valueRectY = extraParams->progressBar.valueRectY; + webThemeExtraParams->progressBar.valueRectWidth = extraParams->progressBar.valueRectWidth; + webThemeExtraParams->progressBar.valueRectHeight = extraParams->progressBar.valueRectHeight; + break; + default: + break; // Parts that have no extra params get here. + } +} + +IntSize PlatformBridge::getThemePartSize(ThemePart part) +{ + return webKitClient()->themeEngine()->getSize(WebThemePart(part)); +} + +void PlatformBridge::paintThemePart( + GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams) +{ + WebThemeEngine::ExtraParams webThemeExtraParams; + GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams); + webKitClient()->themeEngine()->paint( + gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams); +} + +#elif OS(DARWIN) + +void PlatformBridge::paintScrollbarThumb( + GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo) +{ + WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo; + + webThemeScrollbarInfo.orientation = static_cast(scrollbarInfo.orientation); + webThemeScrollbarInfo.parent = static_cast(scrollbarInfo.parent); + webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue; + webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue; + webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize; + webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; + + webKitClient()->themeEngine()->paintScrollbarThumb( + gc->platformContext(), + static_cast(state), + static_cast(size), + rect, + webThemeScrollbarInfo); +} + +#endif + +// Trace Event ---------------------------------------------------------------- + +void PlatformBridge::traceEventBegin(const char* name, void* id, const char* extra) +{ + webKitClient()->traceEventBegin(name, id, extra); +} + +void PlatformBridge::traceEventEnd(const char* name, void* id, const char* extra) +{ + webKitClient()->traceEventEnd(name, id, extra); +} + +// Visited Links -------------------------------------------------------------- + +LinkHash PlatformBridge::visitedLinkHash(const UChar* url, unsigned length) +{ + url_canon::RawCanonOutput<2048> buffer; + url_parse::Parsed parsed; + if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed)) + return 0; // Invalid URLs are unvisited. + return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); +} + +LinkHash PlatformBridge::visitedLinkHash(const KURL& base, + const AtomicString& attributeURL) +{ + // Resolve the relative URL using googleurl and pass the absolute URL up to + // the embedder. We could create a GURL object from the base and resolve + // the relative URL that way, but calling the lower-level functions + // directly saves us the string allocation in most cases. + url_canon::RawCanonOutput<2048> buffer; + url_parse::Parsed parsed; + +#if USE(GOOGLEURL) + const CString& cstr = base.utf8String(); + const char* data = cstr.data(); + int length = cstr.length(); + const url_parse::Parsed& srcParsed = base.parsed(); +#else + // When we're not using GoogleURL, first canonicalize it so we can resolve it + // below. + url_canon::RawCanonOutput<2048> srcCanon; + url_parse::Parsed srcParsed; + String str = base.string(); + if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed)) + return 0; + const char* data = srcCanon.data(); + int length = srcCanon.length(); +#endif + + if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), + attributeURL.length(), 0, &buffer, &parsed)) + return 0; // Invalid resolved URL. + + return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); +} + +bool PlatformBridge::isLinkVisited(LinkHash visitedLinkHash) +{ + return webKitClient()->isLinkVisited(visitedLinkHash); +} + +// These are temporary methods that the WebKit layer can use to call to the +// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these +// methods will be deleted. + +void PlatformBridge::notifyJSOutOfMemory(Frame* frame) +{ + if (!frame) + return; + + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); + if (!webFrame->client()) + return; + webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); +} + +int PlatformBridge::memoryUsageMB() +{ + return static_cast(webKitClient()->memoryUsageMB()); +} + +int PlatformBridge::actualMemoryUsageMB() +{ + return static_cast(webKitClient()->actualMemoryUsageMB()); +} + +int PlatformBridge::screenDepth(Widget* widget) +{ + WebWidgetClient* client = toWebWidgetClient(widget); + if (!client) + return 0; + return client->screenInfo().depth; +} + +int PlatformBridge::screenDepthPerComponent(Widget* widget) +{ + WebWidgetClient* client = toWebWidgetClient(widget); + if (!client) + return 0; + return client->screenInfo().depthPerComponent; +} + +bool PlatformBridge::screenIsMonochrome(Widget* widget) +{ + WebWidgetClient* client = toWebWidgetClient(widget); + if (!client) + return 0; + return client->screenInfo().isMonochrome; +} + +IntRect PlatformBridge::screenRect(Widget* widget) +{ + WebWidgetClient* client = toWebWidgetClient(widget); + if (!client) + return IntRect(); + return client->screenInfo().rect; +} + +IntRect PlatformBridge::screenAvailableRect(Widget* widget) +{ + WebWidgetClient* client = toWebWidgetClient(widget); + if (!client) + return IntRect(); + return client->screenInfo().availableRect; +} + +bool PlatformBridge::popupsAllowed(NPP npp) +{ + // FIXME: Give the embedder a way to control this. + return false; +} + +WorkerContextProxy* WorkerContextProxy::create(Worker* worker) +{ + return WebWorkerClientImpl::createWorkerContextProxy(worker); +} + +} // namespace WebCore diff --git a/Source/WebKit/chromium/src/ResourceHandle.cpp b/Source/WebKit/chromium/src/ResourceHandle.cpp index 83e0017..72f60bb 100644 --- a/Source/WebKit/chromium/src/ResourceHandle.cpp +++ b/Source/WebKit/chromium/src/ResourceHandle.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "ResourceHandle.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "ResourceHandleClient.h" #include "ResourceRequest.h" #include "SharedBuffer.h" @@ -330,7 +330,7 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*) // static void ResourceHandle::cacheMetadata(const ResourceResponse& response, const Vector& data) { - ChromiumBridge::cacheMetadata(response.url(), response.responseTime(), data); + PlatformBridge::cacheMetadata(response.url(), response.responseTime(), data); } } // namespace WebCore diff --git a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp index b5ed384..e481f6e 100644 --- a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -32,7 +32,9 @@ #include "SpeechInputClientImpl.h" #include "PlatformString.h" +#include "SecurityOrigin.h" #include "SpeechInputListener.h" +#include "WebSecurityOrigin.h" #include "WebSpeechInputController.h" #include "WebString.h" #include "WebViewClient.h" @@ -62,10 +64,10 @@ void SpeechInputClientImpl::setListener(WebCore::SpeechInputListener* listener) m_listener = listener; } -bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar) +bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar, WebCore::SecurityOrigin* origin) { ASSERT(m_listener); - return m_controller->startRecognition(requestId, elementRect, language, grammar); + return m_controller->startRecognition(requestId, elementRect, language, grammar, WebSecurityOrigin(origin)); } void SpeechInputClientImpl::stopRecording(int requestId) diff --git a/Source/WebKit/chromium/src/SpeechInputClientImpl.h b/Source/WebKit/chromium/src/SpeechInputClientImpl.h index 520803a..a81151d 100644 --- a/Source/WebKit/chromium/src/SpeechInputClientImpl.h +++ b/Source/WebKit/chromium/src/SpeechInputClientImpl.h @@ -40,6 +40,7 @@ #include namespace WebCore { +class SecurityOrigin; class SpeechInputListener; } @@ -57,7 +58,7 @@ public: // SpeechInputClient methods. void setListener(WebCore::SpeechInputListener*); - bool startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar); + bool startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar, WebCore::SecurityOrigin*); void stopRecording(int); void cancelRecognition(int); diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp index 99e3e1e..86545b7 100644 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp +++ b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp @@ -111,6 +111,7 @@ const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const { switch (format()) { case RGBA: + case YV16: return IntSize(stride(plane), height()); case YV12: if (plane == static_cast(yPlane)) diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h index 866a1cb..dc7d2df 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -55,8 +55,8 @@ struct WebDevToolsMessageData; using WTF::String; -class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend - , public Noncopyable { +class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend { + WTF_MAKE_NONCOPYABLE(WebDevToolsFrontendImpl); public: WebDevToolsFrontendImpl( WebKit::WebViewImpl* webViewImpl, diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp index 8c61997..e1fa0e7 100644 --- a/Source/WebKit/chromium/src/WebFontImpl.cpp +++ b/Source/WebKit/chromium/src/WebFontImpl.cpp @@ -35,6 +35,7 @@ #include "FontDescription.h" #include "GraphicsContext.h" #include "PlatformContextSkia.h" +#include "TextRun.h" #include "WebFloatPoint.h" #include "WebFloatRect.h" #include "WebFontDescription.h" diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index a13eec0..8651fa8 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -74,7 +74,6 @@ #include "AssociatedURLLoader.h" #include "BackForwardController.h" #include "Chrome.h" -#include "ChromiumBridge.h" #include "ClipboardUtilitiesChromium.h" #include "Console.h" #include "DOMUtilitiesPrivate.h" @@ -103,6 +102,7 @@ #include "InspectorController.h" #include "Page.h" #include "Performance.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "PluginDocument.h" #include "PrintContext.h" @@ -284,7 +284,8 @@ WebPluginContainerImpl* WebFrameImpl::pluginContainerFromFrame(Frame* frame) // Simple class to override some of PrintContext behavior. Some of the methods // made virtual so that they can be overriden by ChromePluginPrintContext. -class ChromePrintContext : public PrintContext, public Noncopyable { +class ChromePrintContext : public PrintContext { + WTF_MAKE_NONCOPYABLE(ChromePrintContext); public: ChromePrintContext(Frame* frame) : PrintContext(frame) @@ -883,6 +884,17 @@ void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) RefPtr historyItem = PassRefPtr(item); ASSERT(historyItem.get()); + // Sanity check for http://webkit.org/b/52819. It appears that some child + // items of this item might be null. Try validating just the first set of + // children in an attempt to catch it early. + const HistoryItemVector& childItems = historyItem->children(); + int size = childItems.size(); + for (int i = 0; i < size; ++i) { + RefPtr childItem = childItems[i].get(); + if (!childItem.get()) + CRASH(); + } + // If there is no currentItem, which happens when we are navigating in // session history after a crash, we need to manufacture one otherwise WebKit // hoarks. This is probably the wrong thing to do, but it seems to work. @@ -1198,6 +1210,9 @@ void WebFrameImpl::enableContinuousSpellChecking(bool enable) { if (enable == isContinuousSpellCheckingEnabled()) return; + // Note, the editor will will notify the client that the continuous spell + // checking state has changed by calling + // WebFrameClient::didToggleContinuousSpellChecking(). frame()->editor()->toggleContinuousSpellChecking(); } @@ -1820,13 +1835,13 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client) , m_animationController(this) , m_identifier(generateFrameIdentifier()) { - ChromiumBridge::incrementStatsCounter(webFrameActiveCount); + PlatformBridge::incrementStatsCounter(webFrameActiveCount); frameCount++; } WebFrameImpl::~WebFrameImpl() { - ChromiumBridge::decrementStatsCounter(webFrameActiveCount); + PlatformBridge::decrementStatsCounter(webFrameActiveCount); frameCount--; cancelPendingScopingEffort(); diff --git a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp index 8d8c53e..53eca19 100644 --- a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp @@ -38,7 +38,7 @@ namespace WebKit { WebSecurityOrigin WebGeolocationPermissionRequest::securityOrigin() const { - return WebSecurityOrigin::create(m_private->frame()->document()->url()); + return WebSecurityOrigin(m_private->frame()->document()->securityOrigin()); } void WebGeolocationPermissionRequest::setIsAllowed(bool allowed) diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 63ebed8..a209e6a 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -151,6 +151,10 @@ void WebPopupMenuImpl::resize(const WebSize& newSize) } } +void WebPopupMenuImpl::animate() +{ +} + void WebPopupMenuImpl::layout() { } @@ -299,6 +303,10 @@ void WebPopupMenuImpl::invalidateContentsForSlowScroll(const IntRect& updateRect invalidateContentsAndWindow(updateRect, immediate); } +void WebPopupMenuImpl::scheduleAnimation() +{ +} + void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index b8ef7ba..7bb9f7e 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -56,11 +56,13 @@ struct WebRect; class WebPopupMenuImpl : public WebPopupMenu, public WebCore::FramelessScrollViewClient, public RefCounted { + WTF_MAKE_FAST_ALLOCATED; public: // WebWidget virtual void close(); virtual WebSize size() { return m_size; } virtual void resize(const WebSize&); + virtual void animate(); virtual void layout(); virtual void paint(WebCanvas* canvas, const WebRect& rect); virtual void themeChanged(); @@ -105,6 +107,7 @@ public: virtual void invalidateWindow(const WebCore::IntRect&, bool); virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); + virtual void scheduleAnimation(); virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect); diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index edb0413..0b5d397 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -184,6 +184,22 @@ bool WebRuntimeFeatures::isIndexedDatabaseEnabled() #endif } +void WebRuntimeFeatures::enableWebAudio(bool enable) +{ +#if ENABLE(WEB_AUDIO) + RuntimeEnabledFeatures::setWebkitAudioContextEnabled(enable); +#endif +} + +bool WebRuntimeFeatures::isWebAudioEnabled() +{ +#if ENABLE(WEB_AUDIO) + return RuntimeEnabledFeatures::webkitAudioContextEnabled(); +#else + return false; +#endif +} + void WebRuntimeFeatures::enableWebGL(bool enable) { #if ENABLE(3D_CANVAS) diff --git a/Source/WebKit/chromium/src/WebScriptController.cpp b/Source/WebKit/chromium/src/WebScriptController.cpp index 0aa11a6..10bc68f 100644 --- a/Source/WebKit/chromium/src/WebScriptController.cpp +++ b/Source/WebKit/chromium/src/WebScriptController.cpp @@ -54,7 +54,7 @@ void WebScriptController::enableV8SingleThreadMode() void WebScriptController::flushConsoleMessages() { - WebCore::V8Proxy::processConsoleMessages(); + // FIXME: remove this method after all it's usages are gone. } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp index 8b9e287..05d2d1f 100644 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp @@ -62,9 +62,10 @@ int WebScrollbar::defaultThickness() WebScrollbarImpl::WebScrollbarImpl(WebScrollbarClient* client, Orientation orientation) : m_client(client) + , m_scrollOffset(0) { m_scrollbar = Scrollbar::createNativeScrollbar( - static_cast(this), + static_cast(this), static_cast(orientation), RegularScrollbar); } @@ -89,12 +90,12 @@ void WebScrollbarImpl::setLocation(const WebRect& rect) int WebScrollbarImpl::value() const { - return m_scrollbar->value(); + return m_scrollOffset; } void WebScrollbarImpl::setValue(int position) { - m_scrollbar->setValue(position, Scrollbar::NotFromScrollAnimator); + WebCore::ScrollableArea::scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), position); } void WebScrollbarImpl::setDocumentSize(int size) @@ -112,7 +113,8 @@ void WebScrollbarImpl::scroll(ScrollDirection direction, ScrollGranularity granu dir = horizontal ? ScrollRight : ScrollDown; else dir = horizontal ? ScrollLeft : ScrollUp; - m_scrollbar->scroll(dir, static_cast(granularity), multiplier); + + WebCore::ScrollableArea::scroll(dir, static_cast(granularity), multiplier); } void WebScrollbarImpl::paint(WebCanvas* canvas, const WebRect& rect) @@ -167,11 +169,11 @@ bool WebScrollbarImpl::onMouseDown(const WebInputEvent& event) if (!m_scrollbar->frameRect().contains(mousedown.x, mousedown.y)) return false; - mousedown.x -= m_scrollbar->x(); - mousedown.y -= m_scrollbar->y(); - m_scrollbar->mouseDown(PlatformMouseEventBuilder(m_scrollbar.get(), mousedown)); - return true; - } + mousedown.x -= m_scrollbar->x(); + mousedown.y -= m_scrollbar->y(); + m_scrollbar->mouseDown(PlatformMouseEventBuilder(m_scrollbar.get(), mousedown)); + return true; +} bool WebScrollbarImpl::onMouseUp(const WebInputEvent& event) { @@ -183,16 +185,16 @@ bool WebScrollbarImpl::onMouseUp(const WebInputEvent& event) bool WebScrollbarImpl::onMouseMove(const WebInputEvent& event) { - WebMouseEvent mousemove = *static_cast(&event); - if (m_scrollbar->frameRect().contains(mousemove.x, mousemove.y) - || m_scrollbar->pressedPart() != NoPart) { - mousemove.x -= m_scrollbar->x(); - mousemove.y -= m_scrollbar->y(); - return m_scrollbar->mouseMoved(PlatformMouseEventBuilder(m_scrollbar.get(), mousemove)); - } + WebMouseEvent mousemove = *static_cast(&event); + if (m_scrollbar->frameRect().contains(mousemove.x, mousemove.y) + || m_scrollbar->pressedPart() != NoPart) { + mousemove.x -= m_scrollbar->x(); + mousemove.y -= m_scrollbar->y(); + return m_scrollbar->mouseMoved(PlatformMouseEventBuilder(m_scrollbar.get(), mousemove)); + } - if (m_scrollbar->hoveredPart() != NoPart) - m_scrollbar->mouseExited(); + if (m_scrollbar->hoveredPart() != NoPart) + m_scrollbar->mouseExited(); return false; } @@ -206,59 +208,59 @@ bool WebScrollbarImpl::onMouseLeave(const WebInputEvent& event) bool WebScrollbarImpl::onMouseWheel(const WebInputEvent& event) { - // Same logic as in Scrollview.cpp. If we can move at all, we'll accept the event. - WebMouseWheelEvent mousewheel = *static_cast(&event); - int maxScrollDelta = m_scrollbar->maximum() - m_scrollbar->value(); - float delta = m_scrollbar->orientation() == HorizontalScrollbar ? mousewheel.deltaX : mousewheel.deltaY; - if ((delta < 0 && maxScrollDelta > 0) || (delta > 0 && m_scrollbar->value() > 0)) { - if (mousewheel.scrollByPage) { - ASSERT(m_scrollbar->orientation() == VerticalScrollbar); - bool negative = delta < 0; - delta = max(max(static_cast(m_scrollbar->visibleSize()) * Scrollbar::minFractionToStepWhenPaging(), static_cast(m_scrollbar->visibleSize() - Scrollbar::maxOverlapBetweenPages())), 1.0f); - if (negative) - delta *= -1; - } - m_scrollbar->scroll((m_scrollbar->orientation() == HorizontalScrollbar) ? WebCore::ScrollLeft : WebCore::ScrollUp, WebCore::ScrollByPixel, delta); - return true; + // Same logic as in Scrollview.cpp. If we can move at all, we'll accept the event. + WebMouseWheelEvent mousewheel = *static_cast(&event); + int maxScrollDelta = m_scrollbar->maximum() - m_scrollbar->value(); + float delta = m_scrollbar->orientation() == HorizontalScrollbar ? mousewheel.deltaX : mousewheel.deltaY; + if ((delta < 0 && maxScrollDelta > 0) || (delta > 0 && m_scrollbar->value() > 0)) { + if (mousewheel.scrollByPage) { + ASSERT(m_scrollbar->orientation() == VerticalScrollbar); + bool negative = delta < 0; + delta = max(max(static_cast(m_scrollbar->visibleSize()) * Scrollbar::minFractionToStepWhenPaging(), static_cast(m_scrollbar->visibleSize() - Scrollbar::maxOverlapBetweenPages())), 1.0f); + if (negative) + delta *= -1; } + WebCore::ScrollableArea::scroll((m_scrollbar->orientation() == HorizontalScrollbar) ? WebCore::ScrollLeft : WebCore::ScrollUp, WebCore::ScrollByPixel, delta); + return true; + } return false; } bool WebScrollbarImpl::onKeyDown(const WebInputEvent& event) { - WebKeyboardEvent keyboard = *static_cast(&event); - int keyCode; - // We have to duplicate this logic from WebViewImpl because there it uses - // Char and RawKeyDown events, which don't exist at this point. - if (keyboard.windowsKeyCode == VKEY_SPACE) - keyCode = ((keyboard.modifiers & WebInputEvent::ShiftKey) ? VKEY_PRIOR : VKEY_NEXT); - else { - if (keyboard.modifiers == WebInputEvent::ControlKey) { - // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl - // key combinations which affect scrolling. Safari is buggy in the - // sense that it scrolls the page for all Ctrl+scrolling key - // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. - switch (keyboard.windowsKeyCode) { - case VKEY_HOME: - case VKEY_END: - break; - default: - return false; - } + WebKeyboardEvent keyboard = *static_cast(&event); + int keyCode; + // We have to duplicate this logic from WebViewImpl because there it uses + // Char and RawKeyDown events, which don't exist at this point. + if (keyboard.windowsKeyCode == VKEY_SPACE) + keyCode = ((keyboard.modifiers & WebInputEvent::ShiftKey) ? VKEY_PRIOR : VKEY_NEXT); + else { + if (keyboard.modifiers == WebInputEvent::ControlKey) { + // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl + // key combinations which affect scrolling. Safari is buggy in the + // sense that it scrolls the page for all Ctrl+scrolling key + // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. + switch (keyboard.windowsKeyCode) { + case VKEY_HOME: + case VKEY_END: + break; + default: + return false; } + } - if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKey)) - return false; + if (keyboard.isSystemKey || (keyboard.modifiers & WebInputEvent::ShiftKey)) + return false; - keyCode = keyboard.windowsKeyCode; - } - WebCore::ScrollDirection scrollDirection; - WebCore::ScrollGranularity scrollGranularity; - if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) { - // Will return false if scroll direction wasn't compatible with this scrollbar. - return m_scrollbar->scroll(scrollDirection, scrollGranularity); - } + keyCode = keyboard.windowsKeyCode; + } + WebCore::ScrollDirection scrollDirection; + WebCore::ScrollGranularity scrollGranularity; + if (WebViewImpl::mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) { + // Will return false if scroll direction wasn't compatible with this scrollbar. + return WebCore::ScrollableArea::scroll(scrollDirection, scrollGranularity); + } return false; } @@ -267,13 +269,18 @@ int WebScrollbarImpl::scrollSize(WebCore::ScrollbarOrientation orientation) cons return (orientation == m_scrollbar->orientation()) ? (m_scrollbar->totalSize() - m_scrollbar->visibleSize()) : 0; } -void WebScrollbarImpl::setScrollOffsetFromAnimation(const WebCore::IntPoint& offset) +int WebScrollbarImpl::scrollPosition(WebCore::Scrollbar*) const { - m_scrollbar->setValue((m_scrollbar->orientation() == HorizontalScrollbar) ? offset.x() : offset.y(), Scrollbar::FromScrollAnimator); + return m_scrollOffset; } -void WebScrollbarImpl::valueChanged(WebCore::Scrollbar*) +void WebScrollbarImpl::setScrollOffset(const WebCore::IntPoint& offset) { + if (m_scrollbar->orientation() == HorizontalScrollbar) + m_scrollOffset = offset.x(); + else + m_scrollOffset = offset.y(); + m_client->valueChanged(this); } diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.h b/Source/WebKit/chromium/src/WebScrollbarImpl.h index 5512867..4dcfd5d 100644 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.h +++ b/Source/WebKit/chromium/src/WebScrollbarImpl.h @@ -31,7 +31,7 @@ #ifndef WebScrollbarImpl_h #define WebScrollbarImpl_h -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "WebScrollbar.h" #include @@ -43,7 +43,7 @@ class Scrollbar; namespace WebKit { class WebScrollbarImpl : public WebScrollbar, - public WebCore::ScrollbarClient { + public WebCore::ScrollableArea { public: WebScrollbarImpl(WebScrollbarClient*, Orientation orientation); ~WebScrollbarImpl(); @@ -57,10 +57,10 @@ public: virtual void paint(WebCanvas*, const WebRect&); virtual bool handleInputEvent(const WebInputEvent&); - // WebCore::ScrollbarClient methods - virtual int scrollSize(WebCore::ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const WebCore::IntPoint&); - virtual void valueChanged(WebCore::Scrollbar*); + // WebCore::ScrollableArea methods + virtual int scrollSize(WebCore::ScrollbarOrientation) const; + virtual int scrollPosition(WebCore::Scrollbar*) const; + virtual void setScrollOffset(const WebCore::IntPoint&); virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const; @@ -76,6 +76,7 @@ private: WebScrollbarClient* m_client; + int m_scrollOffset; RefPtr m_scrollbar; }; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index c66a57b..0457f77 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -264,6 +264,11 @@ void WebSettingsImpl::setOfflineWebApplicationCacheEnabled(bool enabled) m_settings->setOfflineWebApplicationCacheEnabled(enabled); } +void WebSettingsImpl::setWebAudioEnabled(bool enabled) +{ + m_settings->setWebAudioEnabled(enabled); +} + void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) { m_settings->setWebGLEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index febc959..4960bb9 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -84,6 +84,7 @@ public: virtual void setAllowFileAccessFromFileURLs(bool); virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); virtual void setOfflineWebApplicationCacheEnabled(bool); + virtual void setWebAudioEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); virtual void setShowDebugBorders(bool); virtual void setEditingBehavior(EditingBehavior); diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp index 48f8b50..3beb785 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp @@ -32,8 +32,10 @@ #include "WebSpeechInputControllerMockImpl.h" #include "PlatformString.h" +#include "SecurityOrigin.h" #include "SpeechInputClientMock.h" #include "WebRect.h" +#include "WebSecurityOrigin.h" namespace WebKit { @@ -80,9 +82,9 @@ void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const m_listener->setRecognitionResult(requestId, result); } -bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar) +bool WebSpeechInputControllerMockImpl::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin) { - return m_webcoreMock->startRecognition(requestId, elementRect, language, grammar); + return m_webcoreMock->startRecognition(requestId, elementRect, language, grammar, origin.get()); } void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h index bf00ed0..4c8fee7 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h @@ -57,7 +57,7 @@ public: void setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result); // WebSpeechInputController methods. - bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar); + bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin&); void cancelRecognition(int requestId); void stopRecording(int requestId); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 41a0804..798e5ff 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -34,23 +34,22 @@ #include "AutoFillPopupMenuClient.h" #include "AXObjectCache.h" #include "BackForwardListChromium.h" +#include "CSSStyleSelector.h" +#include "CSSValueKeywords.h" #include "Chrome.h" -#include "ChromiumBridge.h" #include "ColorSpace.h" #include "CompositionUnderlineVectorBuilder.h" #include "ContextMenu.h" #include "ContextMenuController.h" #include "ContextMenuItem.h" -#include "CSSStyleSelector.h" -#include "CSSValueKeywords.h" #include "Cursor.h" +#include "DOMUtilitiesPrivate.h" #include "DeviceOrientationClientProxy.h" #include "Document.h" #include "DocumentLoader.h" -#include "DOMUtilitiesPrivate.h" #include "DragController.h" -#include "DragScrollTimer.h" #include "DragData.h" +#include "DragScrollTimer.h" #include "Editor.h" #include "EventHandler.h" #include "Extensions3D.h" @@ -65,8 +64,8 @@ #include "GraphicsContext3DInternal.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" -#include "HitTestResult.h" #include "HTMLNames.h" +#include "HitTestResult.h" #include "Image.h" #include "ImageBuffer.h" #include "InspectorController.h" @@ -78,6 +77,7 @@ #include "PageGroup.h" #include "PageGroupLoadDeferrer.h" #include "Pasteboard.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" @@ -98,8 +98,8 @@ #include "Vector.h" #include "WebAccessibilityObject.h" #include "WebAutoFillClient.h" -#include "WebDevToolsAgentPrivate.h" #include "WebDevToolsAgentImpl.h" +#include "WebDevToolsAgentPrivate.h" #include "WebDragData.h" #include "WebFrameImpl.h" #include "WebImage.h" @@ -972,6 +972,18 @@ void WebViewImpl::resize(const WebSize& newSize) #endif } +void WebViewImpl::animate() +{ +#if ENABLE(REQUEST_ANIMATION_FRAME) + WebFrameImpl* webframe = mainFrameImpl(); + if (webframe) { + FrameView* view = webframe->frameView(); + if (view) + view->serviceScriptedAnimations(); + } +#endif +} + void WebViewImpl::layout() { WebFrameImpl* webframe = mainFrameImpl(); @@ -2287,7 +2299,7 @@ void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) void WebViewImpl::setIsAcceleratedCompositingActive(bool active) { - ChromiumBridge::histogramEnumeration("GPU.setIsAcceleratedCompositingActive", active * 2 + m_isAcceleratedCompositingActive, 4); + PlatformBridge::histogramEnumeration("GPU.setIsAcceleratedCompositingActive", active * 2 + m_isAcceleratedCompositingActive, 4); if (m_isAcceleratedCompositingActive == active) return; diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index bc79ec1..d164a48 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -91,6 +91,7 @@ public: virtual void close(); virtual WebSize size() { return m_size; } virtual void resize(const WebSize&); + virtual void animate(); virtual void layout(); virtual void paint(WebCanvas*, const WebRect&); virtual void themeChanged(); diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index 18282e3..f90e7e8 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -41,6 +41,7 @@ #include "MessageEvent.h" #include "MessagePort.h" #include "MessagePortChannel.h" +#include "ScriptCallStack.h" #include "ScriptExecutionContext.h" #include "Worker.h" #include "WorkerContext.h" @@ -247,7 +248,7 @@ void WebWorkerClientImpl::postExceptionToWorkerObject(const WebString& errorMess sourceURL, lineNumber)); if (unhandled) - m_scriptExecutionContext->reportException(errorMessage, lineNumber, sourceURL); + m_scriptExecutionContext->reportException(errorMessage, lineNumber, sourceURL, 0); } void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destination, @@ -274,7 +275,7 @@ void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int destination, static_cast(messageType), static_cast(messageLevel), String(message), lineNumber, - String(sourceURL)); + String(sourceURL), 0); } void WebWorkerClientImpl::postConsoleMessageToWorkerObject(int sourceId, @@ -381,9 +382,7 @@ void WebWorkerClientImpl::postExceptionToWorkerObjectTask( sourceURL, lineNumber)); if (!handled) - thisPtr->m_scriptExecutionContext->reportException(errorMessage, - lineNumber, - sourceURL); + thisPtr->m_scriptExecutionContext->reportException(errorMessage, lineNumber, sourceURL, 0); } void WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask(ScriptExecutionContext* context, @@ -398,8 +397,7 @@ void WebWorkerClientImpl::postConsoleMessageToWorkerObjectTask(ScriptExecutionCo thisPtr->m_scriptExecutionContext->addMessage(static_cast(sourceId), static_cast(messageType), static_cast(messageLevel), - message, lineNumber, - sourceURL); + message, lineNumber, sourceURL, 0); } void WebWorkerClientImpl::confirmMessageFromWorkerObjectTask(ScriptExecutionContext* context, diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index f2e8dcb..900d79e 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -616,7 +616,7 @@ TestSuite.prototype.evaluateInConsole_ = function(code, callback) */ TestSuite.prototype._checkExecutionLine = function(sourceFrame, lineNumber, lineContent) { - this.assertEquals(lineNumber, sourceFrame.executionLine, "Unexpected execution line number."); + this.assertEquals(lineNumber, sourceFrame._executionLine, "Unexpected execution line number."); this.assertEquals(lineContent, sourceFrame._textModel.line(lineNumber - 1), "Unexpected execution line text."); } @@ -686,7 +686,8 @@ TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callbac var test = this; var frame = WebInspector.currentPanel.visibleView.sourceFrame; - if (frame._loaded) + + if (frame._textViewer) checkExecLine(); else { setTimeout(function() { @@ -741,32 +742,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb /** - * Executes the 'code' with InjectedScriptAccess.getProperties overriden - * so that all callbacks passed to InjectedScriptAccess.getProperties are - * extended with the "hook". - * @param {Function} hook The hook function. - * @param {Function} code A code snippet to be executed. - */ -TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) -{ - var accessor = InjectedScriptAccess.prototype; - var orig = accessor.getProperties; - accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) { - orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate, - function() { - callback.apply(this, arguments); - hook(); - }); - }; - try { - code(); - } finally { - accessor.getProperties = orig; - } -}; - - -/** * Key event with given key identifier. */ TestSuite.createKeyEvent = function(keyIdentifier) -- cgit v1.1