diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebKit/chromium/src | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebKit/chromium/src')
48 files changed, 432 insertions, 584 deletions
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index cd0f07ff6..375428923 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -52,6 +52,7 @@ #include "IDBDatabaseException.h" #include "IDBFactoryBackendInterface.h" #include "IDBKey.h" +#include "IDBKeyPath.h" #include "IceOptions.h" #include "IconURL.h" #include "MediaPlayer.h" @@ -86,6 +87,7 @@ #include "WebIDBDatabaseException.h" #include "WebIDBFactory.h" #include "WebIDBKey.h" +#include "WebIDBKeyPath.h" #include "WebIconURL.h" #include "WebInputElement.h" #include "WebMediaPlayer.h" @@ -116,7 +118,7 @@ #if OS(DARWIN) #include "PlatformSupport.h" -#include "platform/mac/WebThemeEngine.h" +#include <public/mac/WebThemeEngine.h> #endif #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ @@ -323,15 +325,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped); COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted); COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeGrayscale, FilterOperation::GRAYSCALE); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSepia, FilterOperation::SEPIA); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSaturate, FilterOperation::SATURATE); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeHueRotate, FilterOperation::HUE_ROTATE); - -COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeInvert, FilterOperation::INVERT); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeBrightness, FilterOperation::BRIGHTNESS); -COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeContrast, FilterOperation::CONTRAST); - COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescription::NoFamily); COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyStandard, FontDescription::StandardFamily); COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySerif, FontDescription::SerifFamily); @@ -467,12 +460,18 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, Inje COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionDataError, IDBDatabaseException::DATA_ERR); COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::QUOTA_ERR); +#if ENABLE(INDEXED_DATABASE) COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::InvalidType, IDBKey::InvalidType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::ArrayType, IDBKey::ArrayType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::DateType, IDBKey::DateType); COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::NullType, IDBKeyPath::NullType); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::StringType, IDBKeyPath::StringType); +COMPILE_ASSERT_MATCHING_ENUM(WebIDBKeyPath::ArrayType, IDBKeyPath::ArrayType); +#endif + #if ENABLE(FILE_SYSTEM) COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, FileSystemTypeTemporary); COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, FileSystemTypePersistent); diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 70d565c2e..bc3061fb8 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -665,14 +665,14 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen int layoutHeight = computed.layoutSize.height(); m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight)); - // FIXME: Investigate the impact this has on layout/rendering if any. - // This exposes the correct device scale to javascript and media queries. + bool needInitializePageScale = !m_webView->isPageScaleFactorSet(); if (useDefaultDeviceScaleFactor && settings->defaultDeviceScaleFactor()) m_webView->setDeviceScaleFactor(settings->defaultDeviceScaleFactor()); else m_webView->setDeviceScaleFactor(computed.devicePixelRatio); m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale); - m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio); + if (needInitializePageScale) + m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio); #endif } @@ -725,7 +725,8 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh #else params.directory = false; #endif - params.acceptMIMETypes = fileChooser->settings().acceptMIMETypes; + params.acceptTypes = fileChooser->settings().acceptMIMETypes; + params.acceptMIMETypes = fileChooser->settings().acceptMIMETypes; // FIXME: Remove this once https://chromiumcodereview.appspot.com/10414085 lands. params.selectedFiles = fileChooser->settings().selectedFiles; if (params.selectedFiles.size() > 0) params.initialValue = params.selectedFiles[0]; diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index d35eb0e6c..5871f44e1 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -280,7 +280,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) { RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange(); if (range.get()) { - Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling); + Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); if (!markers.isEmpty()) { Vector<String> suggestions; for (size_t i = 0; i < markers.size(); ++i) { @@ -347,12 +347,12 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( return 0; } -void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) +static void populateSubMenuItems(PlatformMenuDescription inputMenu, WebVector<WebMenuItemInfo>& subMenuItems) { - Vector<WebMenuItemInfo> customItems; - for (size_t i = 0; i < defaultMenu->itemCount(); ++i) { - ContextMenuItem* inputItem = defaultMenu->itemAtIndex(i, defaultMenu->platformDescription()); - if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() > ContextMenuItemLastCustomTag) + Vector<WebMenuItemInfo> subItems; + for (size_t i = 0; i < inputMenu->size(); ++i) { + const ContextMenuItem* inputItem = &inputMenu->at(i); + if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() > ContextMenuItemLastCustomTag) continue; WebMenuItemInfo outputItem; @@ -371,16 +371,22 @@ void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaul outputItem.type = WebMenuItemInfo::Separator; break; case SubmenuType: - outputItem.type = WebMenuItemInfo::Group; + outputItem.type = WebMenuItemInfo::SubMenu; + populateSubMenuItems(inputItem->platformSubMenu(), outputItem.subMenuItems); break; } - customItems.append(outputItem); + subItems.append(outputItem); } - WebVector<WebMenuItemInfo> outputItems(customItems.size()); - for (size_t i = 0; i < customItems.size(); ++i) - outputItems[i] = customItems[i]; - data->customItems.swap(outputItems); + WebVector<WebMenuItemInfo> outputItems(subItems.size()); + for (size_t i = 0; i < subItems.size(); ++i) + outputItems[i] = subItems[i]; + subMenuItems.swap(outputItems); +} + +void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) +{ + populateSubMenuItems(defaultMenu->platformDescription(), data->customItems); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index 8d4774dbe..c004c3fc3 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -180,7 +180,8 @@ void EditorClientImpl::toggleContinuousSpellChecking() bool EditorClientImpl::isGrammarCheckingEnabled() { - return false; + const Frame* frame = m_webView->focusedWebCoreFrame(); + return frame && frame->settings() && frame->settings()->asynchronousSpellCheckingEnabled(); } void EditorClientImpl::toggleGrammarChecking() @@ -790,7 +791,7 @@ void EditorClientImpl::checkGrammarOfString(const UChar*, int length, { notImplemented(); if (badGrammarLocation) - *badGrammarLocation = 0; + *badGrammarLocation = -1; if (badGrammarLength) *badGrammarLength = 0; } diff --git a/Source/WebKit/chromium/src/ExternalPopupMenu.cpp b/Source/WebKit/chromium/src/ExternalPopupMenu.cpp index 63fa3aeac..1855401c4 100644 --- a/Source/WebKit/chromium/src/ExternalPopupMenu.cpp +++ b/Source/WebKit/chromium/src/ExternalPopupMenu.cpp @@ -69,7 +69,12 @@ void ExternalPopupMenu::show(const IntRect& rect, FrameView* v, int index) return; m_webExternalPopupMenu = m_webViewClient->createExternalPopupMenu(info, this); - m_webExternalPopupMenu->show(v->contentsToWindow(rect)); + if (m_webExternalPopupMenu) + m_webExternalPopupMenu->show(v->contentsToWindow(rect)); + else { + // The client might refuse to create a popup (when there is already one pending to be shown for example). + didCancel(); + } } void ExternalPopupMenu::hide() diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index d0602a9a0..c42979ca3 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -239,6 +239,15 @@ bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings, return enabledPerSettings; } +bool FrameLoaderClientImpl::shadowDOMAllowed(bool enabledAsRuntimeFeature) +{ + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->permissionClient()) + return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature); + + return enabledAsRuntimeFeature; +} + void FrameLoaderClientImpl::didNotAllowScript() { WebViewImpl* webview = m_webFrame->viewImpl(); diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index ecb20a2fb..f798ac2ef 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -199,6 +199,7 @@ public: virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL); virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&); + virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeature) OVERRIDE; virtual void didNotAllowScript(); virtual void didNotAllowPlugins(); diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp index 179799275..6e535499a 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp @@ -75,7 +75,7 @@ PassRefPtr<DOMStringList> IDBDatabaseBackendProxy::objectStoreNames() const return m_webIDBDatabase->objectStoreNames(); } -PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, // all implementations of IDB interfaces are proxy objects. diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h index 5a5baf28f..b78ac6992 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h @@ -46,7 +46,7 @@ public: virtual String version() const; virtual PassRefPtr<WebCore::DOMStringList> objectStoreNames() const; - virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void deleteObjectStore(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void setVersion(const String& version, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, WebCore::ExceptionCode&); virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> transaction(WebCore::DOMStringList* storeNames, unsigned short mode, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp index fc746aa6b..280db881d 100644 --- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp @@ -29,6 +29,7 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBCallbacks.h" +#include "IDBKeyPath.h" #include "IDBKeyRange.h" #include "IDBTransactionBackendProxy.h" #include "WebIDBCallbacksImpl.h" @@ -60,9 +61,9 @@ String IDBIndexBackendProxy::name() return m_webIDBIndex->name(); } -String IDBIndexBackendProxy::keyPath() +IDBKeyPath IDBIndexBackendProxy::keyPath() { - return m_webIDBIndex->keyPath().string(); + return m_webIDBIndex->keyPath(); } bool IDBIndexBackendProxy::unique() diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h index d5cc8bbfe..273405601 100644 --- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h @@ -29,6 +29,7 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBIndexBackendInterface.h" +#include "IDBKeyPath.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -42,7 +43,7 @@ public: virtual ~IDBIndexBackendProxy(); virtual String name(); - virtual String keyPath(); + virtual WebCore::IDBKeyPath keyPath(); virtual bool unique(); virtual bool multiEntry(); diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index 24f23a595..c03b2f13b 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -64,9 +64,9 @@ String IDBObjectStoreBackendProxy::name() const return m_webIDBObjectStore->name(); } -String IDBObjectStoreBackendProxy::keyPath() const +IDBKeyPath IDBObjectStoreBackendProxy::keyPath() const { - return m_webIDBObjectStore->keyPath().string(); + return m_webIDBObjectStore->keyPath(); } PassRefPtr<DOMStringList> IDBObjectStoreBackendProxy::indexNames() const @@ -119,7 +119,7 @@ void IDBObjectStoreBackendProxy::clear(PassRefPtr<IDBCallbacks> callbacks, IDBTr m_webIDBObjectStore->clear(new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); } -PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::createIndex(const String& name, const String& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, // all implementations of IDB interfaces are proxy objects. diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index fb7781d60..5d6796c64 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -28,6 +28,7 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBKeyPath.h" #include "IDBObjectStoreBackendInterface.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -43,7 +44,7 @@ public: virtual ~IDBObjectStoreBackendProxy(); virtual String name() const; - virtual String keyPath() const; + virtual WebCore::IDBKeyPath keyPath() const; virtual PassRefPtr<WebCore::DOMStringList> indexNames() const; virtual bool autoIncrement() const; @@ -53,7 +54,7 @@ public: virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); - PassRefPtr<WebCore::IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, bool multiEntry, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + PassRefPtr<WebCore::IDBIndexBackendInterface> createIndex(const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); PassRefPtr<WebCore::IDBIndexBackendInterface> index(const String& name, WebCore::ExceptionCode&); void deleteIndex(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 75b3a2847..081a67b8a 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -36,9 +36,9 @@ #include "WebKit.h" #include "platform/WebKitPlatformSupport.h" -#include "platform/WebLocalizedString.h" #include "platform/WebString.h" +#include <public/WebLocalizedString.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/WTFString.h> @@ -49,17 +49,17 @@ namespace WebCore { static String query(WebLocalizedString::Name name) { - return WebKit::webKitPlatformSupport()->queryLocalizedString(name); + return WebKit::Platform::current()->queryLocalizedString(name); } static String query(WebLocalizedString::Name name, const WebString& parameter) { - return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter); + return WebKit::Platform::current()->queryLocalizedString(name, parameter); } static String query(WebLocalizedString::Name name, const WebString& parameter1, const WebString& parameter2) { - return WebKit::webKitPlatformSupport()->queryLocalizedString(name, parameter1, parameter2); + return WebKit::Platform::current()->queryLocalizedString(name, parameter1, parameter2); } String searchableIndexIntroduction() diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index b1eecddac..4cc1c1177 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -136,11 +136,6 @@ WebCore::LayerChromium* NonCompositedContentHost::scrollLayer() return m_graphicsLayer->parent()->platformLayer(); } -void NonCompositedContentHost::protectVisibleTileTextures() -{ - m_graphicsLayer->platformLayer()->protectVisibleTileTextures(); -} - void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) { m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect)); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index ace408af2..320e7c1be 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -58,7 +58,6 @@ public: void setBackgroundColor(const WebCore::Color&); void setScrollLayer(WebCore::GraphicsLayer*); void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX); - void protectVisibleTileTextures(); WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } void setShowDebugBorders(bool); diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index bbd07ca7c..fb06ccdf4 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -35,11 +35,14 @@ #include "Chrome.h" #include "ChromeClientImpl.h" +#include "FileMetadata.h" #include "Page.h" +#include "WebFileInfo.h" #include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebIDBKey.h" +#include "WebIDBKeyPath.h" #include "WebKit.h" #include "WebPluginContainerImpl.h" #include "WebPluginListBuilderImpl.h" @@ -49,8 +52,6 @@ #include "WebViewImpl.h" #include "WebWorkerClientImpl.h" #include "platform/WebAudioBus.h" -#include "platform/WebCookie.h" -#include "platform/WebCookieJar.h" #include "platform/WebData.h" #include "platform/WebDragData.h" #include "platform/WebImage.h" @@ -62,17 +63,17 @@ #if OS(WINDOWS) #include "platform/WebRect.h" -#include "platform/win/WebThemeEngine.h" +#include <public/win/WebThemeEngine.h> #endif #if OS(DARWIN) -#include "platform/mac/WebThemeEngine.h" +#include <public/mac/WebThemeEngine.h> #elif OS(UNIX) && !OS(ANDROID) -#include "platform/linux/WebThemeEngine.h" #include "WebFontInfo.h" #include "WebFontRenderStyle.h" +#include <public/linux/WebThemeEngine.h> #elif OS(ANDROID) -#include "platform/android/WebThemeEngine.h" +#include <public/android/WebThemeEngine.h> #endif #include "NativeImageSkia.h" @@ -94,6 +95,8 @@ #include "Worker.h" #include "WorkerContextProxy.h" #include <public/WebClipboard.h> +#include <public/WebCookie.h> +#include <public/WebCookieJar.h> #include <public/WebMimeRegistry.h> #include <public/WebWorkerRunLoop.h> #include <wtf/Assertions.h> @@ -134,7 +137,7 @@ static WebCookieJar* getCookieJar(const Document* document) return 0; WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl); if (!cookieJar) - cookieJar = webKitPlatformSupport()->cookieJar(); + cookieJar = WebKit::Platform::current()->cookieJar(); return cookieJar; } @@ -319,11 +322,6 @@ bool PlatformSupport::getFileSize(const String& path, long long& result) return WebKit::Platform::current()->fileUtilities()->getFileSize(path, result); } -void PlatformSupport::revealFolderInOS(const String& path) -{ - WebKit::Platform::current()->fileUtilities()->revealFolderInOS(path); -} - bool PlatformSupport::getFileModificationTime(const String& path, time_t& result) { double modificationTime; @@ -333,6 +331,17 @@ bool PlatformSupport::getFileModificationTime(const String& path, time_t& result return true; } +bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result) +{ + WebFileInfo webFileInfo; + if (!webKitPlatformSupport()->fileUtilities()->getFileInfo(path, webFileInfo)) + return false; + result.modificationTime = webFileInfo.modificationTime; + result.length = webFileInfo.length; + result.type = static_cast<FileMetadata::Type>(webFileInfo.type); + return true; +} + String PlatformSupport::directoryName(const String& path) { return WebKit::Platform::current()->fileUtilities()->directoryName(path); @@ -500,7 +509,7 @@ PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory() return IDBFactoryBackendProxy::create(); } -void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys) +void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const IDBKeyPath& keyPath, Vector<RefPtr<IDBKey> >& keys) { WebVector<WebSerializedScriptValue> webValues = values; WebVector<WebIDBKey> webKeys; @@ -512,7 +521,7 @@ void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<R keys.append(PassRefPtr<IDBKey>(webKeys[i])); } -PassRefPtr<SerializedScriptValue> PlatformSupport::injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const String& keyPath) +PassRefPtr<SerializedScriptValue> PlatformSupport::injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const IDBKeyPath& keyPath) { return webKitPlatformSupport()->injectIDBKeyIntoSerializedValue(key, value, keyPath); } @@ -575,7 +584,7 @@ void PlatformSupport::paintButton( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintButton( + WebKit::Platform::current()->themeEngine()->paintButton( gc->platformContext()->canvas(), part, state, classicState, rect); } @@ -583,7 +592,7 @@ void PlatformSupport::paintMenuList( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintMenuList( + WebKit::Platform::current()->themeEngine()->paintMenuList( gc->platformContext()->canvas(), part, state, classicState, rect); } @@ -591,7 +600,7 @@ void PlatformSupport::paintScrollbarArrow( GraphicsContext* gc, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintScrollbarArrow( + WebKit::Platform::current()->themeEngine()->paintScrollbarArrow( gc->platformContext()->canvas(), state, classicState, rect); } @@ -599,7 +608,7 @@ void PlatformSupport::paintScrollbarThumb( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintScrollbarThumb( + WebKit::Platform::current()->themeEngine()->paintScrollbarThumb( gc->platformContext()->canvas(), part, state, classicState, rect); } @@ -607,7 +616,7 @@ void PlatformSupport::paintScrollbarTrack( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect, const IntRect& alignRect) { - webKitPlatformSupport()->themeEngine()->paintScrollbarTrack( + WebKit::Platform::current()->themeEngine()->paintScrollbarTrack( gc->platformContext()->canvas(), part, state, classicState, rect, alignRect); } @@ -616,7 +625,7 @@ void PlatformSupport::paintSpinButton( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintSpinButton( + WebKit::Platform::current()->themeEngine()->paintSpinButton( gc->platformContext()->canvas(), part, state, classicState, rect); } @@ -628,7 +637,7 @@ void PlatformSupport::paintTextField( // Fallback to white when |color| is invalid. RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white; - webKitPlatformSupport()->themeEngine()->paintTextField( + WebKit::Platform::current()->themeEngine()->paintTextField( gc->platformContext()->canvas(), part, state, classicState, rect, backgroundColor, fillContentArea, drawEdges); } @@ -637,14 +646,14 @@ void PlatformSupport::paintTrackbar( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { - webKitPlatformSupport()->themeEngine()->paintTrackbar( + WebKit::Platform::current()->themeEngine()->paintTrackbar( gc->platformContext()->canvas(), part, state, classicState, rect); } void PlatformSupport::paintProgressBar( GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds) { - webKitPlatformSupport()->themeEngine()->paintProgressBar( + WebKit::Platform::current()->themeEngine()->paintProgressBar( gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); } @@ -663,7 +672,7 @@ void PlatformSupport::paintScrollbarThumb( webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas(); - webKitPlatformSupport()->themeEngine()->paintScrollbarThumb( + WebKit::Platform::current()->themeEngine()->paintScrollbarThumb( webCanvas, static_cast<WebThemeEngine::State>(state), static_cast<WebThemeEngine::Size>(size), @@ -767,7 +776,7 @@ static void GetWebThemeExtraParams(PlatformSupport::ThemePart part, PlatformSupp IntSize PlatformSupport::getThemePartSize(ThemePart part) { - return webKitPlatformSupport()->themeEngine()->getSize(WebThemePart(part)); + return WebKit::Platform::current()->themeEngine()->getSize(WebThemePart(part)); } void PlatformSupport::paintThemePart( @@ -775,7 +784,7 @@ void PlatformSupport::paintThemePart( { WebThemeEngine::ExtraParams webThemeExtraParams; GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams); - webKitPlatformSupport()->themeEngine()->paint( + WebKit::Platform::current()->themeEngine()->paint( gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams); } @@ -841,6 +850,11 @@ void PlatformSupport::notifyJSOutOfMemory(Frame* frame) webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); } +bool PlatformSupport::getProcessMemorySize(size_t* privateBytes, size_t* sharedBytes) +{ + return webKitPlatformSupport()->getProcessMemorySize(privateBytes, sharedBytes); +} + int PlatformSupport::screenHorizontalDPI(Widget* widget) { WebWidgetClient* client = toWebWidgetClient(widget); @@ -920,9 +934,4 @@ WorkerContextProxy* WorkerContextProxy::create(Worker* worker) } #endif -bool PlatformSupport::canAccelerate2dCanvas() -{ - return webKitPlatformSupport()->canAccelerate2dCanvas(); -} - } // namespace WebCore diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index 11eb7cec3..576105c4d 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -32,6 +32,7 @@ #include "EventNames.h" #include "ExceptionCode.h" #include "Frame.h" +#include "InspectorInstrumentation.h" #include "Page.h" #include "PageGroup.h" #include "SecurityOrigin.h" @@ -80,42 +81,29 @@ String StorageAreaProxy::getItem(const String& key, Frame* frame) const return String(); } -String StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) +void StorageAreaProxy::setItem(const String& key, const String& value, ExceptionCode& ec, Frame* frame) { - WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; - WebKit::WebString oldValue; if (!canAccessStorage(frame)) ec = QUOTA_EXCEEDED_ERR; else { - m_storageArea->setItem(key, value, frame->document()->url(), result, oldValue); + WebKit::WebStorageArea::Result result = WebKit::WebStorageArea::ResultOK; + m_storageArea->setItem(key, value, frame->document()->url(), result); ec = (result == WebKit::WebStorageArea::ResultOK) ? 0 : QUOTA_EXCEEDED_ERR; - String oldValueString = oldValue; - if (oldValueString != value && result == WebKit::WebStorageArea::ResultOK) - storageEvent(key, oldValue, value, m_storageType, frame->document()->securityOrigin(), frame); } - return oldValue; } -String StorageAreaProxy::removeItem(const String& key, Frame* frame) +void StorageAreaProxy::removeItem(const String& key, Frame* frame) { if (!canAccessStorage(frame)) - return String(); - WebKit::WebString oldValue; - m_storageArea->removeItem(key, frame->document()->url(), oldValue); - if (!oldValue.isNull()) - storageEvent(key, oldValue, String(), m_storageType, frame->document()->securityOrigin(), frame); - return oldValue; + return; + m_storageArea->removeItem(key, frame->document()->url()); } -bool StorageAreaProxy::clear(Frame* frame) +void StorageAreaProxy::clear(Frame* frame) { if (!canAccessStorage(frame)) - return false; - bool clearedSomething; - m_storageArea->clear(frame->document()->url(), clearedSomething); - if (clearedSomething) - storageEvent(String(), String(), String(), m_storageType, frame->document()->securityOrigin(), frame); - return clearedSomething; + return; + m_storageArea->clear(frame->document()->url()); } bool StorageAreaProxy::contains(const String& key, Frame* frame) const @@ -123,54 +111,6 @@ bool StorageAreaProxy::contains(const String& key, Frame* frame) const return !getItem(key, frame).isNull(); } -// FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done. -// Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity. It's probably best to keep it current. -void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame) -{ - Page* page = sourceFrame->page(); - if (!page) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - if (storageType == SessionStorage) { - // Send events only to our page. - for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->sessionStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } else { - // Send events to every page. - const HashSet<Page*>& pages = page->group().pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - // FIXME: maybe only raise if the window has an onstorage listener - // attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); - } - } -} - bool StorageAreaProxy::canAccessStorage(Frame* frame) const { if (!frame->page()) @@ -180,74 +120,51 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage); } -void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchLocalStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalLocalStorage(), sourceAreaInstance)) { - // FIXME: maybe only raise if the window has an onstorage listener attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frame->domWindow()->localStorage(ec); - if (!ec) - frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); - } + Storage* storage = frame->domWindow()->optionalLocalStorage(); + if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance)) + frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); } + InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, LocalStorage, securityOrigin, *it); } } -static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace) +static Page* findPageWithSessionStorageNamespace(PageGroup* pageGroup, const WebKit::WebStorageNamespace& sessionNamespace) { - const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages(); + const HashSet<Page*>& pages = pageGroup->pages(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) { - const bool createIfNeeded = true; - StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(createIfNeeded)); - if (proxy->isSameNamespace(sessionNamespace)) + const bool dontCreateIfMissing = false; + StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(dontCreateIfMissing)); + if (proxy && proxy->isSameNamespace(sessionNamespace)) return *it; } return 0; } -void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, +void StorageAreaProxy::dispatchSessionStorageEvent(PageGroup* pageGroup, const String& key, const String& oldValue, const String& newValue, SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess) { - // FIXME: Multi-sided patch engineering alert ! - // step 1: this method gets defined and implemented in webkit/webcore with the early return. - // step 2: this method starts getting called by chromium still with the early return. - // step 3: This class's setters are modified to no longer raise SessionStorage - // events for inprocess changes and this early return is removed. - if (originatedInProcess) - return; - - Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace); + Page* page = findPageWithSessionStorageNamespace(pageGroup, sessionNamespace); if (!page) return; for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalSessionStorage(), sourceAreaInstance)) { - // FIXME: maybe only raise if the window has an onstorage listener attached to avoid creating the Storage instance. - ExceptionCode ec = 0; - Storage* storage = frame->domWindow()->sessionStorage(ec); - if (!ec) - frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); - } + Storage* storage = frame->domWindow()->optionalSessionStorage(); + if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance)) + frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage)); } + InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, securityOrigin, page); } bool StorageAreaProxy::isEventSource(Storage* storage, WebKit::WebStorageArea* sourceAreaInstance) { - if (!storage) - return false; + ASSERT(storage); StorageAreaProxy* areaProxy = static_cast<StorageAreaProxy*>(storage->area()); return areaProxy->m_storageArea == sourceAreaInstance; } diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h index ab2357470..83f2eae17 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.h +++ b/Source/WebKit/chromium/src/StorageAreaProxy.h @@ -38,6 +38,7 @@ namespace WebCore { class Frame; class KURL; class Page; +class PageGroup; class SecurityOrigin; class Storage; @@ -50,23 +51,22 @@ public: virtual unsigned length(Frame* sourceFrame) const; virtual String key(unsigned index, Frame* sourceFrame) const; virtual String getItem(const String& key, Frame* sourceFrame) const; - virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); - virtual String removeItem(const String& key, Frame* sourceFrame); - virtual bool clear(Frame* sourceFrame); + virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame); + virtual void removeItem(const String& key, Frame* sourceFrame); + virtual void clear(Frame* sourceFrame); virtual bool contains(const String& key, Frame* sourceFrame) const; virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; } static void dispatchLocalStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); static void dispatchSessionStorageEvent( - const String& pageGroupName, const String& key, const String& oldValue, const String& newValue, + PageGroup*, const String& key, const String& oldValue, const String& newValue, SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess); private: - void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame); bool canAccessStorage(Frame*) const; static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance); diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp deleted file mode 100644 index e948b597c..000000000 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "StorageEventDispatcherImpl.h" - -#include "DOMWindow.h" -#include "Document.h" -#include "EventNames.h" -#include "Frame.h" -#include "KURL.h" -#include "Page.h" -#include "PageGroup.h" -#include "SecurityOrigin.h" -#include "StorageEvent.h" - -// FIXME: delete this almost obsolete file soon - -namespace WebCore { - -StorageEventDispatcherImpl::StorageEventDispatcherImpl(const String& groupName) - : m_pageGroup(PageGroup::pageGroup(groupName)) -{ - ASSERT(m_pageGroup); -} - -void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin* securityOrigin, - const KURL& url, StorageType storageType) -{ - // FIXME: Implement - if (storageType == SessionStorage) - return; - - // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree - // of any given page in the group or mutate the page group itself. - Vector<RefPtr<Frame> > frames; - - const HashSet<Page*>& pages = m_pageGroup->pages(); - HashSet<Page*>::const_iterator end = pages.end(); - for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { - for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()->securityOrigin()->equal(securityOrigin)) - frames.append(frame); - } - } - - for (unsigned i = 0; i < frames.size(); ++i) { - ExceptionCode ec = 0; - Storage* storage = frames[i]->domWindow()->localStorage(ec); - if (!ec) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); - } -} - -} // namespace WebCore diff --git a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp index 5c37e396c..6c6845497 100644 --- a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp +++ b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp @@ -102,7 +102,7 @@ void StorageNamespaceProxy::sync() bool StorageNamespaceProxy::isSameNamespace(const WebKit::WebStorageNamespace& sessionNamespace) { - return m_storageNamespace->isSameNamespace(sessionNamespace); + return m_storageNamespace && m_storageNamespace->isSameNamespace(sessionNamespace); } } // namespace WebCore diff --git a/Source/WebKit/chromium/src/WebDocument.cpp b/Source/WebKit/chromium/src/WebDocument.cpp index 11639566c..d4cd18b00 100644 --- a/Source/WebKit/chromium/src/WebDocument.cpp +++ b/Source/WebKit/chromium/src/WebDocument.cpp @@ -33,7 +33,6 @@ #include "AXObjectCache.h" #include "CSSParserMode.h" -#include "CSSStyleSheet.h" #include "Document.h" #include "DocumentLoader.h" #include "DocumentType.h" @@ -46,6 +45,7 @@ #include "HTMLHeadElement.h" #include "NodeList.h" #include "SecurityOrigin.h" +#include "StyleSheetContents.h" #include "WebAccessibilityObject.h" #include "WebDOMEvent.h" #include "WebDocumentType.h" @@ -178,7 +178,7 @@ void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLev { RefPtr<Document> document = unwrap<Document>(); - RefPtr<StyleSheetInternal> parsedSheet = StyleSheetInternal::create(document.get()); + RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document.get()); parsedSheet->setIsUserStyleSheet(level == UserStyleUserLevel); parsedSheet->parseString(sourceCode); document->addUserSheet(parsedSheet.release()); diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index f9846efd8..bcb0ad38a 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -86,7 +86,7 @@ WebVector<WebDragData::Item> WebDragData::items() const item.storageType = Item::StorageTypeFilename; RefPtr<WebCore::Blob> blob = originalItem->getAsFile(); if (blob->isFile()) { - File* file = static_cast<File*>(blob.get()); + File* file = toFile(blob.get()); item.filenameData = file->path(); item.displayNameData = file->name(); } else diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 1464f929e..fadb8c020 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -1449,21 +1449,6 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin return node->renderer()->positionForPoint(result.localPoint()); } -// TODO(kmadhusu@chromium.org): Remove this function after fixing -// crbug.com/85132. For more information, please refer to the comments in -// WebFrame.h -int WebFrameImpl::printBegin(const WebSize& printContentSize, - const WebNode& constrainToNode, - int printerDPI, - bool* useBrowserOverlays) { - WebRect printableArea(0, 0, printContentSize.width, printContentSize.height); - WebSize paperSize(printContentSize); - WebRect printContentArea(0, 0, printContentSize.width, printContentSize.height); - WebPrintParams printParams(printContentArea, printableArea, paperSize, - printerDPI, WebPrintScalingOptionSourceSize); - return printBegin(printParams, constrainToNode, useBrowserOverlays); -} - int WebFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& constrainToNode, bool* useBrowserOverlays) diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 5061cfadf..d8ae6dca6 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -178,12 +178,6 @@ public: virtual bool selectWordAroundCaret(); virtual void selectRange(const WebPoint& start, const WebPoint& end); virtual void selectRange(const WebRange&); - // FIXME: Remove this function after fixing crbug.com/85132. For detailed - // information, please refer to the comments in WebFrame.h - virtual int printBegin(const WebSize& printContentSize, - const WebNode& constrainToNode, - int printerDPI, - bool* useBrowserOverlays); virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode, bool* useBrowserOverlays); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 447b993c6..4be43dc14 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -66,7 +66,7 @@ WebDOMStringList WebIDBDatabaseImpl::objectStoreNames() const return m_databaseBackend->objectStoreNames(); } -WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) +WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) { RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface(), ec); if (!objectStore) { diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index f73be5705..96571bbe9 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -53,10 +53,7 @@ public: virtual WebString version() const; virtual WebDOMStringList objectStoreNames() const; - // FIXME: Remove WebString keyPath overload once callers are updated. - // http://webkit.org/b/84207 - virtual WebIDBObjectStore* createObjectStore(const WebString&, const WebString&, bool, const WebIDBTransaction&, WebExceptionCode&); - virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) { return createObjectStore(name, keyPath.string(), autoIncrement, transaction, ec); } + virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&); virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&); virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp index 752a86263..7f74e5a47 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -58,13 +58,6 @@ WebIDBKeyPath WebIDBIndexImpl::keyPath() const return WebIDBKeyPath(m_backend->keyPath()); } -// FIXME: Remove this method once callers are updated. -// http://webkit.org/b/84207 -WebString WebIDBIndexImpl::keyPathString() const -{ - return m_backend->keyPath(); -} - bool WebIDBIndexImpl::unique() const { return m_backend->unique(); diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.h b/Source/WebKit/chromium/src/WebIDBIndexImpl.h index 90d836669..04fea582f 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.h +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.h @@ -45,9 +45,6 @@ public: virtual WebString name() const; virtual WebIDBKeyPath keyPath() const; - // FIXME: Remove this method once callers are updated. - // http://webkit.org/b/84207 - virtual WebString keyPathString() const; virtual bool unique() const; virtual bool multiEntry() const; diff --git a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp index bcf5dbd0d..17c158f34 100644 --- a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp +++ b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp @@ -37,101 +37,79 @@ using namespace WebCore; namespace WebKit { -WebIDBKeyPath WebIDBKeyPath::create(const WebVector<WebString>&) +WebIDBKeyPath::~WebIDBKeyPath() { - // FIXME: Array-type key paths not yet supported. http://webkit.org/b/84207 - WEBKIT_ASSERT_NOT_REACHED(); - return createNull(); + m_private.reset(0); } WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath) { - if (keyPath.isNull()) - return createNull(); - - WTF::Vector<WTF::String> idbElements; - IDBKeyPathParseError idbError; - IDBParseKeyPath(keyPath, idbElements, idbError); - return WebIDBKeyPath(idbElements, static_cast<int>(idbError)); -} - -WebIDBKeyPath WebIDBKeyPath::createNull() -{ - return WebIDBKeyPath(WebString()); + return WebIDBKeyPath(IDBKeyPath(keyPath)); } -WebIDBKeyPath::WebIDBKeyPath(const WebIDBKeyPath& keyPath) +WebIDBKeyPath WebIDBKeyPath::create(const WebVector<WebString>& keyPath) { - assign(keyPath); + Vector<String> strings; + for (size_t i = 0; i < keyPath.size(); ++i) + strings.append(keyPath[i]); + return WebIDBKeyPath(IDBKeyPath(strings)); } -WebIDBKeyPath::WebIDBKeyPath(const WTF::Vector<WTF::String>& elements, int parseError) - : m_private(new WTF::Vector<WTF::String>(elements)) - , m_parseError(parseError) +WebIDBKeyPath WebIDBKeyPath::createNull() { + return WebIDBKeyPath(IDBKeyPath()); } bool WebIDBKeyPath::isValid() const { - return m_parseError == IDBKeyPathParseErrorNone; + ASSERT(m_private.get()); + return m_private->isValid(); } WebIDBKeyPath::Type WebIDBKeyPath::type() const { - return m_private.get() ? StringType : NullType; + ASSERT(m_private.get()); + return Type(m_private->type()); } -WebString WebIDBKeyPath::string() const + +WebVector<WebString> WebIDBKeyPath::array() const { - if (!m_private.get()) - return WebString(); - - // FIXME: Store the complete string instead of rebuilding it. - // http://webkit.org/b/84207 - WTF::String string(""); - WTF::Vector<WTF::String>& array = *m_private.get(); - for (size_t i = 0; i < array.size(); ++i) { - if (i) - string.append("."); - string.append(array[i]); - } - return WebString(string); + ASSERT(m_private.get()); + ASSERT(m_private->type() == IDBKeyPath::ArrayType); + return m_private->array(); } -WebIDBKeyPath::WebIDBKeyPath(const WebString& keyPath) - : m_parseError(IDBKeyPathParseErrorNone) +WebString WebIDBKeyPath::string() const { - if (!keyPath.isNull()) { - m_private.reset(new WTF::Vector<WTF::String>()); - IDBKeyPathParseError idbParseError; - IDBParseKeyPath(keyPath, *m_private.get(), idbParseError); - m_parseError = idbParseError; - } + ASSERT(m_private.get()); + ASSERT(m_private->type() == IDBKeyPath::StringType); + return m_private->string(); } -int WebIDBKeyPath::parseError() const +WebIDBKeyPath::WebIDBKeyPath(const WebIDBKeyPath& keyPath) + : m_private(new IDBKeyPath(keyPath)) { - return m_parseError; + ASSERT(m_private.get()); } -void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath) +WebIDBKeyPath::WebIDBKeyPath(const WebCore::IDBKeyPath& value) + : m_private(new IDBKeyPath(value)) { - m_parseError = keyPath.m_parseError; - if (keyPath.m_private.get()) - m_private.reset(new WTF::Vector<WTF::String>(keyPath)); - else - m_private.reset(0); + ASSERT(m_private.get()); } -void WebIDBKeyPath::reset() +WebIDBKeyPath& WebIDBKeyPath::operator=(const WebCore::IDBKeyPath& value) { - m_private.reset(0); + ASSERT(m_private.get()); + m_private.reset(new IDBKeyPath(value)); + return *this; } -WebIDBKeyPath::operator const WTF::Vector<WTF::String, 0>&() const +WebIDBKeyPath::operator const WebCore::IDBKeyPath&() const { ASSERT(m_private.get()); - return *m_private.get(); + return *(m_private.get()); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 5ec35df0f..ebd7ae945 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -31,6 +31,7 @@ #include "DOMStringList.h" #include "IDBCallbacksProxy.h" #include "IDBIndexBackendInterface.h" +#include "IDBKeyPath.h" #include "IDBKeyRange.h" #include "IDBObjectStoreBackendInterface.h" #include "WebIDBIndexImpl.h" @@ -59,13 +60,6 @@ WebString WebIDBObjectStoreImpl::name() const WebIDBKeyPath WebIDBObjectStoreImpl::keyPath() const { - return WebIDBKeyPath(m_objectStore->keyPath()); -} - -// FIXME: Remove this method once callers are updated. -// http://webkit.org/b/84207 -WebString WebIDBObjectStoreImpl::keyPathString() const -{ return m_objectStore->keyPath(); } @@ -104,7 +98,7 @@ void WebIDBObjectStoreImpl::clear(WebIDBCallbacks* callbacks, const WebIDBTransa m_objectStore->clear(IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } -WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) +WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) { RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, multiEntry, transaction.getIDBTransactionBackendInterface(), ec); if (!index) diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 96ff6ee28..91aee7833 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -47,9 +47,6 @@ public: WebString name() const; WebIDBKeyPath keyPath() const; - // FIXME: Remove this method once callers are updated. - // http://webkit.org/b/84207 - WebString keyPathString() const; WebDOMStringList indexNames() const; bool autoIncrement() const; @@ -59,10 +56,7 @@ public: void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); - // FIXME: Remove WebString keyPath overload once callers are updated. - // http://webkit.org/b/84207 - WebIDBIndex* createIndex(const WebString&, const WebString&, bool, bool, const WebIDBTransaction&, WebExceptionCode&); - WebIDBIndex* createIndex(const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) { return createIndex(name, keyPath.string(), unique, multiEntry, transaction, ec); } + WebIDBIndex* createIndex(const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&); WebIDBIndex* index(const WebString& name, WebExceptionCode&); void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index 67723bf93..44ce2d0ac 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -127,6 +127,18 @@ WebURL WebIntent::service() const #endif } +WebVector<WebURL> WebIntent::suggestions() const +{ +#if ENABLE(WEB_INTENTS) + WebVector<WebURL> suggestions(m_private->suggestions().size()); + for (size_t i = 0; i < m_private->suggestions().size(); ++i) + suggestions[i] = m_private->suggestions().at(i); + return suggestions; +#else + return WebVector<WebURL>(); +#endif +} + WebMessagePortChannelArray* WebIntent::messagePortChannelsRelease() const { // Note: see PlatformMessagePortChannel::postMessageToRemote. diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index 3e6db47f5..bd022b724 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -276,12 +276,12 @@ void WebLayer::setBackgroundColor(WebColor color) void WebLayer::setFilters(const WebFilterOperations& filters) { - m_private->setFilters(filters.toFilterOperations()); + m_private->setFilters(filters); } void WebLayer::setBackgroundFilters(const WebFilterOperations& filters) { - m_private->setBackgroundFilters(filters.toFilterOperations()); + m_private->setBackgroundFilters(filters); } void WebLayer::setDebugBorderColor(const WebColor& color) @@ -294,6 +294,11 @@ void WebLayer::setDebugBorderWidth(float width) m_private->setDebugBorderWidth(width); } +void WebLayer::setForceRenderSurface(bool forceRenderSurface) +{ + m_private->setForceRenderSurface(forceRenderSurface); +} + WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node) : m_private(node) { diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 161f9e932..1c0a0e816 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -65,6 +65,11 @@ void WebLayerTreeViewImpl::willBeginFrame() m_client->willBeginFrame(); } +void WebLayerTreeViewImpl::didBeginFrame() +{ + m_client->didBeginFrame(); +} + void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime) { m_client->updateAnimations(monotonicFrameBeginTime); @@ -94,6 +99,11 @@ void WebLayerTreeViewImpl::didRecreateContext(bool success) m_client->didRebindGraphicsContext(success); } +void WebLayerTreeViewImpl::willCommit() +{ + m_client->willCommit(); +} + void WebLayerTreeViewImpl::didCommit() { m_client->didCommit(); diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index dcd3e2925..f854b7e60 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -40,11 +40,13 @@ public: virtual ~WebLayerTreeViewImpl(); virtual void willBeginFrame() OVERRIDE; + virtual void didBeginFrame() OVERRIDE; virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE; virtual void layout() OVERRIDE; virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE; virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE; virtual void didRecreateContext(bool success) OVERRIDE; + virtual void willCommit() OVERRIDE; virtual void didCommit() OVERRIDE; virtual void didCommitAndDrawFrame() OVERRIDE; virtual void didCompleteSwapBuffers() OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 950068d2f..2411d9c79 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -359,12 +359,12 @@ bool WebMediaPlayerClientImpl::canEnterFullscreen() const #endif #if ENABLE(MEDIA_SOURCE) -WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type) +WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type, const Vector<String>& codecs) { if (!m_webMediaPlayer) return WebCore::MediaPlayer::NotSupported; - return static_cast<WebCore::MediaPlayer::AddIdStatus>(m_webMediaPlayer->sourceAddId(id, type)); + return static_cast<WebCore::MediaPlayer::AddIdStatus>(m_webMediaPlayer->sourceAddId(id, type, codecs)); } bool WebMediaPlayerClientImpl::sourceRemoveId(const String& id) @@ -375,13 +375,33 @@ bool WebMediaPlayerClientImpl::sourceRemoveId(const String& id) return m_webMediaPlayer->sourceRemoveId(id); } -bool WebMediaPlayerClientImpl::sourceAppend(const unsigned char* data, unsigned length) +PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::sourceBuffered(const String& id) +{ + if (!m_webMediaPlayer) + return TimeRanges::create(); + + WebTimeRanges webRanges = m_webMediaPlayer->sourceBuffered(id); + RefPtr<TimeRanges> ranges = TimeRanges::create(); + for (size_t i = 0; i < webRanges.size(); ++i) + ranges->add(webRanges[i].start, webRanges[i].end); + return ranges.release(); +} + +bool WebMediaPlayerClientImpl::sourceAppend(const String& id, const unsigned char* data, unsigned length) { if (m_webMediaPlayer) - return m_webMediaPlayer->sourceAppend(data, length); + return m_webMediaPlayer->sourceAppend(id, data, length); return false; } +bool WebMediaPlayerClientImpl::sourceAbort(const String& id) +{ + if (!m_webMediaPlayer) + return false; + + return m_webMediaPlayer->sourceAbort(id); +} + void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus status) { if (m_webMediaPlayer) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index e06d3e523..72170f750 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -154,9 +154,11 @@ public: #endif #if ENABLE(MEDIA_SOURCE) - virtual WebCore::MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type); + virtual WebCore::MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type, const Vector<String>& codecs); virtual bool sourceRemoveId(const String&); - virtual bool sourceAppend(const unsigned char* data, unsigned length); + virtual WTF::PassRefPtr<WebCore::TimeRanges> sourceBuffered(const String&); + virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); + virtual bool sourceAbort(const String&); virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); #endif diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 1ad417bad..617b725ce 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -32,6 +32,7 @@ #include "WebPagePopupImpl.h" #include "Chrome.h" +#include "DOMWindowPagePopup.h" #include "EmptyClients.h" #include "FileChooser.h" #include "FocusController.h" @@ -127,6 +128,10 @@ private: WebPagePopupImpl* m_popup; }; +class PagePopupFrameLoaderClient : public EmptyFrameLoaderClient { + virtual bool allowPagePopup() OVERRIDE { return true; } +}; + // WebPagePopupImpl ---------------------------------------------------------------- WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client) @@ -181,8 +186,8 @@ bool WebPagePopupImpl::initPage() m_page->settings()->setScriptEnabled(true); m_page->settings()->setAllowScriptsToCloseWindows(true); - static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient; - RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient); + static FrameLoaderClient* pagePopupFrameLoaderClient = new PagePopupFrameLoaderClient; + RefPtr<Frame> frame = Frame::create(m_page.get(), 0, pagePopupFrameLoaderClient); frame->setView(FrameView::create(frame.get())); frame->init(); frame->view()->resize(m_popupClient->contentSize()); @@ -195,7 +200,8 @@ bool WebPagePopupImpl::initPage() m_popupClient->writeDocument(*writer); writer->end(); - frame->script()->installFunctionsForPagePopup(frame.get(), m_popupClient); + ASSERT(frame->existingDOMWindow()); + DOMWindowPagePopup::install(frame->existingDOMWindow(), m_popupClient); return true; } diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 400aabb00..e10e0ae81 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -254,10 +254,7 @@ bool WebPluginContainerImpl::isPrintScalingDisabled() const int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const { - return m_webPlugin->printBegin(printParams.printContentArea, printParams.printerDPI); - // FIXME: After committing this CL, update the chrome plugin printBegin() - // function to use the overloaded printBegin function. - // return m_webPlugin->printBegin(printParams); + return m_webPlugin->printBegin(printParams); } bool WebPluginContainerImpl::printPage(int pageNumber, diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index a9b729df6..78770a95c 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -123,6 +123,11 @@ void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDef m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; } +void WebSettingsImpl::setFontBoostingEnabled(bool enabled) +{ + m_settings->setFontBoostingEnabled(enabled); +} + void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) { m_settings->setDefaultTextEncodingName((String)encoding); @@ -307,6 +312,11 @@ void WebSettingsImpl::setExperimentalCSSRegionsEnabled(bool enabled) m_settings->setCSSRegionsEnabled(enabled); } +void WebSettingsImpl::setExperimentalCSSGridLayoutEnabled(bool enabled) +{ + m_settings->setCSSGridLayoutEnabled(enabled); +} + void WebSettingsImpl::setExperimentalCSSCustomFilterEnabled(bool enabled) { m_settings->setCSSCustomFilterEnabled(enabled); @@ -576,6 +586,16 @@ void WebSettingsImpl::setThreadedAnimationEnabled(bool enabled) m_settings->setThreadedAnimationEnabled(enabled); } +void WebSettingsImpl::setMediaPlaybackRequiresUserGesture(bool required) +{ + m_settings->setMediaPlaybackRequiresUserGesture(required); +} + +void WebSettingsImpl::setFixedPositionCreatesStackingContext(bool creates) +{ + m_settings->setFixedPositionCreatesStackingContext(creates); +} + void WebSettingsImpl::setViewportEnabled(bool enabled) { m_viewportEnabled = enabled; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index ebea771fe..1c3b0e7e2 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -56,6 +56,7 @@ public: virtual void setMinimumLogicalFontSize(int); virtual void setDefaultDeviceScaleFactor(int); virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); + virtual void setFontBoostingEnabled(bool); virtual void setDefaultTextEncodingName(const WebString&); virtual void setJavaScriptEnabled(bool); virtual void setWebSecurityEnabled(bool); @@ -91,6 +92,7 @@ public: virtual void setWebAudioEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); virtual void setExperimentalCSSRegionsEnabled(bool); + virtual void setExperimentalCSSGridLayoutEnabled(bool); virtual void setExperimentalCSSCustomFilterEnabled(bool); virtual void setOpenGLMultisamplingEnabled(bool); virtual void setPrivilegedWebGLExtensionsEnabled(bool); @@ -141,7 +143,9 @@ public: virtual void setPerTilePaintingEnabled(bool); virtual void setPartialSwapEnabled(bool); virtual void setThreadedAnimationEnabled(bool); + virtual void setFixedPositionCreatesStackingContext(bool); virtual void setViewportEnabled(bool); + virtual void setMediaPlaybackRequiresUserGesture(bool); virtual bool viewportEnabled() const { return m_viewportEnabled; } bool showFPSCounter() const { return m_showFPSCounter; } diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp index c8036aa74..95d3bcf88 100644 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp @@ -29,19 +29,18 @@ */ #include "config.h" -#include "WebStorageEventDispatcherImpl.h" +#include "WebStorageEventDispatcher.h" #include "KURL.h" #include "SecurityOrigin.h" #include "StorageAreaProxy.h" +#include "WebViewImpl.h" #include "platform/WebURL.h" #include <wtf/PassOwnPtr.h> namespace WebKit { -extern const char* pageGroupName; - void WebStorageEventDispatcher::dispatchLocalStorageEvent( const WebString& key, const WebString& oldValue, const WebString& newValue, const WebURL& origin, @@ -50,7 +49,7 @@ void WebStorageEventDispatcher::dispatchLocalStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchLocalStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sourceAreaInstance, originatedInProcess); } @@ -62,31 +61,8 @@ void WebStorageEventDispatcher::dispatchSessionStorageEvent( { RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin); WebCore::StorageAreaProxy::dispatchSessionStorageEvent( - pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL, + WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOrigin.get(), pageURL, sessionNamespace, sourceAreaInstance, originatedInProcess); } - -// FIXME: remove the WebStorageEventDispatcherImpl class soon. - -WebStorageEventDispatcher* WebStorageEventDispatcher::create() -{ - return new WebStorageEventDispatcherImpl(); -} - -WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() - : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGroupName))) -{ - ASSERT(m_eventDispatcher); -} - -void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL& pageURL, bool isLocalStorage) -{ - WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage; - RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin); - m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h deleted file mode 100644 index b03c6b7a6..000000000 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebStorageEventDispatcherImpl_h -#define WebStorageEventDispatcherImpl_h - -#include "StorageEventDispatcherImpl.h" -#include "WebStorageEventDispatcher.h" -#include <wtf/OwnPtr.h> - -namespace WebKit { - -// DEPRECATED - to be removed when removing the instance methods in the public api. -class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher { -public: - WebStorageEventDispatcherImpl(); - virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, - const WebString& newValue, const WebString& origin, - const WebURL&, bool isLocalStorage); -private: - OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher; -}; - -} // namespace WebKit - -#endif // WebStorageEventDispatcherImpl_h diff --git a/Source/WebKit/chromium/src/WebTextCheckingResult.cpp b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp index cfd4fa72a..7c5bfbc3e 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingResult.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingResult.cpp @@ -44,6 +44,13 @@ WebTextCheckingResult::operator TextCheckingResult() const result.location = location; result.length = length; result.replacement = replacement; + if (result.type == TextCheckingTypeGrammar) { + GrammarDetail detail; + detail.location = 0; + detail.length = length; + detail.userDescription = replacement; + result.details.append(detail); + } return result; } diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebTextInputInfo.cpp index d3433851f..7a0d87636 100644 --- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.h +++ b/Source/WebKit/chromium/src/WebTextInputInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 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 are @@ -28,30 +28,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef StorageEventDispatcherImpl_h -#define StorageEventDispatcherImpl_h +#include "config.h" +#include "WebTextInputInfo.h" -#include "PlatformString.h" -#include "StorageArea.h" +namespace WebKit { -namespace WebCore { +bool WebTextInputInfo::equals(const WebTextInputInfo& other) const +{ + return type == other.type + && value == other.value + && selectionStart == other.selectionStart + && selectionEnd == other.selectionEnd + && compositionStart == other.compositionStart + && compositionEnd == other.compositionEnd; +} -class KURL; -class PageGroup; -class SecurityOrigin; - -class StorageEventDispatcherImpl { -public: - StorageEventDispatcherImpl(const String& groupName); - - void dispatchStorageEvent(const String& key, const String& oldValue, - const String& newValue, SecurityOrigin*, - const KURL&, StorageType); - -private: - PageGroup* m_pageGroup; -}; - -} // namespace WebCore - -#endif // StorageEventDispatcherImpl_h +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index f74c802a9..a8931b120 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -113,6 +113,7 @@ #include "SpeechInputClientImpl.h" #include "SpeechRecognitionClientProxy.h" #include "StyleResolver.h" +#include "Text.h" #include "TextFieldDecoratorImpl.h" #include "TextIterator.h" #include "Timer.h" @@ -140,6 +141,7 @@ #include "WebRange.h" #include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" +#include "WebTextInputInfo.h" #include "WebViewClient.h" #include "WheelEvent.h" #include "cc/CCProxy.h" @@ -202,7 +204,7 @@ const float WebView::minPageScaleFactor = 0.25; const float WebView::maxPageScaleFactor = 4.0; -// The group name identifies a namespace of pages. Page group is used on OSX +// The group name identifies a namespace of pages. Page group is used on PLATFORM(MAC) // for some programs that use HTML views to display things that don't seem like // web pages to the user (so shouldn't have visited link coloring). We only use // one page group. @@ -1277,6 +1279,11 @@ WebViewImpl* WebViewImpl::fromPage(Page* page) return static_cast<WebViewImpl*>(chromeClient->webView()); } +PageGroup* WebViewImpl::defaultPageGroup() +{ + return PageGroup::pageGroup(pageGroupName); +} + // WebWidget ------------------------------------------------------------------ void WebViewImpl::close() @@ -1460,6 +1467,11 @@ void WebViewImpl::willBeginFrame() m_client->willBeginCompositorFrame(); } +void WebViewImpl::didBeginFrame() +{ + InspectorInstrumentation::didComposite(m_page.get()); +} + void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) { #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -1880,60 +1892,113 @@ bool WebViewImpl::compositionRange(size_t* location, size_t* length) return false; } +WebTextInputInfo WebViewImpl::textInputInfo() +{ + WebTextInputInfo info; + + Frame* focused = focusedWebCoreFrame(); + if (!focused) + return info; + + Editor* editor = focused->editor(); + if (!editor || !editor->canEdit()) + return info; + + FrameSelection* selection = focused->selection(); + if (!selection) + return info; + + Node* node = focusedWebCoreNode(); + if (!node) + return info; + + info.type = textInputType(); + if (info.type == WebTextInputTypeNone) + return info; + + if (node->hasTagName(HTMLNames::textareaTag)) + info.value = static_cast<HTMLTextAreaElement*>(node)->value(); + else if (node->hasTagName(HTMLNames::inputTag)) + info.value = static_cast<HTMLInputElement*>(node)->value(); + else if (node->shouldUseInputMethod()) + info.value = node->nodeValue(); + else + return info; + + if (info.value.isEmpty()) + return info; + + if (node->hasTagName(HTMLNames::textareaTag) || node->hasTagName(HTMLNames::inputTag)) { + HTMLTextFormControlElement* formElement = static_cast<HTMLTextFormControlElement*>(node); + info.selectionStart = formElement->selectionStart(); + info.selectionEnd = formElement->selectionEnd(); + if (editor->hasComposition()) { + info.compositionStart = formElement->indexForVisiblePosition(Position(editor->compositionNode(), editor->compositionStart())); + info.compositionEnd = formElement->indexForVisiblePosition(Position(editor->compositionNode(), editor->compositionEnd())); + } + } else { + info.selectionStart = selection->start().computeOffsetInContainerNode(); + info.selectionEnd = selection->end().computeOffsetInContainerNode(); + if (editor->hasComposition()) { + info.compositionStart = static_cast<int>(editor->compositionStart()); + info.compositionEnd = static_cast<int>(editor->compositionEnd()); + } + } + + return info; +} + WebTextInputType WebViewImpl::textInputType() { Node* node = focusedWebCoreNode(); if (!node) return WebTextInputTypeNone; - if (node->nodeType() == Node::ELEMENT_NODE) { - Element* element = static_cast<Element*>(node); - if (element->hasLocalName(HTMLNames::inputTag)) { - HTMLInputElement* input = static_cast<HTMLInputElement*>(element); - - if (input->readOnly() || input->disabled()) - return WebTextInputTypeNone; - - if (input->isPasswordField()) - return WebTextInputTypePassword; - if (input->isSearchField()) - return WebTextInputTypeSearch; - if (input->isEmailField()) - return WebTextInputTypeEmail; - if (input->isNumberField()) - return WebTextInputTypeNumber; - if (input->isTelephoneField()) - return WebTextInputTypeTelephone; - if (input->isURLField()) - return WebTextInputTypeURL; - if (input->isDateField()) - return WebTextInputTypeDate; - if (input->isDateTimeField()) - return WebTextInputTypeDateTime; - if (input->isDateTimeLocalField()) - return WebTextInputTypeDateTimeLocal; - if (input->isMonthField()) - return WebTextInputTypeMonth; - if (input->isTimeField()) - return WebTextInputTypeTime; - if (input->isWeekField()) - return WebTextInputTypeWeek; - if (input->isTextField()) - return WebTextInputTypeText; + if (node->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* input = static_cast<HTMLInputElement*>(node); + if (input->readOnly() || input->disabled()) return WebTextInputTypeNone; - } - - if (element->hasLocalName(HTMLNames::textareaTag)) { - HTMLTextAreaElement* textarea = static_cast<HTMLTextAreaElement*>(element); - if (textarea->readOnly() || textarea->disabled()) - return WebTextInputTypeNone; + if (input->isPasswordField()) + return WebTextInputTypePassword; + if (input->isSearchField()) + return WebTextInputTypeSearch; + if (input->isEmailField()) + return WebTextInputTypeEmail; + if (input->isNumberField()) + return WebTextInputTypeNumber; + if (input->isTelephoneField()) + return WebTextInputTypeTelephone; + if (input->isURLField()) + return WebTextInputTypeURL; + if (input->isDateField()) + return WebTextInputTypeDate; + if (input->isDateTimeField()) + return WebTextInputTypeDateTime; + if (input->isDateTimeLocalField()) + return WebTextInputTypeDateTimeLocal; + if (input->isMonthField()) + return WebTextInputTypeMonth; + if (input->isTimeField()) + return WebTextInputTypeTime; + if (input->isWeekField()) + return WebTextInputTypeWeek; + if (input->isTextField()) return WebTextInputTypeText; - } + + return WebTextInputTypeNone; + } + + if (node->hasTagName(HTMLNames::textareaTag)) { + HTMLTextAreaElement* textarea = static_cast<HTMLTextAreaElement*>(node); + + if (textarea->readOnly() || textarea->disabled()) + return WebTextInputTypeNone; + + return WebTextInputTypeText; } - // For other situations. if (node->shouldUseInputMethod()) return WebTextInputTypeText; @@ -3042,7 +3107,7 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa m_newNavigationLoader = 0; #endif m_observedNewNavigation = false; - if (!isNavigationWithinPage) + if (*isNewNavigation && !isNavigationWithinPage) m_pageScaleFactorIsSet = false; m_gestureAnimation.clear(); @@ -3244,22 +3309,6 @@ bool WebViewImpl::allowsAcceleratedCompositing() return !m_compositorCreationFailed; } -bool WebViewImpl::pageHasRTLStyle() const -{ - if (!page()) - return false; - Document* document = page()->mainFrame()->document(); - if (!document) - return false; - RenderView* renderView = document->renderView(); - if (!renderView) - return false; - RenderStyle* style = renderView->style(); - if (!style) - return false; - return (style->direction() == RTL); -} - void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) { m_rootGraphicsLayer = layer; @@ -3502,6 +3551,11 @@ void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal } } +void WebViewImpl::willCommit() +{ + InspectorInstrumentation::willComposite(m_page.get()); +} + void WebViewImpl::didCommit() { if (m_client) @@ -3554,14 +3608,10 @@ void WebViewImpl::updateLayerTreeViewport() IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */); IntPoint scroll(view->scrollX(), view->scrollY()); - int layerAdjustX = 0; - if (pageHasRTLStyle()) { - // The origin of the initial containing block for RTL root layers is not - // at the far left side of the layer bounds. Instead, it's one viewport - // width (not including scrollbars) to the left of the right side of the - // layer. - layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width(); - } + // In RTL-style pages, the origin of the initial containing block for the + // root layer may be positive; translate the layer to avoid negative + // coordinates. + int layerAdjustX = -view->scrollOrigin().x(); // This part of the deviceScale will be used to scale the contents of // the NCCH's GraphicsLayer. @@ -3620,8 +3670,6 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, #if USE(ACCELERATED_COMPOSITING) if (!m_layerTreeView.isNull()) { bool visible = visibilityState == WebPageVisibilityStateVisible; - if (!visible && isAcceleratedCompositingActive()) - m_nonCompositedContentHost->protectVisibleTileTextures(); m_layerTreeView.setVisible(visible); } #endif diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index db67dd54a..67562feab 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -69,6 +69,7 @@ class HistoryItem; class HitTestResult; class KeyboardEvent; class Page; +class PageGroup; class PagePopup; class PagePopupClient; class PlatformGestureCurveTarget; @@ -145,6 +146,7 @@ public: virtual bool confirmComposition(); virtual bool confirmComposition(const WebString& text); virtual bool compositionRange(size_t* location, size_t* length); + virtual WebTextInputInfo textInputInfo(); virtual WebTextInputType textInputType(); virtual bool selectionBounds(WebRect& start, WebRect& end) const; virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const; @@ -289,10 +291,12 @@ public: // WebLayerTreeViewClient virtual void willBeginFrame(); + virtual void didBeginFrame(); virtual void updateAnimations(double monotonicFrameBeginTime); virtual void applyScrollAndScale(const WebSize&, float); virtual WebGraphicsContext3D* createContext3D(); virtual void didRebindGraphicsContext(bool); + virtual void willCommit(); virtual void didCommit(); virtual void didCommitAndDrawFrame(); virtual void didCompleteSwapBuffers(); @@ -319,6 +323,12 @@ public: static WebViewImpl* fromPage(WebCore::Page*); + // A pageGroup identifies a namespace of pages. Page groups are used on PLATFORM(MAC) + // for some programs that use HTML views to display things that don't seem like + // web pages to the user (so shouldn't have visited link coloring). We only use + // one page group. + static WebCore::PageGroup* defaultPageGroup(); + WebViewClient* client() { return m_client; @@ -487,7 +497,6 @@ public: #if USE(ACCELERATED_COMPOSITING) bool allowsAcceleratedCompositing(); - bool pageHasRTLStyle() const; void setRootGraphicsLayer(WebCore::GraphicsLayer*); void scheduleCompositingLayerSync(); void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect); |