summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
commit49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch)
tree5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/WebKit/chromium
parentb211c645d8ab690f713515dfdc84d80b11c27d2c (diff)
downloadqtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/WebKit/chromium')
-rw-r--r--Source/WebKit/chromium/ChangeLog3090
-rw-r--r--Source/WebKit/chromium/DEPS2
-rw-r--r--Source/WebKit/chromium/WebKit.gyp22
-rw-r--r--Source/WebKit/chromium/WebKit.gypi9
-rw-r--r--Source/WebKit/chromium/features.gypi42
-rw-r--r--Source/WebKit/chromium/public/WebCompositor.h7
-rw-r--r--Source/WebKit/chromium/public/WebDeviceOrientation.h80
-rw-r--r--Source/WebKit/chromium/public/WebDeviceOrientationClient.h15
-rw-r--r--Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h8
-rw-r--r--Source/WebKit/chromium/public/WebDocument.h1
-rw-r--r--Source/WebKit/chromium/public/WebFileChooserParams.h1
-rw-r--r--Source/WebKit/chromium/public/WebFrame.h14
-rw-r--r--Source/WebKit/chromium/public/WebFrameClient.h4
-rw-r--r--Source/WebKit/chromium/public/WebHelperPlugin.h60
-rw-r--r--Source/WebKit/chromium/public/WebIDBDatabase.h6
-rw-r--r--Source/WebKit/chromium/public/WebIDBKeyPath.h18
-rw-r--r--Source/WebKit/chromium/public/WebIDBMetadata.h70
-rw-r--r--Source/WebKit/chromium/public/WebInputEvent.h20
-rw-r--r--Source/WebKit/chromium/public/WebIntent.h5
-rw-r--r--Source/WebKit/chromium/public/WebMediaPlayer.h9
-rw-r--r--Source/WebKit/chromium/public/WebMediaPlayerClient.h6
-rw-r--r--Source/WebKit/chromium/public/WebMessagePortChannel.h33
-rw-r--r--Source/WebKit/chromium/public/WebMessagePortChannelClient.h22
-rw-r--r--Source/WebKit/chromium/public/WebPermissionClient.h3
-rw-r--r--Source/WebKit/chromium/public/WebPlugin.h2
-rw-r--r--Source/WebKit/chromium/public/WebPopupType.h1
-rw-r--r--Source/WebKit/chromium/public/WebSecurityPolicy.h5
-rw-r--r--Source/WebKit/chromium/public/WebSettings.h12
-rw-r--r--Source/WebKit/chromium/public/WebSharedWorkerClient.h2
-rw-r--r--Source/WebKit/chromium/public/WebStorageArea.h66
-rw-r--r--Source/WebKit/chromium/public/WebStorageNamespace.h33
-rw-r--r--Source/WebKit/chromium/public/WebURLLoaderOptions.h2
-rw-r--r--Source/WebKit/chromium/public/WebView.h2
-rw-r--r--Source/WebKit/chromium/public/WebViewClient.h5
-rw-r--r--Source/WebKit/chromium/public/WebWidgetClient.h3
-rw-r--r--Source/WebKit/chromium/public/linux/WebFontInfo.h7
-rw-r--r--Source/WebKit/chromium/public/linux/WebFontRenderStyle.h3
-rw-r--r--Source/WebKit/chromium/public/linux/WebFontRendering.h7
-rw-r--r--Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h15
-rw-r--r--Source/WebKit/chromium/src/AssertMatchingEnums.cpp4
-rw-r--r--Source/WebKit/chromium/src/AssociatedURLLoader.cpp4
-rw-r--r--Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp6
-rw-r--r--Source/WebKit/chromium/src/AudioDestinationChromium.cpp3
-rw-r--r--Source/WebKit/chromium/src/AudioDestinationChromium.h1
-rw-r--r--Source/WebKit/chromium/src/ChromeClientImpl.cpp12
-rw-r--r--Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp54
-rw-r--r--Source/WebKit/chromium/src/ContextFeaturesClientImpl.h (renamed from Source/WebKit/chromium/public/gtk/WebFontInfo.h)31
-rw-r--r--Source/WebKit/chromium/src/ContextMenuClientImpl.cpp30
-rw-r--r--Source/WebKit/chromium/src/DeviceOrientationClientProxy.h10
-rw-r--r--Source/WebKit/chromium/src/EditorClientImpl.cpp37
-rw-r--r--Source/WebKit/chromium/src/Extensions3DChromium.cpp210
-rw-r--r--Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp22
-rw-r--r--Source/WebKit/chromium/src/FrameLoaderClientImpl.h2
-rw-r--r--Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp1353
-rw-r--r--Source/WebKit/chromium/src/GraphicsContext3DPrivate.h354
-rw-r--r--Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp2
-rw-r--r--Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h2
-rw-r--r--Source/WebKit/chromium/src/InspectorClientImpl.cpp22
-rw-r--r--Source/WebKit/chromium/src/InspectorClientImpl.h11
-rw-r--r--Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp1
-rw-r--r--Source/WebKit/chromium/src/InspectorFrontendClientImpl.h1
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.cpp41
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.h17
-rw-r--r--Source/WebKit/chromium/src/PageWidgetDelegate.cpp5
-rw-r--r--Source/WebKit/chromium/src/PageWidgetDelegate.h6
-rw-r--r--Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp9
-rw-r--r--Source/WebKit/chromium/src/PlatformMessagePortChannel.h2
-rw-r--r--Source/WebKit/chromium/src/PlatformSupport.cpp33
-rw-r--r--Source/WebKit/chromium/src/SharedWorkerRepository.cpp8
-rw-r--r--Source/WebKit/chromium/src/WebCompositorImpl.cpp20
-rw-r--r--Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp8
-rw-r--r--Source/WebKit/chromium/src/WebContentLayerImpl.cpp7
-rw-r--r--Source/WebKit/chromium/src/WebContentLayerImpl.h2
-rw-r--r--Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp8
-rw-r--r--Source/WebKit/chromium/src/WebDeviceOrientation.cpp4
-rw-r--r--Source/WebKit/chromium/src/WebDeviceOrientationController.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebDocument.cpp14
-rw-r--r--Source/WebKit/chromium/src/WebExternalTextureLayer.cpp70
-rw-r--r--Source/WebKit/chromium/src/WebFontImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebFrameImpl.cpp137
-rw-r--r--Source/WebKit/chromium/src/WebFrameImpl.h8
-rw-r--r--Source/WebKit/chromium/src/WebHelperPluginImpl.cpp255
-rw-r--r--Source/WebKit/chromium/src/WebHelperPluginImpl.h86
-rw-r--r--Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebIDBDatabaseImpl.h1
-rw-r--r--Source/WebKit/chromium/src/WebIDBKeyPath.cpp22
-rw-r--r--Source/WebKit/chromium/src/WebImageLayer.cpp48
-rw-r--r--Source/WebKit/chromium/src/WebInputEvent.cpp12
-rw-r--r--Source/WebKit/chromium/src/WebInputEventConversion.cpp5
-rw-r--r--Source/WebKit/chromium/src/WebIntent.cpp17
-rw-r--r--Source/WebKit/chromium/src/WebKit.cpp1
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeView.cpp28
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp47
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h5
-rw-r--r--Source/WebKit/chromium/src/WebNode.cpp3
-rw-r--r--Source/WebKit/chromium/src/WebPagePopupImpl.cpp27
-rw-r--r--Source/WebKit/chromium/src/WebPopupMenuImpl.cpp9
-rw-r--r--Source/WebKit/chromium/src/WebRuntimeFeatures.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebSecurityPolicy.cpp5
-rw-r--r--Source/WebKit/chromium/src/WebSettingsImpl.cpp39
-rw-r--r--Source/WebKit/chromium/src/WebSettingsImpl.h10
-rw-r--r--Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp6
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.cpp128
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.h9
-rw-r--r--Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp1
-rw-r--r--Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp3
-rw-r--r--Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.h1
-rw-r--r--Source/WebKit/chromium/src/js/DevTools.js2
-rw-r--r--Source/WebKit/chromium/src/linux/WebFontInfo.cpp17
-rw-r--r--Source/WebKit/chromium/src/linux/WebFontRenderStyle.cpp6
-rw-r--r--Source/WebKit/chromium/src/linux/WebFontRendering.cpp33
-rw-r--r--Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm57
-rw-r--r--Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp30
-rw-r--r--Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp43
-rw-r--r--Source/WebKit/chromium/tests/CCAnimationTestCommon.h4
-rw-r--r--Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp136
-rw-r--r--Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp95
-rw-r--r--Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp243
-rw-r--r--Source/WebKit/chromium/tests/CCLayerImplTest.cpp24
-rw-r--r--Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp35
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp2025
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp1787
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp929
-rw-r--r--Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp15
-rw-r--r--Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp3
-rw-r--r--Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp42
-rw-r--r--Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp133
-rw-r--r--Source/WebKit/chromium/tests/CCTestCommon.h42
-rw-r--r--Source/WebKit/chromium/tests/CCThreadedTest.cpp651
-rw-r--r--Source/WebKit/chromium/tests/CCThreadedTest.h226
-rw-r--r--Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp4
-rw-r--r--Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h17
-rw-r--r--Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp163
-rw-r--r--Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp205
-rw-r--r--Source/WebKit/chromium/tests/DecimalTest.cpp76
-rwxr-xr-xSource/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h2
-rw-r--r--Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp7
-rw-r--r--Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp366
-rw-r--r--Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp72
-rw-r--r--Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp7
-rw-r--r--Source/WebKit/chromium/tests/LayerChromiumTest.cpp13
-rw-r--r--Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp128
-rw-r--r--Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp267
-rw-r--r--Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp195
-rw-r--r--Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp8
-rw-r--r--Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp4
-rw-r--r--Source/WebKit/chromium/tests/TextureCopierTest.cpp3
-rw-r--r--Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp2
-rw-r--r--Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp17
-rw-r--r--Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp99
-rw-r--r--Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp12
-rw-r--r--Source/WebKit/chromium/tests/WebFrameTest.cpp26
-rw-r--r--Source/WebKit/chromium/tests/WebLayerTest.cpp6
-rw-r--r--Source/WebKit/chromium/tests/data/iframe_redirect.html10
155 files changed, 10990 insertions, 4369 deletions
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 994e3e675..49bb91c43 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,3093 @@
+2012-06-20 Hironori Bono <hbono@chromium.org>
+
+ [chromium] Select the marker range when right-clicking on a marker.
+ https://bugs.webkit.org/show_bug.cgi?id=89331
+
+ Reviewed by Hajime Morita.
+
+ Chromium always selects only one word when right-clicking on a spelling marker.
+ This prevents selecting whole region specified by a marker if the marker
+ consists of two or more words. This change retrieves a range coverted by a
+ marker and select the range. This emulates the behavior of Mac Chromium and it
+ does not need any workarounds for Mac.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+
+2012-06-19 Kenneth Russell <kbr@google.com>
+
+ Unreviewed, rolling out r120772.
+ http://trac.webkit.org/changeset/120772
+ https://bugs.webkit.org/show_bug.cgi?id=89503
+
+ Broke build on Chromium Mac
+
+ * src/WebCompositorImpl.cpp:
+ * src/WebLayerTreeView.cpp:
+ * tests/CCLayerTestCommon.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ * tests/CCOcclusionTrackerTest.cpp:
+ * tests/CCQuadCullerTest.cpp:
+ * tests/CCTiledLayerImplTest.cpp:
+ * tests/ImageLayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+
+2012-06-19 Zeev Lieber <zlieber@chromium.org>
+
+ [Chromium] Remove redundant #includes in compositor
+ https://bugs.webkit.org/show_bug.cgi?id=89503
+
+ Reviewed by Adrienne Walker.
+
+ Minor adjustments to #include statements to remove
+ dependencies. No new tests.
+
+ * src/WebCompositorImpl.cpp:
+ * src/WebLayerTreeView.cpp:
+ * tests/CCLayerTestCommon.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ * tests/CCOcclusionTrackerTest.cpp:
+ * tests/CCQuadCullerTest.cpp:
+ * tests/CCTiledLayerImplTest.cpp:
+ * tests/ImageLayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+
+2012-06-19 Joshua Bell <jsbell@chromium.org>
+
+ IndexedDB: Add new type (and chromium webkit API) for metadata snapshot
+ https://bugs.webkit.org/show_bug.cgi?id=88678
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::metadata):
+ * public/WebIDBKeyPath.h:
+ (WebIDBKeyPath):
+ (WebKit::WebIDBKeyPath::WebIDBKeyPath):
+ (WebKit::WebIDBKeyPath::~WebIDBKeyPath):
+ (WebKit::WebIDBKeyPath::operator=): Used by Chromium backend.
+ * public/WebIDBMetadata.h: Added new type.
+ (WebKit):
+ (WebIDBMetadata):
+ (WebKit::WebIDBMetadata::WebIDBMetadata):
+ (ObjectStore):
+ (WebKit::WebIDBMetadata::ObjectStore::ObjectStore):
+ (Index):
+ (WebKit::WebIDBMetadata::Index::Index):
+ * src/WebIDBKeyPath.cpp: Conform to normal WebXXX patern.
+ (WebKit::WebIDBKeyPath::assign):
+ (WebKit):
+ (WebKit::WebIDBKeyPath::reset):
+
+2012-06-19 Amy Ousterhout <aousterh@chromium.org>
+
+ [Chromium] Style Fix in WebDeviceOrientationController
+ https://bugs.webkit.org/show_bug.cgi?id=89337
+
+ Reviewed by Steve Block.
+
+ Changing a local variable from a PassRefPtr to a RefPtr in order to be consistent with the style guide.
+
+ * src/WebDeviceOrientationController.cpp:
+ (WebKit::WebDeviceOrientationController::didChangeDeviceOrientation):
+
+2012-06-19 Peter Wang <peter.wang@torchmobile.com.cn>
+
+ Remove the function ScriptDebugServer::supportsNativeBreakpoints()
+ https://bugs.webkit.org/show_bug.cgi?id=88759
+
+ Reviewed by Pavel Feldman.
+
+ * src/js/DevTools.js:
+
+2012-06-19 Yury Semikhatsky <yurys@chromium.org>
+
+ [Chromium] Web Inspector: remove unnecessary indirection from message loop instrumentation
+ https://bugs.webkit.org/show_bug.cgi?id=89443
+
+ Removed start/stopMainThreadMonitoring methods from WebDevToolsAgentClient
+ and WebDevToolsAgentImpl. The functionality is now implemented inside
+ InspectorClientImpl.
+
+ Reviewed by Vsevolod Vlasov.
+
+ * public/WebDevToolsAgentClient.h:
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::clearBrowserCookies):
+ (WebKit::InspectorClientImpl::startMainThreadMonitoring):
+ (WebKit::InspectorClientImpl::stopMainThreadMonitoring):
+ (WebKit::InspectorClientImpl::willProcessTask):
+ (WebKit):
+ (WebKit::InspectorClientImpl::didProcessTask):
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+
+2012-06-19 Mike West <mkwst@chromium.org>
+
+ Introduce ENABLE_CSP_NEXT configuration flag.
+ https://bugs.webkit.org/show_bug.cgi?id=89300
+
+ Reviewed by Adam Barth.
+
+ The 1.0 draft of the Content Security Policy spec is just about to
+ move to Last Call. We'll hide work on the upcoming 1.1 spec behind
+ this ENABLE flag, disabled by default.
+
+ Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
+
+ * features.gypi:
+
+2012-06-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120586.
+ http://trac.webkit.org/changeset/120586
+ https://bugs.webkit.org/show_bug.cgi?id=89444
+
+ doesn't fix mac issue (Requested by morrita on #webkit).
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::replaceMisspelledRange):
+
+2012-06-19 Mike West <mkwst@chromium.org>
+
+ Add a scheme registry for bypassing Content Security Policy.
+ https://bugs.webkit.org/show_bug.cgi?id=89373
+
+ Reviewed by Adam Barth.
+
+ * public/WebSecurityPolicy.h:
+ (WebSecurityPolicy):
+ * src/WebSecurityPolicy.cpp:
+ (WebKit::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy):
+ (WebKit):
+
+2012-06-18 Adam Barth <abarth@webkit.org>
+
+ [Chromium] GesturePinchBegin and friends are gesture events
+ https://bugs.webkit.org/show_bug.cgi?id=89398
+
+ Reviewed by James Robinson.
+
+ * public/WebInputEvent.h:
+ (WebKit::WebInputEvent::isGestureEventType):
+
+2012-06-18 Amy Ousterhout <aousterh@chromium.org>
+
+ [Chromium] DeviceOrientation Cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=89354
+
+ Reviewed by Kent Tamura.
+
+ * public/WebDeviceOrientation.h: added const-qualifiers to getters, simplified an overly-complicated parameter to two functions
+ (WebKit::WebDeviceOrientation::isNull):
+ (WebKit::WebDeviceOrientation::canProvideAlpha):
+ (WebKit::WebDeviceOrientation::alpha):
+ (WebKit::WebDeviceOrientation::canProvideBeta):
+ (WebKit::WebDeviceOrientation::beta):
+ (WebKit::WebDeviceOrientation::canProvideGamma):
+ (WebKit::WebDeviceOrientation::gamma):
+ (WebKit::WebDeviceOrientation::canProvideAbsolute):
+ (WebKit::WebDeviceOrientation::absolute):
+ (WebDeviceOrientation):
+ * public/WebDeviceOrientationClient.h: added WEBKIT_ASSERT_NOT_REACHED to virtual functions
+ (WebKit::WebDeviceOrientationClient::setController):
+ (WebKit::WebDeviceOrientationClient::startUpdating):
+ (WebKit::WebDeviceOrientationClient::stopUpdating):
+ (WebKit::WebDeviceOrientationClient::lastOrientation):
+ * public/WebDeviceOrientationClientMock.h: added OVERRIDE specifier for virtual functions
+ (WebDeviceOrientationClientMock):
+ * src/DeviceOrientationClientProxy.h: designated functions as 'virtual' and added OVERRIDE specifier
+ (DeviceOrientationClientProxy):
+ * src/WebDeviceOrientation.cpp: simplified overly-complicated parameter to two functions
+ (WebKit::WebDeviceOrientation::WebDeviceOrientation):
+ (WebKit::WebDeviceOrientation::operator=):
+
+2012-06-18 Ami Fischman <fischman@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use WebImageLayer in GraphicsLayerChromium for image layers
+ https://bugs.webkit.org/show_bug.cgi?id=89150
+
+ Reviewed by Adrienne Walker.
+
+ Implementation of WebImageLayer. Note: This could (should?) live in WebCore/platform/chromium/support/, but it's
+ here to be next to the other Web*Layer.cpp implementation files.
+
+ * WebKit.gyp:
+ * src/WebImageLayer.cpp: Added.
+ (WebKit):
+ (WebKit::WebImageLayer::create):
+ (WebKit::WebImageLayer::WebImageLayer):
+ (WebKit::WebImageLayer::setBitmap):
+
+2012-06-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] GraphicsLayerChromium should use WebContentLayer directly
+ https://bugs.webkit.org/show_bug.cgi?id=89145
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayerImpl::paintContents):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::CCOcclusionTrackerTestMainThreadTypes::createLayer):
+ * tests/OpaqueRectTrackingContentLayerDelegateTest.cpp:
+ (WebCore):
+ (WebCore::OpaqueRectTrackingContentLayerDelegateTest::OpaqueRectTrackingContentLayerDelegateTest):
+ (WebCore::OpaqueRectTrackingContentLayerDelegateTest::canvasRect):
+ (WebCore::TEST_F):
+ * tests/WebLayerTest.cpp:
+
+2012-06-18 Ilya Sherman <isherman@chromium.org>
+
+ [Chromium] Ensure layout has happened before calling into hasNonEmptyBoundingBox()
+ Also update existing code to use updateLayoutIgnorePendingStylesheets()
+ https://bugs.webkit.org/show_bug.cgi?id=89258
+
+ Reviewed by James Robinson.
+
+ * src/WebNode.cpp:
+ (WebKit::WebNode::isFocusable): Use updateLayoutIgnorePendingStylesheets()
+ (WebKit::WebNode::hasNonEmptyBoundingBox): Force layout before checking the bounding box
+
+2012-06-18 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Ensure that skipping frames during an accelerated animation doesn't cause starvation
+ https://bugs.webkit.org/show_bug.cgi?id=87766
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestCheckerboardDoesNotStarveDraws):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::beginTest):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::afterTest):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::animateLayers):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestCheckerboardDoesNotStarveDraws::prepareToDrawOnCCThread):
+ (WTF::TEST_F):
+ * tests/CCSchedulerStateMachineTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCThreadedTest.cpp:
+ (WebKitTests::MockLayerTreeHostImpl::prepareToDraw):
+ * tests/CCThreadedTest.h:
+ (WebKitTests::TestHooks::prepareToDrawOnCCThread):
+
+2012-06-18 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Change back "linuxish" to "linux" and include WebFontRendering.cpp on Android
+ https://bugs.webkit.org/show_bug.cgi?id=89228
+
+ Reviewed by Tony Chang.
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h:
+ (WebKit):
+ (WebFontRendering):
+ * public/linuxish/WebFontRendering.h: Removed.
+ * src/linux/WebFontRendering.cpp: Renamed from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::setLCDOrder):
+ (WebKit::WebFontRendering::setLCDOrientation):
+
+2012-06-18 Hironori Bono <hbono@chromium.org>
+
+ [chromium] Spellchecker should show suggestions only when right-clicking a misspelled word.
+ https://bugs.webkit.org/show_bug.cgi?id=89331
+
+ Reviewed by Hajime Morita.
+
+ When a selection includes two or more misspelled words, it is not so easy to
+ select one word from them and to show its suggestions. To avoid this problem,
+ this change shows suggestions only when the selection is collapsed. For this
+ case, we can use Range::setStart and setEnd to convert a DocumentMarker to a
+ Range.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Added a check that the selection is collapsed.
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::replaceMisspelledRange): Added a check that the selection is collapsed. Also, use Range::setStart() and Range::setEnd() to get the marker range to emulate the behavior of DocumentMarker::markersInRange().
+
+2012-06-14 Kinuko Yasuda <kinuko@chromium.org>
+
+ [chromium] Cleanup: remove PlatformSupport::createAsyncFileSystem as it's no longer used
+ https://bugs.webkit.org/show_bug.cgi?id=89083
+
+ Reviewed by Kentaro Hara.
+
+ * src/PlatformSupport.cpp:
+
+2012-06-15 Kinuko Yasuda <kinuko@chromium.org>
+
+ XHR_RESPONSE_BLOB is not enabled on some platforms
+ https://bugs.webkit.org/show_bug.cgi?id=88859
+
+ Reviewed by Adam Barth.
+
+ Removing XHR_RESPONSE_BLOB since the current implementation has
+ no platform-specific part.
+
+ * src/PlatformSupport.cpp:
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enableXHRResponseBlob):
+ (WebKit::WebRuntimeFeatures::isXHRResponseBlobEnabled):
+
+2012-06-17 MORITA Hajime <morrita@google.com>
+
+ Unreviewed build fix.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-17 Zeev Lieber <zlieber@chromium.org>
+
+ [Chromium] Compositor should avoid drawing quads when cached textures are available and contents unchanged
+ https://bugs.webkit.org/show_bug.cgi?id=88482
+
+ Reviewed by Adrienne Walker.
+
+ Added tests to verify quad removal algorithm. Added infrastructure
+ code to generate custom render passes out of a script encoded as C
+ string.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-16 Robert Kroeger <rjkroege@chromium.org>
+
+ [chromium] Make the deviceScaleFactor dynamically adjustable.
+ https://bugs.webkit.org/show_bug.cgi?id=88916
+
+ Reviewed by James Robinson.
+
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::Settings::operator CCSettings): Removed unused
+ static deviceScaleFactor.
+ (WebKit::WebLayerTreeView::setDeviceScaleFactor):
+ (WebKit):
+ (WebKit::WebLayerTreeView::deviceScaleFactor):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setDeviceScaleFactor): Push the dynamic deviceScaleFactor
+ to the compositor as required.
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/CCLayerTreeHostTest.cpp: Tests use dynamic setDeviceScaleFactor.
+ (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers):
+ (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::beginTest):
+ (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread):
+
+2012-06-16 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120536.
+ http://trac.webkit.org/changeset/120536
+ https://bugs.webkit.org/show_bug.cgi?id=89296
+
+ Does not compile on chromium-linux (Requested by abarth on
+ #webkit).
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h:
+ * public/linuxish/WebFontRendering.h: Renamed from Source/WebKit/chromium/public/WebFontRendering.h.
+ (WebKit):
+ (WebFontRendering):
+ * src/linuxish/WebFontRendering.cpp: Renamed from Source/WebKit/chromium/src/WebFontRendering.cpp.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::setLCDOrder):
+ (WebKit::WebFontRendering::setLCDOrientation):
+
+2012-06-16 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120539.
+ http://trac.webkit.org/changeset/120539
+ https://bugs.webkit.org/show_bug.cgi?id=89295
+
+ Does not compile on chromium-mac (Requested by abarth on
+ #webkit).
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-16 Zeev Lieber <zlieber@chromium.org>
+
+ [Chromium] Compositor should avoid drawing quads when cached textures are available and contents unchanged
+ https://bugs.webkit.org/show_bug.cgi?id=88482
+
+ Reviewed by Adrienne Walker.
+
+ Added tests to verify quad removal algorithm. Added infrastructure
+ code to generate custom render passes out of a script
+ encoded as C string.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-16 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
+ https://bugs.webkit.org/show_bug.cgi?id=89228
+
+ Reverse dependency originally from WebCore::FontPlatformDataHarfBuzz to WebKit::WebFontRendering
+ so that WebKit::WebFontRendering can be platform-independent.
+
+ This also avoids the ambiguous name 'linuxish'.
+
+ Reviewed by Tony Chang.
+
+ * WebKit.gyp:
+ * public/WebFontRendering.h: Copied from Source/WebKit/chromium/public/linuxish/WebFontRendering.h. Added getters under WEBKIT_IMPLEMENTATION.
+ (WebFontRendering):
+ * public/linux/WebFontRendering.h:
+ * public/linuxish: Removed.
+ * public/linuxish/WebFontRendering.h: Removed.
+ * src/WebFontRendering.cpp: Copied from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp. Changed setters to be independent of platform-dependent implementation and added getters.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::hinting):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::autoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::useBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::antiAlias):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::subpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::subpixelPositioning):
+ * src/linuxish: Removed.
+ * src/linuxish/WebFontRendering.cpp: Removed.
+
+2012-06-16 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-16 Dan Alcantara <dfalcantara@chromium.org>
+
+ [chromium] WebFrameClient::userAgentOverride() should take in a WebFrame* as its first argument
+ https://bugs.webkit.org/show_bug.cgi?id=89233
+
+ Reviewed by Darin Fisher.
+
+ Adds a WebFrame* to the WebFrameClient::userAgentOverride() function.
+
+ * public/WebFrameClient.h:
+ (WebKit::WebFrameClient::userAgentOverride):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::userAgent):
+ * tests/FrameLoaderClientImplTest.cpp:
+
+2012-06-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120511.
+ http://trac.webkit.org/changeset/120511
+ https://bugs.webkit.org/show_bug.cgi?id=89255
+
+ Breaks at least Android builder (Requested by wangxianzhu on
+ #webkit).
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h:
+ * public/linuxish/WebFontRendering.h: Renamed from Source/WebKit/chromium/public/WebFontRendering.h.
+ (WebKit):
+ (WebFontRendering):
+ * src/linuxish/WebFontRendering.cpp: Renamed from Source/WebKit/chromium/src/WebFontRendering.cpp.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::setLCDOrder):
+ (WebKit::WebFontRendering::setLCDOrientation):
+
+2012-06-15 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
+ https://bugs.webkit.org/show_bug.cgi?id=89228
+
+ Reverse dependency originally from WebCore::FontPlatformDataHarfBuzz to WebKit::WebFontRendering
+ so that WebKit::WebFontRendering can be platform-independent.
+
+ This also avoids the ambiguous name 'linuxish'.
+
+ Reviewed by Tony Chang.
+
+ * WebKit.gyp:
+ * public/WebFontRendering.h: Copied from Source/WebKit/chromium/public/linuxish/WebFontRendering.h. Added getters under WEBKIT_IMPLEMENTATION.
+ (WebFontRendering):
+ * public/linux/WebFontRendering.h:
+ * public/linuxish: Removed.
+ * public/linuxish/WebFontRendering.h: Removed.
+ * src/WebFontRendering.cpp: Copied from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp. Changed setters to be independent of platform-dependent implementation and added getters.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::hinting):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::autoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::useBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::antiAlias):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::subpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::subpixelPositioning):
+ * src/linuxish: Removed.
+ * src/linuxish/WebFontRendering.cpp: Removed.
+
+2012-06-15 Tony Chang <tony@chromium.org>
+
+ [chromium] Remove WebKit/chromium/public/gtk/WebFontInfo.h since it's no longer referenced.
+ https://bugs.webkit.org/show_bug.cgi?id=89251
+
+ Reviewed by Adam Barth.
+
+ This was a forwarding header when we moved the file to public/linux.
+
+ * public/gtk/WebFontInfo.h: Removed.
+
+2012-06-15 Bill Budge <bbudge@chromium.org>
+
+ AssociatedURLLoader should allow trusted clients to read all headers, not just exposed ones.
+ https://bugs.webkit.org/show_bug.cgi?id=89185
+
+ Reviewed by Adam Barth.
+
+ This change adds an option to turn off whitelist filtering of response headers for CORS loads,
+ and modifies AssociatedURLLoader check for that before filtering.
+
+ * public/WebURLLoaderOptions.h:
+ (WebKit::WebURLLoaderOptions::WebURLLoaderOptions):
+ (WebURLLoaderOptions):
+ * src/AssociatedURLLoader.cpp:
+ (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveResponse):
+ * tests/AssociatedURLLoaderTest.cpp:
+ (WebKit):
+ (WebKit::TEST_F):
+
+2012-06-15 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Allow scrolling non-root layers in the compositor thread
+ https://bugs.webkit.org/show_bug.cgi?id=73350
+
+ Reviewed by James Robinson.
+
+ New unit tests to verify layer scrolling behavior and the associated
+ utility functions.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockContentLayerDelegate::paintContents):
+ (CCLayerTreeHostTestScrollChildLayer):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::CCLayerTreeHostTestScrollChildLayer):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::beginTest):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::applyScrollAndScale):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::beginCommitOnCCThread):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::afterTest):
+ (WTF):
+ (WTF::TEST_F):
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+ (WebKit::TEST_F):
+
+2012-06-15 Hironori Bono <hbono@chromium.org>
+
+ Allow platforms to choose whether to remove markers on editing
+ https://bugs.webkit.org/show_bug.cgi?id=88838
+
+ Reviewed by Hajime Morita.
+
+ This change implements EditorClientImpl::checkGrammarOfString so
+ DumpRenderTree can run grammar tests.
+
+ * src/EditorClientImpl.cpp:
+ (WebKit::EditorClientImpl::isGrammarCheckingEnabled): Return true also when unified text-checking is enabled.
+ (WebKit::EditorClientImpl::shouldEraseMarkersAfterChangeSelection): ditto.
+ (WebKit::EditorClientImpl::checkGrammarOfString): Implement this function with our unified text-checker.
+
+2012-06-14 Kent Tamura <tkent@chromium.org>
+
+ Support file extensions in HTMLInputElement::accept
+ https://bugs.webkit.org/show_bug.cgi?id=88298
+
+ Reviewed by Hajime Morita.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::runOpenPanel):
+ Use FileChooserSettings::acceptTypes() to get both of MIME types and file extensions.
+
+2012-06-14 Kaustubh Atrawalkar <kaustubh@motorola.com>
+
+ Remove support for counterValueForElementById from chromium port
+ https://bugs.webkit.org/show_bug.cgi?id=88851
+
+ Reviewed by Adam Barth.
+
+ Moved the counterValueForElementById from LayoutTestCotroller to Internals so
+ remove the old platform specific implementations as it exclusively tests WebCore functionality.
+
+ * public/WebFrame.h:
+ (WebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+
+2012-06-14 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium-Android] Initialize font rendering in DumpRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=89133
+
+ Reviewed by Adam Barth.
+
+ * src/linuxish/WebFontRendering.cpp:
+ (WebKit::WebFontRendering::setSubpixelPositioning): Now calls WebFontInfo::setSubpixelPositioning to avoid API users from calling both and simplify platform differences at call sites.
+
+2012-06-14 Tony Chang <tony@chromium.org>
+
+ [chromium] Port IFrameRedirectTest.Test from test_shell_tests to webkit_unit_tests
+ https://bugs.webkit.org/show_bug.cgi?id=89132
+
+ Reviewed by Adam Barth.
+
+ This test is currently in src/webkit/glue/iframe_redirect_unittest.cc
+ and uses test_shell's layoutTestController. Moving this will make
+ it easier to get rid of layoutTestController in test_shell.
+
+ * tests/WebFrameTest.cpp:
+ (WebKit::TEST_F):
+ (WebKit):
+ * tests/data/iframe_redirect.html: Added.
+
+2012-06-14 David Reveman <reveman@chromium.org>
+
+ [Chromium] Sub-pixel text rendering is incorrectly used for WebView with transparent background.
+ https://bugs.webkit.org/show_bug.cgi?id=89033
+
+ Reviewed by James Robinson.
+
+ Add canvas background argument to PageWidgetDelegate::paint and call
+ PlatformCanvasSkia::setDrawingToImageBuffer to ensure that sub-pixel
+ rendering is only used when WebView has opaque background.
+
+ * src/PageWidgetDelegate.cpp:
+ (WebKit::PageWidgetDelegate::paint):
+ * src/PageWidgetDelegate.h:
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::paint):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::paint):
+
+2012-06-14 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] CCLayerTreeHostCommonTest.verifyHitTestingForSingleLayer failing in debug
+ https://bugs.webkit.org/show_bug.cgi?id=89065
+
+ Reviewed by James Robinson.
+
+ A debug assertion was being triggered in the hit-testing unit
+ tests because I accidentally forgot to set the
+ DebugScopedSetImplThread for the tests.
+
+ This patch also re-enables the disabled broken test.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-14 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Add setAutoHint() and setUseBitmaps() in WebFontRendering
+ https://bugs.webkit.org/show_bug.cgi?id=89014
+
+ Reviewed by James Robinson.
+
+ * public/linuxish/WebFontRendering.h:
+ (WebFontRendering):
+ * src/linuxish/WebFontRendering.cpp:
+ (WebKit):
+ (WebKit::WebFontRendering::setAutoHint):
+ (WebKit::WebFontRendering::setUseBitmaps):
+ (WebKit::WebFontRendering::setAntiAlias):
+
+2012-06-14 Daniel Erat <derat@chromium.org>
+
+ [chromium/linux] Drop deprecated WebFontRenderStyle::useSubpixel
+ https://bugs.webkit.org/show_bug.cgi?id=88263
+
+ Reviewed by Adam Barth.
+
+ This removes the useSubpixel member, which was replaced by
+ useSubpixelRendering. Chrome has been updated to set only the
+ useSubpixelRendering field.
+
+ No test updates since the existing behavior shouldn't change.
+
+ * public/linux/WebFontInfo.h:
+ (WebFontInfo):
+ * public/linux/WebFontRenderStyle.h:
+ * src/linux/WebFontInfo.cpp:
+ (WebKit::WebFontInfo::renderStyleForStrike):
+ * src/linux/WebFontRenderStyle.cpp:
+ (WebKit::WebFontRenderStyle::toFontRenderStyle):
+ (WebKit::WebFontRenderStyle::setDefaults):
+
+2012-06-14 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] For hit testing in CCLayerTreeHostCommon, need to check that the transform is invertible before inverting it.
+ https://bugs.webkit.org/show_bug.cgi?id=89049
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-14 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Certain settings in CCSettings could be global
+ https://bugs.webkit.org/show_bug.cgi?id=88384
+
+ Reviewed by James Robinson.
+
+ * WebKit.gypi:
+ * public/WebCompositor.h:
+ (WebCompositor):
+ * public/WebSettings.h:
+ * src/WebCompositorImpl.cpp:
+ (WebKit::WebCompositor::shutdown):
+ (WebKit):
+ (WebKit::WebCompositor::setPerTilePaintingEnabled):
+ (WebKit::WebCompositor::setPartialSwapEnabled):
+ (WebKit::WebCompositor::setAcceleratedAnimationEnabled):
+ * src/WebLayerTreeView.cpp:
+ (WebKit):
+ (WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings):
+ * src/WebSettingsImpl.cpp:
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestShortlived1):
+ (WTF::CCLayerTreeHostTestShortlived1::CCLayerTreeHostTestShortlived1):
+ (WTF::CCLayerTreeHostTestShortlived1::beginTest):
+ (WTF::CCLayerTreeHostTestShortlived1::afterTest):
+ * tests/CCTestCommon.h: Added.
+ (WebKitTests):
+ (CCScopedSettings):
+ (WebKitTests::CCScopedSettings::CCScopedSettings):
+ (WebKitTests::CCScopedSettings::~CCScopedSettings):
+ * tests/CCThreadedTest.cpp:
+ (WebKitTests::MockLayerTreeHostImpl::create):
+ (WebKitTests::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::CCThreadedTest::runTest):
+ * tests/CCThreadedTest.h:
+ (CCThreadedTest):
+ (MockLayerTreeHostImpl):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+ * tests/LayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (LayerRendererChromiumTest):
+ (TEST_F):
+ (TEST):
+ * tests/TextureLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-06-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move opaque rectangle tracking logic out of compositor core
+ https://bugs.webkit.org/show_bug.cgi?id=89031
+
+ Reviewed by Adrienne Walker.
+
+ Moves the grayscale/subpixel AA text decision into NonCompositedContentHost and removes one layer of indirection
+ betwen NCCH and WVI that existed only for historical reasons.
+
+ Ports the opaque rect tracking tests that were in LayerTextureUpdaterTest to
+ OpaquerectTrackingContentLayerDelegateTest to reflect the move in responsibilities.
+
+ * WebKit.gypi:
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setOpaque):
+ (WebKit::NonCompositedContentHost::paintContents):
+ * src/NonCompositedContentHost.h:
+ (WebCore):
+ (WebKit):
+ (WebKit::NonCompositedContentHost::create):
+ (NonCompositedContentHost):
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayerImpl::paintContents):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::paintRootLayer):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestOpacityChangeLayerDelegate::paintContents):
+ (WTF::MockContentLayerDelegate::paintContents):
+ * tests/LayerChromiumTest.cpp:
+ * tests/LayerTextureUpdaterTest.cpp: Removed.
+ * tests/OpaqueRectTrackingContentLayerDelegateTest.cpp: Added.
+ (WebCore):
+ (PaintCallback):
+ (TestLayerPainterChromium):
+ (WebCore::TestLayerPainterChromium::TestLayerPainterChromium):
+ (WebCore::PaintFillAlpha::operator()):
+ (WebCore::PaintFillPartialOpaque::PaintFillPartialOpaque):
+ (PaintFillPartialOpaque):
+ (WebCore::PaintFillPartialOpaque::operator()):
+ (OpaqueRectTrackingContentLayerDelegateTest):
+ (WebCore::OpaqueRectTrackingContentLayerDelegateTest::OpaqueRectTrackingContentLayerDelegateTest):
+ (WebCore::OpaqueRectTrackingContentLayerDelegateTest::skCanvas):
+ (WebCore::OpaqueRectTrackingContentLayerDelegateTest::canvasRect):
+ (WebCore::TEST_F):
+
+2012-06-14 Justin Novosad <junov@chromium.org>
+
+ [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw
+ https://bugs.webkit.org/show_bug.cgi?id=89018
+
+ Reviewed by Stephen White.
+
+ Rolling chromium DEPS to 141884
+
+ * DEPS:
+
+2012-06-14 Alexander Pavlov <apavlov@chromium.org>
+
+ [Chromium] Unreviewed, build fix for Mac 10.5
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidth):
+
+2012-06-14 Eugene Klyuchnikov <eustas.bug@gmail.com>
+
+ Web Inspector: Refactor message loop instrumentation.
+ https://bugs.webkit.org/show_bug.cgi?id=88978
+
+ Reviewed by Pavel Feldman.
+
+ 1) Remove "messageLoop" term
+ 2) Reuse WebThread::TaskObserver interface
+ 3) Move implementation (from embedder) to platform code.
+
+ * public/WebDevToolsAgent.h:
+ (WebDevToolsAgent):
+ * public/WebDevToolsAgentClient.h:
+ (WebDevToolsAgentClient):
+ (WebKit::WebDevToolsAgentClient::startMainThreadMonitoring): Renamed medthod.
+ (WebKit::WebDevToolsAgentClient::stopMainThreadMonitoring): Ditto.
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::startMainThreadMonitoring): Ditto.
+ (WebKit::InspectorClientImpl::stopMainThreadMonitoring): Ditto.
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::startMainThreadMonitoring): Use platform threading.
+ (WebKit::WebDevToolsAgentImpl::stopMainThreadMonitoring): Ditto.
+ (WebKit::WebDevToolsAgentImpl::willProcessTask): Renamed medthod.
+ (WebKit::WebDevToolsAgentImpl::didProcessTask): Ditto.
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+ * src/WebKit.cpp:
+
+2012-06-14 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [Device Metrics] "Fit window" results in duplicate rescaling in WebDevToolsAgentImpl::autoZoomPageToFitWidth()
+ https://bugs.webkit.org/show_bug.cgi?id=89092
+
+ Reviewed by Pavel Feldman.
+
+ Do not apply the sizeRatio after it has been applied in scaledEmulatedFrameSize().
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidth):
+ (WebKit::DeviceMetricsSupport::ensureOriginalZoomFactor):
+
+2012-06-14 Yoshifumi Inoue <yosin@chromium.org>
+
+ [Chromium][Forms] We should remove ENABLE_INPUT_TYPE_TIME=0 and so on to allows us to override them by ~/.gyp/include.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=89062
+
+ Reviewed by Kent Tamura.
+
+ This patch removes ENABLE_INPUT_TYPE_*=0 from default entry of feature_defines to
+ allows us overriding by ~/.gyp/include.gypi
+
+ * features.gypi: Remove ENABLE_INPUT_TYPE_DATETIME=0, ENABLE_INPUT_TYPE_DATETIMELOCAL=0,
+ and so on.
+
+2012-06-14 Min Qin <qinmin@google.com>
+
+ Remove the const keyword from MediaPlayerPrivate::enterFullscreen()
+ https://bugs.webkit.org/show_bug.cgi?id=89044
+
+ Reviewed by Adam Barth.
+
+ enterFullscreen() should be treated similarly as exitFullscreen() as it could alter the player state.
+ This reverts the change from r120213.
+
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::enterFullscreen):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-06-14 Dan Alcantara <dfalcantara@chromium.org>
+
+ [chromium] Rename WebFrameClient::userAgent() to better reflect what it does
+ https://bugs.webkit.org/show_bug.cgi?id=89028
+
+ Reviewed by Adam Barth.
+
+ Renames WebFrameClient::userAgent() to userAgentOverride() and makes it return
+ the user agent override string directly.
+
+ * public/WebFrameClient.h:
+ (WebFrameClient):
+ (WebKit::WebFrameClient::userAgentOverride):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::userAgent):
+ * tests/FrameLoaderClientImplTest.cpp:
+
+2012-06-13 Jesse Greenwald <jgreenwald@google.com>
+
+ [Chromium] Add WebDocument.images
+ https://bugs.webkit.org/show_bug.cgi?id=88837
+
+ Reviewed by Adam Barth.
+
+ This method is needed on Android to support the existing
+ WebView.documentHasImages Java API.
+
+ * public/WebDocument.h:
+ (WebDocument):
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::images):
+ (WebKit):
+
+2012-06-13 Dominic Cooney <dominicc@chromium.org>
+
+ Unreviewed: Disable verifyHitTestingForSingleLayer.
+ https://bugs.webkit.org/show_bug.cgi?id=89065
+
+ It is failing on canary debug bots.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120268.
+ http://trac.webkit.org/changeset/120268
+ https://bugs.webkit.org/show_bug.cgi?id=89060
+
+ WebCompositor::setPerTilePaintingEnabled hits an assertion in
+ DEBUG (Requested by dominicc|work on #webkit).
+
+ * WebKit.gypi:
+ * public/WebCompositor.h:
+ (WebCompositor):
+ * public/WebSettings.h:
+ * src/WebCompositorImpl.cpp:
+ (WebKit::WebCompositor::shutdown):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::Settings::operator CCSettings):
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setPerTilePaintingEnabled):
+ (WebKit):
+ (WebKit::WebSettingsImpl::setPartialSwapEnabled):
+ (WebKit::WebSettingsImpl::setThreadedAnimationEnabled):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ * tests/CCTestCommon.h: Removed.
+ * tests/CCThreadedTest.cpp:
+ (WebKitTests::MockLayerTreeHostImpl::create):
+ (WebKitTests::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::CCThreadedTest::runTest):
+ * tests/CCThreadedTest.h:
+ (CCThreadedTest):
+ (MockLayerTreeHostImpl):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+ * tests/LayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (LayerRendererChromiumTest):
+ (TEST_F):
+ (TEST):
+ * tests/TextureLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-06-13 Hironori Bono <hbono@chromium.org>
+
+ [chromium] Add WebFrame::replaceMisspelledRange
+ https://bugs.webkit.org/show_bug.cgi?id=88618
+
+ Reviewed by Kent Tamura.
+
+ This change adds WebFrame::replaceMisspelledRange, which replaces the range of a
+ misspelled marker with text so Chromium can use it for replacing misspelled
+ words with suggetions.
+
+ * public/WebFrame.h:
+ (WebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::replaceMisspelledRange):
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+
+2012-06-13 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Let Android and Linux share WebFontRendering decl/impl.
+ https://bugs.webkit.org/show_bug.cgi?id=88802
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h: Temporarily forwards to the new file under linuxish.
+ * public/linuxish: Added.
+ * public/linuxish/WebFontRendering.h: Copied from chromium/public/linux/WebFontRendering.h.
+ * src/linux/WebFontRendering.cpp: Removed.
+ * src/linuxish: Added.
+ * src/linuxish/WebFontRendering.cpp: Copied from chromium/src/linux/WebFontRendering.cpp.
+
+2012-06-13 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Certain settings in CCSettings could be global
+ https://bugs.webkit.org/show_bug.cgi?id=88384
+
+ Reviewed by James Robinson.
+
+ * WebKit.gypi:
+ * public/WebCompositor.h:
+ (WebCompositor):
+ * public/WebSettings.h:
+ * src/WebCompositorImpl.cpp:
+ (WebKit::WebCompositor::shutdown):
+ (WebKit):
+ (WebKit::WebCompositor::setPerTilePaintingEnabled):
+ (WebKit::WebCompositor::setPartialSwapEnabled):
+ (WebKit::WebCompositor::setAcceleratedAnimationEnabled):
+ * src/WebLayerTreeView.cpp:
+ (WebKit):
+ (WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings):
+ * src/WebSettingsImpl.cpp:
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestShortlived1):
+ (WTF::CCLayerTreeHostTestShortlived1::CCLayerTreeHostTestShortlived1):
+ (WTF::CCLayerTreeHostTestShortlived1::beginTest):
+ (WTF::CCLayerTreeHostTestShortlived1::afterTest):
+ * tests/CCTestCommon.h: Added.
+ (WebKitTests):
+ (CCScopedSettings):
+ (WebKitTests::CCScopedSettings::CCScopedSettings):
+ (WebKitTests::CCScopedSettings::~CCScopedSettings):
+ * tests/CCThreadedTest.cpp:
+ (WebKitTests::MockLayerTreeHostImpl::create):
+ (WebKitTests::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::CCThreadedTest::runTest):
+ * tests/CCThreadedTest.h:
+ (CCThreadedTest):
+ (MockLayerTreeHostImpl):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (WebKitTests::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+ * tests/LayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (LayerRendererChromiumTest):
+ (TEST_F):
+ (TEST):
+ * tests/TextureLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-06-13 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Assert if iterating an invalid RenderSurfaceLayerList, where a layer in the list has no RenderSurface
+ https://bugs.webkit.org/show_bug.cgi?id=89004
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerIteratorTest.cpp:
+
+2012-06-13 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Implement hit-testing for impl-side input handling in accelerated compositor
+ https://bugs.webkit.org/show_bug.cgi?id=88972
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-13 David Reveman <reveman@chromium.org>
+
+ [Chromium] Crash when WebViewImpl::setIsTransparent is called before the WebLayerTreeView has been initialized.
+ https://bugs.webkit.org/show_bug.cgi?id=89013
+
+ Reviewed by James Robinson.
+
+ Add !m_layerTreeView.isNull() check to WebViewImpl::setIsTransparent.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsTransparent):
+
+2012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120220.
+ http://trac.webkit.org/changeset/120220
+ https://bugs.webkit.org/show_bug.cgi?id=89021
+
+ The patch broke build Chromium Win Release (Requested by
+ wangxianzhu on #webkit).
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h:
+ (WebKit):
+ (WebFontRendering):
+ * public/linuxish/WebFontRendering.h: Removed.
+ * src/linux/WebFontRendering.cpp: Renamed from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp.
+ (WebKit):
+ (WebKit::WebFontRendering::setHinting):
+ (WebKit::WebFontRendering::setAntiAlias):
+ (WebKit::WebFontRendering::setSubpixelGlyphs):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+ (WebKit::WebFontRendering::setLCDOrder):
+ (WebKit::WebFontRendering::setLCDOrientation):
+
+2012-06-13 Xianzhu Wang <wangxianzhu@chromium.org>
+
+ [Chromium] Let Android and Linux share WebFontRendering decl/impl.
+ https://bugs.webkit.org/show_bug.cgi?id=88802
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/linux/WebFontRendering.h: Temporarily forwards to the new file under linuxish.
+ * public/linuxish: Added.
+ * public/linuxish/WebFontRendering.h: Copied from chromium/public/linux/WebFontRendering.h.
+ * src/linux/WebFontRendering.cpp: Removed.
+ * src/linuxish: Added.
+ * src/linuxish/WebFontRendering.cpp: Copied from chromium/src/linux/WebFontRendering.cpp.
+
+2012-06-13 Martin Kosiba <mkosiba@google.com>
+
+ [Chromium] WebFrameImpl::find doesn't work for searching from a selection.
+ https://bugs.webkit.org/show_bug.cgi?id=88885
+
+ Reviewed by Adam Barth.
+
+ Remember the active match not just until the seatchText changes but for the entire find session.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::find):
+ (WebKit::WebFrameImpl::setFindEndstateFocusAndSelection):
+
+2012-06-13 Peter Beverloo <peter@chromium.org>
+
+ [Chromium] Fix Clang build with USE(NATIVE_FULLSCREEN_VIDEO)=1
+ https://bugs.webkit.org/show_bug.cgi?id=88987
+
+ Reviewed by Simon Hausmann.
+
+ The enterFullscreen method is declared as const by MediaPlayerPrivateInterface,
+ so this one should be declared as such as well.
+
+ Patch by Evgeniy Stepanov <eugenis@google.com>
+
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::enterFullscreen):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-06-13 MORITA Hajime <morrita@google.com>
+
+ REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
+ https://bugs.webkit.org/show_bug.cgi?id=88148
+
+ Reviewed by Dimitri Glazkov.
+
+ - Added ContextFeaturesClientImpl which implements WebCore::ContextFeaturesClient.
+ - Replaced PagePopupFrameLoaderClient with PagePopupFeaturesClient.
+
+ * WebKit.gyp:
+ * public/WebPermissionClient.h:
+ (WebKit):
+ (WebKit::WebPermissionClient::allowWebComponents):
+ * src/ContextFeaturesClientImpl.cpp: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp.
+ (WebKit):
+ (WebKit::ContextFeaturesClientImpl::isEnabled):
+ * src/ContextFeaturesClientImpl.h: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.h.
+ (WebKit):
+ (ContextFeaturesClientImpl):
+ (WebKit::ContextFeaturesClientImpl::ContextFeaturesClientImpl):
+ (WebKit::ContextFeaturesClientImpl::setPermissionClient):
+ * src/FrameLoaderClientImpl.cpp:
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+ * src/WebPagePopupImpl.cpp:
+ (PagePopupFeaturesClient):
+ (WebKit::PagePopupFeaturesClient::isEnabled):
+ (WebKit):
+ (WebKit::WebPagePopupImpl::initPage):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setPermissionClient):
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-06-12 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Roll chromium rev in DEPS
+ https://bugs.webkit.org/show_bug.cgi?id=88934
+
+ Reviewed by James Robinson.
+
+ Rolling to 141410
+
+ * DEPS:
+
+2012-06-12 James Robinson <jamesr@chromium.org>
+
+ [chromium] Port Canvas2DLayerBridge over to WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=88597
+
+ Reviewed by Adrienne Walker.
+
+ Implementations for new WebExternalTextureLayer APIs, updates test.
+
+ * src/WebExternalTextureLayer.cpp:
+ (WebKit::WebExternalTextureLayer::willModifyTexture):
+ (WebKit):
+ (WebKit::WebExternalTextureLayer::setRateLimitContext):
+ * tests/Canvas2DLayerBridgeTest.cpp:
+ (Canvas2DLayerBridgeTest::fullLifecycleTest):
+
+2012-06-12 Adrienne Walker <enne@google.com>
+
+ [chromium] Paint scrollbars on WebKit thread and composite those textures
+ https://bugs.webkit.org/show_bug.cgi?id=88145
+
+ Reviewed by James Robinson.
+
+ Remove scrollbarLayerLostContext test that no longer makes sense. The
+ compositor won't draw at all after a lost context if it has no
+ contents.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-12 Joshua Bell <jsbell@chromium.org>
+
+ IndexedDB: ObjectStore/Index shouldn't hold reference to backing store
+ https://bugs.webkit.org/show_bug.cgi?id=83074
+
+ Reviewed by Tony Chang.
+
+ * WebKit.gypi:
+ * tests/IDBDatabaseBackendTest.cpp: Added.
+ (WebCore):
+ (WebCore::TEST):
+
+2012-06-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Set contentBounds() on impl layers in CCLayerTreeHostCommonTests
+ https://bugs.webkit.org/show_bug.cgi?id=88903
+
+ Reviewed by Adrienne Walker.
+
+ Without setting the contentBounds() on impl layers, the visibleLayerRect
+ will be wrong. This is not the case for main-thread layers, which most
+ of the tests in this file use. But this is a potential serious confusion
+ for future test implementors so I'd like to make it explicit now.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Return empty visibleLayerRect for layers with empty content bounds
+ https://bugs.webkit.org/show_bug.cgi?id=88901
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-12 Mark Mentovai <mark@chromium.org>
+
+ [chromium mac] Don't #include things in subframeworks of
+ ApplicationServices.framework.
+
+ #including the umbrella <ApplicatonServices/ApplicationServices.h>
+ exposed an ambiguous name, FontMetrics, that needs to be fully
+ qualified as WebCore::FontMetrics.
+
+ https://bugs.webkit.org/show_bug.cgi?id=88569
+
+ Reviewed by Stephen White.
+
+ * src/WebFontImpl.cpp:
+ (WebKit::WebFontImpl::estimateTextBounds):
+
+2012-06-12 James Robinson <jamesr@chromium.org>
+
+ [chromium] REGRESSION(119769): Canvas2DLayerBridge may go away before its TextureLayerChromium
+ https://bugs.webkit.org/show_bug.cgi?id=88910
+
+ Reviewed by Adrienne Walker.
+
+ New unit test to verify that we can still update a TextureLayerChromium after the bridge owning it has gone
+ away.
+
+ * tests/Canvas2DLayerBridgeTest.cpp:
+
+2012-06-12 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix incorrect LayerChromium scroll position for RTL overflow pages
+ https://bugs.webkit.org/show_bug.cgi?id=88887
+
+ Reviewed by James Robinson.
+
+ The scroll position on layers needs to take into account the scroll
+ origin, since RTL pages start scrolled all the way to the right.
+ Otherwise, when scrolling left the scroll position incorrectly will go
+ negative, causing havok in scrollbar theme code that just assumes that
+ it's always scrolled all the way to the left.
+
+ Also, now that the scroll origin is passed into NCCH, handle
+ scrollOrigin.y() for layer adjusting. This is always zero in practice,
+ but it seemed awkward to just drop it and that assumption could always
+ change in the future.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::setViewport):
+ (WebKit::NonCompositedContentHost::paintContents):
+ * src/NonCompositedContentHost.h:
+ (NonCompositedContentHost):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::updateLayerTreeViewport):
+
+2012-06-12 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Make damage tracking more robust to early exits
+ https://bugs.webkit.org/show_bug.cgi?id=84803
+
+ Reviewed by James Robinson.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::clearDamageForAllSurfaces):
+ (WebKitTests::TEST_F):
+
+2012-06-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r120051.
+ http://trac.webkit.org/changeset/120051
+ https://bugs.webkit.org/show_bug.cgi?id=88852
+
+ some tests are crashing (Requested by morrita on #webkit).
+
+ * WebKit.gyp:
+ * public/WebPermissionClient.h:
+ (WebKit::WebPermissionClient::allowWebComponents):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::allowShadowDOM):
+ (WebKit):
+ (WebKit::FrameLoaderClientImpl::allowStyleScoped):
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::initPage):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setPermissionClient):
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-06-12 MORITA Hajime <morrita@google.com>
+
+ REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
+ https://bugs.webkit.org/show_bug.cgi?id=88148
+
+ Reviewed by Dimitri Glazkov.
+
+ - Added ContextFeaturesClientImpl which implements WebCore::ContextFeaturesClient.
+ - Replaced PagePopupFrameLoaderClient with PagePopupFeaturesClient.
+
+ * WebKit.gyp:
+ * public/WebPermissionClient.h:
+ (WebKit):
+ (WebKit::WebPermissionClient::allowWebComponents):
+ * src/ContextFeaturesClientImpl.cpp: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp.
+ (WebKit):
+ (WebKit::ContextFeaturesClientImpl::isEnabled):
+ * src/ContextFeaturesClientImpl.h: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.h.
+ (WebKit):
+ (ContextFeaturesClientImpl):
+ (WebKit::ContextFeaturesClientImpl::ContextFeaturesClientImpl):
+ (WebKit::ContextFeaturesClientImpl::setPermissionClient):
+ * src/FrameLoaderClientImpl.cpp:
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+ * src/WebPagePopupImpl.cpp:
+ (PagePopupFeaturesClient):
+ (WebKit::PagePopupFeaturesClient::isEnabled):
+ (WebKit):
+ (WebKit::WebPagePopupImpl::initPage):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setPermissionClient):
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-06-11 Nico Weber <thakis@chromium.org>
+
+ Remove unused member variables found by clang's -Wunused-private-field
+ https://bugs.webkit.org/show_bug.cgi?id=88812
+
+ Reviewed by Anders Carlsson.
+
+ * src/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+ * src/AudioDestinationChromium.h:
+ (AudioDestinationChromium):
+ * src/InspectorFrontendClientImpl.cpp:
+ (WebKit::InspectorFrontendClientImpl::InspectorFrontendClientImpl):
+ * src/InspectorFrontendClientImpl.h:
+ (InspectorFrontendClientImpl):
+ * src/WebFrameImpl.cpp:
+ (ChromePluginPrintContext):
+ * src/WebInputEvent.cpp:
+ * src/WorkerAsyncFileSystemChromium.cpp:
+ (WebCore::WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge):
+ * src/WorkerAsyncFileWriterChromium.cpp:
+ (WebCore::WorkerAsyncFileWriterChromium::WorkerAsyncFileWriterChromium):
+ * src/WorkerAsyncFileWriterChromium.h:
+ (WorkerAsyncFileWriterChromium):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestSetVisible::CCLayerTreeHostTestSetVisible):
+ (CCLayerTreeHostTestSetVisible):
+
+2012-06-11 Vincent Scheib <scheib@chromium.org>
+
+ Consolidate Pointer Lock runtime enabled flags to just one.
+ https://bugs.webkit.org/show_bug.cgi?id=88810
+
+ Reviewed by Dimitri Glazkov.
+
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enablePointerLock):
+ (WebKit::WebRuntimeFeatures::isPointerLockEnabled):
+
+2012-06-11 Alexis Menard <alexis.menard@openbossa.org>
+
+ [CSS3 Backgrounds and Borders] Protect box-decoration-break behind a feature flag.
+ https://bugs.webkit.org/show_bug.cgi?id=88804
+
+ Reviewed by Tony Chang.
+
+ Protect box-decoration-break behind a feature flag enabled by default.
+
+ * features.gypi:
+
+2012-05-11 James Robinson <jamesr@chromium.org>
+
+ [chromium] Port DrawingBufferChromium from TextureLayerChromium over to WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=86273
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebExternalTextureLayer.cpp:
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebKit):
+ (WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayer::clearClient):
+ (WebKit::WebExternalTextureLayer::setOpaque):
+ (WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
+
+2012-06-11 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Separate CCVideoDrawQuad and from the layer tree and video provider by removing ManagedTexture and WebVideoFrame pointers from the quad
+ https://bugs.webkit.org/show_bug.cgi?id=88363
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCTiledLayerTestCommon.h:
+ (WebKitTests::FakeTextureCopier::copyToTexture):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+
+2012-06-11 Joshua Bell <jsbell@chromium.org>
+
+ IndexedDB: Object stores are not successfully deleted
+ https://bugs.webkit.org/show_bug.cgi?id=88788
+
+ Reviewed by Tony Chang.
+
+ * tests/IDBLevelDBCodingTest.cpp:
+ (IDBLevelDBCoding::TEST):
+
+2012-06-11 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Implement position:fixed in compositor thread
+ https://bugs.webkit.org/show_bug.cgi?id=70103
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-06-11 Sam Weinig <sam@webkit.org>
+
+ Remove support for disconnected/excluded from search frames, they are not used by Safari anymore
+ https://bugs.webkit.org/show_bug.cgi?id=88723
+
+ Reviewed by Dan Bernstein.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::scopeStringMatches):
+
+2012-06-11 Varun Jain <varunjain@chromium.org>
+
+ [chromium] WebInputEvent::isGestureEventType should return true for GestureTwoFingerTap
+ https://bugs.webkit.org/show_bug.cgi?id=88789
+
+ Reviewed by Adam Barth.
+
+ * public/WebInputEvent.h:
+ (WebKit::WebInputEvent::isGestureEventType):
+
+2012-06-11 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call shared timer functions directly
+ https://bugs.webkit.org/show_bug.cgi?id=88781
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-06-11 Amy Ousterhout <aousterh@chromium.org>
+
+ [Chromium] Removing long WebDeviceOrientation constructor
+ https://bugs.webkit.org/show_bug.cgi?id=88779
+
+ Reviewed by Adam Barth.
+
+ Removing the WebDeviceOrientation constructor with nine parameters.
+ Chromium has been changed to use the default constructor and setter
+ functions instead (see https://chromiumcodereview.appspot.com/10542025/).
+
+ * public/WebDeviceOrientation.h:
+
+2012-06-11 David Dorwin <ddorwin@chromium.org>
+
+ [chromium] Provide access to the WebPlugin created by the helper plugin widget
+ https://bugs.webkit.org/show_bug.cgi?id=88028
+
+ Reviewed by Adam Barth.
+
+ A WebPlugin is created when the document created by createHelperPlugin() is laid out.
+ Expose it so the embedder can interact with the plugin instance.
+
+ * public/WebHelperPlugin.h:
+ (WebKit):
+ (WebHelperPlugin):
+ * public/WebMediaPlayerClient.h:
+ (WebKit):
+ * public/WebPlugin.h:
+ (WebKit::WebPlugin::isPlaceholder):
+ (WebPlugin):
+ * src/WebHelperPluginImpl.cpp:
+ (WebKit::WebHelperPluginImpl::WebHelperPluginImpl):
+ (WebKit):
+ (WebKit::WebHelperPluginImpl::getPlugin):
+ (WebKit::WebHelperPluginImpl::initPage):
+ (WebKit::WebHelperPluginImpl::close):
+ * src/WebHelperPluginImpl.h:
+ (WebKit):
+ (WebHelperPluginImpl):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::createHelperPlugin):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPagePopupImpl.cpp:
+
+2012-06-05 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Free texture from CCIOSurfaceLayerImpl when it is destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=88371
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-11 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Should call frameDetached() in WebPagePopupImpl::close()
+ https://bugs.webkit.org/show_bug.cgi?id=88754
+
+ Reviewed by Adam Barth.
+
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::close): Calls FrameLoader::frameDetached().
+
+2012-06-11 Min Qin <qinmin@google.com>
+
+ Adding a flag to show fullscreen media controls in chromium
+ https://bugs.webkit.org/show_bug.cgi?id=88266
+
+ Reviewed by Adam Barth.
+
+ Adding a flag to the gyp file so that we can enable fullscreen media control
+
+ * features.gypi:
+
+2012-06-09 Eugene Klyuchnikov <eustas.bug@gmail.com>
+
+ Web Inspector: Add message loop instrumentation to public API and timeline agent
+ https://bugs.webkit.org/show_bug.cgi?id=88639
+
+ Reviewed by Vsevolod Vlasov.
+
+ Message loop instrumentation will show when the render thread is busy.
+ That way developer can discover if a render thread business causes low fps, or not.
+
+ * public/WebDevToolsAgent.h:
+ (WebDevToolsAgent):
+ * public/WebDevToolsAgentClient.h:
+ (WebDevToolsAgentClient):
+ (WebKit::WebDevToolsAgentClient::startMessageLoopMonitoring):
+ Request message loop notifications.
+ (WebKit::WebDevToolsAgentClient::stopMessageLoopMonitoring):
+ Cancel message loop notifications.
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::startMessageLoopMonitoring):
+ Request message loop notifications.
+ (WebKit):
+ (WebKit::InspectorClientImpl::stopMessageLoopMonitoring):
+ Cancel message loop notifications.
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::startMessageLoopMonitoring):
+ Request message loop notifications.
+ (WebKit):
+ (WebKit::WebDevToolsAgentImpl::stopMessageLoopMonitoring):
+ Cancel message loop notifications.
+ (WebKit::WebDevToolsAgentImpl::instrumentWillProcessTask):
+ Message loop notification.
+ (WebKit::WebDevToolsAgentImpl::instrumentDidProcessTask):
+ Ditto.
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+
+2012-06-08 David Reveman <reveman@chromium.org>
+
+ [Chromium] Compositor doesn't support translucent root layers.
+ https://bugs.webkit.org/show_bug.cgi?id=87821
+
+ Reviewed by James Robinson.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::setOpaque):
+ (WebKit):
+ * src/NonCompositedContentHost.h:
+ (NonCompositedContentHost):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setHasTransparentBackground):
+ (WebKit):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsTransparent):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (ClearCountingContext):
+ (ClearCountingContext::ClearCountingContext):
+ (ClearCountingContext::clear):
+ (ClearCountingContext::clearCount):
+ (TEST):
+
+2012-06-08 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Single thread proxy's animation timer should short circuit if the layer renderer has not been initialized
+ https://bugs.webkit.org/show_bug.cgi?id=88668
+
+ Reviewed by James Robinson.
+
+ * WebKit.gypi:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::beginTest):
+ (WTF::CCLayerTreeHostTestWriteLayersAfterVisible::commitCompleteOnCCThread):
+ (WTF):
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::CCLayerTreeHostTestLayerAddedWithAnimation):
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest):
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::didAddAnimation):
+ (CCLayerTreeHostTestLayerAddedWithAnimation):
+ * tests/CCSingleThreadProxyTest.cpp: Added.
+ (FakeWebGraphicsContext3DMakeCurrentFails):
+ (FakeWebGraphicsContext3DMakeCurrentFails::makeContextCurrent):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation::CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation::beginTest):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation::animateLayers):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation::didRecreateContext):
+ (CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation::afterTest):
+ (TEST_F):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::beginTest):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::animateLayers):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::didRecreateContext):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::didAddAnimation):
+ (CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer::afterTest):
+ * tests/CCThreadedTest.cpp: Added.
+ (WebKitTests):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::create):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::numTextures):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::texture):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetTextures):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::numUsedTextures):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::usedTexture):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::resetUsedTextures):
+ (WebKitTests::CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphicsContext3DWithTextureTracking):
+ (WebKitTests::TestHooks::createContext):
+ (WebKitTests::MockLayerTreeHostImpl::create):
+ (WebKitTests::MockLayerTreeHostImpl::beginCommit):
+ (WebKitTests::MockLayerTreeHostImpl::commitComplete):
+ (WebKitTests::MockLayerTreeHostImpl::prepareToDraw):
+ (WebKitTests::MockLayerTreeHostImpl::drawLayers):
+ (WebKitTests::MockLayerTreeHostImpl::animateLayers):
+ (WebKitTests::MockLayerTreeHostImpl::lowFrequencyAnimationInterval):
+ (WebKitTests::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
+ (MockLayerTreeHost):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (MockLayerTreeHostClient):
+ (WebKitTests::MockLayerTreeHostClient::create):
+ (WebKitTests::MockLayerTreeHostClient::MockLayerTreeHostClient):
+ (TimeoutTask):
+ (WebKitTests::TimeoutTask::TimeoutTask):
+ (WebKitTests::TimeoutTask::clearTest):
+ (WebKitTests::TimeoutTask::~TimeoutTask):
+ (WebKitTests::TimeoutTask::run):
+ (BeginTask):
+ (WebKitTests::BeginTask::BeginTask):
+ (WebKitTests::BeginTask::~BeginTask):
+ (WebKitTests::BeginTask::run):
+ (EndTestTask):
+ (WebKitTests::EndTestTask::EndTestTask):
+ (WebKitTests::EndTestTask::~EndTestTask):
+ (WebKitTests::EndTestTask::clearTest):
+ (WebKitTests::EndTestTask::run):
+ (WebKitTests::CCThreadedTest::CCThreadedTest):
+ (WebKitTests::CCThreadedTest::endTest):
+ (WebKitTests::CCThreadedTest::endTestAfterDelay):
+ (WebKitTests::CCThreadedTest::postSetNeedsAnimateToMainThread):
+ (WebKitTests::CCThreadedTest::postAddAnimationToMainThread):
+ (WebKitTests::CCThreadedTest::postAddInstantAnimationToMainThread):
+ (WebKitTests::CCThreadedTest::postSetNeedsCommitToMainThread):
+ (WebKitTests::CCThreadedTest::postAcquireLayerTextures):
+ (WebKitTests::CCThreadedTest::postSetNeedsRedrawToMainThread):
+ (WebKitTests::CCThreadedTest::postSetNeedsAnimateAndCommitToMainThread):
+ (WebKitTests::CCThreadedTest::postSetVisibleToMainThread):
+ (WebKitTests::CCThreadedTest::postDidAddAnimationToMainThread):
+ (WebKitTests::CCThreadedTest::doBeginTest):
+ (WebKitTests::CCThreadedTest::timeout):
+ (WebKitTests::CCThreadedTest::scheduleComposite):
+ (WebKitTests::CCThreadedTest::onEndTest):
+ (WebKitTests::CCThreadedTest::dispatchSetNeedsAnimate):
+ (WebKitTests::CCThreadedTest::dispatchAddInstantAnimation):
+ (WebKitTests::CCThreadedTest::dispatchAddAnimation):
+ (WebKitTests::CCThreadedTest::dispatchSetNeedsAnimateAndCommit):
+ (WebKitTests::CCThreadedTest::dispatchSetNeedsCommit):
+ (WebKitTests::CCThreadedTest::dispatchAcquireLayerTextures):
+ (WebKitTests::CCThreadedTest::dispatchSetNeedsRedraw):
+ (WebKitTests::CCThreadedTest::dispatchSetVisible):
+ (WebKitTests::CCThreadedTest::dispatchSetInvisible):
+ (WebKitTests::CCThreadedTest::dispatchComposite):
+ (WebKitTests::CCThreadedTest::dispatchDidAddAnimation):
+ (WebKitTests::CCThreadedTest::runTest):
+ * tests/CCThreadedTest.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebKitTests):
+ (TestHooks):
+ (WebKitTests::TestHooks::beginCommitOnCCThread):
+ (WebKitTests::TestHooks::commitCompleteOnCCThread):
+ (WebKitTests::TestHooks::prepareToDrawOnCCThread):
+ (WebKitTests::TestHooks::drawLayersOnCCThread):
+ (WebKitTests::TestHooks::animateLayers):
+ (WebKitTests::TestHooks::willAnimateLayers):
+ (WebKitTests::TestHooks::applyScrollAndScale):
+ (WebKitTests::TestHooks::updateAnimations):
+ (WebKitTests::TestHooks::layout):
+ (WebKitTests::TestHooks::didRecreateContext):
+ (WebKitTests::TestHooks::didAddAnimation):
+ (WebKitTests::TestHooks::didCommit):
+ (WebKitTests::TestHooks::didCommitAndDrawFrame):
+ (WebKitTests::TestHooks::scheduleComposite):
+ (WebKitTests::TestHooks::notifyAnimationStarted):
+ (WebKitTests::TestHooks::notifyAnimationFinished):
+ (CCThreadedTest):
+ (WebKitTests::CCThreadedTest::clearTimeout):
+ (WebKitTests::CCThreadedTest::clearEndTestTask):
+ (WebKitTests::CCThreadedTest::layerTreeHost):
+ (CCThreadedTestThreadOnly):
+ (WebKitTests::CCThreadedTestThreadOnly::runTestThreaded):
+ (MockLayerTreeHostImpl):
+ (CompositorFakeWebGraphicsContext3DWithTextureTracking):
+
+2012-06-08 David Grogan <dgrogan@chromium.org>
+
+ IndexedDB: rename some instances of open to registerFrontendCallbacks
+ https://bugs.webkit.org/show_bug.cgi?id=88611
+
+ Reviewed by Tony Chang.
+
+ * src/IDBDatabaseBackendProxy.cpp:
+ (WebKit::IDBDatabaseBackendProxy::registerFrontendCallbacks):
+ * src/IDBDatabaseBackendProxy.h:
+ (IDBDatabaseBackendProxy):
+ * src/WebIDBDatabaseImpl.cpp:
+ (WebKit::WebIDBDatabaseImpl::open):
+ * src/WebIDBDatabaseImpl.h:
+ (WebIDBDatabaseImpl):
+
+2012-06-08 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Skip willDraw() and didDraw() on fully occluded layers
+ https://bugs.webkit.org/show_bug.cgi?id=88435
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-08 James Robinson <jamesr@chromium.org>
+
+ [chromium] Clean up some unnecessary LayerChromium.h includes
+ https://bugs.webkit.org/show_bug.cgi?id=88599
+
+ Reviewed by Adam Barth.
+
+ Removes unused include, update comment.
+
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::paint):
+
+2012-06-08 Jochen Eisinger <jochen@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-08 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Accelerated animations should use WebTransformOperations
+ https://bugs.webkit.org/show_bug.cgi?id=87686
+
+ Reviewed by James Robinson.
+
+ CCTransformKeyframe new owns a WebTransformOperations rather than a
+ TransformOperations. LayerChromium's API has been changed so that
+ LayerChromium::addAnimation should take only a CCActiveAnimation.
+ GraphicsLayerChromium is new responsible for translating to
+ WebTransformOperations and creating CCActiveAnimations. Tests that use
+ the public API (that is, they call addAnimation with KeyframeValueList
+ and Animation arguments) have been moved to GraphicsLayerChromiumTest.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebCore::addAnimatedTransform):
+ (WebKitTests::FakeTransformTransition::getValue):
+ * tests/CCAnimationTestCommon.h:
+ * tests/CCKeyframedAnimationCurveTest.cpp:
+ * tests/CCLayerAnimationControllerTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (MockLayerTreeHostClient):
+ (WebKitTests):
+ (MockLayerTreeHost):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::expectTranslateX):
+ (WebKitTests::TEST_F):
+ * tests/LayerChromiumTest.cpp:
+
+2012-06-08 Robert Kroeger <rjkroege@chromium.org>
+
+ More than 8 fingers get ignored by touch
+ https://bugs.webkit.org/show_bug.cgi?id=88359
+
+ Reviewed by James Robinson.
+
+ * public/WebInputEvent.h: Increase of TouchPoints per TouchEvent from 8 to 12.
+
+2012-06-08 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-08 Taiju Tsuiki <tzik@chromium.org>
+
+ Add FileSystem item to storage tree.
+ https://bugs.webkit.org/show_bug.cgi?id=72691
+
+ Reviewed by Vsevolod Vlasov.
+
+ * src/js/DevTools.js:
+
+2012-06-08 Peter Beverloo <peter@chromium.org>
+
+ [Chromium] Re-enable SHARED_WORKERS for Android until a build fix has been resolved.
+ https://bugs.webkit.org/show_bug.cgi?id=88637
+
+ Unreviewed build fix.
+
+ Linking content_shell on the Chromium side fails due to an unresolved
+ call to WebSharedWorker::create(). Since this blocks WebKit rolls,
+ temporarily re-enable the feature until this has been solved.
+
+ * features.gypi:
+
+2012-06-07 Nico Weber <thakis@chromium.org>
+
+ [chromium/mac] Improve deviceDPI, rect, and availableRect computation
+ https://bugs.webkit.org/show_bug.cgi?id=88596
+
+ Reviewed by Adam Barth.
+
+ Set deviceDPI to 160 for normal displays and 320 for HiDPI displays.
+ (Why 160? That's what chromium's render_view.cc assumes as default
+ single-resolution resolution at the moment. The only other place
+ where this number gets used is fixed layout mode, which is currently
+ not enabled.)
+
+ Also fix rect and availableRect computations: They get returned in
+ user space already.
+
+ Needed for http://crbug.com/31960.
+
+ * src/mac/WebScreenInfoFactory.mm:
+ (WebKit::toUserSpace):
+ (WebKit::deviceScaleFactor):
+ (WebKit):
+ (WebKit::WebScreenInfoFactory::screenInfo):
+
+2012-06-07 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Move didStartWorkerRunLoop to Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=88562
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-06-05 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move deferral-related logic out of Canvas2DLayerChromium
+ https://bugs.webkit.org/show_bug.cgi?id=86050
+
+ Reviewed by Stephen White.
+
+ * WebKit.gypi:
+ * tests/Canvas2DLayerBridgeTest.cpp: Renamed from tests/Canvas2DLayerChromiumTest
+ (Canvas2DLayerBridgeTest):
+ (Canvas2DLayerBridgeTest::fullLifecycleTest):
+
+2012-06-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r119744.
+ http://trac.webkit.org/changeset/119744
+ https://bugs.webkit.org/show_bug.cgi?id=88584
+
+ Fails assertions in debug builds (Requested by jamesr_ on
+ #webkit).
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-07 Adam Barth <abarth@webkit.org>
+
+ Settings::defaultDeviceScaleFactor is redundant with Page::deviceScaleFactor
+ https://bugs.webkit.org/show_bug.cgi?id=88375
+
+ Reviewed by James Robinson.
+
+ * public/WebSettings.h:
+ (WebKit::WebSettings::setDefaultDeviceScaleFactor):
+ (WebSettings):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange):
+ * src/WebSettingsImpl.cpp:
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * tests/WebFrameTest.cpp:
+ (WebKit::TEST_F):
+
+2012-06-07 Peter Beverloo <peter@chromium.org>
+
+ [Chromium] features.gypi should have the correct definitions for Android
+ https://bugs.webkit.org/show_bug.cgi?id=88533
+
+ Reviewed by Adam Barth.
+
+ Make all features which are enabled on Android but disabled on other platforms,
+ or are disabled on Android while enabled on other platforms, conditional. This
+ also means that the selection of code compiled for Android will slightly change.
+
+ This change also removes the enable_viewport variable as the value of this is
+ no longer respected by WebKit - it's enabled by default for all of Chromium.
+ Furthermore, ENABLE_OVERFLOW_SCROLLING is now listed in features.gypi again.
+
+ * features.gypi:
+
+2012-06-07 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Free texture from CCIOSurfaceLayerImpl when it is destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=88371
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-07 Ami Fischman <fischman@chromium.org>
+
+ Plumb CORS attribute information from HTMLMediaElement to media players so it can be used
+ https://bugs.webkit.org/show_bug.cgi?id=88349
+
+ Reviewed by Adam Barth.
+
+ * public/WebMediaPlayer.h:
+ (WebMediaPlayer):
+ * src/AssertMatchingEnums.cpp:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::loadInternal):
+ (WebKit::WebMediaPlayerClientImpl::didPassCORSAccessCheck):
+ (WebKit):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-06-07 Daniel Erat <derat@chromium.org>
+
+ Add setting to enable subpixel-positioned text on Linux.
+ https://bugs.webkit.org/show_bug.cgi?id=88263
+
+ Reviewed by Tony Chang.
+
+ Add subpixel positioning field to WebFontRenderStyle and rename
+ subpixel rendering field. Make similar changes in
+ WebFontRendering.
+
+ Also add global WebFontInfo::setSubpixelPositioning() to turn
+ subpixel positioning on or off (there's not currently a
+ well-defined way to configure subpixel positioning via FontConfig).
+
+ * public/linux/WebFontInfo.h:
+ (WebFontInfo):
+ * public/linux/WebFontRenderStyle.h:
+ * public/linux/WebFontRendering.h:
+ (WebFontRendering):
+ * src/linux/WebFontInfo.cpp:
+ (WebKit):
+ (WebKit::WebFontInfo::setSubpixelPositioning):
+ (WebKit::WebFontInfo::renderStyleForStrike):
+ * src/linux/WebFontRenderStyle.cpp:
+ (WebKit::WebFontRenderStyle::toFontRenderStyle):
+ (WebKit::WebFontRenderStyle::setDefaults):
+ * src/linux/WebFontRendering.cpp:
+ (WebKit::WebFontRendering::setSubpixelGlyphs):
+ (WebKit):
+ (WebKit::WebFontRendering::setSubpixelRendering):
+ (WebKit::WebFontRendering::setSubpixelPositioning):
+
+2012-06-06 Dana Jansens <danakj@chromium.org>
+
+ [chromium] In each composited frame, didDraw() should only be called on layers for which willDraw() was called
+ https://bugs.webkit.org/show_bug.cgi?id=88469
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r119694.
+ http://trac.webkit.org/changeset/119694
+ https://bugs.webkit.org/show_bug.cgi?id=88529
+
+ it broke PrerenderBrowserTest.PrerenderHTML5VideoNetwork
+ (Requested by loislo on #webkit).
+
+ * public/WebMediaPlayer.h:
+ (WebMediaPlayer):
+ * src/AssertMatchingEnums.cpp:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::loadInternal):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-06-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r119689.
+ http://trac.webkit.org/changeset/119689
+ https://bugs.webkit.org/show_bug.cgi?id=88516
+
+ it broke didDrawNotCalledOnScissoredLayer webkit_unit_test
+ (Requested by loislo on #webkit).
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-07 Ami Fischman <fischman@chromium.org>
+
+ Plumb CORS attribute information from HTMLMediaElement to media players so it can be used
+ https://bugs.webkit.org/show_bug.cgi?id=88349
+
+ Reviewed by Adam Barth.
+
+ * public/WebMediaPlayer.h:
+ (WebMediaPlayer):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::loadInternal):
+
+2012-06-07 Yoshifumi Inoue <yosin@chromium.org>
+
+ [Platform] Introduce conversion from/to Deciaml to/from double and helper functions
+ https://bugs.webkit.org/show_bug.cgi?id=88480
+
+ Reviewed by Kent Tamura.
+
+ This patch added tests for Decimal::fromDouble, isInfinity, toDouble.
+
+ * tests/DecimalTest.cpp:
+ (TEST_F):
+
+2012-06-07 Ami Fischman <fischman@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-06 Dana Jansens <danakj@chromium.org>
+
+ [chromium] In each composited frame, didDraw() should only be called on layers for which willDraw() was called
+ https://bugs.webkit.org/show_bug.cgi?id=88469
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-06 Kent Tamura <tkent@chromium.org>
+
+ Unreviewed, rolling out r60044.
+ http://trac.webkit.org/changeset/60044
+
+ It made a regression, crbug.com/114922.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::invalidateContentsForSlowScroll): Do not hide popups by scrolling.
+ (WebKit::ChromeClientImpl::scroll): ditto.
+
+2012-06-06 Noel Gordon <noel.gordon@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS: Roll to chromium 140955.
+
+2012-06-06 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r119683.
+ http://trac.webkit.org/changeset/119683
+ https://bugs.webkit.org/show_bug.cgi?id=88505
+
+ it broke webkit-unit-test
+ WebLayerTreeViewThreadedTest.InstrumentationCallbacks on mac
+ (Requested by loislo on #webkit).
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHost::create):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (Canvas2DLayerChromiumTest::fullLifecycleTest):
+
+2012-06-06 Robert Kroeger <rjkroege@chromium.org>
+
+ [Chromium] Re-enable handling of smooth scrolling on Chromium Linux/Windows
+ https://bugs.webkit.org/show_bug.cgi?id=87535 by adding support for precise
+ scrolling deltas on all Chromium platforms.
+
+ Reviewed by James Robinson.
+
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Create PlatformWheelEvents
+ with m_hasPreciseScrollingDelta flag as required.
+ * tests/ScrollAnimatorNoneTest.cpp: Added new unit test condiiton for precise scrolling.
+ (TEST):
+
+2012-06-06 Michal Mocny <mmocny@google.com>
+
+ [chromium] Stop dropping texture limits when the layer tree host becomes invisible, and initialize with 0 allocation.
+ https://bugs.webkit.org/show_bug.cgi?id=87747
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHost::create):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (Canvas2DLayerChromiumTest::fullLifecycleTest):
+
+2012-06-06 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Move createMessagePortChannel to Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=85764
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * WebKit.gyp:
+ * public/WebFrame.h:
+ (WebFrame):
+ * public/WebMessagePortChannel.h:
+ * public/WebMessagePortChannelClient.h:
+ * public/WebSharedWorkerClient.h:
+ (WebSharedWorkerClient):
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
+ * src/PlatformMessagePortChannel.cpp:
+ (WebCore::PlatformMessagePortChannel::PlatformMessagePortChannel):
+ * src/PlatformMessagePortChannel.h:
+ * src/SharedWorkerRepository.cpp:
+ * src/WebSharedWorkerImpl.cpp:
+
+2012-06-06 Amy Ousterhout <aousterh@chromium.org>
+
+ [Chromium] DeviceOrientation cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=88406
+
+ Reviewed by Kent Tamura.
+
+ Made default constructor public and added a set function for each property.
+ This will allow us to remove the 8-parameter constructor.
+
+ * public/WebDeviceOrientation.h:
+ (WebKit::WebDeviceOrientation::WebDeviceOrientation):
+ (WebKit::WebDeviceOrientation::setNull):
+ (WebKit::WebDeviceOrientation::setAlpha):
+ (WebKit::WebDeviceOrientation::setBeta):
+ (WebKit::WebDeviceOrientation::setGamma):
+ (WebKit::WebDeviceOrientation::setAbsolute):
+ (WebDeviceOrientation):
+
+2012-06-06 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move implementation of WebCore::GraphicsContext3D and related from WebKit/chromium/src to WebCore/platform/chromium/support
+ https://bugs.webkit.org/show_bug.cgi?id=86257
+
+ Reviewed by Kenneth Russell.
+
+ * WebKit.gyp:
+
+2012-06-06 James Robinson <jamesr@chromium.org>
+
+ [chromium] Unreviewed build fix, add an apparently used include of OwnArrayPtr.h back to GraphicsContext3DPrivate.h
+ https://bugs.webkit.org/show_bug.cgi?id=88468
+
+ * src/GraphicsContext3DPrivate.h:
+
+2012-06-06 James Robinson <jamesr@chromium.org>
+
+ [chromium] Clean up GraphicsContext3D implementation
+ https://bugs.webkit.org/show_bug.cgi?id=88460
+
+ Reviewed by Kenneth Russell.
+
+ Chromium's implementation of the GraphicsContext3D implementation has been somewhat messy for historical
+ reasons. The actual implementation of the majority of these functions is done by delegating to the Platform API
+ WebGraphicsContext3D. A few bits of functionality - extension mapping, some compositor functionality, a readback
+ utility - are implemented by code in WebKit. Previously, all GraphicsContext3D functions delegates to a clone of
+ the interface in GraphicsContext3DPrivate which in turn delegated to WebGraphicsContext3D. This required
+ duplicating the entire GraphicsContext3D interface and made updating the interface an epic pain in the rear.
+
+ This patch provides the implementations of GraphicsContext3D functions in GraphicsContext3DChromium.cpp. Most of
+ these functions delegate directly to WebGraphicsContext3D. The ones that do not delegate to
+ GraphicsContext3DPrivate, which now has a dedicated header and cpp file. GraphicsContext3DPrivate.cpp implements
+ all GraphicsContext3DPrivate functions. I've also reordered the implementation files so that the function order
+ matches the associated header file and normalized the names of callback adapters.
+
+ Refactor only, no change in functionality. Existing tests apply.
+
+ * WebKit.gyp:
+ * src/Extensions3DChromium.cpp:
+ (WebCore::Extensions3DChromium::ensureEnabled):
+ (WebCore::Extensions3DChromium::getGraphicsResetStatusARB):
+ (WebCore::Extensions3DChromium::blitFramebuffer):
+ (WebCore::Extensions3DChromium::renderbufferStorageMultisample):
+ (WebCore::Extensions3DChromium::postSubBufferCHROMIUM):
+ (WebCore::Extensions3DChromium::mapBufferSubDataCHROMIUM):
+ (WebCore::Extensions3DChromium::unmapBufferSubDataCHROMIUM):
+ (WebCore::Extensions3DChromium::mapTexSubImage2DCHROMIUM):
+ (WebCore::Extensions3DChromium::unmapTexSubImage2DCHROMIUM):
+ (WebCore::Extensions3DChromium::setVisibilityCHROMIUM):
+ (WebCore::Extensions3DChromium::discardFramebufferEXT):
+ (WebCore::Extensions3DChromium::ensureFramebufferCHROMIUM):
+ (WebCore::Extensions3DChromium::getTranslatedShaderSourceANGLE):
+ (WebCore::Extensions3DChromium::rateLimitOffscreenContextCHROMIUM):
+ (WebCore::Extensions3DChromium::texImageIOSurface2DCHROMIUM):
+ (WebCore::Extensions3DChromium::texStorage2DEXT):
+ (WebCore::Extensions3DChromium::createQueryEXT):
+ (WebCore::Extensions3DChromium::deleteQueryEXT):
+ (WebCore::Extensions3DChromium::isQueryEXT):
+ (WebCore::Extensions3DChromium::beginQueryEXT):
+ (WebCore::Extensions3DChromium::endQueryEXT):
+ (WebCore::Extensions3DChromium::getQueryivEXT):
+ (WebCore::Extensions3DChromium::getQueryObjectuivEXT):
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ (WebCore::GraphicsContext3D::~GraphicsContext3D):
+ (WebCore::GraphicsContext3D::setContextLostCallback):
+ (WebCore::GraphicsContext3D::setErrorMessageCallback):
+ (WebCore::GraphicsContext3D::create):
+ (WebCore::GraphicsContext3D::platformGraphicsContext3D):
+ (WebCore::GraphicsContext3D::platformTexture):
+ (WebCore::GraphicsContext3D::grContext):
+ (WebCore::GraphicsContext3D::platformLayer):
+ (WebCore):
+ (WebCore::GraphicsContext3D::isGLES2Compliant):
+ (WebCore::GraphicsContext3D::isResourceSafe):
+ (WebCore::GraphicsContext3D::bindAttribLocation):
+ (WebCore::GraphicsContext3D::bufferData):
+ (WebCore::GraphicsContext3D::getActiveAttrib):
+ (WebCore::GraphicsContext3D::getActiveUniform):
+ (WebCore::GraphicsContext3D::getAttribLocation):
+ (WebCore::GraphicsContext3D::getContextAttributes):
+ (WebCore::GraphicsContext3D::getProgramInfoLog):
+ (WebCore::GraphicsContext3D::getShaderInfoLog):
+ (WebCore::GraphicsContext3D::getShaderSource):
+ (WebCore::GraphicsContext3D::getString):
+ (WebCore::GraphicsContext3D::getUniformLocation):
+ (WebCore::GraphicsContext3D::shaderSource):
+ (WebCore::GraphicsContext3D::texImage2D):
+ (WebCore::GraphicsContext3D::texSubImage2D):
+ (WebCore::GraphicsContext3D::reshape):
+ (WebCore::GraphicsContext3D::markContextChanged):
+ (WebCore::GraphicsContext3D::layerComposited):
+ (WebCore::GraphicsContext3D::markLayerComposited):
+ (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+ (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
+ (WebCore::GraphicsContext3D::paintCompositedResultsToCanvas):
+ (WebCore::GraphicsContext3D::getExtensions):
+ (WebCore::GraphicsContext3D::getInternalFramebufferSize):
+ * src/GraphicsContext3DPrivate.cpp: Added.
+ (WebCore):
+ (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::createGraphicsContextFromWebContext):
+ (WebCore::GraphicsContext3DPrivate::extractWebGraphicsContext3D):
+ (GrMemoryAllocationChangedCallback):
+ (WebCore::GrMemoryAllocationChangedCallback::GrMemoryAllocationChangedCallback):
+ (WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged):
+ (WebCore::GraphicsContext3DPrivate::grContext):
+ (WebCore::GraphicsContext3DPrivate::markContextChanged):
+ (WebCore::GraphicsContext3DPrivate::layerComposited):
+ (WebCore::GraphicsContext3DPrivate::markLayerComposited):
+ (WebCore::GraphicsContext3DPrivate::paintFramebufferToCanvas):
+ (GraphicsContextLostCallbackAdapter):
+ (WebCore::GraphicsContextLostCallbackAdapter::GraphicsContextLostCallbackAdapter):
+ (WebCore::GraphicsContextLostCallbackAdapter::~GraphicsContextLostCallbackAdapter):
+ (WebCore::GraphicsContextLostCallbackAdapter::onContextLost):
+ (WebCore::GraphicsContext3DPrivate::setContextLostCallback):
+ (GraphicsErrorMessageCallbackAdapter):
+ (WebCore::GraphicsErrorMessageCallbackAdapter::GraphicsErrorMessageCallbackAdapter):
+ (WebCore::GraphicsErrorMessageCallbackAdapter::~GraphicsErrorMessageCallbackAdapter):
+ (WebCore::GraphicsErrorMessageCallbackAdapter::onErrorMessage):
+ (WebCore::GraphicsContext3DPrivate::setErrorMessageCallback):
+ (WebCore::GraphicsContext3DPrivate::getExtensions):
+ (WebCore::GraphicsContext3DPrivate::initializeExtensions):
+ (WebCore::GraphicsContext3DPrivate::supportsExtension):
+ (WebCore::GraphicsContext3DPrivate::ensureExtensionEnabled):
+ (WebCore::GraphicsContext3DPrivate::isExtensionEnabled):
+ (WebCore::GraphicsContext3DPrivate::isResourceSafe):
+ (GraphicsContext3DSwapBuffersCompleteCallbackAdapter):
+ (WebCore::GraphicsContext3DSwapBuffersCompleteCallbackAdapter::GraphicsContext3DSwapBuffersCompleteCallbackAdapter):
+ (WebCore::GraphicsContext3DSwapBuffersCompleteCallbackAdapter::~GraphicsContext3DSwapBuffersCompleteCallbackAdapter):
+ (WebCore::GraphicsContext3DSwapBuffersCompleteCallbackAdapter::onSwapBuffersComplete):
+ (WebCore::GraphicsContext3DPrivate::setSwapBuffersCompleteCallbackCHROMIUM):
+ (GraphicsContext3DMemoryAllocationChangedCallbackAdapter):
+ (WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::GraphicsContext3DMemoryAllocationChangedCallbackAdapter):
+ (WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::~GraphicsContext3DMemoryAllocationChangedCallbackAdapter):
+ (WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::onMemoryAllocationChanged):
+ (WebCore::GraphicsContext3DPrivate::setGpuMemoryAllocationChangedCallbackCHROMIUM):
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::webContext):
+ (WebCore::GraphicsContext3DPrivate::preserveDrawingBuffer):
+
+2012-06-06 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Avoid limiting page-scale-factor when device-scale-factor is applied in the compositor.
+ https://bugs.webkit.org/show_bug.cgi?id=88417
+
+ Reviewed by James Robinson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+
+2012-06-06 Ami Fischman <fischman@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-06 Nico Weber <thakis@chromium.org>
+
+ [chromium] Expose setPictographFontFamily through the chromium webkit api.
+ https://bugs.webkit.org/show_bug.cgi?id=88393
+
+ Reviewed by Adam Barth.
+
+ This was added to WebCore in
+ https://bugs.webkit.org/show_bug.cgi?id=65197
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setPictographFontFamily):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+
+2012-06-06 Ryosuke Niwa <rniwa@webkit.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-06 Kinuko Yasuda <kinuko@chromium.org>
+
+ Roll Chromium DEPS from r140700 to r140711.
+
+ * DEPS:
+
+2012-06-06 Ami Fischman <fischman@chromium.org>
+
+ [chromium] Add a WebKit::WebMediaPlayer::CORSMode enum in preparation for 88349
+ https://bugs.webkit.org/show_bug.cgi?id=88388
+
+ Reviewed by Darin Fisher.
+
+ * public/WebMediaPlayer.h:
+
+2012-06-05 Ryosuke Niwa <rniwa@webkit.org>
+
+ Roll Chromium DEPS from r140653 to r140700.
+
+ * DEPS:
+
+2012-06-05 Kentaro Hara <haraken@chromium.org>
+
+ Unreviewed, rolling out r119494.
+ http://trac.webkit.org/changeset/119494
+ https://bugs.webkit.org/show_bug.cgi?id=87911
+
+ We found similar APIs are already implemented
+
+ * public/WebWidget.h:
+ * src/WebViewImpl.cpp:
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/WebViewTest.cpp:
+ * tests/data/textarea.html: Removed.
+
+2012-06-05 Ryosuke Niwa <rniwa@webkit.org>
+
+ Roll Chromium DEPS from r140528 to r140653.
+
+ * DEPS:
+
+2012-06-05 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Move createLocalStorageNamespace to Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=85766
+
+ Reviewed by James Robinson.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * WebKit.gyp:
+ * public/WebStorageArea.h:
+ * public/WebStorageNamespace.h:
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKitPlatformSupport):
+
+2012-06-05 Greg Billock <gbillock@google.com>
+
+ New constructor for WebIntent to be used for delivery
+ https://bugs.webkit.org/show_bug.cgi?id=87143
+
+ Reviewed by Darin Fisher.
+
+ When delivering an intent to webkit, the caller needs to be able to
+ provide the action, type, and data, and also extra data and ports.
+
+ * public/WebIntent.h:
+ (WebIntent):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::deliverIntent):
+ * src/WebIntent.cpp:
+ (WebKit::WebIntent::WebIntent):
+ (WebKit):
+ (WebKit::WebIntent::reset):
+ (WebKit::WebIntent::messagePortChannelsRelease):
+
+2012-06-05 Ryosuke Niwa <rniwa@webkit.org>
+
+ Roll Chromium DEPS from r140492 to r140528.
+
+ * DEPS:
+
+2012-06-05 Seigo Nonaka <nona@chromium.org>
+
+ [chromium] There is no way to retrieve composition character rectangle in WebKit/chromium
+ https://bugs.webkit.org/show_bug.cgi?id=87911
+
+ Reviewed by Ryosuke Niwa.
+
+ Add an API for retreieving each character bounds in composition text.
+ This API is necessary for implementing IMR_QUERYCHARPOSITION message in Windows.
+ The message is used by Japanese IME for showing their window at the correct position.
+
+ * public/WebWidget.h:
+ (WebWidget):
+ (WebKit::WebWidget::compositionCharacterBounds):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::compositionCharacterBounds):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
+2012-06-05 Dongwoo Im <dw.im@samsung.com>
+
+ Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
+ https://bugs.webkit.org/show_bug.cgi?id=73176
+
+ Reviewed by Adam Barth.
+
+ Two more APIs are added in Custom Scheme Handler specification.
+ http://dev.w3.org/html5/spec/Overview.html#custom-handlers
+ One is 'isProtocolHandlerRegistered' to query whether the specific URL
+ is registered or not.
+ The other is 'unregisterProtocolHandler' to remove the registered URL.
+
+ * features.gypi: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
+
+2012-06-05 Kent Tamura <tkent@chromium.org>
+
+ Move some function definitions in EmptyClients.h to EmptyClients.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=88285
+
+ Reviewed by Ryosuke Niwa.
+
+ * src/WebHelperPluginImpl.cpp: Remove unnecessary #includes, and add necessary #includes.
+ * src/WebPagePopupImpl.cpp: ditto.
+
+2012-06-05 Noel Gordon <noel.gordon@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-06-05 Adam Barth <abarth@webkit.org>
+
+ EventHandler shouldn't dispatch fake mousemove events when scrolling on devices that don't have a mouse
+ https://bugs.webkit.org/show_bug.cgi?id=88270
+
+ Reviewed by James Robinson.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setDeviceSupportsMouse):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+
+2012-06-04 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove redundant setNeedsCommit when prepareToDraw fails
+ https://bugs.webkit.org/show_bug.cgi?id=88246
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-06-04 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Allow CCLayerImpl to find its layer tree host, and use this for CCVideoLayerImpl instead of always-null pointer.
+ https://bugs.webkit.org/show_bug.cgi?id=88252
+
+ Reviewed by James Robinson.
+
+ * tests/ScrollbarLayerChromiumTest.cpp:
+ (WebCore::TEST):
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::expectTreesAreIdentical):
+ (WebKitTests::TEST):
+
+2012-06-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ yet another build fix attempt.
+
+ * src/WebHelperPluginImpl.cpp:
+
+2012-06-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ Another Chromium Windows build fix attempt after r119411.
+
+ * src/WebHelperPluginImpl.cpp:
+
+2012-06-04 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] CCDamageTrackerTest.verifyDamageForPerspectiveClippedLayer needs to be cleaner
+ https://bugs.webkit.org/show_bug.cgi?id=85245
+
+ Reviewed by James Robinson.
+
+ Updated CCDamageTrackerTest.verifyDamageForPerspectiveClippedLayer
+ so that the test is clearer and cleaner. The original test was
+ covering what it needed, but in a confusing and not-so-practical
+ way. This patch adds comments and performs a tighter test so that
+ the intent is a bit more clear.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-06-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ Fix attempt after r119411.
+
+ * src/WebHelperPluginImpl.cpp:
+
+2012-06-04 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Fix software rendering for larger device-scale-factor
+ https://bugs.webkit.org/show_bug.cgi?id=88136
+
+ Reviewed by Darin Fisher.
+
+ The fix is to apply the device-scale factor on the GraphicsContext.
+ (and add a WebWidgetClient::deviceScaleFactor method to facilitate that).
+
+ * public/WebWidgetClient.h:
+ (WebWidgetClient):
+ (WebKit::WebWidgetClient::deviceScaleFactor):
+ * src/PageWidgetDelegate.cpp:
+ (WebKit::PageWidgetDelegate::paint):
+ * src/WebPopupMenuImpl.cpp:
+ (WebKit::WebPopupMenuImpl::paint):
+
+2012-06-04 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ Combobox options and autofill options should not be scaled for device-scale factor.
+ https://bugs.webkit.org/show_bug.cgi?id=87921
+
+ Reviewed by Darin Fisher.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+
+2012-06-04 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Make LayerRendererChromium use RenderPasses instead of RenderSurfaces
+ https://bugs.webkit.org/show_bug.cgi?id=88132
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeCCRendererClient::FakeCCRendererClient):
+ (FakeCCRendererClient::rootRenderPass):
+ (FakeCCRendererClient):
+ (TEST_F):
+
+2012-06-04 David Dorwin <ddorwin@chromium.org>
+
+ Enable Chromium media player to instantiate a plugin
+ https://bugs.webkit.org/show_bug.cgi?id=87399
+
+ Reviewed by Kent Tamura.
+
+ Adds WebHelperPlugin, an off-screen widget that contains an <object> tag.
+
+ * WebKit.gyp:
+ * public/WebHelperPlugin.h: Copied from Source/WebKit/chromium/public/WebPopupType.h.
+ (WebKit):
+ (WebHelperPlugin):
+ (WebKit::WebHelperPlugin::~WebHelperPlugin):
+ * public/WebMediaPlayerClient.h:
+ (WebKit):
+ * public/WebPopupType.h:
+ * public/WebView.h:
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::initializeHelperPluginWebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::WebFrameImpl):
+ (WebKit::WebFrameImpl::initializeAsMainFrame):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+ * src/WebHelperPluginImpl.cpp: Added.
+ (WebKit):
+ (WebKit::addString):
+ (WebKit::writeDocument):
+ (HelperPluginChromeClient):
+ (WebKit::HelperPluginChromeClient::HelperPluginChromeClient):
+ (WebKit::WebHelperPluginImpl::WebHelperPluginImpl):
+ (WebKit::WebHelperPluginImpl::~WebHelperPluginImpl):
+ (WebKit::WebHelperPluginImpl::init):
+ (WebKit::WebHelperPluginImpl::initializeFrame):
+ (WebKit::WebHelperPluginImpl::initPage):
+ (WebKit::WebHelperPluginImpl::setCompositorSurfaceReady):
+ (WebKit::WebHelperPluginImpl::composite):
+ (WebKit::WebHelperPluginImpl::layout):
+ (WebKit::WebHelperPluginImpl::setFocus):
+ (WebKit::WebHelperPluginImpl::close):
+ (WebKit::WebHelperPluginImpl::closeHelperPlugin):
+ (WebKit::WebHelperPlugin::create):
+ * src/WebHelperPluginImpl.h: Copied from Source/WebKit/chromium/public/WebPopupType.h.
+ (WebCore):
+ (WebKit):
+ (WebHelperPluginImpl):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl):
+ (WebKit::WebMediaPlayerClientImpl::createHelperPlugin):
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::closeHelperPlugin):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebKit):
+ (WebMediaPlayerClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::initializeMainFrame):
+ (WebKit::WebViewImpl::initializeHelperPluginFrame):
+ (WebKit):
+ (WebKit::WebViewImpl::createHelperPlugin):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-06-04 Raymes Khoury <raymes@chromium.org>
+
+ Remove obsolete acceptMIMETypes member.
+ https://bugs.webkit.org/show_bug.cgi?id=88241
+
+ Reviewed by Darin Fisher.
+
+ Obsoleted by https://bugs.webkit.org/show_bug.cgi?id=87271 and http://codereview.chromium.org/10414085/.
+
+ * public/WebFileChooserParams.h:
+ (WebFileChooserParams):
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::runOpenPanel):
+
+2012-06-04 Zeev Lieber <zlieber@chromium.org>
+
+ [chromium] Cleanup scissor rect computation/use with damage
+ https://bugs.webkit.org/show_bug.cgi?id=87167
+
+ Reviewed by Adrienne Walker.
+
+ Added unit tests to CCLayerTreeHostImpl using mock graphic context
+ to verify end-to-end quad drawing.
+
+ Added more test cases to CCLayerTreeHostCommon to verify clip and
+ scissor rect computations.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::executeCalculateDrawTransformsAndVisibility):
+ * tests/CCLayerIteratorTest.cpp:
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::CCOcclusionTrackerTest::calcDrawEtc):
+ * tests/CCRenderSurfaceTest.cpp:
+
+2012-06-03 Ryosuke Niwa <rniwa@webkit.org>
+
+ Roll Chromium DEPS from r140222 to r140260.
+
+ * DEPS:
+
+2012-06-03 Ryosuke Niwa <rniwa@webkit.org>
+
+ Roll Chromium DEPS from r140000 to r140222.
+
+ * DEPS:
+
+2012-06-03 Varun Jain <varunjain@google.com>
+
+ [chromium] Add new gesture type (two finger tap) that triggers context menu.
+ https://bugs.webkit.org/show_bug.cgi?id=88173
+
+ Reviewed by Adam Barth.
+
+ * public/WebInputEvent.h:
+ * src/PageWidgetDelegate.cpp:
+ (WebKit::PageWidgetDelegate::handleInputEvent):
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+ * src/WebPopupMenuImpl.cpp:
+ (WebKit::WebPopupMenuImpl::handleInputEvent):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleGestureEvent):
+
+2012-06-03 Robert Kroeger <rjkroege@chromium.org>
+
+ [chromium] replace isScrollGestureEventType with isGestureEventType
+ https://bugs.webkit.org/show_bug.cgi?id=88097
+
+ This change replaces the unused and incorrect isScrollGestureEventType
+ method with a correct and useful isGestureEventType method.
+
+ Reviewed by Adam Barth.
+
+ * public/WebInputEvent.h:
+ (WebInputEvent):
+ (WebKit::WebInputEvent::isGestureEventType):
+
+2012-06-01 Alexandre Elias <aelias@google.com>
+
+ [chromium] Software compositor initialization and base classes
+ https://bugs.webkit.org/show_bug.cgi?id=87920
+
+ Reviewed by James Robinson.
+
+ Add a new setting to force software compositing. In this mode,
+ no GraphicsContext3D should ever be created.
+
+ * public/WebSettings.h:
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::Settings::operator CCSettings):
+ (WebKit::WebLayerTreeView::context):
+ * src/WebLayerTreeViewImpl.cpp:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ (WebKit::WebSettingsImpl::setForceSoftwareCompositing):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ (WebKit::WebSettingsImpl::forceSoftwareCompositing):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit::WebViewImpl::createCompositorGraphicsContext3D):
+ (WebKit::WebViewImpl::createContext3D):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::CCLayerTreeHostImplTest::createContext):
+ (WebKitTests::TEST_F):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
+ * tests/CCTiledLayerTestCommon.cpp:
+ (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect):
+ * tests/CCTiledLayerTestCommon.h:
+ (Texture):
+ (WebKitTests::FakeTextureCopier::copyTexture):
+ (WebKitTests::FakeTextureUploader::uploadTexture):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (Canvas2DLayerChromiumTest::fullLifecycleTest):
+ * tests/FakeCCLayerTreeHostClient.h:
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromium::FakeLayerRendererChromium):
+ (LayerRendererChromiumTest::LayerRendererChromiumTest):
+ (LayerRendererChromiumTest):
+ (TEST):
+ * tests/TextureCopierTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-06-01 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r119283, r119287, and r119291.
+ http://trac.webkit.org/changeset/119283
+ http://trac.webkit.org/changeset/119287
+ http://trac.webkit.org/changeset/119291
+ https://bugs.webkit.org/show_bug.cgi?id=88159
+
+ Not only broke compilation in the initial commit but also
+ broke LayerChromiumTest.basicCreateAndDestroy (Requested by
+ rniwa on #webkit).
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebCore::addAnimatedTransform):
+ (WebKitTests::FakeTransformTransition::getValue):
+ * tests/CCAnimationTestCommon.h:
+ * tests/CCKeyframedAnimationCurveTest.cpp:
+ * tests/CCLayerAnimationControllerTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (WebKitTests::MockGraphicsLayerClient::notifyAnimationStarted):
+ (WebKitTests::MockGraphicsLayerClient::notifySyncRequired):
+ (WebKitTests::MockGraphicsLayerClient::paintContents):
+ (WebKitTests::MockGraphicsLayerClient::showDebugBorders):
+ (WebKitTests::MockGraphicsLayerClient::showRepaintCounter):
+ (WebKitTests::TEST):
+
+2012-06-01 Ryosuke Niwa <rniwa@webkit.org>
+
+ Use fully qualified name for Fixed to avoid the collision with "typedef SInt32 Fixed" in MacTypes.h
+
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-06-01 James Robinson <jamesr@chromium.org>
+
+ [chromium] Unreviewed compile fix for r119283
+
+ For the record, Dana Jensens <danakj@chromium.org> wrote this slightly faster than I did.
+
+ * tests/CCAnimationTestCommon.h:
+
+2012-06-01 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Accelerated animations should use WebTransformOperations
+ https://bugs.webkit.org/show_bug.cgi?id=87686
+
+ Reviewed by James Robinson.
+
+ CCTransformKeyframe new owns a WebTransformOperations rather than a
+ TransformOperations. LayerChromium's API has been changed so that
+ LayerChromium::addAnimation should take only a CCActiveAnimation.
+ GraphicsLayerChromium is new responsible for translating to
+ WebTransformOperations and creating CCActiveAnimations. Tests that use
+ the public API (that is, they call addAnimation with KeyframeValueList
+ and Animation arguments) have been moved to GraphicsLayerChromiumTest.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebCore::addAnimatedTransform):
+ (WebKitTests::FakeTransformTransition::getValue):
+ * tests/CCAnimationTestCommon.h:
+ * tests/CCKeyframedAnimationCurveTest.cpp:
+ (WebCore::TEST):
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ (MockLayerTreeHostClient):
+ (WebKitTests):
+ (MockLayerTreeHost):
+ (WebKitTests::MockLayerTreeHost::create):
+ (WebKitTests::MockLayerTreeHost::createLayerTreeHostImpl):
+ (WebKitTests::MockLayerTreeHost::MockLayerTreeHost):
+ (GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::~GraphicsLayerChromiumTest):
+ (WebKitTests::GraphicsLayerChromiumTest::expectTranslateX):
+ (WebKitTests::TEST_F):
+
2012-06-01 Mark Pilgrim <pilgrim@chromium.org>
[Chromium] Call clipboard methods directly
diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS
index 31b09c2f9..78bca67d0 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': '140000'
+ 'chromium_rev': '142842'
}
deps = {
diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp
index dc155c9a6..74db258be 100644
--- a/Source/WebKit/chromium/WebKit.gyp
+++ b/Source/WebKit/chromium/WebKit.gyp
@@ -167,6 +167,7 @@
'public/WebGeolocationPermissionRequestManager.h',
'public/WebGeolocationPosition.h',
'public/WebGlyphCache.h',
+ 'public/WebHelperPlugin.h',
'public/WebHistoryItem.h',
'public/WebHitTestResult.h',
'public/WebIDBCallbacks.h',
@@ -180,6 +181,7 @@
'public/WebIDBKey.h',
'public/WebIDBKeyPath.h',
'public/WebIDBKeyRange.h',
+ 'public/WebIDBMetadata.h',
'public/WebIDBObjectStore.h',
'public/WebIDBTransaction.h',
'public/WebIDBTransactionCallbacks.h',
@@ -198,8 +200,6 @@
'public/WebMediaPlayerClient.h',
'public/WebMediaStreamRegistry.h',
'public/WebMenuItemInfo.h',
- 'public/WebMessagePortChannel.h',
- 'public/WebMessagePortChannelClient.h',
'public/WebNavigationType.h',
'public/WebNetworkStateNotifier.h',
'public/WebNode.h',
@@ -258,9 +258,7 @@
'public/WebSpeechRecognizerClient.h',
'public/WebSpeechRecognizer.h',
'public/WebSpellCheckClient.h',
- 'public/WebStorageArea.h',
'public/WebStorageEventDispatcher.h',
- 'public/WebStorageNamespace.h',
'public/WebStorageQuotaCallbacks.h',
'public/WebStorageQuotaType.h',
'public/WebSurroundingText.h',
@@ -374,6 +372,8 @@
'src/CompositionUnderlineBuilder.h',
'src/CompositionUnderlineVectorBuilder.cpp',
'src/CompositionUnderlineVectorBuilder.h',
+ 'src/ContextFeaturesClientImpl.cpp',
+ 'src/ContextFeaturesClientImpl.h',
'src/ContextMenuClientImpl.cpp',
'src/ContextMenuClientImpl.h',
'src/DatabaseObserver.cpp',
@@ -391,7 +391,6 @@
'src/EditorClientImpl.h',
'src/EventListenerWrapper.cpp',
'src/EventListenerWrapper.h',
- 'src/Extensions3DChromium.cpp',
'src/ExternalPopupMenu.cpp',
'src/ExternalPopupMenu.h',
'src/FrameLoaderClientImpl.cpp',
@@ -399,9 +398,9 @@
'src/FrameNetworkingContextImpl.h',
'src/GeolocationClientProxy.cpp',
'src/GeolocationClientProxy.h',
- 'src/GraphicsContext3DChromium.cpp',
- 'src/GraphicsContext3DPrivate.h',
'src/gtk/WebInputEventFactory.cpp',
+ 'src/WebHelperPluginImpl.cpp',
+ 'src/WebHelperPluginImpl.h',
'src/IDBCallbacksProxy.cpp',
'src/IDBCallbacksProxy.h',
'src/IDBCursorBackendProxy.cpp',
@@ -571,6 +570,7 @@
'src/WebIOSurfaceLayer.cpp',
'src/WebImageCG.cpp',
'src/WebImageDecoder.cpp',
+ 'src/WebImageLayer.cpp',
'src/WebImageSkia.cpp',
'src/WebInputElement.cpp',
'src/WebInputEvent.cpp',
@@ -800,6 +800,7 @@
['OS=="android"', {
'include_dirs': [
'public/android',
+ 'public/linux', # We need linux/WebFontRendering.h on Android.
],
}, { # else: OS!="android"
'sources/': [
@@ -850,6 +851,13 @@
},
}],
],
+ 'target_conditions': [
+ ['OS=="android"', {
+ 'sources/': [
+ ['include', '^src/linux/WebFontRendering\\.cpp$'],
+ ],
+ }],
+ ],
},
{
'target_name': 'inspector_resources',
diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi
index 1c11f2d79..549fdfa44 100644
--- a/Source/WebKit/chromium/WebKit.gypi
+++ b/Source/WebKit/chromium/WebKit.gypi
@@ -59,7 +59,7 @@
'webkit_unittest_files': [
'tests/ArenaTestHelpers.h',
'tests/AssociatedURLLoaderTest.cpp',
- 'tests/Canvas2DLayerChromiumTest.cpp',
+ 'tests/Canvas2DLayerBridgeTest.cpp',
'tests/CCActiveAnimationTest.cpp',
'tests/CCAnimationTestCommon.cpp',
'tests/CCAnimationTestCommon.h',
@@ -86,11 +86,15 @@
'tests/CCSchedulerStateMachineTest.cpp',
'tests/CCSchedulerTestCommon.h',
'tests/CCSchedulerTest.cpp',
+ 'tests/CCSingleThreadProxyTest.cpp',
'tests/CCSolidColorLayerImplTest.cpp',
+ 'tests/CCTestCommon.h',
'tests/CCTiledLayerImplTest.cpp',
'tests/CCTiledLayerTestCommon.h',
'tests/CCTiledLayerTestCommon.cpp',
'tests/CCThreadTaskTest.cpp',
+ 'tests/CCThreadedTest.cpp',
+ 'tests/CCThreadedTest.h',
'tests/CCTimerTest.cpp',
'tests/ClipboardChromiumTest.cpp',
'tests/CompositorFakeGraphicsContext3D.h',
@@ -110,6 +114,7 @@
'tests/GraphicsLayerChromiumTest.cpp',
'tests/IDBAbortOnCorruptTest.cpp',
'tests/IDBBindingUtilitiesTest.cpp',
+ 'tests/IDBDatabaseBackendTest.cpp',
'tests/IDBFakeBackingStore.h',
'tests/IDBKeyPathTest.cpp',
'tests/IDBLevelDBCodingTest.cpp',
@@ -118,12 +123,12 @@
'tests/KURLTest.cpp',
'tests/LayerChromiumTest.cpp',
'tests/LayerRendererChromiumTest.cpp',
- 'tests/LayerTextureUpdaterTest.cpp',
'tests/LevelDBTest.cpp',
'tests/LinkHighlightTest.cpp',
'tests/ListenerLeakTest.cpp',
'tests/LocalizedNumberICUTest.cpp',
'tests/MockCCQuadCuller.h',
+ 'tests/OpaqueRectTrackingContentLayerDelegateTest.cpp',
'tests/PaintAggregatorTest.cpp',
'tests/PlatformGestureCurveTest.cpp',
'tests/PlatformContextSkiaTest.cpp',
diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi
index f773cc4bc..a4290a8b3 100644
--- a/Source/WebKit/chromium/features.gypi
+++ b/Source/WebKit/chromium/features.gypi
@@ -37,7 +37,9 @@
'ENABLE_BLOB=1',
'ENABLE_BLOB_SLICE=1',
'ENABLE_CHANNEL_MESSAGING=1',
+ 'ENABLE_CSP_NEXT=0',
'ENABLE_CSS3_FLEXBOX=1',
+ 'ENABLE_CSS_BOX_DECORATION_BREAK=1',
'ENABLE_CSS_EXCLUSIONS=1',
'ENABLE_CSS_FILTERS=1',
'ENABLE_CSS_IMAGE_SET=1',
@@ -45,6 +47,7 @@
'ENABLE_CSS_REGIONS=1',
'ENABLE_CSS_SHADERS=1',
'ENABLE_CSS_VARIABLES=0',
+ 'ENABLE_CUSTOM_SCHEME_HANDLER=0',
'ENABLE_DATALIST=1',
'ENABLE_DASHBOARD_SUPPORT=0',
'ENABLE_DATA_TRANSFER_ITEMS=1',
@@ -62,29 +65,18 @@
'ENABLE_ICONDATABASE=0',
'ENABLE_IFRAME_SEAMLESS=1',
'ENABLE_INDEXED_DATABASE=1',
- 'ENABLE_INPUT_SPEECH=1',
'ENABLE_INPUT_TYPE_DATE=1',
- 'ENABLE_INPUT_TYPE_DATETIME=0',
- 'ENABLE_INPUT_TYPE_DATETIMELOCAL=0',
- 'ENABLE_INPUT_TYPE_MONTH=0',
- 'ENABLE_INPUT_TYPE_TIME=0',
- 'ENABLE_INPUT_TYPE_WEEK=0',
'ENABLE_JAVASCRIPT_DEBUGGER=1',
- 'ENABLE_JAVASCRIPT_I18N_API=1',
'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0',
- 'ENABLE_LEGACY_NOTIFICATIONS=1',
'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1',
'ENABLE_LINK_PREFETCH=1',
'ENABLE_LINK_PRERENDER=1',
'ENABLE_MEDIA_SOURCE=1',
'ENABLE_MEDIA_STATISTICS=1',
- 'ENABLE_MEDIA_STREAM=1',
'ENABLE_METER_TAG=1',
'ENABLE_MHTML=1',
'ENABLE_MICRODATA=0',
'ENABLE_MUTATION_OBSERVERS=<(enable_mutation_observers)',
- 'ENABLE_NOTIFICATIONS=1',
- 'ENABLE_ORIENTATION_EVENTS=0',
'ENABLE_PAGE_VISIBILITY_API=1',
'ENABLE_POINTER_LOCK=1',
'ENABLE_PROGRESS_TAG=1',
@@ -95,7 +87,6 @@
'ENABLE_SANDBOX=1',
'ENABLE_SCRIPTED_SPEECH=1',
'ENABLE_SHADOW_DOM=1',
- 'ENABLE_SHARED_WORKERS=1',
'ENABLE_SMOOTH_SCROLLING=1',
'ENABLE_SQL_DATABASE=1',
'ENABLE_STYLE_SCOPED=1',
@@ -132,7 +123,6 @@
'use_accelerated_compositing%': 1,
'enable_skia_text%': 1,
'enable_svg%': 1,
- 'enable_viewport%': 0,
'enable_touch_events%': 1,
'enable_touch_icon_loading%' : 0,
'enable_mutation_observers%': 1,
@@ -146,17 +136,43 @@
'feature_defines': [
'ENABLE_CALENDAR_PICKER=0',
'ENABLE_FONT_BOOSTING=1',
+ 'ENABLE_FULLSCREEN_MEDIA_CONTROLS=1',
+ 'ENABLE_INPUT_SPEECH=0',
+ 'ENABLE_INPUT_TYPE_DATETIME=1',
+ 'ENABLE_INPUT_TYPE_DATETIMELOCAL=1',
+ 'ENABLE_INPUT_TYPE_MONTH=1',
+ 'ENABLE_INPUT_TYPE_TIME=1',
+ 'ENABLE_INPUT_TYPE_WEEK=1',
+ 'ENABLE_JAVASCRIPT_I18N_API=0',
+ 'ENABLE_LEGACY_NOTIFICATIONS=0',
'ENABLE_MEDIA_CAPTURE=1',
+ 'ENABLE_MEDIA_STREAM=0',
+ 'ENABLE_NOTIFICATIONS=0',
+ 'ENABLE_ORIENTATION_EVENTS=1',
+ 'ENABLE_OVERFLOW_SCROLLING=1',
'ENABLE_PAGE_POPUP=0',
+ # FIXME: Disable once the linking error has been resolved.
+ # https://bugs.webkit.org/show_bug.cgi?id=88636
+ 'ENABLE_SHARED_WORKERS=1',
'ENABLE_WEB_AUDIO=0',
'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1',
],
+ 'enable_touch_icon_loading': 1,
}, {
'feature_defines': [
'ENABLE_CALENDAR_PICKER=1',
'ENABLE_FONT_BOOSTING=0',
+ 'ENABLE_FULLSCREEN_MEDIA_CONTROLS=1',
+ 'ENABLE_INPUT_SPEECH=1',
+ 'ENABLE_JAVASCRIPT_I18N_API=1',
+ 'ENABLE_LEGACY_NOTIFICATIONS=1',
'ENABLE_MEDIA_CAPTURE=0',
+ 'ENABLE_MEDIA_STREAM=1',
+ 'ENABLE_NOTIFICATIONS=1',
+ 'ENABLE_ORIENTATION_EVENTS=0',
+ 'ENABLE_OVERFLOW_SCROLLING=0',
'ENABLE_PAGE_POPUP=1',
+ 'ENABLE_SHARED_WORKERS=1',
'ENABLE_WEB_AUDIO=1',
],
}],
diff --git a/Source/WebKit/chromium/public/WebCompositor.h b/Source/WebKit/chromium/public/WebCompositor.h
index 3eadef32c..6e0da2b22 100644
--- a/Source/WebKit/chromium/public/WebCompositor.h
+++ b/Source/WebKit/chromium/public/WebCompositor.h
@@ -26,6 +26,8 @@
#ifndef WebCompositor_h
#define WebCompositor_h
+#define WEBCOMPOSITOR_OWNS_SETTINGS 1
+
#include "platform/WebCommon.h"
namespace WebKit {
@@ -49,6 +51,11 @@ public:
// after shutdown.
WEBKIT_EXPORT static void shutdown();
+ // These may only be called before initialize.
+ WEBKIT_EXPORT static void setPerTilePaintingEnabled(bool);
+ WEBKIT_EXPORT static void setPartialSwapEnabled(bool);
+ WEBKIT_EXPORT static void setAcceleratedAnimationEnabled(bool);
+
protected:
virtual ~WebCompositor() { }
};
diff --git a/Source/WebKit/chromium/public/WebDeviceOrientation.h b/Source/WebKit/chromium/public/WebDeviceOrientation.h
index 282dc7157..b26649e1c 100644
--- a/Source/WebKit/chromium/public/WebDeviceOrientation.h
+++ b/Source/WebKit/chromium/public/WebDeviceOrientation.h
@@ -35,51 +35,63 @@ namespace WebKit {
class WebDeviceOrientation {
public:
- WebDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute = false, bool absolute = false)
- : m_isNull(false),
- m_canProvideAlpha(canProvideAlpha),
- m_alpha(alpha),
- m_canProvideBeta(canProvideBeta),
- m_beta(beta),
- m_canProvideGamma(canProvideGamma),
- m_gamma(gamma),
- m_canProvideAbsolute(canProvideAbsolute),
- m_absolute(absolute)
+ WebDeviceOrientation()
+ : m_isNull(true)
+ , m_canProvideAlpha(false)
+ , m_alpha(0)
+ , m_canProvideBeta(false)
+ , m_beta(0)
+ , m_canProvideGamma(false)
+ , m_gamma(0)
+ , m_canProvideAbsolute(false)
+ , m_absolute(false)
{
}
static WebDeviceOrientation nullOrientation() { return WebDeviceOrientation(); }
- bool isNull() { return m_isNull; }
- bool canProvideAlpha() { return m_canProvideAlpha; }
- double alpha() { return m_alpha; }
- bool canProvideBeta() { return m_canProvideBeta; }
- double beta() { return m_beta; }
- bool canProvideGamma() { return m_canProvideGamma; }
- double gamma() { return m_gamma; }
- bool canProvideAbsolute() {return m_canProvideAbsolute; }
- bool absolute() { return m_absolute; }
+ void setNull(bool isNull) { m_isNull = isNull; }
+ bool isNull() const { return m_isNull; }
+
+ void setAlpha(double alpha)
+ {
+ m_canProvideAlpha = true;
+ m_alpha = alpha;
+ }
+ bool canProvideAlpha() const { return m_canProvideAlpha; }
+ double alpha() const { return m_alpha; }
+
+ void setBeta(double beta)
+ {
+ m_canProvideBeta = true;
+ m_beta = beta;
+ }
+ bool canProvideBeta() const { return m_canProvideBeta; }
+ double beta() const { return m_beta; }
+
+ void setGamma(double gamma)
+ {
+ m_canProvideGamma = true;
+ m_gamma = gamma;
+ }
+ bool canProvideGamma() const { return m_canProvideGamma; }
+ double gamma() const { return m_gamma; }
+
+ void setAbsolute(bool absolute)
+ {
+ m_canProvideAbsolute = true;
+ m_absolute = absolute;
+ }
+ bool canProvideAbsolute() const {return m_canProvideAbsolute; }
+ bool absolute() const { return m_absolute; }
#if WEBKIT_IMPLEMENTATION
- WebDeviceOrientation(const WTF::PassRefPtr<WebCore::DeviceOrientation>&);
- WebDeviceOrientation& operator=(const WTF::PassRefPtr<WebCore::DeviceOrientation>&);
+ WebDeviceOrientation(const WebCore::DeviceOrientation*);
+ WebDeviceOrientation& operator=(const WebCore::DeviceOrientation*);
operator WTF::PassRefPtr<WebCore::DeviceOrientation>() const;
#endif
private:
- WebDeviceOrientation()
- : m_isNull(true),
- m_canProvideAlpha(false),
- m_alpha(0),
- m_canProvideBeta(false),
- m_beta(0),
- m_canProvideGamma(false),
- m_gamma(0),
- m_canProvideAbsolute(false),
- m_absolute(false)
- {
- }
-
bool m_isNull;
bool m_canProvideAlpha;
double m_alpha;
diff --git a/Source/WebKit/chromium/public/WebDeviceOrientationClient.h b/Source/WebKit/chromium/public/WebDeviceOrientationClient.h
index 4df866559..38eef4478 100644
--- a/Source/WebKit/chromium/public/WebDeviceOrientationClient.h
+++ b/Source/WebKit/chromium/public/WebDeviceOrientationClient.h
@@ -26,6 +26,9 @@
#ifndef WebDeviceOrientationClient_h
#define WebDeviceOrientationClient_h
+#include "WebDeviceOrientation.h"
+#include "platform/WebCommon.h"
+
namespace WebKit {
class WebDeviceOrientation;
@@ -35,11 +38,15 @@ class WebDeviceOrientationClient {
public:
virtual ~WebDeviceOrientationClient() {}
- virtual void setController(WebDeviceOrientationController*) = 0;
- virtual void startUpdating() = 0;
- virtual void stopUpdating() = 0;
+ virtual void setController(WebDeviceOrientationController*) { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void startUpdating() { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void stopUpdating() { WEBKIT_ASSERT_NOT_REACHED(); }
- virtual WebDeviceOrientation lastOrientation() const = 0;
+ virtual WebDeviceOrientation lastOrientation() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return WebDeviceOrientation::nullOrientation();
+ }
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h b/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h
index f029bcc6d..8079cfccb 100644
--- a/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h
+++ b/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h
@@ -39,10 +39,10 @@ public:
WEBKIT_EXPORT static WebDeviceOrientationClientMock* create();
~WebDeviceOrientationClientMock() { reset(); }
- virtual void setController(WebDeviceOrientationController*);
- virtual void startUpdating();
- virtual void stopUpdating();
- virtual WebDeviceOrientation lastOrientation() const;
+ virtual void setController(WebDeviceOrientationController*) OVERRIDE;
+ virtual void startUpdating() OVERRIDE;
+ virtual void stopUpdating() OVERRIDE;
+ virtual WebDeviceOrientation lastOrientation() const OVERRIDE;
WEBKIT_EXPORT void setOrientation(WebDeviceOrientation&);
diff --git a/Source/WebKit/chromium/public/WebDocument.h b/Source/WebKit/chromium/public/WebDocument.h
index 6c0df31bc..f2296b7ee 100644
--- a/Source/WebKit/chromium/public/WebDocument.h
+++ b/Source/WebKit/chromium/public/WebDocument.h
@@ -95,6 +95,7 @@ public:
WEBKIT_EXPORT WebString title() const;
WEBKIT_EXPORT WebNodeCollection all();
WEBKIT_EXPORT void forms(WebVector<WebFormElement>&) const;
+ WEBKIT_EXPORT void images(WebVector<WebElement>&);
WEBKIT_EXPORT WebURL completeURL(const WebString&) const;
WEBKIT_EXPORT WebElement getElementById(const WebString&) const;
WEBKIT_EXPORT WebNode focusedNode() const;
diff --git a/Source/WebKit/chromium/public/WebFileChooserParams.h b/Source/WebKit/chromium/public/WebFileChooserParams.h
index 90dee7036..f15e2242d 100644
--- a/Source/WebKit/chromium/public/WebFileChooserParams.h
+++ b/Source/WebKit/chromium/public/WebFileChooserParams.h
@@ -57,7 +57,6 @@ struct WebFileChooserParams {
// This list comes from an 'accept' attribute value of an INPUT element, and
// it contains only lower-cased MIME type strings and file extensions.
WebVector<WebString> acceptTypes;
- WebVector<WebString> acceptMIMETypes; // FIXME: Remove this once https://chromiumcodereview.appspot.com/10414085 lands.
// |selectedFiles| has filenames which a file upload control already selected.
// A WebViewClient implementation may ask a user to select
// - removing a file from the selected files,
diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h
index 6f76ef9e8..5cd7f5f1e 100644
--- a/Source/WebKit/chromium/public/WebFrame.h
+++ b/Source/WebKit/chromium/public/WebFrame.h
@@ -32,6 +32,7 @@
#define WebFrame_h
#include "WebIconURL.h"
+#include "WebMessagePortChannel.h"
#include "WebNode.h"
#include "WebURLLoaderOptions.h"
#include "platform/WebCanvas.h"
@@ -162,7 +163,7 @@ public:
// The minimum and maxium scroll positions in pixels.
virtual WebSize minimumScrollOffset() const = 0;
virtual WebSize maximumScrollOffset() const = 0;
-
+
// The size of the contents area.
virtual WebSize contentsSize() const = 0;
@@ -433,6 +434,7 @@ public:
virtual void enableContinuousSpellChecking(bool) = 0;
virtual bool isContinuousSpellCheckingEnabled() const = 0;
virtual void requestTextChecking(const WebElement&) = 0;
+ virtual void replaceMisspelledRange(const WebString&) = 0;
// Selection -----------------------------------------------------------
@@ -591,7 +593,9 @@ public:
// Web Intents ---------------------------------------------------------
// Called on a target service page to deliver an intent to the window.
- virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*) = 0;
+ // The ports are any transferred ports that accompany the intent as a result
+ // of MessagePort transfer.
+ virtual void deliverIntent(const WebIntent&, WebMessagePortChannelArray* ports, WebDeliveredIntentClient*) = 0;
// Utility -------------------------------------------------------------
@@ -614,10 +618,6 @@ public:
// to support layout tests.
virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const = 0;
- // Returns the counter value for the specified element. This method is
- // used to support layout tests.
- virtual WebString counterValueForElementById(const WebString& id) const = 0;
-
// Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h.
virtual WebString markerTextForListItem(const WebElement&) const = 0;
@@ -637,7 +637,7 @@ public:
// empty ((0,0), (0,0)).
virtual WebRect selectionBoundsRect() const = 0;
- // Only for testing purpose:
+ // Only for testing purpose:
// Returns true if selection.anchorNode has a marker on range from |from| with |length|.
virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0;
diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h
index 662c7c1c5..62b5f0de8 100644
--- a/Source/WebKit/chromium/public/WebFrameClient.h
+++ b/Source/WebKit/chromium/public/WebFrameClient.h
@@ -398,9 +398,9 @@ public:
WebDOMMessageEvent) { return false; }
// Asks the embedder if a specific user agent should be used for the given
- // URL. Returns true if it should, along with the user agent. If false,
+ // URL. Non-empty strings indicate an override should be used. Otherwise,
// WebKitPlatformSupport::userAgent() will be called to provide one.
- virtual bool userAgent(const WebURL& url, WebString* userAgent) { return false; }
+ virtual WebString userAgentOverride(WebFrame*, const WebURL& url) { return WebString(); }
protected:
~WebFrameClient() { }
diff --git a/Source/WebKit/chromium/public/WebHelperPlugin.h b/Source/WebKit/chromium/public/WebHelperPlugin.h
new file mode 100644
index 000000000..3ce1a5ba8
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebHelperPlugin.h
@@ -0,0 +1,60 @@
+/*
+ * 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 WebHelperPlugin_h
+#define WebHelperPlugin_h
+
+#include "WebWidget.h"
+#include "platform/WebCommon.h"
+
+namespace WebKit {
+
+class WebFrameClient;
+class WebPlugin;
+class WebWidgetClient;
+
+class WebHelperPlugin : public WebWidget {
+public:
+ WEBKIT_EXPORT static WebHelperPlugin* create(WebWidgetClient*);
+
+ virtual void initializeFrame(WebFrameClient*) = 0;
+
+ // The returned pointer may be 0 even if initialization was successful.
+ // For example, if the plugin cannot be found or the plugin is disabled.
+ // If not 0, the returned pointer is valid for the lifetime of this object.
+ virtual WebPlugin* getPlugin() = 0;
+
+protected:
+ ~WebHelperPlugin() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebIDBDatabase.h b/Source/WebKit/chromium/public/WebIDBDatabase.h
index b39853416..a001c2e92 100644
--- a/Source/WebKit/chromium/public/WebIDBDatabase.h
+++ b/Source/WebKit/chromium/public/WebIDBDatabase.h
@@ -28,6 +28,7 @@
#include "WebDOMStringList.h"
#include "WebExceptionCode.h"
+#include "WebIDBMetadata.h"
#include "platform/WebCommon.h"
namespace WebKit {
@@ -44,6 +45,11 @@ class WebIDBDatabase {
public:
virtual ~WebIDBDatabase() { }
+ virtual WebIDBMetadata metadata() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return WebIDBMetadata();
+ }
virtual WebString name() const
{
WEBKIT_ASSERT_NOT_REACHED();
diff --git a/Source/WebKit/chromium/public/WebIDBKeyPath.h b/Source/WebKit/chromium/public/WebIDBKeyPath.h
index beb1fa22d..9bc81ec65 100644
--- a/Source/WebKit/chromium/public/WebIDBKeyPath.h
+++ b/Source/WebKit/chromium/public/WebIDBKeyPath.h
@@ -31,11 +31,6 @@
#include "platform/WebString.h"
#include "platform/WebVector.h"
-namespace WTF {
-template<typename T, size_t inlineCapacity> class Vector;
-class String;
-}
-
namespace WebCore { class IDBKeyPath; }
namespace WebKit {
@@ -45,8 +40,17 @@ public:
WEBKIT_EXPORT static WebIDBKeyPath create(const WebString&);
WEBKIT_EXPORT static WebIDBKeyPath create(const WebVector<WebString>&);
WEBKIT_EXPORT static WebIDBKeyPath createNull();
- WEBKIT_EXPORT WebIDBKeyPath(const WebIDBKeyPath&);
- WEBKIT_EXPORT ~WebIDBKeyPath();
+
+ WebIDBKeyPath(const WebIDBKeyPath& keyPath) { assign(keyPath); }
+ virtual ~WebIDBKeyPath() { reset(); }
+ WebIDBKeyPath& operator=(const WebIDBKeyPath& keyPath)
+ {
+ assign(keyPath);
+ return *this;
+ }
+
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT void assign(const WebIDBKeyPath&);
enum Type {
NullType = 0,
diff --git a/Source/WebKit/chromium/public/WebIDBMetadata.h b/Source/WebKit/chromium/public/WebIDBMetadata.h
new file mode 100644
index 000000000..410d9facf
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebIDBMetadata.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebIDBMetadata_h
+#define WebIDBMetadata_h
+
+#include "WebIDBKeyPath.h"
+#include "platform/WebCommon.h"
+#include "platform/WebString.h"
+#include "platform/WebVector.h"
+
+namespace WebKit {
+
+struct WebIDBMetadata {
+ struct Index;
+ struct ObjectStore;
+
+ WebString name;
+ WebString version;
+ WebVector<ObjectStore> objectStores;
+ WebIDBMetadata() { }
+
+ struct ObjectStore {
+ WebString name;
+ WebIDBKeyPath keyPath;
+ bool autoIncrement;
+ WebVector<Index> indexes;
+ ObjectStore()
+ : keyPath(WebIDBKeyPath::createNull())
+ , autoIncrement(false) { }
+ };
+
+ struct Index {
+ WebString name;
+ WebIDBKeyPath keyPath;
+ bool unique;
+ bool multiEntry;
+ Index()
+ : keyPath(WebIDBKeyPath::createNull())
+ , unique(false)
+ , multiEntry(false) { }
+ };
+};
+
+
+} // namespace WebKit
+
+#endif // WebIDBMetadata_h
diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h
index 6ac9f1f57..b7a5ecbd2 100644
--- a/Source/WebKit/chromium/public/WebInputEvent.h
+++ b/Source/WebKit/chromium/public/WebInputEvent.h
@@ -116,6 +116,7 @@ public:
GestureTap,
GestureTapDown,
GestureDoubleTap,
+ GestureTwoFingerTap,
GestureLongPress,
GesturePinchBegin,
GesturePinchEnd,
@@ -197,16 +198,25 @@ public:
|| type == TouchEnd;
}
- // Returns true if the WebInputEvent |type| should be handled as scroll gesture.
- static bool isScrollGestureEventType(int type)
+ // Returns true if the WebInputEvent is a gesture event.
+ static bool isGestureEventType(int type)
{
return type == GestureScrollBegin
|| type == GestureScrollEnd
|| type == GestureScrollUpdate
|| type == GestureFlingStart
|| type == GestureFlingCancel
+ || type == GesturePinchBegin
+ || type == GesturePinchEnd
+ || type == GesturePinchUpdate
+ || type == GestureTap
|| type == GestureTapDown
- || type == GestureTap; // FIXME: Why is GestureTap on this list?
+ || type == GestureDoubleTap
+ || type == GestureTwoFingerTap
+ || type == GestureLongPress
+ || type == GesturePinchBegin
+ || type == GesturePinchEnd
+ || type == GesturePinchUpdate;
}
};
@@ -379,7 +389,9 @@ public:
class WebTouchEvent : public WebInputEvent {
public:
- enum { touchesLengthCap = 8 };
+ // Maximum number of simultaneous touches supported on
+ // Ash/Aura.
+ enum { touchesLengthCap = 12 };
unsigned touchesLength;
// List of all touches which are currently down.
diff --git a/Source/WebKit/chromium/public/WebIntent.h b/Source/WebKit/chromium/public/WebIntent.h
index cfaddc38d..233652d2e 100644
--- a/Source/WebKit/chromium/public/WebIntent.h
+++ b/Source/WebKit/chromium/public/WebIntent.h
@@ -48,7 +48,6 @@ namespace WebKit {
class WebIntent {
public:
WebIntent() { }
- WEBKIT_EXPORT WebIntent(const WebString& action, const WebString& type, const WebString& data);
WebIntent(const WebIntent& other) { assign(other); }
~WebIntent() { reset(); }
@@ -57,6 +56,10 @@ public:
assign(other);
return *this;
}
+
+ WEBKIT_EXPORT static WebIntent create(const WebString& action, const WebString& type, const WebString& data,
+ const WebVector<WebString>& extrasNames, const WebVector<WebString>& extrasValues);
+
WEBKIT_EXPORT void reset();
WEBKIT_EXPORT bool isNull() const;
WEBKIT_EXPORT bool equals(const WebIntent&) const;
diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h
index 444a2cc90..3b8ef6451 100644
--- a/Source/WebKit/chromium/public/WebMediaPlayer.h
+++ b/Source/WebKit/chromium/public/WebMediaPlayer.h
@@ -100,9 +100,15 @@ public:
MediaKeyExceptionKeySystemNotSupported,
};
+ enum CORSMode {
+ CORSModeUnspecified,
+ CORSModeAnonymous,
+ CORSModeUseCredentials,
+ };
+
virtual ~WebMediaPlayer() {}
- virtual void load(const WebURL&) = 0;
+ virtual void load(const WebURL&, CORSMode) = 0;
virtual void cancelLoad() = 0;
// Playback controls.
@@ -148,6 +154,7 @@ public:
virtual unsigned long long totalBytes() const = 0;
virtual bool hasSingleSecurityOrigin() const = 0;
+ virtual bool didPassCORSAccessCheck() const = 0;
virtual MovieLoadType movieLoadType() const = 0;
virtual float mediaTimeForTimeValue(float timeValue) const = 0;
diff --git a/Source/WebKit/chromium/public/WebMediaPlayerClient.h b/Source/WebKit/chromium/public/WebMediaPlayerClient.h
index 786bf5aa7..1d9c64dc8 100644
--- a/Source/WebKit/chromium/public/WebMediaPlayerClient.h
+++ b/Source/WebKit/chromium/public/WebMediaPlayerClient.h
@@ -35,6 +35,8 @@
namespace WebKit {
+class WebFrame;
+class WebPlugin;
class WebRequest;
class WebURL;
@@ -75,6 +77,10 @@ public:
virtual void keyError(const WebString&, const WebString&, MediaKeyErrorCode, unsigned short systemCode) = 0;
virtual void keyMessage(const WebString&, const WebString&, const unsigned char*, unsigned) = 0;
virtual void keyNeeded(const WebString&, const WebString&, const unsigned char* initData, unsigned initDataLength) = 0;
+ // The returned pointer is valid until closeHelperPlugin() is called.
+ // Returns 0 if the plugin could not be instantiated.
+ virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*) = 0;
+ virtual void closeHelperPlugin() = 0;
virtual void disableAcceleratedCompositing() = 0;
protected:
~WebMediaPlayerClient() { }
diff --git a/Source/WebKit/chromium/public/WebMessagePortChannel.h b/Source/WebKit/chromium/public/WebMessagePortChannel.h
index cd7cfd438..5164cffd7 100644
--- a/Source/WebKit/chromium/public/WebMessagePortChannel.h
+++ b/Source/WebKit/chromium/public/WebMessagePortChannel.h
@@ -28,35 +28,4 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebMessagePortChannel_h
-#define WebMessagePortChannel_h
-
-#include "platform/WebCommon.h"
-#include "platform/WebVector.h"
-
-namespace WebKit {
-
-class WebMessagePortChannelClient;
-class WebString;
-
-typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray;
-
-// Provides an interface to a Message Port Channel implementation. The object owns itself and
-// is signalled that its not needed anymore with the destroy() call.
-class WebMessagePortChannel {
-public:
- virtual void setClient(WebMessagePortChannelClient*) = 0;
- virtual void destroy() = 0;
- // WebKit versions of WebCore::MessagePortChannel.
- virtual void entangle(WebMessagePortChannel*) = 0;
- // Callee receives ownership of the passed vector.
- virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0;
- virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0;
-
-protected:
- ~WebMessagePortChannel() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../Platform/chromium/public/WebMessagePortChannel.h"
diff --git a/Source/WebKit/chromium/public/WebMessagePortChannelClient.h b/Source/WebKit/chromium/public/WebMessagePortChannelClient.h
index 0b85bb344..4d1325b4b 100644
--- a/Source/WebKit/chromium/public/WebMessagePortChannelClient.h
+++ b/Source/WebKit/chromium/public/WebMessagePortChannelClient.h
@@ -28,24 +28,4 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebMessagePortChannelClient_h
-#define WebMessagePortChannelClient_h
-
-namespace WebKit {
-
-// Provides an interface for users of WebMessagePortChannel to be notified
-// when messages are available.
-class WebMessagePortChannelClient {
-public:
- // Alerts that new messages have arrived, which are retrieved by calling
- // WebMessagePortChannel::tryGetMessage. Note that this may be called
- // on any thread.
- virtual void messageAvailable() = 0;
-
-protected:
- ~WebMessagePortChannelClient() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../Platform/chromium/public/WebMessagePortChannelClient.h"
diff --git a/Source/WebKit/chromium/public/WebPermissionClient.h b/Source/WebKit/chromium/public/WebPermissionClient.h
index 116a383ca..014c2c3f4 100644
--- a/Source/WebKit/chromium/public/WebPermissionClient.h
+++ b/Source/WebKit/chromium/public/WebPermissionClient.h
@@ -33,6 +33,7 @@
namespace WebKit {
+class WebDocument;
class WebFrame;
class WebSecurityOrigin;
class WebString;
@@ -90,7 +91,7 @@ public:
virtual bool allowWriteToClipboard(WebFrame*, bool defaultValue) { return defaultValue; }
// Controls whether enabling Web Components API for this frame.
- virtual bool allowWebComponents(WebFrame*, bool defaultValue) { return defaultValue; }
+ virtual bool allowWebComponents(const WebDocument&, bool defaultValue) { return defaultValue; }
// Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled.
virtual void didNotAllowPlugins(WebFrame*) { }
diff --git a/Source/WebKit/chromium/public/WebPlugin.h b/Source/WebKit/chromium/public/WebPlugin.h
index 5b911d0b8..5ef884c73 100644
--- a/Source/WebKit/chromium/public/WebPlugin.h
+++ b/Source/WebKit/chromium/public/WebPlugin.h
@@ -139,6 +139,8 @@ public:
// Rotates the plugin's view of its content.
virtual void rotateView(RotationType type) { }
+ virtual bool isPlaceholder() { return true; }
+
protected:
~WebPlugin() { }
};
diff --git a/Source/WebKit/chromium/public/WebPopupType.h b/Source/WebKit/chromium/public/WebPopupType.h
index 2d0e8e4d2..1a84dd659 100644
--- a/Source/WebKit/chromium/public/WebPopupType.h
+++ b/Source/WebKit/chromium/public/WebPopupType.h
@@ -38,6 +38,7 @@ enum WebPopupType {
WebPopupTypeSelect, // An HTML select (combo-box) popup.
WebPopupTypeSuggestion, // An autofill/autocomplete popup.
WebPopupTypePage, // An HTML-capable popup.
+ WebPopupTypeHelperPlugin, // An off-screen helper plugin.
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/public/WebSecurityPolicy.h b/Source/WebKit/chromium/public/WebSecurityPolicy.h
index 5d9d3de06..462db31e6 100644
--- a/Source/WebKit/chromium/public/WebSecurityPolicy.h
+++ b/Source/WebKit/chromium/public/WebSecurityPolicy.h
@@ -61,9 +61,12 @@ public:
// included by an HTTPS page.
WEBKIT_EXPORT static void registerURLSchemeAsSecure(const WebString&);
- // Registers a non-HTTP URL scheme which can be sent CORS requests.
+ // Registers a non-HTTP URL scheme which can be sent CORS requests.
WEBKIT_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&);
+ // Registers a URL scheme whose resources can be loaded regardless of a page's Content Security Policy.
+ WEBKIT_EXPORT static void registerURLSchemeAsBypassingContentSecurityPolicy(const WebString&);
+
// Registers a URL scheme as strictly empty documents, allowing them to
// commit synchronously.
WEBKIT_EXPORT static void registerURLSchemeAsEmptyDocument(const WebString&);
diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h
index ccf3303c7..0528d8ef4 100644
--- a/Source/WebKit/chromium/public/WebSettings.h
+++ b/Source/WebKit/chromium/public/WebSettings.h
@@ -59,15 +59,16 @@ public:
virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 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 setDefaultFixedFontSize(int) = 0;
virtual void setMinimumFontSize(int) = 0;
virtual void setMinimumLogicalFontSize(int) = 0;
- virtual void setDefaultDeviceScaleFactor(int) = 0;
virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0;
virtual void setFontBoostingEnabled(bool) = 0;
virtual void setDefaultTextEncodingName(const WebString&) = 0;
virtual void setDeviceSupportsTouch(bool) = 0;
+ virtual void setDeviceSupportsMouse(bool) = 0;
virtual void setJavaScriptEnabled(bool) = 0;
virtual void setWebSecurityEnabled(bool) = 0;
virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0;
@@ -114,6 +115,7 @@ public:
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;
@@ -145,9 +147,6 @@ public:
virtual void setHixie76WebSocketProtocolEnabled(bool) = 0;
virtual void setVisualWordMovementEnabled(bool) = 0;
virtual void setAcceleratedPaintingEnabled(bool) = 0;
- virtual void setPerTilePaintingEnabled(bool) = 0;
- virtual void setPartialSwapEnabled(bool) = 0;
- virtual void setThreadedAnimationEnabled(bool) = 0;
virtual void setViewportEnabled(bool) = 0;
virtual void setMediaPlaybackRequiresUserGesture(bool) = 0;
virtual bool viewportEnabled() const = 0;
@@ -156,6 +155,11 @@ public:
virtual void setFixedPositionCreatesStackingContext(bool) = 0;
virtual void setSyncXHRInDocumentsEnabled(bool) = 0;
+ virtual bool forceSoftwareCompositing() const = 0;
+
+ // DEPRECATED
+ virtual void setDefaultDeviceScaleFactor(int) { }
+
protected:
~WebSettings() { }
};
diff --git a/Source/WebKit/chromium/public/WebSharedWorkerClient.h b/Source/WebKit/chromium/public/WebSharedWorkerClient.h
index 4a2b8732f..240fe76e8 100644
--- a/Source/WebKit/chromium/public/WebSharedWorkerClient.h
+++ b/Source/WebKit/chromium/public/WebSharedWorkerClient.h
@@ -56,7 +56,7 @@ public:
const WebString& errorString, int lineNumber,
const WebString& sourceURL) = 0;
- // FIXME: the below is for compatibility only and should be
+ // FIXME: the below is for compatibility only and should be
// removed once Chromium is updated to remove message
// destination parameter <http://webkit.org/b/37155>.
virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel,
diff --git a/Source/WebKit/chromium/public/WebStorageArea.h b/Source/WebKit/chromium/public/WebStorageArea.h
index 89c5cfe7e..89b998fb6 100644
--- a/Source/WebKit/chromium/public/WebStorageArea.h
+++ b/Source/WebKit/chromium/public/WebStorageArea.h
@@ -28,68 +28,4 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebStorageArea_h
-#define WebStorageArea_h
-
-#include "platform/WebCommon.h"
-#include "platform/WebString.h"
-
-namespace WebKit {
-
-class WebURL;
-
-class WebStorageArea {
-public:
- virtual ~WebStorageArea() { }
-
- enum Result {
- ResultOK = 0,
- ResultBlockedByQuota
- };
-
- // The number of key/value pairs in the storage area.
- virtual unsigned length() = 0;
-
- // Get a value for a specific key. Valid key indices are 0 through length() - 1.
- // Indexes may change on any set/removeItem call. Will return null if the index
- // provided is out of range.
- virtual WebString key(unsigned index) = 0;
-
- // Get the value that corresponds to a specific key. This returns null if there is
- // no entry for that key.
- virtual WebString getItem(const WebString& key) = 0;
-
- // Set the value that corresponds to a specific key. Result will either be ResultOK
- // or some particular error. The value is NOT set when there's an error. |pageUrl| is the
- // url that should be used if a storage event fires.
- virtual void setItem(const WebString& key, const WebString& newValue, const WebURL& pageUrl, Result& result)
- {
- WebString unused;
- setItem(key, newValue, pageUrl, result, unused);
- }
-
-
- // Remove the value associated with a particular key. |pageUrl| is the url that should be used
- // if a storage event fires.
- virtual void removeItem(const WebString& key, const WebURL& pageUrl)
- {
- WebString unused;
- removeItem(key, pageUrl, unused);
- }
-
- // Clear all key/value pairs. |pageUrl| is the url that should be used if a storage event fires.
- virtual void clear(const WebURL& pageUrl)
- {
- bool unused;
- clear(pageUrl, unused);
- }
-
- // DEPRECATED - being replaced by the async variants above which do not return oldValues or block until completion.
- virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) { }
- virtual void removeItem(const WebString& key, const WebURL& pageUrl, WebString& oldValue) { }
- virtual void clear(const WebURL& pageUrl, bool& somethingCleared) { }
-};
-
-} // namespace WebKit
-
-#endif // WebStorageArea_h
+#include "../../../Platform/chromium/public/WebStorageArea.h"
diff --git a/Source/WebKit/chromium/public/WebStorageNamespace.h b/Source/WebKit/chromium/public/WebStorageNamespace.h
index dd4a8fd44..b57046489 100644
--- a/Source/WebKit/chromium/public/WebStorageNamespace.h
+++ b/Source/WebKit/chromium/public/WebStorageNamespace.h
@@ -28,35 +28,4 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebStorageNamespace_h
-#define WebStorageNamespace_h
-
-#include "platform/WebCommon.h"
-
-namespace WebKit {
-
-class WebStorageArea;
-class WebString;
-
-// WebStorageNamespace represents a collection of StorageAreas. Typically, you'll have
-// multiple StorageNamespaces to represent the SessionStorage for each tab and a single
-// StorageNamespace to represent LocalStorage for the entire browser.
-class WebStorageNamespace {
-public:
- virtual ~WebStorageNamespace() { }
-
- // Create a new WebStorageArea object. Two subsequent calls with the same origin
- // will return two different WebStorageArea objects that share the same backing store.
- // You should call delete on the returned object when you're finished.
- virtual WebStorageArea* createStorageArea(const WebString& origin) = 0;
-
- // Copy a StorageNamespace. This only makes sense in the case of SessionStorage.
- virtual WebStorageNamespace* copy() = 0;
-
- // Returns true of the two instances represent the same storage namespace.
- virtual bool isSameNamespace(const WebStorageNamespace&) const { return false; }
-};
-
-} // namespace WebKit
-
-#endif // WebStorageNamespace_h
+#include "../../../Platform/chromium/public/WebStorageNamespace.h"
diff --git a/Source/WebKit/chromium/public/WebURLLoaderOptions.h b/Source/WebKit/chromium/public/WebURLLoaderOptions.h
index 114039241..d32b0ce4c 100644
--- a/Source/WebKit/chromium/public/WebURLLoaderOptions.h
+++ b/Source/WebKit/chromium/public/WebURLLoaderOptions.h
@@ -46,6 +46,7 @@ struct WebURLLoaderOptions {
, sniffContent(false)
, allowCredentials(false)
, forcePreflight(false)
+ , exposeAllResponseHeaders(false)
, crossOriginRequestPolicy(CrossOriginRequestPolicyDeny)
{ }
@@ -53,6 +54,7 @@ struct WebURLLoaderOptions {
bool sniffContent; // Whether to sniff content.
bool allowCredentials; // Whether to send HTTP credentials and cookies with the request.
bool forcePreflight; // If policy is to use access control, whether to force a preflight for GET, HEAD, and POST requests.
+ bool exposeAllResponseHeaders; // If policy is to use access control, whether to expose non-whitelisted response headers to the client.
CrossOriginRequestPolicy crossOriginRequestPolicy;
};
diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h
index 0f7093ac4..542b1021a 100644
--- a/Source/WebKit/chromium/public/WebView.h
+++ b/Source/WebKit/chromium/public/WebView.h
@@ -103,6 +103,8 @@ public:
// child frames. It is valid to pass a null WebFrameClient pointer.
virtual void initializeMainFrame(WebFrameClient*) = 0;
+ virtual void initializeHelperPluginFrame(WebFrameClient*) = 0;
+
// Initializes the various client interfaces.
virtual void setAutofillClient(WebAutofillClient*) = 0;
virtual void setDevToolsAgentClient(WebDevToolsAgentClient*) = 0;
diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h
index 9a8ad05b2..9b39da7dd 100644
--- a/Source/WebKit/chromium/public/WebViewClient.h
+++ b/Source/WebKit/chromium/public/WebViewClient.h
@@ -60,6 +60,7 @@ class WebFileChooserCompletion;
class WebFrame;
class WebGeolocationClient;
class WebGeolocationService;
+class WebHelperPlugin;
class WebIconLoadingCompletion;
class WebImage;
class WebInputElement;
@@ -144,6 +145,10 @@ public:
// will never be called.
virtual bool enumerateChosenDirectory(const WebString& path, WebFileChooserCompletion*) { return false; }
+ // Creates the main WebFrame for the specified WebHelperPlugin.
+ // Called by WebHelperPlugin to provide the WebFrameClient interface for the WebFrame.
+ virtual void initializeHelperPluginWebFrame(WebHelperPlugin*) { }
+
// Navigational --------------------------------------------------------
diff --git a/Source/WebKit/chromium/public/WebWidgetClient.h b/Source/WebKit/chromium/public/WebWidgetClient.h
index 92dfb3671..89457ce38 100644
--- a/Source/WebKit/chromium/public/WebWidgetClient.h
+++ b/Source/WebKit/chromium/public/WebWidgetClient.h
@@ -131,6 +131,9 @@ public:
// displayed.
virtual WebScreenInfo screenInfo() { return WebScreenInfo(); }
+ // Called to get the scale factor of the display.
+ virtual float deviceScaleFactor() { return 1; }
+
// When this method gets called, WebWidgetClient implementation should
// reset the input method by cancelling any ongoing composition.
virtual void resetInputMethod() { }
diff --git a/Source/WebKit/chromium/public/linux/WebFontInfo.h b/Source/WebKit/chromium/public/linux/WebFontInfo.h
index 72e1091d6..ed88b9306 100644
--- a/Source/WebKit/chromium/public/linux/WebFontInfo.h
+++ b/Source/WebKit/chromium/public/linux/WebFontInfo.h
@@ -42,6 +42,11 @@ namespace WebKit {
class WebFontInfo {
public:
+ // Set a global preference describing whether renderStyleForStrike() should
+ // enable subpixel positioning or not. FontConfig doesn't currently provide
+ // a parameter for controlling this.
+ WEBKIT_EXPORT static void setSubpixelPositioning(bool);
+
// Return a font family which provides glyphs for the Unicode code points
// specified by |utf16|
// characters: a native-endian UTF16 string
@@ -55,7 +60,7 @@ public:
WEBKIT_EXPORT static void familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*);
// Fill out the given WebFontRenderStyle with the user's preferences for
- // rendering the given font at the given size.
+ // rendering the given font at the given size (in pixels).
// family: i.e. "Times New Roman"
// sizeAndStyle:
// 3322222222221111111111
diff --git a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h
index 9b16380a5..78a85916e 100644
--- a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h
+++ b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h
@@ -47,7 +47,8 @@ struct WEBKIT_EXPORT WebFontRenderStyle {
char useHinting; // hint glyphs to the pixel grid
char hintStyle; // level of hinting, 0..3
char useAntiAlias; // antialias glyph shapes
- char useSubpixel; // use subpixel antialias
+ char useSubpixelRendering; // use subpixel rendering (partially-filled pixels)
+ char useSubpixelPositioning; // use subpixel positioning (fractional X positions for glyphs)
#ifdef WEBKIT_IMPLEMENTATION
// Translates the members of this struct to a FontRenderStyle
diff --git a/Source/WebKit/chromium/public/linux/WebFontRendering.h b/Source/WebKit/chromium/public/linux/WebFontRendering.h
index 87a59b8ca..ae1bbb050 100644
--- a/Source/WebKit/chromium/public/linux/WebFontRendering.h
+++ b/Source/WebKit/chromium/public/linux/WebFontRendering.h
@@ -42,8 +42,11 @@ public:
// Set global font renderering preferences.
WEBKIT_EXPORT static void setHinting(SkPaint::Hinting);
- WEBKIT_EXPORT static void setAntiAlias(bool on);
- WEBKIT_EXPORT static void setSubpixelGlyphs(bool on);
+ WEBKIT_EXPORT static void setAutoHint(bool);
+ WEBKIT_EXPORT static void setUseBitmaps(bool);
+ WEBKIT_EXPORT static void setAntiAlias(bool);
+ WEBKIT_EXPORT static void setSubpixelRendering(bool);
+ WEBKIT_EXPORT static void setSubpixelPositioning(bool);
WEBKIT_EXPORT static void setLCDOrder(SkFontHost::LCDOrder);
WEBKIT_EXPORT static void setLCDOrientation(SkFontHost::LCDOrientation);
};
diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
index f69c62ff2..3bb7ebeb4 100644
--- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
+++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
@@ -51,20 +51,12 @@ class WebApplicationCacheHostClient; // FIXME: Does this belong in platform?
class WebIDBFactory; // FIXME: Does this belong in platform?
class WebIDBKey; // FIXME: Does this belong in platform?
class WebIDBKeyPath; // FIXME: Does this belong in platform?
-class WebMessagePortChannel; // FIXME: Does this belong in platform?
class WebPluginListBuilder; // FIXME: Does this belong in platform?
class WebSharedWorkerRepository; // FIXME: Does this belong in platform?
-class WebStorageNamespace; // FIXME: Does this belong in platform?
// FIXME: Eventually all these API will need to move to WebKit::Platform.
class WebKitPlatformSupport : public Platform {
public:
- // DOM Storage --------------------------------------------------
-
- // Return a LocalStorage namespace that corresponds to the following path.
- virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; }
-
-
// HTML5 Database ------------------------------------------------------
#ifdef WIN32
@@ -97,13 +89,6 @@ public:
virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& keyPath) { return WebSerializedScriptValue(); }
- // Message Ports -------------------------------------------------------
-
- // Creates a Message Port Channel. This can be called on any thread.
- // The returned object should only be used on the thread it was created on.
- virtual WebMessagePortChannel* createMessagePortChannel() { return 0; }
-
-
// Plugins -------------------------------------------------------------
// If refresh is true, then cached information should not be used to
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
index c323d10ab..403088bc9 100644
--- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -581,3 +581,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::Unknown, ResourceResponse::Unknown)
COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_0_9, ResourceResponse::HTTP_0_9);
COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_0, ResourceResponse::HTTP_1_0);
COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_1, ResourceResponse::HTTP_1_1);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUnspecified, MediaPlayerClient::Unspecified);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeAnonymous, MediaPlayerClient::Anonymous);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUseCredentials, MediaPlayerClient::UseCredentials);
diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
index f1c2aab30..086e79e7d 100644
--- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
+++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
@@ -209,7 +209,9 @@ void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const
// Try to use the original ResourceResponse if possible.
WebURLResponse validatedResponse = WrappedResourceResponse(response);
HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl);
- validatedResponse.visitHTTPHeaderFields(&validator);
+ if (!m_options.exposeAllResponseHeaders)
+ validatedResponse.visitHTTPHeaderFields(&validator);
+
// If there are blocked headers, copy the response so we can remove them.
const HTTPHeaderSet& blockedHeaders = validator.blockedHeaders();
if (!blockedHeaders.isEmpty()) {
diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
index eb5021003..5f608a3d9 100644
--- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
@@ -91,12 +91,16 @@ private:
} // namespace
-// static
bool AsyncFileSystem::isAvailable()
{
return true;
}
+PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create()
+{
+ return AsyncFileSystemChromium::create();
+}
+
AsyncFileSystemChromium::AsyncFileSystemChromium()
: m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem())
{
diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
index 44558de87..cadb2e3a9 100644
--- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
+++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
@@ -58,8 +58,7 @@ PassOwnPtr<AudioDestination> AudioDestination::create(AudioSourceProvider& provi
}
AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider, float sampleRate)
- : m_provider(provider)
- , m_renderBus(numberOfChannels, renderBufferSize, false)
+ : m_renderBus(numberOfChannels, renderBufferSize, false)
, m_sampleRate(sampleRate)
, m_isPlaying(false)
{
diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.h b/Source/WebKit/chromium/src/AudioDestinationChromium.h
index dfe5ebd7c..be4cc4b84 100644
--- a/Source/WebKit/chromium/src/AudioDestinationChromium.h
+++ b/Source/WebKit/chromium/src/AudioDestinationChromium.h
@@ -58,7 +58,6 @@ public:
virtual void render(const WebKit::WebVector<float*>& audioData, size_t numberOfFrames);
private:
- AudioSourceProvider& m_provider;
AudioBus m_renderBus;
float m_sampleRate;
bool m_isPlaying;
diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
index 467d6389d..dd1e2104b 100644
--- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -521,7 +521,6 @@ void ChromeClientImpl::invalidateContentsAndRootView(const IntRect& updateRect,
void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
{
- m_webView->hidePopups();
invalidateContentsAndRootView(updateRect, immediate);
}
@@ -536,7 +535,6 @@ void ChromeClientImpl::scroll(
const IntSize& scrollDelta, const IntRect& scrollRect,
const IntRect& clipRect)
{
- m_webView->hidePopups();
#if USE(ACCELERATED_COMPOSITING)
if (!m_webView->isAcceleratedCompositingActive()) {
#endif
@@ -636,12 +634,10 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen
if (!m_webView->settings()->viewportEnabled() || !m_webView->isFixedLayoutModeEnabled() || !m_webView->client() || !m_webView->page())
return;
- bool useDefaultDeviceScaleFactor = false;
ViewportArguments args;
if (arguments == args) {
// Default viewport arguments passed in. This is a signal to reset the viewport.
args.width = ViewportArguments::ValueDesktopWidth;
- useDefaultDeviceScaleFactor = true;
} else
args = arguments;
@@ -666,10 +662,7 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen
m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight));
bool needInitializePageScale = !m_webView->isPageScaleFactorSet();
- if (useDefaultDeviceScaleFactor && settings->defaultDeviceScaleFactor())
- m_webView->setDeviceScaleFactor(settings->defaultDeviceScaleFactor());
- else
- m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
+ m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale);
if (needInitializePageScale)
m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio);
@@ -725,8 +718,7 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
#else
params.directory = false;
#endif
- params.acceptTypes = fileChooser->settings().acceptMIMETypes;
- params.acceptMIMETypes = fileChooser->settings().acceptMIMETypes; // FIXME: Remove this once https://chromiumcodereview.appspot.com/10414085 lands.
+ params.acceptTypes = fileChooser->settings().acceptTypes();
params.selectedFiles = fileChooser->settings().selectedFiles;
if (params.selectedFiles.size() > 0)
params.initialValue = params.selectedFiles[0];
diff --git a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp
new file mode 100644
index 000000000..aada07787
--- /dev/null
+++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * 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 "ContextFeaturesClientImpl.h"
+
+#include "Document.h"
+#include "WebDocument.h"
+#include "WebPermissionClient.h"
+
+namespace WebKit {
+
+bool ContextFeaturesClientImpl::isEnabled(WebCore::Document* document, WebCore::ContextFeatures::FeatureType type, bool defaultValue)
+{
+ if (!m_client)
+ return defaultValue;
+
+ switch (type) {
+ case WebCore::ContextFeatures::ShadowDOM:
+ case WebCore::ContextFeatures::StyleScoped:
+ return m_client->allowWebComponents(WebDocument(document), defaultValue);
+ default:
+ return defaultValue;
+ }
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/public/gtk/WebFontInfo.h b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.h
index 2fc00ba08..ea1f9548d 100644
--- a/Source/WebKit/chromium/public/gtk/WebFontInfo.h
+++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -27,6 +27,29 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// This file can be deleted once http://codereview.chromium.org/8054025/
-// gets committed in Chromium.
-#include "../linux/WebFontInfo.h"
+
+#ifndef ContextFeaturesClientImpl_h
+#define ContextFeaturesClientImpl_h
+
+#include "ContextFeatures.h"
+
+namespace WebKit {
+
+class WebPermissionClient;
+
+class ContextFeaturesClientImpl : public WebCore::ContextFeaturesClient {
+public:
+ ContextFeaturesClientImpl()
+ : m_client(0)
+ { }
+
+ virtual bool isEnabled(WebCore::Document*, WebCore::ContextFeatures::FeatureType, bool defaultValue) OVERRIDE;
+ void setPermissionClient(WebPermissionClient* client) { m_client = client; }
+
+private:
+ WebPermissionClient* m_client;
+};
+
+} // namespace WebKit
+
+#endif // ContextFeaturesClientImpl_h
diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
index d400e7c2b..a32a182a4 100644
--- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -278,25 +278,27 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
// words and attaches suggestions to these markers in the background. Therefore, when a user right-clicks
// a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it.
if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) {
- RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange();
- if (range.get()) {
+ VisibleSelection selection = selectedFrame->selection()->selection();
+ if (selection.isCaretOrRange()) {
+ if (selection.isCaret())
+ selection.expandUsingGranularity(WordGranularity);
+ RefPtr<Range> range = selection.toNormalizedRange();
Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling | DocumentMarker::Grammar);
- if (!markers.isEmpty()) {
- Vector<String> suggestions;
- for (size_t i = 0; i < markers.size(); ++i) {
- if (!markers[i]->description().isEmpty()) {
- Vector<String> descriptions;
- markers[i]->description().split('\n', descriptions);
- suggestions.append(descriptions);
- }
- }
- data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
- if (!suggestions.isEmpty())
+ if (markers.size() == 1) {
+ range->setStart(range->startContainer(), markers[0]->startOffset());
+ range->setEnd(range->endContainer(), markers[0]->endOffset());
+ data.misspelledWord = range->text();
+ if (markers[0]->description().length()) {
+ Vector<String> suggestions;
+ markers[0]->description().split('\n', suggestions);
data.dictionarySuggestions = suggestions;
- else if (m_webView->spellCheckClient()) {
+ } else if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions);
}
+ selection = VisibleSelection(range.get());
+ if (selectedFrame->selection()->shouldChangeSelection(selection))
+ selectedFrame->selection()->setSelection(selection, WordGranularity);
}
}
} else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
diff --git a/Source/WebKit/chromium/src/DeviceOrientationClientProxy.h b/Source/WebKit/chromium/src/DeviceOrientationClientProxy.h
index e90d77fd9..73fd3e2a0 100644
--- a/Source/WebKit/chromium/src/DeviceOrientationClientProxy.h
+++ b/Source/WebKit/chromium/src/DeviceOrientationClientProxy.h
@@ -44,11 +44,11 @@ public:
{
}
- void setController(WebCore::DeviceOrientationController*);
- void startUpdating();
- void stopUpdating();
- WebCore::DeviceOrientation* lastOrientation() const;
- virtual void deviceOrientationControllerDestroyed();
+ virtual void setController(WebCore::DeviceOrientationController*) OVERRIDE;
+ virtual void startUpdating() OVERRIDE;
+ virtual void stopUpdating() OVERRIDE;
+ virtual WebCore::DeviceOrientation* lastOrientation() const OVERRIDE;
+ virtual void deviceOrientationControllerDestroyed() OVERRIDE;
private:
WebDeviceOrientationClient* m_client;
diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp
index 417fe9429..b2d060f0e 100644
--- a/Source/WebKit/chromium/src/EditorClientImpl.cpp
+++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp
@@ -170,7 +170,7 @@ void EditorClientImpl::toggleContinuousSpellChecking()
bool EditorClientImpl::isGrammarCheckingEnabled()
{
const Frame* frame = m_webView->focusedWebCoreFrame();
- return frame && frame->settings() && frame->settings()->asynchronousSpellCheckingEnabled();
+ return frame && frame->settings() && (frame->settings()->asynchronousSpellCheckingEnabled() || frame->settings()->unifiedTextCheckerEnabled());
}
void EditorClientImpl::toggleGrammarChecking()
@@ -703,7 +703,7 @@ void EditorClientImpl::textDidChangeInTextArea(Element*)
bool EditorClientImpl::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const
{
const Frame* frame = m_webView->focusedWebCoreFrame();
- return !frame || !frame->settings() || !frame->settings()->asynchronousSpellCheckingEnabled();
+ return !frame || !frame->settings() || (!frame->settings()->asynchronousSpellCheckingEnabled() && !frame->settings()->unifiedTextCheckerEnabled());
}
void EditorClientImpl::ignoreWordInSpellDocument(const String&)
@@ -766,16 +766,39 @@ String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord(const String&
return String();
}
-void EditorClientImpl::checkGrammarOfString(const UChar*, int length,
- WTF::Vector<GrammarDetail>&,
- int* badGrammarLocation,
- int* badGrammarLength)
+void EditorClientImpl::checkGrammarOfString(const UChar* text, int length, WTF::Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
{
- notImplemented();
if (badGrammarLocation)
*badGrammarLocation = -1;
if (badGrammarLength)
*badGrammarLength = 0;
+
+ if (!m_webView->spellCheckClient())
+ return;
+ WebVector<WebTextCheckingResult> webResults;
+ m_webView->spellCheckClient()->checkTextOfParagraph(WebString(text, length), WebTextCheckingTypeGrammar, &webResults);
+ if (!webResults.size())
+ return;
+
+ // Convert a list of WebTextCheckingResults to a list of GrammarDetails. If
+ // the converted vector of GrammarDetails has grammar errors, we set
+ // badGrammarLocation and badGrammarLength to tell WebKit that the input
+ // text has grammar errors.
+ for (size_t i = 0; i < webResults.size(); ++i) {
+ if (webResults[i].type == WebTextCheckingTypeGrammar) {
+ GrammarDetail detail;
+ detail.location = webResults[i].location;
+ detail.length = webResults[i].length;
+ detail.userDescription = webResults[i].replacement;
+ details.append(detail);
+ }
+ }
+ if (!details.size())
+ return;
+ if (badGrammarLocation)
+ *badGrammarLocation = 0;
+ if (badGrammarLength)
+ *badGrammarLength = length;
}
void EditorClientImpl::checkTextOfParagraph(const UChar* text, int length,
diff --git a/Source/WebKit/chromium/src/Extensions3DChromium.cpp b/Source/WebKit/chromium/src/Extensions3DChromium.cpp
deleted file mode 100644
index 84ad0f78a..000000000
--- a/Source/WebKit/chromium/src/Extensions3DChromium.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEBGL)
-
-#include "Extensions3DChromium.h"
-
-#include "GraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
-
-namespace WebCore {
-
-Extensions3DChromium::Extensions3DChromium(GraphicsContext3DPrivate* priv)
- : m_private(priv)
-{
-}
-
-Extensions3DChromium::~Extensions3DChromium()
-{
-}
-
-bool Extensions3DChromium::supports(const String& name)
-{
- return m_private->supportsExtension(name);
-}
-
-void Extensions3DChromium::ensureEnabled(const String& name)
-{
-#ifndef NDEBUG
- bool result =
-#endif
- m_private->ensureExtensionEnabled(name);
- ASSERT(result);
-}
-
-bool Extensions3DChromium::isEnabled(const String& name)
-{
- return m_private->isExtensionEnabled(name);
-}
-
-int Extensions3DChromium::getGraphicsResetStatusARB()
-{
- return static_cast<int>(m_private->getGraphicsResetStatusARB());
-}
-
-void Extensions3DChromium::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
-{
- m_private->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-void Extensions3DChromium::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
-{
- m_private->renderbufferStorageMultisampleCHROMIUM(target, samples, internalformat, width, height);
-}
-
-void Extensions3DChromium::postSubBufferCHROMIUM(int x, int y, int width, int height)
-{
- m_private->postSubBufferCHROMIUM(x, y, width, height);
-}
-
-void* Extensions3DChromium::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
-{
- return m_private->mapBufferSubDataCHROMIUM(target, offset, size, access);
-}
-
-void Extensions3DChromium::unmapBufferSubDataCHROMIUM(const void* data)
-{
- m_private->unmapBufferSubDataCHROMIUM(data);
-}
-
-void* Extensions3DChromium::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access)
-{
- return m_private->mapTexSubImage2DCHROMIUM(target, level, xoffset, yoffset, width, height, format, type, access);
-}
-
-void Extensions3DChromium::unmapTexSubImage2DCHROMIUM(const void* data)
-{
- m_private->unmapTexSubImage2DCHROMIUM(data);
-}
-
-void Extensions3DChromium::setVisibilityCHROMIUM(bool visibility)
-{
- m_private->setVisibilityCHROMIUM(visibility);
-}
-
-void Extensions3DChromium::discardFramebufferEXT(GC3Denum target, GC3Dsizei numAttachments, const GC3Denum* attachments)
-{
- m_private->discardFramebufferEXT(target, numAttachments, attachments);
-}
-
-void Extensions3DChromium::ensureFramebufferCHROMIUM()
-{
- m_private->ensureFramebufferCHROMIUM();
-}
-
-void Extensions3DChromium::setGpuMemoryAllocationChangedCallbackCHROMIUM(PassOwnPtr<GpuMemoryAllocationChangedCallbackCHROMIUM> callback)
-{
- m_private->setGpuMemoryAllocationChangedCallbackCHROMIUM(callback);
-}
-
-Platform3DObject Extensions3DChromium::createVertexArrayOES()
-{
- return 0;
-}
-
-void Extensions3DChromium::deleteVertexArrayOES(Platform3DObject)
-{
-}
-
-GC3Dboolean Extensions3DChromium::isVertexArrayOES(Platform3DObject)
-{
- return 0;
-}
-
-void Extensions3DChromium::bindVertexArrayOES(Platform3DObject)
-{
-}
-
-String Extensions3DChromium::getTranslatedShaderSourceANGLE(Platform3DObject shader)
-{
- return m_private->getTranslatedShaderSourceANGLE(shader);
-}
-
-void Extensions3DChromium::setSwapBuffersCompleteCallbackCHROMIUM(PassOwnPtr<SwapBuffersCompleteCallbackCHROMIUM> callback)
-{
- m_private->setSwapBuffersCompleteCallbackCHROMIUM(callback);
-}
-
-void Extensions3DChromium::rateLimitOffscreenContextCHROMIUM()
-{
- m_private->rateLimitOffscreenContextCHROMIUM();
-}
-
-void Extensions3DChromium::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer)
-{
- m_private->paintFramebufferToCanvas(framebuffer, width, height, premultiplyAlpha, imageBuffer);
-}
-
-void Extensions3DChromium::texImageIOSurface2DCHROMIUM(unsigned target, int width, int height, uint32_t ioSurfaceId, unsigned plane)
-{
- m_private->texImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane);
-}
-
-void Extensions3DChromium::texStorage2DEXT(unsigned int target, int levels, unsigned int internalFormat, int width, int height)
-{
- m_private->texStorage2DEXT(target, levels, internalFormat, width, height);
-}
-
-Platform3DObject Extensions3DChromium::createQueryEXT()
-{
- return m_private->createQueryEXT();
-}
-
-void Extensions3DChromium::deleteQueryEXT(Platform3DObject query)
-{
- m_private->deleteQueryEXT(query);
-}
-
-GC3Dboolean Extensions3DChromium::isQueryEXT(Platform3DObject query)
-{
- return m_private->isQueryEXT(query);
-}
-
-void Extensions3DChromium::beginQueryEXT(GC3Denum target, Platform3DObject query)
-{
- m_private->beginQueryEXT(target, query);
-}
-
-void Extensions3DChromium::endQueryEXT(GC3Denum target)
-{
- m_private->endQueryEXT(target);
-}
-
-void Extensions3DChromium::getQueryivEXT(GC3Denum target, GC3Denum pname, GC3Dint* params)
-{
- m_private->getQueryivEXT(target, pname, params);
-}
-
-void Extensions3DChromium::getQueryObjectuivEXT(Platform3DObject query, GC3Denum pname, GC3Duint* params)
-{
- m_private->getQueryObjectuivEXT(query, pname, params);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGL)
diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index de3f22789..b67798e74 100644
--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -239,24 +239,6 @@ bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings,
return enabledPerSettings;
}
-bool FrameLoaderClientImpl::allowShadowDOM(bool enabledAsRuntimeFeature)
-{
- WebViewImpl* webview = m_webFrame->viewImpl();
- if (webview && webview->permissionClient())
- return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature);
-
- return enabledAsRuntimeFeature;
-}
-
-bool FrameLoaderClientImpl::allowStyleScoped(bool enabledAsRuntimeFeature)
-{
- WebViewImpl* webview = m_webFrame->viewImpl();
- if (webview && webview->permissionClient())
- return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature);
-
- return enabledAsRuntimeFeature;
-}
-
void FrameLoaderClientImpl::didNotAllowScript()
{
WebViewImpl* webview = m_webFrame->viewImpl();
@@ -1401,8 +1383,8 @@ void FrameLoaderClientImpl::setTitle(const StringWithDirection& title, const KUR
String FrameLoaderClientImpl::userAgent(const KURL& url)
{
- WebString override;
- if (m_webFrame->client()->userAgent(WebURL(url), &override))
+ WebString override = m_webFrame->client()->userAgentOverride(m_webFrame, WebURL(url));
+ if (!override.isEmpty())
return override;
return WebKit::Platform::current()->userAgent(url);
diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
index 236a01b65..ecb20a2fb 100644
--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -199,8 +199,6 @@ public:
virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL);
virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&);
virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&);
- virtual bool allowShadowDOM(bool enabledAsRuntimeFeature) OVERRIDE;
- virtual bool allowStyleScoped(bool enabledAsRuntimeFeature) OVERRIDE;
virtual void didNotAllowScript();
virtual void didNotAllowPlugins();
diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
deleted file mode 100644
index 3ef8cf8a2..000000000
--- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
+++ /dev/null
@@ -1,1353 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEBGL)
-
-#include "GraphicsContext3D.h"
-
-#include "DrawingBuffer.h"
-#include "Extensions3DChromium.h"
-#include "GrContext.h"
-#include "GrGLInterface.h"
-#include "GraphicsContext3DPrivate.h"
-#include "ImageBuffer.h"
-#include "ImageData.h"
-#include <public/Platform.h>
-#include <public/WebGraphicsContext3D.h>
-
-#include <stdio.h>
-#include <wtf/FastMalloc.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringHash.h>
-
-
-namespace {
-
-// The limit of the number of textures we hold in the GrContext's bitmap->texture cache.
-const int maxGaneshTextureCacheCount = 512;
-// The limit of the bytes allocated toward textures in the GrContext's bitmap->texture cache.
-const size_t maxGaneshTextureCacheBytes = 96 * 1024 * 1024;
-
-}
-
-// There are two levels of delegation in this file:
-//
-// 1. GraphicsContext3D delegates to GraphicsContext3DPrivate. This is done
-// so that we have some place to store data members common among
-// implementations; GraphicsContext3D only provides us the m_private
-// pointer. We always delegate to the GraphicsContext3DPrivate. While we
-// could sidestep it and go directly to the WebGraphicsContext3D in some
-// cases, it is better for consistency to always delegate through it.
-//
-// 2. GraphicsContext3DPrivate delegates to an implementation of
-// WebGraphicsContext3D. This is done so we have a place to inject an
-// implementation which remotes the OpenGL calls across processes.
-
-namespace WebCore {
-
-//----------------------------------------------------------------------
-// GraphicsContext3DPrivate
-
-GraphicsContext3DPrivate::GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, bool preserveDrawingBuffer)
- : m_impl(webContext)
- , m_initializedAvailableExtensions(false)
- , m_layerComposited(false)
- , m_preserveDrawingBuffer(preserveDrawingBuffer)
- , m_resourceSafety(ResourceSafetyUnknown)
- , m_grContext(0)
-{
-}
-
-GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
-{
- if (m_grContext) {
- m_grContext->contextDestroyed();
- GrSafeUnref(m_grContext);
- }
-}
-
-PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::RenderStyle renderStyle, bool preserveDrawingBuffer)
-{
- bool renderDirectlyToHostWindow = renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow;
-
- RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(GraphicsContext3D::Attributes(), 0, renderDirectlyToHostWindow));
-
- OwnPtr<GraphicsContext3DPrivate> priv = adoptPtr(new GraphicsContext3DPrivate(webContext, preserveDrawingBuffer));
- context->m_private = priv.release();
- return context.release();
-}
-
-namespace {
-
-void getDrawingParameters(DrawingBuffer* drawingBuffer, WebKit::WebGraphicsContext3D* graphicsContext3D,
- Platform3DObject* frameBufferId, int* width, int* height)
-{
- if (drawingBuffer) {
- *frameBufferId = drawingBuffer->framebuffer();
- *width = drawingBuffer->size().width();
- *height = drawingBuffer->size().height();
- } else {
- *frameBufferId = 0;
- *width = graphicsContext3D->width();
- *height = graphicsContext3D->height();
- }
-}
-
-} // anonymous namespace
-
-WebKit::WebGraphicsContext3D* GraphicsContext3DPrivate::extractWebGraphicsContext3D(GraphicsContext3D* context)
-{
- if (!context)
- return 0;
- return context->m_private->m_impl.get();
-}
-
-PlatformGraphicsContext3D GraphicsContext3DPrivate::platformGraphicsContext3D() const
-{
- return m_impl.get();
-}
-
-Platform3DObject GraphicsContext3DPrivate::platformTexture() const
-{
- return m_impl->getPlatformTextureId();
-}
-
-class GrMemoryAllocationChangedCallback : public Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM {
-public:
- GrMemoryAllocationChangedCallback(GraphicsContext3DPrivate* context)
- : m_context(context)
- {
- }
-
- virtual void onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
- {
- GrContext* context = m_context->grContext();
- if (!context)
- return;
-
- if (!allocation.gpuResourceSizeInBytes) {
- context->freeGpuResources();
- context->setTextureCacheLimits(0, 0);
- } else
- context->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes);
- }
-
-private:
- GraphicsContext3DPrivate* m_context;
-};
-
-GrContext* GraphicsContext3DPrivate::grContext()
-{
- if (!m_grContext) {
- SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
- m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get()));
- if (m_grContext) {
- m_grContext->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes);
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(getExtensions());
- if (extensions3DChromium->supports("GL_CHROMIUM_gpu_memory_manager"))
- extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(adoptPtr(new GrMemoryAllocationChangedCallback(this)));
- }
- }
- return m_grContext;
-}
-
-void GraphicsContext3DPrivate::prepareTexture()
-{
- m_impl->prepareTexture();
-}
-
-void GraphicsContext3DPrivate::markContextChanged()
-{
- m_layerComposited = false;
-}
-
-void GraphicsContext3DPrivate::markLayerComposited()
-{
- m_layerComposited = true;
-}
-
-bool GraphicsContext3DPrivate::layerComposited() const
-{
- return m_layerComposited;
-}
-
-void GraphicsContext3DPrivate::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer)
-{
- unsigned char* pixels = 0;
- size_t bufferSize = 4 * width * height;
-
- const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap();
- const SkBitmap* readbackBitmap = 0;
- ASSERT(canvasBitmap->config() == SkBitmap::kARGB_8888_Config);
- if (canvasBitmap->width() == width && canvasBitmap->height() == height) {
- // This is the fastest and most common case. We read back
- // directly into the canvas's backing store.
- readbackBitmap = canvasBitmap;
- m_resizingBitmap.reset();
- } else {
- // We need to allocate a temporary bitmap for reading back the
- // pixel data. We will then use Skia to rescale this bitmap to
- // the size of the canvas's backing store.
- if (m_resizingBitmap.width() != width || m_resizingBitmap.height() != height) {
- m_resizingBitmap.setConfig(SkBitmap::kARGB_8888_Config,
- width,
- height);
- if (!m_resizingBitmap.allocPixels())
- return;
- }
- readbackBitmap = &m_resizingBitmap;
- }
-
- // Read back the frame buffer.
- SkAutoLockPixels bitmapLock(*readbackBitmap);
- pixels = static_cast<unsigned char*>(readbackBitmap->getPixels());
-
- m_impl->readBackFramebuffer(pixels, 4 * width * height, framebuffer, width, height);
-
- if (premultiplyAlpha) {
- for (size_t i = 0; i < bufferSize; i += 4) {
- pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255);
- pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255);
- pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255);
- }
- }
-
- readbackBitmap->notifyPixelsChanged();
- if (m_resizingBitmap.readyToDraw()) {
- // We need to draw the resizing bitmap into the canvas's backing store.
- SkCanvas canvas(*canvasBitmap);
- SkRect dst;
- dst.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(canvasBitmap->width()), SkIntToScalar(canvasBitmap->height()));
- canvas.drawBitmapRect(m_resizingBitmap, 0, dst);
- }
-}
-
-void GraphicsContext3DPrivate::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer)
-{
- Platform3DObject framebufferId;
- int width, height;
- getDrawingParameters(drawingBuffer, m_impl.get(), &framebufferId, &width, &height);
- paintFramebufferToCanvas(framebufferId, width, height, !m_impl->getContextAttributes().premultipliedAlpha, imageBuffer);
-}
-
-bool GraphicsContext3DPrivate::paintCompositedResultsToCanvas(ImageBuffer*)
-{
- return false;
-}
-
-PassRefPtr<ImageData> GraphicsContext3DPrivate::paintRenderingResultsToImageData(DrawingBuffer* drawingBuffer)
-{
- if (m_impl->getContextAttributes().premultipliedAlpha)
- return 0;
-
- Platform3DObject framebufferId;
- int width, height;
- getDrawingParameters(drawingBuffer, m_impl.get(), &framebufferId, &width, &height);
-
- RefPtr<ImageData> imageData = ImageData::create(IntSize(width, height));
- unsigned char* pixels = imageData->data()->data();
- size_t bufferSize = 4 * width * height;
-
- m_impl->readBackFramebuffer(pixels, bufferSize, framebufferId, width, height);
-
- for (size_t i = 0; i < bufferSize; i += 4)
- std::swap(pixels[i], pixels[i + 2]);
-
- return imageData.release();
-}
-
-void GraphicsContext3DPrivate::reshape(int width, int height)
-{
- if (width == m_impl->width() && height == m_impl->height())
- return;
-
- m_impl->reshape(width, height);
-}
-
-IntSize GraphicsContext3DPrivate::getInternalFramebufferSize() const
-{
- return IntSize(m_impl->width(), m_impl->height());
-}
-
-bool GraphicsContext3DPrivate::isContextLost()
-{
- return m_impl->isContextLost();
-}
-
-// Macros to assist in delegating from GraphicsContext3DPrivate to
-// WebGraphicsContext3D.
-
-#define DELEGATE_TO_IMPL(name) \
-void GraphicsContext3DPrivate::name() \
-{ \
- m_impl->name(); \
-}
-
-#define DELEGATE_TO_IMPL_R(name, rt) \
-rt GraphicsContext3DPrivate::name() \
-{ \
- return m_impl->name(); \
-}
-
-#define DELEGATE_TO_IMPL_1(name, t1) \
-void GraphicsContext3DPrivate::name(t1 a1) \
-{ \
- m_impl->name(a1); \
-}
-
-#define DELEGATE_TO_IMPL_1R(name, t1, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1) \
-{ \
- return m_impl->name(a1); \
-}
-
-#define DELEGATE_TO_IMPL_2(name, t1, t2) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2) \
-{ \
- m_impl->name(a1, a2); \
-}
-
-#define DELEGATE_TO_IMPL_2R(name, t1, t2, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2) \
-{ \
- return m_impl->name(a1, a2); \
-}
-
-#define DELEGATE_TO_IMPL_3(name, t1, t2, t3) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3) \
-{ \
- m_impl->name(a1, a2, a3); \
-}
-
-#define DELEGATE_TO_IMPL_3R(name, t1, t2, t3, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3) \
-{ \
- return m_impl->name(a1, a2, a3); \
-}
-
-#define DELEGATE_TO_IMPL_4(name, t1, t2, t3, t4) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- m_impl->name(a1, a2, a3, a4); \
-}
-
-#define DELEGATE_TO_IMPL_4R(name, t1, t2, t3, t4, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- return m_impl->name(a1, a2, a3, a4); \
-}
-
-#define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5); \
-}
-
-#define DELEGATE_TO_IMPL_5R(name, t1, t2, t3, t4, t5, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
-{ \
- return m_impl->name(a1, a2, a3, a4, a5); \
-}
-
-#define DELEGATE_TO_IMPL_6(name, t1, t2, t3, t4, t5, t6) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5, a6); \
-}
-
-#define DELEGATE_TO_IMPL_6R(name, t1, t2, t3, t4, t5, t6, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \
-{ \
- return m_impl->name(a1, a2, a3, a4, a5, a6); \
-}
-
-#define DELEGATE_TO_IMPL_7(name, t1, t2, t3, t4, t5, t6, t7) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5, a6, a7); \
-}
-
-#define DELEGATE_TO_IMPL_7R(name, t1, t2, t3, t4, t5, t6, t7, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \
-{ \
- return m_impl->name(a1, a2, a3, a4, a5, a6, a7); \
-}
-
-#define DELEGATE_TO_IMPL_8(name, t1, t2, t3, t4, t5, t6, t7, t8) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8); \
-}
-
-#define DELEGATE_TO_IMPL_9(name, t1, t2, t3, t4, t5, t6, t7, t8, t9) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
-}
-
-#define DELEGATE_TO_IMPL_9R(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, rt) \
-rt GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \
-{ \
- return m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
-}
-
-#define DELEGATE_TO_IMPL_10(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) \
-void GraphicsContext3DPrivate::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9, t10 a10) \
-{ \
- m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); \
-}
-
-DELEGATE_TO_IMPL_R(makeContextCurrent, bool)
-
-bool GraphicsContext3DPrivate::isGLES2Compliant() const
-{
- return m_impl->isGLES2Compliant();
-}
-
-DELEGATE_TO_IMPL_1(activeTexture, GC3Denum)
-DELEGATE_TO_IMPL_2(attachShader, Platform3DObject, Platform3DObject)
-
-void GraphicsContext3DPrivate::bindAttribLocation(Platform3DObject program, GC3Duint index, const String& name)
-{
- m_impl->bindAttribLocation(program, index, name.utf8().data());
-}
-
-DELEGATE_TO_IMPL_2(bindBuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_2(bindFramebuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_2(bindRenderbuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_2(bindTexture, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_4(blendColor, GC3Dclampf, GC3Dclampf, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_IMPL_1(blendEquation, GC3Denum)
-DELEGATE_TO_IMPL_2(blendEquationSeparate, GC3Denum, GC3Denum)
-DELEGATE_TO_IMPL_2(blendFunc, GC3Denum, GC3Denum)
-DELEGATE_TO_IMPL_4(blendFuncSeparate, GC3Denum, GC3Denum, GC3Denum, GC3Denum)
-
-void GraphicsContext3DPrivate::bufferData(GC3Denum target, GC3Dsizeiptr size, GC3Denum usage)
-{
- m_impl->bufferData(target, size, 0, usage);
-}
-
-void GraphicsContext3DPrivate::bufferData(GC3Denum target, GC3Dsizeiptr size, const void* data, GC3Denum usage)
-{
- m_impl->bufferData(target, size, data, usage);
-}
-
-void GraphicsContext3DPrivate::bufferSubData(GC3Denum target, GC3Dintptr offset, GC3Dsizeiptr size, const void* data)
-{
- m_impl->bufferSubData(target, offset, size, data);
-}
-
-DELEGATE_TO_IMPL_1R(checkFramebufferStatus, GC3Denum, GC3Denum)
-DELEGATE_TO_IMPL_1(clear, GC3Dbitfield)
-DELEGATE_TO_IMPL_4(clearColor, GC3Dclampf, GC3Dclampf, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_IMPL_1(clearDepth, GC3Dclampf)
-DELEGATE_TO_IMPL_1(clearStencil, GC3Dint)
-DELEGATE_TO_IMPL_4(colorMask, GC3Dboolean, GC3Dboolean, GC3Dboolean, GC3Dboolean)
-DELEGATE_TO_IMPL_1(compileShader, Platform3DObject)
-
-DELEGATE_TO_IMPL_8(compressedTexImage2D, GC3Denum, GC3Dint, GC3Denum, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, const void*)
-DELEGATE_TO_IMPL_9(compressedTexSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Denum, GC3Dsizei, const void*)
-DELEGATE_TO_IMPL_8(copyTexImage2D, GC3Denum, GC3Dint, GC3Denum, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Dint)
-DELEGATE_TO_IMPL_8(copyTexSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-DELEGATE_TO_IMPL_1(cullFace, GC3Denum)
-DELEGATE_TO_IMPL_1(depthFunc, GC3Denum)
-DELEGATE_TO_IMPL_1(depthMask, GC3Dboolean)
-DELEGATE_TO_IMPL_2(depthRange, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_IMPL_2(detachShader, Platform3DObject, Platform3DObject)
-DELEGATE_TO_IMPL_1(disable, GC3Denum)
-DELEGATE_TO_IMPL_1(disableVertexAttribArray, GC3Duint)
-DELEGATE_TO_IMPL_3(drawArrays, GC3Denum, GC3Dint, GC3Dsizei)
-DELEGATE_TO_IMPL_4(drawElements, GC3Denum, GC3Dsizei, GC3Denum, GC3Dsizeiptr)
-
-DELEGATE_TO_IMPL_1(enable, GC3Denum)
-DELEGATE_TO_IMPL_1(enableVertexAttribArray, GC3Duint)
-DELEGATE_TO_IMPL(finish)
-DELEGATE_TO_IMPL(flush)
-DELEGATE_TO_IMPL_4(framebufferRenderbuffer, GC3Denum, GC3Denum, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_5(framebufferTexture2D, GC3Denum, GC3Denum, GC3Denum, Platform3DObject, GC3Dint)
-DELEGATE_TO_IMPL_1(frontFace, GC3Denum)
-DELEGATE_TO_IMPL_1(generateMipmap, GC3Denum)
-
-bool GraphicsContext3DPrivate::getActiveAttrib(Platform3DObject program, GC3Duint index, ActiveInfo& info)
-{
- WebKit::WebGraphicsContext3D::ActiveInfo webInfo;
- if (!m_impl->getActiveAttrib(program, index, webInfo))
- return false;
- info.name = webInfo.name;
- info.type = webInfo.type;
- info.size = webInfo.size;
- return true;
-}
-
-bool GraphicsContext3DPrivate::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info)
-{
- WebKit::WebGraphicsContext3D::ActiveInfo webInfo;
- if (!m_impl->getActiveUniform(program, index, webInfo))
- return false;
- info.name = webInfo.name;
- info.type = webInfo.type;
- info.size = webInfo.size;
- return true;
-}
-
-DELEGATE_TO_IMPL_4(getAttachedShaders, Platform3DObject, GC3Dsizei, GC3Dsizei*, Platform3DObject*)
-
-GC3Dint GraphicsContext3DPrivate::getAttribLocation(Platform3DObject program, const String& name)
-{
- return m_impl->getAttribLocation(program, name.utf8().data());
-}
-
-DELEGATE_TO_IMPL_2(getBooleanv, GC3Denum, GC3Dboolean*)
-
-DELEGATE_TO_IMPL_3(getBufferParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-
-GraphicsContext3D::Attributes GraphicsContext3DPrivate::getContextAttributes()
-{
- WebKit::WebGraphicsContext3D::Attributes webAttributes = m_impl->getContextAttributes();
- GraphicsContext3D::Attributes attributes;
- attributes.alpha = webAttributes.alpha;
- attributes.depth = webAttributes.depth;
- attributes.stencil = webAttributes.stencil;
- attributes.antialias = webAttributes.antialias;
- attributes.premultipliedAlpha = webAttributes.premultipliedAlpha;
- attributes.preserveDrawingBuffer = m_preserveDrawingBuffer;
- attributes.preferDiscreteGPU = webAttributes.preferDiscreteGPU;
- return attributes;
-}
-
-DELEGATE_TO_IMPL_R(getError, GC3Denum)
-
-DELEGATE_TO_IMPL_2(getFloatv, GC3Denum, GC3Dfloat*)
-
-DELEGATE_TO_IMPL_4(getFramebufferAttachmentParameteriv, GC3Denum, GC3Denum, GC3Denum, GC3Dint*)
-
-DELEGATE_TO_IMPL_2(getIntegerv, GC3Denum, GC3Dint*)
-
-DELEGATE_TO_IMPL_3(getProgramiv, Platform3DObject, GC3Denum, GC3Dint*)
-
-String GraphicsContext3DPrivate::getProgramInfoLog(Platform3DObject program)
-{
- return m_impl->getProgramInfoLog(program);
-}
-
-DELEGATE_TO_IMPL_3(getRenderbufferParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-
-DELEGATE_TO_IMPL_3(getShaderiv, Platform3DObject, GC3Denum, GC3Dint*)
-
-String GraphicsContext3DPrivate::getShaderInfoLog(Platform3DObject shader)
-{
- return m_impl->getShaderInfoLog(shader);
-}
-
-DELEGATE_TO_IMPL_4(getShaderPrecisionFormat, GC3Denum, GC3Denum, GC3Dint*, GC3Dint*)
-
-String GraphicsContext3DPrivate::getShaderSource(Platform3DObject shader)
-{
- return m_impl->getShaderSource(shader);
-}
-
-String GraphicsContext3DPrivate::getString(GC3Denum name)
-{
- return m_impl->getString(name);
-}
-
-DELEGATE_TO_IMPL_3(getTexParameterfv, GC3Denum, GC3Denum, GC3Dfloat*)
-DELEGATE_TO_IMPL_3(getTexParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-
-DELEGATE_TO_IMPL_3(getUniformfv, Platform3DObject, GC3Dint, GC3Dfloat*)
-DELEGATE_TO_IMPL_3(getUniformiv, Platform3DObject, GC3Dint, GC3Dint*)
-
-GC3Dint GraphicsContext3DPrivate::getUniformLocation(Platform3DObject program, const String& name)
-{
- return m_impl->getUniformLocation(program, name.utf8().data());
-}
-
-DELEGATE_TO_IMPL_3(getVertexAttribfv, GC3Duint, GC3Denum, GC3Dfloat*)
-DELEGATE_TO_IMPL_3(getVertexAttribiv, GC3Duint, GC3Denum, GC3Dint*)
-
-DELEGATE_TO_IMPL_2R(getVertexAttribOffset, GC3Duint, GC3Denum, GC3Dsizeiptr)
-
-DELEGATE_TO_IMPL_2(hint, GC3Denum, GC3Denum)
-DELEGATE_TO_IMPL_1R(isBuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isEnabled, GC3Denum, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isFramebuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isProgram, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isRenderbuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isShader, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1R(isTexture, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_1(lineWidth, GC3Dfloat)
-DELEGATE_TO_IMPL_1(linkProgram, Platform3DObject)
-DELEGATE_TO_IMPL_2(pixelStorei, GC3Denum, GC3Dint)
-DELEGATE_TO_IMPL_2(polygonOffset, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_IMPL_7(readPixels, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, void*)
-DELEGATE_TO_IMPL(releaseShaderCompiler)
-DELEGATE_TO_IMPL_4(renderbufferStorage, GC3Denum, GC3Denum, GC3Dsizei, GC3Dsizei)
-DELEGATE_TO_IMPL_2(sampleCoverage, GC3Dclampf, GC3Dboolean)
-DELEGATE_TO_IMPL_4(scissor, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-
-void GraphicsContext3DPrivate::shaderSource(Platform3DObject shader, const String& string)
-{
- m_impl->shaderSource(shader, string.utf8().data());
-}
-
-DELEGATE_TO_IMPL_3(stencilFunc, GC3Denum, GC3Dint, GC3Duint)
-DELEGATE_TO_IMPL_4(stencilFuncSeparate, GC3Denum, GC3Denum, GC3Dint, GC3Duint)
-DELEGATE_TO_IMPL_1(stencilMask, GC3Duint)
-DELEGATE_TO_IMPL_2(stencilMaskSeparate, GC3Denum, GC3Duint)
-DELEGATE_TO_IMPL_3(stencilOp, GC3Denum, GC3Denum, GC3Denum)
-DELEGATE_TO_IMPL_4(stencilOpSeparate, GC3Denum, GC3Denum, GC3Denum, GC3Denum)
-
-bool GraphicsContext3DPrivate::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels)
-{
- m_impl->texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
- return true;
-}
-
-DELEGATE_TO_IMPL_3(texParameterf, GC3Denum, GC3Denum, GC3Dfloat)
-DELEGATE_TO_IMPL_3(texParameteri, GC3Denum, GC3Denum, GC3Dint)
-
-void GraphicsContext3DPrivate::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels)
-{
- m_impl->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-DELEGATE_TO_IMPL_2(uniform1f, GC3Dint, GC3Dfloat)
-
-void GraphicsContext3DPrivate::uniform1fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v)
-{
- m_impl->uniform1fv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_2(uniform1i, GC3Dint, GC3Dint)
-
-void GraphicsContext3DPrivate::uniform1iv(GC3Dint location, GC3Dsizei size, GC3Dint* v)
-{
- m_impl->uniform1iv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_3(uniform2f, GC3Dint, GC3Dfloat, GC3Dfloat)
-
-void GraphicsContext3DPrivate::uniform2fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v)
-{
- m_impl->uniform2fv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_3(uniform2i, GC3Dint, GC3Dint, GC3Dint)
-
-void GraphicsContext3DPrivate::uniform2iv(GC3Dint location, GC3Dsizei size, GC3Dint* v)
-{
- m_impl->uniform2iv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_4(uniform3f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-
-void GraphicsContext3DPrivate::uniform3fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v)
-{
- m_impl->uniform3fv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_4(uniform3i, GC3Dint, GC3Dint, GC3Dint, GC3Dint)
-
-void GraphicsContext3DPrivate::uniform3iv(GC3Dint location, GC3Dsizei size, GC3Dint* v)
-{
- m_impl->uniform3iv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_5(uniform4f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-
-void GraphicsContext3DPrivate::uniform4fv(GC3Dint location, GC3Dsizei size, GC3Dfloat* v)
-{
- m_impl->uniform4fv(location, size, v);
-}
-
-DELEGATE_TO_IMPL_5(uniform4i, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint)
-
-void GraphicsContext3DPrivate::uniform4iv(GC3Dint location, GC3Dsizei size, GC3Dint* v)
-{
- m_impl->uniform4iv(location, size, v);
-}
-
-void GraphicsContext3DPrivate::uniformMatrix2fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value)
-{
- m_impl->uniformMatrix2fv(location, size, transpose, value);
-}
-
-void GraphicsContext3DPrivate::uniformMatrix3fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value)
-{
- m_impl->uniformMatrix3fv(location, size, transpose, value);
-}
-
-void GraphicsContext3DPrivate::uniformMatrix4fv(GC3Dint location, GC3Dsizei size, GC3Dboolean transpose, GC3Dfloat* value)
-{
- m_impl->uniformMatrix4fv(location, size, transpose, value);
-}
-
-DELEGATE_TO_IMPL_1(useProgram, Platform3DObject)
-DELEGATE_TO_IMPL_1(validateProgram, Platform3DObject)
-
-DELEGATE_TO_IMPL_2(vertexAttrib1f, GC3Duint, GC3Dfloat)
-DELEGATE_TO_IMPL_2(vertexAttrib1fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_IMPL_3(vertexAttrib2f, GC3Duint, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_IMPL_2(vertexAttrib2fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_IMPL_4(vertexAttrib3f, GC3Duint, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_IMPL_2(vertexAttrib3fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_IMPL_5(vertexAttrib4f, GC3Duint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_IMPL_2(vertexAttrib4fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_IMPL_6(vertexAttribPointer, GC3Duint, GC3Dint, GC3Denum, GC3Dboolean, GC3Dsizei, GC3Dsizeiptr)
-
-DELEGATE_TO_IMPL_4(viewport, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-
-DELEGATE_TO_IMPL_R(createBuffer, Platform3DObject)
-DELEGATE_TO_IMPL_R(createFramebuffer, Platform3DObject)
-DELEGATE_TO_IMPL_R(createProgram, Platform3DObject)
-DELEGATE_TO_IMPL_R(createRenderbuffer, Platform3DObject)
-DELEGATE_TO_IMPL_1R(createShader, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_R(createTexture, Platform3DObject)
-
-DELEGATE_TO_IMPL_1(deleteBuffer, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteFramebuffer, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteProgram, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteRenderbuffer, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteShader, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteTexture, Platform3DObject)
-
-DELEGATE_TO_IMPL_1(synthesizeGLError, GC3Denum)
-
-Extensions3D* GraphicsContext3DPrivate::getExtensions()
-{
- if (!m_extensions)
- m_extensions = adoptPtr(new Extensions3DChromium(this));
- return m_extensions.get();
-}
-
-bool GraphicsContext3DPrivate::isResourceSafe()
-{
- if (m_resourceSafety == ResourceSafetyUnknown)
- m_resourceSafety = getExtensions()->isEnabled("GL_CHROMIUM_resource_safe") ? ResourceSafe : ResourceUnsafe;
- return m_resourceSafety == ResourceSafe;
-}
-
-namespace {
-
-void splitStringHelper(const String& str, HashSet<String>& set)
-{
- Vector<String> substrings;
- str.split(" ", substrings);
- for (size_t i = 0; i < substrings.size(); ++i)
- set.add(substrings[i]);
-}
-
-String mapExtensionName(const String& name)
-{
- if (name == "GL_ANGLE_framebuffer_blit"
- || name == "GL_ANGLE_framebuffer_multisample")
- return "GL_CHROMIUM_framebuffer_multisample";
- return name;
-}
-
-} // anonymous namespace
-
-void GraphicsContext3DPrivate::initializeExtensions()
-{
- if (m_initializedAvailableExtensions)
- return;
-
- m_initializedAvailableExtensions = true;
- bool success = makeContextCurrent();
- ASSERT(success);
- if (!success)
- return;
-
- String extensionsString = getString(GraphicsContext3D::EXTENSIONS);
- splitStringHelper(extensionsString, m_enabledExtensions);
-
- String requestableExtensionsString = m_impl->getRequestableExtensionsCHROMIUM();
- splitStringHelper(requestableExtensionsString, m_requestableExtensions);
-}
-
-
-bool GraphicsContext3DPrivate::supportsExtension(const String& name)
-{
- initializeExtensions();
- String mappedName = mapExtensionName(name);
- return m_enabledExtensions.contains(mappedName) || m_requestableExtensions.contains(mappedName);
-}
-
-bool GraphicsContext3DPrivate::ensureExtensionEnabled(const String& name)
-{
- initializeExtensions();
-
- String mappedName = mapExtensionName(name);
- if (m_enabledExtensions.contains(mappedName))
- return true;
-
- if (m_requestableExtensions.contains(mappedName)) {
- m_impl->requestExtensionCHROMIUM(mappedName.ascii().data());
- m_enabledExtensions.clear();
- m_requestableExtensions.clear();
- m_initializedAvailableExtensions = false;
- }
-
- initializeExtensions();
- return m_enabledExtensions.contains(mappedName);
-}
-
-bool GraphicsContext3DPrivate::isExtensionEnabled(const String& name)
-{
- initializeExtensions();
- String mappedName = mapExtensionName(name);
- return m_enabledExtensions.contains(mappedName);
-}
-
-DELEGATE_TO_IMPL_4(postSubBufferCHROMIUM, int, int, int, int)
-
-DELEGATE_TO_IMPL_4R(mapBufferSubDataCHROMIUM, GC3Denum, GC3Dsizeiptr, GC3Dsizei, GC3Denum, void*)
-DELEGATE_TO_IMPL_1(unmapBufferSubDataCHROMIUM, const void*)
-DELEGATE_TO_IMPL_9R(mapTexSubImage2DCHROMIUM, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, GC3Denum, void*)
-DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*)
-
-DELEGATE_TO_IMPL_1(setVisibilityCHROMIUM, bool);
-
-DELEGATE_TO_IMPL_3(discardFramebufferEXT, GC3Denum, GC3Dsizei, const GC3Denum*);
-DELEGATE_TO_IMPL(ensureFramebufferCHROMIUM);
-
-DELEGATE_TO_IMPL_10(blitFramebufferCHROMIUM, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dbitfield, GC3Denum)
-DELEGATE_TO_IMPL_5(renderbufferStorageMultisampleCHROMIUM, GC3Denum, GC3Dsizei, GC3Denum, GC3Dsizei, GC3Dsizei)
-
-DELEGATE_TO_IMPL(rateLimitOffscreenContextCHROMIUM)
-DELEGATE_TO_IMPL_R(getGraphicsResetStatusARB, GC3Denum)
-
-DELEGATE_TO_IMPL_1R(getTranslatedShaderSourceANGLE, Platform3DObject, String)
-DELEGATE_TO_IMPL_5(texImageIOSurface2DCHROMIUM, GC3Denum, GC3Dint, GC3Dint, GC3Duint, GC3Duint)
-DELEGATE_TO_IMPL_5(texStorage2DEXT, GC3Denum, GC3Dint, GC3Duint, GC3Dint, GC3Dint)
-
-DELEGATE_TO_IMPL_R(createQueryEXT, Platform3DObject)
-DELEGATE_TO_IMPL_1(deleteQueryEXT, Platform3DObject)
-DELEGATE_TO_IMPL_1R(isQueryEXT, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_IMPL_2(beginQueryEXT, GC3Denum, Platform3DObject)
-DELEGATE_TO_IMPL_1(endQueryEXT, GC3Denum)
-DELEGATE_TO_IMPL_3(getQueryivEXT, GC3Denum, GC3Denum, GC3Dint*)
-DELEGATE_TO_IMPL_3(getQueryObjectuivEXT, Platform3DObject, GC3Denum, GC3Duint*)
-
-//----------------------------------------------------------------------
-// GraphicsContext3D
-//
-
-// Macros to assist in delegating from GraphicsContext3D to
-// GraphicsContext3DPrivate.
-
-#define DELEGATE_TO_INTERNAL(name) \
-void GraphicsContext3D::name() \
-{ \
- m_private->name(); \
-}
-
-#define DELEGATE_TO_INTERNAL_R(name, rt) \
-rt GraphicsContext3D::name() \
-{ \
- return m_private->name(); \
-}
-
-#define DELEGATE_TO_INTERNAL_1(name, t1) \
-void GraphicsContext3D::name(t1 a1) \
-{ \
- m_private->name(a1); \
-}
-
-#define DELEGATE_TO_INTERNAL_1R(name, t1, rt) \
-rt GraphicsContext3D::name(t1 a1) \
-{ \
- return m_private->name(a1); \
-}
-
-#define DELEGATE_TO_INTERNAL_2(name, t1, t2) \
-void GraphicsContext3D::name(t1 a1, t2 a2) \
-{ \
- m_private->name(a1, a2); \
-}
-
-#define DELEGATE_TO_INTERNAL_2R(name, t1, t2, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2) \
-{ \
- return m_private->name(a1, a2); \
-}
-
-#define DELEGATE_TO_INTERNAL_3(name, t1, t2, t3) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \
-{ \
- m_private->name(a1, a2, a3); \
-}
-
-#define DELEGATE_TO_INTERNAL_3R(name, t1, t2, t3, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \
-{ \
- return m_private->name(a1, a2, a3); \
-}
-
-#define DELEGATE_TO_INTERNAL_4(name, t1, t2, t3, t4) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- m_private->name(a1, a2, a3, a4); \
-}
-
-#define DELEGATE_TO_INTERNAL_4R(name, t1, t2, t3, t4, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- return m_private->name(a1, a2, a3, a4); \
-}
-
-#define DELEGATE_TO_INTERNAL_5(name, t1, t2, t3, t4, t5) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
-{ \
- m_private->name(a1, a2, a3, a4, a5); \
-}
-
-#define DELEGATE_TO_INTERNAL_6(name, t1, t2, t3, t4, t5, t6) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \
-{ \
- m_private->name(a1, a2, a3, a4, a5, a6); \
-}
-
-#define DELEGATE_TO_INTERNAL_6R(name, t1, t2, t3, t4, t5, t6, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \
-{ \
- return m_private->name(a1, a2, a3, a4, a5, a6); \
-}
-
-#define DELEGATE_TO_INTERNAL_7(name, t1, t2, t3, t4, t5, t6, t7) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \
-{ \
- m_private->name(a1, a2, a3, a4, a5, a6, a7); \
-}
-
-#define DELEGATE_TO_INTERNAL_7R(name, t1, t2, t3, t4, t5, t6, t7, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7) \
-{ \
- return m_private->name(a1, a2, a3, a4, a5, a6, a7); \
-}
-
-#define DELEGATE_TO_INTERNAL_8(name, t1, t2, t3, t4, t5, t6, t7, t8) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \
-{ \
- m_private->name(a1, a2, a3, a4, a5, a6, a7, a8); \
-}
-
-#define DELEGATE_TO_INTERNAL_9(name, t1, t2, t3, t4, t5, t6, t7, t8, t9) \
-void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \
-{ \
- m_private->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
-}
-
-#define DELEGATE_TO_INTERNAL_9R(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, rt) \
-rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9) \
-{ \
- return m_private->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \
-}
-
-GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*, bool)
-{
-}
-
-GraphicsContext3D::~GraphicsContext3D()
-{
- m_private->setContextLostCallback(nullptr);
- m_private->setErrorMessageCallback(nullptr);
- m_private->setSwapBuffersCompleteCallbackCHROMIUM(nullptr);
- m_private->setGpuMemoryAllocationChangedCallbackCHROMIUM(nullptr);
-}
-
-PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
-{
- ASSERT(renderStyle != GraphicsContext3D::RenderDirectlyToHostWindow);
-
- WebKit::WebGraphicsContext3D::Attributes webAttributes;
- webAttributes.alpha = attrs.alpha;
- webAttributes.depth = attrs.depth;
- webAttributes.stencil = attrs.stencil;
- webAttributes.antialias = attrs.antialias;
- webAttributes.premultipliedAlpha = attrs.premultipliedAlpha;
- webAttributes.noExtensions = attrs.noExtensions;
- webAttributes.shareResources = attrs.shareResources;
- webAttributes.preferDiscreteGPU = attrs.preferDiscreteGPU;
-
- OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::Platform::current()->createOffscreenGraphicsContext3D(webAttributes));
- if (!webContext)
- return 0;
-
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), renderStyle, attrs.preserveDrawingBuffer);
-}
-
-PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const
-{
- return m_private->platformGraphicsContext3D();
-}
-
-Platform3DObject GraphicsContext3D::platformTexture() const
-{
- return m_private->platformTexture();
-}
-
-GrContext* GraphicsContext3D::grContext()
-{
- return m_private->grContext();
-}
-
-void GraphicsContext3D::prepareTexture()
-{
- return m_private->prepareTexture();
-}
-
-IntSize GraphicsContext3D::getInternalFramebufferSize() const
-{
- return m_private->getInternalFramebufferSize();
-}
-
-bool GraphicsContext3D::isResourceSafe()
-{
- return m_private->isResourceSafe();
-}
-
-#if USE(ACCELERATED_COMPOSITING)
-PlatformLayer* GraphicsContext3D::platformLayer() const
-{
- return 0;
-}
-#endif
-
-DELEGATE_TO_INTERNAL_R(makeContextCurrent, bool)
-DELEGATE_TO_INTERNAL_2(reshape, int, int)
-
-DELEGATE_TO_INTERNAL_1(activeTexture, GC3Denum)
-DELEGATE_TO_INTERNAL_2(attachShader, Platform3DObject, Platform3DObject)
-DELEGATE_TO_INTERNAL_3(bindAttribLocation, Platform3DObject, GC3Duint, const String&)
-
-DELEGATE_TO_INTERNAL_2(bindBuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_2(bindFramebuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_2(bindRenderbuffer, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_2(bindTexture, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_4(blendColor, GC3Dclampf, GC3Dclampf, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_INTERNAL_1(blendEquation, GC3Denum)
-DELEGATE_TO_INTERNAL_2(blendEquationSeparate, GC3Denum, GC3Denum)
-DELEGATE_TO_INTERNAL_2(blendFunc, GC3Denum, GC3Denum)
-DELEGATE_TO_INTERNAL_4(blendFuncSeparate, GC3Denum, GC3Denum, GC3Denum, GC3Denum)
-
-DELEGATE_TO_INTERNAL_3(bufferData, GC3Denum, GC3Dsizeiptr, GC3Denum)
-DELEGATE_TO_INTERNAL_4(bufferData, GC3Denum, GC3Dsizeiptr, const void*, GC3Denum)
-DELEGATE_TO_INTERNAL_4(bufferSubData, GC3Denum, GC3Dintptr, GC3Dsizeiptr, const void*)
-
-DELEGATE_TO_INTERNAL_1R(checkFramebufferStatus, GC3Denum, GC3Denum)
-DELEGATE_TO_INTERNAL_1(clear, GC3Dbitfield)
-DELEGATE_TO_INTERNAL_4(clearColor, GC3Dclampf, GC3Dclampf, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_INTERNAL_1(clearDepth, GC3Dclampf)
-DELEGATE_TO_INTERNAL_1(clearStencil, GC3Dint)
-DELEGATE_TO_INTERNAL_4(colorMask, GC3Dboolean, GC3Dboolean, GC3Dboolean, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1(compileShader, Platform3DObject)
-
-DELEGATE_TO_INTERNAL_8(compressedTexImage2D, GC3Denum, GC3Dint, GC3Denum, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, const void*)
-DELEGATE_TO_INTERNAL_9(compressedTexSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Denum, GC3Dsizei, const void*)
-DELEGATE_TO_INTERNAL_8(copyTexImage2D, GC3Denum, GC3Dint, GC3Denum, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Dint)
-DELEGATE_TO_INTERNAL_8(copyTexSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-DELEGATE_TO_INTERNAL_1(cullFace, GC3Denum)
-DELEGATE_TO_INTERNAL_1(depthFunc, GC3Denum)
-DELEGATE_TO_INTERNAL_1(depthMask, GC3Dboolean)
-DELEGATE_TO_INTERNAL_2(depthRange, GC3Dclampf, GC3Dclampf)
-DELEGATE_TO_INTERNAL_2(detachShader, Platform3DObject, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(disable, GC3Denum)
-DELEGATE_TO_INTERNAL_1(disableVertexAttribArray, GC3Duint)
-DELEGATE_TO_INTERNAL_3(drawArrays, GC3Denum, GC3Dint, GC3Dsizei)
-DELEGATE_TO_INTERNAL_4(drawElements, GC3Denum, GC3Dsizei, GC3Denum, GC3Dintptr)
-
-DELEGATE_TO_INTERNAL_1(enable, GC3Denum)
-DELEGATE_TO_INTERNAL_1(enableVertexAttribArray, GC3Duint)
-DELEGATE_TO_INTERNAL(finish)
-DELEGATE_TO_INTERNAL(flush)
-DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, GC3Denum, GC3Denum, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_5(framebufferTexture2D, GC3Denum, GC3Denum, GC3Denum, Platform3DObject, GC3Dint)
-DELEGATE_TO_INTERNAL_1(frontFace, GC3Denum)
-DELEGATE_TO_INTERNAL_1(generateMipmap, GC3Denum)
-
-DELEGATE_TO_INTERNAL_3R(getActiveAttrib, Platform3DObject, GC3Duint, ActiveInfo&, bool)
-DELEGATE_TO_INTERNAL_3R(getActiveUniform, Platform3DObject, GC3Duint, ActiveInfo&, bool)
-DELEGATE_TO_INTERNAL_4(getAttachedShaders, Platform3DObject, GC3Dsizei, GC3Dsizei*, Platform3DObject*)
-DELEGATE_TO_INTERNAL_2R(getAttribLocation, Platform3DObject, const String&, GC3Dint)
-DELEGATE_TO_INTERNAL_2(getBooleanv, GC3Denum, GC3Dboolean*)
-DELEGATE_TO_INTERNAL_3(getBufferParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_R(getContextAttributes, GraphicsContext3D::Attributes)
-DELEGATE_TO_INTERNAL_R(getError, GC3Denum)
-DELEGATE_TO_INTERNAL_2(getFloatv, GC3Denum, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_4(getFramebufferAttachmentParameteriv, GC3Denum, GC3Denum, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_2(getIntegerv, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_3(getProgramiv, Platform3DObject, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, Platform3DObject, String)
-DELEGATE_TO_INTERNAL_3(getRenderbufferParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_3(getShaderiv, Platform3DObject, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, Platform3DObject, String)
-DELEGATE_TO_INTERNAL_4(getShaderPrecisionFormat, GC3Denum, GC3Denum, GC3Dint*, GC3Dint*)
-DELEGATE_TO_INTERNAL_1R(getShaderSource, Platform3DObject, String)
-DELEGATE_TO_INTERNAL_1R(getString, GC3Denum, String)
-DELEGATE_TO_INTERNAL_3(getTexParameterfv, GC3Denum, GC3Denum, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_3(getTexParameteriv, GC3Denum, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_3(getUniformfv, Platform3DObject, GC3Dint, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_3(getUniformiv, Platform3DObject, GC3Dint, GC3Dint*)
-DELEGATE_TO_INTERNAL_2R(getUniformLocation, Platform3DObject, const String&, GC3Dint)
-DELEGATE_TO_INTERNAL_3(getVertexAttribfv, GC3Duint, GC3Denum, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_3(getVertexAttribiv, GC3Duint, GC3Denum, GC3Dint*)
-DELEGATE_TO_INTERNAL_2R(getVertexAttribOffset, GC3Duint, GC3Denum, GC3Dsizeiptr)
-
-DELEGATE_TO_INTERNAL_2(hint, GC3Denum, GC3Denum)
-DELEGATE_TO_INTERNAL_1R(isBuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isEnabled, GC3Denum, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isFramebuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isProgram, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isRenderbuffer, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isShader, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1R(isTexture, Platform3DObject, GC3Dboolean)
-DELEGATE_TO_INTERNAL_1(lineWidth, GC3Dfloat)
-DELEGATE_TO_INTERNAL_1(linkProgram, Platform3DObject)
-DELEGATE_TO_INTERNAL_2(pixelStorei, GC3Denum, GC3Dint)
-DELEGATE_TO_INTERNAL_2(polygonOffset, GC3Dfloat, GC3Dfloat)
-
-DELEGATE_TO_INTERNAL_7(readPixels, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, void*)
-
-DELEGATE_TO_INTERNAL(releaseShaderCompiler)
-DELEGATE_TO_INTERNAL_4(renderbufferStorage, GC3Denum, GC3Denum, GC3Dsizei, GC3Dsizei)
-DELEGATE_TO_INTERNAL_2(sampleCoverage, GC3Dclampf, GC3Dboolean)
-DELEGATE_TO_INTERNAL_4(scissor, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-DELEGATE_TO_INTERNAL_2(shaderSource, Platform3DObject, const String&)
-DELEGATE_TO_INTERNAL_3(stencilFunc, GC3Denum, GC3Dint, GC3Duint)
-DELEGATE_TO_INTERNAL_4(stencilFuncSeparate, GC3Denum, GC3Denum, GC3Dint, GC3Duint)
-DELEGATE_TO_INTERNAL_1(stencilMask, GC3Duint)
-DELEGATE_TO_INTERNAL_2(stencilMaskSeparate, GC3Denum, GC3Duint)
-DELEGATE_TO_INTERNAL_3(stencilOp, GC3Denum, GC3Denum, GC3Denum)
-DELEGATE_TO_INTERNAL_4(stencilOpSeparate, GC3Denum, GC3Denum, GC3Denum, GC3Denum)
-
-DELEGATE_TO_INTERNAL_9R(texImage2D, GC3Denum, GC3Dint, GC3Denum, GC3Dsizei, GC3Dsizei, GC3Dint, GC3Denum, GC3Denum, const void*, bool)
-DELEGATE_TO_INTERNAL_3(texParameterf, GC3Denum, GC3Denum, GC3Dfloat)
-DELEGATE_TO_INTERNAL_3(texParameteri, GC3Denum, GC3Denum, GC3Dint)
-DELEGATE_TO_INTERNAL_9(texSubImage2D, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, const void*)
-
-DELEGATE_TO_INTERNAL_2(uniform1f, GC3Dint, GC3Dfloat)
-DELEGATE_TO_INTERNAL_3(uniform1fv, GC3Dint, GC3Dsizei, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_2(uniform1i, GC3Dint, GC3Dint)
-DELEGATE_TO_INTERNAL_3(uniform1iv, GC3Dint, GC3Dsizei, GC3Dint*)
-DELEGATE_TO_INTERNAL_3(uniform2f, GC3Dint, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_3(uniform2fv, GC3Dint, GC3Dsizei, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_3(uniform2i, GC3Dint, GC3Dint, GC3Dint)
-DELEGATE_TO_INTERNAL_3(uniform2iv, GC3Dint, GC3Dsizei, GC3Dint*)
-DELEGATE_TO_INTERNAL_4(uniform3f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_3(uniform3fv, GC3Dint, GC3Dsizei, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_4(uniform3i, GC3Dint, GC3Dint, GC3Dint, GC3Dint)
-DELEGATE_TO_INTERNAL_3(uniform3iv, GC3Dint, GC3Dsizei, GC3Dint*)
-DELEGATE_TO_INTERNAL_5(uniform4f, GC3Dint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_3(uniform4fv, GC3Dint, GC3Dsizei, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_5(uniform4i, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint)
-DELEGATE_TO_INTERNAL_3(uniform4iv, GC3Dint, GC3Dsizei, GC3Dint*)
-DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, GC3Dint, GC3Dsizei, GC3Dboolean, GC3Dfloat*)
-
-DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject)
-
-DELEGATE_TO_INTERNAL_2(vertexAttrib1f, GC3Duint, GC3Dfloat)
-DELEGATE_TO_INTERNAL_2(vertexAttrib1fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_3(vertexAttrib2f, GC3Duint, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_2(vertexAttrib2fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_4(vertexAttrib3f, GC3Duint, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_2(vertexAttrib3fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_5(vertexAttrib4f, GC3Duint, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat)
-DELEGATE_TO_INTERNAL_2(vertexAttrib4fv, GC3Duint, GC3Dfloat*)
-DELEGATE_TO_INTERNAL_6(vertexAttribPointer, GC3Duint, GC3Dint, GC3Denum, GC3Dboolean, GC3Dsizei, GC3Dintptr)
-
-DELEGATE_TO_INTERNAL_4(viewport, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
-
-DELEGATE_TO_INTERNAL(markLayerComposited)
-DELEGATE_TO_INTERNAL(markContextChanged)
-
-bool GraphicsContext3D::layerComposited() const
-{
- return m_private->layerComposited();
-}
-
-void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer)
-{
- return m_private->paintRenderingResultsToCanvas(imageBuffer, drawingBuffer);
-}
-
-PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(DrawingBuffer* drawingBuffer)
-{
- return m_private->paintRenderingResultsToImageData(drawingBuffer);
-}
-
-DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, ImageBuffer*, bool)
-
-DELEGATE_TO_INTERNAL_R(createBuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_R(createFramebuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_R(createProgram, Platform3DObject)
-DELEGATE_TO_INTERNAL_R(createRenderbuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_1R(createShader, GC3Denum, Platform3DObject)
-DELEGATE_TO_INTERNAL_R(createTexture, Platform3DObject)
-
-DELEGATE_TO_INTERNAL_1(deleteBuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(deleteFramebuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(deleteProgram, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(deleteRenderbuffer, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(deleteShader, Platform3DObject)
-DELEGATE_TO_INTERNAL_1(deleteTexture, Platform3DObject)
-
-DELEGATE_TO_INTERNAL_1(synthesizeGLError, GC3Denum)
-DELEGATE_TO_INTERNAL_R(getExtensions, Extensions3D*)
-
-DELEGATE_TO_INTERNAL_1(setContextLostCallback, PassOwnPtr<GraphicsContext3D::ContextLostCallback>)
-DELEGATE_TO_INTERNAL_1(setErrorMessageCallback, PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>)
-
-class GraphicsContextLostCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
-public:
- virtual void onContextLost();
- static PassOwnPtr<GraphicsContextLostCallbackAdapter> create(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
- virtual ~GraphicsContextLostCallbackAdapter() { }
-private:
- GraphicsContextLostCallbackAdapter(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb) : m_contextLostCallback(cb) { }
- OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback;
-};
-
-void GraphicsContextLostCallbackAdapter::onContextLost()
-{
- if (m_contextLostCallback)
- m_contextLostCallback->onContextLost();
-}
-
-PassOwnPtr<GraphicsContextLostCallbackAdapter> GraphicsContextLostCallbackAdapter::create(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb)
-{
- return adoptPtr(cb.get() ? new GraphicsContextLostCallbackAdapter(cb) : 0);
-}
-
-void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb)
-{
- m_contextLostCallbackAdapter = GraphicsContextLostCallbackAdapter::create(cb);
- m_impl->setContextLostCallback(m_contextLostCallbackAdapter.get());
-}
-
-class GraphicsErrorMessageCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsErrorMessageCallback {
-public:
- virtual void onErrorMessage(const WebKit::WebString&, WebKit::WGC3Dint);
- static PassOwnPtr<GraphicsErrorMessageCallbackAdapter> create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>);
- virtual ~GraphicsErrorMessageCallbackAdapter() { }
-private:
- GraphicsErrorMessageCallbackAdapter(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb) : m_errorMessageCallback(cb) { }
- OwnPtr<GraphicsContext3D::ErrorMessageCallback> m_errorMessageCallback;
-};
-
-void GraphicsErrorMessageCallbackAdapter::onErrorMessage(const WebKit::WebString& message, WebKit::WGC3Dint id)
-{
- if (m_errorMessageCallback)
- m_errorMessageCallback->onErrorMessage(message, id);
-}
-
-PassOwnPtr<GraphicsErrorMessageCallbackAdapter> GraphicsErrorMessageCallbackAdapter::create(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb)
-{
- return adoptPtr(cb.get() ? new GraphicsErrorMessageCallbackAdapter(cb) : 0);
-}
-
-void GraphicsContext3DPrivate::setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> cb)
-{
- m_errorMessageCallbackAdapter = GraphicsErrorMessageCallbackAdapter::create(cb);
- m_impl->setErrorMessageCallback(m_errorMessageCallbackAdapter.get());
-}
-
-bool GraphicsContext3D::isGLES2Compliant() const
-{
- return m_private->isGLES2Compliant();
-}
-
-class GraphicsContext3DSwapBuffersCompleteCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM {
-public:
- virtual void onSwapBuffersComplete();
- static PassOwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> create(PassOwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM>);
- virtual ~GraphicsContext3DSwapBuffersCompleteCallbackAdapter() { }
-
-private:
- GraphicsContext3DSwapBuffersCompleteCallbackAdapter(PassOwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM> cb) : m_swapBuffersCompleteCallback(cb) { }
- OwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM> m_swapBuffersCompleteCallback;
-};
-
-void GraphicsContext3DSwapBuffersCompleteCallbackAdapter::onSwapBuffersComplete()
-{
- if (m_swapBuffersCompleteCallback)
- m_swapBuffersCompleteCallback->onSwapBuffersComplete();
-}
-
-PassOwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> GraphicsContext3DSwapBuffersCompleteCallbackAdapter::create(PassOwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM> cb)
-{
- return adoptPtr(cb.get() ? new GraphicsContext3DSwapBuffersCompleteCallbackAdapter(cb) : 0);
-}
-
-void GraphicsContext3DPrivate::setSwapBuffersCompleteCallbackCHROMIUM(PassOwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM> cb)
-{
- m_swapBuffersCompleteCallbackAdapter = GraphicsContext3DSwapBuffersCompleteCallbackAdapter::create(cb);
- m_impl->setSwapBuffersCompleteCallbackCHROMIUM(m_swapBuffersCompleteCallbackAdapter.get());
-}
-
-class GraphicsContext3DMemoryAllocationChangedCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM {
-public:
- GraphicsContext3DMemoryAllocationChangedCallbackAdapter(PassOwnPtr<Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM> cb)
- : m_memoryAllocationChangedCallback(cb)
- {
- }
-
- virtual ~GraphicsContext3DMemoryAllocationChangedCallbackAdapter() { }
-
- virtual void onMemoryAllocationChanged(size_t gpuResourceSizeInBytes)
- {
- // FIXME: Remove this once clients start using WebGraphicsMemoryAllocation exclusively.
- onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation(gpuResourceSizeInBytes, true));
- }
-
- virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation allocation)
- {
- if (m_memoryAllocationChangedCallback)
- m_memoryAllocationChangedCallback->onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM(allocation.gpuResourceSizeInBytes, allocation.suggestHaveBackbuffer));
- }
-
-private:
- OwnPtr<Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM> m_memoryAllocationChangedCallback;
-};
-
-void GraphicsContext3DPrivate::setGpuMemoryAllocationChangedCallbackCHROMIUM(PassOwnPtr<Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM> cb)
-{
- m_memoryAllocationChangedCallbackAdapter = adoptPtr(new GraphicsContext3DMemoryAllocationChangedCallbackAdapter(cb));
- m_impl->setMemoryAllocationChangedCallbackCHROMIUM(m_memoryAllocationChangedCallbackAdapter.get());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGL)
diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h
deleted file mode 100644
index a269192a4..000000000
--- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GraphicsContext3DPrivate_h
-#define GraphicsContext3DPrivate_h
-
-#include "Extensions3DChromium.h"
-#include "GraphicsContext3D.h"
-#include "SkBitmap.h"
-#include <wtf/HashSet.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/OwnPtr.h>
-
-class GrContext;
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace WebCore {
-
-class DrawingBuffer;
-class Extensions3DChromium;
-class GraphicsContextLostCallbackAdapter;
-class GraphicsContext3DSwapBuffersCompleteCallbackAdapter;
-class GraphicsErrorMessageCallbackAdapter;
-class GraphicsContext3DMemoryAllocationChangedCallbackAdapter;
-
-class GraphicsContext3DPrivate {
-public:
- // Callers must make the context current before using it AND check that the context was created successfully
- // via ContextLost before using the context in any way. Once made current on a thread, the context cannot
- // be used on any other thread.
- static PassRefPtr<GraphicsContext3D> createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::RenderStyle, bool preserveDrawingBuffer = false);
-
- virtual ~GraphicsContext3DPrivate();
-
- // Helper function to provide access to the lower-level WebGraphicsContext3D,
- // which is needed for subordinate contexts like WebGL's to share resources
- // with the compositor's context.
- static WebKit::WebGraphicsContext3D* extractWebGraphicsContext3D(GraphicsContext3D*);
-
- PlatformGraphicsContext3D platformGraphicsContext3D() const;
- Platform3DObject platformTexture() const;
- GrContext* grContext();
-
- bool makeContextCurrent();
-
- void reshape(int width, int height);
- IntSize getInternalFramebufferSize() const;
- bool isResourceSafe();
-
- void markContextChanged();
- bool layerComposited() const;
- void markLayerComposited();
-
- void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*);
- void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*);
- PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
- bool paintCompositedResultsToCanvas(ImageBuffer*);
-
- void prepareTexture();
-
- // CHROMIUM_post_sub_buffer
- void postSubBufferCHROMIUM(int x, int y, int width, int height);
-
- bool isGLES2Compliant() const;
-
- void releaseShaderCompiler();
- bool isContextLost();
-
- //----------------------------------------------------------------------
- // Entry points for WebGL.
- //
- void activeTexture(GC3Denum texture);
- void attachShader(Platform3DObject program, Platform3DObject shader);
- void bindAttribLocation(Platform3DObject, GC3Duint index, const String& name);
- void bindBuffer(GC3Denum target, Platform3DObject);
- void bindFramebuffer(GC3Denum target, Platform3DObject);
- void bindRenderbuffer(GC3Denum target, Platform3DObject);
- void bindTexture(GC3Denum target, Platform3DObject);
- void blendColor(GC3Dclampf red, GC3Dclampf green, GC3Dclampf blue, GC3Dclampf alpha);
- void blendEquation(GC3Denum mode);
- void blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha);
- void blendFunc(GC3Denum sfactor, GC3Denum dfactor);
- void blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha);
-
- void bufferData(GC3Denum target, GC3Dsizeiptr, GC3Denum usage);
- void bufferData(GC3Denum target, GC3Dsizeiptr, const void* data, GC3Denum usage);
- void bufferSubData(GC3Denum target, GC3Dintptr offset, GC3Dsizeiptr, const void* data);
-
- GC3Denum checkFramebufferStatus(GC3Denum target);
- void clear(GC3Dbitfield mask);
- void clearColor(GC3Dclampf red, GC3Dclampf green, GC3Dclampf blue, GC3Dclampf alpha);
- void clearDepth(GC3Dclampf depth);
- void clearStencil(GC3Dint s);
- void colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha);
- void compileShader(Platform3DObject);
-
- void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Dsizei imageSize, const void* data);
- void compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Dsizei imageSize, const void* data);
- void copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border);
- void copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
- void cullFace(GC3Denum mode);
- void depthFunc(GC3Denum func);
- void depthMask(GC3Dboolean flag);
- void depthRange(GC3Dclampf zNear, GC3Dclampf zFar);
- void detachShader(Platform3DObject, Platform3DObject);
- void disable(GC3Denum cap);
- void disableVertexAttribArray(GC3Duint index);
- void drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count);
- void drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset);
-
- void enable(GC3Denum cap);
- void enableVertexAttribArray(GC3Duint index);
- void finish();
- void flush();
- void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, Platform3DObject);
- void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, Platform3DObject, GC3Dint level);
- void frontFace(GC3Denum mode);
- void generateMipmap(GC3Denum target);
-
- bool getActiveAttrib(Platform3DObject program, GC3Duint index, ActiveInfo&);
- bool getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo&);
- void getAttachedShaders(Platform3DObject program, GC3Dsizei maxCount, GC3Dsizei* count, Platform3DObject* shaders);
- GC3Dint getAttribLocation(Platform3DObject, const String& name);
- void getBooleanv(GC3Denum pname, GC3Dboolean* value);
- void getBufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value);
- GraphicsContext3D::Attributes getContextAttributes();
- GC3Denum getError();
- void getFloatv(GC3Denum pname, GC3Dfloat* value);
- void getFramebufferAttachmentParameteriv(GC3Denum target, GC3Denum attachment, GC3Denum pname, GC3Dint* value);
- void getIntegerv(GC3Denum pname, GC3Dint* value);
- void getProgramiv(Platform3DObject program, GC3Denum pname, GC3Dint* value);
- String getProgramInfoLog(Platform3DObject);
- void getRenderbufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value);
- void getShaderiv(Platform3DObject, GC3Denum pname, GC3Dint* value);
- String getShaderInfoLog(Platform3DObject);
- void getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, GC3Dint* range, GC3Dint* precision);
-
- String getShaderSource(Platform3DObject);
- String getString(GC3Denum name);
- void getTexParameterfv(GC3Denum target, GC3Denum pname, GC3Dfloat* value);
- void getTexParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value);
- void getUniformfv(Platform3DObject program, GC3Dint location, GC3Dfloat* value);
- void getUniformiv(Platform3DObject program, GC3Dint location, GC3Dint* value);
- GC3Dint getUniformLocation(Platform3DObject, const String& name);
- void getVertexAttribfv(GC3Duint index, GC3Denum pname, GC3Dfloat* value);
- void getVertexAttribiv(GC3Duint index, GC3Denum pname, GC3Dint* value);
- GC3Dsizeiptr getVertexAttribOffset(GC3Duint index, GC3Denum pname);
-
- void hint(GC3Denum target, GC3Denum mode);
- GC3Dboolean isBuffer(Platform3DObject);
- GC3Dboolean isEnabled(GC3Denum cap);
- GC3Dboolean isFramebuffer(Platform3DObject);
- GC3Dboolean isProgram(Platform3DObject);
- GC3Dboolean isRenderbuffer(Platform3DObject);
- GC3Dboolean isShader(Platform3DObject);
- GC3Dboolean isTexture(Platform3DObject);
- void lineWidth(GC3Dfloat);
- void linkProgram(Platform3DObject);
- void pixelStorei(GC3Denum pname, GC3Dint param);
- void polygonOffset(GC3Dfloat factor, GC3Dfloat units);
-
- void readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data);
-
- void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);
- void sampleCoverage(GC3Dclampf value, GC3Dboolean invert);
- void scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
- void shaderSource(Platform3DObject, const String&);
- void stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask);
- void stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask);
- void stencilMask(GC3Duint mask);
- void stencilMaskSeparate(GC3Denum face, GC3Duint mask);
- void stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass);
- void stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass);
-
- // texImage2D return false on any error rather than using an ExceptionCode.
- bool texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels);
- void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param);
- void texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param);
- void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels);
-
- void uniform1f(GC3Dint location, GC3Dfloat x);
- void uniform1fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v);
- void uniform1i(GC3Dint location, GC3Dint x);
- void uniform1iv(GC3Dint location, GC3Dsizei, GC3Dint* v);
- void uniform2f(GC3Dint location, GC3Dfloat x, float y);
- void uniform2fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v);
- void uniform2i(GC3Dint location, GC3Dint x, GC3Dint y);
- void uniform2iv(GC3Dint location, GC3Dsizei, GC3Dint* v);
- void uniform3f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
- void uniform3fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v);
- void uniform3i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z);
- void uniform3iv(GC3Dint location, GC3Dsizei, GC3Dint* v);
- void uniform4f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
- void uniform4fv(GC3Dint location, GC3Dsizei, GC3Dfloat* v);
- void uniform4i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w);
- void uniform4iv(GC3Dint location, GC3Dsizei, GC3Dint* v);
- void uniformMatrix2fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value);
- void uniformMatrix3fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value);
- void uniformMatrix4fv(GC3Dint location, GC3Dsizei, GC3Dboolean transpose, GC3Dfloat* value);
-
- void useProgram(Platform3DObject);
- void validateProgram(Platform3DObject);
-
- void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
- void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values);
- void vertexAttrib2f(GC3Duint index, GC3Dfloat x, GC3Dfloat y);
- void vertexAttrib2fv(GC3Duint index, GC3Dfloat* values);
- void vertexAttrib3f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
- void vertexAttrib3fv(GC3Duint index, GC3Dfloat* values);
- void vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
- void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values);
- void vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized,
- GC3Dsizei stride, GC3Dintptr offset);
-
- void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
-
- Platform3DObject createBuffer();
- Platform3DObject createFramebuffer();
- Platform3DObject createProgram();
- Platform3DObject createRenderbuffer();
- Platform3DObject createShader(GC3Denum);
- Platform3DObject createTexture();
-
- void deleteBuffer(Platform3DObject);
- void deleteFramebuffer(Platform3DObject);
- void deleteProgram(Platform3DObject);
- void deleteRenderbuffer(Platform3DObject);
- void deleteShader(Platform3DObject);
- void deleteTexture(Platform3DObject);
-
- void synthesizeGLError(GC3Denum error);
-
- void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
- void setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback>);
-
- // Extensions3D support.
- Extensions3D* getExtensions();
- bool supportsExtension(const String& name);
- bool ensureExtensionEnabled(const String& name);
- bool isExtensionEnabled(const String& name);
-
- // EXT_texture_format_BGRA8888
- bool supportsBGRA();
-
- // GL_CHROMIUM_map_sub
- bool supportsMapSubCHROMIUM();
- void* mapBufferSubDataCHROMIUM(GC3Denum target, GC3Dsizeiptr offset, GC3Dsizei, GC3Denum access);
- void unmapBufferSubDataCHROMIUM(const void*);
- void* mapTexSubImage2DCHROMIUM(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Denum access);
- void unmapTexSubImage2DCHROMIUM(const void*);
-
- // GL_CHROMIUM_set_visibility
- void setVisibilityCHROMIUM(bool);
-
- // GL_EXT_discard_framebuffer
- virtual void discardFramebufferEXT(GC3Denum target, GC3Dsizei numAttachments, const GC3Denum* attachments);
- virtual void ensureFramebufferCHROMIUM();
-
- // GL_CHROMIUM_gpu_memory_manager
- void setGpuMemoryAllocationChangedCallbackCHROMIUM(PassOwnPtr<Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM>);
-
- // GL_CHROMIUM_framebuffer_multisample
- void blitFramebufferCHROMIUM(GC3Dint srcX0, GC3Dint srcY0, GC3Dint srcX1, GC3Dint srcY1, GC3Dint dstX0, GC3Dint dstY0, GC3Dint dstX1, GC3Dint dstY1, GC3Dbitfield mask, GC3Denum filter);
- void renderbufferStorageMultisampleCHROMIUM(GC3Denum target, GC3Dsizei samples, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);
-
- // GL_CHROMIUM_swapbuffers_complete_callback
- void setSwapBuffersCompleteCallbackCHROMIUM(PassOwnPtr<Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM>);
-
- // GL_CHROMIUM_rate_limit_offscreen_context
- void rateLimitOffscreenContextCHROMIUM();
-
- // GL_ARB_robustness
- GC3Denum getGraphicsResetStatusARB();
-
- // GL_ANGLE_translated_shader_source
- String getTranslatedShaderSourceANGLE(Platform3DObject shader);
-
- // GL_CHROMIUM_iosurface
- void texImageIOSurface2DCHROMIUM(GC3Denum target, GC3Dint width, GC3Dint height, GC3Duint ioSurfaceId, GC3Duint plane);
-
- // GL_EXT_texture_storage
- void texStorage2DEXT(GC3Denum target, GC3Dint levels, GC3Duint internalformat, GC3Dint width, GC3Dint height);
-
- // GL_EXT_occlusion_query
- Platform3DObject createQueryEXT();
- void deleteQueryEXT(Platform3DObject);
- GC3Dboolean isQueryEXT(Platform3DObject);
- void beginQueryEXT(GC3Denum, Platform3DObject);
- void endQueryEXT(GC3Denum);
- void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*);
- void getQueryObjectuivEXT(Platform3DObject, GC3Denum, GC3Duint*);
-
-private:
- GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D>, bool preserveDrawingBuffer);
-
- void initializeExtensions();
-
- OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
- OwnPtr<Extensions3DChromium> m_extensions;
- OwnPtr<GraphicsContextLostCallbackAdapter> m_contextLostCallbackAdapter;
- OwnPtr<GraphicsErrorMessageCallbackAdapter> m_errorMessageCallbackAdapter;
- OwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> m_swapBuffersCompleteCallbackAdapter;
- OwnPtr<GraphicsContext3DMemoryAllocationChangedCallbackAdapter> m_memoryAllocationChangedCallbackAdapter;
- bool m_initializedAvailableExtensions;
- HashSet<String> m_enabledExtensions;
- HashSet<String> m_requestableExtensions;
- bool m_layerComposited;
- bool m_preserveDrawingBuffer;
-
- enum ResourceSafety {
- ResourceSafetyUnknown,
- ResourceSafe,
- ResourceUnsafe
- };
- ResourceSafety m_resourceSafety;
-
- // If the width and height of the Canvas's backing store don't
- // match those that we were given in the most recent call to
- // reshape(), then we need an intermediate bitmap to read back the
- // frame buffer into. This seems to happen when CSS styles are
- // used to resize the Canvas.
- SkBitmap m_resizingBitmap;
-
- GrContext* m_grContext;
-};
-
-} // namespace WebCore
-
-#endif // GraphicsContext3DPrivate_h
diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp
index 6e535499a..58661ebab 100644
--- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp
+++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp
@@ -115,7 +115,7 @@ void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>)
m_webIDBDatabase->close();
}
-void IDBDatabaseBackendProxy::open(PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
+void IDBDatabaseBackendProxy::registerFrontendCallbacks(PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
{
m_webIDBDatabase->open(new WebIDBDatabaseCallbacksImpl(databaseCallbacks));
}
diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h
index b78ac6992..e817edf19 100644
--- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h
+++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h
@@ -52,7 +52,7 @@ public:
virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> transaction(WebCore::DOMStringList* storeNames, unsigned short mode, WebCore::ExceptionCode&);
virtual void close(PassRefPtr<WebCore::IDBDatabaseCallbacks>);
- virtual void open(PassRefPtr<WebCore::IDBDatabaseCallbacks>);
+ virtual void registerFrontendCallbacks(PassRefPtr<WebCore::IDBDatabaseCallbacks>);
private:
IDBDatabaseBackendProxy(PassOwnPtr<WebIDBDatabase>);
diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.cpp b/Source/WebKit/chromium/src/InspectorClientImpl.cpp
index 17bd16111..025876446 100644
--- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp
+++ b/Source/WebKit/chromium/src/InspectorClientImpl.cpp
@@ -33,6 +33,7 @@
#include "DOMWindow.h"
#include "FloatRect.h"
+#include "InspectorInstrumentation.h"
#include "NotImplemented.h"
#include "Page.h"
#include "WebDevToolsAgentImpl.h"
@@ -41,6 +42,7 @@
#include "platform/WebURLRequest.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
+#include <public/Platform.h>
#include <wtf/Vector.h>
using namespace WebCore;
@@ -128,6 +130,16 @@ void InspectorClientImpl::clearBrowserCookies()
agent->clearBrowserCookies();
}
+void InspectorClientImpl::startMainThreadMonitoring()
+{
+ WebKit::Platform::current()->currentThread()->addTaskObserver(this);
+}
+
+void InspectorClientImpl::stopMainThreadMonitoring()
+{
+ WebKit::Platform::current()->currentThread()->removeTaskObserver(this);
+}
+
bool InspectorClientImpl::canOverrideDeviceMetrics()
{
return true;
@@ -150,6 +162,16 @@ bool InspectorClientImpl::supportsFrameInstrumentation()
return true;
}
+void InspectorClientImpl::willProcessTask()
+{
+ InspectorInstrumentation::willProcessTask(m_inspectedWebView->page());
+}
+
+void InspectorClientImpl::didProcessTask()
+{
+ InspectorInstrumentation::didProcessTask(m_inspectedWebView->page());
+}
+
WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
{
return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent());
diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.h b/Source/WebKit/chromium/src/InspectorClientImpl.h
index bdb9b336d..6cb5c5544 100644
--- a/Source/WebKit/chromium/src/InspectorClientImpl.h
+++ b/Source/WebKit/chromium/src/InspectorClientImpl.h
@@ -33,6 +33,7 @@
#include "InspectorClient.h"
#include "InspectorController.h"
+#include "platform/WebThread.h"
#include <wtf/OwnPtr.h>
namespace WebKit {
@@ -41,7 +42,8 @@ class WebDevToolsAgentClient;
class WebDevToolsAgentImpl;
class WebViewImpl;
-class InspectorClientImpl : public WebCore::InspectorClient {
+class InspectorClientImpl : public WebCore::InspectorClient,
+ public WebThread::TaskObserver {
public:
InspectorClientImpl(WebViewImpl*);
~InspectorClientImpl();
@@ -64,6 +66,9 @@ public:
virtual bool canClearBrowserCookies();
virtual void clearBrowserCookies();
+ virtual void startMainThreadMonitoring();
+ virtual void stopMainThreadMonitoring();
+
virtual bool canOverrideDeviceMetrics();
virtual void overrideDeviceMetrics(int, int, float, bool);
virtual void autoZoomPageToFitWidth();
@@ -71,6 +76,10 @@ public:
virtual bool supportsFrameInstrumentation();
private:
+ // WebThread::TaskObserver
+ virtual void willProcessTask();
+ virtual void didProcessTask();
+
WebDevToolsAgentImpl* devToolsAgent();
// The WebViewImpl of the page being inspected; gets passed to the constructor
diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
index af90bad6c..e3f7f1318 100644
--- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
+++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
@@ -50,7 +50,6 @@ namespace WebKit {
InspectorFrontendClientImpl::InspectorFrontendClientImpl(Page* frontendPage, WebDevToolsFrontendClient* client, WebDevToolsFrontendImpl* frontend)
: m_frontendPage(frontendPage)
, m_client(client)
- , m_frontend(frontend)
{
}
diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
index 1aedc1f03..4f66e1bcd 100644
--- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
+++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
@@ -79,7 +79,6 @@ public:
private:
WebCore::Page* m_frontendPage;
WebDevToolsFrontendClient* m_client;
- WebDevToolsFrontendImpl* m_frontend;
RefPtr<WebCore::InspectorFrontendHost> m_frontendHost;
};
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
index 4cc1c1177..2c37209c6 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
@@ -31,13 +31,15 @@
#include "FloatRect.h"
#include "GraphicsLayer.h"
#include "LayerChromium.h"
-#include "LayerPainterChromium.h"
+#include "PlatformContextSkia.h"
+#include "WebViewImpl.h"
#include "cc/CCLayerTreeHost.h"
namespace WebKit {
-NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint)
- : m_contentPaint(contentPaint)
+NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView)
+ : m_webView(webView)
+ , m_opaque(true)
, m_showDebugBorders(false)
, m_deviceScaleFactor(1.0)
{
@@ -62,6 +64,12 @@ void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
m_graphicsLayer->platformLayer()->setBackgroundColor(color);
}
+void NonCompositedContentHost::setOpaque(bool opaque)
+{
+ m_opaque = opaque;
+ m_graphicsLayer->platformLayer()->setOpaque(opaque);
+}
+
void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
{
m_graphicsLayer->setNeedsDisplay();
@@ -93,7 +101,7 @@ static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::Layer
layer->setAlwaysReserveTextures(true);
}
-void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX)
+void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale)
{
if (!scrollLayer())
return;
@@ -101,7 +109,8 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
bool visibleRectChanged = m_viewportSize != viewportSize;
m_viewportSize = viewportSize;
- scrollLayer()->setScrollPosition(scrollPosition);
+
+ scrollLayer()->setScrollPosition(scrollPosition + toSize(scrollOrigin));
scrollLayer()->setPosition(-scrollPosition);
// Due to the possibility of pinch zoom, the noncomposited layer is always
// assumed to be scrollable.
@@ -110,10 +119,14 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
m_graphicsLayer->deviceOrPageScaleFactorChanged();
m_graphicsLayer->setSize(contentsSize);
- m_layerAdjustX = layerAdjustX;
- if (m_graphicsLayer->transform().m41() != m_layerAdjustX) {
+ // In RTL-style pages, the origin of the initial containing block for the
+ // root layer may be positive; translate the layer to avoid negative
+ // coordinates.
+ m_layerAdjust = -toSize(scrollOrigin);
+ if (m_graphicsLayer->transform().m41() != m_layerAdjust.width() || m_graphicsLayer->transform().m42() != m_layerAdjust.height()) {
WebCore::TransformationMatrix transform = m_graphicsLayer->transform();
- transform.setM41(m_layerAdjustX);
+ transform.setM41(m_layerAdjust.width());
+ transform.setM42(m_layerAdjust.height());
m_graphicsLayer->setTransform(transform);
// If a tiled layer is shifted left or right, the content that goes into
@@ -155,10 +168,16 @@ void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*)
void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
{
- context.translate(-m_layerAdjustX, 0);
+ // On non-android platforms, we want to render text with subpixel antialiasing on the root layer
+ // so long as the root is opaque. On android all text is grayscale.
+#if !OS(ANDROID)
+ if (m_opaque)
+ context.platformContext()->setDrawingToImageBuffer(false);
+#endif
+ context.translate(-m_layerAdjust);
WebCore::IntRect adjustedClipRect = clipRect;
- adjustedClipRect.move(m_layerAdjustX, 0);
- m_contentPaint->paint(context, adjustedClipRect);
+ adjustedClipRect.move(m_layerAdjust);
+ m_webView->paintRootLayer(context, adjustedClipRect);
}
void NonCompositedContentHost::setShowDebugBorders(bool showDebugBorders)
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h
index 320e7c1be..9706860d7 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.h
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h
@@ -40,30 +40,31 @@ class GraphicsContext;
class IntPoint;
class IntRect;
class LayerChromium;
-class LayerPainterChromium;
}
namespace WebKit {
+class WebViewImpl;
class NonCompositedContentHost : public WebCore::GraphicsLayerClient {
WTF_MAKE_NONCOPYABLE(NonCompositedContentHost);
public:
- static PassOwnPtr<NonCompositedContentHost> create(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint)
+ static PassOwnPtr<NonCompositedContentHost> create(WebViewImpl* webView)
{
- return adoptPtr(new NonCompositedContentHost(contentPaint));
+ return adoptPtr(new NonCompositedContentHost(webView));
}
virtual ~NonCompositedContentHost();
void invalidateRect(const WebCore::IntRect&);
void setBackgroundColor(const WebCore::Color&);
+ void setOpaque(bool);
void setScrollLayer(WebCore::GraphicsLayer*);
- void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX);
+ void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale);
WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
void setShowDebugBorders(bool);
protected:
- explicit NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint);
+ explicit NonCompositedContentHost(WebViewImpl*);
private:
// GraphicsLayerClient
@@ -81,9 +82,11 @@ private:
WebCore::LayerChromium* scrollLayer();
OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
- OwnPtr<WebCore::LayerPainterChromium> m_contentPaint;
+ WebViewImpl* m_webView;
WebCore::IntSize m_viewportSize;
- int m_layerAdjustX;
+ WebCore::IntSize m_layerAdjust;
+
+ bool m_opaque;
bool m_showDebugBorders;
float m_deviceScaleFactor;
};
diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp
index cb9e95fc3..340e6f1a9 100644
--- a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp
+++ b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp
@@ -82,12 +82,14 @@ void PageWidgetDelegate::layout(Page* page)
view->updateLayoutAndStyleIfNeededRecursive();
}
-void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect)
+void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect, CanvasBackground background)
{
if (rect.isEmpty())
return;
GraphicsContextBuilder builder(canvas);
GraphicsContext& gc = builder.context();
+ gc.platformContext()->setDrawingToImageBuffer(background == Opaque ? false : true);
+ gc.applyDeviceScaleFactor(page->deviceScaleFactor());
IntRect dirtyRect(rect);
gc.save();
FrameView* view = mainFrameView(page);
@@ -153,6 +155,7 @@ bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha
case WebInputEvent::GestureTap:
case WebInputEvent::GestureTapDown:
case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureLongPress:
return handler.handleGestureEvent(*static_cast<const WebGestureEvent*>(&event));
#endif
diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.h b/Source/WebKit/chromium/src/PageWidgetDelegate.h
index dbbe269ac..807e1987b 100644
--- a/Source/WebKit/chromium/src/PageWidgetDelegate.h
+++ b/Source/WebKit/chromium/src/PageWidgetDelegate.h
@@ -73,9 +73,13 @@ public:
// Common implementation of WebViewImpl and WebPagePopupImpl.
class PageWidgetDelegate {
public:
+ enum CanvasBackground {
+ Opaque,
+ Translucent,
+ };
static void animate(WebCore::Page*, double monotonicFrameBeginTime);
static void layout(WebCore::Page*);
- static void paint(WebCore::Page*, PageOverlayList*, WebCanvas*, const WebRect&);
+ static void paint(WebCore::Page*, PageOverlayList*, WebCanvas*, const WebRect&, CanvasBackground);
static bool handleInputEvent(WebCore::Page*, PageWidgetEventHandler&, const WebInputEvent&);
private:
diff --git a/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp b/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp
index 3c7e7113c..cd903c221 100644
--- a/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp
+++ b/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp
@@ -36,9 +36,10 @@
#include "SerializedScriptValue.h"
#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "WebMessagePortChannel.h"
-#include "platform/WebString.h"
+
+#include <public/Platform.h>
+#include <public/WebMessagePortChannel.h>
+#include <public/WebString.h>
using namespace WebKit;
@@ -122,7 +123,7 @@ PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(
PlatformMessagePortChannel::PlatformMessagePortChannel()
: m_localPort(0)
{
- m_webChannel = webKitPlatformSupport()->createMessagePortChannel();
+ m_webChannel = WebKit::Platform::current()->createMessagePortChannel();
if (m_webChannel)
m_webChannel->setClient(this);
}
diff --git a/Source/WebKit/chromium/src/PlatformMessagePortChannel.h b/Source/WebKit/chromium/src/PlatformMessagePortChannel.h
index f674ce635..b1498d4a3 100644
--- a/Source/WebKit/chromium/src/PlatformMessagePortChannel.h
+++ b/Source/WebKit/chromium/src/PlatformMessagePortChannel.h
@@ -31,9 +31,9 @@
#ifndef PlatformMessagePortChannel_h
#define PlatformMessagePortChannel_h
-#include "WebMessagePortChannelClient.h"
#include "MessagePortChannel.h"
+#include <public/WebMessagePortChannelClient.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp
index cfaf097ef..94b26f05a 100644
--- a/Source/WebKit/chromium/src/PlatformSupport.cpp
+++ b/Source/WebKit/chromium/src/PlatformSupport.cpp
@@ -78,7 +78,6 @@
#include "NativeImageSkia.h"
-#include "AsyncFileSystemChromium.h"
#include "BitmapImage.h"
#include "Cookie.h"
#include "Document.h"
@@ -96,7 +95,6 @@
#include <public/WebCookie.h>
#include <public/WebCookieJar.h>
#include <public/WebMimeRegistry.h>
-#include <public/WebWorkerRunLoop.h>
#include <wtf/Assertions.h>
// We are part of the WebKit implementation.
@@ -208,15 +206,6 @@ bool PlatformSupport::cookiesEnabled(const Document* document)
return result;
}
-// File ------------------------------------------------------------------------
-
-#if ENABLE(FILE_SYSTEM)
-PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem()
-{
- return AsyncFileSystemChromium::create();
-}
-#endif
-
// Font -----------------------------------------------------------------------
#if OS(WINDOWS)
@@ -372,18 +361,6 @@ PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size
#endif // ENABLE(WEB_AUDIO)
-// SharedTimers ---------------------------------------------------------------
-
-void PlatformSupport::setSharedTimerFiredFunction(void (*func)())
-{
- webKitPlatformSupport()->setSharedTimerFiredFunction(func);
-}
-
-void PlatformSupport::setSharedTimerFireInterval(double interval)
-{
- webKitPlatformSupport()->setSharedTimerFireInterval(interval);
-}
-
// Theming --------------------------------------------------------------------
#if OS(WINDOWS)
@@ -721,16 +698,6 @@ bool PlatformSupport::popupsAllowed(NPP npp)
}
#if ENABLE(WORKERS)
-void PlatformSupport::didStartWorkerRunLoop(WorkerRunLoop* loop)
-{
- WebKit::Platform::current()->didStartWorkerRunLoop(WebWorkerRunLoop(loop));
-}
-
-void PlatformSupport::didStopWorkerRunLoop(WorkerRunLoop* loop)
-{
- WebKit::Platform::current()->didStopWorkerRunLoop(WebWorkerRunLoop(loop));
-}
-
WorkerContextProxy* WorkerContextProxy::create(Worker* worker)
{
return WebWorkerClientImpl::createWorkerContextProxy(worker);
diff --git a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
index 70b800b5c..d9188ddee 100644
--- a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
+++ b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
@@ -47,15 +47,17 @@
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
#include "WebKit.h"
-#include "WebMessagePortChannel.h"
#include "WebSharedWorker.h"
#include "WebSharedWorkerRepository.h"
#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
#include "WorkerScriptLoader.h"
#include "WorkerScriptLoaderClient.h"
+#include <public/Platform.h>
+#include <public/WebMessagePortChannel.h>
+#include <public/WebString.h>
+#include <public/WebURL.h>
+
namespace WebCore {
class Document;
diff --git a/Source/WebKit/chromium/src/WebCompositorImpl.cpp b/Source/WebKit/chromium/src/WebCompositorImpl.cpp
index 91d8b1be6..f4e96e0be 100644
--- a/Source/WebKit/chromium/src/WebCompositorImpl.cpp
+++ b/Source/WebKit/chromium/src/WebCompositorImpl.cpp
@@ -34,6 +34,7 @@
#include "WebInputEvent.h"
#include "cc/CCLayerTreeHost.h"
#include "cc/CCProxy.h"
+#include "cc/CCSettings.h"
#include <wtf/ThreadingPrimitives.h>
using namespace WebCore;
@@ -51,6 +52,25 @@ void WebCompositor::initialize(WebThread* implThread)
void WebCompositor::shutdown()
{
WebCompositorImpl::shutdown();
+ CCSettings::reset();
+}
+
+void WebCompositor::setPerTilePaintingEnabled(bool enabled)
+{
+ ASSERT(!WebCompositorImpl::initialized());
+ CCSettings::setPerTilePaintingEnabled(enabled);
+}
+
+void WebCompositor::setPartialSwapEnabled(bool enabled)
+{
+ ASSERT(!WebCompositorImpl::initialized());
+ CCSettings::setPartialSwapEnabled(enabled);
+}
+
+void WebCompositor::setAcceleratedAnimationEnabled(bool enabled)
+{
+ ASSERT(!WebCompositorImpl::initialized());
+ CCSettings::setAcceleratedAnimationEnabled(enabled);
}
void WebCompositorImpl::initialize(WebThread* implThread)
diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
index 8e0c613a4..63bf270fe 100644
--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
@@ -191,7 +191,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h
// FIXME: This should be DropEvent, but in cases where we fail to properly sync scrollability it's safer to send the
// event to the main thread. Change back to DropEvent once we have synchronization bugs sorted out.
return DidNotHandle;
- case CCInputHandlerClient::ScrollFailed:
+ case CCInputHandlerClient::ScrollOnMainThread:
return DidNotHandle;
}
} else if (event.type == WebInputEvent::GestureScrollBegin) {
@@ -206,7 +206,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h
case CCInputHandlerClient::ScrollStarted:
m_gestureScrollStarted = true;
return DidHandle;
- case CCInputHandlerClient::ScrollFailed:
+ case CCInputHandlerClient::ScrollOnMainThread:
return DidNotHandle;
case CCInputHandlerClient::ScrollIgnored:
return DropEvent;
@@ -278,8 +278,8 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h
m_inputHandlerClient->scheduleAnimation();
return DidHandle;
}
- case CCInputHandlerClient::ScrollFailed: {
- TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::failed");
+ case CCInputHandlerClient::ScrollOnMainThread: {
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::scrollOnMainThread");
return DidNotHandle;
}
case CCInputHandlerClient::ScrollIgnored: {
diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
index 222fa2fa7..8c8122f6b 100644
--- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
@@ -53,12 +53,13 @@ WebContentLayerImpl::~WebContentLayerImpl()
clearDelegate();
}
-void WebContentLayerImpl::paintContents(GraphicsContext& gc, const IntRect& clip)
+void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, IntRect& opaque)
{
if (!m_contentClient)
return;
- WebCanvas* canvas = gc.platformContext()->canvas();
- m_contentClient->paintContents(canvas, WebRect(clip));
+ WebRect webOpaque;
+ m_contentClient->paintContents(canvas, WebRect(clip), webOpaque);
+ opaque = webOpaque;
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h
index a06cf9082..542bd9b8e 100644
--- a/Source/WebKit/chromium/src/WebContentLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h
@@ -41,7 +41,7 @@ protected:
virtual ~WebContentLayerImpl();
// ContentLayerDelegate implementation.
- virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip);
+ virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::IntRect& opaque);
WebContentLayerClient* m_contentClient;
bool m_drawsContent;
diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 6f72f13fd..7792cf863 100644
--- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -39,7 +39,6 @@
#include "InspectorBackendDispatcher.h"
#include "InspectorController.h"
#include "InspectorFrontend.h"
-#include "InspectorInstrumentation.h"
#include "InspectorProtocolVersion.h"
#include "MemoryCache.h"
#include "Page.h"
@@ -232,10 +231,8 @@ public:
return;
frame->setTextZoomFactor(m_webView->emulatedTextZoomFactor());
- WebSize scaledFrameSize = scaledEmulatedFrameSize(frame->view());
ensureOriginalZoomFactor(frame->view());
- double sizeRatio = static_cast<double>(scaledFrameSize.width) / m_emulatedFrameSize.width;
- frame->setPageAndTextZoomFactors(sizeRatio * m_originalZoomFactor, m_webView->emulatedTextZoomFactor());
+ frame->setPageAndTextZoomFactors(m_originalZoomFactor, m_webView->emulatedTextZoomFactor());
Document* doc = frame->document();
doc->styleResolverChanged(RecalcStyleImmediately);
doc->updateLayout();
@@ -270,8 +267,7 @@ private:
m_webView->setPageScaleFactor(1, WebPoint());
m_webView->setZoomLevel(false, 0);
WebSize scaledEmulatedSize = scaledEmulatedFrameSize(frameView);
- Document* document = frameView->frame()->document();
- double denominator = document->renderView() ? document->renderView()->viewWidth() : frameView->contentsWidth();
+ double denominator = frameView->contentsWidth();
if (!denominator)
denominator = 1;
m_originalZoomFactor = static_cast<double>(scaledEmulatedSize.width) / denominator;
diff --git a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp
index 098cb425c..d7a282f35 100644
--- a/Source/WebKit/chromium/src/WebDeviceOrientation.cpp
+++ b/Source/WebKit/chromium/src/WebDeviceOrientation.cpp
@@ -31,7 +31,7 @@
namespace WebKit {
-WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrientation>& orientation)
+WebDeviceOrientation::WebDeviceOrientation(const WebCore::DeviceOrientation* orientation)
{
if (!orientation) {
m_isNull = true;
@@ -57,7 +57,7 @@ WebDeviceOrientation::WebDeviceOrientation(const PassRefPtr<WebCore::DeviceOrien
m_absolute = orientation->absolute();
}
-WebDeviceOrientation& WebDeviceOrientation::operator=(const PassRefPtr<WebCore::DeviceOrientation>& orientation)
+WebDeviceOrientation& WebDeviceOrientation::operator=(const WebCore::DeviceOrientation* orientation)
{
if (!orientation) {
m_isNull = true;
diff --git a/Source/WebKit/chromium/src/WebDeviceOrientationController.cpp b/Source/WebKit/chromium/src/WebDeviceOrientationController.cpp
index aa9249f76..7d09a6e7d 100644
--- a/Source/WebKit/chromium/src/WebDeviceOrientationController.cpp
+++ b/Source/WebKit/chromium/src/WebDeviceOrientationController.cpp
@@ -35,7 +35,7 @@ namespace WebKit {
void WebDeviceOrientationController::didChangeDeviceOrientation(const WebDeviceOrientation& orientation)
{
- PassRefPtr<WebCore::DeviceOrientation> deviceOrientation(orientation);
+ RefPtr<WebCore::DeviceOrientation> deviceOrientation = PassRefPtr<WebCore::DeviceOrientation>(orientation);
m_controller->didChangeDeviceOrientation(deviceOrientation.get());
}
diff --git a/Source/WebKit/chromium/src/WebDocument.cpp b/Source/WebKit/chromium/src/WebDocument.cpp
index d4cd18b00..063f71892 100644
--- a/Source/WebKit/chromium/src/WebDocument.cpp
+++ b/Source/WebKit/chromium/src/WebDocument.cpp
@@ -139,6 +139,20 @@ WebNodeCollection WebDocument::all()
return WebNodeCollection(unwrap<Document>()->all());
}
+void WebDocument::images(WebVector<WebElement>& results)
+{
+ RefPtr<HTMLCollection> images = unwrap<Document>()->images();
+ size_t sourceLength = images->length();
+ Vector<WebElement> temp;
+ temp.reserveCapacity(sourceLength);
+ for (size_t i = 0; i < sourceLength; ++i) {
+ Node* node = images->item(i);
+ if (node && node->isHTMLElement())
+ temp.append(WebElement(static_cast<Element*>(node)));
+ }
+ results.assign(temp);
+}
+
void WebDocument::forms(WebVector<WebFormElement>& results) const
{
RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>())->forms();
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
index 8f7b58a9d..d9cea3bb1 100644
--- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
+++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
@@ -27,6 +27,8 @@
#include <public/WebExternalTextureLayer.h>
#include "TextureLayerChromium.h"
+#include "cc/CCTextureUpdater.h"
+#include <public/WebExternalTextureLayerClient.h>
#include <public/WebFloatRect.h>
#include <public/WebSize.h>
@@ -34,13 +36,57 @@ using namespace WebCore;
namespace WebKit {
-WebExternalTextureLayer WebExternalTextureLayer::create()
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+ explicit WebTextureUpdaterImpl(CCTextureUpdater& updater)
+ : m_updater(updater)
+ {
+ }
+
+ virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+ {
+ m_updater.appendCopy(sourceTexture, destinationTexture, size);
+ }
+
+private:
+ CCTextureUpdater& m_updater;
+};
+
+class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium {
+public:
+ explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
+ : TextureLayerChromium(client ? this : 0)
+ , m_client(client)
+ {
+ }
+
+ virtual unsigned prepareTexture(CCTextureUpdater& updater) OVERRIDE
+ {
+ WebTextureUpdaterImpl updaterImpl(updater);
+ return m_client->prepareTexture(updaterImpl);
+ }
+
+ virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
+ {
+ return m_client->context();
+ }
+
+private:
+ WebExternalTextureLayerClient* m_client;
+};
+
+WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
{
- RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create(0);
+ RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
layer->setIsDrawable(true);
return WebExternalTextureLayer(layer.release());
}
+void WebExternalTextureLayer::clearClient()
+{
+ unwrap<TextureLayerChromium>()->clearClient();
+}
+
void WebExternalTextureLayer::setTextureId(unsigned id)
{
unwrap<TextureLayerChromium>()->setTextureId(id);
@@ -56,6 +102,26 @@ void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
unwrap<TextureLayerChromium>()->setUVRect(rect);
}
+void WebExternalTextureLayer::setOpaque(bool opaque)
+{
+ unwrap<TextureLayerChromium>()->setOpaque(opaque);
+}
+
+void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
+{
+ unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
+}
+
+void WebExternalTextureLayer::willModifyTexture()
+{
+ unwrap<TextureLayerChromium>()->willModifyTexture();
+}
+
+void WebExternalTextureLayer::setRateLimitContext(bool rateLimit)
+{
+ unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit);
+}
+
WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
: WebLayer(layer)
{
diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp
index 8a05aed84..cdb83c214 100644
--- a/Source/WebKit/chromium/src/WebFontImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFontImpl.cpp
@@ -148,7 +148,7 @@ WebRect WebFontImpl::estimateTextBounds(const WebTextRun& run, const WebFloatPoi
{
FontCachePurgePreventer fontCachePurgePreventer;
int totalWidth = m_font.width(run, 0);
- const FontMetrics& fontMetrics = m_font.fontMetrics();
+ const WebCore::FontMetrics& fontMetrics = m_font.fontMetrics();
return WebRect(leftBaseline.x - (fontMetrics.ascent() + fontMetrics.descent()) / 2,
leftBaseline.y - fontMetrics.ascent() - fontMetrics.lineGap(),
totalWidth + fontMetrics.ascent() + fontMetrics.descent(),
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp
index fadb8c020..88fd9f61d 100644
--- a/Source/WebKit/chromium/src/WebFrameImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp
@@ -109,10 +109,12 @@
#include "IconURL.h"
#include "InspectorController.h"
#include "KURL.h"
+#include "MessagePort.h"
#include "Node.h"
#include "Page.h"
#include "PageOverlay.h"
#include "Performance.h"
+#include "PlatformMessagePortChannel.h"
#include "PlatformSupport.h"
#include "PluginDocument.h"
#include "PrintContext.h"
@@ -504,7 +506,6 @@ private:
WebPluginContainerImpl* m_plugin;
int m_pageCount;
WebPrintParams m_printParams;
- WebPrintScalingOption m_printScalingOption;
};
@@ -1343,6 +1344,24 @@ void WebFrameImpl::requestTextChecking(const WebElement& webElem)
frame()->editor()->spellChecker()->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToCheck, rangeToCheck));
}
+void WebFrameImpl::replaceMisspelledRange(const WebString& text)
+{
+ // If this caret selection has two or more markers, this function replace the range covered by the first marker with the specified word as Microsoft Word does.
+ if (pluginContainerFromFrame(frame()))
+ return;
+ RefPtr<Range> caretRange = frame()->selection()->toNormalizedRange();
+ if (!caretRange)
+ return;
+ Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInRange(caretRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar);
+ if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset())
+ return;
+ RefPtr<Range> markerRange = TextIterator::rangeFromLocationAndLength(frame()->selection()->rootEditableElementOrDocumentElement(), markers[0]->startOffset(), markers[0]->endOffset() - markers[0]->startOffset());
+ if (!markerRange.get() || !frame()->selection()->shouldChangeSelection(markerRange.get()))
+ return;
+ frame()->selection()->setSelection(markerRange.get(), CharacterGranularity);
+ frame()->editor()->replaceSelectionWithText(text, false, true);
+}
+
bool WebFrameImpl::hasSelection() const
{
WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
@@ -1571,12 +1590,14 @@ bool WebFrameImpl::find(int identifier,
{
WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl();
- if (!options.findNext) {
+ if (!options.findNext)
frame()->page()->unmarkAllTextMatches();
- m_activeMatch = 0;
- } else
+ else
setMarkerActive(m_activeMatch.get(), false);
+ if (m_activeMatch && m_activeMatch->ownerDocument() != frame()->document())
+ m_activeMatch = 0;
+
// If the user has selected something since the last Find operation we want
// to start from there. Otherwise, we start searching from where the last Find
// operation left off (either a Find or a FindNext operation).
@@ -1731,44 +1752,41 @@ void WebFrameImpl::scopeStringMatches(int identifier,
continue;
}
- // Only treat the result as a match if it is visible
- if (frame()->editor()->insideVisibleArea(resultRange.get())) {
- ++matchCount;
-
- // Catch a special case where Find found something but doesn't know what
- // the bounding box for it is. In this case we set the first match we find
- // as the active rect.
- IntRect resultBounds = resultRange->boundingBox();
- IntRect activeSelectionRect;
- if (m_locatingActiveRect) {
- activeSelectionRect = m_activeMatch.get() ?
- m_activeMatch->boundingBox() : resultBounds;
- }
+ ++matchCount;
- // If the Find function found a match it will have stored where the
- // match was found in m_activeSelectionRect on the current frame. If we
- // find this rect during scoping it means we have found the active
- // tickmark.
- bool foundActiveMatch = false;
- if (m_locatingActiveRect && (activeSelectionRect == resultBounds)) {
- // We have found the active tickmark frame.
- mainFrameImpl->m_currentActiveMatchFrame = this;
- foundActiveMatch = true;
- // We also know which tickmark is active now.
- m_activeMatchIndexInCurrentFrame = matchCount - 1;
- // To stop looking for the active tickmark, we set this flag.
- m_locatingActiveRect = false;
-
- // Notify browser of new location for the selected rectangle.
- reportFindInPageSelection(
- frameView()->contentsToWindow(resultBounds),
- m_activeMatchIndexInCurrentFrame + 1,
- identifier);
- }
+ // Catch a special case where Find found something but doesn't know what
+ // the bounding box for it is. In this case we set the first match we find
+ // as the active rect.
+ IntRect resultBounds = resultRange->boundingBox();
+ IntRect activeSelectionRect;
+ if (m_locatingActiveRect) {
+ activeSelectionRect = m_activeMatch.get() ?
+ m_activeMatch->boundingBox() : resultBounds;
+ }
- addMarker(resultRange.get(), foundActiveMatch);
+ // If the Find function found a match it will have stored where the
+ // match was found in m_activeSelectionRect on the current frame. If we
+ // find this rect during scoping it means we have found the active
+ // tickmark.
+ bool foundActiveMatch = false;
+ if (m_locatingActiveRect && (activeSelectionRect == resultBounds)) {
+ // We have found the active tickmark frame.
+ mainFrameImpl->m_currentActiveMatchFrame = this;
+ foundActiveMatch = true;
+ // We also know which tickmark is active now.
+ m_activeMatchIndexInCurrentFrame = matchCount - 1;
+ // To stop looking for the active tickmark, we set this flag.
+ m_locatingActiveRect = false;
+
+ // Notify browser of new location for the selected rectangle.
+ reportFindInPageSelection(
+ frameView()->contentsToWindow(resultBounds),
+ m_activeMatchIndexInCurrentFrame + 1,
+ identifier);
}
+ addMarker(resultRange.get(), foundActiveMatch);
+
// Set the new start for the search range to be the end of the previous
// result range. There is no need to use a VisiblePosition here,
// since findPlainText will use a TextIterator to go over the visible
@@ -1901,15 +1919,27 @@ void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin&
m_frame->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0);
}
-void WebFrameImpl::deliverIntent(const WebIntent& intent, WebDeliveredIntentClient* intentClient)
+void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelArray* ports, WebDeliveredIntentClient* intentClient)
{
#if ENABLE(WEB_INTENTS)
OwnPtr<WebCore::DeliveredIntentClient> client(adoptPtr(new DeliveredIntentClientImpl(intentClient)));
- OwnPtr<MessagePortArray> ports;
WebSerializedScriptValue intentData = WebSerializedScriptValue::fromString(intent.data());
const WebCore::Intent* webcoreIntent = intent;
- RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, ports.release(), webcoreIntent->extras());
+
+ // See PlatformMessagePortChannel.cpp
+ OwnPtr<MessagePortChannelArray> channels;
+ if (ports && ports->size()) {
+ channels = adoptPtr(new MessagePortChannelArray(ports->size()));
+ for (size_t i = 0; i < ports->size(); ++i) {
+ RefPtr<PlatformMessagePortChannel> platformChannel = PlatformMessagePortChannel::create((*ports)[i]);
+ (*ports)[i]->setClient(platformChannel.get());
+ (*channels)[i] = MessagePortChannel::create(platformChannel);
+ }
+ }
+ OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->domWindow()->scriptExecutionContext()), channels.release());
+
+ RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras());
DOMWindowIntents::from(m_frame->domWindow())->deliver(deliveredIntent.release());
#endif
@@ -1947,18 +1977,6 @@ WebString WebFrameImpl::renderTreeAsText(RenderAsTextControls toShow) const
return externalRepresentation(m_frame, behavior);
}
-WebString WebFrameImpl::counterValueForElementById(const WebString& id) const
-{
- if (!m_frame)
- return WebString();
-
- Element* element = m_frame->document()->getElementById(id);
- if (!element)
- return WebString();
-
- return counterValueForElement(element);
-}
-
WebString WebFrameImpl::markerTextForListItem(const WebElement& webElement) const
{
return WebCore::markerTextForListItem(const_cast<Element*>(webElement.constUnwrap<Element>()));
@@ -2023,6 +2041,7 @@ PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client)
WebFrameImpl::WebFrameImpl(WebFrameClient* client)
: m_frameLoaderClient(this)
, m_client(client)
+ , m_frame(0)
, m_currentActiveMatchFrame(0)
, m_activeMatchIndexInCurrentFrame(-1)
, m_locatingActiveRect(false)
@@ -2048,9 +2067,9 @@ WebFrameImpl::~WebFrameImpl()
cancelPendingScopingEffort();
}
-void WebFrameImpl::initializeAsMainFrame(WebViewImpl* webViewImpl)
+void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page)
{
- RefPtr<Frame> frame = Frame::create(webViewImpl->page(), 0, &m_frameLoaderClient);
+ RefPtr<Frame> frame = Frame::create(page, 0, &m_frameLoaderClient);
m_frame = frame.get();
// Add reference on behalf of FrameLoader. See comments in
@@ -2209,6 +2228,14 @@ void WebFrameImpl::setFindEndstateFocusAndSelection()
// a link focused, which is weird).
frame()->selection()->setSelection(m_activeMatch.get());
frame()->document()->setFocusedNode(0);
+
+ // Finally clear the active match, for two reasons:
+ // We just finished the find 'session' and we don't want future (potentially
+ // unrelated) find 'sessions' operations to start at the same place.
+ // The WebFrameImpl could get reused and the m_activeMatch could end up pointing
+ // to a document that is no longer valid. Keeping an invalid reference around
+ // is just asking for trouble.
+ m_activeMatch = 0;
}
}
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h
index d8ae6dca6..39937471a 100644
--- a/Source/WebKit/chromium/src/WebFrameImpl.h
+++ b/Source/WebKit/chromium/src/WebFrameImpl.h
@@ -171,6 +171,7 @@ public:
virtual void enableContinuousSpellChecking(bool);
virtual bool isContinuousSpellCheckingEnabled() const;
virtual void requestTextChecking(const WebElement&);
+ virtual void replaceMisspelledRange(const WebString&);
virtual bool hasSelection() const;
virtual WebRange selectionRange() const;
virtual WebString selectionAsText() const;
@@ -217,12 +218,11 @@ public:
const WebSecurityOrigin& intendedTargetOrigin,
const WebDOMEvent&);
- virtual void deliverIntent(const WebIntent&, WebDeliveredIntentClient*);
+ virtual void deliverIntent(const WebIntent&, WebMessagePortChannelArray*, WebDeliveredIntentClient*);
virtual WebString contentAsText(size_t maxChars) const;
virtual WebString contentAsMarkup() const;
virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const;
- virtual WebString counterValueForElementById(const WebString& id) const;
virtual WebString markerTextForListItem(const WebElement&) const;
virtual int pageNumberForElementById(const WebString& id,
float pageWidthInPixels,
@@ -235,8 +235,8 @@ public:
static PassRefPtr<WebFrameImpl> create(WebFrameClient* client);
virtual ~WebFrameImpl();
- // Called by the WebViewImpl to initialize its main frame:
- void initializeAsMainFrame(WebViewImpl*);
+ // Called by the WebViewImpl to initialize the main frame for the page.
+ void initializeAsMainFrame(WebCore::Page*);
PassRefPtr<WebCore::Frame> createChildFrame(
const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*);
diff --git a/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp b/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp
new file mode 100644
index 000000000..afa3701aa
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp
@@ -0,0 +1,255 @@
+/*
+ * 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 "WebHelperPluginImpl.h"
+
+#include "DocumentLoader.h"
+#include "EmptyClients.h"
+#include "FocusController.h"
+#include "FrameView.h"
+#include "HTMLPlugInElement.h"
+#include "NodeList.h"
+#include "Page.h"
+#include "PageWidgetDelegate.h"
+#include "Settings.h"
+#include "WebFrameImpl.h"
+#include "WebPlugin.h"
+#include "WebPluginContainerImpl.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+#include "WebWidgetClient.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#define addLiteral(literal, writer) writer.addData(literal, sizeof(literal) - 1)
+
+static inline void addString(const String& str, DocumentWriter& writer)
+{
+ CString str8 = str.utf8();
+ writer.addData(str8.data(), str8.length());
+}
+
+void writeDocument(WebCore::DocumentWriter& writer, const String& pluginType)
+{
+ writer.setMIMEType("text/html");
+ writer.setEncoding("UTF-8", false);
+ writer.begin();
+
+ addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", writer);
+ String objectTag = "<object type=\"" + pluginType + "\"></object>";
+ addString(objectTag, writer);
+ addLiteral("</body>\n", writer);
+
+ writer.end();
+}
+
+class HelperPluginChromeClient : public EmptyChromeClient {
+ WTF_MAKE_NONCOPYABLE(HelperPluginChromeClient);
+ WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ explicit HelperPluginChromeClient(WebHelperPluginImpl* widget)
+ : m_widget(widget)
+ {
+ ASSERT(m_widget->m_widgetClient);
+ }
+
+private:
+ virtual void closeWindowSoon() OVERRIDE
+ {
+ m_widget->closeHelperPlugin();
+ }
+
+ virtual void* webView() const OVERRIDE
+ {
+ return m_widget->m_webView;
+ }
+
+ WebHelperPluginImpl* m_widget;
+};
+
+// WebHelperPluginImpl ----------------------------------------------------------------
+
+WebHelperPluginImpl::WebHelperPluginImpl(WebWidgetClient* client)
+ : m_widgetClient(client)
+ , m_webView(0)
+{
+ ASSERT(client);
+}
+
+WebHelperPluginImpl::~WebHelperPluginImpl()
+{
+ ASSERT(!m_page);
+}
+
+bool WebHelperPluginImpl::init(WebViewImpl* webView, const String& pluginType)
+{
+ ASSERT(webView);
+ m_webView = webView;
+
+ if (!initPage(webView, pluginType))
+ return false;
+ m_widgetClient->show(WebNavigationPolicy());
+
+ setFocus(true);
+
+ return true;
+}
+
+void WebHelperPluginImpl::closeHelperPlugin()
+{
+ if (m_page) {
+ m_page->setGroupName(String());
+ m_page->mainFrame()->loader()->stopAllLoaders();
+ m_page->mainFrame()->loader()->stopLoading(UnloadEventPolicyNone);
+ }
+ // m_widgetClient might be 0 because this widget might be already closed.
+ if (m_widgetClient) {
+ // closeWidgetSoon() will call this->close() later.
+ m_widgetClient->closeWidgetSoon();
+ }
+}
+
+void WebHelperPluginImpl::initializeFrame(WebFrameClient* client)
+{
+ ASSERT(m_page);
+ RefPtr<WebFrameImpl> frame = WebFrameImpl::create(client);
+ frame->initializeAsMainFrame(m_page.get());
+}
+
+// Returns a pointer to the WebPlugin by finding the single <object> tag in the page.
+WebPlugin* WebHelperPluginImpl::getPlugin()
+{
+ ASSERT(m_page);
+
+ RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElementsByTagName(WebCore::HTMLNames::objectTag.localName());
+ ASSERT(objectElements && objectElements->length() == 1);
+ if (!objectElements || objectElements->length() < 1)
+ return 0;
+ Node* node = objectElements->item(0);
+ ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag));
+ WebCore::Widget* widget = static_cast<HTMLPlugInElement*>(node)->pluginWidget();
+ if (!widget)
+ return 0;
+ WebPlugin* plugin = static_cast<WebPluginContainerImpl*>(widget)->plugin();
+ ASSERT(plugin);
+ // If the plugin is a placeholder, it is not useful to the caller, and it
+ // could be replaced at any time. Therefore, do not return it.
+ if (plugin->isPlaceholder())
+ return 0;
+
+ // The plugin was instantiated and will outlive this object.
+ return plugin;
+}
+
+bool WebHelperPluginImpl::initPage(WebKit::WebViewImpl* webView, const String& pluginType)
+{
+ Page::PageClients pageClients;
+ fillWithEmptyClients(pageClients);
+ m_chromeClient = adoptPtr(new HelperPluginChromeClient(this));
+ pageClients.chromeClient = m_chromeClient.get();
+
+ m_page = adoptPtr(new Page(pageClients));
+ // Scripting must be enabled in ScriptController::windowScriptNPObject().
+ m_page->settings()->setScriptEnabled(true);
+ m_page->settings()->setPluginsEnabled(true);
+
+ webView->client()->initializeHelperPluginWebFrame(this);
+
+ // The page's main frame was set in initializeFrame() as a result of the above call.
+ Frame* frame = m_page->mainFrame();
+ ASSERT(frame);
+ frame->setView(FrameView::create(frame));
+ // No need to set a size or make it not transparent.
+
+ DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer();
+ writeDocument(*writer, pluginType);
+
+ return true;
+}
+
+void WebHelperPluginImpl::setCompositorSurfaceReady()
+{
+}
+
+void WebHelperPluginImpl::composite(bool)
+{
+}
+
+void WebHelperPluginImpl::layout()
+{
+ PageWidgetDelegate::layout(m_page.get());
+}
+
+void WebHelperPluginImpl::setFocus(bool enable)
+{
+ if (!m_page)
+ return;
+ m_page->focusController()->setFocused(enable);
+ if (enable)
+ m_page->focusController()->setActive(true);
+}
+
+void WebHelperPluginImpl::close()
+{
+ RefPtr<WebFrameImpl> mainFrameImpl;
+
+ if (m_page) {
+ // Initiate shutdown. This will cause a lot of notifications to be sent.
+ if (m_page->mainFrame()) {
+ mainFrameImpl = WebFrameImpl::fromFrame(m_page->mainFrame());
+ m_page->mainFrame()->loader()->frameDetached();
+ }
+ m_page.clear();
+ }
+
+ m_widgetClient = 0;
+ deref();
+}
+
+// WebHelperPlugin ----------------------------------------------------------------
+
+WebHelperPlugin* WebHelperPlugin::create(WebWidgetClient* client)
+{
+ if (!client)
+ CRASH();
+ // A WebHelperPluginImpl instance usually has two references.
+ // - One owned by the instance itself. It represents the visible widget.
+ // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
+ // WebHelperPluginImpl to close.
+ // We need them because the closing operation is asynchronous and the widget
+ // can be closed while the WebViewImpl is unaware of it.
+ return adoptRef(new WebHelperPluginImpl(client)).leakRef();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebHelperPluginImpl.h b/Source/WebKit/chromium/src/WebHelperPluginImpl.h
new file mode 100644
index 000000000..2eb28ec31
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebHelperPluginImpl.h
@@ -0,0 +1,86 @@
+/*
+ * 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 WebHelperPluginImpl_h
+#define WebHelperPluginImpl_h
+
+#include "WebHelperPlugin.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+class Page;
+}
+
+namespace WebKit {
+
+class HelperPluginChromeClient;
+class WebViewImpl;
+class WebWidgetClient;
+
+// Hosts a simple page that instantiates a plugin using an <object> tag.
+// The widget is offscreen, and the plugin will not receive painting, resize, etc. events.
+class WebHelperPluginImpl : public WebHelperPlugin,
+ public RefCounted<WebHelperPluginImpl> {
+ WTF_MAKE_NONCOPYABLE(WebHelperPluginImpl);
+ WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ virtual ~WebHelperPluginImpl();
+ bool init(WebViewImpl*, const String& pluginType);
+ void closeHelperPlugin();
+
+ // WebHelperPlugin methods:
+ virtual void initializeFrame(WebFrameClient*) OVERRIDE;
+ virtual WebPlugin* getPlugin() OVERRIDE;
+
+private:
+ explicit WebHelperPluginImpl(WebWidgetClient*);
+ bool initPage(WebKit::WebViewImpl*, const String& pluginType);
+
+ // WebWidget methods:
+ virtual void setCompositorSurfaceReady() OVERRIDE;
+ virtual void composite(bool) OVERRIDE;
+ virtual void layout() OVERRIDE;
+ virtual void setFocus(bool) OVERRIDE;
+ virtual void close() OVERRIDE;
+
+ WebWidgetClient* m_widgetClient;
+ WebViewImpl* m_webView;
+ OwnPtr<WebCore::Page> m_page;
+ OwnPtr<HelperPluginChromeClient> m_chromeClient;
+
+ friend class WebHelperPlugin;
+ friend class HelperPluginChromeClient;
+};
+
+} // namespace WebKit
+
+#endif // WebHelperPluginImpl_h
diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
index 4be43dc14..2662f801f 100644
--- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
@@ -111,7 +111,7 @@ void WebIDBDatabaseImpl::open(WebIDBDatabaseCallbacks* callbacks)
{
ASSERT(!m_databaseCallbacks);
m_databaseCallbacks = IDBDatabaseCallbacksProxy::create(adoptPtr(callbacks));
- m_databaseBackend->open(m_databaseCallbacks);
+ m_databaseBackend->registerFrontendCallbacks(m_databaseCallbacks);
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
index 96571bbe9..190d7e2dc 100644
--- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -59,6 +59,7 @@ public:
virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&);
virtual void close();
+ // FIXME: Rename "open" to registerFrontendCallbacks.
virtual void open(WebIDBDatabaseCallbacks*);
private:
diff --git a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
index 17c158f34..b094e77bd 100644
--- a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
+++ b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
@@ -37,11 +37,6 @@ using namespace WebCore;
namespace WebKit {
-WebIDBKeyPath::~WebIDBKeyPath()
-{
- m_private.reset(0);
-}
-
WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath)
{
return WebIDBKeyPath(IDBKeyPath(keyPath));
@@ -60,6 +55,17 @@ WebIDBKeyPath WebIDBKeyPath::createNull()
return WebIDBKeyPath(IDBKeyPath());
}
+void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath)
+{
+ ASSERT(keyPath.m_private.get());
+ m_private.reset(new IDBKeyPath(keyPath));
+}
+
+void WebIDBKeyPath::reset()
+{
+ m_private.reset(0);
+}
+
bool WebIDBKeyPath::isValid() const
{
ASSERT(m_private.get());
@@ -87,12 +93,6 @@ WebString WebIDBKeyPath::string() const
return m_private->string();
}
-WebIDBKeyPath::WebIDBKeyPath(const WebIDBKeyPath& keyPath)
- : m_private(new IDBKeyPath(keyPath))
-{
- ASSERT(m_private.get());
-}
-
WebIDBKeyPath::WebIDBKeyPath(const WebCore::IDBKeyPath& value)
: m_private(new IDBKeyPath(value))
{
diff --git a/Source/WebKit/chromium/src/WebImageLayer.cpp b/Source/WebKit/chromium/src/WebImageLayer.cpp
new file mode 100644
index 000000000..93dbf3930
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebImageLayer.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <public/WebImageLayer.h>
+
+#include "ImageLayerChromium.h"
+
+namespace WebKit {
+
+WebImageLayer WebImageLayer::create()
+{
+ return WebImageLayer(WebCore::ImageLayerChromium::create());
+}
+
+WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
+ : WebLayer(layer)
+{
+}
+
+void WebImageLayer::setBitmap(SkBitmap bitmap)
+{
+ return unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp
index e61b4ac65..c0690f8d7 100644
--- a/Source/WebKit/chromium/src/WebInputEvent.cpp
+++ b/Source/WebKit/chromium/src/WebInputEvent.cpp
@@ -43,27 +43,27 @@ using namespace WebCore;
namespace WebKit {
-class SameSizeAsWebInputEvent {
+struct SameSizeAsWebInputEvent {
int inputData[5];
};
-class SameSizeAsWebKeyboardEvent : public SameSizeAsWebInputEvent {
+struct SameSizeAsWebKeyboardEvent : public SameSizeAsWebInputEvent {
int keyboardData[12];
};
-class SameSizeAsWebMouseEvent : public SameSizeAsWebInputEvent {
+struct SameSizeAsWebMouseEvent : public SameSizeAsWebInputEvent {
int mouseData[10];
};
-class SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent {
+struct SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent {
int mousewheelData[8];
};
-class SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent {
+struct SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent {
int gestureData[6];
};
-class SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent {
+struct SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent {
WebTouchPoint touchPoints[3 * WebTouchEvent::touchesLengthCap];
int touchData[3];
};
diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp
index 58df5093b..207d81ca3 100644
--- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp
+++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp
@@ -123,8 +123,8 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo
if (e.modifiers & WebInputEvent::MetaKey)
m_modifiers |= PlatformEvent::MetaKey;
-#if OS(DARWIN)
m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
+#if OS(DARWIN)
m_phase = static_cast<WebCore::PlatformWheelEventPhase>(e.phase);
m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(e.momentumPhase);
m_timestamp = e.timeStampSeconds;
@@ -159,6 +159,9 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
case WebInputEvent::GestureDoubleTap:
m_type = PlatformEvent::GestureDoubleTap;
break;
+ case WebInputEvent::GestureTwoFingerTap:
+ m_type = PlatformEvent::GestureTwoFingerTap;
+ break;
case WebInputEvent::GestureLongPress:
m_type = PlatformEvent::GestureLongPress;
break;
diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp
index 44ce2d0ac..55775ecfc 100644
--- a/Source/WebKit/chromium/src/WebIntent.cpp
+++ b/Source/WebKit/chromium/src/WebIntent.cpp
@@ -35,20 +35,27 @@
#include "MessagePort.h"
#include "PlatformMessagePortChannel.h"
#include "SerializedScriptValue.h"
+#include "platform/WebSerializedScriptValue.h"
#include <wtf/HashMap.h>
namespace WebKit {
-WebIntent::WebIntent(const WebString& action, const WebString& type, const WebString& data)
+WebIntent WebIntent::create(const WebString& action, const WebString& type, const WebString& data,
+ const WebVector<WebString>& extrasNames, const WebVector<WebString>& extrasValues)
{
#if ENABLE(WEB_INTENTS)
WebCore::ExceptionCode ec = 0;
- WebCore::MessagePortArray ports;
- RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), ports, ec);
+ WebCore::MessagePortArray dummyPorts;
+ RefPtr<WebCore::Intent> intent = WebCore::Intent::create(action, type, WebCore::SerializedScriptValue::createFromWire(data), dummyPorts, ec);
if (ec)
- return;
+ return WebIntent();
- m_private = intent.release();
+ HashMap<String, String> extras;
+ for (size_t i = 0; i < extrasNames.size() && i < extrasValues.size(); ++i)
+ extras.add(extrasNames[i], extrasValues[i]);
+ intent->setExtras(extras);
+
+ return WebIntent(intent.release());
#endif
}
diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp
index ee999a916..6106597ae 100644
--- a/Source/WebKit/chromium/src/WebKit.cpp
+++ b/Source/WebKit/chromium/src/WebKit.cpp
@@ -63,6 +63,7 @@ namespace {
class EndOfTaskRunner : public WebThread::TaskObserver {
public:
+ virtual void willProcessTask() { }
virtual void didProcessTask()
{
WebCore::WebKitMutationObserver::deliverAllMutations();
diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
index 65a2a63b1..47cc88310 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
@@ -37,20 +37,17 @@
using namespace WebCore;
namespace WebKit {
-WebLayerTreeView::Settings::operator CCSettings() const
+
+WebLayerTreeView::Settings::operator CCLayerTreeSettings() const
{
- CCSettings settings;
- settings.acceleratePainting = acceleratePainting;
+ CCLayerTreeSettings settings;
+ settings.forceSoftwareCompositing = forceSoftwareCompositing;
settings.showFPSCounter = showFPSCounter;
settings.showPlatformLayerTree = showPlatformLayerTree;
settings.showPaintRects = showPaintRects;
settings.refreshRate = refreshRate;
- settings.perTilePainting = perTilePainting;
- settings.partialSwapEnabled = partialSwapEnabled;
- settings.threadedAnimationEnabled = threadedAnimationEnabled;
settings.defaultTileSize = defaultTileSize;
settings.maxUntiledLayerSize = maxUntiledLayerSize;
- settings.deviceScaleFactor = deviceScaleFactor;
// FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently.
return settings;
@@ -101,11 +98,26 @@ WebSize WebLayerTreeView::viewportSize() const
return WebSize(m_private->layerTreeHost()->viewportSize());
}
+void WebLayerTreeView::setDeviceScaleFactor(const float deviceScaleFactor)
+{
+ m_private->layerTreeHost()->setDeviceScaleFactor(deviceScaleFactor);
+}
+
+float WebLayerTreeView::deviceScaleFactor() const
+{
+ return m_private->layerTreeHost()->deviceScaleFactor();
+}
+
void WebLayerTreeView::setBackgroundColor(WebColor color)
{
m_private->layerTreeHost()->setBackgroundColor(color);
}
+void WebLayerTreeView::setHasTransparentBackground(bool transparent)
+{
+ m_private->layerTreeHost()->setHasTransparentBackground(transparent);
+}
+
void WebLayerTreeView::setVisible(bool visible)
{
m_private->layerTreeHost()->setVisible(visible);
@@ -161,7 +173,7 @@ void WebLayerTreeView::finishAllRendering()
WebGraphicsContext3D* WebLayerTreeView::context()
{
- return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context());
+ return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()->context3D());
}
void WebLayerTreeView::loseCompositorContext(int numTimes)
diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
index 45a99603c..17d5fe867 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
@@ -54,7 +54,7 @@ public:
virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); }
virtual void layout() OVERRIDE { m_client->layout(); }
virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); }
- virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE
+ virtual PassRefPtr<WebCore::GraphicsContext3D> createContext3D() OVERRIDE
{
OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
if (!webContext)
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 44e51cd87..95186dd86 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -19,10 +19,10 @@
#include "PlatformContextSkia.h"
#include "RenderView.h"
#include "TimeRanges.h"
-#include "VideoLayerChromium.h"
#include "WebAudioSourceProvider.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
+#include "WebHelperPluginImpl.h"
#include "WebKit.h"
#include "WebMediaPlayer.h"
#include "WebViewImpl.h"
@@ -96,6 +96,8 @@ WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl()
if (m_webMediaPlayer)
m_webMediaPlayer->setStreamTextureClient(0);
#endif
+ if (m_helperPlugin)
+ closeHelperPlugin();
}
void WebMediaPlayerClientImpl::networkStateChanged()
@@ -265,6 +267,32 @@ void WebMediaPlayerClientImpl::keyNeeded(const WebString& keySystem, const WebSt
#endif
}
+WebPlugin* WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginType, WebFrame* frame)
+{
+ ASSERT(!m_helperPlugin);
+ WebViewImpl* webView = static_cast<WebViewImpl*>(frame->view());
+ m_helperPlugin = webView->createHelperPlugin(pluginType);
+ if (!m_helperPlugin)
+ return 0;
+
+ WebPlugin* plugin = m_helperPlugin->getPlugin();
+ if (!plugin) {
+ // There is no need to keep the helper plugin around and the caller
+ // should not be expected to call close after a failure (null pointer).
+ closeHelperPlugin();
+ return 0;
+ }
+
+ return plugin;
+}
+
+void WebMediaPlayerClientImpl::closeHelperPlugin()
+{
+ ASSERT(m_helperPlugin);
+ m_helperPlugin->closeHelperPlugin();
+ m_helperPlugin = 0;
+}
+
void WebMediaPlayerClientImpl::disableAcceleratedCompositing()
{
m_supportsAcceleratedCompositing = false;
@@ -301,7 +329,9 @@ void WebMediaPlayerClientImpl::loadInternal()
// Make sure if we create/re-create the WebMediaPlayer that we update our wrapper.
m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
#endif
- m_webMediaPlayer->load(KURL(ParsedURLString, m_url));
+ m_webMediaPlayer->load(
+ KURL(ParsedURLString, m_url),
+ static_cast<WebMediaPlayer::CORSMode>(m_mediaPlayer->mediaPlayerClient()->mediaPlayerCORSMode()));
}
}
@@ -312,10 +342,10 @@ void WebMediaPlayerClientImpl::cancelLoad()
}
#if USE(ACCELERATED_COMPOSITING)
-PlatformLayer* WebMediaPlayerClientImpl::platformLayer() const
+LayerChromium* WebMediaPlayerClientImpl::platformLayer() const
{
ASSERT(m_supportsAcceleratedCompositing);
- return m_videoLayer.unwrap<VideoLayerChromium>();
+ return m_videoLayer.unwrap<LayerChromium>();
}
#endif
@@ -608,7 +638,7 @@ void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
{
#if USE(ACCELERATED_COMPOSITING)
// If we are using GPU to render video, ignore requests to paint frames into
- // canvas because it will be taken care of by VideoLayerChromium.
+ // canvas because it will be taken care of by WebVideoLayer.
if (acceleratedRenderingInUse())
return;
#endif
@@ -645,6 +675,13 @@ bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
return false;
}
+bool WebMediaPlayerClientImpl::didPassCORSAccessCheck() const
+{
+ if (m_webMediaPlayer)
+ return m_webMediaPlayer->didPassCORSAccessCheck();
+ return false;
+}
+
MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
{
if (m_webMediaPlayer)
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
index 0888d5eee..53a24d666 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -47,6 +47,7 @@ namespace WebCore { class AudioSourceProviderClient; }
namespace WebKit {
+class WebHelperPluginImpl;
class WebAudioSourceProvider;
class WebMediaPlayer;
@@ -89,6 +90,8 @@ public:
virtual void keyError(const WebString& keySystem, const WebString& sessionId, MediaKeyErrorCode, unsigned short systemCode);
virtual void keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength);
virtual void keyNeeded(const WebString& keySystem, const WebString& sessionId, const unsigned char* initData, unsigned initDataLength);
+ virtual WebPlugin* createHelperPlugin(const WebString& pluginType, WebFrame*);
+ virtual void closeHelperPlugin();
virtual void disableAcceleratedCompositing();
// MediaPlayerPrivateInterface methods:
@@ -128,6 +131,7 @@ public:
virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&);
virtual void setPreload(WebCore::MediaPlayer::Preload);
virtual bool hasSingleSecurityOrigin() const;
+ virtual bool didPassCORSAccessCheck() const;
virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const;
virtual float mediaTimeForTimeValue(float timeValue) const;
virtual unsigned decodedFrameCount() const;
@@ -198,6 +202,7 @@ private:
String m_url;
bool m_delayingLoad;
WebCore::MediaPlayer::Preload m_preload;
+ RefPtr<WebHelperPluginImpl> m_helperPlugin;
#if USE(ACCELERATED_COMPOSITING)
WebVideoLayer m_videoLayer;
bool m_supportsAcceleratedCompositing;
diff --git a/Source/WebKit/chromium/src/WebNode.cpp b/Source/WebKit/chromium/src/WebNode.cpp
index 69908c9b7..49dcdd98e 100644
--- a/Source/WebKit/chromium/src/WebNode.cpp
+++ b/Source/WebKit/chromium/src/WebNode.cpp
@@ -153,7 +153,7 @@ bool WebNode::isTextNode() const
bool WebNode::isFocusable() const
{
- m_private->document()->updateLayout();
+ m_private->document()->updateLayoutIgnorePendingStylesheets();
return m_private->isFocusable();
}
@@ -215,6 +215,7 @@ WebElement WebNode::rootEditableElement() const
bool WebNode::hasNonEmptyBoundingBox() const
{
+ m_private->document()->updateLayoutIgnorePendingStylesheets();
return m_private->hasNonEmptyBoundingBox();
}
diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
index 617b725ce..6d59cc19c 100644
--- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
@@ -32,18 +32,16 @@
#include "WebPagePopupImpl.h"
#include "Chrome.h"
+#include "ContextFeatures.h"
#include "DOMWindowPagePopup.h"
+#include "DocumentLoader.h"
#include "EmptyClients.h"
-#include "FileChooser.h"
#include "FocusController.h"
-#include "FormState.h"
#include "FrameView.h"
-#include "HTMLFormElement.h"
#include "Page.h"
#include "PagePopupClient.h"
#include "PageWidgetDelegate.h"
#include "Settings.h"
-#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
#include "WebPagePopup.h"
#include "WebViewImpl.h"
@@ -128,10 +126,17 @@ private:
WebPagePopupImpl* m_popup;
};
-class PagePopupFrameLoaderClient : public EmptyFrameLoaderClient {
- virtual bool allowPagePopup() OVERRIDE { return true; }
+class PagePopupFeaturesClient : public ContextFeaturesClient {
+ virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) OVERRIDE;
};
+bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue)
+{
+ if (type == ContextFeatures::PagePopup)
+ return true;
+ return defaultValue;
+}
+
// WebPagePopupImpl ----------------------------------------------------------------
WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client)
@@ -186,8 +191,10 @@ bool WebPagePopupImpl::initPage()
m_page->settings()->setScriptEnabled(true);
m_page->settings()->setAllowScriptsToCloseWindows(true);
- static FrameLoaderClient* pagePopupFrameLoaderClient = new PagePopupFrameLoaderClient;
- RefPtr<Frame> frame = Frame::create(m_page.get(), 0, pagePopupFrameLoaderClient);
+ static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeaturesClient();
+ provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient);
+ static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient();
+ RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient);
frame->setView(FrameView::create(frame.get()));
frame->init();
frame->view()->resize(m_popupClient->contentSize());
@@ -230,7 +237,7 @@ void WebPagePopupImpl::layout()
void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect)
{
- PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect);
+ PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect, PageWidgetDelegate::Opaque);
}
void WebPagePopupImpl::resize(const WebSize& newSize)
@@ -287,6 +294,8 @@ void WebPagePopupImpl::setFocus(bool enable)
void WebPagePopupImpl::close()
{
+ if (m_page && m_page->mainFrame())
+ m_page->mainFrame()->loader()->frameDetached();
m_page.clear();
m_widgetClient = 0;
deref();
diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
index 1f0b7668a..ec89930fb 100644
--- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
@@ -198,8 +198,12 @@ void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect)
if (!m_widget)
return;
- if (!rect.isEmpty())
- m_widget->paint(&GraphicsContextBuilder(canvas).context(), rect);
+ if (!rect.isEmpty()) {
+ GraphicsContextBuilder builder(canvas);
+ GraphicsContext& context = builder.context();
+ context.applyDeviceScaleFactor(m_client->deviceScaleFactor());
+ m_widget->paint(&context, rect);
+ }
}
void WebPopupMenuImpl::themeChanged()
@@ -274,6 +278,7 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent)
case WebInputEvent::GestureTap:
case WebInputEvent::GestureTapDown:
case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureLongPress:
case WebInputEvent::GesturePinchBegin:
case WebInputEvent::GesturePinchEnd:
diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
index f6478e4ba..03129c54d 100644
--- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
+++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
@@ -278,18 +278,11 @@ bool WebRuntimeFeatures::isScriptedSpeechEnabled()
void WebRuntimeFeatures::enableXHRResponseBlob(bool enable)
{
-#if ENABLE(XHR_RESPONSE_BLOB)
- RuntimeEnabledFeatures::setXHRResponseBlobEnabled(enable);
-#endif
}
bool WebRuntimeFeatures::isXHRResponseBlobEnabled()
{
-#if ENABLE(XHR_RESPONSE_BLOB)
- return RuntimeEnabledFeatures::xhrResponseBlobEnabled();
-#else
- return false;
-#endif
+ return true;
}
void WebRuntimeFeatures::enableFileSystem(bool enable)
@@ -397,7 +390,7 @@ bool WebRuntimeFeatures::isFullScreenAPIEnabled()
void WebRuntimeFeatures::enablePointerLock(bool enable)
{
#if ENABLE(POINTER_LOCK)
- RuntimeEnabledFeatures::setWebkitPointerLockEnabled(enable);
+ RuntimeEnabledFeatures::setPointerLockEnabled(enable);
#else
UNUSED_PARAM(enable);
#endif
@@ -406,7 +399,7 @@ void WebRuntimeFeatures::enablePointerLock(bool enable)
bool WebRuntimeFeatures::isPointerLockEnabled()
{
#if ENABLE(POINTER_LOCK)
- return RuntimeEnabledFeatures::webkitPointerLockEnabled();
+ return RuntimeEnabledFeatures::pointerLockEnabled();
#else
return false;
#endif
diff --git a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp
index a14a36dcd..e80061889 100644
--- a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp
+++ b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp
@@ -68,6 +68,11 @@ void WebSecurityPolicy::registerURLSchemeAsCORSEnabled(const WebString& scheme)
SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme);
}
+void WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(const WebString& scheme)
+{
+ SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(scheme);
+}
+
void WebSecurityPolicy::registerURLSchemeAsEmptyDocument(const WebString& scheme)
{
SchemeRegistry::registerURLSchemeAsEmptyDocument(scheme);
diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
index c51fffbf7..5f8776b58 100644
--- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -47,6 +47,7 @@ namespace WebKit {
WebSettingsImpl::WebSettingsImpl(Settings* settings)
: m_settings(settings)
+ , m_forceSoftwareCompositing(false)
, m_showFPSCounter(false)
, m_showPlatformLayerTree(false)
, m_showPaintRects(false)
@@ -88,6 +89,11 @@ void WebSettingsImpl::setFantasyFontFamily(const WebString& font, UScriptCode sc
m_settings->setFantasyFontFamily(font, script);
}
+void WebSettingsImpl::setPictographFontFamily(const WebString& font, UScriptCode script)
+{
+ m_settings->setPictographFontFamily(font, script);
+}
+
void WebSettingsImpl::setDefaultFontSize(int size)
{
m_settings->setDefaultFontSize(size);
@@ -113,19 +119,14 @@ void WebSettingsImpl::setMinimumLogicalFontSize(int size)
m_settings->setMinimumLogicalFontSize(size);
}
-void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor)
-{
- m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor);
-}
-
-int WebSettingsImpl::defaultDeviceScaleFactor()
+void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch)
{
- return m_settings->defaultDeviceScaleFactor();
+ m_settings->setDeviceSupportsTouch(deviceSupportsTouch);
}
-void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch)
+void WebSettingsImpl::setDeviceSupportsMouse(bool deviceSupportsMouse)
{
- m_settings->setDeviceSupportsTouch(deviceSupportsTouch);
+ m_settings->setDeviceSupportsMouse(deviceSupportsMouse);
}
bool WebSettingsImpl::deviceSupportsTouch()
@@ -388,6 +389,11 @@ void WebSettingsImpl::setForceCompositingMode(bool enabled)
m_settings->setForceCompositingMode(enabled);
}
+void WebSettingsImpl::setForceSoftwareCompositing(bool enabled)
+{
+ m_forceSoftwareCompositing = enabled;
+}
+
void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled)
{
m_settings->setMockScrollbarsEnabled(enabled);
@@ -586,21 +592,6 @@ void WebSettingsImpl::setAcceleratedPaintingEnabled(bool enabled)
m_settings->setAcceleratedDrawingEnabled(enabled);
}
-void WebSettingsImpl::setPerTilePaintingEnabled(bool enabled)
-{
- m_settings->setPerTileDrawingEnabled(enabled);
-}
-
-void WebSettingsImpl::setPartialSwapEnabled(bool enabled)
-{
- m_settings->setPartialSwapEnabled(enabled);
-}
-
-void WebSettingsImpl::setThreadedAnimationEnabled(bool enabled)
-{
- m_settings->setThreadedAnimationEnabled(enabled);
-}
-
void WebSettingsImpl::setMediaPlaybackRequiresUserGesture(bool required)
{
m_settings->setMediaPlaybackRequiresUserGesture(required);
diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h
index c28908441..2b58c0443 100644
--- a/Source/WebKit/chromium/src/WebSettingsImpl.h
+++ b/Source/WebKit/chromium/src/WebSettingsImpl.h
@@ -50,16 +50,16 @@ public:
virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON);
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 setDefaultFixedFontSize(int);
virtual void setMinimumFontSize(int);
virtual void setMinimumLogicalFontSize(int);
- virtual void setDefaultDeviceScaleFactor(int);
- virtual int defaultDeviceScaleFactor();
virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool);
virtual void setFontBoostingEnabled(bool);
virtual void setDefaultTextEncodingName(const WebString&);
virtual void setDeviceSupportsTouch(bool);
+ virtual void setDeviceSupportsMouse(bool);
virtual bool deviceSupportsTouch();
virtual void setJavaScriptEnabled(bool);
virtual void setWebSecurityEnabled(bool);
@@ -109,6 +109,7 @@ public:
virtual void setEditingBehavior(EditingBehavior);
virtual void setAcceleratedCompositingEnabled(bool);
virtual void setForceCompositingMode(bool);
+ virtual void setForceSoftwareCompositing(bool);
virtual void setMockScrollbarsEnabled(bool);
virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool);
virtual void setAcceleratedCompositingForVideoEnabled(bool);
@@ -143,9 +144,6 @@ public:
virtual void setShouldDisplayCaptions(bool);
virtual void setShouldDisplayTextDescriptions(bool);
virtual void setAcceleratedPaintingEnabled(bool);
- virtual void setPerTilePaintingEnabled(bool);
- virtual void setPartialSwapEnabled(bool);
- virtual void setThreadedAnimationEnabled(bool);
virtual void setFixedPositionCreatesStackingContext(bool);
virtual void setViewportEnabled(bool);
virtual void setMediaPlaybackRequiresUserGesture(bool);
@@ -158,9 +156,11 @@ 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;
+ bool m_forceSoftwareCompositing;
bool m_showFPSCounter;
bool m_showPlatformLayerTree;
bool m_showPaintRects;
diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
index 301c75e36..e44a1b434 100644
--- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
@@ -46,7 +46,6 @@
#include "WebFileError.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
-#include "WebMessagePortChannel.h"
#include "WebRuntimeFeatures.h"
#include "WebSettings.h"
#include "WebSharedWorkerClient.h"
@@ -56,8 +55,9 @@
#include "WorkerInspectorController.h"
#include "WorkerLoaderProxy.h"
#include "WorkerThread.h"
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
+#include <public/WebMessagePortChannel.h>
+#include <public/WebString.h>
+#include <public/WebURL.h>
#include <wtf/MainThread.h>
using namespace WebCore;
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
index dacfa152e..67b7c041e 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
@@ -41,6 +41,7 @@
#include "Color.h"
#include "ColorSpace.h"
#include "CompositionUnderlineVectorBuilder.h"
+#include "ContextFeaturesClientImpl.h"
#include "ContextMenu.h"
#include "ContextMenuController.h"
#include "ContextMenuItem.h"
@@ -127,6 +128,7 @@
#include "WebDevToolsAgentImpl.h"
#include "WebDevToolsAgentPrivate.h"
#include "WebFrameImpl.h"
+#include "WebHelperPluginImpl.h"
#include "WebInputElement.h"
#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
@@ -145,6 +147,7 @@
#include "WebViewClient.h"
#include "WheelEvent.h"
#include "cc/CCProxy.h"
+#include "cc/CCSettings.h"
#include "painting/GraphicsContextBuilder.h"
#include "platform/WebKitPlatformSupport.h"
#include "platform/WebString.h"
@@ -308,13 +311,18 @@ void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient)
// and releases that reference once the corresponding Frame is destroyed.
RefPtr<WebFrameImpl> frame = WebFrameImpl::create(frameClient);
- frame->initializeAsMainFrame(this);
+ frame->initializeAsMainFrame(page());
// Restrict the access to the local file system
// (see WebView.mm WebView::_commonInitializationWithFrameName).
SecurityPolicy::setLocalLoadPolicy(SecurityPolicy::AllowLocalLoadsForLocalOnly);
}
+void WebViewImpl::initializeHelperPluginFrame(WebFrameClient* client)
+{
+ RefPtr<WebFrameImpl> frame = WebFrameImpl::create(client);
+}
+
void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient)
{
m_autofillClient = autofillClient;
@@ -331,6 +339,7 @@ void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient)
void WebViewImpl::setPermissionClient(WebPermissionClient* permissionClient)
{
m_permissionClient = permissionClient;
+ m_featureSwitchClient->setPermissionClient(permissionClient);
}
void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient)
@@ -386,6 +395,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_imeAcceptEvents(true)
, m_operationsAllowed(WebDragOperationNone)
, m_dragOperation(WebDragOperationNone)
+ , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl()))
, m_autofillPopupShowing(false)
, m_autofillPopup(0)
, m_isTransparent(false)
@@ -445,6 +455,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
provideNotification(m_page.get(), notificationPresenterImpl());
#endif
+ provideContextFeaturesTo(m_page.get(), m_featureSwitchClient.get());
provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
provideGeolocationTo(m_page.get(), m_geolocationClientProxy.get());
m_geolocationClientProxy->setController(GeolocationController::from(m_page.get()));
@@ -452,7 +463,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
#if ENABLE(BATTERY_STATUS)
provideBatteryTo(m_page.get(), m_batteryClient.get());
#endif
-
+
m_page->setGroupName(pageGroupName);
#if ENABLE(PAGE_VISIBILITY_API)
@@ -676,6 +687,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
}
return gestureHandled;
}
+ case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureLongPress: {
if (!mainFrameImpl() || !mainFrameImpl()->frameView())
return false;
@@ -1265,6 +1277,19 @@ void WebViewImpl::hideAutofillPopup()
}
}
+WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType)
+{
+ WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin);
+ ASSERT(popupWidget);
+ WebHelperPluginImpl* helperPlugin = static_cast<WebHelperPluginImpl*>(popupWidget);
+
+ if (!helperPlugin->init(this, pluginType)) {
+ helperPlugin->closeHelperPlugin();
+ helperPlugin = 0;
+ }
+ return helperPlugin;
+}
+
Frame* WebViewImpl::focusedWebCoreFrame() const
{
return m_page ? m_page->focusController()->focusedOrMainFrame() : 0;
@@ -1547,7 +1572,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
#endif
} else {
double paintStart = currentTime();
- PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect);
+ PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTransparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque);
double paintEnd = currentTime();
double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart);
WebKit::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
@@ -2461,6 +2486,10 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
// needs to match the one in the compositor.
ASSERT(scaleFactor == m_deviceScaleInCompositor);
}
+ if (!m_layerTreeView.isNull() && m_webSettings->applyDefaultDeviceScaleFactorInCompositor()) {
+ m_deviceScaleInCompositor = page()->deviceScaleFactor();
+ m_layerTreeView.setDeviceScaleFactor(m_deviceScaleInCompositor);
+ }
}
bool WebViewImpl::isFixedLayoutModeEnabled() const
@@ -2956,9 +2985,6 @@ void WebViewImpl::applyAutofillSuggestions(
if (!m_autofillPopup) {
PopupContainerSettings popupSettings = autofillPopupSettings;
- popupSettings.defaultDeviceScaleFactor = settingsImpl()->defaultDeviceScaleFactor();
- if (!popupSettings.defaultDeviceScaleFactor)
- popupSettings.defaultDeviceScaleFactor = 1;
popupSettings.deviceSupportsTouch = settingsImpl()->deviceSupportsTouch();
m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(),
PopupContainer::Suggestion,
@@ -3009,6 +3035,12 @@ void WebViewImpl::setIsTransparent(bool isTransparent)
// Future frames check this to know whether to be transparent.
m_isTransparent = isTransparent;
+
+ if (m_nonCompositedContentHost)
+ m_nonCompositedContentHost->setOpaque(!isTransparent);
+
+ if (!m_layerTreeView.isNull())
+ m_layerTreeView.setHasTransparentBackground(isTransparent);
}
bool WebViewImpl::isTransparent() const
@@ -3387,38 +3419,20 @@ void WebViewImpl::scheduleAnimation()
}
#endif
-class WebViewImplContentPainter : public LayerPainterChromium {
- WTF_MAKE_NONCOPYABLE(WebViewImplContentPainter);
-public:
- static PassOwnPtr<WebViewImplContentPainter*> create(WebViewImpl* webViewImpl)
- {
- return adoptPtr(new WebViewImplContentPainter(webViewImpl));
- }
-
- virtual void paint(GraphicsContext& context, const IntRect& contentRect)
- {
- double paintStart = currentTime();
- Page* page = m_webViewImpl->page();
- if (!page)
- return;
- FrameView* view = page->mainFrame()->view();
- view->paintContents(&context, contentRect);
- double paintEnd = currentTime();
- double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
- WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
- WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
-
- m_webViewImpl->setBackgroundColor(view->documentBackgroundColor());
- }
-
-private:
- explicit WebViewImplContentPainter(WebViewImpl* webViewImpl)
- : m_webViewImpl(webViewImpl)
- {
- }
+void WebViewImpl::paintRootLayer(GraphicsContext& context, const IntRect& contentRect)
+{
+ double paintStart = currentTime();
+ if (!page())
+ return;
+ FrameView* view = page()->mainFrame()->view();
+ view->paintContents(&context, contentRect);
+ double paintEnd = currentTime();
+ double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
+ WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
+ WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
- WebViewImpl* m_webViewImpl;
-};
+ setBackgroundColor(view->documentBackgroundColor());
+}
void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
{
@@ -3447,33 +3461,28 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
layerTreeViewSettings.showFPSCounter = settingsImpl()->showFPSCounter();
layerTreeViewSettings.showPlatformLayerTree = settingsImpl()->showPlatformLayerTree();
layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects();
-
- layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawingEnabled();
- layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSwapEnabled();
- layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->threadedAnimationEnabled();
+ layerTreeViewSettings.forceSoftwareCompositing = settings()->forceSoftwareCompositing();
layerTreeViewSettings.defaultTileSize = settingsImpl()->defaultTileSize();
layerTreeViewSettings.maxUntiledLayerSize = settingsImpl()->maxUntiledLayerSize();
- m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
+ m_nonCompositedContentHost = NonCompositedContentHost::create(this);
m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
-
- if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->settings()->defaultDeviceScaleFactor() != 1) {
- ASSERT(page()->settings()->defaultDeviceScaleFactor());
-
- m_deviceScaleInCompositor = page()->settings()->defaultDeviceScaleFactor();
- layerTreeViewSettings.deviceScaleFactor = m_deviceScaleInCompositor;
- setDeviceScaleFactor(m_deviceScaleInCompositor);
- // When applying a scale factor in the compositor, we disallow page
- // scaling as they are currently incompatible.
- setPageScaleFactorLimits(1, 1);
- }
+ m_nonCompositedContentHost->setOpaque(!isTransparent());
m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings);
if (!m_layerTreeView.isNull()) {
+ if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
+ ASSERT(page()->deviceScaleFactor());
+
+ m_deviceScaleInCompositor = page()->deviceScaleFactor();
+ setDeviceScaleFactor(m_deviceScaleInCompositor);
+ }
+
m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
if (m_compositorSurfaceReady)
m_layerTreeView.setSurfaceReady();
+ m_layerTreeView.setHasTransparentBackground(isTransparent());
updateLayerTreeViewport();
m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier());
m_isAcceleratedCompositingActive = true;
@@ -3495,6 +3504,9 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D()
{
+ if (settings()->forceSoftwareCompositing())
+ CRASH();
+
// Explicitly disable antialiasing for the compositor. As of the time of
// this writing, the only platform that supported antialiasing for the
// compositor was Mac OS X, because the on-screen OpenGL context creation
@@ -3518,6 +3530,9 @@ PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsCo
WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D()
{
+ if (settings()->forceSoftwareCompositing())
+ CRASH();
+
OwnPtr<WebKit::WebGraphicsContext3D> webContext;
// If we've already created an onscreen context for this view, return that.
@@ -3609,15 +3624,10 @@ void WebViewImpl::updateLayerTreeViewport()
IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
IntPoint scroll(view->scrollX(), view->scrollY());
- // In RTL-style pages, the origin of the initial containing block for the
- // root layer may be positive; translate the layer to avoid negative
- // coordinates.
- int layerAdjustX = -view->scrollOrigin().x();
-
// This part of the deviceScale will be used to scale the contents of
// the NCCH's GraphicsLayer.
float deviceScale = m_deviceScaleInCompositor;
- m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, deviceScale, layerAdjustX);
+ m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin(), deviceScale);
m_layerTreeView.setViewportSize(size());
m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h
index 67562feab..4f5c048d9 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.h
+++ b/Source/WebKit/chromium/src/WebViewImpl.h
@@ -86,10 +86,12 @@ namespace WebKit {
class AutocompletePopupMenuClient;
class AutofillPopupMenuClient;
class BatteryClientImpl;
+class ContextFeaturesClientImpl;
class ContextMenuClientImpl;
class DeviceOrientationClientProxy;
class DragScrollTimer;
class GeolocationClientProxy;
+class WebHelperPluginImpl;
class NonCompositedContentHost;
class PrerendererClientImpl;
class SpeechInputClientImpl;
@@ -162,6 +164,7 @@ public:
// WebView methods:
virtual void initializeMainFrame(WebFrameClient*);
+ virtual void initializeHelperPluginFrame(WebFrameClient*);
virtual void setAutofillClient(WebAutofillClient*);
virtual void setDevToolsAgentClient(WebDevToolsAgentClient*);
virtual void setPermissionClient(WebPermissionClient*);
@@ -488,6 +491,8 @@ public:
void hideAutofillPopup();
+ WebHelperPluginImpl* createHelperPlugin(const String& pluginType);
+
// Returns the input event we're currently processing. This is used in some
// cases where the WebCore DOM event doesn't have the information we need.
static const WebInputEvent* currentInputEvent()
@@ -501,6 +506,7 @@ public:
void scheduleCompositingLayerSync();
void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
void invalidateRootLayerRect(const WebCore::IntRect&);
+ void paintRootLayer(WebCore::GraphicsContext&, const WebCore::IntRect& contentRect);
NonCompositedContentHost* nonCompositedContentHost();
void setBackgroundColor(const WebCore::Color&);
#endif
@@ -729,6 +735,9 @@ private:
// current drop target in this WebView (the drop target can accept the drop).
WebDragOperation m_dragOperation;
+ // Context-based feature switches.
+ OwnPtr<ContextFeaturesClientImpl> m_featureSwitchClient;
+
// Whether an Autofill popup is currently showing.
bool m_autofillPopupShowing;
diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
index 09021ef44..7a387c7ed 100644
--- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
@@ -191,6 +191,7 @@ void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL
PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
ASSERT(m_synchronousType == AsynchronousFileSystem || !m_bridgeForCurrentOperation);
+ (void)m_synchronousType;
m_modeForCurrentOperation = fileSystemOperationsMode;
m_modeForCurrentOperation.append(String::number(m_workerContext->thread()->runLoop().createUniqueId()));
diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp
index 6d62098a6..e127cfc6d 100644
--- a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp
+++ b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp
@@ -51,9 +51,8 @@ using namespace WebKit;
namespace WebCore {
WorkerAsyncFileWriterChromium::WorkerAsyncFileWriterChromium(WebFileSystem* webFileSystem, const WebURL& path, WorkerContext* workerContext, AsyncFileWriterClient* client, WriterType type)
- : m_type(type)
{
- ASSERT(m_type == Asynchronous); // Synchronous is not implemented yet.
+ ASSERT(type == Asynchronous); // Synchronous is not implemented yet.
WorkerLoaderProxy* proxy = &workerContext->thread()->workerLoaderProxy();
m_bridge = WorkerFileWriterCallbacksBridge::create(path, proxy, workerContext, client);
diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.h
index 86e6517fa..2408a022a 100644
--- a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.h
+++ b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.h
@@ -79,7 +79,6 @@ private:
WorkerAsyncFileWriterChromium(WebKit::WebFileSystem*, const WebKit::WebURL& path, WorkerContext*, AsyncFileWriterClient*, WriterType);
RefPtr<WebKit::WorkerFileWriterCallbacksBridge> m_bridge;
- WriterType m_type;
};
} // namespace
diff --git a/Source/WebKit/chromium/src/js/DevTools.js b/Source/WebKit/chromium/src/js/DevTools.js
index c4d54238d..ffea8af86 100644
--- a/Source/WebKit/chromium/src/js/DevTools.js
+++ b/Source/WebKit/chromium/src/js/DevTools.js
@@ -41,6 +41,8 @@
Preferences.exposeDisableCache = true;
Preferences.exposeWorkersInspection = true;
Preferences.showDockToRight = true;
+ Preferences.exposeFileSystemInspection = true;
+ Preferences.displayInitiator = true;
})();}
function buildPlatformExtensionAPI(extensionInfo)
diff --git a/Source/WebKit/chromium/src/linux/WebFontInfo.cpp b/Source/WebKit/chromium/src/linux/WebFontInfo.cpp
index b23b77789..327af40c9 100644
--- a/Source/WebKit/chromium/src/linux/WebFontInfo.cpp
+++ b/Source/WebKit/chromium/src/linux/WebFontInfo.cpp
@@ -39,6 +39,13 @@
namespace WebKit {
+static bool useSubpixelPositioning = false;
+
+void WebFontInfo::setSubpixelPositioning(bool subpixelPositioning)
+{
+ useSubpixelPositioning = subpixelPositioning;
+}
+
void WebFontInfo::familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily* family)
{
FcCharSet* cset = FcCharSetCreate();
@@ -185,21 +192,25 @@ void WebFontInfo::renderStyleForStrike(const char* family, int sizeAndStyle, Web
if (FcPatternGetInteger(match, FC_RGBA, 0, &i) == FcResultMatch) {
switch (i) {
case FC_RGBA_NONE:
- out->useSubpixel = 0;
+ out->useSubpixelRendering = 0;
break;
case FC_RGBA_RGB:
case FC_RGBA_BGR:
case FC_RGBA_VRGB:
case FC_RGBA_VBGR:
- out->useSubpixel = 1;
+ out->useSubpixelRendering = 1;
break;
default:
// This includes FC_RGBA_UNKNOWN.
- out->useSubpixel = 2;
+ out->useSubpixelRendering = 2;
break;
}
}
+ // FontConfig doesn't provide parameters to configure whether subpixel
+ // positioning should be used or not, so we just use a global setting.
+ out->useSubpixelPositioning = useSubpixelPositioning;
+
FcPatternDestroy(match);
}
diff --git a/Source/WebKit/chromium/src/linux/WebFontRenderStyle.cpp b/Source/WebKit/chromium/src/linux/WebFontRenderStyle.cpp
index 0b864d1b1..0edf8410e 100644
--- a/Source/WebKit/chromium/src/linux/WebFontRenderStyle.cpp
+++ b/Source/WebKit/chromium/src/linux/WebFontRenderStyle.cpp
@@ -44,7 +44,8 @@ void WebFontRenderStyle::toFontRenderStyle(FontRenderStyle* out)
out->useHinting = useHinting;
out->hintStyle = hintStyle;
out->useAntiAlias = useAntiAlias;
- out->useSubpixel = useSubpixel;
+ out->useSubpixelRendering = useSubpixelRendering;
+ out->useSubpixelPositioning = useSubpixelPositioning;
}
void WebFontRenderStyle::setDefaults()
@@ -54,7 +55,8 @@ void WebFontRenderStyle::setDefaults()
useHinting = 2;
hintStyle = 0;
useAntiAlias = 2;
- useSubpixel = 2;
+ useSubpixelRendering = 2;
+ useSubpixelPositioning = 2;
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/linux/WebFontRendering.cpp b/Source/WebKit/chromium/src/linux/WebFontRendering.cpp
index b9862f58b..7dc98e667 100644
--- a/Source/WebKit/chromium/src/linux/WebFontRendering.cpp
+++ b/Source/WebKit/chromium/src/linux/WebFontRendering.cpp
@@ -33,6 +33,10 @@
#include "FontPlatformData.h"
+#if OS(LINUX)
+#include "WebFontInfo.h"
+#endif
+
using WebCore::FontPlatformData;
namespace WebKit {
@@ -44,15 +48,36 @@ void WebFontRendering::setHinting(SkPaint::Hinting hinting)
}
// static
-void WebFontRendering::setAntiAlias(bool isAntiAlias)
+void WebFontRendering::setAutoHint(bool useAutoHint)
+{
+ FontPlatformData::setAutoHint(useAutoHint);
+}
+
+// static
+void WebFontRendering::setUseBitmaps(bool useBitmaps)
+{
+ FontPlatformData::setUseBitmaps(useBitmaps);
+}
+
+// static
+void WebFontRendering::setAntiAlias(bool useAntiAlias)
+{
+ FontPlatformData::setAntiAlias(useAntiAlias);
+}
+
+// static
+void WebFontRendering::setSubpixelRendering(bool useSubpixelRendering)
{
- FontPlatformData::setAntiAlias(isAntiAlias);
+ FontPlatformData::setSubpixelRendering(useSubpixelRendering);
}
// static
-void WebFontRendering::setSubpixelGlyphs(bool isSubpixelGlyphs)
+void WebFontRendering::setSubpixelPositioning(bool useSubpixelPositioning)
{
- FontPlatformData::setSubpixelGlyphs(isSubpixelGlyphs);
+ FontPlatformData::setSubpixelPositioning(useSubpixelPositioning);
+#if OS(LINUX)
+ WebFontInfo::setSubpixelPositioning(useSubpixelPositioning);
+#endif
}
// static
diff --git a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm
index b9fdc141c..88c3b72e5 100644
--- a/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm
+++ b/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm
@@ -35,6 +35,14 @@
#include "WebScreenInfo.h"
+@interface NSWindow (LionAPI)
+- (CGFloat)backingScaleFactor;
+@end
+
+@interface NSScreen (LionAPI)
+- (CGFloat)backingScaleFactor;
+@end
+
namespace WebKit {
static NSScreen* screenForWindow(NSWindow* window)
@@ -50,40 +58,46 @@ static NSScreen* screenForWindow(NSWindow* window)
return nil;
}
-static WebRect toUserSpace(const NSRect& rect, NSWindow* destination)
+static WebRect convertRect(const NSRect& rect, NSWindow* destination)
{
CGRect userRect = NSRectToCGRect(rect);
-
userRect.origin.y =
- NSMaxY([screenForWindow(destination) frame]) - (userRect.origin.y + userRect.size.height); // flip
-
- if (destination) {
- CGFloat scale = 1 / [destination userSpaceScaleFactor]; // scale down
- userRect.origin.x *= scale;
- userRect.origin.y *= scale;
- userRect.size.width *= scale;
- userRect.size.height *= scale;
- }
-
+ NSMaxY([screenForWindow(destination) frame]) - NSMaxY(rect); // flip
return WebRect(userRect.origin.x,
userRect.origin.y,
userRect.size.width,
userRect.size.height);
}
+static float deviceScaleFactor(NSView* view)
+{
+ NSWindow* window = [view window];
+ if (window)
+ {
+ if ([window respondsToSelector:@selector(backingScaleFactor)])
+ return [window backingScaleFactor];
+ return [window userSpaceScaleFactor];
+ }
+
+ NSArray* screens = [NSScreen screens];
+ if (![screens count])
+ return 1;
+
+ NSScreen* screen = [screens objectAtIndex:0];
+ if ([screen respondsToSelector:@selector(backingScaleFactor)])
+ return [screen backingScaleFactor];
+ return [screen userSpaceScaleFactor];
+}
+
WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view)
{
NSString *colorSpace = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]);
WebScreenInfo results;
- // FIXME: Currently Mac seems to always report 72dpi. Need to find a way to
- // report the true screen dpi.
- NSWindow* window = [view window];
- NSDictionary* deviceDescription = [window deviceDescription];
- NSSize deviceDPI = [[deviceDescription valueForKey:NSDeviceResolution] sizeValue];
- results.horizontalDPI = static_cast<int>(deviceDPI.width);
- results.verticalDPI = static_cast<int>(deviceDPI.height);
+ float deviceDPI = 160 * deviceScaleFactor(view);
+ results.horizontalDPI = deviceDPI;
+ results.verticalDPI = deviceDPI;
results.depth =
NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]);
@@ -93,10 +107,9 @@ WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view)
|| colorSpace == NSCalibratedBlackColorSpace
|| colorSpace == NSDeviceWhiteColorSpace
|| colorSpace == NSDeviceBlackColorSpace;
- results.rect =
- toUserSpace([screenForWindow([view window]) frame], [view window]);
+ results.rect = convertRect([screenForWindow([view window]) frame], [view window]);
results.availableRect =
- toUserSpace([screenForWindow([view window]) visibleFrame], [view window]);
+ convertRect([screenForWindow([view window]) visibleFrame], [view window]);
return results;
}
diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
index bdf3a3ab4..03559f7f1 100644
--- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
+++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
@@ -585,4 +585,34 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderWhitelisting)
EXPECT_FALSE(CheckAccessControlHeaders("Set-Cookie", true));
}
+// Test that the loader can allow non-whitelisted response headers for trusted CORS loads.
+TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders)
+{
+ WebURLRequest request;
+ request.initialize();
+ GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html");
+ request.setURL(url);
+
+ WebString headerNameString(WebString::fromUTF8("non-whitelisted"));
+ m_expectedResponse = WebURLResponse();
+ m_expectedResponse.initialize();
+ m_expectedResponse.setMIMEType("text/html");
+ m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*");
+ m_expectedResponse.addHTTPHeaderField(headerNameString, "foo");
+ webkit_support::RegisterMockedURL(url, m_expectedResponse, m_frameFilePath);
+
+ WebURLLoaderOptions options;
+ options.exposeAllResponseHeaders = true; // This turns off response whitelisting.
+ options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
+ m_expectedLoader = createAssociatedURLLoader(options);
+ EXPECT_TRUE(m_expectedLoader);
+ m_expectedLoader->loadAsynchronously(request, this);
+ serveRequests();
+ EXPECT_TRUE(m_didReceiveResponse);
+ EXPECT_TRUE(m_didReceiveData);
+ EXPECT_TRUE(m_didFinishLoading);
+
+ EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
+}
+
}
diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
index 0e8c1a401..854595380 100644
--- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
+++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
@@ -29,9 +29,12 @@
#include "GraphicsLayer.h"
#include "LayerChromium.h"
#include "TranslateTransformOperation.h"
+#include "cc/CCKeyframedAnimationCurve.h"
#include "cc/CCLayerAnimationController.h"
#include "cc/CCLayerImpl.h"
+#include <public/WebTransformOperations.h>
+
using namespace WebCore;
namespace {
@@ -39,38 +42,38 @@ namespace {
template <class Target>
void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
- WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
- if (duration > 0)
- values.insert(new FloatAnimationValue(0, startOpacity));
- values.insert(new FloatAnimationValue(duration, endOpacity));
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create());
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- if (useTimingFunction)
- animation->setTimingFunction(LinearTimingFunction::create());
+ if (duration > 0)
+ curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFunction ? nullptr : CCEaseTimingFunction::create()));
+ curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, nullptr));
- IntSize boxSize;
+ OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), 0, 0, CCActiveAnimation::Opacity));
+ animation->setNeedsSynchronizedStartTime(true);
- target.addAnimation(values, boxSize, animation.get(), 0, 0, 0);
+ target.addAnimation(animation.release());
}
template <class Target>
void addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY)
{
static int id = 0;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
- TransformOperations operations;
- operations.operations().append(TranslateTransformOperation::create(Length(deltaX, WebCore::Fixed), Length(deltaY, WebCore::Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations));
+ if (duration > 0) {
+ WebKit::WebTransformOperations startOperations;
+ startOperations.appendTranslate(deltaX, deltaY, 0);
+ curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, nullptr));
+ }
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
+ WebKit::WebTransformOperations operations;
+ operations.appendTranslate(deltaX, deltaY, 0);
+ curve->addKeyframe(CCTransformKeyframe::create(duration, operations, nullptr));
- IntSize boxSize;
+ OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), id++, 0, CCActiveAnimation::Transform));
+ animation->setNeedsSynchronizedStartTime(true);
- target.addAnimation(values, boxSize, animation.get(), ++id, 0, 0);
+ target.addAnimation(animation.release());
}
} // namespace
@@ -99,7 +102,7 @@ FakeTransformTransition::~FakeTransformTransition()
{
}
-WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const
+WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) const
{
return WebKit::WebTransformationMatrix();
}
diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
index 4384117d3..4bbd60112 100644
--- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
+++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
@@ -54,7 +54,7 @@ public:
virtual ~FakeTransformTransition();
virtual double duration() const OVERRIDE { return m_duration; }
- virtual WebKit::WebTransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE;
+ virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE;
virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE;
@@ -89,12 +89,10 @@ public:
virtual float opacity() const OVERRIDE { return m_opacity; }
virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix& transform) OVERRIDE { m_transform = transform; }
virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; }
- virtual const WebCore::IntSize& bounds() const OVERRIDE { return m_bounds; }
private:
float m_opacity;
WebKit::WebTransformationMatrix m_transform;
- WebCore::IntSize m_bounds;
};
void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
index 56d85fafa..f498069f0 100644
--- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
@@ -58,7 +58,18 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, Vector<CCLay
root->renderSurface()->clearLayerList();
renderSurfaceLayerList.append(root);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(root, root, identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, &layerSorter, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, &layerSorter, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, root->renderSurface()->contentRect());
+}
+
+void clearDamageForAllSurfaces(CCLayerImpl* layer)
+{
+ if (layer->renderSurface())
+ layer->renderSurface()->damageTracker()->didDrawDamagedArea();
+
+ // Recursively clear damage for any existing surface.
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ clearDamageForAllSurfaces(layer->children()[i].get());
}
void emulateDrawingOneFrame(CCLayerImpl* root)
@@ -221,6 +232,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects)
// CASE 1: Setting the update rect should cause the corresponding damage to the surface.
//
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
@@ -230,6 +242,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects)
// CASE 2: The same update rect twice in a row still produces the same damage.
//
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -237,6 +250,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects)
// CASE 3: Setting a different update rect should cause damage on the new update region, but no additional exposed old region.
//
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(20, 25, 1, 2));
emulateDrawingOneFrame(root.get());
@@ -252,6 +266,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges)
// CASE 1: The layer's property changed flag takes priority over update rect.
//
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(10, 11, 12, 13));
child->setOpacity(0.5);
emulateDrawingOneFrame(root.get());
@@ -270,10 +285,12 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges)
// not just the updateRect.
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
// Then, test the actual layer movement.
+ clearDamageForAllSurfaces(root.get());
child->setPosition(FloatPoint(200, 230));
emulateDrawingOneFrame(root.get());
@@ -297,6 +314,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer)
// Note carefully, the anchor is actually part of layer->position(). By setting anchor
// to (0.5, 0.5), the layer's position (100, 100) now refers to the center of the
// layer, not the corner. This means the layer has actually changed position.
+ clearDamageForAllSurfaces(root.get());
child->setAnchorPoint(FloatPoint(0.5, 0.5));
emulateDrawingOneFrame(root.get());
@@ -306,6 +324,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer)
// With the anchor on the layer's center, now we can test the rotation more
// intuitively, since it applies about the layer's anchor.
+ clearDamageForAllSurfaces(root.get());
child->setTransform(rotation);
emulateDrawingOneFrame(root.get());
@@ -326,15 +345,17 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
// tracked properly.
//
// The transform is constructed so that if w < 0 clipping is not performed, the
- // incorrect rect will be very small, specifically: position (-3.153448, -2.750628) and size 8.548689 x 5.661383.
- // Instead, the correctly transformed rect should actually be very huge (i.e. in theory, infinite)
+ // incorrect rect will be very small, specifically: position (500.972504, 498.544617) and size 0.056610 x 2.910767.
+ // Instead, the correctly transformed rect should actually be very huge (i.e. in theory, -infinity on the left),
+ // and positioned so that the right-most bound rect will be approximately 501 units in root surface space.
+ //
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
CCLayerImpl* child = root->children()[0].get();
WebTransformationMatrix transform;
+ transform.translate3d(500, 500, 0);
transform.applyPerspective(1);
- transform.translate3d(-150, -50, 0);
transform.rotate3d(0, 45, 0);
transform.translate3d(-50, -50, 0);
@@ -352,14 +373,15 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
EXPECT_TRUE(clipped);
// Damage the child without moving it.
+ clearDamageForAllSurfaces(root.get());
child->setOpacity(0.5);
emulateDrawingOneFrame(root.get());
// The expected damage should cover the entire root surface (500x500), but we don't
// care whether the damage rect was clamped or is larger than the surface for this test.
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_GE(rootDamageRect.width(), 500);
- EXPECT_GE(rootDamageRect.height(), 500);
+ FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
+ EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout));
}
TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface)
@@ -371,12 +393,14 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface)
filters.append(WebFilterOperation::createBlurFilter(5));
int outsetTop, outsetRight, outsetBottom, outsetLeft;
filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
- root->setFilters(filters);
// Setting the filter will damage the whole surface.
+ clearDamageForAllSurfaces(root.get());
+ root->setFilters(filters);
emulateDrawingOneFrame(root.get());
// Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
@@ -401,16 +425,17 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
filters.append(WebFilterOperation::createBlurFilter(2));
int outsetTop, outsetRight, outsetBottom, outsetLeft;
filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
- child1->setBackgroundFilters(filters);
// Setting the filter will damage the whole surface.
+ clearDamageForAllSurfaces(root.get());
+ child1->setBackgroundFilters(filters);
emulateDrawingOneFrame(root.get());
// CASE 1: Setting the update rect should cause the corresponding damage to
// the surface, blurred based on the size of the child's background blur
// filter.
+ clearDamageForAllSurfaces(root.get());
root->setUpdateRect(FloatRect(297, 297, 2, 2));
-
emulateDrawingOneFrame(root.get());
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -425,8 +450,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// the surface, blurred based on the size of the child's background blur
// filter. Since the damage extends to the right/bottom outside of the
// blurred layer, only the left/top should end up expanded.
+ clearDamageForAllSurfaces(root.get());
root->setUpdateRect(FloatRect(297, 297, 30, 30));
-
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -440,8 +465,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 3: Setting this update rect outside the blurred contentBounds of the blurred
// child1 will not cause it to be expanded.
+ clearDamageForAllSurfaces(root.get());
root->setUpdateRect(FloatRect(30, 30, 2, 2));
-
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -452,8 +477,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 4: Setting this update rect inside the blurred contentBounds but outside the
// original contentBounds of the blurred child1 will cause it to be expanded.
+ clearDamageForAllSurfaces(root.get());
root->setUpdateRect(FloatRect(99, 99, 1, 1));
-
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -467,8 +492,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 5: Setting the update rect on child2, which is above child1, will
// not get blurred by child1, so it does not need to get expanded.
+ clearDamageForAllSurfaces(root.get());
child2->setUpdateRect(FloatRect(0, 0, 1, 1));
-
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -478,8 +503,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// CASE 6: Setting the update rect on child1 will also blur the damage, so
// that any pixels needed for the blur are redrawn in the current frame.
+ clearDamageForAllSurfaces(root.get());
child1->setUpdateRect(FloatRect(0, 0, 1, 1));
-
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -495,6 +520,9 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
CCLayerImpl* child1 = root->children()[0].get();
+ // CASE 1: Adding a new layer should cause the appropriate damage.
+ //
+ clearDamageForAllSurfaces(root.get());
{
OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
child2->setPosition(FloatPoint(400, 380));
@@ -503,9 +531,6 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
child2->setDrawsContent(true);
root->addChild(child2.release());
}
-
- // CASE 1: Adding a new layer should cause the appropriate damage.
- //
emulateDrawingOneFrame(root.get());
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
@@ -518,6 +543,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
// last update rect.
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
@@ -535,6 +561,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer)
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+ clearDamageForAllSurfaces(root.get());
{
OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
child2->setPosition(FloatPoint(400, 380));
@@ -548,7 +575,6 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer)
ASSERT_TRUE(child2->updateRect().isEmpty());
root->addChild(child2.release());
}
-
emulateDrawingOneFrame(root.get());
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
@@ -563,6 +589,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers)
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
CCLayerImpl* child1 = root->children()[0].get();
+ // In this test we don't want the above tree manipulation to be considered part of the same frame.
+ clearDamageForAllSurfaces(root.get());
{
OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
child2->setPosition(FloatPoint(400, 380));
@@ -572,13 +600,12 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers)
root->addChild(child2.release());
}
CCLayerImpl* child2 = root->children()[1].get();
-
- // In this test we don't want the above tree manipulation to be considered part of the same frame.
emulateDrawingOneFrame(root.get());
// Damaging two layers simultaneously should cause combined damage.
// - child1 update rect in surface space: FloatRect(100, 100, 1, 2);
// - child2 update rect in surface space: FloatRect(400, 380, 3, 4);
+ clearDamageForAllSurfaces(root.get());
child1->setUpdateRect(FloatRect(0, 0, 1, 2));
child2->setUpdateRect(FloatRect(0, 0, 3, 4));
emulateDrawingOneFrame(root.get());
@@ -597,6 +624,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces)
// CASE 1: Damage to a descendant surface should propagate properly to ancestor surface.
//
+ clearDamageForAllSurfaces(root.get());
grandChild1->setOpacity(0.5);
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
@@ -607,6 +635,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces)
// CASE 2: Same as previous case, but with additional damage elsewhere that should be properly unioned.
// - child1 surface damage in root surface space: FloatRect(300, 300, 6, 8);
// - child2 damage in root surface space: FloatRect(11, 11, 18, 18);
+ clearDamageForAllSurfaces(root.get());
grandChild1->setOpacity(0.7f);
child2->setOpacity(0.7f);
emulateDrawingOneFrame(root.get());
@@ -631,6 +660,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
FloatRect childDamageRect;
FloatRect rootDamageRect;
+ clearDamageForAllSurfaces(root.get());
grandChild1->setPosition(FloatPoint(195, 205));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
@@ -662,6 +692,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
FloatRect childDamageRect;
FloatRect rootDamageRect;
+ clearDamageForAllSurfaces(root.get());
child1->setPosition(FloatPoint(50, 50));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
@@ -685,6 +716,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// CASE 1: If a descendant surface disappears, its entire old area becomes exposed.
//
+ clearDamageForAllSurfaces(root.get());
child1->setOpacity(1);
emulateDrawingOneFrame(root.get());
@@ -698,11 +730,13 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// CASE 2: If a descendant surface appears, its entire old area becomes exposed.
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_TRUE(rootDamageRect.isEmpty());
// Then change the tree so that the render surface is added back.
+ clearDamageForAllSurfaces(root.get());
child1->setOpacity(0.5);
emulateDrawingOneFrame(root.get());
@@ -726,6 +760,7 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged)
// CASE 1: If nothing changes, the damage rect should be empty.
//
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -734,6 +769,7 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged)
// CASE 2: If nothing changes twice in a row, the damage rect should still be empty.
//
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -750,6 +786,7 @@ TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
// In our specific tree, the update rect of child1 should not cause any damage to any
// surface because it does not actually draw content.
+ clearDamageForAllSurfaces(root.get());
child1->setUpdateRect(FloatRect(0, 0, 1, 2));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
@@ -785,6 +822,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica)
// CASE 1: adding a reflection about the left edge of grandChild1.
//
+ clearDamageForAllSurfaces(root.get());
{
OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7);
grandChild1Replica->setPosition(FloatPoint::zero());
@@ -808,6 +846,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica)
// CASE 2: moving the descendant surface should cause both the original and reflected
// areas to be damaged on the target.
+ clearDamageForAllSurfaces(root.get());
IntRect oldContentRect = child1->renderSurface()->contentRect();
grandChild1->setPosition(FloatPoint(195.0, 205.0));
emulateDrawingOneFrame(root.get());
@@ -827,6 +866,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplica)
// CASE 3: removing the reflection should cause the entire region including reflection
// to damage the target surface.
+ clearDamageForAllSurfaces(root.get());
grandChild1->setReplicaLayer(nullptr);
emulateDrawingOneFrame(root.get());
ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width());
@@ -848,6 +888,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask)
// In the current implementation of the damage tracker, changes to mask layers should
// damage the entire corresponding surface.
+ clearDamageForAllSurfaces(root.get());
+
// Set up the mask layer.
{
OwnPtr<CCLayerImpl> maskLayer = CCLayerImpl::create(3);
@@ -875,6 +917,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask)
// CASE 1: the updateRect on a mask layer should damage the entire target surface.
//
+ clearDamageForAllSurfaces(root.get());
maskLayer->setUpdateRect(FloatRect(1, 2, 3, 4));
emulateDrawingOneFrame(root.get());
FloatRect childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
@@ -884,12 +927,15 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask)
//
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_TRUE(childDamageRect.isEmpty());
// Then test the property change.
- maskLayer->setOpacity(0.5);
+ clearDamageForAllSurfaces(root.get());
+ maskLayer->setStackingOrderChanged(true);
+
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
@@ -898,11 +944,13 @@ TEST_F(CCDamageTrackerTest, verifyDamageForMask)
//
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
+ clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_TRUE(childDamageRect.isEmpty());
// Then test mask removal.
+ clearDamageForAllSurfaces(root.get());
child->setMaskLayer(nullptr);
ASSERT_TRUE(child->layerPropertyChanged());
emulateDrawingOneFrame(root.get());
@@ -923,6 +971,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask)
// Changes to a replica's mask should not damage the original surface, because it is
// not masked. But it does damage the ancestor target surface.
+ clearDamageForAllSurfaces(root.get());
+
// Create a reflection about the left edge of grandChild1.
{
OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6);
@@ -951,7 +1001,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask)
ASSERT_TRUE(grandChild1->renderSurface());
// CASE 1: a property change on the mask should damage only the reflected region on the target surface.
- replicaMaskLayer->setOpacity(0.6f);
+ clearDamageForAllSurfaces(root.get());
+ replicaMaskLayer->setStackingOrderChanged(true);
emulateDrawingOneFrame(root.get());
FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
@@ -962,6 +1013,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask)
// CASE 2: removing the replica mask damages only the reflected region on the target surface.
//
+ clearDamageForAllSurfaces(root.get());
grandChild1Replica->setMaskLayer(nullptr);
emulateDrawingOneFrame(root.get());
@@ -982,6 +1034,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
// incorrect old code incorrectly accounted for the anchor for the replica. A
// non-zero anchor point should not affect the replica reflection.
+ clearDamageForAllSurfaces(root.get());
+
grandChild1->setAnchorPoint(FloatPoint(1.0, 0.0)); // This is the anchor being tested.
{
@@ -1011,7 +1065,9 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
ASSERT_TRUE(grandChild1->renderSurface());
// A property change on the replicaMask should damage the reflected region on the target surface.
- replicaMaskLayer->setOpacity(0.6f);
+ clearDamageForAllSurfaces(root.get());
+ replicaMaskLayer->setStackingOrderChanged(true);
+
emulateDrawingOneFrame(root.get());
FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
@@ -1026,6 +1082,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage)
// Case 1: This test ensures that when the tracker is forced to have full damage, that
// it takes priority over any other partial damage.
//
+ clearDamageForAllSurfaces(root.get());
child->setUpdateRect(FloatRect(10, 11, 12, 13));
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
@@ -1035,6 +1092,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage)
// Case 2: An additional sanity check that forcing full damage works even when nothing
// on the layer tree changed.
//
+ clearDamageForAllSurfaces(root.get());
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -1058,4 +1116,36 @@ TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList)
EXPECT_TRUE(damageRect.isEmpty());
}
+TEST_F(CCDamageTrackerTest, verifyDamageAccumulatesUntilReset)
+{
+ // If damage is not cleared, it should accumulate.
+
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+ CCLayerImpl* child = root->children()[0].get();
+
+ clearDamageForAllSurfaces(root.get());
+ child->setUpdateRect(FloatRect(10, 11, 1, 2));
+ emulateDrawingOneFrame(root.get());
+
+ // Sanity check damage after the first frame; this isnt the actual test yet.
+ FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 1, 2), rootDamageRect);
+
+ // New damage, without having cleared the previous damage, should be unioned to the previous one.
+ child->setUpdateRect(FloatRect(20, 25, 1, 2));
+ emulateDrawingOneFrame(root.get());
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 11, 16), rootDamageRect);
+
+ // If we notify the damage tracker that we drew the damaged area, then damage should be emptied.
+ root->renderSurface()->damageTracker()->didDrawDamagedArea();
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_TRUE(rootDamageRect.isEmpty());
+
+ // Damage should remain empty even after one frame, since there's yet no new damage
+ emulateDrawingOneFrame(root.get());
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_TRUE(rootDamageRect.isEmpty());
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp
index ad1ae74ca..eb6bb0363 100644
--- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp
+++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp
@@ -31,6 +31,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include <public/WebTransformOperations.h>
#include <public/WebTransformationMatrix.h>
#include <wtf/OwnPtr.h>
#include <wtf/Vector.h>
@@ -113,57 +114,55 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes)
TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe)
{
OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
- TransformOperations operations;
- operations.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
+ WebKit::WebTransformOperations operations;
+ operations.appendTranslate(2, 0, 0);
curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr));
- IntSize layerSize; // ignored
- expectTranslateX(2, curve->getValue(-1, layerSize));
- expectTranslateX(2, curve->getValue(0, layerSize));
- expectTranslateX(2, curve->getValue(0.5, layerSize));
- expectTranslateX(2, curve->getValue(1, layerSize));
- expectTranslateX(2, curve->getValue(2, layerSize));
+ expectTranslateX(2, curve->getValue(-1));
+ expectTranslateX(2, curve->getValue(0));
+ expectTranslateX(2, curve->getValue(0.5));
+ expectTranslateX(2, curve->getValue(1));
+ expectTranslateX(2, curve->getValue(2));
}
// Tests that a transform animation with two keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe)
{
OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
+ WebKit::WebTransformOperations operations1;
+ operations1.appendTranslate(2, 0, 0);
+ WebKit::WebTransformOperations operations2;
+ operations2.appendTranslate(4, 0, 0);
+
curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr));
- IntSize layerSize; // ignored
- expectTranslateX(2, curve->getValue(-1, layerSize));
- expectTranslateX(2, curve->getValue(0, layerSize));
- expectTranslateX(3, curve->getValue(0.5, layerSize));
- expectTranslateX(4, curve->getValue(1, layerSize));
- expectTranslateX(4, curve->getValue(2, layerSize));
+ expectTranslateX(2, curve->getValue(-1));
+ expectTranslateX(2, curve->getValue(0));
+ expectTranslateX(3, curve->getValue(0.5));
+ expectTranslateX(4, curve->getValue(1));
+ expectTranslateX(4, curve->getValue(2));
}
// Tests that a transform animation with three keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe)
{
OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations3;
- operations3.operations().append(TranslateTransformOperation::create(Length(8, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
+ WebKit::WebTransformOperations operations1;
+ operations1.appendTranslate(2, 0, 0);
+ WebKit::WebTransformOperations operations2;
+ operations2.appendTranslate(4, 0, 0);
+ WebKit::WebTransformOperations operations3;
+ operations3.appendTranslate(8, 0, 0);
curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr));
- IntSize layerSize; // ignored
- expectTranslateX(2, curve->getValue(-1, layerSize));
- expectTranslateX(2, curve->getValue(0, layerSize));
- expectTranslateX(3, curve->getValue(0.5, layerSize));
- expectTranslateX(4, curve->getValue(1, layerSize));
- expectTranslateX(6, curve->getValue(1.5, layerSize));
- expectTranslateX(8, curve->getValue(2, layerSize));
- expectTranslateX(8, curve->getValue(3, layerSize));
+ expectTranslateX(2, curve->getValue(-1));
+ expectTranslateX(2, curve->getValue(0));
+ expectTranslateX(3, curve->getValue(0.5));
+ expectTranslateX(4, curve->getValue(1));
+ expectTranslateX(6, curve->getValue(1.5));
+ expectTranslateX(8, curve->getValue(2));
+ expectTranslateX(8, curve->getValue(3));
}
// Tests that a transform animation with multiple keys at a given time works sanely.
@@ -171,32 +170,30 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes)
{
OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
// A step function.
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations3;
- operations3.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- TransformOperations operations4;
- operations4.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
+ WebKit::WebTransformOperations operations1;
+ operations1.appendTranslate(4, 0, 0);
+ WebKit::WebTransformOperations operations2;
+ operations2.appendTranslate(4, 0, 0);
+ WebKit::WebTransformOperations operations3;
+ operations3.appendTranslate(6, 0, 0);
+ WebKit::WebTransformOperations operations4;
+ operations4.appendTranslate(6, 0, 0);
curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(1, operations3, nullptr));
curve->addKeyframe(CCTransformKeyframe::create(2, operations4, nullptr));
- IntSize layerSize; // ignored
-
- expectTranslateX(4, curve->getValue(-1, layerSize));
- expectTranslateX(4, curve->getValue(0, layerSize));
- expectTranslateX(4, curve->getValue(0.5, layerSize));
+ expectTranslateX(4, curve->getValue(-1));
+ expectTranslateX(4, curve->getValue(0));
+ expectTranslateX(4, curve->getValue(0.5));
// There is a discontinuity at 1. Any value between 4 and 6 is valid.
- WebTransformationMatrix value = curve->getValue(1, layerSize);
+ WebTransformationMatrix value = curve->getValue(1);
EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6);
- expectTranslateX(6, curve->getValue(1.5, layerSize));
- expectTranslateX(6, curve->getValue(2, layerSize));
- expectTranslateX(6, curve->getValue(3, layerSize));
+ expectTranslateX(6, curve->getValue(1.5));
+ expectTranslateX(6, curve->getValue(2));
+ expectTranslateX(6, curve->getValue(3));
}
// Tests that the keyframes may be added out of order.
diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
index dbed02c74..72361092a 100644
--- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
@@ -29,7 +29,6 @@
#include "CCAnimationTestCommon.h"
#include "GraphicsLayer.h"
#include "Length.h"
-#include "TranslateTransformOperation.h"
#include "cc/CCActiveAnimation.h"
#include "cc/CCAnimationCurve.h"
@@ -54,197 +53,6 @@ PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve>
return CCActiveAnimation::create(curve, 0, id, property);
}
-TEST(CCLayerAnimationControllerTest, createOpacityAnimation)
-{
- FakeLayerAnimationControllerClient dummy;
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
- const double duration = 1;
- WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
- values.insert(new FloatAnimationValue(0, 0));
- values.insert(new FloatAnimationValue(duration, 1));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0);
-
- EXPECT_TRUE(controller->hasActiveAnimation());
-
- CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Opacity);
- EXPECT_TRUE(activeAnimation);
-
- EXPECT_EQ(1, activeAnimation->iterations());
- EXPECT_EQ(CCActiveAnimation::Opacity, activeAnimation->targetProperty());
-
- EXPECT_EQ(CCAnimationCurve::Float, activeAnimation->curve()->type());
-
- const CCFloatAnimationCurve* curve = activeAnimation->curve()->toFloatAnimationCurve();
- EXPECT_TRUE(curve);
-
- EXPECT_EQ(0, curve->getValue(0));
- EXPECT_EQ(1, curve->getValue(duration));
-}
-
-TEST(CCLayerAnimationControllerTest, createTransformAnimation)
-{
- FakeLayerAnimationControllerClient dummy;
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
- const double duration = 1;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(duration, &operations2));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
-
- IntSize boxSize;
- controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0);
-
- EXPECT_TRUE(controller->hasActiveAnimation());
-
- CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform);
- EXPECT_TRUE(activeAnimation);
-
- EXPECT_EQ(1, activeAnimation->iterations());
- EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
-
- EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
-
- const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
- EXPECT_TRUE(curve);
-
- expectTranslateX(2, curve->getValue(0, boxSize));
- expectTranslateX(4, curve->getValue(duration, boxSize));
-}
-
-TEST(CCLayerAnimationControllerTest, createReversedAnimation)
-{
- FakeLayerAnimationControllerClient dummy;
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
- const double duration = 1;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(duration, &operations2));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
- animation->setDirection(Animation::AnimationDirectionReverse);
-
- IntSize boxSize;
- controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0);
-
- EXPECT_TRUE(controller->hasActiveAnimation());
-
- CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform);
- EXPECT_TRUE(activeAnimation);
-
- EXPECT_EQ(1, activeAnimation->iterations());
- EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
-
- EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
-
- const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
- EXPECT_TRUE(curve);
-
- expectTranslateX(4, curve->getValue(0, boxSize));
- expectTranslateX(2, curve->getValue(duration, boxSize));
-}
-
-TEST(CCLayerAnimationControllerTest, createAlternatingAnimation)
-{
- FakeLayerAnimationControllerClient dummy;
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
- const double duration = 1;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(duration, &operations2));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
- animation->setDirection(Animation::AnimationDirectionAlternate);
- animation->setIterationCount(2);
-
- IntSize boxSize;
- controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0);
-
- EXPECT_TRUE(controller->hasActiveAnimation());
-
- CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform);
- EXPECT_TRUE(activeAnimation);
- EXPECT_TRUE(activeAnimation->alternatesDirection());
-
- EXPECT_EQ(2, activeAnimation->iterations());
- EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
-
- EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
-
- const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
- EXPECT_TRUE(curve);
-
- expectTranslateX(2, curve->getValue(0, boxSize));
- expectTranslateX(4, curve->getValue(duration, boxSize));
-}
-
-TEST(CCLayerAnimationControllerTest, createReversedAlternatingAnimation)
-{
- FakeLayerAnimationControllerClient dummy;
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
- const double duration = 1;
- WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
-
- TransformOperations operations1;
- operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(0, &operations1));
-
- TransformOperations operations2;
- operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X));
- values.insert(new TransformAnimationValue(duration, &operations2));
-
- RefPtr<Animation> animation = Animation::create();
- animation->setDuration(duration);
- animation->setDirection(Animation::AnimationDirectionAlternateReverse);
- animation->setIterationCount(2);
-
- IntSize boxSize;
- controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0);
-
- EXPECT_TRUE(controller->hasActiveAnimation());
-
- CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Transform);
- EXPECT_TRUE(activeAnimation);
- EXPECT_TRUE(activeAnimation->alternatesDirection());
-
- EXPECT_EQ(2, activeAnimation->iterations());
- EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
-
- EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
-
- const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
- EXPECT_TRUE(curve);
-
- expectTranslateX(4, curve->getValue(0, boxSize));
- expectTranslateX(2, curve->getValue(duration, boxSize));
-}
-
TEST(CCLayerAnimationControllerTest, syncNewAnimation)
{
FakeLayerAnimationControllerClient dummyImpl;
@@ -333,7 +141,6 @@ TEST(CCLayerAnimationControllerTest, syncPauseAndResume)
EXPECT_EQ(CCActiveAnimation::Running, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
}
-
TEST(CCLayerAnimationControllerTest, doNotSyncFinishedAnimation)
{
FakeLayerAnimationControllerClient dummyImpl;
@@ -375,7 +182,7 @@ TEST(CCLayerAnimationControllerTest, TrivialTransition)
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
EXPECT_EQ(0, dummy.opacity());
@@ -396,7 +203,7 @@ TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfT
toAdd->setNeedsSynchronizedStartTime(true);
// We should pause at the first keyframe indefinitely waiting for that animation to start.
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
EXPECT_EQ(0, dummy.opacity());
@@ -422,8 +229,8 @@ TEST(CCLayerAnimationControllerTest, TrivialQueuing)
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -443,14 +250,14 @@ TEST(CCLayerAnimationControllerTest, Interrupt)
FakeLayerAnimationControllerClient dummy;
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
EXPECT_EQ(0, dummy.opacity());
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity));
toAdd->setRunState(CCActiveAnimation::WaitingForNextTick, 0);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
// Since the animation was in the WaitingForNextTick state, it should start right in
// this call to animate.
@@ -470,9 +277,9 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked)
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 1, CCActiveAnimation::Transform));
- controller->add(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 2, CCActiveAnimation::Transform));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 2, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 1, CCActiveAnimation::Transform));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), 2, CCActiveAnimation::Transform));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 2, CCActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_EQ(0, dummy.opacity());
@@ -497,9 +304,9 @@ TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting)
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeTransformTransition(2)), 1, CCActiveAnimation::Transform));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(2)), 1, CCActiveAnimation::Transform));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5)), 2, CCActiveAnimation::Opacity));
// Animations with id 1 should both start now.
controller->animate(0, events.get());
@@ -530,7 +337,7 @@ TEST(CCLayerAnimationControllerTest, ScheduleAnimation)
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0);
toAdd->setStartTime(1);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -551,12 +358,12 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0.5, 0)), 2, CCActiveAnimation::Opacity));
toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0);
toAdd->setStartTime(1);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
// First 2s opacity transition should start immediately.
controller->animate(0, events.get());
@@ -582,14 +389,14 @@ TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimatio
OwnPtr<CCLayerAnimationController> controller(
CCLayerAnimationController::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0.5, 0)), 2, CCActiveAnimation::Opacity));
toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0);
toAdd->setStartTime(1);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 0.75)), 3, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 0.75)), 3, CCActiveAnimation::Opacity));
// First 2s opacity transition should start immediately.
controller->animate(0, events.get());
@@ -620,7 +427,7 @@ TEST(CCLayerAnimationControllerTest, TrivialLooping)
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
toAdd->setIterations(3);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -657,7 +464,7 @@ TEST(CCLayerAnimationControllerTest, InfiniteLooping)
const int id = 1;
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity));
toAdd->setIterations(-1);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -691,7 +498,7 @@ TEST(CCLayerAnimationControllerTest, PauseResume)
CCLayerAnimationController::create(&dummy));
const int id = 1;
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -726,9 +533,9 @@ TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation)
CCLayerAnimationController::create(&dummy));
const int id = 1;
- controller->add(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), id, CCActiveAnimation::Transform));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), id, CCActiveAnimation::Opacity));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.75)), 2, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeTransformTransition(1)), id, CCActiveAnimation::Transform));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), id, CCActiveAnimation::Opacity));
+ controller->addAnimation(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.75)), 2, CCActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -758,7 +565,7 @@ TEST(CCLayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded)
OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 0, CCActiveAnimation::Opacity));
toAdd->setNeedsSynchronizedStartTime(true);
- controller->add(toAdd.release());
+ controller->addAnimation(toAdd.release());
controller->animate(0, 0);
EXPECT_TRUE(controller->hasActiveAnimation());
diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
index 827c9adaa..01f943a64 100644
--- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
@@ -42,21 +42,33 @@ namespace {
codeToTest; \
EXPECT_TRUE(root->layerPropertyChanged()); \
EXPECT_TRUE(child->layerPropertyChanged()); \
- EXPECT_TRUE(grandChild->layerPropertyChanged())
+ EXPECT_TRUE(grandChild->layerPropertyChanged()); \
+ EXPECT_FALSE(root->layerSurfacePropertyChanged())
+
#define EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(codeToTest) \
root->resetAllChangeTrackingForSubtree(); \
codeToTest; \
EXPECT_FALSE(root->layerPropertyChanged()); \
EXPECT_FALSE(child->layerPropertyChanged()); \
- EXPECT_FALSE(grandChild->layerPropertyChanged())
+ EXPECT_FALSE(grandChild->layerPropertyChanged()); \
+ EXPECT_FALSE(root->layerSurfacePropertyChanged())
#define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(codeToTest) \
root->resetAllChangeTrackingForSubtree(); \
codeToTest; \
EXPECT_TRUE(root->layerPropertyChanged()); \
EXPECT_FALSE(child->layerPropertyChanged()); \
- EXPECT_FALSE(grandChild->layerPropertyChanged())
+ EXPECT_FALSE(grandChild->layerPropertyChanged()); \
+ EXPECT_FALSE(root->layerSurfacePropertyChanged())
+
+#define EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(codeToTest) \
+ root->resetAllChangeTrackingForSubtree(); \
+ codeToTest; \
+ EXPECT_FALSE(root->layerPropertyChanged()); \
+ EXPECT_FALSE(child->layerPropertyChanged()); \
+ EXPECT_FALSE(grandChild->layerPropertyChanged()); \
+ EXPECT_TRUE(root->layerSurfacePropertyChanged())
TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly)
{
@@ -98,11 +110,9 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMaskLayer(CCLayerImpl::create(4)));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setMasksToBounds(true));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpaque(true));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setOpacity(arbitraryNumber));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setReplicaLayer(CCLayerImpl::create(5)));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPosition(arbitraryFloatPoint));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setPreserves3D(true));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setTransform(arbitraryTransform));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setDoubleSided(false)); // constructor initializes it to "true".
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->scrollBy(arbitraryIntSize));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->setScrollDelta(arbitraryIntSize));
@@ -117,6 +127,10 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundColor(Color::gray));
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundFilters(arbitraryFilters));
+ // Changing these properties only affects how render surface is drawn
+ EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(root->setOpacity(arbitraryNumber));
+ EXECUTE_AND_VERIFY_ONLY_SURFACE_CHANGED(root->setTransform(arbitraryTransform));
+
// Special case: check that sublayer transform changes all layer's descendants, but not the layer itself.
root->resetAllChangeTrackingForSubtree();
root->setSublayerTransform(arbitraryTransform);
diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
index 105c7186e..86a374325 100644
--- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
@@ -122,6 +122,14 @@ void iterateBackToFront(Vector<RefPtr<LayerChromium> >* renderSurfaceLayerList)
}
}
+TEST(CCLayerIteratorTest, emptyTree)
+{
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+
+ iterateBackToFront(&renderSurfaceLayerList);
+ iterateFrontToBack(&renderSurfaceLayerList);
+}
+
TEST(CCLayerIteratorTest, simpleTree)
{
RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
@@ -140,10 +148,11 @@ TEST(CCLayerIteratorTest, simpleTree)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > layerList;
renderSurfaceLayerList.append(rootLayer.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
- WebTransformationMatrix(), WebTransformationMatrix(),
- renderSurfaceLayerList, layerList,
- 256);
+ CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(),
+ WebTransformationMatrix(), WebTransformationMatrix(),
+ renderSurfaceLayerList, layerList,
+ 256);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect());
iterateBackToFront(&renderSurfaceLayerList);
EXPECT_COUNT(rootLayer, 0, -1, 1);
@@ -187,10 +196,11 @@ TEST(CCLayerIteratorTest, complexTree)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > layerList;
renderSurfaceLayerList.append(rootLayer.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
- WebTransformationMatrix(), WebTransformationMatrix(),
- renderSurfaceLayerList, layerList,
- 256);
+ CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(),
+ WebTransformationMatrix(), WebTransformationMatrix(),
+ renderSurfaceLayerList, layerList,
+ 256);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect());
iterateBackToFront(&renderSurfaceLayerList);
EXPECT_COUNT(rootLayer, 0, -1, 1);
@@ -246,10 +256,11 @@ TEST(CCLayerIteratorTest, complexTreeMultiSurface)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > layerList;
renderSurfaceLayerList.append(rootLayer.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer.get(), rootLayer.get(),
- WebTransformationMatrix(), WebTransformationMatrix(),
- renderSurfaceLayerList, layerList,
- 256);
+ CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer.get(),
+ WebTransformationMatrix(), WebTransformationMatrix(),
+ renderSurfaceLayerList, layerList,
+ 256);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootLayer->renderSurface()->contentRect());
iterateBackToFront(&renderSurfaceLayerList);
EXPECT_COUNT(rootLayer, 0, -1, 1);
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
index fce9046c7..89d211e81 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
@@ -31,7 +31,12 @@
#include "LayerChromium.h"
#include "TranslateTransformOperation.h"
#include "cc/CCLayerAnimationController.h"
+#include "cc/CCLayerImpl.h"
+#include "cc/CCLayerSorter.h"
#include "cc/CCMathUtil.h"
+#include "cc/CCProxy.h"
+#include "cc/CCSingleThreadProxy.h"
+#include "cc/CCThread.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -43,7 +48,8 @@ using WebKit::WebTransformationMatrix;
namespace {
-void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+template<typename LayerType>
+void setLayerPropertiesForTesting(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
{
layer->setTransform(transform);
layer->setSublayerTransform(sublayerTransform);
@@ -53,13 +59,36 @@ void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationM
layer->setPreserves3D(preserves3D);
}
+void setLayerPropertiesForTesting(LayerChromium* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+{
+ setLayerPropertiesForTesting<LayerChromium>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
+}
+
+void setLayerPropertiesForTesting(CCLayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+{
+ setLayerPropertiesForTesting<CCLayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
+ layer->setContentBounds(bounds);
+}
+
void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer)
{
WebTransformationMatrix identityMatrix;
Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > dummyLayerList;
int dummyMaxTextureSize = 512;
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect());
+}
+
+void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer)
+{
+ // Note: this version skips layer sorting.
+ WebTransformationMatrix identityMatrix;
+ Vector<CCLayerImpl*> dummyRenderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, identityMatrix, identityMatrix, dummyRenderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(dummyRenderSurfaceLayerList, rootLayer->renderSurface()->contentRect());
}
WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat)
@@ -75,6 +104,30 @@ WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
return ret;
}
+PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests()
+{
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
+ OwnPtr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4);
+
+ WebTransformationMatrix IdentityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
+ setLayerPropertiesForTesting(child.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
+ setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
+ setLayerPropertiesForTesting(greatGrandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
+
+ grandChild->addChild(greatGrandChild.release());
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+ root->createRenderSurface();
+
+ return root.release();
+}
+
class LayerChromiumWithForcedDrawsContent : public LayerChromium {
public:
LayerChromiumWithForcedDrawsContent()
@@ -175,7 +228,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleLayer)
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform());
// Case 7: Verify that position pre-multiplies the layer transform.
- // The current implementation of calculateDrawTransformsAndVisibility does this implicitly, but it is
+ // The current implementation of calculateDrawTransforms does this implicitly, but it is
// still worth testing to detect accidental regressions.
expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse();
setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5f, 0.0f), FloatPoint(5.0f, 1.2f), IntSize(10, 12), false);
@@ -318,6 +371,558 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->targetRenderSurface()->screenSpaceTransform());
}
+TEST(CCLayerTreeHostCommonTest, scissorRectNoClip)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ /*
+ Layers are created as follows:
+
+ +--------------------+
+ | 1 |
+ | +-----------+ |
+ | | 2 | |
+ | | +-------------------+
+ | | | 3 |
+ | | +-------------------+
+ | | | |
+ | +-----------+ |
+ | |
+ | |
+ +--------------------+
+
+ Layers 1, 2 have render surfaces
+ */
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
+
+ IntRect rootRect(0, 0, 100, 100);
+ IntRect childRect(10, 10, 50, 50);
+ IntRect grandChildRect(5, 5, 150, 150);
+
+ root->createRenderSurface();
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
+ root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setDrawsContent(true);
+ root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
+
+ child->setAnchorPoint(FloatPoint(0, 0));
+ child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setOpacity(0.5f);
+ child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setDrawsContent(true);
+
+ grandChild->setAnchorPoint(FloatPoint(0, 0));
+ grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
+ grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild->setDrawsContent(true);
+
+ CCLayerImpl* childPtr = child.get();
+ CCLayerImpl* grandChildPtr = grandChild.get();
+
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ {
+ WebTransformationMatrix identityMatrix;
+ Vector<CCLayerImpl*> layerList;
+ int dummyMaxTextureSize = 512;
+ CCLayerSorter layerSorter;
+
+ renderSurfaceLayerList.append(root.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize);
+
+ FloatRect dummyDamageRect;
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect);
+ }
+
+ ASSERT_TRUE(childPtr->renderSurface());
+ ASSERT_TRUE(root->renderSurface());
+ ASSERT_FALSE(grandChildPtr->renderSurface());
+
+ EXPECT_EQ(renderSurfaceLayerList.size(), 2U);
+
+ ASSERT_EQ(root->clipRect(), IntRect(0, 0, 0, 0));
+
+ // Layer's clipRect is a union of all its children's bounds
+ ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height()));
+ ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, 0, 0));
+
+ ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0));
+ ASSERT_EQ(childPtr->renderSurface()->clipRect(), IntRect(0, 0, 0, 0));
+
+ ASSERT_FALSE(root->usesLayerClipping());
+ ASSERT_FALSE(childPtr->usesLayerClipping());
+ ASSERT_FALSE(grandChildPtr->usesLayerClipping());
+
+ // Damage the entire screen
+ IntRect rootDamage(rootRect);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // child surface doesn't have a clip rect, therefore it will be computed as intersection
+ // between root surface's contentrect and child surface's drawable content rect.
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(childRect.x(), childRect.y(), rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(rootRect));
+
+ // The damage is the entire rootRect, but child layer starts at an offset.
+ // Even though it has bounds, it is not clipping to bounds so its children
+ // (which extend beyond the bounds) extend the scissor rect
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ // Grand child will have the same scissor rect as it doesn't have a surface
+ // of its own
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ // Empty damage
+ rootDamage = IntRect(0, 0, 0, 0);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Empty damage == empty scissor
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Partial damage within child
+ rootDamage = IntRect(10, 10, 20, 20);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child does not have its own surface, so its scissor rect is identical to child's
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Partial damage beyond child
+ rootDamage = IntRect(10, 10, 80, 80);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child does not have its own surface, so its scissor rect is identical to child's
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Partial damage beyond root
+ rootDamage = IntRect(10, 10, 110, 110);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Root surface does not have a clipRect, so its contentRect will be used to intersect with damage.
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Root does not use layer clipping, so its content rect will be used to intersect with damage
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Children's content rects are bigger than the root's so they don't clip the damage rect, but change its offset.
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+}
+
+TEST(CCLayerTreeHostCommonTest, scissorRectWithClip)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ /*
+ Layers are created as follows:
+
+ +--------------------+
+ | 1 |
+ | +-----------+ |
+ | | 2 | |
+ | | +-------------------+
+ | | | 3 |
+ | | +-------------------+
+ | | | |
+ | +-----------+ |
+ | |
+ | |
+ +--------------------+
+
+ Layers 1, 2 have render surfaces
+ */
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
+
+ IntRect rootRect(0, 0, 100, 100);
+ IntRect childRect(10, 10, 50, 50);
+ IntRect grandChildRect(5, 5, 150, 150);
+
+ root->createRenderSurface();
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
+ root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setDrawsContent(true);
+ root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
+
+ child->setAnchorPoint(FloatPoint(0, 0));
+ child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setOpacity(0.5f);
+ child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setDrawsContent(true);
+
+ grandChild->setAnchorPoint(FloatPoint(0, 0));
+ grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
+ grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild->setDrawsContent(true);
+
+ CCLayerImpl* childPtr = child.get();
+ CCLayerImpl* grandChildPtr = grandChild.get();
+
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+
+ root->setMasksToBounds(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ {
+ WebTransformationMatrix identityMatrix;
+ Vector<CCLayerImpl*> layerList;
+ int dummyMaxTextureSize = 512;
+ CCLayerSorter layerSorter;
+
+ renderSurfaceLayerList.append(root.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize);
+
+ FloatRect dummyDamageRect;
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect);
+ }
+
+ ASSERT_TRUE(childPtr->renderSurface());
+ ASSERT_TRUE(root->renderSurface());
+ ASSERT_FALSE(grandChildPtr->renderSurface());
+
+ EXPECT_EQ(renderSurfaceLayerList.size(), 2U);
+
+ // Now root is clipping to its bounds
+ ASSERT_EQ(root->clipRect(), rootRect);
+
+ // Layer's clipRect is a union of all its children's bounds
+ ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height()));
+ ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, 0, 0));
+
+ ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0));
+
+ // Child surface's clipping rect is now set to root's
+ ASSERT_EQ(childPtr->renderSurface()->clipRect(), rootRect);
+
+ ASSERT_TRUE(root->usesLayerClipping());
+ ASSERT_FALSE(childPtr->usesLayerClipping());
+ ASSERT_FALSE(grandChildPtr->usesLayerClipping());
+
+ // Damage the entire screen
+ IntRect rootDamage(rootRect);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(rootRect));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(rootRect));
+
+ // The damage is the entire rootRect, but child layer starts at an offset.
+ // Even though it has bounds, it is not clipping to bounds so its children
+ // (which extend beyond the bounds) extend the scissor rect
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ // Grand child will have the same scissor rect as it doesn't have a surface
+ // of its own
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ // Empty damage
+ rootDamage = IntRect(0, 0, 0, 0);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Empty damage == empty scissor
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Partial damage within child
+ rootDamage = IntRect(10, 10, 20, 20);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child does not have its own surface, so its scissor rect is identical to child's
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Partial damage beyond child
+ rootDamage = IntRect(10, 10, 80, 80);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child does not have its own surface, so its scissor rect is identical to child's
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Partial damage beyond root
+ rootDamage = IntRect(10, 10, 110, 110);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Root surface does not have a clipRect, so its contentRect will be used to intersect with damage.
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Root does not use layer clipping, so its content rect will be used to intersect with damage
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Now the scissor rects are clipped by surfaces contentRect
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+}
+
+TEST(CCLayerTreeHostCommonTest, scissorRectWithClipAndSpaceTransform)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ /*
+ Layers are created as follows:
+
+ +--------------------+
+ | 1 |
+ | +-----------+ |
+ | | 2 | |
+ | | +-------------------+
+ | | | 3,4 |
+ | | +-------------------+
+ | | | |
+ | +-----------+ |
+ | |
+ | |
+ +--------------------+
+
+ Layers 1, 2 and 3 have render surfaces
+ */
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
+ OwnPtr<CCLayerImpl> grandChild2 = CCLayerImpl::create(4);
+
+ IntRect rootRect(0, 0, 100, 100);
+ IntRect childRect(10, 10, 50, 50);
+ IntRect grandChildRect(5, 5, 150, 150);
+
+ root->createRenderSurface();
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
+ root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setDrawsContent(true);
+ root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
+
+ child->setAnchorPoint(FloatPoint(0, 0));
+ child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setOpacity(0.5f);
+ child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setDrawsContent(true);
+
+ grandChild->setAnchorPoint(FloatPoint(0, 0));
+ grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
+ grandChild->setOpacity(0.5f);
+ grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild->setDrawsContent(true);
+
+ grandChild2->setAnchorPoint(FloatPoint(0, 0));
+ grandChild2->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
+ grandChild2->setOpacity(0.5f);
+ grandChild2->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild2->setDrawsContent(true);
+
+ CCLayerImpl* childPtr = child.get();
+ CCLayerImpl* grandChildPtr = grandChild.get();
+
+ grandChild->addChild(grandChild2.release());
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+
+ root->setMasksToBounds(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ {
+ WebTransformationMatrix identityMatrix;
+ Vector<CCLayerImpl*> layerList;
+ int dummyMaxTextureSize = 512;
+ CCLayerSorter layerSorter;
+
+ renderSurfaceLayerList.append(root.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, layerList, &layerSorter, dummyMaxTextureSize);
+
+ FloatRect dummyDamageRect;
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, dummyDamageRect);
+ }
+
+ ASSERT_TRUE(childPtr->renderSurface());
+ ASSERT_TRUE(root->renderSurface());
+ ASSERT_TRUE(grandChildPtr->renderSurface());
+
+ EXPECT_EQ(renderSurfaceLayerList.size(), 3U);
+
+ // Now root is clipping to its bounds
+ ASSERT_EQ(root->clipRect(), rootRect);
+
+ ASSERT_EQ(childPtr->clipRect(), IntRect(0, 0, childRect.x() + grandChildRect.width() , childRect.y() + grandChildRect.height()));
+
+ // Grandchild now clips
+ ASSERT_EQ(grandChildPtr->clipRect(), IntRect(0, 0, grandChildRect.x() + grandChildRect.width(), grandChildRect.y() + grandChildRect.height()));
+
+ ASSERT_EQ(root->renderSurface()->clipRect(), IntRect(0, 0, 0, 0));
+
+ // Child surface's clipping rect is now set to root's
+ ASSERT_EQ(childPtr->renderSurface()->clipRect(), rootRect);
+
+ ASSERT_TRUE(root->usesLayerClipping());
+ ASSERT_FALSE(childPtr->usesLayerClipping());
+ ASSERT_FALSE(grandChildPtr->usesLayerClipping());
+
+ // Damage the entire screen
+ IntRect rootDamage(rootRect);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(rootRect));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(rootRect));
+
+ // The damage is the entire rootRect, but child layer starts at an offset.
+ // Even though it has bounds, it is not clipping to bounds so its children
+ // (which extend beyond the bounds) extend the scissor rect
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x(), rootRect.height() - childRect.y()));
+
+ // Grand child is now scissored by the render surface
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, rootRect.width() - childRect.x() - grandChildRect.x(), rootRect.height() - childRect.y() - grandChildRect.y()));
+
+ // Empty damage
+ rootDamage = IntRect(0, 0, 0, 0);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Empty damage == empty scissor
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ EXPECT_EQ(root->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(0, 0, 0, 0));
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Partial damage within child
+ rootDamage = IntRect(10, 10, 20, 20);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child now gets scissored by its target surface as well as root
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width() - grandChildRect.x(), rootDamage.height() - grandChildRect.y()));
+
+ // Partial damage beyond child
+ rootDamage = IntRect(10, 10, 80, 80);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Entire damage rect is within the root surface
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer
+ EXPECT_EQ(root->scissorRect(), rootDamage);
+
+ // Entire damage rect is within the layer, but with different offset
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width(), rootDamage.height()));
+
+ // Grand child now gets scissored by its target surface as well as root
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width() - grandChildRect.x(), rootDamage.height() - grandChildRect.y()));
+
+ // Partial damage beyond root
+ rootDamage = IntRect(10, 10, 110, 110);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, rootDamage);
+
+ // Scissors are not computed for root
+ EXPECT_EQ(root->targetRenderSurface()->scissorRect(), IntRect(0, 0, 0, 0));
+
+ // Root surface does not have a clipRect, so its contentRect will be used to intersect with damage.
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(childPtr->targetRenderSurface()->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Root does not use layer clipping, so its content rect will be used to intersect with damage
+ // Result is that root damage rect is clipped at root layer boundary
+ EXPECT_EQ(root->scissorRect(), IntRect(rootDamage.x(), rootDamage.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Now the scissor rects are clipped by surfaces contentRect
+ EXPECT_EQ(childPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootRect.width() - rootDamage.x(), rootRect.height() - rootDamage.y()));
+
+ // Grandchild's scissor rect is clipped by its target surface
+ EXPECT_EQ(grandChildPtr->scissorRect(), IntRect(rootDamage.x() - childRect.x(), rootDamage.y() - childRect.y(), rootDamage.width() - grandChildRect.x(), rootDamage.height() - grandChildRect.y()));
+}
+
TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica)
{
RefPtr<LayerChromium> parent = LayerChromium::create();
@@ -545,7 +1150,10 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > dummyLayerList;
int dummyMaxTextureSize = 512;
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ FloatRect dummyDamageRect;
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
// The child layer's content is entirely outside the parent's clip rect, so the intermediate
// render surface should have been removed. Render surfaces without children or visible
@@ -573,7 +1181,9 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > dummyLayerList;
int dummyMaxTextureSize = 512;
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
// Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere.
// Also, the drawable content rect should not have been extended by the children.
@@ -601,18 +1211,612 @@ TEST(CCLayerTreeHostCommonTest, verifyForceRenderSurface)
Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
Vector<RefPtr<LayerChromium> > dummyLayerList;
int dummyMaxTextureSize = 512;
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
EXPECT_TRUE(renderSurface1->renderSurface());
EXPECT_EQ(renderSurfaceLayerList.size(), 1U);
renderSurfaceLayerList.clear();
renderSurface1->setForceRenderSurface(false);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
EXPECT_FALSE(renderSurface1->renderSurface());
EXPECT_EQ(renderSurfaceLayerList.size(), 0U);
}
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDirectContainer)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // is the direct parent of the fixed-position layer.
+
+ DebugScopedSetImplThread scopedImplThread;
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setFixedToContainerLayer(true);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50).
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform;
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 10
+ child->setScrollDelta(IntSize(10, 10));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(40, 40);
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithTransformedDirectContainer)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // is the direct parent of the fixed-position layer, but that container is transformed.
+ // In this case, the fixed position element inherits the container's transform,
+ // but the scrollDelta that has to be undone should not be affected by that transform.
+ //
+ // Transforms are in general non-commutative; using something like a non-uniform scale
+ // helps to verify that translations and non-uniform scales are applied in the correct
+ // order.
+
+ DebugScopedSetImplThread scopedImplThread;
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+
+ // This scale will cause child and grandChild to be effectively 200 x 800 with respect to the targetRenderSurface.
+ WebTransformationMatrix nonUniformScale;
+ nonUniformScale.scaleNonUniform(2, 8);
+ child->setTransform(nonUniformScale);
+
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setFixedToContainerLayer(true);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The expected drawTransforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50).
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.multiply(nonUniformScale);
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform;
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 20
+ child->setScrollDelta(IntSize(10, 20));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The child should be affected by scrollDelta, but the fixed position grandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, -20); // scrollDelta
+ expectedChildTransform.multiply(nonUniformScale);
+ expectedChildTransform.translate(50, 50);
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainer)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // is NOT the direct parent of the fixed-position layer.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ CCLayerImpl* greatGrandChild = grandChild->children()[0].get();
+
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setPosition(FloatPoint(8, 6));
+ greatGrandChild->setFixedToContainerLayer(true);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.translate(58, 56);
+
+ WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 10
+ child->setScrollDelta(IntSize(10, 10));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(40, 40);
+ expectedGrandChildTransform.makeIdentity();
+ expectedGrandChildTransform.translate(48, 46);
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithDistantContainerAndTransforms)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // is NOT the direct parent of the fixed-position layer, and the hierarchy has various
+ // transforms that have to be processed in the correct order.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ CCLayerImpl* greatGrandChild = grandChild->children()[0].get();
+
+ WebTransformationMatrix rotationAboutZ;
+ rotationAboutZ.rotate3d(0, 0, 90);
+
+ child->setIsContainerForFixedPositionLayers(true);
+ child->setTransform(rotationAboutZ);
+ grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setTransform(rotationAboutZ);
+ greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the targetRenderSurface
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform
+
+ WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 20
+ child->setScrollDelta(IntSize(10, 20));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, -20); // scrollDelta
+ expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.translate(50, 50);
+
+ expectedGrandChildTransform.makeIdentity();
+ expectedGrandChildTransform.translate(-10, -20); // child's scrollDelta is inherited
+ expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleScrollDeltas)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed.
+ // In this test, each scrollDelta occurs in a different space because of each layer's local transform.
+ // This test checks for correct scroll compensation when the fixed-position container
+ // is NOT the direct parent of the fixed-position layer, and the hierarchy has various
+ // transforms that have to be processed in the correct order.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ CCLayerImpl* greatGrandChild = grandChild->children()[0].get();
+
+ WebTransformationMatrix rotationAboutZ;
+ rotationAboutZ.rotate3d(0, 0, 90);
+
+ child->setIsContainerForFixedPositionLayers(true);
+ child->setTransform(rotationAboutZ);
+ grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setTransform(rotationAboutZ);
+ greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the targetRenderSurface
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform
+
+ WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 20
+ child->setScrollDelta(IntSize(10, 0));
+ grandChild->setScrollDelta(IntSize(5, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, 0); // scrollDelta
+ expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.translate(50, 50);
+
+ expectedGrandChildTransform.makeIdentity();
+ expectedGrandChildTransform.translate(-10, 0); // child's scrollDelta is inherited
+ expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.translate(-5, 0); // grandChild's scrollDelta
+ expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.translate(50, 50); // translation because of half-width half-height occurs after layer's local transform
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithIntermediateSurfaceAndTransforms)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // contributes to a different renderSurface than the fixed-position layer. In this
+ // case, the surface originTransforms also have to be accounted for when checking the
+ // scrollDelta.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ CCLayerImpl* greatGrandChild = grandChild->children()[0].get();
+
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setForceRenderSurface(true);
+ greatGrandChild->setFixedToContainerLayer(true);
+ greatGrandChild->setDrawsContent(true);
+
+ WebTransformationMatrix rotationAboutZ;
+ rotationAboutZ.rotate3d(0, 0, 90);
+ grandChild->setTransform(rotationAboutZ);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+ WebTransformationMatrix expectedSurfaceOriginTransform;
+ expectedSurfaceOriginTransform.translate(8, 6);
+ expectedSurfaceOriginTransform.multiply(rotationAboutZ);
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.translate(50, 50);
+ WebTransformationMatrix expectedGreatGrandChildTransform;
+ expectedGreatGrandChildTransform.translate(50, 50);
+ ASSERT_TRUE(grandChild->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 30
+ child->setScrollDelta(IntSize(10, 30));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the grandChild remains unchanged, because it scrolls along with the
+ // renderSurface, and the translation is actually in the renderSurface. But, the fixed
+ // position greatGrandChild is more awkward: its actually being drawn with respect to
+ // the renderSurface, but it needs to remain fixed with resepct to a container beyond
+ // that surface. So, the net result is that, unlike previous tests where the fixed
+ // position layer's transform remains unchanged, here the fixed position layer's
+ // transform explicitly contains the translation that cancels out the scroll.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, -30); // scrollDelta
+ expectedChildTransform.translate(50, 50);
+
+ expectedSurfaceOriginTransform.makeIdentity();
+ expectedSurfaceOriginTransform.translate(-10, -30); // scrollDelta
+ expectedSurfaceOriginTransform.translate(8, 6);
+ expectedSurfaceOriginTransform.multiply(rotationAboutZ);
+
+ // The rotation and its inverse are needed to place the scrollDelta compensation in
+ // the correct space. This test will fail if the rotation/inverse are backwards, too,
+ // so it requires perfect order of operations.
+ expectedGreatGrandChildTransform.makeIdentity();
+ expectedGreatGrandChildTransform.multiply(rotationAboutZ.inverse());
+ expectedGreatGrandChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
+ expectedGreatGrandChildTransform.multiply(rotationAboutZ);
+ expectedGreatGrandChildTransform.translate(50, 50);
+
+ ASSERT_TRUE(grandChild->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, grandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithMultipleIntermediateSurfaces)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // contributes to a different renderSurface than the fixed-position layer, with
+ // additional renderSurfaces in-between. This checks that the conversion to ancestor
+ // surfaces is accumulated properly in the final matrix transform.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ CCLayerImpl* greatGrandChild = grandChild->children()[0].get();
+
+ // Add one more layer to the test tree for this scenario.
+ {
+ WebTransformationMatrix identity;
+ OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5);
+ setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ greatGrandChild->addChild(fixedPositionChild.release());
+ }
+ CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0].get();
+
+ // Actually set up the scenario here.
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setForceRenderSurface(true);
+ greatGrandChild->setPosition(FloatPoint(140, 120));
+ greatGrandChild->setForceRenderSurface(true);
+ fixedPositionChild->setFixedToContainerLayer(true);
+ fixedPositionChild->setDrawsContent(true);
+
+ // The additional rotations, which are non-commutative with translations, help to
+ // verify that we have correct order-of-operations in the final scroll compensation.
+ WebTransformationMatrix rotationAboutZ;
+ rotationAboutZ.rotate3d(0, 0, 90);
+ grandChild->setTransform(rotationAboutZ);
+ greatGrandChild->setTransform(rotationAboutZ);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildSurfaceOriginTransform;
+ expectedGrandChildSurfaceOriginTransform.translate(8, 6);
+ expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ);
+
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGreatGrandChildSurfaceOriginTransform;
+ expectedGreatGrandChildSurfaceOriginTransform.translate(140, 120);
+ expectedGreatGrandChildSurfaceOriginTransform.multiply(rotationAboutZ);
+
+ WebTransformationMatrix expectedGreatGrandChildTransform;
+ expectedGreatGrandChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedFixedPositionChildTransform;
+ expectedFixedPositionChildTransform.translate(50, 50);
+
+ ASSERT_TRUE(grandChild->renderSurface());
+ ASSERT_TRUE(greatGrandChild->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 30
+ child->setScrollDelta(IntSize(10, 30));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, -30); // scrollDelta
+ expectedChildTransform.translate(50, 50);
+
+ expectedGrandChildSurfaceOriginTransform.makeIdentity();
+ expectedGrandChildSurfaceOriginTransform.translate(-10, -30); // scrollDelta
+ expectedGrandChildSurfaceOriginTransform.translate(8, 6);
+ expectedGrandChildSurfaceOriginTransform.multiply(rotationAboutZ);
+
+ // grandChild, greatGrandChild, and greatGrandChild's surface are not expected to
+ // change, since they are all not fixed, and they are all drawn with respect to
+ // grandChild's surface that already has the scrollDelta accounted for.
+
+ // But the great-great grandchild, "fixedPositionChild", should have a transform that explicitly cancels out the scrollDelta.
+ // The expected transform is:
+ // compoundOriginTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform * half-width-half-height translation
+ WebTransformationMatrix compoundOriginTransform; // transform from greatGrandChildSurface's origin to the root surface.
+ compoundOriginTransform.translate(8, 6); // origin translation of grandChild
+ compoundOriginTransform.multiply(rotationAboutZ); // rotation of grandChild
+ compoundOriginTransform.translate(140, 120); // origin translation of greatGrandChild
+ compoundOriginTransform.multiply(rotationAboutZ); // rotation of greatGrandChild
+
+ expectedFixedPositionChildTransform.makeIdentity();
+ expectedFixedPositionChildTransform.multiply(compoundOriginTransform.inverse());
+ expectedFixedPositionChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
+ expectedFixedPositionChildTransform.multiply(compoundOriginTransform);
+ expectedFixedPositionChildTransform.translate(50, 50);
+
+ ASSERT_TRUE(grandChild->renderSurface());
+ ASSERT_TRUE(greatGrandChild->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceOriginTransform, grandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceOriginTransform, greatGrandChild->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPositionChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithContainerLayerThatHasSurface)
+{
+ // This test checks for correct scroll compensation when the fixed-position container
+ // itself has a renderSurface. In this case, the container layer should be treated
+ // like a layer that contributes to a targetRenderSurface, and that targetRenderSurface
+ // is completely irrelevant; it should not affect the scroll compensation.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+
+ child->setIsContainerForFixedPositionLayers(true);
+ child->setForceRenderSurface(true);
+ grandChild->setFixedToContainerLayer(true);
+ grandChild->setDrawsContent(true);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50).
+ WebTransformationMatrix expectedSurfaceOriginTransform;
+ expectedSurfaceOriginTransform.translate(0, 0);
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.translate(50, 50);
+ ASSERT_TRUE(child->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 10
+ child->setScrollDelta(IntSize(10, 10));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The surface is translated by scrollDelta, the child transform doesn't change
+ // because it scrolls along with the surface, but the fixed position grandChild
+ // needs to compensate for the scroll translation.
+ expectedSurfaceOriginTransform.makeIdentity();
+ expectedSurfaceOriginTransform.translate(-10, -10);
+ expectedGrandChildTransform.makeIdentity();
+ expectedGrandChildTransform.translate(60, 60);
+ ASSERT_TRUE(child->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceOriginTransform, child->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatIsAlsoFixedPositionContainer)
+{
+ // This test checks the scenario where a fixed-position layer also happens to be a
+ // container itself for a descendant fixed position layer. In particular, the layer
+ // should not accidentally be fixed to itself.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+
+ child->setIsContainerForFixedPositionLayers(true);
+ grandChild->setFixedToContainerLayer(true);
+
+ // This should not confuse the grandChild. If correct, the grandChild would still be considered fixed to its container (i.e. "child").
+ grandChild->setIsContainerForFixedPositionLayers(true);
+
+ // Case 1: scrollDelta of 0, 0
+ child->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50).
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.translate(50, 50);
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.translate(50, 50);
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+
+ // Case 2: scrollDelta of 10, 10
+ child->setScrollDelta(IntSize(10, 10));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(40, 40);
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatHasNoContainer)
+{
+ // This test checks scroll compensation when a fixed-position layer does not find any
+ // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should
+ // be fixed to the viewport -- not the rootLayer, which may have transforms of its own.
+ DebugScopedSetImplThread scopedImplThread;
+
+ OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests();
+ CCLayerImpl* child = root->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+
+ WebTransformationMatrix rotationByZ;
+ rotationByZ.rotate3d(0, 0, 90);
+
+ root->setTransform(rotationByZ);
+ grandChild->setFixedToContainerLayer(true);
+
+ // Case 1: root scrollDelta of 0, 0
+ root->setScrollDelta(IntSize(0, 0));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // The expected draw transforms without any scroll should still include a translation to the center of the layer (i.e. translation by 50, 50).
+ WebTransformationMatrix expectedChildTransform;
+ expectedChildTransform.multiply(rotationByZ);
+ expectedChildTransform.translate(50, 50);
+
+ WebTransformationMatrix expectedGrandChildTransform;
+ expectedGrandChildTransform.multiply(rotationByZ);
+ expectedGrandChildTransform.translate(50, 50);
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+
+ // Case 2: root scrollDelta of 10, 10
+ root->setScrollDelta(IntSize(10, 10));
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ // Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected.
+ expectedChildTransform.makeIdentity();
+ expectedChildTransform.translate(-10, -10); // the scrollDelta
+ expectedChildTransform.multiply(rotationByZ);
+ expectedChildTransform.translate(50, 50);
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
+}
+
TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
{
// The entire subtree of layers that are outside the clipRect should be culled away,
@@ -666,7 +1870,11 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ FloatRect dummyDamageRect;
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
+
ASSERT_EQ(2U, renderSurfaceLayerList.size());
EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
@@ -725,7 +1933,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
ASSERT_EQ(2U, renderSurfaceLayerList.size());
EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
@@ -776,7 +1986,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
parent->createRenderSurface();
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
// Without an animation, we should cull child and grandChild from the renderSurfaceLayerList.
ASSERT_EQ(1U, renderSurfaceLayerList.size());
@@ -795,7 +2005,7 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
parent->createRenderSurface();
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
// With an animating transform, we should keep child and grandChild in the renderSurfaceLayerList.
ASSERT_EQ(3U, renderSurfaceLayerList.size());
@@ -855,7 +2065,10 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
+
EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild1->clipRect());
EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild2->clipRect());
@@ -927,7 +2140,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
ASSERT_TRUE(grandChild1->renderSurface());
ASSERT_TRUE(grandChild2->renderSurface());
@@ -1408,7 +2623,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
// Verify which renderSurfaces were created.
EXPECT_FALSE(frontFacingChild->renderSurface());
@@ -1513,7 +2728,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
// Verify which renderSurfaces were created.
EXPECT_FALSE(frontFacingChild->renderSurface());
@@ -1598,7 +2813,9 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, parent->renderSurface()->contentRect());
EXPECT_FALSE(child->renderSurface());
EXPECT_TRUE(animatingSurface->renderSurface());
@@ -1670,7 +2887,7 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin
parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
renderSurfaceLayerList.append(parent.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
// Verify which renderSurfaces were created.
EXPECT_TRUE(frontFacingSurface->renderSurface());
@@ -1693,6 +2910,780 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlattenin
EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id());
}
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList)
+{
+ // Hit testing on an empty renderSurfaceLayerList should return a null pointer.
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+
+ IntPoint testPoint(0, 0);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(10, 20);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for a point outside the layer should return a null pointer.
+ IntPoint testPoint(101, 101);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(-1, -1);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the root layer.
+ testPoint = IntPoint(1, 1);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+
+ testPoint = IntPoint(99, 99);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix uninvertibleTransform;
+ uninvertibleTransform.setM11(0);
+ uninvertibleTransform.setM22(0);
+ uninvertibleTransform.setM33(0);
+ uninvertibleTransform.setM44(0);
+ ASSERT_FALSE(uninvertibleTransform.isInvertible());
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+ ASSERT_FALSE(root->screenSpaceTransform().isInvertible());
+
+ // Hit testing any point should not hit the layer. If the invertible matrix is
+ // accidentally ignored and treated like an identity, then the hit testing will
+ // incorrectly hit the layer when it shouldn't.
+ IntPoint testPoint(1, 1);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(10, 10);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(10, 30);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(50, 50);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(67, 48);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(99, 99);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(-1, -1);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for a point outside the layer should return a null pointer.
+ IntPoint testPoint(49, 49);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it.
+ testPoint = IntPoint(101, 101);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the root layer.
+ testPoint = IntPoint(51, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+
+ testPoint = IntPoint(99, 99);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ WebTransformationMatrix rotation45DegreesAboutCenter;
+ rotation45DegreesAboutCenter.translate(50, 50);
+ rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
+ rotation45DegreesAboutCenter.translate(-50, -50);
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for points outside the layer.
+ // These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
+ IntPoint testPoint(99, 99);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(1, 1);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the root layer.
+ testPoint = IntPoint(1, 50);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+
+ // Hit testing the corners that would overlap the unclipped layer, but are outside the clipped region.
+ testPoint = IntPoint(50, -1);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_FALSE(resultLayer);
+
+ testPoint = IntPoint(-1, 50);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_FALSE(resultLayer);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+
+ // perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
+ WebTransformationMatrix perspectiveProjectionAboutCenter;
+ perspectiveProjectionAboutCenter.translate(50, 50);
+ perspectiveProjectionAboutCenter.applyPerspective(1);
+ perspectiveProjectionAboutCenter.translate(-50, -50);
+ WebTransformationMatrix translationByZ;
+ translationByZ.translate3d(0, 0, -1);
+
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for points outside the layer.
+ // These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
+ IntPoint testPoint(24, 24);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ testPoint = IntPoint(76, 76);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the root layer.
+ testPoint = IntPoint(26, 26);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+
+ testPoint = IntPoint(74, 74);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
+{
+ // A layer's visibleLayerRect 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
+ // layer's content space and layer's origin space, which is not included in the
+ // 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
+ // as being larger than the actual bounds of the layer.
+ //
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(25, 25);
+ IntSize bounds(50, 50);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ root->setContentBounds(IntSize(100, 100));
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ 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());
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for a point outside the layer should return a null pointer.
+ IntPoint testPoint(24, 24);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it.
+ // This case in particular is likely to fail if contents scale is not correctly accounted for.
+ testPoint = IntPoint(76, 76);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the root layer.
+ testPoint = IntPoint(26, 26);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+
+ testPoint = IntPoint(74, 74);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(12345, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
+{
+ // Test that hit-testing will only work for the visible portion of a layer, and not
+ // the entire layer bounds. Here we just test the simple axis-aligned case.
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ IntSize bounds(50, 50);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setMasksToBounds(true);
+
+ {
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456);
+ position = FloatPoint(-50, -50);
+ bounds = IntSize(300, 300);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child->setDrawsContent(true);
+ root->addChild(child.release());
+ }
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, root->renderSurface()->layerList().size());
+
+ // Hit testing for a point outside the layer should return a null pointer.
+ // Despite the child layer being very large, it should be clipped to the root layer's bounds.
+ IntPoint testPoint(24, 24);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it.
+ testPoint = IntPoint(76, 76);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Hit testing for a point inside should return the child layer.
+ testPoint = IntPoint(26, 26);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(456, resultLayer->id());
+
+ testPoint = IntPoint(74, 74);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(456, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
+{
+ // This test checks whether hit testing correctly avoids hit testing with multiple
+ // ancestors that clip in non axis-aligned ways. To pass this test, the hit testing
+ // algorithm needs to recognize that multiple parent layers may clip the layer, and
+ // should not actually hit those clipped areas.
+ //
+ // The child and grandChild layers are both initialized to clip the rotatedLeaf. The
+ // child layer is rotated about the top-left corner, so that the root + child clips
+ // combined create a triangle. The rotatedLeaf will only be visible where it overlaps
+ // this triangle.
+ //
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setMasksToBounds(true);
+
+ {
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456);
+ OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(789);
+ OwnPtr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468);
+
+ position = FloatPoint(10, 10);
+ bounds = IntSize(80, 80);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child->setMasksToBounds(true);
+
+ WebTransformationMatrix rotation45DegreesAboutCorner;
+ rotation45DegreesAboutCorner.rotate3d(0, 0, 45);
+
+ position = FloatPoint(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
+ bounds = IntSize(200, 200); // to ensure it covers at least sqrt(2) * 100.
+ setLayerPropertiesForTesting(grandChild.get(), rotation45DegreesAboutCorner, identityMatrix, anchor, position, bounds, false);
+ grandChild->setMasksToBounds(true);
+
+ // Rotates about the center of the layer
+ WebTransformationMatrix rotatedLeafTransform;
+ rotatedLeafTransform.translate(-10, -10); // cancel out the grandParent's position
+ rotatedLeafTransform.rotate3d(0, 0, -45); // cancel out the corner 45-degree rotation of the parent.
+ rotatedLeafTransform.translate(50, 50);
+ rotatedLeafTransform.rotate3d(0, 0, 45);
+ rotatedLeafTransform.translate(-50, -50);
+ position = FloatPoint(0, 0);
+ bounds = IntSize(100, 100);
+ setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, identityMatrix, anchor, position, bounds, false);
+ rotatedLeaf->setDrawsContent(true);
+
+ grandChild->addChild(rotatedLeaf.release());
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+ }
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ // The grandChild is expected to create a renderSurface because it masksToBounds and is not axis aligned.
+ ASSERT_EQ(2u, renderSurfaceLayerList.size());
+ ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size());
+ ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->id()); // grandChild's surface.
+ ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size());
+ ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
+
+ // (11, 89) is close to the the bottom left corner within the clip, but it is not inside the layer.
+ IntPoint testPoint(11, 89);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Closer inwards from the bottom left will overlap the layer.
+ testPoint = IntPoint(25, 75);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(2468, resultLayer->id());
+
+ // (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
+ // testing would accidentally think that the point successfully hits the layer.
+ testPoint = IntPoint(4, 50);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // (11, 50) is inside the layer and within the clipped area.
+ testPoint = IntPoint(11, 50);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(2468, resultLayer->id());
+
+ // Around the middle, just to the right and up, would have hit the layer except that
+ // that area should be clipped away by the parent.
+ testPoint = IntPoint(51, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ EXPECT_FALSE(resultLayer);
+
+ // Around the middle, just to the left and down, should successfully hit the layer.
+ testPoint = IntPoint(49, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(2468, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
+{
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ {
+ // child 1 and child2 are initialized to overlap between x=50 and x=60.
+ // grandChild is set to overlap both child1 and child2 between y=50 and y=60.
+ // The expected stacking order is:
+ // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
+
+ OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
+ OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
+
+ position = FloatPoint(10, 10);
+ bounds = IntSize(50, 50);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child1->setDrawsContent(true);
+
+ position = FloatPoint(50, 10);
+ bounds = IntSize(50, 50);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child2->setDrawsContent(true);
+
+ // Remember that grandChild is positioned with respect to its parent (i.e. child1).
+ // In screen space, the intended position is (10, 50), with size 100 x 50.
+ position = FloatPoint(0, 40);
+ bounds = IntSize(100, 50);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ grandChild1->setDrawsContent(true);
+
+ child1->addChild(grandChild1.release());
+ root->addChild(child1.release());
+ root->addChild(child2.release());
+ }
+
+ CCLayerImpl* child1 = root->children()[0].get();
+ CCLayerImpl* child2 = root->children()[1].get();
+ CCLayerImpl* grandChild1 = child1->children()[0].get();
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_TRUE(child1);
+ ASSERT_TRUE(child2);
+ ASSERT_TRUE(grandChild1);
+ ASSERT_EQ(1u, renderSurfaceLayerList.size());
+ ASSERT_EQ(4u, root->renderSurface()->layerList().size());
+ ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer
+ ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1
+ ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1
+ ASSERT_EQ(3, root->renderSurface()->layerList()[3]->id()); // child2
+
+ // Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
+ IntPoint testPoint = IntPoint(1, 1);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(1, resultLayer->id());
+
+ // At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
+ testPoint = IntPoint(15, 15);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(2, resultLayer->id());
+
+ // At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
+ testPoint = IntPoint(51, 20);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
+ testPoint = IntPoint(80, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
+ testPoint = IntPoint(51, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
+ testPoint = IntPoint(20, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(4, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
+{
+ //
+ // The geometry is set up similarly to the previous case, but
+ // all layers are forced to be renderSurfaces now.
+ //
+ DebugScopedSetImplThread thisScopeIsOnImplThread;
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), IntSize(100, 100)));
+
+ WebTransformationMatrix identityMatrix;
+ FloatPoint anchor(0, 0);
+ FloatPoint position(0, 0);
+ IntSize bounds(100, 100);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ root->setDrawsContent(true);
+
+ {
+ // child 1 and child2 are initialized to overlap between x=50 and x=60.
+ // grandChild is set to overlap both child1 and child2 between y=50 and y=60.
+ // The expected stacking order is:
+ // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
+
+ OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
+ OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
+
+ position = FloatPoint(10, 10);
+ bounds = IntSize(50, 50);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child1->setDrawsContent(true);
+ child1->setForceRenderSurface(true);
+
+ position = FloatPoint(50, 10);
+ bounds = IntSize(50, 50);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ child2->setDrawsContent(true);
+ child2->setForceRenderSurface(true);
+
+ // Remember that grandChild is positioned with respect to its parent (i.e. child1).
+ // In screen space, the intended position is (10, 50), with size 100 x 50.
+ position = FloatPoint(0, 40);
+ bounds = IntSize(100, 50);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
+ grandChild1->setDrawsContent(true);
+ grandChild1->setForceRenderSurface(true);
+
+ child1->addChild(grandChild1.release());
+ root->addChild(child1.release());
+ root->addChild(child2.release());
+ }
+
+ CCLayerImpl* child1 = root->children()[0].get();
+ CCLayerImpl* child2 = root->children()[1].get();
+ CCLayerImpl* grandChild1 = child1->children()[0].get();
+
+ Vector<CCLayerImpl*> renderSurfaceLayerList;
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ renderSurfaceLayerList.append(root.get());
+ CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect.
+
+ // Sanity check the scenario we just created.
+ ASSERT_TRUE(child1);
+ ASSERT_TRUE(child2);
+ ASSERT_TRUE(grandChild1);
+ ASSERT_TRUE(child1->renderSurface());
+ ASSERT_TRUE(child2->renderSurface());
+ ASSERT_TRUE(grandChild1->renderSurface());
+ ASSERT_EQ(4u, renderSurfaceLayerList.size());
+ ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surface has the root layer, and child1's and child2's renderSurfaces.
+ ASSERT_EQ(2u, child1->renderSurface()->layerList().size()); // The child1 surface has the child1 layer and grandChild1's renderSurface.
+ ASSERT_EQ(1u, child2->renderSurface()->layerList().size());
+ ASSERT_EQ(1u, grandChild1->renderSurface()->layerList().size());
+ ASSERT_EQ(1, renderSurfaceLayerList[0]->id()); // root layer
+ ASSERT_EQ(2, renderSurfaceLayerList[1]->id()); // child1
+ ASSERT_EQ(4, renderSurfaceLayerList[2]->id()); // grandChild1
+ ASSERT_EQ(3, renderSurfaceLayerList[3]->id()); // child2
+
+ // Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
+ IntPoint testPoint = IntPoint(1, 1);
+ CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(1, resultLayer->id());
+
+ // At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
+ testPoint = IntPoint(15, 15);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(2, resultLayer->id());
+
+ // At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
+ testPoint = IntPoint(51, 20);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
+ testPoint = IntPoint(80, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
+ testPoint = IntPoint(51, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(3, resultLayer->id());
+
+ // At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
+ testPoint = IntPoint(20, 51);
+ resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
+ ASSERT_TRUE(resultLayer);
+ EXPECT_EQ(4, resultLayer->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifySubtreeSearch)
+{
+ RefPtr<LayerChromium> root = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild = LayerChromium::create();
+ RefPtr<LayerChromium> maskLayer = LayerChromium::create();
+ RefPtr<LayerChromium> replicaLayer = LayerChromium::create();
+
+ grandChild->setReplicaLayer(replicaLayer.get());
+ child->addChild(grandChild.get());
+ child->setMaskLayer(maskLayer.get());
+ root->addChild(child.get());
+
+ int nonexistentId = -1;
+ EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->id()));
+ EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child->id()));
+ EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), grandChild->id()));
+ EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), maskLayer->id()));
+ EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id()));
+ EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId));
+}
+
// FIXME:
// continue working on https://bugs.webkit.org/show_bug.cgi?id=68942
// - add a test to verify clipping that changes the "center point"
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
index 91c2d1dff..738c88190 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
@@ -28,18 +28,24 @@
#include "CCAnimationTestCommon.h"
#include "CCLayerTestCommon.h"
+#include "CCTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
#include "LayerRendererChromium.h"
+#include "cc/CCIOSurfaceLayerImpl.h"
#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTilingData.h"
#include "cc/CCQuadCuller.h"
+#include "cc/CCRenderPassDrawQuad.h"
#include "cc/CCScrollbarLayerImpl.h"
+#include "cc/CCSettings.h"
#include "cc/CCSingleThreadProxy.h"
+#include "cc/CCSolidColorDrawQuad.h"
#include "cc/CCTextureLayerImpl.h"
#include "cc/CCTileDrawQuad.h"
#include "cc/CCTiledLayerImpl.h"
#include "cc/CCVideoLayerImpl.h"
+#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <public/WebVideoFrame.h>
#include <public/WebVideoFrameProvider.h>
@@ -49,6 +55,12 @@ using namespace WebCore;
using namespace WebKit;
using namespace WebKitTests;
+using ::testing::Mock;
+using ::testing::Return;
+using ::testing::AnyNumber;
+using ::testing::AtLeast;
+using ::testing::_;
+
namespace {
class CCLayerTreeHostImplTest : public testing::Test, public CCLayerTreeHostImplClient {
@@ -57,7 +69,7 @@ public:
: m_didRequestCommit(false)
, m_didRequestRedraw(false)
{
- CCSettings settings;
+ CCLayerTreeSettings settings;
m_hostImpl = CCLayerTreeHostImpl::create(settings, this);
m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader);
m_hostImpl->setViewportSize(IntSize(10, 10));
@@ -70,6 +82,28 @@ public:
virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { }
virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE { }
+ PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassRefPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
+ {
+ CCSettings::setPartialSwapEnabled(partialSwap);
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this);
+
+ myHostImpl->initializeLayerRenderer(graphicsContext, UnthrottledUploader);
+ myHostImpl->setViewportSize(IntSize(10, 10));
+
+ OwnPtr<CCLayerImpl> root = rootPtr;
+
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(0, 0));
+ root->setBounds(IntSize(10, 10));
+ root->setContentBounds(IntSize(10, 10));
+ root->setVisibleLayerRect(IntRect(0, 0, 10, 10));
+ root->setDrawsContent(true);
+ myHostImpl->setRootLayer(root.release());
+ return myHostImpl.release();
+ }
+
static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer)
{
ASSERT_EQ(layer->scrollDelta(), IntSize());
@@ -106,10 +140,31 @@ public:
m_hostImpl->setRootLayer(root.release());
}
+ static PassOwnPtr<CCLayerImpl> createScrollableLayer(int id, const FloatPoint& position, const IntSize& size)
+ {
+ OwnPtr<CCLayerImpl> layer = CCLayerImpl::create(id);
+ layer->setScrollable(true);
+ layer->setDrawsContent(true);
+ layer->setPosition(position);
+ layer->setBounds(size);
+ layer->setContentBounds(size);
+ layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2));
+ return layer.release();
+ }
+
+ void initializeLayerRendererAndDrawFrame()
+ {
+ m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader);
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+ }
+
protected:
- PassRefPtr<GraphicsContext3D> createContext()
+ PassRefPtr<CCGraphicsContext> createContext()
{
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow));
}
DebugScopedSetImplThread m_alwaysImplThread;
@@ -118,6 +173,7 @@ protected:
OwnPtr<CCLayerTreeHostImpl> m_hostImpl;
bool m_didRequestCommit;
bool m_didRequestRedraw;
+ CCScopedSettings m_scopedSettings;
};
TEST_F(CCLayerTreeHostImplTest, scrollDeltaNoLayers)
@@ -189,13 +245,9 @@ TEST_F(CCLayerTreeHostImplTest, scrollDeltaRepeatedScrolls)
TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
{
- {
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
- root->setScrollable(true);
- root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(IntSize(100, 100));
- m_hostImpl->setRootLayer(root.release());
- }
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
m_hostImpl->scrollBy(IntSize(0, 10));
@@ -204,20 +256,57 @@ TEST_F(CCLayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
EXPECT_TRUE(m_didRequestCommit);
}
+TEST_F(CCLayerTreeHostImplTest, scrollWithoutRootLayer)
+{
+ // We should not crash when trying to scroll an empty layer tree.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
+}
+
+TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling)
+{
+ const int scrollLayerId = 0;
+
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
+
+ // We should not crash if the tree is replaced while we are scrolling.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->detachLayerTree();
+
+ setupScrollAndContentsLayers(IntSize(100, 100));
+
+ // We should still be scrolling, because the scrolled layer also exists in the new tree.
+ IntSize scrollDelta(0, 10);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ expectContains(*scrollInfo, scrollLayerId, scrollDelta);
+}
+
+TEST_F(CCLayerTreeHostImplTest, clearRootRenderSurfaceAndScroll)
+{
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
+
+ // We should be able to scroll even if the root layer loses its render surface after the most
+ // recent render.
+ m_hostImpl->rootLayer()->clearRenderSurface();
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+}
+
TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers)
{
- {
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
- root->setScrollable(true);
- root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(IntSize(100, 100));
- m_hostImpl->setRootLayer(root.release());
- }
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
CCLayerImpl* root = m_hostImpl->rootLayer();
root->setHaveWheelEventHandlers(true);
+
// With registered event handlers, wheel scrolls have to go to the main thread.
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread);
// But gesture scrolls can still be handled.
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollStarted);
@@ -225,27 +314,29 @@ TEST_F(CCLayerTreeHostImplTest, wheelEventHandlers)
TEST_F(CCLayerTreeHostImplTest, shouldScrollOnMainThread)
{
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
- root->setScrollable(true);
- root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(IntSize(100, 100));
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
+ CCLayerImpl* root = m_hostImpl->rootLayer();
+
root->setShouldScrollOnMainThread(true);
- m_hostImpl->setRootLayer(root.release());
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollFailed);
+
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollOnMainThread);
}
TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic)
{
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
- root->setScrollable(true);
- root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(IntSize(100, 100));
+ setupScrollAndContentsLayers(IntSize(200, 200));
+ m_hostImpl->setViewportSize(IntSize(100, 100));
+ initializeLayerRendererAndDrawFrame();
+ CCLayerImpl* root = m_hostImpl->rootLayer();
+
root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50));
- m_hostImpl->setRootLayer(root.release());
+
// All scroll types inside the non-fast scrollable region should fail.
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollFailed);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Gesture), CCInputHandlerClient::ScrollOnMainThread);
// All scroll types outside this region should succeed.
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
@@ -258,16 +349,13 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionBasic)
TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
{
- OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
- root->setScrollable(true);
- root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(IntSize(100, 100));
+ setupScrollAndContentsLayers(IntSize(200, 200));
+ m_hostImpl->setViewportSize(IntSize(100, 100));
+ CCLayerImpl* root = m_hostImpl->rootLayer();
+
root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50));
root->setPosition(FloatPoint(-25, 0));
- m_hostImpl->setRootLayer(root.release());
- CCLayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame); // Update draw transforms so we can correctly map points into layer space.
+ initializeLayerRendererAndDrawFrame();
// This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels.
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
@@ -275,15 +363,16 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
m_hostImpl->scrollEnd();
// This point is still inside the non-fast region.
- EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollFailed);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread);
}
TEST_F(CCLayerTreeHostImplTest, pinchGesture)
{
setupScrollAndContentsLayers(IntSize(100, 100));
m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
- CCLayerImpl* scrollLayer = m_hostImpl->scrollLayer();
+ CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
ASSERT(scrollLayer);
const float minPageScale = 0.5, maxPageScale = 4;
@@ -362,8 +451,9 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation)
{
setupScrollAndContentsLayers(IntSize(100, 100));
m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
- CCLayerImpl* scrollLayer = m_hostImpl->scrollLayer();
+ CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
ASSERT(scrollLayer);
const float minPageScale = 0.5, maxPageScale = 4;
@@ -407,6 +497,101 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation)
}
}
+TEST_F(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
+{
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
+
+ CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ ASSERT(scrollLayer);
+
+ const float minPageScale = 0.5, maxPageScale = 4;
+
+ // Pinch zoom in.
+ {
+ // Start a pinch in gesture at the bottom right corner of the viewport.
+ const float zoomInDelta = 2;
+ m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->pinchGestureBegin();
+ m_hostImpl->pinchGestureUpdate(zoomInDelta, IntPoint(50, 50));
+
+ // Because we are pinch zooming in, we shouldn't get any scroll or page
+ // scale deltas.
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, 1);
+ EXPECT_EQ(scrollInfo->scrolls.size(), 0u);
+
+ // Once the gesture ends, we get the final scroll and page scale values.
+ m_hostImpl->pinchGestureEnd();
+ scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, zoomInDelta);
+ expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25));
+ }
+
+ // Pinch zoom out.
+ {
+ // Start a pinch out gesture at the bottom right corner of the viewport.
+ const float zoomOutDelta = 0.75;
+ m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->pinchGestureBegin();
+ m_hostImpl->pinchGestureUpdate(zoomOutDelta, IntPoint(50, 50));
+
+ // Since we are pinch zooming out, we should get an update to zoom all
+ // the way out to the minimum page scale.
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
+ expectContains(*scrollInfo, scrollLayer->id(), IntSize(0, 0));
+
+ // Once the gesture ends, we get the final scroll and page scale values.
+ m_hostImpl->pinchGestureEnd();
+ scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, zoomOutDelta);
+ expectContains(*scrollInfo, scrollLayer->id(), IntSize(8, 8));
+ }
+}
+
+TEST_F(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPageScale)
+{
+ setupScrollAndContentsLayers(IntSize(100, 100));
+ m_hostImpl->setViewportSize(IntSize(50, 50));
+ initializeLayerRendererAndDrawFrame();
+
+ CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ ASSERT(scrollLayer);
+
+ const float minPageScale = 0.5, maxPageScale = 4;
+ const double startTime = 1;
+ const double duration = 0.1;
+ const double halfwayThroughAnimation = startTime + duration / 2;
+ const double endTime = startTime + duration;
+
+ // Start a page scale animation.
+ const float pageScaleDelta = 2;
+ m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->startPageScaleAnimation(IntSize(50, 50), false, pageScaleDelta, startTime, duration);
+
+ // We should immediately get the final zoom and scroll values for the
+ // animation.
+ m_hostImpl->animate(halfwayThroughAnimation, halfwayThroughAnimation);
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
+ expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25));
+
+ // Scrolling during the animation is ignored.
+ const IntSize scrollDelta(0, 10);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ // The final page scale and scroll deltas should match what we got
+ // earlier.
+ m_hostImpl->animate(endTime, endTime);
+ scrollInfo = m_hostImpl->processScrollDeltas();
+ EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
+ expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25));
+}
+
class DidDrawCheckLayer : public CCTiledLayerImpl {
public:
static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); }
@@ -416,7 +601,7 @@ public:
m_didDrawCalled = true;
}
- virtual void willDraw(LayerRendererChromium*)
+ virtual void willDraw(CCRenderer*, CCGraphicsContext*)
{
m_willDrawCalled = true;
}
@@ -424,6 +609,12 @@ public:
bool didDrawCalled() const { return m_didDrawCalled; }
bool willDrawCalled() const { return m_willDrawCalled; }
+ void clearDidDrawCheck()
+ {
+ m_didDrawCalled = false;
+ m_willDrawCalled = false;
+ }
+
protected:
explicit DidDrawCheckLayer(int id)
: CCTiledLayerImpl(id)
@@ -432,7 +623,12 @@ protected:
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
+ setContentBounds(IntSize(10, 10));
setDrawsContent(true);
+ setSkipsDraw(false);
+
+ OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels);
+ setTilingData(*tiler.get());
}
private:
@@ -485,6 +681,42 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_FALSE(layer->visibleLayerRect().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);
+
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+
+ root->addChild(DidDrawCheckLayer::create(1));
+ DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->children()[0].get());
+
+ root->addChild(DidDrawCheckLayer::create(2));
+ DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children()[1].get());
+ // This layer covers the occludedLayer above. Make this layer large so it can occlude.
+ topLayer->setBounds(bigSize);
+ topLayer->setContentBounds(bigSize);
+ topLayer->setOpaque(true);
+
+ CCLayerTreeHostImpl::FrameData frame;
+
+ EXPECT_FALSE(occludedLayer->willDrawCalled());
+ EXPECT_FALSE(occludedLayer->didDrawCalled());
+ EXPECT_FALSE(topLayer->willDrawCalled());
+ EXPECT_FALSE(topLayer->didDrawCalled());
+
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+
+ EXPECT_FALSE(occludedLayer->willDrawCalled());
+ EXPECT_FALSE(occludedLayer->didDrawCalled());
+ EXPECT_TRUE(topLayer->willDrawCalled());
+ EXPECT_TRUE(topLayer->didDrawCalled());
+}
+
TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
{
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
@@ -562,9 +794,7 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
root->addChild(MissingTextureAnimatingLayer::create(1, true, false, true));
- m_didRequestCommit = false;
EXPECT_FALSE(m_hostImpl->prepareToDraw(frame));
- EXPECT_TRUE(m_didRequestCommit);
m_hostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
@@ -578,6 +808,299 @@ TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
m_hostImpl->didDrawAllLayers(frame);
}
+TEST_F(CCLayerTreeHostImplTest, scrollRootIgnored)
+{
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ root->setScrollable(false);
+ m_hostImpl->setRootLayer(root.release());
+ initializeLayerRendererAndDrawFrame();
+
+ // Scroll event is ignored because layer is not scrollable.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
+ EXPECT_FALSE(m_didRequestRedraw);
+ EXPECT_FALSE(m_didRequestCommit);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollNonCompositedRoot)
+{
+ // Test the configuration where a non-composited root layer is embedded in a
+ // scrollable outer layer.
+ IntSize surfaceSize(10, 10);
+
+ OwnPtr<CCLayerImpl> contentLayer = CCLayerImpl::create(1);
+ contentLayer->setIsNonCompositedContent(true);
+ contentLayer->setDrawsContent(true);
+ contentLayer->setPosition(IntPoint(5, 5));
+ contentLayer->setBounds(surfaceSize);
+ contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2));
+
+ OwnPtr<CCLayerImpl> scrollLayer = CCLayerImpl::create(0);
+ scrollLayer->setScrollable(true);
+ scrollLayer->setMaxScrollPosition(surfaceSize);
+ scrollLayer->addChild(contentLayer.release());
+
+ m_hostImpl->setRootLayer(scrollLayer.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(IntSize(0, 10));
+ m_hostImpl->scrollEnd();
+ EXPECT_TRUE(m_didRequestRedraw);
+ EXPECT_TRUE(m_didRequestCommit);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
+{
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ root->addChild(createScrollableLayer(1, FloatPoint(5, 5), surfaceSize));
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(IntSize(0, 10));
+ m_hostImpl->scrollEnd();
+ EXPECT_TRUE(m_didRequestRedraw);
+ EXPECT_TRUE(m_didRequestCommit);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollMissesChild)
+{
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ root->addChild(createScrollableLayer(1, FloatPoint(5, 5), surfaceSize));
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ // Scroll event is ignored because the input coordinate is outside the layer boundaries.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(15, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
+ EXPECT_FALSE(m_didRequestRedraw);
+ EXPECT_FALSE(m_didRequestCommit);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollMissesBackfacingChild)
+{
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ OwnPtr<CCLayerImpl> child = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize);
+ m_hostImpl->setViewportSize(surfaceSize);
+
+ WebTransformationMatrix matrix;
+ matrix.rotate3d(180, 0, 0);
+ child->setTransform(matrix);
+ child->setDoubleSided(false);
+
+ root->addChild(child.release());
+ m_hostImpl->setRootLayer(root.release());
+ initializeLayerRendererAndDrawFrame();
+
+ // Scroll event is ignored because the scrollable layer is not facing the viewer and there is
+ // nothing scrollable behind it.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollIgnored);
+ EXPECT_FALSE(m_didRequestRedraw);
+ EXPECT_FALSE(m_didRequestCommit);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollBlockedByContentLayer)
+{
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> contentLayer = createScrollableLayer(0, FloatPoint(5, 5), surfaceSize);
+ contentLayer->setShouldScrollOnMainThread(true);
+ contentLayer->setScrollable(false);
+
+ OwnPtr<CCLayerImpl> scrollLayer = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize);
+ scrollLayer->addChild(contentLayer.release());
+
+ m_hostImpl->setRootLayer(scrollLayer.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ // Scrolling fails because the content layer is asking to be scrolled on the main thread.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollOnMainThread);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
+{
+ IntSize surfaceSize(10, 10);
+ float pageScale = 2;
+ OwnPtr<CCLayerImpl> root = createScrollableLayer(0, FloatPoint(5, 5), surfaceSize);
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ IntSize scrollDelta(0, 10);
+ IntSize expectedScrollDelta(scrollDelta);
+ IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition());
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ // Set new page scale from main thread.
+ m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale);
+
+ // The scale should apply to the scroll delta.
+ expectedScrollDelta.scale(pageScale);
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ expectContains(*scrollInfo.get(), 0, expectedScrollDelta);
+
+ // The scroll range should also have been updated.
+ EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll);
+
+ // The page scale delta remains constant because the impl thread did not scale.
+ EXPECT_EQ(m_hostImpl->rootLayer()->pageScaleDelta(), 1);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
+{
+ IntSize surfaceSize(10, 10);
+ float pageScale = 2;
+ OwnPtr<CCLayerImpl> root = createScrollableLayer(0, FloatPoint(5, 5), surfaceSize);
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
+ initializeLayerRendererAndDrawFrame();
+
+ IntSize scrollDelta(0, 10);
+ IntSize expectedScrollDelta(scrollDelta);
+ IntSize expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollPosition());
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ // Set new page scale on impl thread by pinching.
+ m_hostImpl->pinchGestureBegin();
+ m_hostImpl->pinchGestureUpdate(pageScale, IntPoint());
+ m_hostImpl->pinchGestureEnd();
+
+ // The scroll delta is not scaled because the main thread did not scale.
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ expectContains(*scrollInfo.get(), 0, expectedScrollDelta);
+
+ // The scroll range should also have been updated.
+ EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), expectedMaxScroll);
+
+ // The page scale delta should match the new scale on the impl side.
+ EXPECT_EQ(m_hostImpl->rootLayer()->pageScaleDelta(), pageScale);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
+{
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
+ // Also mark the root scrollable so it becomes the root scroll layer.
+ root->setScrollable(true);
+ root->addChild(createScrollableLayer(1, FloatPoint(5, 5), surfaceSize));
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+
+ CCLayerImpl* child = m_hostImpl->rootLayer()->children()[0].get();
+
+ IntSize scrollDelta(0, 10);
+ IntSize expectedScrollDelta(scrollDelta);
+ IntSize expectedMaxScroll(child->maxScrollPosition());
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ float pageScale = 2;
+ m_hostImpl->setPageScaleFactorAndLimits(pageScale, 1, pageScale);
+
+ // The scale should apply to the scroll delta.
+ expectedScrollDelta.scale(pageScale);
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ expectContains(*scrollInfo.get(), 1, expectedScrollDelta);
+
+ // The scroll range should not have changed.
+ EXPECT_EQ(child->maxScrollPosition(), expectedMaxScroll);
+
+ // The page scale delta remains constant because the impl thread did not scale.
+ EXPECT_EQ(child->pageScaleDelta(), 1);
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollChildBeyondLimit)
+{
+ // Scroll a child layer beyond its maximum scroll range and make sure the
+ // parent layer is scrolled on the axis on which the child was unable to
+ // scroll.
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = createScrollableLayer(0, FloatPoint(5, 5), surfaceSize);
+
+ OwnPtr<CCLayerImpl> grandChild = createScrollableLayer(2, FloatPoint(5, 5), surfaceSize);
+ grandChild->setScrollPosition(IntPoint(0, 5));
+
+ OwnPtr<CCLayerImpl> child = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize);
+ child->setScrollPosition(IntPoint(3, 0));
+ child->addChild(grandChild.release());
+
+ root->addChild(child.release());
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+ {
+ IntSize scrollDelta(-3, -7);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+
+ // The grand child should have scrolled up to its limit.
+ CCLayerImpl* child = m_hostImpl->rootLayer()->children()[0].get();
+ CCLayerImpl* grandChild = child->children()[0].get();
+ expectContains(*scrollInfo.get(), grandChild->id(), IntSize(0, -5));
+
+ // The child should have only scrolled on the other axis.
+ expectContains(*scrollInfo.get(), child->id(), IntSize(-3, 0));
+ }
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollEventBubbling)
+{
+ // When we try to scroll a non-scrollable child layer, the scroll delta
+ // should be applied to one of its ancestors if possible.
+ IntSize surfaceSize(10, 10);
+ OwnPtr<CCLayerImpl> root = createScrollableLayer(0, FloatPoint(5, 5), surfaceSize);
+ OwnPtr<CCLayerImpl> child = createScrollableLayer(1, FloatPoint(5, 5), surfaceSize);
+
+ child->setScrollable(false);
+ root->addChild(child.release());
+
+ m_hostImpl->setRootLayer(root.release());
+ m_hostImpl->setViewportSize(surfaceSize);
+ initializeLayerRendererAndDrawFrame();
+ {
+ IntSize scrollDelta(0, 4);
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ m_hostImpl->scrollBy(scrollDelta);
+ m_hostImpl->scrollEnd();
+
+ OwnPtr<CCScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+
+ // Only the root should have scrolled.
+ ASSERT_EQ(scrollInfo->scrolls.size(), 1u);
+ expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollDelta);
+ }
+}
+
+TEST_F(CCLayerTreeHostImplTest, scrollBeforeRedraw)
+{
+ IntSize surfaceSize(10, 10);
+ m_hostImpl->setRootLayer(createScrollableLayer(0, FloatPoint(5, 5), surfaceSize));
+ m_hostImpl->setViewportSize(surfaceSize);
+
+ // Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization.
+ initializeLayerRendererAndDrawFrame();
+ m_hostImpl->detachLayerTree();
+ m_hostImpl->setRootLayer(createScrollableLayer(0, FloatPoint(5, 5), surfaceSize));
+
+ // Scrolling should still work even though we did not draw yet.
+ EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+}
+
class BlendStateTrackerContext: public FakeWebGraphicsContext3D {
public:
BlendStateTrackerContext() : m_blend(false) { }
@@ -646,6 +1169,7 @@ private:
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
+ setContentBounds(IntSize(10, 10));
setDrawsContent(true);
}
@@ -666,6 +1190,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
OwnPtr<CCLayerImpl> root = CCLayerImpl::create(0);
root->setAnchorPoint(FloatPoint(0, 0));
root->setBounds(IntSize(10, 10));
+ root->setContentBounds(root->bounds());
root->setDrawsContent(false);
m_hostImpl->setRootLayer(root.release());
}
@@ -988,7 +1513,8 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw)
{
ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext();
RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
- m_hostImpl->initializeLayerRenderer(context, UnthrottledUploader);
+ RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
+ m_hostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
root->setAnchorPoint(FloatPoint(0, 0));
@@ -1031,13 +1557,14 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
{
PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
// This test creates its own CCLayerTreeHostImpl, so
// that we can force partial swap enabled.
- CCSettings settings;
- settings.partialSwapEnabled = true;
+ CCLayerTreeSettings settings;
+ CCSettings::setPartialSwapEnabled(true);
OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
- layerTreeHostImpl->initializeLayerRenderer(context, UnthrottledUploader);
+ layerTreeHostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
layerTreeHostImpl->setViewportSize(IntSize(500, 500));
CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
@@ -1099,6 +1626,349 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
}
+} // namespace
+
+class FakeLayerWithQuads : public CCLayerImpl {
+public:
+ static PassOwnPtr<FakeLayerWithQuads> create(int id) { return adoptPtr(new FakeLayerWithQuads(id)); }
+
+ virtual void appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE
+ {
+ const Color gray(100, 100, 100);
+ IntRect quadRect(0, 0, 5, 5);
+ OwnPtr<CCDrawQuad> myQuad = CCSolidColorDrawQuad::create(sharedQuadState, quadRect, gray);
+ quadList.append(myQuad.release());
+ }
+
+private:
+ FakeLayerWithQuads(int id)
+ : CCLayerImpl(id)
+ {
+ }
+};
+
+namespace {
+
+class MockContext : public FakeWebGraphicsContext3D {
+public:
+ MOCK_METHOD1(useProgram, void(WebGLId program));
+ MOCK_METHOD5(uniform4f, void(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w));
+ MOCK_METHOD4(uniformMatrix4fv, void(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value));
+ MOCK_METHOD4(drawElements, void(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset));
+ MOCK_METHOD1(getString, WebString(WGC3Denum name));
+ MOCK_METHOD0(getRequestableExtensionsCHROMIUM, WebString());
+ MOCK_METHOD1(enable, void(WGC3Denum cap));
+ MOCK_METHOD4(scissor, void(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height));
+};
+
+class MockContextHarness {
+private:
+ MockContext* m_context;
+public:
+ MockContextHarness(MockContext* context)
+ : m_context(context)
+ {
+ // Catch "uninteresting" calls
+ EXPECT_CALL(*m_context, useProgram(_))
+ .Times(0);
+
+ EXPECT_CALL(*m_context, drawElements(_, _, _, _))
+ .Times(0);
+
+ // These are not asserted
+ EXPECT_CALL(*m_context, uniformMatrix4fv(_, _, _, _))
+ .WillRepeatedly(Return());
+
+ EXPECT_CALL(*m_context, uniform4f(_, _, _, _, _))
+ .WillRepeatedly(Return());
+
+ // Any other strings are empty
+ EXPECT_CALL(*m_context, getString(_))
+ .WillRepeatedly(Return(WebString()));
+
+ // Support for partial swap, if needed
+ EXPECT_CALL(*m_context, getString(GraphicsContext3D::EXTENSIONS))
+ .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer")));
+
+ EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM())
+ .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer")));
+
+ // Any un-sanctioned calls to enable() are OK
+ EXPECT_CALL(*m_context, enable(_))
+ .WillRepeatedly(Return());
+ }
+
+ void mustDrawSolidQuad()
+ {
+ EXPECT_CALL(*m_context, drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0))
+ .WillOnce(Return())
+ .RetiresOnSaturation();
+
+ // 1 is hardcoded return value of fake createProgram()
+ EXPECT_CALL(*m_context, useProgram(1))
+ .WillOnce(Return())
+ .RetiresOnSaturation();
+
+ }
+
+ void mustSetScissor(int x, int y, int width, int height)
+ {
+ EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST))
+ .WillRepeatedly(Return());
+
+ EXPECT_CALL(*m_context, scissor(x, y, width, height))
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return());
+ }
+
+};
+
+TEST_F(CCLayerTreeHostImplTest, noPartialSwap)
+{
+ MockContext* mockContext = new MockContext();
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ MockContextHarness harness(mockContext);
+
+ harness.mustDrawSolidQuad();
+ harness.mustSetScissor(0, 0, 10, 10);
+
+ // Run test case
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, FakeLayerWithQuads::create(1));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ Mock::VerifyAndClearExpectations(&mockContext);
+}
+
+TEST_F(CCLayerTreeHostImplTest, partialSwap)
+{
+ MockContext* mockContext = new MockContext();
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ MockContextHarness harness(mockContext);
+
+ harness.mustDrawSolidQuad();
+ harness.mustSetScissor(0, 0, 10, 10);
+
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ Mock::VerifyAndClearExpectations(&mockContext);
+}
+
+TEST_F(CCLayerTreeHostImplTest, partialSwapNoUpdate)
+{
+ MockContext* mockContext = new MockContext();
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ MockContextHarness harness(mockContext);
+
+ harness.mustDrawSolidQuad();
+ harness.mustSetScissor(0, 8, 2, 2);
+ harness.mustDrawSolidQuad();
+ harness.mustSetScissor(0, 0, 10, 10);
+
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1));
+
+ // Draw once to make sure layer is not new
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ // Generate update in layer
+ CCLayerImpl* root = myHostImpl->rootLayer();
+ root->setUpdateRect(FloatRect(0, 0, 2, 2));
+
+ // This draw should generate no new udpates
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ Mock::VerifyAndClearExpectations(&mockContext);
+}
+
+class PartialSwapContext: public FakeWebGraphicsContext3D {
+public:
+ WebString getString(WGC3Denum name)
+ {
+ if (name == GraphicsContext3D::EXTENSIONS)
+ return WebString("GL_CHROMIUM_post_sub_buffer");
+ return WebString();
+ }
+
+ WebString getRequestableExtensionsCHROMIUM()
+ {
+ return WebString("GL_CHROMIUM_post_sub_buffer");
+ }
+};
+
+static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, CCLayerTreeHostImplClient* client)
+{
+ CCSettings::setPartialSwapEnabled(partialSwap);
+
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client);
+ myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
+ myHostImpl->setViewportSize(IntSize(100, 100));
+
+ /*
+ Layers are created as follows:
+
+ +--------------------+
+ | 1 |
+ | +-----------+ |
+ | | 2 | |
+ | | +-------------------+
+ | | | 3 |
+ | | +-------------------+
+ | | | |
+ | +-----------+ |
+ | |
+ | |
+ +--------------------+
+
+ Layers 1, 2 have render surfaces
+ */
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2);
+ OwnPtr<CCLayerImpl> grandChild = FakeLayerWithQuads::create(3);
+
+ IntRect rootRect(0, 0, 100, 100);
+ IntRect childRect(10, 10, 50, 50);
+ IntRect grandChildRect(5, 5, 150, 150);
+
+ root->createRenderSurface();
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
+ root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setContentBounds(root->bounds());
+ root->setVisibleLayerRect(rootRect);
+ root->setDrawsContent(false);
+ root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
+
+ child->setAnchorPoint(FloatPoint(0, 0));
+ child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setOpacity(0.5f);
+ child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setContentBounds(child->bounds());
+ child->setVisibleLayerRect(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->setDrawsContent(true);
+
+ child->addChild(grandChild.release());
+ root->addChild(child.release());
+
+ myHostImpl->setRootLayer(root.release());
+ return myHostImpl.release();
+}
+
+TEST_F(CCLayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
+{
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this);
+
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Just for consistency, the most interesting stuff already happened
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ // Verify all quads have been computed
+ ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size());
+ EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material());
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
+ }
+}
+
+TEST_F(CCLayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
+{
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this);
+
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Just for consistency, the most interesting stuff already happened
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ // Verify all quads have been computed
+ ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size());
+ EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material());
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
+ }
+}
+
+TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnScissoredLayer)
+{
+ CCLayerTreeSettings settings;
+ CCSettings::setPartialSwapEnabled(true);
+
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this);
+ myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
+ myHostImpl->setViewportSize(IntSize(10, 10));
+
+ myHostImpl->setRootLayer(DidDrawCheckLayer::create(1));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(myHostImpl->rootLayer());
+ root->setMasksToBounds(true);
+
+ root->addChild(DidDrawCheckLayer::create(2));
+ DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get());
+
+ CCLayerTreeHostImpl::FrameData frame;
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
+
+ // We should draw everything the first frame.
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ EXPECT_TRUE(root->willDrawCalled());
+ EXPECT_TRUE(root->didDrawCalled());
+ EXPECT_TRUE(layer->willDrawCalled());
+ EXPECT_TRUE(layer->didDrawCalled());
+
+ root->clearDidDrawCheck();
+ layer->clearDidDrawCheck();
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
+
+ // Drawing again, we should scissor out everything since there is no damage.
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+
+ EXPECT_FALSE(root->willDrawCalled());
+ EXPECT_FALSE(root->didDrawCalled());
+ EXPECT_FALSE(layer->willDrawCalled());
+ EXPECT_FALSE(layer->didDrawCalled());
+}
+
// Make sure that context lost notifications are propagated through the tree.
class ContextLostNotificationCheckLayer : public CCLayerImpl {
public:
@@ -1151,7 +2021,7 @@ public:
TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost)
{
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
- m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow), UnthrottledUploader);
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)), UnthrottledUploader);
m_hostImpl->finishAllRendering();
}
@@ -1165,26 +2035,6 @@ private:
ScrollbarLayerFakePaint(int id) : CCScrollbarLayerImpl(id) { }
};
-TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext)
-{
- m_hostImpl->setRootLayer(ScrollbarLayerFakePaint::create(0));
- ScrollbarLayerFakePaint* scrollbar = static_cast<ScrollbarLayerFakePaint*>(m_hostImpl->rootLayer());
- scrollbar->setBounds(IntSize(1, 1));
- scrollbar->setContentBounds(IntSize(1, 1));
- scrollbar->setDrawsContent(true);
-
- for (int i = 0; i < 2; ++i) {
- CCLayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- ASSERT(frame.renderPasses.size() == 1);
- CCRenderPass* renderPass = frame.renderPasses[0].get();
- // Scrollbar layer should always generate quads, even after lost context
- EXPECT_GT(renderPass->quadList().size(), 0u);
- m_hostImpl->didDrawAllLayers(frame);
- m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader);
- }
-}
-
// Fake WebGraphicsContext3D that will cause a failure if trying to use a
// resource that wasn't created by it (resources created by
// FakeWebGraphicsContext3D have an id of 1).
@@ -1312,6 +2162,38 @@ private:
Client* m_client;
};
+class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3D {
+public:
+ virtual WebString getString(WGC3Denum name) OVERRIDE
+ {
+ if (name == WebCore::GraphicsContext3D::EXTENSIONS)
+ return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle");
+
+ return WebString();
+ }
+
+ static PassRefPtr<GraphicsContext3D> createGraphicsContext()
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+};
+
+class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D {
+public:
+ virtual WebString getString(WGC3Denum name) OVERRIDE
+ {
+ if (name == WebCore::GraphicsContext3D::EXTENSIONS)
+ return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle");
+
+ return WebString();
+ }
+
+ static PassRefPtr<GraphicsContext3D> createGraphicsContext()
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+};
+
TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
{
OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(0));
@@ -1344,8 +2226,21 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
videoLayer->setAnchorPoint(FloatPoint(0, 0));
videoLayer->setContentBounds(IntSize(10, 10));
videoLayer->setDrawsContent(true);
+ videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.release());
+ OwnPtr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(4);
+ ioSurfaceLayer->setBounds(IntSize(10, 10));
+ ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
+ ioSurfaceLayer->setContentBounds(IntSize(10, 10));
+ ioSurfaceLayer->setDrawsContent(true);
+ ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
+ ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
+ rootLayer->addChild(ioSurfaceLayer.release());
+
+ // Use a context that supports IOSurfaces
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(FakeWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader);
+
m_hostImpl->setRootLayer(rootLayer.release());
CCLayerTreeHostImpl::FrameData frame;
@@ -1354,13 +2249,757 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
m_hostImpl->didDrawAllLayers(frame);
m_hostImpl->swapBuffers();
- // Lose the context, replacing it with a StrictWebGraphicsContext3D, that
- // will warn if any resource from the previous context gets used.
- m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext(), UnthrottledUploader);
+ // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
+ // that will warn if any resource from the previous context gets used.
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(StrictWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader);
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->swapBuffers();
+}
+
+// Fake WebGraphicsContext3D that tracks the number of textures in use.
+class TrackingWebGraphicsContext3D : public FakeWebGraphicsContext3D {
+public:
+ TrackingWebGraphicsContext3D()
+ : m_nextTextureId(1)
+ , m_numTextures(0)
+ { }
+
+ virtual WebGLId createTexture() OVERRIDE
+ {
+ WebGLId id = m_nextTextureId;
+ ++m_nextTextureId;
+
+ m_textures.set(id, true);
+ ++m_numTextures;
+ return id;
+ }
+
+ virtual void deleteTexture(WebGLId id) OVERRIDE
+ {
+ if (!m_textures.get(id))
+ return;
+
+ m_textures.set(id, false);
+ --m_numTextures;
+ }
+
+ virtual WebString getString(WGC3Denum name) OVERRIDE
+ {
+ if (name == WebCore::GraphicsContext3D::EXTENSIONS)
+ return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle");
+
+ return WebString();
+ }
+
+ PassRefPtr<GraphicsContext3D> createGraphicsContext()
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(this), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+
+ unsigned numTextures() const { return m_numTextures; }
+
+private:
+ WebGLId m_nextTextureId;
+ HashMap<WebGLId, bool> m_textures;
+ unsigned m_numTextures;
+};
+
+TEST_F(CCLayerTreeHostImplTest, layersFreeTextures)
+{
+ OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(1));
+ rootLayer->setBounds(IntSize(10, 10));
+ rootLayer->setAnchorPoint(FloatPoint(0, 0));
+
+ OwnPtr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2);
+ tileLayer->setBounds(IntSize(10, 10));
+ tileLayer->setAnchorPoint(FloatPoint(0, 0));
+ tileLayer->setContentBounds(IntSize(10, 10));
+ tileLayer->setDrawsContent(true);
+ tileLayer->setSkipsDraw(false);
+ OwnPtr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels));
+ tilingData->setBounds(IntSize(10, 10));
+ tileLayer->setTilingData(*tilingData);
+ tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10));
+ rootLayer->addChild(tileLayer.release());
+
+ OwnPtr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3);
+ textureLayer->setBounds(IntSize(10, 10));
+ textureLayer->setAnchorPoint(FloatPoint(0, 0));
+ textureLayer->setContentBounds(IntSize(10, 10));
+ textureLayer->setDrawsContent(true);
+ textureLayer->setTextureId(1);
+ rootLayer->addChild(textureLayer.release());
+
+ FakeVideoFrameProvider provider;
+ OwnPtr<CCVideoLayerImpl> videoLayer = CCVideoLayerImpl::create(4, &provider);
+ videoLayer->setBounds(IntSize(10, 10));
+ videoLayer->setAnchorPoint(FloatPoint(0, 0));
+ videoLayer->setContentBounds(IntSize(10, 10));
+ videoLayer->setDrawsContent(true);
+ videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
+ rootLayer->addChild(videoLayer.release());
+
+ OwnPtr<CCIOSurfaceLayerImpl> ioSurfaceLayer = CCIOSurfaceLayerImpl::create(5);
+ ioSurfaceLayer->setBounds(IntSize(10, 10));
+ ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
+ ioSurfaceLayer->setContentBounds(IntSize(10, 10));
+ ioSurfaceLayer->setDrawsContent(true);
+ ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
+ ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
+ rootLayer->addChild(ioSurfaceLayer.release());
+
+ // Lose the context, replacing it with a TrackingWebGraphicsContext3D, that
+ // tracks the number of textures allocated. This pointer is owned by its
+ // GraphicsContext3D.
+ TrackingWebGraphicsContext3D* trackingWebGraphicsContext = new TrackingWebGraphicsContext3D();
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(trackingWebGraphicsContext->createGraphicsContext()), UnthrottledUploader);
+
+ m_hostImpl->setRootLayer(rootLayer.release());
+
+ CCLayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
m_hostImpl->swapBuffers();
+
+ EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u);
+
+ // Kill the layer tree.
+ m_hostImpl->setRootLayer(CCLayerImpl::create(100));
+ // FIXME: Remove this when we don't use ManagedTextures in impl layers.
+ m_hostImpl->layerRenderer()->implTextureManager()->deleteEvictedTextures(m_hostImpl->layerRenderer()->implTextureAllocator());
+ // There should be no textures left in use after.
+ EXPECT_EQ(0u, trackingWebGraphicsContext->numTextures());
+}
+
+class MockDrawQuadsToFillScreenContext : public FakeWebGraphicsContext3D {
+public:
+ MOCK_METHOD1(useProgram, void(WebGLId program));
+ MOCK_METHOD4(drawElements, void(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset));
+};
+
+TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground)
+{
+ MockDrawQuadsToFillScreenContext* mockContext = new MockDrawQuadsToFillScreenContext();
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+
+ // Run test case
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, CCLayerImpl::create(1));
+ myHostImpl->setBackgroundColor(Color::white);
+
+ // Verify one quad is drawn when transparent background set is not set.
+ myHostImpl->setHasTransparentBackground(false);
+ EXPECT_CALL(*mockContext, useProgram(_))
+ .Times(1);
+ EXPECT_CALL(*mockContext, drawElements(_, _, _, _))
+ .Times(1);
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ Mock::VerifyAndClearExpectations(&mockContext);
+
+ // Verify no quads are drawn when transparent background is set.
+ myHostImpl->setHasTransparentBackground(true);
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ Mock::VerifyAndClearExpectations(&mockContext);
+}
+
+TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching)
+{
+ CCSettings::setPartialSwapEnabled(true);
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this);
+
+ RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+
+ myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
+ myHostImpl->setViewportSize(IntSize(100, 100));
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ CCLayerImpl* rootPtr = root.get();
+
+ root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(FloatPoint(0, 0));
+ root->setBounds(IntSize(100, 100));
+ root->setContentBounds(IntSize(100, 100));
+ root->setVisibleLayerRect(IntRect(0, 0, 100, 100));
+ root->setDrawsContent(true);
+ myHostImpl->setRootLayer(root.release());
+
+ // Intermediate layer does not own a surface, and does not draw content.
+ OwnPtr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(2);
+ CCLayerImpl* intermediateLayerPtr = intermediateLayer.get();
+
+ intermediateLayerPtr->setAnchorPoint(FloatPoint(0, 0));
+ intermediateLayerPtr->setPosition(FloatPoint(10, 10));
+ intermediateLayerPtr->setBounds(IntSize(100, 100));
+ intermediateLayerPtr->setContentBounds(IntSize(100, 100));
+ intermediateLayerPtr->setVisibleLayerRect(IntRect(0, 0, 100, 100));
+ intermediateLayerPtr->setDrawsContent(false); // only children draw content
+ rootPtr->addChild(intermediateLayer.release());
+
+ OwnPtr<CCLayerImpl> surfaceLayer = CCLayerImpl::create(3);
+ CCLayerImpl* surfaceLayerPtr = surfaceLayer.get();
+
+ // Surface layer is the layer that changes its opacity
+ // It will contain other layers that draw content.
+ surfaceLayerPtr->setAnchorPoint(FloatPoint(0, 0));
+ surfaceLayerPtr->setPosition(FloatPoint(10, 10));
+ surfaceLayerPtr->setBounds(IntSize(50, 50));
+ surfaceLayerPtr->setContentBounds(IntSize(50, 50));
+ surfaceLayerPtr->setVisibleLayerRect(IntRect(0, 0, 50, 50));
+ surfaceLayerPtr->setDrawsContent(false); // only children draw content
+ surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface
+ intermediateLayerPtr->addChild(surfaceLayer.release());
+
+ // Child of the surface layer will produce some quads
+ OwnPtr<FakeLayerWithQuads> child = FakeLayerWithQuads::create(4);
+ FakeLayerWithQuads* childPtr = child.get();
+
+ childPtr->setAnchorPoint(FloatPoint(0, 0));
+ childPtr->setPosition(FloatPoint(5, 5));
+ childPtr->setBounds(IntSize(10, 10));
+ childPtr->setContentBounds(IntSize(10, 10));
+ childPtr->setVisibleLayerRect(IntRect(0, 0, 10, 10));
+ childPtr->setDrawsContent(true);
+
+ surfaceLayerPtr->addChild(child.release());
+
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive two render passes, each with one quad
+ ASSERT_EQ(2U, frame.renderPasses.size());
+ EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
+
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
+ CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get());
+ EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Draw without any change
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive two EMPTY render passes
+ ASSERT_EQ(2U, frame.renderPasses.size());
+ EXPECT_EQ(0U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(0U, frame.renderPasses[1]->quadList().size());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Change opacity and draw
+ surfaceLayerPtr->setOpacity(0.6f);
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive one render pass, as the other one should be culled
+ ASSERT_EQ(1U, frame.renderPasses.size());
+
+ EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material());
+ CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get());
+ EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Change less benign property and draw - should have contents changed flag
+ surfaceLayerPtr->setStackingOrderChanged(true);
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive two render passes, each with one quad
+ ASSERT_EQ(2U, frame.renderPasses.size());
+
+ EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(CCDrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->material());
+
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
+ CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get());
+ EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Change opacity again, but evict the cached surface texture
+ surfaceLayerPtr->setOpacity(0.5f);
+ ManagedTexture* contentsTexture = surfaceLayerPtr->renderSurface()->contentsTexture();
+ ASSERT_TRUE(contentsTexture->isValid(contentsTexture->size(), contentsTexture->format()));
+ CCRenderer* renderer = myHostImpl->layerRenderer();
+ TextureManager* textureManager = renderer->implTextureManager();
+ size_t maxMemoryLimit = textureManager->maxMemoryLimitBytes();
+
+ // This should evice all cached surfaces
+ textureManager->setMaxMemoryLimitBytes(0);
+
+ // Restore original limit
+ textureManager->setMaxMemoryLimitBytes(maxMemoryLimit);
+
+ // Was our surface evicted?
+ ASSERT_FALSE(contentsTexture->isValid(contentsTexture->size(), contentsTexture->format()));
+
+ // Change opacity and draw
+ surfaceLayerPtr->setOpacity(0.6f);
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive two render passes
+ ASSERT_EQ(2U, frame.renderPasses.size());
+
+ // Even though not enough properties changed, the entire thing must be
+ // redrawn as we don't have cached textures
+ EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
+
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
+ CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get());
+ EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Draw without any change, to make sure the state is clear
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive two EMPTY render passes
+ ASSERT_EQ(2U, frame.renderPasses.size());
+ EXPECT_EQ(0U, frame.renderPasses[0]->quadList().size());
+ EXPECT_EQ(0U, frame.renderPasses[1]->quadList().size());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+
+ // Change opacity on the intermediate layer
+ WebTransformationMatrix transform = intermediateLayerPtr->transform();
+ transform.setM11(1.0001);
+ intermediateLayerPtr->setTransform(transform);
+ {
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+
+ // Must receive one render pass, as the other one should be culled.
+ ASSERT_EQ(1U, frame.renderPasses.size());
+ EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
+
+ EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material());
+ CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get());
+ EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged());
+
+ myHostImpl->drawLayers(frame);
+ myHostImpl->didDrawAllLayers(frame);
+ }
+}
+
+struct RenderPassCacheEntry {
+ mutable OwnPtr<CCRenderPass> renderPassPtr;
+ CCRenderPass* renderPass;
+
+ RenderPassCacheEntry(PassOwnPtr<CCRenderPass> r)
+ : renderPassPtr(r),
+ renderPass(renderPassPtr.get())
+ {
+ }
+
+ RenderPassCacheEntry()
+ {
+ }
+
+ RenderPassCacheEntry(const RenderPassCacheEntry& entry)
+ : renderPassPtr(entry.renderPassPtr.release()),
+ renderPass(entry.renderPass)
+ {
+ }
+
+ RenderPassCacheEntry& operator=(const RenderPassCacheEntry& entry)
+ {
+ renderPassPtr = entry.renderPassPtr.release();
+ renderPass = entry.renderPass;
+ return *this;
+ }
+};
+
+struct RenderPassRemovalTestData {
+ CCRenderPassList renderPassList;
+ std::map<char, RenderPassCacheEntry> renderPassCache;
+ std::map<const CCRenderPass*, char> renderPassId;
+ Vector<OwnPtr<CCRenderSurface> > renderSurfaceStore;
+ Vector<OwnPtr<CCLayerImpl> > layerStore;
+ OwnPtr<CCSharedQuadState> sharedQuadState;
+};
+
+class FakeRenderSurface : public CCRenderSurface {
+private:
+ bool m_hasCachedTexture;
+ bool m_contentsChanged;
+
+public:
+ FakeRenderSurface(CCLayerImpl* layerImpl)
+ : CCRenderSurface(layerImpl),
+ m_hasCachedTexture(false)
+ {
+ }
+
+ virtual bool hasCachedContentsTexture() const OVERRIDE
+ {
+ return m_hasCachedTexture;
+ }
+
+ virtual bool prepareContentsTexture(LayerRendererChromium* lrc) OVERRIDE
+ {
+ return true;
+ }
+
+ virtual bool contentsChanged() const OVERRIDE
+ {
+ return m_contentsChanged;
+ }
+
+ void setHasCachedTexture(bool hasCachedTexture)
+ {
+ m_hasCachedTexture = hasCachedTexture;
+ }
+
+ void setContentsChanged(bool contentsChanged)
+ {
+ m_contentsChanged = contentsChanged;
+ }
+};
+
+class CCTestRenderPass: public CCRenderPass {
+public:
+ static PassOwnPtr<CCRenderPass> create(CCRenderSurface* targetSurface)
+ {
+ return adoptPtr(new CCTestRenderPass(targetSurface));
+ }
+
+protected:
+ CCTestRenderPass(CCRenderSurface* surface)
+ : CCRenderPass(surface)
+ {
+ }
+
+public:
+ void appendQuad(PassOwnPtr<CCDrawQuad> quad)
+ {
+ m_quadList.append(quad);
+ }
+};
+
+static PassOwnPtr<CCRenderPass> createDummyRenderPass(RenderPassRemovalTestData& testData)
+{
+ OwnPtr<CCLayerImpl> layerImpl = CCLayerImpl::create(1);
+ CCRenderSurface* renderSurface = new FakeRenderSurface(layerImpl.get());
+ OwnPtr<CCRenderPass> renderPassPtr = CCTestRenderPass::create(renderSurface);
+
+ testData.renderSurfaceStore.append(adoptPtr(renderSurface));
+ testData.layerStore.append(layerImpl.release());
+ return renderPassPtr.release();
+}
+
+static void configureRenderPassTestData(const char* testScript, RenderPassRemovalTestData& testData)
+{
+ // One shared state for all quads - we don't need the correct details
+ testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true);
+
+ const char* currentChar = testScript;
+
+ // Pre-create root pass
+ OwnPtr<CCRenderPass> rootRenderPass = createDummyRenderPass(testData);
+ testData.renderPassId.insert(std::pair<CCRenderPass*, char>(rootRenderPass.get(), testScript[0]));
+ testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(testScript[0], RenderPassCacheEntry(rootRenderPass.release())));
+ while (*currentChar != '\0') {
+ char renderPassId = currentChar[0];
+ currentChar++;
+
+ OwnPtr<CCRenderPass> renderPass;
+
+ bool isReplica = false;
+ if (!testData.renderPassCache[renderPassId].renderPassPtr.get())
+ isReplica = true;
+
+ renderPass = testData.renderPassCache[renderPassId].renderPassPtr.release();
+
+ // Cycle through quad data and create all quads
+ while (*currentChar != '\n' && *currentChar != '\0') {
+ if (*currentChar == 's') {
+ // Solid color draw quad
+ OwnPtr<CCDrawQuad> quad = CCSolidColorDrawQuad::create(testData.sharedQuadState.get(), IntRect(0, 0, 10, 10), Color::white);
+
+ static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release());
+ currentChar++;
+ } else if ((*currentChar >= 'A') && (*currentChar <= 'Z')) {
+ // RenderPass draw quad
+ char newRenderPassId = *currentChar;
+ currentChar++;
+ bool hasTexture = false;
+ bool contentsChanged = true;
+
+ if (*currentChar == '[') {
+ currentChar++;
+ while ((*currentChar != ']') && (*currentChar != '\0')) {
+ switch (*currentChar) {
+ case 'c':
+ contentsChanged = false;
+ break;
+ case 't':
+ hasTexture = true;
+ break;
+ }
+ currentChar++;
+ }
+ if (*currentChar == ']')
+ currentChar++;
+ }
+
+ CCRenderPass* refRenderPassPtr;
+
+ if (testData.renderPassCache.find(newRenderPassId) == testData.renderPassCache.end()) {
+ OwnPtr<CCRenderPass> refRenderPass = createDummyRenderPass(testData);
+ refRenderPassPtr = refRenderPass.get();
+ FakeRenderSurface* refRenderSurface = static_cast<FakeRenderSurface*>(refRenderPass->targetSurface());
+ refRenderSurface->setHasCachedTexture(hasTexture);
+ refRenderSurface->setContentsChanged(contentsChanged);
+ 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<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), IntRect(), refRenderPassPtr, isReplica, WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1);
+ static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release());
+ }
+ }
+ testData.renderPassList.insert(0, renderPass.release());
+ if (*currentChar != '\0')
+ currentChar++;
+ }
+}
+
+void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buffer)
+{
+ char* pos = buffer;
+ CCRenderPassList::const_reverse_iterator it = testData.renderPassList.rbegin();
+ while (it != testData.renderPassList.rend()) {
+ CCRenderPass* currentPass = it->get();
+ char passId = testData.renderPassId.find(currentPass)->second;
+ *pos = passId;
+ pos++;
+
+ CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin();
+ while (quadListIterator != currentPass->quadList().end()) {
+ CCDrawQuad* currentQuad = (*quadListIterator).get();
+ switch (currentQuad->material()) {
+ case CCDrawQuad::SolidColor:
+ *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;
+ pos++;
+ }
+ break;
+ default:
+ *pos = 'x';
+ pos++;
+ break;
+ }
+
+ quadListIterator++;
+ }
+ *pos = '\n';
+ pos++;
+ it++;
+ }
+ *pos = '\0';
+}
+
+// Each CCRenderPassList is represented by a string which describes the configuration.
+// The syntax of the string is as follows:
+//
+// RsssssX[c]ssYsssZ[t]ssW[ct]
+// Identifies the render pass---------------------------^ ^^^ ^ ^ ^ ^ ^
+// These are solid color quads-----------------------------+ | | | | |
+// Identifies RenderPassDrawQuad's RenderPass-----------------+ | | | |
+// This quad's contents didn't change---------------------------+ | | |
+// This quad's contents changed and it has no texture---------------+ | |
+// This quad has texture but its contents changed-------------------------+ |
+// This quad's contents didn't change and it has texture - will be removed------+
+//
+// Expected results have exactly the same syntax, except they do not use square brackets,
+// since we only check the structure, not attributes.
+//
+// Test case configuration consists of initialization script and expected results,
+// all in the same format.
+struct TestCase {
+ const char* name;
+ const char* initScript;
+ const char* expectedResult;
+};
+
+TestCase removeRenderPassesCases[] =
+ {
+ {
+ "Single root pass",
+ "Rssss\n",
+ "Rssss\n"
+ }, {
+ "Single pass - no quads",
+ "R\n",
+ "R\n"
+ }, {
+ "Two passes, no removal",
+ "RssssAsss\n"
+ "Assss\n",
+ "RssssAsss\n"
+ "Assss\n"
+ }, {
+ "Two passes, remove last",
+ "RssssA[ct]sss\n"
+ "Assss\n",
+ "RssssAsss\n"
+ }, {
+ "Have texture but contents changed - leave pass",
+ "RssssA[t]sss\n"
+ "Assss\n",
+ "RssssAsss\n"
+ "Assss\n"
+ }, {
+ "Contents didn't change but no texture - leave pass",
+ "RssssA[c]sss\n"
+ "Assss\n",
+ "RssssAsss\n"
+ "Assss\n"
+ }, {
+ "Replica: two quads reference the same pass; remove",
+ "RssssA[ct]A[ct]sss\n"
+ "Assss\n",
+ "RssssAAsss\n"
+ }, {
+ "Replica: two quads reference the same pass; leave",
+ "RssssA[c]A[c]sss\n"
+ "Assss\n",
+ "RssssAAsss\n"
+ "Assss\n",
+ }, {
+ "Many passes, remove all",
+ "RssssA[ct]sss\n"
+ "AsssB[ct]C[ct]s\n"
+ "BsssD[ct]ssE[ct]F[ct]\n"
+ "Essssss\n"
+ "CG[ct]\n"
+ "Dsssssss\n"
+ "Fsssssss\n"
+ "Gsss\n",
+
+ "RssssAsss\n"
+ }, {
+ "Deep recursion, remove all",
+
+ "RsssssA[ct]ssss\n"
+ "AssssBsss\n"
+ "BC\n"
+ "CD\n"
+ "DE\n"
+ "EF\n"
+ "FG\n"
+ "GH\n"
+ "HsssIsss\n"
+ "IJ\n"
+ "Jssss\n",
+
+ "RsssssAssss\n"
+ }, {
+ "Wide recursion, remove all",
+ "RA[ct]B[ct]C[ct]D[ct]E[ct]F[ct]G[ct]H[ct]I[ct]J[ct]\n"
+ "As\n"
+ "Bs\n"
+ "Cssss\n"
+ "Dssss\n"
+ "Es\n"
+ "F\n"
+ "Gs\n"
+ "Hs\n"
+ "Is\n"
+ "Jssss\n",
+
+ "RABCDEFGHIJ\n"
+ }, {
+ "Remove passes regardless of cache state",
+ "RssssA[ct]sss\n"
+ "AsssBCs\n"
+ "BsssD[c]ssE[t]F\n"
+ "Essssss\n"
+ "CG\n"
+ "Dsssssss\n"
+ "Fsssssss\n"
+ "Gsss\n",
+
+ "RssssAsss\n"
+ }, {
+ "Leave some passes, remove others",
+
+ "RssssA[c]sss\n"
+ "AsssB[t]C[ct]s\n"
+ "BsssD[c]ss\n"
+ "CG\n"
+ "Dsssssss\n"
+ "Gsss\n",
+
+ "RssssAsss\n"
+ "AsssBCs\n"
+ "BsssDss\n"
+ "Dsssssss\n"
+ }, {
+ 0, 0, 0
+ }
+ };
+
+static void verifyRenderPassTestData(TestCase& testCase, RenderPassRemovalTestData& testData)
+{
+ char actualResult[1024];
+ dumpRenderPassTestData(testData, actualResult);
+ EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << testCase.name;
+}
+
+TEST(RenderPassRemovalTest, testRemoveRenderPasses)
+{
+ int testCaseIndex = 0;
+ while (removeRenderPassesCases[testCaseIndex].name) {
+ DebugScopedSetImplThread implThread;
+ RenderPassRemovalTestData testData;
+ CCRenderPassList skippedPasses;
+ configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initScript, testData);
+ CCLayerTreeHostImpl::removePassesWithCachedTextures(testData.renderPassList, skippedPasses);
+ verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testData);
+ testCaseIndex++;
+ }
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
index b996006ae..544eca88b 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
@@ -27,38 +27,20 @@
#include "cc/CCLayerTreeHost.h"
#include "AnimationIdVendor.h"
-#include "CCAnimationTestCommon.h"
#include "CCOcclusionTrackerTestCommon.h"
-#include "CCTiledLayerTestCommon.h"
-#include "CompositorFakeWebGraphicsContext3D.h"
+#include "CCThreadedTest.h"
#include "ContentLayerChromium.h"
-#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
-#include "LayerChromium.h"
-#include "TextureManager.h"
-#include "WebCompositor.h"
-#include "WebKit.h"
-#include "cc/CCActiveAnimation.h"
-#include "cc/CCLayerAnimationController.h"
-#include "cc/CCLayerAnimationDelegate.h"
-#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTreeHostImpl.h"
-#include "cc/CCScopedThreadProxy.h"
-#include "cc/CCSingleThreadProxy.h"
+#include "cc/CCSettings.h"
#include "cc/CCTextureUpdater.h"
-#include "cc/CCThreadTask.h"
#include "cc/CCTimingFunction.h"
#include "platform/WebThread.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <public/Platform.h>
-#include <public/WebFilterOperation.h>
-#include <public/WebFilterOperations.h>
-#include <wtf/Locker.h>
#include <wtf/MainThread.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/ThreadingPrimitives.h>
-#include <wtf/Vector.h>
+#include <wtf/OwnArrayPtr.h>
using namespace WebCore;
using namespace WebKit;
@@ -73,683 +55,8 @@ using namespace WTF;
namespace {
-class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D {
-public:
- static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes attrs)
- {
- return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs));
- }
-
- virtual WebGLId createTexture()
- {
- WebGLId texture = m_textures.size() + 1;
- m_textures.append(texture);
- return texture;
- }
-
- virtual void deleteTexture(WebGLId texture)
- {
- for (size_t i = 0; i < m_textures.size(); i++) {
- if (m_textures[i] == texture) {
- m_textures.remove(i);
- break;
- }
- }
- }
-
- virtual void bindTexture(WGC3Denum /* target */, WebGLId texture)
- {
- m_usedTextures.add(texture);
- }
-
- int numTextures() const { return static_cast<int>(m_textures.size()); }
- int texture(int i) const { return m_textures[i]; }
- void resetTextures() { m_textures.clear(); }
-
- int numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); }
- bool usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); }
- void resetUsedTextures() { m_usedTextures.clear(); }
-
-private:
- explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs)
- {
- }
-
- Vector<WebGLId> m_textures;
- HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures;
-};
-
-// Used by test stubs to notify the test when something interesting happens.
-class TestHooks : public CCLayerAnimationDelegate {
-public:
- virtual void beginCommitOnCCThread(CCLayerTreeHostImpl*) { }
- virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) { }
- virtual void prepareToDrawOnCCThread(CCLayerTreeHostImpl*) { }
- virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) { }
- virtual void animateLayers(CCLayerTreeHostImpl*, double monotonicTime) { }
- virtual void willAnimateLayers(CCLayerTreeHostImpl*, double monotonicTime) { }
- virtual void applyScrollAndScale(const IntSize&, float) { }
- virtual void updateAnimations(double monotonicTime) { }
- virtual void layout() { }
- virtual void didRecreateContext(bool succeeded) { }
- virtual void didCommit() { }
- virtual void didCommitAndDrawFrame() { }
- virtual void scheduleComposite() { }
-
- // Implementation of CCLayerAnimationDelegate
- virtual void notifyAnimationStarted(double time) { }
- virtual void notifyAnimationFinished(double time) { }
-
- virtual PassRefPtr<GraphicsContext3D> createContext()
- {
- GraphicsContext3D::Attributes attrs;
- WebGraphicsContext3D::Attributes webAttrs;
- webAttrs.alpha = attrs.alpha;
-
- OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs);
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
-};
-
-// Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
-class MockLayerTreeHostImpl : public CCLayerTreeHostImpl {
-public:
- static PassOwnPtr<MockLayerTreeHostImpl> create(TestHooks* testHooks, const CCSettings& settings, CCLayerTreeHostImplClient* client)
- {
- return adoptPtr(new MockLayerTreeHostImpl(testHooks, settings, client));
- }
-
- virtual void beginCommit()
- {
- CCLayerTreeHostImpl::beginCommit();
- m_testHooks->beginCommitOnCCThread(this);
- }
-
- virtual void commitComplete()
- {
- CCLayerTreeHostImpl::commitComplete();
- m_testHooks->commitCompleteOnCCThread(this);
- }
-
- virtual bool prepareToDraw(FrameData& frame)
- {
- bool result = CCLayerTreeHostImpl::prepareToDraw(frame);
- m_testHooks->prepareToDrawOnCCThread(this);
- return result;
- }
-
- virtual void drawLayers(const FrameData& frame)
- {
- CCLayerTreeHostImpl::drawLayers(frame);
- m_testHooks->drawLayersOnCCThread(this);
- }
-
- // Make these public.
- typedef Vector<CCLayerImpl*> CCLayerList;
- using CCLayerTreeHostImpl::calculateRenderSurfaceLayerList;
-
-protected:
- virtual void animateLayers(double monotonicTime, double wallClockTime)
- {
- m_testHooks->willAnimateLayers(this, monotonicTime);
- CCLayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime);
- m_testHooks->animateLayers(this, monotonicTime);
- }
-
- virtual double lowFrequencyAnimationInterval() const
- {
- return 1.0 / 60;
- }
-
-private:
- MockLayerTreeHostImpl(TestHooks* testHooks, const CCSettings& settings, CCLayerTreeHostImplClient* client)
- : CCLayerTreeHostImpl(settings, client)
- , m_testHooks(testHooks)
- {
- }
-
- TestHooks* m_testHooks;
-};
-
-// Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
-class MockLayerTreeHost : public CCLayerTreeHost {
-public:
- static PassOwnPtr<MockLayerTreeHost> create(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
- {
- // For these tests, we will enable threaded animations.
- CCSettings settingsCopy = settings;
- settingsCopy.threadedAnimationEnabled = true;
-
- OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(testHooks, client, settingsCopy)));
- bool success = layerTreeHost->initialize();
- EXPECT_TRUE(success);
- layerTreeHost->setRootLayer(rootLayer);
-
- // LayerTreeHostImpl won't draw if it has 1x1 viewport.
- layerTreeHost->setViewportSize(IntSize(1, 1));
-
- layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks);
-
- return layerTreeHost.release();
- }
-
- virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient* client)
- {
- // For these tests, we will enable threaded animations.
- CCSettings copySettings = settings();
- copySettings.threadedAnimationEnabled = true;
- return MockLayerTreeHostImpl::create(m_testHooks, copySettings, client);
- }
-
- virtual void didAddAnimation() OVERRIDE
- {
- m_didAddAnimationWasCalled = true;
- CCLayerTreeHost::didAddAnimation();
- }
-
- bool didAddAnimationWasCalled()
- {
- return m_didAddAnimationWasCalled;
- }
-
-private:
- MockLayerTreeHost(TestHooks* testHooks, CCLayerTreeHostClient* client, const CCSettings& settings)
- : CCLayerTreeHost(client, settings)
- , m_testHooks(testHooks)
- , m_didAddAnimationWasCalled(false)
- {
- }
-
- TestHooks* m_testHooks;
- bool m_didAddAnimationWasCalled;
-};
-
-// Implementation of CCLayerTreeHost callback interface.
-class MockLayerTreeHostClient : public CCLayerTreeHostClient {
-public:
- static PassOwnPtr<MockLayerTreeHostClient> create(TestHooks* testHooks)
- {
- return adoptPtr(new MockLayerTreeHostClient(testHooks));
- }
-
- virtual void willBeginFrame() OVERRIDE
- {
- }
-
- virtual void didBeginFrame() OVERRIDE
- {
- }
-
- virtual void updateAnimations(double monotonicTime) OVERRIDE
- {
- m_testHooks->updateAnimations(monotonicTime);
- }
-
- virtual void layout() OVERRIDE
- {
- m_testHooks->layout();
- }
-
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
- {
- m_testHooks->applyScrollAndScale(scrollDelta, scale);
- }
-
- virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
- {
- return m_testHooks->createContext();
- }
-
- virtual void willCommit() OVERRIDE
- {
- }
-
- virtual void didCommit() OVERRIDE
- {
- m_testHooks->didCommit();
- }
-
- virtual void didCommitAndDrawFrame() OVERRIDE
- {
- m_testHooks->didCommitAndDrawFrame();
- }
-
- virtual void didCompleteSwapBuffers() OVERRIDE
- {
- }
-
- virtual void didRecreateContext(bool succeeded) OVERRIDE
- {
- m_testHooks->didRecreateContext(succeeded);
- }
-
- virtual void scheduleComposite() OVERRIDE
- {
- m_testHooks->scheduleComposite();
- }
-
-private:
- explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { }
-
- TestHooks* m_testHooks;
-};
-
-// The CCLayerTreeHostTest runs with the main loop running. It instantiates a single MockLayerTreeHost and associated
-// MockLayerTreeHostImpl/MockLayerTreeHostClient.
-//
-// beginTest() is called once the main message loop is running and the layer tree host is initialized.
-//
-// Key stages of the drawing loop, e.g. drawing or commiting, redirect to CCLayerTreeHostTest methods of similar names.
-// To track the commit process, override these functions.
-//
-// The test continues until someone calls endTest. endTest can be called on any thread, but be aware that
-// ending the test is an asynchronous process.
-class CCLayerTreeHostTest : public testing::Test, TestHooks {
-public:
- virtual void afterTest() = 0;
- virtual void beginTest() = 0;
-
- void endTest();
- void endTestAfterDelay(int delayMilliseconds);
-
- void postSetNeedsAnimateToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsAnimate, this);
- }
-
- void postAddAnimationToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchAddAnimation, this);
- }
-
- void postAddInstantAnimationToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchAddInstantAnimation, this);
- }
-
- void postSetNeedsCommitToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsCommit, this);
- }
-
- void AcquireLayerTextures()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchAcquireLayerTextures, this);
- }
-
- void postSetNeedsRedrawToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsRedraw, this);
- }
-
- void postSetNeedsAnimateAndCommitToMainThread()
- {
- callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsAnimateAndCommit, this);
- }
-
- void postSetVisibleToMainThread(bool visible)
- {
- callOnMainThread(visible ? CCLayerTreeHostTest::dispatchSetVisible : CCLayerTreeHostTest::dispatchSetInvisible, this);
- }
-
- void timeout()
- {
- m_timedOut = true;
- endTest();
- }
-
- void clearTimeout()
- {
- m_timeoutTask = 0;
- }
-
- void clearEndTestTask()
- {
- m_endTestTask = 0;
- }
-
- CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); }
-
-
-protected:
- CCLayerTreeHostTest()
- : m_beginning(false)
- , m_endWhenBeginReturns(false)
- , m_timedOut(false)
- , m_finished(false)
- , m_scheduled(false)
- , m_started(false)
- , m_endTestTask(0)
- { }
-
- void doBeginTest();
-
- virtual void scheduleComposite()
- {
- if (!m_started || m_scheduled || m_finished)
- return;
- m_scheduled = true;
- callOnMainThread(&CCLayerTreeHostTest::dispatchComposite, this);
- }
-
- static void onEndTest(void* self)
- {
- ASSERT(isMainThread());
- WebKit::Platform::current()->currentThread()->exitRunLoop();
- }
-
- static void dispatchSetNeedsAnimate(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->setNeedsAnimate();
- }
-
- static void dispatchAddInstantAnimation(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
- }
-
- static void dispatchAddAnimation(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5, true);
- }
-
- static void dispatchSetNeedsAnimateAndCommit(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost) {
- test->m_layerTreeHost->setNeedsAnimate();
- test->m_layerTreeHost->setNeedsCommit();
- }
- }
-
- static void dispatchSetNeedsCommit(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT_TRUE(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->setNeedsCommit();
- }
-
- static void dispatchAcquireLayerTextures(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT_TRUE(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->acquireLayerTextures();
- }
-
- static void dispatchSetNeedsRedraw(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT_TRUE(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->setNeedsRedraw();
- }
-
- static void dispatchSetVisible(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->setVisible(true);
- }
-
- static void dispatchSetInvisible(void* self)
- {
- ASSERT(isMainThread());
-
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(test);
- if (test->m_finished)
- return;
-
- if (test->m_layerTreeHost)
- test->m_layerTreeHost->setVisible(false);
- }
-
- static void dispatchComposite(void* self)
- {
- CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
- ASSERT(isMainThread());
- ASSERT(test);
- test->m_scheduled = false;
- if (test->m_layerTreeHost && !test->m_finished)
- test->m_layerTreeHost->composite();
- }
-
- class TimeoutTask : public WebThread::Task {
- public:
- explicit TimeoutTask(CCLayerTreeHostTest* test)
- : m_test(test)
- {
- }
-
- void clearTest()
- {
- m_test = 0;
- }
-
- virtual ~TimeoutTask()
- {
- if (m_test)
- m_test->clearTimeout();
- }
-
- virtual void run()
- {
- if (m_test)
- m_test->timeout();
- }
-
- private:
- CCLayerTreeHostTest* m_test;
- };
-
- class BeginTask : public WebThread::Task {
- public:
- explicit BeginTask(CCLayerTreeHostTest* test)
- : m_test(test)
- {
- }
-
- virtual ~BeginTask() { }
- virtual void run()
- {
- m_test->doBeginTest();
- }
- private:
- CCLayerTreeHostTest* m_test;
- };
-
- class EndTestTask : public WebThread::Task {
- public:
- explicit EndTestTask(CCLayerTreeHostTest* test)
- : m_test(test)
- {
- }
-
- virtual ~EndTestTask()
- {
- if (m_test)
- m_test->clearEndTestTask();
- }
-
- void clearTest()
- {
- m_test = 0;
- }
-
- virtual void run()
- {
- if (m_test)
- m_test->endTest();
- }
-
- private:
- CCLayerTreeHostTest* m_test;
- };
-
- virtual void runTest(bool threaded)
- {
- if (threaded) {
- m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCLayerTreeHostTest"));
- WebCompositor::initialize(m_webThread.get());
- } else
- WebCompositor::initialize(0);
-
- ASSERT(CCProxy::isMainThread());
- m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
-
- m_beginTask = new BeginTask(this);
- WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task
- m_timeoutTask = new TimeoutTask(this);
- WebKit::Platform::current()->currentThread()->postDelayedTask(m_timeoutTask, 5000);
- WebKit::Platform::current()->currentThread()->enterRunLoop();
-
- if (m_layerTreeHost && m_layerTreeHost->rootLayer())
- m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
- m_layerTreeHost.clear();
-
- if (m_timeoutTask)
- m_timeoutTask->clearTest();
-
- if (m_endTestTask)
- m_endTestTask->clearTest();
-
- ASSERT_FALSE(m_layerTreeHost.get());
- m_client.clear();
- if (m_timedOut) {
- FAIL() << "Test timed out";
- WebCompositor::shutdown();
- return;
- }
- afterTest();
- WebCompositor::shutdown();
- }
-
- CCSettings m_settings;
- OwnPtr<MockLayerTreeHostClient> m_client;
- OwnPtr<CCLayerTreeHost> m_layerTreeHost;
-
-private:
- bool m_beginning;
- bool m_endWhenBeginReturns;
- bool m_timedOut;
- bool m_finished;
- bool m_scheduled;
- bool m_started;
-
- OwnPtr<WebThread> m_webThread;
- RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
- TimeoutTask* m_timeoutTask;
- BeginTask* m_beginTask;
- EndTestTask* m_endTestTask;
-};
-
-void CCLayerTreeHostTest::doBeginTest()
-{
- ASSERT(isMainThread());
- m_client = MockLayerTreeHostClient::create(this);
-
- RefPtr<LayerChromium> rootLayer = LayerChromium::create();
- m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);
- ASSERT_TRUE(m_layerTreeHost);
- rootLayer->setLayerTreeHost(m_layerTreeHost.get());
- m_layerTreeHost->setSurfaceReady();
-
- m_started = true;
- m_beginning = true;
- beginTest();
- m_beginning = false;
- if (m_endWhenBeginReturns)
- onEndTest(static_cast<void*>(this));
-}
-
-void CCLayerTreeHostTest::endTest()
-{
- m_finished = true;
-
- // If we are called from the CCThread, re-call endTest on the main thread.
- if (!isMainThread())
- m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTest));
- else {
- // For the case where we endTest during beginTest(), set a flag to indicate that
- // the test should end the second beginTest regains control.
- if (m_beginning)
- m_endWhenBeginReturns = true;
- else
- onEndTest(static_cast<void*>(this));
- }
-}
-
-void CCLayerTreeHostTest::endTestAfterDelay(int delayMilliseconds)
-{
- // If we are called from the CCThread, re-call endTest on the main thread.
- if (!isMainThread())
- m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTestAfterDelay, delayMilliseconds));
- else {
- m_endTestTask = new EndTestTask(this);
- WebKit::Platform::current()->currentThread()->postDelayedTask(m_endTestTask, delayMilliseconds);
- }
-}
-
-class CCLayerTreeHostTestThreadOnly : public CCLayerTreeHostTest {
-public:
- void runTestThreaded()
- {
- CCLayerTreeHostTest::runTest(true);
- }
-};
+class CCLayerTreeHostTest : public CCThreadedTest { };
+class CCLayerTreeHostTestThreadOnly : public CCThreadedTestThreadOnly { };
// Shortlived layerTreeHosts shouldn't die.
class CCLayerTreeHostTestShortlived1 : public CCLayerTreeHostTest {
@@ -770,18 +77,6 @@ public:
}
};
-#define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
- TEST_F(TEST_FIXTURE_NAME, runSingleThread) \
- { \
- runTest(false); \
- } \
- TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
- { \
- runTest(true); \
- }
-
-SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestShortlived1)
-
// Shortlived layerTreeHosts shouldn't die with a commit in flight.
class CCLayerTreeHostTestShortlived2 : public CCLayerTreeHostTest {
public:
@@ -1076,7 +371,7 @@ public:
virtual void beginTest()
{
- AcquireLayerTextures();
+ postAcquireLayerTextures();
postSetNeedsRedrawToMainThread(); // should be inhibited without blocking
postSetNeedsCommitToMainThread();
}
@@ -1133,7 +428,7 @@ public:
else {
postSetVisibleToMainThread(false);
postSetVisibleToMainThread(true);
- AcquireLayerTextures();
+ postAcquireLayerTextures();
postSetNeedsCommitToMainThread();
}
}
@@ -1287,6 +582,50 @@ TEST_F(CCLayerTreeHostTestAddAnimation, runMultiThread)
runTestThreaded();
}
+// Add a layer animation to a layer, but continually fail to draw. Confirm that after
+// a while, we do eventually force a draw.
+class CCLayerTreeHostTestCheckerboardDoesNotStarveDraws : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestCheckerboardDoesNotStarveDraws()
+ : m_startedAnimating(false)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddAnimationToMainThread();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+ virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
+ {
+ m_startedAnimating = true;
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*)
+ {
+ if (m_startedAnimating)
+ endTest();
+ }
+
+ virtual bool prepareToDrawOnCCThread(CCLayerTreeHostImpl*)
+ {
+ return false;
+ }
+
+private:
+ bool m_startedAnimating;
+};
+
+// Starvation can only be an issue with the MT compositor.
+TEST_F(CCLayerTreeHostTestCheckerboardDoesNotStarveDraws, runMultiThread)
+{
+ runTestThreaded();
+}
+
// Ensures that animations continue to be ticked when we are backgrounded.
class CCLayerTreeHostTestTickAnimationWhileBackgrounded : public CCLayerTreeHostTestThreadOnly {
public:
@@ -1446,56 +785,6 @@ private:
SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes)
-class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
-public:
- virtual bool makeContextCurrent() { return false; }
-};
-
-// Ensures that we do not animate
-class CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation : public CCLayerTreeHostTest {
-public:
- CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation()
- {
- }
-
- virtual void beginTest()
- {
- // This will cause the animation timer to be set which will fire in
- // CCSingleThreadProxy::animationTimerDelay() seconds.
- postAddAnimationToMainThread();
- }
-
- virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
- {
- ASSERT_NOT_REACHED();
- }
-
- virtual void didRecreateContext(bool succeeded)
- {
- EXPECT_FALSE(succeeded);
-
- // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds
- // (use ceil just to be sure). If the timer was not disabled, we will
- // attempt to call CCSingleThreadProxy::compositeImmediately and the
- // test will fail.
- endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000));
- }
-
- virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
-
- virtual void afterTest()
- {
- }
-};
-
-TEST_F(CCLayerTreeHostTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread)
-{
- runTest(false);
-}
-
// Ensures that main thread animations have their start times synchronized with impl thread animations.
class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly {
public:
@@ -1886,8 +1175,7 @@ class CCLayerTreeHostTestSetVisible : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestSetVisible()
- : m_numCommits(0)
- , m_numDraws(0)
+ : m_numDraws(0)
{
}
@@ -1911,7 +1199,6 @@ public:
}
private:
- int m_numCommits;
int m_numDraws;
};
@@ -1927,7 +1214,7 @@ public:
{
}
- virtual void paintContents(GraphicsContext&, const IntRect&)
+ virtual void paintContents(SkCanvas*, const IntRect&, IntRect&)
{
// Set layer opacity to 0.
m_test->layerTreeHost()->rootLayer()->setOpacity(0);
@@ -2021,7 +1308,7 @@ class MockContentLayerDelegate : public ContentLayerDelegate {
public:
bool drawsContent() const { return true; }
MOCK_CONST_METHOD0(preserves3D, bool());
- void paintContents(GraphicsContext&, const IntRect&) { }
+ void paintContents(SkCanvas*, const IntRect&, IntRect&) { }
void notifySyncRequired() { }
};
@@ -2032,13 +1319,13 @@ public:
: m_rootLayer(ContentLayerChromium::create(&m_delegate))
, m_childLayer(ContentLayerChromium::create(&m_delegate))
{
- m_settings.deviceScaleFactor = 1.5;
}
virtual void beginTest()
{
// The device viewport should be scaled by the device scale factor.
m_layerTreeHost->setViewportSize(IntSize(40, 40));
+ m_layerTreeHost->setDeviceScaleFactor(1.5);
EXPECT_EQ(IntSize(40, 40), m_layerTreeHost->viewportSize());
EXPECT_EQ(IntSize(60, 60), m_layerTreeHost->deviceViewportSize());
@@ -2064,7 +1351,7 @@ public:
// Should only do one commit.
EXPECT_EQ(0, impl->sourceFrameNumber());
// Device scale factor should come over to impl.
- EXPECT_NEAR(impl->settings().deviceScaleFactor, 1.5, 0.00001);
+ EXPECT_NEAR(impl->deviceScaleFactor(), 1.5, 0.00001);
// Both layers are on impl.
ASSERT_EQ(1u, impl->rootLayer()->children().size());
@@ -2093,7 +1380,7 @@ public:
EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect());
WebTransformationMatrix scaleTransform;
- scaleTransform.scale(impl->settings().deviceScaleFactor);
+ scaleTransform.scale(impl->deviceScaleFactor());
// The root layer is scaled by 2x.
WebTransformationMatrix rootScreenSpaceTransform = scaleTransform;
@@ -2154,7 +1441,7 @@ public:
virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
switch (impl->sourceFrameNumber()) {
case 0:
@@ -2188,7 +1475,7 @@ public:
virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
// Number of textures used for draw should always be one.
EXPECT_EQ(1, context->numUsedTextures());
@@ -2258,7 +1545,7 @@ public:
virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
switch (impl->sourceFrameNumber()) {
case 0:
@@ -2327,7 +1614,7 @@ public:
virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
// Number of textures used for drawing should two except for frame 4
// where the viewport only contains one layer.
@@ -2940,33 +2227,115 @@ SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestFinishAllRendering)
// correctly recognized.
class CCLayerTreeHostTestLayerAddedWithAnimation : public CCLayerTreeHostTest {
public:
- CCLayerTreeHostTestLayerAddedWithAnimation() { }
+ CCLayerTreeHostTestLayerAddedWithAnimation()
+ : m_addedAnimation(false)
+ {
+ }
virtual void beginTest()
{
- EXPECT_FALSE(static_cast<MockLayerTreeHost*>(layerTreeHost())->didAddAnimationWasCalled());
+ EXPECT_FALSE(m_addedAnimation);
RefPtr<LayerChromium> layer = LayerChromium::create();
- layer->setLayerAnimationDelegate(&m_animationDelegate);
+ layer->setLayerAnimationDelegate(this);
// Any valid CCAnimationCurve will do here.
OwnPtr<CCAnimationCurve> curve(CCEaseTimingFunction::create());
OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), CCActiveAnimation::Opacity));
- layer->layerAnimationController()->add(animation.release());
+ layer->layerAnimationController()->addAnimation(animation.release());
// We add the animation *before* attaching the layer to the tree.
m_layerTreeHost->rootLayer()->addChild(layer);
- EXPECT_TRUE(static_cast<MockLayerTreeHost*>(layerTreeHost())->didAddAnimationWasCalled());
+ EXPECT_TRUE(m_addedAnimation);
endTest();
}
+ virtual void didAddAnimation()
+ {
+ m_addedAnimation = true;
+ }
+
virtual void afterTest() { }
private:
- ::TestHooks m_animationDelegate;
+ bool m_addedAnimation;
};
SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerAddedWithAnimation)
+class CCLayerTreeHostTestScrollChildLayer : public CCLayerTreeHostTest, public LayerChromiumScrollDelegate {
+public:
+ CCLayerTreeHostTestScrollChildLayer()
+ : m_scrollAmount(2, 1)
+ {
+ }
+
+ virtual void beginTest() OVERRIDE
+ {
+ m_layerTreeHost->setViewportSize(IntSize(10, 10));
+ m_rootScrollLayer = ContentLayerChromium::create(&m_mockDelegate);
+ m_rootScrollLayer->setBounds(IntSize(10, 10));
+ m_rootScrollLayer->setIsDrawable(true);
+ m_rootScrollLayer->setScrollable(true);
+ m_rootScrollLayer->setMaxScrollPosition(IntSize(100, 100));
+ m_layerTreeHost->rootLayer()->addChild(m_rootScrollLayer);
+ m_childLayer = ContentLayerChromium::create(&m_mockDelegate);
+ m_childLayer->setLayerScrollDelegate(this);
+ m_childLayer->setBounds(IntSize(50, 50));
+ m_childLayer->setIsDrawable(true);
+ m_childLayer->setScrollable(true);
+ m_childLayer->setMaxScrollPosition(IntSize(100, 100));
+ m_rootScrollLayer->addChild(m_childLayer);
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void didScroll(const IntSize& scrollDelta) OVERRIDE
+ {
+ m_reportedScrollAmount = scrollDelta;
+ }
+
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float) OVERRIDE
+ {
+ IntPoint position = m_rootScrollLayer->scrollPosition();
+ m_rootScrollLayer->setScrollPosition(position + scrollDelta);
+ }
+
+ virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+ {
+ EXPECT_EQ(m_rootScrollLayer->scrollPosition(), IntPoint());
+ if (!m_layerTreeHost->frameNumber())
+ EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint());
+ else
+ EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint() + m_scrollAmount);
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+ {
+ if (impl->frameNumber() == 1) {
+ EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
+ impl->scrollBy(m_scrollAmount);
+ impl->scrollEnd();
+ } else if (impl->frameNumber() == 2)
+ endTest();
+ }
+
+ virtual void afterTest() OVERRIDE
+ {
+ EXPECT_EQ(m_scrollAmount, m_reportedScrollAmount);
+ }
+
+private:
+ const IntSize m_scrollAmount;
+ IntSize m_reportedScrollAmount;
+ MockContentLayerDelegate m_mockDelegate;
+ RefPtr<LayerChromium> m_childLayer;
+ RefPtr<LayerChromium> m_rootScrollLayer;
+};
+
+TEST_F(CCLayerTreeHostTestScrollChildLayer, runMultiThread)
+{
+ runTest(true);
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
index 80317a008..8631b1942 100644
--- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
@@ -132,7 +132,10 @@ struct CCOcclusionTrackerTestMainThreadTypes {
typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator;
typedef CCOcclusionTracker OcclusionTrackerType;
- static PassLayerPtrType createLayer() { return LayerChromium::create(); }
+ static PassLayerPtrType createLayer()
+ {
+ return LayerChromium::create();
+ }
static PassContentLayerPtrType createContentLayer() { return adoptRef(new ContentLayerType()); }
};
@@ -261,7 +264,10 @@ protected:
root->setClipRect(IntRect(IntPoint::zero(), root->bounds()));
m_renderSurfaceLayerListImpl.append(m_root.get());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, 0, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, 0, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListImpl, root->renderSurface()->contentRect());
+
m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListImpl);
}
@@ -277,7 +283,10 @@ protected:
root->setClipRect(IntRect(IntPoint::zero(), root->bounds()));
m_renderSurfaceLayerListChromium.append(m_root);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize);
+ CCLayerTreeHostCommon::calculateDrawTransforms(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize);
+
+ CCLayerTreeHostCommon::calculateVisibleAndScissorRects(m_renderSurfaceLayerListChromium, root->renderSurface()->contentRect());
+
m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListChromium);
}
diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
index 5cbe7fc54..c8b0edaed 100644
--- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
+++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
@@ -111,6 +111,7 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
renderSurface->setOriginTransform(origin);
renderSurface->setContentRect(contentRect);
renderSurface->setClipRect(clipRect);
+ renderSurface->setScissorRect(clipRect);
renderSurface->setDrawOpacity(1);
OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState();
@@ -119,7 +120,7 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
EXPECT_EQ(30, sharedQuadState->layerTransform().m41());
EXPECT_EQ(40, sharedQuadState->layerTransform().m42());
EXPECT_EQ(contentRect, sharedQuadState->layerRect());
- EXPECT_EQ(clipRect, sharedQuadState->clipRect());
+ EXPECT_EQ(clipRect, sharedQuadState->scissorRect());
EXPECT_EQ(1, sharedQuadState->opacity());
EXPECT_FALSE(sharedQuadState->isOpaque());
}
diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
index 2731c76fd..a99149ba9 100644
--- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
+++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
@@ -285,6 +285,48 @@ TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotA
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
}
+TEST(CCSchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTheNextCommit)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+ state.setMaximumNumberOfFailedDrawsBeforeDrawIsForced(1);
+
+ // Start a commit.
+ state.setNeedsCommit();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME);
+ EXPECT_TRUE(state.commitPending());
+
+ // Then initiate a draw.
+ state.setNeedsRedraw();
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ EXPECT_TRUE(state.redrawPending());
+
+ // Fail the draw.
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ state.didDrawIfPossibleCompleted(false);
+ EXPECT_TRUE(state.redrawPending());
+ // But the commit is ongoing.
+ EXPECT_TRUE(state.commitPending());
+
+ // Finish the commit. Note, we should not yet be forcing a draw, but should
+ // continue the commit as usual.
+ state.beginFrameComplete();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES);
+ state.beginUpdateMoreResourcesComplete(false);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_COMMIT);
+ EXPECT_TRUE(state.redrawPending());
+
+ // The redraw should be forced in this case.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction());
+}
+
TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync)
{
CCSchedulerStateMachine state;
diff --git a/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp b/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp
new file mode 100644
index 000000000..4fe40f241
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCSingleThreadProxyTest.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "cc/CCSingleThreadProxy.h"
+
+#include "CCThreadedTest.h"
+#include "CompositorFakeWebGraphicsContext3D.h"
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
+#include "platform/WebThread.h"
+
+using namespace WebCore;
+using namespace WebKit;
+using namespace WebKitTests;
+
+class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
+public:
+ virtual bool makeContextCurrent() { return false; }
+};
+
+class CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation : public CCThreadedTest {
+public:
+ CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ // This will cause the animation timer to be set which will fire in
+ // CCSingleThreadProxy::animationTimerDelay() seconds.
+ postAddAnimationToMainThread();
+ }
+
+ virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual void didRecreateContext(bool succeeded)
+ {
+ EXPECT_FALSE(succeeded);
+
+ // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds
+ // (use ceil just to be sure). If the timer was not disabled, we will
+ // attempt to call CCSingleThreadProxy::compositeImmediately and the
+ // test will fail.
+ endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000));
+ }
+
+ virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+
+ virtual void afterTest()
+ {
+ }
+};
+
+TEST_F(CCSingleThreadProxyTestInitializeLayerRendererFailsAfterAddAnimation, runSingleThread)
+{
+ runTest(false);
+}
+
+class CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer : public CCThreadedTest {
+public:
+ CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ // This will cause the animation timer to be set which will fire in
+ // CCSingleThreadProxy::animationTimerDelay() seconds.
+ postDidAddAnimationToMainThread();
+ }
+
+ virtual void animateLayers(CCLayerTreeHostImpl*, double)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual void didRecreateContext(bool)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual void didAddAnimation()
+ {
+ // Make sure we wait CCSingleThreadProxy::animationTimerDelay() seconds
+ // (use ceil just to be sure). If the timer was not disabled, we will
+ // attempt to call CCSingleThreadProxy::compositeImmediately and the
+ // test will fail.
+ endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000));
+ }
+
+ virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+
+ virtual void afterTest()
+ {
+ }
+};
+
+TEST_F(CCSingleThreadProxyTestDidAddAnimationBeforeInitializingLayerRenderer, runSingleThread)
+{
+ runTest(false);
+}
diff --git a/Source/WebKit/chromium/tests/CCTestCommon.h b/Source/WebKit/chromium/tests/CCTestCommon.h
new file mode 100644
index 000000000..89fce9818
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCTestCommon.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CCTestCommon_h
+#define CCTestCommon_h
+
+#include "cc/CCSettings.h"
+
+namespace WebKitTests {
+
+// If you have a test that modifies or uses global settings, keep an instance
+// of this class to ensure that you start and end with a clean slate.
+class CCScopedSettings {
+public:
+ CCScopedSettings() { WebCore::CCSettings::reset(); }
+ ~CCScopedSettings() { WebCore::CCSettings::reset(); }
+};
+
+} // namespace WebKitTests
+
+#endif // CCTestCommon_h
diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp
new file mode 100644
index 000000000..57b6df14e
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp
@@ -0,0 +1,651 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "CCThreadedTest.h"
+
+#include "AnimationIdVendor.h"
+#include "CCAnimationTestCommon.h"
+#include "CCOcclusionTrackerTestCommon.h"
+#include "CCTiledLayerTestCommon.h"
+#include "ContentLayerChromium.h"
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
+#include "LayerChromium.h"
+#include "TextureManager.h"
+#include "WebCompositor.h"
+#include "WebKit.h"
+#include "cc/CCActiveAnimation.h"
+#include "cc/CCLayerAnimationController.h"
+#include "cc/CCLayerAnimationDelegate.h"
+#include "cc/CCLayerImpl.h"
+#include "cc/CCLayerTreeHostImpl.h"
+#include "cc/CCScopedThreadProxy.h"
+#include "cc/CCSingleThreadProxy.h"
+#include "cc/CCTextureUpdater.h"
+#include "cc/CCThreadTask.h"
+#include "cc/CCTimingFunction.h"
+#include "platform/WebThread.h"
+#include <gmock/gmock.h>
+#include <public/Platform.h>
+#include <public/WebFilterOperation.h>
+#include <public/WebFilterOperations.h>
+#include <wtf/Locker.h>
+#include <wtf/MainThread.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/ThreadingPrimitives.h>
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+using namespace WebKit;
+using namespace WTF;
+
+namespace WebKitTests {
+
+PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFakeWebGraphicsContext3DWithTextureTracking::create(Attributes attrs)
+{
+ return adoptPtr(new CompositorFakeWebGraphicsContext3DWithTextureTracking(attrs));
+}
+
+WebGLId CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture()
+{
+ WebGLId texture = m_textures.size() + 1;
+ m_textures.append(texture);
+ return texture;
+}
+
+void CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture(WebGLId texture)
+{
+ for (size_t i = 0; i < m_textures.size(); i++) {
+ if (m_textures[i] == texture) {
+ m_textures.remove(i);
+ break;
+ }
+ }
+}
+
+void CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture(WGC3Denum /* target */, WebGLId texture)
+{
+ m_usedTextures.add(texture);
+}
+
+int CompositorFakeWebGraphicsContext3DWithTextureTracking::numTextures() const { return static_cast<int>(m_textures.size()); }
+int CompositorFakeWebGraphicsContext3DWithTextureTracking::texture(int i) const { return m_textures[i]; }
+void CompositorFakeWebGraphicsContext3DWithTextureTracking::resetTextures() { m_textures.clear(); }
+
+int CompositorFakeWebGraphicsContext3DWithTextureTracking::numUsedTextures() const { return static_cast<int>(m_usedTextures.size()); }
+bool CompositorFakeWebGraphicsContext3DWithTextureTracking::usedTexture(int texture) const { return m_usedTextures.find(texture) != m_usedTextures.end(); }
+void CompositorFakeWebGraphicsContext3DWithTextureTracking::resetUsedTextures() { m_usedTextures.clear(); }
+
+CompositorFakeWebGraphicsContext3DWithTextureTracking::CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs) : CompositorFakeWebGraphicsContext3D(attrs)
+{
+}
+
+PassRefPtr<GraphicsContext3D> TestHooks::createContext()
+{
+ GraphicsContext3D::Attributes attrs;
+ WebGraphicsContext3D::Attributes webAttrs;
+ webAttrs.alpha = attrs.alpha;
+
+ OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs);
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+}
+
+PassOwnPtr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client)
+{
+ return adoptPtr(new MockLayerTreeHostImpl(testHooks, settings, client));
+}
+
+void MockLayerTreeHostImpl::beginCommit()
+{
+ CCLayerTreeHostImpl::beginCommit();
+ m_testHooks->beginCommitOnCCThread(this);
+}
+
+void MockLayerTreeHostImpl::commitComplete()
+{
+ CCLayerTreeHostImpl::commitComplete();
+ m_testHooks->commitCompleteOnCCThread(this);
+}
+
+bool MockLayerTreeHostImpl::prepareToDraw(FrameData& frame)
+{
+ bool result = CCLayerTreeHostImpl::prepareToDraw(frame);
+ if (!m_testHooks->prepareToDrawOnCCThread(this))
+ result = false;
+ return result;
+}
+
+void MockLayerTreeHostImpl::drawLayers(const FrameData& frame)
+{
+ CCLayerTreeHostImpl::drawLayers(frame);
+ m_testHooks->drawLayersOnCCThread(this);
+}
+
+void MockLayerTreeHostImpl::animateLayers(double monotonicTime, double wallClockTime)
+{
+ m_testHooks->willAnimateLayers(this, monotonicTime);
+ CCLayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime);
+ m_testHooks->animateLayers(this, monotonicTime);
+}
+
+double MockLayerTreeHostImpl::lowFrequencyAnimationInterval() const
+{
+ return 1.0 / 60;
+}
+
+MockLayerTreeHostImpl::MockLayerTreeHostImpl(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client)
+ : CCLayerTreeHostImpl(settings, client)
+ , m_testHooks(testHooks)
+{
+}
+
+// Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
+class MockLayerTreeHost : public WebCore::CCLayerTreeHost {
+public:
+ static PassOwnPtr<MockLayerTreeHost> create(TestHooks* testHooks, WebCore::CCLayerTreeHostClient* client, PassRefPtr<WebCore::LayerChromium> rootLayer, const WebCore::CCLayerTreeSettings& settings)
+ {
+ OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(testHooks, client, settings)));
+ bool success = layerTreeHost->initialize();
+ EXPECT_TRUE(success);
+ layerTreeHost->setRootLayer(rootLayer);
+
+ // LayerTreeHostImpl won't draw if it has 1x1 viewport.
+ layerTreeHost->setViewportSize(IntSize(1, 1));
+
+ layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks);
+
+ return layerTreeHost.release();
+ }
+
+ virtual PassOwnPtr<WebCore::CCLayerTreeHostImpl> createLayerTreeHostImpl(WebCore::CCLayerTreeHostImplClient* client)
+ {
+ return MockLayerTreeHostImpl::create(m_testHooks, settings(), client);
+ }
+
+ virtual void didAddAnimation() OVERRIDE
+ {
+ CCLayerTreeHost::didAddAnimation();
+ m_testHooks->didAddAnimation();
+ }
+
+private:
+ MockLayerTreeHost(TestHooks* testHooks, WebCore::CCLayerTreeHostClient* client, const WebCore::CCLayerTreeSettings& settings)
+ : CCLayerTreeHost(client, settings)
+ , m_testHooks(testHooks)
+ {
+ }
+
+ TestHooks* m_testHooks;
+};
+
+// Implementation of CCLayerTreeHost callback interface.
+class MockLayerTreeHostClient : public MockCCLayerTreeHostClient {
+public:
+ static PassOwnPtr<MockLayerTreeHostClient> create(TestHooks* testHooks)
+ {
+ return adoptPtr(new MockLayerTreeHostClient(testHooks));
+ }
+
+ virtual void willBeginFrame() OVERRIDE
+ {
+ }
+
+ virtual void didBeginFrame() OVERRIDE
+ {
+ }
+
+ virtual void updateAnimations(double monotonicTime) OVERRIDE
+ {
+ m_testHooks->updateAnimations(monotonicTime);
+ }
+
+ virtual void layout() OVERRIDE
+ {
+ m_testHooks->layout();
+ }
+
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
+ {
+ m_testHooks->applyScrollAndScale(scrollDelta, scale);
+ }
+
+ virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
+ {
+ return m_testHooks->createContext();
+ }
+
+ virtual void willCommit() OVERRIDE
+ {
+ }
+
+ virtual void didCommit() OVERRIDE
+ {
+ m_testHooks->didCommit();
+ }
+
+ virtual void didCommitAndDrawFrame() OVERRIDE
+ {
+ m_testHooks->didCommitAndDrawFrame();
+ }
+
+ virtual void didCompleteSwapBuffers() OVERRIDE
+ {
+ }
+
+ virtual void didRecreateContext(bool succeeded) OVERRIDE
+ {
+ m_testHooks->didRecreateContext(succeeded);
+ }
+
+ virtual void scheduleComposite() OVERRIDE
+ {
+ m_testHooks->scheduleComposite();
+ }
+
+private:
+ explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { }
+
+ TestHooks* m_testHooks;
+};
+
+class TimeoutTask : public WebThread::Task {
+public:
+ explicit TimeoutTask(CCThreadedTest* test)
+ : m_test(test)
+ {
+ }
+
+ void clearTest()
+ {
+ m_test = 0;
+ }
+
+ virtual ~TimeoutTask()
+ {
+ if (m_test)
+ m_test->clearTimeout();
+ }
+
+ virtual void run()
+ {
+ if (m_test)
+ m_test->timeout();
+ }
+
+private:
+ CCThreadedTest* m_test;
+};
+
+class BeginTask : public WebThread::Task {
+public:
+ explicit BeginTask(CCThreadedTest* test)
+ : m_test(test)
+ {
+ }
+
+ virtual ~BeginTask() { }
+ virtual void run()
+ {
+ m_test->doBeginTest();
+ }
+private:
+ CCThreadedTest* m_test;
+};
+
+class EndTestTask : public WebThread::Task {
+public:
+ explicit EndTestTask(CCThreadedTest* test)
+ : m_test(test)
+ {
+ }
+
+ virtual ~EndTestTask()
+ {
+ if (m_test)
+ m_test->clearEndTestTask();
+ }
+
+ void clearTest()
+ {
+ m_test = 0;
+ }
+
+ virtual void run()
+ {
+ if (m_test)
+ m_test->endTest();
+ }
+
+private:
+ CCThreadedTest* m_test;
+};
+
+CCThreadedTest::CCThreadedTest()
+ : m_beginning(false)
+ , m_endWhenBeginReturns(false)
+ , m_timedOut(false)
+ , m_finished(false)
+ , m_scheduled(false)
+ , m_started(false)
+ , m_endTestTask(0)
+{ }
+
+void CCThreadedTest::endTest()
+{
+ m_finished = true;
+
+ // If we are called from the CCThread, re-call endTest on the main thread.
+ if (!isMainThread())
+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::endTest));
+ else {
+ // For the case where we endTest during beginTest(), set a flag to indicate that
+ // the test should end the second beginTest regains control.
+ if (m_beginning)
+ m_endWhenBeginReturns = true;
+ else
+ onEndTest(static_cast<void*>(this));
+ }
+}
+
+void CCThreadedTest::endTestAfterDelay(int delayMilliseconds)
+{
+ // If we are called from the CCThread, re-call endTest on the main thread.
+ if (!isMainThread())
+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadedTest::endTestAfterDelay, delayMilliseconds));
+ else {
+ m_endTestTask = new EndTestTask(this);
+ WebKit::Platform::current()->currentThread()->postDelayedTask(m_endTestTask, delayMilliseconds);
+ }
+}
+
+void CCThreadedTest::postSetNeedsAnimateToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchSetNeedsAnimate, this);
+}
+
+void CCThreadedTest::postAddAnimationToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchAddAnimation, this);
+}
+
+void CCThreadedTest::postAddInstantAnimationToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchAddInstantAnimation, this);
+}
+
+void CCThreadedTest::postSetNeedsCommitToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchSetNeedsCommit, this);
+}
+
+void CCThreadedTest::postAcquireLayerTextures()
+{
+ callOnMainThread(CCThreadedTest::dispatchAcquireLayerTextures, this);
+}
+
+void CCThreadedTest::postSetNeedsRedrawToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchSetNeedsRedraw, this);
+}
+
+void CCThreadedTest::postSetNeedsAnimateAndCommitToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchSetNeedsAnimateAndCommit, this);
+}
+
+void CCThreadedTest::postSetVisibleToMainThread(bool visible)
+{
+ callOnMainThread(visible ? CCThreadedTest::dispatchSetVisible : CCThreadedTest::dispatchSetInvisible, this);
+}
+
+void CCThreadedTest::postDidAddAnimationToMainThread()
+{
+ callOnMainThread(CCThreadedTest::dispatchDidAddAnimation, this);
+}
+
+void CCThreadedTest::doBeginTest()
+{
+ ASSERT(isMainThread());
+ m_client = MockLayerTreeHostClient::create(this);
+
+ RefPtr<LayerChromium> rootLayer = LayerChromium::create();
+ m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);
+ ASSERT_TRUE(m_layerTreeHost);
+ rootLayer->setLayerTreeHost(m_layerTreeHost.get());
+ m_layerTreeHost->setSurfaceReady();
+
+ m_started = true;
+ m_beginning = true;
+ beginTest();
+ m_beginning = false;
+ if (m_endWhenBeginReturns)
+ onEndTest(static_cast<void*>(this));
+}
+
+void CCThreadedTest::timeout()
+{
+ m_timedOut = true;
+ endTest();
+}
+
+void CCThreadedTest::scheduleComposite()
+{
+ if (!m_started || m_scheduled || m_finished)
+ return;
+ m_scheduled = true;
+ callOnMainThread(&CCThreadedTest::dispatchComposite, this);
+}
+
+void CCThreadedTest::onEndTest(void* self)
+{
+ ASSERT(isMainThread());
+ WebKit::Platform::current()->currentThread()->exitRunLoop();
+}
+
+void CCThreadedTest::dispatchSetNeedsAnimate(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->setNeedsAnimate();
+}
+
+void CCThreadedTest::dispatchAddInstantAnimation(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
+}
+
+void CCThreadedTest::dispatchAddAnimation(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5, true);
+}
+
+void CCThreadedTest::dispatchSetNeedsAnimateAndCommit(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost) {
+ test->m_layerTreeHost->setNeedsAnimate();
+ test->m_layerTreeHost->setNeedsCommit();
+ }
+}
+
+void CCThreadedTest::dispatchSetNeedsCommit(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT_TRUE(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->setNeedsCommit();
+}
+
+void CCThreadedTest::dispatchAcquireLayerTextures(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT_TRUE(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->acquireLayerTextures();
+}
+
+void CCThreadedTest::dispatchSetNeedsRedraw(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT_TRUE(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->setNeedsRedraw();
+}
+
+void CCThreadedTest::dispatchSetVisible(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->setVisible(true);
+}
+
+void CCThreadedTest::dispatchSetInvisible(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->setVisible(false);
+}
+
+void CCThreadedTest::dispatchComposite(void* self)
+{
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(isMainThread());
+ ASSERT(test);
+ test->m_scheduled = false;
+ if (test->m_layerTreeHost && !test->m_finished)
+ test->m_layerTreeHost->composite();
+}
+
+void CCThreadedTest::dispatchDidAddAnimation(void* self)
+{
+ ASSERT(isMainThread());
+
+ CCThreadedTest* test = static_cast<CCThreadedTest*>(self);
+ ASSERT(test);
+ if (test->m_finished)
+ return;
+
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->didAddAnimation();
+}
+
+void CCThreadedTest::runTest(bool threaded)
+{
+ // For these tests, we will enable threaded animations.
+ WebCompositor::setAcceleratedAnimationEnabled(true);
+
+ if (threaded) {
+ m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCThreadedTest"));
+ WebCompositor::initialize(m_webThread.get());
+ } else
+ WebCompositor::initialize(0);
+
+ ASSERT(CCProxy::isMainThread());
+ m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
+
+ m_beginTask = new BeginTask(this);
+ WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task
+ m_timeoutTask = new TimeoutTask(this);
+ WebKit::Platform::current()->currentThread()->postDelayedTask(m_timeoutTask, 5000);
+ WebKit::Platform::current()->currentThread()->enterRunLoop();
+
+ if (m_layerTreeHost && m_layerTreeHost->rootLayer())
+ m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
+ m_layerTreeHost.clear();
+
+ if (m_timeoutTask)
+ m_timeoutTask->clearTest();
+
+ if (m_endTestTask)
+ m_endTestTask->clearTest();
+
+ ASSERT_FALSE(m_layerTreeHost.get());
+ m_client.clear();
+ if (m_timedOut) {
+ FAIL() << "Test timed out";
+ WebCompositor::shutdown();
+ return;
+ }
+ afterTest();
+ WebCompositor::shutdown();
+}
+
+} // namespace WebKitTests
diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.h b/Source/WebKit/chromium/tests/CCThreadedTest.h
new file mode 100644
index 000000000..c0ca44fee
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCThreadedTest.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CCThreadedTest_h
+#define CCThreadedTest_h
+
+#include "CompositorFakeWebGraphicsContext3D.h"
+#include "cc/CCLayerAnimationDelegate.h"
+#include "cc/CCLayerTreeHost.h"
+#include "cc/CCLayerTreeHostImpl.h"
+#include "cc/CCScopedThreadProxy.h"
+#include <gtest/gtest.h>
+
+namespace WebCore {
+class CCLayerImpl;
+class CCLayerTreeHost;
+class CCLayerTreeHostClient;
+class CCLayerTreeHostImpl;
+class GraphicsContext3D;
+}
+
+namespace WebKit {
+class WebThread;
+}
+
+namespace WebKitTests {
+
+// Used by test stubs to notify the test when something interesting happens.
+class TestHooks : public WebCore::CCLayerAnimationDelegate {
+public:
+ virtual void beginCommitOnCCThread(WebCore::CCLayerTreeHostImpl*) { }
+ virtual void commitCompleteOnCCThread(WebCore::CCLayerTreeHostImpl*) { }
+ virtual bool prepareToDrawOnCCThread(WebCore::CCLayerTreeHostImpl*) { return true; }
+ virtual void drawLayersOnCCThread(WebCore::CCLayerTreeHostImpl*) { }
+ virtual void animateLayers(WebCore::CCLayerTreeHostImpl*, double monotonicTime) { }
+ virtual void willAnimateLayers(WebCore::CCLayerTreeHostImpl*, double monotonicTime) { }
+ virtual void applyScrollAndScale(const WebCore::IntSize&, float) { }
+ virtual void updateAnimations(double monotonicTime) { }
+ virtual void layout() { }
+ virtual void didRecreateContext(bool succeeded) { }
+ virtual void didAddAnimation() { }
+ virtual void didCommit() { }
+ virtual void didCommitAndDrawFrame() { }
+ virtual void scheduleComposite() { }
+
+ // Implementation of CCLayerAnimationDelegate
+ virtual void notifyAnimationStarted(double time) { }
+ virtual void notifyAnimationFinished(double time) { }
+
+ virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
+};
+
+class TimeoutTask;
+class BeginTask;
+class EndTestTask;
+
+class MockCCLayerTreeHostClient : public WebCore::CCLayerTreeHostClient {
+};
+
+// The CCThreadedTests runs with the main loop running. It instantiates a single MockLayerTreeHost and associated
+// MockLayerTreeHostImpl/MockLayerTreeHostClient.
+//
+// beginTest() is called once the main message loop is running and the layer tree host is initialized.
+//
+// Key stages of the drawing loop, e.g. drawing or commiting, redirect to CCThreadedTest methods of similar names.
+// To track the commit process, override these functions.
+//
+// The test continues until someone calls endTest. endTest can be called on any thread, but be aware that
+// ending the test is an asynchronous process.
+class CCThreadedTest : public testing::Test, public TestHooks {
+public:
+ virtual void afterTest() = 0;
+ virtual void beginTest() = 0;
+
+ void endTest();
+ void endTestAfterDelay(int delayMilliseconds);
+
+ void postSetNeedsAnimateToMainThread();
+ void postAddAnimationToMainThread();
+ void postAddInstantAnimationToMainThread();
+ void postSetNeedsCommitToMainThread();
+ void postAcquireLayerTextures();
+ void postSetNeedsRedrawToMainThread();
+ void postSetNeedsAnimateAndCommitToMainThread();
+ void postSetVisibleToMainThread(bool visible);
+ void postDidAddAnimationToMainThread();
+
+ void doBeginTest();
+ void timeout();
+
+ void clearTimeout() { m_timeoutTask = 0; }
+ void clearEndTestTask() { m_endTestTask = 0; }
+
+ WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); }
+
+protected:
+ CCThreadedTest();
+
+ virtual void scheduleComposite();
+
+ static void onEndTest(void* self);
+
+ static void dispatchSetNeedsAnimate(void* self);
+ static void dispatchAddInstantAnimation(void* self);
+ static void dispatchAddAnimation(void* self);
+ static void dispatchSetNeedsAnimateAndCommit(void* self);
+ static void dispatchSetNeedsCommit(void* self);
+ static void dispatchAcquireLayerTextures(void* self);
+ static void dispatchSetNeedsRedraw(void* self);
+ static void dispatchSetVisible(void* self);
+ static void dispatchSetInvisible(void* self);
+ static void dispatchComposite(void* self);
+ static void dispatchDidAddAnimation(void* self);
+
+ virtual void runTest(bool threaded);
+
+ WebCore::CCLayerTreeSettings m_settings;
+ OwnPtr<MockCCLayerTreeHostClient> m_client;
+ OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
+
+private:
+ bool m_beginning;
+ bool m_endWhenBeginReturns;
+ bool m_timedOut;
+ bool m_finished;
+ bool m_scheduled;
+ bool m_started;
+
+ OwnPtr<WebKit::WebThread> m_webThread;
+ RefPtr<WebCore::CCScopedThreadProxy> m_mainThreadProxy;
+ TimeoutTask* m_timeoutTask;
+ BeginTask* m_beginTask;
+ EndTestTask* m_endTestTask;
+};
+
+class CCThreadedTestThreadOnly : public CCThreadedTest {
+public:
+ void runTestThreaded()
+ {
+ CCThreadedTest::runTest(true);
+ }
+};
+
+// Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
+class MockLayerTreeHostImpl : public WebCore::CCLayerTreeHostImpl {
+public:
+ static PassOwnPtr<MockLayerTreeHostImpl> create(TestHooks*, const WebCore::CCLayerTreeSettings&, WebCore::CCLayerTreeHostImplClient*);
+
+ virtual void beginCommit();
+ virtual void commitComplete();
+ virtual bool prepareToDraw(FrameData&);
+ virtual void drawLayers(const FrameData&);
+
+ // Make these public.
+ typedef Vector<WebCore::CCLayerImpl*> CCLayerList;
+ using CCLayerTreeHostImpl::calculateRenderSurfaceLayerList;
+
+protected:
+ virtual void animateLayers(double monotonicTime, double wallClockTime);
+ virtual double lowFrequencyAnimationInterval() const;
+
+private:
+ MockLayerTreeHostImpl(TestHooks*, const WebCore::CCLayerTreeSettings&, WebCore::CCLayerTreeHostImplClient*);
+
+ TestHooks* m_testHooks;
+};
+
+class CompositorFakeWebGraphicsContext3DWithTextureTracking : public WebKit::CompositorFakeWebGraphicsContext3D {
+public:
+ static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithTextureTracking> create(Attributes);
+
+ virtual WebKit::WebGLId createTexture();
+
+ virtual void deleteTexture(WebKit::WebGLId texture);
+
+ virtual void bindTexture(WebKit::WGC3Denum target, WebKit::WebGLId texture);
+
+ int numTextures() const;
+ int texture(int texture) const;
+ void resetTextures();
+
+ int numUsedTextures() const;
+ bool usedTexture(int texture) const;
+ void resetUsedTextures();
+
+private:
+ explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs);
+
+ Vector<WebKit::WebGLId> m_textures;
+ HashSet<WebKit::WebGLId, DefaultHash<WebKit::WebGLId>::Hash, WTF::UnsignedWithZeroKeyHashTraits<WebKit::WebGLId> > m_usedTextures;
+};
+
+} // namespace WebKitTests
+
+#define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
+ TEST_F(TEST_FIXTURE_NAME, runSingleThread) \
+ { \
+ runTest(false); \
+ } \
+ TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
+ { \
+ runTest(true); \
+ }
+
+#endif // CCThreadedTest_h
diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
index 46d11a96e..7484b70f3 100644
--- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
+++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
@@ -40,7 +40,7 @@ FakeLayerTextureUpdater::Texture::~Texture()
{
}
-void FakeLayerTextureUpdater::Texture::updateRect(GraphicsContext3D*, TextureAllocator* allocator, const IntRect&, const IntRect&)
+void FakeLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect&, const IntRect&)
{
if (allocator)
texture()->allocate(allocator);
@@ -63,7 +63,7 @@ FakeLayerTextureUpdater::~FakeLayerTextureUpdater()
{
}
-void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect& resultingOpaqueRect)
+void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, float, IntRect& resultingOpaqueRect)
{
m_prepareCount++;
m_lastUpdateRect = contentRect;
diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
index 4eb875b1e..68fef6420 100644
--- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
+++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
@@ -25,7 +25,6 @@
#ifndef CCTiledLayerTestCommon_h
#define CCTiledLayerTestCommon_h
-#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "IntSize.h"
#include "LayerTextureUpdater.h"
@@ -34,6 +33,7 @@
#include "TextureManager.h"
#include "TextureUploader.h"
#include "TiledLayerChromium.h"
+#include "cc/CCGraphicsContext.h"
#include "cc/CCTextureUpdater.h"
#include "cc/CCTiledLayerImpl.h"
@@ -48,8 +48,8 @@ public:
Texture(FakeLayerTextureUpdater*, PassOwnPtr<WebCore::ManagedTexture>);
virtual ~Texture();
- virtual void updateRect(WebCore::GraphicsContext3D*, WebCore::TextureAllocator* , const WebCore::IntRect&, const WebCore::IntRect&);
- virtual void prepareRect(const WebCore::IntRect&);
+ virtual void updateRect(WebCore::CCGraphicsContext*, WebCore::TextureAllocator* , const WebCore::IntRect&, const WebCore::IntRect&) OVERRIDE;
+ virtual void prepareRect(const WebCore::IntRect&) OVERRIDE;
private:
FakeLayerTextureUpdater* m_layer;
@@ -58,10 +58,10 @@ public:
FakeLayerTextureUpdater();
virtual ~FakeLayerTextureUpdater();
- virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::TextureManager*);
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }
+ virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::TextureManager*) OVERRIDE;
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE { return SampledTexelFormatRGBA; }
- virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, int, float, WebCore::IntRect& resultingOpaqueRect);
+ virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, float, WebCore::IntRect& resultingOpaqueRect) OVERRIDE;
// Sets the rect to invalidate during the next call to prepareToUpdate(). After the next
// call to prepareToUpdate() the rect is reset.
void setRectToInvalidate(const WebCore::IntRect&, FakeTiledLayerChromium*);
@@ -156,7 +156,8 @@ public:
class FakeTextureCopier : public WebCore::TextureCopier {
public:
- virtual void copyTexture(WebCore::GraphicsContext3D*, unsigned, unsigned, const WebCore::IntSize&) { }
+ virtual void copyTexture(WebCore::CCGraphicsContext*, unsigned, unsigned, const WebCore::IntSize&) { }
+ virtual void copyToTexture(WebCore::CCGraphicsContext*, const void*, unsigned, const WebCore::IntSize&, GC3Denum) { }
};
class FakeTextureUploader : public WebCore::TextureUploader {
@@ -164,7 +165,7 @@ public:
virtual bool isBusy() { return false; }
virtual void beginUploads() { }
virtual void endUploads() { }
- virtual void uploadTexture(WebCore::GraphicsContext3D* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
+ virtual void uploadTexture(WebCore::CCGraphicsContext* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
};
}
diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp
new file mode 100644
index 000000000..bacf873fc
--- /dev/null
+++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "Canvas2DLayerBridge.h"
+
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
+#include "ImageBuffer.h"
+#include "LayerChromium.h"
+#include "TextureManager.h"
+#include "WebCompositor.h"
+#include "WebKit.h"
+#include "cc/CCGraphicsContext.h"
+#include "cc/CCTextureUpdater.h"
+#include "platform/WebKitPlatformSupport.h"
+#include "platform/WebThread.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <wtf/RefPtr.h>
+
+using namespace WebCore;
+using namespace WebKit;
+using testing::InSequence;
+using testing::Return;
+using testing::Test;
+
+namespace {
+
+class MockCanvasContext : public FakeWebGraphicsContext3D {
+public:
+ MOCK_METHOD0(flush, void(void));
+ MOCK_METHOD0(createTexture, unsigned(void));
+ MOCK_METHOD1(deleteTexture, void(unsigned));
+
+ virtual GrGLInterface* onCreateGrGLInterface() OVERRIDE { return 0; }
+};
+
+class MockWebTextureUpdater : public WebTextureUpdater {
+public:
+ MOCK_METHOD3(appendCopy, void(unsigned, unsigned, WebSize));
+};
+
+} // namespace
+
+enum ThreadMode {
+ SingleThreaded, Threaded
+};
+
+class Canvas2DLayerBridgeTest : public Test {
+protected:
+ void fullLifecycleTest(ThreadMode threadMode, DeferralMode deferralMode)
+ {
+ GraphicsContext3D::Attributes attrs;
+
+ RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<CCGraphicsContext> ccMainContext = CCGraphicsContext::create3D(mainContext);
+ RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(implContext);
+
+ MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
+ MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
+
+ MockWebTextureUpdater updater;
+
+ const IntSize size(300, 150);
+
+ OwnPtr<WebThread> thread;
+ if (threadMode == Threaded)
+ thread = adoptPtr(WebKit::Platform::current()->createThread("Canvas2DLayerBridgeTest"));
+ WebCompositor::initialize(thread.get());
+
+ WebGLId backTextureId = 1;
+ WebGLId frontTextureId = 1;
+
+ // Threaded and non deferred canvases are double buffered.
+ if (threadMode == Threaded && deferralMode == NonDeferred) {
+ frontTextureId = 2;
+ // Create texture (on the main thread) and do the copy (on the impl thread).
+ EXPECT_CALL(mainMock, createTexture()).WillOnce(Return(frontTextureId));
+ }
+
+ OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainContext.get(), size, deferralMode, backTextureId);
+
+ ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+
+ EXPECT_CALL(mainMock, flush());
+ if (threadMode == Threaded && deferralMode == NonDeferred)
+ EXPECT_CALL(updater, appendCopy(backTextureId, frontTextureId, WebSize(300, 150)));
+ EXPECT_EQ(frontTextureId, bridge->prepareTexture(updater));
+ ::testing::Mock::VerifyAndClearExpectations(&mainMock);
+ ::testing::Mock::VerifyAndClearExpectations(&updater);
+
+ if (threadMode == Threaded && deferralMode == NonDeferred) {
+ EXPECT_CALL(mainMock, deleteTexture(frontTextureId));
+ EXPECT_CALL(mainMock, flush());
+ }
+ bridge.clear();
+ ::testing::Mock::VerifyAndClearExpectations(&implMock);
+
+ WebCompositor::shutdown();
+ }
+};
+
+namespace {
+
+TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleSingleThreadedDeferred)
+{
+ fullLifecycleTest(SingleThreaded, NonDeferred);
+}
+
+TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleSingleThreadedNonDeferred)
+{
+ fullLifecycleTest(SingleThreaded, Deferred);
+}
+
+TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleThreadedNonDeferred)
+{
+ fullLifecycleTest(Threaded, NonDeferred);
+}
+
+TEST_F(Canvas2DLayerBridgeTest, testFullLifecycleThreadedDeferred)
+{
+ fullLifecycleTest(Threaded, Deferred);
+}
+
+TEST(Canvas2DLayerBridgeTest2, testClearClient)
+{
+ GraphicsContext3D::Attributes attrs;
+
+ RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainContext.get(), IntSize(100, 100), Deferred, 1);
+ RefPtr<LayerChromium> layer = bridge->layer();
+ bridge.clear();
+ CCTextureUpdater updater;
+ layer->update(updater, 0);
+}
+
+} // namespace
+
diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
deleted file mode 100644
index b42485b71..000000000
--- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "Canvas2DLayerChromium.h"
-
-#include "CCSchedulerTestCommon.h"
-#include "FakeCCLayerTreeHostClient.h"
-#include "FakeWebGraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
-#include "Region.h"
-#include "TextureCopier.h"
-#include "TextureManager.h"
-#include "WebCompositor.h"
-#include "WebKit.h"
-#include "cc/CCSingleThreadProxy.h"
-#include "cc/CCTextureLayerImpl.h"
-#include "cc/CCTextureUpdater.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebThread.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <wtf/RefPtr.h>
-
-using namespace WebCore;
-using namespace WebKit;
-using namespace WebKitTests;
-using testing::InSequence;
-using testing::Return;
-using testing::Test;
-
-namespace {
-
-class FakeCCLayerTreeHost : public CCLayerTreeHost {
-public:
- static PassOwnPtr<FakeCCLayerTreeHost> create()
- {
- OwnPtr<FakeCCLayerTreeHost> host(adoptPtr(new FakeCCLayerTreeHost));
- host->initialize();
- return host.release();
- }
-
-private:
- FakeCCLayerTreeHost()
- : CCLayerTreeHost(&m_client, CCSettings())
- {
- }
-
- FakeCCLayerTreeHostClient m_client;
-};
-
-class MockCanvasContext : public FakeWebGraphicsContext3D {
-public:
- MOCK_METHOD0(flush, void(void));
-};
-
-class MockTextureAllocator : public TextureAllocator {
-public:
- MOCK_METHOD2(createTexture, unsigned(const IntSize&, GC3Denum));
- MOCK_METHOD3(deleteTexture, void(unsigned, const IntSize&, GC3Denum));
-};
-
-class MockTextureCopier : public TextureCopier {
-public:
- MOCK_METHOD4(copyTexture, void(GraphicsContext3D*, unsigned, unsigned, const IntSize&));
-};
-
-class MockTextureUploader : public TextureUploader {
-public:
- MOCK_METHOD0(isBusy, bool());
- MOCK_METHOD0(beginUploads, void());
- MOCK_METHOD0(endUploads, void());
- MOCK_METHOD5(uploadTexture, void(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect));
-};
-
-} // namespace
-
-class Canvas2DLayerChromiumTest : public Test {
-protected:
- void fullLifecycleTest(bool threaded, bool deferred)
- {
- GraphicsContext3D::Attributes attrs;
-
- RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
-
- MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
- MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
-
- MockTextureAllocator allocatorMock;
- MockTextureCopier copierMock;
- MockTextureUploader uploaderMock;
- CCTextureUpdater updater;
-
- const IntSize size(300, 150);
-
- OwnPtr<WebThread> thread;
- if (threaded)
- thread = adoptPtr(WebKit::Platform::current()->createThread("Canvas2DLayerChromiumTest"));
- WebCompositor::initialize(thread.get());
-
- OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
- // Force an update, so that we get a valid TextureManager.
- layerTreeHost->updateLayers(updater);
-
- const WebGLId backTextureId = 1;
- const WebGLId frontTextureId = 2;
- {
- InSequence sequence;
-
- // Paint canvas contents on the main thread.
- EXPECT_CALL(mainMock, flush());
-
- // Note that the canvas backing texture is doublebuffered only when using the threaded
- // compositor and not using deferred canvas rendering
- if (threaded && !deferred) {
- // Create texture and do the copy (on the impl thread).
- EXPECT_CALL(allocatorMock, createTexture(size, GraphicsContext3D::RGBA))
- .WillOnce(Return(frontTextureId));
- EXPECT_CALL(copierMock, copyTexture(implContext.get(), backTextureId, frontTextureId, size));
- EXPECT_CALL(implMock, flush());
-
- // Teardown TextureManager.
- EXPECT_CALL(allocatorMock, deleteTexture(frontTextureId, size, GraphicsContext3D::RGBA));
- }
- }
-
- RefPtr<Canvas2DLayerChromium> canvas = Canvas2DLayerChromium::create(mainContext.get(), size, deferred ? Deferred : NonDeferred);
- canvas->setIsDrawable(true);
- canvas->setLayerTreeHost(layerTreeHost.get());
- canvas->setBounds(IntSize(600, 300));
- canvas->setTextureId(backTextureId);
-
- canvas->setNeedsDisplay();
- EXPECT_TRUE(canvas->needsDisplay());
- canvas->update(updater, 0);
- EXPECT_FALSE(canvas->needsDisplay());
- {
- DebugScopedSetImplThread scopedImplThread;
-
- OwnPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl();
- EXPECT_EQ(0u, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
-
- updater.update(implContext.get(), &allocatorMock, &copierMock, &uploaderMock, 1);
- canvas->pushPropertiesTo(layerImpl.get());
-
- if (threaded && !deferred)
- EXPECT_EQ(frontTextureId, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
- else
- EXPECT_EQ(backTextureId, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
- }
- canvas.clear();
- layerTreeHost->contentsTextureManager()->reduceMemoryToLimit(0);
- layerTreeHost->contentsTextureManager()->deleteEvictedTextures(&allocatorMock);
- layerTreeHost.clear();
- WebCompositor::shutdown();
- }
-};
-
-namespace {
-
-TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleSingleThread)
-{
- fullLifecycleTest(false, false);
-}
-
-TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleThreaded)
-{
- fullLifecycleTest(true, false);
-}
-
-TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleSingleThreadDeferred)
-{
- fullLifecycleTest(false, true);
-}
-
-TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleThreadedDeferred)
-{
- fullLifecycleTest(true, true);
-}
-
-} // namespace
diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp
index 18457fdf4..db80f5bfe 100644
--- a/Source/WebKit/chromium/tests/DecimalTest.cpp
+++ b/Source/WebKit/chromium/tests/DecimalTest.cpp
@@ -556,6 +556,32 @@ TEST_F(DecimalTest, FloorSpecialValues)
EXPECT_EQ(Decimal::nan(), Decimal::nan().floor());
}
+TEST_F(DecimalTest, FromDouble)
+{
+ EXPECT_EQ(encode(0, 0, Positive), Decimal::fromDouble(0.0));
+ EXPECT_EQ(encode(0, 0, Negative), Decimal::fromDouble(-0.0));
+ EXPECT_EQ(encode(1, 0, Positive), Decimal::fromDouble(1));
+ EXPECT_EQ(encode(1, 0, Negative), Decimal::fromDouble(-1));
+ EXPECT_EQ(encode(123, 0, Positive), Decimal::fromDouble(123));
+ EXPECT_EQ(encode(123, 0, Negative), Decimal::fromDouble(-123));
+ EXPECT_EQ(encode(1, -1, Positive), Decimal::fromDouble(0.1));
+ EXPECT_EQ(encode(1, -1, Negative), Decimal::fromDouble(-0.1));
+}
+
+TEST_F(DecimalTest, FromDoubleLimits)
+{
+ EXPECT_EQ(encode(UINT64_C(2220446049250313), -31, Positive), Decimal::fromDouble(std::numeric_limits<double>::epsilon()));
+ EXPECT_EQ(encode(UINT64_C(2220446049250313), -31, Negative), Decimal::fromDouble(-std::numeric_limits<double>::epsilon()));
+ EXPECT_EQ(encode(UINT64_C(17976931348623157), 292, Positive), Decimal::fromDouble(std::numeric_limits<double>::max()));
+ EXPECT_EQ(encode(UINT64_C(17976931348623157), 292, Negative), Decimal::fromDouble(-std::numeric_limits<double>::max()));
+ EXPECT_EQ(encode(UINT64_C(22250738585072014), -324, Positive), Decimal::fromDouble(std::numeric_limits<double>::min()));
+ EXPECT_EQ(encode(UINT64_C(22250738585072014), -324, Negative), Decimal::fromDouble(-std::numeric_limits<double>::min()));
+ EXPECT_TRUE(Decimal::fromDouble(std::numeric_limits<double>::infinity()).isInfinity());
+ EXPECT_TRUE(Decimal::fromDouble(-std::numeric_limits<double>::infinity()).isInfinity());
+ EXPECT_TRUE(Decimal::fromDouble(std::numeric_limits<double>::quiet_NaN()).isNaN());
+ EXPECT_TRUE(Decimal::fromDouble(-std::numeric_limits<double>::quiet_NaN()).isNaN());
+}
+
TEST_F(DecimalTest, FromInt32)
{
EXPECT_EQ(encode(0, 0, Positive), Decimal(0));
@@ -750,24 +776,32 @@ TEST_F(DecimalTest, NegateSpecialValues)
TEST_F(DecimalTest, Predicates)
{
EXPECT_TRUE(Decimal::zero(Positive).isFinite());
+ EXPECT_FALSE(Decimal::zero(Positive).isInfinity());
+ EXPECT_FALSE(Decimal::zero(Positive).isNaN());
EXPECT_TRUE(Decimal::zero(Positive).isPositive());
EXPECT_FALSE(Decimal::zero(Positive).isNegative());
EXPECT_FALSE(Decimal::zero(Positive).isSpecial());
EXPECT_TRUE(Decimal::zero(Positive).isZero());
EXPECT_TRUE(Decimal::zero(Negative).isFinite());
+ EXPECT_FALSE(Decimal::zero(Negative).isInfinity());
+ EXPECT_FALSE(Decimal::zero(Negative).isNaN());
EXPECT_FALSE(Decimal::zero(Negative).isPositive());
EXPECT_TRUE(Decimal::zero(Negative).isNegative());
EXPECT_FALSE(Decimal::zero(Negative).isSpecial());
EXPECT_TRUE(Decimal::zero(Negative).isZero());
EXPECT_TRUE(Decimal(123).isFinite());
+ EXPECT_FALSE(Decimal(123).isInfinity());
+ EXPECT_FALSE(Decimal(123).isNaN());
EXPECT_TRUE(Decimal(123).isPositive());
EXPECT_FALSE(Decimal(123).isNegative());
EXPECT_FALSE(Decimal(123).isSpecial());
EXPECT_FALSE(Decimal(123).isZero());
EXPECT_TRUE(Decimal(-123).isFinite());
+ EXPECT_FALSE(Decimal(-123).isInfinity());
+ EXPECT_FALSE(Decimal(-123).isNaN());
EXPECT_FALSE(Decimal(-123).isPositive());
EXPECT_TRUE(Decimal(-123).isNegative());
EXPECT_FALSE(Decimal(-123).isSpecial());
@@ -777,18 +811,24 @@ TEST_F(DecimalTest, Predicates)
TEST_F(DecimalTest, PredicatesSpecialValues)
{
EXPECT_FALSE(Decimal::infinity(Positive).isFinite());
+ EXPECT_TRUE(Decimal::infinity(Positive).isInfinity());
+ EXPECT_FALSE(Decimal::infinity(Positive).isNaN());
EXPECT_TRUE(Decimal::infinity(Positive).isPositive());
EXPECT_FALSE(Decimal::infinity(Positive).isNegative());
EXPECT_TRUE(Decimal::infinity(Positive).isSpecial());
EXPECT_FALSE(Decimal::infinity(Positive).isZero());
EXPECT_FALSE(Decimal::infinity(Negative).isFinite());
+ EXPECT_TRUE(Decimal::infinity(Negative).isInfinity());
+ EXPECT_FALSE(Decimal::infinity(Negative).isNaN());
EXPECT_FALSE(Decimal::infinity(Negative).isPositive());
EXPECT_TRUE(Decimal::infinity(Negative).isNegative());
EXPECT_TRUE(Decimal::infinity(Negative).isSpecial());
EXPECT_FALSE(Decimal::infinity(Negative).isZero());
EXPECT_FALSE(Decimal::nan().isFinite());
+ EXPECT_FALSE(Decimal::nan().isInfinity());
+ EXPECT_TRUE(Decimal::nan().isNaN());
EXPECT_TRUE(Decimal::nan().isSpecial());
EXPECT_FALSE(Decimal::nan().isZero());
}
@@ -940,6 +980,42 @@ TEST_F(DecimalTest, SubtractSpecialValues)
EXPECT_EQ(NaN, MinusInfinity - NaN);
}
+TEST_F(DecimalTest, ToDouble)
+{
+ EXPECT_EQ(0.0, encode(0, 0, Positive).toDouble());
+ EXPECT_EQ(-0.0, encode(0, 0, Negative).toDouble());
+
+ EXPECT_EQ(1.0, encode(1, 0, Positive).toDouble());
+ EXPECT_EQ(-1.0, encode(1, 0, Negative).toDouble());
+
+ EXPECT_EQ(0.1, encode(1, -1, Positive).toDouble());
+ EXPECT_EQ(-0.1, encode(1, -1, Negative).toDouble());
+ EXPECT_EQ(0.3, encode(3, -1, Positive).toDouble());
+ EXPECT_EQ(-0.3, encode(3, -1, Negative).toDouble());
+ EXPECT_EQ(0.6, encode(6, -1, Positive).toDouble());
+ EXPECT_EQ(-0.6, encode(6, -1, Negative).toDouble());
+ EXPECT_EQ(0.7, encode(7, -1, Positive).toDouble());
+ EXPECT_EQ(-0.7, encode(7, -1, Negative).toDouble());
+
+ EXPECT_EQ(0.01, encode(1, -2, Positive).toDouble());
+ EXPECT_EQ(0.001, encode(1, -3, Positive).toDouble());
+ EXPECT_EQ(0.0001, encode(1, -4, Positive).toDouble());
+ EXPECT_EQ(0.00001, encode(1, -5, Positive).toDouble());
+
+ EXPECT_EQ(1e+308, encode(1, 308, Positive).toDouble());
+ EXPECT_EQ(1e-307, encode(1, -307, Positive).toDouble());
+
+ EXPECT_TRUE(isinf(encode(1, 1000, Positive).toDouble()));
+ EXPECT_EQ(0.0, encode(1, -1000, Positive).toDouble());
+}
+
+TEST_F(DecimalTest, ToDoubleSpecialValues)
+{
+ EXPECT_TRUE(isinf(Decimal::infinity(Decimal::Positive).toDouble()));
+ EXPECT_TRUE(isinf(Decimal::infinity(Decimal::Negative).toDouble()));
+ EXPECT_TRUE(isnan(Decimal::nan().toDouble()));
+}
+
TEST_F(DecimalTest, ToString)
{
EXPECT_EQ(String("0"), Decimal::zero(Positive).toString());
diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
index 992509c4f..6ab616d3c 100755
--- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
+++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
@@ -39,7 +39,7 @@ public:
virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { }
virtual void layout() OVERRIDE { }
virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
- virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
+ virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
{
GraphicsContext3D::Attributes attrs;
return createCompositorMockGraphicsContext3D(attrs);
diff --git a/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp
index 8fc9e42b2..12ca68418 100644
--- a/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp
+++ b/Source/WebKit/chromium/tests/FrameLoaderClientImplTest.cpp
@@ -46,13 +46,12 @@ namespace {
class TestWebFrameClient : public WebFrameClient {
public:
- bool userAgent(const WebURL& url, WebString* userAgent) OVERRIDE
+ WebString userAgentOverride(WebFrame* frame, const WebURL& url) OVERRIDE
{
if (m_userAgentOverride.isEmpty())
- return false;
+ return WebString();
- *userAgent = m_userAgentOverride;
- return true;
+ return m_userAgentOverride;
}
void setUserAgentOverride(const WebString& userAgent)
diff --git a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
index b7aa85746..4fdcf4f41 100644
--- a/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
@@ -27,56 +27,372 @@
#include "GraphicsLayerChromium.h"
#include "CCAnimationTestCommon.h"
+#include "CompositorFakeGraphicsContext3D.h"
+#include "GraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
#include "GraphicsLayer.h"
#include "LayerChromium.h"
+#include "Matrix3DTransformOperation.h"
+#include "RotateTransformOperation.h"
+#include "TranslateTransformOperation.h"
+#include "WebCompositor.h"
+
+#include "cc/CCLayerTreeHost.h"
+#include "cc/CCLayerTreeHostImpl.h"
+#include "cc/CCSingleThreadProxy.h"
+
#include <gtest/gtest.h>
#include <wtf/PassOwnPtr.h>
using namespace WebCore;
+using namespace WebKit;
using namespace WebKitTests;
namespace {
class MockGraphicsLayerClient : public GraphicsLayerClient {
public:
- virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { }
- virtual void notifySyncRequired(const GraphicsLayer*) { }
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) { }
- virtual bool showDebugBorders(const GraphicsLayer*) const { return false; }
- virtual bool showRepaintCounter(const GraphicsLayer*) const { return false; }
+ virtual void notifyAnimationStarted(const GraphicsLayer*, double time) OVERRIDE { }
+ virtual void notifySyncRequired(const GraphicsLayer*) OVERRIDE { }
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) OVERRIDE { }
+ virtual bool showDebugBorders(const GraphicsLayer*) const OVERRIDE { return false; }
+ virtual bool showRepaintCounter(const GraphicsLayer*) const OVERRIDE { return false; }
};
-TEST(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations)
-{
- MockGraphicsLayerClient client;
- OwnPtr<GraphicsLayerChromium> graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&client));
- ASSERT_TRUE(graphicsLayer.get());
+class MockLayerTreeHostClient : public CCLayerTreeHostClient {
+public:
+ virtual void willBeginFrame() OVERRIDE { }
+ virtual void didBeginFrame() OVERRIDE { }
+ virtual void updateAnimations(double frameBeginTime) OVERRIDE { }
+ virtual void layout() OVERRIDE { }
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
+ virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
+ {
+ GraphicsContext3D::Attributes attrs;
+ return createCompositorMockGraphicsContext3D(attrs);
+ }
+ virtual void didRecreateContext(bool success) OVERRIDE { }
+ virtual void willCommit() OVERRIDE { }
+ virtual void didCommit() OVERRIDE { }
+ virtual void didCommitAndDrawFrame() OVERRIDE { }
+ virtual void didCompleteSwapBuffers() OVERRIDE { }
+ virtual void scheduleComposite() OVERRIDE { }
+};
+
+class MockLayerTreeHost : public CCLayerTreeHost {
+public:
+ static PassOwnPtr<MockLayerTreeHost> create()
+ {
+ CCLayerTreeSettings settings;
+ OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(new MockLayerTreeHostClient(), settings)));
+ bool success = layerTreeHost->initialize();
+ EXPECT_TRUE(success);
+ layerTreeHost->setRootLayer(LayerChromium::create());
+ layerTreeHost->setViewportSize(IntSize(1, 1));
+ return layerTreeHost.release();
+ }
+
+ virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient* client)
+ {
+ return CCLayerTreeHostImpl::create(settings(), client);
+ }
+
+private:
+ MockLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTreeSettings& settings)
+ : CCLayerTreeHost(client, settings)
+ {
+ }
+};
+
+class GraphicsLayerChromiumTest : public testing::Test {
+public:
+ GraphicsLayerChromiumTest()
+ {
+ // For these tests, we will enable threaded animations.
+ WebCompositor::setAcceleratedAnimationEnabled(true);
+ WebCompositor::initialize(0);
+ m_graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&m_client));
+ m_platformLayer = static_cast<LayerChromium*>(m_graphicsLayer->platformLayer());
+ m_layerTreeHost = MockLayerTreeHost::create();
+ m_platformLayer->setLayerTreeHost(m_layerTreeHost.get());
+ }
+
+ virtual ~GraphicsLayerChromiumTest()
+ {
+ m_graphicsLayer.clear();
+ m_layerTreeHost.clear();
+ WebCompositor::shutdown();
+ }
+
+protected:
+ static void expectTranslateX(double translateX, const WebTransformationMatrix& matrix)
+ {
+ EXPECT_FLOAT_EQ(translateX, matrix.m41());
+ }
+
+ LayerChromium* m_platformLayer;
+ OwnPtr<GraphicsLayerChromium> m_graphicsLayer;
+ OwnPtr<CCLayerTreeHost> m_layerTreeHost;
- LayerChromium* platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
- ASSERT_TRUE(platformLayer);
+private:
+ MockGraphicsLayerClient m_client;
+ DebugScopedSetMainThread m_main;
+};
- ASSERT_FALSE(platformLayer->hasActiveAnimation());
+TEST_F(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations)
+{
+ ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
OwnPtr<CCActiveAnimation> floatAnimation(CCActiveAnimation::create(adoptPtr(new FakeFloatAnimationCurve), 0, 1, CCActiveAnimation::Opacity));
- platformLayer->layerAnimationController()->add(floatAnimation.release());
+ m_platformLayer->layerAnimationController()->addAnimation(floatAnimation.release());
+
+ ASSERT_TRUE(m_platformLayer->hasActiveAnimation());
+
+ m_graphicsLayer->setPreserves3D(true);
+
+ m_platformLayer = static_cast<LayerChromium*>(m_graphicsLayer->platformLayer());
+ ASSERT_TRUE(m_platformLayer);
+
+ ASSERT_TRUE(m_platformLayer->hasActiveAnimation());
+ m_platformLayer->removeAnimation(0);
+ ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
+
+ m_graphicsLayer->setPreserves3D(false);
+
+ m_platformLayer = static_cast<LayerChromium*>(m_graphicsLayer->platformLayer());
+ ASSERT_TRUE(m_platformLayer);
+
+ ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
+}
+
+TEST_F(GraphicsLayerChromiumTest, createOpacityAnimation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
+ values.insert(new FloatAnimationValue(0, 0));
+ values.insert(new FloatAnimationValue(duration, 1));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ bool addedAnimation = m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_TRUE(addedAnimation);
+
+ EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+
+ CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Opacity);
+ EXPECT_TRUE(activeAnimation);
+
+ EXPECT_EQ(1, activeAnimation->iterations());
+ EXPECT_EQ(CCActiveAnimation::Opacity, activeAnimation->targetProperty());
+
+ EXPECT_EQ(CCAnimationCurve::Float, activeAnimation->curve()->type());
+
+ const CCFloatAnimationCurve* curve = activeAnimation->curve()->toFloatAnimationCurve();
+ EXPECT_TRUE(curve);
+
+ EXPECT_EQ(0, curve->getValue(0));
+ EXPECT_EQ(1, curve->getValue(duration));
+}
+
+TEST_F(GraphicsLayerChromiumTest, createTransformAnimation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+
+ CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform);
+ EXPECT_TRUE(activeAnimation);
+
+ EXPECT_EQ(1, activeAnimation->iterations());
+ EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
+
+ EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
+
+ const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
+ EXPECT_TRUE(curve);
+
+ expectTranslateX(2, curve->getValue(0));
+ expectTranslateX(4, curve->getValue(duration));
+}
+
+TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithBigRotation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(RotateTransformOperation::create(0, TransformOperation::ROTATE));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(RotateTransformOperation::create(270, TransformOperation::ROTATE));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_FALSE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+}
+
+TEST_F(GraphicsLayerChromiumTest, createTransformAnimationWithSingularMatrix)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformationMatrix matrix1;
+ TransformOperations operations1;
+ operations1.operations().append(Matrix3DTransformOperation::create(matrix1));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformationMatrix matrix2;
+ matrix2.setM11(0);
+ TransformOperations operations2;
+ operations2.operations().append(Matrix3DTransformOperation::create(matrix2));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_FALSE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+}
+
+TEST_F(GraphicsLayerChromiumTest, createReversedAnimation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+ animation->setDirection(Animation::AnimationDirectionReverse);
+
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+
+ CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform);
+ EXPECT_TRUE(activeAnimation);
+
+ EXPECT_EQ(1, activeAnimation->iterations());
+ EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
+
+ EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
+
+ const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
+ EXPECT_TRUE(curve);
+
+ expectTranslateX(4, curve->getValue(0));
+ expectTranslateX(2, curve->getValue(duration));
+}
+
+TEST_F(GraphicsLayerChromiumTest, createAlternatingAnimation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+ animation->setDirection(Animation::AnimationDirectionAlternate);
+ animation->setIterationCount(2);
+
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
+
+ EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
+
+ CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform);
+ EXPECT_TRUE(activeAnimation);
+ EXPECT_TRUE(activeAnimation->alternatesDirection());
+
+ EXPECT_EQ(2, activeAnimation->iterations());
+ EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
+
+ EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
+
+ const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
+ EXPECT_TRUE(curve);
+
+ expectTranslateX(2, curve->getValue(0));
+ expectTranslateX(4, curve->getValue(duration));
+}
+
+TEST_F(GraphicsLayerChromiumTest, createReversedAlternatingAnimation)
+{
+ const double duration = 1;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations1;
+ operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations1));
+
+ TransformOperations operations2;
+ operations2.operations().append(TranslateTransformOperation::create(Length(4, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(duration, &operations2));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+ animation->setDirection(Animation::AnimationDirectionAlternateReverse);
+ animation->setIterationCount(2);
- ASSERT_TRUE(platformLayer->hasActiveAnimation());
+ IntSize boxSize;
+ m_graphicsLayer->addAnimation(values, boxSize, animation.get(), "", 0);
- graphicsLayer->setPreserves3D(true);
+ EXPECT_TRUE(m_platformLayer->layerAnimationController()->hasActiveAnimation());
- platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
- ASSERT_TRUE(platformLayer);
+ CCActiveAnimation* activeAnimation = m_platformLayer->layerAnimationController()->getActiveAnimation(CCActiveAnimation::Transform);
+ EXPECT_TRUE(activeAnimation);
+ EXPECT_TRUE(activeAnimation->alternatesDirection());
- ASSERT_TRUE(platformLayer->hasActiveAnimation());
- platformLayer->removeAnimation(0);
- ASSERT_FALSE(platformLayer->hasActiveAnimation());
+ EXPECT_EQ(2, activeAnimation->iterations());
+ EXPECT_EQ(CCActiveAnimation::Transform, activeAnimation->targetProperty());
- graphicsLayer->setPreserves3D(false);
+ EXPECT_EQ(CCAnimationCurve::Transform, activeAnimation->curve()->type());
- platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
- ASSERT_TRUE(platformLayer);
+ const CCTransformAnimationCurve* curve = activeAnimation->curve()->toTransformAnimationCurve();
+ EXPECT_TRUE(curve);
- ASSERT_FALSE(platformLayer->hasActiveAnimation());
+ expectTranslateX(4, curve->getValue(0));
+ expectTranslateX(2, curve->getValue(duration));
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp
new file mode 100644
index 000000000..098a7327f
--- /dev/null
+++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBBackingStore.h"
+#include "IDBDatabaseBackendImpl.h"
+#include "IDBFactoryBackendImpl.h"
+#include "IDBFakeBackingStore.h"
+#include "IDBIndexBackendImpl.h"
+#include "IDBObjectStoreBackendImpl.h"
+#include "IDBTransactionCoordinator.h"
+
+#include <gtest/gtest.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+using namespace WebCore;
+
+namespace {
+
+TEST(IDBDatabaseBackendTest, BackingStoreRetention)
+{
+ RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore());
+ EXPECT_TRUE(backingStore->hasOneRef());
+
+ IDBTransactionCoordinator* coordinator = 0;
+ IDBFactoryBackendImpl* factory = 0;
+ RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid");
+ EXPECT_GT(backingStore->refCount(), 1);
+
+ const bool autoIncrement = false;
+ RefPtr<IDBObjectStoreBackendImpl> store = IDBObjectStoreBackendImpl::create(db.get(), "store", String("keyPath"), autoIncrement);
+ EXPECT_GT(backingStore->refCount(), 1);
+
+ const bool unique = false;
+ const bool multiEntry = false;
+ RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(db.get(), store.get(), "index", String("keyPath"), unique, multiEntry);
+ EXPECT_GT(backingStore->refCount(), 1);
+
+ db.clear();
+ EXPECT_TRUE(backingStore->hasOneRef());
+ store.clear();
+ EXPECT_TRUE(backingStore->hasOneRef());
+ index.clear();
+ EXPECT_TRUE(backingStore->hasOneRef());
+}
+
+} // namespace
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp
index 8f5b8ef01..9934e5c79 100644
--- a/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp
+++ b/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp
@@ -620,10 +620,17 @@ TEST(IDBLevelDBCodingTest, ComparisonTest)
keys.append(DatabaseNameKey::encode("a", "a"));
keys.append(DatabaseMetaDataKey::encode(1, DatabaseMetaDataKey::kOriginName));
keys.append(ObjectStoreMetaDataKey::encode(1, 1, 0));
+ keys.append(ObjectStoreMetaDataKey::encode(1, 1, 1));
+ keys.append(ObjectStoreMetaDataKey::encodeMaxKey(1, 1));
+ keys.append(ObjectStoreMetaDataKey::encodeMaxKey(1, 2));
keys.append(ObjectStoreMetaDataKey::encodeMaxKey(1));
keys.append(IndexMetaDataKey::encode(1, 1, 30, 0));
keys.append(IndexMetaDataKey::encode(1, 1, 31, 0));
keys.append(IndexMetaDataKey::encode(1, 1, 31, 1));
+ keys.append(IndexMetaDataKey::encodeMaxKey(1, 1, 31));
+ keys.append(IndexMetaDataKey::encodeMaxKey(1, 1, 32));
+ keys.append(IndexMetaDataKey::encodeMaxKey(1, 1));
+ keys.append(IndexMetaDataKey::encodeMaxKey(1, 2));
keys.append(ObjectStoreFreeListKey::encode(1, 1));
keys.append(ObjectStoreFreeListKey::encodeMaxKey(1));
keys.append(IndexFreeListKey::encode(1, 1, kMinimumIndexId));
diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
index 8213dd812..cd4fcc340 100644
--- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
@@ -57,7 +57,7 @@ namespace {
class MockCCLayerTreeHost : public CCLayerTreeHost {
public:
MockCCLayerTreeHost()
- : CCLayerTreeHost(&m_fakeClient, CCSettings())
+ : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings())
{
initialize();
}
@@ -70,7 +70,7 @@ private:
class MockLayerPainterChromium : public LayerPainterChromium {
public:
- virtual void paint(GraphicsContext&, const IntRect&) { }
+ virtual void paint(SkCanvas*, const IntRect&, IntRect&) { }
};
@@ -80,11 +80,13 @@ protected:
{
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
}
virtual void TearDown()
{
+ DebugScopedSetMainThread main;
Mock::VerifyAndClearExpectations(m_layerTreeHost.get());
EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber());
m_parent.clear();
@@ -614,7 +616,7 @@ public:
private:
FakeCCLayerTreeHost()
- : CCLayerTreeHost(&m_client, CCSettings())
+ : CCLayerTreeHost(&m_client, CCLayerTreeSettings())
{
}
@@ -639,6 +641,7 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost*
TEST(LayerChromiumLayerTreeHostTest, enteringTree)
{
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> child = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -671,6 +674,7 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree)
TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
{
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
RefPtr<LayerChromium> parent = LayerChromium::create();
OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
@@ -702,6 +706,7 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
TEST(LayerChromiumLayerTreeHostTest, changeHost)
{
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> child = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -735,6 +740,7 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost)
TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
{
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
RefPtr<LayerChromium> firstParent = LayerChromium::create();
RefPtr<LayerChromium> firstChild = LayerChromium::create();
RefPtr<LayerChromium> secondParent = LayerChromium::create();
@@ -772,6 +778,7 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
{
WebKit::WebCompositor::initialize(0);
+ DebugScopedSetMainThread main;
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
RefPtr<LayerChromium> replica = LayerChromium::create();
diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
index 4ed35986c..9269217c3 100644
--- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
@@ -25,9 +25,12 @@
#include "config.h"
#include "LayerRendererChromium.h"
+#include "CCTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
+#include "WebCompositor.h"
+#include "cc/CCSettings.h"
#include "cc/CCSingleThreadProxy.h"
#include <gmock/gmock.h>
@@ -35,6 +38,7 @@
using namespace WebCore;
using namespace WebKit;
+using namespace WebKitTests;
class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContext3D {
public:
@@ -54,44 +58,56 @@ public:
// Methods added for test.
int frameCount() { return m_frame; }
- void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) { m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation); }
+ void setMemoryAllocation(WebGraphicsMemoryAllocation allocation)
+ {
+ ASSERT(CCProxy::isImplThread());
+ // In single threaded mode we expect this callback on main thread.
+ DebugScopedSetMainThread main;
+ m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation);
+ }
private:
int m_frame;
WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChangedCallback;
};
-class FakeLayerRendererChromiumClient : public LayerRendererChromiumClient {
+class FakeCCRendererClient : public CCRendererClient {
public:
- FakeLayerRendererChromiumClient()
+ FakeCCRendererClient()
: m_setFullRootLayerDamageCount(0)
, m_rootLayer(CCLayerImpl::create(1))
+ , m_memoryAllocationLimitBytes(0)
{
m_rootLayer->createRenderSurface();
+ m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface());
}
- // LayerRendererChromiumClient methods.
+ // CCRendererClient methods.
virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize; return fakeSize; }
- virtual const CCSettings& settings() const OVERRIDE { static CCSettings fakeSettings; return fakeSettings; }
+ virtual const CCLayerTreeSettings& settings() const OVERRIDE { static CCLayerTreeSettings fakeSettings; return fakeSettings; }
virtual void didLoseContext() OVERRIDE { }
virtual void onSwapBuffersComplete() OVERRIDE { }
virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; }
- virtual void setContentsMemoryAllocationLimitBytes(size_t) OVERRIDE { }
+ virtual void setContentsMemoryAllocationLimitBytes(size_t bytes) OVERRIDE { m_memoryAllocationLimitBytes = bytes; }
// Methods added for test.
int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; }
- CCLayerImpl* rootLayer() { return m_rootLayer.get(); }
+ CCRenderPass* rootRenderPass() { return m_rootRenderPass.get(); }
+
+ size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
private:
int m_setFullRootLayerDamageCount;
DebugScopedSetImplThread m_implThread;
OwnPtr<CCLayerImpl> m_rootLayer;
+ OwnPtr<CCRenderPass> m_rootRenderPass;
+ size_t m_memoryAllocationLimitBytes;
};
class FakeLayerRendererChromium : public LayerRendererChromium {
public:
- FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
+ FakeLayerRendererChromium(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
// LayerRendererChromium methods.
@@ -113,9 +129,15 @@ protected:
virtual void SetUp()
{
+ WebKit::WebCompositor::initialize(0);
m_layerRendererChromium.initialize();
}
+ virtual void TearDown()
+ {
+ WebKit::WebCompositor::shutdown();
+ }
+
void swapBuffers()
{
m_layerRendererChromium.swapBuffers(IntRect());
@@ -126,8 +148,9 @@ protected:
RefPtr<GraphicsContext3D> m_context;
FrameCountingMemoryAllocationSettingContext& m_mockContext;
- FakeLayerRendererChromiumClient m_mockClient;
+ FakeCCRendererClient m_mockClient;
FakeLayerRendererChromium m_layerRendererChromium;
+ CCScopedSettings m_scopedSettings;
};
// Test LayerRendererChromium discardFramebuffer functionality:
@@ -179,7 +202,7 @@ TEST_F(LayerRendererChromiumTest, SwapBuffersWhileBackbufferDiscardedShouldIgnor
swapBuffers();
EXPECT_EQ(0, m_mockContext.frameCount());
EXPECT_EQ(2, m_mockClient.setFullRootLayerDamageCount());
-
+
swapBuffers();
EXPECT_EQ(0, m_mockContext.frameCount());
EXPECT_EQ(3, m_mockClient.setFullRootLayerDamageCount());
@@ -194,7 +217,7 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatredForScopeDuratio
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
- m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootLayer()->renderSurface());
+ m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootRenderPass());
EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
swapBuffers();
@@ -270,7 +293,8 @@ public:
// This test isn't using the same fixture as LayerRendererChromiumTest, and you can't mix TEST() and TEST_F() with the same name, hence LRC2.
TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls)
{
- FakeLayerRendererChromiumClient mockClient;
+ CCScopedSettings scopedSettings;
+ FakeCCRendererClient mockClient;
FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow));
EXPECT_TRUE(layerRendererChromium.initialize());
@@ -311,8 +335,86 @@ private:
TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert)
{
- FakeLayerRendererChromiumClient mockClient;
+ CCScopedSettings scopedSettings;
+ FakeCCRendererClient mockClient;
FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow));
layerRendererChromium.initialize();
}
+
+class ContextThatDoesNotSupportMemoryManagmentExtensions : public FakeWebGraphicsContext3D {
+public:
+ ContextThatDoesNotSupportMemoryManagmentExtensions() { }
+
+ // WebGraphicsContext3D methods.
+
+ // This method would normally do a glSwapBuffers under the hood.
+ virtual void prepareTexture() { }
+ virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { }
+ virtual WebString getString(WebKit::WGC3Denum name) { return WebString(); }
+};
+
+TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation)
+{
+ FakeCCRendererClient mockClient;
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions), GraphicsContext3D::RenderDirectlyToHostWindow));
+
+ layerRendererChromium.initialize();
+
+ EXPECT_GT(mockClient.memoryAllocationLimitBytes(), 0ul);
+}
+
+class ClearCountingContext : public FakeWebGraphicsContext3D {
+public:
+ ClearCountingContext() : m_clear(0) { }
+
+ virtual void clear(WGC3Dbitfield)
+ {
+ m_clear++;
+ }
+
+ int clearCount() const { return m_clear; }
+
+private:
+ int m_clear;
+};
+
+TEST(LayerRendererChromiumTest2, opaqueBackground)
+{
+ FakeCCRendererClient mockClient;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
+
+ mockClient.rootRenderPass()->setHasTransparentBackground(false);
+
+ EXPECT_TRUE(layerRendererChromium.initialize());
+
+ layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass());
+ layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect());
+ layerRendererChromium.finishDrawingFrame();
+
+ // On DEBUG builds, render passes with opaque background clear to blue to
+ // easily see regions that were not drawn on the screen.
+#if defined(NDEBUG)
+ EXPECT_EQ(0, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+#else
+ EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+#endif
+}
+
+TEST(LayerRendererChromiumTest2, transparentBackground)
+{
+ FakeCCRendererClient mockClient;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
+
+ mockClient.rootRenderPass()->setHasTransparentBackground(true);
+
+ EXPECT_TRUE(layerRendererChromium.initialize());
+
+ layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass());
+ layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect());
+ layerRendererChromium.finishDrawingFrame();
+
+ EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+}
diff --git a/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp
deleted file mode 100644
index d1a97bb5b..000000000
--- a/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp
+++ /dev/null
@@ -1,267 +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 "LayerTextureUpdater.h"
-
-#include "BitmapCanvasLayerTextureUpdater.h"
-#include "BitmapSkPictureCanvasLayerTextureUpdater.h"
-#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
-#include "GraphicsContext.h"
-#include "LayerPainterChromium.h"
-#include "PlatformContextSkia.h"
-#include "SkPictureCanvasLayerTextureUpdater.h"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace {
-
-struct PaintCallback {
- virtual void operator()(GraphicsContext&, const IntRect&) = 0;
-};
-
-class TestLayerPainterChromium : public LayerPainterChromium {
-public:
- TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { }
-
- virtual void paint(GraphicsContext& context, const IntRect& contentRect)
- {
- m_callback(context, contentRect);
- }
-
- private:
- PaintCallback& m_callback;
-};
-
-// Paint callback functions
-
-struct PaintFillOpaque : public PaintCallback {
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
- {
- Color opaque(255, 0, 0, 255);
- IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height() / 2);
- IntRect bottom(contentRect.x(), contentRect.y() + contentRect.height() / 2, contentRect.width(), contentRect.height() / 2);
- context.fillRect(top, opaque, ColorSpaceDeviceRGB);
- context.fillRect(bottom, opaque, ColorSpaceDeviceRGB);
- }
-};
-
-struct PaintFillAlpha : public PaintCallback {
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
- {
- Color alpha(0, 0, 0, 0);
- context.fillRect(contentRect, alpha, ColorSpaceDeviceRGB);
- }
-};
-
-struct PaintFillPartialOpaque : public PaintCallback {
- PaintFillPartialOpaque(IntRect opaqueRect)
- : m_opaqueRect(opaqueRect)
- {
- }
-
- virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
- {
- Color alpha(0, 0, 0, 0);
- context.fillRect(contentRect, alpha, ColorSpaceDeviceRGB);
-
- IntRect fillOpaque = m_opaqueRect;
- fillOpaque.intersect(contentRect);
-
- Color opaque(255, 255, 255, 255);
- context.fillRect(fillOpaque, opaque, ColorSpaceDeviceRGB);
- }
-
- IntRect m_opaqueRect;
-};
-
-#define EXPECT_EQ_RECT(a, b) \
- EXPECT_EQ(a.x(), b.x()); \
- EXPECT_EQ(a.maxX(), b.maxX()); \
- EXPECT_EQ(a.y(), b.y()); \
- EXPECT_EQ(a.maxY(), b.maxY());
-
-TEST(LayerTextureUpdaterTest, testOpaqueRectPresentAfterOpaquePaint)
-{
- PaintFillOpaque fillOpaque;
- RefPtr<LayerTextureUpdater> updater;
- IntRect opaqueRect;
- OwnPtr<TestLayerPainterChromium> painter;
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release());
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentAfterNonOpaquePaint)
-{
- PaintFillAlpha fillAlpha;
- RefPtr<LayerTextureUpdater> updater;
- IntRect opaqueRect;
- OwnPtr<TestLayerPainterChromium> painter;
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release());
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithOpaquePaint)
-{
- PaintFillOpaque fillOpaque;
- RefPtr<LayerTextureUpdater> updater;
- IntRect opaqueRect;
- OwnPtr<TestLayerPainterChromium> painter;
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillOpaque));
- updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release());
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithNonOpaquePaint)
-{
- PaintFillAlpha fillAlpha;
- RefPtr<LayerTextureUpdater> updater;
- IntRect opaqueRect;
- OwnPtr<TestLayerPainterChromium> painter;
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.release(), false);
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-
- opaqueRect = IntRect();
- painter = adoptPtr(new TestLayerPainterChromium(fillAlpha));
- updater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.release());
- updater->setOpaque(true);
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testPartialOpaqueRectNoTransform)
-{
- IntRect partialRect(100, 200, 50, 75);
- PaintFillPartialOpaque fillPartial(partialRect);
- OwnPtr<TestLayerPainterChromium> painter(adoptPtr(new TestLayerPainterChromium(fillPartial)));
- RefPtr<LayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
-
- IntRect opaqueRect;
- updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(partialRect, opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testPartialOpaqueRectTranslation)
-{
- IntRect partialRect(100, 200, 50, 75);
- PaintFillPartialOpaque fillPartial(partialRect);
-
- OwnPtr<TestLayerPainterChromium> painter(adoptPtr(new TestLayerPainterChromium(fillPartial)));
- RefPtr<LayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
-
- IntRect opaqueRect;
- IntRect contentRect(11, 12, 389, 388);
- updater->prepareToUpdate(contentRect, IntSize(400, 400), 0, 1, opaqueRect);
- EXPECT_EQ_RECT(partialRect, opaqueRect);
-}
-
-TEST(LayerTextureUpdaterTest, testPartialOpaqueRectScale)
-{
- float contentsScale = 0.5;
-
- IntRect partialRect(9, 20, 50, 75);
- IntRect partialDeviceRect(partialRect);
- PaintFillPartialOpaque fillPartial(partialDeviceRect);
- OwnPtr<TestLayerPainterChromium> painter(adoptPtr(new TestLayerPainterChromium(fillPartial)));
- RefPtr<LayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(painter.release(), false);
-
- IntRect opaqueRect;
- IntRect contentRect(4, 6, 396, 394);
- updater->prepareToUpdate(contentRect, IntSize(400, 400), 0, contentsScale, opaqueRect);
-
- // Original rect: 9, 20, 50, 75
- // Scaled down to half size: 4.5, 10, 25, 37.5
- // Enclosed int rect: 5, 10, 24, 37
- // Scaled back up to content: 10, 20, 48, 74
- IntRect scaledRect(10, 20, 48, 74);
- EXPECT_EQ_RECT(scaledRect, opaqueRect);
-}
-
-} // namespace
diff --git a/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp b/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp
new file mode 100644
index 000000000..dd60a97b7
--- /dev/null
+++ b/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp
@@ -0,0 +1,195 @@
+/*
+ * 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 "OpaqueRectTrackingContentLayerDelegate.h"
+
+#include "Color.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "skia/ext/platform_canvas.h"
+#include <public/WebRect.h>
+
+#include <gtest/gtest.h>
+
+using WebKit::WebRect;
+using namespace WebCore;
+
+namespace {
+
+struct PaintCallback {
+ virtual void operator()(GraphicsContext&, const IntRect&) = 0;
+};
+
+class TestLayerPainterChromium : public GraphicsContextPainter {
+public:
+ TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { }
+
+ virtual void paint(GraphicsContext& context, const IntRect& contentRect) OVERRIDE
+ {
+ m_callback(context, contentRect);
+ }
+
+ private:
+ PaintCallback& m_callback;
+};
+
+// Paint callback functions
+
+struct PaintFillOpaque : public PaintCallback {
+ virtual void operator()(GraphicsContext& context, const IntRect& contentRect) OVERRIDE
+ {
+ Color opaque(255, 0, 0, 255);
+ IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), contentRect.height() / 2);
+ IntRect bottom(contentRect.x(), contentRect.y() + contentRect.height() / 2, contentRect.width(), contentRect.height() / 2);
+ context.fillRect(top, opaque, ColorSpaceDeviceRGB);
+ context.fillRect(bottom, opaque, ColorSpaceDeviceRGB);
+ }
+};
+
+struct PaintFillAlpha : public PaintCallback {
+ virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
+ {
+ Color alpha(0, 0, 0, 0);
+ context.fillRect(contentRect, alpha, ColorSpaceDeviceRGB);
+ }
+};
+
+struct PaintFillPartialOpaque : public PaintCallback {
+ PaintFillPartialOpaque(IntRect opaqueRect)
+ : m_opaqueRect(opaqueRect)
+ {
+ }
+
+ virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
+ {
+ Color alpha(0, 0, 0, 0);
+ context.fillRect(contentRect, alpha, ColorSpaceDeviceRGB);
+
+ IntRect fillOpaque = m_opaqueRect;
+ fillOpaque.intersect(contentRect);
+
+ Color opaque(255, 255, 255, 255);
+ context.fillRect(fillOpaque, opaque, ColorSpaceDeviceRGB);
+ }
+
+ IntRect m_opaqueRect;
+};
+
+#define EXPECT_EQ_RECT(a, b) \
+ EXPECT_EQ(a.x, b.x); \
+ EXPECT_EQ(a.width, b.width); \
+ EXPECT_EQ(a.y, b.y); \
+ EXPECT_EQ(a.height, b.height);
+
+class OpaqueRectTrackingContentLayerDelegateTest : public testing::Test {
+public:
+ OpaqueRectTrackingContentLayerDelegateTest()
+ : m_skCanvas(adoptPtr(skia::CreateBitmapCanvas(canvasRect().width, canvasRect().height, false)))
+ {
+ }
+
+ SkCanvas* skCanvas() { return m_skCanvas.get(); }
+ WebRect canvasRect() { return WebRect(0, 0, 400, 400); }
+
+private:
+ OwnPtr<SkCanvas> m_skCanvas;
+};
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectPresentAfterOpaquePaint)
+{
+ PaintFillOpaque fillOpaque;
+ TestLayerPainterChromium painter(fillOpaque);
+
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ WebRect opaqueRect;
+ delegate.paintContents(skCanvas(), canvasRect(), opaqueRect);
+ EXPECT_EQ_RECT(WebRect(0, 0, 400, 400), opaqueRect);
+}
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentAfterNonOpaquePaint)
+{
+ PaintFillAlpha fillAlpha;
+ TestLayerPainterChromium painter(fillAlpha);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ WebRect opaqueRect;
+ delegate.paintContents(skCanvas(), canvasRect(), opaqueRect);
+ EXPECT_EQ_RECT(WebRect(0, 0, 0, 0), opaqueRect);
+}
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentForOpaqueLayerWithOpaquePaint)
+{
+ PaintFillOpaque fillOpaque;
+ TestLayerPainterChromium painter(fillOpaque);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ delegate.setOpaque(true);
+
+ WebRect opaqueRect;
+ delegate.paintContents(skCanvas(), canvasRect(), opaqueRect);
+ EXPECT_EQ_RECT(WebRect(0, 0, 0, 0), opaqueRect);
+}
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testOpaqueRectNotPresentForOpaqueLayerWithNonOpaquePaint)
+{
+ PaintFillOpaque fillAlpha;
+ TestLayerPainterChromium painter(fillAlpha);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ delegate.setOpaque(true);
+
+ WebRect opaqueRect;
+ delegate.paintContents(skCanvas(), canvasRect(), opaqueRect);
+ EXPECT_EQ_RECT(WebRect(0, 0, 0, 0), opaqueRect);
+}
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testPartialOpaqueRectNoTransform)
+{
+ IntRect partialRect(100, 200, 50, 75);
+ PaintFillPartialOpaque fillPartial(partialRect);
+ TestLayerPainterChromium painter(fillPartial);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ WebRect opaqueRect;
+ delegate.paintContents(skCanvas(), canvasRect(), opaqueRect);
+ EXPECT_EQ_RECT(WebRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect);
+}
+
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testPartialOpaqueRectTranslation)
+{
+ IntRect partialRect(100, 200, 50, 75);
+ PaintFillPartialOpaque fillPartial(partialRect);
+ TestLayerPainterChromium painter(fillPartial);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ WebRect opaqueRect;
+ WebRect contentRect(11, 12, 389, 388);
+ delegate.paintContents(skCanvas(), contentRect, opaqueRect);
+ EXPECT_EQ_RECT(WebRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect);
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
index 0827267ed..6c6c359a9 100644
--- a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
+++ b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
@@ -110,7 +110,7 @@ TEST(ScrollAnimatorEnabled, Enabled)
MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly(Return(1000));
- EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(3);
+ EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4);
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
EXPECT_NE(100, scrollAnimatorNone.currentX());
@@ -125,6 +125,12 @@ TEST(ScrollAnimatorEnabled, Enabled)
scrollAnimatorNone.reset();
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
+ EXPECT_NE(100, scrollAnimatorNone.currentX());
+ EXPECT_NE(0, scrollAnimatorNone.currentX());
+ EXPECT_EQ(0, scrollAnimatorNone.currentY());
+ scrollAnimatorNone.reset();
+
+ scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
EXPECT_EQ(100, scrollAnimatorNone.currentX());
EXPECT_NE(0, scrollAnimatorNone.currentX());
EXPECT_EQ(0, scrollAnimatorNone.currentY());
diff --git a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
index 5bf990cde..d2cd9befc 100644
--- a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
@@ -100,7 +100,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer)
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, 0);
CCLayerImpl* ccChild1 = ccLayerTreeRoot->children()[0].get();
CCScrollbarLayerImpl* ccChild2 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[1].get());
@@ -116,7 +116,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer)
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, 0);
CCScrollbarLayerImpl* ccChild1 = static_cast<CCScrollbarLayerImpl*>(ccLayerTreeRoot->children()[0].get());
CCLayerImpl* ccChild2 = ccLayerTreeRoot->children()[1].get();
diff --git a/Source/WebKit/chromium/tests/TextureCopierTest.cpp b/Source/WebKit/chromium/tests/TextureCopierTest.cpp
index 17173c0a5..d71b8ce45 100644
--- a/Source/WebKit/chromium/tests/TextureCopierTest.cpp
+++ b/Source/WebKit/chromium/tests/TextureCopierTest.cpp
@@ -54,6 +54,7 @@ TEST(TextureCopierTest, testDrawArraysCopy)
GraphicsContext3D::Attributes attrs;
RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
MockContext& mockContext = *static_cast<MockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
+ RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
{
InSequence sequence;
@@ -79,7 +80,7 @@ TEST(TextureCopierTest, testDrawArraysCopy)
int destTextureId = 2;
IntSize size(256, 128);
OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(context));
- copier->copyTexture(context.get(), sourceTextureId, destTextureId, size);
+ copier->copyTexture(ccContext.get(), sourceTextureId, destTextureId, size);
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp
index b60017fd9..d0cc3d96f 100644
--- a/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/TextureLayerChromiumTest.cpp
@@ -43,7 +43,7 @@ namespace {
class MockCCLayerTreeHost : public CCLayerTreeHost {
public:
MockCCLayerTreeHost()
- : CCLayerTreeHost(&m_fakeClient, CCSettings())
+ : CCLayerTreeHost(&m_fakeClient, CCLayerTreeSettings())
{
initialize();
}
diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
index 80b099f19..5e301d8eb 100644
--- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
@@ -673,12 +673,13 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
FakeTextureCopier fakeCopier;
FakeTextureUploader fakeUploader;
RefPtr<GraphicsContext3D> context = createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes());
+ RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(IntSize(100, 200));
layer->invalidateRect(IntRect(0, 0, 100, 200));
layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
- updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
+ updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
layer->pushPropertiesTo(layerImpl.get());
// We should have both tiles on the impl side.
@@ -691,7 +692,7 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
// Invoke updateLayerRect again. As the layer is valid updateLayerRect shouldn't be invoked on
// the LayerTextureUpdater.
layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
- updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
+ updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount());
layer->invalidateRect(IntRect(0, 0, 50, 50));
@@ -699,12 +700,12 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
layer->fakeLayerTextureUpdater()->clearPrepareCount();
layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
- updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
+ 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);
- updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
+ updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
}
@@ -796,7 +797,7 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
- OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
+ OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings());
// Create two 300 x 300 tiled layers.
IntSize contentBounds(300, 300);
@@ -872,10 +873,12 @@ TEST(TiledLayerChromiumTest, hugeLayerUpdateCrash)
TEST(TiledLayerChromiumTest, partialUpdates)
{
- CCSettings settings;
- settings.maxPartialTextureUpdates = 4;
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
+
+ CCLayerTreeSettings settings;
+ settings.maxPartialTextureUpdates = 4;
+
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
index 098dd2731..08597f1dc 100644
--- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
+++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
@@ -120,22 +120,23 @@ private:
bool m_synchronizedAnimations;
};
-void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer)
+void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer, CCLayerTreeHostImpl* hostImpl)
{
ASSERT_TRUE(layer);
ASSERT_TRUE(ccLayer);
EXPECT_EQ(layer->id(), ccLayer->id());
+ EXPECT_EQ(ccLayer->layerTreeHostImpl(), hostImpl);
EXPECT_EQ(layer->nonFastScrollableRegion(), ccLayer->nonFastScrollableRegion());
ASSERT_EQ(!!layer->maskLayer(), !!ccLayer->maskLayer());
if (layer->maskLayer())
- expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer());
+ expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer(), hostImpl);
ASSERT_EQ(!!layer->replicaLayer(), !!ccLayer->replicaLayer());
if (layer->replicaLayer())
- expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer());
+ expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer(), hostImpl);
const Vector<RefPtr<LayerChromium> >& layerChildren = layer->children();
const Vector<OwnPtr<CCLayerImpl> >& ccLayerChildren = ccLayer->children();
@@ -143,7 +144,7 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer)
ASSERT_EQ(layerChildren.size(), ccLayerChildren.size());
for (size_t i = 0; i < layerChildren.size(); ++i)
- expectTreesAreIdentical(layerChildren[i].get(), ccLayerChildren[i].get());
+ expectTreesAreIdentical(layerChildren[i].get(), ccLayerChildren[i].get(), hostImpl);
}
// Attempts to synchronizes a null tree. This should not crash, and should
@@ -152,7 +153,7 @@ TEST(TreeSynchronizerTest, syncNullTree)
{
DebugScopedSetImplThread impl;
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, nullptr);
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, nullptr, 0);
EXPECT_TRUE(!ccLayerTreeRoot.get());
}
@@ -161,13 +162,17 @@ TEST(TreeSynchronizerTest, syncNullTree)
TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
{
DebugScopedSetImplThread impl;
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
}
// Constructs a very simple tree and synchronizes it attempting to reuse some layers
@@ -176,12 +181,15 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
DebugScopedSetImplThread impl;
Vector<int> ccLayerDestructionList;
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Add a new layer to the LayerChromium side
layerTreeRoot->children()[0]->addChild(MockLayerChromium::create(&ccLayerDestructionList));
@@ -190,8 +198,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
int secondCCLayerId = ccLayerTreeRoot->children()[1]->id();
// Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one CCLayerImpl.
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
ASSERT_EQ(1u, ccLayerDestructionList.size());
EXPECT_EQ(secondCCLayerId, ccLayerDestructionList[0]);
@@ -203,21 +211,24 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
DebugScopedSetImplThread impl;
Vector<int> ccLayerDestructionList;
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
// Set up the tree and sync once. child2 needs to be synced here, too, even though we
// remove it to set up the intended scenario.
RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
RefPtr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList);
layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
layerTreeRoot->addChild(child2);
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
ccLayerTreeRoot->resetAllChangeTrackingForSubtree();
// re-insert the layer and sync again.
child2->removeFromParent();
layerTreeRoot->addChild(child2);
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Check that the impl thread properly tracked the change.
EXPECT_FALSE(ccLayerTreeRoot->layerPropertyChanged());
@@ -228,6 +239,10 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
{
DebugScopedSetImplThread impl;
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
@@ -242,8 +257,8 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
IntSize secondChildBounds = IntSize(25, 53);
layerTreeRoot->children()[1]->setBounds(secondChildBounds);
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Check that the property values we set on the LayerChromium tree are reflected in the CCLayerImpl tree.
FloatPoint rootCCLayerPosition = ccLayerTreeRoot->position();
@@ -262,6 +277,9 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange)
DebugScopedSetImplThread impl;
Vector<int> ccLayerDestructionList;
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
// Set up a tree with this sort of structure:
// root --- A --- B ---+--- C
// |
@@ -279,8 +297,8 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange)
layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList));
RefPtr<LayerChromium> layerD = layerB->children()[1].get();
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Now restructure the tree to look like this:
// root --- D ---+--- A
@@ -297,8 +315,8 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange)
layerC->addChild(layerB);
// After another synchronize our trees should match and we should not have destroyed any CCLayerImpls
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
EXPECT_EQ(0u, ccLayerDestructionList.size());
}
@@ -309,6 +327,9 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
DebugScopedSetImplThread impl;
Vector<int> ccLayerDestructionList;
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> oldLayerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
@@ -317,16 +338,16 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id();
int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id();
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), nullptr);
- expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), nullptr, hostImpl.get());
+ expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Remove all children on the LayerChromium side.
oldLayerTreeRoot->removeAllChildren();
// Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted.
RefPtr<LayerChromium> newLayerTreeRoot = LayerChromium::create();
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
ASSERT_EQ(3u, ccLayerDestructionList.size());
EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeRootLayerId));
@@ -338,6 +359,10 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
{
DebugScopedSetImplThread impl;
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
layerTreeRoot->addChild(LayerChromium::create());
layerTreeRoot->addChild(LayerChromium::create());
@@ -357,29 +382,33 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get());
layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get());
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Remove the mask layer.
layerTreeRoot->children()[0]->setMaskLayer(0);
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Remove the replica layer.
layerTreeRoot->children()[1]->setReplicaLayer(0);
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
// Remove the replica mask.
replicaLayerWithMask->setMaskLayer(0);
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
+ expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get());
}
TEST(TreeSynchronizerTest, synchronizeAnimations)
{
DebugScopedSetImplThread impl;
+
+ CCLayerTreeSettings settings;
+ OwnPtr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0);
+
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
FakeLayerAnimationControllerClient dummy;
@@ -387,8 +416,8 @@ TEST(TreeSynchronizerTest, synchronizeAnimations)
EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
- OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr, hostImpl.get());
+ ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release(), hostImpl.get());
EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
}
diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
index 92f006184..d5b68a867 100644
--- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
@@ -202,14 +202,14 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureScrollStarted)
m_inputHandler->handleInputEvent(gesture);
}
-TEST_F(WebCompositorInputHandlerImplTest, gestureScrollFailed)
+TEST_F(WebCompositorInputHandlerImplTest, gestureScrollOnMainThread)
{
// We should send all events to the widget for this gesture.
m_expectedDisposition = DidNotHandle;
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(::testing::_, ::testing::_))
- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread));
gesture.type = WebInputEvent::GestureScrollBegin;
m_inputHandler->handleInputEvent(gesture);
@@ -306,7 +306,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingFailed)
VERIFY_AND_RESET_MOCKS();
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread));
gesture.type = WebInputEvent::GestureFlingStart;
m_inputHandler->handleInputEvent(gesture);
@@ -387,7 +387,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates)
// transferred to the main thread.
EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread));
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
@@ -469,7 +469,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets)
// transferred to the main thread.
EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread));
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
@@ -546,7 +546,7 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets)
// Then abort the second fling.
EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollOnMainThread));
EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp
index 4aa905c78..40705808d 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 "WebDataSource.h"
#include "WebDocument.h"
#include "WebFindOptions.h"
#include "WebFormElement.h"
@@ -225,13 +226,12 @@ TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag)
int viewportHeight = 480;
FixedLayoutTestWebViewClient client;
- client.m_screenInfo.horizontalDPI = 160;
+ client.m_screenInfo.horizontalDPI = 320;
client.m_windowRect = WebRect(0, 0, viewportWidth, viewportHeight);
WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
webView->settings()->setViewportEnabled(true);
- webView->settings()->setDefaultDeviceScaleFactor(2);
webView->enableFixedLayoutMode(true);
webView->resize(WebSize(viewportWidth, viewportHeight));
webView->layout();
@@ -397,6 +397,28 @@ TEST_F(WebFrameTest, ReloadDoesntSetRedirect)
webkit_support::ServeAsynchronousMockedRequests();
}
+TEST_F(WebFrameTest, IframeRedirect)
+{
+ registerMockedHttpURLLoad("iframe_redirect.html");
+ registerMockedHttpURLLoad("visible_iframe.html");
+
+ WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframe_redirect.html", true);
+ webkit_support::RunAllPendingMessages(); // Queue the iframe.
+ webkit_support::ServeAsynchronousMockedRequests(); // Load the iframe.
+
+ WebFrame* iframe = webView->findFrameByName(WebString::fromUTF8("ifr"));
+ ASSERT_TRUE(iframe);
+ WebDataSource* iframeDataSource = iframe->dataSource();
+ ASSERT_TRUE(iframeDataSource);
+ 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]));
+
+ webView->close();
+}
+
TEST_F(WebFrameTest, ClearFocusedNodeTest)
{
registerMockedHttpURLLoad("iframe_clear_focused_node_test.html");
diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp
index 8fc7c93bd..bc4929311 100644
--- a/Source/WebKit/chromium/tests/WebLayerTest.cpp
+++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp
@@ -65,7 +65,7 @@ public:
class MockWebContentLayerClient : public WebContentLayerClient {
public:
- MOCK_METHOD2(paintContents, void(WebCanvas*, const WebRect& clip));
+ MOCK_METHOD3(paintContents, void(WebCanvas*, const WebRect& clip, WebRect& opaque));
};
class WebLayerTest : public Test {
@@ -175,7 +175,7 @@ TEST_F(WebLayerTest, Client)
// Content layer.
MockWebContentLayerClient contentClient;
- EXPECT_CALL(contentClient, paintContents(_, _)).Times(AnyNumber());
+ EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
m_rootLayer.addChild(contentLayer);
@@ -209,7 +209,7 @@ TEST_F(WebLayerTest, Hierarchy)
EXPECT_TRUE(layer2.parent().isNull());
MockWebContentLayerClient contentClient;
- EXPECT_CALL(contentClient, paintContents(_, _)).Times(AnyNumber());
+ EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create();
diff --git a/Source/WebKit/chromium/tests/data/iframe_redirect.html b/Source/WebKit/chromium/tests/data/iframe_redirect.html
new file mode 100644
index 000000000..8176253ea
--- /dev/null
+++ b/Source/WebKit/chromium/tests/data/iframe_redirect.html
@@ -0,0 +1,10 @@
+<html>
+ <body>
+ <iframe id='ifr'>
+ </iframe>
+ <script>
+ var ifr = document.getElementById('ifr');
+ ifr.contentWindow.document.location = "visible_iframe.html";
+ </script>
+ </body>
+</html>