diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
commit | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch) | |
tree | 8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebKit/chromium/src | |
parent | d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff) | |
download | qtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz |
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebKit/chromium/src')
75 files changed, 1718 insertions, 459 deletions
diff --git a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp index 9042a1175..73f258b0c 100644 --- a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -295,6 +295,11 @@ bool ApplicationCacheHost::swapCache() return success; } +void ApplicationCacheHost::abort() +{ + // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=76270 +} + bool ApplicationCacheHost::isApplicationCacheEnabled() { ASSERT(m_documentLoader->frame()); diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 5a3af4301..a451b88a6 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -37,6 +37,7 @@ #include "AccessibilityObject.h" #include "ApplicationCacheHost.h" #include "AsyncFileSystem.h" +#include "ContentSecurityPolicy.h" #include "DocumentMarker.h" #include "EditorInsertAction.h" #include "ExceptionCode.h" @@ -60,6 +61,7 @@ #include "Settings.h" #include "StorageInfo.h" #include "TextAffinity.h" +#include "TextChecking.h" #include "TextControlInnerElements.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" @@ -68,6 +70,7 @@ #include "WebAccessibilityNotification.h" #include "WebAccessibilityObject.h" #include "WebApplicationCacheHost.h" +#include "WebContentSecurityPolicy.h" #include "WebCursorInfo.h" #include "WebEditingAction.h" #include "WebFileError.h" @@ -89,6 +92,7 @@ #include "WebStorageQuotaType.h" #include "WebTextAffinity.h" #include "WebTextCaseSensitivity.h" +#include "WebTextCheckingType.h" #include "WebTextCheckingResult.h" #include "WebVideoFrame.h" #include "WebView.h" @@ -429,7 +433,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); #if ENABLE(FILE_SYSTEM) COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary); COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent); -COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, AsyncFileSystem::External); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile); COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory); @@ -454,6 +457,15 @@ COMPILE_ASSERT_MATCHING_ENUM(WebGeolocationError::ErrorPositionUnavailable, Geol COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingResult::ErrorSpelling, DocumentMarker::Spelling); COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingResult::ErrorGrammar, DocumentMarker::Grammar); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeSpelling, TextCheckingTypeSpelling); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeGrammar, TextCheckingTypeGrammar); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeLink, TextCheckingTypeLink); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeQuote, TextCheckingTypeQuote); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeDash, TextCheckingTypeDash); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeReplacement, TextCheckingTypeReplacement); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeCorrection, TextCheckingTypeCorrection); +COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeShowCorrectionPanel, TextCheckingTypeShowCorrectionPanel); + #if ENABLE(QUOTA) COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorNotSupported, NOT_SUPPORTED_ERR); COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorAbort, ABORT_ERR); @@ -494,3 +506,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, SecurityPolicy::ReferrerPo COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, SecurityPolicy::ReferrerPolicyDefault); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, SecurityPolicy::ReferrerPolicyNever); COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, SecurityPolicy::ReferrerPolicyOrigin); + +COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeReportOnly, ContentSecurityPolicy::ReportOnly); +COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeEnforcePolicy, ContentSecurityPolicy::EnforcePolicy); diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp index 6adeba746..c314411b4 100644 --- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp +++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011 Google Inc. All rights reserved. + * Copyright (C) 2010, 2011, 2012 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 @@ -31,6 +31,7 @@ #include "config.h" #include "AssociatedURLLoader.h" +#include "CrossOriginAccessControl.h" #include "DocumentThreadableLoader.h" #include "DocumentThreadableLoaderClient.h" #include "HTTPValidation.h" @@ -45,9 +46,12 @@ #include "XMLHttpRequest.h" #include "platform/WebHTTPHeaderVisitor.h" #include "platform/WebKitPlatformSupport.h" +#include "platform/WebString.h" #include "platform/WebURLError.h" #include "platform/WebURLLoaderClient.h" #include "platform/WebURLRequest.h" +#include <wtf/HashSet.h> +#include <wtf/text/WTFString.h> using namespace WebCore; using namespace WTF; @@ -56,10 +60,10 @@ namespace WebKit { namespace { -class SafeHTTPHeaderValidator : public WebHTTPHeaderVisitor { - WTF_MAKE_NONCOPYABLE(SafeHTTPHeaderValidator); +class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { + WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); public: - SafeHTTPHeaderValidator() : m_isSafe(true) { } + HTTPRequestHeaderValidator() : m_isSafe(true) { } void visitHeader(const WebString& name, const WebString& value); bool isSafe() const { return m_isSafe; } @@ -68,11 +72,55 @@ private: bool m_isSafe; }; -void SafeHTTPHeaderValidator::visitHeader(const WebString& name, const WebString& value) +typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet; + +void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebString& value) { m_isSafe = m_isSafe && isValidHTTPToken(name) && XMLHttpRequest::isAllowedHTTPHeader(name) && isValidHTTPHeaderValue(value); } +class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { + WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); +public: + HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl(usingAccessControl) { } + + void visitHeader(const WebString& name, const WebString& value); + const HTTPHeaderSet& blockedHeaders(); + +private: + HTTPHeaderSet m_exposedHeaders; + HTTPHeaderSet m_blockedHeaders; + bool m_usingAccessControl; +}; + +void HTTPResponseHeaderValidator::visitHeader(const WebString& name, const WebString& value) +{ + String headerName(name); + if (m_usingAccessControl) { + if (equalIgnoringCase(headerName, "access-control-expose-header")) + parseAccessControlExposeHeadersAllowList(value, m_exposedHeaders); + else if (!isOnAccessControlResponseHeaderWhitelist(headerName)) + m_blockedHeaders.add(name); + } +} + +const HTTPHeaderSet& HTTPResponseHeaderValidator::blockedHeaders() +{ + // Remove exposed headers from the blocked set. + if (!m_exposedHeaders.isEmpty()) { + // Don't allow Set-Cookie headers to be exposed. + m_exposedHeaders.remove("set-cookie"); + m_exposedHeaders.remove("set-cookie2"); + // Block Access-Control-Expose-Header itself. It could be exposed later. + m_blockedHeaders.add("access-control-expose-header"); + HTTPHeaderSet::const_iterator end = m_exposedHeaders.end(); + for (HTTPHeaderSet::const_iterator it = m_exposedHeaders.begin(); it != end; ++it) + m_blockedHeaders.remove(*it); + } + + return m_blockedHeaders; +} + } // This class bridges the interface differences between WebCore and WebKit loader clients. @@ -80,7 +128,7 @@ void SafeHTTPHeaderValidator::visitHeader(const WebString& name, const WebString class AssociatedURLLoader::ClientAdapter : public DocumentThreadableLoaderClient { WTF_MAKE_NONCOPYABLE(ClientAdapter); public: - static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, bool /*downloadToFile*/); + static PassOwnPtr<ClientAdapter> create(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/); virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/); @@ -105,30 +153,30 @@ public: void clearClient() { m_client = 0; } private: - ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, bool /*downloadToFile*/); + ClientAdapter(AssociatedURLLoader*, WebURLLoaderClient*, const WebURLLoaderOptions&); void notifyError(Timer<ClientAdapter>*); AssociatedURLLoader* m_loader; WebURLLoaderClient* m_client; + WebURLLoaderOptions m_options; WebURLError m_error; Timer<ClientAdapter> m_errorTimer; - bool m_downloadToFile; bool m_enableErrorNotifications; bool m_didFail; }; -PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, bool downloadToFile) +PassOwnPtr<AssociatedURLLoader::ClientAdapter> AssociatedURLLoader::ClientAdapter::create(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) { - return adoptPtr(new ClientAdapter(loader, client, downloadToFile)); + return adoptPtr(new ClientAdapter(loader, client, options)); } -AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, bool downloadToFile) +AssociatedURLLoader::ClientAdapter::ClientAdapter(AssociatedURLLoader* loader, WebURLLoaderClient* client, const WebURLLoaderOptions& options) : m_loader(loader) , m_client(client) + , m_options(options) , m_errorTimer(this, &ClientAdapter::notifyError) - , m_downloadToFile(downloadToFile) , m_enableErrorNotifications(false) , m_didFail(false) { @@ -156,8 +204,19 @@ void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response) { - WrappedResourceResponse wrappedResponse(response); - m_client->didReceiveResponse(m_loader, wrappedResponse); + // Try to use the original ResourceResponse if possible. + WebURLResponse validatedResponse = WrappedResourceResponse(response); + HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); + validatedResponse.visitHTTPHeaderFields(&validator); + // If there are blocked headers, copy the response so we can remove them. + const HTTPHeaderSet& blockedHeaders = validator.blockedHeaders(); + if (!blockedHeaders.isEmpty()) { + validatedResponse = WebURLResponse(validatedResponse); + HTTPHeaderSet::const_iterator end = blockedHeaders.end(); + for (HTTPHeaderSet::const_iterator it = blockedHeaders.begin(); it != end; ++it) + validatedResponse.clearHTTPHeaderField(*it); + } + m_client->didReceiveResponse(m_loader, validatedResponse); } void AssociatedURLLoader::ClientAdapter::didDownloadData(int dataLength) @@ -263,13 +322,13 @@ void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR allowLoad = isValidHTTPToken(method) && XMLHttpRequest::isAllowedHTTPMethod(method); if (allowLoad) { newRequest.setHTTPMethod(XMLHttpRequest::uppercaseKnownHTTPMethod(method)); - SafeHTTPHeaderValidator validator; + HTTPRequestHeaderValidator validator; newRequest.visitHTTPHeaderFields(&validator); allowLoad = validator.isSafe(); } } - m_clientAdapter = ClientAdapter::create(this, m_client, request.downloadToFile()); + m_clientAdapter = ClientAdapter::create(this, m_client, m_options); if (allowLoad) { ThreadableLoaderOptions options; diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index c55c71b79..28712827d 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -34,6 +34,7 @@ #include "AsyncFileSystemCallbacks.h" #include "AsyncFileWriterChromium.h" +#include "SecurityOrigin.h" #include "WebFileInfo.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFileWriter.h" @@ -41,14 +42,58 @@ #include "platform/WebFileSystem.h" #include "platform/WebKitPlatformSupport.h" #include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { +// ChromeOS-specific filesystem type. +const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal); +const char externalPathPrefix[] = "external"; +const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1; + +// static bool AsyncFileSystem::isAvailable() { return true; } +// static +bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath) +{ + if (!url.protocolIs("filesystem")) + return false; + + KURL originURL(ParsedURLString, url.path()); + String path = decodeURLEscapeSequences(originURL.path()); + if (path.isEmpty() || path[0] != '/') + return false; + path = path.substring(1); + + if (path.startsWith(temporaryPathPrefix)) { + type = Temporary; + path = path.substring(temporaryPathPrefixLength); + } else if (path.startsWith(persistentPathPrefix)) { + type = Persistent; + path = path.substring(persistentPathPrefixLength); + } else if (path.startsWith(externalPathPrefix)) { + type = externalType; + path = path.substring(externalPathPrefixLength); + } else + return false; + + if (path.isEmpty() || path[0] != '/') + return false; + + filePath.swap(path); + return true; +} + +// static +bool AsyncFileSystem::isValidType(Type type) +{ + return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal); +} + AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL) : AsyncFileSystem(type) , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) @@ -61,6 +106,28 @@ AsyncFileSystemChromium::~AsyncFileSystemChromium() { } +String AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath) +{ + ASSERT(!originString.isEmpty()); + if (originString == "null") + return String(); + + if (type() == externalType) { + // For external filesystem originString could be different from what we have in m_filesystemRootURL. + StringBuilder result; + result.append("filesystem:"); + result.append(originString); + result.append("/"); + result.append(externalPathPrefix); + result.append(encodeWithURLEscapeSequences(fullPath)); + return result.toString(); + } + + // For regular types we can just call virtualPathToFileSystemURL which appends the fullPath to the m_filesystemRootURL that should look like 'filesystem:<origin>/<typePrefix>'. + ASSERT(SecurityOrigin::create(m_filesystemRootURL)->toString() == originString); + return virtualPathToFileSystemURL(fullPath); +} + void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->move(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks)); diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h index 0c550b5e2..a8cbca276 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h @@ -54,6 +54,7 @@ public: virtual ~AsyncFileSystemChromium(); + virtual String toURL(const String& originString, const String& fullPath); virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); @@ -66,7 +67,7 @@ public: virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>); -private: +protected: AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL); WebKit::WebFileSystem* m_webFileSystem; diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp index e6ef7d10b..6c82385c8 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp @@ -160,8 +160,8 @@ void AudioDestinationChromium::FIFO::consume(AudioBus* destination, size_t frame size_t numberOfChannels = m_fifoAudioBus.numberOfChannels(); for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { - float* destinationData = destination->channel(channelIndex)->data(); - float* sourceData = m_fifoAudioBus.channel(channelIndex)->data(); + float* destinationData = destination->channel(channelIndex)->mutableData(); + const float* sourceData = m_fifoAudioBus.channel(channelIndex)->data(); bool isCopyGood = ((m_readIndex < m_fifoLength) && (m_readIndex + part1Length) <= m_fifoLength @@ -219,8 +219,8 @@ void AudioDestinationChromium::FIFO::fillBuffer(size_t numberOfFrames) size_t numberOfChannels = m_fifoAudioBus.numberOfChannels(); for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { - float* destination = m_fifoAudioBus.channel(channelIndex)->data(); - float* source = m_tempBus.channel(channelIndex)->data(); + float* destination = m_fifoAudioBus.channel(channelIndex)->mutableData(); + const float* source = m_tempBus.channel(channelIndex)->data(); bool isCopyGood = (part1Length <= m_providerSize && (part1Length + part2Length) <= m_providerSize diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 5f2851bb5..fb07b4c10 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -773,7 +773,7 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, // transparent to the WebView. m_webView->popupOpened(popupContainer); } - static_cast<WebPopupMenuImpl*>(webwidget)->Init(popupContainer, bounds); + static_cast<WebPopupMenuImpl*>(webwidget)->init(popupContainer, bounds); } void ChromeClientImpl::popupClosed(WebCore::PopupContainer* popupContainer) @@ -1018,4 +1018,21 @@ void ChromeClientImpl::numWheelEventHandlersChanged(unsigned numberOfWheelHandle m_webView->numberOfWheelEventHandlersChanged(numberOfWheelHandlers); } +#if ENABLE(POINTER_LOCK) +bool ChromeClientImpl::requestPointerLock() +{ + return m_webView->requestPointerLock(); +} + +void ChromeClientImpl::requestPointerUnlock() +{ + return m_webView->requestPointerUnlock(); +} + +bool ChromeClientImpl::isPointerLocked() +{ + return m_webView->isPointerLocked(); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 2113ec1af..8fd2488d9 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -205,6 +205,12 @@ public: virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const; virtual void numWheelEventHandlersChanged(unsigned); +#if ENABLE(POINTER_LOCK) + virtual bool requestPointerLock(); + virtual void requestPointerUnlock(); + virtual bool isPointerLocked(); +#endif + private: void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); void setCursor(const WebCursorInfo&); diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 5fa237852..04aa719ed 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. - * Copyright (C) 2010 Google, Inc. All rights reserved. + * Copyright (C) 2012 Google, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +57,7 @@ #include "WebSpellCheckClient.h" #include "WebTextAffinity.h" #include "WebTextCheckingCompletionImpl.h" +#include "WebTextCheckingResult.h" #include "WebViewClient.h" #include "WebViewImpl.h" @@ -765,6 +766,22 @@ void EditorClientImpl::checkGrammarOfString(const UChar*, int length, *badGrammarLength = 0; } +void EditorClientImpl::checkTextOfParagraph(const UChar* text, int length, + TextCheckingTypeMask mask, + WTF::Vector<TextCheckingResult>& results) +{ + if (!m_webView->spellCheckClient()) + return; + + WebTextCheckingTypeMask webMask = static_cast<WebTextCheckingTypeMask>(mask); + WebVector<WebTextCheckingResult> webResults; + m_webView->spellCheckClient()->checkTextOfParagraph(WebString(text, length), webMask, &webResults); + + results.resize(webResults.size()); + for (size_t i = 0; i < webResults.size(); ++i) + results[i] = webResults[i]; +} + void EditorClientImpl::updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) { diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 233695f9f..2b577107c 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -99,6 +99,8 @@ public: virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); + virtual void checkTextOfParagraph(const UChar*, int length, WebCore::TextCheckingTypeMask checkingTypes, + WTF::Vector<WebCore::TextCheckingResult>& results); virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&); virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&); virtual void updateSpellingUIWithMisspelledWord(const WTF::String&); diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 72e71b960..a85ccbd2e 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -47,6 +47,7 @@ #include "HTMLAppletElement.h" #include "HTMLFormElement.h" // needed by FormState.h #include "HTMLNames.h" +#include "IntentRequest.h" #include "MessageEvent.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" @@ -66,6 +67,7 @@ #include "WebFormElement.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebIntentRequest.h" #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" #include <public/WebMimeRegistry.h> @@ -692,7 +694,7 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() } bool isNewNavigation; - webView->didCommitLoad(&isNewNavigation); + webView->didCommitLoad(&isNewNavigation, true); if (m_webFrame->client()) m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation); @@ -804,7 +806,7 @@ void FrameLoaderClientImpl::dispatchDidCommitLoad() { WebViewImpl* webview = m_webFrame->viewImpl(); bool isNewNavigation; - webview->didCommitLoad(&isNewNavigation); + webview->didCommitLoad(&isNewNavigation, false); if (m_webFrame->client()) m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, isNewNavigation); @@ -1629,4 +1631,11 @@ bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( m_webFrame, WebSecurityOrigin(target), WebDOMMessageEvent(event)); } +#if ENABLE(WEB_INTENTS) +void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> intentRequest) +{ + m_webFrame->client()->dispatchIntent(webFrame(), intentRequest); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index b1b85ba35..0bf935d6d 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -208,6 +208,10 @@ public: virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const; +#if ENABLE(WEB_INTENTS) + virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE; +#endif + private: void makeDocumentView(); diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index beeb94b65..94958c94e 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -46,9 +46,10 @@ #include "ImageBuffer.h" #include "ImageData.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" +#include "WebViewClient.h" #include "WebViewImpl.h" #include "platform/WebGraphicsContext3D.h" +#include "platform/WebKitPlatformSupport.h" #include <stdio.h> #include <wtf/FastMalloc.h> @@ -151,14 +152,17 @@ PassRefPtr<GraphicsContext3D> createGraphicsContext(GraphicsContext3D::Attribute webAttributes.noExtensions = attrs.noExtensions; webAttributes.shareResources = attrs.shareResources; webAttributes.forUseOnAnotherThread = threadUsage == GraphicsContext3DPrivate::ForUseOnAnotherThread; - OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createGraphicsContext3D()); - if (!webContext) - return 0; Chrome* chrome = static_cast<Chrome*>(hostWindow); WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0; - - if (!webContext->initialize(webAttributes, webViewImpl, renderDirectlyToHostWindow)) + OwnPtr<WebKit::WebGraphicsContext3D> webContext; + if (!webViewImpl || !webViewImpl->client()) { + if (renderDirectlyToHostWindow) + return 0; + webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes)); + } else + webContext = adoptPtr(webViewImpl->client()->createGraphicsContext3D(webAttributes, renderDirectlyToHostWindow)); + if (!webContext) return 0; return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attrs, hostWindow, renderStyle, threadUsage); @@ -210,7 +214,7 @@ GrContext* GraphicsContext3DPrivate::grContext() // Limit the number of textures we hold in the bitmap->texture cache. static const int maxTextureCacheCount = 512; // Limit the bytes allocated toward textures in the bitmap->texture cache. - static const size_t maxTextureCacheBytes = 50 * 1024 * 1024; + static const size_t maxTextureCacheBytes = 96 * 1024 * 1024; if (!m_grContext) { SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface()); @@ -1032,6 +1036,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*, GraphicsContext3D::~GraphicsContext3D() { m_private->setContextLostCallback(nullptr); + m_private->setErrorMessageCallback(nullptr); m_private->setSwapBuffersCompleteCallbackCHROMIUM(nullptr); } @@ -1268,6 +1273,7 @@ DELEGATE_TO_INTERNAL_1(synthesizeGLError, GC3Denum) DELEGATE_TO_INTERNAL_R(getExtensions, Extensions3D*) DELEGATE_TO_INTERNAL_1(setContextLostCallback, PassOwnPtr<GraphicsContext3D::ContextLostCallback>) +DELEGATE_TO_INTERNAL_1(setErrorMessageCallback, PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>) class GraphicsContextLostCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { public: @@ -1296,6 +1302,33 @@ void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext m_impl->setContextLostCallback(m_contextLostCallbackAdapter.get()); } +class GraphicsErrorMessageCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsErrorMessageCallback { +public: + virtual void onErrorMessage(const WebKit::WebString&, WebKit::WGC3Dint); + static PassOwnPtr<GraphicsErrorMessageCallbackAdapter> create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>); + virtual ~GraphicsErrorMessageCallbackAdapter() { } +private: + GraphicsErrorMessageCallbackAdapter(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) : m_errorMessageCallback(cb) { } + OwnPtr<GraphicsContext3D::ErrorMessageCallback> m_errorMessageCallback; +}; + +void GraphicsErrorMessageCallbackAdapter::onErrorMessage(const WebKit::WebString& message, WebKit::WGC3Dint id) +{ + if (m_errorMessageCallback) + m_errorMessageCallback->onErrorMessage(message, id); +} + +PassOwnPtr<GraphicsErrorMessageCallbackAdapter> GraphicsErrorMessageCallbackAdapter::create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) +{ + return adoptPtr(cb.get() ? new GraphicsErrorMessageCallbackAdapter(cb) : 0); +} + +void GraphicsContext3DPrivate::setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) +{ + m_errorMessageCallbackAdapter = GraphicsErrorMessageCallbackAdapter::create(cb); + m_impl->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); +} + bool GraphicsContext3D::isGLES2Compliant() const { return m_private->isGLES2Compliant(); diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h index 28079c313..f2d49a132 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h +++ b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h @@ -50,6 +50,7 @@ class DrawingBuffer; class Extensions3DChromium; class GraphicsContextLostCallbackAdapter; class GraphicsContext3DSwapBuffersCompleteCallbackAdapter; +class GraphicsErrorMessageCallbackAdapter; class GraphicsContext3DPrivate { public: @@ -273,6 +274,7 @@ public: void synthesizeGLError(GC3Denum error); void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>); + void setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>); // Extensions3D support. Extensions3D* getExtensions(); @@ -321,6 +323,7 @@ private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; OwnPtr<Extensions3DChromium> m_extensions; OwnPtr<GraphicsContextLostCallbackAdapter> m_contextLostCallbackAdapter; + OwnPtr<GraphicsErrorMessageCallbackAdapter> m_errorMessageCallbackAdapter; OwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> m_swapBuffersCompleteCallbackAdapter; WebKit::WebViewImpl* m_webViewImpl; bool m_initializedAvailableExtensions; diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index c22309b2a..80b711a56 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -47,6 +47,7 @@ #include "platform/WebVector.h" #include "WebViewImpl.h" #include "WebWorkerBase.h" +#include "WebWorkerClientImpl.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerScriptController.h" @@ -85,9 +86,91 @@ void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext*, const String&, const WebSecurityOrigin&) +static const char allowIndexedDBMode[] = "allowIndexedDBMode"; + +class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { +public: + static PassRefPtr<AllowIndexedDBMainThreadBridge> create(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + { + return adoptRef(new AllowIndexedDBMainThreadBridge(webWorkerClientImpl, mode, name)); + } + + // These methods are invoked on the worker context. + void cancel() + { + MutexLocker locker(m_mutex); + m_webWorkerClientImpl = 0; + } + + bool result() + { + return m_result; + } + + // This method is invoked on the main thread. + void signalCompleted(bool result, const String& mode) + { + MutexLocker locker(m_mutex); + if (m_webWorkerClientImpl) + m_webWorkerClientImpl->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), mode); + } + +private: + AllowIndexedDBMainThreadBridge(WebWorkerClientImpl* webWorkerClientImpl, const String& mode, const String& name) + : m_result(false) + , m_webWorkerClientImpl(webWorkerClientImpl) + { + WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(webWorkerClientImpl->view()->mainFrame()); + // webFrame is not deleted as long as the process is alive, relying on + // it to exist on the main thread should be ok. + WebWorkerBase::dispatchTaskToMainThread( + createCallbackTask(&allowIndexedDBTask, this, WebCore::AllowCrossThreadAccess(webFrame), name, mode)); + } + + static void allowIndexedDBTask(ScriptExecutionContext*, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, PassRefPtr<WebFrameImpl> prpWebFrame, const String& name, const String& mode) + { + RefPtr<WebFrameImpl> webFrame = prpWebFrame; + WebViewImpl* webView = webFrame->viewImpl(); + if (!webView) { + bridge->signalCompleted(false, mode); + return; + } + bool allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame.get(), name, WebSecurityOrigin()); + bridge->signalCompleted(allowed, mode); + } + + static void didComplete(ScriptExecutionContext* context, PassRefPtr<AllowIndexedDBMainThreadBridge> bridge, bool result) + { + bridge->m_result = result; + } + + bool m_result; + Mutex m_mutex; + // WebWorkerClientImpl is never deleted as long as the renderer process + // is alive. We use it on the main thread to notify the worker thread that + // the permission result has been set. The underlying message proxy object + // is valid as long as the worker run loop hasn't returned + // MessageQueueTerminated, in which case we don't use the + // WebWorkerClientImpl. + WebWorkerClientImpl* m_webWorkerClientImpl; +}; + +bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) { - return true; + WebWorkerClientImpl* webWorkerClientImpl = static_cast<WebWorkerClientImpl*>(&workerContext->thread()->workerLoaderProxy()); + WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + + String mode = allowIndexedDBMode; + mode.append(String::number(runLoop.createUniqueId())); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerClientImpl, mode, name); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + return false; + } + + return bridge->result(); } void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir) diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 494822376..ee2e89a42 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -124,9 +124,9 @@ void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned) // Do nothing; } -void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) +void InspectorFrontendClientImpl::openInNewTab(const String& url) { - m_client->saveAs(fileName, content); + m_client->openInNewTab(url); } bool InspectorFrontendClientImpl::canSaveAs() @@ -134,6 +134,11 @@ bool InspectorFrontendClientImpl::canSaveAs() return true; } +void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content) +{ + m_client->saveAs(fileName, content); +} + void InspectorFrontendClientImpl::inspectedURLChanged(const String& url) { m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url); diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h index d8e9a3669..4f7a72b96 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -66,6 +66,9 @@ public: virtual void requestDetachWindow(); virtual void requestSetDockSide(const String&); virtual void changeAttachedWindowHeight(unsigned); + + virtual void openInNewTab(const String& url); + virtual bool canSaveAs(); virtual void saveAs(const WTF::String& fileName, const WTF::String& content); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index edf1da7a3..5f43a9ab3 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -45,6 +45,7 @@ NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPain #endif m_graphicsLayer->setDrawsContent(true); m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true); + m_graphicsLayer->platformLayer()->setBackgroundCoversViewport(true); m_graphicsLayer->platformLayer()->setOpaque(true); } @@ -77,6 +78,20 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) ASSERT(scrollLayer()); } +static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::LayerChromium* clipLayer) +{ + // Scrollbars and corners are known to be attached outside the root clip + // rect, so skip the clipLayer subtree. + if (layer == clipLayer) + return; + + for (size_t i = 0; i < layer->children().size(); ++i) + reserveScrollbarLayers(layer->children()[i].get(), clipLayer); + + if (layer->drawsContent()) + layer->setAlwaysReserveTextures(true); +} + void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale, int layerAdjustX) { if (!scrollLayer()) @@ -105,6 +120,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, if (m_graphicsLayer->pageScaleFactor() != pageScale) m_graphicsLayer->deviceOrPageScaleFactorChanged(); + + WebCore::LayerChromium* clipLayer = scrollLayer()->parent(); + WebCore::LayerChromium* rootLayer = clipLayer; + while (rootLayer->parent()) + rootLayer = rootLayer->parent(); + reserveScrollbarLayers(rootLayer, clipLayer); } WebCore::LayerChromium* NonCompositedContentHost::scrollLayer() @@ -150,12 +171,12 @@ void NonCompositedContentHost::setShowDebugBorders(bool showDebugBorders) m_graphicsLayer->updateDebugIndicators(); } -bool NonCompositedContentHost::showDebugBorders() const +bool NonCompositedContentHost::showDebugBorders(const WebCore::GraphicsLayer*) const { return m_showDebugBorders; } -bool NonCompositedContentHost::showRepaintCounter() const +bool NonCompositedContentHost::showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 2ae85b736..be9f509a2 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -71,8 +71,8 @@ private: virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifySyncRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); - virtual bool showDebugBorders() const; - virtual bool showRepaintCounter() const; + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; WebCore::LayerChromium* scrollLayer(); diff --git a/Source/WebKit/chromium/src/PageOverlay.cpp b/Source/WebKit/chromium/src/PageOverlay.cpp index 6bbb69581..5f16d29c2 100644 --- a/Source/WebKit/chromium/src/PageOverlay.cpp +++ b/Source/WebKit/chromium/src/PageOverlay.cpp @@ -98,12 +98,12 @@ public: return m_webViewImpl->pageScaleFactor(); } - virtual bool showDebugBorders() const + virtual bool showDebugBorders(const GraphicsLayer*) const { return m_webViewImpl->page()->settings()->showDebugBorders(); } - virtual bool showRepaintCounter() const + virtual bool showRepaintCounter(const GraphicsLayer*) const { return m_webViewImpl->page()->settings()->showRepaintCounter(); } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 24681ec96..7ed80bb24 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -1092,30 +1092,22 @@ bool PlatformSupport::screenIsMonochrome(Widget* widget) return client->screenInfo().isMonochrome; } -IntRect PlatformSupport::screenRect(Widget* widget) +IntRect PlatformSupport::screenRect(FrameView* frameView) { - WebWidgetClient* client = toWebWidgetClient(widget); + WebWidgetClient* client = toWebWidgetClient(frameView); if (!client) return IntRect(); return client->screenInfo().rect; } -IntRect PlatformSupport::screenAvailableRect(Widget* widget) +IntRect PlatformSupport::screenAvailableRect(FrameView* frameView) { - WebWidgetClient* client = toWebWidgetClient(widget); + WebWidgetClient* client = toWebWidgetClient(frameView); if (!client) return IntRect(); return client->screenInfo().availableRect; } -double PlatformSupport::screenRefreshRate(Widget* widget) -{ - WebWidgetClient* client = toWebWidgetClient(widget); - if (!client) - return 0; - return client->screenInfo().refreshRate; -} - bool PlatformSupport::popupsAllowed(NPP npp) { // FIXME: Give the embedder a way to control this. diff --git a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp index 17f5dc210..e7aae4263 100644 --- a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp +++ b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp @@ -34,6 +34,7 @@ #include "SharedWorkerRepository.h" +#include "ContentSecurityPolicy.h" #include "Event.h" #include "EventNames.h" #include "ExceptionCode.h" @@ -42,13 +43,14 @@ #include "PlatformMessagePortChannel.h" #include "ScriptExecutionContext.h" #include "SharedWorker.h" +#include "WebContentSecurityPolicy.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebMessagePortChannel.h" #include "WebSharedWorker.h" #include "WebSharedWorkerRepository.h" +#include "platform/WebKitPlatformSupport.h" #include "platform/WebString.h" #include "platform/WebURL.h" #include "WorkerScriptLoader.h" @@ -168,7 +170,10 @@ void SharedWorkerScriptLoader::notifyFinished() } else { InspectorInstrumentation::scriptImported(m_worker->scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script()); // Pass the script off to the worker, then send a connect event. - m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader->script(), m_responseAppCacheID); + m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader->script(), + m_worker->scriptExecutionContext()->contentSecurityPolicy()->policy(), + static_cast<WebKit::WebContentSecurityPolicyType>(m_worker->scriptExecutionContext()->contentSecurityPolicy()->headerType()), + m_responseAppCacheID); sendConnect(); } } diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp index 67a7c34b9..9c0bf58e1 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp @@ -38,6 +38,7 @@ #include "WebViewClient.h" #include "WebViewImpl.h" #include "platform/WebMediaStreamSource.h" +#include <wtf/RefPtr.h> using namespace WebCore; @@ -52,10 +53,19 @@ void UserMediaClientImpl::pageDestroyed() { } -void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> request, const MediaStreamSourceVector& sources) +void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) { - if (m_client) - m_client->requestUserMedia(request, sources); + if (m_client) { + RefPtr<UserMediaRequest> request = prpRequest; + + // FIXME: Cleanup when the chromium code has switched to the split sources implementation. + MediaStreamSourceVector combinedSources; + combinedSources.append(audioSources); + combinedSources.append(videoSources); + m_client->requestUserMedia(PassRefPtr<UserMediaRequest>(request.get()), combinedSources); + + m_client->requestUserMedia(request.release(), audioSources, videoSources); + } } void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request) diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.h b/Source/WebKit/chromium/src/UserMediaClientImpl.h index ef36a4818..f0871236b 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.h +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.h @@ -50,7 +50,7 @@ public: // WebCore::UserMediaClient ---------------------------------------------- virtual void pageDestroyed(); - virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&); + virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&, const WebCore::MediaStreamSourceVector&); virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*); private: diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index 806bfd809..489347bf2 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -870,6 +870,24 @@ unsigned WebAccessibilityObject::cellRowSpan() const return rowRange.second; } +void WebAccessibilityObject::scrollToMakeVisible() const +{ + m_private->updateBackingStore(); + m_private->scrollToMakeVisible(); +} + +void WebAccessibilityObject::scrollToMakeVisibleWithSubFocus(const WebRect& subfocus) const +{ + m_private->updateBackingStore(); + m_private->scrollToMakeVisibleWithSubFocus(subfocus); +} + +void WebAccessibilityObject::scrollToGlobalPoint(const WebPoint& point) const +{ + m_private->updateBackingStore(); + m_private->scrollToGlobalPoint(point); +} + WebAccessibilityObject::WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>& object) : m_private(object) { diff --git a/Source/WebKit/chromium/src/WebAudioBus.cpp b/Source/WebKit/chromium/src/WebAudioBus.cpp index 50e3814cc..cc447ba20 100644 --- a/Source/WebKit/chromium/src/WebAudioBus.cpp +++ b/Source/WebKit/chromium/src/WebAudioBus.cpp @@ -110,7 +110,7 @@ float* WebAudioBus::channelData(unsigned channelIndex) if (!m_private) return 0; ASSERT(channelIndex < numberOfChannels()); - return m_private->channel(channelIndex)->data(); + return m_private->channel(channelIndex)->mutableData(); #else ASSERT_NOT_REACHED(); return 0; diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index ea083de56..4f64d5471 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -52,7 +52,7 @@ WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient) WebContentLayerImpl::~WebContentLayerImpl() { - setDelegate(0); + clearDelegate(); } void WebContentLayerImpl::setDrawsContent(bool drawsContent) diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index bc1e26008..51f344f7c 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -32,7 +32,7 @@ namespace WebKit { class WebContentLayerClient; -class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::CCLayerDelegate { +class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate { public: static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient); @@ -41,6 +41,8 @@ public: protected: explicit WebContentLayerImpl(WebContentLayerClient* contentClient); virtual ~WebContentLayerImpl(); + + // ContentLayerDelegate implementation. virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip); WebContentLayerClient* m_contentClient; diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index e821f0b1e..52eb37400 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -227,7 +227,7 @@ void WebDevToolsAgentImpl::didNavigate() void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) { WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame()); - if (proxy) + if (proxy && webframe->frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) proxy->setContextDebugId(m_hostId); } diff --git a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp index 47f6bd188..098cb425c 100644 --- a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp +++ b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp @@ -41,6 +41,8 @@ WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrien m_beta = 0; m_canProvideGamma = false; m_gamma = 0; + m_canProvideAbsolute = false; + m_absolute = false; return; } @@ -51,6 +53,8 @@ WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrien m_beta = orientation->beta(); m_canProvideGamma = orientation->canProvideGamma(); m_gamma = orientation->gamma(); + m_canProvideAbsolute = orientation->canProvideAbsolute(); + m_absolute = orientation->absolute(); } WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore::DeviceOrientation>& orientation) @@ -63,6 +67,8 @@ WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore:: m_beta = 0; m_canProvideGamma = false; m_gamma = 0; + m_canProvideAbsolute = false; + m_absolute = false; return *this; } @@ -73,6 +79,8 @@ WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore:: m_beta = orientation->beta(); m_canProvideGamma = orientation->canProvideGamma(); m_gamma = orientation->gamma(); + m_canProvideAbsolute = orientation->canProvideAbsolute(); + m_absolute = orientation->absolute(); return *this; } @@ -80,7 +88,7 @@ WebDeviceOrientation::operator PassRefPtr<WebCore::DeviceOrientation>() const { if (m_isNull) return 0; - return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma); + return WebCore::DeviceOrientation::create(m_canProvideAlpha, m_alpha, m_canProvideBeta, m_beta, m_canProvideGamma, m_gamma, m_canProvideAbsolute, m_absolute); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp index 4d439fd43..ec6c29060 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp @@ -39,7 +39,7 @@ PassRefPtr<WebExternalTextureLayerImpl> WebExternalTextureLayerImpl::create() } WebExternalTextureLayerImpl::WebExternalTextureLayerImpl() - : PluginLayerChromium(this) + : PluginLayerChromium() { setFlipped(false); setIsDrawable(true); @@ -47,7 +47,6 @@ WebExternalTextureLayerImpl::WebExternalTextureLayerImpl() WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { - setDelegate(0); } bool WebExternalTextureLayerImpl::drawsContent() const @@ -55,8 +54,4 @@ bool WebExternalTextureLayerImpl::drawsContent() const return !!textureId() && LayerChromium::drawsContent(); } -void WebExternalTextureLayerImpl::paintContents(GraphicsContext&, const IntRect&) -{ -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h index 1ad2b8199..7b73e7080 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h @@ -31,14 +31,13 @@ namespace WebKit { -class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium, public WebCore::CCLayerDelegate { +class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium { public: static PassRefPtr<WebExternalTextureLayerImpl> create(); protected: WebExternalTextureLayerImpl(); virtual ~WebExternalTextureLayerImpl(); - virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip); virtual bool drawsContent() const; }; diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 2e8a328f8..2524cf45b 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -106,6 +106,7 @@ #include "IconURL.h" #include "InspectorController.h" #include "KURL.h" +#include "Node.h" #include "Page.h" #include "PageOverlay.h" #include "painting/GraphicsContextBuilder.h" @@ -133,6 +134,7 @@ #include "SecurityPolicy.h" #include "Settings.h" #include "SkiaUtils.h" +#include "SpellChecker.h" #include "SubstituteData.h" #include "TextAffinity.h" #include "TextIterator.h" @@ -858,9 +860,7 @@ void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) return; } - frame()->domWindow()->console()->addMessage( - OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text, - 1, String()); + frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, webCoreMessageLevel, message.text); } void WebFrameImpl::collectGarbage() @@ -1296,6 +1296,16 @@ bool WebFrameImpl::isContinuousSpellCheckingEnabled() const return frame()->editor()->isContinuousSpellCheckingEnabled(); } +void WebFrameImpl::requestTextChecking(const WebElement& webElem) +{ + if (webElem.isNull()) + return; + + RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(webElem.constUnwrap<Element>())); + + frame()->editor()->spellChecker()->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, rangeToCheck, rangeToCheck)); +} + bool WebFrameImpl::hasSelection() const { WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); @@ -1374,7 +1384,7 @@ void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) { - HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove; + HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; hitType |= HitTestRequest::ReadOnly; hitType |= HitTestRequest::Active; HitTestRequest request(hitType); @@ -2154,11 +2164,18 @@ void WebFrameImpl::setFindEndstateFocusAndSelection() // Try to find the first focusable node up the chain, which will, for // example, focus links if we have found text within the link. Node* node = m_activeMatch->firstNode(); + if (node && node->isInShadowTree()) { + Node* host = node->shadowAncestorNode(); + if (host->hasTagName(HTMLNames::inputTag) || host->hasTagName(HTMLNames::textareaTag)) + node = host; + } while (node && !node->isFocusable() && node != frame()->document()) node = node->parentNode(); if (node && node != frame()->document()) { - // Found a focusable parent node. Set focus to it. + // Found a focusable parent node. Set the active match as the + // selection and focus to the focusable node. + frame()->selection()->setSelection(m_activeMatch.get()); frame()->document()->setFocusedNode(node); return; } diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 23e60d980..de38d0dca 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -158,6 +158,7 @@ public: virtual bool isCommandEnabled(const WebString&) const; virtual void enableContinuousSpellChecking(bool); virtual bool isContinuousSpellCheckingEnabled() const; + virtual void requestTextChecking(const WebElement&); virtual bool hasSelection() const; virtual WebRange selectionRange() const; virtual WebString selectionAsText() const; diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp index 35be9f3b2..25be6c52f 100644 --- a/Source/WebKit/chromium/src/WebIDBKey.cpp +++ b/Source/WebKit/chromium/src/WebIDBKey.cpp @@ -76,10 +76,18 @@ WebIDBKey WebIDBKey::createInvalid() return key; } +WebIDBKey WebIDBKey::createNull() +{ + WebIDBKey key; + key.assignNull(); + return key; +} + WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) { + // FIXME: If key path is empty string, this should return invalid key instead if (serializedScriptValue.isNull()) - return WebIDBKey::createInvalid(); + return WebIDBKey::createNull(); return createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); } @@ -112,6 +120,7 @@ static PassRefPtr<IDBKey> convertFromWebIDBKeyArray(const WebVector<WebIDBKey>& keys.append(IDBKey::createNumber(array[i].number())); break; case WebIDBKey::InvalidType: + case WebIDBKey::NullType: ASSERT_NOT_REACHED(); break; } @@ -170,6 +179,11 @@ void WebIDBKey::assignNumber(double number) void WebIDBKey::assignInvalid() { + m_private = IDBKey::createInvalid(); +} + +void WebIDBKey::assignNull() +{ m_private = 0; } @@ -181,7 +195,7 @@ void WebIDBKey::reset() WebIDBKey::Type WebIDBKey::type() const { if (!m_private.get()) - return InvalidType; + return NullType; return Type(m_private->type()); } diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 38d8a5502..ddd4736ab 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -149,6 +149,12 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; break; + case WebInputEvent::GestureTapDown: + m_type = PlatformEvent::GestureTapDown; + break; + case WebInputEvent::GestureDoubleTap: + m_type = PlatformEvent::GestureDoubleTap; + break; default: ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index 13540e162..77d766d76 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -31,48 +31,75 @@ #include "config.h" #include "WebIntent.h" -namespace WebKit { +#include "Intent.h" +#include "SerializedScriptValue.h" -WebIntent::WebIntent() { } +namespace WebKit { -WebString WebIntent::action() const +#if ENABLE(WEB_INTENTS) +WebIntent::WebIntent(const PassRefPtr<WebCore::Intent>& intent) + : m_private(intent) { - return m_action; } +#endif -void WebIntent::setAction(const WebString& action) +void WebIntent::reset() { - m_action = action; +#if ENABLE(WEB_INTENTS) + m_private.reset(); +#endif } -WebString WebIntent::type() const +bool WebIntent::isNull() const { - return m_type; +#if ENABLE(WEB_INTENTS) + return m_private.isNull(); +#else + return true; +#endif } -void WebIntent::setType(const WebString& type) +bool WebIntent::equals(const WebIntent& other) const { - m_type = type; +#if ENABLE(WEB_INTENTS) + return (m_private.get() == other.m_private.get()); +#else + return true; +#endif } -WebString WebIntent::data() const +void WebIntent::assign(const WebIntent& other) { - return m_data; +#if ENABLE(WEB_INTENTS) + m_private = other.m_private; +#endif } -void WebIntent::setData(const WebString& data) +WebString WebIntent::action() const { - m_data = data; +#if ENABLE(WEB_INTENTS) + return m_private->action(); +#else + return WebString(); +#endif } -int WebIntent::identifier() const +WebString WebIntent::type() const { - return m_identifier; +#if ENABLE(WEB_INTENTS) + return m_private->type(); +#else + return WebString(); +#endif } -void WebIntent::setIdentifier(int identifier) +WebString WebIntent::data() const { - m_identifier = identifier; +#if ENABLE(WEB_INTENTS) + return m_private->data()->toWireString(); +#else + return WebString(); +#endif } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h b/Source/WebKit/chromium/src/WebIntentRequest.cpp index 05bfd52a8..64d341217 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.h +++ b/Source/WebKit/chromium/src/WebIntentRequest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2011 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 @@ -28,52 +28,78 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSpeechInputControllerMockImpl_h -#define WebSpeechInputControllerMockImpl_h +#include "config.h" +#include "WebIntentRequest.h" -#include "SpeechInputListener.h" -#include "WebSpeechInputControllerMock.h" -#include "WebSpeechInputListener.h" -#include "platform/WebString.h" -#include <wtf/OwnPtr.h> +#include "Intent.h" +#include "IntentRequest.h" +#include "SerializedScriptValue.h" +#include "WebIntent.h" +#include "platform/WebSerializedScriptValue.h" -#if ENABLE(INPUT_SPEECH) +namespace WebKit { -namespace WebCore { -class SpeechInputClientMock; +#if ENABLE(WEB_INTENTS) +WebIntentRequest::WebIntentRequest(const PassRefPtr<WebCore::IntentRequest>& intentRequest) + : m_private(intentRequest) +{ } +#endif -namespace WebKit { - -struct WebRect; +void WebIntentRequest::reset() +{ +#if ENABLE(WEB_INTENTS) + m_private.reset(); +#endif +} -class WebSpeechInputControllerMockImpl : public WebCore::SpeechInputListener - , public WebSpeechInputControllerMock { -public: - WebSpeechInputControllerMockImpl(WebSpeechInputListener*); - virtual ~WebSpeechInputControllerMockImpl(); +bool WebIntentRequest::isNull() const +{ +#if ENABLE(WEB_INTENTS) + return m_private.isNull(); +#else + return true; +#endif +} - // WebCore::SpeechInputListener methods. - void didCompleteRecording(int requestId); - void didCompleteRecognition(int requestId); - void setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result); +bool WebIntentRequest::equals(const WebIntentRequest& other) const +{ +#if ENABLE(WEB_INTENTS) + return (m_private.get() == other.m_private.get()); +#else + return true; +#endif +} - // WebSpeechInputController methods. - bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin&); - void cancelRecognition(int requestId); - void stopRecording(int requestId); +void WebIntentRequest::assign(const WebIntentRequest& other) +{ +#if ENABLE(WEB_INTENTS) + m_private = other.m_private; +#endif +} - // WebSpeechInputControllerMock methods. - void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language); - void clearResults(); +WebIntent WebIntentRequest::intent() const +{ +#if ENABLE(WEB_INTENTS) + return WebIntent(m_private->intent()); +#else + return WebIntent(); +#endif +} -private: - OwnPtr<WebCore::SpeechInputClientMock> m_webcoreMock; - WebSpeechInputListener* m_listener; -}; +void WebIntentRequest::postResult(const WebSerializedScriptValue& data) +{ +#if ENABLE(WEB_INTENTS) + m_private->postResult(PassRefPtr<WebCore::SerializedScriptValue>(data).get()); +#endif +} -} // namespace WebKit +void WebIntentRequest::postFailure(const WebSerializedScriptValue& data) +{ +#if ENABLE(WEB_INTENTS) + m_private->postFailure(PassRefPtr<WebCore::SerializedScriptValue>(data).get()); +#endif +} -#endif // ENABLE(INPUT_SPEECH) -#endif // WebSpeechInputControllerMockImpl_h +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp b/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp index bd1983488..f08ab4885 100644 --- a/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp +++ b/Source/WebKit/chromium/src/WebIntentServiceInfo.cpp @@ -83,4 +83,17 @@ void WebIntentServiceInfo::setDisposition(const WebString& disposition) m_disposition = disposition; } +WebIntentServiceInfo::WebIntentServiceInfo(const WebString& action, + const WebString& type, + const WebURL& href, + const WebString& title, + const WebString& disposition) + : m_action(action) + , m_type(type) + , m_href(href) + , m_title(title) + , m_disposition(disposition) +{ +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index 07a162d64..13721be0c 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -36,7 +36,7 @@ PassRefPtr<WebLayerImpl> WebLayerImpl::create() } WebLayerImpl::WebLayerImpl() - : LayerChromium(this) + : LayerChromium() { // Make sure that this layer does not draw content. This way we don't have to override // the base class implementation of drawsContent(). @@ -45,7 +45,6 @@ WebLayerImpl::WebLayerImpl() WebLayerImpl::~WebLayerImpl() { - setDelegate(0); } void WebLayerImpl::paintContents(GraphicsContext&, const IntRect& clip) diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 6bda83f54..3884c42bc 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -31,7 +31,7 @@ namespace WebKit { -class WebLayerImpl : public WebCore::LayerChromium, public WebCore::CCLayerDelegate { +class WebLayerImpl : public WebCore::LayerChromium { public: static PassRefPtr<WebLayerImpl> create(); diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 891c31f3f..996e70710 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -120,7 +120,7 @@ void WebMediaPlayerClientImpl::readyStateChanged() m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { - m_videoLayer = VideoLayerChromium::create(0, this); + m_videoLayer = VideoLayerChromium::create(this); m_videoLayer->setOpaque(m_opaque); } #endif @@ -603,7 +603,7 @@ VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() { MutexLocker locker(m_compositingMutex); ASSERT(!m_currentVideoFrame); - if (m_webMediaPlayer && !m_currentVideoFrame) { + if (m_webMediaPlayer) { WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); if (webkitVideoFrame) m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame)); @@ -614,14 +614,14 @@ VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) { MutexLocker locker(m_compositingMutex); - if (videoFrame && videoFrame == m_currentVideoFrame) { - if (m_webMediaPlayer) { - m_webMediaPlayer->putCurrentFrame( - VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); - } - ASSERT(videoFrame == m_currentVideoFrame); - m_currentVideoFrame.clear(); + ASSERT(videoFrame == m_currentVideoFrame); + if (!videoFrame) + return; + if (m_webMediaPlayer) { + m_webMediaPlayer->putCurrentFrame( + VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); } + m_currentVideoFrame.clear(); } #endif @@ -726,7 +726,7 @@ void WebMediaPlayerClientImpl::AudioSourceProviderImpl::provideInput(AudioBus* b size_t n = bus->numberOfChannels(); WebVector<float*> webAudioData(n); for (size_t i = 0; i < n; ++i) - webAudioData[i] = bus->channel(i)->data(); + webAudioData[i] = bus->channel(i)->mutableData(); m_webAudioSourceProvider->provideInput(webAudioData, framesToProcess); } diff --git a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp index 0cf53c0eb..7daf329e5 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp @@ -60,12 +60,35 @@ WebString WebMediaStreamDescriptor::label() const return m_private->label(); } +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSources) const { - size_t numberOfSources = m_private->numberOfComponents(); + size_t numberOfAudioSources = m_private->numberOfAudioComponents(); + size_t numberOfVideoSources = m_private->numberOfVideoComponents(); + WebVector<WebMediaStreamSource> result(numberOfAudioSources + numberOfVideoSources); + size_t i = 0; + for (size_t j = 0; j < numberOfAudioSources; ++i, ++j) + result[i] = m_private->audioComponent(j)->source(); + for (size_t j = 0; j < numberOfVideoSources; ++i, ++j) + result[i] = m_private->videoComponent(j)->source(); + webSources.swap(result); +} + +void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamSource>& webSources) const +{ + size_t numberOfSources = m_private->numberOfAudioComponents(); + WebVector<WebMediaStreamSource> result(numberOfSources); + for (size_t i = 0; i < numberOfSources; ++i) + result[i] = m_private->audioComponent(i)->source(); + webSources.swap(result); +} + +void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamSource>& webSources) const +{ + size_t numberOfSources = m_private->numberOfVideoComponents(); WebVector<WebMediaStreamSource> result(numberOfSources); for (size_t i = 0; i < numberOfSources; ++i) - result[i] = m_private->component(i)->source(); + result[i] = m_private->videoComponent(i)->source(); webSources.swap(result); } @@ -85,14 +108,37 @@ WebMediaStreamDescriptor::operator WebCore::MediaStreamDescriptor*() const return m_private.get(); } +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& sources) { - MediaStreamSourceVector s; + MediaStreamSourceVector audio, video; for (size_t i = 0; i < sources.size(); ++i) { MediaStreamSource* curr = sources[i]; - s.append(curr); + if (curr->type() == MediaStreamSource::TypeAudio) + audio.append(curr); + else if (curr->type() == MediaStreamSource::TypeVideo) + video.append(curr); + } + m_private = MediaStreamDescriptor::create(label, audio, video); +} + +void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) +{ + MediaStreamSourceVector audio, video; + for (size_t i = 0; i < audioSources.size(); ++i) { + MediaStreamSource* curr = audioSources[i]; + audio.append(curr); } - m_private = MediaStreamDescriptor::create(label, s); + for (size_t i = 0; i < videoSources.size(); ++i) { + MediaStreamSource* curr = videoSources[i]; + video.append(curr); + } + m_private = MediaStreamDescriptor::create(label, audio, video); +} + +void WebMediaStreamDescriptor::assign(const WebMediaStreamDescriptor& other) +{ + m_private = other.m_private; } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp b/Source/WebKit/chromium/src/WebMediaStreamSource.cpp index fe826f18b..a9fac4b06 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamSource.cpp @@ -53,6 +53,11 @@ WebMediaStreamSource& WebMediaStreamSource::operator=(WebCore::MediaStreamSource return *this; } +void WebMediaStreamSource::assign(const WebMediaStreamSource& other) +{ + m_private = other.m_private; +} + void WebMediaStreamSource::reset() { m_private.reset(); diff --git a/Source/WebKit/chromium/src/WebNode.cpp b/Source/WebKit/chromium/src/WebNode.cpp index a4a26f2ee..69908c9b7 100644 --- a/Source/WebKit/chromium/src/WebNode.cpp +++ b/Source/WebKit/chromium/src/WebNode.cpp @@ -42,6 +42,7 @@ #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDocument.h" +#include "WebElement.h" #include "WebFrameImpl.h" #include "WebNodeList.h" #include "platform/WebString.h" @@ -207,6 +208,11 @@ WebNodeList WebNode::getElementsByTagName(const WebString& tag) const return WebNodeList(m_private->getElementsByTagName(tag)); } +WebElement WebNode::rootEditableElement() const +{ + return WebElement(m_private->rootEditableElement()); +} + bool WebNode::hasNonEmptyBoundingBox() const { return m_private->hasNonEmptyBoundingBox(); diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index fd2690a9f..da0e32555 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -283,7 +283,7 @@ void WebPageSerializerImpl::encodeAndFlushBuffer( return; String content = m_dataBuffer.toString(); - m_dataBuffer = StringBuilder(); + m_dataBuffer.clear(); // Convert the unicode content to target encoding CString encodedContent = param->textEncoding.encode( @@ -307,7 +307,7 @@ void WebPageSerializerImpl::openTagToString(Element* element, // Add open tag result += "<" + element->nodeName().lower(); // Go through all attributes and serialize them. - const NamedNodeMap *attrMap = element->attributes(true); + const NamedNodeMap *attrMap = element->updatedAttributes(); if (attrMap) { unsigned numAttrs = attrMap->length(); for (unsigned i = 0; i < numAttrs; i++) { diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 95eca8891..a8f6d126b 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -537,7 +537,7 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme , m_element(element) , m_webPlugin(webPlugin) #if USE(ACCELERATED_COMPOSITING) - , m_platformLayer(PluginLayerChromium::create(0)) + , m_platformLayer(PluginLayerChromium::create()) #endif { } diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 84c66a6d2..687b03360 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -32,25 +32,23 @@ #include "WebPopupMenuImpl.h" #include "Cursor.h" -#include "FramelessScrollView.h" #include "FrameView.h" +#include "FramelessScrollView.h" #include "IntRect.h" #include "NotImplemented.h" -#include "painting/GraphicsContextBuilder.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "PopupContainer.h" #include "PopupMenuChromium.h" #include "SkiaUtils.h" - #include "WebInputEvent.h" #include "WebInputEventConversion.h" #include "WebRange.h" -#include "platform/WebRect.h" #include "WebViewClient.h" #include "WebWidgetClient.h" - +#include "painting/GraphicsContextBuilder.h" +#include "platform/WebRect.h" #include <skia/ext/platform_canvas.h> #if ENABLE(GESTURE_RECOGNIZER) @@ -79,7 +77,7 @@ WebPopupMenuImpl::WebPopupMenuImpl(WebWidgetClient* client) , m_gestureRecognizer(WebCore::PlatformGestureRecognizer::create()) #endif { - // set to impossible point so we always get the first mouse pos + // Set to impossible point so we always get the first mouse position. m_lastMousePosition = WebPoint(-1, -1); } @@ -89,20 +87,20 @@ WebPopupMenuImpl::~WebPopupMenuImpl() m_widget->setClient(0); } -void WebPopupMenuImpl::Init(FramelessScrollView* widget, const WebRect& bounds) +void WebPopupMenuImpl::init(FramelessScrollView* widget, const WebRect& bounds) { m_widget = widget; m_widget->setClient(this); if (m_client) { m_client->setWindowRect(bounds); - m_client->show(WebNavigationPolicy()); // Policy is ignored + m_client->show(WebNavigationPolicy()); // Policy is ignored. } } -void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) { - // don't send mouse move messages if the mouse hasn't moved. + // Don't send mouse move messages if the mouse hasn't moved. if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { m_lastMousePosition = WebPoint(event.x, event.y); m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); @@ -113,34 +111,34 @@ void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event) } } -void WebPopupMenuImpl::MouseLeave(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) { m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseDown(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) { m_widget->handleMouseDownEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseUp(const WebMouseEvent& event) +void WebPopupMenuImpl::handleMouseUp(const WebMouseEvent& event) { mouseCaptureLost(); m_widget->handleMouseReleaseEvent(PlatformMouseEventBuilder(m_widget, event)); } -void WebPopupMenuImpl::MouseWheel(const WebMouseWheelEvent& event) +void WebPopupMenuImpl::handleMouseWheel(const WebMouseWheelEvent& event) { m_widget->handleWheelEvent(PlatformWheelEventBuilder(m_widget, event)); } -bool WebPopupMenuImpl::GestureEvent(const WebGestureEvent& event) +bool WebPopupMenuImpl::handleGestureEvent(const WebGestureEvent& event) { return m_widget->handleGestureEvent(PlatformGestureEventBuilder(m_widget, event)); } #if ENABLE(TOUCH_EVENTS) -bool WebPopupMenuImpl::TouchEvent(const WebTouchEvent& event) +bool WebPopupMenuImpl::handleTouchEvent(const WebTouchEvent& event) { PlatformTouchEventBuilder touchEventBuilder(m_widget, event); @@ -154,7 +152,7 @@ bool WebPopupMenuImpl::TouchEvent(const WebTouchEvent& event) } #endif -bool WebPopupMenuImpl::KeyEvent(const WebKeyboardEvent& event) +bool WebPopupMenuImpl::handleKeyEvent(const WebKeyboardEvent& event) { return m_widget->handleKeyEvent(PlatformKeyboardEventBuilder(event)); } @@ -168,7 +166,7 @@ void WebPopupMenuImpl::close() m_client = 0; - deref(); // Balances ref() from WebWidget::Create + deref(); // Balances ref() from WebPopupMenu::create. } void WebPopupMenuImpl::willStartLiveResize() @@ -218,7 +216,7 @@ void WebPopupMenuImpl::themeChanged() notImplemented(); } -void WebPopupMenuImpl::composite(bool finish) +void WebPopupMenuImpl::composite(bool) { notImplemented(); } @@ -228,28 +226,28 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) if (!m_widget) return false; - // TODO (jcampan): WebKit seems to always return false on mouse events - // methods. For now we'll assume it has processed them (as we are only - // interested in whether keyboard events are processed). + // FIXME: WebKit seems to always return false on mouse events methods. For + // now we'll assume it has processed them (as we are only interested in + // whether keyboard events are processed). switch (inputEvent.type) { case WebInputEvent::MouseMove: - MouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseLeave: - MouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseWheel: - MouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); + handleMouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent)); return true; case WebInputEvent::MouseDown: - MouseDown(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseDown(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; case WebInputEvent::MouseUp: - MouseUp(*static_cast<const WebMouseEvent*>(&inputEvent)); + handleMouseUp(*static_cast<const WebMouseEvent*>(&inputEvent)); return true; // In Windows, RawKeyDown only has information about the physical key, but @@ -264,13 +262,13 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::KeyDown: case WebInputEvent::KeyUp: case WebInputEvent::Char: - return KeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); + return handleKeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent)); case WebInputEvent::TouchStart: case WebInputEvent::TouchMove: case WebInputEvent::TouchEnd: case WebInputEvent::TouchCancel: - return TouchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); + return handleTouchEvent(*static_cast<const WebTouchEvent*>(&inputEvent)); case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: @@ -278,7 +276,9 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: - return GestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); + case WebInputEvent::GestureTapDown: + case WebInputEvent::GestureDoubleTap: + return handleGestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); case WebInputEvent::Undefined: case WebInputEvent::MouseEnter: @@ -292,7 +292,7 @@ void WebPopupMenuImpl::mouseCaptureLost() { } -void WebPopupMenuImpl::setFocus(bool enable) +void WebPopupMenuImpl::setFocus(bool) { } @@ -301,9 +301,7 @@ void WebPopupMenu::setMinimumRowHeight(int minimumRowHeight) PopupMenuChromium::setMinimumRowHeight(minimumRowHeight); } -bool WebPopupMenuImpl::setComposition( - const WebString& text, const WebVector<WebCompositionUnderline>& underlines, - int selectionStart, int selectionEnd) +bool WebPopupMenuImpl::setComposition(const WebString&, const WebVector<WebCompositionUnderline>&, int, int) { return false; } @@ -313,7 +311,7 @@ bool WebPopupMenuImpl::confirmComposition() return false; } -bool WebPopupMenuImpl::confirmComposition(const WebString& text) +bool WebPopupMenuImpl::confirmComposition(const WebString&) { return false; } @@ -337,7 +335,7 @@ bool WebPopupMenuImpl::caretOrSelectionRange(size_t* location, size_t* length) return false; } -void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) +void WebPopupMenuImpl::setTextDirection(WebTextDirection) { } @@ -345,11 +343,6 @@ void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) //----------------------------------------------------------------------------- // WebCore::HostWindow -void WebPopupMenuImpl::invalidateContents(const IntRect&, bool) -{ - notImplemented(); -} - void WebPopupMenuImpl::invalidateRootView(const IntRect&, bool) { notImplemented(); @@ -372,9 +365,7 @@ void WebPopupMenuImpl::scheduleAnimation() { } -void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, - const IntRect& scrollRect, - const IntRect& clipRect) +void WebPopupMenuImpl::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) { if (m_client) { int dx = scrollDelta.width(); @@ -395,12 +386,6 @@ IntRect WebPopupMenuImpl::rootViewToScreen(const IntRect& rect) const return IntRect(); } -void WebPopupMenuImpl::scrollRectIntoView(const IntRect&) const -{ - // Nothing to be done here since we do not have the concept of a container - // that implements its own scrolling. -} - void WebPopupMenuImpl::scrollbarsModeDidChange() const { // Nothing to be done since we have no concept of different scrollbar modes. diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index 1dec77c28..0ad03963a 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -32,8 +32,8 @@ #define WebPopupMenuImpl_h #include "FramelessScrollViewClient.h" -#include "platform/WebPoint.h" #include "WebPopupMenu.h" +#include "platform/WebPoint.h" #include "platform/WebSize.h" #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -65,81 +65,78 @@ class WebPopupMenuImpl : public WebPopupMenu, public RefCounted<WebPopupMenuImpl> { WTF_MAKE_FAST_ALLOCATED; public: - // WebWidget - virtual void close(); - virtual WebSize size() { return m_size; } - virtual void willStartLiveResize(); - virtual void resize(const WebSize&); - virtual void willEndLiveResize(); - virtual void animate(double frameBeginTime); - virtual void layout(); - virtual void paint(WebCanvas* canvas, const WebRect& rect); - virtual void themeChanged(); - virtual void composite(bool finish); - virtual bool handleInputEvent(const WebInputEvent&); - virtual void mouseCaptureLost(); - virtual void setFocus(bool enable); + // WebWidget functions: + virtual void close() OVERRIDE; + virtual WebSize size() OVERRIDE { return m_size; } + virtual void willStartLiveResize() OVERRIDE; + virtual void resize(const WebSize&) OVERRIDE; + virtual void willEndLiveResize() OVERRIDE; + virtual void animate(double frameBeginTime) OVERRIDE; + virtual void layout() OVERRIDE; + virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; + virtual void themeChanged() OVERRIDE; + virtual void composite(bool finish) OVERRIDE; + virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE; + virtual void mouseCaptureLost() OVERRIDE; + virtual void setFocus(bool enable) OVERRIDE; virtual bool setComposition( const WebString& text, const WebVector<WebCompositionUnderline>& underlines, - int selectionStart, int selectionEnd); - virtual bool confirmComposition(); - virtual bool confirmComposition(const WebString& text); - virtual bool compositionRange(size_t* location, size_t* length); - virtual WebTextInputType textInputType(); - virtual bool caretOrSelectionRange(size_t* location, size_t* length); - virtual void setTextDirection(WebTextDirection direction); - virtual bool isAcceleratedCompositingActive() const { return false; } + int selectionStart, int selectionEnd) OVERRIDE; + virtual bool confirmComposition() OVERRIDE; + virtual bool confirmComposition(const WebString& text) OVERRIDE; + virtual bool compositionRange(size_t* location, size_t* length) OVERRIDE; + virtual WebTextInputType textInputType() OVERRIDE; + virtual bool caretOrSelectionRange(size_t* location, size_t* length) OVERRIDE; + virtual void setTextDirection(WebTextDirection) OVERRIDE; + virtual bool isAcceleratedCompositingActive() const OVERRIDE { return false; } // WebPopupMenuImpl - void Init(WebCore::FramelessScrollView* widget, - const WebRect& bounds); + void init(WebCore::FramelessScrollView* widget, const WebRect& bounds); WebWidgetClient* client() { return m_client; } - void MouseMove(const WebMouseEvent&); - void MouseLeave(const WebMouseEvent&); - void MouseDown(const WebMouseEvent&); - void MouseUp(const WebMouseEvent&); - void MouseDoubleClick(const WebMouseEvent&); - void MouseWheel(const WebMouseWheelEvent&); - bool GestureEvent(const WebGestureEvent&); - bool TouchEvent(const WebTouchEvent&); - bool KeyEvent(const WebKeyboardEvent&); + void handleMouseMove(const WebMouseEvent&); + void handleMouseLeave(const WebMouseEvent&); + void handleMouseDown(const WebMouseEvent&); + void handleMouseUp(const WebMouseEvent&); + void handleMouseDoubleClick(const WebMouseEvent&); + void handleMouseWheel(const WebMouseWheelEvent&); + bool handleGestureEvent(const WebGestureEvent&); + bool handleTouchEvent(const WebTouchEvent&); + bool handleKeyEvent(const WebKeyboardEvent&); protected: - friend class WebPopupMenu; // For WebPopupMenu::create + friend class WebPopupMenu; // For WebPopupMenu::create. friend class WTF::RefCounted<WebPopupMenuImpl>; - WebPopupMenuImpl(WebWidgetClient* client); + WebPopupMenuImpl(WebWidgetClient*); ~WebPopupMenuImpl(); // WebCore::HostWindow methods: - virtual void invalidateContents(const WebCore::IntRect&, bool); - virtual void invalidateRootView(const WebCore::IntRect&, bool); - virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool); - virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); - virtual void scheduleAnimation(); + virtual void invalidateRootView(const WebCore::IntRect&, bool) OVERRIDE; + virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool) OVERRIDE; + virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool) OVERRIDE; + virtual void scheduleAnimation() OVERRIDE; virtual void scroll( const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, - const WebCore::IntRect& clipRect); - virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const; - virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const; - virtual PlatformPageClient platformPageClient() const { return 0; } - virtual void scrollRectIntoView(const WebCore::IntRect&) const; - virtual void scrollbarsModeDidChange() const; - virtual void setCursor(const WebCore::Cursor&); - virtual void setCursorHiddenUntilMouseMoves(bool); + const WebCore::IntRect& clipRect) OVERRIDE; + virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const OVERRIDE; + virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const OVERRIDE; + virtual PlatformPageClient platformPageClient() const OVERRIDE { return 0; } + virtual void scrollbarsModeDidChange() const OVERRIDE; + virtual void setCursor(const WebCore::Cursor&) OVERRIDE; + virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE; // WebCore::FramelessScrollViewClient methods: - virtual void popupClosed(WebCore::FramelessScrollView*); + virtual void popupClosed(WebCore::FramelessScrollView*) OVERRIDE; WebWidgetClient* m_client; WebSize m_size; WebPoint m_lastMousePosition; - // This is a non-owning ref. The popup will notify us via popupClosed() + // This is a non-owning ref. The popup will notify us via popupClosed() // before it is destroyed. WebCore::FramelessScrollView* m_widget; diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index de6cda186..38963b521 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -432,4 +432,23 @@ bool WebRuntimeFeatures::isGamepadEnabled() #endif } +void WebRuntimeFeatures::enableShadowDOM(bool enable) +{ +#if ENABLE(SHADOW_DOM) + RuntimeEnabledFeatures::setShadowDOMEnabled(enable); +#else + UNUSED_PARAM(enable); +#endif +} + +bool WebRuntimeFeatures::isShadowDOMEnabled() +{ +#if ENABLE(SHADOW_DOM) + return RuntimeEnabledFeatures::shadowDOMEnabled(); +#else + return false; +#endif +} + + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp index 39f5e2770..01162779e 100644 --- a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -63,6 +63,11 @@ void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) SchemeRegistry::registerURLSchemeAsSecure(scheme); } +void WebSecurityPolicy::registerURLSchemeAsCORSEnabled(const WebString& scheme) +{ + SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme); +} + void WebSecurityPolicy::addOriginAccessWhitelistEntry( const WebURL& sourceOrigin, const WebString& destinationProtocol, diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 7733e2699..2723ca78b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -224,6 +224,11 @@ void WebSettingsImpl::setDNSPrefetchingEnabled(bool enabled) m_settings->setDNSPrefetchingEnabled(enabled); } +void WebSettingsImpl::setFixedElementsLayoutRelativeToFrame(bool fixedElementsLayoutRelativeToFrame) +{ + m_settings->setFixedElementsLayoutRelativeToFrame(fixedElementsLayoutRelativeToFrame); +} + void WebSettingsImpl::setLocalStorageEnabled(bool enabled) { m_settings->setLocalStorageEnabled(enabled); @@ -368,6 +373,11 @@ void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled) m_settings->setAccelerated2dCanvasEnabled(enabled); } +void WebSettingsImpl::setDeferred2dCanvasEnabled(bool enabled) +{ + m_settings->setDeferred2dCanvasEnabled(enabled); +} + void WebSettingsImpl::setAcceleratedCompositingForFixedPositionEnabled(bool enabled) { m_settings->setAcceleratedCompositingForFixedPositionEnabled(enabled); @@ -388,6 +398,11 @@ void WebSettingsImpl::setHyperlinkAuditingEnabled(bool enabled) m_settings->setHyperlinkAuditingEnabled(enabled); } +void WebSettingsImpl::setLayoutFallbackWidth(int width) +{ + m_settings->setLayoutFallbackWidth(width); +} + void WebSettingsImpl::setAsynchronousSpellCheckingEnabled(bool enabled) { m_settings->setAsynchronousSpellCheckingEnabled(enabled); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index cc70d1316..63a00a099 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -77,6 +77,7 @@ public: virtual void setJavaScriptCanAccessClipboard(bool); virtual void setXSSAuditorEnabled(bool); virtual void setDNSPrefetchingEnabled(bool); + virtual void setFixedElementsLayoutRelativeToFrame(bool); virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); virtual void setFrameFlatteningEnabled(bool); @@ -106,11 +107,13 @@ public: virtual void setAcceleratedCompositingForCanvasEnabled(bool); virtual void setAcceleratedCompositingForAnimationEnabled(bool); virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setDeferred2dCanvasEnabled(bool); virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); virtual void setMinimumAccelerated2dCanvasSize(int); virtual void setAcceleratedFiltersEnabled(bool); virtual void setMemoryInfoEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); + virtual void setLayoutFallbackWidth(int); virtual void setAsynchronousSpellCheckingEnabled(bool); virtual void setUnifiedTextCheckerEnabled(bool); virtual void setCaretBrowsingEnabled(bool); diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp index a2e16847d..7a4bddb22 100644 --- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp @@ -361,12 +361,13 @@ void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, PassOwnPt workerContext->dispatchEvent(createConnectEvent(port)); } -void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long) +void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType, long long) { initializeLoader(url); WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerContextOnStart : DontPauseWorkerContextOnStart; - // FIXME: pass content-security-policy directives into shared worker. - setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, "", ContentSecurityPolicy::ReportOnly)); + setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicy, + static_cast<WebCore::ContentSecurityPolicy::HeaderType>(policyType))); + workerThread()->start(); } diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h index 70bf3707b..b98a2c9d7 100644 --- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h +++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h @@ -36,6 +36,7 @@ #if ENABLE(SHARED_WORKERS) #include "ScriptExecutionContext.h" #include "WebCommonWorkerClient.h" +#include "WebContentSecurityPolicy.h" #include "WebFrameClient.h" #include "WebSharedWorkerClient.h" #include "WebWorkerBase.h" @@ -95,7 +96,9 @@ public: // WebSharedWorker methods: virtual bool isStarted(); - virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, long long); + + virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType, long long cacheId); + virtual void connect(WebMessagePortChannel*, ConnectListener*); virtual void terminateWorkerContext(); virtual void clientDestroyed(); diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp index 9c4e8534f..f0bf28206 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.cpp +++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 2012 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 @@ -31,6 +31,7 @@ #include "config.h" #include "WebSocketImpl.h" +#include "ArrayBuffer.h" #include "Document.h" #include "KURL.h" #if ENABLE(WEB_SOCKETS) @@ -43,7 +44,7 @@ class WebSocketChannel { } // namespace WebCore #endif -#include "platform/WebData.h" +#include "WebArrayBuffer.h" #include "WebDocument.h" #include "WebSocketClient.h" #include "platform/WebString.h" @@ -55,6 +56,7 @@ namespace WebKit { WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* client) : m_client(client) + , m_binaryType(BinaryTypeBlob) { #if ENABLE(WEB_SOCKETS) m_private = WebSocketChannel::create(PassRefPtr<Document>(document).get(), this); @@ -72,6 +74,19 @@ WebSocketImpl::~WebSocketImpl() #endif } +WebSocket::BinaryType WebSocketImpl::binaryType() const +{ + return m_binaryType; +} + +bool WebSocketImpl::setBinaryType(BinaryType binaryType) +{ + if (binaryType > BinaryTypeArrayBuffer) + return false; + m_binaryType = binaryType; + return true; +} + void WebSocketImpl::connect(const WebURL& url, const WebString& protocol) { #if ENABLE(WEB_SOCKETS) @@ -99,10 +114,10 @@ bool WebSocketImpl::sendText(const WebString& message) #endif } -bool WebSocketImpl::sendBinary(const WebData& binaryData) +bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) { #if ENABLE(WEB_SOCKETS) - return m_private->send(binaryData.data(), binaryData.size()); + return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer)); #else ASSERT_NOT_REACHED(); #endif @@ -166,7 +181,14 @@ void WebSocketImpl::didReceiveMessage(const String& message) void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) { #if ENABLE(WEB_SOCKETS) - m_client->didReceiveBinaryData(WebData(binaryData->data(), binaryData->size())); + switch (m_binaryType) { + case BinaryTypeBlob: + // FIXME: Handle Blob after supporting WebBlob. + break; + case BinaryTypeArrayBuffer: + m_client->didReceiveArrayBuffer(WebArrayBuffer(ArrayBuffer::create(binaryData->data(), binaryData->size()))); + break; + } #else ASSERT_NOT_REACHED(); #endif diff --git a/Source/WebKit/chromium/src/WebSocketImpl.h b/Source/WebKit/chromium/src/WebSocketImpl.h index 3d37355d0..3d42bd506 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.h +++ b/Source/WebKit/chromium/src/WebSocketImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2011, 2012 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 @@ -42,7 +42,6 @@ namespace WebCore { class WebSocketChannel; } namespace WebKit { -class WebData; class WebDocument; class WebString; class WebURL; @@ -54,10 +53,12 @@ public: bool isNull() const { return !m_private; } + BinaryType binaryType() const; + virtual bool setBinaryType(BinaryType); virtual void connect(const WebURL&, const WebString& protocol); virtual WebString subprotocol(); - virtual bool sendText(const WebString& message); - virtual bool sendBinary(const WebData& binaryData); + virtual bool sendText(const WebString&); + virtual bool sendArrayBuffer(const WebArrayBuffer&); virtual unsigned long bufferedAmount() const; virtual void close(int code, const WebString& reason); virtual void fail(const WebString& reason); @@ -75,6 +76,7 @@ public: private: RefPtr<WebCore::WebSocketChannel> m_private; WebSocketClient* m_client; + BinaryType m_binaryType; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayer.cpp b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp new file mode 100644 index 000000000..11d7c1417 --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "platform/WebSolidColorLayer.h" + +#include "WebSolidColorLayerImpl.h" +#include "platform/WebFloatRect.h" + +namespace WebKit { + +WebSolidColorLayer WebSolidColorLayer::create() +{ + return WebSolidColorLayer(WebSolidColorLayerImpl::create()); +} + +WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node) + : WebLayer(node) +{ +} + +void WebSolidColorLayer::setBackgroundColor(const WebColor& color) +{ + m_private->setBackgroundColor(color); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp new file mode 100644 index 000000000..33b1a30e3 --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebSolidColorLayerImpl.h" + +using namespace WebCore; + +namespace WebKit { + +PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create() +{ + return adoptRef(new WebSolidColorLayerImpl()); +} + +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : SolidColorLayerChromium() +{ + setIsDrawable(true); +} + +WebSolidColorLayerImpl::~WebSolidColorLayerImpl() +{ +} + +} // namespace WebKit + diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h new file mode 100644 index 000000000..d2673b42b --- /dev/null +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 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: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSolidColorLayerImpl_h +#define WebSolidColorLayerImpl_h + +#include "SolidColorLayerChromium.h" +#include <wtf/PassRefPtr.h> + +namespace WebKit { + +class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium { +public: + static PassRefPtr<WebSolidColorLayerImpl> create(); + +protected: + WebSolidColorLayerImpl(); + virtual ~WebSolidColorLayerImpl(); +}; + +} // namespace WebKit + +#endif // WebSolidColorLayerImpl_h + diff --git a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp b/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp deleted file mode 100644 index 4f1f07457..000000000 --- a/Source/WebKit/chromium/src/WebSpeechInputControllerMockImpl.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebSpeechInputControllerMockImpl.h" - -#if ENABLE(INPUT_SPEECH) - -#include "PlatformString.h" -#include "SecurityOrigin.h" -#include "SpeechInputClientMock.h" -#include "platform/WebRect.h" -#include "WebSecurityOrigin.h" -#include <wtf/PassOwnPtr.h> - -namespace WebKit { - -WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) -{ - return new WebSpeechInputControllerMockImpl(listener); -} - -WebSpeechInputControllerMockImpl::WebSpeechInputControllerMockImpl( - WebSpeechInputListener* listener) - : m_webcoreMock(adoptPtr(new WebCore::SpeechInputClientMock())) - , m_listener(listener) -{ - m_webcoreMock->setListener(this); -} - -WebSpeechInputControllerMockImpl::~WebSpeechInputControllerMockImpl() -{ - m_webcoreMock->setListener(0); -} - -void WebSpeechInputControllerMockImpl::addMockRecognitionResult(const WebString& result, double confidence, const WebString &language) -{ - m_webcoreMock->addRecognitionResult(result, confidence, language); -} - -void WebSpeechInputControllerMockImpl::clearResults() -{ - m_webcoreMock->clearResults(); -} - -void WebSpeechInputControllerMockImpl::didCompleteRecording(int requestId) -{ - m_listener->didCompleteRecording(requestId); -} - -void WebSpeechInputControllerMockImpl::didCompleteRecognition(int requestId) -{ - m_listener->didCompleteRecognition(requestId); -} - -void WebSpeechInputControllerMockImpl::setRecognitionResult(int requestId, const WebCore::SpeechInputResultArray& result) -{ - m_listener->setRecognitionResult(requestId, result); -} - -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, origin.get()); -} - -void WebSpeechInputControllerMockImpl::cancelRecognition(int requestId) -{ - m_webcoreMock->cancelRecognition(requestId); -} - -void WebSpeechInputControllerMockImpl::stopRecording(int requestId) -{ - m_webcoreMock->stopRecording(requestId); -} - -} // namespace WebKit - -#else - -namespace WebKit { - -WebSpeechInputControllerMock* WebSpeechInputControllerMock::create(WebSpeechInputListener* listener) -{ - return 0; -} - -} // namespace WebKit - -#endif // ENABLE(INPUT_SPEECH) - diff --git a/Source/WebKit/chromium/src/WebSpeechInputResult.cpp b/Source/WebKit/chromium/src/WebSpeechInputResult.cpp index 9b1314418..45de4674e 100644 --- a/Source/WebKit/chromium/src/WebSpeechInputResult.cpp +++ b/Source/WebKit/chromium/src/WebSpeechInputResult.cpp @@ -43,11 +43,16 @@ WebSpeechInputResult::WebSpeechInputResult(const PassRefPtr<WebCore::SpeechInput { } -void WebSpeechInputResult::set(const WebString& utterance, double confidence) +void WebSpeechInputResult::assign(const WebString& utterance, double confidence) { m_private = WebCore::SpeechInputResult::create(utterance, confidence); } +void WebSpeechInputResult::assign(const WebSpeechInputResult& other) +{ + m_private = WebCore::SpeechInputResult::create(*other.m_private.get()); +} + WebSpeechInputResult::operator PassRefPtr<WebCore::SpeechInputResult>() const { return m_private.get(); diff --git a/Source/WebKit/chromium/src/WebTextCheckingResult.cpp b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp new file mode 100644 index 000000000..cfd4fa72a --- /dev/null +++ b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 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 "WebTextCheckingResult.h" + +#include "TextCheckerClient.h" + +using namespace WebCore; + +namespace WebKit { + +WebTextCheckingResult::operator TextCheckingResult() const +{ + TextCheckingResult result; + result.type = static_cast<TextCheckingType>(type); + result.location = location; + result.length = length; + result.replacement = replacement; + + return result; +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp index 4172aae5b..5a76c83b0 100644 --- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp +++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp @@ -86,18 +86,41 @@ WebSecurityOrigin WebUserMediaRequest::securityOrigin() const return WebSecurityOrigin(m_private->scriptExecutionContext()->securityOrigin()); } +void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) +{ + if (m_private.isNull()) + return; + + MediaStreamSourceVector audio; + for (size_t i = 0; i < audioSources.size(); ++i) { + MediaStreamSource* curr = audioSources[i]; + audio.append(curr); + } + MediaStreamSourceVector video; + for (size_t i = 0; i < videoSources.size(); ++i) { + MediaStreamSource* curr = videoSources[i]; + video.append(curr); + } + + m_private->succeed(audio, video); +} + +// FIXME: Cleanup when the chromium code has switched to the split sources implementation. void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& sources) { if (m_private.isNull()) return; - MediaStreamSourceVector s; + MediaStreamSourceVector audio, video; for (size_t i = 0; i < sources.size(); ++i) { MediaStreamSource* curr = sources[i]; - s.append(curr); + if (curr->type() == MediaStreamSource::TypeAudio) + audio.append(curr); + else if (curr->type() == MediaStreamSource::TypeVideo) + video.append(curr); } - m_private->succeed(s); + m_private->succeed(audio, video); } void WebUserMediaRequest::requestFailed() diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index a14748353..84de7729c 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -87,9 +87,10 @@ #include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" -#include "PlatformScreen.h" #include "PlatformThemeChromiumLinux.h" #include "PlatformWheelEvent.h" +#include "PointerLock.h" +#include "PointerLockController.h" #include "PopupContainer.h" #include "PopupMenuClient.h" #include "ProgressTracker.h" @@ -1331,6 +1332,13 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) m_currentInputEvent = &inputEvent; +#if ENABLE(POINTER_LOCK) + if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { + pointerLockMouseEvent(inputEvent); + return true; + } +#endif + if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. RefPtr<Node> node = m_mouseCaptureNode; @@ -1407,6 +1415,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: + case WebInputEvent::GestureTapDown: + case WebInputEvent::GestureDoubleTap: handled = gestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent)); break; #endif @@ -1742,6 +1752,36 @@ bool WebViewImpl::isAcceleratedCompositingActive() const #endif } +void WebViewImpl::didAcquirePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didAcquirePointerLock(); +#endif +} + +void WebViewImpl::didNotAcquirePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didNotAcquirePointerLock(); +#endif +} + +void WebViewImpl::didLosePointerLock() +{ +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->didLosePointerLock(); +#endif +} + +void WebViewImpl::didChangeWindowResizerRect() +{ + if (mainFrameImpl()->frameView()) + mainFrameImpl()->frameView()->windowResizerRectChanged(); +} + // WebView -------------------------------------------------------------------- WebSettings* WebViewImpl::settings() @@ -1996,8 +2036,6 @@ void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor) { // Pick a scale factor that is within the expected limits scaleFactor = clampPageScaleFactorToLimits(scaleFactor); - if (scaleFactor == pageScaleFactor()) - return; IntPoint scrollOffsetAtNewScale(mainFrame()->scrollOffset().width, mainFrame()->scrollOffset().height); float deltaScale = scaleFactor / pageScaleFactor(); @@ -2037,30 +2075,6 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) page()->setDeviceScaleFactor(scaleFactor); } -bool WebViewImpl::shouldLayoutFixedElementsRelativeToFrame() const -{ - if (!page()) - return false; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return false; - - return frame->view()->shouldLayoutFixedElementsRelativeToFrame(); -} - -void WebViewImpl::setShouldLayoutFixedElementsRelativeToFrame(bool enable) -{ - if (!page()) - return; - - Frame* frame = page()->mainFrame(); - if (!frame || !frame->view()) - return; - - frame->view()->setShouldLayoutFixedElementsRelativeToFrame(enable); -} - bool WebViewImpl::isFixedLayoutModeEnabled() const { if (!page()) @@ -2649,7 +2663,7 @@ void WebView::removeAllUserContent() pageGroup->removeAllUserContent(); } -void WebViewImpl::didCommitLoad(bool* isNewNavigation) +void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage) { if (isNewNavigation) *isNewNavigation = m_observedNewNavigation; @@ -2660,6 +2674,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation) m_newNavigationLoader = 0; #endif m_observedNewNavigation = false; + if (!isNavigationWithinPage) + m_pageScaleFactorIsSet = false; } void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) @@ -2742,9 +2758,6 @@ void WebViewImpl::startDragging(const WebDragData& dragData, void WebViewImpl::observeNewNavigation() { m_observedNewNavigation = true; - // FIXME: We need to make sure that m_pageScaleFactorIsSet is not reset - // on same page navigations. - m_pageScaleFactorIsSet = false; #ifndef NDEBUG m_newNavigationLoader = m_page->mainFrame()->loader()->documentLoader(); #endif @@ -2989,24 +3002,21 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) } else { TRACE_EVENT("WebViewImpl::setIsAcceleratedCompositingActive(true)", this, 0); - static const double defaultRefreshRate = 60.0; - WebCore::CCSettings ccSettings; ccSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled(); ccSettings.compositeOffscreen = settings()->compositeToTextureEnabled(); ccSettings.showFPSCounter = settings()->showFPSCounter(); ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree(); - ccSettings.refreshRate = screenRefreshRate(page()->mainFrame()->view()); - - ASSERT(ccSettings.refreshRate >= 0); - if (!ccSettings.refreshRate) - ccSettings.refreshRate = defaultRefreshRate; ccSettings.perTilePainting = page()->settings()->perTileDrawingEnabled(); ccSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled(); m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this)); m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); + + if (page() && page()->mainFrame()->view()) + m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->view()->documentBackgroundColor()); + m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings); if (m_layerTreeHost) { m_layerTreeHost->setHaveWheelEventHandlers(m_haveWheelEventHandlers); @@ -3177,4 +3187,47 @@ void WebViewImpl::resetGestureRecognizer() } #endif +#if ENABLE(POINTER_LOCK) +bool WebViewImpl::requestPointerLock() +{ + return m_client && m_client->requestPointerLock(); +} + +void WebViewImpl::requestPointerUnlock() +{ + if (m_client) + m_client->requestPointerUnlock(); +} + +bool WebViewImpl::isPointerLocked() +{ + return m_client && m_client->isPointerLocked(); +} + +void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) +{ + AtomicString eventType; + switch (event.type) { + case WebInputEvent::MouseDown: + eventType = eventNames().mousedownEvent; + break; + case WebInputEvent::MouseUp: + eventType = eventNames().mouseupEvent; + break; + case WebInputEvent::MouseMove: + eventType = eventNames().mousemoveEvent; + break; + default: + ASSERT_NOT_REACHED(); + } + + const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); + + if (page()) + page()->pointerLockController()->dispatchLockedMouseEvent( + PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), + eventType); +} +#endif + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 6ea196a75..a039a09ce 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -129,6 +129,10 @@ public: virtual bool caretOrSelectionRange(size_t* location, size_t* length); virtual void setTextDirection(WebTextDirection direction); virtual bool isAcceleratedCompositingActive() const; + virtual void didAcquirePointerLock(); + virtual void didNotAcquirePointerLock(); + virtual void didLosePointerLock(); + virtual void didChangeWindowResizerRect(); // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -173,8 +177,6 @@ public: virtual float deviceScaleFactor() const; virtual void setDeviceScaleFactor(float); - virtual bool shouldLayoutFixedElementsRelativeToFrame() const; - virtual void setShouldLayoutFixedElementsRelativeToFrame(bool); virtual bool isFixedLayoutModeEnabled() const; virtual void enableFixedLayoutMode(bool enable); virtual WebSize fixedLayoutSize() const; @@ -331,8 +333,9 @@ public: // Notifies the WebView that a load has been committed. isNewNavigation // will be true if a new session history item should be created for that - // load. - void didCommitLoad(bool* isNewNavigation); + // load. isNavigationWithinPage will be true if the navigation does + // not take the user away from the current page. + void didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage); // Indicates two things: // 1) This view may have a new layout now. @@ -468,6 +471,14 @@ public: bool hasHorizontalScrollbar(); bool hasVerticalScrollbar(); + // Pointer Lock calls allow a page to capture all mouse events and + // disable the system cursor. +#if ENABLE(POINTER_LOCK) + virtual bool requestPointerLock(); + virtual void requestPointerUnlock(); + virtual bool isPointerLocked(); +#endif + private: bool computePageScaleFactorLimits(); float clampPageScaleFactorToLimits(float scale); @@ -521,6 +532,10 @@ private: void updateLayerTreeViewport(); #endif +#if ENABLE(POINTER_LOCK) + void pointerLockMouseEvent(const WebInputEvent&); +#endif + WebViewClient* m_client; WebAutofillClient* m_autofillClient; WebPermissionClient* m_permissionClient; diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index d36e83a70..799599ab3 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -62,7 +62,6 @@ #include "platform/WebString.h" #include "platform/WebURL.h" #include "WebViewImpl.h" -#include "WebWorker.h" using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebWorkerInfo.cpp b/Source/WebKit/chromium/src/WebWorkerInfo.cpp new file mode 100644 index 000000000..8454e518d --- /dev/null +++ b/Source/WebKit/chromium/src/WebWorkerInfo.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 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 "WebWorkerInfo.h" + +#include "WorkerThread.h" + +namespace WebKit { + +unsigned WebWorkerInfo::dedicatedWorkerCount() +{ + return WebCore::WorkerThread::workerThreadCount(); +} + +} diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp index 6155d152a..7fbb1f468 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp @@ -57,14 +57,11 @@ namespace WebCore { static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous) - : AsyncFileSystem(type) + : AsyncFileSystemChromium(type, rootURL) , m_scriptExecutionContext(context) - , m_webFileSystem(webKitPlatformSupport()->fileSystem()) , m_workerContext(static_cast<WorkerContext*>(context)) , m_synchronous(synchronous) - , m_filesystemRootURL(rootURL) { - ASSERT(m_webFileSystem); ASSERT(m_scriptExecutionContext->isWorkerContext()); WorkerLoaderProxy* workerLoaderProxy = &m_workerContext->thread()->workerLoaderProxy(); @@ -222,15 +219,6 @@ PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::creat return m_bridgeForCurrentOperation; } -KURL WorkerAsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const -{ - ASSERT(!m_filesystemRootURL.isEmpty()); - KURL url = m_filesystemRootURL; - // Remove the extra leading slash. - url.setPath(url.path() + encodeWithURLEscapeSequences(virtualPath.substring(1))); - return url; -} - } // namespace WebCore #endif // ENABLE(FILE_SYSTEM) diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h index 13a8e7cb4..c8ae3565f 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h +++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h @@ -33,7 +33,7 @@ #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) -#include "AsyncFileSystem.h" +#include "AsyncFileSystemChromium.h" #include "PlatformString.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> @@ -51,7 +51,7 @@ class AsyncFileSystemCallbacks; class ScriptExecutionContext; class WorkerContext; -class WorkerAsyncFileSystemChromium : public AsyncFileSystem { +class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { public: static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous) { @@ -80,17 +80,12 @@ private: PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>); - // Converts a given absolute virtual path to a full origin-qualified FileSystem URL. - KURL virtualPathToFileSystemURL(const String& virtualPath) const; - ScriptExecutionContext* m_scriptExecutionContext; - WebKit::WebFileSystem* m_webFileSystem; WebKit::WebWorkerBase* m_worker; WorkerContext* m_workerContext; RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation; String m_modeForCurrentOperation; bool m_synchronous; - KURL m_filesystemRootURL; }; } // namespace WebCore diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index f27db1bf0..a41eefdd0 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -744,7 +744,7 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb if (test._scriptsAreParsed(expectedScripts)) callback(); else - test.addSniffer(WebInspector.panels.scripts, "_addOptionToFilesSelect", waitForAllScripts); + test.addSniffer(WebInspector.panels.scripts, "_uiSourceCodeAdded", waitForAllScripts); } waitForAllScripts(); diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index f84df986c..f719f2d5e 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -43,7 +43,8 @@ enum { NSEventPhaseStationary = 0x1 << 1, NSEventPhaseChanged = 0x1 << 2, NSEventPhaseEnded = 0x1 << 3, - NSEventPhaseCancelled = 0x1 << 4 + NSEventPhaseCancelled = 0x1 << 4, + NSEventPhaseMayBegin = 0x1 << 5 }; typedef NSUInteger NSEventPhase; diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp new file mode 100644 index 000000000..2f7e4c73c --- /dev/null +++ b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp @@ -0,0 +1,374 @@ +/* + * Copyright (C) 2011 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 "PaintAggregator.h" + +#include "WebKit.h" +#include "platform/WebKitPlatformSupport.h" + +using namespace WebCore; + +namespace WebKit { + +// ---------------------------------------------------------------------------- +// ALGORITHM NOTES +// +// We attempt to maintain a scroll rect in the presence of invalidations that +// are contained within the scroll rect. If an invalidation crosses a scroll +// rect, then we just treat the scroll rect as an invalidation rect. +// +// For invalidations performed prior to scrolling and contained within the +// scroll rect, we offset the invalidation rects to account for the fact that +// the consumer will perform scrolling before painting. +// +// We only support scrolling along one axis at a time. A diagonal scroll will +// therefore be treated as an invalidation. +// ---------------------------------------------------------------------------- + +// If the combined area of paint rects contained within the scroll rect grows +// too large, then we might as well just treat the scroll rect as a paint rect. +// This constant sets the max ratio of paint rect area to scroll rect area that +// we will tolerate before dograding the scroll into a repaint. +static const float maxRedundantPaintToScrollArea = 0.8f; + +// The maximum number of paint rects. If we exceed this limit, then we'll +// start combining paint rects (see CombinePaintRects). This limiting is +// important since the WebKit code associated with deciding what to paint given +// a paint rect can be significant. +static const size_t maxPaintRects = 5; + +// If the combined area of paint rects divided by the area of the union of all +// paint rects exceeds this threshold, then we will combine the paint rects. +static const float maxPaintRectsAreaRatio = 0.7f; + +static int calculateArea(const IntRect& rect) +{ + return rect.size().width() * rect.size().height(); +} + +// Subtracts out the intersection of |a| and |b| from |a|, assuming |b| fully +// overlaps with |a| in either the x- or y-direction. If there is no full +// overlap, then |a| is returned. +static IntRect subtractIntersection(const IntRect& a, const IntRect& b) +{ + // boundary cases: + if (!a.intersects(b)) + return a; + if (b.contains(a)) + return IntRect(); + + int rx = a.x(); + int ry = a.y(); + int rr = a.maxX(); + int rb = a.maxY(); + + if (b.y() <= a.y() && b.maxY() >= a.maxY()) { + // complete intersection in the y-direction + if (b.x() <= a.x()) + rx = b.maxX(); + else + rr = b.x(); + } else if (b.x() <= a.x() && b.maxX() >= a.maxX()) { + // complete intersection in the x-direction + if (b.y() <= a.y()) + ry = b.maxY(); + else + rb = b.y(); + } + return IntRect(rx, ry, rr - rx, rb - ry); +} + +// Returns true if |a| and |b| share an entire edge (i.e., same width or same +// height), and the rectangles do not overlap. +static bool sharesEdge(const IntRect& a, const IntRect& b) +{ + return (a.y() == b.y() && a.height() == b.height() && (a.x() == b.maxX() || a.maxX() == b.x())) + || (a.x() == b.x() && a.width() == b.width() && (a.y() == b.maxY() || a.maxY() == b.y())); +} + +PaintAggregator::PendingUpdate::PendingUpdate() +{ +} + +PaintAggregator::PendingUpdate::~PendingUpdate() +{ +} + +IntRect PaintAggregator::PendingUpdate::calculateScrollDamage() const +{ + // Should only be scrolling in one direction at a time. + ASSERT(!(scrollDelta.x() && scrollDelta.y())); + + IntRect damagedRect; + + // Compute the region we will expose by scrolling, and paint that into a + // shared memory section. + if (scrollDelta.x()) { + int dx = scrollDelta.x(); + damagedRect.setY(scrollRect.y()); + damagedRect.setHeight(scrollRect.height()); + if (dx > 0) { + damagedRect.setX(scrollRect.x()); + damagedRect.setWidth(dx); + } else { + damagedRect.setX(scrollRect.maxX() + dx); + damagedRect.setWidth(-dx); + } + } else { + int dy = scrollDelta.y(); + damagedRect.setX(scrollRect.x()); + damagedRect.setWidth(scrollRect.width()); + if (dy > 0) { + damagedRect.setY(scrollRect.y()); + damagedRect.setHeight(dy); + } else { + damagedRect.setY(scrollRect.maxY() + dy); + damagedRect.setHeight(-dy); + } + } + + // In case the scroll offset exceeds the width/height of the scroll rect + return intersection(scrollRect, damagedRect); +} + +IntRect PaintAggregator::PendingUpdate::calculatePaintBounds() const +{ + IntRect bounds; + for (size_t i = 0; i < paintRects.size(); ++i) + bounds.unite(paintRects[i]); + return bounds; +} + +bool PaintAggregator::hasPendingUpdate() const +{ + return !m_update.scrollRect.isEmpty() || !m_update.paintRects.isEmpty(); +} + +void PaintAggregator::clearPendingUpdate() +{ + m_update = PendingUpdate(); +} + +void PaintAggregator::popPendingUpdate(PendingUpdate* update) +{ + // Combine paint rects if their combined area is not sufficiently less than + // the area of the union of all paint rects. We skip this if there is a + // scroll rect since scrolling benefits from smaller paint rects. + if (m_update.scrollRect.isEmpty() && m_update.paintRects.size() > 1) { + int paintArea = 0; + IntRect unionRect; + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + paintArea += calculateArea(m_update.paintRects[i]); + unionRect.unite(m_update.paintRects[i]); + } + int unionArea = calculateArea(unionRect); + if (float(paintArea) / float(unionArea) > maxPaintRectsAreaRatio) + combinePaintRects(); + } + *update = m_update; + clearPendingUpdate(); +} + +void PaintAggregator::invalidateRect(const IntRect& rect) +{ + // Combine overlapping paints using smallest bounding box. + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (existingRect.contains(rect)) // Optimize out redundancy. + return; + if (rect.intersects(existingRect) || sharesEdge(rect, existingRect)) { + // Re-invalidate in case the union intersects other paint rects. + IntRect combinedRect = unionRect(existingRect, rect); + m_update.paintRects.remove(i); + invalidateRect(combinedRect); + return; + } + } + + // Add a non-overlapping paint. + m_update.paintRects.append(rect); + + // If the new paint overlaps with a scroll, then it forces an invalidation of + // the scroll. If the new paint is contained by a scroll, then trim off the + // scroll damage to avoid redundant painting. + if (!m_update.scrollRect.isEmpty()) { + if (shouldInvalidateScrollRect(rect)) + invalidateScrollRect(); + else if (m_update.scrollRect.contains(rect)) { + m_update.paintRects[m_update.paintRects.size() - 1] = + subtractIntersection(rect, m_update.calculateScrollDamage()); + if (m_update.paintRects[m_update.paintRects.size() - 1].isEmpty()) + m_update.paintRects.remove(m_update.paintRects.size() - 1); + } + } + + if (m_update.paintRects.size() > maxPaintRects) + combinePaintRects(); + + // Track how large the paintRects vector grows during an invalidation + // sequence. Note: A subsequent invalidation may end up being combined + // with all existing paints, which means that tracking the size of + // paintRects at the time when popPendingUpdate() is called may mask + // certain performance problems. + webKitPlatformSupport()->histogramCustomCounts("MPArch.RW_IntermediatePaintRectCount", + m_update.paintRects.size(), 1, 100, 50); +} + +void PaintAggregator::scrollRect(int dx, int dy, const IntRect& clipRect) +{ + // We only support scrolling along one axis at a time. + if (dx && dy) { + invalidateRect(clipRect); + return; + } + + // We can only scroll one rect at a time. + if (!m_update.scrollRect.isEmpty() && m_update.scrollRect != clipRect) { + invalidateRect(clipRect); + return; + } + + // Again, we only support scrolling along one axis at a time. Make sure this + // update doesn't scroll on a different axis than any existing one. + if ((dx && m_update.scrollDelta.y()) || (dy && m_update.scrollDelta.x())) { + invalidateRect(clipRect); + return; + } + + // The scroll rect is new or isn't changing (though the scroll amount may + // be changing). + m_update.scrollRect = clipRect; + m_update.scrollDelta.move(dx, dy); + + // We might have just wiped out a pre-existing scroll. + if (m_update.scrollDelta == IntPoint()) { + m_update.scrollRect = IntRect(); + return; + } + + // Adjust any contained paint rects and check for any overlapping paints. + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + if (m_update.scrollRect.contains(m_update.paintRects[i])) { + m_update.paintRects[i] = scrollPaintRect(m_update.paintRects[i], dx, dy); + // The rect may have been scrolled out of view. + if (m_update.paintRects[i].isEmpty()) { + m_update.paintRects.remove(i); + i--; + } + } else if (m_update.scrollRect.intersects(m_update.paintRects[i])) { + invalidateScrollRect(); + return; + } + } + + // If the new scroll overlaps too much with contained paint rects, then force + // an invalidation of the scroll. + if (shouldInvalidateScrollRect(IntRect())) + invalidateScrollRect(); +} + +IntRect PaintAggregator::scrollPaintRect(const IntRect& paintRect, int dx, int dy) const +{ + IntRect result = paintRect; + + result.move(dx, dy); + result = intersection(m_update.scrollRect, result); + + // Subtract out the scroll damage rect to avoid redundant painting. + return subtractIntersection(result, m_update.calculateScrollDamage()); +} + +bool PaintAggregator::shouldInvalidateScrollRect(const IntRect& rect) const +{ + if (!rect.isEmpty()) { + if (!m_update.scrollRect.intersects(rect)) + return false; + + if (!m_update.scrollRect.contains(rect)) + return true; + } + + // Check if the combined area of all contained paint rects plus this new + // rect comes too close to the area of the scrollRect. If so, then we + // might as well invalidate the scroll rect. + + int paintArea = calculateArea(rect); + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (m_update.scrollRect.contains(existingRect)) + paintArea += calculateArea(existingRect); + } + int scrollArea = calculateArea(m_update.scrollRect); + if (float(paintArea) / float(scrollArea) > maxRedundantPaintToScrollArea) + return true; + + return false; +} + +void PaintAggregator::invalidateScrollRect() +{ + IntRect scrollRect = m_update.scrollRect; + m_update.scrollRect = IntRect(); + m_update.scrollDelta = IntPoint(); + invalidateRect(scrollRect); +} + +void PaintAggregator::combinePaintRects() +{ + // Combine paint rects do to at most two rects: one inside the scrollRect + // and one outside the scrollRect. If there is no scrollRect, then just + // use the smallest bounding box for all paint rects. + // + // NOTE: This is a fairly simple algorithm. We could get fancier by only + // combining two rects to get us under the maxPaintRects limit, but if we + // reach this method then it means we're hitting a rare case, so there's no + // need to over-optimize it. + // + if (m_update.scrollRect.isEmpty()) { + IntRect bounds = m_update.calculatePaintBounds(); + m_update.paintRects.clear(); + m_update.paintRects.append(bounds); + } else { + IntRect inner, outer; + for (size_t i = 0; i < m_update.paintRects.size(); ++i) { + const IntRect& existingRect = m_update.paintRects[i]; + if (m_update.scrollRect.contains(existingRect)) + inner.unite(existingRect); + else + outer.unite(existingRect); + } + m_update.paintRects.clear(); + m_update.paintRects.append(inner); + m_update.paintRects.append(outer); + } +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.h b/Source/WebKit/chromium/src/painting/PaintAggregator.h new file mode 100644 index 000000000..f083e4017 --- /dev/null +++ b/Source/WebKit/chromium/src/painting/PaintAggregator.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PaintAggregator_h +#define PaintAggregator_h + +#include "IntPoint.h" +#include "IntRect.h" +#include <wtf/Vector.h> + +namespace WebKit { + +// This class is responsible for aggregating multiple invalidation and scroll +// commands to produce a scroll and repaint sequence. +class PaintAggregator { +public: + // This structure describes an aggregation of invalidateRect and scrollRect + // calls. If |scrollRect| is non-empty, then that rect should be scrolled + // by the amount specified by |scrollDelta|. If |paintRects| is non-empty, + // then those rects should be repainted. If |scrollRect| and |paintRects| + // are non-empty, then scrolling should be performed before repainting. + // |scrollDelta| can only specify scrolling in one direction (i.e., the x + // and y members cannot both be non-zero). + struct PendingUpdate { + PendingUpdate(); + ~PendingUpdate(); + + // Returns the rect damaged by scrolling within |scrollRect| by + // |scrollDelta|. This rect must be repainted. + WebCore::IntRect calculateScrollDamage() const; + + // Returns the smallest rect containing all paint rects. + WebCore::IntRect calculatePaintBounds() const; + + WebCore::IntPoint scrollDelta; + WebCore::IntRect scrollRect; + WTF::Vector<WebCore::IntRect> paintRects; + }; + + // There is a PendingUpdate if invalidateRect or scrollRect were called and + // ClearPendingUpdate was not called. + bool hasPendingUpdate() const; + void clearPendingUpdate(); + + // Fills |update| and clears the pending update. + void popPendingUpdate(PendingUpdate*); + + // The given rect should be repainted. + void invalidateRect(const WebCore::IntRect&); + + // The given rect should be scrolled by the given amounts. + void scrollRect(int dx, int dy, const WebCore::IntRect& clipRect); + +private: + WebCore::IntRect scrollPaintRect(const WebCore::IntRect& paintRect, int dx, int dy) const; + bool shouldInvalidateScrollRect(const WebCore::IntRect&) const; + void invalidateScrollRect(); + void combinePaintRects(); + + PendingUpdate m_update; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp index 9263deac7..5a6c11214 100644 --- a/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 2012 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 @@ -31,6 +31,7 @@ #include "config.h" #include "WebScreenInfoFactory.h" +#include "HWndDC.h" #include "WebScreenInfo.h" #include <windows.h> @@ -60,7 +61,8 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(HWND window) devMode.dmDriverExtra = 0; EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode); - HDC hdc = GetDC(0); + WebCore::HWndDC hdc(0); + ASSERT(hdc); WebScreenInfo results; results.horizontalDPI = GetDeviceCaps(hdc, LOGPIXELSX); |