diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
| commit | 6668b07fcd51f86be243b9e08e667224e30c0cf8 (patch) | |
| tree | 64f466e09b68a77ae1156c0d35cd5b95e18a34ca /Source/WebKit/chromium | |
| parent | e7923d9de38974f0c6fb7646c898a6ea618261e8 (diff) | |
| download | qtwebkit-6668b07fcd51f86be243b9e08e667224e30c0cf8.tar.gz | |
Imported WebKit commit 26cd9bd8ab0471ffe987c9b60368f63dc0f1f31b (http://svn.webkit.org/repository/webkit/trunk@121325)
New snapshot with more Windows build fixes
Diffstat (limited to 'Source/WebKit/chromium')
55 files changed, 992 insertions, 588 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 3cbb2e803..365d0eb3c 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,513 @@ +2012-06-26 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-06-26 James Robinson <jamesr@chromium.org> + + [chromium] Remove WebView::graphicsContext3D getter + https://bugs.webkit.org/show_bug.cgi?id=89916 + + Reviewed by Adrienne Walker. + + Removes WebView::graphicsContext3D getter. This getter was used to access the compositor's context, which is an + inherently dangerous operation since the compositor context may not be safe to use on the main thread and has + somewhat complicated creation / recreation semantics. A shared context is exposed + (WebView::sharedGraphicsContext3D) for callers who may want access to a context in a share group with the + compositor. + + * public/WebView.h: + (WebView): + * src/WebLayerTreeView.cpp: + * src/WebViewImpl.cpp: + * src/WebViewImpl.h: + (WebViewImpl): + +2012-06-26 Peter Beverloo <peter@chromium.org> + + [Chromium] Decrease the number of conditional blocks in features.gypi + https://bugs.webkit.org/show_bug.cgi?id=90013 + + Reviewed by Adam Barth. + + Consolidate two Android-specific and accelerated-compositing-specific + conditional blocks into other blocks which serve an identical purpose. + + * features.gypi: + +2012-06-26 Dave Tu <dtu@chromium.org> + + [chromium] Expose rendering statistics to WebWidget. + https://bugs.webkit.org/show_bug.cgi?id=88268 + + Reviewed by James Robinson. + + The WebKit side of a basic framework for exposing rendering statistics + to Chromium's --enable-benchmarking extension. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::renderingStatistics): + (WebKit): + +2012-06-25 James Robinson <jamesr@chromium.org> + + [chromium] Add WebLayer API for scrolling + https://bugs.webkit.org/show_bug.cgi?id=89913 + + Reviewed by Adrienne Walker. + + Use WebScrollableLayer type in NonCompositedContentHost. + + * WebKit.gyp: + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::setScrollLayer): + (WebKit::reserveScrollbarLayers): + (WebKit::NonCompositedContentHost::setViewport): + (WebKit::NonCompositedContentHost::haveScrollLayer): + (WebKit): + (WebKit::NonCompositedContentHost::scrollLayer): + * src/NonCompositedContentHost.h: + (WebCore): + * src/WebContentLayer.cpp: + (WebKit::WebContentLayer::WebContentLayer): + * src/WebLayer.cpp: + (WebKit::WebLayer::numberOfChildren): + (WebKit): + (WebKit::WebLayer::childAt): + (WebKit::WebLayer::setAlwaysReserveTextures): + * src/WebScrollableLayer.cpp: + (WebKit): + (WebKit::WebScrollableLayer::setScrollPosition): + (WebKit::WebScrollableLayer::setScrollable): + (WebKit::WebScrollableLayer::setHaveWheelEventHandlers): + (WebKit::WebScrollableLayer::setShouldScrollOnMainThread): + +2012-06-26 Ian Vollick <vollick@chromium.org> + + [chromium] The single thread proxy should not automatically tick new animations. + https://bugs.webkit.org/show_bug.cgi?id=89996 + + Reviewed by James Robinson. + + * WebKit.gypi: + * tests/CCSingleThreadProxyTest.cpp: Removed. + +2012-06-26 Ian Vollick <vollick@chromium.org> + + [chromium] Layer chromium should need a redraw after getting its first non-empty bounds. + https://bugs.webkit.org/show_bug.cgi?id=89784 + + Reviewed by James Robinson. + + Previously, we'd only set needs redraw if the old bounds were zero, + and the new bounds were non-zero, but we should actually have + checked that the old bounds were non-empty. + + * tests/LayerChromiumTest.cpp: + +2012-06-26 James Robinson <jamesr@chromium.org> + + [chromium] Remove dead compositor-related API from GraphicsContext3DPrivate / Extensions3DChromium + https://bugs.webkit.org/show_bug.cgi?id=89933 + + Reviewed by Kenneth Russell. + + * tests/Canvas2DLayerBridgeTest.cpp: + (Canvas2DLayerBridgeTest::fullLifecycleTest): + +2012-06-26 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Fix incorrect #ifdef WEBKIT_IMPLEMENTATION statements + https://bugs.webkit.org/show_bug.cgi?id=89931 + + Reviewed by James Robinson. + + WEBKIT_IMPLEMENTATION is defined as either 0 or 1, so the usage of + #ifdef or #if have different behavior. There are some places in + the code that use "#ifdef WEBKIT_IMLPEMENTATION", but they should + actually be "#if WEBKIT_IMPLEMENTATION". This patch fixes those + #ifdef statements. + + * public/WebTextRun.h: + (WebTextRun): + * public/linux/WebFontRenderStyle.h: + +2012-06-26 Jun Mukai <mukai@chromium.org> + + Allow using <input type="color"> UI in ChromeOS. + https://bugs.webkit.org/show_bug.cgi?id=89944 + + Reviewed by Kent Tamura. + + http://crrev.com/144111 adds the UI of <input type="color"> for + ChromeOS, so now we can set its flag too. + + * features.gypi: + +2012-06-25 Ryosuke Niwa <rniwa@webkit.org> + + Get rid of firstItem and nextItem from HTMLCollection + https://bugs.webkit.org/show_bug.cgi?id=89923 + + Reviewed by Andreas Kling. + + Re-implement WebNodeCollection::firstItem() and WebNodeCollection::nextItem() in WebKit code + because we got rid of it from WebCore implementation. + + This is an extremely poor API and we shouldn't be exposing it in the future. + + * public/WebNodeCollection.h: + (WebKit::WebNodeCollection::WebNodeCollection): + (WebNodeCollection): + * src/WebNodeCollection.cpp: + (WebKit::WebNodeCollection::nextItem): + (WebKit::WebNodeCollection::firstItem): + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::collectTargetFrames): + +2012-06-25 Luke Macpherson <macpherson@chromium.org> + + Add runtime flag to enable/disable CSS variables (in addition to existing compile-time flag). + https://bugs.webkit.org/show_bug.cgi?id=89542 + + Reviewed by Dimitri Glazkov. + + * features.gypi: + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setExperimentalCSSVariablesEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-06-25 Adrienne Walker <enne@google.com> + + [chromium] Add WebPluginScrollbar and WebPluginScrollbarClient stub implementations + https://bugs.webkit.org/show_bug.cgi?id=89928 + + Reviewed by Darin Fisher. + + These classes are just typedef'd to be the non-Plugin version. The + next step is to change Chromium to use the Plugin version, then move + most of WebPluginScrollbar to a WebScrollbar in Platform to separate + out the base functionality, while providing the same top level API. + + * WebKit.gyp: + * public/WebPluginScrollbar.h: Added. + (WebKit): + * public/WebPluginScrollbarClient.h: Added. + (WebKit): + +2012-06-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-06-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r121206. + http://trac.webkit.org/changeset/121206 + https://bugs.webkit.org/show_bug.cgi?id=89935 + + [chromium] webkit_unit_tests + WebViewTest.MHTMLWithMissingResourceFinishesLoading crash + (Requested by ukai on #webkit). + + * tests/EventListenerTest.cpp: + * tests/FrameTestHelpers.cpp: + (WebKit::FrameTestHelpers::registerMockedURLLoad): + (WebKit::FrameTestHelpers::createWebViewAndLoad): + * tests/FrameTestHelpers.h: + (FrameTestHelpers): + * tests/ListenerLeakTest.cpp: + (WebKit::ListenerLeakTest::RunTest): + * tests/WebFrameTest.cpp: + (WebKit::WebFrameTest::registerMockedHttpURLLoad): + (WebKit::WebFrameTest::registerMockedChromeURLLoad): + * tests/WebViewTest.cpp: + (WebKit::TEST_F): + (WebKit::WebViewTest::testAutoResize): + (WebKit::WebViewTest::testTextInputType): + +2012-06-25 Adam Barth <abarth@webkit.org> + + [Chromium] Let the embedder override the max page scale factor set by the page + https://bugs.webkit.org/show_bug.cgi?id=89406 + + Reviewed by James Robinson. + + Chrome on Android has an option to force the web site to allow page + scaling (for accessibility). This patch adds + WebView::setIgnoreViewportTagMaximumScale, which instructs the WebView + to ignore the maximum scale factor supplied by by the page in the + viewport meta tag. + + This patch is a bit different from how this is implemented on the + chromium-android branch, but I'll clean up the branch once this patch + lands. + + * public/WebView.h: + (WebView): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setIgnoreViewportTagMaximumScale): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + (WebKit::WebViewImpl::ignoreViewportTagMaximumScale): + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + (WebKit): + +2012-06-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r121176. + http://trac.webkit.org/changeset/121176 + https://bugs.webkit.org/show_bug.cgi?id=89934 + + [chromium] browser_tests assert failed: + FATAL:native_theme_win.cc(1541)] Check failed: false. Invalid + part: 16 (Requested by ukai on #webkit). + + * src/PlatformSupport.cpp: + +2012-06-25 Jay Civelli <jcivelli@chromium.org> + + Fix progress load reporting for MHTML documents. + + MHTML documents containing references to resources they don't include + never finish loading. + https://bugs.webkit.org/show_bug.cgi?id=71859 + + Reviewed by Nate Chapin. + + * tests/EventListenerTest.cpp: + * tests/FrameTestHelpers.cpp: + (FrameTestHelpers): + (WebKit::FrameTestHelpers::registerMockedURLLoad): + (WebKit::FrameTestHelpers::registerMockedURLLoadAsHTML): + (WebKit::FrameTestHelpers::createWebViewAndLoad): + * tests/FrameTestHelpers.h: + (FrameTestHelpers): + * tests/ListenerLeakTest.cpp: + (WebKit::ListenerLeakTest::RunTest): + * tests/WebFrameTest.cpp: + (WebKit::WebFrameTest::registerMockedHttpURLLoad): + (WebKit::WebFrameTest::registerMockedChromeURLLoad): + * tests/WebViewTest.cpp: + (WebKit::TEST_F): + (WebKit::WebViewTest::testAutoResize): + (WebKit::WebViewTest::testTextInputType): + (TestWebViewClient): + (WebKit::TestWebViewClient::TestWebViewClient): + (WebKit::TestWebViewClient::didStartLoading): + (WebKit::TestWebViewClient::didStopLoading): + (WebKit::TestWebViewClient::didChangeLoadProgress): + (WebKit::TestWebViewClient::loadingStarted): + (WebKit::TestWebViewClient::loadingStopped): + (WebKit::TestWebViewClient::loadProgress): + (WebKit): + +2012-06-25 James Robinson <jamesr@chromium.org> + + [chromium] Use WebGraphicsContext3D in compositor implementation + https://bugs.webkit.org/show_bug.cgi?id=89700 + + Reviewed by Adrienne Walker. + + Updates tests for refactor, mostly by removing unnecessary GraphicsContext3D wrapper around mock contexts. + + * WebKit.gypi: + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::context): + * src/WebLayerTreeViewImpl.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread): + * tests/CCSingleThreadProxyTest.cpp: + * tests/CCThreadedTest.cpp: + (WebKitTests::TestHooks::createContext): + * tests/CCThreadedTest.h: + (TestHooks): + * tests/Canvas2DLayerBridgeTest.cpp: + (Canvas2DLayerBridgeTest::fullLifecycleTest): + * tests/CompositorFakeGraphicsContext3D.h: Removed. + * tests/DrawingBufferChromiumTest.cpp: Removed. + * tests/FakeCCLayerTreeHostClient.h: + * tests/FakeGraphicsContext3DTest.cpp: + (TEST): + * tests/GraphicsLayerChromiumTest.cpp: + * tests/LayerRendererChromiumTest.cpp: + (FakeLayerRendererChromium::FakeLayerRendererChromium): + (LayerRendererChromiumTest::LayerRendererChromiumTest): + (LayerRendererChromiumTest): + (TEST_F): + (TEST): + * tests/TextureCopierTest.cpp: + * tests/ThrottledTextureUploaderTest.cpp: + (WebKit::TEST): + * tests/TiledLayerChromiumTest.cpp: + +2012-06-25 Kausalya Madhusudhanan <kmadhusu@chromium.org> + + [Chromium] Add a chromium-webkit API to create a serializable file system. + https://bugs.webkit.org/show_bug.cgi?id=89776 + + In order to send a DOMFileSystem as part of WebIntent payload data it + should be serializable. Therefore, I added an API that allows us to + create serializable file system in chromium code. + + Reviewed by Adam Barth. + + * public/WebFrame.h: + (WebFrame): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createSerializableFileSystem): + (WebKit): + * src/WebFrameImpl.h: + (WebFrameImpl): + +2012-06-25 Alpha Lam <hclam@chromium.org> + + Unreviewed, rolling out r121178. + http://trac.webkit.org/changeset/121178 + https://bugs.webkit.org/show_bug.cgi?id=89784 + + New unit test added is failing on WebKit Linux (dbg) + + * tests/LayerChromiumTest.cpp: + +2012-06-25 Alpha Lam <hclam@chromium.org> + + Unreviewed, rolling out r121129. + http://trac.webkit.org/changeset/121129 + https://bugs.webkit.org/show_bug.cgi?id=89542 + + Chromium ASan failure: crbug.com/134402 + + * features.gypi: + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-06-25 Alpha Lam <hclam@chromium.org> + + Roll Chromium DEPS to r144020 + https://bugs.webkit.org/show_bug.cgi?id=89912 + + Build fixed now! Unreviewed. + + Rolled DEPS to fix chromium build. + Patch by Scott Graham <scottmg@chromium.org>. + + * DEPS: + +2012-06-25 Alec Flett <alecflett@chromium.org> + + IndexedDB: Stub out new onSuccess() handler for chromium + https://bugs.webkit.org/show_bug.cgi?id=89895 + + This is the chromium side of a refactor which will + introduce an onSuccess() method which includes the raw + SerializedScriptValue to the frontend, so the primaryKey + injection can happen in the front end, rather than + the V8 helper process. + + Reviewed by Darin Fisher. + + * public/WebIDBCallbacks.h: + (WebKit): + (WebKit::WebIDBCallbacks::onSuccess): + * src/IDBCallbacksProxy.cpp: + (WebKit::IDBCallbacksProxy::onSuccess): + * src/IDBCallbacksProxy.h: + (IDBCallbacksProxy): + * src/WebIDBCallbacksImpl.cpp: + (WebKit::WebIDBCallbacksImpl::onSuccess): + (WebKit): + * src/WebIDBCallbacksImpl.h: + (WebIDBCallbacksImpl): + +2012-06-25 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Remove unused backend property accessors + https://bugs.webkit.org/show_bug.cgi?id=89893 + + Reviewed by Darin Fisher. + + Following the "metadata" API addition in trac.webkit.org/changeset/121059 + per-property accessors can be removed from the Chromium WebKit API. + + * src/WebIDBDatabaseImpl.cpp: Removed name, version, objectStoreNames. + * src/WebIDBDatabaseImpl.h: + (WebIDBDatabaseImpl): + * src/WebIDBIndexImpl.cpp: Removed name, keyPath, unique, multiEntry. + * src/WebIDBIndexImpl.h: + (WebIDBIndexImpl): + * src/WebIDBObjectStoreImpl.cpp: Removed name, keyPath, autoIncrement, indexNames. + * src/WebIDBObjectStoreImpl.h: + (WebIDBObjectStoreImpl): + +2012-06-25 Ian Vollick <vollick@chromium.org> + + [chromium] Layer chromium should need a redraw after getting its first non-empty bounds. + https://bugs.webkit.org/show_bug.cgi?id=89784 + + Reviewed by James Robinson. + + Previously, we'd only set needs redraw if the old bounds were zero, + and the new bounds were non-zero, but we should actually have + checked that the old bounds were non-empty. + + * tests/LayerChromiumTest.cpp: + +2012-06-25 Scott Graham <scottmg@chromium.org> + + Plumb Scrollbar button dimensions down to WebThemeEngine + https://bugs.webkit.org/show_bug.cgi?id=89264 + + Reviewed by James Robinson. + + Rather than making the height of the scrollbar buttons the same as the + width of the scrollbar, delegate to the WebThemeEngine. This allows + matching the Aura theme rather than the standard Windows theme. + + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::getThemePartSize): + (WebCore): + +2012-06-25 Zeev Lieber <zlieber@chromium.org> + + [Chromium] RenderPass textures are evicted at the end of every frame + https://bugs.webkit.org/show_bug.cgi?id=89786 + + Reviewed by Adrienne Walker. + + Added unit tests to verify large textures are staying in memory + and available for render pass optimization. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-06-25 Kinuko Yasuda <kinuko@chromium.org> + + Heap-use-after-free in WebKit::MainThreadFileSystemCallbacks + https://bugs.webkit.org/show_bug.cgi?id=87019 + + Reviewed by David Levin. + + Should not access the CallbacksBridge's member field after it's freed. + + * src/WorkerFileSystemCallbacksBridge.cpp: + (WebKit::WorkerFileSystemCallbacksBridge::cleanUpAfterCallback): + 2012-06-24 Luke Macpherson <macpherson@chromium.org> Add runtime flag to enable/disable CSS variables (in addition to existing compile-time flag). diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 307c63cc0..94cb27e29 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '143776' + 'chromium_rev': '144160' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index bcbb91386..d75f5b709 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -222,6 +222,8 @@ 'public/WebPluginContainer.h', 'public/WebPluginDocument.h', 'public/WebPluginListBuilder.h', + 'public/WebPluginScrollbar.h', + 'public/WebPluginScrollbarClient.h', 'public/WebPrintParams.h', 'public/WebPrintScalingOption.h', 'public/WebPopupMenu.h', @@ -621,6 +623,7 @@ 'src/WebScopedMicrotaskSuppression.cpp', 'src/WebScopedUserGesture.cpp', 'src/WebScriptController.cpp', + 'src/WebScrollableLayer.cpp', 'src/WebScrollbarImpl.cpp', 'src/WebScrollbarImpl.h', 'src/WebSearchableFormData.cpp', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 549fdfa44..c410e6f4f 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -86,7 +86,6 @@ 'tests/CCSchedulerStateMachineTest.cpp', 'tests/CCSchedulerTestCommon.h', 'tests/CCSchedulerTest.cpp', - 'tests/CCSingleThreadProxyTest.cpp', 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTestCommon.h', 'tests/CCTiledLayerImplTest.cpp', @@ -97,11 +96,9 @@ 'tests/CCThreadedTest.h', 'tests/CCTimerTest.cpp', 'tests/ClipboardChromiumTest.cpp', - 'tests/CompositorFakeGraphicsContext3D.h', 'tests/CompositorFakeWebGraphicsContext3D.h', 'tests/DecimalTest.cpp', 'tests/DragImageTest.cpp', - 'tests/DrawingBufferChromiumTest.cpp', 'tests/EventListenerTest.cpp', 'tests/FakeCCLayerTreeHostClient.h', 'tests/FakeGraphicsContext3DTest.cpp', diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 2ae79ba92..caa41dae3 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -46,7 +46,7 @@ 'ENABLE_CSS_IMAGE_RESOLUTION=0', 'ENABLE_CSS_REGIONS=1', 'ENABLE_CSS_SHADERS=1', - 'ENABLE_CSS_VARIABLES=1', + 'ENABLE_CSS_VARIABLES=0', 'ENABLE_CUSTOM_SCHEME_HANDLER=0', 'ENABLE_DATALIST=1', 'ENABLE_DASHBOARD_SUPPORT=0', @@ -137,6 +137,7 @@ 'ENABLE_CALENDAR_PICKER=0', 'ENABLE_FONT_BOOSTING=1', 'ENABLE_INPUT_SPEECH=0', + 'ENABLE_INPUT_TYPE_COLOR=0', 'ENABLE_INPUT_TYPE_DATETIME=1', 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1', 'ENABLE_INPUT_TYPE_MONTH=1', @@ -157,11 +158,12 @@ 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1', ], 'enable_touch_icon_loading': 1, - }, { + }, { # OS!="android" 'feature_defines': [ 'ENABLE_CALENDAR_PICKER=1', 'ENABLE_FONT_BOOSTING=0', 'ENABLE_INPUT_SPEECH=1', + 'ENABLE_INPUT_TYPE_COLOR=1', 'ENABLE_JAVASCRIPT_I18N_API=1', 'ENABLE_LEGACY_NOTIFICATIONS=1', 'ENABLE_MEDIA_CAPTURE=0', @@ -174,24 +176,11 @@ 'ENABLE_WEB_AUDIO=1', ], }], - ['OS=="android" or chromeos==1', { - 'feature_defines': [ - 'ENABLE_INPUT_TYPE_COLOR=0', - ], - }, { - 'feature_defines': [ - 'ENABLE_INPUT_TYPE_COLOR=1', - ], - }], ['use_accelerated_compositing==1', { 'feature_defines': [ - 'WTF_USE_ACCELERATED_COMPOSITING=1', 'ENABLE_3D_RENDERING=1', - ], - }], - ['use_accelerated_compositing==1', { - 'feature_defines': [ 'ENABLE_ACCELERATED_2D_CANVAS=1', + 'WTF_USE_ACCELERATED_COMPOSITING=1', ], }], # Mac OS X uses Accelerate.framework FFT by default instead of FFmpeg. diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h index 5cd7f5f1e..ab67c496d 100644 --- a/Source/WebKit/chromium/public/WebFrame.h +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -297,6 +297,12 @@ public: virtual v8::Handle<v8::Value> createFileSystem(WebFileSystem::Type, const WebString& name, const WebString& rootURL) = 0; + // Creates an instance of serializable file system object. + // FIXME: Remove this API after we have a better way of creating serialized + // file system object. + virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystem::Type, + const WebString& name, + const WebString& rootURL) = 0; // Creates an instance of file or directory entry object. virtual v8::Handle<v8::Value> createFileEntry(WebFileSystem::Type, const WebString& fileSystemName, diff --git a/Source/WebKit/chromium/public/WebIDBCallbacks.h b/Source/WebKit/chromium/public/WebIDBCallbacks.h index 31d665b4b..a63c0bc9e 100644 --- a/Source/WebKit/chromium/public/WebIDBCallbacks.h +++ b/Source/WebKit/chromium/public/WebIDBCallbacks.h @@ -36,6 +36,7 @@ class WebIDBCursor; class WebIDBDatabase; class WebIDBDatabaseError; class WebIDBKey; +class WebIDBKeyPath; class WebIDBIndex; class WebIDBObjectStore; class WebIDBTransaction; @@ -54,6 +55,7 @@ public: virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(WebIDBTransaction*) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&) { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithContinuation() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onBlocked() { WEBKIT_ASSERT_NOT_REACHED(); } virtual void onSuccessWithPrefetch(const WebVector<WebIDBKey>& keys, const WebVector<WebIDBKey>& primaryKeys, const WebVector<WebSerializedScriptValue>& values) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/public/WebNodeCollection.h b/Source/WebKit/chromium/public/WebNodeCollection.h index b168b6d5b..a896f5d5d 100644 --- a/Source/WebKit/chromium/public/WebNodeCollection.h +++ b/Source/WebKit/chromium/public/WebNodeCollection.h @@ -46,7 +46,7 @@ class WebNodeCollection { public: ~WebNodeCollection() { reset(); } - WebNodeCollection() : m_private(0) { } + WebNodeCollection() : m_private(0), m_current(0) { } WebNodeCollection(const WebNodeCollection& n) : m_private(0) { assign(n); } WebNodeCollection& operator=(const WebNodeCollection& n) { @@ -70,6 +70,7 @@ public: private: void assign(WebCore::HTMLCollection*); WebCore::HTMLCollection* m_private; + mutable unsigned m_current; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/tests/CompositorFakeGraphicsContext3D.h b/Source/WebKit/chromium/public/WebPluginScrollbar.h index 937b62d4c..306f098aa 100644 --- a/Source/WebKit/chromium/tests/CompositorFakeGraphicsContext3D.h +++ b/Source/WebKit/chromium/public/WebPluginScrollbar.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 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 @@ -22,24 +22,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CompositorFakeGraphicsContext3D_h -#define CompositorFakeGraphicsContext3D_h +#ifndef WebPluginScrollbar_h +#define WebPluginScrollbar_h -#include "CompositorFakeWebGraphicsContext3D.h" -#include "GraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" +#include "WebScrollbar.h" -namespace WebCore { +namespace WebKit { -static PassRefPtr<GraphicsContext3D> createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes attrs) -{ - WebKit::WebGraphicsContext3D::Attributes webAttrs; - webAttrs.alpha = attrs.alpha; +typedef WebScrollbar WebPluginScrollbar; - OwnPtr<WebKit::WebGraphicsContext3D> webContext = WebKit::CompositorFakeWebGraphicsContext3D::create(webAttrs); - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); -} - -} +} // namespace WebKit #endif diff --git a/Source/WebKit/chromium/public/WebPluginScrollbarClient.h b/Source/WebKit/chromium/public/WebPluginScrollbarClient.h new file mode 100644 index 000000000..36f8e49c8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPluginScrollbarClient.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPluginScrollbarClient_h +#define WebPluginScrollbarClient_h + +#include "WebPluginScrollbar.h" +#include "WebScrollbarClient.h" + +namespace WebKit { + +typedef WebScrollbarClient WebPluginScrollbarClient; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextRun.h b/Source/WebKit/chromium/public/WebTextRun.h index b7a57ae69..bacfe31ad 100644 --- a/Source/WebKit/chromium/public/WebTextRun.h +++ b/Source/WebKit/chromium/public/WebTextRun.h @@ -33,7 +33,7 @@ #include "platform/WebString.h" -#ifdef WEBKIT_IMPLEMENTATION +#if WEBKIT_IMPLEMENTATION namespace WebCore { class TextRun; } #endif @@ -56,7 +56,7 @@ struct WebTextRun { bool rtl; bool directionalOverride; -#ifdef WEBKIT_IMPLEMENTATION +#if WEBKIT_IMPLEMENTATION // The resulting WebCore::TextRun will refer to the text in this // struct, so "this" must outlive the WebCore text run. operator WebCore::TextRun() const; diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index c15298204..96642f666 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -62,6 +62,7 @@ struct WebActiveWheelFlingParameters; struct WebMediaPlayerAction; struct WebPluginAction; struct WebPoint; +struct WebRenderingStats; class WebView : public WebWidget { public: @@ -249,6 +250,11 @@ public: virtual float minimumPageScaleFactor() const = 0; virtual float maximumPageScaleFactor() const = 0; + // Prevent the web page from setting a maximum scale via the viewport meta + // tag. This is an accessibility feature that lets folks zoom in to web + // pages even if the web page tries to block scaling. + virtual void setIgnoreViewportTagMaximumScale(bool) = 0; + // The ratio of the current device's screen DPI to the target device's screen DPI. virtual float deviceScaleFactor() const = 0; @@ -442,13 +448,6 @@ public: // GPU acceleration support -------------------------------------------- - // Returns the (on-screen) WebGraphicsContext3D associated with - // this WebView. One will be created if it doesn't already exist. - // This is used to set up sharing between this context (which is - // that used by the compositor) and contexts for WebGL and other - // APIs. - virtual WebGraphicsContext3D* graphicsContext3D() = 0; - // Context that's in the compositor's share group, but is not the compositor context itself. // Can be used for allocating resources that the compositor will later access. virtual WebGraphicsContext3D* sharedGraphicsContext3D() = 0; @@ -459,6 +458,10 @@ public: virtual bool setEditableSelectionOffsets(int start, int end) = 0; + // Fills in a WebRenderingStats struct containing information about the state of the compositor. + // This call is relatively expensive in threaded mode as it blocks on the compositor thread. + virtual void renderingStats(WebRenderingStats&) const { } + // Visibility ----------------------------------------------------------- // Sets the visibility of the WebView. diff --git a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h index 78a85916e..f4858f3ec 100644 --- a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h +++ b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h @@ -50,7 +50,7 @@ struct WEBKIT_EXPORT WebFontRenderStyle { char useSubpixelRendering; // use subpixel rendering (partially-filled pixels) char useSubpixelPositioning; // use subpixel positioning (fractional X positions for glyphs) -#ifdef WEBKIT_IMPLEMENTATION +#if WEBKIT_IMPLEMENTATION // Translates the members of this struct to a FontRenderStyle void toFontRenderStyle(WebCore::FontRenderStyle*); #endif diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index dd1e2104b..50c560908 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -657,6 +657,11 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen args, settings->layoutFallbackWidth(), deviceRect.width, deviceRect.height, dpi, IntSize(deviceRect.width, deviceRect.height)); + if (m_webView->ignoreViewportTagMaximumScale()) { + computed.maximumScale = max(computed.maximumScale, m_webView->maxPageScaleFactor); + computed.userScalable = true; + } + int layoutWidth = computed.layoutSize.width(); int layoutHeight = computed.layoutSize.height(); m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight)); diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp index d0e75485a..a544189b6 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp @@ -94,6 +94,10 @@ void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedSc m_callbacks->onSuccess(WebSerializedScriptValue(serializedScriptValue)); } +void IDBCallbacksProxy::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue, PassRefPtr<IDBKey> key, const IDBKeyPath& keyPath) +{ + m_callbacks->onSuccess(serializedScriptValue, key, keyPath); +} void IDBCallbacksProxy::onSuccessWithContinuation() { m_callbacks->onSuccessWithContinuation(); diff --git a/Source/WebKit/chromium/src/IDBCallbacksProxy.h b/Source/WebKit/chromium/src/IDBCallbacksProxy.h index 333351fdb..db3056550 100644 --- a/Source/WebKit/chromium/src/IDBCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBCallbacksProxy.h @@ -52,6 +52,7 @@ public: virtual void onSuccess(PassRefPtr<WebCore::IDBKey>); virtual void onSuccess(PassRefPtr<WebCore::IDBTransactionBackendInterface>); virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>); + virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, const WebCore::IDBKeyPath&); virtual void onSuccessWithContinuation(); virtual void onSuccessWithPrefetch(const Vector<RefPtr<WebCore::IDBKey> >& keys, const Vector<RefPtr<WebCore::IDBKey> >& primaryKeys, const Vector<RefPtr<WebCore::SerializedScriptValue> >& values); virtual void onBlocked(); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 2c37209c6..0970ce6c2 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -34,6 +34,7 @@ #include "PlatformContextSkia.h" #include "WebViewImpl.h" #include "cc/CCLayerTreeHost.h" +#include <public/WebFloatPoint.h> namespace WebKit { @@ -80,41 +81,41 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) return; } - if (layer->platformLayer() == scrollLayer()) + if (WebScrollableLayer(layer->platformLayer()) == scrollLayer()) return; layer->addChildAtIndex(m_graphicsLayer.get(), 0); - ASSERT(scrollLayer()); + ASSERT(haveScrollLayer()); } -static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::LayerChromium* clipLayer) +static void reserveScrollbarLayers(WebLayer layer, WebLayer clipLayer) { // Scrollbars and corners are known to be attached outside the root clip // rect, so skip the clipLayer subtree. if (layer == clipLayer) return; - for (size_t i = 0; i < layer->children().size(); ++i) - reserveScrollbarLayers(layer->children()[i].get(), clipLayer); + for (size_t i = 0; i < layer.numberOfChildren(); ++i) + reserveScrollbarLayers(layer.childAt(i), clipLayer); - if (layer->drawsContent()) - layer->setAlwaysReserveTextures(true); + if (layer.drawsContent()) + layer.setAlwaysReserveTextures(true); } void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale) { - if (!scrollLayer()) + if (!haveScrollLayer()) return; bool visibleRectChanged = m_viewportSize != viewportSize; m_viewportSize = viewportSize; - - scrollLayer()->setScrollPosition(scrollPosition + toSize(scrollOrigin)); - scrollLayer()->setPosition(-scrollPosition); + WebScrollableLayer layer = scrollLayer(); + layer.setScrollPosition(scrollPosition + scrollOrigin); + layer.setPosition(WebFloatPoint(-scrollPosition)); // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. - scrollLayer()->setScrollable(true); + layer.setScrollable(true); m_deviceScaleFactor = deviceScale; m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); @@ -135,18 +136,23 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, } else if (visibleRectChanged) m_graphicsLayer->setNeedsDisplay(); - WebCore::LayerChromium* clipLayer = scrollLayer()->parent(); - WebCore::LayerChromium* rootLayer = clipLayer; - while (rootLayer->parent()) - rootLayer = rootLayer->parent(); + WebLayer clipLayer = layer.parent(); + WebLayer rootLayer = clipLayer; + while (!rootLayer.parent().isNull()) + rootLayer = rootLayer.parent(); reserveScrollbarLayers(rootLayer, clipLayer); } -WebCore::LayerChromium* NonCompositedContentHost::scrollLayer() +bool NonCompositedContentHost::haveScrollLayer() +{ + return m_graphicsLayer->parent(); +} + +WebScrollableLayer NonCompositedContentHost::scrollLayer() { if (!m_graphicsLayer->parent()) - return 0; - return m_graphicsLayer->parent()->platformLayer(); + return WebScrollableLayer(); + return WebScrollableLayer(m_graphicsLayer->parent()->platformLayer()); } void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 9706860d7..e60e9ef48 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -29,6 +29,7 @@ #include "GraphicsLayerClient.h" #include "IntSize.h" +#include <public/WebScrollableLayer.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -39,7 +40,6 @@ class GraphicsLayer; class GraphicsContext; class IntPoint; class IntRect; -class LayerChromium; } namespace WebKit { @@ -79,7 +79,8 @@ private: // size, so it is always 1 for the GraphicsLayer. virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } - WebCore::LayerChromium* scrollLayer(); + bool haveScrollLayer(); + WebScrollableLayer scrollLayer(); OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer; WebViewImpl* m_webView; diff --git a/Source/WebKit/chromium/src/WebContentLayer.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp index 2c041c2cb..14ce98039 100644 --- a/Source/WebKit/chromium/src/WebContentLayer.cpp +++ b/Source/WebKit/chromium/src/WebContentLayer.cpp @@ -54,7 +54,7 @@ void WebContentLayer::setContentsScale(float scale) } WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node) - : WebLayer(node) + : WebScrollableLayer(node) { } diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 8ccec72b1..afe0f99ff 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -950,6 +950,15 @@ v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, return toV8(DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create())); } +v8::Handle<v8::Value> WebFrameImpl::createSerializableFileSystem(WebFileSystem::Type type, + const WebString& name, + const WebString& path) +{ + RefPtr<DOMFileSystem> fs = DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create()); + fs->makeClonable(); + return toV8(fs.release()); +} + v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, const WebString& fileSystemName, const WebString& fileSystemPath, diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 39937471a..3ddfb76d2 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -126,6 +126,9 @@ public: virtual v8::Handle<v8::Value> createFileSystem(WebFileSystem::Type, const WebString& name, const WebString& path); + virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystem::Type, + const WebString& name, + const WebString& path); virtual v8::Handle<v8::Value> createFileEntry(WebFileSystem::Type, const WebString& fileSystemName, const WebString& fileSystemPath, diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index 1a82a63d8..31266b1a3 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -90,6 +90,13 @@ void WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedSc m_callbacks->onSuccess(serializedScriptValue); } +void WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKey& key, const WebIDBKeyPath& keyPath) +{ + // FIXME: proxy to the 3-parameter version when interface lands: + // m_callbacks->onSuccess(serializedScriptValue, key, keyPath);); + ASSERT_NOT_REACHED(); +} + void WebIDBCallbacksImpl::onSuccessWithContinuation() { m_callbacks->onSuccessWithContinuation(); diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h index be8541b70..7b0216359 100644 --- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h @@ -48,6 +48,7 @@ public: virtual void onSuccess(const WebIDBKey&); virtual void onSuccess(WebIDBTransaction*); virtual void onSuccess(const WebSerializedScriptValue&); + virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&); virtual void onSuccessWithContinuation(); virtual void onBlocked(); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index 39803e145..18573cacf 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -58,21 +58,6 @@ WebIDBMetadata WebIDBDatabaseImpl::metadata() const return m_databaseBackend->metadata(); } -WebString WebIDBDatabaseImpl::name() const -{ - return m_databaseBackend->name(); -} - -WebString WebIDBDatabaseImpl::version() const -{ - return m_databaseBackend->version(); -} - -WebDOMStringList WebIDBDatabaseImpl::objectStoreNames() const -{ - return m_databaseBackend->objectStoreNames(); -} - 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); diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 5e989e00e..4f8251820 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -51,9 +51,6 @@ public: virtual ~WebIDBDatabaseImpl(); virtual WebIDBMetadata metadata() const; - virtual WebString name() const; - virtual WebString version() const; - virtual WebDOMStringList objectStoreNames() const; virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&); virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp index 7f74e5a47..9b1d68cff 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -48,26 +48,6 @@ WebIDBIndexImpl::~WebIDBIndexImpl() { } -WebString WebIDBIndexImpl::name() const -{ - return m_backend->name(); -} - -WebIDBKeyPath WebIDBIndexImpl::keyPath() const -{ - return WebIDBKeyPath(m_backend->keyPath()); -} - -bool WebIDBIndexImpl::unique() const -{ - return m_backend->unique(); -} - -bool WebIDBIndexImpl::multiEntry() const -{ - return m_backend->multiEntry(); -} - void WebIDBIndexImpl::openObjectCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_backend->openCursor(keyRange, direction, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.h b/Source/WebKit/chromium/src/WebIDBIndexImpl.h index 04fea582f..220962b57 100644 --- a/Source/WebKit/chromium/src/WebIDBIndexImpl.h +++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.h @@ -43,11 +43,6 @@ public: WebIDBIndexImpl(WTF::PassRefPtr<WebCore::IDBIndexBackendInterface>); virtual ~WebIDBIndexImpl(); - virtual WebString name() const; - virtual WebIDBKeyPath keyPath() const; - virtual bool unique() const; - virtual bool multiEntry() const; - virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index 4c45be2f9..9bac6d3c3 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -53,26 +53,6 @@ WebIDBObjectStoreImpl::~WebIDBObjectStoreImpl() { } -WebString WebIDBObjectStoreImpl::name() const -{ - return m_objectStore->name(); -} - -WebIDBKeyPath WebIDBObjectStoreImpl::keyPath() const -{ - return m_objectStore->keyPath(); -} - -WebDOMStringList WebIDBObjectStoreImpl::indexNames() const -{ - return m_objectStore->indexNames(); -} - -bool WebIDBObjectStoreImpl::autoIncrement() const -{ - return m_objectStore->autoIncrement(); -} - void WebIDBObjectStoreImpl::get(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec) { m_objectStore->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 1bffd562b..5a881b592 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -45,11 +45,6 @@ public: WebIDBObjectStoreImpl(WTF::PassRefPtr<WebCore::IDBObjectStoreBackendInterface>); ~WebIDBObjectStoreImpl(); - WebString name() const; - WebIDBKeyPath keyPath() const; - WebDOMStringList indexNames() const; - bool autoIncrement() const; - void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp index 25cb5868c..5b8d55cf4 100644 --- a/Source/WebKit/chromium/src/WebLayer.cpp +++ b/Source/WebKit/chromium/src/WebLayer.cpp @@ -118,6 +118,16 @@ WebLayer WebLayer::parent() const return WebLayer(const_cast<LayerChromium*>(m_private->parent())); } +size_t WebLayer::numberOfChildren() const +{ + return m_private->children().size(); +} + +WebLayer WebLayer::childAt(size_t index) const +{ + return WebLayer(m_private->children()[index]); +} + void WebLayer::addChild(const WebLayer& child) { m_private->addChild(child); @@ -300,6 +310,11 @@ void WebLayer::setDebugBorderWidth(float width) m_private->setDebugBorderWidth(width); } +void WebLayer::setAlwaysReserveTextures(bool reserve) +{ + m_private->setAlwaysReserveTextures(reserve); +} + void WebLayer::setForceRenderSurface(bool forceRenderSurface) { m_private->setForceRenderSurface(forceRenderSurface); diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index 356af1de2..207a8350d 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -31,10 +31,12 @@ #include "WebLayerTreeViewImpl.h" #include "cc/CCGraphicsContext.h" #include "cc/CCLayerTreeHost.h" +#include "cc/CCRenderingStats.h" #include "platform/WebLayer.h" #include "platform/WebPoint.h" #include "platform/WebRect.h" #include "platform/WebSize.h" +#include <public/WebRenderingStats.h> using namespace WebCore; @@ -173,9 +175,13 @@ void WebLayerTreeView::finishAllRendering() m_private->layerTreeHost()->finishAllRendering(); } -WebGraphicsContext3D* WebLayerTreeView::context() +void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const { - return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()->context3D()); + CCRenderingStats ccStats; + m_private->layerTreeHost()->renderingStats(ccStats); + + stats.numAnimationFrames = ccStats.numAnimationFrames; + stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; } void WebLayerTreeView::loseCompositorContext(int numTimes) diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 17d5fe867..825fc01ef 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -54,12 +54,9 @@ public: virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); } virtual void layout() OVERRIDE { m_client->layout(); } virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } - virtual PassRefPtr<WebCore::GraphicsContext3D> createContext3D() OVERRIDE + virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE { - OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D()); - if (!webContext) - return 0; - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ ); + return adoptPtr(m_client->createContext3D()); } virtual void didRecreateContext(bool success) OVERRIDE { m_client->didRebindGraphicsContext(success); } virtual void willCommit() OVERRIDE { m_client->willCommit(); } diff --git a/Source/WebKit/chromium/src/WebNodeCollection.cpp b/Source/WebKit/chromium/src/WebNodeCollection.cpp index a8356d9d5..617bf564a 100644 --- a/Source/WebKit/chromium/src/WebNodeCollection.cpp +++ b/Source/WebKit/chromium/src/WebNodeCollection.cpp @@ -74,12 +74,16 @@ unsigned WebNodeCollection::length() const WebNode WebNodeCollection::nextItem() const { - return WebNode(m_private->nextItem()); + Node* node = m_private->item(m_current); + if (node) + m_current++; + return WebNode(node); } WebNode WebNodeCollection::firstItem() const { - return WebNode(m_private->firstItem()); + m_current = 0; + return nextItem(); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index 072a9909c..ac200f1c9 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -477,7 +477,8 @@ void WebPageSerializerImpl::collectTargetFrames() Document* currentDoc = currentFrame->frame()->document(); // Go through sub-frames. RefPtr<HTMLAllCollection> all = currentDoc->all(); - for (Node* node = all->firstItem(); node; node = all->nextItem()) { + + for (unsigned i = 0; Node* node = all->item(i); i++) { if (!node->isHTMLElement()) continue; Element* element = static_cast<Element*>(node); diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp new file mode 100644 index 000000000..19e410aa5 --- /dev/null +++ b/Source/WebKit/chromium/src/WebScrollableLayer.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <public/WebScrollableLayer.h> + +#include "LayerChromium.h" + + +namespace WebKit { + +void WebScrollableLayer::setScrollPosition(WebPoint position) +{ + m_private->setScrollPosition(position); +} + +void WebScrollableLayer::setScrollable(bool scrollable) +{ + m_private->setScrollable(scrollable); +} + +void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers) +{ + m_private->setHaveWheelEventHandlers(haveWheelEventHandlers); +} + +void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread) +{ + m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread); +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index d2393c31c..652e9a616 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -386,6 +386,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_pageDefinedMaximumPageScaleFactor(-1) , m_minimumPageScaleFactor(minPageScaleFactor) , m_maximumPageScaleFactor(maxPageScaleFactor) + , m_ignoreViewportTagMaximumScale(false) , m_pageScaleFactorIsSet(false) , m_contextMenuAllowed(false) , m_doingDragAndDrop(false) @@ -728,6 +729,13 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar scheduleAnimation(); } +void WebViewImpl::renderingStats(WebRenderingStats& stats) const +{ + ASSERT(isAcceleratedCompositingActive()); + if (!m_layerTreeView.isNull()) + m_layerTreeView.renderingStats(stats); +} + void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) { if (!m_layerTreeView.isNull()) @@ -2607,6 +2615,16 @@ void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal computePageScaleFactorLimits(); } +void WebViewImpl::setIgnoreViewportTagMaximumScale(bool flag) +{ + m_ignoreViewportTagMaximumScale = flag; + + if (!page() || !page()->mainFrame()) + return; + + m_page->chrome()->client()->dispatchViewportPropertiesDidChange(page()->mainFrame()->document()->viewportArguments()); +} + bool WebViewImpl::computePageScaleFactorLimits() { if (m_pageDefinedMinimumPageScaleFactor == -1 || m_pageDefinedMaximumPageScaleFactor == -1) @@ -3698,30 +3716,6 @@ void WebViewImpl::updateLayerTreeViewport() m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } -WebGraphicsContext3D* WebViewImpl::graphicsContext3D() -{ -#if USE(ACCELERATED_COMPOSITING) - if (m_page->settings()->acceleratedCompositingEnabled() && allowsAcceleratedCompositing()) { - if (!m_layerTreeView.isNull()) { - WebGraphicsContext3D* context = m_layerTreeView.context(); - if (context && !context->isContextLost()) - return context; - } - // If we get here it means that some system needs access to the context the compositor will use but the compositor itself - // hasn't requested a context or it was unable to successfully instantiate a context. - // We need to return the context that the compositor will later use so we allocate a new context (if needed) and stash it - // until the compositor requests and takes ownership of the context via createLayerTreeHost3D(). - if (!m_temporaryOnscreenGraphicsContext3D) - m_temporaryOnscreenGraphicsContext3D = createCompositorGraphicsContext3D(); - - WebGraphicsContext3D* webContext = m_temporaryOnscreenGraphicsContext3D.get(); - if (webContext && !webContext->isContextLost()) - return webContext; - } -#endif - return 0; -} - WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() { if (!m_page->settings()->acceleratedCompositingEnabled() || !allowsAcceleratedCompositing()) diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index d4527da0d..f657504f2 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -207,6 +207,7 @@ public: virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale); virtual float minimumPageScaleFactor() const; virtual float maximumPageScaleFactor() const; + virtual void setIgnoreViewportTagMaximumScale(bool); virtual float deviceScaleFactor() const; virtual void setDeviceScaleFactor(float); @@ -293,6 +294,7 @@ public: virtual void updateBatteryStatus(const WebBatteryStatus&); #endif virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); + virtual void renderingStats(WebRenderingStats&) const; // WebLayerTreeViewClient virtual void willBeginFrame(); @@ -451,6 +453,8 @@ public: return m_emulatedTextZoomFactor; } + bool ignoreViewportTagMaximumScale() const { return m_ignoreViewportTagMaximumScale; } + // Determines whether a page should e.g. be opened in a background tab. // Returns false if it has no opinion, in which case it doesn't set *policy. static bool navigationPolicyFromMouseEvent( @@ -516,13 +520,6 @@ public: void scheduleAnimation(); #endif - // Returns the onscreen 3D context used by the compositor. This is - // used by the renderer's code to set up resource sharing between - // the compositor's context and subordinate contexts for APIs like - // WebGL. Returns 0 if compositing support is not compiled in or - // we could not successfully instantiate a context. - virtual WebGraphicsContext3D* graphicsContext3D(); - virtual WebGraphicsContext3D* sharedGraphicsContext3D(); PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D(); @@ -709,6 +706,8 @@ private: float m_minimumPageScaleFactor; float m_maximumPageScaleFactor; + bool m_ignoreViewportTagMaximumScale; + bool m_pageScaleFactorIsSet; bool m_contextMenuAllowed; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp index e87b5aa29..bd9b1761a 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp @@ -187,8 +187,10 @@ void WorkerFileSystemCallbacksBridge::cleanUpAfterCallback() m_callbacksOnWorkerThread = 0; if (m_workerContextObserver) { - delete m_workerContextObserver; + WorkerFileSystemContextObserver* observer = m_workerContextObserver; m_workerContextObserver = 0; + // The next line may delete this. + delete observer; } } diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index d19b036bb..34846b7c2 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -30,7 +30,6 @@ #include "CCLayerTestCommon.h" #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" #include "LayerRendererChromium.h" #include "ManagedTexture.h" #include "cc/CCIOSurfaceLayerImpl.h" @@ -82,7 +81,7 @@ public: virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } - PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassRefPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) + PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOwnPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) { CCSettings::setPartialSwapEnabled(partialSwap); @@ -162,9 +161,9 @@ public: } protected: - PassRefPtr<CCGraphicsContext> createContext() + PassOwnPtr<CCGraphicsContext> createContext() { - return CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow)); + return CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3D)); } DebugScopedSetImplThread m_alwaysImplThread; @@ -1511,10 +1510,9 @@ public: // viewport size is never set. TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) { - ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext(); - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow); - RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context); - m_hostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader); + OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new ReshapeTrackerContext)); + ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); + m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1555,16 +1553,15 @@ private: // where it should request to swap only the subBuffer that is damaged. TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) { - PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext(); - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow); - RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context); + OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new PartialSwapTrackerContext)); + PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D()); // This test creates its own CCLayerTreeHostImpl, so // that we can force partial swap enabled. CCLayerTreeSettings settings; CCSettings::setPartialSwapEnabled(true); OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this); - layerTreeHostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader); + layerTreeHostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); layerTreeHostImpl->setViewportSize(IntSize(500, 500)); CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); @@ -1725,15 +1722,15 @@ public: TEST_F(CCLayerTreeHostImplTest, noPartialSwap) { - MockContext* mockContext = new MockContext(); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext)); + MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); harness.mustDrawSolidQuad(); harness.mustSetScissor(0, 0, 10, 10); // Run test case - OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, FakeLayerWithQuads::create(1)); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), FakeLayerWithQuads::create(1)); CCLayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); @@ -1744,14 +1741,14 @@ TEST_F(CCLayerTreeHostImplTest, noPartialSwap) TEST_F(CCLayerTreeHostImplTest, partialSwap) { - MockContext* mockContext = new MockContext(); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext)); + MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); harness.mustDrawSolidQuad(); harness.mustSetScissor(0, 0, 10, 10); - OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1)); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1)); CCLayerTreeHostImpl::FrameData frame; EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); @@ -1762,8 +1759,8 @@ TEST_F(CCLayerTreeHostImplTest, partialSwap) TEST_F(CCLayerTreeHostImplTest, partialSwapNoUpdate) { - MockContext* mockContext = new MockContext(); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext)); + MockContext* mockContext = static_cast<MockContext*>(context->context3D()); MockContextHarness harness(mockContext); harness.mustDrawSolidQuad(); @@ -1771,7 +1768,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapNoUpdate) harness.mustDrawSolidQuad(); harness.mustSetScissor(0, 0, 10, 10); - OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1)); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1)); // Draw once to make sure layer is not new CCLayerTreeHostImpl::FrameData frame; @@ -1804,13 +1801,20 @@ public: { return WebString("GL_CHROMIUM_post_sub_buffer"); } + + // Unlimited texture size. + virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) + { + if (pname == WebCore::GraphicsContext3D::MAX_TEXTURE_SIZE) + *value = 8192; + } }; static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, CCLayerTreeHostImplClient* client) { CCSettings::setPartialSwapEnabled(partialSwap); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); CCLayerTreeSettings settings; OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client); @@ -1921,7 +1925,7 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnScissoredLayer) CCLayerTreeSettings settings; CCSettings::setPartialSwapEnabled(true); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); myHostImpl->setViewportSize(IntSize(10, 10)); @@ -2021,7 +2025,7 @@ public: TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) { // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. - m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)), UnthrottledUploader); + m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); m_hostImpl->finishAllRendering(); } @@ -2131,11 +2135,6 @@ public: ADD_FAILURE() << "Trying to bind texture id " << id; } - static PassRefPtr<GraphicsContext3D> createGraphicsContext() - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow); - } - private: HashSet<unsigned> m_allocatedTextureIds; }; @@ -2186,11 +2185,6 @@ public: return WebString(); } - - static PassRefPtr<GraphicsContext3D> createGraphicsContext() - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow); - } }; class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { @@ -2202,11 +2196,6 @@ public: return WebString(); } - - static PassRefPtr<GraphicsContext3D> createGraphicsContext() - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow); - } }; TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) @@ -2254,7 +2243,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) rootLayer->addChild(ioSurfaceLayer.release()); // Use a context that supports IOSurfaces - m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(FakeWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader); + m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); m_hostImpl->setRootLayer(rootLayer.release()); @@ -2266,7 +2255,7 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface, // that will warn if any resource from the previous context gets used. - m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(StrictWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader); + m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); m_hostImpl->drawLayers(frame); m_hostImpl->didDrawAllLayers(frame); @@ -2307,11 +2296,6 @@ public: return WebString(); } - PassRefPtr<GraphicsContext3D> createGraphicsContext() - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(this), GraphicsContext3D::RenderDirectlyToHostWindow); - } - unsigned numTextures() const { return m_numTextures; } private: @@ -2363,11 +2347,10 @@ TEST_F(CCLayerTreeHostImplTest, layersFreeTextures) ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); rootLayer->addChild(ioSurfaceLayer.release()); - // Lose the context, replacing it with a TrackingWebGraphicsContext3D, that - // tracks the number of textures allocated. This pointer is owned by its - // GraphicsContext3D. - TrackingWebGraphicsContext3D* trackingWebGraphicsContext = new TrackingWebGraphicsContext3D(); - m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(trackingWebGraphicsContext->createGraphicsContext()), UnthrottledUploader); + // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of). + OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new TrackingWebGraphicsContext3D))); + TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); + m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); m_hostImpl->setRootLayer(rootLayer.release()); @@ -2395,11 +2378,11 @@ public: TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground) { - MockDrawQuadsToFillScreenContext* mockContext = new MockDrawQuadsToFillScreenContext(); - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockDrawQuadsToFillScreenContext)); + MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D()); // Run test case - OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, CCLayerImpl::create(1)); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), CCLayerImpl::create(1)); myHostImpl->setBackgroundColor(Color::white); // Verify one quad is drawn when transparent background set is not set. @@ -2422,21 +2405,21 @@ TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground) Mock::VerifyAndClearExpectations(&mockContext); } -static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr) +static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) { - RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext)); layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); - layerTreeHostImpl->setViewportSize(IntSize(100, 100)); + layerTreeHostImpl->setViewportSize(rootSize); OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); rootPtr = root.get(); root->setAnchorPoint(FloatPoint(0, 0)); root->setPosition(FloatPoint(0, 0)); - root->setBounds(IntSize(100, 100)); - root->setContentBounds(IntSize(100, 100)); - root->setVisibleLayerRect(IntRect(0, 0, 100, 100)); + root->setBounds(rootSize); + root->setContentBounds(rootSize); + root->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); root->setDrawsContent(true); layerTreeHostImpl->setRootLayer(root.release()); @@ -2446,9 +2429,9 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, intermediateLayerPtr->setAnchorPoint(FloatPoint(0, 0)); intermediateLayerPtr->setPosition(FloatPoint(10, 10)); - intermediateLayerPtr->setBounds(IntSize(100, 100)); - intermediateLayerPtr->setContentBounds(IntSize(100, 100)); - intermediateLayerPtr->setVisibleLayerRect(IntRect(0, 0, 100, 100)); + intermediateLayerPtr->setBounds(rootSize); + intermediateLayerPtr->setContentBounds(rootSize); + intermediateLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); intermediateLayerPtr->setDrawsContent(false); // only children draw content rootPtr->addChild(intermediateLayer.release()); @@ -2457,11 +2440,12 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, // Surface layer is the layer that changes its opacity // It will contain other layers that draw content. + IntSize surfaceSize(rootSize.width(), rootSize.height()); surfaceLayerPtr->setAnchorPoint(FloatPoint(0, 0)); surfaceLayerPtr->setPosition(FloatPoint(10, 10)); - surfaceLayerPtr->setBounds(IntSize(50, 50)); - surfaceLayerPtr->setContentBounds(IntSize(50, 50)); - surfaceLayerPtr->setVisibleLayerRect(IntRect(0, 0, 50, 50)); + surfaceLayerPtr->setBounds(surfaceSize); + surfaceLayerPtr->setContentBounds(surfaceSize); + surfaceLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), surfaceSize)); surfaceLayerPtr->setDrawsContent(false); // only children draw content surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface intermediateLayerPtr->addChild(surfaceLayer.release()); @@ -2470,11 +2454,12 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, OwnPtr<FakeLayerWithQuads> child = FakeLayerWithQuads::create(4); childPtr = child.get(); + IntSize childSize(rootSize.width(), rootSize.height()); childPtr->setAnchorPoint(FloatPoint(0, 0)); childPtr->setPosition(FloatPoint(5, 5)); - childPtr->setBounds(IntSize(10, 10)); - childPtr->setContentBounds(IntSize(10, 10)); - childPtr->setVisibleLayerRect(IntRect(0, 0, 10, 10)); + childPtr->setBounds(childSize); + childPtr->setContentBounds(childSize); + childPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), childSize)); childPtr->setDrawsContent(true); surfaceLayerPtr->addChild(child.release()); @@ -2492,7 +2477,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) CCLayerImpl* surfaceLayerPtr; CCLayerImpl* childPtr; - setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr); + setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100)); { CCLayerTreeHostImpl::FrameData frame; @@ -2649,7 +2634,7 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) CCLayerImpl* surfaceLayerPtr; CCLayerImpl* childPtr; - setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr); + setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100)); { CCLayerTreeHostImpl::FrameData frame; @@ -2796,6 +2781,80 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) } } +// FIXME: This test is temporary until memory management in render surfaces gets refactored. +// It depends on implementation of TextureManager and needs to get removed as +// it will become meaningless with a different implementation. +TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) +{ + CCSettings::setPartialSwapEnabled(true); + + CCLayerTreeSettings settings; + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); + + CCLayerImpl* rootPtr; + CCLayerImpl* intermediateLayerPtr; + CCLayerImpl* surfaceLayerPtr; + CCLayerImpl* childPtr; + + // FIXME: The number 4200 is the "magic" number which will cause render surface size + // to go above 64M. This will bring it above reclaimLimitBytes(). + // We could compute this number from return value of reclaimLimitBytes(), however + // it takes a viewport, so it's no better as it still contains same kind of assumption + // (namely that reclaimLimitBytes() ignores viewport size). + IntSize largeSurfaceSize(4200, 4200); + setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, largeSurfaceSize); + + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive two render passes, each with one quad + ASSERT_EQ(2U, frame.renderPasses.size()); + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size()); + + EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); + CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); + EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // Draw without any change + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive two EMPTY render passes + ASSERT_EQ(2U, frame.renderPasses.size()); + EXPECT_EQ(0U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(0U, frame.renderPasses[1]->quadList().size()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } + + // Change opacity and draw. + // If all goes well, the texture must still be available, even though it's really big. + surfaceLayerPtr->setOpacity(0.6f); + { + CCLayerTreeHostImpl::FrameData frame; + EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); + + // Must receive one render pass, as the other one should be culled + ASSERT_EQ(1U, frame.renderPasses.size()); + + EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); + EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); + CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); + EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + + myHostImpl->drawLayers(frame); + myHostImpl->didDrawAllLayers(frame); + } +} + struct RenderPassCacheEntry { mutable OwnPtr<CCRenderPass> renderPassPtr; CCRenderPass* renderPass; diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index d2773790e..7d14d38d5 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -866,7 +866,7 @@ public: virtual void layout() { LayerChromium* root = m_layerTreeHost->rootLayer(); - if (!m_layerTreeHost->frameNumber()) + if (!m_layerTreeHost->commitNumber()) EXPECT_EQ(root->scrollPosition(), m_initialScroll); else { EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount); @@ -952,7 +952,7 @@ public: root->setScrollable(true); root->setMaxScrollPosition(IntSize(100, 100)); - if (!impl->sourceFrameNumber() && impl->frameNumber() == 1) { + if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 1) { // First draw after first commit. EXPECT_EQ(root->scrollDelta(), IntSize()); root->scrollBy(m_scrollAmount); @@ -960,7 +960,7 @@ public: EXPECT_EQ(root->scrollPosition(), m_initialScroll); postSetNeedsRedrawToMainThread(); - } else if (!impl->sourceFrameNumber() && impl->frameNumber() == 2) { + } else if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 2) { // Second draw after first commit. EXPECT_EQ(root->scrollDelta(), m_scrollAmount); root->scrollBy(m_scrollAmount); @@ -970,7 +970,7 @@ public: postSetNeedsCommitToMainThread(); } else if (impl->sourceFrameNumber() == 1) { // Third or later draw after second commit. - EXPECT_GE(impl->frameNumber(), 3); + EXPECT_GE(impl->sourceAnimationFrameNumber(), 3); EXPECT_EQ(root->scrollDelta(), IntSize()); EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount); endTest(); @@ -1369,7 +1369,7 @@ public: virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D())); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); switch (impl->sourceFrameNumber()) { case 0: @@ -1403,7 +1403,7 @@ public: virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D())); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); // Number of textures used for draw should always be one. EXPECT_EQ(1, context->numUsedTextures()); @@ -1473,7 +1473,7 @@ public: virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D())); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); switch (impl->sourceFrameNumber()) { case 0: @@ -1542,7 +1542,7 @@ public: virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) { - CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D())); + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D()); // Number of textures used for drawing should two except for frame 4 // where the viewport only contains one layer. @@ -2235,7 +2235,7 @@ public: virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { EXPECT_EQ(m_rootScrollLayer->scrollPosition(), IntPoint()); - if (!m_layerTreeHost->frameNumber()) + if (!m_layerTreeHost->commitNumber()) EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint()); else EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint() + m_scrollAmount); @@ -2243,11 +2243,11 @@ public: virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE { - if (impl->frameNumber() == 1) { + if (impl->sourceAnimationFrameNumber() == 1) { EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted); impl->scrollBy(m_scrollAmount); impl->scrollEnd(); - } else if (impl->frameNumber() == 2) + } else if (impl->sourceAnimationFrameNumber() == 2) endTest(); } diff --git a/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp b/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp deleted file mode 100644 index 4fe40f241..000000000 --- a/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "cc/CCSingleThreadProxy.h" - -#include "CCThreadedTest.h" -#include "CompositorFakeWebGraphicsContext3D.h" -#include "FakeWebGraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" -#include "platform/WebThread.h" - -using namespace WebCore; -using namespace WebKit; -using namespace WebKitTests; - -class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D { -public: - virtual bool makeContextCurrent() { return false; } -}; - -class CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation : public CCThreadedTest { -public: - CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation() - { - } - - virtual void beginTest() - { - // This will cause the animation timer to be set which will fire in - // CCSingleThreadProxy::animationTimerDelay() seconds. - postAddAnimationToMainThread(); - } - - virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) - { - ASSERT_NOT_REACHED(); - } - - virtual void didRecreateContext(bool succeeded) - { - EXPECT_FALSE(succeeded); - - // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds - // (use ceil just to be sure). If the timer was not disabled, we will - // attempt to call CCSingleThreadProxy::compositeImmediately and the - // test will fail. - endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000)); - } - - virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow); - } - - virtual void afterTest() - { - } -}; - -TEST_F(CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread) -{ - runTest(false); -} - -class CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer : public CCThreadedTest { -public: - CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer() - { - } - - virtual void beginTest() - { - // This will cause the animation timer to be set which will fire in - // CCSingleThreadProxy::animationTimerDelay() seconds. - postDidAddAnimationToMainThread(); - } - - virtual void animateLayers(CCLayerTreeHostImpl*, double) - { - ASSERT_NOT_REACHED(); - } - - virtual void didRecreateContext(bool) - { - ASSERT_NOT_REACHED(); - } - - virtual void didAddAnimation() - { - // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds - // (use ceil just to be sure). If the timer was not disabled, we will - // attempt to call CCSingleThreadProxy::compositeImmediately and the - // test will fail. - endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000)); - } - - virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE - { - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow); - } - - virtual void afterTest() - { - } -}; - -TEST_F(CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer, runSingleThread) -{ - runTest(false); -} diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index 57b6df14e..40d3ce5e6 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -103,14 +103,9 @@ CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphics { } -PassRefPtr<GraphicsContext3D> TestHooks::createContext() +PassOwnPtr<WebGraphicsContext3D> TestHooks::createContext() { - GraphicsContext3D::Attributes attrs; - WebGraphicsContext3D::Attributes webAttrs; - webAttrs.alpha = attrs.alpha; - - OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs); - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow); + return CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes()); } PassOwnPtr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client) @@ -232,7 +227,7 @@ public: m_testHooks->applyScrollAndScale(scrollDelta, scale); } - virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE + virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE { return m_testHooks->createContext(); } diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.h b/Source/WebKit/chromium/tests/CCThreadedTest.h index c0ca44fee..75886effe 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.h +++ b/Source/WebKit/chromium/tests/CCThreadedTest.h @@ -68,7 +68,7 @@ public: virtual void notifyAnimationStarted(double time) { } virtual void notifyAnimationFinished(double time) { } - virtual PassRefPtr<WebCore::GraphicsContext3D> createContext(); + virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext(); }; class TimeoutTask; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index bacf873fc..435907c94 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -74,15 +74,11 @@ class Canvas2DLayerBridgeTest : public Test { protected: void fullLifecycleTest(ThreadMode threadMode, DeferralMode deferralMode) { - GraphicsContext3D::Attributes attrs; - - RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow); - RefPtr<CCGraphicsContext> ccMainContext = CCGraphicsContext::create3D(mainContext); - RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow); - RefPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(implContext); + RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext)); + OwnPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(adoptPtr(new MockCanvasContext)); MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get())); - MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get())); + MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(ccImplContext->context3D()); MockWebTextureUpdater updater; @@ -151,7 +147,7 @@ TEST(Canvas2DLayerBridgeTest2, testClearClient) { GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow); + RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext)); OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainContext.get(), IntSize(100, 100), Deferred, 1); RefPtr<LayerChromium> layer = bridge->layer(); bridge.clear(); diff --git a/Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp b/Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp deleted file mode 100644 index 27ef49281..000000000 --- a/Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "DrawingBuffer.h" - -#include "CompositorFakeGraphicsContext3D.h" -#include "LayerChromium.h" -#include <gmock/gmock.h> -#include <gtest/gtest.h> - -using namespace WebCore; -using namespace WebKit; - -namespace { - -TEST(DrawingBufferChromiumTest, opaqueFormats) -{ - RefPtr<DrawingBuffer> buffer; - - GraphicsContext3D::Attributes alphaAttrs; - alphaAttrs.alpha = true; - GraphicsContext3D::Attributes opaqueAttrs; - opaqueAttrs.alpha = false; - - RefPtr<GraphicsContext3D> alphaContext = createCompositorMockGraphicsContext3D(alphaAttrs); - EXPECT_TRUE(alphaContext); - RefPtr<GraphicsContext3D> opaqueContext = createCompositorMockGraphicsContext3D(opaqueAttrs); - EXPECT_TRUE(opaqueContext); - - buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Alpha); - EXPECT_FALSE(buffer->platformLayer()->opaque()); - buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Alpha); - EXPECT_FALSE(buffer->platformLayer()->opaque()); - - buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Opaque); - EXPECT_TRUE(buffer->platformLayer()->opaque()); - buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Opaque); - EXPECT_TRUE(buffer->platformLayer()->opaque()); -} - -} // namespace diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h index 6ab616d3c..0b3c3fe9e 100755 --- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h +++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h @@ -27,8 +27,8 @@ #include "config.h" +#include "CompositorFakeWebGraphicsContext3D.h" #include "cc/CCLayerTreeHost.h" -#include "CompositorFakeGraphicsContext3D.h" namespace WebCore { @@ -39,10 +39,10 @@ public: virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { } virtual void layout() OVERRIDE { } virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { } - virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE + virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() OVERRIDE { - GraphicsContext3D::Attributes attrs; - return createCompositorMockGraphicsContext3D(attrs); + WebKit::WebGraphicsContext3D::Attributes attrs; + return WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()); } virtual void didRecreateContext(bool success) OVERRIDE { } virtual void willCommit() OVERRIDE { } diff --git a/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp b/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp index 71cb8bab1..720630e17 100644 --- a/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp +++ b/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp @@ -25,10 +25,7 @@ #include "config.h" -#include "GraphicsContext3D.h" - #include "FakeWebGraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -36,57 +33,6 @@ using namespace WebCore; using namespace WebKit; -class FrameCountingContext : public FakeWebGraphicsContext3D { -public: - FrameCountingContext() : m_frame(0) { } - - // This method would normally do a glSwapBuffers under the hood. - virtual void prepareTexture() { m_frame++; } - - int frameCount() { return m_frame; } - -private: - int m_frame; -}; - -TEST(FakeGraphicsContext3DTest, CanOverrideManually) -{ - GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingContext()), GraphicsContext3D::RenderDirectlyToHostWindow); - FrameCountingContext& mockContext = *static_cast<FrameCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - - for (int i = 0; i < 10; i++) { - context->clearColor(0, 0, 0, 1); - context->prepareTexture(); - } - context->finish(); - - EXPECT_EQ(10, mockContext.frameCount()); -} - - -class GMockContext : public FakeWebGraphicsContext3D { -public: - MOCK_METHOD0(getError, WGC3Denum()); -}; - -TEST(FakeGraphicsContext3DTest, CanUseGMock) -{ - GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new GMockContext()), GraphicsContext3D::RenderDirectlyToHostWindow); - GMockContext& mockContext = *static_cast<GMockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - - EXPECT_CALL(mockContext, getError()) - .WillRepeatedly(testing::Return(314)); - - // It's OK to call methods GMock doesn't know about. - context->makeContextCurrent(); - - // Check that the mocked method is returning as intended. - for (int i = 0; i < 10; i++) - EXPECT_EQ((int)context->getError(), 314); -} - class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D { public: ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { } @@ -101,21 +47,10 @@ private: }; -TEST(FakeGraphicsContext3DTest, ContextForThisThreadShouldNotMakeCurrent) -{ - GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow); - EXPECT_TRUE(context); - ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - EXPECT_EQ(0, mockContext.makeCurrentCount()); -} - -TEST(FakeGraphicsContext3DTest, ContextForAnotherThreadShouldNotMakeCurrent) +TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent) { - GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow); + OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCountsMakeCurrents)); EXPECT_TRUE(context); - ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - EXPECT_EQ(0, mockContext.makeCurrentCount()); + EXPECT_EQ(0, context->makeCurrentCount()); } diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp index 410c45d78..1979d935c 100644 --- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp @@ -27,7 +27,7 @@ #include "GraphicsLayerChromium.h" #include "CCAnimationTestCommon.h" -#include "CompositorFakeGraphicsContext3D.h" +#include "CompositorFakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "GraphicsLayer.h" @@ -42,6 +42,7 @@ #include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> +#include <public/WebGraphicsContext3D.h> #include <wtf/PassOwnPtr.h> using namespace WebCore; @@ -67,10 +68,9 @@ public: virtual void updateAnimations(double frameBeginTime) OVERRIDE { } virtual void layout() OVERRIDE { } virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { } - virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE + virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE { - GraphicsContext3D::Attributes attrs; - return createCompositorMockGraphicsContext3D(attrs); + return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()); } virtual void didRecreateContext(bool success) OVERRIDE { } virtual void willCommit() OVERRIDE { } diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index cd4fcc340..4a92b1509 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -813,4 +813,20 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer) WebKit::WebCompositor::shutdown(); } +class MockLayerChromium : public LayerChromium { +public: + bool needsDisplay() const { return m_needsDisplay; } +}; + +TEST(LayerChromiumTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds) +{ + RefPtr<MockLayerChromium> layer(adoptRef(new MockLayerChromium)); + EXPECT_FALSE(layer->needsDisplay()); + layer->setBounds(IntSize(0, 10)); + EXPECT_FALSE(layer->needsDisplay()); + layer->setBounds(IntSize(10, 10)); + EXPECT_TRUE(layer->needsDisplay()); +} + + } // namespace diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index e4650961b..cfdcdc156 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -28,7 +28,6 @@ #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3D.h" -#include "GraphicsContext3DPrivate.h" #include "WebCompositor.h" #include "cc/CCDrawQuad.h" #include "cc/CCSettings.h" @@ -109,7 +108,7 @@ private: class FakeLayerRendererChromium : public LayerRendererChromium { public: - FakeLayerRendererChromium(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { } + FakeLayerRendererChromium(CCRendererClient* client, WebGraphicsContext3D* context) : LayerRendererChromium(client, context, UnthrottledUploader) { } // LayerRendererChromium methods. @@ -123,9 +122,8 @@ protected: LayerRendererChromiumTest() : m_suggestHaveBackbufferYes(1, true) , m_suggestHaveBackbufferNo(1, false) - , m_context(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingMemoryAllocationSettingContext()), GraphicsContext3D::RenderDirectlyToHostWindow)) - , m_mockContext(*static_cast<FrameCountingMemoryAllocationSettingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get()))) - , m_layerRendererChromium(&m_mockClient, m_context.release()) + , m_context(adoptPtr(new FrameCountingMemoryAllocationSettingContext)) + , m_layerRendererChromium(&m_mockClient, m_context.get()) { } @@ -148,8 +146,7 @@ protected: WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes; WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo; - RefPtr<GraphicsContext3D> m_context; - FrameCountingMemoryAllocationSettingContext& m_mockContext; + OwnPtr<FrameCountingMemoryAllocationSettingContext> m_context; FakeCCRendererClient m_mockClient; FakeLayerRendererChromium m_layerRendererChromium; CCScopedSettings m_scopedSettings; @@ -160,12 +157,12 @@ protected: // Expected: it does nothing. TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) { - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferYes); + m_context->setMemoryAllocation(m_suggestHaveBackbufferYes); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); - EXPECT_EQ(1, m_mockContext.frameCount()); + EXPECT_EQ(1, m_context->frameCount()); } // Test LayerRendererChromium discardFramebuffer functionality: @@ -174,7 +171,7 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldD TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) { m_layerRendererChromium.setVisible(false); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -185,7 +182,7 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndD TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible) { m_layerRendererChromium.setVisible(true); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount()); EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -197,11 +194,11 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible) TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing) { m_layerRendererChromium.setVisible(false); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); } @@ -212,7 +209,7 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNo TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration) { m_layerRendererChromium.setVisible(false); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); @@ -221,13 +218,13 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded()); swapBuffers(); - EXPECT_EQ(1, m_mockContext.frameCount()); + EXPECT_EQ(1, m_context->frameCount()); } TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisible) { m_layerRendererChromium.setVisible(false); - m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo); + m_context->setMemoryAllocation(m_suggestHaveBackbufferNo); EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded()); EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount()); @@ -311,7 +308,8 @@ TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls) { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ForbidSynchronousCallContext)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); EXPECT_TRUE(layerRendererChromium.initialize()); } @@ -353,7 +351,8 @@ TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAsse { CCScopedSettings scopedSettings; FakeCCRendererClient mockClient; - FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<WebGraphicsContext3D> context(adoptPtr(new LoseContextOnFirstGetContext)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); layerRendererChromium.initialize(); } @@ -373,7 +372,8 @@ public: TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeCCRendererClient mockClient; - FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions), GraphicsContext3D::RenderDirectlyToHostWindow)); + OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); layerRendererChromium.initialize(); @@ -398,8 +398,8 @@ private: TEST(LayerRendererChromiumTest2, opaqueBackground) { FakeCCRendererClient mockClient; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context); + OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); mockClient.rootRenderPass()->setHasTransparentBackground(false); @@ -412,17 +412,17 @@ TEST(LayerRendererChromiumTest2, opaqueBackground) // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. #if defined(NDEBUG) - EXPECT_EQ(0, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount()); + EXPECT_EQ(0, context->clearCount()); #else - EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount()); + EXPECT_EQ(1, context->clearCount()); #endif } TEST(LayerRendererChromiumTest2, transparentBackground) { FakeCCRendererClient mockClient; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow); - FakeLayerRendererChromium layerRendererChromium(&mockClient, context); + OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext)); + FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get()); mockClient.rootRenderPass()->setHasTransparentBackground(true); @@ -432,5 +432,5 @@ TEST(LayerRendererChromiumTest2, transparentBackground) layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect()); layerRendererChromium.finishDrawingFrame(); - EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount()); + EXPECT_EQ(1, context->clearCount()); } diff --git a/Source/WebKit/chromium/tests/TextureCopierTest.cpp b/Source/WebKit/chromium/tests/TextureCopierTest.cpp index d71b8ce45..2c90c4ed5 100644 --- a/Source/WebKit/chromium/tests/TextureCopierTest.cpp +++ b/Source/WebKit/chromium/tests/TextureCopierTest.cpp @@ -52,9 +52,8 @@ public: TEST(TextureCopierTest, testDrawArraysCopy) { GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockContext()), GraphicsContext3D::RenderDirectlyToHostWindow); - MockContext& mockContext = *static_cast<MockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context); + OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new MockContext)); + MockContext& mockContext = *static_cast<MockContext*>(ccContext->context3D()); { InSequence sequence; @@ -79,7 +78,7 @@ TEST(TextureCopierTest, testDrawArraysCopy) int sourceTextureId = 1; int destTextureId = 2; IntSize size(256, 128); - OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(context)); + OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(ccContext->context3D())); copier->copyTexture(ccContext.get(), sourceTextureId, destTextureId, size); } diff --git a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp index 4b0dfd059..39a57d131 100644 --- a/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp +++ b/Source/WebKit/chromium/tests/ThrottledTextureUploaderTest.cpp @@ -65,11 +65,10 @@ private: TEST(ThrottledTextureUploaderTest, IsBusy) { GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting()), GraphicsContext3D::RenderDirectlyToHostWindow); - FakeWebGraphicsContext3DWithQueryTesting& fakeContext = *static_cast<FakeWebGraphicsContext3DWithQueryTesting*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(context, 2); + OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting)); + OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get(), 2); - fakeContext.setResultAvailable(0); + fakeContext->setResultAvailable(0); EXPECT_FALSE(uploader->isBusy()); uploader->beginUploads(); uploader->endUploads(); @@ -78,7 +77,7 @@ TEST(ThrottledTextureUploaderTest, IsBusy) uploader->endUploads(); EXPECT_TRUE(uploader->isBusy()); - fakeContext.setResultAvailable(1); + fakeContext->setResultAvailable(1); EXPECT_FALSE(uploader->isBusy()); uploader->beginUploads(); uploader->endUploads(); diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index 9495e706a..04b3c382e 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -673,8 +673,7 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare) FakeTextureAllocator fakeAllocator; FakeTextureCopier fakeCopier; FakeTextureUploader fakeUploader; - RefPtr<GraphicsContext3D> context = createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes()); - RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context); + OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes())); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 40705808d..4e2b0c5ea 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -284,6 +284,28 @@ TEST_F(WebFrameTest, FixedLayoutInitializeAtMinimumPageScale) } #endif +TEST_F(WebFrameTest, CanOverrideMaximumScaleFactor) +{ + registerMockedHttpURLLoad("no_scale_for_you.html"); + + FixedLayoutTestWebViewClient client; + client.m_screenInfo.horizontalDPI = 160; + int viewportWidth = 640; + int viewportHeight = 480; + client.m_windowRect = WebRect(0, 0, viewportWidth, viewportHeight); + + WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_scale_for_you.html", true, 0, &client)); + webViewImpl->enableFixedLayoutMode(true); + webViewImpl->settings()->setViewportEnabled(true); + webViewImpl->resize(WebSize(viewportWidth, viewportHeight)); + + EXPECT_EQ(1.0f, webViewImpl->maximumPageScaleFactor()); + + webViewImpl->setIgnoreViewportTagMaximumScale(true); + + EXPECT_EQ(4.0f, webViewImpl->maximumPageScaleFactor()); +} + #if ENABLE(GESTURE_EVENTS) TEST_F(WebFrameTest, DivAutoZoomParamsTest) { diff --git a/Source/WebKit/chromium/tests/data/no_scale_for_you.html b/Source/WebKit/chromium/tests/data/no_scale_for_you.html new file mode 100644 index 000000000..86bac2cab --- /dev/null +++ b/Source/WebKit/chromium/tests/data/no_scale_for_you.html @@ -0,0 +1 @@ +<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" > |
