diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
| commit | 4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch) | |
| tree | 7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/WebKit/chromium | |
| parent | 3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff) | |
| download | qtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz | |
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/WebKit/chromium')
60 files changed, 2009 insertions, 1144 deletions
diff --git a/Source/WebKit/chromium/All.gyp b/Source/WebKit/chromium/All.gyp index d28bce8cf..739a0c8ec 100644 --- a/Source/WebKit/chromium/All.gyp +++ b/Source/WebKit/chromium/All.gyp @@ -47,7 +47,9 @@ 'conditions': [ ['OS=="android"', { 'dependencies': [ + 'WebKitUnitTests.gyp:webkit_unit_tests_apk', '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree_apk', + '../../../Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:TestWebKitAPI_apk', ], }], ], diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index cd904d3c1..ca0049168 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,546 @@ +2012-07-13 Eric Penner <epenner@google.com> + + [chromium] Add 'self-managed' option to CCPrioritizedTexture to enable render-surface and canvas use cases. + https://bugs.webkit.org/show_bug.cgi?id=91177 + + Reviewed by Adrienne Walker. + + * tests/CCPrioritizedTextureTest.cpp: + (WTF::TEST_F): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-13 Brian Anderson <brianderson@chromium.org> + + Add flushes to CCTextureUpdater::update + https://bugs.webkit.org/show_bug.cgi?id=89035 + + Reviewed by Adrienne Walker. + + CCTextureUpdaterTest added to verify texture upload/flushing patterns. + + * WebKit.gypi: + * tests/CCTextureUpdaterTest.cpp: Added. + +2012-07-13 David Grogan <dgrogan@chromium.org> + + IndexedDB: Re-enable indexeddb in test_shell + https://bugs.webkit.org/show_bug.cgi?id=91161 + + Reviewed by Tony Chang. + + IDB used to be allowed to run if webView->permissionClient() was NULL, + as is the case in test_shell. This was inadvertently changed in + http://wkb.ug/90310. + + We still don't have an automated test for this (http://crbug.com/113738) + Tested manually: + + * In test_shell: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + + * In chrome: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + 3) Revoke IDB permissions in chrome://chrome/settings/content + 4) Reload the IDB page + 5) Verify IDB doesn't have permission to open a DB + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): + +2012-07-13 Wei James <james.wei@intel.com> + + enable TestWebKitAPI/webkit_unit_tests apk on x86 android platform by adding abi support + https://bugs.webkit.org/show_bug.cgi?id=91194 + + Reviewed by Adam Barth. + + * WebKitUnitTests.gyp: + +2012-07-13 Dana Jansens <danakj@chromium.org> + + webkit_unit_test CCLayerTreeHostImplTest.testRemoveRenderPasses started failing. + https://bugs.webkit.org/show_bug.cgi?id=91245 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening: skip failing webkit unit test. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening, skip failing webkit_unit_tests. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Make calendar pickers testable + https://bugs.webkit.org/show_bug.cgi?id=84827 + + Reviewed by Hajime Morita. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::ChromeClientImpl): + Initialize m_pagePopupDriver with the WebViewImpl. + (WebKit::ChromeClientImpl::openPagePopup): + Just calls PagePoupDriver::openPagePopup(). + (WebKit::ChromeClientImpl::closePagePopup): + Just calls PagePoupDriver::closePagePopup(). + (WebKit::ChromeClientImpl::setPagePopupDriver): + * src/ChromeClientImpl.h: + (ChromeClientImpl): Add setPagePopupDriver + * src/WebViewImpl.h: + (WebViewImpl): + WebViewImpl implements PagePopupDriver. openPagePopup() and + closePagePopup() override members of PagePopupDriver. + +2012-07-13 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched + https://bugs.webkit.org/show_bug.cgi?id=91197 + + Reviewed by Kent Tamura. + + This patch adds test cases for Decimal::ceiling() and floor() of + positive/negative small fractional numbers. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-12 Adrienne Walker <enne@google.com> + + [chromium] Root invalidations for RTL pages need to be in the right space + https://bugs.webkit.org/show_bug.cgi?id=91155 + + Reviewed by Kenneth Russell. + + The root layer has a translation on it when placed in the tree, so any + invalidations on this layer likewise need to be adjusted. + + This adjustment is due to the fact that compositor layers all have the + origin in the upper left corner of the layer, but this is not always + the origin for graphics layers. Rather than making compositor layers + have to deal with a potential offset, we change the transform when + inserting the layer into the tree. Invalidations need to be similarly + transformed from document space into compositor layer space. + + The need for this offset is due to the definition of the initial + containing block. RTL pages (pages with dir=RTL on the body) start + scrolled all the way to the right, and the origin is in the upper left + hand corner of this initial viewport. Thus on RTL pages with + horizontal overflow, the left of the document is in negative CSS + space. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::invalidateRect): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] Remove the RenderPass pointer from RenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=91023 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] WebSettings should be sorted + https://bugs.webkit.org/show_bug.cgi?id=91157 + + Reviewed by Eric Seidel. + + This might be my OCD, but IMHO this file would be cleaner if we listed + the settings in alphabetic order. + + * public/WebSettings.h: + * src/WebSettingsImpl.h: + (WebSettingsImpl): + (WebKit::WebSettingsImpl::forceSoftwareCompositing): + (WebKit::WebSettingsImpl::viewportEnabled): + (WebKit::WebSettingsImpl::maxUntiledLayerSize): + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers + https://bugs.webkit.org/show_bug.cgi?id=90310 + + Reviewed by Tony Chang. + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): Consolidates user-prompting logic. + (WebKit::getWebFrame): Helper to dig out frame from Document, or null for Worker. + (WebKit::IDBFactoryBackendProxy::getDatabaseNames): + (WebKit): + (WebKit::IDBFactoryBackendProxy::open): + (WebKit::IDBFactoryBackendProxy::deleteDatabase): + * src/IDBFactoryBackendProxy.h: Update method signatures to match interface. + (WebCore): + (IDBFactoryBackendProxy): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] The root layer should not try create a second RenderSurface for itself + https://bugs.webkit.org/show_bug.cgi?id=91124 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Eric Penner <epenner@google.com> + + [chromium] Use CCTexture/TextureAllocator and remove TextureManager + https://bugs.webkit.org/show_bug.cgi?id=91001 + + Reviewed by Adrienne Walker. + + Deleting old texture manager tests. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::texturesMemorySize): + * tests/CCThreadedTest.cpp: + * tests/CCTiledLayerTestCommon.h: + * tests/Canvas2DLayerBridgeTest.cpp: + * tests/TextureManagerTest.cpp: Removed. + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] Delete last mention of Hixie76 in WebKit/chromium + https://bugs.webkit.org/show_bug.cgi?id=91099 + + Reviewed by Tony Chang. + + This deprecated API is no longer used anywhere. + + * public/WebSettings.h: + (WebKit::WebSettings::setDefaultDeviceScaleFactor): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r122477. + http://trac.webkit.org/changeset/122477 + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Broke Chromium Mac build + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Peter Beverloo <peter@chromium.org> + + [Chromium] Enable building APKs for TestWebKitAPI and webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90989 + + Reviewed by Adam Barth. + + Add dependencies on the webkit_unit_tests_apk and TestWebKitAPI_apk + targets for Android, making sure that we're generating the packages. + + * All.gyp: + +2012-07-12 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Remove unrequired API in WebSurroundingText. + https://bugs.webkit.org/show_bug.cgi?id=91067 + + Reviewed by Adam Barth. + + Remove the unused first initialize method from WebSurroundingText. + Now both Chromium and LayoutTestController use the second method. + + * public/WebSurroundingText.h: + (WebSurroundingText): + * src/WebSurroundingText.cpp: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * src/mac/WebInputEventFactory.mm: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122358. + http://trac.webkit.org/changeset/122358 + https://bugs.webkit.org/show_bug.cgi?id=91037 + + Build break on WebKit Win (Requested by hayato on #webkit). + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit): + (WebKit::WebViewImpl::dragTargetDragOver): + (WebKit::WebViewImpl::dragTargetDrop): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + * tests/CCLayerTestCommon.cpp: + (CCLayerTestCommon::verifyQuadsExactlyCoverRect): + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Rename layerRect to contentRect for rects that live in content space + https://bugs.webkit.org/show_bug.cgi?id=90843 + + Reviewed by Adrienne Walker. + + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + (CCLayerTestCommon::coverageVisibleRectIntersectsTiles): + (CCLayerTestCommon::coverageVisibleRectIntersectsBounds): + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate): + (WebKitTests::FakeTiledLayerChromium::update): + * tests/CCTiledLayerTestCommon.h: + (FakeTiledLayerChromium): + * tests/LayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Minimum size used for occlusion tracking should be a setting on CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=90993 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-11 Adam Barth <abarth@webkit.org> + + [Chromium] Enable LEGACY_VIEWPORT_ADAPTION + https://bugs.webkit.org/show_bug.cgi?id=90991 + + Reviewed by Tony Chang. + + Chromium wishes to support LEGACY_VIEWPORT_ADAPTION. I actually thought + this was enabled before, but the enable bit got lost in the shuffle. + + * features.gypi: + +2012-07-11 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + Unreviewed build fix, forgot to add URLTestHelpers.* when landing r122344 + + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Added. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Use WEBKIT_IMPLEMENTATION == 1 for webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90094 + + Reviewed by Adrienne Walker. + + This patch adds the WEBKIT_IMPLEMENTATION = 1 define to + WebKitUnitTests.gyp. To get it to compile correctly, some string + and URL code was refactored and fixed, in particular GURL usage is + replaced with KURL usage. + + * WebKit.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when in shared library + added URLTestHelpers to exclusion in shared library build, because it depends on webkit_support + + * WebKit.gypi: + added URLTestHelpers.h and .cpp to the build process + + * WebKitUnitTests.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when not in shared library. + note that in shared library build, RunAllTests.cpp does not have WEBKIT_IMPLEMENTATION == 1. + + * public/WebDOMMessageEvent.h: + (WebKit::WebDOMMessageEvent::WebDOMMessageEvent): + * tests/AssociatedURLLoaderTest.cpp: + * tests/EventListenerTest.cpp: + * tests/FrameTestHelpers.cpp: + (WebKit::FrameTestHelpers::loadFrame): + * tests/FrameTestHelpers.h: + * tests/ListenerLeakTest.cpp: + (WebKit::ListenerLeakTest::RunTest): + * tests/PopupMenuTest.cpp: + * tests/RunAllTests.cpp: + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Copied from Source/WebKit/chromium/public/WebDOMMessageEvent.h. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + * tests/WebFrameTest.cpp: + * tests/WebPageNewSerializerTest.cpp: + * tests/WebPageSerializerTest.cpp: + * tests/WebViewTest.cpp: + +2012-07-10 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: migrate from background images to CSS for statusbar rendering. + https://bugs.webkit.org/show_bug.cgi?id=90902 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gypi: + * src/js/Images/statusbarBackgroundChromium.png: Removed. + * src/js/Images/statusbarBottomBackgroundChromium.png: Removed. + * src/js/Images/statusbarButtonsChromium.png: Removed. + * src/js/Images/statusbarMenuButtonChromium.png: Removed. + * src/js/Images/statusbarMenuButtonSelectedChromium.png: Removed. + * src/js/devTools.css: + (.status-bar-background): + 2012-07-11 Kenichi Ishibashi <bashi@chromium.org> [Chromium] Adding HarfBuzz-ng for Linux diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 67aef6ffa..b33ddc339 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': '145569' + 'chromium_rev': '146381' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 6fce44075..f6868201c 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -688,6 +688,7 @@ ['component=="shared_library"', { 'defines': [ 'WEBKIT_DLL', + 'WEBKIT_IMPLEMENTATION=1', ], 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore_bindings', @@ -739,6 +740,7 @@ 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', + 'tests/URLTestHelpers.cpp', 'tests/WebFrameTest.cpp', 'tests/WebPageNewSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a5babfd0..59c00795e 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -50,11 +50,6 @@ 'src/js/Images/segmentHoverEndChromium.png', 'src/js/Images/segmentSelectedChromium.png', 'src/js/Images/segmentSelectedEndChromium.png', - 'src/js/Images/statusbarBackgroundChromium.png', - 'src/js/Images/statusbarBottomBackgroundChromium.png', - 'src/js/Images/statusbarButtonsChromium.png', - 'src/js/Images/statusbarMenuButtonChromium.png', - 'src/js/Images/statusbarMenuButtonSelectedChromium.png', ], 'webkit_unittest_files': [ 'tests/ArenaTestHelpers.h', @@ -89,6 +84,7 @@ 'tests/CCScopedTextureTest.cpp', 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTestCommon.h', + 'tests/CCTextureUpdaterTest.cpp', 'tests/CCTiledLayerImplTest.cpp', 'tests/CCTiledLayerTestCommon.h', 'tests/CCTiledLayerTestCommon.cpp', @@ -143,13 +139,14 @@ 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', 'tests/TextureLayerChromiumTest.cpp', - 'tests/TextureManagerTest.cpp', 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', 'tests/TreeTestHelpers.cpp', 'tests/TreeTestHelpers.h', + 'tests/URLTestHelpers.cpp', + 'tests/URLTestHelpers.h', 'tests/WebAnimationTest.cpp', 'tests/WebCompositorInputHandlerImplTest.cpp', 'tests/WebFloatAnimationCurveTest.cpp', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index bf68f4f49..051c13524 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -87,6 +87,9 @@ 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', ], + 'defines': [ + 'WEBKIT_IMPLEMENTATION=1', + ], 'sources': [ '<@(webkit_unittest_files)', ], @@ -170,7 +173,9 @@ '<(PRODUCT_DIR)/webkit_unit_tests_apk', '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-compile' + '--ant-compile', + '--app_abi', + '<(android_app_abi)', ], }], }], diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 7c02a0127..35f86cf24 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -69,6 +69,7 @@ 'ENABLE_INPUT_TYPE_DATE=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', + 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', 'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1', 'ENABLE_LINK_PREFETCH=1', 'ENABLE_LINK_PRERENDER=1', diff --git a/Source/WebKit/chromium/public/WebDOMMessageEvent.h b/Source/WebKit/chromium/public/WebDOMMessageEvent.h index 355b73715..6619af246 100644 --- a/Source/WebKit/chromium/public/WebDOMMessageEvent.h +++ b/Source/WebKit/chromium/public/WebDOMMessageEvent.h @@ -46,6 +46,7 @@ class WebString; class WebDOMMessageEvent : public WebDOMEvent { public: + WebDOMMessageEvent() { } WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId); WEBKIT_EXPORT WebSerializedScriptValue data() const; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 56b49ffbb..88ed9639d 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -53,114 +53,112 @@ public: EditingBehaviorUnix }; - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual bool forceSoftwareCompositing() const = 0; + virtual bool scrollAnimatorEnabled() const = 0; + virtual bool viewportEnabled() const = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; + virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; + virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; + virtual void setAcceleratedFiltersEnabled(bool) = 0; + virtual void setAcceleratedPaintingEnabled(bool) = 0; + virtual void setAllowDisplayOfInsecureContent(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; + virtual void setAllowRunningOfInsecureContent(bool) = 0; + virtual void setAllowScriptsToCloseWindows(bool) = 0; + virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; + virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; + virtual void setCaretBrowsingEnabled(bool) = 0; + virtual void setCookieEnabled(bool) = 0; virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setDefaultFontSize(int) = 0; + virtual void setDNSPrefetchingEnabled(bool) = 0; + virtual void setDOMPasteAllowed(bool) = 0; virtual void setDefaultFixedFontSize(int) = 0; - virtual void setMinimumFontSize(int) = 0; - virtual void setMinimumLogicalFontSize(int) = 0; - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; - virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setDefaultFontSize(int) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; - virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDefaultTileSize(WebSize) = 0; + virtual void setDeferred2dCanvasEnabled(bool) = 0; + virtual void setDeveloperExtrasEnabled(bool) = 0; virtual void setDeviceSupportsMouse(bool) = 0; - virtual void setJavaScriptEnabled(bool) = 0; - virtual void setWebSecurityEnabled(bool) = 0; - virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; - virtual void setLoadsImagesAutomatically(bool) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setEditableLinkBehaviorNeverLive() = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setEnableScrollAnimator(bool) = 0; + virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; + virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; + virtual void setExperimentalCSSRegionsEnabled(bool) = 0; + virtual void setExperimentalCSSVariablesEnabled(bool) = 0; + virtual void setExperimentalWebGLEnabled(bool) = 0; + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedPositionCreatesStackingContext(bool) = 0; + virtual void setFontRenderingModeNormal() = 0; + virtual void setForceCompositingMode(bool) = 0; + virtual void setForceSoftwareCompositing(bool) = 0; + virtual void setFrameFlatteningEnabled(bool) = 0; + virtual void setFullScreenEnabled(bool) = 0; + virtual void setHyperlinkAuditingEnabled(bool) = 0; virtual void setImagesEnabled(bool) = 0; - virtual void setPluginsEnabled(bool) = 0; - virtual void setDOMPasteAllowed(bool) = 0; - virtual void setDeveloperExtrasEnabled(bool) = 0; - virtual void setNeedsSiteSpecificQuirks(bool) = 0; - virtual void setShrinksStandaloneImagesToFit(bool) = 0; - virtual void setUsesEncodingDetector(bool) = 0; - virtual void setTextAreasAreResizable(bool) = 0; + virtual void setInteractiveFormValidationEnabled(bool) = 0; virtual void setJavaEnabled(bool) = 0; - virtual void setAllowScriptsToCloseWindows(bool) = 0; - virtual void setUserStyleSheetLocation(const WebURL&) = 0; - virtual void setAuthorAndUserStylesEnabled(bool) = 0; - virtual void setUsesPageCache(bool) = 0; - virtual void setPageCacheSupportsPlugins(bool) = 0; - virtual void setDownloadableBinaryFontsEnabled(bool) = 0; virtual void setJavaScriptCanAccessClipboard(bool) = 0; - virtual void setXSSAuditorEnabled(bool) = 0; - virtual void setDNSPrefetchingEnabled(bool) = 0; - virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; + virtual void setJavaScriptEnabled(bool) = 0; + virtual void setLayoutFallbackWidth(int) = 0; + virtual void setLoadsImagesAutomatically(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; - virtual void setEditableLinkBehaviorNeverLive() = 0; - virtual void setFrameFlatteningEnabled(bool) = 0; - virtual void setFontRenderingModeNormal() = 0; - virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; - virtual void setAllowFileAccessFromFileURLs(bool) = 0; - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; + virtual void setMaxUntiledLayerSize(WebSize) = 0; + virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; + virtual void setMinimumAccelerated2dCanvasSize(int) = 0; + virtual void setMinimumFontSize(int) = 0; + virtual void setMinimumLogicalFontSize(int) = 0; + virtual void setMinimumTimerInterval(double) = 0; + virtual void setMockScrollbarsEnabled(bool) = 0; + virtual void setNeedsSiteSpecificQuirks(bool) = 0; virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; - virtual void setWebAudioEnabled(bool) = 0; - virtual void setExperimentalWebGLEnabled(bool) = 0; - virtual void setExperimentalCSSRegionsEnabled(bool) = 0; - virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; - virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; - virtual void setExperimentalCSSVariablesEnabled(bool) = 0; virtual void setOpenGLMultisamplingEnabled(bool) = 0; + virtual void setPageCacheSupportsPlugins(bool) = 0; + virtual void setPasswordEchoDurationInSeconds(double) = 0; + virtual void setPasswordEchoEnabled(bool) = 0; + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setPluginsEnabled(bool) = 0; virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0; - virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setShouldPrintBackgrounds(bool) = 0; virtual void setShowDebugBorders(bool) = 0; virtual void setShowFPSCounter(bool) = 0; - virtual void setShowPlatformLayerTree(bool) = 0; virtual void setShowPaintRects(bool) = 0; - virtual void setEditingBehavior(EditingBehavior) = 0; - virtual void setAcceleratedCompositingEnabled(bool) = 0; - virtual void setForceCompositingMode(bool) = 0; - virtual void setForceSoftwareCompositing(bool) = 0; - virtual void setMockScrollbarsEnabled(bool) = 0; - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; - virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; - virtual void setAccelerated2dCanvasEnabled(bool) = 0; - virtual void setDeferred2dCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; - virtual void setMinimumAccelerated2dCanvasSize(int) = 0; - virtual void setAcceleratedFiltersEnabled(bool) = 0; - virtual void setMemoryInfoEnabled(bool) = 0; - virtual void setHyperlinkAuditingEnabled(bool) = 0; - virtual void setLayoutFallbackWidth(int) = 0; - virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setShowPlatformLayerTree(bool) = 0; + virtual void setShrinksStandaloneImagesToFit(bool) = 0; + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSyncXHRInDocumentsEnabled(bool) = 0; + virtual void setTextAreasAreResizable(bool) = 0; + virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; virtual void setUnifiedTextCheckerEnabled(bool) = 0; - virtual void setCaretBrowsingEnabled(bool) = 0; - virtual void setInteractiveFormValidationEnabled(bool) = 0; + virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setUsesEncodingDetector(bool) = 0; + virtual void setUsesPageCache(bool) = 0; virtual void setValidationMessageTimerMagnification(int) = 0; - virtual void setMinimumTimerInterval(double) = 0; - virtual void setFullScreenEnabled(bool) = 0; - virtual void setAllowDisplayOfInsecureContent(bool) = 0; - virtual void setAllowRunningOfInsecureContent(bool) = 0; - virtual void setPasswordEchoEnabled(bool) = 0; - virtual void setPasswordEchoDurationInSeconds(double) = 0; - virtual void setShouldPrintBackgrounds(bool) = 0; - virtual void setEnableScrollAnimator(bool) = 0; - virtual bool scrollAnimatorEnabled() const = 0; - virtual void setVisualWordMovementEnabled(bool) = 0; - virtual void setAcceleratedPaintingEnabled(bool) = 0; virtual void setViewportEnabled(bool) = 0; - virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; - virtual bool viewportEnabled() const = 0; - virtual void setDefaultTileSize(WebSize) = 0; - virtual void setMaxUntiledLayerSize(WebSize) = 0; - virtual void setFixedPositionCreatesStackingContext(bool) = 0; - virtual void setSyncXHRInDocumentsEnabled(bool) = 0; - virtual void setCookieEnabled(bool) = 0; - - virtual bool forceSoftwareCompositing() const = 0; + virtual void setVisualWordMovementEnabled(bool) = 0; + virtual void setWebAudioEnabled(bool) = 0; + virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setWebSecurityEnabled(bool) = 0; + virtual void setXSSAuditorEnabled(bool) = 0; // DEPRECATED virtual void setDefaultDeviceScaleFactor(int) { } - virtual void setHixie76WebSocketProtocolEnabled(bool) { } protected: ~WebSettings() { } diff --git a/Source/WebKit/chromium/public/WebSurroundingText.h b/Source/WebKit/chromium/public/WebSurroundingText.h index 716fe4f0c..fa8c52ff0 100644 --- a/Source/WebKit/chromium/public/WebSurroundingText.h +++ b/Source/WebKit/chromium/public/WebSurroundingText.h @@ -48,10 +48,6 @@ public: WEBKIT_EXPORT bool isNull() const; WEBKIT_EXPORT void reset(); - // Initializes the object go get the surrounding text centered in the position described by the hit test. - // The maximum length of the contents retrieved is defined by maxLength. - WEBKIT_EXPORT void initialize(const WebHitTestResult&, size_t maxLength); - // Initializes the object to get the surrounding text centered in the position relative to a provided node. // The maximum length of the contents retrieved is defined by maxLength. WEBKIT_EXPORT void initialize(const WebNode&, const WebPoint&, size_t maxLength); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 96642f666..3ba5da24f 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -317,28 +317,16 @@ public: // Callback methods when a drag-and-drop operation is trying to drop // something on the WebView. - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragEnter( const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; virtual void dragTargetDragLeave() = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; virtual void dragTargetDrop( const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) = 0; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 349733919..b2219454c 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -60,6 +60,7 @@ #include "NavigationAction.h" #include "Node.h" #include "Page.h" +#include "PagePopupDriver.h" #include "PlatformScreen.h" #include "PlatformSupport.h" #include "PopupContainer.h" @@ -139,6 +140,9 @@ ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) , m_menubarVisible(true) , m_resizable(true) , m_nextNewWindowNavigationPolicy(WebNavigationPolicyIgnore) +#if ENABLE(PAGE_POPUP) + , m_pagePopupDriver(webView) +#endif { } @@ -1009,12 +1013,25 @@ PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuCli #if ENABLE(PAGE_POPUP) PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) { - return m_webView->openPagePopup(client, originBoundsInRootView); + ASSERT(m_pagePopupDriver); + return m_pagePopupDriver->openPagePopup(client, originBoundsInRootView); } void ChromeClientImpl::closePagePopup(PagePopup* popup) { - m_webView->closePagePopup(popup); + ASSERT(m_pagePopupDriver); + m_pagePopupDriver->closePagePopup(popup); +} + +void ChromeClientImpl::setPagePopupDriver(PagePopupDriver* driver) +{ + ASSERT(driver); + m_pagePopupDriver = driver; +} + +void ChromeClientImpl::resetPagePopupDriver() +{ + m_pagePopupDriver = m_webView; } #endif diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 5894177e0..86ff7ba68 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -198,6 +198,8 @@ public: #if ENABLE(PAGE_POPUP) virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect&) OVERRIDE; virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; + virtual void setPagePopupDriver(WebCore::PagePopupDriver*) OVERRIDE; + virtual void resetPagePopupDriver() OVERRIDE; #endif virtual bool willAddTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; virtual void addTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; @@ -228,6 +230,9 @@ private: // The policy for how the next webview to be created will be shown. WebNavigationPolicy m_nextNewWindowNavigationPolicy; +#if ENABLE(PAGE_POPUP) + WebCore::PagePopupDriver* m_pagePopupDriver; +#endif }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 149bfe12a..e2c9bb9e2 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -35,6 +35,7 @@ #include "DOMStringList.h" #include "IDBDatabaseBackendProxy.h" #include "IDBDatabaseError.h" +#include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" @@ -72,20 +73,6 @@ IDBFactoryBackendProxy::~IDBFactoryBackendProxy() { } -void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) -{ - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, "Database Listing", origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); - return; - } - - m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); -} - static const char allowIndexedDBMode[] = "allowIndexedDBMode"; class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { @@ -161,60 +148,80 @@ private: WebWorkerBase* m_webWorkerBase; }; -bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) +bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, const String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callbacks) { + bool allowed; + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + WebViewImpl* webView = webFrame->viewImpl(); + // FIXME: webView->permissionClient() returns 0 in test_shell and content_shell http://crbug.com/137269 + allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame, name, origin); + } else { + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); + WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + + String mode = allowIndexedDBMode; + mode.append(String::number(runLoop.createUniqueId())); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + allowed = false; + } else + allowed = bridge->result(); + } - WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); - WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + if (!allowed) + callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UNKNOWN_ERR, "The user denied permission to access the database.")); - String mode = allowIndexedDBMode; - mode.append(String::number(runLoop.createUniqueId())); - RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + return allowed; +} - // Either the bridge returns, or the queue gets terminated. - if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { - bridge->cancel(); - return false; +static WebFrameImpl* getWebFrame(ScriptExecutionContext* context) +{ + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return WebFrameImpl::fromFrame(document->frame()); } - - return bridge->result(); + return 0; } -void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir) +void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { -#if ENABLE(WORKERS) - WebSecurityOrigin origin(prpOrigin); - if (!allowIDBFromWorkerThread(context, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, "Database Listing", origin, callbacks)) return; - } - m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, /*webFrame*/0, dataDir); -#endif + + WebFrameImpl* webFrame = getWebFrame(context); + m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::open(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) + +void IDBFactoryBackendProxy::open(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) +void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h index c07db3556..22a6f52a8 100644 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -31,10 +31,11 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBCallbacks.h" #include "IDBFactoryBackendInterface.h" namespace WebCore { -class WorkerContext; +class ScriptExecutionContext; } namespace WebKit { @@ -47,16 +48,13 @@ public: static PassRefPtr<WebCore::IDBFactoryBackendInterface> create(); virtual ~IDBFactoryBackendProxy(); - virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - - virtual void open(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - virtual void openFromWorker(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::WorkerContext*, const String& dataDir); - - virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); + virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); private: IDBFactoryBackendProxy(); - bool allowIDBFromWorkerThread(WebCore::WorkerContext*, const String& name, const WebSecurityOrigin&); + bool allowIndexedDB(WebCore::ScriptExecutionContext*, const String& name, const WebSecurityOrigin&, PassRefPtr<WebCore::IDBCallbacks>); // We don't own this pointer (unlike all the other proxy classes which do). WebIDBFactory* m_webIDBFactory; diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 7e9539376..899315d29 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -157,7 +157,9 @@ WebScrollableLayer NonCompositedContentHost::scrollLayer() void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) { - m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect)); + WebCore::IntRect layerRect = rect; + layerRect.move(-m_layerAdjust); + m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(layerRect)); } void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLayer*, double /* time */) diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 163862e19..76e30b52f 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -44,112 +44,113 @@ public: explicit WebSettingsImpl(WebCore::Settings*); virtual ~WebSettingsImpl() { } - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual bool deviceSupportsTouch(); + virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } + virtual bool scrollAnimatorEnabled() const; + virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setAcceleratedCompositingEnabled(bool); + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); + virtual void setAcceleratedCompositingForAnimationEnabled(bool); + virtual void setAcceleratedCompositingForCanvasEnabled(bool); + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); + virtual void setAcceleratedCompositingForPluginsEnabled(bool); + virtual void setAcceleratedCompositingForVideoEnabled(bool); + virtual void setAcceleratedFiltersEnabled(bool); + virtual void setAcceleratedPaintingEnabled(bool); + virtual void setAllowDisplayOfInsecureContent(bool); + virtual void setAllowFileAccessFromFileURLs(bool); + virtual void setAllowRunningOfInsecureContent(bool); + virtual void setAllowScriptsToCloseWindows(bool); + virtual void setAllowUniversalAccessFromFileURLs(bool); + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); + virtual void setAsynchronousSpellCheckingEnabled(bool); + virtual void setAuthorAndUserStylesEnabled(bool); + virtual void setCaretBrowsingEnabled(bool); + virtual void setCookieEnabled(bool); virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setDefaultFontSize(int); + virtual void setDNSPrefetchingEnabled(bool); + virtual void setDOMPasteAllowed(bool); virtual void setDefaultFixedFontSize(int); - virtual void setMinimumFontSize(int); - virtual void setMinimumLogicalFontSize(int); - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); - virtual void setTextAutosizingEnabled(bool); + virtual void setDefaultFontSize(int); virtual void setDefaultTextEncodingName(const WebString&); - virtual void setDeviceSupportsTouch(bool); - virtual void setDeviceSupportsMouse(bool); - virtual bool deviceSupportsTouch(); - virtual void setJavaScriptEnabled(bool); - virtual void setWebSecurityEnabled(bool); - virtual void setJavaScriptCanOpenWindowsAutomatically(bool); - virtual void setLoadsImagesAutomatically(bool); - virtual void setImagesEnabled(bool); - virtual void setPluginsEnabled(bool); - virtual void setDOMPasteAllowed(bool); + virtual void setDefaultTileSize(WebSize); + virtual void setDeferred2dCanvasEnabled(bool); virtual void setDeveloperExtrasEnabled(bool); - virtual void setNeedsSiteSpecificQuirks(bool); - virtual void setShrinksStandaloneImagesToFit(bool); - virtual void setUsesEncodingDetector(bool); - virtual void setTextAreasAreResizable(bool); - virtual void setJavaEnabled(bool); - virtual void setAllowScriptsToCloseWindows(bool); - virtual void setUserStyleSheetLocation(const WebURL&); - virtual void setAuthorAndUserStylesEnabled(bool); - virtual void setUsesPageCache(bool); - virtual void setPageCacheSupportsPlugins(bool); + virtual void setDeviceSupportsMouse(bool); + virtual void setDeviceSupportsTouch(bool); virtual void setDownloadableBinaryFontsEnabled(bool); - virtual void setJavaScriptCanAccessClipboard(bool); - virtual void setXSSAuditorEnabled(bool); - virtual void setDNSPrefetchingEnabled(bool); - virtual void setFixedElementsLayoutRelativeToFrame(bool); - virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); - virtual void setFrameFlatteningEnabled(bool); - virtual void setFontRenderingModeNormal(); - virtual void setAllowUniversalAccessFromFileURLs(bool); - virtual void setAllowFileAccessFromFileURLs(bool); - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); - virtual void setOfflineWebApplicationCacheEnabled(bool); - virtual void setWebAudioEnabled(bool); - virtual void setExperimentalWebGLEnabled(bool); - virtual void setExperimentalCSSRegionsEnabled(bool); - virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setEditingBehavior(EditingBehavior); + virtual void setEnableScrollAnimator(bool); virtual void setExperimentalCSSCustomFilterEnabled(bool); + virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setExperimentalCSSRegionsEnabled(bool); virtual void setExperimentalCSSVariablesEnabled(bool); - virtual void setOpenGLMultisamplingEnabled(bool); - virtual void setPrivilegedWebGLExtensionsEnabled(bool); - virtual void setWebGLErrorsToConsoleEnabled(bool); - virtual void setShowDebugBorders(bool); - virtual void setShowFPSCounter(bool); - virtual void setShowPlatformLayerTree(bool); - virtual void setShowPaintRects(bool); - virtual void setDefaultTileSize(WebSize); - virtual void setMaxUntiledLayerSize(WebSize); - virtual void setEditingBehavior(EditingBehavior); - virtual void setAcceleratedCompositingEnabled(bool); + virtual void setExperimentalWebGLEnabled(bool); + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedElementsLayoutRelativeToFrame(bool); + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedPositionCreatesStackingContext(bool); + virtual void setFontRenderingModeNormal(); virtual void setForceCompositingMode(bool); virtual void setForceSoftwareCompositing(bool); - virtual void setMockScrollbarsEnabled(bool); - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); - virtual void setAcceleratedCompositingForVideoEnabled(bool); - virtual void setAcceleratedCompositingForPluginsEnabled(bool); - virtual void setAcceleratedCompositingForCanvasEnabled(bool); - virtual void setAcceleratedCompositingForAnimationEnabled(bool); - virtual void setAccelerated2dCanvasEnabled(bool); - virtual void setDeferred2dCanvasEnabled(bool); - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); - virtual void setMinimumAccelerated2dCanvasSize(int); - virtual void setAcceleratedFiltersEnabled(bool); - virtual void setMemoryInfoEnabled(bool); + virtual void setFrameFlatteningEnabled(bool); + virtual void setFullScreenEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); - virtual void setLayoutFallbackWidth(int); - virtual void setAsynchronousSpellCheckingEnabled(bool); - virtual void setUnifiedTextCheckerEnabled(bool); - virtual void setCaretBrowsingEnabled(bool); + virtual void setImagesEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); - virtual void setValidationMessageTimerMagnification(int); + virtual void setJavaEnabled(bool); + virtual void setJavaScriptCanAccessClipboard(bool); + virtual void setJavaScriptCanOpenWindowsAutomatically(bool); + virtual void setJavaScriptEnabled(bool); + virtual void setLayoutFallbackWidth(int); + virtual void setLoadsImagesAutomatically(bool); + virtual void setLocalStorageEnabled(bool); + virtual void setMaxUntiledLayerSize(WebSize); + virtual void setMediaPlaybackRequiresUserGesture(bool); + virtual void setMemoryInfoEnabled(bool); + virtual void setMinimumAccelerated2dCanvasSize(int); + virtual void setMinimumFontSize(int); + virtual void setMinimumLogicalFontSize(int); virtual void setMinimumTimerInterval(double); - virtual void setFullScreenEnabled(bool); - virtual void setAllowDisplayOfInsecureContent(bool); - virtual void setAllowRunningOfInsecureContent(bool); - virtual void setPasswordEchoEnabled(bool); + virtual void setMockScrollbarsEnabled(bool); + virtual void setNeedsSiteSpecificQuirks(bool); + virtual void setOfflineWebApplicationCacheEnabled(bool); + virtual void setOpenGLMultisamplingEnabled(bool); + virtual void setPageCacheSupportsPlugins(bool); virtual void setPasswordEchoDurationInSeconds(double); - virtual void setShouldPrintBackgrounds(bool); - virtual void setEnableScrollAnimator(bool); - virtual bool scrollAnimatorEnabled() const; - virtual void setVisualWordMovementEnabled(bool); - virtual void setShouldDisplaySubtitles(bool); + virtual void setPasswordEchoEnabled(bool); + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setPluginsEnabled(bool); + virtual void setPrivilegedWebGLExtensionsEnabled(bool); + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setShouldDisplayCaptions(bool); + virtual void setShouldDisplaySubtitles(bool); virtual void setShouldDisplayTextDescriptions(bool); - virtual void setAcceleratedPaintingEnabled(bool); - virtual void setFixedPositionCreatesStackingContext(bool); - virtual void setViewportEnabled(bool); - virtual void setMediaPlaybackRequiresUserGesture(bool); - virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setShouldPrintBackgrounds(bool); + virtual void setShowDebugBorders(bool); + virtual void setShowFPSCounter(bool); + virtual void setShowPaintRects(bool); + virtual void setShowPlatformLayerTree(bool); + virtual void setShrinksStandaloneImagesToFit(bool); + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setSyncXHRInDocumentsEnabled(bool); - virtual void setCookieEnabled(bool); + virtual void setTextAreasAreResizable(bool); + virtual void setTextAutosizingEnabled(bool); + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); + virtual void setUnifiedTextCheckerEnabled(bool); + virtual void setUserStyleSheetLocation(const WebURL&); + virtual void setUsesEncodingDetector(bool); + virtual void setUsesPageCache(bool); + virtual void setValidationMessageTimerMagnification(int); + virtual void setViewportEnabled(bool); + virtual void setVisualWordMovementEnabled(bool); + virtual void setWebAudioEnabled(bool); + virtual void setWebGLErrorsToConsoleEnabled(bool); + virtual void setWebSecurityEnabled(bool); + virtual void setXSSAuditorEnabled(bool); bool showFPSCounter() const { return m_showFPSCounter; } bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } @@ -157,7 +158,6 @@ public: bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } - virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } private: WebCore::Settings* m_settings; diff --git a/Source/WebKit/chromium/src/WebSurroundingText.cpp b/Source/WebKit/chromium/src/WebSurroundingText.cpp index f880676ae..45db3d1bd 100644 --- a/Source/WebKit/chromium/src/WebSurroundingText.cpp +++ b/Source/WebKit/chromium/src/WebSurroundingText.cpp @@ -40,15 +40,6 @@ using namespace WebCore; namespace WebKit { -void WebSurroundingText::initialize(const WebHitTestResult& hitTestResult, size_t maxLength) -{ - Node* node = hitTestResult.node().unwrap<Node>(); - if (!node || !node->renderer()) - return; - - m_private.reset(new SurroundingText(VisiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(hitTestResult.localPoint()))), maxLength)); -} - void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& nodePoint, size_t maxLength) { const Node* node = webNode.constUnwrap<Node>(); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index dd3315ff9..721bfc1d6 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -2796,15 +2796,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( const WebDragData& webDragData, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragEnter(webDragData, clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragEnter( - const WebDragData& webDragData, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2819,14 +2810,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragOver(clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2854,12 +2837,6 @@ void WebViewImpl::dragTargetDragLeave() } void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, - const WebPoint& screenPoint) -{ - dragTargetDrop(clientPoint, screenPoint, 0); -} - -void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) { diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index f657504f2..4596dcafc 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -52,6 +52,7 @@ #include "IntRect.h" #include "NotificationPresenterImpl.h" #include "PageOverlayList.h" +#include "PagePopupDriver.h" #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" @@ -112,7 +113,14 @@ class WebMouseWheelEvent; class WebSettingsImpl; class WebTouchEvent; -class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget, public PageWidgetEventHandler { +class WebViewImpl : public WebView + , public WebLayerTreeViewClient + , public RefCounted<WebViewImpl> + , public WebCore::PlatformGestureCurveTarget +#if ENABLE(PAGE_POPUP) + , public WebCore::PagePopupDriver +#endif + , public PageWidgetEventHandler { public: enum AutoZoomType { DoubleTap, @@ -239,28 +247,16 @@ public: const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual void dragTargetDragLeave(); virtual void dragTargetDrop( const WebPoint& clientPoint, - const WebPoint& screenPoint); - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers); virtual unsigned long createUniqueIdentifierForRequest(); @@ -491,8 +487,9 @@ public: void popupOpened(WebCore::PopupContainer* popupContainer); void popupClosed(WebCore::PopupContainer* popupContainer); #if ENABLE(PAGE_POPUP) - WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView); - void closePagePopup(WebCore::PagePopup*); + // PagePopupDriver functions. + virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView) OVERRIDE; + virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; #endif void hideAutofillPopup(); diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png Binary files differdeleted file mode 100644 index b5a780f36..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png Binary files differdeleted file mode 100644 index 531a3efe7..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png Binary files differdeleted file mode 100644 index 136d5a8be..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png Binary files differdeleted file mode 100644 index c8fbd454f..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png Binary files differdeleted file mode 100644 index 668070d9b..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/devTools.css b/Source/WebKit/chromium/src/js/devTools.css index 3d1183404..c7aa9420d 100644 --- a/Source/WebKit/chromium/src/js/devTools.css +++ b/Source/WebKit/chromium/src/js/devTools.css @@ -80,28 +80,8 @@ body.platform-linux #scripts-files { -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2; } -body.drawer-visible #main-status-bar { - background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png); -} - .status-bar { - background-image: url(Images/statusbarBackgroundChromium.png); -} - -button.status-bar-item { - background-image: url(Images/statusbarButtonsChromium.png); -} - -select.status-bar-item:active { - -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2; -} - -#drawer { - background-image: url(Images/statusbarBottomBackgroundChromium.png); -} - -select.status-bar-item { - -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2; + background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235)); } .scope-bar li.selected { diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index f719f2d5e..e1b94a640 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -34,7 +34,7 @@ #include "WebInputEvent.h" #include <wtf/ASCIICType.h> -#if BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 // Additional Lion APIs. enum { @@ -53,9 +53,11 @@ typedef NSUInteger NSEventPhase; - (NSEventPhase)momentumPhase; @end -#endif // BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 -#if BUILDING_ON_LEOPARD +// Do not __MAC_OS_X_VERSION_MAX_ALLOWED here because of a bug in the 10.5 SDK, +// see <http://lists.webkit.org/pipermail/webkit-dev/2012-July/021442.html>. +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // These are not defined in the 10.5 SDK but are defined in later SDKs inside // a MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 #ifdef. @@ -64,7 +66,7 @@ enum { NSEventTypeEndGesture = 20 }; -#endif // BUILDING_ON_LEOPARD +#endif // MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 namespace WebKit { diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp index 03559f7f1..7051bf9d6 100644 --- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp +++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebURLLoaderOptions.h" @@ -42,11 +43,11 @@ #include "platform/WebURLResponse.h" #include <wtf/text/WTFString.h> -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -76,9 +77,9 @@ public: , m_runningMessageLoop(false) { // Reuse one of the test files from WebFrameTest. - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html"; - m_frameFilePath = WebString::fromUTF8(filePath); + m_frameFilePath = WebString::fromUTF8(filePath.c_str()); } void SetUp() @@ -87,7 +88,7 @@ public: m_webView->initializeMainFrame(&m_webFrameClient); // Load the frame before trying to load resources. - GURL url = GURL("http://www.test.com/iframes_test.html"); + WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html"); WebURLResponse response; response.initialize(); response.setMIMEType("text/html"); @@ -184,7 +185,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPMethod(WebString::fromUTF8(unsafeMethod)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -200,7 +201,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -230,7 +231,7 @@ public: id.append("-Exposed"); id.append(".html"); - GURL url = GURL(id); + WebCore::KURL url = toKURL(id); WebURLRequest request; request.initialize(); request.setURL(url); @@ -282,7 +283,7 @@ protected: // Test a successful same-origin URL load. TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) { - GURL url = GURL("http://www.test.com/SameOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -305,7 +306,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/SameOriginRestriction.html"); + WebCore::KURL url = toKURL("http://www.other.com/SameOriginRestriction.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -316,7 +317,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -341,7 +342,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -367,7 +368,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -398,9 +399,9 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) // Test a same-origin URL redirect and load. TEST_F(AssociatedURLLoaderTest, RedirectSuccess) { - GURL url = GURL("http://www.test.com/RedirectSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html"); char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -435,9 +436,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess) // Test that a cross origin redirect response without CORS headers fails. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -467,9 +468,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) // Test that a cross origin redirect response with CORS headers that allow the requesting origin succeeds. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -590,7 +591,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders) { WebURLRequest request; request.initialize(); - GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); request.setURL(url); WebString headerNameString(WebString::fromUTF8("non-whitelisted")); diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 262fcf76f..892da4f2f 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -175,7 +175,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setScreenSpaceTransform(arbitraryTransform)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawableContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUpdateRect(arbitraryFloatRect)); - EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleLayerRect(arbitraryIntRect)); + EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaxScrollPosition(arbitraryIntSize)); } diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp index b35819759..6cc4d2c39 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -43,10 +43,11 @@ void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) for (size_t i = 0; i < quads.size(); ++i) { CCDrawQuad* quad = quads[i].get(); + IntRect quadRect = quad->quadRect(); - EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; - EXPECT_TRUE(remaining.contains(quad->quadRect())) << quadString << i; - remaining.subtract(Region(quad->quadRect())); + EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; + EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i; + remaining.subtract(Region(quadRect)); } EXPECT_TRUE(remaining.isEmpty()); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 73f1eb974..54409514c 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -2844,13 +2844,13 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id()); EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); - EXPECT_FALSE(child2->visibleLayerRect().isEmpty()); + EXPECT_FALSE(child2->visibleContentRect().isEmpty()); - // The animating layers should have a visibleLayerRect that represents the area of the front face that is within the viewport. - EXPECT_EQ(animatingChild->visibleLayerRect(), IntRect(IntPoint(), animatingChild->contentBounds())); - EXPECT_EQ(animatingSurface->visibleLayerRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); - // And layers in the subtree of the animating layer should have valid visibleLayerRects also. - EXPECT_EQ(childOfAnimatingSurface->visibleLayerRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); + // The animating layers should have a visibleContentRect that represents the area of the front face that is within the viewport. + EXPECT_EQ(animatingChild->visibleContentRect(), IntRect(IntPoint(), animatingChild->contentBounds())); + EXPECT_EQ(animatingSurface->visibleContentRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); + // And layers in the subtree of the animating layer should have valid visibleContentRects also. + EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); } TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface) @@ -3208,7 +3208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) { - // A layer's visibleLayerRect is actually in the layer's content space. The + // A layer's visibleContentRect is actually in the layer's content space. The // screenSpaceTransform converts from the layer's origin space to screen space. This // test makes sure that hit testing works correctly accounts for the contents scale. // A contentsScale that is not 1 effectively forces a non-identity transform between @@ -3216,7 +3216,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // screenSpaceTransformn. The hit testing code must take this into account. // // To test this, the layer is positioned at (25, 25), and is size (50, 50). If - // contentsScale is ignored, then hit testing will mis-interpret the visibleLayerRect + // contentsScale is ignored, then hit testing will mis-interpret the visibleContentRect // as being larger than the actual bounds of the layer. // DebugScopedSetImplThread thisScopeIsOnImplThread; @@ -3242,8 +3242,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. - // The visibleLayerRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleLayerRect()); + // The visibleContentRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. + EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); @@ -3418,7 +3418,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // (4, 50) is inside the unclipped layer, but that corner of the layer should be // clipped away by the grandParent and should not get hit. If hit testing blindly uses - // visibleLayerRect without considering how parent may clip the layer, then hit + // visibleContentRect without considering how parent may clip the layer, then hit // testing would accidentally think that the point successfully hits the layer. testPoint = IntPoint(4, 50); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index fbede6ced..cb2b7f36f 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -31,7 +31,6 @@ #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "LayerRendererChromium.h" -#include "ManagedTexture.h" #include "cc/CCIOSurfaceLayerImpl.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTilingData.h" @@ -70,6 +69,8 @@ public: , m_didRequestRedraw(false) { CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + m_hostImpl = CCLayerTreeHostImpl::create(settings, this); m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); m_hostImpl->setViewportSize(IntSize(10, 10)); @@ -86,6 +87,8 @@ public: CCSettings::setPartialSwapEnabled(partialSwap); CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); myHostImpl->initializeLayerRenderer(graphicsContext, UnthrottledUploader); @@ -97,7 +100,7 @@ public: root->setPosition(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(IntSize(10, 10)); - root->setVisibleLayerRect(IntRect(0, 0, 10, 10)); + root->setVisibleContentRect(IntRect(0, 0, 10, 10)); root->setDrawsContent(true); myHostImpl->setRootLayer(root.release()); return myHostImpl.release(); @@ -625,7 +628,7 @@ protected: setContentBounds(IntSize(10, 10)); setDrawsContent(true); setSkipsDraw(false); - setVisibleLayerRect(IntRect(0, 0, 10, 10)); + setVisibleContentRect(IntRect(0, 0, 10, 10)); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); tiler->setBounds(contentBounds()); @@ -647,7 +650,7 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) root->addChild(DidDrawCheckLayer::create(2)); DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); - // Ensure visibleLayerRect for layer is empty + // Ensure visibleContentRect for layer is empty layer->setPosition(FloatPoint(100, 100)); layer->setBounds(IntSize(10, 10)); layer->setContentBounds(IntSize(10, 10)); @@ -664,9 +667,9 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_FALSE(layer->willDrawCalled()); EXPECT_FALSE(layer->didDrawCalled()); - EXPECT_TRUE(layer->visibleLayerRect().isEmpty()); + EXPECT_TRUE(layer->visibleContentRect().isEmpty()); - // Ensure visibleLayerRect for layer layer is not empty + // Ensure visibleContentRect for layer layer is not empty layer->setPosition(FloatPoint(0, 0)); EXPECT_FALSE(layer->willDrawCalled()); @@ -679,12 +682,11 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_TRUE(layer->willDrawCalled()); EXPECT_TRUE(layer->didDrawCalled()); - EXPECT_FALSE(layer->visibleLayerRect().isEmpty()); + EXPECT_FALSE(layer->visibleContentRect().isEmpty()); } TEST_F(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) { - // Make the viewport large so that we can have large layers that get considered for occlusion (small layers do not). IntSize bigSize(1000, 1000); m_hostImpl->setViewportSize(bigSize); @@ -1184,10 +1186,8 @@ private: IntRect m_quadVisibleRect; }; -// https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - { OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1200,6 +1200,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) root->addChild(BlendStateCheckLayer::create(2)); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get()); + layer1->setPosition(FloatPoint(2, 2)); CCLayerTreeHostImpl::FrameData frame; @@ -1252,6 +1253,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->addChild(BlendStateCheckLayer::create(3)); BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get()); + layer2->setPosition(FloatPoint(4, 4)); // 2 opaque layers, drawn without blending. layer1->setOpaque(true); @@ -1626,6 +1628,28 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); } +TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) +{ + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); + child->setAnchorPoint(FloatPoint(0, 0)); + child->setBounds(IntSize(10, 10)); + child->setDrawsContent(true); + root->setAnchorPoint(FloatPoint(0, 0)); + root->setBounds(IntSize(10, 10)); + root->setDrawsContent(true); + root->setOpacity(0.7f); + root->addChild(adoptPtr(child)); + + m_hostImpl->setRootLayer(adoptPtr(root)); + + CCLayerTreeHostImpl::FrameData frame; + + EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); + EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); + EXPECT_EQ(1u, frame.renderPasses.size()); +} + } // namespace class FakeLayerWithQuads : public CCLayerImpl { @@ -1855,7 +1879,7 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); root->setContentBounds(root->bounds()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->setDrawsContent(false); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); @@ -1864,14 +1888,14 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C child->setOpacity(0.5f); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setContentBounds(child->bounds()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child->setDrawsContent(false); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); grandChild->setContentBounds(grandChild->bounds()); - grandChild->setVisibleLayerRect(grandChildRect); + grandChild->setVisibleContentRect(grandChildRect); grandChild->setDrawsContent(true); child->addChild(grandChild.release()); @@ -2420,7 +2444,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, root->setPosition(FloatPoint(0, 0)); root->setBounds(rootSize); root->setContentBounds(rootSize); - root->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + root->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); root->setDrawsContent(true); layerTreeHostImpl->setRootLayer(root.release()); @@ -2432,7 +2456,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, intermediateLayerPtr->setPosition(FloatPoint(10, 10)); intermediateLayerPtr->setBounds(rootSize); intermediateLayerPtr->setContentBounds(rootSize); - intermediateLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + intermediateLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); intermediateLayerPtr->setDrawsContent(false); // only children draw content rootPtr->addChild(intermediateLayer.release()); @@ -2446,7 +2470,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, surfaceLayerPtr->setPosition(FloatPoint(10, 10)); surfaceLayerPtr->setBounds(surfaceSize); surfaceLayerPtr->setContentBounds(surfaceSize); - surfaceLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), surfaceSize)); + surfaceLayerPtr->setVisibleContentRect(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()); @@ -2460,7 +2484,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, childPtr->setPosition(FloatPoint(5, 5)); childPtr->setBounds(childSize); childPtr->setContentBounds(childSize); - childPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), childSize)); + childPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), childSize)); childPtr->setDrawsContent(true); surfaceLayerPtr->addChild(child.release()); @@ -2496,7 +2520,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2528,7 +2553,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2548,7 +2574,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2574,10 +2601,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2611,7 +2639,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2643,7 +2672,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2676,7 +2706,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2696,7 +2727,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2722,10 +2754,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2760,7 +2793,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2801,7 +2835,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2834,7 +2869,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) 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()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2877,7 +2913,6 @@ struct RenderPassCacheEntry { struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { std::map<char, RenderPassCacheEntry> renderPassCache; - std::map<const CCRenderPass*, char> renderPassId; Vector<OwnPtr<CCRenderSurface> > renderSurfaceStore; Vector<OwnPtr<CCLayerImpl> > layerStore; OwnPtr<CCSharedQuadState> sharedQuadState; @@ -2943,14 +2978,13 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova renderer->clearCachedTextures(); // One shared state for all quads - we don't need the correct details - testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; // Pre-create root pass char rootRenderPassId = testScript[0]; OwnPtr<CCRenderPass> rootRenderPass = createDummyRenderPass(testData, rootRenderPassId); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(rootRenderPass.get(), rootRenderPassId)); testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); while (*currentChar) { char renderPassId = currentChar[0]; @@ -2997,26 +3031,22 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova currentChar++; } - CCRenderPass* refRenderPassPtr; - if (testData.renderPassCache.find(newRenderPassId) == testData.renderPassCache.end()) { if (hasTexture) renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); - OwnPtr<CCRenderPass> refRenderPass = createDummyRenderPass(testData, newRenderPassId); - refRenderPassPtr = refRenderPass.get(); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(refRenderPass.get(), newRenderPassId)); - testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(refRenderPass.release()))); - } else - refRenderPassPtr = testData.renderPassCache[newRenderPassId].renderPass; + OwnPtr<CCRenderPass> renderPass = createDummyRenderPass(testData, newRenderPassId); + testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); + } IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, refRenderPassPtr, isReplica, WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); + OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release()); } } - testData.renderPasses.insert(0, renderPass.release()); + testData.renderPasses.insert(0, renderPass.get()); + testData.renderPassesById.add(renderPassId, renderPass.release()); if (*currentChar) currentChar++; } @@ -3026,9 +3056,8 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf { char* pos = buffer; for (CCRenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { - CCRenderPass* currentPass = it->get(); - char passId = testData.renderPassId.find(currentPass)->second; - *pos = passId; + const CCRenderPass* currentPass = *it; + *pos = currentPass->id(); pos++; CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin(); @@ -3039,14 +3068,10 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf *pos = 's'; pos++; break; - case CCDrawQuad::RenderPass: { - CCRenderPassDrawQuad* renderPassDrawQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - const CCRenderPass* refPass = renderPassDrawQuad->renderPass(); - char refPassId = testData.renderPassId.find(refPass)->second; - *pos = refPassId; + case CCDrawQuad::RenderPass: + *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); pos++; break; - } default: *pos = 'x'; pos++; diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 22ed5a997..f0bfd0ea3 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -62,7 +62,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return LayerChromium::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -88,7 +88,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return CCLayerImpl::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -759,7 +759,7 @@ protected: // This extends past both sides of child2, so it will be the original rect. EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. - // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). + // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleContentRect(). EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. @@ -869,7 +869,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); @@ -2024,7 +2024,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); - // This is very close to the camera, so pixels in its visibleLayerRect will actually go outside of the layer's clipRect. + // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. // Ensure that those pixels don't occlude things outside the clipRect. this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 468af36bb..21e0a717c 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -28,6 +28,7 @@ #include "CCTiledLayerTestCommon.h" #include "cc/CCPrioritizedTextureManager.h" +#include "cc/CCTexture.h" #include <gtest/gtest.h> using namespace WebCore; @@ -50,7 +51,7 @@ public: size_t texturesMemorySize(size_t textureCount) { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; + return CCTexture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount; } PassOwnPtr<CCPrioritizedTextureManager> createManager(size_t maxTextures) @@ -98,7 +99,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_FALSE(validateTexture(textures[8], false)); @@ -109,7 +110,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[7], false)); EXPECT_TRUE(validateTexture(textures[8], false)); @@ -134,7 +135,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); textureManager->reduceMemory(allocator()); @@ -144,7 +145,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 5 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); textureManager->reduceMemory(allocator()); @@ -154,7 +155,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 4 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); textureManager->reduceMemory(allocator()); @@ -180,7 +181,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) textures[i]->setRequestPriority(200 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Allocate textures which are currently high priority. EXPECT_TRUE(validateTexture(textures[0], false)); @@ -195,7 +196,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) moreTextures[i]->setRequestPriority(100 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Textures are now below cutoff. EXPECT_FALSE(validateTexture(textures[0], false)); @@ -241,7 +242,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // The two high priority textures should be available, others should not. for (size_t i = 0; i < 2; ++i) @@ -272,7 +273,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -295,7 +296,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManagerOne->prioritizeTextures(0); + textureManagerOne->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -311,7 +312,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(textureManagerTwo.get()); - textureManagerTwo->prioritizeTextures(0); + textureManagerTwo->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -325,8 +326,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -339,7 +342,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[3], false)); EXPECT_FALSE(validateTexture(textures[4], false)); @@ -350,14 +353,14 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[3], false)); EXPECT_TRUE(validateTexture(textures[4], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -368,8 +371,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -382,7 +387,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa textures[i]->setRequestPriority(100); // The first four to be requested late will be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); for (unsigned i = 0; i < maxTextures; ++i) EXPECT_FALSE(validateTexture(textures[i], false)); for (unsigned i = 0; i < maxTextures; i += 2) @@ -391,7 +396,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_FALSE(validateTexture(textures[i], true)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -402,8 +407,10 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -417,7 +424,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva for (size_t i = 6; i < 8; ++i) textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(false)); - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); // Unable to requestLate textures in the child surface. EXPECT_FALSE(validateTexture(textures[6], true)); @@ -428,7 +435,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_TRUE(validateTexture(textures[i], false)); EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index d0d87d252..624d24711 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -67,7 +67,7 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We layer->setSkipsDraw(false); layer->setDrawTransform(drawTransform); layer->setScreenSpaceTransform(drawTransform); - layer->setVisibleLayerRect(layerRect); + layer->setVisibleContentRect(layerRect); layer->setDrawOpacity(opacity); layer->setOpaque(opaque); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index b65e6e72b..e9e041749 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -102,12 +102,10 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - WebTransformationMatrix draw; WebTransformationMatrix origin; - draw.translate(30, 40); + origin.translate(30, 40); - renderSurface->setDrawTransform(draw); renderSurface->setOriginTransform(origin); renderSurface->setContentRect(contentRect); renderSurface->setClipRect(clipRect); @@ -116,13 +114,12 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(); - EXPECT_TRUE(sharedQuadState->quadTransform().isIdentity()); - EXPECT_EQ(30, sharedQuadState->layerTransform().m41()); - EXPECT_EQ(40, sharedQuadState->layerTransform().m42()); - EXPECT_EQ(contentRect, sharedQuadState->layerRect()); - EXPECT_EQ(clipRect, sharedQuadState->scissorRect()); - EXPECT_EQ(1, sharedQuadState->opacity()); - EXPECT_FALSE(sharedQuadState->isOpaque()); + EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); + EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); + EXPECT_EQ(contentRect, IntRect(sharedQuadState->visibleContentRect)); + EXPECT_EQ(clipRect, IntRect(sharedQuadState->scissorRect)); + EXPECT_EQ(1, sharedQuadState->opacity); + EXPECT_FALSE(sharedQuadState->opaque); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 22763cef3..1bfc81d8c 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -45,17 +45,17 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(800, 600); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleLayerRect); + verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) @@ -66,10 +66,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setBackgroundColor(testColor); @@ -78,7 +78,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(quadCuller.quadList()[0]->toSolidColorDrawQuad()->color(), testColor); + EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->color(), testColor); } TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) @@ -89,10 +89,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setDrawOpacity(opacity); @@ -101,7 +101,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity()); + EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->opacity()); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp new file mode 100644 index 000000000..d0bbd36f4 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp @@ -0,0 +1,520 @@ +/* + * 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 "cc/CCTextureUpdater.h" + +#include "CCTiledLayerTestCommon.h" +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" +#include "WebCompositor.h" +#include "platform/WebThread.h" + +#include <gtest/gtest.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; +using namespace WebKitTests; +using testing::Test; + + +namespace { + +const int kFlushPeriodFull = 4; +const int kFlushPeriodPartial = kFlushPeriodFull; + +class CCTextureUpdaterTest; + +class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { +public: + WebGraphicsContext3DForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } + virtual void flush(void); + virtual GrGLInterface* onCreateGrGLInterface() { return 0; } + +private: + CCTextureUpdaterTest* m_test; +}; + + +class TextureUploaderForUploadTest : public FakeTextureUploader { +public: + TextureUploaderForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } + + virtual void beginUploads(); + virtual void endUploads(); + virtual void uploadTexture(WebCore::CCGraphicsContext*, + WebCore::LayerTextureUpdater::Texture*, + WebCore::TextureAllocator*, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect); + +private: + CCTextureUpdaterTest* m_test; +}; + + +class TextureForUploadTest : public LayerTextureUpdater::Texture { +public: + TextureForUploadTest() : LayerTextureUpdater::Texture(adoptPtr<CCPrioritizedTexture>(0)) { } + virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) { } +}; + + +class CCTextureUpdaterTest : public Test { +public: + CCTextureUpdaterTest() + : m_uploader(this) + , m_fullUploadCountExpected(0) + , m_partialCountExpected(0) + , m_totalUploadCountExpected(0) + , m_maxUploadCountPerUpdate(0) + , m_numBeginUploads(0) + , m_numEndUploads(0) + , m_numConsecutiveFlushes(0) + , m_numDanglingUploads(0) + , m_numTotalUploads(0) + , m_numTotalFlushes(0) + , m_numPreviousUploads(0) + , m_numPreviousFlushes(0) + { } + +public: + void onFlush() + { + // Check for back-to-back flushes. + EXPECT_EQ(0, m_numConsecutiveFlushes) << "Back-to-back flushes detected."; + + // Check for premature flushes + if (m_numPreviousUploads != m_maxUploadCountPerUpdate) { + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodFull) << "Premature flush detected in full uploads."; + else if (m_numTotalUploads > m_fullUploadCountExpected && m_numTotalUploads < m_totalUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodPartial) << "Premature flush detected in partial uploads."; + } + + m_numDanglingUploads = 0; + m_numConsecutiveFlushes++; + m_numTotalFlushes++; + m_numPreviousFlushes++; + } + + void onBeginUploads() + { + m_numPreviousFlushes = 0; + m_numPreviousUploads = 0; + m_numBeginUploads++; + } + + void onUpload() + { + // Check for too many consecutive uploads + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_LT(m_numDanglingUploads, kFlushPeriodFull) << "Too many consecutive full uploads detected."; + else + EXPECT_LT(m_numDanglingUploads, kFlushPeriodPartial) << "Too many consecutive partial uploads detected."; + + m_numConsecutiveFlushes = 0; + m_numDanglingUploads++; + m_numTotalUploads++; + m_numPreviousUploads++; + } + + void onEndUploads() + { + EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; + + // Note: The m_numTotalUploads != m_fullUploadCountExpected comparison + // allows for the quota not to be hit in the case where we are trasitioning + // from full uploads to partial uploads. + if (m_numTotalUploads != m_totalUploadCountExpected && m_numTotalUploads != m_fullUploadCountExpected) { + EXPECT_EQ(m_maxUploadCountPerUpdate, m_numPreviousUploads) + << "endUpload() was called when there are textures to upload, but the upload quota hasn't been filled."; + } + + m_numEndUploads++; + } + +protected: + virtual void SetUp() + { + OwnPtr<WebThread> thread; + WebCompositor::initialize(thread.get()); + + m_context = CCGraphicsContext::create3D( + adoptPtr(new WebGraphicsContext3DForUploadTest(this))); + } + + virtual void TearDown() + { + WebCompositor::shutdown(); + } + + void appendFullUploadsToUpdater(int count) + { + m_fullUploadCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 300, 150); + for (int i = 0; i < count; i++) + m_updater.appendFullUpdate(&m_texture, rect, rect); + } + + void appendPartialUploadsToUpdater(int count) + { + m_partialCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 100, 100); + for (int i = 0; i < count; i++) + m_updater.appendPartialUpdate(&m_texture, rect, rect); + } + + void setMaxUploadCountPerUpdate(int count) + { + m_maxUploadCountPerUpdate = count; + } + +protected: + // Classes required to interact and test the CCTextureUpdater + OwnPtr<CCGraphicsContext> m_context; + CCTextureUpdater m_updater; + TextureForUploadTest m_texture; + FakeTextureAllocator m_allocator; + FakeTextureCopier m_copier; + TextureUploaderForUploadTest m_uploader; + + // Properties / expectations of this test + int m_fullUploadCountExpected; + int m_partialCountExpected; + int m_totalUploadCountExpected; + int m_maxUploadCountPerUpdate; + + // Dynamic properties of this test + int m_numBeginUploads; + int m_numEndUploads; + int m_numConsecutiveFlushes; + int m_numDanglingUploads; + int m_numTotalUploads; + int m_numTotalFlushes; + int m_numPreviousUploads; + int m_numPreviousFlushes; +}; + + +void WebGraphicsContext3DForUploadTest::flush(void) +{ + m_test->onFlush(); +} + +void TextureUploaderForUploadTest::beginUploads() +{ + m_test->onBeginUploads(); +} + +void TextureUploaderForUploadTest::endUploads() +{ + m_test->onEndUploads(); +} + +void TextureUploaderForUploadTest::uploadTexture(WebCore::CCGraphicsContext* context, + WebCore::LayerTextureUpdater::Texture* texture, + WebCore::TextureAllocator* allocator, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect) +{ + m_test->onUpload(); +} + + +// ZERO UPLOADS TESTS +TEST_F(CCTextureUpdaterTest, ZeroUploads) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(0, m_numBeginUploads); + EXPECT_EQ(0, m_numEndUploads); + EXPECT_EQ(0, m_numPreviousFlushes); + EXPECT_EQ(0, m_numPreviousUploads); +} + + +// ONE UPLOAD TESTS +TEST_F(CCTextureUpdaterTest, OneFullUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OnePartialUpload) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OneFullOnePartialUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + // We expect the full uploads to be followed by a flush + // before the partial uploads begin. + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(2, m_numPreviousFlushes); + EXPECT_EQ(2, m_numPreviousUploads); +} + + +// NO REMAINDER TESTS +// This class of tests upload a number of textures that is a multiple of the flush period. +const int fullUploadFlushMultipler = 7; +const int fullNoRemainderCount = fullUploadFlushMultipler * kFlushPeriodFull; + +const int partialUploadFlushMultipler = 11; +const int partialNoRemainderCount = partialUploadFlushMultipler * kFlushPeriodPartial; + +TEST_F(CCTextureUpdaterTest, ManyFullUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(partialNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount + partialNoRemainderCount, m_numPreviousUploads); +} + + +// MIN/MAX REMAINDER TESTS +// This class of tests mix and match uploading 1 more and 1 less texture +// than a multiple of the flush period. + +const int fullMinRemainderCount = fullNoRemainderCount + 1; +const int fullMaxRemainderCount = fullNoRemainderCount - 1; +const int partialMinRemainderCount = partialNoRemainderCount + 1; +const int partialMaxRemainderCount = partialNoRemainderCount - 1; + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler + 2, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialUploadsMaxRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMinRemainderManyPartialMaxRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ((fullUploadFlushMultipler+1) + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMaxRemainderManyPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + (partialUploadFlushMultipler+1), m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + + +// MULTIPLE UPDATE TESTS +// These tests attempt to upload too many textures at once, requiring +// multiple calls to update(). + +int expectedFlushes(int uploads, int flushPeriod) +{ + return (uploads + flushPeriod - 1) / flushPeriod; +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 100; + const int kPartialUploads = 20; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Second update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Third update (20 full, 20 partial) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kFullUploads-kMaxUploadsPerUpdate*2, kFlushPeriodFull) + + expectedFlushes(kPartialUploads, kFlushPeriodPartial); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = (kFullUploads-kMaxUploadsPerUpdate*2)+kPartialUploads; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 70; + const int kPartialUploads = 30; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Second update (30 full, optionally 10 partial) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here, as the number of flushes + // will depend on whether some partial uploads were performed. + // onFlush(), onUpload(), and onEndUpload() will do basic flush checks for us anyway. + + // Third update (30 partial OR 20 partial if 10 partial uploaded in second update) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here as well. + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index 40d3ce5e6..2e2c1a06f 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -34,7 +34,6 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCActiveAnimation.h" diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index efb3a6a16..588c0ff08 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -48,7 +48,7 @@ static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I tiler->setBounds(layerSize); layer->setTilingData(*tiler); layer->setSkipsDraw(false); - layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + layer->setVisibleContentRect(IntRect(IntPoint(), layerSize)); layer->setDrawOpacity(1); int textureId = 1; @@ -82,7 +82,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - layer->setVisibleLayerRect(IntRect()); + layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -96,7 +96,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); - layer->setVisibleLayerRect(outsideBounds); + layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -158,10 +158,10 @@ TEST(CCTiledLayerImplTest, checkerboarding) } } -static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) +static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); MockCCQuadCuller quadCuller(quads); @@ -201,13 +201,13 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt // This rect intersects the middle 3x3 of the 5x5 tiles. IntPoint topLeft(65, 73); IntPoint bottomRight(182, 198); - IntRect visibleLayerRect(topLeft, bottomRight - topLeft); + IntRect visibleContentRect(topLeft, bottomRight - topLeft); IntSize layerSize(250, 250); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); @@ -216,11 +216,11 @@ static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOp DebugScopedSetImplThread scopedImplThread; IntSize layerSize(220, 210); - IntRect visibleLayerRect(IntPoint(), layerSize); + IntRect visibleContentRect(IntPoint(), layerSize); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 558cba576..2d1603e48 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -68,7 +68,7 @@ void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const m_prepareCount++; m_lastUpdateRect = contentRect; if (!m_rectToInvalidate.isEmpty()) { - m_layer->invalidateRect(m_rectToInvalidate); + m_layer->invalidateContentRect(m_rectToInvalidate); m_rectToInvalidate = IntRect(); m_layer = 0; } @@ -118,7 +118,7 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) { - updateLayerRect(updater, visibleLayerRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion); } void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 53e58b3a7..9501caba9 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -29,6 +29,7 @@ #include "IntSize.h" #include "LayerTextureUpdater.h" #include "Region.h" +#include "TextureAllocator.h" #include "TextureCopier.h" #include "TextureUploader.h" #include "TiledLayerChromium.h" @@ -110,8 +111,8 @@ public: static WebCore::IntSize tileSize() { return WebCore::IntSize(100, 100); } - using WebCore::TiledLayerChromium::invalidateRect; - using WebCore::TiledLayerChromium::updateLayerRect; + using WebCore::TiledLayerChromium::invalidateContentRect; + using WebCore::TiledLayerChromium::updateContentRect; using WebCore::TiledLayerChromium::needsIdlePaint; using WebCore::TiledLayerChromium::skipsDraw; using WebCore::TiledLayerChromium::numPaintedTiles; @@ -120,7 +121,7 @@ public: virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE; const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } - // Updates the visibleLayerRect(). + // Updates the visibleContentRect(). virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE; virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index 435907c94..c206dda5e 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -30,7 +30,6 @@ #include "GraphicsContext3DPrivate.h" #include "ImageBuffer.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCGraphicsContext.h" diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp index db80f5bfe..454dfea2c 100644 --- a/Source/WebKit/chromium/tests/DecimalTest.cpp +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -211,12 +211,14 @@ TEST_F(DecimalTest, AddSpecialValues) TEST_F(DecimalTest, Ceiling) { EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); @@ -229,7 +231,7 @@ TEST_F(DecimalTest, CeilingBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); } -TEST_F(DecimalTest, CeilingSmallExponent) +TEST_F(DecimalTest, DISABLED_CeilingSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); @@ -525,12 +527,14 @@ TEST_F(DecimalTest, EncodedData) TEST_F(DecimalTest, Floor) { EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor()); EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); @@ -543,7 +547,7 @@ TEST_F(DecimalTest, FloorBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); } -TEST_F(DecimalTest, FloorSmallExponent) +TEST_F(DecimalTest, DISABLED_FloorSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); diff --git a/Source/WebKit/chromium/tests/EventListenerTest.cpp b/Source/WebKit/chromium/tests/EventListenerTest.cpp index 799ac4007..425546952 100644 --- a/Source/WebKit/chromium/tests/EventListenerTest.cpp +++ b/Source/WebKit/chromium/tests/EventListenerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDOMMutationEvent.h" @@ -78,7 +79,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName("listener/mutation_event_listener.html"); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp index e406413dd..a2b1675c0 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include <wtf/StdLibExtras.h> #include "WebFrame.h" #include "WebFrameClient.h" @@ -40,35 +41,16 @@ #include "platform/WebURLResponse.h" #include "WebView.h" #include "WebViewClient.h" -#include <googleurl/src/gurl.h> #include <webkit/support/webkit_support.h> namespace WebKit { namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName) -{ - registerMockedURLLoad(GURL(base + fileName), fileName); -} - -void registerMockedURLLoad(GURL url, const std::string& fileName) -{ - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); -} - void loadFrame(WebFrame* frame, const std::string& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(GURL(url)); + urlRequest.setURL(URLTestHelpers::toKURL(url)); frame->loadRequest(urlRequest); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.h b/Source/WebKit/chromium/tests/FrameTestHelpers.h index fc2fa2d36..bfb57b67c 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.h +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.h @@ -33,8 +33,6 @@ #include <string> -class GURL; - namespace WebKit { class WebFrame; @@ -44,10 +42,6 @@ class WebViewClient; namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName); -// Like the previous overload, but it allows more flexibility in the url since it is given by the caller. -void registerMockedURLLoad(GURL, const std::string& fileName); - void loadFrame(WebFrame*, const std::string& url); WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index e7c655247..fdae37c6a 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -494,7 +494,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should not call needsDisplay and needsCommit when changed. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleLayerRect(IntRect(0, 0, 40, 50))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUsesLayerClipping(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setIsNonCompositedContent(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 9c9ec25b0..7cdba809c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext3D.h" #include "WebCompositor.h" #include "cc/CCDrawQuad.h" +#include "cc/CCPrioritizedTextureManager.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" @@ -76,7 +77,7 @@ public: FakeCCRendererClient() : m_setFullRootLayerDamageCount(0) , m_rootLayer(CCLayerImpl::create(1)) - , m_memoryAllocationLimitBytes(0) + , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); diff --git a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp index 5e321c70d..b0f700a0c 100644 --- a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp +++ b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebView.h" #include <gtest/gtest.h> #include <v8/include/v8-profiler.h> @@ -90,7 +91,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName(filename); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 7acb31149..59c233632 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -43,6 +43,7 @@ #include "PopupMenuClient.h" #include "PopupMenuChromium.h" #include "RuntimeEnabledFeatures.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebElement.h" #include "WebFrame.h" @@ -63,6 +64,7 @@ using namespace WebCore; using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -249,15 +251,7 @@ protected: void registerMockedURLLoad(const std::string& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/popup/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html")); } void serveRequests() @@ -269,7 +263,7 @@ protected: { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(GURL(baseURL + fileName))); + urlRequest.setURL(WebURL(toKURL(baseURL + fileName))); frame->loadRequest(urlRequest); } @@ -427,7 +421,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) // mousedown event is held by select node, and we don't simulate the event for the node. // So we can only see mouseup and click event. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); // Disable the item at index 1. m_popupMenuClient.setDisabledIndex(1); @@ -439,7 +433,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item at index 1 is disabled, so the text should not be changed. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); showPopup(); // menuItemHeight * 2.5 means the Y position on the item at index 2. @@ -448,7 +442,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item is changed to the item at index 2, from index 0, so change event is fired. - EXPECT_STREQ("upclickchangeupclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) @@ -469,7 +463,7 @@ TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) WebElement element = m_webView->mainFrame()->document().getElementById("message"); // We only can see change event but no other mouse related events. - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) @@ -491,7 +485,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) @@ -513,7 +507,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("click", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("click", element.innerText().utf8().data()); } } // namespace diff --git a/Source/WebKit/chromium/tests/RunAllTests.cpp b/Source/WebKit/chromium/tests/RunAllTests.cpp index dc0528257..78fd7da3d 100644 --- a/Source/WebKit/chromium/tests/RunAllTests.cpp +++ b/Source/WebKit/chromium/tests/RunAllTests.cpp @@ -28,6 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if WEBKIT_IMPLEMENTATION +#include "config.h" +#endif + // FIXME: Avoid this source dependency on Chromium's base module. #include <base/test/test_suite.h> diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp deleted file mode 100644 index d5313f5dc..000000000 --- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp +++ /dev/null @@ -1,295 +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 "CCTiledLayerTestCommon.h" -#include "ManagedTexture.h" -#include "TextureManager.h" - -#include <gtest/gtest.h> - -using namespace WebCore; -using namespace WebKitTests; -using namespace WTF; - -namespace { - -class TextureManagerTest : public testing::Test { -public: - TextureManagerTest() - : m_textureSize(256, 256) - , m_textureFormat(GraphicsContext3D::RGBA) - { - } - - virtual ~TextureManagerTest() - { - } - - size_t texturesMemorySize(size_t textureCount) - { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; - } - - PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) - { - return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); - } - - bool requestTexture(TextureManager* manager, TextureToken token) - { - bool result = manager->requestTexture(token, m_textureSize, m_textureFormat); - if (result) - manager->allocateTexture(&m_fakeTextureAllocator, token); - return result; - } - -private: - FakeTextureAllocator m_fakeTextureAllocator; - const IntSize m_textureSize; - const GC3Denum m_textureFormat; -}; - -TEST_F(TextureManagerTest, requestTextureInPreferredLimit) -{ - const size_t preferredTextures = 8; - OwnPtr<TextureManager> textureManager = createTextureManager(preferredTextures * 2, preferredTextures); - TextureToken tokens[preferredTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - if (i) - EXPECT_GT(tokens[i], tokens[i - 1]); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - EXPECT_TRUE(textureManager->isProtected(tokens[i])); - } - - for (size_t i = 0; i < preferredTextures; ++i) - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[0]); - textureManager->unprotectTexture(tokens[2]); - - for (size_t i = preferredTextures; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[4]); - textureManager->unprotectTexture(tokens[5]); - - // These textures should be valid before the reduceMemoryToLimit call. - EXPECT_TRUE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[2])); - - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - - EXPECT_FALSE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[1])); - EXPECT_TRUE(textureManager->isProtected(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[2])); - EXPECT_TRUE(textureManager->hasTexture(tokens[3])); - EXPECT_TRUE(textureManager->isProtected(tokens[3])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingMaxLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - for (size_t i = 0; i < maxTextures; ++i) { - TextureToken token = textureManager->getToken(); - EXPECT_FALSE(requestTexture(textureManager.get(), token)); - EXPECT_FALSE(textureManager->hasTexture(token)); - } - - EXPECT_EQ(textureManager->currentMemoryUseBytes(), texturesMemorySize(maxTextures)); - - textureManager->unprotectTexture(tokens[1]); - textureManager->unprotectTexture(tokens[3]); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_FALSE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_FALSE(textureManager->hasTexture(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[3])); -} - -TEST_F(TextureManagerTest, reduceMemoryToLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < preferredTextures + 1; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(1)); - EXPECT_EQ(texturesMemorySize(maxTextures - unprotectedTextures), textureManager->currentMemoryUseBytes()); - - // reduceMemoryToLimit doesn't change the current memory limits. - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setMaxMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->maxMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - - // Setting preferred memory limit only won't force reduceMemoryToLimit. - textureManager->setPreferredMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, textureManagerDestroyedBeforeManagedTexture) -{ - OwnPtr<TextureManager> textureManager = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManager.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - textureManager.clear(); - - // Deleting the manager should invalidate the texture and reservation attempts should fail. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_FALSE(managedTexture->reserve(size, format)); -} - -TEST_F(TextureManagerTest, textureMovedToNewManager) -{ - OwnPtr<TextureManager> textureManagerOne = createTextureManager(1, 1); - OwnPtr<TextureManager> textureManagerTwo = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManagerOne.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to the same manager should be a no-op. - managedTexture->setTextureManager(textureManagerOne.get()); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to a different manager should invalidate the texture. - managedTexture->setTextureManager(textureManagerTwo.get()); - - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); -} - -} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c277e006e..f152ab4fb 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -101,13 +101,13 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -116,11 +116,11 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates both tiles... - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); // ....but then only update one of them. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); layer->pushPropertiesTo(layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. @@ -140,13 +140,13 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -159,10 +159,10 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates part of the top tile... - layer->invalidateRect(IntRect(0, 0, 50, 50)); + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -184,13 +184,13 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -211,8 +211,8 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // This should recreate and update the deleted textures. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -235,13 +235,13 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // This invalidates 25 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -255,9 +255,9 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // For the next four updates, we should detect we still need idle painting. for (int i = 0; i < 4; i++) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -295,21 +295,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // This requires 4*30000 bytes of memory. IntRect layer2Rect(0, 0, 100, 300); layer2->setBounds(layer2Rect.size()); - layer2->setVisibleLayerRect(layer2Rect); - layer2->invalidateRect(layer2Rect); + layer2->setVisibleContentRect(layer2Rect); + layer2->invalidateContentRect(layer2Rect); // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer. IntRect layerRect(IntPoint::zero(), IntSize(100, 2400)); layer1->setBounds(layerRect.size()); - layer1->setVisibleLayerRect(layerRect); - layer1->invalidateRect(layerRect); + layer1->setVisibleContentRect(layerRect); + layer1->invalidateContentRect(layerRect); // Paint a single tile in layer2 so that it will idle paint. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer1->updateLayerRect(updater, layerRect, 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer1->updateContentRect(updater, layerRect, 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -325,8 +325,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now idle paint layer2. We are going to run out of memory though! layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // Oh well, commit the frame and push. updateTextures(); @@ -345,9 +345,9 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, layer2Rect, 0); - layer1->updateLayerRect(updater, layerRect, 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, layer2Rect, 0); + layer1->updateContentRect(updater, layerRect, 0); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -374,12 +374,12 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) layer->setBounds(IntSize(100, 100)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); - layer->invalidateRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); + layer->invalidateContentRect(IntRect(0, 0, 100, 100)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -398,13 +398,13 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) // However, during the paint, we invalidate one of the tiles. This should // not prevent the tile from being pushed. layer->setBounds(IntSize(100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -423,22 +423,22 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -461,21 +461,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -504,12 +504,12 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) // Invalidates 9 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -521,8 +521,8 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -544,14 +544,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) IntRect contentRect; layer->setBounds(contentRect.size()); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -580,14 +580,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); for (int i = 0; i < 2; i++) { // Paint / idle-paint. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -632,11 +632,11 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise, // we shoud paint nothing. @@ -648,9 +648,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) // If the layer is to be prepainted at all, then after four updates we should have the outer row/columns painted. for (int k = 0; k < 4; ++k) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -661,9 +661,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); for (int k = 0; k < 4; ++k) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -687,11 +687,11 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); layer->pushPropertiesTo(layerImpl.get()); @@ -700,22 +700,22 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // Invoke updateLayerRect again. As the layer is valid updateLayerRect shouldn't be invoked on + // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); - layer->invalidateRect(IntRect(0, 0, 50, 50)); - // setRectToInvalidate triggers invalidateRect() being invoked from updateLayerRect. + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); + // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // The layer should still be invalid as updateLayerRect invoked invalidate. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + // The layer should still be invalid as updateContentRect invoked invalidate. + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -733,32 +733,32 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setBounds(layerBounds.size()); layer->setContentBounds(contentBounds.size()); - layer->setVisibleLayerRect(contentBounds); + layer->setVisibleContentRect(contentBounds); // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer. // However, it should still be in layer space, not content space. - layer->invalidateRect(contentBounds); + layer->invalidateContentRect(contentBounds); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); // Partial re-paint should also be represented by the updateRect in layer space, not content space. IntRect partialDamage(30, 100, 10, 10); - layer->invalidateRect(partialDamage); + layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -771,7 +771,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); // Invalidate the entire layer. layer->setNeedsDisplay(); @@ -779,8 +779,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -791,13 +791,13 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Change the contents scale and verify that the content rectangle requiring painting // is not scaled. layer->setContentsScale(2); - layer->setVisibleLayerRect(IntRect(0, 0, 200, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 200, 200)); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // The impl side should get 2x2 tiles now. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 200, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 200, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -809,8 +809,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(priorityCalculator); - layer->updateLayerRect(updater, IntRect(1, 0, 0, 1), 0); - textureManager->prioritizeTextures(0); + layer->updateContentRect(updater, IntRect(1, 0, 0, 1), 0); + textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -839,13 +839,13 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->addChild(childLayer); rootLayer->setBounds(contentBounds); - rootLayer->setVisibleLayerRect(contentRect); + rootLayer->setVisibleContentRect(contentRect); rootLayer->setPosition(FloatPoint(150, 150)); childLayer->setBounds(contentBounds); - childLayer->setVisibleLayerRect(contentRect); + childLayer->setVisibleContentRect(contentRect); childLayer->setPosition(FloatPoint(150, 150)); - rootLayer->invalidateRect(contentRect); - childLayer->invalidateRect(contentRect); + rootLayer->invalidateContentRect(contentRect); + childLayer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(rootLayer); ccLayerTreeHost->setViewportSize(IntSize(300, 300)); @@ -876,15 +876,15 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); layer->setBounds(IntSize(700, 700)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, 700, 700)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, 700, 700)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); layer->setBounds(IntSize(200, 200)); - layer->invalidateRect(IntRect(0, 0, 200, 200)); + layer->invalidateContentRect(IntRect(0, 0, 200, 200)); } TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) @@ -894,13 +894,13 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) int size = 1 << 30; layer->setBounds(IntSize(size, size)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, size, size)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, size, size)); // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -922,8 +922,8 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); layer->setBounds(contentBounds); layer->setPosition(FloatPoint(150, 150)); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(layer); ccLayerTreeHost->setViewportSize(IntSize(300, 200)); @@ -946,7 +946,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Full update of 3 tiles and partial update of 3 tiles. - layer->invalidateRect(IntRect(0, 0, 300, 150)); + layer->invalidateContentRect(IntRect(0, 0, 300, 150)); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -964,7 +964,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -982,7 +982,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Checkerboard all tiles. - layer->invalidateRect(IntRect(0, 0, 300, 200)); + layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -991,7 +991,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1009,7 +1009,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 4 tiles. - layer->invalidateRect(IntRect(50, 50, 100, 100)); + layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1035,12 +1035,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } @@ -1056,12 +1056,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1071,8 +1071,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 200, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1082,8 +1082,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 250, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1104,12 +1104,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 360)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 360), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 360), &occluded); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1120,11 +1120,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 350)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 350), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 350), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1135,11 +1135,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region is even smaller than the occlusion, it should have the same result. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 340)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 340), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 340), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1160,11 +1160,11 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); updateTextures(); @@ -1175,7 +1175,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1200,11 +1200,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1228,11 +1228,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1248,11 +1248,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // a different layer space. In this case the occluded region catches the // blown up tiles. occluded.setOcclusion(IntRect(200, 200, 300, 200)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1268,11 +1268,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1296,16 +1296,16 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1317,8 +1317,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // visibleContentOpaqueRegion should match the visible part of what is painted opaque. opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1331,7 +1331,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1345,8 +1345,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1360,8 +1360,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(10, 10, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(10, 10, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1389,16 +1389,16 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1411,9 +1411,9 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle, // even though it is not dirty and will not be uploaded. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->invalidateRect(IntRect(50, 200, 10, 10)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->invalidateContentRect(IntRect(50, 200, 10, 10)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1448,7 +1448,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->setBounds(rootRect.size()); root->setAnchorPoint(FloatPoint()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->addChild(surface); surface->setForceRenderSurface(true); @@ -1460,20 +1460,20 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->setBounds(childRect.size()); child->setAnchorPoint(FloatPoint()); child->setPosition(childRect.location()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child2->setBounds(child2Rect.size()); child2->setAnchorPoint(FloatPoint()); child2->setPosition(child2Rect.location()); - child2->setVisibleLayerRect(child2Rect); + child2->setVisibleContentRect(child2Rect); ccLayerTreeHost->setRootLayer(root); ccLayerTreeHost->setViewportSize(rootRect.size()); // With a huge memory limit, all layers should update and push their textures. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -1506,9 +1506,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that // the child layers draw into, the child layers will not be allocated. If the surface isn't // accounted for, then one of the children would fit within the memory limit. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 2 + 3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1542,9 +1542,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // allocated. If render surface memory wasn't accounted for, there is enough space // for one of the children layers, but they draw into a surface that can't be // allocated. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1633,13 +1633,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) IntRect contentRect(0, 0, 45, 47); EXPECT_EQ(contentRect.size(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1647,8 +1647,8 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) updateTextures(); // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. - layer->invalidateRect(contentRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->invalidateContentRect(contentRect); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } @@ -1666,13 +1666,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->setContentsScale(1.3); IntRect contentRect(IntPoint(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1681,7 +1681,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.cpp b/Source/WebKit/chromium/tests/URLTestHelpers.cpp new file mode 100644 index 000000000..b2e6039d1 --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "URLTestHelpers.h" + +#include "platform/WebURLResponse.h" +#include <public/WebString.h> +#include <public/WebURL.h> +#include <webkit/support/webkit_support.h> + +namespace WebKit { +namespace URLTestHelpers { + +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType) +{ + // fullURL = baseURL + fileName. + std::string fullString = std::string(baseURL.utf8().data()) + std::string(fileName.utf8().data()); + registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType) +{ + registerMockedURLLoad(fullURL, fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType) +{ + WebURLResponse response; + response.initialize(); + response.setMIMEType(mimeType); + response.setHTTPStatusCode(200); + + // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName. + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); + filePath.append("/Source/WebKit/chromium/tests/data/"); + filePath.append(std::string(relativeBaseDirectory.utf8().data())); + filePath.append(std::string(fileName.utf8().data())); + + webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str())); +} + +} // namespace URLTestHelpers +} // namespace WebKit diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.h b/Source/WebKit/chromium/tests/URLTestHelpers.h new file mode 100644 index 000000000..0b9fb00bb --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef URLTestHelpers_h +#define URLTestHelpers_h + +#include "KURL.h" +#include <public/WebString.h> + +namespace WebKit { + +class WebURL; + +namespace URLTestHelpers { + +inline WebCore::KURL toKURL(const std::string& url) +{ + WTF::String wtfString(url.c_str()); + return WebCore::KURL(WebCore::ParsedURLString, wtfString); +} + +// Helper functions for mock URLs. These functions set up the desired URL and mimeType, with a 200 OK return status. +// For the mock URL, fullURL == baseURL + fileName. +// For the actual file path: <WebKit root directory> + relativeBaseDirectory + fileName, +// or, if the relative base directory is not specified: <WebKit root directory> + fileName. +// +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType); + +} // namespace URLTestHelpers +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 6b14cff0f..9b745e029 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -36,6 +36,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "ResourceError.h" +#include "URLTestHelpers.h" #include "WebDataSource.h" #include "WebDocument.h" #include "WebFindOptions.h" @@ -55,6 +56,7 @@ #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,12 +75,12 @@ public: void registerMockedHttpURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); } void registerMockedChromeURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str())); } protected: @@ -96,7 +98,7 @@ TEST_F(WebFrameTest, ContentText) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); // Now retrieve the frames text and test it only includes visible elements. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find(" visible paragraph")); EXPECT_NE(std::string::npos, content.find(" visible iframe")); EXPECT_EQ(std::string::npos, content.find(" invisible pararaph")); @@ -156,7 +158,7 @@ TEST_F(WebFrameTest, ChromePageJavascript) webView->layout(); // Now retrieve the frame's text and ensure it was modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Clobbered")); } @@ -175,7 +177,7 @@ TEST_F(WebFrameTest, ChromePageNoJavascript) webView->layout(); // Now retrieve the frame's text and ensure it wasn't modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } @@ -187,7 +189,7 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); // Send a message with the correct origin. - WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); + WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))); WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); @@ -195,14 +197,14 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); // Send another message with incorrect origin. - WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); + WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL))); webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); // Required to see any updates in contentAsText. webView->layout(); // Verify that only the first addition is in the body of the page. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Message 1.")); EXPECT_EQ(std::string::npos, content.find("Message 2.")); } @@ -441,13 +443,13 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) float previousScale = webViewImpl->pageScaleFactor(); // Reload the page using the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); // Reload the page while ignoring the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + thirdURL), true); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); @@ -469,8 +471,8 @@ TEST_F(WebFrameTest, IframeRedirect) WebVector<WebURL> redirects; iframeDataSource->redirectChain(redirects); ASSERT_EQ(2U, redirects.size()); - EXPECT_EQ(GURL("about:blank"), GURL(redirects[0])); - EXPECT_EQ(GURL("http://www.test.com/visible_iframe.html"), GURL(redirects[1])); + EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data())); + EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data())); webView->close(); } @@ -731,19 +733,19 @@ TEST_F(WebFrameTest, GetContentAsPlainText) // Generate a simple test case. const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); // Make sure it comes out OK. const std::string expected("Foo bar\nbaz"); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ(expected, std::string(text.utf8())); + EXPECT_EQ(expected, std::string(text.utf8().data())); // Try reading the same one with clipping of the text. const int length = 5; text = frame->contentAsText(length); - EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8().data())); // Now do a new test with a subframe. const char outerFrameSource[] = "Hello<iframe></iframe> world"; @@ -757,12 +759,12 @@ TEST_F(WebFrameTest, GetContentAsPlainText) webkit_support::RunAllPendingMessages(); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8().data())); // Get the frame text where the subframe separator falls on the boundary of // what we'll take. There used to be a crash in this case. text = frame->contentAsText(12); - EXPECT_EQ("Hello world", std::string(text.utf8())); + EXPECT_EQ("Hello world", std::string(text.utf8().data())); webView->close(); } @@ -774,23 +776,23 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage) // Generate a simple test case. const char simpleSource[] = "<p>Hello</p><p>World</p>"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); - const std::string html = frame->contentAsMarkup().utf8(); + const std::string html = std::string(frame->contentAsMarkup().utf8().data()); // Load again with the output html. - frame->loadHTMLString(html, testURL); + frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL); webkit_support::RunAllPendingMessages(); - EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data())); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); // Test selection check EXPECT_FALSE(frame->hasSelection()); diff --git a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp index 5c3ba98a0..3ea4fcf9e 100644 --- a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebPageSerializer.h" @@ -41,11 +42,12 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; +using WebKit::URLTestHelpers::registerMockedURLLoad; namespace { @@ -110,41 +112,29 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName, const WebString& mimeType) - { - WebURLResponse response; - response.initialize(); - response.setMIMEType(mimeType); - response.setHTTPStatusCode(200); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserializer/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); - } - WebURL setUpCSSTestPage() { - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); return topFrameURL; } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -161,7 +151,7 @@ protected: static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType) { - WebURL webURL = WebURL(GURL(url)); + WebURL webURL = WebURL(toKURL(url)); for (size_t i = 0; i < resources.size(); ++i) { const WebPageSerializer::Resource& resource = resources[i]; if (resource.url == webURL && !resource.data.isEmpty() && !resource.mimeType.compare(WebCString(mimeType))) @@ -184,13 +174,13 @@ private: TEST_F(WebPageNewSerializeTest, PageWithFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -200,7 +190,7 @@ TEST_F(WebPageNewSerializeTest, PageWithFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -227,7 +217,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -249,11 +239,11 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) TEST_F(WebPageNewSerializeTest, BlankFrames) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -263,7 +253,7 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -279,8 +269,8 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) { - WebURL topFrameURL = GURL("http://www.test.com/simple.xhtml"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), xhtmlMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com/simple.xhtml"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), WebString::fromUTF8("pageserializer/"), xhtmlMimeType()); loadURLInTopFrame(topFrameURL); @@ -290,7 +280,7 @@ TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) // We expect only one resource, the XML. ASSERT_EQ(1U, resources.size()); - std::string xml = resources[0].data; + std::string xml = std::string(resources[0].data.data()); // We should have one and only one instance of the XML declaration. size_t pos = xml.find("<?xml version="); @@ -310,7 +300,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_TestMHTMLEncoding) ASSERT_FALSE(mhtmlData.isEmpty()); // Read the MHTML data line per line and do some pseudo-parsing to make sure the right encoding is used for the different sections. - LineReader lineReader(mhtmlData); + LineReader lineReader(std::string(mhtmlData.data())); int sectionCheckedCount = 0; const char* expectedEncoding = 0; std::string line; diff --git a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp index aa0c6dc2a..feb5f7f6f 100644 --- a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebPageSerializer.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "platform/WebString.h" @@ -39,11 +40,11 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,22 +74,16 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName) + void registerMockedURLLoad(const std::string& url, const WebString& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserialization/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -96,7 +91,7 @@ protected: static bool webVectorContains(const WebVector<WebURL>& vector, const char* url) { - return vector.contains(WebURL(GURL(url))); + return vector.contains(WebURL(toKURL(std::string(url)))); } // Useful for debugging. @@ -116,8 +111,8 @@ private: TEST_F(WebPageSerializerTest, HTMLNodes) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple_page.html")); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_page.html")); loadURLInTopFrame(topFrameURL); // Retrieve all resources. @@ -150,18 +145,18 @@ TEST_F(WebPageSerializerTest, HTMLNodes) TEST_F(WebPageSerializerTest, MultipleFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html")); - registerMockedURLLoad(GURL("http://www.test.com/simple_iframe.html"), + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("top_frame.html")); + registerMockedURLLoad("http://www.test.com/simple_iframe.html", WebString::fromUTF8("simple_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"), + registerMockedURLLoad("http://www.test.com/object_iframe.html", WebString::fromUTF8("object_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"), + registerMockedURLLoad("http://www.test.com/embed_iframe.html", WebString::fromUTF8("embed_iframe.html")); // If we don't register a mocked resource for awesome.png, it causes the // document loader of the iframe that has it as its src to assert on close, // not sure why. - registerMockedURLLoad(GURL("http://www.test.com/awesome.png"), + registerMockedURLLoad("http://www.test.com/awesome.png", WebString::fromUTF8("awesome.png")); loadURLInTopFrame(topFrameURL); diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 7903721d9..33ce2f70c 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -35,6 +35,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "HTMLDocument.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebFrame.h" #include "WebFrameClient.h" @@ -42,11 +43,11 @@ #include "platform/WebSize.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -140,7 +141,7 @@ protected: TEST_F(WebViewTest, FocusIsInactive) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); webView->setFocus(true); @@ -168,7 +169,7 @@ TEST_F(WebViewTest, FocusIsInactive) TEST_F(WebViewTest, ActiveState) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); ASSERT_TRUE(webView); @@ -192,7 +193,7 @@ void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma { AutoResizeWebViewClient client; std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight; - FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html"); + URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client); client.testData().setWebView(webView); @@ -291,7 +292,7 @@ TEST_F(WebViewTest, AutoResizeMaxSize) void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str())); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); webView->setInitialFocus(false); EXPECT_EQ(expectedType, webView->textInputType()); @@ -331,7 +332,7 @@ TEST_F(WebViewTest, DISABLED_TextInputType) TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(5, 13); @@ -345,7 +346,7 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) EXPECT_EQ(-1, info.compositionEnd); webView->close(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(8, 19); @@ -364,12 +365,12 @@ TEST_F(WebViewTest, FormChange) { FormChangeWebViewClient client; client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_focused.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_TRUE(client.focused()); client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_not_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_not_focused.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_not_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_FALSE(client.focused()); |
