summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit/chromium
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit/chromium')
-rw-r--r--Source/WebKit/chromium/.gitignore35
-rw-r--r--Source/WebKit/chromium/ChangeLog8926
-rw-r--r--Source/WebKit/chromium/DEPS4
-rw-r--r--Source/WebKit/chromium/WebKit.gyp89
-rw-r--r--Source/WebKit/chromium/WebKit.gypi16
-rw-r--r--Source/WebKit/chromium/WebKitUnitTests.gyp11
-rw-r--r--Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp96
-rw-r--r--Source/WebKit/chromium/bridge/PeerConnectionHandler.cpp88
-rw-r--r--Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.cpp137
-rw-r--r--Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.h80
-rw-r--r--Source/WebKit/chromium/features.gypi29
-rwxr-xr-xSource/WebKit/chromium/gyp_webkit2
-rw-r--r--Source/WebKit/chromium/public/WebAccessibilityRole.h1
-rw-r--r--Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h54
-rw-r--r--Source/WebKit/chromium/public/WebArrayBuffer.h1
-rw-r--r--Source/WebKit/chromium/public/WebAutofillClient.h24
-rw-r--r--Source/WebKit/chromium/public/WebBatteryStatus.h (renamed from Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp)38
-rw-r--r--Source/WebKit/chromium/public/WebBatteryStatusClient.h41
-rw-r--r--Source/WebKit/chromium/public/WebCompositor.h8
-rw-r--r--Source/WebKit/chromium/public/WebCompositorInputHandler.h3
-rw-r--r--Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h6
-rw-r--r--Source/WebKit/chromium/public/WebContextMenuData.h2
-rw-r--r--Source/WebKit/chromium/public/WebDevToolsFrontendClient.h3
-rw-r--r--Source/WebKit/chromium/public/WebDocument.h2
-rw-r--r--Source/WebKit/chromium/public/WebElement.h5
-rw-r--r--Source/WebKit/chromium/public/WebFileChooserCompletion.h20
-rw-r--r--Source/WebKit/chromium/public/WebFrame.h18
-rw-r--r--Source/WebKit/chromium/public/WebFrameClient.h14
-rw-r--r--Source/WebKit/chromium/public/WebHitTestResult.h71
-rw-r--r--Source/WebKit/chromium/public/WebIDBCursor.h1
-rw-r--r--Source/WebKit/chromium/public/WebIDBDatabase.h9
-rw-r--r--Source/WebKit/chromium/public/WebIDBDatabaseException.h (renamed from Source/WebKit/chromium/public/WebReferrerPolicy.h)16
-rw-r--r--Source/WebKit/chromium/public/WebIDBIndex.h13
-rw-r--r--Source/WebKit/chromium/public/WebIDBKeyPath.h22
-rw-r--r--Source/WebKit/chromium/public/WebIDBObjectStore.h16
-rw-r--r--Source/WebKit/chromium/public/WebInputElement.h5
-rw-r--r--Source/WebKit/chromium/public/WebInputEvent.h54
-rw-r--r--Source/WebKit/chromium/public/WebIntent.h16
-rw-r--r--Source/WebKit/chromium/public/WebMediaElement.h56
-rw-r--r--Source/WebKit/chromium/public/WebMediaPlayer.h87
-rw-r--r--Source/WebKit/chromium/public/WebMediaPlayerClient.h19
-rw-r--r--Source/WebKit/chromium/public/WebNamedNodeMap.h74
-rw-r--r--Source/WebKit/chromium/public/WebNodeCollection.h2
-rw-r--r--Source/WebKit/chromium/public/WebPageVisibilityState.h3
-rw-r--r--Source/WebKit/chromium/public/WebPrerendererClient.h (renamed from Source/WebKit/chromium/src/WebURLRequestPrivate.h)27
-rw-r--r--Source/WebKit/chromium/public/WebPrintScalingOption.h44
-rw-r--r--Source/WebKit/chromium/public/WebRange.h4
-rw-r--r--Source/WebKit/chromium/public/WebRuntimeFeatures.h9
-rw-r--r--Source/WebKit/chromium/public/WebScopedMicrotaskSuppression.h (renamed from Source/WebKit/chromium/public/WebAttribute.h)64
-rw-r--r--Source/WebKit/chromium/public/WebSecurityPolicy.h6
-rw-r--r--Source/WebKit/chromium/public/WebSettings.h6
-rw-r--r--Source/WebKit/chromium/public/WebSpeechGrammar.h60
-rw-r--r--Source/WebKit/chromium/public/WebSpeechRecognitionHandle.h91
-rw-r--r--Source/WebKit/chromium/public/WebSpeechRecognitionParams.h58
-rw-r--r--Source/WebKit/chromium/public/WebSpeechRecognitionResult.h59
-rw-r--r--Source/WebKit/chromium/public/WebSpeechRecognizer.h56
-rw-r--r--Source/WebKit/chromium/public/WebSpeechRecognizerClient.h94
-rw-r--r--Source/WebKit/chromium/public/WebStorageEventDispatcher.h23
-rw-r--r--Source/WebKit/chromium/public/WebStorageNamespace.h25
-rw-r--r--Source/WebKit/chromium/public/WebSurroundingText.h72
-rw-r--r--Source/WebKit/chromium/public/WebTextCheckingCompletion.h1
-rw-r--r--Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h (renamed from Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp)79
-rw-r--r--Source/WebKit/chromium/public/WebTimeRange.h (renamed from Source/WebKit/chromium/src/WebURLResponsePrivate.h)24
-rw-r--r--Source/WebKit/chromium/public/WebUserMediaClient.h3
-rw-r--r--Source/WebKit/chromium/public/WebUserMediaRequest.h8
-rw-r--r--Source/WebKit/chromium/public/WebVideoFrame.h81
-rw-r--r--Source/WebKit/chromium/public/WebView.h40
-rw-r--r--Source/WebKit/chromium/public/WebViewClient.h11
-rw-r--r--Source/WebKit/chromium/public/WebWidget.h25
-rw-r--r--Source/WebKit/chromium/public/WebWidgetClient.h19
-rw-r--r--Source/WebKit/chromium/public/android/WebInputEventFactory.h2
-rw-r--r--Source/WebKit/chromium/public/platform/WebArrayBufferView.h11
-rw-r--r--Source/WebKit/chromium/public/platform/WebAudioBus.h73
-rw-r--r--Source/WebKit/chromium/public/platform/WebAudioDevice.h34
-rw-r--r--Source/WebKit/chromium/public/platform/WebData.h122
-rw-r--r--Source/WebKit/chromium/public/platform/WebDragData.h4
-rw-r--r--Source/WebKit/chromium/public/platform/WebFileSystem.h5
-rw-r--r--Source/WebKit/chromium/public/platform/WebGamepad.h112
-rw-r--r--Source/WebKit/chromium/public/platform/WebGamepads.h88
-rw-r--r--Source/WebKit/chromium/public/platform/WebHTTPBody.h121
-rw-r--r--Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h60
-rw-r--r--Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h100
-rw-r--r--Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebICEOptions.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h259
-rw-r--r--Source/WebKit/chromium/public/platform/WebLocalizedString.h58
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaHints.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h64
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h57
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h81
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h78
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamSource.h98
-rw-r--r--Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h79
-rw-r--r--Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h85
-rw-r--r--Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h64
-rw-r--r--Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h53
-rw-r--r--Source/WebKit/chromium/public/platform/WebReferrerPolicy.h31
-rw-r--r--Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h26
-rw-r--r--Source/WebKit/chromium/public/platform/WebSocketStreamError.h57
-rw-r--r--Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h70
-rw-r--r--Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h78
-rw-r--r--Source/WebKit/chromium/public/platform/WebThread.h50
-rw-r--r--Source/WebKit/chromium/public/platform/WebThreadSafeData.h89
-rw-r--r--Source/WebKit/chromium/public/platform/WebURL.h170
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLError.h85
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLLoadTiming.h120
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLLoader.h83
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLLoaderClient.h90
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLRequest.h211
-rw-r--r--Source/WebKit/chromium/public/platform/WebURLResponse.h212
-rw-r--r--Source/WebKit/chromium/public/platform/WebVector.h198
-rw-r--r--Source/WebKit/chromium/src/ApplicationCacheHost.cpp8
-rw-r--r--Source/WebKit/chromium/src/AssertMatchingEnums.cpp152
-rw-r--r--Source/WebKit/chromium/src/AssociatedURLLoader.cpp6
-rw-r--r--Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp89
-rw-r--r--Source/WebKit/chromium/src/AsyncFileSystemChromium.h9
-rw-r--r--Source/WebKit/chromium/src/AudioDestinationChromium.cpp130
-rw-r--r--Source/WebKit/chromium/src/AudioDestinationChromium.h57
-rw-r--r--Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp136
-rw-r--r--Source/WebKit/chromium/src/AutofillPopupMenuClient.h17
-rw-r--r--Source/WebKit/chromium/src/BatteryClientImpl.cpp (renamed from Source/WebKit/chromium/bridge/MediaStreamCenter.cpp)48
-rw-r--r--Source/WebKit/chromium/src/BatteryClientImpl.h (renamed from Source/WebKit/chromium/src/WebStorageNamespaceImpl.h)40
-rw-r--r--Source/WebKit/chromium/src/BlobRegistryProxy.h1
-rw-r--r--Source/WebKit/chromium/src/CCThreadImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/ChromeClientImpl.cpp94
-rw-r--r--Source/WebKit/chromium/src/ChromeClientImpl.h12
-rw-r--r--Source/WebKit/chromium/src/ChromiumCurrentTime.cpp4
-rw-r--r--Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp5
-rw-r--r--Source/WebKit/chromium/src/ChromiumThreading.cpp2
-rw-r--r--Source/WebKit/chromium/src/ColorChooserProxy.cpp4
-rw-r--r--Source/WebKit/chromium/src/ColorChooserProxy.h4
-rw-r--r--Source/WebKit/chromium/src/CompositionUnderlineBuilder.h2
-rw-r--r--Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h2
-rw-r--r--Source/WebKit/chromium/src/ContextMenuClientImpl.cpp22
-rw-r--r--Source/WebKit/chromium/src/DatabaseObserver.cpp3
-rw-r--r--Source/WebKit/chromium/src/Extensions3DChromium.cpp45
-rw-r--r--Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp98
-rw-r--r--Source/WebKit/chromium/src/FrameLoaderClientImpl.h18
-rw-r--r--Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp29
-rw-r--r--Source/WebKit/chromium/src/GraphicsContext3DPrivate.h16
-rw-r--r--Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp5
-rw-r--r--Source/WebKit/chromium/src/IDBCursorBackendProxy.h1
-rw-r--r--Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp10
-rw-r--r--Source/WebKit/chromium/src/IDBIndexBackendProxy.h4
-rwxr-xr-xSource/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp6
-rw-r--r--Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h2
-rw-r--r--Source/WebKit/chromium/src/InspectorClientImpl.cpp22
-rw-r--r--Source/WebKit/chromium/src/InspectorClientImpl.h7
-rw-r--r--Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp11
-rw-r--r--Source/WebKit/chromium/src/InspectorFrontendClientImpl.h5
-rw-r--r--Source/WebKit/chromium/src/LocalFileSystemChromium.cpp21
-rw-r--r--Source/WebKit/chromium/src/LocalizedStrings.cpp36
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.cpp11
-rw-r--r--Source/WebKit/chromium/src/NotificationPresenterImpl.cpp4
-rw-r--r--Source/WebKit/chromium/src/NotificationPresenterImpl.h11
-rw-r--r--Source/WebKit/chromium/src/PageWidgetDelegate.cpp221
-rw-r--r--Source/WebKit/chromium/src/PageWidgetDelegate.h86
-rw-r--r--Source/WebKit/chromium/src/PlatformSupport.cpp192
-rw-r--r--Source/WebKit/chromium/src/ResourceHandle.cpp297
-rw-r--r--Source/WebKit/chromium/src/ResourceHandleInternal.h97
-rw-r--r--Source/WebKit/chromium/src/ScrollbarGroup.cpp26
-rw-r--r--Source/WebKit/chromium/src/ScrollbarGroup.h5
-rw-r--r--Source/WebKit/chromium/src/SharedWorkerRepository.cpp4
-rw-r--r--Source/WebKit/chromium/src/SocketStreamHandle.cpp8
-rw-r--r--Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp163
-rw-r--r--Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h75
-rw-r--r--Source/WebKit/chromium/src/StorageAreaProxy.cpp80
-rw-r--r--Source/WebKit/chromium/src/StorageAreaProxy.h18
-rw-r--r--Source/WebKit/chromium/src/StorageEventDispatcherChromium.cpp52
-rw-r--r--Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/StorageNamespaceProxy.cpp7
-rw-r--r--Source/WebKit/chromium/src/StorageNamespaceProxy.h5
-rw-r--r--Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp119
-rw-r--r--Source/WebKit/chromium/src/TextFieldDecoratorImpl.h (renamed from Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h)53
-rw-r--r--Source/WebKit/chromium/src/UserMediaClientImpl.cpp6
-rw-r--r--Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp138
-rw-r--r--Source/WebKit/chromium/src/VideoFrameChromiumImpl.h69
-rw-r--r--Source/WebKit/chromium/src/WebAccessibilityObject.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebArrayBuffer.cpp10
-rw-r--r--Source/WebKit/chromium/src/WebArrayBufferView.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebAttribute.cpp67
-rw-r--r--Source/WebKit/chromium/src/WebAudioBus.cpp132
-rw-r--r--Source/WebKit/chromium/src/WebBindings.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp4
-rw-r--r--Source/WebKit/chromium/src/WebColorChooserClientImpl.h4
-rw-r--r--Source/WebKit/chromium/src/WebColorName.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebCompositorImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp227
-rw-r--r--Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h33
-rw-r--r--Source/WebKit/chromium/src/WebContentLayer.cpp10
-rw-r--r--Source/WebKit/chromium/src/WebData.cpp103
-rw-r--r--Source/WebKit/chromium/src/WebDatabase.cpp1
-rw-r--r--Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp243
-rw-r--r--Source/WebKit/chromium/src/WebDevToolsAgentImpl.h12
-rw-r--r--Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h20
-rw-r--r--Source/WebKit/chromium/src/WebDocument.cpp10
-rw-r--r--Source/WebKit/chromium/src/WebDragData.cpp107
-rw-r--r--Source/WebKit/chromium/src/WebElement.cpp21
-rw-r--r--Source/WebKit/chromium/src/WebExternalTextureLayer.cpp54
-rw-r--r--Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp22
-rw-r--r--Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h1
-rw-r--r--Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp6
-rw-r--r--Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h10
-rw-r--r--Source/WebKit/chromium/src/WebFontImpl.cpp31
-rw-r--r--Source/WebKit/chromium/src/WebFrameImpl.cpp99
-rw-r--r--Source/WebKit/chromium/src/WebFrameImpl.h14
-rw-r--r--Source/WebKit/chromium/src/WebGeolocationClientMock.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebHTTPBody.cpp184
-rw-r--r--Source/WebKit/chromium/src/WebHTTPLoadInfo.cpp147
-rw-r--r--Source/WebKit/chromium/src/WebHitTestResult.cpp84
-rw-r--r--Source/WebKit/chromium/src/WebIDBCursorImpl.cpp5
-rw-r--r--Source/WebKit/chromium/src/WebIDBCursorImpl.h1
-rw-r--r--Source/WebKit/chromium/src/WebIDBDatabaseImpl.h5
-rw-r--r--Source/WebKit/chromium/src/WebIDBIndexImpl.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebIDBIndexImpl.h9
-rw-r--r--Source/WebKit/chromium/src/WebIDBKeyPath.cpp64
-rwxr-xr-xSource/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h14
-rw-r--r--Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp (renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp)28
-rw-r--r--Source/WebKit/chromium/src/WebInputElement.cpp18
-rw-r--r--Source/WebKit/chromium/src/WebInputEvent.cpp32
-rw-r--r--Source/WebKit/chromium/src/WebInputEventConversion.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebIntent.cpp54
-rw-r--r--Source/WebKit/chromium/src/WebKit.cpp32
-rw-r--r--Source/WebKit/chromium/src/WebLayer.cpp26
-rw-r--r--Source/WebKit/chromium/src/WebLayerImpl.cpp4
-rw-r--r--Source/WebKit/chromium/src/WebLayerImpl.h1
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeView.cpp28
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp43
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeViewImpl.h29
-rw-r--r--Source/WebKit/chromium/src/WebMediaElement.cpp64
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp193
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h48
-rw-r--r--Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp153
-rw-r--r--Source/WebKit/chromium/src/WebMediaStreamSource.cpp102
-rw-r--r--Source/WebKit/chromium/src/WebNamedNodeMap.cpp70
-rw-r--r--Source/WebKit/chromium/src/WebNotification.cpp13
-rw-r--r--Source/WebKit/chromium/src/WebPagePopupImpl.cpp286
-rw-r--r--Source/WebKit/chromium/src/WebPagePopupImpl.h104
-rw-r--r--Source/WebKit/chromium/src/WebPageSerializer.cpp9
-rw-r--r--Source/WebKit/chromium/src/WebPluginContainerImpl.cpp68
-rw-r--r--Source/WebKit/chromium/src/WebPluginContainerImpl.h11
-rw-r--r--Source/WebKit/chromium/src/WebPopupMenuImpl.cpp15
-rw-r--r--Source/WebKit/chromium/src/WebPopupMenuImpl.h1
-rw-r--r--Source/WebKit/chromium/src/WebRange.cpp23
-rw-r--r--Source/WebKit/chromium/src/WebRuntimeFeatures.cpp61
-rw-r--r--Source/WebKit/chromium/src/WebScopedMicrotaskSuppression.cpp (renamed from Source/WebKit/chromium/src/WebURL.cpp)29
-rw-r--r--Source/WebKit/chromium/src/WebSecurityPolicy.cpp7
-rw-r--r--Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp (renamed from Source/WebKit/chromium/src/WebMediaStreamComponent.cpp)37
-rw-r--r--Source/WebKit/chromium/src/WebSettingsImpl.cpp26
-rw-r--r--Source/WebKit/chromium/src/WebSettingsImpl.h8
-rw-r--r--Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp3
-rw-r--r--Source/WebKit/chromium/src/WebSharedWorkerImpl.h2
-rw-r--r--Source/WebKit/chromium/src/WebSocketImpl.cpp2
-rw-r--r--Source/WebKit/chromium/src/WebSpeechGrammar.cpp62
-rw-r--r--Source/WebKit/chromium/src/WebSpeechRecognitionHandle.cpp71
-rw-r--r--Source/WebKit/chromium/src/WebSpeechRecognitionResult.cpp62
-rw-r--r--Source/WebKit/chromium/src/WebStorageAreaImpl.cpp93
-rw-r--r--Source/WebKit/chromium/src/WebStorageAreaImpl.h79
-rw-r--r--Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp37
-rw-r--r--Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h3
-rw-r--r--Source/WebKit/chromium/src/WebStorageNamespaceImpl.cpp75
-rw-r--r--Source/WebKit/chromium/src/WebSurroundingText.cpp90
-rw-r--r--Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp8
-rw-r--r--Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h1
-rwxr-xr-xSource/WebKit/chromium/src/WebThreadSafeData.cpp75
-rw-r--r--Source/WebKit/chromium/src/WebURLError.cpp72
-rw-r--r--Source/WebKit/chromium/src/WebURLRequest.cpp347
-rw-r--r--Source/WebKit/chromium/src/WebURLResponse.cpp447
-rw-r--r--Source/WebKit/chromium/src/WebUserMediaRequest.cpp28
-rw-r--r--Source/WebKit/chromium/src/WebVideoLayer.cpp (renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h)31
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.cpp589
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.h108
-rw-r--r--Source/WebKit/chromium/src/WebWorkerClientImpl.cpp8
-rw-r--r--Source/WebKit/chromium/src/WebWorkerClientImpl.h2
-rw-r--r--Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp6
-rw-r--r--Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h10
-rw-r--r--Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp8
-rw-r--r--Source/WebKit/chromium/src/WrappedResourceRequest.h80
-rw-r--r--Source/WebKit/chromium/src/WrappedResourceResponse.h80
-rw-r--r--Source/WebKit/chromium/src/android/WebInputEventFactory.cpp5
-rw-r--r--Source/WebKit/chromium/src/js/Tests.js10
-rw-r--r--Source/WebKit/chromium/src/painting/PaintAggregator.cpp2
-rw-r--r--Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp42
-rw-r--r--Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp55
-rw-r--r--Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp57
-rw-r--r--Source/WebKit/chromium/tests/CCAnimationTestCommon.h50
-rw-r--r--Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp260
-rw-r--r--Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp82
-rw-r--r--Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp62
-rw-r--r--Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp396
-rw-r--r--Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp519
-rw-r--r--Source/WebKit/chromium/tests/CCLayerImplTest.cpp4
-rw-r--r--Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp2
-rw-r--r--Source/WebKit/chromium/tests/CCLayerSorterTest.cpp246
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp759
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp641
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp708
-rw-r--r--Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h8
-rw-r--r--Source/WebKit/chromium/tests/CCMathUtilTest.cpp102
-rw-r--r--Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp4681
-rw-r--r--Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h57
-rw-r--r--Source/WebKit/chromium/tests/CCQuadCullerTest.cpp397
-rw-r--r--Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp36
-rw-r--r--Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp357
-rw-r--r--Source/WebKit/chromium/tests/CCSchedulerTest.cpp316
-rw-r--r--Source/WebKit/chromium/tests/CCSchedulerTestCommon.h34
-rw-r--r--Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp40
-rw-r--r--Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp128
-rw-r--r--Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp129
-rw-r--r--Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h168
-rw-r--r--Source/WebKit/chromium/tests/CCTimerTest.cpp6
-rw-r--r--Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp125
-rw-r--r--Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp (renamed from Source/WebKit/chromium/tests/WebGLLayerChromiumTest.cpp)16
-rwxr-xr-xSource/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h18
-rw-r--r--Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h13
-rw-r--r--Source/WebKit/chromium/tests/FloatQuadTest.cpp4
-rw-r--r--Source/WebKit/chromium/tests/FrameTestHelpers.cpp9
-rw-r--r--Source/WebKit/chromium/tests/FrameTestHelpers.h4
-rw-r--r--Source/WebKit/chromium/tests/LayerChromiumTest.cpp56
-rw-r--r--Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp277
-rw-r--r--Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp93
-rw-r--r--Source/WebKit/chromium/tests/LevelDBTest.cpp105
-rw-r--r--Source/WebKit/chromium/tests/LocaleWinTest.cpp163
-rw-r--r--Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp4
-rw-r--r--Source/WebKit/chromium/tests/MockCCQuadCuller.h65
-rw-r--r--Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp255
-rw-r--r--Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp34
-rw-r--r--Source/WebKit/chromium/tests/PopupMenuTest.cpp9
-rw-r--r--Source/WebKit/chromium/tests/RegionTest.cpp127
-rw-r--r--Source/WebKit/chromium/tests/RenderTableCellTest.cpp23
-rw-r--r--Source/WebKit/chromium/tests/RenderTableRowTest.cpp118
-rw-r--r--Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp22
-rw-r--r--Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp2
-rw-r--r--Source/WebKit/chromium/tests/TextureCopierTest.cpp85
-rw-r--r--Source/WebKit/chromium/tests/TextureManagerTest.cpp9
-rw-r--r--Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp1046
-rwxr-xr-xSource/WebKit/chromium/tests/TilingDataTest.cpp686
-rw-r--r--Source/WebKit/chromium/tests/TransparencyWinTest.cpp60
-rw-r--r--Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp66
-rw-r--r--Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp614
-rw-r--r--Source/WebKit/chromium/tests/WebFrameTest.cpp44
-rw-r--r--Source/WebKit/chromium/tests/WebLayerTest.cpp7
-rw-r--r--Source/WebKit/chromium/tests/WebMediaPlayerClientImplTest.cpp120
-rw-r--r--Source/WebKit/chromium/tests/WebSocketDeflaterTest.cpp12
-rw-r--r--Source/WebKit/chromium/tests/WebViewTest.cpp125
-rw-r--r--Source/WebKit/chromium/tests/data/no_viewport_tag.html5
-rw-r--r--Source/WebKit/chromium/tests/data/specify_size.html16
350 files changed, 25691 insertions, 12571 deletions
diff --git a/Source/WebKit/chromium/.gitignore b/Source/WebKit/chromium/.gitignore
new file mode 100644
index 000000000..12ec0f709
--- /dev/null
+++ b/Source/WebKit/chromium/.gitignore
@@ -0,0 +1,35 @@
+# Ignore Chromium dependencies
+
+*.Makefile
+*.mk
+*.sln
+*.vcproj*
+All.xcodeproj
+WebKit.xcodeproj
+WebKitUnitTests.xcodeproj
+
+.gclient
+.gclient_entries
+base/
+chromium_deps/
+crypto/
+depot_tools/
+dbus/
+gfx/
+googleurl/
+gpu/
+ipc/
+media/
+net/
+ppapi/
+printing/
+sdch/
+skia/
+sql/
+testing/
+third_party/
+tools/
+ui/
+v8/
+webkit/
+xcodebuild/
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 8fe572481..4b8508c40 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,8929 @@
+2012-05-06 Kinuko Yasuda <kinuko@chromium.org>
+
+ Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code
+ https://bugs.webkit.org/show_bug.cgi?id=85741
+
+ Reviewed by David Levin.
+
+ * src/LocalFileSystemChromium.cpp:
+ (WebCore::openFileSystemHelper):
+ (WebCore::LocalFileSystem::readFileSystem):
+ (WebCore::LocalFileSystem::requestFileSystem):
+ * src/WebFileSystemCallbacksImpl.cpp:
+ (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):
+ (WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem):
+ * src/WebFileSystemCallbacksImpl.h:
+ (WebFileSystemCallbacksImpl):
+ * src/WorkerAsyncFileSystemChromium.cpp:
+ (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
+ (WebCore::WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge):
+ * src/WorkerAsyncFileSystemChromium.h:
+ (WebCore::WorkerAsyncFileSystemChromium::create):
+ (WorkerAsyncFileSystemChromium):
+
+2012-05-06 Kinuko Yasuda <kinuko@chromium.org>
+
+ Cleanup: Move FileSystem API type definitions into a separate header file
+ https://bugs.webkit.org/show_bug.cgi?id=85738
+
+ Reviewed by David Levin.
+
+ Move FileSystem API type definitions from AsyncFileSystem.h and
+ AsyncFileSystemChromium.cpp for chromium port into a single separate
+ header file: FileSystemType.h
+
+ By doing this we make it clearer that every filesystem type can be
+ found in the header file and also can save including entire
+ AsyncFileSystem definition just for referring type enum value.
+
+ * src/AssertMatchingEnums.cpp:
+ * src/AsyncFileSystemChromium.cpp:
+ (WebCore::AsyncFileSystem::crackFileSystemURL):
+ (WebCore::AsyncFileSystem::isValidType):
+ (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium):
+ (WebCore::AsyncFileSystemChromium::createIsolatedFileSystem):
+ (WebCore::AsyncFileSystemChromium::toURL):
+ * src/AsyncFileSystemChromium.h:
+ (WebCore::AsyncFileSystemChromium::create):
+ (AsyncFileSystemChromium):
+ * src/LocalFileSystemChromium.cpp:
+ (WebCore::openFileSystemHelper):
+ (WebCore::LocalFileSystem::readFileSystem):
+ (WebCore::LocalFileSystem::requestFileSystem):
+ * src/WebFileSystemCallbacksImpl.cpp:
+ (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):
+ * src/WebFileSystemCallbacksImpl.h:
+ (WebFileSystemCallbacksImpl):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::createFileSystem):
+ (WebKit::WebFrameImpl::createFileEntry):
+ * src/WorkerAsyncFileSystemChromium.cpp:
+ (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
+ * src/WorkerAsyncFileSystemChromium.h:
+ (WebCore::WorkerAsyncFileSystemChromium::create):
+ (WorkerAsyncFileSystemChromium):
+
+2012-05-06 Kinuko Yasuda <kinuko@chromium.org>
+
+ Cleanup: FileSystem API's Entry.toURL() impl should return KURL instead of String
+ https://bugs.webkit.org/show_bug.cgi?id=85736
+
+ Reviewed by David Levin.
+
+ Change AsyncFileSystemChromium::toURL()'s return type from String to KURL.
+
+ * src/AsyncFileSystemChromium.cpp:
+ (WebCore::AsyncFileSystemChromium::toURL):
+ String to KURL.
+ * src/AsyncFileSystemChromium.h:
+ (AsyncFileSystemChromium):
+
+2012-05-06 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call currentThread through Platform.h directly
+ https://bugs.webkit.org/show_bug.cgi?id=85769
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::onEndTest):
+ (WTF::CCLayerTreeHostTest::runTest):
+
+2012-05-06 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call cryptographicallyRandomValues through Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=85763
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/ChromiumOSRandomSource.cpp:
+ (WTF::cryptographicallyRandomValuesFromOS):
+
+2012-05-06 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Add WebKit API to access multiple attribute of input element
+ https://bugs.webkit.org/show_bug.cgi?id=85355
+
+ Reviewed by Kent Tamura.
+
+ We need this to implement the datalist UI for <input type=email multiple>.
+
+ * public/WebInputElement.h:
+ (WebInputElement):
+ * src/WebInputElement.cpp:
+ (WebKit::WebInputElement::isMultiple):
+ (WebKit):
+
+2012-05-06 Adam Barth <abarth@webkit.org>
+
+ CSP should let sites both enforce one policy and monitor another
+ https://bugs.webkit.org/show_bug.cgi?id=85561
+
+ Reviewed by Eric Seidel.
+
+ * src/SharedWorkerRepository.cpp:
+ (WebCore::SharedWorkerScriptLoader::notifyFinished):
+ * src/WebWorkerClientImpl.cpp:
+ (WebKit::WebWorkerClientImpl::startWorkerContext):
+
+2012-05-06 Kent Tamura <tkent@chromium.org>
+
+ Rename ICULocale to LocaleICU, part 2
+ https://bugs.webkit.org/show_bug.cgi?id=85695
+
+ Reviewed by Kentaro Hara.
+
+ * tests/LocalizedNumberICUTest.cpp:
+ (testNumberIsReversible): Rename ICULocale to LocaleICU.
+
+2012-05-06 Adrienne Walker <enne@google.com>
+
+ [chromium] Allow WebMediaPlayerClientImpl to switch clients
+ https://bugs.webkit.org/show_bug.cgi?id=85093
+
+ Reviewed by James Robinson.
+
+ WebVideoFrameProviderClient has a 1:1 relationship with a
+ WebVideoFrameProvider. The client here is CCVideoLayerImpl and the
+ provider is WebMediaPlayerClientImpl. If the provider gets a new
+ client, then the old client needs to be informed to stop using the
+ provider.
+
+ If this doesn't happen, then the old client will have an unsafe
+ pointer to the provider, will not get informed if the provider gets
+ deleted, and the client will crash when it dereferences the provider
+ pointer trying to tell the provider that its client is going away.
+
+ Test: WebMediaPlayerClientImplTest.InitialNullVideoClient
+ WebMediaPlayerClientImplTest.SetAndUnsetVideoClient
+ WebMediaPlayerClientImplTest.DestroyProvider
+ WebMediaPlayerClientImplTest.SetMultipleVideoClients
+
+ * WebKit.gypi:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * tests/WebMediaPlayerClientImplTest.cpp: Added.
+ (WebKit):
+ (FakeWebMediaPlayerClientImpl):
+ (WebKit::FakeWebMediaPlayerClientImpl::create):
+ (WebKit::FakeWebMediaPlayerClientImpl::FakeWebMediaPlayerClientImpl):
+ (FakeVideoFrameProviderClient):
+ (WebKit::FakeVideoFrameProviderClient::create):
+ (WebKit::FakeVideoFrameProviderClient::~FakeVideoFrameProviderClient):
+ (WebKit::FakeVideoFrameProviderClient::didReceiveFrame):
+ (WebKit::FakeVideoFrameProviderClient::didUpdateMatrix):
+ (WebKit::FakeVideoFrameProviderClient::stopUsingProvider):
+ (WebKit::FakeVideoFrameProviderClient::provider):
+ (WebKit::FakeVideoFrameProviderClient::FakeVideoFrameProviderClient):
+ (WebKit::TEST):
+
+2012-05-06 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-05-06 Andrey Kosyakov <caseq@chromium.org>
+
+ Web Inspector: take timeline frame mode out of experimental
+ https://bugs.webkit.org/show_bug.cgi?id=85707
+
+ Reviewed by Pavel Feldman.
+
+ - exposed supportFrameInstrumentation method to InspectorClient. Client must return true iff the platform will call
+ InspectorInstrumentation::instrumentBeginFrame() upon beginning of frame rendering;
+
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::supportsFrameInstrumentation):
+ (WebKit):
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+
+2012-05-04 Kent Tamura <tkent@chromium.org>
+
+ Rename ICULocale to LocaleICU, part 1
+ https://bugs.webkit.org/show_bug.cgi?id=85688
+
+ Reviewed by Kentaro Hara.
+
+ * tests/LocalizedNumberICUTest.cpp: Rename ICULocale.h to LocaleICU.h.
+
+2012-05-04 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Changes to layer tree structure need to be tracked properly
+ https://bugs.webkit.org/show_bug.cgi?id=85421
+
+ Reviewed by Adrienne Walker.
+
+ Unit test added: TreeSynchronizerTest.syncSimpleTreeAndTrackStackingOrderChange
+
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests):
+ (WebKitTests::TEST):
+
+2012-05-04 Tony Chang <tony@chromium.org>
+
+ [chromium] enable msvs_error_on_missing_sources at gyp time
+ https://bugs.webkit.org/show_bug.cgi?id=85683
+
+ Reviewed by Adam Barth.
+
+ This flag checks for missing files, which cause compile times to be
+ slow on Windows. Since this flag is on by default for the
+ build.chromium.org bots, we should add it here too so everyone can fix
+ these errors.
+
+ * DEPS: Roll to a chromium version that has no missing files.
+ * gyp_webkit: Add the flag.
+
+2012-05-04 Satoru Takabayashi <satorux@chromium.org>
+
+ [chromium] Add plumbing for file display names for drag and drop
+ https://bugs.webkit.org/show_bug.cgi?id=85673
+
+ Reviewed by Darin Fisher.
+
+ * public/platform/WebDragData.h:
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::items):
+ (WebKit::WebDragData::addItem):
+
+2012-05-04 Adam Barth <abarth@webkit.org>
+
+ Refactor CSP state to prepare for having both a ReportOnly and an Enforced policy
+ https://bugs.webkit.org/show_bug.cgi?id=85662
+
+ Reviewed by Eric Seidel.
+
+ Update callers to the new function name.
+
+ * src/SharedWorkerRepository.cpp:
+ (WebCore::SharedWorkerScriptLoader::notifyFinished):
+ * src/WebWorkerClientImpl.cpp:
+ (WebKit::WebWorkerClientImpl::startWorkerContext):
+
+2012-05-04 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Revert compositor layer scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=85644
+
+ Reviewed by Steve Block.
+
+ * src/WebContentLayerImpl.cpp:
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockContentLayerDelegate::paintContents):
+
+2012-05-04 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Make PeerConnection00's API fully compliant with the draft
+ https://bugs.webkit.org/show_bug.cgi?id=85491
+
+ Reviewed by Adam Barth.
+
+ * src/AssertMatchingEnums.cpp:
+
+2012-05-04 Nate Chapin <japhet@chromium.org>
+
+ Don't require FrameLoaderClient to manufacture a commitData() call for empty documents.
+ https://bugs.webkit.org/show_bug.cgi?id=85533
+
+ Reviewed by Alexey Proskuryakov.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::FrameLoaderClientImpl):
+ (WebKit):
+ (WebKit::FrameLoaderClientImpl::finishedLoading):
+ * src/FrameLoaderClientImpl.h:
+ (WebKit::FrameLoaderClientImpl::makeRepresentation):
+ (WebKit::FrameLoaderClientImpl::revertToProvisionalState):
+ (FrameLoaderClientImpl):
+
+2012-05-04 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [Device Metrics] With "Fit window" option on, page contents are downscaled incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=85510
+
+ Reviewed by Pavel Feldman.
+
+ Use the RenderView width rather than FrameView contents width whenever possible.
+ Drive-by: add protection from division-by-zero (for some weird rendering states).
+
+ Test: inspector/styles/device-metrics-fit-window.html
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::ensureOriginalZoomFactor):
+ (WebKit::DeviceMetricsSupport::scaledEmulatedFrameSize):
+
+2012-05-03 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Revise touchpad fling curve to use exponential curve, to improve feel and small fling performance.
+ https://bugs.webkit.org/show_bug.cgi?id=85530
+
+ Reviewed by Kenneth Russell.
+
+ * tests/PlatformGestureCurveTest.cpp:
+
+2012-05-03 Dimitri Glazkov <dglazkov@chromium.org>
+
+ [Chromium] Use correct define in the features.gypi
+ https://bugs.webkit.org/show_bug.cgi?id=85520
+
+ Patch by Ben Goodger.
+
+ Reviewed by Tony Chang.
+
+ * features.gypi: Replaced use_aura with a more appropriate chromeos
+
+2012-05-03 Antony Sargent <asargent@chromium.org>
+
+ Add methods to create WebArrayBuffer/WebArrayBufferView from v8 objects
+ https://bugs.webkit.org/show_bug.cgi?id=84899
+
+ Reviewed by Adam Barth.
+
+ * public/WebArrayBuffer.h:
+ (WebArrayBuffer):
+ * public/platform/WebArrayBufferView.h:
+ (v8):
+ (WebArrayBufferView):
+ * src/WebArrayBuffer.cpp:
+ (WebKit):
+ (WebKit::WebArrayBuffer::createFromV8Value):
+ * src/WebArrayBufferView.cpp:
+ (WebKit):
+ (WebKit::WebArrayBufferView::createFromV8Value):
+
+2012-05-03 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Don't add small opaque areas to the occlusion tracker's Region
+ https://bugs.webkit.org/show_bug.cgi?id=85297
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests):
+ (CCOcclusionTrackerTestMinimumTrackingSize):
+ (WebKitTests::CCOcclusionTrackerTestMinimumTrackingSize::runMyTest):
+
+2012-05-02 Jon Lee <jonlee@apple.com>
+
+ Migrate permission functions to Notification from NotificationCenter
+ https://bugs.webkit.org/show_bug.cgi?id=80485
+ <rdar://problem/10965458>
+
+ Reviewed by Jian Li.
+
+ * src/NotificationPresenterImpl.h:
+ (NotificationPresenterImpl): Add stub implementation of requestPermission.
+ (WebKit::NotificationPresenterImpl::requestPermission):
+
+2012-05-02 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Don't occlude pixels in a surface that are needed for a background filter blur
+ https://bugs.webkit.org/show_bug.cgi?id=84317
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest):
+ (WebKitTests):
+ (CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter):
+ (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter::runMyTest):
+ (CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice):
+ (WebKitTests::CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice::runMyTest):
+ (CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip):
+ (WebKitTests::CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip::runMyTest):
+ (CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter):
+ (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter::runMyTest):
+ (CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded):
+ (WebKitTests::CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded::runMyTest):
+ (CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded):
+ (WebKitTests::CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded::runMyTest):
+
+2012-04-18 Jon Honeycutt <jhoneycutt@apple.com>
+
+ FrameLoaderClient::dispatchWillSendSubmitEvent() should be given more
+ information about the form being submitted
+ https://bugs.webkit.org/show_bug.cgi?id=84297
+
+ Reviewed by Andy Estes.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::dispatchWillSendSubmitEvent):
+ Updated to use the FormState.
+
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+ Updated method declaration.
+
+2012-05-02 Joshua Bell <jsbell@chromium.org>
+
+ Roll Chromium DEPS r134537 to r134581.
+ https://bugs.webkit.org/show_bug.cgi?id=85428
+
+ Unreviewed - just a deps roll.
+
+ * DEPS:
+
+2012-05-02 Jochen Eisinger <jochen@chromium.org>
+
+ [chromium] Add WebDocument::referrerPolicy() which wraps the same method on Document
+ https://bugs.webkit.org/show_bug.cgi?id=85201
+
+ Reviewed by Adam Barth.
+
+ Embedders should use webFrame->document()->referrerPolicy() instead of webFrame->referrerPolicy(). The latter will be removed soon.
+
+ * public/WebDocument.h:
+ (WebDocument):
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::referrerPolicy):
+ (WebKit):
+
+2012-05-02 Michal Mocny <mmocny@google.com>
+
+ [chromium] Set contents texture manager preferred memory limit based on GpuMemoryManager suggestion.
+ https://bugs.webkit.org/show_bug.cgi?id=84270
+
+ Reviewed by Kenneth Russell.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+
+2012-05-02 Emil A Eklund <eae@chromium.org>
+
+ Fix usage of layout types in platform code
+ https://bugs.webkit.org/show_bug.cgi?id=85392
+
+ Reviewed by Eric Seidel.
+
+ * src/WebHitTestResult.cpp:
+ (WebKit::WebHitTestResult::localPoint):
+ * src/WebSurroundingText.cpp:
+ (WebKit::WebSurroundingText::initialize):
+ Explicitly cast WebPoint to IntPoint to avoid ambiguous conversion error.
+
+2012-05-02 Yury Semikhatsky <yurys@chromium.org>
+
+ Web Inspector: TypeError: Cannot call method 'createLiveLocation' of undefined
+ https://bugs.webkit.org/show_bug.cgi?id=85371
+
+ Standard extension scripts injected to the Chromium background page should have
+ correct script data which means that context debug id should be already set on
+ the context where they are compiled before the compilation. This patch moves
+ assignment of context debug id earlier where it is known that no scripts have
+ been evaluated in the context.
+
+ Reviewed by Pavel Feldman.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::dispatchDidClearWindowObjectInWorld):
+ (WebKit::FrameLoaderClientImpl::didCreateScriptContext):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::didCreateScriptContext):
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+ * src/WebDevToolsAgentPrivate.h:
+ (WebDevToolsAgentPrivate):
+
+2012-05-02 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Changing webkitGetUserMedia to take an object instead of a string
+ https://bugs.webkit.org/show_bug.cgi?id=84850
+
+ Reviewed by Dimitri Glazkov.
+
+ * public/WebUserMediaRequest.h:
+ (WebUserMediaRequest):
+ * src/WebUserMediaRequest.cpp:
+
+2012-05-01 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Additional instances of calling histogramCustomCounts directly
+ https://bugs.webkit.org/show_bug.cgi?id=85322
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/painting/PaintAggregator.cpp:
+ (WebKit::PaintAggregator::invalidateRect):
+
+2012-05-01 Min Qin <qinmin@google.com>
+
+ use USE(NATIVE_FULLSCREEN_VIDEO) instead of ENABLE(NATIVE_FULLSCREEN_VIDEO)
+ https://bugs.webkit.org/show_bug.cgi?id=85316
+
+ Reviewed by Kent Tamura.
+
+ NATIVE_FULLSCREEN_VIDEO means the fullscreen video is implemented by native
+ system view instead of webkit
+ So it is more appropriate to use USE(NATIVE_FULLSCREEN_VIDEO).
+ Just rename the flag, no new tests
+
+ * features.gypi:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::enterFullScreenForElement):
+ (WebKit::WebViewImpl::exitFullScreenForElement):
+
+2012-05-01 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Additional instances of calling createAudioDevice directly
+ https://bugs.webkit.org/show_bug.cgi?id=85321
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+
+2012-05-01 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Additional instances of calling mimeRegistry directly
+ https://bugs.webkit.org/show_bug.cgi?id=85320
+
+ Reviewed by Eric Seidel.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::canShowMIMEType):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+
+2012-05-01 Ryosuke Niwa <rniwa@webkit.org>
+
+ *Command.h files shouldn't be exported to WebKit layer
+ https://bugs.webkit.org/show_bug.cgi?id=74778
+
+ Reviewed by Eric Seidel.
+
+ * src/WebFrameImpl.cpp:
+ * src/WebViewImpl.cpp:
+
+2012-05-01 Julien Chaffraix <jchaffraix@webkit.org>
+
+ WebKit test RenderTableCellDeathTest.CanSetRow is failing as of r115705
+ https://bugs.webkit.org/show_bug.cgi?id=85274
+
+ Reviewed by Ojan Vafai.
+
+ The tests were crashing as we were creating a RenderTableCell without any RenderTableRow parent
+ which shouldn't happen inside the render tree.
+
+ Using RenderTableCell to access RenderTableRow was artificial and the checks have now been moved
+ to using a RenderTableRow directly.
+
+ * WebKit.gyp:
+ * WebKit.gypi:
+ Added the new file.
+
+ * tests/RenderTableCellTest.cpp:
+ Removed the row index tests as they are now in the following file.
+
+ * tests/RenderTableRowTest.cpp: Copied from Source/WebKit/chromium/tests/RenderTableCellTest.cpp.
+ Changed a bit the row index tests and re-enabled them.
+
+2012-05-01 Pavel Feldman <pfeldman@chromium.org>
+
+ WebKit unit tests RenderTableCellDeathTest.CanSetRow* are failing as of r115705
+ https://bugs.webkit.org/show_bug.cgi?id=85274
+
+ Not reviewed: test disabled.
+
+ * tests/RenderTableCellTest.cpp:
+
+2012-05-01 Pavel Feldman <pfeldman@chromium.org>
+
+ WebKit test RenderTableCellDeathTest.CanSetRow is failing as of r115705
+ https://bugs.webkit.org/show_bug.cgi?id=85274
+
+ Not reviewed: test disabled.
+
+ The test is based on the standalone cell, while the new logic
+ requires parent to be present upon the row index set.
+
+ * tests/RenderTableCellTest.cpp:
+
+2012-05-01 Hironori Bono <hbono@chromium.org>
+
+ [Chromium] Regression r113405 ContextMenuImpl does not set a misspelled word
+ https://bugs.webkit.org/show_bug.cgi?id=85271
+
+ Reviewed by Kent Tamura.
+
+ This change calls selectMisspelledWord() to get a misspelled word so Chrome can
+ set the misspelledWord variable without selecting text.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+
+2012-04-30 Kent Tamura <tkent@chromium.org>
+
+ [Chromium/Windows] Add LocalizedDateWin
+ https://bugs.webkit.org/show_bug.cgi?id=84935
+
+ Reviewed by Kentaro Hara.
+
+ Add test for LocaleWin.cpp.
+
+ * WebKit.gypi:
+ * tests/LocaleWinTest.cpp: Added.
+ (msForDate): A helper function.
+ (TEST):
+
+2012-04-30 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Move RenderTableCell's row index to RenderTableRow
+ https://bugs.webkit.org/show_bug.cgi?id=85229
+
+ Reviewed by Ojan Vafai.
+
+ * tests/RenderTableCellTest.cpp:
+ Updated after the refactoring.
+
+2012-04-30 Gavin Peters <gavinp@chromium.org>
+
+ [Chromium] Add thunk headers for staging Prerendering API.
+ https://bugs.webkit.org/show_bug.cgi?id=84880
+
+ Reviewed by Adam Barth.
+
+ These empty headers will be replaced by the actual API when Bug 85005 is commited.
+
+ * WebKit.gyp:
+ * public/WebPrerendererClient.h: Added.
+ (WebKit):
+ (WebPrerendererClient):
+ * public/WebView.h:
+ (WebKit):
+ (WebKit::WebView::setPrerendererClient):
+
+2012-04-30 Ilya Sherman <isherman@chromium.org>
+
+ [Chromium] Fix Autofill popup visibility behavior
+ Prevent users from interacting with invisible Autofill popups rendered outside the main frame's contents view.
+ This is a recommit of r115400, restricted to just Autofill popups.
+ https://bugs.webkit.org/show_bug.cgi?id=84420
+
+ Reviewed by Abhishek Arya
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::popupOpened): Hide popups rendered outside the main frame's contents view.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions): Fix up order of operations to support immediately hiding a popup if it would not be visible
+
+2012-04-30 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Disable battery-status API support.
+
+ The battery-status API support should not have view-dependency. So disable it until
+ that is fixed.
+ https://bugs.webkit.org/show_bug.cgi?id=84499
+
+ Reviewed by Adam Barth.
+
+ * features.gypi:
+
+2012-04-30 Gavin Peters <gavinp@chromium.org>
+
+ [Chromium] Remove Webkit/chromium/public/WebReferrerPolicy.h thunk.
+ https://bugs.webkit.org/show_bug.cgi?id=84552
+
+ After http://codereview.chromium.org/10139023/ lands, this thunk is no
+ longer needed.
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/WebReferrerPolicy.h: Removed.
+
+2012-04-29 Sam Weinig <sam@webkit.org>
+
+ Remove BlobBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=84036
+
+ Reviewed by Anders Carlsson.
+
+ * features.gypi:
+ Keep WebKitBlobBuilder enabled for Chromium, since it has shipped it.
+
+2012-04-30 Min Qin <qinmin@google.com>
+
+ Expose a flag so that fullscreen video on android can work with FULLSCREEN_API
+ https://bugs.webkit.org/show_bug.cgi?id=84414
+
+ Reviewed by Darin Fisher.
+
+ On android, the fullscreen video was implemented by passing a java
+ surfaceView to an android mediaplayer class.
+ The implementation of that logic should happen in WebKit::WebMediaPlayer.
+ This change makes it possble for WebViewImpl::enterFullScreenForElement()
+ to call WebMediaPlayer->enterFullscreen(), thus solving the issue.
+
+ Sorry, there is a merge error during the previous commit, resolved now
+
+ No new tests. This just exposes the flag so later it can be used by android.
+
+ * features.gypi:
+ * public/WebMediaPlayer.h:
+ (WebMediaPlayer):
+ (WebKit::WebMediaPlayer::enterFullscreen):
+ (WebKit::WebMediaPlayer::exitFullscreen):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::enterFullscreen):
+ (WebKit::WebMediaPlayerClientImpl::exitFullscreen):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::enterFullScreenForElement):
+ (WebKit::WebViewImpl::exitFullScreenForElement):
+
+2012-04-30 Gavin Peters <gavinp@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Remove PlatformSupport::loadPlatformAudioResource, call loadResource directly
+ https://bugs.webkit.org/show_bug.cgi?id=85193
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call defaultLocale directly
+ https://bugs.webkit.org/show_bug.cgi?id=85192
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call callOnMainThread directly
+ https://bugs.webkit.org/show_bug.cgi?id=85190
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/ChromiumThreading.cpp:
+ (WTF::ChromiumThreading::callOnMainThread):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call monotonicallyIncreasingTime directly
+ https://bugs.webkit.org/show_bug.cgi?id=85189
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/ChromiumCurrentTime.cpp:
+ (WTF::monotonicallyIncreasingTime):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call userAgent directly
+ https://bugs.webkit.org/show_bug.cgi?id=85188
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::userAgent):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call currentTime directly
+ https://bugs.webkit.org/show_bug.cgi?id=85187
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/ChromiumCurrentTime.cpp:
+ (WTF::currentTime):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call currentThread directly
+ https://bugs.webkit.org/show_bug.cgi?id=85185
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/CCThreadImpl.cpp:
+ (WebKit::CCThreadImpl::CCThreadImpl):
+ * src/WebCompositorImpl.cpp:
+ (WebKit::WebCompositorImpl::initialize):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call createThread directly
+ https://bugs.webkit.org/show_bug.cgi?id=85186
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::runTest):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (Canvas2DLayerChromiumTest::fullLifecycleTest):
+
+2012-04-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Use new syntax to call createSocketStreamHandle directly
+ https://bugs.webkit.org/show_bug.cgi?id=85184
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/SocketStreamHandle.cpp:
+ (WebCore::SocketStreamHandleInternal::connect):
+
+2012-04-29 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call highUsageDeltaMB directly
+ https://bugs.webkit.org/show_bug.cgi?id=84844
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-28 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: InspectorFrontendHost.append has to be implemented for saving heap snapshots.
+ https://bugs.webkit.org/show_bug.cgi?id=85137
+
+ We can save a file with help of InspectorFrontendHost.save method,
+ but it is suitable only for relatively small portions of data and
+ can't process the 6Gb heap snapshot.
+ These methods just pass the url and content into embedder.
+
+ Reviewed by Yury Semikhatsky.
+
+ * public/WebDevToolsFrontendClient.h:
+ (WebKit::WebDevToolsFrontendClient::append):
+ * src/InspectorFrontendClientImpl.cpp:
+ (WebKit::InspectorFrontendClientImpl::append):
+ (WebKit):
+ * src/InspectorFrontendClientImpl.h:
+ (InspectorFrontendClientImpl):
+
+2012-04-28 Andrey Kosyakov <caseq@chromium.org>
+
+ [chromium] add frame boundaries instrumentation for the threaded compositor
+ https://bugs.webkit.org/show_bug.cgi?id=83926
+
+ - call instrumentBeginFrame() in a callback invoked by CCThreadProxy to fix frame marks in WebInspector's
+ timeline panel, currently broken for threaded compositor.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::willBeginFrame):
+
+2012-04-27 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r115529.
+ http://trac.webkit.org/changeset/115529
+ https://bugs.webkit.org/show_bug.cgi?id=85125
+
+ Broke Clang build (Requested by enne on #webkit).
+
+ * WebKit.gypi:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * tests/WebMediaPlayerClientImplTest.cpp: Removed.
+
+2012-04-27 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call highMemoryUsageMB directly
+ https://bugs.webkit.org/show_bug.cgi?id=84841
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-27 Adrienne Walker <enne@google.com>
+
+ [chromium] Allow WebMediaPlayerClientImpl to switch clients
+ https://bugs.webkit.org/show_bug.cgi?id=85093
+
+ Reviewed by James Robinson.
+
+ WebVideoFrameProviderClient has a 1:1 relationship with a
+ WebVideoFrameProvider. The client here is CCVideoLayerImpl and the
+ provider is WebMediaPlayerClientImpl. If the provider gets a new
+ client, then the old client needs to be informed to stop using the
+ provider.
+
+ If this doesn't happen, then the old client will have an unsafe
+ pointer to the provider, will not get informed if the provider gets
+ deleted, and the client will crash when it dereferences the provider
+ pointer trying to tell the provider that its client is going away.
+
+ Test: WebMediaPlayerClientImplTest.InitialNullVideoClient
+ WebMediaPlayerClientImplTest.SetAndUnsetVideoClient
+ WebMediaPlayerClientImplTest.DestroyProvider
+ WebMediaPlayerClientImplTest.SetMultipleVideoClients
+
+ * WebKit.gypi:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * tests/WebMediaPlayerClientImplTest.cpp: Added.
+ (WebKit):
+ (FakeWebMediaPlayerClientImpl):
+ (WebKit::FakeWebMediaPlayerClientImpl::create):
+ (WebKit::FakeWebMediaPlayerClientImpl::FakeWebMediaPlayerClientImpl):
+ (FakeVideoFrameProviderClient):
+ (WebKit::FakeVideoFrameProviderClient::create):
+ (WebKit::FakeVideoFrameProviderClient::~FakeVideoFrameProviderClient):
+ (WebKit::FakeVideoFrameProviderClient::didReceiveFrame):
+ (WebKit::FakeVideoFrameProviderClient::didUpdateMatrix):
+ (WebKit::FakeVideoFrameProviderClient::stopUsingProvider):
+ (WebKit::FakeVideoFrameProviderClient::provider):
+ (WebKit::FakeVideoFrameProviderClient::FakeVideoFrameProviderClient):
+ (WebKit::TEST):
+
+2012-04-27 Tony Chang <tony@chromium.org>
+
+ [chromium] Fix compiler warning in CCSchedulerTest.cpp with gcc 4.6.3
+ https://bugs.webkit.org/show_bug.cgi?id=85110
+
+ Reviewed by James Robinson.
+
+ Using gcc 4.6.3 (default on Precise), I get:
+ third_party/WebKit/Source/WebKit/chromium/tests/CCSchedulerTest.cpp:188:5: error: converting 'false' to pointer type
+ for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
+
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-04-27 Nat Duca <nduca@chromium.org>
+
+ Expose high-resolution on requestAnimationFrame callback
+ https://bugs.webkit.org/show_bug.cgi?id=66683
+
+ This changes requestAnimationFrame's animationStartTime argument
+ to be a high resolution DOM timestamp, per disucssion here:
+ http://lists.w3.org/Archives/Public/public-web-perf/2012Apr/0004.html
+
+ Reviewed by James Robinson.
+
+ * src/PageWidgetDelegate.cpp:
+ (WebKit::PageWidgetDelegate::animate):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::updateAnimations):
+
+2012-04-27 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call lowMemoryUsageMB directly
+ https://bugs.webkit.org/show_bug.cgi?id=84840
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-27 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Add pause and resume support for accelerated css animations.
+ https://bugs.webkit.org/show_bug.cgi?id=84601
+
+ Reviewed by James Robinson.
+
+ * tests/CCActiveAnimationTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-26 James Robinson <jamesr@chromium.org>
+
+ [chromium] Separate IOSurface layer type from texture layers
+ https://bugs.webkit.org/show_bug.cgi?id=85030
+
+ Reviewed by Adrienne Walker.
+
+ Update WebPluginContainerImpl to support having either a texture or IOSurface layer (but never both) depending
+ on the plugin's contents.
+
+ * WebKit.gyp:
+ * src/WebExternalTextureLayer.cpp:
+ * src/WebIOSurfaceLayer.cpp:
+ (WebKit):
+ (WebKit::WebIOSurfaceLayer::create):
+ (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties):
+ (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+
+2012-04-27 Hans Wennborg <hans@chromium.org>
+
+ Speech JavaScript API: Fix Vector use failure
+ https://bugs.webkit.org/show_bug.cgi?id=85069
+
+ Reviewed by Tony Gentilcore.
+
+ Fix think-o in code copying from WebVector to Vector.
+
+ * src/SpeechRecognitionClientProxy.cpp:
+ (WebKit::SpeechRecognitionClientProxy::didReceiveResult):
+ (WebKit::SpeechRecognitionClientProxy::didDeleteResult):
+ * src/WebSpeechRecognitionResult.cpp:
+ (WebKit::WebSpeechRecognitionResult::assign):
+
+2012-04-27 Leandro Gracia Gil <leandrogracia@chromium.org>
+
+ Selectively retrieve text around a touched point.
+ https://bugs.webkit.org/show_bug.cgi?id=82460
+
+ Reviewed by Darin Fisher.
+
+ Implements an embedding API to WebCore's SurroundingText, adding also
+ the possibility of select and highlight the retrieved text range.
+
+ * WebKit.gyp:
+ * public/WebFrame.h:
+ (WebFrame):
+ * public/WebHitTestResult.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebHitTestResult):
+ (WebKit::WebHitTestResult::WebHitTestResult):
+ (WebKit::WebHitTestResult::~WebHitTestResult):
+ * public/WebRange.h:
+ (WebKit):
+ (WebRange):
+ * public/WebSurroundingText.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSurroundingText):
+ (WebKit::WebSurroundingText::WebSurroundingText):
+ (WebKit::WebSurroundingText::~WebSurroundingText):
+ * public/WebView.h:
+ (WebKit):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::selectRange):
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+ * src/WebHitTestResult.cpp: Added.
+ (WebKit):
+ (WebKit::WebHitTestResult::node):
+ (WebKit::WebHitTestResult::localPoint):
+ (WebKit::WebHitTestResult::WebHitTestResult):
+ (WebKit::WebHitTestResult::operator=):
+ (WebKit::WebHitTestResult::operator HitTestResult):
+ (WebKit::WebHitTestResult::isNull):
+ (WebKit::WebHitTestResult::assign):
+ (WebKit::WebHitTestResult::reset):
+ * src/WebRange.cpp:
+ (WebKit::WebRange::textQuads):
+ (WebKit):
+ * src/WebSurroundingText.cpp: Added.
+ (WebKit):
+ (WebKit::WebSurroundingText::initialize):
+ (WebKit::WebSurroundingText::textContent):
+ (WebKit::WebSurroundingText::hitOffsetInTextContent):
+ (WebKit::WebSurroundingText::rangeFromContentOffsets):
+ (WebKit::WebSurroundingText::isNull):
+ (WebKit::WebSurroundingText::reset):
+
+2012-04-27 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r115463.
+ http://trac.webkit.org/changeset/115463
+ https://bugs.webkit.org/show_bug.cgi?id=82460
+
+ Broke Mac build.
+
+ * WebKit.gyp:
+ * public/WebFrame.h:
+ (WebFrame):
+ * public/WebHitTestResult.h: Removed.
+ * public/WebRange.h:
+ (WebRange):
+ * public/WebSurroundingText.h: Removed.
+ * public/WebView.h:
+ (WebKit):
+ * src/WebFrameImpl.cpp:
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+ * src/WebHitTestResult.cpp: Removed.
+ * src/WebRange.cpp:
+ * src/WebSurroundingText.cpp: Removed.
+
+2012-04-27 Kausalya Madhusudhanan <kmadhusu@chromium.org>
+
+ Added a chromium webkit public header file to support different web print scaling options.
+ https://bugs.webkit.org/show_bug.cgi?id=84608
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebPrintScalingOption.h: Added.
+ (WebKit):
+
+2012-04-27 Leandro Gracia Gil <leandrogracia@chromium.org>
+
+ Selectively retrieve text around a touched point.
+ https://bugs.webkit.org/show_bug.cgi?id=82460
+
+ Reviewed by Darin Fisher.
+
+ Implements an embedding API to WebCore's SurroundingText, adding also
+ the possibility of select and highlight the retrieved text range.
+
+ * WebKit.gyp:
+ * public/WebFrame.h:
+ (WebFrame):
+ * public/WebHitTestResult.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebHitTestResult):
+ (WebKit::WebHitTestResult::WebHitTestResult):
+ (WebKit::WebHitTestResult::~WebHitTestResult):
+ * public/WebRange.h:
+ (WebKit):
+ (WebRange):
+ * public/WebSurroundingText.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSurroundingText):
+ (WebKit::WebSurroundingText::WebSurroundingText):
+ (WebKit::WebSurroundingText::~WebSurroundingText):
+ * public/WebView.h:
+ (WebKit):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::selectRange):
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+ * src/WebHitTestResult.cpp: Added.
+ (WebKit):
+ (WebKit::WebHitTestResult::node):
+ (WebKit::WebHitTestResult::localPoint):
+ (WebKit::WebHitTestResult::WebHitTestResult):
+ (WebKit::WebHitTestResult::operator=):
+ (WebKit::WebHitTestResult::operator HitTestResult):
+ (WebKit::WebHitTestResult::isNull):
+ (WebKit::WebHitTestResult::assign):
+ (WebKit::WebHitTestResult::reset):
+ * src/WebRange.cpp:
+ (WebKit::WebRange::textQuads):
+ (WebKit):
+ * src/WebSurroundingText.cpp: Added.
+ (WebKit):
+ (WebKit::WebSurroundingText::initialize):
+ (WebKit::WebSurroundingText::textContent):
+ (WebKit::WebSurroundingText::hitOffsetInTextContent):
+ (WebKit::WebSurroundingText::rangeFromContentOffsets):
+ (WebKit::WebSurroundingText::isNull):
+ (WebKit::WebSurroundingText::reset):
+
+2012-04-27 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r115436.
+ http://trac.webkit.org/changeset/115436
+ https://bugs.webkit.org/show_bug.cgi?id=85079
+
+ "broke the build" (Requested by tonyg-cr on #webkit).
+
+ * WebKit.gyp:
+ * public/WebReferrerPolicy.h: Added.
+
+2012-04-27 Gavin Peters <gavinp@chromium.org>
+
+ Add new ENABLE_LINK_PRERENDER define to control the Prerendering API
+ https://bugs.webkit.org/show_bug.cgi?id=84871
+
+ Reviewed by Adam Barth.
+
+ Prerendering is currently covered by the ENABLE_LINK_PREFETCH macro, but the new Prerendering
+ API separates it from prefetching. Having separate include guards lets ports enable prefetching,
+ a relatively easy change, without needing to build the infrastructure for prerendering, which
+ is considerably more complicated.
+
+2012-04-27 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r115433.
+ http://trac.webkit.org/changeset/115433
+ https://bugs.webkit.org/show_bug.cgi?id=85052
+
+ Enable unit tests again.
+
+ * tests/PopupMenuTest.cpp:
+ (WebKit::TEST_F):
+
+2012-04-27 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r115421.
+ http://trac.webkit.org/changeset/115421
+ https://bugs.webkit.org/show_bug.cgi?id=85052
+
+ Enable unit tests again.
+
+ * tests/PopupMenuTest.cpp:
+ (WebKit::TEST_F):
+
+2012-04-27 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r115400.
+ http://trac.webkit.org/changeset/115400
+ https://bugs.webkit.org/show_bug.cgi?id=84420
+
+ Broke unit tests.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::popupOpened):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+
+2012-04-27 Gavin Peters <gavinp@chromium.org>
+
+ [Chromium] Remove Webkit/chromium/public/WebReferrerPolicy.h thunk.
+ https://bugs.webkit.org/show_bug.cgi?id=84552
+
+ After http://codereview.chromium.org/10139023/ lands, this thunk is no
+ longer needed.
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/WebReferrerPolicy.h: Removed.
+
+2012-04-27 Marcus Bulach <bulach@chromium.org>
+
+ [chromium] Disables a few more webkit_unittests.
+ https://bugs.webkit.org/show_bug.cgi?id=85052
+
+ Unreviewed build fix.
+
+ Failing on Windows bots, probably due to r115400.
+
+ * tests/PopupMenuTest.cpp:
+ (WebKit::TEST_F):
+
+2012-04-27 Marcus Bulach <bulach@chromium.org>
+
+ [chromium] Disables a few webkit_unittests.
+ https://bugs.webkit.org/show_bug.cgi?id=85052
+
+ Unreviewed build fix.
+
+ * tests/PopupMenuTest.cpp:
+ (WebKit::TEST_F):
+
+2012-04-24 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move ProgramBinding definitions to LayerRendererChromium and normalize naming
+ https://bugs.webkit.org/show_bug.cgi?id=84808
+
+ Reviewed by Adrienne Walker.
+
+ Add some includes needed by this test that were previously picked up by upstream headers.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+
+2012-04-26 Ilya Sherman <isherman@chromium.org>
+
+ [Chromium] Security: Autofill info can be captured by innocuous social engineering
+ Prevent users from interacting with invisible popups rendered outside the main frame's contents view.
+ https://bugs.webkit.org/show_bug.cgi?id=84420
+ https://code.google.com/p/chromium/issues/detail?id=122925
+
+ Reviewed by Kent Tamura.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::popupOpened): Hide popups rendered outside the main frame's contents view.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions): Fix up order of operations to support immediately hiding a popup if it would not be visible
+
+2012-04-26 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Some background filters require inflating damage on the surface behind them
+ https://bugs.webkit.org/show_bug.cgi?id=84479
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-04-26 Aaron Colwell <acolwell@chromium.org>
+
+ Cleanup WebMediaPlayer enum values that didn't match Chromium style guidelines
+ https://bugs.webkit.org/show_bug.cgi?id=84998
+
+ Reviewed by Darin Fisher.
+
+ * public/WebMediaPlayer.h:
+ (WebKit::WebMediaPlayer::generateKeyRequest):
+ (WebKit::WebMediaPlayer::addKey):
+ (WebKit::WebMediaPlayer::cancelKeyRequest):
+
+2012-04-26 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] re-implement backFaceVisibility to avoid dealing with perspective w<0 problem
+ https://bugs.webkit.org/show_bug.cgi?id=84059
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/CCMathUtilTest.cpp: Added.
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-26 Justin Novosad <junov@chromium.org>
+
+ [Chromium] Single buffered canvas layers with the threaded compositor
+ https://bugs.webkit.org/show_bug.cgi?id=80540
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::AcquireLayerTextures):
+ (CCLayerTreeHostTest):
+ (WTF::CCLayerTreeHostTest::dispatchAcquireLayerTextures):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestWriteLayersRedraw):
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::CCLayerTreeHostTestWriteLayersRedraw):
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::beginTest):
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestWriteLayersRedraw::afterTest):
+ (CCLayerTreeHostTestWriteLayersAfterVisible):
+ (WTF::CCLayerTreeHostTestWriteLayersAfterVisible::CCLayerTreeHostTestWriteLayersAfterVisible):
+ (WTF::CCLayerTreeHostTestWriteLayersAfterVisible::beginTest):
+ (WTF::CCLayerTreeHostTestWriteLayersAfterVisible::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestWriteLayersAfterVisible::afterTest):
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (Canvas2DLayerChromiumTest::fullLifecycleTest):
+
+2012-04-26 Joshua Bell <jsbell@chromium.org>
+
+ [Chromium] IndexedDB: Use WebIDBKeyPath type for key paths in WebKit API
+ https://bugs.webkit.org/show_bug.cgi?id=84631
+
+ Reviewed by James Robinson.
+
+ WebIDBKeyPath was previously a utility class for parsing key paths into components,
+ but the API exposed key paths only as nullable strings. To support array-type keypaths,
+ WebIDBKeyPath becomes a value class with type flags. For landing, several legacy methods
+ are retained but will be cleaned up after all callers have been updated, tracked as
+ the bug: http://webkit.org/b/84207
+
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::createObjectStore): Add WebIDBKeyPath overload; WebString overload delegates so implementers can switch.
+ * public/WebIDBIndex.h:
+ (WebKit::WebIDBIndex::keyPath): Calls keyPathString if not overridden.
+ (WebKit::WebIDBIndex::keyPathString): Comment change.
+ * public/WebIDBKeyPath.h:
+ (WebKit::WebIDBKeyPath::create): Overload added for creating array-type key paths.
+ (WebKit::WebIDBKeyPath::array): Accessor for array-type key paths.
+ (WebKit::WebIDBKeyPath::operator const WebString ): Temporary, for compatibility.
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::keyPath): Calls keyPathString if not overridden.
+ (WebKit::WebIDBObjectStore::keyPathString): Comment change.
+ (WebKit::WebIDBObjectStore::createIndex): Add WebIDBKeyPath overload; WebString overload delegates so implementers can switch.
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKitPlatformSupport): WebIDBKeyPath overloads for these methods added, delegate to WebString version until implementers are updated.
+ (WebKit::WebKitPlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath):
+ (WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
+ * src/IDBIndexBackendProxy.cpp:
+ (WebKit::IDBIndexBackendProxy::keyPath): Returns the string version until WebCore is updated.
+ * src/IDBObjectStoreBackendProxy.cpp:
+ (WebKit::IDBObjectStoreBackendProxy::keyPath): Returns the string version until WebCore is updated.
+ * src/WebIDBDatabaseImpl.h:
+ (WebIDBDatabaseImpl): Add createObjectStore overload for WebIDBKeyPath type, delegates to WebString version until callers are updated.
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::keyPath): Implements the new WebIDBKeyPath return type.
+ (WebKit):
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl): Implements the new WebIDBKeyPath return type.
+ * src/WebIDBKeyPath.cpp:
+ (WebKit::WebIDBKeyPath::create): Support null key path types.
+ (WebKit::WebIDBKeyPath::createNull): New API.
+ (WebKit):
+ (WebKit::WebIDBKeyPath::isValid): New API.
+ (WebKit::WebIDBKeyPath::type): New API.
+ (WebKit::WebIDBKeyPath::string): New API (value accessor).
+ (WebKit::WebIDBKeyPath::WebIDBKeyPath):
+ (WebKit::WebIDBKeyPath::assign): This API will be removed.
+ (WebKit::WebIDBKeyPath::operator const WTF::Vector<WTF::String, 0>&): Ensure it is non-null - only used in copy constructor which guards against this.
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::keyPath): Implement the new WebIDBKeyPath return type.
+ (WebKit):
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl): Add createIndex overload for WebIDBKeyPath type, delegates to WebString version until callers are updated.
+
+2012-04-26 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [CRASH] WebViewImpl::setZoomLevel when emulating device metrics
+ https://bugs.webkit.org/show_bug.cgi?id=84938
+
+ Check for the presence of a live Frame/FrameView before invoking methods that depend on them.
+
+ Reviewed by Yury Semikhatsky.
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::restore):
+
+2012-04-25 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove guarded virtual methods from WebFilterOperation API
+ https://bugs.webkit.org/show_bug.cgi?id=84926
+
+ Reviewed by James Robinson.
+
+ * src/AssertMatchingEnums.cpp:
+
+2012-04-25 James Robinson <jamesr@chromium.org>
+
+ [chromium] REGRESSION(112286) Compositor initialization blocks for program compilation / linking
+ https://bugs.webkit.org/show_bug.cgi?id=84822
+
+ Reviewed by Adrienne Walker.
+
+ Add a test that makes sure we don't make blocking calls during LayerRendererChromium initialization.
+
+ * tests/LayerRendererChromiumTest.cpp:
+ (ForbidSynchronousCallContext):
+ (ForbidSynchronousCallContext::ForbidSynchronousCallContext):
+ (ForbidSynchronousCallContext::finish):
+ (ForbidSynchronousCallContext::getActiveAttrib):
+ (ForbidSynchronousCallContext::getActiveUniform):
+ (ForbidSynchronousCallContext::getAttachedShaders):
+ (ForbidSynchronousCallContext::getAttribLocation):
+ (ForbidSynchronousCallContext::getBooleanv):
+ (ForbidSynchronousCallContext::getBufferParameteriv):
+ (ForbidSynchronousCallContext::getContextAttributes):
+ (ForbidSynchronousCallContext::getError):
+ (ForbidSynchronousCallContext::getFloatv):
+ (ForbidSynchronousCallContext::getFramebufferAttachmentParameteriv):
+ (TEST):
+
+2012-04-25 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: implement cursor.advance()
+ https://bugs.webkit.org/show_bug.cgi?id=84174
+
+ Reviewed by Ojan Vafai.
+
+ Hook up chromium IPC to IDBCursor.advance().
+
+ * src/IDBCursorBackendProxy.cpp:
+ (WebKit::IDBCursorBackendProxy::advance):
+ (WebKit):
+ * src/IDBCursorBackendProxy.h:
+ (IDBCursorBackendProxy):
+ * src/WebIDBCursorImpl.cpp:
+ (WebKit::WebIDBCursorImpl::advance):
+
+2012-04-25 Alpha Lam <hclam@chromium.org>
+
+ Unreviewed, rolling out r115262.
+ http://trac.webkit.org/changeset/115262
+ https://bugs.webkit.org/show_bug.cgi?id=84631
+
+ r115262 is causing link error in WebKit Win Builder (dbg)
+
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::createObjectStore):
+ * public/WebIDBIndex.h:
+ (WebKit::WebIDBIndex::keyPath):
+ (WebKit::WebIDBIndex::keyPathString):
+ * public/WebIDBKeyPath.h:
+ (WebKit):
+ (WebIDBKeyPath):
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::keyPath):
+ (WebKit::WebIDBObjectStore::keyPathString):
+ (WebKit::WebIDBObjectStore::createIndex):
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit::WebKitPlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath):
+ (WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
+ * src/IDBIndexBackendProxy.cpp:
+ (WebKit::IDBIndexBackendProxy::keyPath):
+ * src/IDBObjectStoreBackendProxy.cpp:
+ (WebKit::IDBObjectStoreBackendProxy::keyPath):
+ * src/WebIDBDatabaseImpl.h:
+ (WebIDBDatabaseImpl):
+ * src/WebIDBIndexImpl.cpp:
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl):
+ * src/WebIDBKeyPath.cpp:
+ (WebKit::WebIDBKeyPath::create):
+ (WebKit::WebIDBKeyPath::assign):
+ (WebKit::WebIDBKeyPath::operator const WTF::Vector<WTF::String, 0>&):
+ * src/WebIDBObjectStoreImpl.cpp:
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl):
+ (WebKit::WebIDBObjectStoreImpl::createIndex):
+
+2012-04-24 Adrienne Walker <enne@google.com>
+
+ [chromium] Prevent CCLayerImpl::willDraw/didDraw mismatches
+ https://bugs.webkit.org/show_bug.cgi?id=84812
+
+ Reviewed by James Robinson.
+
+ Update all tests to call CCLayerTreeHostImpl::didDrawAllLayers if they
+ call CCLayerTreeHostImpl::prepareToDraw.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::CCLayerTreeHostImplTest::initializeLayerRendererAndDrawFrame):
+ (WebKitTests::TEST_F):
+
+2012-04-25 Joshua Bell <jsbell@chromium.org>
+
+ [Chromium] IndexedDB: Use WebIDBKeyPath type for key paths in WebKit API
+ https://bugs.webkit.org/show_bug.cgi?id=84631
+
+ Reviewed by James Robinson.
+
+ WebIDBKeyPath was previously a utility class for parsing key paths into components,
+ but the API exposed key paths only as nullable strings. To support array-type keypaths,
+ WebIDBKeyPath becomes a value class with type flags. For landing, several legacy methods
+ are retained but will be cleaned up after all callers have been updated, tracked as
+ the bug: http://webkit.org/b/84207
+
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::createObjectStore): Add WebIDBKeyPath overload; WebString overload delegates so implementers can switch.
+ * public/WebIDBIndex.h:
+ (WebKit::WebIDBIndex::keyPath): Calls keyPathString if not overridden.
+ (WebKit::WebIDBIndex::keyPathString): Comment change.
+ * public/WebIDBKeyPath.h:
+ (WebKit::WebIDBKeyPath::create): Overload added for creating array-type key paths.
+ (WebKit::WebIDBKeyPath::array): Accessor for array-type key paths.
+ (WebKit::WebIDBKeyPath::operator const WebString ): Temporary, for compatibility.
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::keyPath): Calls keyPathString if not overridden.
+ (WebKit::WebIDBObjectStore::keyPathString): Comment change.
+ (WebKit::WebIDBObjectStore::createIndex): Add WebIDBKeyPath overload; WebString overload delegates so implementers can switch.
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKitPlatformSupport): WebIDBKeyPath overloads for these methods added, delegate to WebString version until implementers are updated.
+ (WebKit::WebKitPlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath):
+ (WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
+ * src/IDBIndexBackendProxy.cpp:
+ (WebKit::IDBIndexBackendProxy::keyPath): Returns the string version until WebCore is updated.
+ * src/IDBObjectStoreBackendProxy.cpp:
+ (WebKit::IDBObjectStoreBackendProxy::keyPath): Returns the string version until WebCore is updated.
+ * src/WebIDBDatabaseImpl.h:
+ (WebIDBDatabaseImpl): Add createObjectStore overload for WebIDBKeyPath type, delegates to WebString version until callers are updated.
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::keyPath): Implements the new WebIDBKeyPath return type.
+ (WebKit):
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl): Implements the new WebIDBKeyPath return type.
+ * src/WebIDBKeyPath.cpp:
+ (WebKit::WebIDBKeyPath::create): Support null key path types.
+ (WebKit::WebIDBKeyPath::createNull): New API.
+ (WebKit):
+ (WebKit::WebIDBKeyPath::isValid): New API.
+ (WebKit::WebIDBKeyPath::type): New API.
+ (WebKit::WebIDBKeyPath::string): New API (value accessor).
+ (WebKit::WebIDBKeyPath::WebIDBKeyPath):
+ (WebKit::WebIDBKeyPath::assign): This API will be removed.
+ (WebKit::WebIDBKeyPath::operator const WTF::Vector<WTF::String, 0>&): Ensure it is non-null - only used in copy constructor which guards against this.
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::keyPath): Implement the new WebIDBKeyPath return type.
+ (WebKit):
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl): Add createIndex overload for WebIDBKeyPath type, delegates to WebString version until callers are updated.
+
+2012-04-25 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Add support for animation finished events.
+ https://bugs.webkit.org/show_bug.cgi?id=84454
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestHooks::notifyAnimationFinished):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestAnimationFinishedEvents):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::CCLayerTreeHostTestAnimationFinishedEvents):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::beginTest):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::notifyAnimationFinished):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::afterTest):
+
+2012-04-25 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Do not clobber synchronized start times.
+ https://bugs.webkit.org/show_bug.cgi?id=84605
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests):
+ (WebKitTests::TEST):
+
+2012-04-25 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call actualMemoryUsageMB directly
+ https://bugs.webkit.org/show_bug.cgi?id=84837
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-25 Alexis Menard <alexis.menard@openbossa.org>
+
+ Rename CSSStyleSelector files to StyleResolver.
+ https://bugs.webkit.org/show_bug.cgi?id=84814
+
+ Reviewed by Antti Koivisto.
+
+ Rename CSSStyleSelector files to match the new class name StyleResolver.
+ Update the includes all over the code base to the new name.
+
+ * src/AutofillPopupMenuClient.cpp:
+ * src/WebViewImpl.cpp:
+
+2012-04-25 Gavin Peters <gavinp@chromium.org>
+
+ [Chromium] Fix some conditional compilation logic in Platform
+ https://bugs.webkit.org/show_bug.cgi?id=83798
+
+ Reviewed by Darin Fisher.
+
+ * tests/WebFrameTest.cpp:
+ (WebKit::TestReloadDoesntRedirectWebFrameClient::cancelledError):
+
+2012-04-25 Yury Semikhatsky <yurys@chromium.org>
+
+ Web Inspector: move HeapSnapshotLoader into a separate file
+ https://bugs.webkit.org/show_bug.cgi?id=84860
+
+ Extracted HeapSnapshotLoader into its own file.
+
+ Reviewed by Pavel Feldman.
+
+ * WebKit.gyp:
+
+2012-04-25 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Animations waiting for a synchronized start time should never be marked finished.
+ https://bugs.webkit.org/show_bug.cgi?id=84519
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-25 Gavin Peters <gavinp@chromium.org>
+
+ Move WebReferrerPolicy.h from WebKit to Platform
+ https://bugs.webkit.org/show_bug.cgi?id=84539
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/WebContextMenuData.h:
+ * public/WebFrame.h:
+ * public/WebReferrerPolicy.h:
+ * public/WebSecurityPolicy.h:
+ * public/platform/WebReferrerPolicy.h: Copied from Source/WebKit/chromium/public/WebReferrerPolicy.h.
+ * src/AssertMatchingEnums.cpp:
+
+2012-04-24 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Unbounded draws should use clip to limit their damage to opaque tracking
+ https://bugs.webkit.org/show_bug.cgi?id=84494
+
+ Reviewed by Adrienne Walker.
+
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-04-24 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Image masks are considered opaque incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=84275
+
+ Reviewed by Adrienne Walker.
+
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-24 Alexis Menard <alexis.menard@openbossa.org>
+
+ Replace occurences of style selector from variables and methods names by style resolver.
+ https://bugs.webkit.org/show_bug.cgi?id=84765
+
+ Reviewed by Andreas Kling.
+
+ Rename methods and variables to follow the new name StyleResolver. It requires to update the
+ local variables, methods parameters, and function names to match the new name and to remove
+ the concept of "selector" to avoid clashing with the CSS concept. The next and last patch
+ will be to rename CSSStyleSelector file and update the includes.
+
+ * src/AutofillPopupMenuClient.cpp:
+ (WebKit::AutofillPopupMenuClient::fontSelector):
+ (WebKit::AutofillPopupMenuClient::initialize):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidth):
+ (WebKit::DeviceMetricsSupport::applySizeOverrideInternal):
+
+2012-04-24 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Implement WebCore::dateFormat{DayInMonth,Month,Year}Text()
+ https://bugs.webkit.org/show_bug.cgi?id=84683
+
+ Reviewed by Dimitri Glazkov.
+
+ * public/platform/WebLocalizedString.h:
+ Add DateFormat{DayInMonth,Month,Year}Label
+ * src/LocalizedStrings.cpp:
+ (WebCore::dateFormatYearText): Implemented.
+ (WebCore::dateFormatMonthText): ditto.
+ (WebCore::dateFormatDayInMonthText): ditto.
+
+2012-04-24 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Create a new flag for PeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=84723
+
+ Reviewed by Dimitri Glazkov.
+
+ To allow Chrome to make the GetUserMedia functionality available by default we
+ need another flag for the PeerConnection related parts. This new flag is in
+ addition to the general media stream flag, and both need to be enabled for
+ PeerConnection object creation.
+
+ * public/WebRuntimeFeatures.h:
+ (WebRuntimeFeatures):
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enablePeerConnection):
+ (WebKit):
+ (WebKit::WebRuntimeFeatures::isPeerConnectionEnabled):
+
+2012-04-24 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Don't keep pointers to released layer tree
+ https://bugs.webkit.org/show_bug.cgi?id=84715
+
+ Reviewed by Adrienne Walker.
+
+ Added new unit test to check that we can keep scrolling even if the layer
+ tree is replaced from under us.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-04-24 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-04-24 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r115000.
+ http://trac.webkit.org/changeset/115000
+ https://bugs.webkit.org/show_bug.cgi?id=84703
+
+ Breaks webkit_unit_tests on Mac in Chromium:
+ http://build.chromium.org/p/chromium.webkit/builders/Webkit%20Mac10.6/builds/15157
+ (Requested by mnaganov on #webkit).
+
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-23 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Image masks are considered opaque incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=84275
+
+ Reviewed by Adrienne Walker.
+
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-23 Kent Tamura <tkent@chromium.org>
+
+ Show the format indicator in a date field
+ https://bugs.webkit.org/show_bug.cgi?id=83872
+
+ Reviewed by Hajime Morita.
+
+ * src/LocalizedStrings.cpp:
+ (WebCore::dateFormatYearText): Added a stub.
+ (WebCore::dateFormatMonthText): ditto.
+ (WebCore::dateFormatDayInMonthText): ditto.
+
+2012-04-23 Michael Nordman <michaeln@google.com>
+
+ [chromium] DomStorage event handling mods.
+ https://bugs.webkit.org/show_bug.cgi?id=84387
+
+ Events are currently handled inconsistently. The dispatch of some events are
+ initiated from within webkit/webcore, the dispatch of other events are initiated
+ from the outside via the WebKit::WebStorageEventDispatcher interface. The existing
+ WebStorageEventDispatcher is not expressive enough to handle initiation all
+ events from the outside. There's a chunk of nearly replicated code in there
+ that shouldn't be. The existing code has several FIXMEs related to making
+ this better.
+
+ The current state of things in webkit/webcore is also blocking development of some
+ overall performance improvements to chromium's implemention of this feature (getting
+ rid of sync ipcs for each access and adding a renderer-side caching layer).
+
+ To facilitate the perf improvements, this patch adds WebKit API to allow all
+ DomStorage events to be initiated from the outside. This is needed because
+ there will be an async latency between setting an item and receiving the
+ 'oldValue' from the main browser process which is required to raise the
+ mutation event.
+
+ This is the first of a multi-sided sequence of patches to make this transition.
+ wkpatch 1: add the new wider WebKit API and impl
+ crpatch 2: start using the new wider WebKit API
+ wkpatch 3: cleanup, delete the old WebKit API and impl
+ xxxxxxx 4/5: cleanup, remove extra params from new API whose only purpose was to allow the transition
+
+ Reviewed by Dimitri Glazkov.
+
+ * public/WebStorageEventDispatcher.h: Add new API to dispatch events.
+ * public/WebStorageNamespace.h: Add new API to test for namespace equality.
+ * src/StorageAreaProxy.cpp:
+ (WebCore::StorageAreaProxy::dispatchLocalStorageEvent): implementation of the new API
+ (WebCore::StorageAreaProxy::dispatchSessionStorageEvent): implementation of the new API
+ (WebCore::StorageAreaProxy::IsEventSource): a helper method
+ (WebCore::StorageAreaProxy::FindPageWithSessionStorageNamespace): a helper method
+ * src/StorageAreaProxy.h:
+ * src/StorageEventDispatcherImpl.cpp: added a FIXME comment to delete soon
+ * src/StorageNamespaceProxy.cpp:
+ (WebCore::StorageNamespaceProxy::IsSameNamespace): plumbing to call the new API
+ * src/StorageNamespaceProxy.h:
+ * src/WebStorageEventDispatcherImpl.cpp:
+ (WebKit::WebStorageEventDispatcher::dispatchLocalStorageEvent): plumbing to call the new impl
+ (WebKit::WebStorageEventDispatcher::dispatchSessionStorageEvent): plumbing to call the new impl
+ * src/WebStorageEventDispatcherImpl.h: added a FIXME comment to delete soon
+
+2012-04-23 Kenneth Russell <kbr@google.com>
+
+ Change ImageData to reference Uint8ClampedArray rather than CanvasPixelArray
+ https://bugs.webkit.org/show_bug.cgi?id=73011
+
+ Reviewed by Oliver Hunt.
+
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore::GraphicsContext3DPrivate::paintRenderingResultsToImageData):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::doPixelReadbackToCanvas):
+
+2012-04-23 Kent Tamura <tkent@chromium.org>
+
+ Crash when the page with a calendar picker is scrolled
+ https://bugs.webkit.org/show_bug.cgi?id=84287
+
+ Reviewed by Hajime Morita.
+
+ Use the same ownership model as WebPopupMenuImpl's.
+
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::close):
+ Clear m_widgetClient to avoid furthur access to it. deref instead of delete.
+ (WebKit::WebPagePopupImpl::closePopup):
+ Do not call closeWidgetSoon() if close() was already called.
+ (WebKit::WebPagePopup::create):
+ Add a reference. Add explanation of the ownership.
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl): Make this RefCounted. Make the destuctor public.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl): No need to clear m_pagePopup explicitly.
+ (WebKit::WebViewImpl::openPagePopup): Need to use .get() because m_pagePopup is a RefPtr.
+ (WebKit::WebViewImpl::closePagePopup): ditto.
+ (WebKit::WebViewImpl::hidePopups): ditto.
+ * src/WebViewImpl.h: Make m_pagePopup a RefPtr.
+
+2012-04-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use TextureLayerChromium for WebGL content instead of a dedicated layer type
+ https://bugs.webkit.org/show_bug.cgi?id=84311
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * src/WebExternalTextureLayer.cpp:
+ (WebKit::WebExternalTextureLayer::create):
+ * src/WebLayer.cpp:
+ * tests/WebGLLayerChromiumTest.cpp: Removed.
+ * tests/WebLayerTest.cpp:
+
+2012-04-23 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: remove IDB(Index|ObjectStore)BackendImpl::get/getKey for IDBKey
+ https://bugs.webkit.org/show_bug.cgi?id=84285
+
+ Reviewed by Dimitri Glazkov.
+
+ This is old code supporting IDBKey-based lookup, supplanted by
+ IDBKeyRange. Now that chromium IPC/proxy code has landed,
+ these functions can be removed.
+
+ * public/WebIDBIndex.h:
+ * public/WebIDBObjectStore.h:
+ * src/IDBIndexBackendProxy.cpp:
+ * src/IDBIndexBackendProxy.h:
+ (IDBIndexBackendProxy):
+ * src/IDBObjectStoreBackendProxy.cpp:
+ * src/IDBObjectStoreBackendProxy.h:
+ (IDBObjectStoreBackendProxy):
+ * src/WebIDBIndexImpl.cpp:
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl):
+ * src/WebIDBObjectStoreImpl.cpp:
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl):
+
+2012-04-23 Eriq Augustine <eaugusti@chromium.org>
+
+ Return value from executed script in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=79851
+
+ Reviewed by Adam Barth.
+
+ Providing a variant of evaluateScriptInIsolatedWorld that
+ returns the value of the evaluated script.
+
+ * public/WebFrame.h:
+ (WebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::executeScriptInIsolatedWorldAndReturnValues):
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebKit):
+ (WebFrameImpl):
+
+2012-04-23 Raymond Toy <rtoy@google.com>
+
+ Move AudioDestinationChromium FIFO class to its own class.
+ https://bugs.webkit.org/show_bug.cgi?id=84058
+
+ Reviewed by Chris Rogers.
+
+ Remove private FIFO class and use new AudioPullFIFO class.
+ * src/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+ * src/AudioDestinationChromium.h:
+ (AudioDestinationChromium):
+
+2012-04-23 Dmitry Titov <dimich@chromium.org>
+
+ Chromium roll 133422:133506.
+ Not reviewed.
+
+ * DEPS:
+
+2012-04-23 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Properly ignore unsupported animation directions.
+ https://bugs.webkit.org/show_bug.cgi?id=84599
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-23 Ian Vollick <vollick@chromium.org>
+
+ [chromium] When prepareToDraw fails due to animation checkerboard, we need to call setNeedsCommit
+ https://bugs.webkit.org/show_bug.cgi?id=84520
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-04-23 Mikhail Naganov <mnaganov@chromium.org>
+
+ Chromium roll from r133348 to r133422.
+
+ * DEPS:
+
+2012-04-23 Gavin Peters <gavinp@chromium.org>
+
+ Move ReferrerPolicy out of SecurityPolicy class into its own header in platform.
+ https://bugs.webkit.org/show_bug.cgi?id=84516
+
+
+ Reviewed by Adam Barth.
+
+ No change in behaviour; same enum, different class.
+
+ * src/AssertMatchingEnums.cpp:
+ * src/WebSecurityPolicy.cpp:
+ (WebKit::WebSecurityPolicy::generateReferrerHeader):
+
+2012-04-22 Andreas Kling <kling@webkit.org>
+
+ Optimize Element attribute storage for the common case (no Attr objects.)
+ <http://webkit.org/b/83440>
+
+ Reviewed by Antti Koivisto.
+
+ Remove the WebNamedNodeMap and WebAttribute API classes since they are no
+ longer needed by chromium after <http://crrev.com/133299>.
+
+ * WebKit.gyp:
+ * public/WebAttribute.h: Removed.
+ * public/WebElement.h:
+ * public/WebNamedNodeMap.h: Removed.
+ * src/WebAttribute.cpp: Removed.
+ * src/WebElement.cpp:
+ * src/WebNamedNodeMap.cpp: Removed.
+
+2012-04-22 Mikhail Naganov <mnaganov@chromium.org>
+
+ [Chromium] Fix clang build after r114827, unreviewed.
+
+ * tests/LayerTextureUpdaterTest.cpp:
+ (WebCore::TEST):
+
+2012-04-22 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Damage Tracker needs to use CCMathUtil transforms
+ https://bugs.webkit.org/show_bug.cgi?id=84070
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-04-21 Ryosuke Niwa <rniwa@webkit.org>
+
+ Chromium roll attempt from r133173 to r133348.
+
+ * DEPS:
+
+2012-04-20 Adrienne Walker <enne@google.com>
+
+ [chromium] Refactor opaque content transform out of Skia context
+ https://bugs.webkit.org/show_bug.cgi?id=83608
+
+ Reviewed by James Robinson.
+
+ Add tests for opaque tracking in LayerTextureUpdater, since the
+ transform logic has moved there.
+
+ * tests/CCTiledLayerTestCommon.cpp:
+ (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate):
+ * tests/CCTiledLayerTestCommon.h:
+ (FakeLayerTextureUpdater):
+ * tests/LayerTextureUpdaterTest.cpp:
+ (WebCore::PaintFillPartialOpaque::PaintFillPartialOpaque):
+ (PaintFillPartialOpaque):
+ (WebCore::PaintFillPartialOpaque::operator()):
+ (WebCore):
+ (WebCore::TEST):
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore::TEST):
+
+2012-04-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove special case for recreating layers during sync
+ https://bugs.webkit.org/show_bug.cgi?id=84458
+
+ Reviewed by James Robinson.
+
+ * tests/TreeSynchronizerTest.cpp:
+
+2012-04-20 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: Support get/getKey(keyRange)
+ https://bugs.webkit.org/show_bug.cgi?id=83638
+
+ Reviewed by Ojan Vafai.
+
+ Hook up WebKit API to the new get/getKey implementations.
+
+ * src/IDBIndexBackendProxy.cpp:
+ (WebKit::IDBIndexBackendProxy::get):
+ (WebKit):
+ (WebKit::IDBIndexBackendProxy::getKey):
+ * src/IDBIndexBackendProxy.h:
+ (IDBIndexBackendProxy):
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::getObject):
+ (WebKit::WebIDBIndexImpl::getKey):
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::get):
+
+2012-04-20 Brady Eidson <beidson@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=84512
+ Repurpose ActiveDOMObject::WillShowDialog to WillDeferLoading
+
+ Reviewed by Eric Carlson.
+
+ PageGroupLoadDeferrer's don't take a ReasonForSuspension argument anymore;
+ They just use WillDeferLoading by default.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebView::willEnterModalLoop):
+
+2012-04-20 James Robinson <jamesr@chromium.org>
+
+ [chromium] Plumb a compositor surface ready notification through to the threaded compositor
+ https://bugs.webkit.org/show_bug.cgi?id=84305
+
+ Reviewed by Adrienne Walker.
+
+ Adds a notification to WebWidget for when the compositor surface is ready to use. This exists to fix a race
+ condition when WebKit requires that we enter compositing mode but we haven't completed initialization of the
+ native window/etc backing the WebWidget, and we can't block for this initialization to complete without inducing
+ deadlocks. In this situation, we proceed as usual except that we can't attempt to use the compositor context or
+ it will fail.
+
+ * public/WebWidget.h:
+ (WebWidget):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setSurfaceReady):
+ (WebKit):
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::setCompositorSurfaceReady):
+ (WebKit):
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl):
+ * src/WebPopupMenuImpl.cpp:
+ (WebKit::WebPopupMenuImpl::setCompositorSurfaceReady):
+ (WebKit):
+ * src/WebPopupMenuImpl.h:
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setCompositorSurfaceReady):
+ (WebKit):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
+2012-04-20 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call memoryUsageMB directly
+ https://bugs.webkit.org/show_bug.cgi?id=84376
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-20 Adrienne Walker <enne@google.com>
+
+ [chromium] Clip TransparencyWin to prevent OOM from large Skia canvas
+ https://bugs.webkit.org/show_bug.cgi?id=84289
+
+ Reviewed by James Robinson.
+
+ Add a test that would OOM if the layer wasn't clipped. Also, verify
+ that clipping the canvas doesn't shift pixels around incorrectly.
+
+ * tests/TransparencyWinTest.cpp:
+ (WebCore::testClippedLayerKeepTransform):
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-20 Brady Eidson <beidson@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=84490
+ PageGroupLoadDeferrer needs to take a ReasonForSuspension argument
+
+ Reviewed by Anders Carlsson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebView::willEnterModalLoop): Pass along ActiveDOMObject::WillShowDialog, which used
+ to be the default.
+
+2012-04-20 James Robinson <jamesr@chromium.org>
+
+ Avoid synchronously recalculating the nonFastScrollableRegion when the ScrollableArea set changes
+ https://bugs.webkit.org/show_bug.cgi?id=84470
+
+ Reviewed by Anders Carlsson.
+
+ Trigger a layout when a plugin becomes or stops being scrollable so the nonFastScrollableRegion
+ can be updated.
+
+ * src/ScrollbarGroup.cpp:
+ (WebKit::ScrollbarGroup::scrollbarCreated):
+ (WebKit::ScrollbarGroup::scrollbarDestroyed):
+
+2012-04-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Some filters require inflating damage rect in CCDamageTracker
+ https://bugs.webkit.org/show_bug.cgi?id=84373
+
+ Reviewed by James Robinson.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::emulateDrawingOneFrame):
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-04-20 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Don't crash when scrolling empty layer tree
+ https://bugs.webkit.org/show_bug.cgi?id=84455
+
+ Reviewed by James Robinson.
+
+ Try to scroll an empty layer tree.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-04-20 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-04-20 'Pavel Feldman' <pfeldman@chromium.org>
+
+ Not reviewed: fixed chromium sanity tests for inspector via assigning last path component
+ to entire url for parsed urls with invalid specs.
+
+ * src/js/Tests.js:
+ (.TestSuite.prototype._scriptsAreParsed):
+
+2012-04-20 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call cacheMetadata directly
+ https://bugs.webkit.org/show_bug.cgi?id=84415
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-20 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call stopSharedTimer directly
+ https://bugs.webkit.org/show_bug.cgi?id=84418
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-19 Jeremy Mao <yujie.mao@intel.com>
+
+ Media Stream API: Piece of code cleanup for the chromium port
+ https://bugs.webkit.org/show_bug.cgi?id=84328
+
+ Reviewed by Kent Tamura.
+
+ Remove some deprecated interfaces.
+
+ No new tests. No behavior changes.
+
+ * public/WebUserMediaClient.h:
+ Remove deprecated requestUserMedia interface.
+ * public/WebUserMediaRequest.h:
+ Remove deprecated requestSucceeded interface.
+ * src/UserMediaClientImpl.cpp:
+ (WebKit::UserMediaClientImpl::requestUserMedia):
+ Use the requestUserMedia split sources implementation.
+ * src/WebUserMediaRequest.cpp:
+ Remove deprecated requestSucceeded implementation.
+
+2012-04-19 Joshua Bell <jsbell@chromium.org>
+
+ [Chromium] IndexedDB: Prep for changing keyPath return type
+ https://bugs.webkit.org/show_bug.cgi?id=84208
+
+ To introduce Array-type key paths (see http://webkit.org/b/84207) the keyPath() accessors
+ on WebIDBObjectStore and WebIDBIndex need to change return type. To do so requires temporarily
+ changing the method names to keyPathString with compatibility shims (on the WebKit side)
+ then switching the implementation in the Chromium port in a follow-up patch.
+
+ Reviewed by Kent Tamura.
+
+ * public/WebIDBIndex.h:
+ (WebKit::WebIDBIndex::keyPath):
+ (WebKit::WebIDBIndex::keyPathString):
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::keyPath):
+ (WebKit::WebIDBObjectStore::keyPathString):
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::keyPathString):
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl):
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::keyPathString):
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl):
+
+2012-04-19 Andreas Kling <kling@webkit.org>
+
+ [chromium] Add simplified API for iterating over a WebElement's attributes.
+ <http://webkit.org/b/84183>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add attributeCount(), attributeLocalName(index) and attributeValue(index) to the
+ WebElement API so that call sites currently using WebNamedNodeMap can be
+ converted, which will ultimately allow us to refactor WebCore::Attribute
+ on <http://webkit.org/b/83440>.
+
+ * public/WebElement.h:
+ * src/WebElement.cpp:
+ (WebKit::WebElement::attributeCount):
+ (WebKit::WebElement::attributeLocalName):
+ (WebKit::WebElement::attributeValue):
+
+2012-04-19 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call signedPublicKeyAndChallengeString directly
+ https://bugs.webkit.org/show_bug.cgi?id=84372
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-19 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call audioHardwareBufferSize directly
+ https://bugs.webkit.org/show_bug.cgi?id=84370
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+
+2012-04-19 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Add tests for scrolling non-root layers in the compositor thread
+ https://bugs.webkit.org/show_bug.cgi?id=73350
+
+ Reviewed by James Robinson.
+
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayerImpl::didScroll):
+ (WebKit):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::CCLayerTreeHostImplTest::createScrollableLayer):
+ (CCLayerTreeHostImplTest):
+ (WebKitTests::CCLayerTreeHostImplTest::initializeLayerRendererAndDrawFrame):
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestOpacityChangeLayerDelegate::didScroll):
+ (WTF::MockContentLayerDelegate::paintContents):
+ (WTF::MockContentLayerDelegate::didScroll):
+ (CCLayerTreeHostTestScrollChildLayer):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::CCLayerTreeHostTestScrollChildLayer):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::beginTest):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::applyScrollAndScale):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::beginCommitOnCCThread):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestScrollChildLayer::afterTest):
+ (WTF):
+ (WTF::TEST_F):
+
+2012-04-19 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: Stub out IDBCursor.advance for landing
+ https://bugs.webkit.org/show_bug.cgi?id=84280
+
+ Reviewed by Dimitri Glazkov.
+
+ Just a stub method so it can be implemented on chromium
+
+ * public/WebIDBCursor.h:
+ (WebKit::WebIDBCursor::advance):
+ * src/WebIDBCursorImpl.cpp:
+ (WebKit::WebIDBCursorImpl::advance):
+ (WebKit):
+ * src/WebIDBCursorImpl.h:
+ (WebIDBCursorImpl):
+
+2012-04-19 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call mimeRegistry directly
+ https://bugs.webkit.org/show_bug.cgi?id=84334
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::layoutTestMode):
+
+2012-04-19 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call sampleGamepads directly
+ https://bugs.webkit.org/show_bug.cgi?id=84339
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::injectIDBKeyIntoSerializedValue):
+
+2012-04-19 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call audioHardwareSampleRate directly
+ https://bugs.webkit.org/show_bug.cgi?id=84335
+
+ Reviewed by Kentaro Hara.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * src/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestination::hardwareSampleRate):
+
+2012-04-18 Nico Weber <thakis@chromium.org>
+
+ [chromium/mac] Fix build.
+ https://bugs.webkit.org/show_bug.cgi?id=84314
+
+ Unreviewed, build fix after http://trac.webkit.org/changeset/114604
+
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+
+2012-04-18 Hironori Bono <hbono@chromium.org>
+
+ Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+ https://bugs.webkit.org/show_bug.cgi?id=83748
+
+ Reviewed by Ryosuke Niwa.
+
+ This change adds a new API WebTextCheckingCompletion::didCancelCheckingText(),
+ which encapsulates SpellChecker::didCheckCanceled() and implements it so
+ Chromium can use it.
+
+ * public/WebTextCheckingCompletion.h:
+ (WebKit::WebTextCheckingCompletion::didCancelCheckingText):
+ * src/WebTextCheckingCompletionImpl.cpp:
+ (WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText):
+ (WebKit):
+ (WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText):
+ * src/WebTextCheckingCompletionImpl.h:
+ (WebTextCheckingCompletionImpl):
+
+2012-04-16 James Robinson <jamesr@chromium.org>
+
+ [chromium] Convert WebPluginContainerImpl over to use WebExternalTextureLayer
+ https://bugs.webkit.org/show_bug.cgi?id=84120
+
+ Reviewed by Adrienne Walker.
+
+ This ports WebPluginContainerImpl over to use WebExternalTextureLayer instead of directly using a *LayerChromium
+ type for better layering and code sharing. The changes to WebPluginContainerImpl are fairly straightforward. In
+ addition to renames I also moved some state tracking into WPCI instead of having it exposed on the interface. I
+ also removed the WebExternalTextureLayerImpl intermediate class since it wasn't doing anything useful.
+
+ * WebKit.gyp:
+ * WebKit.gypi:
+ * src/WebContentLayer.cpp:
+ * src/WebExternalTextureLayer.cpp:
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayer::setTextureId):
+ (WebKit::WebExternalTextureLayer::setIOSurfaceProperties):
+ (WebKit::WebExternalTextureLayer::setFlipped):
+ (WebKit::WebExternalTextureLayer::flipped):
+ (WebKit::WebExternalTextureLayer::setUVRect):
+ (WebKit::WebExternalTextureLayer::uvRect):
+ (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+ * src/WebExternalTextureLayerImpl.cpp: Removed.
+ * src/WebExternalTextureLayerImpl.h: Removed.
+ * src/WebLayer.cpp:
+ (WebKit::WebLayer::invalidateRect):
+ (WebKit):
+ (WebKit::WebLayer::invalidate):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
+ * src/WebPluginContainerImpl.h:
+ (WebCore):
+ (WebPluginContainerImpl):
+ * tests/WebExternalTextureLayerImplTest.cpp: Removed.
+ * tests/WebLayerTest.cpp:
+
+2012-04-18 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Simplify occlusion tracker API by passing layer iterator data
+ https://bugs.webkit.org/show_bug.cgi?id=84088
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (CCOcclusionTrackerTestMainThreadTypes):
+ (CCOcclusionTrackerTestImplThreadTypes):
+ (WebKitTests::CCOcclusionTrackerTest::CCOcclusionTrackerTest):
+ (WebKitTests::CCOcclusionTrackerTest::calcDrawEtc):
+ (CCOcclusionTrackerTest):
+ (WebKitTests::CCOcclusionTrackerTest::enterLayer):
+ (WebKitTests::CCOcclusionTrackerTest::leaveLayer):
+ (WebKitTests::CCOcclusionTrackerTest::visitLayer):
+ (WebKitTests::CCOcclusionTrackerTest::enterContributingSurface):
+ (WebKitTests::CCOcclusionTrackerTest::leaveContributingSurface):
+ (WebKitTests::CCOcclusionTrackerTest::visitContributingSurface):
+ (WebKitTests::CCOcclusionTrackerTest::resetLayerIterator):
+ (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestReplicaDoesOcclude::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore):
+ (WebCore::makeLayer):
+ (WebCore::appendQuads):
+ (WebCore::TEST):
+
+2012-04-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Add canBeginFrame state to CCSchedulerStateMachine to suppress initialization before our surface is available
+ https://bugs.webkit.org/show_bug.cgi?id=84301
+
+ Reviewed by Adrienne Walker.
+
+ Update unit tests for new canBeginFrame bit.
+
+ * tests/CCSchedulerStateMachineTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-04-18 David Reveman <reveman@chromium.org>
+
+ [Chromium] Solid color layers should respect opacity value.
+ https://bugs.webkit.org/show_bug.cgi?id=84197
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon):
+
+2012-04-18 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium] Call prefetchDNS directly
+ https://bugs.webkit.org/show_bug.cgi?id=84262
+
+ Reviewed by Kentaro Hara.
+
+ Part of a series, see tracking bug 82948.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-18 Myles Maxfield <mmaxfield@google.com>
+
+ Chromium compile of WebDatabase.cpp fails without SQL_DATABASE
+ https://bugs.webkit.org/show_bug.cgi?id=84212
+
+ Reviewed by Kentaro Hara.
+
+ * src/WebDatabase.cpp:
+ (WebCore::AbstractDatabase::isSyncDatabase):
+
+2012-04-18 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Turn on ENABLE_DATALIST for chromium
+ https://bugs.webkit.org/show_bug.cgi?id=84118
+
+ Reviewed by Kent Tamura.
+
+ * features.gypi: Turn on ENABLE_DATALIST.
+ * src/WebInputElement.cpp: Touched to avoid build issues. No code change.
+
+2012-04-18 Alexander Pavlov <apavlov@chromium.org>
+
+ [Chromium] REGRESSION: Popup shrinks because of autocomplete
+ https://bugs.webkit.org/show_bug.cgi?id=84139
+ http://code.google.com/p/chromium/issues/detail?id=123432
+
+ Do not use the PopupContainer's frameRect() to update the popup client's window rect,
+ since PopupContainer is always positioned at (0, 0) inside the client's window rect,
+ and the latter one is positioned relative to the screen origin.
+
+ Reviewed by Kent Tamura.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::refreshAutofillPopup):
+
+2012-04-17 Rafael Weinstein <rafaelw@chromium.org>
+
+ [MutationObservers] enable V8RecursionScope debug ASSERT()
+ https://bugs.webkit.org/show_bug.cgi?id=84094
+
+ Reviewed by Ojan Vafai.
+
+ This patch enables the ASSERT() which enforces usage of
+ V8RecursionScope.
+
+ * src/WebKit.cpp:
+ (WebKit::assertV8RecursionScope):
+
+2012-04-17 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Fix gyp for WebFilterOperation.h and WebFilterOperations.h
+ https://bugs.webkit.org/show_bug.cgi?id=84182
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+
+2012-04-17 David Reveman <reveman@chromium.org>
+
+ [Chromium] Add TextureUploader which allows us to use persistent GC3D state for texture uploads.
+ https://bugs.webkit.org/show_bug.cgi?id=83972
+
+ Reviewed by James Robinson.
+
+ * tests/CCTiledLayerTestCommon.h:
+ (FakeTextureUploader):
+ (WebKitTests::FakeTextureUploader::uploadTexture):
+ (WebKitTests):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-04-17 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: stub getKey/getObject interfaces for IDBKeyRange
+ https://bugs.webkit.org/show_bug.cgi?id=84089
+
+ Reviewed by Dimitri Glazkov.
+
+ Added stub methods on WebIDBIndex.h to cleanly land
+ https://bugs.webkit.org/show_bug.cgi?id=83638
+
+ * public/WebIDBIndex.h:
+ (WebKit::WebIDBIndex::getObject):
+ (WebKit::WebIDBIndex::getKey):
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::getObject):
+ (WebKit):
+ (WebKit::WebIDBIndexImpl::getKey):
+ * src/WebIDBIndexImpl.h:
+ (WebIDBIndexImpl):
+
+2012-04-17 Aaron Colwell <acolwell@chromium.org>
+
+ Add sourceAddId() & sourceRemoveId() stubs for Chromium.
+ These are needed to bring the Media Source implementation
+ up to date with the new 0.4 version of the Media Source spec.
+ http://html5-mediasource-api.googlecode.com/svn/tags/0.4/draft-spec/mediasource-draft-spec.html
+ https://bugs.webkit.org/show_bug.cgi?id=83616
+
+ Reviewed by Eric Carlson, Darin Fisher.
+
+ * public/WebMediaPlayer.h:
+ (WebKit::WebMediaPlayer::sourceAddId):
+ (WebKit::WebMediaPlayer::sourceRemoveId):
+ * src/AssertMatchingEnums.cpp:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::sourceAddId):
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::sourceRemoveId):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-17 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Calendar Picker: Popup position is wrong when there are
+ no enough space below the target date field
+ https://bugs.webkit.org/show_bug.cgi?id=84007
+
+ Reviewed by Hajime Morita.
+
+ The popup was detached from the origin element because
+ calendarPicker.js resizes its window. To fix this bug, we move the
+ window position vertically when it is resized.
+
+ No new tests. This is not testable in WebKit.
+
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::PagePopupChromeClient::setWindowRect):
+ If this request is just a resize and m_isPutAboveOrigin is true,
+ update the vertical position so that the popup attaches to the
+ origin rectangle.
+ (WebKit::WebPagePopupImpl::WebPagePopupImpl):
+ Initialize m_isPutAboveOrigin with false.
+ (WebKit::WebPagePopupImpl::init): Set m_isPutAboveOrigin true.
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl): Add m_isPutAboveOrigin.
+
+2012-04-16 Kent Tamura <tkent@chromium.org>
+
+ Rename LocalizedNumberICU.h to ICULocale.h
+ https://bugs.webkit.org/show_bug.cgi?id=84119
+
+ Reviewed by Kentaro Hara.
+
+ * tests/LocalizedNumberICUTest.cpp: Rename LocalizedNumberICU.h to ICULocale.h
+
+2012-04-16 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Expose compositor filters to Aura through WebLayer
+ https://bugs.webkit.org/show_bug.cgi?id=80054
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/WebLayer.cpp:
+ (WebKit::WebLayer::setFilters):
+ (WebKit):
+ (WebKit::WebLayer::setBackgroundFilters):
+
+2012-04-16 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-04-16 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Move popup location detection code from WebViewImpl to WebPagePopupImpl
+ https://bugs.webkit.org/show_bug.cgi?id=84116
+
+ Reviewed by Kentaro Hara.
+
+ This makes no behavior change. Just move some code.
+ To fix Bug 84007, WebPagePopupImpl needs to know if the popup is
+ above the target element or below the target element.
+
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::init): Move some code from WebViewImpl::openPagePopup().
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl): Rename an argument name.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::openPagePopup): Move some code to WebPagePopupImpl::init().
+
+2012-04-13 James Robinson <jamesr@chromium.org>
+
+ [chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
+ https://bugs.webkit.org/show_bug.cgi?id=83963
+
+ Reviewed by Adrienne Walker.
+
+ Adds implementation of WebVideoLayer and ports WebMediaPlayerClientImpl over to using it.
+ WebMediaPlayerClientImpl still exposes a WebCore::VideoLayerChromium* to the compositor via the platformLayer()
+ interface, but this is temporary until we can change the PlatformLayer typedef over to WebLayer.
+
+ * WebKit.gyp:
+ * src/WebContentLayer.cpp:
+ * src/WebLayer.cpp:
+ (WebKit::WebLayer::invalidate):
+ (WebKit):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+ (WebKit::WebMediaPlayerClientImpl::setOpaque):
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+ (WebKit::WebMediaPlayerClientImpl::setVideoFrameProviderClient):
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebVideoLayer.cpp: Copied from Source/WebKit/chromium/src/WebContentLayer.cpp.
+ (WebKit):
+ (WebKit::WebVideoLayer::create):
+ (WebKit::WebVideoLayer::WebVideoLayer):
+ (WebKit::WebVideoLayer::active):
+
+2012-04-16 Aaron Colwell <acolwell@chromium.org>
+
+ Fix WebKit style violations in Chromium WebMediaPlayer.h & WebMediaPlayerClient.h
+ https://bugs.webkit.org/show_bug.cgi?id=84046
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebMediaPlayer.h:
+ (WebKit):
+ * public/WebMediaPlayerClient.h:
+ * public/WebTimeRange.h: Copied from Source/WebKit/chromium/public/WebMediaPlayerClient.h.
+ (WebKit):
+ (WebKit::WebTimeRange::WebTimeRange):
+ (WebTimeRange):
+ * src/AssertMatchingEnums.cpp:
+
+2012-04-16 Terry Anderson <tdanderson@chromium.org>
+
+ [chromium] Allow WebGestureEvent to store four floating point values
+ https://bugs.webkit.org/show_bug.cgi?id=84053
+
+ Reviewed by Darin Fisher.
+
+ See bug description for an explanation of the changes made.
+
+ * public/WebInputEvent.h:
+ (WebGestureEvent):
+ (WebKit::WebGestureEvent::WebGestureEvent):
+ * src/WebInputEvent.cpp:
+ (SameSizeAsWebGestureEvent):
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+
+2012-04-16 Alexey Proskuryakov <ap@apple.com>
+
+ [chromium] Remove BlobRegistryProxy::createResourceHandle
+ https://bugs.webkit.org/show_bug.cgi?id=84047
+
+ Reviewed by Nate Chapin.
+
+ * src/BlobRegistryProxy.h: (BlobRegistryProxy::createResourceHandle): This function
+ is no longer used.
+
+2012-04-16 Raymes Khoury <raymes@chromium.org>
+
+ Fix bug in WebPluginContainer::isRectTopmost() which gave the incorrect result for a scrolled window.
+ https://bugs.webkit.org/show_bug.cgi?id=80606
+
+ Reviewed by Darin Fisher.
+
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::isRectTopmost):
+
+2012-04-15 Keishi Hattori <keishi@webkit.org>
+
+ Introduce MenuItemID to autofill popup
+ https://bugs.webkit.org/show_bug.cgi?id=83777
+
+ Introducing MenuItemIDs because we want to add multiple separators and
+ need to identify non-autofill menu items without resorting to the separator position.
+
+ Reviewed by Kent Tamura.
+
+ * public/WebAutofillClient.h:
+ (WebKit::WebAutofillClient::didAcceptAutofillSuggestion): Changed uniqueID to itemID because they aren't unique.
+ (WebKit::WebAutofillClient::didSelectAutofillSuggestion):
+ * public/WebView.h:
+ (WebView):
+ * src/AutofillPopupMenuClient.cpp:
+ (WebKit::AutofillPopupMenuClient::AutofillPopupMenuClient):
+ (WebKit::AutofillPopupMenuClient::getSuggestionsCount):
+ (WebKit::AutofillPopupMenuClient::getSuggestion):
+ (WebKit::AutofillPopupMenuClient::getLabel):
+ (WebKit::AutofillPopupMenuClient::getIcon):
+ (WebKit::AutofillPopupMenuClient::removeSuggestionAtIndex):
+ (WebKit::AutofillPopupMenuClient::canRemoveSuggestionAtIndex):
+ (WebKit::AutofillPopupMenuClient::valueChanged):
+ (WebKit::AutofillPopupMenuClient::selectionChanged):
+ (WebKit::AutofillPopupMenuClient::itemIsSeparator):
+ (WebKit::AutofillPopupMenuClient::itemIsWarning):
+ (WebKit::AutofillPopupMenuClient::initialize):
+ (WebKit::AutofillPopupMenuClient::setSuggestions):
+ * src/AutofillPopupMenuClient.h: Removed m_separatorIndex because now we use itemID to identify separators.
+ Added m_useLegacyBehavior which is true when it is initialized with a valid separator index. This is to keep
+ the autofill working even when the chromium side hasn't been updated yet.
+ (AutofillPopupMenuClient):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
+2012-04-15 James Robinson <jamesr@chromium.org>
+
+ [chromium] LayerRendererChromium shouldn't know anything about CCLayerImpl
+ https://bugs.webkit.org/show_bug.cgi?id=83415
+
+ Reviewed by Adrienne Walker.
+
+ Add an explicit rootLayer getter to the test implementation of LayerRendererChromium since there isn't one on
+ the base class any more.
+
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromiumClient::rootLayer):
+ (FakeLayerRendererChromiumClient):
+ (TEST_F):
+
+2012-04-15 Yuta Kitamura <yutak@chromium.org>
+
+ Leak in WebSocketChannel with workers/worker-reload.html (part 2)
+ https://bugs.webkit.org/show_bug.cgi?id=83749
+
+ Reviewed by David Levin.
+
+ * src/WebWorkerClientImpl.cpp:
+ (WebKit::WebWorkerClientImpl::postTaskForModeToWorkerContext):
+ Correctly propagate the return value of postTaskForModeToWorkerContext().
+
+2012-04-13 David Reveman <reveman@chromium.org>
+
+ [Chromium] Avoid unnecessary full tile updates for checkerboard tiles.
+ https://bugs.webkit.org/show_bug.cgi?id=83804
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::setLayerPropertiesForTesting):
+ (WTF):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::layout):
+ (WTF::setTestLayerPropertiesForTesting):
+ (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
+ (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
+ (WTF::CCLayerTreeHostTestManySurfaces::beginTest):
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-04-13 Nico Weber <thakis@chromium.org>
+
+ [chromium] There is no Color(float, float, float) constructor, fix an attempt to call it.
+ https://bugs.webkit.org/show_bug.cgi?id=83920
+
+ Reviewed by James Robinson.
+
+ Found by clang:
+ third_party/WebKit/Source/WebKit/chromium/tests/LayerChromiumTest.cpp:508:89:error: implicit conversion turns literal floating-point number into integer: 'float' to 'int' [-Werror,-Wliteral-conversion]
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(Color(0.4f, 0.4f, 0.4f)));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
+
+ * tests/LayerChromiumTest.cpp:
+
+2012-04-13 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Replicas should be included in the computed occlusion
+ https://bugs.webkit.org/show_bug.cgi?id=82262
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (CCOcclusionTrackerTestReplicaDoesOcclude):
+ (WebKitTests::CCOcclusionTrackerTestReplicaDoesOcclude::runMyTest):
+ (WebKitTests):
+ (CCOcclusionTrackerTestReplicaWithClipping):
+ (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest):
+ (CCOcclusionTrackerTestSurfaceChildOfSurface):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest):
+
+2012-04-13 Bernhard Bauer <bauerb@google.com>
+
+ [chromium] Remove fallback code for "Missing plug-in" string.
+ https://bugs.webkit.org/show_bug.cgi?id=81907
+
+ Reviewed by Adam Barth.
+
+ * src/LocalizedStrings.cpp:
+ (WebCore::missingPluginText):
+
+2012-04-11 James Robinson <jamesr@chromium.org>
+
+ [chromium] Remove unused compositeToTexture / compositeOffscreen setting
+ https://bugs.webkit.org/show_bug.cgi?id=83733
+
+ Reviewed by Adrienne Walker.
+
+ Remove compositeOffscreen / compositeToTexture setting. This was an experiment that is no longer needed.
+
+ * public/WebSettings.h:
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::Settings::operator CCSettings):
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+
+2012-04-13 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API
+ https://bugs.webkit.org/show_bug.cgi?id=83851
+
+ Reviewed by Adam Barth.
+
+ Moves the WebVideoFrame interface into Platform and removes the now unnecessary VideoFrameChromiumImpl adapter
+ implementation.
+
+ * WebKit.gyp:
+ * public/WebVideoFrame.h:
+ * src/AssertMatchingEnums.cpp:
+ * src/VideoFrameChromiumImpl.cpp: Removed.
+ * src/VideoFrameChromiumImpl.h: Removed.
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-13 Rob Flack <flackr@chromium.org>
+
+ Chromium: Should enable -webkit-image-set
+ https://bugs.webkit.org/show_bug.cgi?id=81859
+
+ Reviewed by Adam Barth.
+
+ * features.gypi:
+
+2012-04-12 Michael Nordman <michaeln@google.com>
+
+ [chromium] Now that the chromium port is using a different dom_storage backend
+ library in its main browser process, there are a handful of files that should no
+ longer be included in the build, and a few files than should be deleted
+ outright, and the webkit api should be modified to reflect the new (and smaller)
+ contract between the embedder and webkit/webcore.
+ https://bugs.webkit.org/show_bug.cgi?id=83807
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp: Delete a few files.
+ * public/WebStorageNamespace.h: Remove some unused data members and methods, and annotate close() as deprecated.
+ * public/platform/WebKitPlatformSupport.h: Annotate a method as deprecated.
+ * src/StorageAreaProxy.cpp: Remove the include of a deleted file.
+ * src/StorageEventDispatcherChromium.cpp: Removed.
+ * src/StorageEventDispatcherImpl.cpp: Added a FIXME comment for upcoming work.
+ * src/StorageNamespaceProxy.cpp: Modified to no longer call out to the embedder thru the deprecated close() method.
+ * src/StorageNamespaceProxy.h: Moved some blank lines around.
+ * src/WebStorageAreaImpl.cpp: Removed.
+ * src/WebStorageAreaImpl.h: Removed.
+ * src/WebStorageEventDispatcherImpl.cpp: Cleaned up some cruft.
+ * src/WebStorageNamespaceImpl.cpp: Removed.
+ * src/WebStorageNamespaceImpl.h: Removed.
+
+2012-04-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r114140.
+ http://trac.webkit.org/changeset/114140
+ https://bugs.webkit.org/show_bug.cgi?id=83921
+
+ Fails fast/css/image-set-parsing.html test it attempts to
+ introduce. (Requested by scheib on #webkit).
+
+ * features.gypi:
+
+2012-04-13 Rob Flack <flackr@chromium.org>
+
+ Chromium: Should enable -webkit-image-set
+ https://bugs.webkit.org/show_bug.cgi?id=81859
+
+ Reviewed by Adam Barth.
+
+ * features.gypi:
+
+2012-04-13 Yury Semikhatsky <yurys@chromium.org>
+
+ Unreviewed. Build fix after r114126.
+
+ * WebKit.gyp:
+
+2012-04-13 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Add WebKit API to access <datalist> options
+ https://bugs.webkit.org/show_bug.cgi?id=83762
+
+ Introduce WebInputElement::dataListOptions so we can implement a UI for datalist.
+
+ Reviewed by Kent Tamura.
+
+ * public/WebInputElement.h:
+ (WebKit):
+ (WebInputElement):
+ * src/WebInputElement.cpp:
+ (WebKit::WebInputElement::dataListOptions): Added. Returns a WebNodeCollection containing WebOptionElements.
+
+2012-04-13 Kent Tamura <tkent@chromium.org>
+
+ Add a runtime flag for <input type=date>
+ https://bugs.webkit.org/show_bug.cgi?id=83853
+
+ Reviewed by Adam Barth.
+
+ * public/WebRuntimeFeatures.h:
+ (WebRuntimeFeatures): Add enableInputTypeDate() and isInputTypeDateEnabled().
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enableInputTypeDate): Added.
+ (WebKit::WebRuntimeFeatures::isInputTypeDateEnabled): Added.
+
+2012-04-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-04-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Background filters for composited layers
+ https://bugs.webkit.org/show_bug.cgi?id=80046
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerImplTest.cpp:
+ (WebCore::TEST):
+
+2012-04-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r114075.
+ http://trac.webkit.org/changeset/114075
+ https://bugs.webkit.org/show_bug.cgi?id=83857
+
+ Breaks compile (Requested by jamesr on #webkit).
+
+ * WebKit.gyp:
+ * public/WebVideoFrame.h:
+ (WebKit):
+ (WebVideoFrame):
+ (WebKit::WebVideoFrame::~WebVideoFrame):
+ (WebKit::WebVideoFrame::format):
+ (WebKit::WebVideoFrame::width):
+ (WebKit::WebVideoFrame::height):
+ (WebKit::WebVideoFrame::planes):
+ (WebKit::WebVideoFrame::stride):
+ (WebKit::WebVideoFrame::data):
+ (WebKit::WebVideoFrame::textureId):
+ (WebKit::WebVideoFrame::textureTarget):
+ * src/AssertMatchingEnums.cpp:
+ * src/VideoFrameChromiumImpl.cpp: Added.
+ (WebKit):
+ (WebKit::VideoFrameChromiumImpl::toWebVideoFrame):
+ (WebKit::VideoFrameChromiumImpl::VideoFrameChromiumImpl):
+ (WebKit::VideoFrameChromiumImpl::format):
+ (WebKit::VideoFrameChromiumImpl::width):
+ (WebKit::VideoFrameChromiumImpl::height):
+ (WebKit::VideoFrameChromiumImpl::planes):
+ (WebKit::VideoFrameChromiumImpl::stride):
+ (WebKit::VideoFrameChromiumImpl::data):
+ (WebKit::VideoFrameChromiumImpl::requiredTextureSize):
+ (WebKit::VideoFrameChromiumImpl::hasPaddingBytes):
+ (WebKit::VideoFrameChromiumImpl::textureId):
+ (WebKit::VideoFrameChromiumImpl::textureTarget):
+ * src/VideoFrameChromiumImpl.h: Renamed from Source/Platform/chromium/public/WebVideoFrame.h.
+ (WebKit):
+ (VideoFrameChromiumImpl):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-12 James Robinson <jamesr@chromium.org>
+
+ [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API
+ https://bugs.webkit.org/show_bug.cgi?id=83851
+
+ Reviewed by Adam Barth.
+
+ Moves the WebVideoFrame interface into Platform and removes the now unnecessary VideoFrameChromiumImpl adapter
+ implementation.
+
+ * WebKit.gyp:
+ * public/WebVideoFrame.h:
+ * src/AssertMatchingEnums.cpp:
+ * src/VideoFrameChromiumImpl.cpp: Removed.
+ * src/VideoFrameChromiumImpl.h: Removed.
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-12 David Dorwin <ddorwin@chromium.org>
+
+ Add Encrypted Media Extensions events and errors to HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=82974
+
+ Reviewed by Adam Barth.
+
+ The new events and errors are behind the ENABLE(ENCRYPTED_MEDIA) feature define.
+ Implementation is based on v0.1 of the draft proposal at
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#events.
+
+ * public/WebMediaPlayerClient.h:
+ * src/AssertMatchingEnums.cpp:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::keyAdded):
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::keyError):
+ (WebKit::WebMediaPlayerClientImpl::keyMessage):
+ (WebKit::WebMediaPlayerClientImpl::keyNeeded):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-12 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Enable INPUT_TYPE_DATE
+ https://bugs.webkit.org/show_bug.cgi?id=83761
+
+ Reviewed by Kentaro Hara.
+
+ * features.gypi: Turn ENABLE_INPUT_TYPE_DATE on.
+
+2012-04-12 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Fix !ENABLE(PAGE_POPUP) build
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl): Wrap m_pagePopup with ENABLE(PAGE_POPUP).
+
+2012-04-12 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Add PagePopup implementation
+ https://bugs.webkit.org/show_bug.cgi?id=81081
+
+ Reviewed by Adam Barth.
+
+ Add WebPagePopupImpl class, which is an implementation of
+ WebCore::PagePopup interface and WebKit::WebPagePopup interface. It's a
+ WebWidget which has a Page object.
+
+ No new tests because this makes no behavior change yet.
+
+ * WebKit.gyp: Add WebPagePopupImpl.h.
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::hasOpenedPopup): Supports the PagePopup.
+ (WebKit::ChromeClientImpl::openPagePopup):
+ just delegate to WebViewImpl::openPagePopup().
+ (WebKit::ChromeClientImpl::closePagePopup): ditto.
+
+ * src/WebPagePopupImpl.cpp:
+ (PagePopupChromeClient):
+ This is a light implementation of ChromeClient for the page in
+ WebPagePopupImpl. This is a friend of WebPagePopupImpl becase of ease of
+ access to its members.
+ (WebKit::PagePopupChromeClient::PagePopupChromeClient):
+ (WebKit::WebPagePopupImpl::WebPagePopupImpl):
+ (WebKit::WebPagePopupImpl::~WebPagePopupImpl):
+ (WebKit::WebPagePopupImpl::init):
+ (WebKit::WebPagePopupImpl::initPage):
+ (WebKit::WebPagePopupImpl::size):
+ (WebKit::WebPagePopupImpl::animate): Calls PageWidgetDelegate::animate().
+ (WebKit::WebPagePopupImpl::composite):
+ (WebKit::WebPagePopupImpl::layout): Calls PageWidgetDelegate::layout().
+ (WebKit::WebPagePopupImpl::paint): Calls PageWidgetDelegate::paint().
+ (WebKit::WebPagePopupImpl::resize):
+ (WebKit::WebPagePopupImpl::handleKeyEvent):
+ (WebKit::WebPagePopupImpl::handleCharEvent):
+ (WebKit::WebPagePopupImpl::handleGestureEvent):
+ (WebKit::WebPagePopupImpl::handleInputEvent):
+ (WebKit::WebPagePopupImpl::setFocus):
+ (WebKit::WebPagePopupImpl::close): Delete the page, and kill itself.
+ (WebKit::WebPagePopupImpl::closePopup):
+ (WebKit::WebPagePopup::create):
+ * src/WebPagePopupImpl.h: Added.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl): Initialize m_pagePopup.
+ (WebKit::WebViewImpl::handleKeyEvent):
+ Renamed from keyEvent(). Forward key events to a PagePopup if it is open.
+ (WebKit::WebViewImpl::handleCharEvent):
+ Renamed from charEvent(). Forward char events to a PagePopup if it is open.
+ (WebKit::WebViewImpl::openPagePopup):
+ Added. Instantiate a WebPagePopupImpl, calculates a good bounding
+ rectangle of the page popup from the specified element rectangle,
+ initialize the WebPagePopupImpl, and stop caret blink.
+ (WebKit::WebViewImpl::closePagePopup):
+ Close the popup, clear m_pagePopup, and resume caret blink.
+ (WebKit::WebViewImpl::setFocus): Hide all the popups.
+ (WebKit::WebViewImpl::hidePopups): Hide the page popup too.
+ * src/WebViewImpl.h:
+ (WebKit::WebViewImpl::hasOpenedPopup): Checks the page popup too.
+
+2012-04-12 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Move some code of WebViewImpl and WebFrameImpl to PageWidgetDelegate
+ https://bugs.webkit.org/show_bug.cgi?id=83750
+
+ Reviewed by Adam Barth.
+
+ In order to share code in WebViewImpl and the incoming WebPagePopupImpl,
+ we move some code of WebViewImpl and WebFrameImpl to PageWidgetDelegate.
+ PageWidgetDelegate is a set of static functions because we can't use
+ virtual inheritance in this case and we don't want to move WebView's
+ data members to another class.
+
+ No new tests. Just refactoring.
+
+ * WebKit.gyp: Add PageWidgetDelegate.{cpp,h} and WebPagePopupImpl.h.
+ * src/PageWidgetDelegate.cpp: Added.
+ (WebKit::mainFrameView):
+ (WebKit::PageWidgetDelegate::animate):
+ Moved from a part of WebViewImpl::animatie()
+ (WebKit::PageWidgetDelegate::layout):
+ Moved from WebViewImpl::layout() and WebFrameImpl::layout().
+ (WebKit::PageWidgetDelegate::paint):
+ Moved from WebFrameImpl::paint() and paintWithContext().
+ (WebKit::PageWidgetDelegate::handleInputEvent):
+ Moved from a part of WebViewImpl::handleInputEvent().
+ (WebKit::PageWidgetEventHandler::handleMouseMove):
+ Common implementation of an event handling.
+ (WebKit::PageWidgetEventHandler::handleMouseLeave): ditto.
+ (WebKit::PageWidgetEventHandler::handleMouseDown): ditto.
+ (WebKit::PageWidgetEventHandler::handleMouseUp): ditto.
+ (WebKit::PageWidgetEventHandler::handleMouseWheel): ditto.
+ (WebKit::PageWidgetEventHandler::handleTouchEvent): ditto.
+ * src/PageWidgetDelegate.h: Added.
+ * src/WebFrameImpl.cpp:
+ Remove layout(), paintWithContext(), and paint(). They are moved to
+ PageWidgetDelegate.
+ * src/WebFrameImpl.h:
+ (WebFrameImpl): Remove layout(), paintWithContext(), and paint().
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleMouseLeave):
+ Renamed from mouseLeave(), use PageWidgetDelegate::handleMouseLeave().
+ (WebKit::WebViewImpl::handleMouseDown):
+ Renamed from mouseDown(), use PageWidgetDelegate::handleMouseDown().
+ (WebKit::WebViewImpl::handleMouseUp):
+ Renamed from mouseUp(), use PageWidgetDelegate::handleMouseUp().
+ (WebKit::WebViewImpl::scrollBy): Calls renamed handleMouseWheel().
+ (WebKit::WebViewImpl::handleGestureEvent): Renamed from gestureEvent().
+ (WebKit::WebViewImpl::handleKeyEvent): Renamed from keyEvent().
+ (WebKit::WebViewImpl::handleCharEvent): Renamed from charEvent().
+ (WebKit::WebViewImpl::updateAnimations): Uses PageWidgetDelegate::animate().
+ (WebKit::WebViewImpl::layout): Uses PageWidgetDelegate::layout().
+ (WebKit::WebViewImpl::paint): Uses PageWidgetDelegate::paint().
+ (WebKit::WebViewImpl::handleInputEvent): Uses PageWidgetDelegate::handleInputEvent().
+ * src/WebViewImpl.h:
+
+2012-04-12 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix Windows compiler warnings in webkit_unit_test target
+ https://bugs.webkit.org/show_bug.cgi?id=83732
+
+ Reviewed by Kent Tamura.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore::TEST):
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TEST):
+ * tests/FloatQuadTest.cpp:
+ (WebCore::TEST):
+ * tests/ScrollAnimatorNoneTest.cpp:
+ (TEST_F):
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/WebLayerTest.cpp:
+
+2012-04-11 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: Stub out WebKit interface for get(IndexedKeyRange)
+ https://bugs.webkit.org/show_bug.cgi?id=83637
+
+ Reviewed by Kent Tamura.
+
+ This is just a stub-out of IDBObjectStore.get(IDBKeyRange) to coordinate
+ a landing in chromium
+
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::get):
+ (WebIDBObjectStore):
+ * src/IDBObjectStoreBackendProxy.cpp:
+ (WebKit::IDBObjectStoreBackendProxy::get):
+ (WebKit):
+ * src/IDBObjectStoreBackendProxy.h:
+ (IDBObjectStoreBackendProxy):
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::get):
+ (WebKit):
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl):
+
+2012-04-11 Kenichi Ishibashi <bashi@chromium.org>
+
+ [chromium] Fix Windows warnings in WebSocketDeflaterTest
+ https://bugs.webkit.org/show_bug.cgi?id=83731
+
+ Reviewed by Kent Tamura.
+
+ Use const char* instead of const char[] to suppress warnings on
+ Windows.
+
+ * tests/WebSocketDeflaterTest.cpp:
+ (WebCore::TEST):
+
+2012-04-11 David Dorwin <ddorwin@chromium.org>
+
+ Add keySystem attribute to canPlayType() for Encrypted Media Extensions
+ https://bugs.webkit.org/show_bug.cgi?id=82973
+
+ Reviewed by Adam Barth.
+
+ The new attribute is behind the ENABLE(ENCRYPTED_MEDIA) feature define.
+ Implementation is based on v0.1 of the draft proposal at
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#extensions.
+
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::supportsType):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
+2012-04-10 James Robinson <jamesr@chromium.org>
+
+ [chromium] Add OVERRIDE annotations for cc layer types
+ https://bugs.webkit.org/show_bug.cgi?id=83658
+
+ Reviewed by Daniel Bates.
+
+ This adds OVERRIDE annotations to overrides of functions on these classes:
+ - CCLayerImpl
+ - LayerChromium
+ - TiledLayerChromium
+
+ * src/WebLayerImpl.cpp:
+ * src/WebLayerImpl.h:
+ (WebLayerImpl): Removed unused and empty paintContents() function.
+ * tests/CCLayerIteratorTest.cpp:
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ * tests/CCOcclusionTrackerTest.cpp:
+ * tests/CCTiledLayerTestCommon.h:
+ (FakeTiledLayerChromium):
+ * tests/LayerChromiumTest.cpp:
+ * tests/TreeSynchronizerTest.cpp:
+
+2012-04-11 James Robinson <jamesr@chromium.org>
+
+ [chromium] Add OVERRIDE annotations for cc animation-related interfaces
+ https://bugs.webkit.org/show_bug.cgi?id=83650
+
+ Reviewed by Daniel Bates.
+
+ This adds OVERRIDE annotations to the implementations of the following interfaces:
+ - CCAnimationCurve
+ - CCFloatAnimationCurve
+ - CCLayerAnimationControllerClient
+ - CCTransformAnimationCurve
+
+ * tests/CCAnimationTestCommon.h:
+
+2012-04-11 Aaron Colwell <acolwell@chromium.org>
+
+ Remove webkit prefix from Media Source runtime feature name.
+ https://bugs.webkit.org/show_bug.cgi?id=83633
+
+ Reviewed by Adam Barth.
+
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enableMediaSource):
+ (WebKit::WebRuntimeFeatures::isMediaSourceEnabled):
+
+2012-04-11 Adrienne Walker <enne@google.com>
+
+ [chromium] Draw missing layer tile checkerboards as checkerboards
+ https://bugs.webkit.org/show_bug.cgi?id=83241
+
+ Reviewed by James Robinson.
+
+ Rename usedCheckerboard to hadMissingTile to avoid confusion. Update
+ tests to not expect SolidColor quads for checkerboards.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ * tests/CCTiledLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon::getQuads):
+ * tests/LayerChromiumTest.cpp:
+
+2012-04-11 Ami Fischman <fischman@chromium.org>
+
+ Remove unused WebVideoFrame::Format values
+ https://bugs.webkit.org/show_bug.cgi?id=83625
+
+ Reviewed by Kenneth Russell.
+
+ * public/WebVideoFrame.h:
+ (WebKit):
+ * src/AssertMatchingEnums.cpp:
+
+2012-04-11 'Pavel Feldman' <pfeldman@chromium.org>
+
+ Follow up to r113863: fix chromium inspector interactive test harness.
+
+ * src/js/Tests.js:
+
+2012-04-11 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Add Battery Status API support.
+
+ The battery-client (BatteryClientChromium) will notify the client (WebBatteryStatusClient) when to start or stop
+ sending battery status updates. The client, in response will send the notifications to WebViewImpl, which sends
+ this update information to the WebCore::BatteryClient, and it triggers the appropriate javascript-callbacks.
+ The spec is at http://www.w3.org/TR/2011/WD-battery-status-20111129/.
+ https://bugs.webkit.org/show_bug.cgi?id=83284
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * features.gypi:
+ * public/WebBatteryStatus.h: Added.
+ (WebKit):
+ (WebBatteryStatus):
+ (WebKit::WebBatteryStatus::WebBatteryStatus):
+ * public/WebBatteryStatusClient.h: Added.
+ (WebKit):
+ (WebBatteryStatusClient):
+ (WebKit::WebBatteryStatusClient::~WebBatteryStatusClient):
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ (WebKit::WebView::updateBatteryStatus):
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::batteryStatusClient):
+ * src/BatteryClientImpl.cpp: Added.
+ (WebKit):
+ (WebKit::BatteryClientImpl::BatteryClientImpl):
+ (WebKit::BatteryClientImpl::updateBatteryStatus):
+ (WebKit::BatteryClientImpl::setController):
+ (WebKit::BatteryClientImpl::startUpdating):
+ (WebKit::BatteryClientImpl::stopUpdating):
+ (WebKit::BatteryClientImpl::batteryControllerDestroyed):
+ * src/BatteryClientImpl.h: Added.
+ (WebKit):
+ (BatteryClientImpl):
+ (WebKit::BatteryClientImpl::~BatteryClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit):
+ (WebKit::WebViewImpl::updateBatteryStatus):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-04-10 Ami Fischman <fischman@chromium.org>
+
+ Roll Chromium DEPS to last-known good revision
+ https://bugs.webkit.org/show_bug.cgi?id=83652
+
+ Unreviewed, just a DEPS roll (131469:131684)
+
+ * DEPS:
+
+2012-04-10 Alexandre Elias <aelias@google.com>
+
+ Add gesture event enums for long-press and pinch
+ https://bugs.webkit.org/show_bug.cgi?id=83640
+
+ Reviewed by James Robinson.
+
+ Add new enum values GestureLongPress and GesturePinchBegin/End/Update,
+ along with no-op default handling.
+
+ * public/WebInputEvent.h:
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+ * src/WebPopupMenuImpl.cpp:
+ (WebKit::WebPopupMenuImpl::handleInputEvent):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::gestureEvent):
+
+2012-04-10 James Robinson <jamesr@chromium.org>
+
+ [chromium] Add OVERRIDE annotations for cc tree host and proxy interfaces
+ https://bugs.webkit.org/show_bug.cgi?id=83653
+
+ Reviewed by Adrienne Walker.
+
+ This adds OVERRIDE annotations to the implementations of the following interfaces:
+ - CCLayerTreeHostClient
+ - CCLayerTreeHostImplClient
+ - CCProxy
+ - LayerRendererChromiumClient
+
+ * src/WebLayerTreeViewImpl.h:
+ (WebLayerTreeViewImpl):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ * tests/FakeCCLayerTreeHostClient.h:
+ * tests/LayerRendererChromiumTest.cpp:
+
+2012-04-10 James Robinson <jamesr@chromium.org>
+
+ [chromium] Add OVERRIDE annotations for cc scheduler-related client interfaces
+ https://bugs.webkit.org/show_bug.cgi?id=83646
+
+ Reviewed by Adrienne Walker.
+
+ This adds OVERRIDE annotations to the implementations of the following interfaces:
+ - CCFrameRateControllerClient
+ - CCSchedulerClient
+ - CCTimeSource
+ - CCTimeSourceClient
+ - CCTimerClient
+
+
+ * tests/CCSchedulerTest.cpp:
+ * tests/CCSchedulerTestCommon.h:
+
+2012-04-10 James Robinson <jamesr@chromium.org>
+
+ [chromium] Fold LayerChromium::updateCompositorResources into main update
+ https://bugs.webkit.org/show_bug.cgi?id=83530
+
+ Reviewed by Adrienne Walker.
+
+ Update tests for interface changes.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::runTest):
+ (WTF::ContentLayerChromiumWithUpdateTracking::update):
+ (WTF::ContentLayerChromiumWithUpdateTracking::idleUpdate):
+ (WTF::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking):
+ (ContentLayerChromiumWithUpdateTracking):
+ (WTF::CCLayerTreeHostTestOpacityChange::afterTest):
+ (WTF::CCLayerTreeHostTestSetViewportSize::beginTest):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
+ (WTF::TestLayerChromium::update):
+ (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
+ (WTF::CCLayerTreeHostTestContentLayerOcclusion::beginTest):
+ (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
+ (WTF::CCLayerTreeHostTestManySurfaces::beginTest):
+ * tests/CCTiledLayerTestCommon.cpp:
+ (WebKitTests::FakeLayerTextureUpdater::updateLayerRect):
+ (WebKitTests::FakeTiledLayerChromium::update):
+ * tests/CCTiledLayerTestCommon.h:
+ (FakeLayerTextureUpdater):
+ (FakeTiledLayerChromium):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF::idlePaintRepeat):
+
+2012-04-10 Adam Barth <abarth@webkit.org>
+
+ Limit -apple- and -khtml- to ENABLE(DASHBOARD_SUPPORT)
+ https://bugs.webkit.org/show_bug.cgi?id=83256
+
+ Reviewed by Eric Seidel.
+
+ * features.gypi:
+
+2012-04-10 Tim Dresser <tdresser@chromium.org>
+
+ [Chromium] defaultDeviceScaleFactor != 0 should set deviceScaleFactor = defaultDeviceScaleFactor in the absence of a viewport tag for debugging purposes
+ https://bugs.webkit.org/show_bug.cgi?id=82757
+
+ Reviewed by Darin Fisher.
+
+ If there is no viewport tag, the deviceScaleFactor is set to the defaultDeviceScaleFactor.
+ Tested by: WebFrameTest.DeviceScaleFactorUsesDefaultWithoutViewportTag.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit):
+ (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange):
+ * tests/WebFrameTest.cpp:
+ (WebKit):
+ (FixedLayoutTestWebViewClient):
+ (WebKit::TEST_F):
+ * tests/data/no_viewport_tag.html: Added.
+
+2012-04-10 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113734.
+ http://trac.webkit.org/changeset/113734
+ https://bugs.webkit.org/show_bug.cgi?id=83606
+
+ causing a bunch of unrelated test failures (Requested by
+ simonjam on #webkit).
+
+ * WebKit.gyp:
+ * features.gypi:
+ * public/WebBatteryStatus.h: Removed.
+ * public/WebBatteryStatusClient.h: Removed.
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ * public/WebViewClient.h:
+ (WebKit):
+ * src/BatteryClientImpl.cpp: Removed.
+ * src/BatteryClientImpl.h: Removed.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-04-09 James Robinson <jamesr@chromium.org>
+
+ [chromium] Defer texture id allocation for copies until the actual copy executes
+ https://bugs.webkit.org/show_bug.cgi?id=83514
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCTiledLayerTestCommon.cpp:
+ * tests/CCTiledLayerTestCommon.h:
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-04-10 David Dorwin <ddorwin@chromium.org>
+
+ Add Encrypted Media Extensions methods to HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=82971
+
+ Reviewed by Adam Barth.
+
+ The extensions are behind the ENABLE(ENCRYPTED_MEDIA) feature define.
+ Implementation is based on v0.1 of the draft proposal at
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html.
+
+ * features.gypi:
+ * public/WebMediaPlayer.h:
+ (WebKit):
+ (WebMediaPlayer):
+ (WebKit::WebMediaPlayer::generateKeyRequest):
+ (WebKit::WebMediaPlayer::addKey):
+ (WebKit::WebMediaPlayer::cancelKeyRequest):
+ * public/WebRuntimeFeatures.h:
+ (WebRuntimeFeatures):
+ * src/AssertMatchingEnums.cpp:
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::generateKeyRequest):
+ (WebKit::WebMediaPlayerClientImpl::addKey):
+ (WebKit::WebMediaPlayerClientImpl::cancelKeyRequest):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::isMediaStreamEnabled):
+ (WebKit::WebRuntimeFeatures::enableEncryptedMedia):
+ (WebKit):
+ (WebKit::WebRuntimeFeatures::isEncryptedMediaEnabled):
+
+2012-04-10 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Add Battery Status API support.
+
+ The battery-client (BatteryClientChromium) will notify the client (WebBatteryStatusClient) when to start or stop
+ sending battery status updates. The client, in response will send the notifications to WebViewImpl, which sends
+ this update information to the WebCore::BatteryClient, and it triggers the appropriate javascript-callbacks.
+ The spec is at http://www.w3.org/TR/2011/WD-battery-status-20111129/.
+ https://bugs.webkit.org/show_bug.cgi?id=83284
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * features.gypi:
+ * public/WebBatteryStatus.h: Added.
+ (WebKit):
+ (WebBatteryStatus):
+ (WebKit::WebBatteryStatus::WebBatteryStatus):
+ * public/WebBatteryStatusClient.h: Added.
+ (WebKit):
+ (WebBatteryStatusClient):
+ (WebKit::WebBatteryStatusClient::~WebBatteryStatusClient):
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ (WebKit::WebView::updateBatteryStatus):
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::batteryStatusClient):
+ * src/BatteryClientImpl.cpp: Added.
+ (WebKit):
+ (WebKit::BatteryClientImpl::BatteryClientImpl):
+ (WebKit::BatteryClientImpl::updateBatteryStatus):
+ (WebKit::BatteryClientImpl::setController):
+ (WebKit::BatteryClientImpl::startUpdating):
+ (WebKit::BatteryClientImpl::stopUpdating):
+ (WebKit::BatteryClientImpl::batteryControllerDestroyed):
+ * src/BatteryClientImpl.h: Added.
+ (WebKit):
+ (BatteryClientImpl):
+ (WebKit::BatteryClientImpl::~BatteryClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit):
+ (WebKit::WebViewImpl::updateBatteryStatus):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-04-10 Zhenyao Mo <zmo@google.com>
+
+ Unreviewed, roll chromium to 131469
+
+ * DEPS:
+
+2012-04-09 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [Device Metrics] Introduce the "Fit window" option
+ https://bugs.webkit.org/show_bug.cgi?id=83280
+
+ Implement the scaling of the FrameView to the WebViewImpl size, handle WebViewImpl resizes.
+
+ Reviewed by Pavel Feldman.
+
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::overrideDeviceMetrics):
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::DeviceMetricsSupport::DeviceMetricsSupport):
+ (WebKit::DeviceMetricsSupport::setDeviceMetrics):
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidthOnNavigation):
+ (DeviceMetricsSupport):
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidth):
+ (WebKit::DeviceMetricsSupport::webViewResized):
+ (WebKit::DeviceMetricsSupport::applySizeOverrideIfNecessary):
+ (WebKit::DeviceMetricsSupport::ensureOriginalZoomFactor):
+ (WebKit::DeviceMetricsSupport::restore):
+ (WebKit::DeviceMetricsSupport::scaledEmulatedFrameSize):
+ (WebKit::DeviceMetricsSupport::forcedScrollbarDimensions):
+ (WebKit::DeviceMetricsSupport::applySizeOverrideInternal):
+ (WebKit::WebDevToolsAgentImpl::webViewResized):
+ (WebKit):
+ (WebKit::WebDevToolsAgentImpl::overrideDeviceMetrics):
+ (WebKit::WebDevToolsAgentImpl::autoZoomPageToFitWidth):
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+ * src/WebDevToolsAgentPrivate.h:
+ (WebDevToolsAgentPrivate):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::resize):
+
+2012-04-09 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Remove unused variable, WebViewImpl::m_lastMousePosition.
+ https://bugs.webkit.org/show_bug.cgi?id=83550
+
+ Reviewed by Kentaro Hara.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::mouseMove):
+ * src/WebViewImpl.h:
+
+2012-04-09 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Viewport is not filled when out of texture memory on mac
+ https://bugs.webkit.org/show_bug.cgi?id=83351
+
+ Reviewed by Adrienne Walker.
+
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setBackgroundColor):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setBackgroundColor):
+ (WebKit):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setBackgroundColor):
+ (WebKit):
+ (WebKit::WebViewImplContentPainter::paint):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * src/WebViewImpl.h:
+ (WebCore):
+ (WebViewImpl):
+ * tests/CCLayerImplTest.cpp:
+ (WebCore::TEST):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::BlendStateCheckLayer::appendQuads):
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestCommit):
+ (WTF::CCLayerTreeHostTestCommit::CCLayerTreeHostTestCommit):
+ (WTF::CCLayerTreeHostTestCommit::beginTest):
+ (WTF::CCLayerTreeHostTestCommit::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestCommit::afterTest):
+ (WTF::TEST_F):
+ (TestLayerChromium):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::TestContentLayerChromium::TestContentLayerChromium):
+ (WebKitTests::TestContentLayerChromium::visibleContentOpaqueRegion):
+ (WebKitTests::TestContentLayerChromium::setOpaqueContentsRect):
+ (TestContentLayerChromium):
+ (WebKitTests::TestContentLayerImpl::TestContentLayerImpl):
+ (TestContentLayerImpl):
+ (WebKitTests::TestContentLayerImpl::visibleContentOpaqueRegion):
+ (WebKitTests::TestContentLayerImpl::setOpaqueContentsRect):
+ * tests/CCTiledLayerImplTest.cpp:
+ * tests/LayerChromiumTest.cpp:
+
+2012-04-09 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113656.
+ http://trac.webkit.org/changeset/113656
+ https://bugs.webkit.org/show_bug.cgi?id=83542
+
+ test is broken on chromium-win (Requested by simonjam on
+ #webkit).
+
+ * public/WebIntent.h:
+ (WebIntent):
+ * src/WebIntent.cpp:
+
+2012-04-09 James Robinson <jamesr@chromium.org>
+
+ [chromium] More unreviewed OwnPtr<>::operator= related clang build fixes in unit tests.
+
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/LayerChromiumTest.cpp:
+
+2012-04-09 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Cull occluded surface quads
+ https://bugs.webkit.org/show_bug.cgi?id=81227
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::CCOcclusionTrackerTest::TearDown):
+ (WebKitTests::CCOcclusionTrackerTest::createReplicaLayer):
+ (CCOcclusionTrackerTest):
+ (WebKitTests::CCOcclusionTrackerTest::setReplica):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
+ (WebKitTests):
+ (CCOcclusionTrackerTestReplicaOccluded):
+ (WebKitTests::CCOcclusionTrackerTestReplicaOccluded::runMyTest):
+ (CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded::runMyTest):
+ (CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently::runMyTest):
+ (CCOcclusionTrackerTestSurfaceChildOfSurface):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfSurface::runMyTest):
+
+2012-04-09 James Robinson <jamesr@chromium.org>
+
+ [chromium] Unreviewed build fix. OwnPtr<>::operator = breaks the build on clang, but not gcc :(
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHost::create):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/LayerChromiumTest.cpp:
+
+2012-04-09 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Make culling work with clipped rects
+ https://bugs.webkit.org/show_bug.cgi?id=83494
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude):
+ (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
+ (WebKitTests):
+ (CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect):
+ (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+ (WebCore::makeLayer):
+ (WebCore::TEST):
+
+2012-04-09 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113613.
+ http://trac.webkit.org/changeset/113613
+ https://bugs.webkit.org/show_bug.cgi?id=83509
+
+ crashing most chromium bots (Requested by simonjam on
+ #webkit).
+
+ * WebKit.gyp:
+ * features.gypi:
+ * public/WebBatteryStatus.h: Removed.
+ * public/WebBatteryStatusClient.h: Removed.
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ * public/WebViewClient.h:
+ (WebKit):
+ * src/BatteryClientImpl.cpp: Removed.
+ * src/BatteryClientImpl.h: Removed.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-04-09 James Robinson <jamesr@chromium.org>
+
+ [chromium] CCLayerTreeHost / WebLayerTreeView should be single ownership, not RefCounted
+ https://bugs.webkit.org/show_bug.cgi?id=83413
+
+ Reviewed by Adrienne Walker.
+
+ Updates tests and implementation for RefPtr->OwnPtr switch. One nice benefit is that since WebLayerTreeView is
+ explicitly owned by the user of the API we can safely rely on them managing the lifetime of the client and thus
+ don't have to null check the client all the time.
+
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::reset):
+ (WebKit::WebLayerTreeView::isNull):
+ (WebKit::WebLayerTreeView::initialize):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::create):
+ (WebKit::WebLayerTreeViewImpl::willBeginFrame):
+ (WebKit::WebLayerTreeViewImpl::updateAnimations):
+ (WebKit::WebLayerTreeViewImpl::layout):
+ (WebKit::WebLayerTreeViewImpl::applyScrollAndScale):
+ (WebKit::WebLayerTreeViewImpl::createContext):
+ (WebKit::WebLayerTreeViewImpl::didRecreateContext):
+ (WebKit::WebLayerTreeViewImpl::didCommit):
+ (WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
+ (WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
+ (WebKit::WebLayerTreeViewImpl::scheduleComposite):
+ * src/WebLayerTreeViewImpl.h:
+ (WebLayerTreeViewImpl):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHost::create):
+ (CCLayerTreeHostTest):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/LayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-04-09 Joshua Bell <jsbell@chromium.org>
+
+ Unreviewed, rolling out r113473.
+ http://trac.webkit.org/changeset/113473
+ https://bugs.webkit.org/show_bug.cgi?id=83074
+
+ Change does not handle cursor retention of LevelDB iterators
+
+ * WebKit.gypi:
+ * tests/IDBDatabaseBackendTest.cpp: Removed.
+
+2012-04-06 James Robinson <jamesr@chromium.org>
+
+ [chromium] Texture copies should happen after incremental updates to preserve commit atomicity
+ https://bugs.webkit.org/show_bug.cgi?id=83392
+
+ Reviewed by Adrienne Walker.
+
+ * tests/Canvas2DLayerChromiumTest.cpp:
+
+2012-04-09 Sadrul Habib Chowdhury <sadrul@chromium.org>
+
+ [chromium] Add Battery Status API support.
+
+ The battery-client (BatteryClientChromium) will notify the client (WebBatteryStatusClient) when to start or stop
+ sending battery status updates. The client, in response will send the notifications to WebViewImpl, which sends
+ this update information to the WebCore::BatteryClient, and it triggers the appropriate javascript-callbacks.
+ The spec is at http://www.w3.org/TR/2011/WD-battery-status-20111129/.
+ https://bugs.webkit.org/show_bug.cgi?id=83284
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * features.gypi:
+ * public/WebBatteryStatus.h: Added.
+ (WebKit):
+ (WebBatteryStatus):
+ (WebKit::WebBatteryStatus::WebBatteryStatus):
+ * public/WebBatteryStatusClient.h: Added.
+ (WebKit):
+ (WebBatteryStatusClient):
+ (WebKit::WebBatteryStatusClient::~WebBatteryStatusClient):
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ (WebKit::WebView::updateBatteryStatus):
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::batteryStatusClient):
+ * src/BatteryClientImpl.cpp: Added.
+ (WebKit):
+ (WebKit::BatteryClientImpl::BatteryClientImpl):
+ (WebKit::BatteryClientImpl::updateBatteryStatus):
+ (WebKit::BatteryClientImpl::setController):
+ (WebKit::BatteryClientImpl::startUpdating):
+ (WebKit::BatteryClientImpl::stopUpdating):
+ (WebKit::BatteryClientImpl::batteryControllerDestroyed):
+ * src/BatteryClientImpl.h: Added.
+ (WebKit):
+ (BatteryClientImpl):
+ (WebKit::BatteryClientImpl::~BatteryClientImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit):
+ (WebKit::WebViewImpl::updateBatteryStatus):
+ * src/WebViewImpl.h:
+ (WebKit):
+ (WebViewImpl):
+
+2012-04-09 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Fix layer sorting perspective w if w becomes negative
+ https://bugs.webkit.org/show_bug.cgi?id=82997
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerSorterTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-04-09 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Flip transition painting delayed with threaded animations
+ https://bugs.webkit.org/show_bug.cgi?id=82571
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-09 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113561.
+ http://trac.webkit.org/changeset/113561
+ https://bugs.webkit.org/show_bug.cgi?id=83487
+
+ broke webkit_unit_tests (Requested by simonjam on #webkit).
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+
+2012-04-09 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Make culling work with clipped rects
+ https://bugs.webkit.org/show_bug.cgi?id=83217
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude):
+ (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
+ (WebKitTests):
+ (CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect):
+ (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+
+2012-04-06 Ami Fischman <fischman@chromium.org>
+
+ Roll Chromium DEPS
+ https://bugs.webkit.org/show_bug.cgi?id=83389
+
+ Unreviewed, just a DEPS roll (130110:131183)
+
+ * DEPS:
+
+2012-04-06 James Robinson <jamesr@chromium.org>
+
+ WebGL content swapped at wrong time in threaded compositing mode
+ https://bugs.webkit.org/show_bug.cgi?id=82275
+
+ Reviewed by Kenneth Russell.
+
+ * tests/WebGLLayerChromiumTest.cpp:
+ (WebKit::TEST):
+
+2012-04-06 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):
+ (MockIDBBackingStore):
+ (WebCore::TEST):
+
+2012-04-06 Kent Tamura <tkent@chromium.org>
+
+ Calendar Picker: Add code to open/close the calendar picker
+ https://bugs.webkit.org/show_bug.cgi?id=83258
+
+ Reviewed by Hajime Morita.
+
+ * features.gypi: Enable ENABLE_PAGE_POPUP for non-Android
+ platforms. This is needed because ENABLE_CALENDAR_PICKER now depends on
+ ENABLE_PAGE_POPUP.
+ * src/ChroemClientImpl.cpp: Add stubs.
+ (WebKit::ChromeClientImpl::openPagePopup):
+ (WebKit::ChromeClientImpl::closePagePopup):
+ * src/ChromeClientImpl.h: Add declarations of openPagePopup() and closePagePopup().
+
+2012-04-05 Hironori Bono <hbono@chromium.org>
+
+ [Chromium] moving a cursor on a misspelled word should not remove a misspelled underline
+ https://bugs.webkit.org/show_bug.cgi?id=83214
+
+ Reviewed by Ryosuke Niwa.
+
+ When Chrome enables asynchronous spellchecking, it adds Spelling markers in the
+ background. For this case, moving a cursor should not remove these markers
+ because it requires Chrome to spellcheck text again. This change prevents
+ removing Spelling markers added by spellcheckers asynchronously.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): use marker descriptions instead of spellchecking text when Chrome enables asynchronous spellchecking.
+
+2012-04-05 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Record the number of tiles paint-culled instead of the incorrect number of pixels
+ https://bugs.webkit.org/show_bug.cgi?id=82423
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TEST):
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-04-05 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Need to clip to homogeneous w=0 plane when applying transforms.
+ https://bugs.webkit.org/show_bug.cgi?id=80806
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-05 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Cleanup test, redundant code in CCSchedulerTest.NoBeginFrameWhenDrawFails
+ https://bugs.webkit.org/show_bug.cgi?id=83300
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::TEST):
+
+2012-04-05 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113241.
+ http://trac.webkit.org/changeset/113241
+ https://bugs.webkit.org/show_bug.cgi?id=83293
+
+ Requested by sievers@chromium.org (Requested by zhenyao on
+ #webkit).
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::doBeginTest):
+
+2012-04-05 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113341.
+ http://trac.webkit.org/changeset/113341
+ https://bugs.webkit.org/show_bug.cgi?id=83299
+
+ bots caught some build errors (Requested by shawnsingh on
+ #webkit).
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
+2012-04-05 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Race condition in CCLayerTreeHostTestSynchronizeAnimationStartTimes
+ https://bugs.webkit.org/show_bug.cgi?id=83179
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestHooks::willAnimateLayers):
+ (WTF::MockLayerTreeHostImpl::animateLayers):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::willAnimateLayers):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::notifyAnimationStarted):
+
+2012-04-05 Justin Novosad <junov@chromium.org>
+
+ [Chromium] With the skia port, setting LCD text filtering is causing
+ texture cache invalidations of gpu canvas backing store
+ https://bugs.webkit.org/show_bug.cgi?id=74183
+
+ Reviewed by Stephen White.
+
+ Replacing unnecessary usage of SkCanvas::LayerIter with call to
+ SkCanvas::isDrawingToLayer(). Same results, lower overhead, and no
+ GPU texture invalidation.
+
+ * src/WebFontImpl.cpp:
+ (WebKit::WebFontImpl::drawText):
+
+2012-04-05 Lei Zhang <thestig@chromium.org>
+
+ [Chromium] Properly align members in WebInputEvent and subclasses to make Valgrind happy.
+ https://bugs.webkit.org/show_bug.cgi?id=81570
+
+ Reviewed by Darin Fisher.
+
+ * public/WebInputEvent.h:
+ (WebKit):
+ (WebKit::WebInputEvent::WebInputEvent):
+ (WebKeyboardEvent):
+ (WebKit::WebTouchEvent::WebTouchEvent):
+
+2012-04-05 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Need to clip to homogeneous w=0 plane when applying transforms.
+ https://bugs.webkit.org/show_bug.cgi?id=80806
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-04-05 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113307.
+ http://trac.webkit.org/changeset/113307
+ https://bugs.webkit.org/show_bug.cgi?id=83288
+
+ Requested by sievers@chromium.org (Requested by zhenyao on
+ #webkit).
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TEST_F):
+
+2012-04-05 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: [chromium] clean up WDTFC::saveAs after migration to save()
+ https://bugs.webkit.org/show_bug.cgi?id=83271
+
+ Reviewed by Yury Semikhatsky.
+
+ * public/WebDevToolsFrontendClient.h:
+
+2012-04-05 Hans Wennborg <hans@chromium.org>
+
+ webkit_unit_tests build fix.
+ https://bugs.webkit.org/show_bug.cgi?id=83261
+
+ Unreviewed, webkit_unit_tests buildfix.
+
+ The CCLayerTreeHostTestEmptyContentsShouldNotDraw.runMultiThread test
+ stopped working after r113254.
+
+ Disable it for now.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (WTF::TEST_F):
+
+2012-04-05 Jochen Eisinger <jochen@chromium.org>
+
+ [chromium] Only shut down V8 if we actually initialized it
+ https://bugs.webkit.org/show_bug.cgi?id=83159
+
+ Reviewed by Pavel Feldman.
+
+ * src/WebKit.cpp:
+ (WebKit::initialize):
+ (WebKit::shutdown):
+
+2012-04-05 Kinuko Yasuda <kinuko@chromium.org>
+
+ Expose DataTransferItem.getAsEntry() to allow users access dropped files as FileEntry
+ https://bugs.webkit.org/show_bug.cgi?id=82592
+
+ Reviewed by David Levin.
+
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::filesystemId): Added implementation.
+ (WebKit::WebDragData::setFilesystemId): Added implementation.
+
+2012-04-04 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Calendar Picker: Add localization functions
+ https://bugs.webkit.org/show_bug.cgi?id=83235
+
+ Reviewed by Adam Barth.
+
+ Implement calendarTodayText() and calendarClearText(), which are
+ introduced in http://trac.webkit.org/changeset/113166
+
+ * public/platform/WebLocalizedString.h:
+ Add CalendarClear and CalendarToday.
+ * src/LocalizedStrings.cpp:
+ (WebCore::calendarTodayText): Added.
+ (WebCore::calendarClearText): Added.
+
+2012-04-04 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call histogramEnumeration directly
+ https://bugs.webkit.org/show_bug.cgi?id=83106
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring project to remove the PlatformSupport
+ abstraction from some functions. See bug 82948.
+
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::shouldRunModalDialogDuringPageDismissal):
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-04 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Move recursive renderSurface clearing to CCLayerTreeHostImpl
+ https://bugs.webkit.org/show_bug.cgi?id=82091
+
+ Reviewed by James Robinson.
+
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromiumClient::FakeLayerRendererChromiumClient):
+
+2012-04-04 Daniel Sievers <sievers@chromium.org>
+
+ [Chromium] Always skip draw and readback if there is nothing
+ to draw.
+ https://bugs.webkit.org/show_bug.cgi?id=82680
+
+ This avoids corruption from pushing frames that have no valid
+ content drawn into them.
+ Also in addition to checking for non-existing root layers, check
+ for root layers with no content bounds. It's possible to see those
+ with kForceCompositing mode for empty documents.
+
+ Reviewed by James Robinson.
+
+ Added CCLayerTreeHostTestEmptyContentsShouldNotDraw.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::doBeginTest):
+ (WTF):
+ (CCLayerTreeHostTestEmptyContentsShouldNotDraw):
+ (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::CCLayerTreeHostTestEmptyContentsShouldNotDraw):
+ (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::beginTest):
+ (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::didCommitAndDrawFrame):
+ (WTF::CCLayerTreeHostTestEmptyContentsShouldNotDraw::afterTest):
+ (WTF::TEST_F):
+
+2012-04-04 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call histogramCustomCounts directly
+ https://bugs.webkit.org/show_bug.cgi?id=83112
+
+ Reviewed by Adam Barth.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::paint):
+ (WebKit::WebViewImplContentPainter::paint):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ * src/painting/PaintAggregator.cpp:
+
+2012-04-04 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call suddenTerminationChanged directly
+ https://bugs.webkit.org/show_bug.cgi?id=83114
+
+ Reviewed by Adam Barth.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-04 Adam Barth <abarth@webkit.org>
+
+ figure out how to export webcore symbols from webkit.dll properly
+ https://bugs.webkit.org/show_bug.cgi?id=83105
+
+ Reviewed by Dimitri Glazkov.
+
+ * WebKit.gyp:
+ - We now compile the platform support files as part of webkit.dll
+ to make sure the lib contains the obj files and therefore exports
+ the necessary symbols. In principle, we could use a defs file to
+ achieve the same thing, but those files are a pain to maintain.
+ * src/WebKit.cpp:
+ (WebKit::shutdown):
+ - Unwind our ugly, ugly hack to make the Windows component build
+ work.
+
+2012-04-04 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call sandboxEnabled directly
+ https://bugs.webkit.org/show_bug.cgi?id=83113
+
+ Reviewed by Adam Barth.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+
+2012-04-04 Kausalya Madhusudhanan <kmadhusu@chromium.org>
+
+ [Coverity] Address some uninit constructor values.
+ https://bugs.webkit.org/show_bug.cgi?id=82424
+
+ Reviewed by Stephen White.
+
+ New tests are not required since I did not modify any code behavior. I just initialized the class member variables in the constructor.
+
+ * src/DatabaseObserver.cpp:
+ (WebKit::AllowDatabaseMainThreadBridge::AllowDatabaseMainThreadBridge):
+ * src/LocalFileSystemChromium.cpp:
+ (WebCore):
+
+2012-04-04 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, temporary dirty hack to make Win Debug work again.
+
+ * All.gyp: Temporarily removed TestWebKitAPI target.
+
+2012-04-04 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: migrate from InspectorFrontendHost.saveAs to InspectorFrontendHost.save.
+ https://bugs.webkit.org/show_bug.cgi?id=83162
+
+ Reviewed by Yury Semikhatsky.
+
+ * public/WebDevToolsFrontendClient.h:
+ * src/InspectorFrontendClientImpl.cpp:
+ (WebKit::InspectorFrontendClientImpl::canSave):
+ (WebKit::InspectorFrontendClientImpl::save):
+ * src/InspectorFrontendClientImpl.h:
+ (InspectorFrontendClientImpl):
+
+2012-04-04 Hans Wennborg <hans@chromium.org>
+
+ WebSpeechRecognizer.h: add missing forward declaration
+ https://bugs.webkit.org/show_bug.cgi?id=83150
+
+ Reviewed by Tony Gentilcore.
+
+ Add missing forward declaration of WebSpeechRecognitionParams.
+
+ * public/WebSpeechRecognizer.h:
+ (WebKit):
+
+2012-04-03 Hans Wennborg <hans@chromium.org>
+
+ Speech JavaScript API: Plumbing for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=81667
+
+ Reviewed by Darin Fisher.
+
+ Add plumbing for speech recognition.
+
+ The implementer is expected to implement the WebSpeechRecognizer interface.
+ The start(), stop(), and abort() functions of that interface take a
+ WebSpeechRecognitionHandle argument, which identifies the object which has
+ requested the action, and a pointer to a WebSpeechRecognitionClient interface,
+ through which it should send back notifications on progress, errors, etc.
+
+ SpeechRecognitionClientProxy passes data between the WebCore and WebKit layers,
+ implementing the WebCore::SpeechRecognitionClient and WebKit::WebSpeechRecognizerClient
+ interfaces.
+
+ * WebKit.gyp:
+ * public/WebSpeechGrammar.h:
+ (WebCore):
+ (WebKit):
+ (WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::~WebSpeechGrammar):
+ * public/WebSpeechRecognitionHandle.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::~WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::operator=):
+ (WebKit::operator==):
+ (WebKit::operator!=):
+ (WebKit::operator<):
+ * public/WebSpeechRecognitionParams.h:
+ (WebKit):
+ (WebSpeechRecognitionParams):
+ (WebKit::WebSpeechRecognitionParams::grammars):
+ (WebKit::WebSpeechRecognitionParams::language):
+ (WebKit::WebSpeechRecognitionParams::continuous):
+ * public/WebSpeechRecognitionResult.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSpeechRecognitionResult):
+ (WebKit::WebSpeechRecognitionResult::WebSpeechRecognitionResult):
+ (WebKit::WebSpeechRecognitionResult::~WebSpeechRecognitionResult):
+ * public/WebSpeechRecognizer.h:
+ (WebKit):
+ (WebSpeechRecognizer):
+ (WebKit::WebSpeechRecognizer::start):
+ (WebKit::WebSpeechRecognizer::stop):
+ (WebKit::WebSpeechRecognizer::abort):
+ (WebKit::WebSpeechRecognizer::~WebSpeechRecognizer):
+ * public/WebSpeechRecognizerClient.h: Added.
+ (WebKit):
+ (WebSpeechRecognizerClient):
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::speechRecognizer):
+ * src/SpeechRecognitionClientProxy.cpp: Added.
+ (WebKit):
+ (WebKit::SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy):
+ (WebKit::SpeechRecognitionClientProxy::create):
+ (WebKit::SpeechRecognitionClientProxy::start):
+ (WebKit::SpeechRecognitionClientProxy::stop):
+ (WebKit::SpeechRecognitionClientProxy::abort):
+ (WebKit::SpeechRecognitionClientProxy::didStartAudio):
+ (WebKit::SpeechRecognitionClientProxy::didStartSound):
+ (WebKit::SpeechRecognitionClientProxy::didStartSpeech):
+ (WebKit::SpeechRecognitionClientProxy::didEndSpeech):
+ (WebKit::SpeechRecognitionClientProxy::didEndSound):
+ (WebKit::SpeechRecognitionClientProxy::didEndAudio):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveResult):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveNoMatch):
+ (WebKit::SpeechRecognitionClientProxy::didDeleteResult):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveError):
+ (WebKit::SpeechRecognitionClientProxy::didStart):
+ (WebKit::SpeechRecognitionClientProxy::didEnd):
+ (WebKit::SpeechRecognitionClientProxy::SpeechRecognitionClientProxy):
+ * src/SpeechRecognitionClientProxy.h: Added.
+ (WebKit):
+ (SpeechRecognitionClientProxy):
+ * src/WebSpeechGrammar.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechGrammar::reset):
+ (WebKit::WebSpeechGrammar::WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::operator=):
+ (WebKit::WebSpeechGrammar::src):
+ (WebKit::WebSpeechGrammar::weight):
+ * src/WebSpeechRecognitionHandle.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionHandle::reset):
+ (WebKit::WebSpeechRecognitionHandle::assign):
+ (WebKit::WebSpeechRecognitionHandle::equals):
+ (WebKit::WebSpeechRecognitionHandle::lessThan):
+ (WebKit::WebSpeechRecognitionHandle::WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::operator=):
+ (WebKit::WebSpeechRecognitionHandle::operator PassRefPtr<SpeechRecognition>):
+ * src/WebSpeechRecognitionParams.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionParams::WebSpeechRecognitionParams):
+ * src/WebSpeechRecognitionResult.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionResult::assign):
+ (WebKit::WebSpeechRecognitionResult::reset):
+ (WebKit::WebSpeechRecognitionResult::operator PassRefPtr<WebCore::SpeechRecognitionResult>):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-04-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r113149.
+ http://trac.webkit.org/changeset/113149
+ https://bugs.webkit.org/show_bug.cgi?id=83126
+
+ for breaking Chromium builders (Requested by pfeldman on
+ #webkit).
+
+ * WebKit.gyp:
+ * public/WebSpeechGrammar.h: Removed.
+ * public/WebSpeechRecognitionHandle.h: Removed.
+ * public/WebSpeechRecognitionParams.h: Removed.
+ * public/WebSpeechRecognitionResult.h: Removed.
+ * public/WebSpeechRecognizer.h: Removed.
+ * public/WebSpeechRecognizerClient.h: Removed.
+ * public/WebViewClient.h:
+ (WebKit):
+ * src/SpeechRecognitionClientProxy.cpp: Removed.
+ * src/SpeechRecognitionClientProxy.h: Removed.
+ * src/WebSpeechGrammar.cpp: Removed.
+ * src/WebSpeechRecognitionHandle.cpp: Removed.
+ * src/WebSpeechRecognitionResult.cpp: Removed.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-04-03 Hans Wennborg <hans@chromium.org>
+
+ Speech JavaScript API: Plumbing for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=81667
+
+ Reviewed by Darin Fisher.
+
+ Add plumbing for speech recognition.
+
+ The implementer is expected to implement the WebSpeechRecognizer interface.
+ The start(), stop(), and abort() functions of that interface take a
+ WebSpeechRecognitionHandle argument, which identifies the object which has
+ requested the action, and a pointer to a WebSpeechRecognitionClient interface,
+ through which it should send back notifications on progress, errors, etc.
+
+ SpeechRecognitionClientProxy passes data between the WebCore and WebKit layers,
+ implementing the WebCore::SpeechRecognitionClient and WebKit::WebSpeechRecognizerClient
+ interfaces.
+
+ * WebKit.gyp:
+ * public/WebSpeechGrammar.h:
+ (WebCore):
+ (WebKit):
+ (WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::~WebSpeechGrammar):
+ * public/WebSpeechRecognitionHandle.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::~WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::operator=):
+ (WebKit::operator==):
+ (WebKit::operator!=):
+ (WebKit::operator<):
+ * public/WebSpeechRecognitionParams.h:
+ (WebKit):
+ (WebSpeechRecognitionParams):
+ (WebKit::WebSpeechRecognitionParams::grammars):
+ (WebKit::WebSpeechRecognitionParams::language):
+ (WebKit::WebSpeechRecognitionParams::continuous):
+ * public/WebSpeechRecognitionResult.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSpeechRecognitionResult):
+ (WebKit::WebSpeechRecognitionResult::WebSpeechRecognitionResult):
+ (WebKit::WebSpeechRecognitionResult::~WebSpeechRecognitionResult):
+ * public/WebSpeechRecognizer.h:
+ (WebKit):
+ (WebSpeechRecognizer):
+ (WebKit::WebSpeechRecognizer::start):
+ (WebKit::WebSpeechRecognizer::stop):
+ (WebKit::WebSpeechRecognizer::abort):
+ (WebKit::WebSpeechRecognizer::~WebSpeechRecognizer):
+ * public/WebSpeechRecognizerClient.h: Added.
+ (WebKit):
+ (WebSpeechRecognizerClient):
+ * public/WebViewClient.h:
+ (WebKit):
+ (WebViewClient):
+ (WebKit::WebViewClient::speechRecognizer):
+ * src/SpeechRecognitionClientProxy.cpp: Added.
+ (WebKit):
+ (WebKit::SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy):
+ (WebKit::SpeechRecognitionClientProxy::create):
+ (WebKit::SpeechRecognitionClientProxy::start):
+ (WebKit::SpeechRecognitionClientProxy::stop):
+ (WebKit::SpeechRecognitionClientProxy::abort):
+ (WebKit::SpeechRecognitionClientProxy::didStartAudio):
+ (WebKit::SpeechRecognitionClientProxy::didStartSound):
+ (WebKit::SpeechRecognitionClientProxy::didStartSpeech):
+ (WebKit::SpeechRecognitionClientProxy::didEndSpeech):
+ (WebKit::SpeechRecognitionClientProxy::didEndSound):
+ (WebKit::SpeechRecognitionClientProxy::didEndAudio):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveResult):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveNoMatch):
+ (WebKit::SpeechRecognitionClientProxy::didDeleteResult):
+ (WebKit::SpeechRecognitionClientProxy::didReceiveError):
+ (WebKit::SpeechRecognitionClientProxy::didStart):
+ (WebKit::SpeechRecognitionClientProxy::didEnd):
+ (WebKit::SpeechRecognitionClientProxy::SpeechRecognitionClientProxy):
+ * src/SpeechRecognitionClientProxy.h: Added.
+ (WebKit):
+ (SpeechRecognitionClientProxy):
+ * src/WebSpeechGrammar.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechGrammar::reset):
+ (WebKit::WebSpeechGrammar::WebSpeechGrammar):
+ (WebKit::WebSpeechGrammar::operator=):
+ (WebKit::WebSpeechGrammar::src):
+ (WebKit::WebSpeechGrammar::weight):
+ * src/WebSpeechRecognitionHandle.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionHandle::reset):
+ (WebKit::WebSpeechRecognitionHandle::assign):
+ (WebKit::WebSpeechRecognitionHandle::equals):
+ (WebKit::WebSpeechRecognitionHandle::lessThan):
+ (WebKit::WebSpeechRecognitionHandle::WebSpeechRecognitionHandle):
+ (WebKit::WebSpeechRecognitionHandle::operator=):
+ (WebKit::WebSpeechRecognitionHandle::operator PassRefPtr<SpeechRecognition>):
+ * src/WebSpeechRecognitionParams.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionParams::WebSpeechRecognitionParams):
+ * src/WebSpeechRecognitionResult.cpp: Added.
+ (WebKit):
+ (WebKit::WebSpeechRecognitionResult::assign):
+ (WebKit::WebSpeechRecognitionResult::reset):
+ (WebKit::WebSpeechRecognitionResult::operator PassRefPtr<WebCore::SpeechRecognitionResult>):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ * src/WebViewImpl.h:
+ (WebKit):
+
+2012-04-03 Yuta Kitamura <yutak@chromium.org>
+
+ Crash in WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadCreateWebSocketChannel
+ https://bugs.webkit.org/show_bug.cgi?id=82873
+
+ Reviewed by David Levin.
+
+ Change the function signature of WorkerLoaderProxy::postTaskForModeToWorkerContext().
+
+ * src/WebSharedWorkerImpl.cpp:
+ (WebKit::WebSharedWorkerImpl::postTaskForModeToWorkerContext):
+ * src/WebSharedWorkerImpl.h:
+ (WebSharedWorkerImpl):
+ * src/WebWorkerClientImpl.cpp:
+ (WebKit::WebWorkerClientImpl::postTaskForModeToWorkerContext):
+ * src/WebWorkerClientImpl.h:
+ (WebWorkerClientImpl):
+
+2012-04-03 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Include Image.h in TextFieldDecoratorImpl.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=83066
+
+ Reviewed by James Robinson.
+
+ * src/TextFieldDecoratorImpl.cpp:
+
+2012-04-03 Rafael Weinstein <rafaelw@chromium.org>
+
+ Use V8 completion callback API to assert that V8RecursionScope is on the stack whenever invoking script
+ https://bugs.webkit.org/show_bug.cgi?id=79131
+
+ Reviewed by Adam Barth.
+
+ * WebKit.gyp:
+ * public/WebFrame.h:
+ (v8):
+ (WebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit):
+ (WebKit::WebFrameImpl::callFunctionEvenIfScriptDisabled):
+ * src/WebFrameImpl.h:
+ (WebFrameImpl):
+ * src/WebKit.cpp:
+ (WebKit):
+ (WebKit::assertV8RecursionScope):
+ (WebKit::initialize):
+ (WebKit::shutdown):
+
+2012-04-03 Adam Barth <abarth@webkit.org>
+
+ Unreviewed. This patch adds an ugly, ugly hack to bandaid over the
+ Windows component build. See comments in the code for details.
+
+ * src/WebKit.cpp:
+ (WebKit::shutdown):
+
+2012-04-03 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r113087.
+ http://trac.webkit.org/changeset/113087
+ https://bugs.webkit.org/show_bug.cgi?id=83068
+
+ Breaks Windows builds in other unpredictable ways.
+
+ * WebKit.gyp: Removed the hack.
+
+2012-04-03 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Switch touchpad fling curve physics to absolute (not scaled) curve.
+ https://bugs.webkit.org/show_bug.cgi?id=83061
+
+ Reviewed by James Robinson.
+
+ * tests/PlatformGestureCurveTest.cpp:
+
+2012-04-02 Zhenyao Mo <zmo@google.com>
+
+ Implement WebGLShaderPrecisionFormat
+ https://bugs.webkit.org/show_bug.cgi?id=75925
+
+ Reviewed by Kenneth Russell.
+
+ * src/GraphicsContext3DChromium.cpp: Add getShaderPrecisionFormat().
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h: Ditto.
+ (GraphicsContext3DPrivate):
+ * tests/FakeWebGraphicsContext3D.h: Ditto.
+ (FakeWebGraphicsContext3D):
+
+2012-04-03 Dirk Pranke <dpranke@chromium.org>
+
+ disable incremental linking for debug of webkit
+ https://bugs.webkit.org/show_bug.cgi?id=83068
+
+ Reviewed by Adam Barth.
+
+ Now that we need to export symbols from webkit.dll that are
+ defined in webcore_platform, we have to enable ULDI in order for
+ incremental linking to work (which is used in debug mode).
+
+ * WebKit.gyp:
+
+2012-04-03 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Fix incorrect comment in CCDamageTrackerTest
+ https://bugs.webkit.org/show_bug.cgi?id=82118
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-04-03 Adam Barth <abarth@webkit.org>
+
+ Another attempt to fix the Windows build. This uses WebSecurityOrigin
+ has a value type but doesn't include the header.
+
+ * public/WebUserMediaRequest.h:
+ (WebKit):
+
+2012-04-03 'Pavel Feldman' <pfeldman@chromium.org>
+
+ Not reviewed. Follow up to inspector's r113032: change provisional method signature a bit.
+
+ * public/WebDevToolsFrontendClient.h:
+ (WebKit::WebDevToolsFrontendClient::save):
+
+2012-04-03 Bolin Hsu <bhsu@google.com>
+
+ [Chromium] Add click count and modifiers to the factory method of mouse event.
+ https://bugs.webkit.org/show_bug.cgi?id=82502
+
+ Modify WebInputEventFactory::mouseEvent() to take click count
+ and modifiers from input parameters. Sample use cases of these
+ are double click, triple click, Ctrl+click, etc.
+
+ Reviewed by Eric Seidel.
+
+ * public/android/WebInputEventFactory.h:
+ * src/android/WebInputEventFactory.cpp:
+ (WebKit::WebInputEventFactory::mouseEvent):
+
+2012-04-03 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call incrementStatsCounter directly
+ https://bugs.webkit.org/show_bug.cgi?id=83023
+
+ Reviewed by Kentaro Hara.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::WebFrameImpl):
+
+2012-04-03 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Canvas2DLayerChromium::updateCompositorResources should flush after copying
+ https://bugs.webkit.org/show_bug.cgi?id=83013
+
+ Reviewed by Stephen White.
+
+ * tests/Canvas2DLayerChromiumTest.cpp: Make sure context is flushed after copying.
+
+2012-04-03 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: [chromium] add provisional save method into the frontend client.
+ https://bugs.webkit.org/show_bug.cgi?id=83022
+
+ Reviewed by Yury Semikhatsky.
+
+ * public/WebDevToolsFrontendClient.h:
+ (WebKit::WebDevToolsFrontendClient::save):
+
+2012-04-03 Bill Budge <bbudge@chromium.org>
+
+ WebViewImpl doesn't notify the page that the user has canceled fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=82760
+
+ Reviewed by Darin Fisher.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::willExitFullScreen):
+ (WebKit::WebViewImpl::exitFullScreenForElement):
+ * src/WebViewImpl.h:
+
+2012-04-02 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Add WebKit API for WebCore::TextFieldDecorator
+ https://bugs.webkit.org/show_bug.cgi?id=82143
+
+ Reviewed by Dimitri Glazkov.
+
+ Expose WebCore::TextFieldDecorator as
+ WebKit::WebTextFieldDecoratorClient. This change add capability to add
+ decoration buttons to text field <input> elements.
+
+ * WebKit.gyp: Add new files.
+ * public/WebTextFieldDecoratorClient.h: Added.
+ * public/WebView.h:
+ (WebKit): Add addTextFieldDecoratorClient().
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::willAddTextFieldDecorationsTo):
+ Calls willAddDecorationTo() of TextFieldDecorator objects owned by WebViewImpl.
+ (WebKit::ChromeClientImpl::addTextFieldDecorationsTo):
+ Apply TextFieldDecorationElement::decorate() for the specified input element.
+ * src/ChromeClientImpl.h:
+ (ChromeClientImpl): Add new function declarations.
+ * src/TextFieldDecoratorImpl.cpp:
+ Added. This is a bridge of WebCore::TextFieldDecorator and
+ WebKit::WebTextFieldDecoratorClient. This owns CachedImage objects
+ specfied by WebTextFieldDecoratorClient.
+ (WebKit::TextFieldDecoratorImpl::TextFieldDecoratorImpl):
+ (WebKit::TextFieldDecoratorImpl::create):
+ (WebKit::TextFieldDecoratorImpl::~TextFieldDecoratorImpl):
+ (WebKit::TextFieldDecoratorImpl::willAddDecorationTo):
+ (WebKit::TextFieldDecoratorImpl::imageForNormalState):
+ (WebKit::TextFieldDecoratorImpl::imageForDisabledState):
+ (WebKit::TextFieldDecoratorImpl::imageForReadonlyState):
+ (WebKit::TextFieldDecoratorImpl::handleClick):
+ (WebKit::TextFieldDecoratorImpl::willDetach):
+ * src/TextFieldDecoratorImpl.h: Added.
+ (TextFieldDecoratorImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::addTextFieldDecoratorClient):
+ Add implementation of WebView::addTextFieldDecoratorClient().
+ * src/WebViewImpl.h:
+ WebViewImpl owns a vector of TextFieldDecoratorImpl.
+ (WebViewImpl):
+ (WebKit::WebViewImpl::textFieldDecorators):
+
+2012-04-02 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove SkCanvas::LayerIter use from OpaqueRegionSkia
+ https://bugs.webkit.org/show_bug.cgi?id=82564
+
+ Reviewed by Stephen White.
+
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-04-02 Mark Pilgrim <pilgrim@chromium.org>
+
+ Call decrementStatsCounter directly
+ https://bugs.webkit.org/show_bug.cgi?id=82950
+
+ Reviewed by Adam Barth.
+
+ * src/PlatformSupport.cpp:
+ (WebCore):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::~WebFrameImpl):
+
+2012-04-02 Alexander Pavlov <apavlov@chromium.org>
+
+ [Chromium] Unreviewed, CCLayerTreeHost runMultiThread is flaky.
+ Related bug: https://bugs.webkit.org/show_bug.cgi?id=80811
+
+ Disabled CCLayerTreeHostTestAddAnimationWithTimingFunction.runMultiThread.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TEST_F):
+
+2012-04-02 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: Device metrics emulation should turn off when zero width and height are passed in
+ https://bugs.webkit.org/show_bug.cgi?id=82907
+
+ Currently this also requires the fontScaleFactor of 1 to be passed in, too. However, it results in
+ downsizing the FrameView to (0x0) on navigation with the open Inspector when the emulation is disabled.
+
+ Reviewed by Yury Semikhatsky.
+
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::overrideDeviceMetrics):
+
+2012-04-02 Kinuko Yasuda <kinuko@chromium.org>
+
+ Unreviewed, rolling chromium DEPS.
+
+ * DEPS:
+
+2012-04-02 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Disable ENABLE_INPUT_TYPE_COLOR for aura and android
+ https://bugs.webkit.org/show_bug.cgi?id=82863
+
+ Reviewed by Kent Tamura.
+
+ * features.gypi:
+
+2012-04-02 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move a number of virtual functions from WebKitPlatformSupport.h into Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=82865
+
+ Reviewed by Kent Tamura.
+
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKitPlatformSupport):
+
+2012-04-02 Kent Tamura <tkent@chromium.org>
+
+ Add a calendar picker indicator to date-type input fields
+ https://bugs.webkit.org/show_bug.cgi?id=80478
+
+ Reviewed by Hajime Morita.
+
+ * features.gypi: Enable CALENDAR_PICKER for non-Android platforms. This
+ doesn't affect any bahevior because INPUT_TYPE_DATE is disabled.
+
+2012-04-02 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move another block of headers from WebKit/chromium/public/platform to Platform/chromium/public
+ https://bugs.webkit.org/show_bug.cgi?id=82862
+
+ Rubber-stamped by Eric Seidel.
+
+ * WebKit.gyp:
+ * public/platform/WebAudioBus.h: Replaced.
+ * public/platform/WebAudioDevice.h: Replaced.
+ * public/platform/WebGamepad.h: Replaced.
+ * public/platform/WebGamepads.h: Replaced.
+ * public/platform/WebSocketStreamError.h: Replaced.
+ * public/platform/WebSocketStreamHandle.h: Replaced.
+ * public/platform/WebSocketStreamHandleClient.h: Replaced.
+ * src/WebAudioBus.cpp: Removed.
+
+2012-04-01 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move thread-related APIs from WebKit into Platform
+ https://bugs.webkit.org/show_bug.cgi?id=82858
+
+ Reviewed by Eric Seidel.
+
+ * WebKit.gyp:
+ * public/platform/WebThread.h: Replaced.
+ * public/platform/WebThreadSafeData.h: Replaced.
+ * src/WebThreadSafeData.cpp: Removed.
+
+2012-04-01 Jon Lee <jonlee@apple.com>
+
+ Rename notification properties and functions
+ https://bugs.webkit.org/show_bug.cgi?id=80482
+ <rdar://problem/10912432>
+
+ Reviewed by Kentaro Hara.
+
+ * src/WebNotification.cpp:
+ (WebKit::WebNotification::replaceId): Refactor to call tag().
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Delete WebKit/chromium/bridge
+ https://bugs.webkit.org/show_bug.cgi?id=82677
+
+ Reviewed by James Robinson.
+
+ Delete WebKit/chromium/bridge. This was a directory we were
+ experimenting with storing WebCore-namespaced code. Now we're able to
+ actually keep that code in WebCore itself, which is much more sensible.
+
+ * WebKit.gyp:
+ * bridge: Removed.
+ * bridge/DeprecatedPeerConnectionHandler.cpp: Removed.
+ * bridge/DeprecatedPeerConnectionHandlerInternal.cpp: Removed.
+ * bridge/DeprecatedPeerConnectionHandlerInternal.h: Removed.
+ * bridge/MediaStreamCenter.cpp: Removed.
+ * bridge/MediaStreamCenterInternal.cpp: Removed.
+ * bridge/MediaStreamCenterInternal.h: Removed.
+ * bridge/PeerConnection00Handler.cpp: Removed.
+ * bridge/PeerConnection00HandlerInternal.cpp: Removed.
+ * bridge/PeerConnection00HandlerInternal.h: Removed.
+ * public/platform/WebICECandidateDescriptor.h: Replaced.
+ * public/platform/WebICEOptions.h: Replaced.
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKitPlatformSupport):
+ * public/platform/WebMediaHints.h: Replaced.
+ * public/platform/WebMediaStreamCenter.h: Replaced.
+ * public/platform/WebMediaStreamCenterClient.h: Replaced.
+ * public/platform/WebMediaStreamComponent.h: Replaced.
+ * public/platform/WebMediaStreamDescriptor.h: Replaced.
+ * public/platform/WebMediaStreamSource.h: Replaced.
+ * public/platform/WebMediaStreamSourcesRequest.h: Replaced.
+ * public/platform/WebPeerConnection00Handler.h: Replaced.
+ * public/platform/WebPeerConnection00HandlerClient.h: Replaced.
+ * public/platform/WebPeerConnectionHandler.h: Replaced.
+ * public/platform/WebPeerConnectionHandlerClient.h: Replaced.
+ * public/platform/WebSessionDescriptionDescriptor.h: Replaced.
+ * public/platform/WebVector.h: Replaced.
+ * src/WebICECandidateDescriptor.cpp: Removed.
+ * src/WebICEOptions.cpp: Removed.
+ * src/WebMediaHints.cpp: Removed.
+ * src/WebMediaStreamComponent.cpp: Removed.
+ * src/WebMediaStreamDescriptor.cpp: Removed.
+ * src/WebMediaStreamSource.cpp: Removed.
+ * src/WebMediaStreamSourcesRequest.cpp: Removed.
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move ResourceHandle to WebCore/platform/network/chromium
+ https://bugs.webkit.org/show_bug.cgi?id=82657
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/ResourceHandle.cpp: Removed.
+ * src/ResourceHandleInternal.h: Removed.
+ * src/WrappedResourceRequest.h: Removed.
+ * src/WrappedResourceResponse.h: Removed.
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ Two more link errors. This time it's v8 we're missing.
+
+ * WebKitUnitTests.gyp:
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix the Windows component build. It seems we're just
+ missing GURL now.
+
+ * WebKitUnitTests.gyp:
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ Attempt to fix the Windows component build. The way we link the unit
+ tests in the component build is kind of nutty. Hopefully this approach
+ will eliminate the duplicate symbols we've been seeing.
+
+ * WebKitUnitTests.gyp:
+
+2012-03-30 Emil A Eklund <eae@chromium.org>
+
+ Change WebKit/WebKit2 platform code to use pixel snapped values
+ https://bugs.webkit.org/show_bug.cgi?id=82549
+
+ Reviewed by Eric Seidel.
+
+ * src/WebAccessibilityObject.cpp:
+ (WebKit::WebAccessibilityObject::boundingBoxRect):
+ Use pixelSnappedBoundingBoxRect instead of boundingBoxRect which returns
+ a LayoutRect.
+
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::characterIndexForPoint):
+ Use roundedPoint instead of point for hit testing as ranges use screen
+ cordinates which are represented with pixel accuracy.
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ https://bugs.webkit.org/show_bug.cgi?id=82582
+ Move CPP files related to ResourceHandle to WebCore/platform
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/WebHTTPBody.cpp: Removed.
+ * src/WebHTTPLoadInfo.cpp: Removed.
+ * src/WebURL.cpp: Removed.
+ * src/WebURLError.cpp: Removed.
+ * src/WebURLRequest.cpp: Removed.
+ * src/WebURLRequestPrivate.h: Removed.
+ * src/WebURLResponse.cpp: Removed.
+ * src/WebURLResponsePrivate.h: Removed.
+
+2012-03-30 Dirk Pranke <dpranke@chromium.org>
+
+ Roll chromium DEPS from 129593 to 129574.
+
+ Unreviewed.
+
+ * DEPS:
+
+2012-03-30 Adam Barth <abarth@webkit.org>
+
+ Move CPP files related to ResourceHandle to WebCore/platform
+ https://bugs.webkit.org/show_bug.cgi?id=82582
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/WebData.cpp: Removed.
+
+2012-03-30 Mark Pilgrim <pilgrim@chromium.org>
+
+ GEOLOCATION should be implemented as Page Supplement
+ https://bugs.webkit.org/show_bug.cgi?id=82228
+
+ Reviewed by Adam Barth.
+
+ Geolocation is now a Supplement in Page so the interface
+ has changed for setting up the page's geolocation client
+ initially and accessing the controller later.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
+2012-03-30 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Flaky animation unit test CCLayerTreeHostTestSynchronizeAnimationStartTimes
+ https://bugs.webkit.org/show_bug.cgi?id=82731
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::animateLayers):
+ (CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::notifyAnimationStarted):
+
+2012-03-30 Ian Vollick <vollick@chromium.org>
+
+ [chromium] assertion being hit in CCLayerAnimationController
+ https://bugs.webkit.org/show_bug.cgi?id=82237
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-03-30 Alexander Pavlov <apavlov@chromium.org>
+
+ [Chromium] Unreviewed Chromium Mac build fix.
+
+ * src/WebDevToolsAgentPrivate.h:
+ (WebKit):
+
+2012-03-30 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [Chromium] Implement Chromium-specific part of the device metrics emulation
+ https://bugs.webkit.org/show_bug.cgi?id=82612
+
+ This change implements the Chromium-specific code for overriding the device metrics, such as screen size
+ (by setting the FrameView size) and font zoom factor (necessary for certain emulated devices,)
+ and for painting the gutter overlay covering the WebView area not occupied by the associated FrameView.
+
+ Reviewed by Pavel Feldman.
+
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::canOverrideDeviceMetrics):
+ (WebKit):
+ (WebKit::InspectorClientImpl::overrideDeviceMetrics):
+ (WebKit::InspectorClientImpl::autoZoomPageToFitWidth):
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ (OverlayZOrders):
+ (DeviceMetricsSupport):
+ (WebKit::DeviceMetricsSupport::DeviceMetricsSupport):
+ (WebKit::DeviceMetricsSupport::~DeviceMetricsSupport):
+ (WebKit::DeviceMetricsSupport::setDeviceMetrics):
+ (WebKit::DeviceMetricsSupport::autoZoomPageToFitWidth):
+ (WebKit::DeviceMetricsSupport::applySizeOverrideIfNecessary):
+ (WebKit::DeviceMetricsSupport::restore):
+ (WebKit::DeviceMetricsSupport::applySizeOverrideInternal):
+ (WebKit::DeviceMetricsSupport::paintPageOverlay):
+ (WebKit::DeviceMetricsSupport::frameView):
+ (WebKit):
+ (WebKit::WebDevToolsAgentImpl::mainFrameViewCreated):
+ (WebKit::WebDevToolsAgentImpl::metricsOverridden):
+ (WebKit::WebDevToolsAgentImpl::overrideDeviceMetrics):
+ (WebKit::WebDevToolsAgentImpl::autoZoomPageToFitWidth):
+ (WebKit::WebDevToolsAgentImpl::highlight):
+ * src/WebDevToolsAgentImpl.h:
+ (WebCore):
+ (WebKit):
+ (WebDevToolsAgentImpl):
+ * src/WebDevToolsAgentPrivate.h:
+ (WebKit):
+ (WebDevToolsAgentPrivate):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::createFrameView):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::resize):
+ (WebKit::WebViewImpl::setZoomLevel):
+ (WebKit::WebViewImpl::setEmulatedTextZoomFactor):
+ (WebKit):
+ (WebKit::WebViewImpl::updateLayerTreeViewport):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ (WebKit::WebViewImpl::emulatedTextZoomFactor):
+
+2012-03-30 David Barr <davidbarr@chromium.org>
+
+ Split up top-level .gitignore and .gitattributes
+ https://bugs.webkit.org/show_bug.cgi?id=82687
+
+ Reviewed by Tor Arne Vestbø.
+
+ * .gitignore: Added.
+
+2012-03-30 Mike Reed <reed@google.com>
+
+ pass alpha directly to player, rather than creating a layer (for performance)
+ https://bugs.webkit.org/show_bug.cgi?id=82360
+
+ Reviewed by Stephen White.
+
+ Performance change, existing webkit tests apply.
+
+ * public/WebMediaPlayer.h:
+ (WebMediaPlayer):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::paintCurrentFrameInContext):
+
+2012-03-30 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
+
+ Add a "preview" state to Page Visibility API implementation
+ https://bugs.webkit.org/show_bug.cgi?id=81355
+
+ Reviewed by Adam Barth.
+
+ Updating the Page Visibility API implementation to the current spec version.
+
+ * public/WebPageVisibilityState.h:
+ * src/AssertMatchingEnums.cpp:
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setVisibilityState):
+
+2012-03-30 Keishi Hattori <keishi@webkit.org>
+
+ Change ENABLE_INPUT_COLOR to ENABLE_INPUT_TYPE_COLOR and enable it for chromium
+ https://bugs.webkit.org/show_bug.cgi?id=80972
+
+ Reviewed by Kent Tamura.
+
+ * features.gypi:
+ * src/ChromeClientImpl.cpp:
+ (WebKit):
+ * src/ChromeClientImpl.h:
+ (WebCore):
+ (ChromeClientImpl):
+ * src/ColorChooserProxy.cpp:
+ * src/ColorChooserProxy.h:
+ * src/WebColorChooserClientImpl.cpp:
+ * src/WebColorChooserClientImpl.h:
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ Unreviewed, rolling out r112572.
+ http://trac.webkit.org/changeset/112572
+ https://bugs.webkit.org/show_bug.cgi?id=82582
+
+ Does not compile in Windows component build
+
+ * WebKit.gyp:
+ * src/WebData.cpp: Renamed from Source/WebCore/platform/chromium/support/WebData.cpp.
+ (WebKit):
+ (WebKit::WebData::reset):
+ (WebKit::WebData::assign):
+ (WebKit::WebData::size):
+ (WebKit::WebData::data):
+ (WebKit::WebData::WebData):
+ (WebKit::WebData::operator=):
+ (WebKit::WebData::operator PassRefPtr<SharedBuffer>):
+ * src/WebHTTPBody.cpp: Renamed from Source/WebCore/platform/chromium/support/WebHTTPBody.cpp.
+ (WebKit):
+ (WebKit::WebHTTPBody::initialize):
+ (WebKit::WebHTTPBody::reset):
+ (WebKit::WebHTTPBody::assign):
+ (WebKit::WebHTTPBody::elementCount):
+ (WebKit::WebHTTPBody::elementAt):
+ (WebKit::WebHTTPBody::appendData):
+ (WebKit::WebHTTPBody::appendFile):
+ (WebKit::WebHTTPBody::appendFileRange):
+ (WebKit::WebHTTPBody::appendBlob):
+ (WebKit::WebHTTPBody::identifier):
+ (WebKit::WebHTTPBody::setIdentifier):
+ (WebKit::WebHTTPBody::containsPasswordData):
+ (WebKit::WebHTTPBody::setContainsPasswordData):
+ (WebKit::WebHTTPBody::WebHTTPBody):
+ (WebKit::WebHTTPBody::operator=):
+ (WebKit::WebHTTPBody::operator PassRefPtr<FormData>):
+ (WebKit::WebHTTPBody::ensureMutable):
+ * src/WebHTTPLoadInfo.cpp: Renamed from Source/WebCore/platform/chromium/support/WebHTTPLoadInfo.cpp.
+ (WebKit):
+ (WebKit::WebHTTPLoadInfo::initialize):
+ (WebKit::WebHTTPLoadInfo::reset):
+ (WebKit::WebHTTPLoadInfo::assign):
+ (WebKit::WebHTTPLoadInfo::WebHTTPLoadInfo):
+ (WebKit::WebHTTPLoadInfo::operator WTF::PassRefPtr<WebCore::ResourceLoadInfo>):
+ (WebKit::WebHTTPLoadInfo::httpStatusCode):
+ (WebKit::WebHTTPLoadInfo::setHTTPStatusCode):
+ (WebKit::WebHTTPLoadInfo::httpStatusText):
+ (WebKit::WebHTTPLoadInfo::setHTTPStatusText):
+ (WebKit::WebHTTPLoadInfo::encodedDataLength):
+ (WebKit::WebHTTPLoadInfo::setEncodedDataLength):
+ (WebKit::addHeader):
+ (WebKit::WebHTTPLoadInfo::addRequestHeader):
+ (WebKit::WebHTTPLoadInfo::addResponseHeader):
+ (WebKit::WebHTTPLoadInfo::requestHeadersText):
+ (WebKit::WebHTTPLoadInfo::setRequestHeadersText):
+ (WebKit::WebHTTPLoadInfo::responseHeadersText):
+ (WebKit::WebHTTPLoadInfo::setResponseHeadersText):
+ * src/WebURL.cpp: Renamed from Source/WebCore/platform/chromium/support/WebURL.cpp.
+ (WebKit):
+ (WebKit::WebURL::WebURL):
+ (WebKit::WebURL::operator=):
+ (WebKit::WebURL::operator WebCore::KURL):
+ * src/WebURLError.cpp: Renamed from Source/WebCore/platform/chromium/support/WebURLError.cpp.
+ (WebKit):
+ (WebKit::WebURLError::WebURLError):
+ (WebKit::WebURLError::operator=):
+ (WebKit::WebURLError::operator ResourceError):
+ * src/WebURLRequest.cpp: Renamed from Source/WebCore/platform/chromium/support/WebURLRequest.cpp.
+ (WebURLRequestPrivateImpl):
+ (WebKit::WebURLRequestPrivateImpl::WebURLRequestPrivateImpl):
+ (WebKit::WebURLRequestPrivateImpl::dispose):
+ (WebKit::WebURLRequestPrivateImpl::~WebURLRequestPrivateImpl):
+ (WebKit):
+ (WebKit::WebURLRequest::initialize):
+ (WebKit::WebURLRequest::reset):
+ (WebKit::WebURLRequest::assign):
+ (WebKit::WebURLRequest::isNull):
+ (WebKit::WebURLRequest::url):
+ (WebKit::WebURLRequest::setURL):
+ (WebKit::WebURLRequest::firstPartyForCookies):
+ (WebKit::WebURLRequest::setFirstPartyForCookies):
+ (WebKit::WebURLRequest::allowCookies):
+ (WebKit::WebURLRequest::setAllowCookies):
+ (WebKit::WebURLRequest::allowStoredCredentials):
+ (WebKit::WebURLRequest::setAllowStoredCredentials):
+ (WebKit::WebURLRequest::cachePolicy):
+ (WebKit::WebURLRequest::setCachePolicy):
+ (WebKit::WebURLRequest::httpMethod):
+ (WebKit::WebURLRequest::setHTTPMethod):
+ (WebKit::WebURLRequest::httpHeaderField):
+ (WebKit::WebURLRequest::setHTTPHeaderField):
+ (WebKit::WebURLRequest::addHTTPHeaderField):
+ (WebKit::WebURLRequest::clearHTTPHeaderField):
+ (WebKit::WebURLRequest::visitHTTPHeaderFields):
+ (WebKit::WebURLRequest::httpBody):
+ (WebKit::WebURLRequest::setHTTPBody):
+ (WebKit::WebURLRequest::reportUploadProgress):
+ (WebKit::WebURLRequest::setReportUploadProgress):
+ (WebKit::WebURLRequest::reportLoadTiming):
+ (WebKit::WebURLRequest::setReportRawHeaders):
+ (WebKit::WebURLRequest::reportRawHeaders):
+ (WebKit::WebURLRequest::setReportLoadTiming):
+ (WebKit::WebURLRequest::targetType):
+ (WebKit::WebURLRequest::hasUserGesture):
+ (WebKit::WebURLRequest::setHasUserGesture):
+ (WebKit::WebURLRequest::setTargetType):
+ (WebKit::WebURLRequest::requestorID):
+ (WebKit::WebURLRequest::setRequestorID):
+ (WebKit::WebURLRequest::requestorProcessID):
+ (WebKit::WebURLRequest::setRequestorProcessID):
+ (WebKit::WebURLRequest::appCacheHostID):
+ (WebKit::WebURLRequest::setAppCacheHostID):
+ (WebKit::WebURLRequest::downloadToFile):
+ (WebKit::WebURLRequest::setDownloadToFile):
+ (WebKit::WebURLRequest::extraData):
+ (WebKit::WebURLRequest::setExtraData):
+ (WebKit::WebURLRequest::toMutableResourceRequest):
+ (WebKit::WebURLRequest::toResourceRequest):
+ * src/WebURLRequestPrivate.h: Renamed from Source/WebCore/platform/chromium/support/WebURLRequestPrivate.h.
+ (WebKit):
+ (WebURLRequestPrivate):
+ (WebKit::WebURLRequestPrivate::WebURLRequestPrivate):
+ * src/WebURLResponse.cpp: Renamed from Source/WebCore/platform/chromium/support/WebURLResponse.cpp.
+ (WebURLResponsePrivateImpl):
+ (WebKit::WebURLResponsePrivateImpl::WebURLResponsePrivateImpl):
+ (WebKit::WebURLResponsePrivateImpl::dispose):
+ (WebKit::WebURLResponsePrivateImpl::~WebURLResponsePrivateImpl):
+ (WebKit):
+ (WebKit::WebURLResponse::initialize):
+ (WebKit::WebURLResponse::reset):
+ (WebKit::WebURLResponse::assign):
+ (WebKit::WebURLResponse::isNull):
+ (WebKit::WebURLResponse::url):
+ (WebKit::WebURLResponse::setURL):
+ (WebKit::WebURLResponse::connectionID):
+ (WebKit::WebURLResponse::setConnectionID):
+ (WebKit::WebURLResponse::connectionReused):
+ (WebKit::WebURLResponse::setConnectionReused):
+ (WebKit::WebURLResponse::loadTiming):
+ (WebKit::WebURLResponse::setLoadTiming):
+ (WebKit::WebURLResponse::httpLoadInfo):
+ (WebKit::WebURLResponse::setHTTPLoadInfo):
+ (WebKit::WebURLResponse::responseTime):
+ (WebKit::WebURLResponse::setResponseTime):
+ (WebKit::WebURLResponse::mimeType):
+ (WebKit::WebURLResponse::setMIMEType):
+ (WebKit::WebURLResponse::expectedContentLength):
+ (WebKit::WebURLResponse::setExpectedContentLength):
+ (WebKit::WebURLResponse::textEncodingName):
+ (WebKit::WebURLResponse::setTextEncodingName):
+ (WebKit::WebURLResponse::suggestedFileName):
+ (WebKit::WebURLResponse::setSuggestedFileName):
+ (WebKit::WebURLResponse::httpStatusCode):
+ (WebKit::WebURLResponse::setHTTPStatusCode):
+ (WebKit::WebURLResponse::httpStatusText):
+ (WebKit::WebURLResponse::setHTTPStatusText):
+ (WebKit::WebURLResponse::httpHeaderField):
+ (WebKit::WebURLResponse::setHTTPHeaderField):
+ (WebKit::WebURLResponse::addHTTPHeaderField):
+ (WebKit::WebURLResponse::clearHTTPHeaderField):
+ (WebKit::WebURLResponse::visitHTTPHeaderFields):
+ (WebKit::WebURLResponse::lastModifiedDate):
+ (WebKit::WebURLResponse::setLastModifiedDate):
+ (WebKit::WebURLResponse::appCacheID):
+ (WebKit::WebURLResponse::setAppCacheID):
+ (WebKit::WebURLResponse::appCacheManifestURL):
+ (WebKit::WebURLResponse::setAppCacheManifestURL):
+ (WebKit::WebURLResponse::securityInfo):
+ (WebKit::WebURLResponse::setSecurityInfo):
+ (WebKit::WebURLResponse::toMutableResourceResponse):
+ (WebKit::WebURLResponse::toResourceResponse):
+ (WebKit::WebURLResponse::wasCached):
+ (WebKit::WebURLResponse::setWasCached):
+ (WebKit::WebURLResponse::wasFetchedViaSPDY):
+ (WebKit::WebURLResponse::setWasFetchedViaSPDY):
+ (WebKit::WebURLResponse::wasNpnNegotiated):
+ (WebKit::WebURLResponse::setWasNpnNegotiated):
+ (WebKit::WebURLResponse::wasAlternateProtocolAvailable):
+ (WebKit::WebURLResponse::setWasAlternateProtocolAvailable):
+ (WebKit::WebURLResponse::wasFetchedViaProxy):
+ (WebKit::WebURLResponse::setWasFetchedViaProxy):
+ (WebKit::WebURLResponse::isMultipartPayload):
+ (WebKit::WebURLResponse::setIsMultipartPayload):
+ (WebKit::WebURLResponse::downloadFilePath):
+ (WebKit::WebURLResponse::setDownloadFilePath):
+ (WebKit::WebURLResponse::remoteIPAddress):
+ (WebKit::WebURLResponse::setRemoteIPAddress):
+ (WebKit::WebURLResponse::remotePort):
+ (WebKit::WebURLResponse::setRemotePort):
+ (WebKit::WebURLResponse::extraData):
+ (WebKit::WebURLResponse::setExtraData):
+ * src/WebURLResponsePrivate.h: Renamed from Source/WebCore/platform/chromium/support/WebURLResponsePrivate.h.
+ (WebKit):
+ (WebURLResponsePrivate):
+ (WebKit::WebURLResponsePrivate::WebURLResponsePrivate):
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ Unreviewed, rolling out r112579.
+ http://trac.webkit.org/changeset/112579
+ https://bugs.webkit.org/show_bug.cgi?id=82657
+
+ Does not compile in Windows component build
+
+ * WebKit.gyp:
+ * src/ResourceHandle.cpp: Renamed from Source/WebCore/platform/network/chromium/ResourceHandle.cpp.
+ (WebCore):
+ (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+ (WebCore::ResourceHandleInternal::start):
+ (WebCore::ResourceHandleInternal::cancel):
+ (WebCore::ResourceHandleInternal::setDefersLoading):
+ (WebCore::ResourceHandleInternal::allowStoredCredentials):
+ (WebCore::ResourceHandleInternal::willSendRequest):
+ (WebCore::ResourceHandleInternal::didSendData):
+ (WebCore::ResourceHandleInternal::didReceiveResponse):
+ (WebCore::ResourceHandleInternal::didDownloadData):
+ (WebCore::ResourceHandleInternal::didReceiveData):
+ (WebCore::ResourceHandleInternal::didReceiveCachedMetadata):
+ (WebCore::ResourceHandleInternal::didFinishLoading):
+ (WebCore::ResourceHandleInternal::didFail):
+ (WebCore::ResourceHandleInternal::FromResourceHandle):
+ (WebCore::ResourceHandle::ResourceHandle):
+ (WebCore::ResourceHandle::create):
+ (WebCore::ResourceHandle::firstRequest):
+ (WebCore::ResourceHandle::client):
+ (WebCore::ResourceHandle::setClient):
+ (WebCore::ResourceHandle::setDefersLoading):
+ (WebCore::ResourceHandle::start):
+ (WebCore::ResourceHandle::hasAuthenticationChallenge):
+ (WebCore::ResourceHandle::clearAuthentication):
+ (WebCore::ResourceHandle::cancel):
+ (WebCore::ResourceHandle::~ResourceHandle):
+ (WebCore::ResourceHandle::loadsBlocked):
+ (WebCore::ResourceHandle::loadResourceSynchronously):
+ (WebCore::ResourceHandle::willLoadFromCache):
+ (WebCore::ResourceHandle::cacheMetadata):
+ * src/ResourceHandleInternal.h: Renamed from Source/WebCore/platform/network/chromium/ResourceHandleInternal.h.
+ (WebCore):
+ (ResourceHandleInternal):
+ (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
+ (WebCore::ResourceHandleInternal::setOwner):
+ (WebCore::ResourceHandleInternal::request):
+ (WebCore::ResourceHandleInternal::client):
+ (WebCore::ResourceHandleInternal::setClient):
+ (WebCore::ResourceHandleInternal::loader):
+ * src/WrappedResourceRequest.h: Renamed from Source/WebCore/platform/chromium/support/WrappedResourceRequest.h.
+ (WebKit):
+ (WrappedResourceRequest):
+ (WebKit::WrappedResourceRequest::~WrappedResourceRequest):
+ (WebKit::WrappedResourceRequest::WrappedResourceRequest):
+ (WebKit::WrappedResourceRequest::bind):
+ (Handle):
+ (WebKit::WrappedResourceRequest::Handle::dispose):
+ * src/WrappedResourceResponse.h: Renamed from Source/WebCore/platform/chromium/support/WrappedResourceResponse.h.
+ (WebKit):
+ (WrappedResourceResponse):
+ (WebKit::WrappedResourceResponse::~WrappedResourceResponse):
+ (WebKit::WrappedResourceResponse::WrappedResourceResponse):
+ (WebKit::WrappedResourceResponse::bind):
+ (Handle):
+ (WebKit::WrappedResourceResponse::Handle::dispose):
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move ResourceHandle to WebCore/platform/network/chromium
+ https://bugs.webkit.org/show_bug.cgi?id=82657
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/ResourceHandle.cpp: Removed.
+ * src/ResourceHandleInternal.h: Removed.
+ * src/WrappedResourceRequest.h: Removed.
+ * src/WrappedResourceResponse.h: Removed.
+
+2012-03-29 Dmitry Lomov <dslomov@google.com>
+
+ [Chromium] WorkerFileSystemContextObserver can reference a deleted WorkerFileSystemCallbacksBridge.
+ https://bugs.webkit.org/show_bug.cgi?id=82565
+
+ WorkerFileSystemCallbacksBridge relies on a cleanUpAfterCallback being called
+ prior to the disposal of the bridge to ensure that WorkerFileSystemContextObserver
+ is unsubscribed and deleted. However cleanUpAfterCallback will only execute if the bridge's
+ callback has executed on the worker thread, and this might not be the case if the worker
+ terminates.
+
+ This patch fixes this by maintaining a RefPtr from WorkerFileSystemContextObserver to
+ WorkerFileSystemCallbacksBridge. This ensures that bridge is not deleted while observer is alive.
+
+ Reviewed by David Levin.
+
+ * src/WorkerFileSystemCallbacksBridge.cpp:
+ (WebKit::WorkerFileSystemContextObserver::create):
+ (WebKit::WorkerFileSystemContextObserver::WorkerFileSystemContextObserver):
+ (WorkerFileSystemContextObserver):
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ Move CPP files related to ResourceHandle to WebCore/platform
+ https://bugs.webkit.org/show_bug.cgi?id=82582
+
+ Reviewed by James Robinson.
+
+ * WebKit.gyp:
+ * src/WebData.cpp: Removed.
+ * src/WebHTTPBody.cpp: Removed.
+ * src/WebHTTPLoadInfo.cpp: Removed.
+ * src/WebURL.cpp: Removed.
+ * src/WebURLError.cpp: Removed.
+ * src/WebURLRequest.cpp: Removed.
+ * src/WebURLRequestPrivate.h: Removed.
+ * src/WebURLResponse.cpp: Removed.
+ * src/WebURLResponsePrivate.h: Removed.
+
+2012-03-29 Michal Mocny <mmocny@google.com>
+
+ [chromium] Ensure framebuffer exists at the start of beginDrawingFrame.
+ https://bugs.webkit.org/show_bug.cgi?id=82569
+
+ Reviewed by James Robinson.
+
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromiumClient::FakeLayerRendererChromiumClient):
+ (FakeLayerRendererChromiumClient::rootLayer):
+ (FakeLayerRendererChromiumClient):
+ (TEST_F):
+
+2012-03-29 Adam Barth <abarth@webkit.org>
+
+ Move createURLLoader() into Platform
+ https://bugs.webkit.org/show_bug.cgi?id=82587
+
+ Reviewed by James Robinson.
+
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKitPlatformSupport):
+ * src/WebKit.cpp:
+ (WebKit::initializeWithoutV8):
+ (WebKit::shutdown):
+
+2012-03-29 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r112553.
+ http://trac.webkit.org/changeset/112553
+ https://bugs.webkit.org/show_bug.cgi?id=82638
+
+ It made all tests crash on Qt WK2 (Requested by Ossy_away on
+ #webkit).
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
+2012-03-29 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ HashMap<>::add should return a more descriptive object
+ https://bugs.webkit.org/show_bug.cgi?id=71063
+
+ Reviewed by Ryosuke Niwa.
+
+ Update code to use AddResult instead of a pair.
+
+ * src/WebHTTPLoadInfo.cpp:
+ (WebKit::addHeader):
+ * src/WebURLResponse.cpp:
+ (WebKit::WebURLResponse::addHTTPHeaderField):
+
+2012-03-29 Mark Pilgrim <pilgrim@chromium.org>
+
+ GEOLOCATION should be implemented as Page Supplement
+ https://bugs.webkit.org/show_bug.cgi?id=82228
+
+ Reviewed by Adam Barth.
+
+ Geolocation is now a Supplement in Page so the interface
+ has changed for setting up the page's geolocation client
+ initially and accessing the controller later.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
+2012-03-29 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Split off tiled layer constructs for unit tests into a common header
+ https://bugs.webkit.org/show_bug.cgi?id=82425
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/CCTiledLayerTestCommon.cpp: Added.
+ (WebKitTests):
+ (WebKitTests::FakeLayerTextureUpdater::Texture::Texture):
+ (WebKitTests::FakeLayerTextureUpdater::Texture::~Texture):
+ (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect):
+ (WebKitTests::FakeLayerTextureUpdater::Texture::prepareRect):
+ (WebKitTests::FakeLayerTextureUpdater::FakeLayerTextureUpdater):
+ (WebKitTests::FakeLayerTextureUpdater::~FakeLayerTextureUpdater):
+ (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate):
+ (WebKitTests::FakeLayerTextureUpdater::setRectToInvalidate):
+ (WebKitTests::FakeLayerTextureUpdater::createTexture):
+ (WebKitTests::FakeCCTiledLayerImpl::FakeCCTiledLayerImpl):
+ (WebKitTests::FakeCCTiledLayerImpl::~FakeCCTiledLayerImpl):
+ (WebKitTests::FakeTiledLayerChromium::FakeTiledLayerChromium):
+ (WebKitTests::FakeTiledLayerChromium::~FakeTiledLayerChromium):
+ (WebKitTests::FakeTiledLayerChromium::setNeedsDisplayRect):
+ (WebKitTests::FakeTiledLayerChromium::paintContentsIfDirty):
+ (WebKitTests::FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds):
+ (WebKitTests::FakeCCTextureUpdater::FakeCCTextureUpdater):
+ * tests/CCTiledLayerTestCommon.h: Added.
+ (WebKitTests):
+ (FakeLayerTextureUpdater):
+ (Texture):
+ (WebKitTests::FakeLayerTextureUpdater::sampledTexelFormat):
+ (WebKitTests::FakeLayerTextureUpdater::lastUpdateRect):
+ (WebKitTests::FakeLayerTextureUpdater::prepareCount):
+ (WebKitTests::FakeLayerTextureUpdater::clearPrepareCount):
+ (WebKitTests::FakeLayerTextureUpdater::updateCount):
+ (WebKitTests::FakeLayerTextureUpdater::clearUpdateCount):
+ (WebKitTests::FakeLayerTextureUpdater::updateRect):
+ (WebKitTests::FakeLayerTextureUpdater::prepareRectCount):
+ (WebKitTests::FakeLayerTextureUpdater::clearPrepareRectCount):
+ (WebKitTests::FakeLayerTextureUpdater::prepareRect):
+ (WebKitTests::FakeLayerTextureUpdater::setOpaquePaintRect):
+ (FakeCCTiledLayerImpl):
+ (FakeTiledLayerChromium):
+ (WebKitTests::FakeTiledLayerChromium::tileSize):
+ (WebKitTests::FakeTiledLayerChromium::lastNeedsDisplayRect):
+ (WebKitTests::FakeTiledLayerChromium::textureManager):
+ (WebKitTests::FakeTiledLayerChromium::fakeLayerTextureUpdater):
+ (WebKitTests::FakeTiledLayerChromium::updateRect):
+ (WebKitTests::FakeTiledLayerChromium::textureUpdater):
+ (WebKitTests::FakeTiledLayerChromium::createTextureUpdaterIfNeeded):
+ (FakeTiledLayerWithScaledBounds):
+ (WebKitTests::FakeTiledLayerWithScaledBounds::setContentBounds):
+ (WebKitTests::FakeTiledLayerWithScaledBounds::contentBounds):
+ (FakeTextureAllocator):
+ (WebKitTests::FakeTextureAllocator::createTexture):
+ (WebKitTests::FakeTextureAllocator::deleteTexture):
+ (FakeTextureCopier):
+ (WebKitTests::FakeTextureCopier::copyTexture):
+ (FakeCCTextureUpdater):
+ (WebKitTests::FakeCCTextureUpdater::textureAllocator):
+ * tests/TextureManagerTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+
+2012-03-29 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove unneeded code+fixmes from CCOcclusionTracker
+ https://bugs.webkit.org/show_bug.cgi?id=82380
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestLayerChromium::paintContentsIfDirty):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::TestCCOcclusionTrackerWithScissor::TestCCOcclusionTrackerWithScissor):
+ (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+ * tests/CCOcclusionTrackerTestCommon.h: Added.
+ (WebKitTests):
+ (TestCCOcclusionTrackerBase):
+ (WebKitTests::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase):
+ (WebKitTests::TestCCOcclusionTrackerBase::occlusionInScreenSpace):
+ (WebKitTests::TestCCOcclusionTrackerBase::occlusionInTargetSurface):
+ (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace):
+ (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface):
+
+2012-03-29 Dirk Schulze <krit@webkit.org>
+
+ Introduce CSSParserMode in all classes
+ https://bugs.webkit.org/show_bug.cgi?id=82335
+
+ Unreviewed build fix.
+
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::insertUserStyleSheet):
+
+2012-03-28 Dirk Schulze <krit@webkit.org>
+
+ Introduce CSSParserMode in all classes
+ https://bugs.webkit.org/show_bug.cgi?id=82335
+
+ Use CSSParserMode for setting the parsing mode on parseValue.
+
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::insertUserStyleSheet):
+
+2012-03-29 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Adding better comments for the WebRTC methods in WebKitPlatformSupport.h
+ https://bugs.webkit.org/show_bug.cgi?id=82588
+
+ Reviewed by Adam Barth.
+
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKitPlatformSupport):
+
+2012-03-28 Kinuko Yasuda <kinuko@chromium.org>
+
+ [chromium] Add isolated filesystem type and WebDragData::filesystem_id for drag-and-drop using File/DirectoryEntry.
+ https://bugs.webkit.org/show_bug.cgi?id=76826
+
+ As proposed on whatwg (http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-November/033814.html)
+ we are implementing better drag-and-drop support using File/Directory
+ Entry objects in FileSystem API, and for the purpose this patch adds
+ a new filesystem type: Isolated filesystem.
+
+ Each filesystem can be distinguished by a filesystem ID that is given
+ by chromium platform code via WebDragData when set of
+ files/directories are dropped.
+
+ This is all platform-specific implementation detail and all the changes
+ are in chromium directory.
+
+ Reviewed by David Levin.
+
+ * public/platform/WebDragData.h:
+ (WebDragData):
+ * public/platform/WebFileSystem.h: Added Isolated type.
+ * src/AsyncFileSystemChromium.cpp:
+ (WebCore::AsyncFileSystemChromium::createIsolatedFileSystemName): Added.
+ (WebCore::AsyncFileSystemChromium::createIsolatedFileSystem): Added.
+ (WebCore::AsyncFileSystemChromium::toURL): Made it not to return URL
+ for isolated filesystem (as we do not support it for now).
+ * src/AsyncFileSystemChromium.h:
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::createIsolatedFileSystem): Added.
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::filesystemId): Added.
+ (WebKit::WebDragData::setFilesystemId): Added.
+
+2012-03-29 Kinuko Yasuda <kinuko@chromium.org>
+
+ Unreviewed; rolling chromium deps to 129583.
+
+ * DEPS:
+
+2012-03-28 Adam Barth <abarth@webkit.org>
+
+ [Chromium] Move APIs related to ResourceHandle into Platform
+ https://bugs.webkit.org/show_bug.cgi?id=82553
+
+ Reviewed by James Robinson.
+
+ These headers are now just forwarding headers to the new location of
+ these headers. These forwarding headers exist to avoid breaking
+ existing users of the API. They will likely be removed (or changed)
+ in the future once we've updated all folks using them.
+
+ * public/platform/WebData.h:
+ * public/platform/WebHTTPBody.h:
+ * public/platform/WebHTTPHeaderVisitor.h:
+ * public/platform/WebHTTPLoadInfo.h:
+ * public/platform/WebPrivateOwnPtr.h:
+ * public/platform/WebURL.h:
+ * public/platform/WebURLError.h:
+ * public/platform/WebURLLoadTiming.h:
+ * public/platform/WebURLLoader.h:
+ * public/platform/WebURLLoaderClient.h:
+ * public/platform/WebURLRequest.h:
+ * public/platform/WebURLResponse.h:
+
+2012-03-28 Bill Budge <bbudge@chromium.org>
+
+ AssociatedURLLoader does not support Cross Origin Redirects when using
+ Access Control.
+ https://bugs.webkit.org/show_bug.cgi?id=82354
+
+ AssociatedURLLoader's internal adapter now overrides didFailRedirectCheck,
+ which cancels the load, causing didFail to notify the client that the
+ load failed. AssociatedURLLoaderTest adds test cases for CORS requests
+ that receive redirects and pass or fail the redirect access check.
+
+ Reviewed by Adam Barth.
+
+ * src/AssociatedURLLoader.cpp:
+ (AssociatedURLLoader::ClientAdapter):
+ (WebKit::AssociatedURLLoader::ClientAdapter::didFailRedirectCheck):
+ (WebKit):
+ * tests/AssociatedURLLoaderTest.cpp:
+ (WebKit):
+ (WebKit::TEST_F):
+
+2012-03-28 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix tiled layer assert for huge layers
+ https://bugs.webkit.org/show_bug.cgi?id=82486
+
+ Reviewed by James Robinson.
+
+ Add test for updating a huge layer that would assert prior to this
+ code. Fix up TilingData tests to use a testing class that provides a
+ safe version of numTiles().
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF):
+ * tests/TilingDataTest.cpp:
+ (TestTiling):
+ (WebCore::TestTiling::TestTiling):
+ (WebCore::TestTiling::numTiles):
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-28 Nate Chapin <japhet@chromium.org>
+
+ Remove dispatchDidLoadMainResource callback, since no
+ port implements it.
+ https://bugs.webkit.org/show_bug.cgi?id=82539
+
+ Reviewed by Alexey Proskuryakov.
+
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit):
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+
+2012-03-28 Dirk Pranke <dpranke@chromium.org>
+
+ Roll chromium from 129300 to 129509.
+
+ Unreviewed, DEPS change.
+
+ * DEPS:
+
+2012-03-28 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r112432.
+ http://trac.webkit.org/changeset/112432
+ https://bugs.webkit.org/show_bug.cgi?id=82536
+
+ Causes ccs3 layout test asserts (Requested by enne on
+ #webkit).
+
+ * tests/TiledLayerChromiumTest.cpp:
+ * tests/TilingDataTest.cpp:
+ (WebCore::TEST):
+
+2012-03-27 Daniel Cheng <dcheng@chromium.org>
+
+ [chromium] Merge ChromiumDataObject and DataTransferItemListChromium.
+ https://bugs.webkit.org/show_bug.cgi?id=82407
+
+ Reviewed by Tony Chang.
+
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::items):
+
+2012-03-28 Nat Duca <nduca@chromium.org>
+
+ [chromium] Scheduler should not tell FrameRateController to begin a frame when we dont swap
+ https://bugs.webkit.org/show_bug.cgi?id=82516
+
+ Reviewed by James Robinson.
+
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::FakeCCSchedulerClient::reset):
+ (WebKitTests::FakeCCSchedulerClient::hasAction):
+ (FakeCCSchedulerClient):
+ (WebKitTests::FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible):
+ (WebKitTests::FakeCCSchedulerClient::scheduledActionDrawAndSwapForced):
+ (WebKitTests::FakeCCSchedulerClient::setDrawWillHappen):
+ (WebKitTests::FakeCCSchedulerClient::setSwapWillHappenIfDrawHappens):
+ (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::scheduledActionDrawAndSwapIfPossible):
+ (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::scheduledActionDrawAndSwapForced):
+ (SchedulerClientThatSetNeedsDrawInsideDraw):
+ (WebKitTests::TEST):
+ (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::scheduledActionDrawAndSwapIfPossible):
+ (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::scheduledActionDrawAndSwapForced):
+ (SchedulerClientThatSetNeedsCommitInsideDraw):
+ (WebKitTests):
+
+2012-03-26 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] layer->clipRect() is not initialized for layers that create a renderSurface.
+ https://bugs.webkit.org/show_bug.cgi?id=74147
+
+ Reviewed by Adrienne Walker.
+
+ Added 3 more unit tests. One reproduces the clipRect problem in an
+ integrated manner, the other two directly test that clipRects are
+ properly initialized.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCLayerTreeTestCommon.h:
+ (WebKitTests):
+
+2012-03-28 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix tiled layer assert for huge layers
+ https://bugs.webkit.org/show_bug.cgi?id=82486
+
+ Reviewed by James Robinson.
+
+ Add test for updating a huge layer that would assert prior to this
+ code. Fix up TilingData tests to use a testing class that provides a
+ safe version of numTiles().
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF):
+ * tests/TilingDataTest.cpp:
+ (TestTiling):
+ (WebCore::TestTiling::TestTiling):
+ (WebCore::TestTiling::numTiles):
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-28 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API (JSEP): Introducing WebPeerConnection00Handler
+ https://bugs.webkit.org/show_bug.cgi?id=82450
+
+ Reviewed by Adam Barth.
+
+ Last patch to enable the PeerConnection00 functionality in Chromium introduces
+ WebPeerConnection00Handler and WebPeerConnection00HandlerClient, together with the necessary plumbing.
+
+ * WebKit.gyp:
+ * bridge/PeerConnection00Handler.cpp: Added.
+ (WebCore):
+ (WebCore::PeerConnection00Handler::create):
+ (WebCore::PeerConnection00Handler::PeerConnection00Handler):
+ (WebCore::PeerConnection00Handler::~PeerConnection00Handler):
+ (WebCore::PeerConnection00Handler::createOffer):
+ (WebCore::PeerConnection00Handler::createAnswer):
+ (WebCore::PeerConnection00Handler::setLocalDescription):
+ (WebCore::PeerConnection00Handler::setRemoteDescription):
+ (WebCore::PeerConnection00Handler::localDescription):
+ (WebCore::PeerConnection00Handler::remoteDescription):
+ (WebCore::PeerConnection00Handler::startIce):
+ (WebCore::PeerConnection00Handler::processIceMessage):
+ (WebCore::PeerConnection00Handler::addStream):
+ (WebCore::PeerConnection00Handler::removeStream):
+ (WebCore::PeerConnection00Handler::stop):
+ * bridge/PeerConnection00HandlerInternal.cpp: Added.
+ (WebCore):
+ (WebCore::PeerConnection00HandlerInternal::PeerConnection00HandlerInternal):
+ (WebCore::PeerConnection00HandlerInternal::~PeerConnection00HandlerInternal):
+ (WebCore::PeerConnection00HandlerInternal::createOffer):
+ (WebCore::PeerConnection00HandlerInternal::createAnswer):
+ (WebCore::PeerConnection00HandlerInternal::setLocalDescription):
+ (WebCore::PeerConnection00HandlerInternal::setRemoteDescription):
+ (WebCore::PeerConnection00HandlerInternal::localDescription):
+ (WebCore::PeerConnection00HandlerInternal::remoteDescription):
+ (WebCore::PeerConnection00HandlerInternal::startIce):
+ (WebCore::PeerConnection00HandlerInternal::processIceMessage):
+ (WebCore::PeerConnection00HandlerInternal::addStream):
+ (WebCore::PeerConnection00HandlerInternal::removeStream):
+ (WebCore::PeerConnection00HandlerInternal::stop):
+ (WebCore::PeerConnection00HandlerInternal::didGenerateICECandidate):
+ (WebCore::PeerConnection00HandlerInternal::didChangeReadyState):
+ (WebCore::PeerConnection00HandlerInternal::didChangeICEState):
+ (WebCore::PeerConnection00HandlerInternal::didAddRemoteStream):
+ (WebCore::PeerConnection00HandlerInternal::didRemoveRemoteStream):
+ * bridge/PeerConnection00HandlerInternal.h: Copied from Source/WebCore/platform/mediastream/PeerConnection00Handler.h.
+ (WebKit):
+ (WebCore):
+ (PeerConnection00HandlerInternal):
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKit::WebKitPlatformSupport::createPeerConnection00Handler):
+ * public/platform/WebPeerConnection00Handler.h: Added.
+ (WebKit):
+ (WebPeerConnection00Handler):
+ (WebKit::WebPeerConnection00Handler::~WebPeerConnection00Handler):
+ * public/platform/WebPeerConnection00HandlerClient.h: Added.
+ (WebKit):
+ (WebPeerConnection00HandlerClient):
+ (WebKit::WebPeerConnection00HandlerClient::~WebPeerConnection00HandlerClient):
+ * src/AssertMatchingEnums.cpp:
+
+2012-03-28 James Robinson <jamesr@chromium.org>
+
+ [chromium] Compositor visibility setting must be updated even if not actively compositing
+ https://bugs.webkit.org/show_bug.cgi?id=82406
+
+ Reviewed by Adrienne Walker.
+
+ Propagate the visibility bit to the WebLayerTreeView even when compositing is inactive.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setVisibilityState):
+
+2012-03-28 Fady Samuel <fsamuel@chromium.org>
+
+ [Chromium] Enable Viewport define by default
+ https://bugs.webkit.org/show_bug.cgi?id=79514
+
+ Reviewed by Darin Fisher.
+
+ * features.gypi:
+
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ [chromium] Transfer wheel fling via WebCompositorInputHandlerClient
+ https://bugs.webkit.org/show_bug.cgi?id=81740
+
+ Reviewed by Adrienne Walker.
+
+ Adds a path for transfering an active wheel fling animation out to the embedder from the compositor and back in
+ to a WebViewImpl via the embedder. This is used when we start a wheel fling animation on the compositor thread
+ but then hit a condition that we can't handle from the compositor, such as registered wheel event listeners or a
+ scrollable area we can't handle.
+
+ New tests added to WebCompositorInputHandlerTest for the transfering logic.
+
+ * public/WebActiveWheelFlingParameters.h: Copied from Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h.
+ (WebKit):
+ (WebActiveWheelFlingParameters):
+ (WebKit::WebActiveWheelFlingParameters::WebActiveWheelFlingParameters):
+ * public/WebCompositorInputHandlerClient.h:
+ (WebKit):
+ (WebCompositorInputHandlerClient):
+ (WebKit::WebCompositorInputHandlerClient::transferActiveWheelFlingAnimation):
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ (WebKit::WebCompositorInputHandlerImpl::animate):
+ (WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling):
+ (WebKit::WebCompositorInputHandlerImpl::scrollBy):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCore):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::transferActiveWheelFlingAnimation):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+ (WebKit::MockWebCompositorInputHandlerClient::MockWebCompositorInputHandlerClient):
+ (MockWebCompositorInputHandlerClient):
+ (WebKit::TEST):
+ (WebKit::WebCompositorInputHandlerImplTest::WebCompositorInputHandlerImplTest):
+ (WebKit::WebCompositorInputHandlerImplTest::~WebCompositorInputHandlerImplTest):
+ (WebCompositorInputHandlerImplTest):
+ (WebKit::TEST_F):
+ (WebKit):
+
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ [chromium] Send wheel events to main thread even if we think nothing is scrollable
+ https://bugs.webkit.org/show_bug.cgi?id=82408
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+
+2012-03-27 Nat Duca <nduca@chromium.org>
+
+ [chromium] Route monotonic clock up from compositor
+ https://bugs.webkit.org/show_bug.cgi?id=82154
+
+ Reviewed by James Robinson.
+
+ * public/WebWidget.h:
+ (WebKit::WebWidget::animate):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::updateAnimations):
+ * src/WebLayerTreeViewImpl.h:
+ (WebLayerTreeViewImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::animate):
+ (WebKit::WebViewImpl::updateAnimations):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/FakeCCLayerTreeHostClient.h:
+ (WebCore::FakeCCLayerTreeHostClient::updateAnimations):
+
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ webkit_unit_tests crashing on chromium lion in CCLayerTreeHostTestCompositeAndReadbackWhileInvisible
+ https://bugs.webkit.org/show_bug.cgi?id=82382
+
+ Reviewed by Adrienne Walker.
+
+ Use UnsignedWithZeroKeyHashTraits trait for the HashSet<WebGLId> m_usedTextures in
+ CompositorFakeWebGraphicsContext3DWithTextureTracking. This set is used to track all textures that are bound in
+ a given context during a test. During ..CompositeAndReadback.. we bind texture id 0. By default, HashSet<T>
+ where T is an unsigned does not allow 0 as a value. WebGLId is typedef'd to unsigned.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (CompositorFakeWebGraphicsContext3DWithTextureTracking):
+
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ webkit_unit_tests crashing on chromium lion in ScrollbarLayerChromiumTest.resolveScrollLayerPointer
+ https://bugs.webkit.org/show_bug.cgi?id=82381
+
+ Reviewed by Adrienne Walker.
+
+ Use the mock scrollbar theme for this unit test. The real ScrollbarThemeMac isn't compatible with the mocks this
+ test uses and the test isn't designed to cover the theming code, only code inside the compositor.
+
+ * tests/ScrollbarLayerChromiumTest.cpp:
+ (WebCore::TEST):
+
+2012-03-27 Dirk Pranke <dpranke@chromium.org>
+
+ Unreviewed, rolling out r112339.
+ http://trac.webkit.org/changeset/112339
+ https://bugs.webkit.org/show_bug.cgi?id=82354
+
+ webkit_unit_tests crashing on chromium mac bots
+
+ * src/AssociatedURLLoader.cpp:
+ (AssociatedURLLoader::ClientAdapter):
+ * tests/AssociatedURLLoaderTest.cpp:
+ (WebKit::AssociatedURLLoaderTest::TearDown):
+ (WebKit):
+ (WebKit::TEST_F):
+
+2012-03-27 Kausalya Madhusudhanan <kmadhusu@chromium.org>
+
+ [Coverity] Address some uninitialized constructor values.
+ https://bugs.webkit.org/show_bug.cgi?id=82376
+
+ Reviewed by James Robinson.
+
+ New tests are not required since I did not modify any code behavior. I just initialized the class member variables in the constructor.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebCore::PlatformGestureToCCGestureAdapter::PlatformGestureToCCGestureAdapter):
+
+2012-03-27 Dirk Pranke <dpranke@chromium.org>
+
+ Roll chromium DEPS to r129300.
+
+ Unreviewed, deps change.
+
+ * DEPS:
+
+2012-03-27 Bill Budge <bbudge@chromium.org>
+
+ AssociatedURLLoader does not support Cross Origin Redirects when using
+ Access Control.
+ https://bugs.webkit.org/show_bug.cgi?id=82354
+
+ AssociatedURLLoader's internal adapter now overrides didFailRedirectCheck,
+ which cancels the load, causing didFail to notify the client that the
+ load failed. AssociatedURLLoaderTest adds test cases for CORS requests
+ that receive redirects and pass or fail the redirect access check.
+
+ Reviewed by Adam Barth.
+
+ * src/AssociatedURLLoader.cpp:
+ (AssociatedURLLoader::ClientAdapter):
+ (WebKit::AssociatedURLLoader::ClientAdapter::didFailRedirectCheck):
+ (WebKit):
+ * tests/AssociatedURLLoaderTest.cpp:
+ (WebKit::TEST_F):
+
+2012-03-27 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Unknown transforms should be treated as non-axis aligned on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=82370
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+
+2012-03-27 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Rename opaqueContentsRegion() to visibleContentOpaqueRegion()
+ https://bugs.webkit.org/show_bug.cgi?id=81689
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestLayerChromium::opaqueVisibleContents):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::TestContentLayerChromium::opaqueVisibleContents):
+ (WebCore::TestContentLayerImpl::opaqueVisibleContents):
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-03-27 Dana Jansens <danakj@chromium.org>
+
+ [chromium] A unit test to verify clipping is honored when moving occlusion to parent surface
+ https://bugs.webkit.org/show_bug.cgi?id=81783
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+ (WebCore):
+ (CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping):
+ (WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
+
+2012-03-27 James Robinson <jamesr@chromium.org>
+
+ Scrollable plugins not registered properly in ScrollingCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=82163
+
+ Reviewed by Anders Carlsson.
+
+ Since ScrollbarGroups are ScrollableAreas, they need to be able to report their bounds for the
+ ScrollingCoordinator's calculateNonFastScrollableRegion. This also changes ScrollbarGroups to only be registered
+ as ScrollableAreas on the FrameView's set when they actually have Scrollbars.
+
+ * src/ScrollbarGroup.cpp:
+ (WebKit::ScrollbarGroup::ScrollbarGroup):
+ (WebKit::ScrollbarGroup::~ScrollbarGroup):
+ (WebKit::ScrollbarGroup::scrollbarCreated):
+ (WebKit::ScrollbarGroup::scrollbarDestroyed):
+ (WebKit::ScrollbarGroup::setFrameRect):
+ (WebKit):
+ (WebKit::ScrollbarGroup::scrollableAreaBoundingBox):
+ * src/ScrollbarGroup.h:
+ (ScrollbarGroup):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::reportGeometry):
+ (WebKit):
+ (WebKit::WebPluginContainerImpl::scrollbarGroup):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+
+2012-03-27 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Make use of common animation unit test methods
+ https://bugs.webkit.org/show_bug.cgi?id=82357
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebKitTests::addAnimatedTransformToController):
+ (WebKitTests):
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+
+2012-03-27 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Add TextureCopier for copying texture contents
+ https://bugs.webkit.org/show_bug.cgi?id=80870
+
+ Reviewed by Stephen White.
+
+ Add new test for TextureCopier.
+
+ * WebKit.gypi:
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TextureCopierTest.cpp: Added.
+ * tests/TiledLayerChromiumTest.cpp:
+ (FakeTextureCopier):
+ (WTF::FakeTextureCopier::copyTexture):
+ (WTF):
+ (WTF::TEST):
+
+2012-03-27 Stephen White <senorblanco@chromium.org>
+
+ [chromium] Fix filter context usage in webkit_unit_tests.
+ https://bugs.webkit.org/show_bug.cgi?id=82349
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
+ Cancel request for filter context after test run.
+ (WTF::TEST_F):
+ * tests/CCOcclusionTrackerTest.cpp:
+ Re-enable CCLayerTreeHostTestSetSingleLostContext.runMultiThread.
+ (WebCore::CCOcclusionTrackerTest::TearDown):
+ Cancel request for filter context after test run.
+
+2012-03-26 Stephen White <senorblanco@chromium.org>
+
+ Disable CCLayerTreeHostTestSetSingleLostContext.runMultiThread.
+ https://bugs.webkit.org/show_bug.cgi?id=82285
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TEST_F):
+
+2012-03-26 Andrew Scherkus <scherkus@chromium.org>
+
+ [chromium] Remove WebMediaElement from Chromium WebKit API.
+ https://bugs.webkit.org/show_bug.cgi?id=82277
+
+ Reviewed by James Robinson.
+
+ This was added in r63859 but is no longer used by anyone.
+
+ * WebKit.gyp:
+ * public/WebMediaElement.h: Removed.
+ * src/WebMediaElement.cpp: Removed.
+
+2012-03-26 Scott Byer <scottbyer@chromium.org>
+
+ Enable layout testing of the scroll animator.
+ https://bugs.webkit.org/show_bug.cgi?id=81858
+ Add a call to the InternalSettings that layout tests can use to
+ turn on scroll animation. Enable animation updates for the
+ Chromium platform DRT when scroll animation has been turned on in
+ a test. This should be a no-op for all current layout tests.
+
+ Reviewed by James Robinson.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::scrollAnimatorEnabled):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+
+2012-03-26 Nat Duca <nduca@chromium.org>
+
+ [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
+ https://bugs.webkit.org/show_bug.cgi?id=82265
+
+ In threaded compositing mode, the WebWidget is self-scheduled,
+ receiving damage and processing it without forwarding that damage
+ up to the embedding WebWidgetClient. In Chromium's case, the
+ client uses the presence of damage to perform input flow
+ control. This patch exposes the need for input flow control to the
+ embedder, while keeping the actual logic about what exactly
+ warrants input flow control inside the implementation.
+
+ Reviewed by James Robinson.
+
+ * public/WebWidget.h:
+ (WebWidget):
+ (WebKit::WebWidget::isInputThrottled):
+ * public/WebWidgetClient.h:
+ (WebWidgetClient):
+ (WebKit::WebWidgetClient::didBecomeReadyForAdditionalInput):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::commitRequested):
+ (WebKit):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::didCommit):
+ (WebKit):
+ * src/WebLayerTreeViewImpl.h:
+ (WebLayerTreeViewImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::isInputThrottled):
+ (WebKit):
+ (WebKit::WebViewImpl::didCommit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHostClient::didCommit):
+ (MockLayerTreeHostClient):
+ * tests/FakeCCLayerTreeHostClient.h:
+ (FakeCCLayerTreeHostClient):
+
+2012-03-26 Vangelis Kokkevis <vangelis@chromium.org>
+
+ [chromium] Simplify and fix CCLayerSorter
+ https://bugs.webkit.org/show_bug.cgi?id=82114
+
+ Adjustments to the CCLayerSorter unit tests to account for API changes in the
+ CCLayerSorter class.
+
+ Reviewed by Kenneth Russell.
+
+ * tests/CCLayerSorterTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-26 James Robinson <jamesr@chromium.org>
+
+ Scrollable plugins not registered properly in ScrollingCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=82163
+
+ Reviewed by Anders Carlsson.
+
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::scrollable):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+
+2012-03-26 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Change handleGestureFling() to use CCInputHandlerClient::Wheel.
+ https://bugs.webkit.org/show_bug.cgi?id=82133
+
+ Reviewed by James Robinson.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-03-26 Terry Anderson <tdanderson@chromium.org>
+
+ [chromium] Allow the viewport meta tag to be disabled for testing purposes
+ https://bugs.webkit.org/show_bug.cgi?id=81940
+
+ Reviewed by Adam Barth.
+
+ * public/WebSettings.h:
+ * src/ChromeClientImpl.cpp:
+ (WebKit::ChromeClientImpl::dispatchViewportPropertiesDidChange):
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ (WebKit::WebSettingsImpl::setViewportEnabled):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+ (WebKit::WebSettingsImpl::viewportEnabled):
+
+2012-03-25 Nat Duca <nduca@chromium.org>
+
+ [chromium] Route willBeginFrame from compositor to WebWidget
+ https://bugs.webkit.org/show_bug.cgi?id=82171
+
+ Reviewed by Darin Fisher.
+
+ * public/WebWidgetClient.h:
+ (WebWidgetClient):
+ (WebKit::WebWidgetClient::willBeginCompositorFrame):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::willBeginFrame):
+ (WebKit):
+ * src/WebLayerTreeViewImpl.h:
+ (WebLayerTreeViewImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::willBeginFrame):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHostClient::willBeginFrame):
+ (MockLayerTreeHostClient):
+ * tests/FakeCCLayerTreeHostClient.h:
+ (WebCore::FakeCCLayerTreeHostClient::willBeginFrame):
+
+2012-03-25 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Layers with animating transforms should prepaint even if they are not visible yet
+ https://bugs.webkit.org/show_bug.cgi?id=82117
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTiledLayerChromium::FakeTiledLayerChromium):
+ (WTF::FakeTiledLayerChromium::tileSize):
+ (FakeTiledLayerChromium):
+ (WTF::TEST):
+ (WTF):
+ (WTF::idlePaintRepeat):
+ (WTF::testHaveOuterTiles):
+
+2012-03-24 Nat Duca <nduca@chromium.org>
+
+ [chromium] Instrument gesture animations with async traces
+ https://bugs.webkit.org/show_bug.cgi?id=82076
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebCore::PlatformGestureToCCGestureAdapter::debugName):
+ (PlatformGestureToCCGestureAdapter):
+
+2012-03-23 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Incorrect replica originTransform used in CCDamageTracker
+ https://bugs.webkit.org/show_bug.cgi?id=82118
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-03-23 Dana Jansens <danakj@chromium.org>
+
+ [chromium] When prepainting fails, tiles dirty rects may be cleared
+ https://bugs.webkit.org/show_bug.cgi?id=82107
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTextureAllocator::createTexture):
+ (WTF::FakeLayerTextureUpdater::Texture::updateRect):
+ (FakeCCTiledLayerImpl):
+ (WTF::FakeCCTiledLayerImpl::hasTextureIdForTileAt):
+ (WTF::TEST):
+ (WTF):
+
+2012-03-23 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] CCLayerTreeHostImpl::scrollBegin() should return ScrollFailed for CCInputHandlerClient::Gesture type when wheel handlers found.
+ https://bugs.webkit.org/show_bug.cgi?id=82106
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::TEST_F):
+
+2012-03-23 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Fix race bug that clobbers CCLayerImpl updateRect
+ https://bugs.webkit.org/show_bug.cgi?id=82109
+
+ Reviewed by Dirk Pranke.
+
+ * tests/LayerChromiumTest.cpp:
+
+2012-03-23 Daniel Cheng <dcheng@chromium.org>
+
+ [chromium] Support file drag out using DataTransferItemList::add(File)
+ https://bugs.webkit.org/show_bug.cgi?id=81261
+
+ Reviewed by Tony Chang.
+
+ Original patch by Varun Jain <varunjain@chromium.org>.
+ I've updated the original patch to add some asserts for conditions we shouldn't encounter as
+ well as removing some redundant null checks.
+
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::items):
+
+2012-03-23 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Record painted pixel counts for measuring effectiveness of per-tile painting
+ https://bugs.webkit.org/show_bug.cgi?id=82057
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF):
+
+2012-03-23 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix scrollbarLayerLostContext flaky test crash on 10.6
+ https://bugs.webkit.org/show_bug.cgi?id=82062
+
+ Reviewed by James Robinson.
+
+ Override the paint function so that it becomes a no-op. Painting
+ scrollbars on the impl thread is not yet supported on platforms other
+ than Linux or ChromeOS.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (ScrollbarLayerFakePaint):
+ (WebKitTests::ScrollbarLayerFakePaint::create):
+ (WebKitTests::ScrollbarLayerFakePaint::paint):
+ (WebKitTests::ScrollbarLayerFakePaint::ScrollbarLayerFakePaint):
+ (WebKitTests):
+ (WebKitTests::TEST_F):
+
+2012-03-23 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API (JSEP): Extending WebMediaStreamCenter
+ https://bugs.webkit.org/show_bug.cgi?id=81924
+
+ Reviewed by Adam Barth.
+
+ Adding the two constructSDP methods.
+
+ * bridge/MediaStreamCenter.cpp:
+ (WebCore::MediaStreamCenter::constructSDP):
+ (WebCore):
+ * bridge/MediaStreamCenterInternal.cpp:
+ (WebCore::MediaStreamCenterInternal::constructSDP):
+ (WebCore):
+ * bridge/MediaStreamCenterInternal.h:
+ (WebCore):
+ (MediaStreamCenterInternal):
+ * public/platform/WebMediaStreamCenter.h:
+ (WebKit):
+ (WebMediaStreamCenter):
+ (WebKit::WebMediaStreamCenter::constructSDP):
+
+2012-03-23 Jonathan Backer <backer@chromium.org>
+
+ [chromium] Remove unused variables from unittest.
+ https://bugs.webkit.org/show_bug.cgi?id=82054
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-03-23 Ryosuke Niwa <rniwa@webkit.org>
+
+ Chromium DEPS roll r127913:r128426.
+
+ * DEPS:
+
+2012-03-22 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Target surface should be damaged for a new layers even when layer had no changes
+ https://bugs.webkit.org/show_bug.cgi?id=81879
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-03-22 Adrienne Walker <enne@google.com>
+
+ [chromium] Unreviewed, fix LayerRendererChromiumTest debug unit test errors
+ https://bugs.webkit.org/show_bug.cgi?id=81823
+
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromiumClient):
+
+2012-03-22 Michal Mocny <mmocny@google.com>
+
+ [chromium] Removing failing unit test - CCLayerTreeHostImplTest.visibilityChangeResetsDamage
+ https://bugs.webkit.org/show_bug.cgi?id=82003
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-03-22 Robert Kroeger <rjkroege@chromium.org>
+
+ [chromium] Halt in progress flings on receipt of key events
+ https://bugs.webkit.org/show_bug.cgi?id=81988
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::keyEvent):
+
+2012-03-22 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Skip frames when checkerboarding an animation
+ https://bugs.webkit.org/show_bug.cgi?id=81716
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ * tests/CCSchedulerStateMachineTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+ * tests/CCSchedulerTest.cpp:
+ (WebKitTests::FakeCCSchedulerClient::reset):
+ (WebKitTests::FakeCCSchedulerClient::numDraws):
+ (WebKitTests::FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible):
+ (FakeCCSchedulerClient):
+ (WebKitTests::FakeCCSchedulerClient::scheduledActionDrawAndSwapForced):
+ (WebKitTests::FakeCCSchedulerClient::setDrawSuccess):
+ (WebKitTests::TEST):
+ (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::SchedulerClientThatSetNeedsDrawInsideDraw):
+ (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::scheduledActionDrawAndSwapIfPossible):
+ (WebKitTests::SchedulerClientThatSetNeedsDrawInsideDraw::scheduledActionDrawAndSwapForced):
+ (SchedulerClientThatSetNeedsDrawInsideDraw):
+ (WebKitTests):
+ (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::SchedulerClientThatSetNeedsCommitInsideDraw):
+ (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::scheduledActionDrawAndSwapIfPossible):
+ (WebKitTests::SchedulerClientThatSetNeedsCommitInsideDraw::scheduledActionDrawAndSwapForced):
+ (SchedulerClientThatSetNeedsCommitInsideDraw):
+ * tests/CCSchedulerTestCommon.h:
+ (FakeCCFrameRateController):
+ (WebKitTests::FakeCCFrameRateController::FakeCCFrameRateController):
+ (WebKitTests::FakeCCFrameRateController::numFramesPending):
+ (WebKitTests):
+
+2012-03-22 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Force update of nonFastScrollableRegion if target CCLayerImpl has been freshly created.
+ https://bugs.webkit.org/show_bug.cgi?id=81968
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::expectTreesAreIdentical):
+ (WebKitTests::TEST):
+ (WebKitTests):
+
+2012-03-22 Michal Mocny <mmocny@google.com>
+
+ [chromium] LayerRendererChromium should use GpuMemoryAllocationChanged callback to explicitly manage framebuffer.
+ https://bugs.webkit.org/show_bug.cgi?id=81823
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/LayerRendererChromiumTest.cpp: Added.
+ (FrameCountingMemoryAllocationSettingContext):
+ (FrameCountingMemoryAllocationSettingContext::FrameCountingMemoryAllocationSettingContext):
+ (FrameCountingMemoryAllocationSettingContext::prepareTexture):
+ (FrameCountingMemoryAllocationSettingContext::setMemoryAllocationChangedCallbackCHROMIUM):
+ (FrameCountingMemoryAllocationSettingContext::getString):
+ (FrameCountingMemoryAllocationSettingContext::frameCount):
+ (FrameCountingMemoryAllocationSettingContext::setMemoryAllocation):
+ (FakeLayerRendererChromiumClient):
+ (FakeLayerRendererChromiumClient::FakeLayerRendererChromiumClient):
+ (FakeLayerRendererChromiumClient::viewportSize):
+ (FakeLayerRendererChromiumClient::settings):
+ (FakeLayerRendererChromiumClient::rootLayer):
+ (FakeLayerRendererChromiumClient::didLoseContext):
+ (FakeLayerRendererChromiumClient::onSwapBuffersComplete):
+ (FakeLayerRendererChromiumClient::setFullRootLayerDamage):
+ (FakeLayerRendererChromiumClient::setFullRootLayerDamageCount):
+ (FakeLayerRendererChromium):
+ (FakeLayerRendererChromium::FakeLayerRendererChromium):
+ (LayerRendererChromiumTest):
+ (LayerRendererChromiumTest::LayerRendererChromiumTest):
+ (LayerRendererChromiumTest::SetUp):
+ (LayerRendererChromiumTest::swapBuffers):
+ (TEST_F):
+
+2012-03-22 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] Make CCDamageTracker robust to empty layer lists
+ https://bugs.webkit.org/show_bug.cgi?id=81831
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCDamageTrackerTest.cpp:
+ (WebKitTests::emulateDrawingOneFrame): modified args passed to damage tracker on update.
+
+ (WebKitTests::TEST_F): Added another unit test.
+ (WebKitTests):
+
+2012-03-22 Bernhard Bauer <bauerb@google.com>
+
+ [chromium] Plug-in failing to load shouldn't say "Missing Plug-in"
+ https://bugs.webkit.org/show_bug.cgi?id=81907
+
+ Reviewed by Adam Barth.
+
+ Adding a MissingPluginText value to WebLocalizedString which can be used to override the "Missing Plug-in" message.
+
+ * public/platform/WebLocalizedString.h:
+ * src/LocalizedStrings.cpp:
+ (WebCore::missingPluginText):
+
+2012-03-22 Adrienne Walker <enne@google.com>
+
+ [chromium] Fix scrollbar layers holding onto invalid textures after lost context
+ https://bugs.webkit.org/show_bug.cgi?id=81841
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ (WebKitTests):
+
+2012-03-22 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Early out in a new prepareToDraw() step if checkerboarding an accelerated animation in order to skip the frame
+ https://bugs.webkit.org/show_bug.cgi?id=81437
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore):
+ (WebCore::addAnimatedTransform):
+ (WebKitTests::addOpacityTransitionToLayer):
+ (WebKitTests):
+ (WebKitTests::addAnimatedTransformToLayer):
+ * tests/CCAnimationTestCommon.h:
+ (WebCore):
+ (WebKitTests):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ (DidDrawCheckLayer):
+ (WebKitTests::DidDrawCheckLayer::DidDrawCheckLayer):
+ (MissingTextureAnimatingLayer):
+ (WebKitTests::MissingTextureAnimatingLayer::create):
+ (WebKitTests::MissingTextureAnimatingLayer::MissingTextureAnimatingLayer):
+ (WebKitTests):
+ (WebKitTests::BlendStateCheckLayer::appendQuads):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestHooks::prepareToDrawOnCCThread):
+ (WTF::MockLayerTreeHostImpl::prepareToDraw):
+ (MockLayerTreeHostImpl):
+ (WTF::MockLayerTreeHostImpl::drawLayers):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ * tests/CCTiledLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon::getQuads):
+ * tests/MockCCQuadCuller.h:
+ (WebCore::MockCCQuadCuller::append):
+
+2012-03-22 W. James MacLean <wjmaclean@chromium.org>
+
+ Rename touchpad fling curve, add curve parameters to constructor.
+ https://bugs.webkit.org/show_bug.cgi?id=81820
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::gestureEvent):
+ * tests/PlatformGestureCurveTest.cpp:
+
+2012-03-21 Ian Vollick <vollick@chromium.org>
+
+ [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+ https://bugs.webkit.org/show_bug.cgi?id=81692
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebKitTests::addOpacityTransitionToController):
+ (WebKitTests::addOpacityTransitionToLayer):
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
+ (WTF::CCLayerTreeHostTest::dispatchAddAnimation):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::beginTest):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::animateLayers):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::afterTest):
+
+2012-03-22 Kenichi Ishibashi <bashi@chromium.org>
+
+ [Chromium] Should check m_socket in SocketStreamHandleInternal::close()
+ https://bugs.webkit.org/show_bug.cgi?id=81860
+
+ Reviewed by Kent Tamura.
+
+ m_socket could be NULL if WebSocket::resume() is called after SocketStreamHandle::didClose() is called.
+ This could happen when the page shows a popup dialog (by using alert()) immediately after closing an WebSocket object.
+
+ * src/SocketStreamHandle.cpp:
+ (WebCore::SocketStreamHandleInternal::close): Ensures m_socket is not NULL.
+
+2012-03-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r111616.
+ http://trac.webkit.org/changeset/111616
+ https://bugs.webkit.org/show_bug.cgi?id=81862
+
+ broke chromium mac (Requested by eae on #webkit).
+
+ * tests/CCAnimationTestCommon.cpp:
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::TEST_F):
+ (DidDrawCheckLayer):
+ (WebKit::DidDrawCheckLayer::DidDrawCheckLayer):
+ (WebKit::BlendStateCheckLayer::appendQuads):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHostImpl::drawLayers):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ * tests/CCTiledLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon::getQuads):
+ * tests/MockCCQuadCuller.h:
+ (WebCore::MockCCQuadCuller::append):
+
+2012-03-21 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Early out in a new prepareToDraw() step if checkerboarding an accelerated animation in order to skip the frame
+ https://bugs.webkit.org/show_bug.cgi?id=81437
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore):
+ (WebCore::addAnimatedTransform):
+ (WebKitTests::addOpacityTransitionToLayer):
+ (WebKitTests):
+ (WebKitTests::addAnimatedTransformToLayer):
+ * tests/CCAnimationTestCommon.h:
+ (WebCore):
+ (WebKitTests):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKitTests::TEST_F):
+ (DidDrawCheckLayer):
+ (WebKitTests::DidDrawCheckLayer::DidDrawCheckLayer):
+ (MissingTextureAnimatingLayer):
+ (WebKitTests::MissingTextureAnimatingLayer::create):
+ (WebKitTests::MissingTextureAnimatingLayer::MissingTextureAnimatingLayer):
+ (WebKitTests):
+ (WebKitTests::BlendStateCheckLayer::appendQuads):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestHooks::prepareToDrawOnCCThread):
+ (WTF::MockLayerTreeHostImpl::prepareToDraw):
+ (MockLayerTreeHostImpl):
+ (WTF::MockLayerTreeHostImpl::drawLayers):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ * tests/CCTiledLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon::getQuads):
+ * tests/MockCCQuadCuller.h:
+ (WebCore::MockCCQuadCuller::append):
+
+2012-03-21 Alexandru Chiculita <achicu@adobe.com>
+
+ [CSS Shaders] Make CSS Shaders compile on Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=81435
+
+ Reviewed by Stephen White.
+
+ I've added the ENABLE_CSS_SHADERS flag by default, but kept CSS Shaders disabled using the runtime flag.
+
+ This change adds a new public API to WebSettings with syntax void setExperimentalCSSCustomFilterEnabled(bool).
+
+ * features.gypi:
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setExperimentalCSSCustomFilterEnabled):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+
+2012-03-21 David Reveman <reveman@chromium.org>
+
+ [Chromium] GL_EXT_occlusion_query_boolean and GL_CHROMIUM_command_buffer_query support.
+ https://bugs.webkit.org/show_bug.cgi?id=80988
+
+ Reviewed by Adrienne Walker.
+
+ Expose EXT_occlusion_query API to WebKit compositor.
+
+ * src/Extensions3DChromium.cpp:
+ (WebCore::Extensions3DChromium::createQueryEXT):
+ (WebCore):
+ (WebCore::Extensions3DChromium::deleteQueryEXT):
+ (WebCore::Extensions3DChromium::isQueryEXT):
+ (WebCore::Extensions3DChromium::beginQueryEXT):
+ (WebCore::Extensions3DChromium::endQueryEXT):
+ (WebCore::Extensions3DChromium::getQueryivEXT):
+ (WebCore::Extensions3DChromium::getQueryObjectuivEXT):
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * tests/FakeWebGraphicsContext3D.h:
+ (WebKit::FakeWebGraphicsContext3D::createQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::deleteQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::isQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::beginQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::endQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::getQueryivEXT):
+ (WebKit::FakeWebGraphicsContext3D::getQueryObjectuivEXT):
+ (FakeWebGraphicsContext3D):
+
+2012-03-21 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API (JSEP): Enhancing WebMediaHints and WebICEOptions
+ https://bugs.webkit.org/show_bug.cgi?id=81652
+
+ Reviewed by Adam Barth.
+
+ Adding an initialize method to WebMediaHints and WebICEOptions.
+ This is needed for Chromium unittests.
+
+ * public/platform/WebICEOptions.h:
+ (WebKit::WebICEOptions::WebICEOptions):
+ (WebICEOptions):
+ * public/platform/WebMediaHints.h:
+ (WebKit::WebMediaHints::WebMediaHints):
+ (WebMediaHints):
+ * src/AssertMatchingEnums.cpp:
+ * src/WebICEOptions.cpp:
+ (WebKit::WebICEOptions::initialize):
+ (WebKit):
+ (WebKit::WebICEOptions::candidateTypeToUse):
+ * src/WebMediaHints.cpp:
+ (WebKit::WebMediaHints::initialize):
+ (WebKit):
+
+2012-03-21 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API (JSEP): Introducing WebSessionDescription and WebIceCandidate
+ https://bugs.webkit.org/show_bug.cgi?id=81339
+
+ Reviewed by Adam Barth.
+
+ Simple WebKit representations of the WebCore/platform versions.
+
+ * WebKit.gyp:
+ * public/platform/WebICECandidateDescriptor.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebICECandidateDescriptor):
+ (WebKit::WebICECandidateDescriptor::WebICECandidateDescriptor):
+ (WebKit::WebICECandidateDescriptor::~WebICECandidateDescriptor):
+ (WebKit::WebICECandidateDescriptor::operator=):
+ (WebKit::WebICECandidateDescriptor::isNull):
+ * public/platform/WebSessionDescriptionDescriptor.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebSessionDescriptionDescriptor):
+ (WebKit::WebSessionDescriptionDescriptor::WebSessionDescriptionDescriptor):
+ (WebKit::WebSessionDescriptionDescriptor::~WebSessionDescriptionDescriptor):
+ (WebKit::WebSessionDescriptionDescriptor::operator=):
+ (WebKit::WebSessionDescriptionDescriptor::isNull):
+ * src/WebICECandidateDescriptor.cpp: Added.
+ (WebKit):
+ (WebKit::WebICECandidateDescriptor::WebICECandidateDescriptor):
+ (WebKit::WebICECandidateDescriptor::assign):
+ (WebKit::WebICECandidateDescriptor::reset):
+ (WebKit::WebICECandidateDescriptor::initialize):
+ (WebKit::WebICECandidateDescriptor::operator PassRefPtr<WebCore::IceCandidateDescriptor>):
+ (WebKit::WebICECandidateDescriptor::label):
+ (WebKit::WebICECandidateDescriptor::candidateLine):
+ * src/WebSessionDescriptionDescriptor.cpp: Added.
+ (WebKit):
+ (WebKit::WebSessionDescriptionDescriptor::WebSessionDescriptionDescriptor):
+ (WebKit::WebSessionDescriptionDescriptor::assign):
+ (WebKit::WebSessionDescriptionDescriptor::reset):
+ (WebKit::WebSessionDescriptionDescriptor::operator WTF::PassRefPtr<WebCore::SessionDescriptionDescriptor>):
+ (WebKit::WebSessionDescriptionDescriptor::initialize):
+ (WebKit::WebSessionDescriptionDescriptor::numberOfAddedCandidates):
+ (WebKit::WebSessionDescriptionDescriptor::candidate):
+ (WebKit::WebSessionDescriptionDescriptor::initialSDP):
+
+2012-03-21 Sami Kyostila <skyostil@chromium.org>
+
+ [chromium] Use floating point scroll deltas for layers
+ https://bugs.webkit.org/show_bug.cgi?id=81546
+
+ Reviewed by James Robinson.
+
+ New unit test for accumulating fractional scroll deltas across multiple commits.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (CCLayerTreeHostTestFractionalScroll):
+ (WTF::CCLayerTreeHostTestFractionalScroll::CCLayerTreeHostTestFractionalScroll):
+ (WTF::CCLayerTreeHostTestFractionalScroll::beginTest):
+ (WTF::CCLayerTreeHostTestFractionalScroll::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestFractionalScroll::applyScrollAndScale):
+ (WTF::CCLayerTreeHostTestFractionalScroll::afterTest):
+ (WTF):
+ (WTF::TEST_F):
+
+2012-03-21 Joshua Bell <jsbell@chromium.org>
+
+ [Chromium] IndexedDB: Expose necessary IDB exception codes through WebKit API
+ https://bugs.webkit.org/show_bug.cgi?id=81597
+
+ To fix http://crbug.com/96826 and http://crbug.com/113118 we need to be able throw
+ exceptions from the Chromium side, so expose the necessary members of IDBDatabaseException.
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebIDBDatabaseException.h: Added.
+ (WebKit):
+ * src/AssertMatchingEnums.cpp:
+
+2012-03-21 Tim Dresser <tdresser@chromium.org>
+
+ [chromium] Increase size of Combo Box Options for touch and high DPI devices
+ https://bugs.webkit.org/show_bug.cgi?id=80027
+
+ Reviewed by Darin Fisher.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::gestureEvent):
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ * tests/PopupMenuTest.cpp:
+ (WebKit::TestWebViewClient::screenInfo):
+ (WebKit::SelectPopupMenuTest::SetUp):
+ (WebKit::SelectPopupMenuTest::TearDown):
+ (SelectPopupMenuTest):
+
+2012-03-21 Takashi Toyoshima <toyoshim@chromium.org>
+
+ [Chromium] [WebSocket] provide WebFrameClient with a chance of
+ accessing to opening WebSocketStreamHandle.
+ https://bugs.webkit.org/show_bug.cgi?id=78459
+
+ Reviewed by Kent Tamura and Darin Fisher.
+
+ Add dispatchWillOpenSocketStream client function to WebFrameClient with
+ an argument representing an opening SocketStreamHandle.
+ These mechanisms provide embedders with a chance to bind arbitrary
+ data to a WebSocketStreamHandle from WebFrameClient to which the
+ WebSocket object having the WebSocketStreamHandle belongs.
+
+ No new tests because this change just provide mechanisms to embedders.
+
+ * public/WebFrameClient.h: Add dispatchWillOpenSocketStream declaration.
+ (WebKit):
+ (WebFrameClient):
+ (WebKit::WebFrameClient::willOpenSocketStream):
+ * public/platform/WebSocketStreamHandle.h: Add default implementation to virtual functions.
+ (WebKit::WebSocketStreamHandle::connect):
+ (WebKit::WebSocketStreamHandle::send):
+ (WebKit::WebSocketStreamHandle::close):
+ * src/FrameLoaderClientImpl.cpp: Implement dispatchWillOpenSocketStream.
+ (WebKit::FrameLoaderClientImpl::dispatchWillOpenSocketStream):
+ (WebKit):
+ * src/FrameLoaderClientImpl.h: Add dispatchWillOpenSocketStream declaratioin.
+ (FrameLoaderClientImpl):
+ * src/SocketStreamHandle.cpp: Call willOpenSocketStream client function.
+ (WebCore::SocketStreamHandleInternal::connect):
+
+2012-03-21 Ian Vollick <vollick@chromium.org>
+
+ [chromium] timing functions are getting incorrectly applied for accelerated css transitions
+ https://bugs.webkit.org/show_bug.cgi?id=81692
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCAnimationTestCommon.cpp:
+ (WebCore::addOpacityTransition):
+ (WebKitTests::addOpacityTransitionToController):
+ (WebKitTests::addOpacityTransitionToLayer):
+ * tests/CCAnimationTestCommon.h:
+ (WebKitTests):
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
+ (WTF::CCLayerTreeHostTest::dispatchAddAnimation):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::CCLayerTreeHostTestAddAnimationWithTimingFunction):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::beginTest):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::animateLayers):
+ (WTF::CCLayerTreeHostTestAddAnimationWithTimingFunction::afterTest):
+
+2012-03-21 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Animation events should only be used for synchronizing animation start times
+ https://bugs.webkit.org/show_bug.cgi?id=81484
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::CCLayerTreeHostTestSynchronizeAnimationStartTimes):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::beginTest):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::animateLayers):
+ (WTF::CCLayerTreeHostTestSynchronizeAnimationStartTimes::afterTest):
+ (WTF::TEST_F):
+
+2012-03-21 Peter Beverloo <peter@chromium.org>
+
+ [Chromium] Remove Android build-fix when the proper fix rolled into WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=80861
+
+ Reviewed by Tony Chang.
+
+ No longer set the CC.target environment variable as this is no longer
+ required for project file generation.
+
+ * gyp_webkit:
+
+2012-03-21 Peter Beverloo <peter@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-03-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Use origin transform to transform occlusion from surface content space to its target content space
+ https://bugs.webkit.org/show_bug.cgi?id=81730
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+ (CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent):
+ (WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+
+2012-03-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Store origin/screen space transforms for surface and replica in the surface
+ https://bugs.webkit.org/show_bug.cgi?id=81296
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::TEST):
+
+2012-03-20 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Convert TouchFlingPlatformGestureCurve to a 2-D Bezier for better control of curve shape.
+ https://bugs.webkit.org/show_bug.cgi?id=81713
+
+ Reviewed by Dirk Pranke.
+
+ * tests/PlatformGestureCurveTest.cpp:
+
+2012-03-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Allow us to disable overdraw metrics when tracing is off
+ https://bugs.webkit.org/show_bug.cgi?id=81431
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase):
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+ (WebCore::TEST):
+ (WebCore):
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TestCCOcclusionTracker::TestCCOcclusionTracker):
+
+2012-03-20 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Use opaque contents for paint culling
+ https://bugs.webkit.org/show_bug.cgi?id=81676
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestLayerChromium::opaqueContentsRegion):
+ (WTF::TestLayerChromium::setOpaqueContentsRect):
+ (TestLayerChromium):
+ (CCLayerTreeHostTestContentLayerOcclusion):
+ (WTF::CCLayerTreeHostTestContentLayerOcclusion::CCLayerTreeHostTestContentLayerOcclusion):
+ (WTF::CCLayerTreeHostTestContentLayerOcclusion::beginTest):
+ (WTF::CCLayerTreeHostTestContentLayerOcclusion::afterTest):
+ (WTF):
+
+2012-03-20 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Tune fling physics curve. [Not for review yet]
+ https://bugs.webkit.org/show_bug.cgi?id=81398
+
+ Reviewed by James Robinson.
+
+ * tests/PlatformGestureCurveTest.cpp:
+
+2012-03-20 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Infrastructure to allow animating layers to be only partially updated
+ https://bugs.webkit.org/show_bug.cgi?id=81106
+
+ Reviewed by James Robinson
+
+ * WebKit.gypi:
+ * tests/CCAnimationTestCommon.cpp:
+ (WebKitTests::FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient):
+ (WebKitTests::FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient):
+ * tests/CCAnimationTestCommon.h:
+ (FakeLayerAnimationControllerClient):
+ (WebKitTests::FakeLayerAnimationControllerClient::setOpacityFromAnimation):
+ (WebKitTests::FakeLayerAnimationControllerClient::setTransformFromAnimation):
+ * tests/CCLayerAnimationControllerImplTest.cpp: Removed.
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ (WebKitTests):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestAddAnimation::CCLayerTreeHostTestAddAnimation):
+ (WTF::CCLayerTreeHostTestAddAnimation::animateLayers):
+ (CCLayerTreeHostTestAddAnimation):
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests::FakeLayerAnimationController::create):
+ (WebKitTests::FakeLayerAnimationController::FakeLayerAnimationController):
+ (WebKitTests::FakeLayerAnimationController::pushAnimationUpdatesTo):
+ (WebKitTests::TEST):
+
+2012-03-20 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Marking WebFrameTest.DivAutoZoomParamsTest as failing.
+
+ * tests/WebFrameTest.cpp:
+ (WebKit::TEST_F):
+
+2012-03-19 Adam Barth <abarth@webkit.org>
+
+ Remove support for "magic" iframe
+ https://bugs.webkit.org/show_bug.cgi?id=81590
+
+ Reviewed by Eric Seidel.
+
+ Remove FrameLoaderClient methods that no longer exist.
+
+ * public/WebFrameClient.h:
+ (WebFrameClient):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit):
+ * src/FrameLoaderClientImpl.h:
+ (FrameLoaderClientImpl):
+
+2012-03-19 Charlie Reis <creis@chromium.org>
+
+ [Chromium] Add registerURLSchemeAsEmptyDocument to WebSecurityPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=81421
+
+ Reviewed by Adam Barth.
+
+ * public/WebSecurityPolicy.h:
+ (WebSecurityPolicy):
+ * src/WebSecurityPolicy.cpp:
+ (WebKit::WebSecurityPolicy::registerURLSchemeAsEmptyDocument):
+ (WebKit):
+
+2012-03-19 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Fixing build. Adding missing virtual.
+
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+
+2012-03-19 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Push culled tiles that are prepainted
+ https://bugs.webkit.org/show_bug.cgi?id=81552
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF):
+
+2012-03-19 James Robinson <jamesr@chromium.org>
+
+ Unreviewed chromium compile fix - put all TRACE_*s in their own scope explicitly.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+
+2012-03-19 Robert Kroeger <rjkroege@chromium.org>
+
+ [chromium] return true/false on GestureFlingCancel if a fling was stopped
+ https://bugs.webkit.org/show_bug.cgi?id=81563
+
+ Reviewed by James Robinson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::gestureEvent):
+
+2012-03-19 Michal Mocny <mmocny@google.com>
+
+ [chromium] Adding support for GL_EXT_discard_framebuffer.
+ https://bugs.webkit.org/show_bug.cgi?id=81383
+
+ Reviewed by James Robinson.
+
+ * src/Extensions3DChromium.cpp:
+ (WebCore::Extensions3DChromium::discardFramebufferEXT):
+ (WebCore):
+ (WebCore::Extensions3DChromium::ensureFramebufferCHROMIUM):
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * tests/FakeWebGraphicsContext3D.h:
+ (WebKit::FakeWebGraphicsContext3D::discardFramebufferEXT):
+ (WebKit::FakeWebGraphicsContext3D::ensureFramebufferCHROMIUM):
+ (FakeWebGraphicsContext3D):
+
+2012-03-19 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Times in the cc should be expressed in seconds.
+ https://bugs.webkit.org/show_bug.cgi?id=80514
+
+ Reviewed by James Robinson.
+
+ * tests/CCDelayBasedTimeSourceTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCFrameRateControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCSchedulerTestCommon.h:
+ (WebKitTests::FakeCCThread::pendingDelayMs):
+ (WebKitTests::FakeCCDelayBasedTimeSource::create):
+ (WebKitTests::FakeCCDelayBasedTimeSource::setMonotonicallyIncreasingTime):
+ (WebKitTests::FakeCCDelayBasedTimeSource::monotonicallyIncreasingTime):
+ (WebKitTests::FakeCCDelayBasedTimeSource::FakeCCDelayBasedTimeSource):
+ (FakeCCDelayBasedTimeSource):
+ * tests/CCTimerTest.cpp:
+ (WebKitTests::TEST_F):
+
+2012-03-19 Nat Duca <nduca@chromium.org>
+
+ [chromium] Stop deriving WebCompositor from WebCompositorInputHandler
+ https://bugs.webkit.org/show_bug.cgi?id=80586
+
+ Reviewed by Darin Fisher.
+
+ * public/WebCompositor.h:
+ (WebKit):
+ * public/WebCompositorInputHandler.h:
+ (WebCompositorInputHandler):
+ * public/WebWidgetClient.h:
+ (WebWidgetClient):
+ (WebKit::WebWidgetClient::didActivateCompositor):
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandler::fromIdentifier):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCompositorInputHandlerImpl):
+
+2012-03-18 James Robinson <jamesr@chromium.org>
+
+ [chromium] Implement fling-by-wheel on compositor thread
+ https://bugs.webkit.org/show_bug.cgi?id=81462
+
+ Reviewed by Adrienne Walker.
+
+ Implement fling-by-wheel and beef up existing unit test coverage considerably by using gmock instead of mocking
+ by hand.
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
+ (WebKit):
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ (WebKit::WebCompositorInputHandlerImpl::animate):
+ (WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling):
+ (WebKit::WebCompositorInputHandlerImpl::scrollBy):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCompositorInputHandlerImpl):
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+
+2012-03-19 Emil A Eklund <eae@chromium.org>
+
+ [mac/chromium] Change platform code to use pixelSnappedRect methods
+ https://bugs.webkit.org/show_bug.cgi?id=81016
+
+ Reviewed by Eric Seidel.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::computeBlockBounds):
+ (WebKit::WebViewImpl::applyAutofillSuggestions):
+ (WebKit::WebViewImpl::refreshAutofillPopup):
+
+2012-03-19 Eric Seidel <eric@webkit.org>
+
+ Fix WTF header include discipline in Chromium WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=81281
+
+ Reviewed by James Robinson.
+
+ * src/CompositionUnderlineBuilder.h:
+ * src/CompositionUnderlineVectorBuilder.h:
+ * src/FrameLoaderClientImpl.cpp:
+ * src/WebArrayBuffer.cpp:
+ * src/WebArrayBufferView.cpp:
+ * src/WebBindings.cpp:
+ * src/WebColorName.cpp:
+ * src/WebGeolocationClientMock.cpp:
+ * src/WebPageSerializer.cpp:
+ * src/WebSocketImpl.cpp:
+ * src/WebViewImpl.cpp:
+ * tests/FrameTestHelpers.cpp:
+
+2012-03-19 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Invalidate/update evicted tiles during commit
+ https://bugs.webkit.org/show_bug.cgi?id=81529
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+ (WTF):
+
+2012-03-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r111207.
+ http://trac.webkit.org/changeset/111207
+ https://bugs.webkit.org/show_bug.cgi?id=81561
+
+ Causing chromium unit test failure (Requested by reveman on
+ #webkit).
+
+ * src/Extensions3DChromium.cpp:
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * tests/FakeWebGraphicsContext3D.h:
+
+2012-03-19 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API (JSEP): Introducing WebMediaHints and WebIceOptions
+ https://bugs.webkit.org/show_bug.cgi?id=81341
+
+ Reviewed by Darin Fisher.
+
+ Simple WebKit representations of the WebCore/platform versions.
+
+ * WebKit.gyp:
+ * public/platform/WebICEOptions.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebICEOptions):
+ (WebKit::WebICEOptions::WebICEOptions):
+ (WebKit::WebICEOptions::~WebICEOptions):
+ (WebKit::WebICEOptions::operator=):
+ (WebKit::WebICEOptions::isNull):
+ * public/platform/WebMediaHints.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebMediaHints):
+ (WebKit::WebMediaHints::WebMediaHints):
+ (WebKit::WebMediaHints::~WebMediaHints):
+ (WebKit::WebMediaHints::operator=):
+ (WebKit::WebMediaHints::isNull):
+ * src/WebICEOptions.cpp: Added.
+ (WebKit):
+ (WebKit::WebICEOptions::WebICEOptions):
+ (WebKit::WebICEOptions::assign):
+ (WebKit::WebICEOptions::reset):
+ (WebKit::WebICEOptions::candidateTypeToUse):
+ * src/WebMediaHints.cpp: Added.
+ (WebKit):
+ (WebKit::WebMediaHints::WebMediaHints):
+ (WebKit::WebMediaHints::assign):
+ (WebKit::WebMediaHints::reset):
+ (WebKit::WebMediaHints::audio):
+ (WebKit::WebMediaHints::video):
+
+2012-03-19 Michal Mocny <mmocny@google.com>
+
+ [chromium] Updating WebGraphicsContext3D MemoryAllocation callback to accept a struct with have backbuffer suggestion.
+ https://bugs.webkit.org/show_bug.cgi?id=81279
+
+ Reviewed by James Robinson.
+
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged):
+ (WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::onMemoryAllocationChanged):
+ (GraphicsContext3DMemoryAllocationChangedCallbackAdapter):
+
+2012-03-19 David Reveman <reveman@chromium.org>
+
+ [Chromium] GL_EXT_occlusion_query_boolean and GL_CHROMIUM_command_buffer_query support.
+ https://bugs.webkit.org/show_bug.cgi?id=80988
+
+ Reviewed by Adrienne Walker.
+
+ Expose EXT_occlusion_query API to WebKit compositor.
+
+ * src/Extensions3DChromium.cpp:
+ (WebCore::Extensions3DChromium::createQueryEXT):
+ (WebCore):
+ (WebCore::Extensions3DChromium::deleteQueryEXT):
+ (WebCore::Extensions3DChromium::isQueryEXT):
+ (WebCore::Extensions3DChromium::beginQueryEXT):
+ (WebCore::Extensions3DChromium::endQueryEXT):
+ (WebCore::Extensions3DChromium::getQueryivEXT):
+ (WebCore::Extensions3DChromium::getQueryObjectuivEXT):
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * tests/FakeWebGraphicsContext3D.h:
+ (WebKit::FakeWebGraphicsContext3D::createQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::deleteQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::isQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::beginQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::endQueryEXT):
+ (WebKit::FakeWebGraphicsContext3D::getQueryivEXT):
+ (WebKit::FakeWebGraphicsContext3D::getQueryObjectuivEXT):
+ (FakeWebGraphicsContext3D):
+
+2012-03-19 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Unit test fix, save the sharedQuadState while the quads hold a pointer to it
+ https://bugs.webkit.org/show_bug.cgi?id=81476
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-19 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-03-19 Robert Kroeger <rjkroege@chromium.org>
+
+ [chromium] synthesize wheel events for fling on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=81458
+
+ Support track pad fling by generating a sequence of wheel events.
+
+ Reviewed by James Robinson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::scrollBy): Call-back from PlatformGestureCurve to dispatch wheel event.
+ (WebKit):
+ (WebKit::WebViewImpl::gestureEvent): Handle GestureFlingStart and GestureFlingCancel.
+ (WebKit::WebViewImpl::updateAnimations): Requests a PlatformGestureCurve to animate forward.
+ (WebKit::WebViewImpl::didCommitLoad): Halt flings on navigations.
+ * src/WebViewImpl.h:
+ (WebCore):
+ (WebViewImpl):
+
+2012-03-19 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Fix build that was broken by r111137
+
+ Fixed was ambiguous because of MacTypes.h
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::addTransformAnimationToLayer):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::addTransformAnimationToLayer):
+
+2012-03-18 Keishi Hattori <keishi@webkit.org>
+
+ [chromium] Fix test that was broken by r111128
+
+ * tests/ScrollAnimatorNoneTest.cpp:
+ (TEST): ScrollByPixel no longer animates.
+
+2012-03-18 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Don't occlude on main-thread behind layers/surfaces with impl-thread animations
+ https://bugs.webkit.org/show_bug.cgi?id=81354
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+ (WebCore::addOpacityAnimationToLayer):
+ (WebCore::addTransformAnimationToLayer):
+ (CCOcclusionTrackerTestAnimationOpacity1OnMainThread):
+ (WebCore::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (CCOcclusionTrackerTestAnimationOpacity0OnMainThread):
+ (WebCore::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (CCOcclusionTrackerTestAnimationTranslateOnMainThread):
+ (WebCore::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+
+2012-03-18 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Animating opacity is not opaque and should create a render surface on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=81401
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::TEST):
+
+2012-03-18 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Transform animation state should be inherited from parents
+ https://bugs.webkit.org/show_bug.cgi?id=81363
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::addOpacityAnimationToLayer):
+ (WebCore):
+ (WebCore::addTransformAnimationToLayer):
+ (WebCore::TEST):
+
+2012-03-16 James Robinson <jamesr@chromium.org>
+
+ [chromium] Unify the drawing logic for different layer types that output textures to the compositor
+ https://bugs.webkit.org/show_bug.cgi?id=81286
+
+ Reviewed by Adrienne Walker.
+
+ * tests/Canvas2DLayerChromiumTest.cpp:
+
+2012-03-15 Daniel Cheng <dcheng@chromium.org>
+
+ [chromium] Refactor ClipboardChromium and DataTransferItemList/DataTransferItem to support HTML spec
+ https://bugs.webkit.org/show_bug.cgi?id=76598
+
+ Reviewed by Tony Chang.
+
+ * src/WebDragData.cpp:
+ (WebKit::WebDragData::items):
+ (WebKit::WebDragData::addItem):
+ (WebKit::WebDragData::assign):
+
+2012-03-16 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Add overdraw metrics for texture uploads
+ https://bugs.webkit.org/show_bug.cgi?id=81175
+
+ Reviewed by Adrienne Walker.
+
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::TEST):
+
+2012-03-16 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Remove surface damage client from occlusion tracker
+ https://bugs.webkit.org/show_bug.cgi?id=81242
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+
+2012-03-16 Ian Vollick <vollick@chromium.org>
+
+ [chromium] Threaded opacity animation jump to opacity of 0
+ https://bugs.webkit.org/show_bug.cgi?id=80744
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity):
+ (WTF::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity):
+ (WTF::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity::beginTest):
+ (WTF::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity::animateLayers):
+ (WTF::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity::afterTest):
+ (WTF::TEST_F):
+
+2012-03-16 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Changes to overdraw metrics to allow upload tracking
+ https://bugs.webkit.org/show_bug.cgi?id=81222
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ (WebCore):
+ (WebCore::TEST):
+ * tests/MockCCQuadCuller.h:
+ (WebCore::MockCCQuadCuller::MockCCQuadCuller):
+
+2012-03-16 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Quads that become fully opaque after culling should not use blending
+ https://bugs.webkit.org/show_bug.cgi?id=81235
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::BlendStateCheckLayer::appendQuads):
+ (WebKit::BlendStateCheckLayer::setQuadRect):
+ (WebKit::BlendStateCheckLayer::setQuadVisibleRect):
+ (WebKit::BlendStateCheckLayer::setOpaqueContents):
+ (WebKit::BlendStateCheckLayer::setOpaqueContentRect):
+ (WebKit::BlendStateCheckLayer::BlendStateCheckLayer):
+ (BlendStateCheckLayer):
+ (WebKit::TEST_F):
+
+2012-03-15 Hans Wennborg <hans@chromium.org>
+
+ Speech JavaScript API: SpeechRecognition, Controller and Client
+ https://bugs.webkit.org/show_bug.cgi?id=81096
+
+ Reviewed by Adam Barth.
+
+ Provide a SpeechRecognitionController to Page, with a NULL client for
+ now.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
+2012-03-15 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Fix some assertions in occlusion tracker unit tests
+ https://bugs.webkit.org/show_bug.cgi?id=81308
+
+ Reviewed by James Robinson.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest):
+ (WebCore::CCOcclusionTrackerTestDamageRectOutsideChild::runMyTest):
+ (WebCore::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (WebCore::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+
+2012-03-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r110941.
+ http://trac.webkit.org/changeset/110941
+ https://bugs.webkit.org/show_bug.cgi?id=81307
+
+ the revert looks innocent. (Requested by morrita on #webkit).
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty):
+ (WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty):
+ (WTF::TestLayerChromium::paintContentsIfDirty):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (TestCCOcclusionTracker):
+ (WTF::TestCCOcclusionTracker::TestCCOcclusionTracker):
+ (WTF::TestCCOcclusionTracker::setOcclusion):
+ (WTF::TestCCOcclusionTracker::layerScissorRectInTargetSurface):
+ (WTF):
+ (WTF::FakeTiledLayerChromium::prepareToUpdate):
+ (WTF::FakeTiledLayerChromium::prepareToUpdateIdle):
+ (WTF::FakeTiledLayerChromium::paintContentsIfDirty):
+ (WTF::TEST):
+
+2012-03-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r110929.
+ http://trac.webkit.org/changeset/110929
+ https://bugs.webkit.org/show_bug.cgi?id=81306
+
+ breaking webkit_unit_tests (Requested by morrita on #webkit).
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty):
+ (WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty):
+ (WTF::TestLayerChromium::paintContentsIfDirty):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (WTF::FakeTiledLayerChromium::prepareToUpdate):
+ (WTF::FakeTiledLayerChromium::prepareToUpdateIdle):
+ (WTF::FakeTiledLayerChromium::paintContentsIfDirty):
+ (WTF::TEST):
+
+2012-03-15 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Decide occlusion in paint culling with CCOcclusionTracker
+ https://bugs.webkit.org/show_bug.cgi?id=81181
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty):
+ (WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty):
+ (WTF::TestLayerChromium::paintContentsIfDirty):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ * tests/TiledLayerChromiumTest.cpp:
+ (TestCCOcclusionTracker):
+ (WTF::TestCCOcclusionTracker::TestCCOcclusionTracker):
+ (WTF::TestCCOcclusionTracker::setOcclusion):
+ (WTF::TestCCOcclusionTracker::layerScissorRectInTargetSurface):
+ (WTF):
+ (WTF::FakeTiledLayerChromium::prepareToUpdate):
+ (WTF::FakeTiledLayerChromium::prepareToUpdateIdle):
+ (WTF::FakeTiledLayerChromium::paintContentsIfDirty):
+ (WTF::TEST):
+
+2012-03-15 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Move overdraw metrics into a templated class for both paint and draw metrics.
+ https://bugs.webkit.org/show_bug.cgi?id=81156
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::appendQuads):
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-07 Jon Lee <jonlee@apple.com>
+
+ Move NotificationContents into Notification
+ https://bugs.webkit.org/show_bug.cgi?id=80487
+ <rdar://problem/10965519>
+
+ Reviewed by Jian Li.
+
+ Refactor to use accessor methods on Notification.
+ * src/WebNotification.cpp:
+ (WebKit::WebNotification::title):
+ (WebKit::WebNotification::body):
+
+2012-03-13 Jon Lee <jonlee@apple.com>
+
+ Deprecate ondisplay()
+ https://bugs.webkit.org/show_bug.cgi?id=80483
+ <rdar://problem/10912432>
+
+ Reviewed by Jian Li.
+
+ * src/WebNotification.cpp:
+ (WebKit::WebNotification::dispatchDisplayEvent): Dispatch the show event.
+
+2012-03-14 W. James MacLean <wjmaclean@chromium.org>
+
+ [chromium] Wire up PlatformGestureCurves for CC, ScrollAnimatorNone.
+ https://bugs.webkit.org/show_bug.cgi?id=80607
+
+ Reviewed by James Robinson.
+
+ * public/WebInputEvent.h:
+ (WebKit::WebInputEvent::isScrollGestureEventType):
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (PlatformGestureToCCGestureAdapter):
+ (WebCore::PlatformGestureToCCGestureAdapter::create):
+ (WebCore::PlatformGestureToCCGestureAdapter::apply):
+ (WebCore::PlatformGestureToCCGestureAdapter::scrollBy):
+ (WebCore::PlatformGestureToCCGestureAdapter::PlatformGestureToCCGestureAdapter):
+ (WebCore):
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ (WebKit):
+ (WebKit::WebCompositorInputHandlerImpl::scrollBy):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCore):
+ (WebCompositorInputHandlerImpl):
+ * tests/PlatformGestureCurveTest.cpp:
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+
+2012-03-15 Dana Jansens <danakj@chromium.org>
+
+ [Chromium] REGRESSION(r110596) CCQuadCullerTest.verifyCullChildLinesUpTopLeft fails on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=81083
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore::TEST):
+
+2012-03-15 David Levin <levin@chromium.org>
+
+ Various autoresize fixes.
+ https://bugs.webkit.org/show_bug.cgi?id=81199
+
+ Reviewed by Darin Fisher.
+
+ * public/WebView.h:
+ (WebView): Remove a deprecated api.
+ * src/WebViewImpl.cpp: Ditto.
+ * src/WebViewImpl.h: Ditto.
+ * tests/FrameTestHelpers.cpp:
+ (WebKit::FrameTestHelpers::registerMockedURLLoad): Added an overload with more flexibility.
+ The previous api didn't allow one to request a url with a search string.
+ (FrameTestHelpers):
+ * tests/FrameTestHelpers.h:
+ (FrameTestHelpers): Ditto.
+ * tests/WebViewTest.cpp: Fix the test because calling javascript:
+ was working. Make the test generic and added a lot more tests to cover
+ various possibilities. I avoided using a layout test because there wasn't
+ a way to get the scrollbar state, so I just generalized a test that was already there.
+ * tests/data/specify_size.html: Allow the test to take its size from the search string.
+
+2012-03-15 Peter Beverloo <peter@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-03-14 Chris Fleizach <cfleizach@apple.com>
+
+ AXDescription for HTML5 footer and ARIA role contentinfo incorrect
+ https://bugs.webkit.org/show_bug.cgi?id=78967
+
+ Reviewed by Beth Dakin.
+
+ * src/LocalizedStrings.cpp:
+
+2012-03-13 Jon Lee <jonlee@apple.com>
+
+ Separate NOTIFICATIONS and LEGACY_NOTIFICATIONS
+ https://bugs.webkit.org/show_bug.cgi?id=80922
+ <rdar://problem/11035082>
+
+ Reviewed by Jian Li.
+
+ You can include either NOTIFICATIONS or LEGACY_NOTIFICATIONS and have a complete API.
+ LEGACY_NOTIFICATIONS should cover all of the previous functionality, and NOTIFICATIONS will cover the
+ new API. Therefore, APIs that are common between the two will have:
+ #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+
+ This patch initially sets both to be exactly the same. As other bugs with patches begin to migrate to
+ the new API, the defines will begin to split. This allows ports to decide which set of APIs to include.
+
+ Update everything to be #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ * src/AssertMatchingEnums.cpp:
+ * src/NotificationPresenterImpl.cpp:
+ * src/NotificationPresenterImpl.h:
+ * src/WebNotification.cpp:
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enableNotifications):
+ (WebKit::WebRuntimeFeatures::isNotificationsEnabled):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
+2012-03-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] Deprecate renderDirectlyToWebView parameter of WebViewClient::createGraphicsContext3D()
+ https://bugs.webkit.org/show_bug.cgi?id=80523
+
+ Reviewed by Darin Fisher.
+
+ * public/WebViewClient.h:
+ (WebViewClient):
+ (WebKit::WebViewClient::createGraphicsContext3D):
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::createCompositorGraphicsContext3D):
+
+2012-03-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] Remove canRecoverFromContextLoss attribute, it's unused
+ https://bugs.webkit.org/show_bug.cgi?id=81158
+
+ Reviewed by Stephen White.
+
+ Deletes the canRecoverFromContextLoss attribute from WebCore::GraphicsContext3D::Attributes. This is still left in
+ WebGraphicsContext3D::Attributes, since chromium-side code still references it.
+
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore::GraphicsContext3D::create):
+
+2012-03-14 Stephen White <senorblanco@chromium.org>
+
+ [chromium] Fix accelerated Canvas2D with threaded compositing.
+ https://bugs.webkit.org/show_bug.cgi?id=80998
+
+ Reviewed by James Robinson.
+
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ Instantiate a CCLayerTreeHost, so that Canvas2DLayerChromium can
+ retrieve its texture manager. Also move the test into the unnamed
+ namespace -- since it's already using WebCore, there's little reason for
+ it to also be in the namespace.
+ * tests/TreeSynchronizerTest.cpp:
+ (WebKitTests):
+ (WebKitTests::TEST):
+ Add a new test for trying to synchronize NULL tree.
+
+2012-03-14 James Robinson <jamesr@chromium.org>
+
+ [chromium] Provide explicit polling API to check if the platform is capable of accelerated 2d canvas
+ https://bugs.webkit.org/show_bug.cgi?id=80667
+
+ Reviewed by Darin Fisher.
+
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit::WebKitPlatformSupport::canAccelerate2dCanvas):
+ (WebKitPlatformSupport):
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::canAccelerate2dCanvas):
+ (WebCore):
+
+2012-03-14 Andrey Kosyakov <caseq@chromium.org>
+
+ Web Inspector: add didCancelFrame timeline event
+ https://bugs.webkit.org/show_bug.cgi?id=80994
+
+ Reviewed by Pavel Feldman.
+
+ - add intrumentCanceFrame(), called when renderer decides not to
+ render frame after instrumentBeginFrame() was called.
+
+ * public/WebWidget.h:
+ (WebWidget):
+ (WebKit::WebWidget::instrumentCancelFrame):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::instrumentCancelFrame):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
+2012-03-14 Dana Jansens <danakj@chromium.org>
+
+ Region can acquire an empty span by subtracting an empty Region
+ https://bugs.webkit.org/show_bug.cgi?id=81074
+
+ Reviewed by Anders Carlsson.
+
+ * tests/RegionTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-03-13 Hajime Morrita <morrita@chromium.org>
+
+ Unreviewed, mark verifyCullChildLinesUpTopLeft() as failed.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-14 Marja Hölttä <marja@google.com>
+
+ WebHTTPBody: Keep track of whether the data includes passwords.
+ https://bugs.webkit.org/show_bug.cgi?id=81003
+
+ Reviewed by Darin Fisher.
+
+ This change enables Chrome to save HTTP bodies selectively, only
+ if they don't contain passwords.
+
+ * public/platform/WebHTTPBody.h:
+ (WebHTTPBody): Added containsPasswordData, setContainsPasswordData.
+ * src/WebHTTPBody.cpp:
+ (WebKit::WebHTTPBody::containsPasswordData): Added.
+ (WebKit):
+ (WebKit::WebHTTPBody::setContainsPasswordData): Added.
+
+2012-03-14 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-03-13 Hajime Morrita <morrita@chromium.org>
+
+ Unreviewed, mark verifyCullChildLinesUpTopLeft() as failed.
+
+ * tests/CCQuadCullerTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-13 Shawn Singh <shawnsingh@chromium.org>
+
+ [chromium] wrong transform causing incorrect culling
+ https://bugs.webkit.org/show_bug.cgi?id=80471
+
+ Reviewed by James Robinson.
+
+ * tests/CCRenderSurfaceTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-03-13 Nat Duca <nduca@chromium.org>
+
+ [chromium] vsync ticks are needed in invisible tabs when we are still updating resources
+ https://bugs.webkit.org/show_bug.cgi?id=80910
+
+ Reviewed by James Robinson.
+
+ * tests/CCSchedulerStateMachineTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-03-13 Dana Jansens <danakj@chromium.org>
+
+ Region::contains(IntPoint) is slow
+ https://bugs.webkit.org/show_bug.cgi?id=81008
+
+ Reviewed by Anders Carlsson.
+
+ * WebKit.gypi:
+ * tests/RegionTest.cpp: Added.
+ (WebCore):
+ (WebCore::TEST):
+
+2012-03-13 Gavin Peters <gavinp@chromium.org>
+
+ Implement ApplicationCacheHost::canCacheInPageCache() for chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=80905
+
+ Reviewed by Eric Seidel.
+
+ This won't cause chrome to use the PageCache, but it will cause our histogram statistics
+ describing PageCache use to be more accurate.
+
+ * src/ApplicationCacheHost.cpp:
+ (WebCore::ApplicationCacheHost::canCacheInPageCache):
+
+2012-03-13 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Use CCOcclusionTracker for draw culling
+ https://bugs.webkit.org/show_bug.cgi?id=80743
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (WebKit::BlendStateCheckLayer::appendQuads):
+ * tests/CCQuadCullerTest.cpp:
+ (TestCCOcclusionTrackerImpl):
+ (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+ (WebCore::TestCCOcclusionTrackerImpl::layerScissorRectInTargetSurface):
+ (WebCore::makeLayer):
+ (WebCore::appendQuads):
+ (WebCore):
+ (WebCore::TEST):
+ * tests/CCSolidColorLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ * tests/CCTiledLayerImplTest.cpp:
+ (CCLayerTestCommon::TEST):
+ (CCLayerTestCommon::getQuads):
+ * tests/MockCCQuadCuller.h: Added.
+ (WebCore):
+ (MockCCQuadCuller):
+ (WebCore::MockCCQuadCuller::MockCCQuadCuller):
+ (WebCore::MockCCQuadCuller::append):
+ (WebCore::MockCCQuadCuller::quadList):
+
+2012-03-13 Adam Barth <abarth@webkit.org> && Benjamin Poulain <bpoulain@apple.com>
+
+ Always enable ENABLE(CLIENT_BASED_GEOLOCATION)
+ https://bugs.webkit.org/show_bug.cgi?id=78853
+
+ Reviewed by Adam Barth.
+
+ * features.gypi:
+ * src/ChromeClientImpl.cpp:
+ * src/ChromeClientImpl.h:
+ (ChromeClientImpl):
+
+2012-03-13 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Rename PeerConnection to DeprecatedPeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=80692
+
+ Reviewed by Adam Barth.
+
+ First patch in a series of patches to change the PeerConnection from ROAP to JSEP,
+ see bug 80589 for more information.
+
+ * WebKit.gyp:
+ * bridge/DeprecatedPeerConnectionHandler.cpp: Renamed from Source/WebKit/chromium/bridge/PeerConnectionHandler.cpp.
+ (WebCore):
+ (WebCore::DeprecatedPeerConnectionHandler::create):
+ (WebCore::DeprecatedPeerConnectionHandler::DeprecatedPeerConnectionHandler):
+ (WebCore::DeprecatedPeerConnectionHandler::~DeprecatedPeerConnectionHandler):
+ (WebCore::DeprecatedPeerConnectionHandler::produceInitialOffer):
+ (WebCore::DeprecatedPeerConnectionHandler::handleInitialOffer):
+ (WebCore::DeprecatedPeerConnectionHandler::processSDP):
+ (WebCore::DeprecatedPeerConnectionHandler::processPendingStreams):
+ (WebCore::DeprecatedPeerConnectionHandler::sendDataStreamMessage):
+ (WebCore::DeprecatedPeerConnectionHandler::stop):
+ * bridge/DeprecatedPeerConnectionHandlerInternal.cpp: Renamed from Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.cpp.
+ (WebCore):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::DeprecatedPeerConnectionHandlerInternal):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::~DeprecatedPeerConnectionHandlerInternal):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::produceInitialOffer):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::handleInitialOffer):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::processSDP):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::processPendingStreams):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::sendDataStreamMessage):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::stop):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::didCompleteICEProcessing):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::didGenerateSDP):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::didReceiveDataStreamMessage):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::didAddRemoteStream):
+ (WebCore::DeprecatedPeerConnectionHandlerInternal::didRemoveRemoteStream):
+ * bridge/DeprecatedPeerConnectionHandlerInternal.h: Renamed from Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.h.
+ (WebKit):
+ (WebCore):
+ (DeprecatedPeerConnectionHandlerInternal):
+
+2012-03-13 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Use projectQuad to apply inverse mapRect
+ https://bugs.webkit.org/show_bug.cgi?id=80741
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+ (CCOcclusionTrackerTest3dTransform):
+ (WebCore::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (CCOcclusionTrackerTestPerspectiveTransform):
+ (WebCore::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+ (CCOcclusionTrackerTestPerspectiveTransformBehindCamera):
+ (WebCore::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest):
+
+2012-03-13 Gavin Peters <gavinp@chromium.org>
+
+ Make ApplicationCacheHost::canCacheInPageCache() non-const.
+ https://bugs.webkit.org/show_bug.cgi?id=80904
+
+ Reviewed by Alexey Proskuryakov.
+
+ A const pointer to a large object like ApplicationCacheHost is not our standard
+ practice; so remove this (implicit) one. See also https://bugs.webkit.org/show_bug.cgi?id=80898
+
+ * src/ApplicationCacheHost.cpp:
+ (WebCore::ApplicationCacheHost::canCacheInPageCache):
+
+2012-03-13 Kinuko Yasuda <kinuko@chromium.org>
+
+ Allow WebFileChooser to return extra file info (like displayName) in addition to mere file paths
+ https://bugs.webkit.org/show_bug.cgi?id=80719
+
+ Reviewed by Kent Tamura.
+
+ * public/WebFileChooserCompletion.h:
+ (SelectedFileInfo): Added.
+ (WebFileChooserCompletion):
+ (WebKit::WebFileChooserCompletion::didChooseFile): Added an overloaded
+ method that takes SelectedFileInfo.
+ * src/WebFileChooserCompletionImpl.cpp:
+ (WebKit::WebFileChooserCompletionImpl::didChooseFile): Ditto.
+ (WebKit):
+ * src/WebFileChooserCompletionImpl.h:
+ (WebFileChooserCompletionImpl):
+
+2012-03-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r110529.
+ http://trac.webkit.org/changeset/110529
+ https://bugs.webkit.org/show_bug.cgi?id=80969
+
+ breaks mac build (Requested by morrita on #webkit).
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+
+2012-03-12 Hajime Morrita <morrita@chromium.org>
+
+ Unreviewed Windows build fix.
+
+ * src/WebViewImpl.cpp:
+
+2012-03-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Use projectQuad to apply inverse mapRect
+ https://bugs.webkit.org/show_bug.cgi?id=80741
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore):
+ (CCOcclusionTrackerTest3dTransform):
+ (WebCore::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (CCOcclusionTrackerTestPerspectiveTransform):
+ (WebCore::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+ (CCOcclusionTrackerTestPerspectiveTransformBehindCamera):
+ (WebCore::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest):
+
+2012-03-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Fix clang build for CCOcclusionTracker tests
+ https://bugs.webkit.org/show_bug.cgi?id=80891
+
+ Reviewed by Adam Barth.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::CCOcclusionTrackerTest::createRoot):
+ (WebCore::CCOcclusionTrackerTest::createLayer):
+ (WebCore::CCOcclusionTrackerTest::createDrawingLayer):
+
+2012-03-12 Stephen White <senorblanco@chromium.org>
+
+ [chromium] Restore canvas2D acceleration after context loss.
+ https://bugs.webkit.org/show_bug.cgi?id=80629
+
+ Reviewed by James Robinson.
+
+ Covered by existing canvas tests, and manual testing (killing the GPU
+ process).
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::sharedGraphicsContext3D):
+
+2012-03-12 Nat Duca <nduca@chromium.org>
+
+ [Chromium] Force compositeAndReadback through regular scheduling flow
+ https://bugs.webkit.org/show_bug.cgi?id=77049
+
+ Reviewed by James Robinson.
+
+ * tests/CCFrameRateControllerTest.cpp:
+ (WebKitTests::FakeCCFrameRateControllerClient::reset):
+ (WebKitTests::FakeCCFrameRateControllerClient::vsyncTicked):
+ (WebKitTests::FakeCCFrameRateControllerClient::vsyncTick):
+ (FakeCCFrameRateControllerClient):
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestCompositeAndReadbackWhileInvisible):
+ (WTF::CCLayerTreeHostTestCompositeAndReadbackWhileInvisible::CCLayerTreeHostTestCompositeAndReadbackWhileInvisible):
+ (WTF::CCLayerTreeHostTestCompositeAndReadbackWhileInvisible::beginTest):
+ (WTF::CCLayerTreeHostTestCompositeAndReadbackWhileInvisible::didCommitAndDrawFrame):
+ (WTF::CCLayerTreeHostTestCompositeAndReadbackWhileInvisible::afterTest):
+ (WTF::TEST_F):
+ * tests/CCSchedulerStateMachineTest.cpp:
+ (WebCore::StateMachine::setNeedsForcedCommit):
+ (WebCore::StateMachine::needsForcedCommit):
+ (StateMachine):
+ (WebCore::TEST):
+ (WebCore):
+
+2012-03-12 Joshua Bell <jsbell@chromium.org>
+
+ IndexedDB: Handle LevelDB database corruption
+ https://bugs.webkit.org/show_bug.cgi?id=79413
+
+ Reviewed by Tony Chang.
+
+ * WebKit.gyp: Skip LevelDBTest.cpp in shared component builds due to webkit_support dependency
+ * WebKit.gypi: Add LevelDBTest.cpp
+ * tests/LevelDBTest.cpp: Added.
+ (WebCore):
+ (SimpleComparator):
+ (WebCore::SimpleComparator::compare):
+ (WebCore::SimpleComparator::name):
+ (WebCore::encodeString):
+ (WebCore::TEST):
+
+2012-03-12 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Clean up culling tests and templatize to test impl constructs
+ https://bugs.webkit.org/show_bug.cgi?id=80613
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebCore::TestContentLayerChromium::TestContentLayerChromium):
+ (WebCore::TestContentLayerChromium::opaqueContentsRegion):
+ (WebCore::TestContentLayerChromium::setOpaqueContentsRect):
+ (TestContentLayerChromium):
+ (TestContentLayerImpl):
+ (WebCore::TestContentLayerImpl::TestContentLayerImpl):
+ (WebCore::TestContentLayerImpl::opaqueContentsRegion):
+ (WebCore::TestContentLayerImpl::setOpaqueContentsRect):
+ (WebCore):
+ (WebCore::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase):
+ (WebCore::TestCCOcclusionTrackerBase::occlusionInScreenSpace):
+ (WebCore::TestCCOcclusionTrackerBase::occlusionInTargetSurface):
+ (WebCore::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace):
+ (WebCore::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface):
+ (WebCore::TestCCOcclusionTrackerBase::layerScissorRectInTargetSurface):
+ (WebCore::TestDamageClient::damageRect):
+ (CCOcclusionTrackerTestMainThreadTypes):
+ (WebCore::CCOcclusionTrackerTestMainThreadTypes::createLayer):
+ (WebCore::CCOcclusionTrackerTestMainThreadTypes::createContentLayer):
+ (CCOcclusionTrackerTestImplThreadTypes):
+ (WebCore::CCOcclusionTrackerTestImplThreadTypes::createLayer):
+ (WebCore::CCOcclusionTrackerTestImplThreadTypes::createContentLayer):
+ (CCOcclusionTrackerTest):
+ (WebCore::CCOcclusionTrackerTest::TearDown):
+ (WebCore::CCOcclusionTrackerTest::createRoot):
+ (WebCore::CCOcclusionTrackerTest::createLayer):
+ (WebCore::CCOcclusionTrackerTest::createSurface):
+ (WebCore::CCOcclusionTrackerTest::createDrawingLayer):
+ (WebCore::CCOcclusionTrackerTest::createDrawingSurface):
+ (WebCore::CCOcclusionTrackerTest::calcDrawEtc):
+ (WebCore::CCOcclusionTrackerTest::setBaseProperties):
+ (WebCore::CCOcclusionTrackerTest::setProperties):
+ (CCOcclusionTrackerTestIdentityTransforms):
+ (WebCore::CCOcclusionTrackerTestIdentityTransforms::runMyTest):
+ (CCOcclusionTrackerTestRotatedChild):
+ (WebCore::CCOcclusionTrackerTestRotatedChild::runMyTest):
+ (CCOcclusionTrackerTestTranslatedChild):
+ (WebCore::CCOcclusionTrackerTestTranslatedChild::runMyTest):
+ (CCOcclusionTrackerTestChildInRotatedChild):
+ (WebCore::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
+ (CCOcclusionTrackerTestVisitTargetTwoTimes):
+ (WebCore::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
+ (CCOcclusionTrackerTestSurfaceRotatedOffAxis):
+ (WebCore::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest):
+ (CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren):
+ (WebCore::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
+ (CCOcclusionTrackerTestOverlappingSurfaceSiblings):
+ (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms):
+ (WebCore::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (CCOcclusionTrackerTestFilters):
+ (WebCore::CCOcclusionTrackerTestFilters::runMyTest):
+ (CCOcclusionTrackerTestLayerScissorRectOutsideChild):
+ (WebCore::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest):
+ (CCOcclusionTrackerTestScreenScissorRectOutsideChild):
+ (WebCore::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest):
+ (CCOcclusionTrackerTestDamageRectOutsideChild):
+ (WebCore::CCOcclusionTrackerTestDamageRectOutsideChild::runMyTest):
+ (CCOcclusionTrackerTestLayerScissorRectOverChild):
+ (WebCore::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest):
+ (CCOcclusionTrackerTestScreenScissorRectOverChild):
+ (WebCore::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest):
+ (CCOcclusionTrackerTestDamageRectOverChild):
+ (WebCore::CCOcclusionTrackerTestDamageRectOverChild::runMyTest):
+ (CCOcclusionTrackerTestLayerScissorRectPartlyOverChild):
+ (WebCore::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest):
+ (CCOcclusionTrackerTestScreenScissorRectPartlyOverChild):
+ (WebCore::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest):
+ (CCOcclusionTrackerTestDamageRectPartlyOverChild):
+ (WebCore::CCOcclusionTrackerTestDamageRectPartlyOverChild::runMyTest):
+ (CCOcclusionTrackerTestLayerScissorRectOverNothing):
+ (WebCore::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest):
+ (CCOcclusionTrackerTestScreenScissorRectOverNothing):
+ (WebCore::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest):
+ (CCOcclusionTrackerTestDamageRectOverNothing):
+ (WebCore::CCOcclusionTrackerTestDamageRectOverNothing::runMyTest):
+ (CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin):
+ (WebCore::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest):
+ (CCOcclusionTrackerTestOpaqueContentsRegionEmpty):
+ (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest):
+ (CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty):
+ (WebCore::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest):
+
2012-03-11 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r110359.
diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS
index 23e521aa7..15044b59e 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': '125600'
+ 'chromium_rev': '135601'
}
deps = {
@@ -121,6 +121,8 @@ deps = {
Var('chromium_svn')+'/ui@'+Var('chromium_rev'), # needed by app
# other third party
+ 'third_party/pyftpdlib/src':
+ From('chromium_deps', 'src/third_party/pyftpdlib/src'),
'third_party/icu':
From('chromium_deps', 'src/third_party/icu'),
'third_party/ots':
diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp
index 1e1a41665..ea966b1f1 100644
--- a/Source/WebKit/chromium/WebKit.gyp
+++ b/Source/WebKit/chromium/WebKit.gyp
@@ -91,22 +91,18 @@
'WEBKIT_IMPLEMENTATION=1',
],
'sources': [
- 'bridge/MediaStreamCenter.cpp',
- 'bridge/MediaStreamCenterInternal.cpp',
- 'bridge/MediaStreamCenterInternal.h',
- 'bridge/PeerConnectionHandler.cpp',
- 'bridge/PeerConnectionHandlerInternal.cpp',
- 'bridge/PeerConnectionHandlerInternal.h',
+ '<@(webcore_platform_support_files)',
'public/WebAccessibilityNotification.h',
'public/WebAccessibilityObject.h',
'public/WebAccessibilityRole.h',
'public/WebAnimationController.h',
'public/WebApplicationCacheHostClient.h',
'public/WebArrayBuffer.h',
- 'public/WebAttribute.h',
'public/WebAudioSourceProvider.h',
'public/WebAudioSourceProviderClient.h',
'public/WebAutofillClient.h',
+ 'public/WebBatteryStatus.h',
+ 'public/WebBatteryStatusClient.h',
'public/WebBindings.h',
'public/WebBlob.h',
'public/WebCache.h',
@@ -173,11 +169,13 @@
'public/WebGeolocationPosition.h',
'public/WebGlyphCache.h',
'public/WebHistoryItem.h',
+ 'public/WebHitTestResult.h',
'public/WebIDBCallbacks.h',
'public/WebIDBCursor.h',
'public/WebIDBDatabase.h',
'public/WebIDBDatabaseCallbacks.h',
'public/WebIDBDatabaseError.h',
+ 'public/WebIDBDatabaseException.h',
'public/WebIDBFactory.h',
'public/WebIDBIndex.h',
'public/WebIDBKey.h',
@@ -196,7 +194,6 @@
'public/WebIntentServiceInfo.h',
'public/WebKit.h',
'public/WebLabelElement.h',
- 'public/WebMediaElement.h',
'public/WebMediaPlayer.h',
'public/WebMediaPlayerAction.h',
'public/WebMediaPlayerClient.h',
@@ -204,7 +201,6 @@
'public/WebMenuItemInfo.h',
'public/WebMessagePortChannel.h',
'public/WebMessagePortChannelClient.h',
- 'public/WebNamedNodeMap.h',
'public/WebNavigationType.h',
'public/WebNetworkStateNotifier.h',
'public/WebNode.h',
@@ -227,13 +223,15 @@
'public/WebPluginContainer.h',
'public/WebPluginDocument.h',
'public/WebPluginListBuilder.h',
+ 'public/WebPrintScalingOption.h',
'public/WebPopupMenu.h',
'public/WebPopupMenuInfo.h',
'public/WebPopupType.h',
+ 'public/WebPrerendererClient.h',
'public/WebRange.h',
- 'public/WebReferrerPolicy.h',
'public/WebRegularExpression.h',
'public/WebRuntimeFeatures.h',
+ 'public/WebScopedMicrotaskSuppression.h',
'public/WebScopedUserGesture.h',
'public/WebScreenInfo.h',
'public/WebScriptController.h',
@@ -250,23 +248,32 @@
'public/WebSharedWorkerRepository.h',
'public/WebSocket.h',
'public/WebSocketClient.h',
+ 'public/WebSpeechGrammar.h',
'public/WebSpeechInputController.h',
'public/WebSpeechInputListener.h',
'public/WebSpeechInputResult.h',
+ 'public/WebSpeechRecognitionHandle.h',
+ 'public/WebSpeechRecognitionParams.h',
+ 'public/WebSpeechRecognitionResult.h',
+ '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',
'public/WebStreamTextureClient.h',
'public/WebTextAffinity.h',
'public/WebTextCaseSensitivity.h',
'public/WebTextCheckingCompletion.h',
'public/WebTextCheckingResult.h',
'public/WebTextDirection.h',
+ 'public/WebTextFieldDecoratorClient.h',
'public/WebTextInputType.h',
'public/WebTextRun.h',
+ 'public/WebTimeRange.h',
'public/WebURLLoaderOptions.h',
'public/WebUserMediaClient.h',
'public/WebUserMediaRequest.h',
@@ -318,18 +325,12 @@
'public/platform/WebLayerTreeView.h',
'public/platform/WebLayerTreeViewClient.h',
'public/platform/WebLocalizedString.h',
- 'public/platform/WebMediaStreamCenter.h',
- 'public/platform/WebMediaStreamComponent.h',
- 'public/platform/WebMediaStreamDescriptor.h',
- 'public/platform/WebMediaStreamSource.h',
- 'public/platform/WebMediaStreamSourcesRequest.h',
'public/platform/WebNonCopyable.h',
- 'public/platform/WebPeerConnectionHandler.h',
- 'public/platform/WebPeerConnectionHandlerClient.h',
'public/platform/WebPoint.h',
'public/platform/WebPrivateOwnPtr.h',
'public/platform/WebPrivatePtr.h',
'public/platform/WebRect.h',
+ 'public/platform/WebReferrerPolicy.h',
'public/platform/WebSerializedScriptValue.h',
'public/platform/WebSize.h',
'public/platform/WebSocketStreamError.h',
@@ -373,6 +374,8 @@
'src/AutofillPopupMenuClient.h',
'src/BackForwardListChromium.cpp',
'src/BackForwardListChromium.h',
+ 'src/BatteryClientImpl.cpp',
+ 'src/BatteryClientImpl.h',
'src/BlobRegistryProxy.cpp',
'src/BlobRegistryProxy.h',
'src/CCThreadImpl.cpp',
@@ -458,10 +461,11 @@
'src/PageOverlay.h',
'src/PageOverlayList.cpp',
'src/PageOverlayList.h',
+ 'src/PageWidgetDelegate.cpp',
+ 'src/PageWidgetDelegate.h',
'src/PlatformMessagePortChannel.cpp',
'src/PlatformMessagePortChannel.h',
'src/PlatformSupport.cpp',
- 'src/ResourceHandle.cpp',
'src/ScrollbarGroup.cpp',
'src/ScrollbarGroup.h',
'src/SharedWorkerRepository.cpp',
@@ -469,28 +473,27 @@
'src/SocketStreamHandleInternal.h',
'src/SpeechInputClientImpl.cpp',
'src/SpeechInputClientImpl.h',
+ 'src/SpeechRecognitionClientProxy.cpp',
+ 'src/SpeechRecognitionClientProxy.h',
'src/StorageAreaProxy.cpp',
'src/StorageAreaProxy.h',
- 'src/StorageEventDispatcherChromium.cpp',
'src/StorageEventDispatcherImpl.cpp',
'src/StorageEventDispatcherImpl.h',
'src/StorageInfoChromium.cpp',
'src/StorageNamespaceProxy.cpp',
'src/StorageNamespaceProxy.h',
+ 'src/TextFieldDecoratorImpl.h',
+ 'src/TextFieldDecoratorImpl.cpp',
'src/UserMediaClientImpl.h',
'src/UserMediaClientImpl.cpp',
'src/WebTextCheckingCompletionImpl.h',
'src/WebTextCheckingCompletionImpl.cpp',
'src/WebTextCheckingResult.cpp',
- 'src/VideoFrameChromiumImpl.cpp',
- 'src/VideoFrameChromiumImpl.h',
'src/WebAccessibilityObject.cpp',
'src/WebAnimationControllerImpl.cpp',
'src/WebAnimationControllerImpl.h',
'src/WebArrayBuffer.cpp',
'src/WebArrayBufferView.cpp',
- 'src/WebAttribute.cpp',
- 'src/WebAudioBus.cpp',
'src/WebBindings.cpp',
'src/WebBlob.cpp',
'src/WebBlobData.cpp',
@@ -516,7 +519,6 @@
'src/WebDOMMouseEvent.cpp',
'src/WebDOMMutationEvent.cpp',
'src/WebDOMStringList.cpp',
- 'src/WebData.cpp',
'src/WebDatabase.cpp',
'src/WebDataSourceImpl.cpp',
'src/WebDataSourceImpl.h',
@@ -534,8 +536,6 @@
'src/WebEntities.cpp',
'src/WebEntities.h',
'src/WebExternalTextureLayer.cpp',
- 'src/WebExternalTextureLayerImpl.cpp',
- 'src/WebExternalTextureLayerImpl.h',
'src/WebFileChooserCompletionImpl.cpp',
'src/WebFileChooserCompletionImpl.h',
'src/WebFileSystemCallbacksImpl.cpp',
@@ -557,8 +557,7 @@
'src/WebGlyphCache.cpp',
'src/WebGraphicsContext3D.cpp',
'src/WebHistoryItem.cpp',
- 'src/WebHTTPBody.cpp',
- 'src/WebHTTPLoadInfo.cpp',
+ 'src/WebHitTestResult.cpp',
'src/WebIconLoadingCompletionImpl.cpp',
'src/WebIconLoadingCompletionImpl.h',
'src/WebIDBCallbacksImpl.cpp',
@@ -583,6 +582,7 @@
'src/WebIDBTransactionImpl.h',
'src/WebIDBTransactionCallbacksImpl.cpp',
'src/WebIDBTransactionCallbacksImpl.h',
+ 'src/WebIOSurfaceLayer.cpp',
'src/WebImageCG.cpp',
'src/WebImageDecoder.cpp',
'src/WebImageSkia.cpp',
@@ -601,15 +601,9 @@
'src/WebLayerTreeView.cpp',
'src/WebLayerTreeViewImpl.cpp',
'src/WebLayerTreeViewImpl.h',
- 'src/WebMediaElement.cpp',
'src/WebMediaPlayerClientImpl.cpp',
'src/WebMediaPlayerClientImpl.h',
- 'src/WebMediaStreamComponent.cpp',
- 'src/WebMediaStreamDescriptor.cpp',
'src/WebMediaStreamRegistry.cpp',
- 'src/WebMediaStreamSource.cpp',
- 'src/WebMediaStreamSourcesRequest.cpp',
- 'src/WebNamedNodeMap.cpp',
'src/WebNetworkStateNotifier.cpp',
'src/WebNode.cpp',
'src/WebNodeCollection.cpp',
@@ -617,6 +611,7 @@
'src/WebNotification.cpp',
'src/WebOptionElement.cpp',
'src/WebPagePopupImpl.cpp',
+ 'src/WebPagePopupImpl.h',
'src/WebPageSerializer.cpp',
'src/WebPageSerializerImpl.cpp',
'src/WebPageSerializerImpl.h',
@@ -636,6 +631,7 @@
'src/WebRange.cpp',
'src/WebRegularExpression.cpp',
'src/WebRuntimeFeatures.cpp',
+ 'src/WebScopedMicrotaskSuppression.cpp',
'src/WebScopedUserGesture.cpp',
'src/WebScriptController.cpp',
'src/WebScrollbarImpl.cpp',
@@ -645,6 +641,7 @@
'src/WebSecurityPolicy.cpp',
'src/WebSelectElement.cpp',
'src/WebSerializedScriptValue.cpp',
+ 'src/WebSessionDescriptionDescriptor.cpp',
'src/WebSettingsImpl.cpp',
'src/WebSettingsImpl.h',
'src/WebSharedWorkerImpl.cpp',
@@ -654,26 +651,20 @@
'src/WebSocketImpl.h',
'src/WebSolidColorLayer.cpp',
'src/WebSolidColorLayerImpl.cpp',
+ 'src/WebSpeechGrammar.cpp',
'src/WebSpeechInputResult.cpp',
- 'src/WebStorageAreaImpl.cpp',
- 'src/WebStorageAreaImpl.h',
+ 'src/WebSpeechRecognitionHandle.cpp',
+ 'src/WebSpeechRecognitionResult.cpp',
'src/WebStorageEventDispatcherImpl.cpp',
'src/WebStorageEventDispatcherImpl.h',
- 'src/WebStorageNamespaceImpl.cpp',
- 'src/WebStorageNamespaceImpl.h',
'src/WebStorageQuotaCallbacksImpl.cpp',
'src/WebStorageQuotaCallbacksImpl.h',
+ 'src/WebSurroundingText.cpp',
'src/WebTextRun.cpp',
- 'src/WebThreadSafeData.cpp',
- 'src/WebURL.cpp',
'src/WebURLLoadTiming.cpp',
- 'src/WebURLRequest.cpp',
- 'src/WebURLRequestPrivate.h',
- 'src/WebURLResponse.cpp',
- 'src/WebURLResponsePrivate.h',
- 'src/WebURLError.cpp',
'src/WebScopedUserGesture.cpp',
'src/WebUserMediaRequest.cpp',
+ 'src/WebVideoLayer.cpp',
'src/WebViewImpl.cpp',
'src/WebViewImpl.h',
'src/WebWorkerBase.cpp',
@@ -690,8 +681,6 @@
'src/WorkerFileSystemCallbacksBridge.h',
'src/WorkerFileWriterCallbacksBridge.cpp',
'src/WorkerFileWriterCallbacksBridge.h',
- 'src/WrappedResourceRequest.h',
- 'src/WrappedResourceResponse.h',
'src/win/WebInputEventFactory.cpp',
'src/win/WebScreenInfoFactory.cpp',
],
@@ -748,8 +737,10 @@
# functions defined only in !WEBKIT_IMPLEMENTATION.
'tests/AssociatedURLLoaderTest.cpp',
'tests/FrameTestHelpers.cpp',
+ 'tests/LevelDBTest.cpp',
'tests/PopupMenuTest.cpp',
'tests/RenderTableCellTest.cpp',
+ 'tests/RenderTableRowTest.cpp',
'tests/WebFrameTest.cpp',
'tests/WebPageNewSerializerTest.cpp',
'tests/WebPageSerializerTest.cpp',
@@ -1107,10 +1098,10 @@
'inputs': [
'<@(_script_name)',
'<@(_input_file)',
- '../../WebCore/inspector/front-end/BinarySearch.js',
'../../WebCore/inspector/front-end/HeapSnapshot.js',
+ '../../WebCore/inspector/front-end/HeapSnapshotLoader.js',
'../../WebCore/inspector/front-end/HeapSnapshotWorkerDispatcher.js',
- '../../WebCore/inspector/front-end/PartialQuickSort.js',
+ '../../WebCore/inspector/front-end/utilities.js',
],
'search_path': '../../WebCore/inspector/front-end',
'outputs': ['<(PRODUCT_DIR)/resources/inspector/HeapSnapshotWorker.js'],
diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi
index 87d41bfb9..f85d97920 100644
--- a/Source/WebKit/chromium/WebKit.gypi
+++ b/Source/WebKit/chromium/WebKit.gypi
@@ -67,7 +67,6 @@
'tests/CCDelayBasedTimeSourceTest.cpp',
'tests/CCFrameRateControllerTest.cpp',
'tests/CCKeyframedAnimationCurveTest.cpp',
- 'tests/CCLayerAnimationControllerImplTest.cpp',
'tests/CCLayerAnimationControllerTest.cpp',
'tests/CCLayerImplTest.cpp',
'tests/CCLayerIteratorTest.cpp',
@@ -79,7 +78,9 @@
'tests/CCLayerTreeHostImplTest.cpp',
'tests/CCLayerTreeHostTest.cpp',
'tests/CCLayerTreeTestCommon.h',
+ 'tests/CCMathUtilTest.cpp',
'tests/CCOcclusionTrackerTest.cpp',
+ 'tests/CCOcclusionTrackerTestCommon.h',
'tests/CCQuadCullerTest.cpp',
'tests/CCRenderSurfaceTest.cpp',
'tests/CCSchedulerStateMachineTest.cpp',
@@ -87,12 +88,15 @@
'tests/CCSchedulerTest.cpp',
'tests/CCSolidColorLayerImplTest.cpp',
'tests/CCTiledLayerImplTest.cpp',
+ 'tests/CCTiledLayerTestCommon.h',
+ 'tests/CCTiledLayerTestCommon.cpp',
'tests/CCThreadTaskTest.cpp',
'tests/CCTimerTest.cpp',
'tests/ClipboardChromiumTest.cpp',
'tests/CompositorFakeGraphicsContext3D.h',
'tests/CompositorFakeWebGraphicsContext3D.h',
'tests/DragImageTest.cpp',
+ 'tests/DrawingBufferChromiumTest.cpp',
'tests/FakeCCLayerTreeHostClient.h',
'tests/FakeGraphicsContext3DTest.cpp',
'tests/FakeWebGraphicsContext3D.h',
@@ -106,16 +110,22 @@
'tests/KeyboardTest.cpp',
'tests/KURLTest.cpp',
'tests/LayerChromiumTest.cpp',
+ 'tests/LayerRendererChromiumTest.cpp',
'tests/LayerTextureUpdaterTest.cpp',
+ 'tests/LevelDBTest.cpp',
'tests/LocalizedNumberICUTest.cpp',
+ 'tests/MockCCQuadCuller.h',
'tests/PaintAggregatorTest.cpp',
'tests/PlatformGestureCurveTest.cpp',
'tests/PlatformContextSkiaTest.cpp',
'tests/PODArenaTest.cpp',
'tests/PODIntervalTreeTest.cpp',
'tests/PODRedBlackTreeTest.cpp',
+ 'tests/RegionTest.cpp',
'tests/RenderTableCellTest.cpp',
+ 'tests/RenderTableRowTest.cpp',
'tests/ScrollbarLayerChromiumTest.cpp',
+ 'tests/TextureCopierTest.cpp',
'tests/TextureManagerTest.cpp',
'tests/TiledLayerChromiumTest.cpp',
'tests/TilingDataTest.cpp',
@@ -123,10 +133,9 @@
'tests/TreeTestHelpers.cpp',
'tests/TreeTestHelpers.h',
'tests/WebCompositorInputHandlerImplTest.cpp',
- 'tests/WebExternalTextureLayerImplTest.cpp',
'tests/WebFrameTest.cpp',
- 'tests/WebGLLayerChromiumTest.cpp',
'tests/WebLayerTest.cpp',
+ 'tests/WebMediaPlayerClientImplTest.cpp',
'tests/WebPageNewSerializerTest.cpp',
'tests/WebPageSerializerTest.cpp',
'tests/WebSocketDeflaterTest.cpp',
@@ -139,6 +148,7 @@
'conditions': [
['OS=="win"', {
'webkit_unittest_files': [
+ 'tests/LocaleWinTest.cpp',
# FIXME: Port PopupMenuTest to Linux and Mac.
'tests/PopupMenuTest.cpp',
'tests/TransparencyWinTest.cpp',
diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp
index d50ad1523..6f1ed11c7 100644
--- a/Source/WebKit/chromium/WebKitUnitTests.gyp
+++ b/Source/WebKit/chromium/WebKitUnitTests.gyp
@@ -55,7 +55,8 @@
'msvs_guid': '7CEFE800-8403-418A-AD6A-2D52C6FC3EAD',
'dependencies': [
'WebKit.gyp:webkit',
- '../../WebCore/WebCore.gyp/WebCore.gyp:webcore',
+ '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
+ '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
'<(chromium_src_dir)/testing/gtest.gyp:gtest',
'<(chromium_src_dir)/testing/gmock.gyp:gmock',
'<(chromium_src_dir)/base/base.gyp:base',
@@ -71,6 +72,11 @@
'include_dirs': [
'public',
'src',
+ # WebKit unit tests are allowed to include WebKit and WebCore header files, which may include headers in the
+ # Platform API as <public/WebFoo.h>. Thus we need to have the Platform API include path, but we can't depend
+ # directly on Platform.gyp:webkit_platform since platform cannot link as a separate library. Instead, we just
+ # add the include path directly.
+ '../../Platform/chromium',
],
'conditions': [
['inside_chromium_build==1 and component=="shared_library"', {
@@ -78,6 +84,9 @@
'WEBKIT_DLL_UNITTEST',
],
}, {
+ 'dependencies': [
+ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore',
+ ],
'sources': [
'<@(webkit_unittest_files)',
],
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp
deleted file mode 100644
index a8693b479..000000000
--- a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp
+++ /dev/null
@@ -1,96 +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:
- *
- * * 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(MEDIA_STREAM)
-
-#include "MediaStreamCenterInternal.h"
-
-#include "MediaStreamCenter.h"
-#include "MediaStreamComponent.h"
-#include "MediaStreamSource.h"
-#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebMediaStreamCenter.h"
-#include "platform/WebMediaStreamComponent.h"
-#include "platform/WebMediaStreamDescriptor.h"
-#include "platform/WebMediaStreamSourcesRequest.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-MediaStreamCenterInternal::MediaStreamCenterInternal(MediaStreamCenter* owner)
- : m_private(adoptPtr(WebKit::webKitPlatformSupport()->createMediaStreamCenter(this)))
- , m_owner(owner)
-{
-}
-
-MediaStreamCenterInternal::~MediaStreamCenterInternal()
-{
-}
-
-void MediaStreamCenterInternal::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
-{
- // FIXME: Remove this "short-circuit" and forward to m_private when Chrome has implemented WebMediaStreamCenter.
- MediaStreamSourceVector audioSources, videoSources;
- client->didCompleteQuery(audioSources, videoSources);
-}
-
-void MediaStreamCenterInternal::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
-{
- if (m_private) {
- if (component->enabled())
- m_private->didEnableMediaStreamTrack(stream, component);
- else
- m_private->didDisableMediaStreamTrack(stream, component);
- }
-}
-
-void MediaStreamCenterInternal::didStopLocalMediaStream(MediaStreamDescriptor* stream)
-{
- if (m_private)
- m_private->didStopLocalMediaStream(stream);
-}
-
-void MediaStreamCenterInternal::didConstructMediaStream(MediaStreamDescriptor* stream)
-{
- if (m_private)
- m_private->didConstructMediaStream(stream);
-}
-
-void MediaStreamCenterInternal::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream)
-{
- m_owner->endLocalMediaStream(stream);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebKit/chromium/bridge/PeerConnectionHandler.cpp b/Source/WebKit/chromium/bridge/PeerConnectionHandler.cpp
deleted file mode 100644
index c59b2d46c..000000000
--- a/Source/WebKit/chromium/bridge/PeerConnectionHandler.cpp
+++ /dev/null
@@ -1,88 +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:
- *
- * * 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(MEDIA_STREAM)
-
-#include "PeerConnectionHandler.h"
-
-#include "PeerConnectionHandlerClient.h"
-#include "PeerConnectionHandlerInternal.h"
-
-namespace WebCore {
-
-PassOwnPtr<PeerConnectionHandler> PeerConnectionHandler::create(PeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username)
-{
- return adoptPtr(new PeerConnectionHandler(client, serverConfiguration, username));
-}
-
-PeerConnectionHandler::PeerConnectionHandler(PeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username)
- : m_private(adoptPtr(new PeerConnectionHandlerInternal(client, serverConfiguration, username)))
-{
-}
-
-PeerConnectionHandler::~PeerConnectionHandler()
-{
-}
-
-void PeerConnectionHandler::produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams)
-{
- m_private->produceInitialOffer(pendingAddStreams);
-}
-
-void PeerConnectionHandler::handleInitialOffer(const String& sdp)
-{
- m_private->handleInitialOffer(sdp);
-}
-
-void PeerConnectionHandler::processSDP(const String& sdp)
-{
- m_private->processSDP(sdp);
-}
-
-void PeerConnectionHandler::processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams)
-{
- m_private->processPendingStreams(pendingAddStreams, pendingRemoveStreams);
-}
-
-void PeerConnectionHandler::sendDataStreamMessage(const char* data, size_t length)
-{
- m_private->sendDataStreamMessage(data, length);
-}
-
-void PeerConnectionHandler::stop()
-{
- m_private->stop();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.cpp b/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.cpp
deleted file mode 100644
index d8f61f7f0..000000000
--- a/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.cpp
+++ /dev/null
@@ -1,137 +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:
- *
- * * 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(MEDIA_STREAM)
-
-#include "PeerConnectionHandlerInternal.h"
-
-#include "PeerConnectionHandlerClient.h"
-#include "SecurityOrigin.h"
-#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebMediaStreamDescriptor.h"
-#include "platform/WebPeerConnectionHandler.h"
-#include "platform/WebPeerConnectionHandlerClient.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-PeerConnectionHandlerInternal::PeerConnectionHandlerInternal(PeerConnectionHandlerClient* client, const String& serverConfiguration, const String& username)
- : m_client(client)
-{
- ASSERT(m_client);
- m_webHandler = adoptPtr(WebKit::webKitPlatformSupport()->createPeerConnectionHandler(this));
- // FIXME: When there is some error reporting avaliable in the PeerConnection object report
- // if we didn't get a WebPeerConnectionHandler instance.
-
- if (m_webHandler) {
- // Dual calls due to API change
- m_webHandler->initialize(serverConfiguration, username);
-
- // DEPRECATED
- m_webHandler->initialize(serverConfiguration, SecurityOrigin::createFromString(username));
- }
-}
-
-PeerConnectionHandlerInternal::~PeerConnectionHandlerInternal()
-{
-}
-
-void PeerConnectionHandlerInternal::produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams)
-{
- if (m_webHandler)
- m_webHandler->produceInitialOffer(pendingAddStreams);
-}
-
-void PeerConnectionHandlerInternal::handleInitialOffer(const String& sdp)
-{
- if (m_webHandler)
- m_webHandler->handleInitialOffer(sdp);
-}
-
-void PeerConnectionHandlerInternal::processSDP(const String& sdp)
-{
- if (m_webHandler)
- m_webHandler->processSDP(sdp);
-}
-
-void PeerConnectionHandlerInternal::processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams)
-{
- if (m_webHandler)
- m_webHandler->processPendingStreams(pendingAddStreams, pendingRemoveStreams);
-}
-
-void PeerConnectionHandlerInternal::sendDataStreamMessage(const char* data, size_t length)
-{
- if (m_webHandler)
- m_webHandler->sendDataStreamMessage(data, length);
-}
-
-void PeerConnectionHandlerInternal::stop()
-{
- if (m_webHandler)
- m_webHandler->stop();
-}
-
-void PeerConnectionHandlerInternal::didCompleteICEProcessing()
-{
- if (m_webHandler)
- m_client->didCompleteICEProcessing();
-}
-
-void PeerConnectionHandlerInternal::didGenerateSDP(const WebKit::WebString& sdp)
-{
- if (m_webHandler)
- m_client->didGenerateSDP(sdp);
-}
-
-void PeerConnectionHandlerInternal::didReceiveDataStreamMessage(const char* data, size_t length)
-{
- if (m_webHandler)
- m_client->didReceiveDataStreamMessage(data, length);
-}
-
-void PeerConnectionHandlerInternal::didAddRemoteStream(const WebKit::WebMediaStreamDescriptor& webMediaStreamDescriptor)
-{
- if (m_webHandler)
- m_client->didAddRemoteStream(webMediaStreamDescriptor);
-}
-
-void PeerConnectionHandlerInternal::didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor& webMediaStreamDescriptor)
-{
- if (m_webHandler)
- m_client->didRemoveRemoteStream(webMediaStreamDescriptor);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.h b/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.h
deleted file mode 100644
index e17fd96b5..000000000
--- a/Source/WebKit/chromium/bridge/PeerConnectionHandlerInternal.h
+++ /dev/null
@@ -1,80 +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:
- *
- * * 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 PeerConnectionHandlerInternal_h
-#define PeerConnectionHandlerInternal_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStreamDescriptor.h"
-#include "platform/WebPeerConnectionHandlerClient.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebKit {
-class WebPeerConnectionHandler;
-class WebString;
-class WebMediaStreamDescriptor;
-}
-
-namespace WebCore {
-
-class PeerConnectionHandlerClient;
-
-class PeerConnectionHandlerInternal : public WebKit::WebPeerConnectionHandlerClient {
-public:
- PeerConnectionHandlerInternal(PeerConnectionHandlerClient*, const String& serverConfiguration, const String& username);
- ~PeerConnectionHandlerInternal();
-
- virtual void produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams);
- virtual void handleInitialOffer(const String& sdp);
- virtual void processSDP(const String& sdp);
- virtual void processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams);
- virtual void sendDataStreamMessage(const char* data, size_t length);
- virtual void stop();
-
- // WebKit::WebPeerConnectionHandlerClient implementation.
- virtual void didCompleteICEProcessing();
- virtual void didGenerateSDP(const WebKit::WebString& sdp);
- virtual void didReceiveDataStreamMessage(const char* data, size_t length);
- virtual void didAddRemoteStream(const WebKit::WebMediaStreamDescriptor&);
- virtual void didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor&);
-
-private:
- OwnPtr<WebKit::WebPeerConnectionHandler> m_webHandler;
- PeerConnectionHandlerClient* m_client;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // PeerConnectionHandlerInternal_h
diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi
index 5a033c8cf..86054fac1 100644
--- a/Source/WebKit/chromium/features.gypi
+++ b/Source/WebKit/chromium/features.gypi
@@ -33,17 +33,21 @@
'variables': {
'feature_defines': [
'ENABLE_3D_PLUGIN=1',
+ 'ENABLE_BATTERY_STATUS=0',
'ENABLE_BLOB=1',
'ENABLE_BLOB_SLICE=1',
'ENABLE_CHANNEL_MESSAGING=1',
- 'ENABLE_CLIENT_BASED_GEOLOCATION=1',
'ENABLE_CSS_FILTERS=1',
+ 'ENABLE_CSS_IMAGE_SET=1',
+ 'ENABLE_CSS_SHADERS=1',
+ 'ENABLE_DATALIST=1',
'ENABLE_DASHBOARD_SUPPORT=0',
'ENABLE_DATA_TRANSFER_ITEMS=1',
'ENABLE_DETAILS=1',
'ENABLE_DEVICE_ORIENTATION=1',
'ENABLE_DIRECTORY_UPLOAD=1',
'ENABLE_DOWNLOAD_ATTRIBUTE=1',
+ 'ENABLE_ENCRYPTED_MEDIA=1',
'ENABLE_FILE_SYSTEM=1',
'ENABLE_FILTERS=1',
'ENABLE_FULLSCREEN_API=1',
@@ -52,10 +56,8 @@
'ENABLE_GESTURE_EVENTS=1',
'ENABLE_ICONDATABASE=0',
'ENABLE_INDEXED_DATABASE=1',
- 'ENABLE_INPUT_COLOR=0',
'ENABLE_INPUT_SPEECH=1',
- 'ENABLE_INPUT_TYPE_COLOR=0',
- 'ENABLE_INPUT_TYPE_DATE=0',
+ 'ENABLE_INPUT_TYPE_DATE=1',
'ENABLE_INPUT_TYPE_DATETIME=0',
'ENABLE_INPUT_TYPE_DATETIMELOCAL=0',
'ENABLE_INPUT_TYPE_MONTH=0',
@@ -63,8 +65,11 @@
'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',
@@ -95,7 +100,7 @@
'ENABLE_V8_SCRIPT_DEBUG_SERVER=1',
'ENABLE_VIDEO=1',
'ENABLE_VIDEO_TRACK=1',
- 'ENABLE_VIEWPORT=<(enable_viewport)',
+ 'ENABLE_VIEWPORT=1',
'ENABLE_WEBGL=1',
'ENABLE_WEB_SOCKETS=1',
'ENABLE_WEB_TIMING=1',
@@ -131,13 +136,27 @@
'conditions': [
['OS=="android"', {
'feature_defines': [
+ 'ENABLE_CALENDAR_PICKER=0',
+ 'ENABLE_PAGE_POPUP=0',
'ENABLE_WEB_AUDIO=0',
+ 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1',
],
}, {
'feature_defines': [
+ 'ENABLE_CALENDAR_PICKER=1',
+ 'ENABLE_PAGE_POPUP=1',
'ENABLE_WEB_AUDIO=1',
],
}],
+ ['OS=="android" or chromeos==1', {
+ 'feature_defines': [
+ 'ENABLE_INPUT_TYPE_COLOR=0',
+ ],
+ }, {
+ 'feature_defines': [
+ 'ENABLE_INPUT_TYPE_COLOR=1',
+ ],
+ }],
['use_accelerated_compositing==1', {
'feature_defines': [
'WTF_USE_ACCELERATED_COMPOSITING=1',
diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit
index 2e73f4ea6..36f0f431b 100755
--- a/Source/WebKit/chromium/gyp_webkit
+++ b/Source/WebKit/chromium/gyp_webkit
@@ -87,7 +87,6 @@ if __name__ == '__main__':
envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh')
exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))]))
else:
- os.environ['CC.target'] = os.environ['CROSS_CC']
args.remove('--no-envsetup-recursion')
# Add includes.
@@ -120,6 +119,7 @@ if __name__ == '__main__':
'-Dinside_chromium_build=0',
'-Dv8_use_snapshot=false',
'-Dmsvs_use_common_release=0',
+ '-Gmsvs_error_on_missing_sources=1',
# WebKit doesn't use the chromium style checker.
'-Dmake_clang_dir=Source/WebKit/chromium/third_party/llvm-build/Release+Asserts',
diff --git a/Source/WebKit/chromium/public/WebAccessibilityRole.h b/Source/WebKit/chromium/public/WebAccessibilityRole.h
index 196845730..60958f910 100644
--- a/Source/WebKit/chromium/public/WebAccessibilityRole.h
+++ b/Source/WebKit/chromium/public/WebAccessibilityRole.h
@@ -67,6 +67,7 @@ enum WebAccessibilityRole {
WebAccessibilityRoleDocumentRegion,
WebAccessibilityRoleDrawer,
WebAccessibilityRoleEditableText,
+ WebAccessibilityRoleFooter,
WebAccessibilityRoleForm,
WebAccessibilityRoleGrid,
WebAccessibilityRoleGroup,
diff --git a/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h b/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h
new file mode 100644
index 000000000..ef277d5fd
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebActiveWheelFlingParameters.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebActiveWheelFlingParameters_h
+#define WebActiveWheelFlingParameters_h
+
+#include "platform/WebCommon.h"
+
+#include "platform/WebFloatPoint.h"
+#include "platform/WebPoint.h"
+#include "platform/WebSize.h"
+
+namespace WebKit {
+
+struct WebActiveWheelFlingParameters {
+ WebFloatPoint delta;
+ WebPoint point;
+ WebPoint globalPoint;
+ int modifiers;
+ WebSize cumulativeScroll;
+ double startTime;
+
+ WebActiveWheelFlingParameters()
+ : modifiers(0)
+ , startTime(0)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebArrayBuffer.h b/Source/WebKit/chromium/public/WebArrayBuffer.h
index 81c9cb83b..85ba2c30f 100644
--- a/Source/WebKit/chromium/public/WebArrayBuffer.h
+++ b/Source/WebKit/chromium/public/WebArrayBuffer.h
@@ -68,6 +68,7 @@ public:
#if WEBKIT_USING_V8
WEBKIT_EXPORT v8::Handle<v8::Value> toV8Value();
+ WEBKIT_EXPORT static WebArrayBuffer* createFromV8Value(v8::Handle<v8::Value>);
#endif
#if WEBKIT_IMPLEMENTATION
diff --git a/Source/WebKit/chromium/public/WebAutofillClient.h b/Source/WebKit/chromium/public/WebAutofillClient.h
index 5824f170a..7b48f57db 100644
--- a/Source/WebKit/chromium/public/WebAutofillClient.h
+++ b/Source/WebKit/chromium/public/WebAutofillClient.h
@@ -40,16 +40,26 @@ class WebString;
class WebAutofillClient {
public:
+ enum {
+ MenuItemIDAutocompleteEntry = 0,
+ MenuItemIDWarningMessage = -1,
+ MenuItemIDPasswordEntry = -2,
+ MenuItemIDSeparator = -3,
+ MenuItemIDClearForm = -4,
+ MenuItemIDAutofillOptions = -5,
+ MenuItemIDDataListEntry = -6
+ };
+
// Informs the browser that the user has accepted an Autofill suggestion for
- // a WebNode. |uniqueID| is used as a key into the set of Autofill profiles,
- // and should never be negative. If it is 0, then the suggestion is an
- // Autocomplete suggestion; and |value| stores the suggested text. |index|
- // is an index of the selected suggestion in the list of suggestions provided
- // by the client.
+ // a WebNode. A positive |itemID| is a unique id used to identify the set
+ // of Autofill profiles. If it is AutocompleteEntryMenuItemID, then the
+ // suggestion is an Autocomplete suggestion; and |value| stores the
+ // suggested text. |index| is an index of the selected suggestion in the
+ // list of suggestions provided by the client.
virtual void didAcceptAutofillSuggestion(const WebNode&,
const WebString& value,
const WebString& label,
- int uniqueID,
+ int itemID,
unsigned index) { }
// Informs the browser that the user has selected an Autofill suggestion for
@@ -58,7 +68,7 @@ public:
virtual void didSelectAutofillSuggestion(const WebNode&,
const WebString& name,
const WebString& label,
- int uniqueID) { }
+ int itemID) { }
// Informs the browser that the user has cleared the selection from the
// Autofill suggestions popup. This happens when a user uses the arrow
diff --git a/Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp b/Source/WebKit/chromium/public/WebBatteryStatus.h
index 583d0df70..b1cf48600 100644
--- a/Source/WebKit/chromium/tests/WebExternalTextureLayerImplTest.cpp
+++ b/Source/WebKit/chromium/public/WebBatteryStatus.h
@@ -23,29 +23,29 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#ifndef WebBatteryStatus_h
+#define WebBatteryStatus_h
-#include "WebExternalTextureLayerImpl.h"
+#include "platform/WebCommon.h"
-#include <gtest/gtest.h>
-#include <wtf/RefPtr.h>
+namespace WebKit {
-namespace {
-
-using namespace WebKit;
-using WTF::RefPtr;
-
-class WebExternalTextureLayerImplTest : public WebExternalTextureLayerImpl {
+class WebBatteryStatus {
public:
- bool isDrawable() const { return drawsContent(); }
+ WebBatteryStatus()
+ : charging(true)
+ , chargingTime(0.0)
+ , dischargingTime(0.0)
+ , level(0.0)
+ {
+ }
+
+ bool charging;
+ double chargingTime;
+ double dischargingTime;
+ double level;
};
-TEST(WebExternalTextureLayerImpl, testIsDrawable)
-{
- RefPtr<WebExternalTextureLayerImplTest> textureLayer = adoptRef(new WebExternalTextureLayerImplTest());
-
- textureLayer->setTextureId(1);
- EXPECT_TRUE(textureLayer->isDrawable());
-}
+} // namespace WebKit
-}
+#endif // WebBatteryStatus_h
diff --git a/Source/WebKit/chromium/public/WebBatteryStatusClient.h b/Source/WebKit/chromium/public/WebBatteryStatusClient.h
new file mode 100644
index 000000000..1a2a15b00
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebBatteryStatusClient.h
@@ -0,0 +1,41 @@
+/*
+ * 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 WebBatteryStatusClient_h
+#define WebBatteryStatusClient_h
+
+namespace WebKit {
+
+class WebBatteryStatusClient {
+public:
+ virtual ~WebBatteryStatusClient() { }
+
+ virtual void startUpdating() = 0;
+ virtual void stopUpdating() = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebBatteryStatusClient_h
diff --git a/Source/WebKit/chromium/public/WebCompositor.h b/Source/WebKit/chromium/public/WebCompositor.h
index 32b60e284..3eadef32c 100644
--- a/Source/WebKit/chromium/public/WebCompositor.h
+++ b/Source/WebKit/chromium/public/WebCompositor.h
@@ -26,7 +26,6 @@
#ifndef WebCompositor_h
#define WebCompositor_h
-#include "WebCompositorInputHandler.h"
#include "platform/WebCommon.h"
namespace WebKit {
@@ -34,16 +33,11 @@ namespace WebKit {
class WebInputEvent;
class WebThread;
-#define WEBCOMPOSITOR_HAS_INITIALIZE
-
// This class contains global routines for interacting with the
// compositor.
//
// All calls to the WebCompositor must be made from the main thread.
-//
-// This class currently temporarily inherits from WebCompositorInputHandler
-// while we migrate downstream code to use WebCompositorInputHandler directly.
-class WebCompositor : public WebCompositorInputHandler {
+class WebCompositor {
public:
// Initializes the compositor. Threaded compositing is enabled by passing in
// a non-null WebThread. No compositor classes or methods should be used
diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandler.h b/Source/WebKit/chromium/public/WebCompositorInputHandler.h
index bc58748bd..557da6772 100644
--- a/Source/WebKit/chromium/public/WebCompositorInputHandler.h
+++ b/Source/WebKit/chromium/public/WebCompositorInputHandler.h
@@ -30,7 +30,6 @@
namespace WebKit {
-class WebCompositor;
class WebCompositorInputHandlerClient;
class WebInputEvent;
class WebThread;
@@ -41,7 +40,7 @@ class WebCompositorInputHandler {
public:
// The return value is temporarily WebCompositor until all downstream code
// is switched to use WebCompositorInputHandler.
- WEBKIT_EXPORT static WebCompositor* fromIdentifier(int);
+ WEBKIT_EXPORT static WebCompositorInputHandler* fromIdentifier(int);
virtual void setClient(WebCompositorInputHandlerClient*) = 0;
virtual void handleInputEvent(const WebInputEvent&) = 0;
diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h
index e8bb55598..7c911d8f8 100644
--- a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h
+++ b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h
@@ -28,6 +28,8 @@
namespace WebKit {
+struct WebActiveWheelFlingParameters;
+
class WebCompositorInputHandlerClient {
public:
// Callbacks invoked from the compositor thread.
@@ -42,6 +44,10 @@ public:
// should be forwarded to the WebWidget associated with this compositor for further processing.
virtual void didNotHandleInputEvent(bool sendToWidget) = 0;
+ // Transfers an active wheel fling animation initiated by a previously handled input event out to the client.
+ // FIXME: Make pure virtual once implementation lands on Chromium side.
+ virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&) { }
+
protected:
virtual ~WebCompositorInputHandlerClient() { }
};
diff --git a/Source/WebKit/chromium/public/WebContextMenuData.h b/Source/WebKit/chromium/public/WebContextMenuData.h
index e72a434db..a36372192 100644
--- a/Source/WebKit/chromium/public/WebContextMenuData.h
+++ b/Source/WebKit/chromium/public/WebContextMenuData.h
@@ -34,8 +34,8 @@
#include "WebHistoryItem.h"
#include "WebMenuItemInfo.h"
#include "WebNode.h"
-#include "WebReferrerPolicy.h"
#include "platform/WebPoint.h"
+#include "platform/WebReferrerPolicy.h"
#include "platform/WebString.h"
#include "platform/WebURL.h"
#include "platform/WebVector.h"
diff --git a/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
index c09f514c1..0438cd355 100644
--- a/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
+++ b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h
@@ -50,7 +50,8 @@ public:
virtual void requestSetDockSide(const WebString& side) { }
virtual void moveWindowBy(const WebFloatPoint&) { }
virtual void openInNewTab(const WebString& side) { }
- virtual void saveAs(const WebString& fileName, const WebString& content) { }
+ virtual void save(const WebString& url, const WebString& content, bool saveAs) { }
+ virtual void append(const WebString& url, const WebString& content) { }
protected:
virtual ~WebDevToolsFrontendClient() {}
diff --git a/Source/WebKit/chromium/public/WebDocument.h b/Source/WebKit/chromium/public/WebDocument.h
index 6725e79e1..6c0df31bc 100644
--- a/Source/WebKit/chromium/public/WebDocument.h
+++ b/Source/WebKit/chromium/public/WebDocument.h
@@ -33,6 +33,7 @@
#include "WebNode.h"
#include "WebSecurityOrigin.h"
+#include "platform/WebReferrerPolicy.h"
#include "platform/WebVector.h"
#if WEBKIT_IMPLEMENTATION
@@ -101,6 +102,7 @@ public:
WEBKIT_EXPORT void cancelFullScreen();
WEBKIT_EXPORT WebElement fullScreenElement() const;
WEBKIT_EXPORT WebDOMEvent createEvent(const WebString& eventType);
+ WEBKIT_EXPORT WebReferrerPolicy referrerPolicy() const;
// Accessibility support. These methods should only be called on the
// top-level document, because one accessibility cache spans all of
diff --git a/Source/WebKit/chromium/public/WebElement.h b/Source/WebKit/chromium/public/WebElement.h
index a3a06121d..84c43b251 100644
--- a/Source/WebKit/chromium/public/WebElement.h
+++ b/Source/WebKit/chromium/public/WebElement.h
@@ -38,7 +38,6 @@ namespace WebCore { class Element; }
#endif
namespace WebKit {
-class WebNamedNodeMap;
struct WebRect;
// Provides access to some properties of a DOM element node.
@@ -57,10 +56,12 @@ struct WebRect;
WEBKIT_EXPORT bool hasAttribute(const WebString&) const;
WEBKIT_EXPORT WebString getAttribute(const WebString&) const;
WEBKIT_EXPORT bool setAttribute(const WebString& name, const WebString& value);
- WEBKIT_EXPORT WebNamedNodeMap attributes() const;
WEBKIT_EXPORT WebString innerText();
WEBKIT_EXPORT WebDocument document() const;
WEBKIT_EXPORT void requestFullScreen();
+ WEBKIT_EXPORT WebString attributeLocalName(unsigned index) const;
+ WEBKIT_EXPORT WebString attributeValue(unsigned index) const;
+ WEBKIT_EXPORT unsigned attributeCount() const;
// Returns the language code specified for this element. This attribute
// is inherited, so the returned value is drawn from the closest parent
diff --git a/Source/WebKit/chromium/public/WebFileChooserCompletion.h b/Source/WebKit/chromium/public/WebFileChooserCompletion.h
index 14bace4c2..9b01d0e41 100644
--- a/Source/WebKit/chromium/public/WebFileChooserCompletion.h
+++ b/Source/WebKit/chromium/public/WebFileChooserCompletion.h
@@ -31,18 +31,36 @@
#ifndef WebFileChooserCompletion_h
#define WebFileChooserCompletion_h
+#include "platform/WebString.h"
+
namespace WebKit {
-class WebString;
template <typename T> class WebVector;
// Gets called back when WebViewClient finished choosing a file.
class WebFileChooserCompletion {
public:
+ struct SelectedFileInfo {
+ // The actual path of the selected file.
+ WebString path;
+
+ // The display name of the file that is to be exposed as File.name in
+ // the DOM layer. If it is empty the base part of the |path| is used.
+ WebString displayName;
+ };
+
// Called with zero or more file names. Zero-lengthed vector means that
// the user cancelled or that file choosing failed. The callback instance
// is destroyed when this method is called.
virtual void didChooseFile(const WebVector<WebString>& fileNames) = 0;
+
+ // Called with zero or more files, given as a vector of SelectedFileInfo.
+ // Zero-lengthed vector means that the user cancelled or that file
+ // choosing failed. The callback instance is destroyed when this method
+ // is called.
+ // FIXME: Deprecate either one of the didChooseFile (and rename it to
+ // didChooseFile*s*).
+ virtual void didChooseFile(const WebVector<SelectedFileInfo>&) { }
protected:
virtual ~WebFileChooserCompletion() {}
};
diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h
index 0d5406d52..da795ae8d 100644
--- a/Source/WebKit/chromium/public/WebFrame.h
+++ b/Source/WebKit/chromium/public/WebFrame.h
@@ -33,10 +33,10 @@
#include "WebIconURL.h"
#include "WebNode.h"
-#include "WebReferrerPolicy.h"
#include "WebURLLoaderOptions.h"
#include "platform/WebCanvas.h"
#include "platform/WebFileSystem.h"
+#include "platform/WebReferrerPolicy.h"
#include "platform/WebURL.h"
struct NPObject;
@@ -44,6 +44,8 @@ struct NPObject;
#if WEBKIT_USING_V8
namespace v8 {
class Context;
+class Function;
+class Object;
class Value;
template <class T> class Handle;
template <class T> class Local;
@@ -274,6 +276,18 @@ public:
virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
const WebScriptSource&) = 0;
+ virtual void executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results) = 0;
+
+ // Call the function with the given receiver and arguments, bypassing
+ // canExecute().
+ virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
+ v8::Handle<v8::Function>,
+ v8::Handle<v8::Object>,
+ int argc,
+ v8::Handle<v8::Value> argv[]) = 0;
+
// Returns the V8 context for this frame, or an empty handle if there
// is none.
virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0;
@@ -436,6 +450,8 @@ public:
virtual void selectRange(const WebPoint& start, const WebPoint& end) = 0;
+ virtual void selectRange(const WebRange&) = 0;
+
// Printing ------------------------------------------------------------
diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h
index fa6fc7a33..9270d1ab9 100644
--- a/Source/WebKit/chromium/public/WebFrameClient.h
+++ b/Source/WebKit/chromium/public/WebFrameClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -63,6 +63,8 @@ class WebMediaPlayerClient;
class WebNode;
class WebPlugin;
class WebSharedWorker;
+class WebSharedWorkerClient;
+class WebSocketStreamHandle;
class WebStorageQuotaCallbacks;
class WebString;
class WebURL;
@@ -70,7 +72,6 @@ class WebURLLoader;
class WebURLRequest;
class WebURLResponse;
class WebWorker;
-class WebSharedWorkerClient;
struct WebPluginParams;
struct WebRect;
struct WebSize;
@@ -284,10 +285,6 @@ public:
// A reflected XSS was encountered in the page and suppressed.
virtual void didDetectXSS(WebFrame*, const WebURL&, bool didBlockEntirePage) { }
- // This frame adopted the resource that is being loaded. This happens when
- // an iframe, that is loading a subresource, is transferred between windows.
- virtual void didAdoptURLLoader(WebURLLoader*) { }
-
// Script notifications ------------------------------------------------
// Script in the page tried to allocate too much memory.
@@ -385,6 +382,11 @@ public:
// object to coordinate replies to the intent invocation.
virtual void dispatchIntent(WebFrame*, const WebIntentRequest&) { }
+ // WebSocket -----------------------------------------------------
+
+ // A WebSocket object is going to open new stream connection.
+ virtual void willOpenSocketStream(WebSocketStreamHandle*) { }
+
// Messages ------------------------------------------------------
// Notifies the embedder that a postMessage was issued on this frame, and
diff --git a/Source/WebKit/chromium/public/WebHitTestResult.h b/Source/WebKit/chromium/public/WebHitTestResult.h
new file mode 100644
index 000000000..8fb9838a4
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebHitTestResult.h
@@ -0,0 +1,71 @@
+/*
+* Copyright (C) 2012 Google Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* 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 WebHitTestResult_h
+#define WebHitTestResult_h
+
+#include "platform/WebPrivateOwnPtr.h"
+
+namespace WebCore {
+class HitTestResult;
+}
+
+namespace WebKit {
+
+class WebNode;
+struct WebPoint;
+
+// Properties of a hit test result, i.e. properties of the nodes at a given point
+// (the hit point) on the page. Both urls may be populated at the same time, for
+// example in the instance of an <img> inside an <a>.
+class WebHitTestResult {
+public:
+ WebHitTestResult() { }
+ WebHitTestResult(const WebHitTestResult& info) { assign(info); }
+ ~WebHitTestResult() { reset(); }
+
+ WEBKIT_EXPORT void assign(const WebHitTestResult&);
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT bool isNull() const;
+
+ // The node that was hit (only one for point-based tests).
+ WEBKIT_EXPORT WebNode node() const;
+
+ // Coordinates of the point that was hit. Relative to the node.
+ WEBKIT_EXPORT WebPoint localPoint() const;
+
+#if WEBKIT_IMPLEMENTATION
+ WebHitTestResult(const WebCore::HitTestResult&);
+ WebHitTestResult& operator=(const WebCore::HitTestResult&);
+ operator WebCore::HitTestResult() const;
+#endif
+
+protected:
+ WebPrivateOwnPtr<WebCore::HitTestResult> m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebIDBCursor.h b/Source/WebKit/chromium/public/WebIDBCursor.h
index 96b1765d8..4e23f0702 100644
--- a/Source/WebKit/chromium/public/WebIDBCursor.h
+++ b/Source/WebKit/chromium/public/WebIDBCursor.h
@@ -62,6 +62,7 @@ public:
}
virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void prefetchContinue(int numberToFetch, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
diff --git a/Source/WebKit/chromium/public/WebIDBDatabase.h b/Source/WebKit/chromium/public/WebIDBDatabase.h
index ff8e1ca4a..f53b02e39 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 "WebIDBKeyPath.h"
#include "platform/WebCommon.h"
namespace WebKit {
@@ -58,7 +59,13 @@ public:
WEBKIT_ASSERT_NOT_REACHED();
return WebDOMStringList();
}
- virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&)
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
+ virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec)
+ {
+ return createObjectStore(name, WebIDBKeyPath(keyPath), autoIncrement, transaction, ec);
+ }
+ virtual WebIDBObjectStore* createObjectStore(const WebString&, const WebIDBKeyPath&, bool, const WebIDBTransaction&, WebExceptionCode&)
{
WEBKIT_ASSERT_NOT_REACHED();
return 0;
diff --git a/Source/WebKit/chromium/public/WebReferrerPolicy.h b/Source/WebKit/chromium/public/WebIDBDatabaseException.h
index 82710fb22..81b838667 100644
--- a/Source/WebKit/chromium/public/WebReferrerPolicy.h
+++ b/Source/WebKit/chromium/public/WebIDBDatabaseException.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
@@ -28,18 +28,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebReferrerPolicy_h
-#define WebReferrerPolicy_h
+#ifndef WebIDBDatabaseException_h
+#define WebIDBDatabaseException_h
namespace WebKit {
-enum WebReferrerPolicy {
- WebReferrerPolicyAlways,
- WebReferrerPolicyDefault,
- WebReferrerPolicyNever,
- WebReferrerPolicyOrigin,
+enum WebIDBDatabaseException {
+ WebIDBDatabaseExceptionDataError = 1205,
+ WebIDBDatabaseExceptionQuotaError = 1211,
};
} // namespace WebKit
-#endif
+#endif // WebIDBDatabaseException_h
diff --git a/Source/WebKit/chromium/public/WebIDBIndex.h b/Source/WebKit/chromium/public/WebIDBIndex.h
index b7f526d76..37af02c0c 100644
--- a/Source/WebKit/chromium/public/WebIDBIndex.h
+++ b/Source/WebKit/chromium/public/WebIDBIndex.h
@@ -27,6 +27,7 @@
#define WebIDBIndex_h
#include "WebExceptionCode.h"
+#include "WebIDBKeyPath.h"
#include "WebIDBTransaction.h"
#include "platform/WebString.h"
@@ -51,7 +52,13 @@ public:
WEBKIT_ASSERT_NOT_REACHED();
return WebString();
}
- virtual WebString keyPath() const
+ virtual WebIDBKeyPath keyPath() const
+ {
+ return WebIDBKeyPath(keyPathString());
+ }
+ // FIXME: Remove method once callers are updated.
+ // http://webkit.org/b/84207
+ virtual WebString keyPathString() const
{
WEBKIT_ASSERT_NOT_REACHED();
return WebString();
@@ -70,8 +77,8 @@ public:
virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
- virtual void getObject(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
- virtual void getKey(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void getObject(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void getKey(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
protected:
WebIDBIndex() {}
diff --git a/Source/WebKit/chromium/public/WebIDBKeyPath.h b/Source/WebKit/chromium/public/WebIDBKeyPath.h
index 4c7259f03..97bac06ff 100644
--- a/Source/WebKit/chromium/public/WebIDBKeyPath.h
+++ b/Source/WebKit/chromium/public/WebIDBKeyPath.h
@@ -28,6 +28,7 @@
#include "platform/WebCommon.h"
#include "platform/WebPrivateOwnPtr.h"
+#include "platform/WebString.h"
#include "platform/WebVector.h"
namespace WTF {
@@ -37,14 +38,29 @@ class String;
namespace WebKit {
-class WebString;
-
class WebIDBKeyPath {
public:
WEBKIT_EXPORT static WebIDBKeyPath create(const WebString&);
- WebIDBKeyPath(const WebIDBKeyPath& keyPath) { assign(keyPath); }
+ WEBKIT_EXPORT static WebIDBKeyPath create(const WebVector<WebString>&);
+ WEBKIT_EXPORT static WebIDBKeyPath createNull();
+ WEBKIT_EXPORT WebIDBKeyPath(const WebIDBKeyPath&);
~WebIDBKeyPath() { reset(); }
+ enum Type {
+ NullType = 0,
+ StringType,
+ ArrayType,
+ };
+
+ WEBKIT_EXPORT bool isValid() const;
+ WEBKIT_EXPORT Type type() const;
+ // FIXME: Array-type key paths not yet supported. http://webkit.org/b/84207
+ WebVector<WebString> array() const { WEBKIT_ASSERT_NOT_REACHED(); return WebVector<WebString>(); }
+ WEBKIT_EXPORT WebString string() const;
+
+ // FIXME: Remove these once callers are updated. http://webkit.org/b/84207
+ WEBKIT_EXPORT WebIDBKeyPath(const WebString&);
+ operator const WebString () const { return string(); }
WEBKIT_EXPORT int parseError() const;
WEBKIT_EXPORT void assign(const WebIDBKeyPath&);
WEBKIT_EXPORT void reset();
diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h
index 981f5ec7e..dcf485692 100644
--- a/Source/WebKit/chromium/public/WebIDBObjectStore.h
+++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h
@@ -29,6 +29,7 @@
#include "WebExceptionCode.h"
#include "WebDOMStringList.h"
#include "WebIDBCallbacks.h"
+#include "WebIDBKeyPath.h"
#include "WebIDBTransaction.h"
#include "platform/WebCommon.h"
#include "platform/WebString.h"
@@ -48,7 +49,11 @@ public:
WEBKIT_ASSERT_NOT_REACHED();
return WebString();
}
- virtual WebString keyPath() const
+ virtual WebIDBKeyPath keyPath() const
+ {
+ return WebIDBKeyPath(keyPathString());
+ }
+ virtual WebString keyPathString() const
{
WEBKIT_ASSERT_NOT_REACHED();
return WebString();
@@ -59,7 +64,7 @@ public:
return WebDOMStringList();
}
- virtual void get(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
enum PutMode {
AddOrUpdate,
@@ -71,8 +76,15 @@ public:
virtual void deleteFunction(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
virtual WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
+ return createIndex(name, WebIDBKeyPath(keyPath), unique, multiEntry, transaction, ec);
+ }
+ virtual WebIDBIndex* createIndex(const WebString&, const WebIDBKeyPath&, bool, bool, const WebIDBTransaction&, WebExceptionCode&)
+ {
WEBKIT_ASSERT_NOT_REACHED();
return 0;
}
diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h
index 3d1ffb6e0..b1c407c59 100644
--- a/Source/WebKit/chromium/public/WebInputElement.h
+++ b/Source/WebKit/chromium/public/WebInputElement.h
@@ -39,6 +39,8 @@ namespace WebCore { class HTMLInputElement; }
namespace WebKit {
+ class WebNodeCollection;
+
// Provides readonly access to some properties of a DOM input element node.
class WebInputElement : public WebFormControlElement {
public:
@@ -83,6 +85,9 @@ namespace WebKit {
WEBKIT_EXPORT int selectionEnd() const;
WEBKIT_EXPORT bool isValidValue(const WebString&) const;
WEBKIT_EXPORT bool isChecked() const;
+ WEBKIT_EXPORT bool isMultiple() const;
+
+ WEBKIT_EXPORT WebNodeCollection dataListOptions() const;
WEBKIT_EXPORT bool isSpeechInputEnabled() const;
WEBKIT_EXPORT SpeechInputState getSpeechInputState() const;
diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h
index e42e45134..d5d6394f8 100644
--- a/Source/WebKit/chromium/public/WebInputEvent.h
+++ b/Source/WebKit/chromium/public/WebInputEvent.h
@@ -45,16 +45,23 @@ namespace WebKit {
// WARNING! These classes must remain PODs (plain old data). They are
// intended to be "serializable" by copying their raw bytes, so they must
// not contain any non-bit-copyable member variables!
+//
+// Furthermore, the class members need to be packed so they are aligned
+// properly and don't have paddings/gaps, otherwise memory check tools
+// like Valgrind will complain about uninitialized memory usage when
+// transferring these classes over the wire.
+
+#pragma pack(push, 4)
// WebInputEvent --------------------------------------------------------------
class WebInputEvent {
public:
WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent))
- : size(sizeParam)
+ : timeStampSeconds(0.0)
+ , size(sizeParam)
, type(Undefined)
- , modifiers(0)
- , timeStampSeconds(0.0) { }
+ , modifiers(0) { }
// When we use an input method (or an input method editor), we receive
// two events for a keypress. The former event is a keydown, which
@@ -109,6 +116,7 @@ public:
GestureTap,
GestureTapDown,
GestureDoubleTap,
+ GestureLongPress,
GesturePinchBegin,
GesturePinchEnd,
GesturePinchUpdate,
@@ -145,10 +153,10 @@ public:
static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey;
- unsigned size; // The size of this structure, for serialization.
+ double timeStampSeconds; // Seconds since epoch.
+ unsigned size; // The size of this structure, for serialization.
Type type;
int modifiers;
- double timeStampSeconds; // Seconds since epoch.
// Returns true if the WebInputEvent |type| is a mouse event.
static bool isMouseEventType(int type)
@@ -197,6 +205,7 @@ public:
|| type == GestureScrollUpdate
|| type == GestureFlingStart
|| type == GestureFlingCancel
+ || type == GestureTapDown
|| type == GestureTap; // FIXME: Why is GestureTap on this list?
}
};
@@ -225,6 +234,14 @@ public:
// doesn't hurt to have this one around.
int nativeKeyCode;
+ // This identifies whether this event was tagged by the system as being
+ // a "system key" event (see
+ // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
+ // details). Other platforms don't have this concept, but it's just
+ // easier to leave it always false than ifdef.
+ // See comment at the top of the file for why an int is used here.
+ bool isSystemKey;
+
// |text| is the text generated by this keystroke. |unmodifiedText| is
// |text|, but unmodified by an concurrently-held modifiers (except
// shift). This is useful for working out shortcut keys. Linux and
@@ -237,17 +254,6 @@ public:
// This is a string identifying the key pressed.
char keyIdentifier[keyIdentifierLengthCap];
- // This identifies whether this event was tagged by the system as being
- // a "system key" event (see
- // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
- // details). Other platforms don't have this concept, but it's just
- // easier to leave it always false than ifdef.
- // int is used instead of bool to ensure the size of this structure is
- // strictly aligned to a factor of 4 bytes, otherwise memory check tools
- // like valgrind may complain about uninitialized memory usage when
- // transfering it over the wire.
- int isSystemKey;
-
WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
: WebInputEvent(sizeParam)
, windowsKeyCode(0)
@@ -322,13 +328,11 @@ public:
float wheelTicksX;
float wheelTicksY;
- // int is used instead of bool to ensure the size of this structure is
- // strictly aligned to a factor of 4 bytes, otherwise memory check tools
- // like valgrind may complain about uninitialized memory usage when
- // transfering it over the wire.
+ // See comment at the top of the file for why an int is used here.
int scrollByPage;
- bool hasPreciseScrollingDeltas;
+ // See comment at the top of the file for why an int is used here.
+ int hasPreciseScrollingDeltas;
Phase phase;
Phase momentumPhase;
@@ -355,9 +359,11 @@ public:
int globalX;
int globalY;
- // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor.
+ // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. For Tap and Press events, |deltaX|,|deltaY| and |gammaX|,|gammaY| correspond to the top left and bottom right corners of the ellipse's enlosing rectangle for tap target fuzzing.
float deltaX;
float deltaY;
+ float gammaX;
+ float gammaY;
WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent))
: WebInputEvent(sizeParam)
@@ -367,6 +373,8 @@ public:
, globalY(0)
, deltaX(0.0f)
, deltaY(0.0f)
+ , gammaX(0.0f)
+ , gammaY(0.0f)
{
}
};
@@ -398,6 +406,8 @@ public:
}
};
+#pragma pack(pop)
+
} // namespace WebKit
#endif
diff --git a/Source/WebKit/chromium/public/WebIntent.h b/Source/WebKit/chromium/public/WebIntent.h
index d01098fe5..cc080ad99 100644
--- a/Source/WebKit/chromium/public/WebIntent.h
+++ b/Source/WebKit/chromium/public/WebIntent.h
@@ -31,9 +31,12 @@
#ifndef WebIntent_h
#define WebIntent_h
+#include "WebMessagePortChannel.h"
#include "platform/WebCommon.h"
#include "platform/WebPrivatePtr.h"
#include "platform/WebString.h"
+#include "platform/WebURL.h"
+#include "platform/WebVector.h"
namespace WebCore { class Intent; }
@@ -61,6 +64,19 @@ public:
WEBKIT_EXPORT WebString action() const;
WEBKIT_EXPORT WebString type() const;
WEBKIT_EXPORT WebString data() const;
+ WEBKIT_EXPORT WebURL service() const;
+
+ // Retrieve a list of the names of extra metadata associated with the
+ // intent.
+ WEBKIT_EXPORT WebVector<WebString> extrasNames() const;
+
+ // Retrieve the value of an extra metadata element. The argument should
+ // be one of the names retrieved with |extrasNames|. Returns an empty
+ // string if the name is invalid.
+ WEBKIT_EXPORT WebString extrasValue(const WebString&) const;
+
+ // Caller takes ownership of the ports.
+ WEBKIT_EXPORT WebMessagePortChannelArray* messagePortChannelsRelease() const;
#if WEBKIT_IMPLEMENTATION
WebIntent(const WTF::PassRefPtr<WebCore::Intent>&);
diff --git a/Source/WebKit/chromium/public/WebMediaElement.h b/Source/WebKit/chromium/public/WebMediaElement.h
deleted file mode 100644
index f828ea1f6..000000000
--- a/Source/WebKit/chromium/public/WebMediaElement.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebMediaElement_h
-#define WebMediaElement_h
-
-#include "WebElement.h"
-
-#if WEBKIT_IMPLEMENTATION
-namespace WebCore { class HTMLMediaElement; }
-#endif
-
-namespace WebKit {
-
-class WebMediaPlayer;
-
-class WebMediaElement : public WebElement {
-public:
- WEBKIT_EXPORT WebMediaPlayer* player() const;
-
-#if WEBKIT_IMPLEMENTATION
- WebMediaElement(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&);
- WebMediaElement& operator=(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&);
- operator WTF::PassRefPtr<WebCore::HTMLMediaElement>() const;
-#endif
-};
-} // namespace WebKit
-
-#endif // WebMediaElement_h
diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h
index 239134963..a2a9fb9b4 100644
--- a/Source/WebKit/chromium/public/WebMediaPlayer.h
+++ b/Source/WebKit/chromium/public/WebMediaPlayer.h
@@ -31,9 +31,10 @@
#ifndef WebMediaPlayer_h
#define WebMediaPlayer_h
+#include "WebTimeRange.h"
#include "WebVideoFrame.h"
#include "platform/WebCanvas.h"
-#include "platform/WebVector.h"
+#include "platform/WebString.h"
namespace WebKit {
@@ -41,57 +42,62 @@ class WebAudioSourceProvider;
class WebAudioSourceProviderClient;
class WebMediaPlayerClient;
class WebStreamTextureClient;
+class WebString;
class WebURL;
struct WebRect;
struct WebSize;
-struct WebTimeRange {
- WebTimeRange() : start(0), end(0) {}
- WebTimeRange(float s, float e) : start(s), end(e) {}
-
- float start;
- float end;
-};
-
-typedef WebVector<WebTimeRange> WebTimeRanges;
-
class WebMediaPlayer {
public:
enum NetworkState {
- Empty,
- Idle,
- Loading,
- Loaded,
- FormatError,
- NetworkError,
- DecodeError,
+ NetworkStateEmpty,
+ NetworkStateIdle,
+ NetworkStateLoading,
+ NetworkStateLoaded,
+ NetworkStateFormatError,
+ NetworkStateNetworkError,
+ NetworkStateDecodeError,
};
enum ReadyState {
- HaveNothing,
- HaveMetadata,
- HaveCurrentData,
- HaveFutureData,
- HaveEnoughData,
+ ReadyStateHaveNothing,
+ ReadyStateHaveMetadata,
+ ReadyStateHaveCurrentData,
+ ReadyStateHaveFutureData,
+ ReadyStateHaveEnoughData,
};
enum MovieLoadType {
- Unknown,
- Download,
- StoredStream,
- LiveStream,
+ MovieLoadTypeUnknown,
+ MovieLoadTypeDownload,
+ MovieLoadTypeStoredStream,
+ MovieLoadTypeLiveStream,
};
enum Preload {
- None,
- MetaData,
- Auto,
+ PreloadNone,
+ PreloadMetaData,
+ PreloadAuto,
+ };
+
+ enum AddIdStatus {
+ AddIdStatusOk,
+ AddIdStatusNotSupported,
+ AddIdStatusReachedIdLimit
};
enum EndOfStreamStatus {
- EosNoError,
- EosNetworkError,
- EosDecodeError,
+ EndOfStreamStatusNoError,
+ EndOfStreamStatusNetworkError,
+ EndOfStreamStatusDecodeError,
+ };
+
+ // Represents synchronous exceptions that can be thrown from the Encrypted
+ // Media methods. This is different from the asynchronous MediaKeyError.
+ enum MediaKeyException {
+ MediaKeyExceptionNoError,
+ MediaKeyExceptionInvalidPlayerState,
+ MediaKeyExceptionKeySystemNotSupported,
};
virtual ~WebMediaPlayer() {}
@@ -116,7 +122,7 @@ public:
virtual void setSize(const WebSize&) = 0;
- virtual void paint(WebCanvas*, const WebRect&) = 0;
+ virtual void paint(WebCanvas*, const WebRect&, uint8_t alpha) = 0;
// True if the loaded media has a playable video/audio track.
virtual bool hasVideo() const = 0;
@@ -167,8 +173,21 @@ public:
virtual WebAudioSourceProvider* audioSourceProvider() { return 0; }
+ virtual AddIdStatus sourceAddId(const WebString& id, const WebString& type) { return AddIdStatusNotSupported; }
+ virtual bool sourceRemoveId(const WebString& id) { return false; }
virtual bool sourceAppend(const unsigned char* data, unsigned length) { return false; }
virtual void sourceEndOfStream(EndOfStreamStatus) { }
+
+ // Returns whether keySystem is supported. If true, the result will be
+ // reported by an event.
+ virtual MediaKeyException generateKeyRequest(const WebString& keySystem, const unsigned char* initData, unsigned initDataLength) { return MediaKeyExceptionKeySystemNotSupported; }
+ virtual MediaKeyException addKey(const WebString& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
+ virtual MediaKeyException cancelKeyRequest(const WebString& keySystem, const WebString& sessionId) { return MediaKeyExceptionKeySystemNotSupported; }
+
+ // Instuct WebMediaPlayer to enter/exit fullscreen.
+ // Returns true if the player can enter fullscreen.
+ virtual bool enterFullscreen() { return false; }
+ virtual void exitFullscreen() { }
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/public/WebMediaPlayerClient.h b/Source/WebKit/chromium/public/WebMediaPlayerClient.h
index 19ea242ec..786bf5aa7 100644
--- a/Source/WebKit/chromium/public/WebMediaPlayerClient.h
+++ b/Source/WebKit/chromium/public/WebMediaPlayerClient.h
@@ -40,6 +40,21 @@ class WebURL;
class WebMediaPlayerClient {
public:
+ enum MediaKeyErrorCode {
+ MediaKeyErrorCodeUnknown = 1,
+ MediaKeyErrorCodeClient,
+ MediaKeyErrorCodeService,
+ MediaKeyErrorCodeOutput,
+ MediaKeyErrorCodeHardwareChange,
+ MediaKeyErrorCodeDomain,
+ UnknownError = MediaKeyErrorCodeUnknown,
+ ClientError = MediaKeyErrorCodeClient,
+ ServiceError = MediaKeyErrorCodeService,
+ OutputError = MediaKeyErrorCodeOutput,
+ HardwareChangeError = MediaKeyErrorCodeHardwareChange,
+ DomainError = MediaKeyErrorCodeDomain,
+ };
+
virtual void networkStateChanged() = 0;
virtual void readyStateChanged() = 0;
virtual void volumeChanged(float) = 0;
@@ -56,6 +71,10 @@ public:
virtual WebMediaPlayer::Preload preload() const = 0;
virtual void sourceOpened() = 0;
virtual WebKit::WebURL sourceURL() const = 0;
+ virtual void keyAdded(const WebString&, const WebString&) = 0;
+ 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;
virtual void disableAcceleratedCompositing() = 0;
protected:
~WebMediaPlayerClient() { }
diff --git a/Source/WebKit/chromium/public/WebNamedNodeMap.h b/Source/WebKit/chromium/public/WebNamedNodeMap.h
deleted file mode 100644
index 796c8d164..000000000
--- a/Source/WebKit/chromium/public/WebNamedNodeMap.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebNamedNodeMap_h
-#define WebNamedNodeMap_h
-
-#include "platform/WebCommon.h"
-#include "platform/WebPrivatePtr.h"
-
-namespace WebCore { class NamedNodeMap; }
-#if WEBKIT_IMPLEMENTATION
-namespace WTF { template <typename T> class PassRefPtr; }
-#endif
-
-namespace WebKit {
-class WebAttribute;
-
-// Provides readonly access to some properties of a DOM attribute map.
-class WebNamedNodeMap {
-public:
- ~WebNamedNodeMap() { reset(); }
-
- WebNamedNodeMap() { }
- WebNamedNodeMap(const WebNamedNodeMap& n) { assign(n); }
- WebNamedNodeMap& operator=(const WebNamedNodeMap& n)
- {
- assign(n);
- return *this;
- }
-
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebNamedNodeMap&);
-
- WEBKIT_EXPORT unsigned length() const;
- WEBKIT_EXPORT WebAttribute attributeItem(unsigned) const;
-
-#if WEBKIT_IMPLEMENTATION
- WebNamedNodeMap(const WTF::PassRefPtr<WebCore::NamedNodeMap>&);
-#endif
-
-private:
- WebPrivatePtr<WebCore::NamedNodeMap> m_private;
-};
-
-} // namespace WebKit
-
-#endif
diff --git a/Source/WebKit/chromium/public/WebNodeCollection.h b/Source/WebKit/chromium/public/WebNodeCollection.h
index 9707e17fb..b168b6d5b 100644
--- a/Source/WebKit/chromium/public/WebNodeCollection.h
+++ b/Source/WebKit/chromium/public/WebNodeCollection.h
@@ -54,6 +54,8 @@ public:
return *this;
}
+ bool isNull() const { return !m_private; }
+
WEBKIT_EXPORT void reset();
WEBKIT_EXPORT void assign(const WebNodeCollection&);
diff --git a/Source/WebKit/chromium/public/WebPageVisibilityState.h b/Source/WebKit/chromium/public/WebPageVisibilityState.h
index be7705c0d..8eb867fa2 100644
--- a/Source/WebKit/chromium/public/WebPageVisibilityState.h
+++ b/Source/WebKit/chromium/public/WebPageVisibilityState.h
@@ -38,7 +38,8 @@ namespace WebKit {
enum WebPageVisibilityState {
WebPageVisibilityStateVisible,
WebPageVisibilityStateHidden,
- WebPageVisibilityStatePrerender
+ WebPageVisibilityStatePrerender,
+ WebPageVisibilityStatePreview
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebURLRequestPrivate.h b/Source/WebKit/chromium/public/WebPrerendererClient.h
index 1c1b69608..fd148e5e8 100644
--- a/Source/WebKit/chromium/src/WebURLRequestPrivate.h
+++ b/Source/WebKit/chromium/public/WebPrerendererClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -26,28 +26,23 @@
* 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 WebURLRequestPrivate_h
-#define WebURLRequestPrivate_h
+#ifndef WebPrerendererClient_h
+#define WebPrerendererClient_h
-namespace WebCore { class ResourceRequest; }
+#include "platform/WebCommon.h"
namespace WebKit {
-class WebURLRequestPrivate {
-public:
- WebURLRequestPrivate()
- : m_resourceRequest(0)
- , m_allowStoredCredentials(true) { }
-
- // Called by WebURLRequest when it no longer needs this object.
- virtual void dispose() = 0;
+class WebPrerender;
- WebCore::ResourceRequest* m_resourceRequest;
- bool m_allowStoredCredentials;
+class WebPrerendererClient {
+public:
+ virtual void willAddPrerender(WebPrerender*) = 0;
};
-} // namespace WebKit
+} // namespace WebPrerendererClient_h
-#endif
+#endif // WebPrerendererClient_h
diff --git a/Source/WebKit/chromium/public/WebPrintScalingOption.h b/Source/WebKit/chromium/public/WebPrintScalingOption.h
new file mode 100644
index 000000000..95dbb8984
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebPrintScalingOption.h
@@ -0,0 +1,44 @@
+/*
+ * 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 WebPrintScalingOption_h
+#define WebPrintScalingOption_h
+
+namespace WebKit {
+
+enum WebPrintScalingOption {
+ WebPrintScalingOptionNone, // Prints the upper left of a page without scaling. Crop the page contents that don't fit on the paper.
+ WebPrintScalingOptionFitToPrintableArea, // Reduces or enlarges each page to fit the printable area of the selected printer paper size.
+ WebPrintScalingOptionSourceSize, // Print output page size is same as the actual source page size. Do not scale/center/fit to printable area.
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebRange.h b/Source/WebKit/chromium/public/WebRange.h
index 907dfd563..37f05ec60 100644
--- a/Source/WebKit/chromium/public/WebRange.h
+++ b/Source/WebKit/chromium/public/WebRange.h
@@ -32,6 +32,7 @@
#define WebRange_h
#include "platform/WebCommon.h"
+#include "platform/WebVector.h"
#if WEBKIT_IMPLEMENTATION
namespace WebCore { class Range; }
@@ -40,6 +41,7 @@ namespace WTF { template <typename T> class PassRefPtr; }
namespace WebKit {
+struct WebFloatQuad;
class WebFrame;
class WebNode;
class WebRangePrivate;
@@ -73,6 +75,8 @@ public:
WEBKIT_EXPORT static WebRange fromDocumentRange(WebFrame*, int start, int length);
+ WEBKIT_EXPORT WebVector<WebFloatQuad> textQuads() const;
+
#if WEBKIT_IMPLEMENTATION
WebRange(const WTF::PassRefPtr<WebCore::Range>&);
WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&);
diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h
index 187ef0f55..0a954e164 100644
--- a/Source/WebKit/chromium/public/WebRuntimeFeatures.h
+++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h
@@ -109,6 +109,9 @@ public:
WEBKIT_EXPORT static void enableMediaStream(bool);
WEBKIT_EXPORT static bool isMediaStreamEnabled();
+ WEBKIT_EXPORT static void enablePeerConnection(bool);
+ WEBKIT_EXPORT static bool isPeerConnectionEnabled();
+
WEBKIT_EXPORT static void enableFullScreenAPI(bool);
WEBKIT_EXPORT static bool isFullScreenAPIEnabled();
@@ -118,6 +121,9 @@ public:
WEBKIT_EXPORT static void enableMediaSource(bool);
WEBKIT_EXPORT static bool isMediaSourceEnabled();
+ WEBKIT_EXPORT static void enableEncryptedMedia(bool);
+ WEBKIT_EXPORT static bool isEncryptedMediaEnabled();
+
WEBKIT_EXPORT static void enableVideoTrack(bool);
WEBKIT_EXPORT static bool isVideoTrackEnabled();
@@ -130,6 +136,9 @@ public:
WEBKIT_EXPORT static void enableStyleScoped(bool);
WEBKIT_EXPORT static bool isStyleScopedEnabled();
+ WEBKIT_EXPORT static void enableInputTypeDate(bool);
+ WEBKIT_EXPORT static bool isInputTypeDateEnabled();
+
private:
WebRuntimeFeatures();
};
diff --git a/Source/WebKit/chromium/public/WebAttribute.h b/Source/WebKit/chromium/public/WebScopedMicrotaskSuppression.h
index ff4b3a7f8..826db6955 100644
--- a/Source/WebKit/chromium/public/WebAttribute.h
+++ b/Source/WebKit/chromium/public/WebScopedMicrotaskSuppression.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,47 +28,47 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebAttribute_h
-#define WebAttribute_h
+#ifndef WebScopedMicrotaskSuppression_h
+#define WebScopedMicrotaskSuppression_h
-#include "platform/WebCommon.h"
-#include "platform/WebPrivatePtr.h"
-
-namespace WebCore { class Attribute; }
-#if WEBKIT_IMPLEMENTATION
-namespace WTF { template <typename T> class PassRefPtr; }
-#endif
+#include "platform/WebPrivateOwnPtr.h"
namespace WebKit {
-class WebString;
-// Provides readonly access to some properties of a DOM attribute.
-class WebAttribute {
+// This class wraps V8RecursionScope::BypassMicrotaskCheckpoint. Please
+// see V8RecursionScope.h for full usage. Short story: Embedder calls into
+// script contexts which also host page script must do one of two things:
+//
+// 1. If the call may cause any page/author script to run, it must be
+// captured for pre/post work (e.g. inspector instrumentation/microtask
+// delivery) and thus be invoked through WebFrame (e.g. executeScript*,
+// callFunction*).
+// 2. If the call will not cause any page/author script to run, the call
+// should be made directly via the v8 context, but the callsite must be
+// accompanied by a stack allocated WebScopedMicrotaskSuppression, e.g.:
+//
+// ...
+// {
+// WebKit::WebScopedMicrotaskSuppression suppression;
+// func->Call(global, argv, args);
+// }
+// ...
+//
+class WebScopedMicrotaskSuppression {
public:
- ~WebAttribute() { reset(); }
-
- WebAttribute() { }
- WebAttribute(const WebAttribute& n) { assign(n); }
- WebAttribute& operator=(const WebAttribute& n)
- {
- assign(n);
- return *this;
- }
+ WebScopedMicrotaskSuppression() { initialize(); }
+ ~WebScopedMicrotaskSuppression() { reset(); }
+private:
+ WEBKIT_EXPORT void initialize();
WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebAttribute&);
- WEBKIT_EXPORT WebString localName() const;
- WEBKIT_EXPORT WebString value() const;
-
-#if WEBKIT_IMPLEMENTATION
- WebAttribute(const WTF::PassRefPtr<WebCore::Attribute>&);
+#ifndef NDEBUG
+ class Impl;
+ WebPrivateOwnPtr<Impl> m_impl;
#endif
-
-private:
- WebPrivatePtr<WebCore::Attribute> m_private;
};
-} // namespace WebKit
+} // WebKit
#endif
diff --git a/Source/WebKit/chromium/public/WebSecurityPolicy.h b/Source/WebKit/chromium/public/WebSecurityPolicy.h
index 466d98684..5d9d3de06 100644
--- a/Source/WebKit/chromium/public/WebSecurityPolicy.h
+++ b/Source/WebKit/chromium/public/WebSecurityPolicy.h
@@ -31,8 +31,8 @@
#ifndef WebSecurityPolicy_h
#define WebSecurityPolicy_h
-#include "WebReferrerPolicy.h"
#include "platform/WebCommon.h"
+#include "platform/WebReferrerPolicy.h"
namespace WebKit {
@@ -64,6 +64,10 @@ public:
// Registers a non-HTTP URL scheme which can be sent CORS requests.
WEBKIT_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&);
+ // Registers a URL scheme as strictly empty documents, allowing them to
+ // commit synchronously.
+ WEBKIT_EXPORT static void registerURLSchemeAsEmptyDocument(const WebString&);
+
// Support for whitelisting access to origins beyond the same-origin policy.
WEBKIT_EXPORT static void addOriginAccessWhitelistEntry(
const WebURL& sourceOrigin, const WebString& destinationProtocol,
diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h
index 47aaeece0..ec7d03785 100644
--- a/Source/WebKit/chromium/public/WebSettings.h
+++ b/Source/WebKit/chromium/public/WebSettings.h
@@ -98,6 +98,7 @@ public:
virtual void setWebAudioEnabled(bool) = 0;
virtual void setExperimentalWebGLEnabled(bool) = 0;
virtual void setExperimentalCSSRegionsEnabled(bool) = 0;
+ virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0;
virtual void setOpenGLMultisamplingEnabled(bool) = 0;
virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0;
virtual void setWebGLErrorsToConsoleEnabled(bool) = 0;
@@ -110,8 +111,6 @@ public:
virtual void setAcceleratedCompositingEnabled(bool) = 0;
virtual void setForceCompositingMode(bool) = 0;
virtual void setMockScrollbarsEnabled(bool) = 0;
- virtual void setCompositeToTextureEnabled(bool) = 0;
- virtual bool compositeToTextureEnabled() const = 0;
virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0;
virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0;
virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0;
@@ -138,12 +137,15 @@ public:
virtual void setPasswordEchoDurationInSeconds(double) = 0;
virtual void setShouldPrintBackgrounds(bool) = 0;
virtual void setEnableScrollAnimator(bool) = 0;
+ virtual bool scrollAnimatorEnabled() const = 0;
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 bool viewportEnabled() const = 0;
protected:
~WebSettings() { }
diff --git a/Source/WebKit/chromium/public/WebSpeechGrammar.h b/Source/WebKit/chromium/public/WebSpeechGrammar.h
new file mode 100644
index 000000000..d3c36523d
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechGrammar.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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechGrammar_h
+#define WebSpeechGrammar_h
+
+#include "platform/WebCommon.h"
+#include "platform/WebPrivatePtr.h"
+#include "platform/WebURL.h"
+
+namespace WebCore {
+class SpeechGrammar;
+}
+
+namespace WebKit {
+
+class WebSpeechGrammar {
+public:
+ WebSpeechGrammar() { }
+ ~WebSpeechGrammar() { reset(); }
+
+ WEBKIT_EXPORT WebURL src() const;
+ WEBKIT_EXPORT float weight() const;
+
+ WEBKIT_EXPORT void reset();
+
+#if WEBKIT_IMPLEMENTATION
+ WebSpeechGrammar(const WTF::PassRefPtr<WebCore::SpeechGrammar>&);
+ WebSpeechGrammar& operator=(const WTF::PassRefPtr<WebCore::SpeechGrammar>&);
+#endif
+
+private:
+ WebPrivatePtr<WebCore::SpeechGrammar> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechGrammar_h
diff --git a/Source/WebKit/chromium/public/WebSpeechRecognitionHandle.h b/Source/WebKit/chromium/public/WebSpeechRecognitionHandle.h
new file mode 100644
index 000000000..fa3cb85bd
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechRecognitionHandle.h
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechRecognitionHandle_h
+#define WebSpeechRecognitionHandle_h
+
+#include "platform/WebCommon.h"
+#include "platform/WebPrivatePtr.h"
+
+namespace WebCore {
+class SpeechRecognition;
+}
+
+namespace WebKit {
+
+class WebSpeechRecognitionResult;
+class WebString;
+
+// WebSpeechRecognitionHandle is used by WebSpeechRecognizer to identify a
+// recognition session, and by WebSpeechRecognizerClient to route
+// recognition events.
+class WebSpeechRecognitionHandle {
+public:
+ ~WebSpeechRecognitionHandle() { reset(); }
+ WebSpeechRecognitionHandle() { }
+
+ WebSpeechRecognitionHandle(const WebSpeechRecognitionHandle& other) { assign(other); }
+ WebSpeechRecognitionHandle& operator=(const WebSpeechRecognitionHandle& other)
+ {
+ assign(other);
+ return *this;
+ }
+
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT void assign(const WebSpeechRecognitionHandle&);
+
+ // Comparison functions are provided so that WebSpeechRecognitionHandle objects
+ // can be stored in a hash map.
+ WEBKIT_EXPORT bool equals(const WebSpeechRecognitionHandle&) const;
+ WEBKIT_EXPORT bool lessThan(const WebSpeechRecognitionHandle&) const;
+
+#if WEBKIT_IMPLEMENTATION
+ WebSpeechRecognitionHandle(const WTF::PassRefPtr<WebCore::SpeechRecognition>&);
+ WebSpeechRecognitionHandle& operator=(const WTF::PassRefPtr<WebCore::SpeechRecognition>&);
+ operator WTF::PassRefPtr<WebCore::SpeechRecognition>() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::SpeechRecognition> m_private;
+};
+
+inline bool operator==(const WebSpeechRecognitionHandle& a, const WebSpeechRecognitionHandle& b)
+{
+ return a.equals(b);
+}
+
+inline bool operator!=(const WebSpeechRecognitionHandle& a, const WebSpeechRecognitionHandle& b)
+{
+ return !(a == b);
+}
+
+inline bool operator<(const WebSpeechRecognitionHandle& a, const WebSpeechRecognitionHandle& b)
+{
+ return a.lessThan(b);
+}
+
+} // namespace WebKit
+
+#endif // WebSpeechRecognitionHandle_h
diff --git a/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h b/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h
new file mode 100644
index 000000000..b2dcce055
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechRecognitionParams.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechRecognitionParams_h
+#define WebSpeechRecognitionParams_h
+
+#include "WebSpeechGrammar.h"
+#include "platform/WebString.h"
+#include "platform/WebVector.h"
+
+namespace WebKit {
+
+class WebSpeechGrammar;
+
+class WebSpeechRecognitionParams {
+public:
+ WebSpeechRecognitionParams(const WebVector<WebSpeechGrammar>& grammars, const WebString& language, bool continuous)
+ : m_grammars(grammars)
+ , m_language(language)
+ , m_continuous(continuous)
+ {
+ }
+
+ const WebVector<WebSpeechGrammar>& grammars() const { return m_grammars; }
+ const WebString& language() const { return m_language; }
+ bool continuous() const { return m_continuous; }
+
+private:
+ WebVector<WebSpeechGrammar> m_grammars;
+ WebString m_language;
+ bool m_continuous;
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechRecognitionParams_h
diff --git a/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h b/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h
new file mode 100644
index 000000000..899f28556
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechRecognitionResult.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechRecognitionResult_h
+#define WebSpeechRecognitionResult_h
+
+#include "platform/WebCommon.h"
+#include "platform/WebPrivatePtr.h"
+#include "platform/WebString.h"
+#include "platform/WebVector.h"
+
+namespace WebCore {
+class SpeechRecognitionResult;
+}
+
+namespace WebKit {
+
+class WebSpeechRecognitionResult {
+public:
+ WebSpeechRecognitionResult() { }
+ ~WebSpeechRecognitionResult() { reset(); }
+
+ WEBKIT_EXPORT void assign(const WebVector<WebString>& transcripts, const WebVector<float>& confidences, bool final);
+ WEBKIT_EXPORT void assign(const WebSpeechRecognitionResult&);
+ WEBKIT_EXPORT void reset();
+
+#if WEBKIT_IMPLEMENTATION
+ operator WTF::PassRefPtr<WebCore::SpeechRecognitionResult>() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::SpeechRecognitionResult> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechRecognitionResult_h
diff --git a/Source/WebKit/chromium/public/WebSpeechRecognizer.h b/Source/WebKit/chromium/public/WebSpeechRecognizer.h
new file mode 100644
index 000000000..bd8f3c65e
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechRecognizer.h
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechRecognizer_h
+#define WebSpeechRecognizer_h
+
+#include "WebSpeechRecognitionHandle.h"
+#include "platform/WebCommon.h"
+
+namespace WebKit {
+
+class WebSpeechGrammar;
+class WebSpeechRecognitionParams;
+class WebSpeechRecognizerClient;
+
+// Interface for speech recognition, to be implemented by the embedder.
+class WebSpeechRecognizer {
+public:
+ // Start speech recognition for the specified handle using the specified parameters. Notifications on progress, results, and errors will be sent via the client.
+ virtual void start(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionParams&, WebSpeechRecognizerClient*) { WEBKIT_ASSERT_NOT_REACHED(); }
+
+ // Stop speech recognition for the specified handle, returning any results for the audio recorded so far. Notifications and errors are sent via the client.
+ virtual void stop(const WebSpeechRecognitionHandle&, WebSpeechRecognizerClient*) { WEBKIT_ASSERT_NOT_REACHED(); }
+
+ // Abort speech recognition for the specified handle, discarding any recorded audio. Notifications and errors are sent via the client.
+ virtual void abort(const WebSpeechRecognitionHandle&, WebSpeechRecognizerClient*) { WEBKIT_ASSERT_NOT_REACHED(); }
+
+protected:
+ virtual ~WebSpeechRecognizer() { }
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechRecognizer_h
diff --git a/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h b/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h
new file mode 100644
index 000000000..35c637834
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSpeechRecognizerClient.h
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 WebSpeechRecognizerClient_h
+#define WebSpeechRecognizerClient_h
+
+#include "platform/WebVector.h"
+
+namespace WebKit {
+
+class WebSpeechRecognitionResult;
+class WebSpeechRecognitionHandle;
+class WebString;
+
+// A client for reporting progress on speech recognition for a specific handle.
+class WebSpeechRecognizerClient {
+public:
+ // These methods correspond to the events described in the spec:
+ // http://speech-javascript-api-spec.googlecode.com/git/speechapi.html#speechreco-events
+
+ // To be called when the embedder has started to capture audio.
+ virtual void didStartAudio(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when some sound, possibly speech, has been detected.
+ // This is expected to be called after didStartAudio.
+ virtual void didStartSound(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when speech has been detected.
+ // This is expected to be called after didStartSound.
+ virtual void didStartSpeech(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when speech is no longer detected.
+ virtual void didEndSpeech(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when sound is no longer detected.
+ // This is expected to be called after didEndSpeech.
+ virtual void didEndSound(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when audio capture has stopped.
+ // This is expected to be called after didEndSound.
+ virtual void didEndAudio(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when the speech recognizer returns a result.
+ virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) = 0;
+
+ // To be called when the speech recognizer returns a final result with no
+ // recognizion hypothesis.
+ virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) = 0;
+
+ // To be called when the recognizer needs to delete one of the previously
+ // returned interim results.
+ virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) = 0;
+
+ // To be called when a speech recognition error occurs.
+ // FIXME: Introduce an enum for the error code.
+ virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, unsigned short code) = 0;
+
+ // To be called when the recognizer has begun to listen to the audio with
+ // the intention of recognizing.
+ virtual void didStart(const WebSpeechRecognitionHandle&) = 0;
+
+ // To be called when the recognition session has ended. This must always be
+ // called, no matter the reason for the end.
+ virtual void didEnd(const WebSpeechRecognitionHandle&) = 0;
+
+protected:
+ virtual ~WebSpeechRecognizerClient() {}
+};
+
+} // namespace WebKit
+
+#endif // WebSpeechRecognizerClient_h
diff --git a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h
index 88d333a93..4fbc596b2 100644
--- a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h
+++ b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h
@@ -35,17 +35,30 @@
namespace WebKit {
+class WebStorageArea;
+class WebStorageNamespace;
class WebURL;
-// This is used to dispatch storage events to all pages.
-// FIXME: Make this (or something) work for SessionStorage!
class WebStorageEventDispatcher {
public:
- WEBKIT_EXPORT static WebStorageEventDispatcher* create();
+ // Dispatch a local storage event to appropiate documents.
+ WEBKIT_EXPORT static void dispatchLocalStorageEvent(
+ const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebURL& origin,
+ const WebURL& pageUrl, WebStorageArea* sourceAreaInstance,
+ bool originatedInProcess);
- virtual ~WebStorageEventDispatcher() { }
+ // Dispatch a session storage event to appropiate documents.
+ WEBKIT_EXPORT static void dispatchSessionStorageEvent(
+ const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebURL& origin,
+ const WebURL& pageUrl, const WebStorageNamespace&,
+ WebStorageArea* sourceAreaInstance, bool originatedInProcess);
- // Dispatch the actual event. Doesn't yet work for SessionStorage.
+ // DEPRECATED - The instance methods are going away soon in favor
+ // of the two static dispatch methods above.
+ WEBKIT_EXPORT static WebStorageEventDispatcher* create();
+ virtual ~WebStorageEventDispatcher() { }
virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
const WebString& newValue, const WebString& origin,
const WebURL& url, bool isLocalStorage) = 0;
diff --git a/Source/WebKit/chromium/public/WebStorageNamespace.h b/Source/WebKit/chromium/public/WebStorageNamespace.h
index bb748d958..894330717 100644
--- a/Source/WebKit/chromium/public/WebStorageNamespace.h
+++ b/Source/WebKit/chromium/public/WebStorageNamespace.h
@@ -43,23 +43,6 @@ class WebString;
// StorageNamespace to represent LocalStorage for the entire browser.
class WebStorageNamespace {
public:
- // Create a new WebStorageNamespace. LocalStorageNamespaces require a path to specify
- // where the SQLite databases that make LocalStorage data persistent are located.
- // If path is empty, data will not persist. You should call delete on the returned
- // object when you're finished.
- WEBKIT_EXPORT static WebStorageNamespace* createLocalStorageNamespace(const WebString& backingDirectoryPath, unsigned quota);
- WEBKIT_EXPORT static WebStorageNamespace* createSessionStorageNamespace(unsigned quota);
-
- // The quota for each storage area. Suggested by the spec.
- static const unsigned m_localStorageQuota = 5 * 1024 * 1024;
-
- // Since SessionStorage memory is allocated in the browser process, we place a
- // per-origin quota on it. Like LocalStorage there are known attacks against
- // this, so it's more of a sanity check than a real security measure.
- static const unsigned m_sessionStorageQuota = 5 * 1024 * 1024;
-
- static const unsigned noQuota = UINT_MAX;
-
virtual ~WebStorageNamespace() { }
// Create a new WebStorageArea object. Two subsequent calls with the same origin
@@ -70,9 +53,11 @@ public:
// Copy a StorageNamespace. This only makes sense in the case of SessionStorage.
virtual WebStorageNamespace* copy() = 0;
- // Shutdown the StorageNamespace. Write all StorageArea's to disk and disallow new
- // write activity.
- virtual void close() = 0;
+ // Returns true of the two instances represent the same storage namespace.
+ virtual bool isSameNamespace(const WebStorageNamespace&) const { return false; }
+
+ // DEPRECATED
+ virtual void close() { }
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/public/WebSurroundingText.h b/Source/WebKit/chromium/public/WebSurroundingText.h
new file mode 100644
index 000000000..dd2a3c527
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebSurroundingText.h
@@ -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 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 WebSurroundingText_h
+#define WebSurroundingText_h
+
+#include "WebNode.h"
+#include "WebRange.h"
+#include "platform/WebPrivateOwnPtr.h"
+#include "platform/WebString.h"
+
+namespace WebCore {
+class SurroundingText;
+}
+
+namespace WebKit {
+
+class WebHitTestResult;
+
+class WebSurroundingText {
+public:
+ WebSurroundingText() { }
+ ~WebSurroundingText() { reset(); }
+
+ WEBKIT_EXPORT bool isNull() const;
+ WEBKIT_EXPORT void reset();
+
+ // Initializes the object go get the surrounding text centered in the position described by the hit test.
+ // The maximum length of the contents retrieved is defined by maxLength.
+ WEBKIT_EXPORT void initialize(const WebHitTestResult&, size_t maxLength);
+
+ // Initializes the object go get the surrounding text centered in the selected offset of the given node.
+ // The maximum length of the contents retrieved is defined by maxLength.
+ WEBKIT_EXPORT void initialize(WebNode textNode, size_t offset, size_t maxLength);
+
+ // Surrounding text content retrieved.
+ WEBKIT_EXPORT WebString textContent() const;
+
+ // Offset in the text content of the initial hit position (or provided offset in the node).
+ WEBKIT_EXPORT size_t hitOffsetInTextContent() const;
+
+ // Convert start/end positions in the content text string into a WebKit text range.
+ WEBKIT_EXPORT WebRange rangeFromContentOffsets(size_t startOffsetInContent, size_t endOffsetInContent);
+
+protected:
+ WebPrivateOwnPtr<WebCore::SurroundingText> m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebTextCheckingCompletion.h b/Source/WebKit/chromium/public/WebTextCheckingCompletion.h
index 32701e4c7..c3010dfd4 100644
--- a/Source/WebKit/chromium/public/WebTextCheckingCompletion.h
+++ b/Source/WebKit/chromium/public/WebTextCheckingCompletion.h
@@ -42,6 +42,7 @@ template <typename T> class WebVector;
class WebTextCheckingCompletion {
public:
virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) = 0;
+ virtual void didCancelCheckingText() { };
protected:
~WebTextCheckingCompletion() { }
};
diff --git a/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp b/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h
index ea8868009..a8d29f93e 100644
--- a/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp
+++ b/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h
@@ -28,61 +28,44 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#ifndef WebTextFieldDecoratorClient_h
+#define WebTextFieldDecoratorClient_h
-#if ENABLE(MEDIA_STREAM)
-
-#include "platform/WebMediaStreamSourcesRequest.h"
-
-#include "MediaStreamCenter.h"
-#include "MediaStreamSource.h"
-#include "platform/WebMediaStreamSource.h"
-#include "platform/WebVector.h"
-#include <wtf/Vector.h>
-
-using namespace WebCore;
+#include "platform/WebCString.h"
namespace WebKit {
-WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest(const PassRefPtr<WebCore::MediaStreamSourcesQueryClient>& queryClient)
- : m_private(queryClient)
-{
-}
-
-void WebMediaStreamSourcesRequest::reset()
-{
- m_private.reset();
-}
+class WebInputElement;
-bool WebMediaStreamSourcesRequest::audio() const
-{
- ASSERT(!isNull());
- return m_private->audio();
-}
+class WebTextFieldDecoratorClient {
+public:
+ // The function should return true if the specified input element should
+ // have a decoration icon. This function is called whenever a text field is
+ // created, and should not take much time.
+ virtual bool shouldAddDecorationTo(const WebInputElement&) = 0;
-bool WebMediaStreamSourcesRequest::video() const
-{
- ASSERT(!isNull());
- return m_private->video();
-}
+ // Image resource name for the normal state. The image is stretched to
+ // font-size x font-size square. The function must return an existing
+ // resource name.
+ virtual WebCString imageNameForNormalState() = 0;
+ // Image resource name for the disabled state. If this function returns an
+ // empty string, imageNameForNormalState() is used even for the disabled
+ // state.
+ virtual WebCString imageNameForDisabledState() = 0;
+ // Image resource name for the disabled state. If this function returns an
+ // empty string, the image same as imageNameForDisabledState() is used.
+ virtual WebCString imageNameForReadOnlyState() = 0;
-void WebMediaStreamSourcesRequest::didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const
-{
- ASSERT(!isNull());
- MediaStreamSourceVector audio;
- for (size_t i = 0; i < audioSources.size(); ++i) {
- MediaStreamSource* curr = audioSources[i];
- audio.append(curr);
- }
- MediaStreamSourceVector video;
- for (size_t i = 0; i < videoSources.size(); ++i) {
- MediaStreamSource* curr = videoSources[i];
- video.append(curr);
- }
- m_private->didCompleteQuery(audio, video);
-}
+ // This is called when the decoration icon is clicked.
+ virtual void handleClick(WebInputElement&) = 0;
+ // This is called when the input element loses its renderer. An
+ // implementation of this function should not do something which updates
+ // state of WebKit objects.
+ virtual void willDetach(const WebInputElement&) = 0;
-} // namespace WebKit
+ virtual ~WebTextFieldDecoratorClient() { }
+};
-#endif // ENABLE(MEDIA_STREAM)
+}
+#endif // WebTextFieldDecoratorClient_h
diff --git a/Source/WebKit/chromium/src/WebURLResponsePrivate.h b/Source/WebKit/chromium/public/WebTimeRange.h
index b6d5730b0..d1a3a2098 100644
--- a/Source/WebKit/chromium/src/WebURLResponsePrivate.h
+++ b/Source/WebKit/chromium/public/WebTimeRange.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,25 +28,23 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebURLResponsePrivate_h
-#define WebURLResponsePrivate_h
+#ifndef WebTimeRange_h
+#define WebTimeRange_h
-#include "platform/WebString.h"
-
-namespace WebCore { class ResourceResponse; }
+#include "platform/WebVector.h"
namespace WebKit {
-class WebURLResponsePrivate {
-public:
- WebURLResponsePrivate() : m_resourceResponse(0) { }
-
- // Called by WebURLResponse when it no longer needs this object.
- virtual void dispose() = 0;
+struct WebTimeRange {
+ WebTimeRange() : start(0), end(0) { }
+ WebTimeRange(float s, float e) : start(s), end(e) { }
- WebCore::ResourceResponse* m_resourceResponse;
+ float start;
+ float end;
};
+typedef WebVector<WebTimeRange> WebTimeRanges;
+
} // namespace WebKit
#endif
diff --git a/Source/WebKit/chromium/public/WebUserMediaClient.h b/Source/WebKit/chromium/public/WebUserMediaClient.h
index 2998159ee..bbdea18c1 100644
--- a/Source/WebKit/chromium/public/WebUserMediaClient.h
+++ b/Source/WebKit/chromium/public/WebUserMediaClient.h
@@ -41,9 +41,6 @@ class WebUserMediaClient {
public:
virtual ~WebUserMediaClient() { }
- // DEPRECATED
- virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&) { }
-
virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) { }
virtual void cancelUserMediaRequest(const WebUserMediaRequest&) = 0;
diff --git a/Source/WebKit/chromium/public/WebUserMediaRequest.h b/Source/WebKit/chromium/public/WebUserMediaRequest.h
index 38fb1898b..54b534e7b 100644
--- a/Source/WebKit/chromium/public/WebUserMediaRequest.h
+++ b/Source/WebKit/chromium/public/WebUserMediaRequest.h
@@ -31,6 +31,7 @@
#ifndef WebUserMediaRequest_h
#define WebUserMediaRequest_h
+#include "WebSecurityOrigin.h"
#include "platform/WebCommon.h"
#include "platform/WebPrivatePtr.h"
@@ -41,7 +42,6 @@ class UserMediaRequest;
namespace WebKit {
class WebMediaStreamSource;
-class WebSecurityOrigin;
class WebString;
template <typename T> class WebVector;
@@ -64,12 +64,8 @@ public:
WEBKIT_EXPORT bool audio() const;
WEBKIT_EXPORT bool video() const;
- WEBKIT_EXPORT bool cameraPreferenceUser() const;
- WEBKIT_EXPORT bool cameraPreferenceEnvironment() const;
- WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const;
- // DEPRECATED
- WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>&);
+ WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const;
WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources);
WEBKIT_EXPORT void requestFailed();
diff --git a/Source/WebKit/chromium/public/WebVideoFrame.h b/Source/WebKit/chromium/public/WebVideoFrame.h
index 78790627d..948a7a444 100644
--- a/Source/WebKit/chromium/public/WebVideoFrame.h
+++ b/Source/WebKit/chromium/public/WebVideoFrame.h
@@ -1,69 +1,26 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebVideoFrame_h
-#define WebVideoFrame_h
-
-namespace WebKit {
-
-// A proxy video frame interface to communicate frame data between chromium
-// and WebKit.
-class WebVideoFrame {
-public:
- enum Format {
- FormatInvalid,
- FormatRGB555,
- FormatRGB565,
- FormatRGB24,
- FormatRGB32,
- FormatRGBA,
- FormatYV12,
- FormatYV16,
- FormatNV12,
- FormatEmpty,
- FormatASCII,
- FormatI420,
- FormatNativeTexture,
- };
-
- virtual ~WebVideoFrame() { }
- virtual Format format() const { return FormatInvalid; }
- virtual unsigned width() const { return 0; }
- virtual unsigned height() const { return 0; }
- virtual unsigned planes() const { return 0; }
- virtual int stride(unsigned plane) const { return 0; }
- virtual const void* data(unsigned plane) const { return 0; }
- virtual unsigned textureId() const { return 0; }
- virtual unsigned textureTarget() const { return 0; }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../Platform/chromium/public/WebVideoFrame.h"
diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h
index 50cf2eaa0..111ecc641 100644
--- a/Source/WebKit/chromium/public/WebView.h
+++ b/Source/WebKit/chromium/public/WebView.h
@@ -41,6 +41,7 @@ namespace WebKit {
class WebAccessibilityObject;
class WebAutofillClient;
+class WebBatteryStatus;
class WebDevToolsAgent;
class WebDevToolsAgentClient;
class WebDragData;
@@ -50,10 +51,14 @@ class WebGraphicsContext3D;
class WebNode;
class WebPageOverlay;
class WebPermissionClient;
+class WebPrerendererClient;
+class WebRange;
class WebSettings;
class WebSpellCheckClient;
class WebString;
+class WebTextFieldDecoratorClient;
class WebViewClient;
+struct WebActiveWheelFlingParameters;
struct WebMediaPlayerAction;
struct WebPluginAction;
struct WebPoint;
@@ -102,7 +107,11 @@ public:
virtual void setAutofillClient(WebAutofillClient*) = 0;
virtual void setDevToolsAgentClient(WebDevToolsAgentClient*) = 0;
virtual void setPermissionClient(WebPermissionClient*) = 0;
+ // FIXME: After the Prerendering API lands in chrome, remove this staging thunk
+ // for setPrerendererClient().
+ virtual void setPrerendererClient(WebPrerendererClient*) { }
virtual void setSpellCheckClient(WebSpellCheckClient*) = 0;
+ virtual void addTextFieldDecoratorClient(WebTextFieldDecoratorClient*) = 0;
// Options -------------------------------------------------------------
@@ -266,12 +275,6 @@ public:
// Turn off auto-resize.
virtual void disableAutoResizeMode() = 0;
- // DEPRECATED
- virtual void enableAutoResizeMode(
- bool enable,
- const WebSize& minSize,
- const WebSize& maxSize) = 0;
-
// Media ---------------------------------------------------------------
// Performs the specified media player action on the node at the given location.
@@ -352,19 +355,16 @@ public:
// Autofill -----------------------------------------------------------
// Notifies the WebView that Autofill suggestions are available for a node.
- // |uniqueIDs| is a vector of IDs that represent the unique ID of each
- // Autofill profile in the suggestions popup. If a unique ID is 0, then the
- // corresponding suggestion comes from Autocomplete rather than Autofill.
- // If a unique ID is negative, then the corresponding "suggestion" is
- // actually a user-facing warning, e.g. explaining why Autofill is
- // unavailable for the current form.
+ // |itemIDs| is a vector of IDs for the menu items. A positive itemID is a
+ // unique ID for the Autofill entries. Other MenuItemIDs are defined in
+ // WebAutofillClient.h
virtual void applyAutofillSuggestions(
const WebNode&,
const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
- int separatorIndex) = 0;
+ const WebVector<int>& itemIDs,
+ int separatorIndex = -1) = 0;
// Hides any popup (suggestions, selects...) that might be showing.
virtual void hidePopups() = 0;
@@ -434,6 +434,10 @@ public:
// Can be used for allocating resources that the compositor will later access.
virtual WebGraphicsContext3D* sharedGraphicsContext3D() = 0;
+ // Called to inform the WebView that a wheel fling animation was started externally (for instance
+ // by the compositor) but must be completed by the WebView.
+ virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&) = 0;
+
// Visibility -----------------------------------------------------------
// Sets the visibility of the WebView.
@@ -453,12 +457,18 @@ public:
virtual void addPageOverlay(WebPageOverlay*, int /*z-order*/) = 0;
virtual void removePageOverlay(WebPageOverlay*) = 0;
+ // Battery status API support -------------------------------------------
+
+ // Updates the battery status in the BatteryClient. This also triggers the
+ // appropriate JS events (e.g. sends a 'levelchange' event to JS if the
+ // level is changed in this update from the previous update).
+ virtual void updateBatteryStatus(const WebBatteryStatus&) { }
+
// Testing functionality for LayoutTestController -----------------------
// Simulates a compositor lost context.
virtual void loseCompositorContext(int numTimes) = 0;
-
protected:
~WebView() {}
};
diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h
index b2c0e5665..c4a5e40d2 100644
--- a/Source/WebKit/chromium/public/WebViewClient.h
+++ b/Source/WebKit/chromium/public/WebViewClient.h
@@ -48,6 +48,7 @@
namespace WebKit {
class WebAccessibilityObject;
+class WebBatteryStatusClient;
class WebColorChooser;
class WebColorChooserClient;
class WebDeviceOrientationClient;
@@ -68,6 +69,7 @@ class WebNotificationPresenter;
class WebRange;
class WebSpeechInputController;
class WebSpeechInputListener;
+class WebSpeechRecognizer;
class WebStorageNamespace;
class WebURL;
class WebURLRequest;
@@ -116,8 +118,6 @@ public:
// Creates a graphics context that renders to the client's WebView.
virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
- // Deprecated, use the first version of this function. If you want an offscreen context, use WebKitPlatformSupport::createOffscreenGraphicsContext3D().
- virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&, bool renderDirectlyToWebView) { return 0; }
// Misc ----------------------------------------------------------------
@@ -318,11 +318,18 @@ public:
virtual WebSpeechInputController* speechInputController(
WebSpeechInputListener*) { return 0; }
+ // Access the embedder API for speech recognition services.
+ virtual WebSpeechRecognizer* speechRecognizer() { return 0; }
+
// Device Orientation --------------------------------------------------
// Access the embedder API for device orientation services.
virtual WebDeviceOrientationClient* deviceOrientationClient() { return 0; }
+ // Battery Status ------------------------------------------------------
+
+ // Access the embedder API for battery status services.
+ virtual WebBatteryStatusClient* batteryStatusClient() { return 0; }
// Zoom ----------------------------------------------------------------
diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h
index e9712d743..fad319d78 100644
--- a/Source/WebKit/chromium/public/WebWidget.h
+++ b/Source/WebKit/chromium/public/WebWidget.h
@@ -40,6 +40,7 @@
#include "platform/WebSize.h"
#define WEBKIT_HAS_NEW_FULLSCREEN_API 1
+#define WEBWIDGET_HAS_SETCOMPOSITORSURFACEREADY 1
namespace WebKit {
@@ -79,10 +80,10 @@ public:
virtual void didExitFullScreen() { }
// Called to update imperative animation state. This should be called before
- // paint, although the client can rate-limit these calls. When
- // frameBeginTime is 0.0, the WebWidget will determine the frame begin time
- // itself.
- virtual void animate(double frameBeginTime) { }
+ // paint, although the client can rate-limit these calls.
+ //
+ // FIXME: remove this function entirely when inversion patches land.
+ virtual void animate(double ignored) { }
// Called to layout the WebWidget. This MUST be called before Paint,
// and it may result in calls to WebWidgetClient::didInvalidateRect.
@@ -107,11 +108,24 @@ public:
// animate or layout in this case.
virtual void composite(bool finish) = 0;
+ // Indicates that the compositing surface associated with this WebWidget is
+ // ready to use.
+ virtual void setCompositorSurfaceReady() = 0;
+
// Temporary method for the embedder to notify the WebWidget that the widget
// has taken damage, e.g. due to a window expose. This method will be
// removed when the WebWidget inversion patch lands --- http://crbug.com/112837
virtual void setNeedsRedraw() { }
+ // Temporary method for the embedder to check for throttled input. When this
+ // is true, the WebWidget is indicating that it would prefer to not receive
+ // additional input events until
+ // WebWidgetClient::didBecomeReadyForAdditionalInput is called.
+ //
+ // This method will be removed when the WebWidget inversion patch lands ---
+ // http://crbug.com/112837
+ virtual bool isInputThrottled() const { return false; }
+
// Called to inform the WebWidget of a change in theme.
// Implementors that cache rendered copies of widgets need to re-render
// on receiving this message
@@ -195,6 +209,9 @@ public:
// Instrumentation method that marks beginning of frame update that includes
// things like animate()/layout()/paint()/composite().
virtual void instrumentBeginFrame() { }
+ // Cancels the effect of instrumentBeginFrame() in case there were no events
+ // following the call to instrumentBeginFrame().
+ virtual void instrumentCancelFrame() { }
protected:
~WebWidget() { }
diff --git a/Source/WebKit/chromium/public/WebWidgetClient.h b/Source/WebKit/chromium/public/WebWidgetClient.h
index 24cd9c6ac..92dfb3671 100644
--- a/Source/WebKit/chromium/public/WebWidgetClient.h
+++ b/Source/WebKit/chromium/public/WebWidgetClient.h
@@ -56,14 +56,23 @@ public:
virtual void didAutoResize(const WebSize& newSize) { }
// Called when the compositor is enabled or disabled.
- // The WebCompositor identifier can be used on the compositor thread to get access
- // to the WebCompositor instance associated with this WebWidget.
- // If there is no WebCompositor associated with this WebWidget (for example if
- // threaded compositing is not enabled) then calling WebCompositor::fromIdentifier()
+ // The inputHandlerIdentifier can be used on the compositor thread to get access
+ // to the WebCompositorInputHandler instance associated with this WebWidget.
+ // If there is no WebCompositorInputHandler associated with this WebWidget (for example if
+ // threaded compositing is not enabled) then calling WebCompositorInputHandler::fromIdentifier()
// for the specified identifier will return 0.
- virtual void didActivateCompositor(int compositorIdentifier) { }
+ virtual void didActivateCompositor(int inputHandlerIdentifier) { }
virtual void didDeactivateCompositor() { }
+ // Indicates to the embedder that the compositor is about to begin a
+ // frame. This is primarily to signal to flow control mechanisms that a
+ // frame is beginning, not to perform actual painting work.
+ virtual void willBeginCompositorFrame() { }
+
+ // Indicates to the embedder that the WebWidget is ready for additional
+ // input.
+ virtual void didBecomeReadyForAdditionalInput() { }
+
// Called for compositing mode when the draw commands for a WebKit-side
// frame have been issued.
virtual void didCommitAndDrawCompositorFrame() { }
diff --git a/Source/WebKit/chromium/public/android/WebInputEventFactory.h b/Source/WebKit/chromium/public/android/WebInputEventFactory.h
index d49be4187..fb52787a7 100644
--- a/Source/WebKit/chromium/public/android/WebInputEventFactory.h
+++ b/Source/WebKit/chromium/public/android/WebInputEventFactory.h
@@ -59,6 +59,8 @@ public:
int windowY,
MouseEventType,
double timeStampSeconds,
+ int modifiers,
+ int clickCount,
WebMouseEvent::Button = WebMouseEvent::ButtonLeft);
};
diff --git a/Source/WebKit/chromium/public/platform/WebArrayBufferView.h b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h
index 8f2356930..bcdb4b515 100644
--- a/Source/WebKit/chromium/public/platform/WebArrayBufferView.h
+++ b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h
@@ -32,6 +32,13 @@
#include "WebCommon.h"
#include "WebPrivatePtr.h"
+#if WEBKIT_USING_V8
+namespace v8 {
+class Value;
+template <class T> class Handle;
+}
+#endif
+
namespace WTF { class ArrayBufferView; }
namespace WebKit {
@@ -50,6 +57,10 @@ public:
WEBKIT_EXPORT void assign(const WebArrayBufferView&);
WEBKIT_EXPORT void reset();
+#if WEBKIT_USING_V8
+ WEBKIT_EXPORT static WebArrayBufferView* createFromV8Value(v8::Handle<v8::Value>);
+#endif
+
#if WEBKIT_IMPLEMENTATION
WebArrayBufferView(const WTF::PassRefPtr<WTF::ArrayBufferView>&);
WebArrayBufferView& operator=(const WTF::PassRefPtr<WTF::ArrayBufferView>&);
diff --git a/Source/WebKit/chromium/public/platform/WebAudioBus.h b/Source/WebKit/chromium/public/platform/WebAudioBus.h
index 750ae79e2..a01117bce 100644
--- a/Source/WebKit/chromium/public/platform/WebAudioBus.h
+++ b/Source/WebKit/chromium/public/platform/WebAudioBus.h
@@ -1,75 +1,26 @@
/*
- * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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.
+ * 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
+ * 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 INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * 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.
+ * 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 WebAudioBus_h
-#define WebAudioBus_h
-
-#include "WebCommon.h"
-
-namespace WebCore { class AudioBus; }
-
-#if WEBKIT_IMPLEMENTATION
-namespace WTF { template <typename T> class PassOwnPtr; }
-#endif
-
-namespace WebKit {
-
-class WebAudioBusPrivate;
-
-// A container for multi-channel linear PCM audio data.
-//
-// WARNING: It is not safe to pass a WebAudioBus across threads!!!
-//
-class WebAudioBus {
-public:
- WebAudioBus() : m_private(0) { }
- ~WebAudioBus() { reset(); }
-
- // initialize() allocates memory of the given length for the given number of channels.
- WEBKIT_EXPORT void initialize(unsigned numberOfChannels, size_t length, double sampleRate);
-
- // reset() releases the memory allocated from initialize().
- WEBKIT_EXPORT void reset();
-
- WEBKIT_EXPORT unsigned numberOfChannels() const;
- WEBKIT_EXPORT size_t length() const;
- WEBKIT_EXPORT double sampleRate() const;
-
- WEBKIT_EXPORT float* channelData(unsigned channelIndex);
-
-#if WEBKIT_IMPLEMENTATION
- WTF::PassOwnPtr<WebCore::AudioBus> release();
-#endif
-
-private:
- // Disallow copy and assign.
- WebAudioBus(const WebAudioBus&);
- void operator=(const WebAudioBus&);
-
- WebCore::AudioBus* m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebAudioBus_h
+#include "../../../../Platform/chromium/public/WebAudioBus.h"
diff --git a/Source/WebKit/chromium/public/platform/WebAudioDevice.h b/Source/WebKit/chromium/public/platform/WebAudioDevice.h
index 00aea975f..67ea5ffbe 100644
--- a/Source/WebKit/chromium/public/platform/WebAudioDevice.h
+++ b/Source/WebKit/chromium/public/platform/WebAudioDevice.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,9 +10,6 @@
* 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -26,31 +23,4 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebAudioDevice_h
-#define WebAudioDevice_h
-
-#include "WebVector.h"
-
-namespace WebKit {
-
-// Abstract interface to the Chromium audio system.
-
-class WebAudioDevice {
-public:
- class RenderCallback {
- public:
- virtual void render(const WebVector<float*>& audioData, size_t numberOfFrames) = 0;
- protected:
- virtual ~RenderCallback() { }
- };
-
- virtual ~WebAudioDevice() { }
-
- virtual void start() = 0;
- virtual void stop() = 0;
- virtual double sampleRate() = 0;
-};
-
-} // namespace WebKit
-
-#endif // WebAudioDevice_h
+#include "../../../../Platform/chromium/public/WebAudioDevice.h"
diff --git a/Source/WebKit/chromium/public/platform/WebData.h b/Source/WebKit/chromium/public/platform/WebData.h
index 17d3f388c..cec0c63bd 100644
--- a/Source/WebKit/chromium/public/platform/WebData.h
+++ b/Source/WebKit/chromium/public/platform/WebData.h
@@ -1,110 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebData_h
-#define WebData_h
-
-#include "WebCommon.h"
-
-#if WEBKIT_IMPLEMENTATION
-namespace WebCore { class SharedBuffer; }
-namespace WTF { template <typename T> class PassRefPtr; }
-#endif
-
-namespace WebKit {
-
-class WebDataPrivate;
-
-// A container for raw bytes. It is inexpensive to copy a WebData object.
-//
-// WARNING: It is not safe to pass a WebData across threads!!!
-//
-class WebData {
-public:
- ~WebData() { reset(); }
-
- WebData() : m_private(0) { }
-
- WebData(const char* data, size_t size) : m_private(0)
- {
- assign(data, size);
- }
-
- template <int N>
- WebData(const char (&data)[N]) : m_private(0)
- {
- assign(data, N - 1);
- }
-
- WebData(const WebData& d) : m_private(0) { assign(d); }
-
- WebData& operator=(const WebData& d)
- {
- assign(d);
- return *this;
- }
-
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebData&);
- WEBKIT_EXPORT void assign(const char* data, size_t size);
-
- WEBKIT_EXPORT size_t size() const;
- WEBKIT_EXPORT const char* data() const;
-
- bool isEmpty() const { return !size(); }
- bool isNull() const { return !m_private; }
-
-#if WEBKIT_IMPLEMENTATION
- WebData(const WTF::PassRefPtr<WebCore::SharedBuffer>&);
- WebData& operator=(const WTF::PassRefPtr<WebCore::SharedBuffer>&);
- operator WTF::PassRefPtr<WebCore::SharedBuffer>() const;
-#else
- template <class C>
- WebData(const C& c) : m_private(0)
- {
- assign(c.data(), c.size());
- }
-
- template <class C>
- WebData& operator=(const C& c)
- {
- assign(c.data(), c.size());
- return *this;
- }
-#endif
-
-private:
- void assign(WebDataPrivate*);
- WebDataPrivate* m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebData.h"
diff --git a/Source/WebKit/chromium/public/platform/WebDragData.h b/Source/WebKit/chromium/public/platform/WebDragData.h
index a6c82aee1..9666fe4b1 100644
--- a/Source/WebKit/chromium/public/platform/WebDragData.h
+++ b/Source/WebKit/chromium/public/platform/WebDragData.h
@@ -70,6 +70,7 @@ public:
// Only valid when storageType == StorageTypeFilename.
WebString filenameData;
+ WebString displayNameData;
// Only valid when storageType == StorageTypeBinaryData.
WebData binaryData;
@@ -102,6 +103,9 @@ public:
WEBKIT_EXPORT void setItems(const WebVector<Item>&);
WEBKIT_EXPORT void addItem(const Item&);
+ WEBKIT_EXPORT WebString filesystemId() const;
+ WEBKIT_EXPORT void setFilesystemId(const WebString&);
+
#if WEBKIT_IMPLEMENTATION
WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h
index 2562ef1c3..25afb49f0 100644
--- a/Source/WebKit/chromium/public/platform/WebFileSystem.h
+++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h
@@ -46,6 +46,11 @@ public:
enum Type {
TypeTemporary,
TypePersistent,
+
+ // Indicates an isolated filesystem which only exposes a set of files.
+ TypeIsolated,
+
+ // Indicates a non-sandboxed filesystem.
TypeExternal,
};
diff --git a/Source/WebKit/chromium/public/platform/WebGamepad.h b/Source/WebKit/chromium/public/platform/WebGamepad.h
index 788e78ba4..93d08f3c7 100644
--- a/Source/WebKit/chromium/public/platform/WebGamepad.h
+++ b/Source/WebKit/chromium/public/platform/WebGamepad.h
@@ -1,86 +1,26 @@
-// 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 WebGamepad_h
-#define WebGamepad_h
-
-#include "WebCommon.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Assertions.h>
-#endif
-
-namespace WebKit {
-
-#pragma pack(push, 1)
-
-// This structure is intentionally POD and fixed size so that it can be shared
-// memory between hardware polling threads and the rest of the browser. See
-// also WebGamepads.h.
-class WebGamepad {
-public:
- static const size_t idLengthCap = 128;
- static const size_t axesLengthCap = 16;
- static const size_t buttonsLengthCap = 32;
-
- WebGamepad()
- : connected(false)
- , timestamp(0)
- , axesLength(0)
- , buttonsLength(0)
- {
- id[0] = 0;
- }
-
- // Is there a gamepad connected at this index?
- bool connected;
-
- // Device identifier (based on manufacturer, model, etc.).
- WebUChar id[idLengthCap];
-
- // Monotonically increasing value referring to when the data were last
- // updated.
- unsigned long long timestamp;
-
- // Number of valid entries in the axes array.
- unsigned axesLength;
-
- // Normalized values representing axes, in the range [-1..1].
- float axes[axesLengthCap];
-
- // Number of valid entries in the buttons array.
- unsigned buttonsLength;
-
- // Normalized values representing buttons, in the range [0..1].
- float buttons[buttonsLengthCap];
-};
-
-#if WEBKIT_IMPLEMENTATION
-COMPILE_ASSERT(sizeof(WebGamepad) == 465, WebGamepad_has_wrong_size);
-#endif
-
-#pragma pack(pop)
-
-}
-
-#endif // WebGamepad_h
+/*
+ * 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 "../../../../Platform/chromium/public/WebGamepad.h"
diff --git a/Source/WebKit/chromium/public/platform/WebGamepads.h b/Source/WebKit/chromium/public/platform/WebGamepads.h
index 50e2ab208..b69539029 100644
--- a/Source/WebKit/chromium/public/platform/WebGamepads.h
+++ b/Source/WebKit/chromium/public/platform/WebGamepads.h
@@ -1,62 +1,26 @@
-// 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 WebGamepads_h
-#define WebGamepads_h
-
-#include "WebGamepad.h"
-
-#if WEBKIT_IMPLEMENTATION
-#include <wtf/Assertions.h>
-#endif
-
-namespace WebKit {
-
-#pragma pack(push, 1)
-
-// This structure is intentionally POD and fixed size so that it can be stored
-// in shared memory between hardware polling threads and the rest of the
-// browser.
-class WebGamepads {
-public:
- WebGamepads()
- : length(0) { }
-
- static const size_t itemsLengthCap = 4;
-
- // Number of valid entries in the items array.
- unsigned length;
-
- // Gamepad data for N separate gamepad devices.
- WebGamepad items[itemsLengthCap];
-};
-
-#if WEBKIT_IMPLEMENTATION
-COMPILE_ASSERT(sizeof(WebGamepads) == 1864, WebGamepads_has_wrong_size);
-#endif
-
-#pragma pack(pop)
-
-}
-
-#endif // WebGamepads_h
+/*
+ * 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 "../../../../Platform/chromium/public/WebGamepads.h"
diff --git a/Source/WebKit/chromium/public/platform/WebHTTPBody.h b/Source/WebKit/chromium/public/platform/WebHTTPBody.h
index e97856320..44754e936 100644
--- a/Source/WebKit/chromium/public/platform/WebHTTPBody.h
+++ b/Source/WebKit/chromium/public/platform/WebHTTPBody.h
@@ -1,109 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebHTTPBody_h
-#define WebHTTPBody_h
-
-#include "WebData.h"
-#include "WebNonCopyable.h"
-#include "WebString.h"
-#include "WebURL.h"
-
-#if WEBKIT_IMPLEMENTATION
-namespace WebCore { class FormData; }
-namespace WTF { template <typename T> class PassRefPtr; }
-#endif
-
-namespace WebKit {
-
-class WebHTTPBodyPrivate;
-
-class WebHTTPBody {
-public:
- struct Element {
- enum Type { TypeData, TypeFile, TypeBlob } type;
- WebData data;
- WebString filePath;
- long long fileStart;
- long long fileLength; // -1 means to the end of the file.
- double modificationTime;
- WebURL blobURL;
- };
-
- ~WebHTTPBody() { reset(); }
-
- WebHTTPBody() : m_private(0) { }
- WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); }
- WebHTTPBody& operator=(const WebHTTPBody& b)
- {
- assign(b);
- return *this;
- }
-
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebHTTPBody&);
-
- bool isNull() const { return !m_private; }
-
- // Returns the number of elements comprising the http body.
- WEBKIT_EXPORT size_t elementCount() const;
-
- // Sets the values of the element at the given index. Returns false if
- // index is out of bounds.
- WEBKIT_EXPORT bool elementAt(size_t index, Element&) const;
-
- // Append to the list of elements.
- WEBKIT_EXPORT void appendData(const WebData&);
- WEBKIT_EXPORT void appendFile(const WebString&);
- // Passing -1 to fileLength means to the end of the file.
- WEBKIT_EXPORT void appendFileRange(const WebString&, long long fileStart, long long fileLength, double modificationTime);
- WEBKIT_EXPORT void appendBlob(const WebURL&);
-
- // Identifies a particular form submission instance. A value of 0 is
- // used to indicate an unspecified identifier.
- WEBKIT_EXPORT long long identifier() const;
- WEBKIT_EXPORT void setIdentifier(long long);
-
-#if WEBKIT_IMPLEMENTATION
- WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&);
- WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&);
- operator WTF::PassRefPtr<WebCore::FormData>() const;
-#endif
-
-private:
- void assign(WebHTTPBodyPrivate*);
- void ensureMutable();
- WebHTTPBodyPrivate* m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebHTTPBody.h"
diff --git a/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h
index 2ca86c01c..d244c9543 100644
--- a/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h
+++ b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h
@@ -1,48 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebHTTPHeaderVisitor_h
-#define WebHTTPHeaderVisitor_h
-
-namespace WebKit {
-
-class WebString;
-
-class WebHTTPHeaderVisitor {
-public:
- virtual void visitHeader(const WebString& name, const WebString& value) = 0;
-
-protected:
- ~WebHTTPHeaderVisitor() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebHTTPHeaderVisitor.h"
diff --git a/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h
index 09bf16992..3e3cb3608 100644
--- a/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h
+++ b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h
@@ -1,88 +1,26 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebHTTPLoadInfo_h
-#define WebHTTPLoadInfo_h
-
-#include "WebCommon.h"
-#include "WebPrivatePtr.h"
-
-namespace WebCore {
-struct ResourceLoadInfo;
-}
-
-namespace WebKit {
-class WebString;
-
-class WebHTTPLoadInfo {
-public:
- WebHTTPLoadInfo() { initialize(); }
- ~WebHTTPLoadInfo() { reset(); }
- WebHTTPLoadInfo(const WebHTTPLoadInfo& r) { assign(r); }
- WebHTTPLoadInfo& operator =(const WebHTTPLoadInfo& r)
- {
- assign(r);
- return *this;
- }
-
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebHTTPLoadInfo& r);
-
- WEBKIT_EXPORT int httpStatusCode() const;
- WEBKIT_EXPORT void setHTTPStatusCode(int);
-
- WEBKIT_EXPORT WebString httpStatusText() const;
- WEBKIT_EXPORT void setHTTPStatusText(const WebString&);
-
- WEBKIT_EXPORT long long encodedDataLength() const;
- WEBKIT_EXPORT void setEncodedDataLength(long long);
-
- WEBKIT_EXPORT void addRequestHeader(const WebString& name, const WebString& value);
- WEBKIT_EXPORT void addResponseHeader(const WebString& name, const WebString& value);
-
- WEBKIT_EXPORT WebString requestHeadersText() const;
- WEBKIT_EXPORT void setRequestHeadersText(const WebString&);
-
- WEBKIT_EXPORT WebString responseHeadersText() const;
- WEBKIT_EXPORT void setResponseHeadersText(const WebString&);
-
-#if WEBKIT_IMPLEMENTATION
- WebHTTPLoadInfo(WTF::PassRefPtr<WebCore::ResourceLoadInfo>);
- operator WTF::PassRefPtr<WebCore::ResourceLoadInfo>() const;
-#endif
-
-private:
- WebPrivatePtr<WebCore::ResourceLoadInfo> m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebHTTPLoadInfo.h"
diff --git a/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h b/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h
new file mode 100644
index 000000000..56ea93146
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebICECandidateDescriptor.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebICECandidateDescriptor.h"
diff --git a/Source/WebKit/chromium/public/platform/WebICEOptions.h b/Source/WebKit/chromium/public/platform/WebICEOptions.h
new file mode 100644
index 000000000..0f2e46000
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebICEOptions.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebICEOptions.h"
diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
index d2c1fd814..ca3762dcb 100644
--- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
+++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
@@ -31,19 +31,16 @@
#ifndef WebKitPlatformSupport_h
#define WebKitPlatformSupport_h
-#include "WebAudioBus.h"
-#include "WebAudioDevice.h"
+#include "../WebIDBKeyPath.h" // FIXME: Remove with: http://webkit.org/b/84207
#include "WebCommon.h"
-#include "WebData.h"
-#include "WebGamepads.h"
#include "WebGraphicsContext3D.h"
#include "WebLocalizedString.h"
#include "WebSerializedScriptValue.h"
#include "WebString.h"
#include "WebURL.h"
#include "WebVector.h"
-
#include <time.h>
+#include "../../../../Platform/chromium/public/Platform.h"
#ifdef WIN32
typedef void *HANDLE;
@@ -60,31 +57,21 @@ class WebFileSystem;
class WebFileUtilities;
class WebIDBFactory; // FIXME: Does this belong in platform?
class WebIDBKey; // FIXME: Does this belong in platform?
-class WebMediaStreamCenter;
-class WebMediaStreamCenterClient;
class WebMessagePortChannel; // FIXME: Does this belong in platform?
-class WebMimeRegistry;
-class WebPeerConnectionHandler;
-class WebPeerConnectionHandlerClient;
class WebPluginListBuilder; // FIXME: Does this belong in platform?
class WebSandboxSupport;
class WebSharedWorkerRepository; // FIXME: Does this belong in platform?
-class WebSocketStreamHandle;
class WebStorageNamespace; // FIXME: Does this belong in platform?
class WebThemeEngine;
-class WebThread;
-class WebURLLoader;
class WebWorkerRunLoop;
-class WebKitPlatformSupport {
+// FIXME: Eventually all these API will need to move to WebKit::Platform.
+class WebKitPlatformSupport : public Platform {
public:
// Must return non-null.
virtual WebClipboard* clipboard() { return 0; }
// Must return non-null.
- virtual WebMimeRegistry* mimeRegistry() { return 0; }
-
- // Must return non-null.
virtual WebFileUtilities* fileUtilities() { return 0; }
// May return null if sandbox support is not necessary
@@ -106,29 +93,12 @@ public:
// Return a LocalStorage namespace that corresponds to the following path.
virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; }
- // Called when storage events fire.
+ // DEPRECATED
virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
const WebString& newValue, const WebString& origin,
const WebURL& url, bool isLocalStorage) { }
- // Gamepad -------------------------------------------------------------
-
- virtual void sampleGamepads(WebGamepads& into) { into.length = 0; }
-
-
- // History -------------------------------------------------------------
-
- // Returns the hash for the given canonicalized URL for use in visited
- // link coloring.
- virtual unsigned long long visitedLinkHash(
- const char* canonicalURL, size_t length) { return 0; }
-
- // Returns whether the given link hash is in the user's history. The
- // hash must have been generated by calling VisitedLinkHash().
- virtual bool isLinkVisited(unsigned long long linkHash) { return false; }
-
-
// HTML5 Database ------------------------------------------------------
#ifdef WIN32
@@ -157,49 +127,14 @@ public:
// Indexed Database ----------------------------------------------------
virtual WebIDBFactory* idbFactory() { return 0; }
- virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebString& keyPath, WebVector<WebIDBKey>& keys) { }
- virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebString& keyPath) { return WebSerializedScriptValue(); }
-
-
- // Keygen --------------------------------------------------------------
-
- // Handle the <keygen> tag for generating client certificates
- // Returns a base64 encoded signed copy of a public key from a newly
- // generated key pair and the supplied challenge string. keySizeindex
- // specifies the strength of the key.
- virtual WebString signedPublicKeyAndChallengeString(unsigned keySizeIndex,
- const WebKit::WebString& challenge,
- const WebKit::WebURL& url) { return WebString(); }
-
-
-
- // Memory --------------------------------------------------------------
-
- // Returns the current space allocated for the pagefile, in MB.
- // That is committed size for Windows and virtual memory size for POSIX
- virtual size_t memoryUsageMB() { return 0; }
-
- // Same as above, but always returns actual value, without any caches.
- virtual size_t actualMemoryUsageMB() { return 0; }
-
- // If memory usage is below this threshold, do not bother forcing GC.
- virtual size_t lowMemoryUsageMB() { return 256; }
-
- // If memory usage is above this threshold, force GC more aggressively.
- virtual size_t highMemoryUsageMB() { return 1024; }
-
- // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high.
- virtual size_t highUsageDeltaMB() { return 128; }
-
-
- // Threads -------------------------------------------------------
-
- // Creates an embedder-defined thread.
- virtual WebThread* createThread(const char* name) { return 0; }
-
- // Returns an interface to the current thread. This is owned by the
- // embedder.
- virtual WebThread* currentThread() { return 0; }
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
+ virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebString& keyPath, WebVector<WebIDBKey>& keys) { createIDBKeysFromSerializedValuesAndKeyPath(values, WebIDBKeyPath(keyPath), keys); }
+ virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebIDBKeyPath& keyPath, WebVector<WebIDBKey>& keys) { }
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
+ virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebString& keyPath) { return injectIDBKeyIntoSerializedValue(key, value, WebIDBKeyPath(keyPath)); }
+ virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& keyPath) { return WebSerializedScriptValue(); }
// Message Ports -------------------------------------------------------
@@ -209,24 +144,6 @@ public:
virtual WebMessagePortChannel* createMessagePortChannel() { return 0; }
- // Network -------------------------------------------------------------
-
- // A suggestion to prefetch IP information for the given hostname.
- virtual void prefetchHostName(const WebString&) { }
-
- // Returns a new WebURLLoader instance.
- virtual WebURLLoader* createURLLoader() { return 0; }
-
- // Returns a new WebSocketStreamHandle instance.
- virtual WebSocketStreamHandle* createSocketStreamHandle() { return 0; }
-
- // Returns the User-Agent string that should be used for the given URL.
- virtual WebString userAgent(const WebURL&) { return WebString(); }
-
- // A suggestion to cache this metadata in association with this URL.
- virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { }
-
-
// Plugins -------------------------------------------------------------
// If refresh is true, then cached information should not be used to
@@ -234,174 +151,38 @@ public:
virtual void getPluginList(bool refresh, WebPluginListBuilder*) { }
- // Profiling -----------------------------------------------------------
-
- virtual void decrementStatsCounter(const char* name) { }
- virtual void incrementStatsCounter(const char* name) { }
-
- // Tracing -------------------------------------------------------------
-
- // Get a pointer to the enabled state of the given trace category. The
- // embedder can dynamically change the enabled state as trace event
- // recording is started and stopped by the application. Only long-lived
- // literal strings should be given as the category name. The implementation
- // expects the returned pointer to be held permanently in a local static. If
- // the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
- // addTraceEvent is expected to be called by the trace event macros.
- virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return 0; }
- // Add a trace event to the platform tracing system. Depending on the actual
- // enabled state, this event may be recorded or dropped. Returns
- // thresholdBeginId for use in a corresponding end addTraceEvent call.
- // - phase specifies the type of event:
- // - BEGIN ('B'): Marks the beginning of a scoped event.
- // - END ('E'): Marks the end of a scoped event.
- // - INSTANT ('I'): Standalone, instantaneous event.
- // - START ('S'): Marks the beginning of an asynchronous event (the end
- // event can occur in a different scope or thread). The id parameter is
- // used to match START/FINISH pairs.
- // - FINISH ('F'): Marks the end of an asynchronous event.
- // - COUNTER ('C'): Used to trace integer quantities that change over
- // time. The argument values are expected to be of type int.
- // - METADATA ('M'): Reserved for internal use.
- // - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
- // - name is the name of the event. Also used to match BEGIN/END and
- // START/FINISH pairs.
- // - id optionally allows events of the same name to be distinguished from
- // each other. For example, to trace the consutruction and destruction of
- // objects, specify the pointer as the id parameter.
- // - numArgs specifies the number of elements in argNames, argTypes, and
- // argValues.
- // - argNames is the array of argument names. Use long-lived literal strings
- // or specify the COPY flag.
- // - argTypes is the array of argument types:
- // - BOOL (1): bool
- // - UINT (2): unsigned long long
- // - INT (3): long long
- // - DOUBLE (4): double
- // - POINTER (5): void*
- // - STRING (6): char* (long-lived null-terminated char* string)
- // - COPY_STRING (7): char* (temporary null-terminated char* string)
- // - argValues is the array of argument values. Each value is the unsigned
- // long long member of a union of all supported types.
- // - thresholdBeginId optionally specifies the value returned by a previous
- // call to addTraceEvent with a BEGIN phase.
- // - threshold is used on an END phase event in conjunction with the
- // thresholdBeginId of a prior BEGIN event. The threshold is the minimum
- // number of microseconds that must have passed since the BEGIN event. If
- // less than threshold microseconds has passed, the BEGIN/END pair is
- // dropped.
- // - flags can be 0 or one or more of the following, ORed together:
- // - COPY (0x1): treat all strings (name, argNames and argValues of type
- // string) as temporary so that they will be copied by addTraceEvent.
- // - HAS_ID (0x2): use the id argument to uniquely identify the event for
- // matching with other events of the same name.
- // - MANGLE_ID (0x4): specify this flag if the id parameter is the value
- // of a pointer.
- virtual int addTraceEvent(
- char phase,
- const unsigned char* categoryEnabledFlag,
- const char* name,
- unsigned long long id,
- int numArgs,
- const char** argNames,
- const unsigned char* argTypes,
- const unsigned long long* argValues,
- int thresholdBeginId,
- long long threshold,
- unsigned char flags) { return -1; }
-
- // Callbacks for reporting histogram data.
- // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
- virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { }
- // Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value.
- virtual void histogramEnumeration(const char* name, int sample, int boundaryValue) { }
-
-
// Resources -----------------------------------------------------------
- // Returns a blob of data corresponding to the named resource.
- virtual WebData loadResource(const char* name) { return WebData(); }
-
- // Decodes the in-memory audio file data and returns the linear PCM audio data in the destinationBus.
- // A sample-rate conversion to sampleRate will occur if the file data is at a different sample-rate.
- // Returns true on success.
- virtual bool loadAudioResource(WebAudioBus* destinationBus, const char* audioFileData, size_t dataSize, double sampleRate) { return false; }
-
// Returns a localized string resource (with substitution parameters).
virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); }
virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter) { return WebString(); }
virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter1, const WebString& parameter2) { return WebString(); }
- // Sandbox ------------------------------------------------------------
-
- // In some browsers, a "sandbox" restricts what operations a program
- // is allowed to preform. Such operations are typically abstracted out
- // via this API, but sometimes (like in HTML 5 database opening) WebKit
- // needs to behave differently based on whether it's restricted or not.
- // In these cases (and these cases only) you can call this function.
- // It's OK for this value to be conservitive (i.e. true even if the
- // sandbox isn't active).
- virtual bool sandboxEnabled() { return false; }
-
-
// Shared Workers ------------------------------------------------------
virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; }
- // Sudden Termination --------------------------------------------------
-
- // Disable/Enable sudden termination.
- virtual void suddenTerminationChanged(bool enabled) { }
-
-
- // System --------------------------------------------------------------
-
- // Returns a value such as "en-US".
- virtual WebString defaultLocale() { return WebString(); }
-
- // Wall clock time in seconds since the epoch.
- virtual double currentTime() { return 0; }
-
- // Monotonically increasing time in seconds from an arbitrary fixed point in the past.
- // This function is expected to return at least millisecond-precision values. For this reason,
- // it is recommended that the fixed point be no further in the past than the epoch.
- virtual double monotonicallyIncreasingTime() { return 0; }
-
- // WebKit clients must implement this funcion if they use cryptographic randomness.
- virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0;
-
- // Delayed work is driven by a shared timer.
- typedef void (*SharedTimerFunction)();
- virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) { }
- virtual void setSharedTimerFireInterval(double) { }
- virtual void stopSharedTimer() { }
-
- // Callable from a background WebKit thread.
- virtual void callOnMainThread(void (*func)(void*), void* context) { }
-
// GPU ----------------------------------------------------------------
//
// May return null if GPU is not supported.
// Returns newly allocated and initialized offscreen WebGraphicsContext3D instance.
virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
- // Audio --------------------------------------------------------------
+ // Returns true if the platform is capable of producing an offscreen context suitable for accelerating 2d canvas.
+ // This will return false if the platform cannot promise that contexts will be preserved across operations like
+ // locking the screen or if the platform cannot provide a context with suitable performance characteristics.
+ //
+ // This value must be checked again after a context loss event as the platform's capabilities may have changed.
+ virtual bool canAccelerate2dCanvas() { return false; }
- virtual double audioHardwareSampleRate() { return 0; }
- virtual size_t audioHardwareBufferSize() { return 0; }
- virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; }
// FileSystem ----------------------------------------------------------
// Must return non-null.
virtual WebFileSystem* fileSystem() { return 0; }
- // WebRTC ----------------------------------------------------------
-
- // May return null if WebRTC functionality is not avaliable or out of resources.
- virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; }
- virtual WebMediaStreamCenter* createMediaStreamCenter(WebMediaStreamCenterClient*) { return 0; }
+ // WebWorker ----------------------------------------------------------
virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { }
virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { }
diff --git a/Source/WebKit/chromium/public/platform/WebLocalizedString.h b/Source/WebKit/chromium/public/platform/WebLocalizedString.h
index 0483df90b..5e7748ec6 100644
--- a/Source/WebKit/chromium/public/platform/WebLocalizedString.h
+++ b/Source/WebKit/chromium/public/platform/WebLocalizedString.h
@@ -35,46 +35,52 @@ namespace WebKit {
struct WebLocalizedString {
enum Name {
+ AXButtonActionVerb,
+ AXCheckedCheckBoxActionVerb,
+ AXHeadingText,
+ AXImageMapText,
+ AXLinkActionVerb,
+ AXLinkText,
+ AXListMarkerText,
+ AXRadioButtonActionVerb,
+ AXTextFieldActionVerb,
+ AXUncheckedCheckBoxActionVerb,
+ AXWebAreaText,
+ CalendarClear,
+ CalendarToday,
+ DateFormatDayInMonthLabel,
+ DateFormatMonthLabel,
+ DateFormatYearLabel,
DetailsLabel,
- SubmitButtonDefaultLabel,
- InputElementAltText,
- ResetButtonDefaultLabel,
FileButtonChooseFileLabel,
FileButtonChooseMultipleFilesLabel,
FileButtonNoFileSelectedLabel,
+ InputElementAltText,
+ KeygenMenuHighGradeKeySize,
+ KeygenMenuMediumGradeKeySize,
+ MissingPluginText,
MultipleFileUploadText,
+ ResetButtonDefaultLabel,
SearchableIndexIntroduction,
+ SearchMenuClearRecentSearchesText,
SearchMenuNoRecentSearchesText,
SearchMenuRecentSearchesText,
- SearchMenuClearRecentSearchesText,
- AXWebAreaText,
- AXLinkText,
- AXListMarkerText,
- AXImageMapText,
- AXHeadingText,
- AXButtonActionVerb,
- AXRadioButtonActionVerb,
- AXTextFieldActionVerb,
- AXCheckedCheckBoxActionVerb,
- AXUncheckedCheckBoxActionVerb,
- AXLinkActionVerb,
- KeygenMenuHighGradeKeySize,
- KeygenMenuMediumGradeKeySize,
+ SubmitButtonDefaultLabel,
+ ValidationPatternMismatch,
+ ValidationRangeOverflow,
+ ValidationRangeUnderflow,
+ ValidationStepMismatch,
+ ValidationTooLong,
+ ValidationTypeMismatch,
+ ValidationTypeMismatchForEmail,
+ ValidationTypeMismatchForMultipleEmail,
+ ValidationTypeMismatchForURL,
ValidationValueMissing,
ValidationValueMissingForCheckbox,
ValidationValueMissingForFile,
ValidationValueMissingForMultipleFile,
ValidationValueMissingForRadio,
ValidationValueMissingForSelect,
- ValidationTypeMismatch,
- ValidationTypeMismatchForEmail,
- ValidationTypeMismatchForMultipleEmail,
- ValidationTypeMismatchForURL,
- ValidationPatternMismatch,
- ValidationTooLong,
- ValidationRangeUnderflow,
- ValidationRangeOverflow,
- ValidationStepMismatch,
};
};
diff --git a/Source/WebKit/chromium/public/platform/WebMediaHints.h b/Source/WebKit/chromium/public/platform/WebMediaHints.h
new file mode 100644
index 000000000..b27836db5
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebMediaHints.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebMediaHints.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h
index 8381a9a4c..80f607ce4 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h
@@ -2,53 +2,25 @@
* 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:
+ * 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.
+ * 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 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.
+ * 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 WebMediaStreamCenter_h
-#define WebMediaStreamCenter_h
-
-namespace WebKit {
-
-class WebMediaStreamComponent;
-class WebMediaStreamDescriptor;
-class WebMediaStreamSourcesRequest;
-
-class WebMediaStreamCenter {
-public:
- virtual ~WebMediaStreamCenter() { }
-
- virtual void queryMediaStreamSources(const WebMediaStreamSourcesRequest&) = 0;
- virtual void didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
- virtual void didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
- virtual void didStopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
- virtual void didConstructMediaStream(const WebMediaStreamDescriptor&) = 0;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamCenter_h
-
+#include "../../../../Platform/chromium/public/WebMediaStreamCenter.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h
index 8a0825f90..9c133c0fd 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h
@@ -2,46 +2,25 @@
* 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:
+ * 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.
+ * 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 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.
+ * 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 WebMediaStreamCenterClient_h
-#define WebMediaStreamCenterClient_h
-
-namespace WebKit {
-
-class WebMediaStreamDescriptor;
-
-class WebMediaStreamCenterClient {
-public:
- virtual ~WebMediaStreamCenterClient() { }
-
- virtual void stopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamCenterClient_h
+#include "../../../../Platform/chromium/public/WebMediaStreamCenterClient.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h b/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h
index bee18553f..7e6802880 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h
@@ -2,70 +2,25 @@
* 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:
+ * 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.
+ * 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 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.
+ * 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 WebMediaStreamComponent_h
-#define WebMediaStreamComponent_h
-
-#include "WebCommon.h"
-#include "WebNonCopyable.h"
-#include "WebPrivatePtr.h"
-
-namespace WebCore {
-class MediaStreamComponent;
-}
-
-namespace WebKit {
-
-class WebMediaStreamSource;
-class WebString;
-
-class WebMediaStreamComponent {
-public:
- WebMediaStreamComponent() { }
- ~WebMediaStreamComponent() { reset(); }
-
- WEBKIT_EXPORT void reset();
- bool isNull() const { return m_private.isNull(); }
-
- WEBKIT_EXPORT WebMediaStreamSource source() const;
- WEBKIT_EXPORT bool isEnabled() const;
-
-#if WEBKIT_IMPLEMENTATION
- WebMediaStreamComponent(WebCore::MediaStreamComponent*);
- WebMediaStreamComponent& operator=(WebCore::MediaStreamComponent*);
- operator WTF::PassRefPtr<WebCore::MediaStreamComponent>() const;
- operator WebCore::MediaStreamComponent*() const;
-#endif
-
-private:
- WebPrivatePtr<WebCore::MediaStreamComponent> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamComponent_h
+#include "../../../../Platform/chromium/public/WebMediaStreamComponent.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h
index 4923c97b5..97733a555 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h
@@ -1,86 +1,26 @@
/*
- * 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 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
+ * 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 INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * 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.
+ * 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 WebMediaStreamDescriptor_h
-#define WebMediaStreamDescriptor_h
-
-#include "WebCommon.h"
-#include "WebNonCopyable.h"
-#include "WebPrivatePtr.h"
-#include "WebVector.h"
-
-namespace WebCore {
-class MediaStreamDescriptor;
-}
-
-namespace WebKit {
-
-class WebMediaStreamComponent;
-class WebMediaStreamSource;
-class WebString;
-
-class WebMediaStreamDescriptor {
-public:
- WebMediaStreamDescriptor() { }
- WebMediaStreamDescriptor(const WebMediaStreamDescriptor& other) { assign(other); }
- ~WebMediaStreamDescriptor() { reset(); }
-
- WebMediaStreamDescriptor& operator=(const WebMediaStreamDescriptor& other)
- {
- assign(other);
- return *this;
- }
-
- WEBKIT_EXPORT void assign(const WebMediaStreamDescriptor&);
-
- // DEPRECATED
- WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>&);
-
- WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources);
- WEBKIT_EXPORT void reset();
- bool isNull() const { return m_private.isNull(); }
-
- WEBKIT_EXPORT WebString label() const;
-
- // DEPRECATED
- WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const;
-
- WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const;
- WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const;
-
-#if WEBKIT_IMPLEMENTATION
- WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor*);
- WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&);
- operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const;
- operator WebCore::MediaStreamDescriptor*() const;
- WebMediaStreamDescriptor& operator=(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&);
-#endif
-
-private:
- WebPrivatePtr<WebCore::MediaStreamDescriptor> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamDescriptor_h
+#include "../../../../Platform/chromium/public/WebMediaStreamDescriptor.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h
index 142d59866..570bfd7e0 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h
@@ -1,86 +1,26 @@
/*
- * 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
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebMediaStreamSource_h
-#define WebMediaStreamSource_h
-
-#include "WebCommon.h"
-#include "WebNonCopyable.h"
-#include "WebPrivatePtr.h"
-
-namespace WebCore {
-class MediaStreamSource;
-}
-
-namespace WebKit {
-
-class WebString;
-
-class WebMediaStreamSource {
-public:
- enum Type {
- TypeAudio,
- TypeVideo
- };
-
- WebMediaStreamSource() { }
- WebMediaStreamSource(const WebMediaStreamSource& other) { assign(other); }
- ~WebMediaStreamSource() { reset(); }
-
- WebMediaStreamSource& operator=(const WebMediaStreamSource& other)
- {
- assign(other);
- return *this;
- }
-
- WEBKIT_EXPORT void assign(const WebMediaStreamSource&);
-
- WEBKIT_EXPORT void initialize(const WebString& id, Type, const WebString& name);
- WEBKIT_EXPORT void reset();
- bool isNull() const { return m_private.isNull(); }
-
- WEBKIT_EXPORT WebString id() const;
- WEBKIT_EXPORT Type type() const;
- WEBKIT_EXPORT WebString name() const;
-
-#if WEBKIT_IMPLEMENTATION
- WebMediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&);
- WebMediaStreamSource& operator=(WebCore::MediaStreamSource*);
- operator WTF::PassRefPtr<WebCore::MediaStreamSource>() const;
- operator WebCore::MediaStreamSource*() const;
-#endif
-
-private:
- WebPrivatePtr<WebCore::MediaStreamSource> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamSource_h
+#include "../../../../Platform/chromium/public/WebMediaStreamSource.h"
diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h
index 7fcc7c275..418215218 100644
--- a/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h
+++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h
@@ -2,68 +2,25 @@
* 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:
+ * 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.
+ * 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 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.
+ * 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 WebMediaStreamSourcesRequest_h
-#define WebMediaStreamSourcesRequest_h
-
-#include "WebCommon.h"
-#include "WebPrivatePtr.h"
-
-namespace WebCore {
-class MediaStreamSourcesQueryClient;
-}
-
-namespace WebKit {
-
-class WebMediaStreamSource;
-template <typename T> class WebVector;
-
-class WebMediaStreamSourcesRequest {
-public:
- WebMediaStreamSourcesRequest() { }
- ~WebMediaStreamSourcesRequest() { reset(); }
-
- WEBKIT_EXPORT void reset();
- bool isNull() const { return m_private.isNull(); }
-
- WEBKIT_EXPORT bool audio() const;
- WEBKIT_EXPORT bool video() const;
-
- WEBKIT_EXPORT void didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const;
-
-#if WEBKIT_IMPLEMENTATION
- WebMediaStreamSourcesRequest(const WTF::PassRefPtr<WebCore::MediaStreamSourcesQueryClient>&);
-#endif
-
-private:
- WebPrivatePtr<WebCore::MediaStreamSourcesQueryClient> m_private;
-};
-
-} // namespace WebKit
-
-#endif // WebMediaStreamSourcesRequest_h
+#include "../../../../Platform/chromium/public/WebMediaStreamSourcesRequest.h"
diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h b/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h
new file mode 100644
index 000000000..e87ec99e7
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebPeerConnection00Handler.h"
diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h b/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h
new file mode 100644
index 000000000..e6ba56cfc
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebPeerConnection00HandlerClient.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebPeerConnection00HandlerClient.h"
diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h
index bd2093577..e68710c96 100644
--- a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h
+++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h
@@ -1,73 +1,26 @@
/*
- * 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
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebPeerConnectionHandler_h
-#define WebPeerConnectionHandler_h
-
-#include "../WebSecurityOrigin.h" // FIXME: This is a layering violation.
-#include "WebString.h"
-#include "WebVector.h"
-
-namespace WebKit {
-
-class WebMediaStreamDescriptor;
-class WebPeerConnectionHandlerClient;
-
-// Note:
-// SDP stands for Session Description Protocol, which is intended for describing
-// multimedia sessions for the purposes of session announcement, session
-// invitation, and other forms of multimedia session initiation.
-//
-// More information can be found here:
-// http://tools.ietf.org/html/rfc4566
-// http://en.wikipedia.org/wiki/Session_Description_Protocol
-
-
-class WebPeerConnectionHandler {
-public:
- virtual ~WebPeerConnectionHandler() { }
-
- // DEPRECATED
- virtual void initialize(const WebString& serverConfiguration, const WebSecurityOrigin&) { };
-
- virtual void initialize(const WebString& serverConfiguration, const WebString& username) { };
-
- virtual void produceInitialOffer(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams) = 0;
- virtual void handleInitialOffer(const WebString& sdp) = 0;
- virtual void processSDP(const WebString& sdp) = 0;
- virtual void processPendingStreams(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams, const WebVector<WebMediaStreamDescriptor>& pendingRemoveStreams) = 0;
- virtual void sendDataStreamMessage(const char* data, size_t length) = 0;
-
- virtual void stop() = 0;
-};
-
-} // namespace WebKit
-
-#endif // WebPeerConnectionHandler_h
+#include "../../../../Platform/chromium/public/WebPeerConnectionHandler.h"
diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h
index f2b1d3297..defa67c45 100644
--- a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h
+++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h
@@ -1,52 +1,26 @@
/*
- * 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
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebPeerConnectionHandlerClient_h
-#define WebPeerConnectionHandlerClient_h
-
-namespace WebKit {
-
-class WebMediaStreamDescriptor;
-class WebString;
-
-class WebPeerConnectionHandlerClient {
-public:
- virtual ~WebPeerConnectionHandlerClient() { }
-
- virtual void didCompleteICEProcessing() = 0;
- virtual void didGenerateSDP(const WebString& sdp) = 0;
- virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0;
- virtual void didAddRemoteStream(const WebMediaStreamDescriptor&) = 0;
- virtual void didRemoveRemoteStream(const WebMediaStreamDescriptor&) = 0;
-};
-
-} // namespace WebKit
-
-#endif // WebPeerConnectionHandlerClient_h
+#include "../../../../Platform/chromium/public/WebPeerConnectionHandlerClient.h"
diff --git a/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h
index 4bcabcfe6..793c127eb 100644
--- a/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h
+++ b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,53 +23,4 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebPrivateOwnPtr_h
-#define WebPrivateOwnPtr_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
-
-// This class is an implementation detail of the WebKit API. It exists
-// to help simplify the implementation of WebKit interfaces that merely
-// wrap a pointer to a WebCore class. It's similar to WebPrivatePtr, but it
-// wraps a naked pointer rather than a reference counted.
-// Note: you must call reset(0) on the implementation side in order to delete
-// the WebCore pointer.
-template <typename T>
-class WebPrivateOwnPtr {
-public:
- WebPrivateOwnPtr() : m_ptr(0) {}
- ~WebPrivateOwnPtr() { WEBKIT_ASSERT(!m_ptr); }
-
-#if WEBKIT_IMPLEMENTATION
- explicit WebPrivateOwnPtr(T* ptr)
- : m_ptr(ptr)
- {
- }
-
- void reset(T* ptr)
- {
- delete m_ptr;
- m_ptr = ptr;
- }
-
- T* get() const { return m_ptr; }
-
- T* operator->() const
- {
- WEBKIT_ASSERT(m_ptr);
- return m_ptr;
- }
-#endif // WEBKIT_IMPLEMENTATION
-
-private:
- T* m_ptr;
-
- WebPrivateOwnPtr(const WebPrivateOwnPtr&);
- void operator=(const WebPrivateOwnPtr&);
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebPrivateOwnPtr.h"
diff --git a/Source/WebKit/chromium/public/platform/WebReferrerPolicy.h b/Source/WebKit/chromium/public/platform/WebReferrerPolicy.h
new file mode 100644
index 000000000..194c45374
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebReferrerPolicy.h
@@ -0,0 +1,31 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebReferrerPolicy.h"
diff --git a/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h b/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h
new file mode 100644
index 000000000..8b1d2a255
--- /dev/null
+++ b/Source/WebKit/chromium/public/platform/WebSessionDescriptionDescriptor.h
@@ -0,0 +1,26 @@
+/*
+ * 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 "../../../../Platform/chromium/public/WebSessionDescriptionDescriptor.h"
diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamError.h b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h
index f52869b3b..166042934 100644
--- a/Source/WebKit/chromium/public/platform/WebSocketStreamError.h
+++ b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h
@@ -1,45 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebSocketStreamError_h
-#define WebSocketStreamError_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
-
-class WebSocketStreamError {
-public:
- // FIXME: Define SocketStream Error codes and accessor methods.
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebSocketStreamError.h"
diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h
index ededa0e43..0f0ceb93c 100644
--- a/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h
+++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h
@@ -1,58 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebSocketStreamHandle_h
-#define WebSocketStreamHandle_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
-
-class WebData;
-class WebSocketStreamHandleClient;
-class WebURL;
-
-class WebSocketStreamHandle {
-public:
- virtual ~WebSocketStreamHandle() { }
-
- // Connect new socket stream asynchronously.
- virtual void connect(const WebURL&, WebSocketStreamHandleClient*) = 0;
-
- // Send web socket frame data on the socket stream.
- virtual bool send(const WebData&) = 0;
-
- // Close the socket stream.
- virtual void close() = 0;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebSocketStreamHandle.h"
diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h
index 82f328c6e..6ad2a27ba 100644
--- a/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h
+++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h
@@ -1,66 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebSocketStreamHandleClient_h
-#define WebSocketStreamHandleClient_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
-
-class WebData;
-class WebSocketStreamError;
-class WebSocketStreamHandle;
-class WebURL;
-
-class WebSocketStreamHandleClient {
-public:
-
- // Called when Socket Stream is opened.
- virtual void didOpenStream(WebSocketStreamHandle*, int /* maxPendingSendAllowed */) = 0;
-
- // Called when |amountSent| bytes are sent.
- virtual void didSendData(WebSocketStreamHandle*, int /* amountSent */) = 0;
-
- // Called when data are received.
- virtual void didReceiveData(WebSocketStreamHandle*, const WebData&) = 0;
-
- // Called when Socket Stream is closed.
- virtual void didClose(WebSocketStreamHandle*) = 0;
-
- // Called when Socket Stream has an error.
- virtual void didFail(WebSocketStreamHandle*, const WebSocketStreamError&) = 0;
-
- // FIXME: auth challenge for proxy
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebSocketStreamHandleClient.h"
diff --git a/Source/WebKit/chromium/public/platform/WebThread.h b/Source/WebKit/chromium/public/platform/WebThread.h
index b54bee849..5ad4b46e3 100644
--- a/Source/WebKit/chromium/public/platform/WebThread.h
+++ b/Source/WebKit/chromium/public/platform/WebThread.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -22,51 +22,5 @@
* (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 WebThread_h
-#define WebThread_h
-#include "WebCommon.h"
-
-namespace WebKit {
-
-#define WEBTHREAD_HAS_LONGLONG_CHANGE
-
-// Provides an interface to an embedder-defined thread implementation.
-//
-// Deleting the thread blocks until all pending, non-delayed tasks have been
-// run.
-class WebThread {
-public:
- class Task {
- public:
- virtual ~Task() { }
- virtual void run() = 0;
- };
-
- class TaskObserver {
- public:
- virtual ~TaskObserver() { }
- virtual void didProcessTask() = 0;
- };
-
- virtual void postTask(Task*) = 0;
- virtual void postDelayedTask(Task*, long long delayMs) = 0;
-
- virtual void addTaskObserver(TaskObserver*) { }
- virtual void removeTaskObserver(TaskObserver*) { }
-
- // enterRunLoop() processes tasks posted to this WebThread. This call does not return until some task calls exitRunLoop().
- // WebThread does not support nesting, meaning that once the run loop is entered for a given WebThread it is not valid to
- // call enterRunLoop() again.
- virtual void enterRunLoop() = 0;
-
- // exitRunLoop() runs tasks until there are no tasks available to run, then returns control to the caller of enterRunLoop().
- // Must be called when the WebThread is running.
- virtual void exitRunLoop() = 0;
-
- virtual ~WebThread() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebThread.h"
diff --git a/Source/WebKit/chromium/public/platform/WebThreadSafeData.h b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h
index 19af4df2b..dfb6fadcc 100644
--- a/Source/WebKit/chromium/public/platform/WebThreadSafeData.h
+++ b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h
@@ -1,77 +1,26 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebThreadSafeData_h
-#define WebThreadSafeData_h
-
-#include "WebCommon.h"
-#include "WebPrivatePtr.h"
-
-#if !WEBKIT_IMPLEMENTATION
-#include <string>
-#endif
-
-namespace WebCore { class RawData; }
-
-namespace WebKit {
-
-// A container for raw bytes. It is inexpensive to copy a WebThreadSafeData object.
-// It is safe to pass a WebThreadSafeData across threads!!!
-class WebThreadSafeData {
-public:
- WebThreadSafeData() { }
- ~WebThreadSafeData() { reset(); }
-
- WEBKIT_EXPORT void assign(const WebThreadSafeData&);
- WEBKIT_EXPORT void reset();
-
- WEBKIT_EXPORT size_t size() const;
- WEBKIT_EXPORT const char* data() const;
-
- bool isEmpty() const { return !size(); }
-
-#if WEBKIT_IMPLEMENTATION
- WebThreadSafeData(const WTF::PassRefPtr<WebCore::RawData>&);
- WebThreadSafeData& operator=(const WTF::PassRefPtr<WebCore::RawData>&);
-#else
- operator std::string() const
- {
- size_t len = size();
- return len ? std::string(data(), len) : std::string();
- }
-#endif
-
-private:
- WebPrivatePtr<WebCore::RawData> m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebThreadSafeData.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURL.h b/Source/WebKit/chromium/public/platform/WebURL.h
index 707ba0896..d28c21b6f 100644
--- a/Source/WebKit/chromium/public/platform/WebURL.h
+++ b/Source/WebKit/chromium/public/platform/WebURL.h
@@ -1,158 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURL_h
-#define WebURL_h
-
-#include "WebCString.h"
-#include <googleurl/src/url_parse.h>
-
-#if WEBKIT_IMPLEMENTATION
-namespace WebCore { class KURL; }
-#else
-#include <googleurl/src/gurl.h>
-#endif
-
-namespace WebKit {
-
-class WebURL {
-public:
- ~WebURL()
- {
- }
-
- WebURL() : m_isValid(false)
- {
- }
-
- WebURL(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid)
- : m_spec(spec)
- , m_parsed(parsed)
- , m_isValid(isValid)
- {
- }
-
- WebURL(const WebURL& s)
- : m_spec(s.m_spec)
- , m_parsed(s.m_parsed)
- , m_isValid(s.m_isValid)
- {
- }
-
- WebURL& operator=(const WebURL& s)
- {
- m_spec = s.m_spec;
- m_parsed = s.m_parsed;
- m_isValid = s.m_isValid;
- return *this;
- }
-
- void assign(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid)
- {
- m_spec = spec;
- m_parsed = parsed;
- m_isValid = isValid;
- }
-
- const WebCString& spec() const
- {
- return m_spec;
- }
-
- const url_parse::Parsed& parsed() const
- {
- return m_parsed;
- }
-
- bool isValid() const
- {
- return m_isValid;
- }
-
- bool isEmpty() const
- {
- return m_spec.isEmpty();
- }
-
- bool isNull() const
- {
- return m_spec.isEmpty();
- }
-
-#if WEBKIT_IMPLEMENTATION
- WebURL(const WebCore::KURL&);
- WebURL& operator=(const WebCore::KURL&);
- operator WebCore::KURL() const;
-#else
- WebURL(const GURL& g)
- : m_spec(g.possibly_invalid_spec())
- , m_parsed(g.parsed_for_possibly_invalid_spec())
- , m_isValid(g.is_valid())
- {
- }
-
- WebURL& operator=(const GURL& g)
- {
- m_spec = g.possibly_invalid_spec();
- m_parsed = g.parsed_for_possibly_invalid_spec();
- m_isValid = g.is_valid();
- return *this;
- }
-
- operator GURL() const
- {
- return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid);
- }
-#endif
-
-private:
- WebCString m_spec; // UTF-8 encoded
- url_parse::Parsed m_parsed;
- bool m_isValid;
-};
-
-inline bool operator<(const WebURL& a, const WebURL& b)
-{
- return a.spec() < b.spec();
-}
-
-inline bool operator==(const WebURL& a, const WebURL& b)
-{
- return !a.spec().compare(b.spec());
-}
-
-inline bool operator!=(const WebURL& a, const WebURL& b)
-{
- return !(a == b);
-}
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURL.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLError.h b/Source/WebKit/chromium/public/platform/WebURLError.h
index 862dbeaa3..8f0c15627 100644
--- a/Source/WebKit/chromium/public/platform/WebURLError.h
+++ b/Source/WebKit/chromium/public/platform/WebURLError.h
@@ -1,73 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLError_h
-#define WebURLError_h
-
-#include "WebString.h"
-#include "WebURL.h"
-
-#if defined(WEBKIT_IMPLEMENTATION)
-namespace WebCore { class ResourceError; }
-#endif
-
-namespace WebKit {
-
-struct WebURLError {
- // A namespace for "reason" to support various layers generating
- // resource errors. WebKit does not care about the value of this
- // string as it will just be passed via callbacks to the consumer.
- WebString domain;
-
- // A numeric error code detailing the reason for this error. A value
- // of 0 means no error. WebKit does not interpret the meaning of other
- // values and normally just forwards this error information back to the
- // embedder (see for example WebFrameClient).
- int reason;
-
- // A flag showing whether this error should be treated as a cancellation,
- // e.g. we do not show console errors for cancellations.
- bool isCancellation;
-
- // The url that failed to load.
- WebURL unreachableURL;
-
- WebURLError() : reason(0), isCancellation(false) { }
-
-#if defined(WEBKIT_IMPLEMENTATION)
- WebURLError(const WebCore::ResourceError&);
- WebURLError& operator=(const WebCore::ResourceError&);
- operator WebCore::ResourceError() const;
-#endif
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLError.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h
index 839276bfb..7cc0dd844 100644
--- a/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h
+++ b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h
@@ -1,108 +1,26 @@
/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLLoadTiming_h
-#define WebURLLoadTiming_h
-
-#include "WebCommon.h"
-#include "WebPrivatePtr.h"
-
-namespace WebCore { class ResourceLoadTiming; }
-
-namespace WebKit {
-class WebString;
-
-class WebURLLoadTiming {
-public:
- ~WebURLLoadTiming() { reset(); }
-
- WebURLLoadTiming() { }
- WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); }
- WebURLLoadTiming& operator=(const WebURLLoadTiming& d)
- {
- assign(d);
- return *this;
- }
-
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebURLLoadTiming&);
-
- bool isNull() const { return m_private.isNull(); }
-
- WEBKIT_EXPORT double requestTime() const;
- WEBKIT_EXPORT void setRequestTime(double);
-
- WEBKIT_EXPORT int proxyStart() const;
- WEBKIT_EXPORT void setProxyStart(int);
-
- WEBKIT_EXPORT int proxyEnd() const;
- WEBKIT_EXPORT void setProxyEnd(int);
-
- WEBKIT_EXPORT int dnsStart() const;
- WEBKIT_EXPORT void setDNSStart(int);
-
- WEBKIT_EXPORT int dnsEnd() const;
- WEBKIT_EXPORT void setDNSEnd(int);
-
- WEBKIT_EXPORT int connectStart() const;
- WEBKIT_EXPORT void setConnectStart(int);
-
- WEBKIT_EXPORT int connectEnd() const;
- WEBKIT_EXPORT void setConnectEnd(int);
-
- WEBKIT_EXPORT int sendStart() const;
- WEBKIT_EXPORT void setSendStart(int);
-
- WEBKIT_EXPORT int sendEnd() const;
- WEBKIT_EXPORT void setSendEnd(int);
-
- WEBKIT_EXPORT int receiveHeadersEnd() const;
- WEBKIT_EXPORT void setReceiveHeadersEnd(int);
-
- WEBKIT_EXPORT int sslStart() const;
- WEBKIT_EXPORT void setSSLStart(int);
-
- WEBKIT_EXPORT int sslEnd() const;
- WEBKIT_EXPORT void setSSLEnd(int);
-
-#if WEBKIT_IMPLEMENTATION
- WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&);
- WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&);
- operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const;
-#endif
-
-private:
- WebPrivatePtr<WebCore::ResourceLoadTiming> m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLLoadTiming.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLLoader.h b/Source/WebKit/chromium/public/platform/WebURLLoader.h
index a47b986b9..de437843b 100644
--- a/Source/WebKit/chromium/public/platform/WebURLLoader.h
+++ b/Source/WebKit/chromium/public/platform/WebURLLoader.h
@@ -1,71 +1,26 @@
/*
- * Copyright (C) 2009, 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
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLLoader_h
-#define WebURLLoader_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
-
-class WebData;
-class WebURLLoaderClient;
-class WebURLRequest;
-class WebURLResponse;
-struct WebURLError;
-
-class WebURLLoader {
-public:
- // The WebURLLoader may be deleted in a call to its client.
- virtual ~WebURLLoader() {}
-
- // Load the request synchronously, returning results directly to the
- // caller upon completion. There is no mechanism to interrupt a
- // synchronous load!!
- virtual void loadSynchronously(const WebURLRequest&,
- WebURLResponse&, WebURLError&, WebData& data) = 0;
-
- // Load the request asynchronously, sending notifications to the given
- // client. The client will receive no further notifications if the
- // loader is disposed before it completes its work.
- virtual void loadAsynchronously(const WebURLRequest&,
- WebURLLoaderClient*) = 0;
-
- // Cancels an asynchronous load. This will appear as a load error to
- // the client.
- virtual void cancel() = 0;
-
- // Suspends/resumes an asynchronous load.
- virtual void setDefersLoading(bool) = 0;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLLoader.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h
index 3313a9c03..49cef3e56 100644
--- a/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h
+++ b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h
@@ -1,78 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLLoaderClient_h
-#define WebURLLoaderClient_h
-
-namespace WebKit {
-
-class WebURLLoader;
-class WebURLRequest;
-class WebURLResponse;
-struct WebURLError;
-
-class WebURLLoaderClient {
-public:
- // Called when following a redirect. |newRequest| contains the request
- // generated by the redirect. The client may modify |newRequest|.
- virtual void willSendRequest(
- WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { }
-
- // Called to report upload progress. The bytes reported correspond to
- // the HTTP message body.
- virtual void didSendData(
- WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { }
-
- // Called when response headers are received.
- virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { }
-
- // Called when a chunk of response data is downloaded. This is only called
- // if WebURLRequest's downloadToFile flag was set to true.
- virtual void didDownloadData(WebURLLoader*, int dataLength) { }
-
- // Called when a chunk of response data is received.
- virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { }
-
- // Called when a chunk of renderer-generated metadata is received from the cache.
- virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { }
-
- // Called when the load completes successfully.
- virtual void didFinishLoading(WebURLLoader*, double finishTime) { }
-
- // Called when the load completes with an error.
- virtual void didFail(WebURLLoader*, const WebURLError&) { }
-
-protected:
- virtual ~WebURLLoaderClient() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLLoaderClient.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLRequest.h b/Source/WebKit/chromium/public/platform/WebURLRequest.h
index adf2f2e23..38c0e52a0 100644
--- a/Source/WebKit/chromium/public/platform/WebURLRequest.h
+++ b/Source/WebKit/chromium/public/platform/WebURLRequest.h
@@ -1,199 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLRequest_h
-#define WebURLRequest_h
-
-#include "WebCommon.h"
-#include "WebHTTPBody.h"
-
-#if defined(WEBKIT_IMPLEMENTATION)
-namespace WebCore { class ResourceRequest; }
-#endif
-
-namespace WebKit {
-
-class WebCString;
-class WebHTTPBody;
-class WebHTTPHeaderVisitor;
-class WebString;
-class WebURL;
-class WebURLRequestPrivate;
-
-class WebURLRequest {
-public:
- enum CachePolicy {
- UseProtocolCachePolicy, // normal load
- ReloadIgnoringCacheData, // reload
- ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data
- ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache
- };
-
- enum TargetType {
- TargetIsMainFrame = 0,
- TargetIsSubframe = 1,
- TargetIsSubresource = 2,
- TargetIsStyleSheet = 3,
- TargetIsScript = 4,
- TargetIsFontResource = 5,
- TargetIsImage = 6,
- TargetIsObject = 7,
- TargetIsMedia = 8,
- TargetIsWorker = 9,
- TargetIsSharedWorker = 10,
- TargetIsPrefetch = 11,
- TargetIsPrerender = 12,
- TargetIsFavicon = 13,
- TargetIsXHR = 14,
- TargetIsTextTrack = 15,
- TargetIsUnspecified = 16,
- };
-
- class ExtraData {
- public:
- virtual ~ExtraData() { }
- };
-
- ~WebURLRequest() { reset(); }
-
- WebURLRequest() : m_private(0) { }
- WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); }
- WebURLRequest& operator=(const WebURLRequest& r)
- {
- assign(r);
- return *this;
- }
-
- explicit WebURLRequest(const WebURL& url) : m_private(0)
- {
- initialize();
- setURL(url);
- }
-
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebURLRequest&);
-
- WEBKIT_EXPORT bool isNull() const;
-
- WEBKIT_EXPORT WebURL url() const;
- WEBKIT_EXPORT void setURL(const WebURL&);
-
- // Used to implement third-party cookie blocking.
- WEBKIT_EXPORT WebURL firstPartyForCookies() const;
- WEBKIT_EXPORT void setFirstPartyForCookies(const WebURL&);
-
- WEBKIT_EXPORT bool allowCookies() const;
- WEBKIT_EXPORT void setAllowCookies(bool);
-
- // Controls whether user name, password, and cookies may be sent with the
- // request. (If false, this overrides allowCookies.)
- WEBKIT_EXPORT bool allowStoredCredentials() const;
- WEBKIT_EXPORT void setAllowStoredCredentials(bool);
-
- WEBKIT_EXPORT CachePolicy cachePolicy() const;
- WEBKIT_EXPORT void setCachePolicy(CachePolicy);
-
- WEBKIT_EXPORT WebString httpMethod() const;
- WEBKIT_EXPORT void setHTTPMethod(const WebString&);
-
- WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const;
- WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value);
- WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value);
- WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name);
- WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
-
- WEBKIT_EXPORT WebHTTPBody httpBody() const;
- WEBKIT_EXPORT void setHTTPBody(const WebHTTPBody&);
-
- // Controls whether upload progress events are generated when a request
- // has a body.
- WEBKIT_EXPORT bool reportUploadProgress() const;
- WEBKIT_EXPORT void setReportUploadProgress(bool);
-
- // Controls whether load timing info is collected for the request.
- WEBKIT_EXPORT bool reportLoadTiming() const;
- WEBKIT_EXPORT void setReportLoadTiming(bool);
-
- // Controls whether actual headers sent and received for request are
- // collected and reported.
- WEBKIT_EXPORT bool reportRawHeaders() const;
- WEBKIT_EXPORT void setReportRawHeaders(bool);
-
- WEBKIT_EXPORT TargetType targetType() const;
- WEBKIT_EXPORT void setTargetType(TargetType);
-
- // True if the request was user initiated.
- WEBKIT_EXPORT bool hasUserGesture() const;
- WEBKIT_EXPORT void setHasUserGesture(bool);
-
- // A consumer controlled value intended to be used to identify the
- // requestor.
- WEBKIT_EXPORT int requestorID() const;
- WEBKIT_EXPORT void setRequestorID(int);
-
- // A consumer controlled value intended to be used to identify the
- // process of the requestor.
- WEBKIT_EXPORT int requestorProcessID() const;
- WEBKIT_EXPORT void setRequestorProcessID(int);
-
- // Allows the request to be matched up with its app cache host.
- WEBKIT_EXPORT int appCacheHostID() const;
- WEBKIT_EXPORT void setAppCacheHostID(int);
-
- // If true, the response body will be downloaded to a file managed by the
- // WebURLLoader. See WebURLResponse::downloadedFilePath.
- WEBKIT_EXPORT bool downloadToFile() const;
- WEBKIT_EXPORT void setDownloadToFile(bool);
-
- // Extra data associated with the underlying resource request. Resource
- // requests can be copied. If non-null, each copy of a resource requests
- // holds a pointer to the extra data, and the extra data pointer will be
- // deleted when the last resource request is destroyed. Setting the extra
- // data pointer will cause the underlying resource request to be
- // dissociated from any existing non-null extra data pointer.
- WEBKIT_EXPORT ExtraData* extraData() const;
- WEBKIT_EXPORT void setExtraData(ExtraData*);
-
-#if defined(WEBKIT_IMPLEMENTATION)
- WebCore::ResourceRequest& toMutableResourceRequest();
- const WebCore::ResourceRequest& toResourceRequest() const;
-#endif
-
-protected:
- void assign(WebURLRequestPrivate*);
-
-private:
- WebURLRequestPrivate* m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLRequest.h"
diff --git a/Source/WebKit/chromium/public/platform/WebURLResponse.h b/Source/WebKit/chromium/public/platform/WebURLResponse.h
index 8d53eac38..29cbd614b 100644
--- a/Source/WebKit/chromium/public/platform/WebURLResponse.h
+++ b/Source/WebKit/chromium/public/platform/WebURLResponse.h
@@ -1,200 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebURLResponse_h
-#define WebURLResponse_h
-
-#include "WebCommon.h"
-#include "WebPrivateOwnPtr.h"
-
-#if defined(WEBKIT_IMPLEMENTATION)
-namespace WebCore { class ResourceResponse; }
-#endif
-
-namespace WebKit {
-
-class WebCString;
-class WebHTTPHeaderVisitor;
-class WebHTTPLoadInfo;
-class WebString;
-class WebURL;
-class WebURLLoadTiming;
-class WebURLResponsePrivate;
-
-class WebURLResponse {
-public:
- class ExtraData {
- public:
- virtual ~ExtraData() { }
- };
-
- ~WebURLResponse() { reset(); }
-
- WebURLResponse() : m_private(0) { }
- WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); }
- WebURLResponse& operator=(const WebURLResponse& r)
- {
- assign(r);
- return *this;
- }
-
- explicit WebURLResponse(const WebURL& url) : m_private(0)
- {
- initialize();
- setURL(url);
- }
-
- WEBKIT_EXPORT void initialize();
- WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void assign(const WebURLResponse&);
-
- WEBKIT_EXPORT bool isNull() const;
-
- WEBKIT_EXPORT WebURL url() const;
- WEBKIT_EXPORT void setURL(const WebURL&);
-
- WEBKIT_EXPORT unsigned connectionID() const;
- WEBKIT_EXPORT void setConnectionID(unsigned);
-
- WEBKIT_EXPORT bool connectionReused() const;
- WEBKIT_EXPORT void setConnectionReused(bool);
-
- WEBKIT_EXPORT WebURLLoadTiming loadTiming();
- WEBKIT_EXPORT void setLoadTiming(const WebURLLoadTiming&);
-
- WEBKIT_EXPORT WebHTTPLoadInfo httpLoadInfo();
- WEBKIT_EXPORT void setHTTPLoadInfo(const WebHTTPLoadInfo&);
-
- WEBKIT_EXPORT double responseTime() const;
- WEBKIT_EXPORT void setResponseTime(double);
-
- WEBKIT_EXPORT WebString mimeType() const;
- WEBKIT_EXPORT void setMIMEType(const WebString&);
-
- WEBKIT_EXPORT long long expectedContentLength() const;
- WEBKIT_EXPORT void setExpectedContentLength(long long);
-
- WEBKIT_EXPORT WebString textEncodingName() const;
- WEBKIT_EXPORT void setTextEncodingName(const WebString&);
-
- WEBKIT_EXPORT WebString suggestedFileName() const;
- WEBKIT_EXPORT void setSuggestedFileName(const WebString&);
-
- WEBKIT_EXPORT int httpStatusCode() const;
- WEBKIT_EXPORT void setHTTPStatusCode(int);
-
- WEBKIT_EXPORT WebString httpStatusText() const;
- WEBKIT_EXPORT void setHTTPStatusText(const WebString&);
-
- WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const;
- WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value);
- WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value);
- WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name);
- WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const;
-
- WEBKIT_EXPORT double lastModifiedDate() const;
- WEBKIT_EXPORT void setLastModifiedDate(double);
-
- WEBKIT_EXPORT long long appCacheID() const;
- WEBKIT_EXPORT void setAppCacheID(long long);
-
- WEBKIT_EXPORT WebURL appCacheManifestURL() const;
- WEBKIT_EXPORT void setAppCacheManifestURL(const WebURL&);
-
- // A consumer controlled value intended to be used to record opaque
- // security info related to this request.
- WEBKIT_EXPORT WebCString securityInfo() const;
- WEBKIT_EXPORT void setSecurityInfo(const WebCString&);
-
-#if defined(WEBKIT_IMPLEMENTATION)
- WebCore::ResourceResponse& toMutableResourceResponse();
- const WebCore::ResourceResponse& toResourceResponse() const;
-#endif
-
- // Flag whether this request was served from the disk cache entry.
- WEBKIT_EXPORT bool wasCached() const;
- WEBKIT_EXPORT void setWasCached(bool);
-
- // Flag whether this request was loaded via the SPDY protocol or not.
- // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy
- WEBKIT_EXPORT bool wasFetchedViaSPDY() const;
- WEBKIT_EXPORT void setWasFetchedViaSPDY(bool);
-
- // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiation was used.
- // This is related to SPDY.
- WEBKIT_EXPORT bool wasNpnNegotiated() const;
- WEBKIT_EXPORT void setWasNpnNegotiated(bool);
-
- // Flag whether this request was made when "Alternate-Protocol: xxx"
- // is present in server's response.
- WEBKIT_EXPORT bool wasAlternateProtocolAvailable() const;
- WEBKIT_EXPORT void setWasAlternateProtocolAvailable(bool);
-
- // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc).
- WEBKIT_EXPORT bool wasFetchedViaProxy() const;
- WEBKIT_EXPORT void setWasFetchedViaProxy(bool);
-
- // Flag whether this request is part of a multipart response.
- WEBKIT_EXPORT bool isMultipartPayload() const;
- WEBKIT_EXPORT void setIsMultipartPayload(bool);
-
- // This indicates the location of a downloaded response if the
- // WebURLRequest had the downloadToFile flag set to true. This file path
- // remains valid for the lifetime of the WebURLLoader used to create it.
- WEBKIT_EXPORT WebString downloadFilePath() const;
- WEBKIT_EXPORT void setDownloadFilePath(const WebString&);
-
- // Remote IP address of the socket which fetched this resource.
- WEBKIT_EXPORT WebString remoteIPAddress() const;
- WEBKIT_EXPORT void setRemoteIPAddress(const WebString&);
-
- // Remote port number of the socket which fetched this resource.
- WEBKIT_EXPORT unsigned short remotePort() const;
- WEBKIT_EXPORT void setRemotePort(unsigned short);
-
- // Extra data associated with the underlying resource response. Resource
- // responses can be copied. If non-null, each copy of a resource response
- // holds a pointer to the extra data, and the extra data pointer will be
- // deleted when the last resource response is destroyed. Setting the extra
- // data pointer will cause the underlying resource response to be
- // dissociated from any existing non-null extra data pointer.
- WEBKIT_EXPORT ExtraData* extraData() const;
- WEBKIT_EXPORT void setExtraData(ExtraData*);
-
-protected:
- void assign(WebURLResponsePrivate*);
-
-private:
- WebURLResponsePrivate* m_private;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebURLResponse.h"
diff --git a/Source/WebKit/chromium/public/platform/WebVector.h b/Source/WebKit/chromium/public/platform/WebVector.h
index bb02abcdf..372147789 100644
--- a/Source/WebKit/chromium/public/platform/WebVector.h
+++ b/Source/WebKit/chromium/public/platform/WebVector.h
@@ -1,186 +1,26 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
+ * 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.
+ * 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 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.
+ * 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 WebVector_h
-#define WebVector_h
-
-#include "WebCommon.h"
-
-#include <algorithm>
-
-namespace WebKit {
-
-// A simple vector class.
-//
-// Sample usage:
-//
-// void Foo(WebVector<int>& result)
-// {
-// WebVector<int> data(10);
-// for (size_t i = 0; i < data.size(); ++i)
-// data[i] = ...
-// result.swap(data);
-// }
-//
-// It is also possible to assign from other types of random access
-// containers:
-//
-// void Foo(const std::vector<std::string>& input)
-// {
-// WebVector<WebCString> cstrings = input;
-// ...
-// }
-//
-template <typename T>
-class WebVector {
-public:
- typedef T ValueType;
-
- ~WebVector()
- {
- destroy();
- }
-
- explicit WebVector(size_t size = 0)
- {
- initialize(size);
- }
-
- WebVector(const WebVector<T>& other)
- {
- initializeFrom(other.m_ptr, other.m_size);
- }
-
- template <typename C>
- WebVector(const C& other)
- {
- initializeFrom(other.size() ? &other[0] : 0, other.size());
- }
-
- WebVector& operator=(const WebVector& other)
- {
- if (this != &other)
- assign(other);
- return *this;
- }
-
- template <typename C>
- WebVector<T>& operator=(const C& other)
- {
- if (this != reinterpret_cast<const WebVector<T>*>(&other))
- assign(other);
- return *this;
- }
-
- template <typename C>
- void assign(const C& other)
- {
- assign(other.size() ? &other[0] : 0, other.size());
- }
-
- template <typename U>
- void assign(const U* values, size_t size)
- {
- destroy();
- initializeFrom(values, size);
- }
-
- size_t size() const { return m_size; }
- bool isEmpty() const { return !m_size; }
-
- T& operator[](size_t i)
- {
- WEBKIT_ASSERT(i < m_size);
- return m_ptr[i];
- }
- const T& operator[](size_t i) const
- {
- WEBKIT_ASSERT(i < m_size);
- return m_ptr[i];
- }
-
- bool contains(const T& value) const
- {
- for (size_t i = 0; i < m_size; i++) {
- if (m_ptr[i] == value)
- return true;
- }
- return false;
- }
-
- T* data() { return m_ptr; }
- const T* data() const { return m_ptr; }
-
- void swap(WebVector<T>& other)
- {
- std::swap(m_ptr, other.m_ptr);
- std::swap(m_size, other.m_size);
- }
-
-private:
- void initialize(size_t size)
- {
- m_size = size;
- if (!m_size)
- m_ptr = 0;
- else {
- m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size));
- for (size_t i = 0; i < m_size; ++i)
- new (&m_ptr[i]) T();
- }
- }
-
- template <typename U>
- void initializeFrom(const U* values, size_t size)
- {
- m_size = size;
- if (!m_size)
- m_ptr = 0;
- else {
- m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size));
- for (size_t i = 0; i < m_size; ++i)
- new (&m_ptr[i]) T(values[i]);
- }
- }
-
- void destroy()
- {
- for (size_t i = 0; i < m_size; ++i)
- m_ptr[i].~T();
- ::operator delete(m_ptr);
- }
-
- T* m_ptr;
- size_t m_size;
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../../../Platform/chromium/public/WebVector.h"
diff --git a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp
index 73f258b0c..bbf740dfd 100644
--- a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp
+++ b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp
@@ -193,10 +193,12 @@ void ApplicationCacheHost::maybeLoadFallbackSynchronously(const ResourceRequest&
// N/A to the chromium port
}
-bool ApplicationCacheHost::canCacheInPageCache() const
+bool ApplicationCacheHost::canCacheInPageCache()
{
- // N/A to the chromium port which doesn't use the page cache.
- return false;
+ // Chromium doesn't use the page cache, however, that's controlled by WebCore::Settings, which has usesPageCache() return
+ // false. So we return an hyptothetical here: Chromium won't end up using the PageCache, but the statistics in PageCache.cpp
+ // will be reported correctly for re-evaluating that decision.
+ return !isApplicationCacheEnabled() || status() == UNCACHED;
}
void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplicationCache)
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
index ac6fa0447..9f39fc372 100644
--- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -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
@@ -36,28 +36,32 @@
#include "AXObjectCache.h"
#include "AccessibilityObject.h"
#include "ApplicationCacheHost.h"
-#include "AsyncFileSystem.h"
#include "ContentSecurityPolicy.h"
#include "DocumentMarker.h"
#include "EditorInsertAction.h"
#include "ExceptionCode.h"
#include "FileError.h"
#include "FileMetadata.h"
+#include "FileSystemType.h"
+#include "FilterOperation.h"
#include "FontDescription.h"
#include "FontSmoothingMode.h"
#include "GeolocationError.h"
#include "GeolocationPosition.h"
#include "HTMLInputElement.h"
+#include "IDBDatabaseException.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBKey.h"
+#include "IceOptions.h"
#include "IconURL.h"
#include "MediaPlayer.h"
#include "MediaStreamSource.h"
#include "NotificationClient.h"
#include "PageVisibilityState.h"
#include "PasteboardPrivate.h"
+#include "PeerConnection00.h"
#include "PlatformCursor.h"
-#include "SecurityPolicy.h"
+#include "ReferrerPolicy.h"
#include "Settings.h"
#include "StorageInfo.h"
#include "TextAffinity.h"
@@ -66,7 +70,6 @@
#include "UserContentTypes.h"
#include "UserScriptTypes.h"
#include "UserStyleSheetTypes.h"
-#include "VideoFrameChromium.h"
#include "WebAccessibilityNotification.h"
#include "WebAccessibilityObject.h"
#include "WebApplicationCacheHost.h"
@@ -78,27 +81,32 @@
#include "WebFontDescription.h"
#include "WebGeolocationError.h"
#include "WebGeolocationPosition.h"
+#include "WebIDBDatabaseException.h"
#include "WebIDBFactory.h"
#include "WebIDBKey.h"
#include "WebIconURL.h"
#include "WebInputElement.h"
#include "WebMediaPlayer.h"
+#include "WebMediaPlayerClient.h"
#include "WebNotificationPresenter.h"
#include "WebPageVisibilityState.h"
-#include "WebReferrerPolicy.h"
#include "WebScrollbar.h"
#include "WebSettings.h"
#include "WebStorageQuotaError.h"
#include "WebStorageQuotaType.h"
#include "WebTextAffinity.h"
#include "WebTextCaseSensitivity.h"
-#include "WebTextCheckingType.h"
#include "WebTextCheckingResult.h"
-#include "WebVideoFrame.h"
+#include "WebTextCheckingType.h"
#include "WebView.h"
#include "platform/WebClipboard.h"
#include "platform/WebFileSystem.h"
+#include "platform/WebICEOptions.h"
#include "platform/WebMediaStreamSource.h"
+#include "platform/WebPeerConnection00Handler.h"
+#include "platform/WebPeerConnection00HandlerClient.h"
+#include <public/WebFilterOperation.h>
+#include <public/WebReferrerPolicy.h>
#include <wtf/Assertions.h>
#include <wtf/text/StringImpl.h>
@@ -212,6 +220,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTreeGrid, TreeGridRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTreeItemRole, TreeItemRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDirectory, DirectoryRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleEditableText, EditableTextRole);
+COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleFooter, FooterRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleListItem, ListItemRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleParagraph, ParagraphRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLabel, LabelRole);
@@ -310,6 +319,15 @@ COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped);
COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted);
COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeGrayscale, FilterOperation::GRAYSCALE);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSepia, FilterOperation::SEPIA);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSaturate, FilterOperation::SATURATE);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeHueRotate, FilterOperation::HUE_ROTATE);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeInvert, FilterOperation::INVERT);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeBrightness, FilterOperation::BRIGHTNESS);
+COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeContrast, FilterOperation::CONTRAST);
+
COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescription::NoFamily);
COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyStandard, FontDescription::StandardFamily);
COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySerif, FontDescription::SerifFamily);
@@ -361,39 +379,57 @@ COMPILE_ASSERT_MATCHING_ENUM(WebNode::NotationNode, Node::NOTATION_NODE);
COMPILE_ASSERT_MATCHING_ENUM(WebNode::XPathNamespaceNode, Node::XPATH_NAMESPACE_NODE);
#if ENABLE(VIDEO)
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Empty, MediaPlayer::Empty);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Idle, MediaPlayer::Idle);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Loading, MediaPlayer::Loading);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Loaded, MediaPlayer::Loaded);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::FormatError, MediaPlayer::FormatError);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkError, MediaPlayer::NetworkError);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::DecodeError, MediaPlayer::DecodeError);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveNothing, MediaPlayer::HaveNothing);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveMetadata, MediaPlayer::HaveMetadata);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveCurrentData, MediaPlayer::HaveCurrentData);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveFutureData, MediaPlayer::HaveFutureData);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::HaveEnoughData, MediaPlayer::HaveEnoughData);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Unknown, MediaPlayer::Unknown);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Download, MediaPlayer::Download);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::StoredStream, MediaPlayer::StoredStream);
-COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::LiveStream, MediaPlayer::LiveStream);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatInvalid, VideoFrameChromium::Invalid);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB555, VideoFrameChromium::RGB555);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB565, VideoFrameChromium::RGB565);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB24, VideoFrameChromium::RGB24);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB32, VideoFrameChromium::RGB32);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGBA, VideoFrameChromium::RGBA);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV12, VideoFrameChromium::YV12);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV16, VideoFrameChromium::YV16);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatNV12, VideoFrameChromium::NV12);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatEmpty, VideoFrameChromium::Empty);
-COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatASCII, VideoFrameChromium::ASCII);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateEmpty, MediaPlayer::Empty);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateIdle, MediaPlayer::Idle);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateLoading, MediaPlayer::Loading);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateLoaded, MediaPlayer::Loaded);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateFormatError, MediaPlayer::FormatError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateNetworkError, MediaPlayer::NetworkError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::NetworkStateDecodeError, MediaPlayer::DecodeError);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveNothing, MediaPlayer::HaveNothing);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveMetadata, MediaPlayer::HaveMetadata);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveCurrentData, MediaPlayer::HaveCurrentData);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveFutureData, MediaPlayer::HaveFutureData);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::ReadyStateHaveEnoughData, MediaPlayer::HaveEnoughData);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MovieLoadTypeUnknown, MediaPlayer::Unknown);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MovieLoadTypeDownload, MediaPlayer::Download);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MovieLoadTypeStoredStream, MediaPlayer::StoredStream);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MovieLoadTypeLiveStream, MediaPlayer::LiveStream);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::PreloadNone, MediaPlayer::None);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::PreloadMetaData, MediaPlayer::MetaData);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::PreloadAuto, MediaPlayer::Auto);
+
+#if ENABLE(MEDIA_SOURCE)
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::AddIdStatusOk, MediaPlayer::Ok);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::AddIdStatusNotSupported, MediaPlayer::NotSupported);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::AddIdStatusReachedIdLimit, MediaPlayer::ReachedIdLimit);
+#endif
+
+#if ENABLE(ENCRYPTED_MEDIA)
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::EndOfStreamStatusNoError, MediaPlayer::EosNoError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::EndOfStreamStatusNetworkError, MediaPlayer::EosNetworkError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::EndOfStreamStatusDecodeError, MediaPlayer::EosDecodeError);
#endif
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(ENCRYPTED_MEDIA)
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MediaKeyExceptionNoError, MediaPlayer::NoError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MediaKeyExceptionInvalidPlayerState, MediaPlayer::InvalidPlayerState);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported, MediaPlayer::KeySystemNotSupported);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeUnknown, MediaPlayerClient::UnknownError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeClient, MediaPlayerClient::ClientError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeService, MediaPlayerClient::ServiceError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeOutput, MediaPlayerClient::OutputError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeHardwareChange, MediaPlayerClient::HardwareChangeError);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::MediaKeyErrorCodeDomain, MediaPlayerClient::DomainError);
+#endif
+
+#endif
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionAllowed, NotificationClient::PermissionAllowed);
COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionNotAllowed, NotificationClient::PermissionNotAllowed);
COMPILE_ASSERT_MATCHING_ENUM(WebNotificationPresenter::PermissionDenied, NotificationClient::PermissionDenied);
@@ -424,6 +460,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserContentInjectInTopFrameOnly, InjectInT
COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInExistingDocuments, InjectInExistingDocuments);
COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, InjectInSubsequentDocuments);
+COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionDataError, IDBDatabaseException::DATA_ERR);
+COMPILE_ASSERT_MATCHING_ENUM(WebIDBDatabaseExceptionQuotaError, IDBDatabaseException::QUOTA_ERR);
+
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::InvalidType, IDBKey::InvalidType);
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::ArrayType, IDBKey::ArrayType);
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType);
@@ -431,8 +470,10 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::DateType, IDBKey::DateType);
COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType);
#if ENABLE(FILE_SYSTEM)
-COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary);
-COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent);
+COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, FileSystemTypeTemporary);
+COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, FileSystemTypePersistent);
+COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, FileSystemTypeExternal);
+COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeIsolated, FileSystemTypeIsolated);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory);
@@ -493,16 +534,39 @@ COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, Platfor
COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateVisible);
COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHidden);
COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePrerender, PageVisibilityStatePrerender);
+COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePreview, PageVisibilityStatePreview);
#if ENABLE(MEDIA_STREAM)
COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeAudio, MediaStreamSource::TypeAudio);
COMPILE_ASSERT_MATCHING_ENUM(WebMediaStreamSource::TypeVideo, MediaStreamSource::TypeVideo);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeAll, IceOptions::ALL);
+COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeNoRelay, IceOptions::NO_RELAY);
+COMPILE_ASSERT_MATCHING_ENUM(WebICEOptions::CandidateTypeOnlyRelay, IceOptions::ONLY_RELAY);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00Handler::ActionSDPOffer, PeerConnection00::SDP_OFFER);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00Handler::ActionSDPPRanswer, PeerConnection00::SDP_PRANSWER);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00Handler::ActionSDPAnswer, PeerConnection00::SDP_ANSWER);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateNew, PeerConnection00::NEW);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateOpening, PeerConnection00::OPENING);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateNegotiating, PeerConnection00::OPENING);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateActive, PeerConnection00::ACTIVE);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateClosed, PeerConnection00::CLOSED);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateGathering, PeerConnection00::ICE_GATHERING);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateWaiting, PeerConnection00::ICE_WAITING);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateChecking, PeerConnection00::ICE_CHECKING);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateConnected, PeerConnection00::ICE_CONNECTED);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateCompleted, PeerConnection00::ICE_COMPLETED);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateFailed, PeerConnection00::ICE_FAILED);
+COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateClosed, PeerConnection00::ICE_CLOSED);
#endif
-COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, SecurityPolicy::ReferrerPolicyAlways);
-COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, SecurityPolicy::ReferrerPolicyDefault);
-COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, SecurityPolicy::ReferrerPolicyNever);
-COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, SecurityPolicy::ReferrerPolicyOrigin);
+COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, ReferrerPolicyAlways);
+COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, ReferrerPolicyDefault);
+COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, ReferrerPolicyNever);
+COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, ReferrerPolicyOrigin);
COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeReportOnly, ContentSecurityPolicy::ReportOnly);
COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeEnforcePolicy, ContentSecurityPolicy::EnforcePolicy);
diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
index 0c3a0cf55..f1c2aab30 100644
--- a/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
+++ b/Source/WebKit/chromium/src/AssociatedURLLoader.cpp
@@ -140,6 +140,7 @@ public:
virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/);
virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/);
virtual void didFail(const ResourceError&);
+ virtual void didFailRedirectCheck();
virtual bool isDocumentThreadableLoaderClient() { return true; }
@@ -263,6 +264,11 @@ void AssociatedURLLoader::ClientAdapter::didFail(const ResourceError& error)
notifyError(&m_errorTimer);
}
+void AssociatedURLLoader::ClientAdapter::didFailRedirectCheck()
+{
+ m_loader->cancel();
+}
+
void AssociatedURLLoader::ClientAdapter::setDelayedError(const ResourceError& error)
{
didFail(error);
diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
index 8d8a3fedc..d2026d330 100644
--- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
@@ -51,10 +51,11 @@ namespace WebCore {
namespace {
-// ChromeOS-specific filesystem type.
-const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
+// For isolated filesystem.
+const char isolatedPathPrefix[] = "isolated";
+
+// For external filesystem.
const char externalPathPrefix[] = "external";
-const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
// Specialized callback class for createSnapshotFileAndReadMetadata.
class SnapshotFileCallbacks : public AsyncFileSystemCallbacks {
@@ -101,7 +102,7 @@ bool AsyncFileSystem::isAvailable()
}
// static
-bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
+bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath)
{
if (!url.protocolIs("filesystem"))
return false;
@@ -109,51 +110,26 @@ bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type&
if (url.innerURL()) {
String typeString = url.innerURL()->path().substring(1);
if (typeString == temporaryPathPrefix)
- type = Temporary;
+ type = FileSystemTypeTemporary;
else if (typeString == persistentPathPrefix)
- type = Persistent;
+ type = FileSystemTypePersistent;
else if (typeString == externalPathPrefix)
- type = externalType;
+ type = FileSystemTypeExternal;
else
return false;
filePath = decodeURLEscapeSequences(url.path());
- } else {
- // FIXME: Remove this clause once http://codereview.chromium.org/7811006
- // lands, which makes this dead code.
- KURL originURL(ParsedURLString, url.path());
- String path = decodeURLEscapeSequences(originURL.path());
- if (path.isEmpty() || path[0] != '/')
- return false;
- path = path.substring(1);
-
- if (path.startsWith(temporaryPathPrefix)) {
- type = Temporary;
- path = path.substring(temporaryPathPrefixLength);
- } else if (path.startsWith(persistentPathPrefix)) {
- type = Persistent;
- path = path.substring(persistentPathPrefixLength);
- } else if (path.startsWith(externalPathPrefix)) {
- type = externalType;
- path = path.substring(externalPathPrefixLength);
- } else
- return false;
-
- if (path.isEmpty() || path[0] != '/')
- return false;
-
- filePath.swap(path);
}
return true;
}
// static
-bool AsyncFileSystem::isValidType(Type type)
+bool AsyncFileSystem::isValidType(FileSystemType type)
{
- return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal);
+ return type == FileSystemTypeTemporary || type == FileSystemTypePersistent || type == FileSystemTypeExternal;
}
-AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL)
+AsyncFileSystemChromium::AsyncFileSystemChromium(FileSystemType type, const KURL& rootURL)
: AsyncFileSystem(type)
, m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem())
, m_filesystemRootURL(rootURL)
@@ -161,17 +137,50 @@ AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, con
ASSERT(m_webFileSystem);
}
+// static
+String AsyncFileSystemChromium::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
+{
+ StringBuilder filesystemName;
+ filesystemName.append(storageIdentifier);
+ filesystemName.append(":");
+ filesystemName.append(isolatedPathPrefix);
+ filesystemName.append("_");
+ filesystemName.append(filesystemId);
+ return filesystemName.toString();
+}
+
+// static
+PassOwnPtr<AsyncFileSystem> AsyncFileSystemChromium::createIsolatedFileSystem(const String& originString, const String& filesystemId)
+{
+ // The rootURL is used in succeeding filesystem requests sent to the
+ // chromium and is validated each time in the browser process.
+ StringBuilder rootURL;
+ rootURL.append("filesystem:");
+ rootURL.append(originString);
+ rootURL.append("/");
+ rootURL.append(isolatedPathPrefix);
+ rootURL.append("/");
+ rootURL.append(filesystemId);
+ rootURL.append("/");
+
+ return AsyncFileSystemChromium::create(FileSystemTypeIsolated, KURL(ParsedURLString, rootURL.toString()));
+}
+
AsyncFileSystemChromium::~AsyncFileSystemChromium()
{
}
-String AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath)
+KURL AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath) const
{
ASSERT(!originString.isEmpty());
if (originString == "null")
- return String();
+ return KURL();
+
+ // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue).
+ if (type() == FileSystemTypeIsolated)
+ return KURL();
- if (type() == externalType) {
+ if (type() == FileSystemTypeExternal) {
// For external filesystem originString could be different from what we have in m_filesystemRootURL.
StringBuilder result;
result.append("filesystem:");
@@ -179,12 +188,12 @@ String AsyncFileSystemChromium::toURL(const String& originString, const String&
result.append("/");
result.append(externalPathPrefix);
result.append(encodeWithURLEscapeSequences(fullPath));
- return result.toString();
+ return KURL(ParsedURLString, result.toString());
}
// For regular types we can just call virtualPathToFileSystemURL which appends the fullPath to the m_filesystemRootURL that should look like 'filesystem:<origin>/<typePrefix>'.
ASSERT(SecurityOrigin::create(m_filesystemRootURL)->toString() == originString);
- return virtualPathToFileSystemURL(fullPath);
+ return KURL(ParsedURLString, virtualPathToFileSystemURL(fullPath));
}
void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h
index 8255d8e72..e827855a0 100644
--- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.h
+++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.h
@@ -47,14 +47,17 @@ class KURL;
class AsyncFileSystemChromium : public AsyncFileSystem {
public:
- static PassOwnPtr<AsyncFileSystem> create(AsyncFileSystem::Type type, const KURL& rootURL)
+ static PassOwnPtr<AsyncFileSystem> create(FileSystemType type, const KURL& rootURL)
{
return adoptPtr(new AsyncFileSystemChromium(type, rootURL));
}
+ static String createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId);
+ static PassOwnPtr<AsyncFileSystem> createIsolatedFileSystem(const String& originString, const String& filesystemId);
+
virtual ~AsyncFileSystemChromium();
- virtual String toURL(const String& originString, const String& fullPath);
+ virtual KURL toURL(const String& originString, const String& fullPath) const;
virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
@@ -69,7 +72,7 @@ public:
virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
protected:
- AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL);
+ AsyncFileSystemChromium(FileSystemType, const KURL& rootURL);
PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const;
diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
index 6c82385c8..44558de87 100644
--- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
+++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp
@@ -32,9 +32,12 @@
#include "AudioDestinationChromium.h"
+#include "AudioPullFIFO.h"
#include "WebKit.h"
#include "platform/WebKitPlatformSupport.h"
+#include <public/Platform.h>
+
using namespace WebKit;
namespace WebCore {
@@ -61,14 +64,14 @@ AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider
, m_isPlaying(false)
{
// Use the optimal buffer size recommended by the audio backend.
- m_callbackBufferSize = webKitPlatformSupport()->audioHardwareBufferSize();
+ m_callbackBufferSize = WebKit::Platform::current()->audioHardwareBufferSize();
// Quick exit if the requested size is too large.
ASSERT(m_callbackBufferSize + renderBufferSize <= fifoSize);
if (m_callbackBufferSize + renderBufferSize > fifoSize)
return;
- m_audioDevice = adoptPtr(webKitPlatformSupport()->createAudioDevice(m_callbackBufferSize, numberOfChannels, sampleRate, this));
+ m_audioDevice = adoptPtr(WebKit::Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfChannels, sampleRate, this));
ASSERT(m_audioDevice);
// Create a FIFO to handle the possibility of the callback size
@@ -76,7 +79,7 @@ AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider
// contains enough data, the data will be provided directly.
// Otherwise, the FIFO will call the provider enough times to
// satisfy the request for data.
- m_fifo = adoptPtr(new FIFO(provider, numberOfChannels, fifoSize, renderBufferSize));
+ m_fifo = adoptPtr(new AudioPullFIFO(provider, numberOfChannels, fifoSize, renderBufferSize));
}
AudioDestinationChromium::~AudioDestinationChromium()
@@ -102,7 +105,7 @@ void AudioDestinationChromium::stop()
float AudioDestination::hardwareSampleRate()
{
- return static_cast<float>(webKitPlatformSupport()->audioHardwareSampleRate());
+ return static_cast<float>(WebKit::Platform::current()->audioHardwareSampleRate());
}
// Pulls on our provider to get the rendered audio stream.
@@ -125,125 +128,6 @@ void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t
m_fifo->consume(&m_renderBus, numberOfFrames);
}
-AudioDestinationChromium::FIFO::FIFO(AudioSourceProvider& provider, unsigned numberOfChannels, size_t fifoLength, size_t providerSize)
- : m_provider(provider)
- , m_fifoAudioBus(numberOfChannels, fifoLength)
- , m_fifoLength(fifoLength)
- , m_framesInFifo(0)
- , m_readIndex(0)
- , m_writeIndex(0)
- , m_providerSize(providerSize)
- , m_tempBus(numberOfChannels, providerSize)
-{
-}
-
-void AudioDestinationChromium::FIFO::consume(AudioBus* destination, size_t framesToConsume)
-{
- bool isGood = destination && (framesToConsume <= m_fifoLength);
- ASSERT(isGood);
- if (!isGood)
- return;
-
- if (framesToConsume > m_framesInFifo) {
- // We don't have enough data in the FIFO to fulfill the
- // request. Ask for more data.
- fillBuffer(framesToConsume - m_framesInFifo);
- }
-
- // We have enough data now. Copy the requested number of samples
- // to the destination.
-
- size_t part1Length;
- size_t part2Length;
- findWrapLengths(m_readIndex, framesToConsume, part1Length, part2Length);
-
- size_t numberOfChannels = m_fifoAudioBus.numberOfChannels();
-
- for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
- float* destinationData = destination->channel(channelIndex)->mutableData();
- const float* sourceData = m_fifoAudioBus.channel(channelIndex)->data();
-
- bool isCopyGood = ((m_readIndex < m_fifoLength)
- && (m_readIndex + part1Length) <= m_fifoLength
- && (part1Length <= destination->length())
- && (part1Length + part2Length) <= destination->length());
- ASSERT(isCopyGood);
- if (!isCopyGood)
- return;
-
- memcpy(destinationData, sourceData + m_readIndex, part1Length * sizeof(*sourceData));
- // Handle wrap around of the FIFO, if needed.
- if (part2Length > 0)
- memcpy(destinationData + part1Length, sourceData, part2Length * sizeof(*sourceData));
- }
- m_readIndex = updateIndex(m_readIndex, framesToConsume);
- m_framesInFifo -= framesToConsume;
- ASSERT(m_framesInFifo >= 0);
-}
-
-void AudioDestinationChromium::FIFO::findWrapLengths(size_t index, size_t size, size_t& part1Length, size_t& part2Length)
-{
- ASSERT(index < m_fifoLength && size <= m_fifoLength);
- if (index < m_fifoLength && size <= m_fifoLength) {
- if (index + size > m_fifoLength) {
- // Need to wrap. Figure out the length of each piece.
- part1Length = m_fifoLength - index;
- part2Length = size - part1Length;
- } else {
- // No wrap needed.
- part1Length = size;
- part2Length = 0;
- }
- } else {
- // Invalid values for index or size. Set the part lengths to
- // zero so nothing is copied.
- part1Length = 0;
- part2Length = 0;
- }
-}
-
-void AudioDestinationChromium::FIFO::fillBuffer(size_t numberOfFrames)
-{
- // Keep asking the provider to give us data until we have received
- // at least |numberOfFrames| of data. Stuff the data into the
- // FIFO.
- size_t framesProvided = 0;
-
- while (framesProvided < numberOfFrames) {
- m_provider.provideInput(&m_tempBus, m_providerSize);
-
- size_t part1Length;
- size_t part2Length;
- findWrapLengths(m_writeIndex, m_providerSize, part1Length, part2Length);
-
- size_t numberOfChannels = m_fifoAudioBus.numberOfChannels();
-
- for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
- float* destination = m_fifoAudioBus.channel(channelIndex)->mutableData();
- const float* source = m_tempBus.channel(channelIndex)->data();
-
- bool isCopyGood = (part1Length <= m_providerSize
- && (part1Length + part2Length) <= m_providerSize
- && (m_writeIndex < m_fifoLength)
- && (m_writeIndex + part1Length) <= m_fifoLength
- && part2Length < m_fifoLength);
- ASSERT(isCopyGood);
- if (!isCopyGood)
- return;
-
- memcpy(destination + m_writeIndex, source, part1Length * sizeof(*destination));
- // Handle wrap around of the FIFO, if needed.
- if (part2Length > 0)
- memcpy(destination, source + part1Length, part2Length * sizeof(*destination));
- }
-
- m_framesInFifo += m_providerSize;
- ASSERT(m_framesInFifo <= m_fifoLength);
- m_writeIndex = updateIndex(m_writeIndex, m_providerSize);
- framesProvided += m_providerSize;
- }
-}
-
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.h b/Source/WebKit/chromium/src/AudioDestinationChromium.h
index 3d1af2a1a..dfe5ebd7c 100644
--- a/Source/WebKit/chromium/src/AudioDestinationChromium.h
+++ b/Source/WebKit/chromium/src/AudioDestinationChromium.h
@@ -39,6 +39,8 @@ namespace WebKit { class WebAudioDevice; }
namespace WebCore {
+class AudioPullFIFO;
+
// An AudioDestination using Chromium's audio system
class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback {
@@ -56,64 +58,13 @@ public:
virtual void render(const WebKit::WebVector<float*>& audioData, size_t numberOfFrames);
private:
- // A FIFO (First In First Out) buffer to handle mismatches in the
- // audio backend hardware buffer size and the Web Audio render size.
- class FIFO {
- public:
- // Create a FIFO that gets data from |provider|. The FIFO will
- // be large enough to hold |fifoLength| frames of data of
- // |numberOfChannels| channels. The AudioSourceProvider will
- // be asked to produce |providerSize| frames when the FIFO
- // needs more data.
- FIFO(AudioSourceProvider& provider, unsigned numberOfChannels, size_t fifoLength, size_t providerSize);
-
- // Read |framesToConsume| frames from the FIFO into the
- // destination. If the FIFO does not have enough data, we ask
- // the |provider| to get more data to fulfill the request.
- void consume(AudioBus* destination, size_t framesToConsume);
-
- private:
- // Update the FIFO index by the step, with appropriate
- // wrapping around the endpoint.
- int updateIndex(int index, int step) { return (index + step) % m_fifoLength; }
-
- void findWrapLengths(size_t index, size_t providerSize, size_t& part1Length, size_t& part2Length);
-
- // Fill the FIFO buffer with at least |numberOfFrames| more data.
- void fillBuffer(size_t numberOfFrames);
-
- // The provider of the data in our FIFO.
- AudioSourceProvider& m_provider;
-
- // The FIFO itself. In reality, the FIFO is a circular buffer.
- AudioBus m_fifoAudioBus;
-
- // The total available space in the FIFO.
- size_t m_fifoLength;
-
- // The number of actual elements in the FIFO
- size_t m_framesInFifo;
-
- // Where to start reading from the FIFO.
- size_t m_readIndex;
-
- // Where to start writing to the FIFO.
- size_t m_writeIndex;
-
- // Number of frames of data that the provider will produce per call.
- unsigned int m_providerSize;
-
- // Temporary workspace to hold the data from the provider.
- AudioBus m_tempBus;
- };
-
-AudioSourceProvider& m_provider;
+ AudioSourceProvider& m_provider;
AudioBus m_renderBus;
float m_sampleRate;
bool m_isPlaying;
OwnPtr<WebKit::WebAudioDevice> m_audioDevice;
size_t m_callbackBufferSize;
- OwnPtr<FIFO> m_fifo;
+ OwnPtr<AudioPullFIFO> m_fifo;
};
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp
index c84ea12f6..4e643029a 100644
--- a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp
+++ b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp
@@ -32,7 +32,6 @@
#include "AutofillPopupMenuClient.h"
#include "CSSFontSelector.h"
-#include "CSSStyleSelector.h"
#include "CSSValueKeywords.h"
#include "Chrome.h"
#include "Frame.h"
@@ -40,6 +39,7 @@
#include "HTMLInputElement.h"
#include "Page.h"
#include "RenderTheme.h"
+#include "StyleResolver.h"
#include "WebAutofillClient.h"
#include "WebNode.h"
#include "WebViewClient.h"
@@ -52,9 +52,9 @@ using namespace WebCore;
namespace WebKit {
AutofillPopupMenuClient::AutofillPopupMenuClient()
- : m_separatorIndex(-1)
- , m_selectedIndex(-1)
+ : m_selectedIndex(-1)
, m_textField(0)
+ , m_useLegacyBehavior(false)
{
}
@@ -64,37 +64,25 @@ AutofillPopupMenuClient::~AutofillPopupMenuClient()
unsigned AutofillPopupMenuClient::getSuggestionsCount() const
{
- return m_names.size() + ((m_separatorIndex == -1) ? 0 : 1);
+ return m_names.size();
}
WebString AutofillPopupMenuClient::getSuggestion(unsigned listIndex) const
{
- int index = convertListIndexToInternalIndex(listIndex);
- if (index == -1)
- return WebString();
-
- ASSERT(index >= 0 && static_cast<size_t>(index) < m_names.size());
- return m_names[index];
+ ASSERT(listIndex < m_names.size());
+ return m_names[listIndex];
}
WebString AutofillPopupMenuClient::getLabel(unsigned listIndex) const
{
- int index = convertListIndexToInternalIndex(listIndex);
- if (index == -1)
- return WebString();
-
- ASSERT(index >= 0 && static_cast<size_t>(index) < m_labels.size());
- return m_labels[index];
+ ASSERT(listIndex < m_labels.size());
+ return m_labels[listIndex];
}
WebString AutofillPopupMenuClient::getIcon(unsigned listIndex) const
{
- int index = convertListIndexToInternalIndex(listIndex);
- if (index == -1)
- return WebString();
-
- ASSERT(index >= 0 && static_cast<size_t>(index) < m_icons.size());
- return m_icons[index];
+ ASSERT(listIndex < m_icons.size());
+ return m_icons[listIndex];
}
void AutofillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
@@ -102,26 +90,17 @@ void AutofillPopupMenuClient::removeSuggestionAtIndex(unsigned listIndex)
if (!canRemoveSuggestionAtIndex(listIndex))
return;
- int index = convertListIndexToInternalIndex(listIndex);
-
- ASSERT(static_cast<unsigned>(index) < m_names.size());
-
- m_names.remove(index);
- m_labels.remove(index);
- m_icons.remove(index);
- m_uniqueIDs.remove(index);
+ ASSERT(listIndex < m_names.size());
- // Shift the separator index if necessary.
- if (m_separatorIndex != -1)
- m_separatorIndex--;
+ m_names.remove(listIndex);
+ m_labels.remove(listIndex);
+ m_icons.remove(listIndex);
+ m_itemIDs.remove(listIndex);
}
bool AutofillPopupMenuClient::canRemoveSuggestionAtIndex(unsigned listIndex)
{
- // Only allow deletion of items before the separator that have unique id 0
- // (i.e. are autocomplete rather than autofill items).
- int index = convertListIndexToInternalIndex(listIndex);
- return !m_uniqueIDs[index] && (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex));
+ return m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDAutocompleteEntry || m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDPasswordEntry;
}
void AutofillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
@@ -130,15 +109,22 @@ void AutofillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents)
if (!webView)
return;
- if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex))
- --listIndex;
-
ASSERT(listIndex < m_names.size());
+ if (m_useLegacyBehavior) {
+ for (size_t i = 0; i < m_itemIDs.size(); ++i) {
+ if (m_itemIDs[i] == WebAutofillClient::MenuItemIDSeparator) {
+ if (listIndex > i)
+ listIndex--;
+ break;
+ }
+ }
+ }
+
webView->autofillClient()->didAcceptAutofillSuggestion(WebNode(getTextField()),
m_names[listIndex],
m_labels[listIndex],
- m_uniqueIDs[listIndex],
+ m_itemIDs[listIndex],
listIndex);
}
@@ -148,15 +134,12 @@ void AutofillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEven
if (!webView)
return;
- if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex))
- --listIndex;
-
ASSERT(listIndex < m_names.size());
webView->autofillClient()->didSelectAutofillSuggestion(WebNode(getTextField()),
m_names[listIndex],
m_labels[listIndex],
- m_uniqueIDs[listIndex]);
+ m_itemIDs[listIndex]);
}
void AutofillPopupMenuClient::selectionCleared()
@@ -228,17 +211,12 @@ void AutofillPopupMenuClient::popupDidHide()
bool AutofillPopupMenuClient::itemIsSeparator(unsigned listIndex) const
{
- return (m_separatorIndex != -1 && static_cast<unsigned>(m_separatorIndex) == listIndex);
+ return m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDSeparator;
}
bool AutofillPopupMenuClient::itemIsWarning(unsigned listIndex) const
{
- int index = convertListIndexToInternalIndex(listIndex);
- if (index == -1)
- return false;
-
- ASSERT(index >= 0 && static_cast<size_t>(index) < m_uniqueIDs.size());
- return m_uniqueIDs[index] < 0;
+ return m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDWarningMessage;
}
void AutofillPopupMenuClient::setTextFromItem(unsigned listIndex)
@@ -248,7 +226,7 @@ void AutofillPopupMenuClient::setTextFromItem(unsigned listIndex)
FontSelector* AutofillPopupMenuClient::fontSelector() const
{
- return m_textField->document()->styleSelector()->fontSelector();
+ return m_textField->document()->styleResolver()->fontSelector();
}
HostWindow* AutofillPopupMenuClient::hostWindow() const
@@ -269,20 +247,36 @@ void AutofillPopupMenuClient::initialize(
const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
+ const WebVector<int>& itemIDs,
int separatorIndex)
{
ASSERT(names.size() == labels.size());
ASSERT(names.size() == icons.size());
- ASSERT(names.size() == uniqueIDs.size());
- ASSERT(separatorIndex < static_cast<int>(names.size()));
+ ASSERT(names.size() == itemIDs.size());
m_selectedIndex = -1;
m_textField = textField;
- // The suggestions must be set before initializing the
- // AutofillPopupMenuClient.
- setSuggestions(names, labels, icons, uniqueIDs, separatorIndex);
+ if (separatorIndex == -1) {
+ // The suggestions must be set before initializing the
+ // AutofillPopupMenuClient.
+ setSuggestions(names, labels, icons, itemIDs);
+ } else {
+ m_useLegacyBehavior = true;
+ WebVector<WebString> namesWithSeparator(names.size() + 1);
+ WebVector<WebString> labelsWithSeparator(labels.size() + 1);
+ WebVector<WebString> iconsWithSeparator(icons.size() + 1);
+ WebVector<int> itemIDsWithSeparator(itemIDs.size() + 1);
+ for (size_t i = 0; i < names.size(); ++i) {
+ size_t j = i < static_cast<size_t>(separatorIndex) ? i : i + 1;
+ namesWithSeparator[j] = names[i];
+ labelsWithSeparator[j] = labels[i];
+ iconsWithSeparator[j] = icons[i];
+ itemIDsWithSeparator[j] = itemIDs[i];
+ }
+ itemIDsWithSeparator[separatorIndex] = WebAutofillClient::MenuItemIDSeparator;
+ setSuggestions(namesWithSeparator, labelsWithSeparator, iconsWithSeparator, itemIDsWithSeparator);
+ }
FontDescription regularFontDescription;
RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl,
@@ -291,7 +285,7 @@ void AutofillPopupMenuClient::initialize(
regularFontDescription.setComputedSize(style->fontDescription().computedSize());
Font regularFont(regularFontDescription, 0, 0);
- regularFont.update(textField->document()->styleSelector()->fontSelector());
+ regularFont.update(textField->document()->styleResolver()->fontSelector());
// The direction of text in popup menu is set the same as the direction of
// the input element: textField.
m_regularStyle = adoptPtr(new PopupMenuStyle(Color::black, Color::white, regularFont, true, false,
@@ -313,42 +307,28 @@ void AutofillPopupMenuClient::initialize(
void AutofillPopupMenuClient::setSuggestions(const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
- int separatorIndex)
+ const WebVector<int>& itemIDs)
{
ASSERT(names.size() == labels.size());
ASSERT(names.size() == icons.size());
- ASSERT(names.size() == uniqueIDs.size());
- ASSERT(separatorIndex < static_cast<int>(names.size()));
+ ASSERT(names.size() == itemIDs.size());
m_names.clear();
m_labels.clear();
m_icons.clear();
- m_uniqueIDs.clear();
+ m_itemIDs.clear();
for (size_t i = 0; i < names.size(); ++i) {
m_names.append(names[i]);
m_labels.append(labels[i]);
m_icons.append(icons[i]);
- m_uniqueIDs.append(uniqueIDs[i]);
+ m_itemIDs.append(itemIDs[i]);
}
- m_separatorIndex = separatorIndex;
-
// Try to preserve selection if possible.
if (getSelectedIndex() >= static_cast<int>(names.size()))
setSelectedIndex(-1);
}
-int AutofillPopupMenuClient::convertListIndexToInternalIndex(unsigned listIndex) const
-{
- if (listIndex == static_cast<unsigned>(m_separatorIndex))
- return -1;
-
- if (m_separatorIndex == -1 || listIndex < static_cast<unsigned>(m_separatorIndex))
- return listIndex;
- return listIndex - 1;
-}
-
WebViewImpl* AutofillPopupMenuClient::getWebView() const
{
Frame* frame = m_textField->document()->frame();
diff --git a/Source/WebKit/chromium/src/AutofillPopupMenuClient.h b/Source/WebKit/chromium/src/AutofillPopupMenuClient.h
index 73cc180e0..588e19bec 100644
--- a/Source/WebKit/chromium/src/AutofillPopupMenuClient.h
+++ b/Source/WebKit/chromium/src/AutofillPopupMenuClient.h
@@ -106,20 +106,15 @@ public:
const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
+ const WebVector<int>& itemIDs,
int separatorIndex);
void setSuggestions(const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
- int separatorIndex);
+ const WebVector<int>& itemIDs);
private:
- // Convert the specified index from an index into the visible list (which might
- // include a separator entry) to an index to |m_names| and |m_labels|.
- // Returns -1 if the given index points to the separator.
- int convertListIndexToInternalIndex(unsigned) const;
WebViewImpl* getWebView() const;
WebCore::HTMLInputElement* getTextField() const { return m_textField.get(); }
WebCore::RenderStyle* textFieldStyle() const;
@@ -133,10 +128,7 @@ private:
Vector<WTF::String> m_names;
Vector<WTF::String> m_labels;
Vector<WTF::String> m_icons;
- Vector<int> m_uniqueIDs;
-
- // The index of the separator. -1 if there is no separator.
- int m_separatorIndex;
+ Vector<int> m_itemIDs;
// The index of the selected item. -1 if there is no selected item.
int m_selectedIndex;
@@ -144,6 +136,9 @@ private:
RefPtr<WebCore::HTMLInputElement> m_textField;
OwnPtr<WebCore::PopupMenuStyle> m_regularStyle;
OwnPtr<WebCore::PopupMenuStyle> m_warningStyle;
+
+ // Use legacy behavior while the chromium side hasn't been updated.
+ bool m_useLegacyBehavior;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp b/Source/WebKit/chromium/src/BatteryClientImpl.cpp
index 99f636d53..136c9123d 100644
--- a/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp
+++ b/Source/WebKit/chromium/src/BatteryClientImpl.cpp
@@ -29,46 +29,54 @@
*/
#include "config.h"
+#include "BatteryClientImpl.h"
-#if ENABLE(MEDIA_STREAM)
+#if ENABLE(BATTERY_STATUS)
-#include "MediaStreamCenter.h"
+#include "BatteryController.h"
+#include "BatteryStatus.h"
+#include "EventNames.h"
+#include "WebBatteryStatusClient.h"
+#include <wtf/RefPtr.h>
-#include "MediaStreamCenterInternal.h"
-#include "MediaStreamDescriptor.h"
-#include <wtf/PassOwnPtr.h>
+namespace WebKit {
-namespace WebCore {
-
-MediaStreamCenter::MediaStreamCenter()
- : m_private(adoptPtr(new MediaStreamCenterInternal(this)))
+BatteryClientImpl::BatteryClientImpl(WebBatteryStatusClient* client)
+ : m_client(client)
+ , m_controller(0)
{
}
-MediaStreamCenter::~MediaStreamCenter()
+void BatteryClientImpl::updateBatteryStatus(const WebBatteryStatus& batteryStatus)
{
+ if (m_controller) {
+ RefPtr<WebCore::BatteryStatus> status = WebCore::BatteryStatus::create(batteryStatus.charging, batteryStatus.chargingTime, batteryStatus.dischargingTime, batteryStatus.level);
+ m_controller->updateBatteryStatus(status);
+ }
}
-void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
+void BatteryClientImpl::setController(WebCore::BatteryController* controller)
{
- m_private->queryMediaStreamSources(client);
+ m_controller = controller;
}
-void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
+void BatteryClientImpl::startUpdating()
{
- m_private->didSetMediaStreamTrackEnabled(stream, component);
+ if (m_client)
+ m_client->startUpdating();
}
-void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
+void BatteryClientImpl::stopUpdating()
{
- m_private->didStopLocalMediaStream(stream);
+ if (m_client)
+ m_client->stopUpdating();
}
-void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor* stream)
+void BatteryClientImpl::batteryControllerDestroyed()
{
- m_private->didConstructMediaStream(stream);
+ m_controller = 0;
}
-} // namespace WebCore
+} // namespace WebKit
-#endif // ENABLE(MEDIA_STREAM)
+#endif // ENABLE(BATTERY_STATUS)
diff --git a/Source/WebKit/chromium/src/WebStorageNamespaceImpl.h b/Source/WebKit/chromium/src/BatteryClientImpl.h
index 10406c127..a3b1fa5d8 100644
--- a/Source/WebKit/chromium/src/WebStorageNamespaceImpl.h
+++ b/Source/WebKit/chromium/src/BatteryClientImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,26 +28,38 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebStorageNamespaceImpl_h
-#define WebStorageNamespaceImpl_h
+#ifndef BatteryClientImpl_h
+#define BatteryClientImpl_h
-#include "StorageNamespaceImpl.h"
-#include "WebStorageNamespace.h"
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryClient.h"
+#include "WebBatteryStatus.h"
namespace WebKit {
-class WebStorageNamespaceImpl : public WebStorageNamespace {
+class WebBatteryStatusClient;
+
+class BatteryClientImpl : public WebCore::BatteryClient {
public:
- WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace);
- virtual ~WebStorageNamespaceImpl();
- virtual WebStorageArea* createStorageArea(const WebString& origin);
- virtual WebStorageNamespace* copy();
- virtual void close();
+ explicit BatteryClientImpl(WebBatteryStatusClient*);
+ virtual ~BatteryClientImpl() { }
+
+ void updateBatteryStatus(const WebBatteryStatus&);
+
+ // WebCore::BatteryClient methods:
+ virtual void setController(WebCore::BatteryController*) OVERRIDE;
+ virtual void startUpdating() OVERRIDE;
+ virtual void stopUpdating() OVERRIDE;
+ virtual void batteryControllerDestroyed() OVERRIDE;
private:
- RefPtr<WebCore::StorageNamespace> m_storageNamespace;
+ WebBatteryStatusClient* m_client;
+ WebCore::BatteryController* m_controller;
};
-} // namespace WebKit
+} // namespce WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
-#endif // WebStorageNamespaceImpl_h
+#endif // BatteryClientImpl_h
diff --git a/Source/WebKit/chromium/src/BlobRegistryProxy.h b/Source/WebKit/chromium/src/BlobRegistryProxy.h
index 6f2ebb254..05c854f5b 100644
--- a/Source/WebKit/chromium/src/BlobRegistryProxy.h
+++ b/Source/WebKit/chromium/src/BlobRegistryProxy.h
@@ -47,7 +47,6 @@ public:
virtual void registerBlobURL(const KURL&, const KURL& srcURL);
virtual void unregisterBlobURL(const KURL&);
- virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) { return 0; }
virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) { return false; }
private:
diff --git a/Source/WebKit/chromium/src/CCThreadImpl.cpp b/Source/WebKit/chromium/src/CCThreadImpl.cpp
index 1c9a447ac..ef7bb5cb3 100644
--- a/Source/WebKit/chromium/src/CCThreadImpl.cpp
+++ b/Source/WebKit/chromium/src/CCThreadImpl.cpp
@@ -103,7 +103,7 @@ ThreadIdentifier CCThreadImpl::threadID() const
CCThreadImpl::CCThreadImpl(WebThread* thread)
: m_thread(thread)
{
- if (thread == webKitPlatformSupport()->currentThread()) {
+ if (thread == WebKit::Platform::current()->currentThread()) {
m_threadID = currentThread();
return;
}
diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
index ad35382b9..fac80d993 100644
--- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -34,7 +34,7 @@
#include "AXObjectCache.h"
#include "AccessibilityObject.h"
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
#include "ColorChooser.h"
#include "ColorChooserClient.h"
#include "ColorChooserProxy.h"
@@ -51,8 +51,8 @@
#include "FrameLoadRequest.h"
#include "FrameView.h"
#include "Geolocation.h"
-#include "GeolocationService.h"
#include "GraphicsLayer.h"
+#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "Icon.h"
@@ -69,11 +69,12 @@
#include "SearchPopupMenuChromium.h"
#include "SecurityOrigin.h"
#include "Settings.h"
+#include "TextFieldDecorationElement.h"
#if USE(V8)
#include "V8Proxy.h"
#endif
#include "WebAccessibilityObject.h"
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
#include "WebColorChooser.h"
#include "WebColorChooserClientImpl.h"
#endif
@@ -100,6 +101,7 @@
#include "WebWindowFeatures.h"
#include "WindowFeatures.h"
#include "WrappedResourceRequest.h"
+#include <public/Platform.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringConcatenate.h>
#include <wtf/unicode/CharacterNames.h>
@@ -316,7 +318,7 @@ WebNavigationPolicy ChromeClientImpl::getNavigationPolicy()
policy = WebNavigationPolicyNewBackgroundTab;
return policy;
}
-
+
void ChromeClientImpl::show()
{
if (!m_webView->client())
@@ -640,14 +642,16 @@ void ChromeClientImpl::setToolTip(const String& tooltipText, TextDirection dir)
void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
{
#if ENABLE(VIEWPORT)
- if (!m_webView->isFixedLayoutModeEnabled() || !m_webView->client() || !m_webView->page())
+ if (!m_webView->settings()->viewportEnabled() || !m_webView->isFixedLayoutModeEnabled() || !m_webView->client() || !m_webView->page())
return;
+ bool useDefaultDeviceScaleFactor = false;
ViewportArguments args;
- if (arguments == args)
+ if (arguments == args) {
// Default viewport arguments passed in. This is a signal to reset the viewport.
args.width = ViewportArguments::ValueDesktopWidth;
- else
+ useDefaultDeviceScaleFactor = true;
+ } else
args = arguments;
FrameView* frameView = m_webView->mainFrameImpl()->frameView();
@@ -672,7 +676,10 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen
// FIXME: Investigate the impact this has on layout/rendering if any.
// This exposes the correct device scale to javascript and media queries.
- m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
+ if (useDefaultDeviceScaleFactor && settings->defaultDeviceScaleFactor())
+ m_webView->setDeviceScaleFactor(settings->defaultDeviceScaleFactor());
+ else
+ m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale);
m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio);
#endif
@@ -699,7 +706,7 @@ void ChromeClientImpl::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64
ASSERT_NOT_REACHED();
}
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
PassOwnPtr<ColorChooser> ChromeClientImpl::createColorChooser(ColorChooserClient* chooserClient, const Color& initialColor)
{
WebViewClient* client = m_webView->client();
@@ -772,6 +779,22 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,
const IntRect& bounds,
bool handleExternally)
{
+ // For Autofill popups, if the popup will not be fully visible, we shouldn't
+ // show it at all. Among other things, this prevents users from being able
+ // to interact via the keyboard with an invisible popup.
+ if (popupContainer->popupType() == PopupContainer::Suggestion) {
+ FrameView* view = m_webView->page()->mainFrame()->view();
+ IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */);
+ // |bounds| is in screen coordinates, so make sure to convert it to
+ // content coordinates prior to comparing to |visibleRect|.
+ IntRect screenRect = bounds;
+ screenRect.setLocation(view->screenToContents(bounds.location()));
+ if (!visibleRect.contains(screenRect)) {
+ m_webView->hideAutofillPopup();
+ return;
+ }
+ }
+
if (!m_webView->client())
return;
@@ -888,20 +911,6 @@ bool ChromeClientImpl::paintCustomOverhangArea(GraphicsContext* context, const I
return false;
}
-// FIXME: Remove ChromeClientImpl::requestGeolocationPermissionForFrame and ChromeClientImpl::cancelGeolocationPermissionRequestForFrame
-// once all ports have moved to client-based geolocation (see https://bugs.webkit.org/show_bug.cgi?id=40373 ).
-// For client-based geolocation, these methods are now implemented as WebGeolocationClient::requestPermission and WebGeolocationClient::cancelPermissionRequest.
-// (see https://bugs.webkit.org/show_bug.cgi?id=50061 ).
-void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
-{
- ASSERT_NOT_REACHED();
-}
-
-void ChromeClientImpl::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocation* geolocation)
-{
- ASSERT_NOT_REACHED();
-}
-
#if USE(ACCELERATED_COMPOSITING)
void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
{
@@ -984,7 +993,7 @@ bool ChromeClientImpl::selectItemAlignmentFollowsMenuWritingDirection()
bool ChromeClientImpl::hasOpenedPopup() const
{
- return !!m_webView->selectPopup();
+ return m_webView->hasOpenedPopup();
}
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
@@ -1000,6 +1009,41 @@ PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuCli
return adoptRef(new SearchPopupMenuChromium(client));
}
+#if ENABLE(PAGE_POPUP)
+PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView)
+{
+ return m_webView->openPagePopup(client, originBoundsInRootView);
+}
+
+void ChromeClientImpl::closePagePopup(PagePopup* popup)
+{
+ m_webView->closePagePopup(popup);
+}
+#endif
+
+bool ChromeClientImpl::willAddTextFieldDecorationsTo(HTMLInputElement* input)
+{
+ ASSERT(input);
+ const Vector<OwnPtr<TextFieldDecorator> >& decorators = m_webView->textFieldDecorators();
+ for (unsigned i = 0; i < decorators.size(); ++i) {
+ if (decorators[i]->willAddDecorationTo(input))
+ return true;
+ }
+ return false;
+}
+
+void ChromeClientImpl::addTextFieldDecorationsTo(HTMLInputElement* input)
+{
+ ASSERT(willAddTextFieldDecorationsTo(input));
+ const Vector<OwnPtr<TextFieldDecorator> >& decorators = m_webView->textFieldDecorators();
+ for (unsigned i = 0; i < decorators.size(); ++i) {
+ if (!decorators[i]->willAddDecorationTo(input))
+ continue;
+ RefPtr<TextFieldDecorationElement> decoration = TextFieldDecorationElement::create(input->document(), decorators[i].get());
+ decoration->decorate(input);
+ }
+}
+
bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, FrameLoader::PageDismissalType dismissalType) const
{
const char* kDialogs[] = {"alert", "confirm", "prompt", "showModalDialog"};
@@ -1010,7 +1054,7 @@ bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType&
int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal.
ASSERT(0 <= dismissal && dismissal < static_cast<int>(arraysize(kDismissals)));
- PlatformSupport::histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
+ WebKit::Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMessage::LevelError, makeString("Blocked ", kDialogs[dialog], "('", dialogMessage, "') during ", kDismissals[dismissal], ".")));
diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h
index c34945404..5894177e0 100644
--- a/Source/WebKit/chromium/src/ChromeClientImpl.h
+++ b/Source/WebKit/chromium/src/ChromeClientImpl.h
@@ -39,7 +39,7 @@
namespace WebCore {
class AccessibilityObject;
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
class ColorChooser;
class ColorChooserClient;
#endif
@@ -137,9 +137,7 @@ public:
virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&);
- virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
- virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE;
#endif
virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
@@ -197,6 +195,12 @@ public:
virtual bool hasOpenedPopup() const OVERRIDE;
virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+#if ENABLE(PAGE_POPUP)
+ virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect&) OVERRIDE;
+ virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE;
+#endif
+ virtual bool willAddTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE;
+ virtual void addTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE;
virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, WebCore::FrameLoader::PageDismissalType) const;
diff --git a/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp b/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp
index e591112da..25090fdd0 100644
--- a/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp
+++ b/Source/WebKit/chromium/src/ChromiumCurrentTime.cpp
@@ -38,12 +38,12 @@ namespace WTF {
double currentTime()
{
- return WebKit::webKitPlatformSupport()->currentTime();
+ return WebKit::Platform::current()->currentTime();
}
double monotonicallyIncreasingTime()
{
- return WebKit::webKitPlatformSupport()->monotonicallyIncreasingTime();
+ return WebKit::Platform::current()->monotonicallyIncreasingTime();
}
} // namespace WTF
diff --git a/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp
index 182f5e76e..9a31f4ae4 100644
--- a/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp
+++ b/Source/WebKit/chromium/src/ChromiumOSRandomSource.cpp
@@ -32,13 +32,14 @@
#include <wtf/OSRandomSource.h>
#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
+
+#include <public/Platform.h>
namespace WTF {
void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
{
- WebKit::webKitPlatformSupport()->cryptographicallyRandomValues(buffer, length);
+ WebKit::Platform::current()->cryptographicallyRandomValues(buffer, length);
}
}
diff --git a/Source/WebKit/chromium/src/ChromiumThreading.cpp b/Source/WebKit/chromium/src/ChromiumThreading.cpp
index e68d8d497..bc677f3c9 100644
--- a/Source/WebKit/chromium/src/ChromiumThreading.cpp
+++ b/Source/WebKit/chromium/src/ChromiumThreading.cpp
@@ -40,7 +40,7 @@ namespace WTF {
void ChromiumThreading::callOnMainThread(void (*func)(void*), void* context)
{
- WebKit::webKitPlatformSupport()->callOnMainThread(func, context);
+ WebKit::Platform::current()->callOnMainThread(func, context);
}
} // namespace WTF
diff --git a/Source/WebKit/chromium/src/ColorChooserProxy.cpp b/Source/WebKit/chromium/src/ColorChooserProxy.cpp
index dae1b127d..6cf72d524 100644
--- a/Source/WebKit/chromium/src/ColorChooserProxy.cpp
+++ b/Source/WebKit/chromium/src/ColorChooserProxy.cpp
@@ -30,7 +30,7 @@
#include "WebColorChooser.h"
#include "platform/WebColor.h"
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
namespace WebKit {
@@ -59,4 +59,4 @@ void ColorChooserProxy::endChooser()
}
-#endif // ENABLE(INPUT_COLOR)
+#endif // ENABLE(INPUT_TYPE_COLOR)
diff --git a/Source/WebKit/chromium/src/ColorChooserProxy.h b/Source/WebKit/chromium/src/ColorChooserProxy.h
index 56a9980f2..987f67b3c 100644
--- a/Source/WebKit/chromium/src/ColorChooserProxy.h
+++ b/Source/WebKit/chromium/src/ColorChooserProxy.h
@@ -31,7 +31,7 @@
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
namespace WebKit {
@@ -49,6 +49,6 @@ private:
} // namespace WebKit
-#endif // ENABLE(INPUT_COLOR)
+#endif // ENABLE(INPUT_TYPE_COLOR)
#endif // ColorChooserProxy_h
diff --git a/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h b/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h
index 3a3a95edf..73e07cb55 100644
--- a/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h
+++ b/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h
@@ -32,7 +32,7 @@
#define CompositionUnderlineBuilder_h
#include "Editor.h"
-#include "Vector.h"
+#include <wtf/Vector.h>
#include "WebCompositionUnderline.h"
#include "platform/WebVector.h"
diff --git a/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h b/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h
index 4f0ae43cb..b12b92cc6 100644
--- a/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h
+++ b/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h
@@ -32,7 +32,7 @@
#define CompositionUnderlineVectorBuilder_h
#include "Editor.h"
-#include "Vector.h"
+#include <wtf/Vector.h>
#include "WebCompositionUnderline.h"
#include "platform/WebVector.h"
diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
index 4712eff7d..4491ea1ca 100644
--- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -37,6 +37,7 @@
#include "ContextMenuController.h"
#include "Document.h"
#include "DocumentLoader.h"
+#include "DocumentMarkerController.h"
#include "Editor.h"
#include "EventHandler.h"
#include "FrameLoader.h"
@@ -54,6 +55,7 @@
#include "Page.h"
#include "PlatformString.h"
#include "RenderWidget.h"
+#include "Settings.h"
#include "TextBreakIterator.h"
#include "Widget.h"
@@ -272,7 +274,25 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
static_cast<HTMLInputElement*>(r.innerNonSharedNode())->isSpeechEnabled();
}
#endif
- if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
+ // When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled
+ // 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();
+ Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling);
+ 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.dictionarySuggestions = suggestions;
+ data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
+ }
+ } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
data.isSpellCheckingEnabled = true;
// Spellchecking might be enabled for the field, but could be disabled on the node.
if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) {
diff --git a/Source/WebKit/chromium/src/DatabaseObserver.cpp b/Source/WebKit/chromium/src/DatabaseObserver.cpp
index 2196c9b44..322e800ec 100644
--- a/Source/WebKit/chromium/src/DatabaseObserver.cpp
+++ b/Source/WebKit/chromium/src/DatabaseObserver.cpp
@@ -92,7 +92,8 @@ public:
private:
AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize)
- : m_workerLoaderProxy(workerLoaderProxy)
+ : m_result(false)
+ , m_workerLoaderProxy(workerLoaderProxy)
{
WebWorkerBase::dispatchTaskToMainThread(
createCallbackTask(&allowDatabaseTask, mode, WebCore::AllowCrossThreadAccess(commonClient),
diff --git a/Source/WebKit/chromium/src/Extensions3DChromium.cpp b/Source/WebKit/chromium/src/Extensions3DChromium.cpp
index 73397bd2b..84ad0f78a 100644
--- a/Source/WebKit/chromium/src/Extensions3DChromium.cpp
+++ b/Source/WebKit/chromium/src/Extensions3DChromium.cpp
@@ -107,6 +107,16 @@ 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);
@@ -160,6 +170,41 @@ void Extensions3DChromium::texStorage2DEXT(unsigned int target, int levels, unsi
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 2dada5c50..abe1e98b4 100644
--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,19 +37,19 @@
#include "Document.h"
#include "DocumentLoader.h"
#include "FormState.h"
-#include "FrameLoader.h"
#include "FrameLoadRequest.h"
+#include "FrameLoader.h"
#include "FrameNetworkingContextImpl.h"
#include "FrameView.h"
-#include "HTTPParsers.h"
-#include "HistoryItem.h"
-#include "HitTestResult.h"
#include "HTMLAppletElement.h"
#include "HTMLFormElement.h" // needed by FormState.h
#include "HTMLNames.h"
+#include "HTTPParsers.h"
+#include "HistoryItem.h"
+#include "HitTestResult.h"
#include "IntentRequest.h"
-#include "MessageEvent.h"
#include "MIMETypeRegistry.h"
+#include "MessageEvent.h"
#include "MouseEvent.h"
#include "Page.h"
#include "PlatformString.h"
@@ -59,7 +59,7 @@
#include "ResourceHandleInternal.h"
#include "ResourceLoader.h"
#include "Settings.h"
-#include "StringExtras.h"
+#include "SocketStreamHandleInternal.h"
#include "WebDOMEvent.h"
#include "WebDataSourceImpl.h"
#include "WebDevToolsAgentPrivate.h"
@@ -69,8 +69,6 @@
#include "WebFrameImpl.h"
#include "WebIntentRequest.h"
#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include <public/WebMimeRegistry.h>
#include "WebNode.h"
#include "WebPermissionClient.h"
#include "WebPlugin.h"
@@ -78,14 +76,19 @@
#include "WebPluginLoadObserver.h"
#include "WebPluginParams.h"
#include "WebSecurityOrigin.h"
-#include "platform/WebURL.h"
-#include "platform/WebURLError.h"
-#include "platform/WebVector.h"
+#include "platform/WebSocketStreamHandle.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "WindowFeatures.h"
#include "WrappedResourceRequest.h"
#include "WrappedResourceResponse.h"
+#include "platform/WebKitPlatformSupport.h"
+#include "platform/WebURL.h"
+#include "platform/WebURLError.h"
+#include "platform/WebVector.h"
+#include <public/WebMimeRegistry.h>
+
+#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
#if USE(V8)
@@ -107,7 +110,6 @@ enum {
FrameLoaderClientImpl::FrameLoaderClientImpl(WebFrameImpl* frame)
: m_webFrame(frame)
- , m_hasRepresentation(false)
, m_sentInitialResponseToPlugin(false)
, m_nextNavigationPolicy(WebNavigationPolicyIgnore)
{
@@ -132,10 +134,6 @@ void FrameLoaderClientImpl::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*
{
if (m_webFrame->client())
m_webFrame->client()->didClearWindowObject(m_webFrame);
-
- WebViewImpl* webview = m_webFrame->viewImpl();
- if (webview->devToolsAgentPrivate())
- webview->devToolsAgentPrivate()->didClearWindowObject(m_webFrame);
}
void FrameLoaderClientImpl::documentElementAvailable()
@@ -147,6 +145,9 @@ void FrameLoaderClientImpl::documentElementAvailable()
#if USE(V8)
void FrameLoaderClientImpl::didCreateScriptContext(v8::Handle<v8::Context> context, int extensionGroup, int worldId)
{
+ WebViewImpl* webview = m_webFrame->viewImpl();
+ if (webview->devToolsAgentPrivate())
+ webview->devToolsAgentPrivate()->didCreateScriptContext(m_webFrame, worldId);
if (m_webFrame->client())
m_webFrame->client()->didCreateScriptContext(m_webFrame, context, extensionGroup, worldId);
}
@@ -270,11 +271,6 @@ void FrameLoaderClientImpl::makeDocumentView()
m_webFrame->createFrameView();
}
-void FrameLoaderClientImpl::makeRepresentation(DocumentLoader*)
-{
- m_hasRepresentation = true;
-}
-
void FrameLoaderClientImpl::forceLayout()
{
// FIXME
@@ -1033,10 +1029,10 @@ void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError&
m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error);
}
-void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form)
+void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState)
{
if (m_webFrame->client())
- m_webFrame->client()->willSendSubmitEvent(m_webFrame, WebFormElement(form));
+ m_webFrame->client()->willSendSubmitEvent(m_webFrame, WebFormElement(prpFormState->form()));
}
void FrameLoaderClientImpl::dispatchWillSubmitForm(FramePolicyFunction function,
@@ -1047,16 +1043,6 @@ void FrameLoaderClientImpl::dispatchWillSubmitForm(FramePolicyFunction function,
(m_webFrame->frame()->loader()->policyChecker()->*function)(PolicyUse);
}
-void FrameLoaderClientImpl::dispatchDidLoadMainResource(DocumentLoader*)
-{
- // FIXME
-}
-
-void FrameLoaderClientImpl::revertToProvisionalState(DocumentLoader*)
-{
- m_hasRepresentation = true;
-}
-
void FrameLoaderClientImpl::setMainDocumentError(DocumentLoader*,
const ResourceError& error)
{
@@ -1153,18 +1139,12 @@ void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* da
}
}
-void FrameLoaderClientImpl::finishedLoading(DocumentLoader* dl)
+void FrameLoaderClientImpl::finishedLoading(DocumentLoader*)
{
if (m_pluginWidget) {
m_pluginWidget->didFinishLoading();
m_pluginWidget = 0;
m_sentInitialResponseToPlugin = false;
- } else {
- // This is necessary to create an empty document. See bug 634004.
- // However, we only want to do this if makeRepresentation has been called, to
- // match the behavior on the Mac.
- if (m_hasRepresentation)
- dl->writer()->setEncoding("", false);
}
}
@@ -1308,7 +1288,7 @@ bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const
// mimeType strings are supposed to be ASCII, but if they are not for some
// reason, then it just means that the mime type will fail all of these "is
// supported" checks and go down the path of an unhandled mime type.
- if (webKitPlatformSupport()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
+ if (WebKit::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMimeRegistry::IsSupported)
return true;
// If Chrome is started with the --disable-plugins switch, pluginData is null.
@@ -1396,7 +1376,7 @@ void FrameLoaderClientImpl::setTitle(const StringWithDirection& title, const KUR
String FrameLoaderClientImpl::userAgent(const KURL& url)
{
- return webKitPlatformSupport()->userAgent(url);
+ return WebKit::Platform::current()->userAgent(url);
}
void FrameLoaderClientImpl::savePlatformDataToCachedFrame(CachedFrame*)
@@ -1459,33 +1439,6 @@ PassRefPtr<Frame> FrameLoaderClientImpl::createFrame(
return m_webFrame->createChildFrame(frameRequest, ownerElement);
}
-void FrameLoaderClientImpl::didTransferChildFrameToNewDocument(Page*)
-{
- ASSERT(m_webFrame->frame()->ownerElement());
-
- WebFrameImpl* newParent = static_cast<WebFrameImpl*>(m_webFrame->parent());
- if (!newParent || !newParent->client())
- return;
-
- // Replace the client since the old client may be destroyed when the
- // previous page is closed.
- m_webFrame->setClient(newParent->client());
-}
-
-void FrameLoaderClientImpl::transferLoadingResourceFromPage(ResourceLoader* loader, const ResourceRequest& request, Page* oldPage)
-{
- assignIdentifierToInitialRequest(loader->identifier(), loader->documentLoader(), request);
-
- WebFrameImpl* oldWebFrame = WebFrameImpl::fromFrame(oldPage->mainFrame());
- if (oldWebFrame && oldWebFrame->client())
- oldWebFrame->client()->removeIdentifierForRequest(loader->identifier());
-
- ResourceHandle* handle = loader->handle();
- WebURLLoader* webURLLoader = ResourceHandleInternal::FromResourceHandle(handle)->loader();
- if (webURLLoader && m_webFrame->client())
- m_webFrame->client()->didAdoptURLLoader(webURLLoader);
-}
-
PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin(
const IntSize& size, // FIXME: how do we use this?
HTMLPlugInElement* element,
@@ -1649,4 +1602,9 @@ void FrameLoaderClientImpl::dispatchIntent(PassRefPtr<WebCore::IntentRequest> in
}
#endif
+void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* handle)
+{
+ m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWebSocketStreamHandle(handle));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
index 53d5997e8..df7e0f123 100644
--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -72,7 +72,7 @@ public:
virtual bool hasWebView() const;
virtual bool hasFrameView() const;
- virtual void makeRepresentation(WebCore::DocumentLoader*);
+ virtual void makeRepresentation(WebCore::DocumentLoader*) { }
virtual void forceLayout();
virtual void forceLayoutForNonHTML();
virtual void setCopiesOnScroll();
@@ -116,10 +116,9 @@ public:
virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state);
virtual void cancelPolicyCheck();
virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&);
- virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*);
+ virtual void dispatchWillSendSubmitEvent(PassRefPtr<WebCore::FormState>);
virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>);
- virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*);
- virtual void revertToProvisionalState(WebCore::DocumentLoader*);
+ virtual void revertToProvisionalState(WebCore::DocumentLoader*) { }
virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&);
virtual void willChangeEstimatedProgress() { }
virtual void didChangeEstimatedProgress() { }
@@ -177,8 +176,6 @@ public:
WebCore::HTMLFrameOwnerElement* ownerElement,
const WTF::String& referrer, bool allowsScrolling,
int marginWidth, int marginHeight);
- virtual void didTransferChildFrameToNewDocument(WebCore::Page*);
- virtual void transferLoadingResourceFromPage(WebCore::ResourceLoader*, const WebCore::ResourceRequest&, WebCore::Page*);
virtual PassRefPtr<WebCore::Widget> createPlugin(
const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&,
const Vector<WTF::String>&, const Vector<WTF::String>&,
@@ -212,6 +209,8 @@ public:
virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE;
#endif
+ virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE;
+
private:
void makeDocumentView();
@@ -226,11 +225,6 @@ private:
// the web frame object is guaranteed to exist.
WebFrameImpl* m_webFrame;
- // True if makeRepresentation was called. We don't actually have a concept
- // of a "representation", but we need to know when we're expected to have one.
- // See finishedLoading().
- bool m_hasRepresentation;
-
// Used to help track client redirects. When a provisional load starts, it
// has no redirects in its chain. But in the case of client redirects, we want
// to add that initial load as a redirect. When we get a new provisional load
diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
index 4bfa2e5bc..60919a20c 100644
--- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
+++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
@@ -174,13 +174,13 @@ public:
{
}
- virtual void onGpuMemoryAllocationChanged(size_t gpuResourceSizeInBytes)
+ virtual void onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
{
GrContext* context = m_context->grContext();
if (!context)
return;
- if (!gpuResourceSizeInBytes) {
+ if (!allocation.gpuResourceSizeInBytes) {
context->freeGpuResources();
context->setTextureCacheLimits(0, 0);
} else
@@ -318,7 +318,7 @@ PassRefPtr<ImageData> GraphicsContext3DPrivate::paintRenderingResultsToImageData
getDrawingParameters(drawingBuffer, m_impl.get(), &framebufferId, &width, &height);
RefPtr<ImageData> imageData = ImageData::create(IntSize(width, height));
- unsigned char* pixels = imageData->data()->data()->data();
+ unsigned char* pixels = imageData->data()->data();
size_t bufferSize = 4 * width * height;
m_impl->readBackFramebuffer(pixels, bufferSize, framebufferId, width, height);
@@ -612,6 +612,8 @@ 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);
@@ -879,6 +881,9 @@ 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)
@@ -889,6 +894,14 @@ 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
//
@@ -1026,7 +1039,6 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
webAttributes.stencil = attrs.stencil;
webAttributes.antialias = attrs.antialias;
webAttributes.premultipliedAlpha = attrs.premultipliedAlpha;
- webAttributes.canRecoverFromContextLoss = attrs.canRecoverFromContextLoss;
webAttributes.noExtensions = attrs.noExtensions;
webAttributes.shareResources = attrs.shareResources;
webAttributes.preferDiscreteGPU = attrs.preferDiscreteGPU;
@@ -1145,6 +1157,7 @@ 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*)
@@ -1361,8 +1374,14 @@ public:
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(gpuResourceSizeInBytes);
+ m_memoryAllocationChangedCallback->onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM(allocation.gpuResourceSizeInBytes, allocation.suggestHaveBackbuffer));
}
private:
diff --git a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h
index be9db4287..b79898971 100644
--- a/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h
+++ b/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h
@@ -59,7 +59,7 @@ public:
// be used on any other thread.
static PassRefPtr<GraphicsContext3D> createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::RenderStyle, bool preserveDrawingBuffer = false);
- ~GraphicsContext3DPrivate();
+ virtual ~GraphicsContext3DPrivate();
// Helper function to provide access to the lower-level WebGraphicsContext3D,
// which is needed for subordinate contexts like WebGL's to share resources
@@ -164,6 +164,7 @@ public:
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);
@@ -282,6 +283,10 @@ public:
// 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>);
@@ -307,6 +312,15 @@ public:
// 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);
diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp
index 428c37f5e..2a62b926f 100644
--- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp
+++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.cpp
@@ -79,6 +79,11 @@ void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, Pass
m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks), ec);
}
+void IDBCursorBackendProxy::advance(unsigned long count, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
+{
+ m_idbCursor->advance(count, new WebIDBCallbacksImpl(callbacks), ec);
+}
+
void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
{
m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks), ec);
diff --git a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h
index cfe6daf5d..24a3e42c4 100644
--- a/Source/WebKit/chromium/src/IDBCursorBackendProxy.h
+++ b/Source/WebKit/chromium/src/IDBCursorBackendProxy.h
@@ -47,6 +47,7 @@ public:
virtual PassRefPtr<WebCore::IDBKey> primaryKey() const;
virtual PassRefPtr<WebCore::SerializedScriptValue> value() const;
virtual void update(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&);
+ virtual void advance(unsigned long, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&);
virtual void continueFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&);
virtual void deleteFunction(PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&);
virtual void prefetchContinue(int numberToFetch, PassRefPtr<WebCore::IDBCallbacks>, WebCore::ExceptionCode&) { ASSERT_NOT_REACHED(); } // Only used in the backend.
diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp
index bc2c836f8..0014f2959 100644
--- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp
+++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.cpp
@@ -67,7 +67,7 @@ String IDBIndexBackendProxy::storeName()
String IDBIndexBackendProxy::keyPath()
{
- return m_webIDBIndex->keyPath();
+ return m_webIDBIndex->keyPath().string();
}
bool IDBIndexBackendProxy::unique()
@@ -104,20 +104,20 @@ void IDBIndexBackendProxy::openKeyCursor(PassRefPtr<IDBKeyRange> keyRange, unsig
m_webIDBIndex->openKeyCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBIndexBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
+void IDBIndexBackendProxy::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->getObject(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
+ m_webIDBIndex->getObject(keyRange, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBIndexBackendProxy::getKey(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
+void IDBIndexBackendProxy::getKey(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->getKey(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
+ m_webIDBIndex->getKey(keyRange, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h
index 4ce8c876b..42e0eabbe 100644
--- a/Source/WebKit/chromium/src/IDBIndexBackendProxy.h
+++ b/Source/WebKit/chromium/src/IDBIndexBackendProxy.h
@@ -50,8 +50,8 @@ public:
virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void openKeyCursor(PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void count(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
- virtual void get(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
- virtual void getKey(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
+ virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
+ virtual void getKey(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
private:
IDBIndexBackendProxy(PassOwnPtr<WebIDBIndex>);
diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
index 485487ac0..21a5dd856 100755
--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
@@ -66,7 +66,7 @@ String IDBObjectStoreBackendProxy::name() const
String IDBObjectStoreBackendProxy::keyPath() const
{
- return m_webIDBObjectStore->keyPath();
+ return m_webIDBObjectStore->keyPath().string();
}
PassRefPtr<DOMStringList> IDBObjectStoreBackendProxy::indexNames() const
@@ -74,12 +74,12 @@ PassRefPtr<DOMStringList> IDBObjectStoreBackendProxy::indexNames() const
return m_webIDBObjectStore->indexNames();
}
-void IDBObjectStoreBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
+void IDBObjectStoreBackendProxy::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
+ m_webIDBObjectStore->get(keyRange, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
void IDBObjectStoreBackendProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
index c19a0f0a4..5e1189186 100644
--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
@@ -46,7 +46,7 @@ public:
virtual String keyPath() const;
virtual PassRefPtr<WebCore::DOMStringList> indexNames() const;
- virtual void get(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
+ virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void deleteFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.cpp b/Source/WebKit/chromium/src/InspectorClientImpl.cpp
index 317b57693..17bd16111 100644
--- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp
+++ b/Source/WebKit/chromium/src/InspectorClientImpl.cpp
@@ -128,6 +128,28 @@ void InspectorClientImpl::clearBrowserCookies()
agent->clearBrowserCookies();
}
+bool InspectorClientImpl::canOverrideDeviceMetrics()
+{
+ return true;
+}
+
+void InspectorClientImpl::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow)
+{
+ if (WebDevToolsAgentImpl* agent = devToolsAgent())
+ agent->overrideDeviceMetrics(width, height, fontScaleFactor, fitWindow);
+}
+
+void InspectorClientImpl::autoZoomPageToFitWidth()
+{
+ if (WebDevToolsAgentImpl* agent = devToolsAgent())
+ agent->autoZoomPageToFitWidth();
+}
+
+bool InspectorClientImpl::supportsFrameInstrumentation()
+{
+ return true;
+}
+
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 b16b6f468..bdb9b336d 100644
--- a/Source/WebKit/chromium/src/InspectorClientImpl.h
+++ b/Source/WebKit/chromium/src/InspectorClientImpl.h
@@ -63,6 +63,13 @@ public:
virtual void clearBrowserCache();
virtual bool canClearBrowserCookies();
virtual void clearBrowserCookies();
+
+ virtual bool canOverrideDeviceMetrics();
+ virtual void overrideDeviceMetrics(int, int, float, bool);
+ virtual void autoZoomPageToFitWidth();
+
+ virtual bool supportsFrameInstrumentation();
+
private:
WebDevToolsAgentImpl* devToolsAgent();
diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
index ee2e89a42..af90bad6c 100644
--- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
+++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
@@ -129,14 +129,19 @@ void InspectorFrontendClientImpl::openInNewTab(const String& url)
m_client->openInNewTab(url);
}
-bool InspectorFrontendClientImpl::canSaveAs()
+bool InspectorFrontendClientImpl::canSave()
{
return true;
}
-void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content)
+void InspectorFrontendClientImpl::save(const String& url, const String& content, bool forceSaveAs)
{
- m_client->saveAs(fileName, content);
+ m_client->save(url, content, forceSaveAs);
+}
+
+void InspectorFrontendClientImpl::append(const String& url, const String& content)
+{
+ m_client->append(url, content);
}
void InspectorFrontendClientImpl::inspectedURLChanged(const String& url)
diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
index 4f7a72b96..1aedc1f03 100644
--- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
+++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h
@@ -69,8 +69,9 @@ public:
virtual void openInNewTab(const String& url);
- virtual bool canSaveAs();
- virtual void saveAs(const WTF::String& fileName, const WTF::String& content);
+ virtual bool canSave();
+ virtual void save(const WTF::String& urk, const WTF::String& content, bool forceSaveAs);
+ virtual void append(const WTF::String& urk, const WTF::String& content);
virtual void inspectedURLChanged(const WTF::String&);
diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
index be263bea1..5f6d52750 100644
--- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
@@ -33,12 +33,12 @@
#if ENABLE(FILE_SYSTEM)
-#include "AsyncFileSystem.h"
#include "CrossThreadTask.h"
#include "Document.h"
#include "ErrorCallback.h"
#include "FileSystemCallback.h"
#include "FileSystemCallbacks.h"
+#include "FileSystemType.h"
#include "PlatformString.h"
#include "WebFileError.h"
#include "platform/WebFileSystem.h"
@@ -108,7 +108,8 @@ public:
private:
AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient)
- : m_workerLoaderProxy(workerLoaderProxy)
+ : m_result(false)
+ , m_workerLoaderProxy(workerLoaderProxy)
{
WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&allowFileSystemTask, mode, AllowCrossThreadAccess(commonClient), this));
}
@@ -152,7 +153,7 @@ bool allowFileSystemForWorker(WebCommonWorkerClient* commonClient)
return bridge->result();
}
-void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous)
+void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, FileSystemSynchronousType synchronousType)
{
WorkerScriptController* controller = WorkerScriptController::controllerForContext();
WorkerContext* workerContext = controller->workerContext();
@@ -167,7 +168,7 @@ void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem:
RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(workerLoaderProxy, workerContext, callbacks);
bridge->postOpenFileSystemToMainThread(commonClient, type, size, create, mode);
- if (synchronous) {
+ if (synchronousType == SynchronousFileSystem) {
if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated)
bridge->stop();
}
@@ -182,7 +183,7 @@ static void openFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFi
callbacks->didFail(WebKit::WebFileErrorAbort);
}
-static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)
+static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType, long long size, CreationFlag create)
{
bool allowed = true;
ASSERT(context);
@@ -202,7 +203,7 @@ static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSyste
if (!allowFileSystemForWorker(webWorker->commonClient()))
allowed = false;
else
- openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous);
+ openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronousType), synchronousType);
#else
ASSERT_NOT_REACHED();
@@ -215,14 +216,14 @@ static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSyste
}
}
-void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
+void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType)
{
- openFileSystemHelper(context, type, callbacks, synchronous, 0, OpenExisting);
+ openFileSystemHelper(context, type, callbacks, synchronousType, 0, OpenExisting);
}
-void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
+void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType)
{
- openFileSystemHelper(context, type, callbacks, synchronous, size, CreateIfNotPresent);
+ openFileSystemHelper(context, type, callbacks, synchronousType, size, CreateIfNotPresent);
}
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp
index 917180b66..6af49515f 100644
--- a/Source/WebKit/chromium/src/LocalizedStrings.cpp
+++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp
@@ -158,6 +158,12 @@ String AXDefinitionListDefinitionText()
return String("definition");
}
+String AXFooterRoleDescriptionText()
+{
+ notImplemented();
+ return String("footer");
+}
+
String AXButtonActionVerb()
{
return query(WebLocalizedString::AXButtonActionVerb);
@@ -200,8 +206,7 @@ String AXMenuListActionVerb()
String missingPluginText()
{
- notImplemented();
- return String("Missing Plug-in");
+ return query(WebLocalizedString::MissingPluginText);
}
String crashedPluginText()
@@ -391,4 +396,31 @@ String validationMessageStepMismatchText(const String& base, const String& step)
return query(WebLocalizedString::ValidationStepMismatch, base, step);
}
+#if ENABLE(CALENDAR_PICKER)
+String calendarTodayText()
+{
+ return query(WebLocalizedString::CalendarToday);
+}
+
+String calendarClearText()
+{
+ return query(WebLocalizedString::CalendarClear);
+}
+
+String dateFormatYearText()
+{
+ return query(WebLocalizedString::DateFormatYearLabel);
+}
+
+String dateFormatMonthText()
+{
+ return query(WebLocalizedString::DateFormatMonthLabel);
+}
+
+String dateFormatDayInMonthText()
+{
+ return query(WebLocalizedString::DateFormatDayInMonthLabel);
+}
+#endif
+
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
index b6b1a2294..6d11d8a59 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
@@ -46,10 +46,10 @@ NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPain
#endif
m_graphicsLayer->setDrawsContent(true);
m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true);
-#if !ENABLE(RUBBER_BANDING)
- m_graphicsLayer->platformLayer()->setBackgroundCoversViewport(true);
-#endif
m_graphicsLayer->platformLayer()->setOpaque(true);
+#if !OS(ANDROID)
+ m_graphicsLayer->platformLayer()->setDrawCheckerboardForMissingTiles(true);
+#endif
}
NonCompositedContentHost::~NonCompositedContentHost()
@@ -58,10 +58,7 @@ NonCompositedContentHost::~NonCompositedContentHost()
void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
{
- if (color.isValid())
- m_graphicsLayer->platformLayer()->setBackgroundColor(color);
- else
- m_graphicsLayer->platformLayer()->setBackgroundColor(WebCore::Color::white);
+ m_graphicsLayer->platformLayer()->setBackgroundColor(color);
}
void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
diff --git a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp
index 99a7ea378..683e66faa 100644
--- a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp
+++ b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "NotificationPresenterImpl.h"
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
#include "KURL.h"
#include "Notification.h"
@@ -111,4 +111,4 @@ void NotificationPresenterImpl::requestPermission(ScriptExecutionContext* contex
} // namespace WebKit
-#endif // ENABLE(NOTIFICATIONS)
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
diff --git a/Source/WebKit/chromium/src/NotificationPresenterImpl.h b/Source/WebKit/chromium/src/NotificationPresenterImpl.h
index cad5b8801..d29699eca 100644
--- a/Source/WebKit/chromium/src/NotificationPresenterImpl.h
+++ b/Source/WebKit/chromium/src/NotificationPresenterImpl.h
@@ -37,7 +37,7 @@
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
namespace WebKit {
@@ -56,7 +56,12 @@ public:
virtual void notificationObjectDestroyed(WebCore::Notification* object);
virtual void notificationControllerDestroyed();
virtual WebCore::NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*);
- virtual void requestPermission(WebCore::ScriptExecutionContext* , WTF::PassRefPtr<WebCore::VoidCallback> callback);
+#if ENABLE(LEGACY_NOTIFICATIONS)
+ virtual void requestPermission(WebCore::ScriptExecutionContext*, WTF::PassRefPtr<WebCore::VoidCallback> callback);
+#endif
+#if ENABLE(NOTIFICATIONS)
+ virtual void requestPermission(WebCore::ScriptExecutionContext*, WTF::PassRefPtr<WebCore::NotificationPermissionCallback> callback) { }
+#endif
virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) {}
private:
@@ -66,6 +71,6 @@ private:
} // namespace WebKit
-#endif // ENABLE(NOTIFICATIONS)
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
#endif
diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp
new file mode 100644
index 000000000..058bae024
--- /dev/null
+++ b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp
@@ -0,0 +1,221 @@
+/*
+ * 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 "PageWidgetDelegate.h"
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "PageOverlayList.h"
+#include "WebInputEvent.h"
+#include "WebInputEventConversion.h"
+#include "painting/GraphicsContextBuilder.h"
+#include <wtf/CurrentTime.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static inline FrameView* mainFrameView(Page* page)
+{
+ if (!page)
+ return 0;
+ // FIXME: Can we remove this check?
+ if (!page->mainFrame())
+ return 0;
+ return page->mainFrame()->view();
+}
+
+void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime)
+{
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ FrameView* view = mainFrameView(page);
+ if (!view)
+ return;
+ view->serviceScriptedAnimations(monotonicFrameBeginTime);
+#endif
+}
+
+void PageWidgetDelegate::layout(Page* page)
+{
+ FrameView* view = mainFrameView(page);
+ if (!view)
+ return;
+ // In order for our child HWNDs (NativeWindowWidgets) to update properly,
+ // they need to be told that we are updating the screen. The problem is that
+ // the native widgets need to recalculate their clip region and not overlap
+ // any of our non-native widgets. To force the resizing, call
+ // setFrameRect(). This will be a quick operation for most frames, but the
+ // NativeWindowWidgets will update a proper clipping region.
+ view->setFrameRect(view->frameRect());
+
+ // setFrameRect may have the side-effect of causing existing page layout to
+ // be invalidated, so layout needs to be called last.
+ view->updateLayoutAndStyleIfNeededRecursive();
+}
+
+void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* canvas, const WebRect& rect)
+{
+ if (rect.isEmpty())
+ return;
+ GraphicsContextBuilder builder(canvas);
+ GraphicsContext& gc = builder.context();
+ IntRect dirtyRect(rect);
+ gc.save();
+ FrameView* view = mainFrameView(page);
+ // FIXME: Can we remove the mainFrame()->document() check?
+ if (view && page->mainFrame()->document()) {
+ gc.clip(dirtyRect);
+ view->paint(&gc, dirtyRect);
+ if (overlays)
+ overlays->paintWebFrame(gc);
+ } else
+ gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB);
+ gc.restore();
+}
+
+bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& handler, const WebInputEvent& event)
+{
+ Frame* frame = page ? page->mainFrame() : 0;
+ switch (event.type) {
+
+ // FIXME: WebKit seems to always return false on mouse events processing
+ // methods. For now we'll assume it has processed them (as we are only
+ // interested in whether keyboard events are processed).
+ case WebInputEvent::MouseMove:
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseMove(*frame, *static_cast<const WebMouseEvent*>(&event));
+ return true;
+ case WebInputEvent::MouseLeave:
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseLeave(*frame, *static_cast<const WebMouseEvent*>(&event));
+ return true;
+ case WebInputEvent::MouseDown:
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseDown(*frame, *static_cast<const WebMouseEvent*>(&event));
+ return true;
+ case WebInputEvent::MouseUp:
+ if (!frame || !frame->view())
+ return true;
+ handler.handleMouseUp(*frame, *static_cast<const WebMouseEvent*>(&event));
+ return true;
+
+ case WebInputEvent::MouseWheel:
+ if (!frame || !frame->view())
+ return false;
+ return handler.handleMouseWheel(*frame, *static_cast<const WebMouseWheelEvent*>(&event));
+
+ case WebInputEvent::RawKeyDown:
+ case WebInputEvent::KeyDown:
+ case WebInputEvent::KeyUp:
+ return handler.handleKeyEvent(*static_cast<const WebKeyboardEvent*>(&event));
+
+ case WebInputEvent::Char:
+ return handler.handleCharEvent(*static_cast<const WebKeyboardEvent*>(&event));
+
+#if ENABLE(GESTURE_EVENTS)
+ case WebInputEvent::GestureScrollBegin:
+ case WebInputEvent::GestureScrollEnd:
+ case WebInputEvent::GestureScrollUpdate:
+ case WebInputEvent::GestureFlingStart:
+ case WebInputEvent::GestureFlingCancel:
+ case WebInputEvent::GestureTap:
+ case WebInputEvent::GestureTapDown:
+ case WebInputEvent::GestureDoubleTap:
+ return handler.handleGestureEvent(*static_cast<const WebGestureEvent*>(&event));
+#endif
+
+#if ENABLE(TOUCH_EVENTS)
+ case WebInputEvent::TouchStart:
+ case WebInputEvent::TouchMove:
+ case WebInputEvent::TouchEnd:
+ case WebInputEvent::TouchCancel:
+ if (!frame || !frame->view())
+ return false;
+ return handler.handleTouchEvent(*frame, *static_cast<const WebTouchEvent*>(&event));
+#endif
+
+#if ENABLE(GESTURE_EVENTS)
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate:
+ // FIXME: Once PlatformGestureEvent is updated to support pinch, this
+ // should call handleGestureEvent, just like it currently does for
+ // gesture scroll.
+ return false;
+#endif
+
+ default:
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------
+// Default handlers for PageWidgetEventHandler
+
+void PageWidgetEventHandler::handleMouseMove(Frame& mainFrame, const WebMouseEvent& event)
+{
+ // We call mouseMoved here instead of handleMouseMovedEvent because we need
+ // our ChromeClientImpl to receive changes to the mouse position and tooltip
+ // text, and mouseMoved handles all of that.
+ mainFrame.eventHandler()->mouseMoved(PlatformMouseEventBuilder(mainFrame.view(), event));
+}
+
+void PageWidgetEventHandler::handleMouseLeave(Frame& mainFrame, const WebMouseEvent& event)
+{
+ mainFrame.eventHandler()->handleMouseMoveEvent(PlatformMouseEventBuilder(mainFrame.view(), event));
+}
+
+void PageWidgetEventHandler::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event)
+{
+ mainFrame.eventHandler()->handleMousePressEvent(PlatformMouseEventBuilder(mainFrame.view(), event));
+}
+
+void PageWidgetEventHandler::handleMouseUp(Frame& mainFrame, const WebMouseEvent& event)
+{
+ mainFrame.eventHandler()->handleMouseReleaseEvent(PlatformMouseEventBuilder(mainFrame.view(), event));
+}
+
+bool PageWidgetEventHandler::handleMouseWheel(Frame& mainFrame, const WebMouseWheelEvent& event)
+{
+ return mainFrame.eventHandler()->handleWheelEvent(PlatformWheelEventBuilder(mainFrame.view(), event));
+}
+
+#if ENABLE(TOUCH_EVENTS)
+bool PageWidgetEventHandler::handleTouchEvent(Frame& mainFrame, const WebTouchEvent& event)
+{
+ return mainFrame.eventHandler()->handleTouchEvent(PlatformTouchEventBuilder(mainFrame.view(), event));
+}
+#endif
+
+}
diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.h b/Source/WebKit/chromium/src/PageWidgetDelegate.h
new file mode 100644
index 000000000..dbbe269ac
--- /dev/null
+++ b/Source/WebKit/chromium/src/PageWidgetDelegate.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 PageWidgetDelegate_h
+#define PageWidgetDelegate_h
+
+#include "Page.h"
+#include "WebWidget.h"
+#include "platform/WebCanvas.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+class Frame;
+class Page;
+}
+
+namespace WebKit {
+
+class PageOverlayList;
+class WebGestureEvent;
+class WebInputEvent;
+class WebKeyboardEvent;
+class WebMouseEvent;
+class WebMouseWheelEvent;
+class WebTouchEvent;
+
+class PageWidgetEventHandler {
+public:
+ virtual void handleMouseMove(WebCore::Frame& mainFrame, const WebMouseEvent&);
+ virtual void handleMouseLeave(WebCore::Frame& mainFrame, const WebMouseEvent&);
+ virtual void handleMouseDown(WebCore::Frame& mainFrame, const WebMouseEvent&);
+ virtual void handleMouseUp(WebCore::Frame& mainFrame, const WebMouseEvent&);
+ virtual bool handleMouseWheel(WebCore::Frame& mainFrame, const WebMouseWheelEvent&);
+ virtual bool handleKeyEvent(const WebKeyboardEvent&) = 0;
+ virtual bool handleCharEvent(const WebKeyboardEvent&) = 0;
+#if ENABLE(GESTURE_EVENTS)
+ virtual bool handleGestureEvent(const WebGestureEvent&) = 0;
+#endif
+#if ENABLE(TOUCH_EVENTS)
+ virtual bool handleTouchEvent(WebCore::Frame& mainFrame, const WebTouchEvent&);
+#endif
+ virtual ~PageWidgetEventHandler() { }
+};
+
+
+// Common implementation of WebViewImpl and WebPagePopupImpl.
+class PageWidgetDelegate {
+public:
+ static void animate(WebCore::Page*, double monotonicFrameBeginTime);
+ static void layout(WebCore::Page*);
+ static void paint(WebCore::Page*, PageOverlayList*, WebCanvas*, const WebRect&);
+ static bool handleInputEvent(WebCore::Page*, PageWidgetEventHandler&, const WebInputEvent&);
+
+private:
+ PageWidgetDelegate() { }
+};
+
+}
+#endif
diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp
index 63be0245c..de9810dbd 100644
--- a/Source/WebKit/chromium/src/PlatformSupport.cpp
+++ b/Source/WebKit/chromium/src/PlatformSupport.cpp
@@ -61,7 +61,6 @@
#include "platform/WebString.h"
#include "platform/WebURL.h"
#include "platform/WebVector.h"
-#include <public/WebMimeRegistry.h>
#if USE(CG)
#include <CoreGraphics/CGContext.h>
@@ -86,12 +85,12 @@
#include "NativeImageSkia.h"
#endif
+#include "AsyncFileSystemChromium.h"
#include "BitmapImage.h"
#include "ClipboardChromium.h"
#include "Cookie.h"
#include "Document.h"
#include "FrameView.h"
-#include "GamepadList.h"
#include "GraphicsContext.h"
#include "IDBFactoryBackendProxy.h"
#include "KURL.h"
@@ -102,6 +101,7 @@
#include "Worker.h"
#include "WorkerContextProxy.h"
+#include <public/WebMimeRegistry.h>
#include <wtf/Assertions.h>
// We are part of the WebKit implementation.
@@ -144,13 +144,6 @@ static WebCookieJar* getCookieJar(const Document* document)
return cookieJar;
}
-// Cache ----------------------------------------------------------------------
-
-void PlatformSupport::cacheMetadata(const KURL& url, double responseTime, const Vector<char>& data)
-{
- webKitPlatformSupport()->cacheMetadata(url, responseTime, data.data(), data.size());
-}
-
// Clipboard ------------------------------------------------------------------
uint64_t PlatformSupport::clipboardSequenceNumber(PasteboardPrivate::ClipboardBuffer buffer)
@@ -314,13 +307,6 @@ bool PlatformSupport::cookiesEnabled(const Document* document)
return result;
}
-// DNS ------------------------------------------------------------------------
-
-void PlatformSupport::prefetchDNS(const String& hostname)
-{
- webKitPlatformSupport()->prefetchHostName(hostname);
-}
-
// File ------------------------------------------------------------------------
bool PlatformSupport::fileExists(const String& path)
@@ -417,6 +403,18 @@ int PlatformSupport::writeToFile(PlatformFileHandle handle, const char* data, in
return webKitPlatformSupport()->fileUtilities()->writeToFile(handle, data, length);
}
+#if ENABLE(FILE_SYSTEM)
+String PlatformSupport::createIsolatedFileSystemName(const String& storageIdentifier, const String& filesystemId)
+{
+ return AsyncFileSystemChromium::createIsolatedFileSystemName(storageIdentifier, filesystemId);
+}
+
+PassOwnPtr<AsyncFileSystem> PlatformSupport::createIsolatedFileSystem(const String& originString, const String& filesystemId)
+{
+ return AsyncFileSystemChromium::createIsolatedFileSystem(originString, filesystemId);
+}
+#endif
+
// Font -----------------------------------------------------------------------
#if OS(WINDOWS)
@@ -534,48 +532,6 @@ PassRefPtr<SerializedScriptValue> PlatformSupport::injectIDBKeyIntoSerializedVal
return webKitPlatformSupport()->injectIDBKeyIntoSerializedValue(key, value, keyPath);
}
-// Gamepad --------------------------------------------------------------------
-
-void PlatformSupport::sampleGamepads(GamepadList* into)
-{
- WebGamepads gamepads;
-
- webKitPlatformSupport()->sampleGamepads(gamepads);
-
- for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) {
- WebGamepad& webGamepad = gamepads.items[i];
- if (i < gamepads.length && webGamepad.connected) {
- RefPtr<Gamepad> gamepad = into->item(i);
- if (!gamepad)
- gamepad = Gamepad::create();
- gamepad->id(webGamepad.id);
- gamepad->index(i);
- gamepad->timestamp(webGamepad.timestamp);
- gamepad->axes(webGamepad.axesLength, webGamepad.axes);
- gamepad->buttons(webGamepad.buttonsLength, webGamepad.buttons);
- into->set(i, gamepad);
- } else
- into->set(i, 0);
- }
-}
-
-// Keygen ---------------------------------------------------------------------
-
-String PlatformSupport::signedPublicKeyAndChallengeString(
- unsigned keySizeIndex, const String& challenge, const KURL& url)
-{
- return webKitPlatformSupport()->signedPublicKeyAndChallengeString(keySizeIndex,
- WebString(challenge),
- WebURL(url));
-}
-
-// Language -------------------------------------------------------------------
-
-String PlatformSupport::computedDefaultLanguage()
-{
- return webKitPlatformSupport()->defaultLocale();
-}
-
// LayoutTestMode -------------------------------------------------------------
bool PlatformSupport::layoutTestMode()
@@ -583,46 +539,6 @@ bool PlatformSupport::layoutTestMode()
return WebKit::layoutTestMode();
}
-// MimeType -------------------------------------------------------------------
-
-bool PlatformSupport::isSupportedImageMIMEType(const String& mimeType)
-{
- return webKitPlatformSupport()->mimeRegistry()->supportsImageMIMEType(mimeType)
- != WebMimeRegistry::IsNotSupported;
-}
-
-bool PlatformSupport::isSupportedJavaScriptMIMEType(const String& mimeType)
-{
- return webKitPlatformSupport()->mimeRegistry()->supportsJavaScriptMIMEType(mimeType)
- != WebMimeRegistry::IsNotSupported;
-}
-
-bool PlatformSupport::isSupportedNonImageMIMEType(const String& mimeType)
-{
- return webKitPlatformSupport()->mimeRegistry()->supportsNonImageMIMEType(mimeType)
- != WebMimeRegistry::IsNotSupported;
-}
-
-String PlatformSupport::mimeTypeForExtension(const String& extension)
-{
- return webKitPlatformSupport()->mimeRegistry()->mimeTypeForExtension(extension);
-}
-
-String PlatformSupport::wellKnownMimeTypeForExtension(const String& extension)
-{
- return webKitPlatformSupport()->mimeRegistry()->wellKnownMimeTypeForExtension(extension);
-}
-
-String PlatformSupport::mimeTypeFromFile(const String& path)
-{
- return webKitPlatformSupport()->mimeRegistry()->mimeTypeFromFile(path);
-}
-
-String PlatformSupport::preferredExtensionForMIMEType(const String& mimeType)
-{
- return webKitPlatformSupport()->mimeRegistry()->preferredExtensionForMIMEType(mimeType);
-}
-
// Plugin ---------------------------------------------------------------------
bool PlatformSupport::plugins(bool refresh, Vector<PluginInfo>* results)
@@ -655,15 +571,6 @@ PassRefPtr<Image> PlatformSupport::loadPlatformImageResource(const char* name)
#if ENABLE(WEB_AUDIO)
-PassOwnPtr<AudioBus> PlatformSupport::loadPlatformAudioResource(const char* name, double sampleRate)
-{
- const WebData& resource = webKitPlatformSupport()->loadResource(name);
- if (resource.isEmpty())
- return nullptr;
-
- return decodeAudioFileData(resource.data(), resource.size(), sampleRate);
-}
-
PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate)
{
WebAudioBus webAudioBus;
@@ -674,13 +581,6 @@ PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size
#endif // ENABLE(WEB_AUDIO)
-// Sandbox --------------------------------------------------------------------
-
-bool PlatformSupport::sandboxEnabled()
-{
- return webKitPlatformSupport()->sandboxEnabled();
-}
-
// SharedTimers ---------------------------------------------------------------
void PlatformSupport::setSharedTimerFiredFunction(void (*func)())
@@ -693,40 +593,6 @@ void PlatformSupport::setSharedTimerFireInterval(double interval)
webKitPlatformSupport()->setSharedTimerFireInterval(interval);
}
-void PlatformSupport::stopSharedTimer()
-{
- webKitPlatformSupport()->stopSharedTimer();
-}
-
-// StatsCounters --------------------------------------------------------------
-
-void PlatformSupport::decrementStatsCounter(const char* name)
-{
- webKitPlatformSupport()->decrementStatsCounter(name);
-}
-
-void PlatformSupport::incrementStatsCounter(const char* name)
-{
- webKitPlatformSupport()->incrementStatsCounter(name);
-}
-
-void PlatformSupport::histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount)
-{
- webKitPlatformSupport()->histogramCustomCounts(name, sample, min, max, bucketCount);
-}
-
-void PlatformSupport::histogramEnumeration(const char* name, int sample, int boundaryValue)
-{
- webKitPlatformSupport()->histogramEnumeration(name, sample, boundaryValue);
-}
-
-// Sudden Termination ---------------------------------------------------------
-
-void PlatformSupport::suddenTerminationChanged(bool enabled)
-{
- webKitPlatformSupport()->suddenTerminationChanged(enabled);
-}
-
// Theming --------------------------------------------------------------------
#if OS(WINDOWS)
@@ -1032,31 +898,6 @@ void PlatformSupport::notifyJSOutOfMemory(Frame* frame)
webFrame->client()->didExhaustMemoryAvailableForScript(webFrame);
}
-int PlatformSupport::memoryUsageMB()
-{
- return static_cast<int>(webKitPlatformSupport()->memoryUsageMB());
-}
-
-int PlatformSupport::actualMemoryUsageMB()
-{
- return static_cast<int>(webKitPlatformSupport()->actualMemoryUsageMB());
-}
-
-int PlatformSupport::lowMemoryUsageMB()
-{
- return static_cast<int>(webKitPlatformSupport()->lowMemoryUsageMB());
-}
-
-int PlatformSupport::highMemoryUsageMB()
-{
- return static_cast<int>(webKitPlatformSupport()->highMemoryUsageMB());
-}
-
-int PlatformSupport::highUsageDeltaMB()
-{
- return static_cast<int>(webKitPlatformSupport()->highUsageDeltaMB());
-}
-
int PlatformSupport::screenHorizontalDPI(Widget* widget)
{
WebWidgetClient* client = toWebWidgetClient(widget);
@@ -1136,4 +977,9 @@ WorkerContextProxy* WorkerContextProxy::create(Worker* worker)
}
#endif
+bool PlatformSupport::canAccelerate2dCanvas()
+{
+ return webKitPlatformSupport()->canAccelerate2dCanvas();
+}
+
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/ResourceHandle.cpp b/Source/WebKit/chromium/src/ResourceHandle.cpp
deleted file mode 100644
index 6b2eb05ea..000000000
--- a/Source/WebKit/chromium/src/ResourceHandle.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ResourceHandle.h"
-
-#include "PlatformSupport.h"
-#include "ResourceHandleClient.h"
-#include "ResourceHandleInternal.h"
-#include "ResourceRequest.h"
-#include "SharedBuffer.h"
-
-#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebURLError.h"
-#include "platform/WebURLLoader.h"
-#include "platform/WebURLLoaderClient.h"
-#include "platform/WebURLRequest.h"
-#include "platform/WebURLResponse.h"
-#include "WrappedResourceRequest.h"
-#include "WrappedResourceResponse.h"
-
-using namespace WebKit;
-
-namespace WebCore {
-
-// ResourceHandleInternal -----------------------------------------------------
-ResourceHandleInternal::ResourceHandleInternal(const ResourceRequest& request, ResourceHandleClient* client)
- : m_request(request)
- , m_owner(0)
- , m_client(client)
- , m_state(ConnectionStateNew)
-{ }
-
-void ResourceHandleInternal::start()
-{
- if (m_state != ConnectionStateNew)
- CRASH();
- m_state = ConnectionStateStarted;
-
- m_loader = adoptPtr(webKitPlatformSupport()->createURLLoader());
- ASSERT(m_loader);
-
- WrappedResourceRequest wrappedRequest(m_request);
- wrappedRequest.setAllowStoredCredentials(allowStoredCredentials());
- m_loader->loadAsynchronously(wrappedRequest, this);
-}
-
-void ResourceHandleInternal::cancel()
-{
- m_state = ConnectionStateCanceled;
- m_loader->cancel();
-
- // Do not make any further calls to the client.
- m_client = 0;
-}
-
-void ResourceHandleInternal::setDefersLoading(bool value)
-{
- m_loader->setDefersLoading(value);
-}
-
-bool ResourceHandleInternal::allowStoredCredentials() const
-{
- return m_client && m_client->shouldUseCredentialStorage(m_owner);
-}
-
-void ResourceHandleInternal::willSendRequest(
- WebURLLoader*, WebURLRequest& request, const WebURLResponse& response)
-{
- ASSERT(m_client);
- ASSERT(!request.isNull());
- ASSERT(!response.isNull());
- m_client->willSendRequest(m_owner, request.toMutableResourceRequest(), response.toResourceResponse());
-}
-
-void ResourceHandleInternal::didSendData(
- WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
-{
- ASSERT(m_client);
- m_client->didSendData(m_owner, bytesSent, totalBytesToBeSent);
-}
-
-void ResourceHandleInternal::didReceiveResponse(WebURLLoader*, const WebURLResponse& response)
-{
- ASSERT(m_client);
- ASSERT(!response.isNull());
- bool isMultipart = response.isMultipartPayload();
- bool isValidStateTransition = (m_state == ConnectionStateStarted || m_state == ConnectionStateReceivedResponse);
- // In the case of multipart loads, calls to didReceiveData & didReceiveResponse can be interleaved.
- if (!isMultipart && !isValidStateTransition)
- CRASH();
- m_state = ConnectionStateReceivedResponse;
- m_client->didReceiveResponse(m_owner, response.toResourceResponse());
-}
-
-void ResourceHandleInternal::didDownloadData(WebURLLoader*, int dataLength)
-{
- ASSERT(m_client);
- if (m_state != ConnectionStateReceivedResponse)
- CRASH();
-
- m_client->didDownloadData(m_owner, dataLength);
-}
-
-void ResourceHandleInternal::didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength)
-{
- ASSERT(m_client);
- if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData)
- CRASH();
- m_state = ConnectionStateReceivingData;
-
- m_client->didReceiveData(m_owner, data, dataLength, encodedDataLength);
-}
-
-void ResourceHandleInternal::didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength)
-{
- ASSERT(m_client);
- if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData)
- CRASH();
-
- m_client->didReceiveCachedMetadata(m_owner, data, dataLength);
-}
-
-void ResourceHandleInternal::didFinishLoading(WebURLLoader*, double finishTime)
-{
- ASSERT(m_client);
- if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData)
- CRASH();
- m_state = ConnectionStateFinishedLoading;
- m_client->didFinishLoading(m_owner, finishTime);
-}
-
-void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error)
-{
- ASSERT(m_client);
- m_state = ConnectionStateFailed;
- m_client->didFail(m_owner, error);
-}
-
-ResourceHandleInternal* ResourceHandleInternal::FromResourceHandle(ResourceHandle* handle)
-{
- return handle->d.get();
-}
-
-// ResourceHandle -------------------------------------------------------------
-
-ResourceHandle::ResourceHandle(const ResourceRequest& request,
- ResourceHandleClient* client,
- bool defersLoading,
- bool shouldContentSniff)
- : d(adoptPtr(new ResourceHandleInternal(request, client)))
-{
- d->setOwner(this);
-
- // FIXME: Figure out what to do with the bool params.
-}
-
-PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context,
- const ResourceRequest& request,
- ResourceHandleClient* client,
- bool defersLoading,
- bool shouldContentSniff)
-{
- RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle(
- request, client, defersLoading, shouldContentSniff));
-
- if (newHandle->start(context))
- return newHandle.release();
-
- return 0;
-}
-
-ResourceRequest& ResourceHandle::firstRequest()
-{
- return d->request();
-}
-
-ResourceHandleClient* ResourceHandle::client() const
-{
- return d->client();
-}
-
-void ResourceHandle::setClient(ResourceHandleClient* client)
-{
- d->setClient(client);
-}
-
-void ResourceHandle::setDefersLoading(bool value)
-{
- d->setDefersLoading(value);
-}
-
-bool ResourceHandle::start(NetworkingContext* context)
-{
- d->start();
- return true;
-}
-
-bool ResourceHandle::hasAuthenticationChallenge() const
-{
- return false;
-}
-
-void ResourceHandle::clearAuthentication()
-{
-}
-
-void ResourceHandle::cancel()
-{
- d->cancel();
-}
-
-ResourceHandle::~ResourceHandle()
-{
- d->setOwner(0);
-}
-
-bool ResourceHandle::loadsBlocked()
-{
- return false; // This seems to be related to sync XMLHttpRequest...
-}
-
-// static
-void ResourceHandle::loadResourceSynchronously(NetworkingContext* context,
- const ResourceRequest& request,
- StoredCredentials storedCredentials,
- ResourceError& error,
- ResourceResponse& response,
- Vector<char>& data)
-{
- OwnPtr<WebURLLoader> loader = adoptPtr(webKitPlatformSupport()->createURLLoader());
- ASSERT(loader);
-
- WrappedResourceRequest requestIn(request);
- requestIn.setAllowStoredCredentials(storedCredentials == AllowStoredCredentials);
- WrappedResourceResponse responseOut(response);
- WebURLError errorOut;
- WebData dataOut;
-
- loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut);
-
- error = errorOut;
- data.clear();
- data.append(dataOut.data(), dataOut.size());
-}
-
-// static
-bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
-{
- // This method is used to determine if a POST request can be repeated from
- // cache, but you cannot really know until you actually try to read from the
- // cache. Even if we checked now, something else could come along and wipe
- // out the cache entry by the time we fetch it.
- //
- // So, we always say yes here, to prevent the FrameLoader from initiating a
- // reload. Then in FrameLoaderClientImpl::dispatchWillSendRequest, we
- // fix-up the cache policy of the request to force a load from the cache.
- //
- ASSERT(request.httpMethod() == "POST");
- return true;
-}
-
-// static
-void ResourceHandle::cacheMetadata(const ResourceResponse& response, const Vector<char>& data)
-{
- PlatformSupport::cacheMetadata(response.url(), response.responseTime(), data);
-}
-
-} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/ResourceHandleInternal.h b/Source/WebKit/chromium/src/ResourceHandleInternal.h
deleted file mode 100644
index 02bbe7313..000000000
--- a/Source/WebKit/chromium/src/ResourceHandleInternal.h
+++ /dev/null
@@ -1,97 +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:
- *
- * * 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 ResourceHandleInternal_h
-#define ResourceHandleInternal_h
-
-#include "ResourceRequest.h"
-#include "platform/WebCommon.h"
-#include "platform/WebURLLoader.h"
-#include "platform/WebURLLoaderClient.h"
-
-namespace WebCore {
-
-class ResourceHandle;
-class ResourceHandleClient;
-
-class ResourceHandleInternal : public WebKit::WebURLLoaderClient {
-public:
- ResourceHandleInternal(const ResourceRequest&, ResourceHandleClient*);
-
- virtual ~ResourceHandleInternal() { }
-
- void start();
- void cancel();
- void setDefersLoading(bool);
- bool allowStoredCredentials() const;
-
- // WebURLLoaderClient methods:
- virtual void willSendRequest(WebKit::WebURLLoader*, WebKit::WebURLRequest&, const WebKit::WebURLResponse&);
- virtual void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
- virtual void didReceiveResponse(WebKit::WebURLLoader*, const WebKit::WebURLResponse&);
- virtual void didDownloadData(WebKit::WebURLLoader*, int dataLength);
- virtual void didReceiveData(WebKit::WebURLLoader*, const char* data, int dataLength, int encodedDataLength);
-
- virtual void didReceiveCachedMetadata(WebKit::WebURLLoader*, const char* data, int dataLength);
- virtual void didFinishLoading(WebKit::WebURLLoader*, double finishTime);
- virtual void didFail(WebKit::WebURLLoader*, const WebKit::WebURLError&);
-
- enum ConnectionState {
- ConnectionStateNew,
- ConnectionStateStarted,
- ConnectionStateReceivedResponse,
- ConnectionStateReceivingData,
- ConnectionStateFinishedLoading,
- ConnectionStateCanceled,
- ConnectionStateFailed,
- };
-
- void setOwner(ResourceHandle* owner) { m_owner = owner; }
- ResourceRequest& request() { return m_request; }
- ResourceHandleClient* client() const { return m_client; }
- void setClient(ResourceHandleClient* client) { m_client = client; }
- WebKit::WebURLLoader* loader() const { return m_loader.get(); }
-
- static ResourceHandleInternal* FromResourceHandle(ResourceHandle*);
-
-private:
- ResourceRequest m_request;
- ResourceHandle* m_owner;
- ResourceHandleClient* m_client;
- OwnPtr<WebKit::WebURLLoader> m_loader;
-
- // Used for sanity checking to make sure we don't experience illegal state
- // transitions.
- ConnectionState m_state;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/WebKit/chromium/src/ScrollbarGroup.cpp b/Source/WebKit/chromium/src/ScrollbarGroup.cpp
index 579dc7aa7..19fdbade4 100644
--- a/Source/WebKit/chromium/src/ScrollbarGroup.cpp
+++ b/Source/WebKit/chromium/src/ScrollbarGroup.cpp
@@ -36,23 +36,23 @@ using namespace WebCore;
namespace WebKit {
-ScrollbarGroup::ScrollbarGroup(FrameView* frameView)
+ScrollbarGroup::ScrollbarGroup(FrameView* frameView, const IntRect& frameRect)
: m_frameView(frameView)
+ , m_frameRect(frameRect)
, m_horizontalScrollbar(0)
, m_verticalScrollbar(0)
{
- m_frameView->addScrollableArea(this);
}
ScrollbarGroup::~ScrollbarGroup()
{
ASSERT(!m_horizontalScrollbar);
ASSERT(!m_verticalScrollbar);
- m_frameView->removeScrollableArea(this);
}
void ScrollbarGroup::scrollbarCreated(WebScrollbarImpl* scrollbar)
{
+ bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar;
if (scrollbar->scrollbar()->orientation() == HorizontalScrollbar) {
ASSERT(!m_horizontalScrollbar);
m_horizontalScrollbar = scrollbar;
@@ -62,6 +62,11 @@ void ScrollbarGroup::scrollbarCreated(WebScrollbarImpl* scrollbar)
m_verticalScrollbar = scrollbar;
didAddVerticalScrollbar(scrollbar->scrollbar());
}
+
+ if (!hadScrollbars) {
+ m_frameView->addScrollableArea(this);
+ m_frameView->setNeedsLayout();
+ }
}
void ScrollbarGroup::scrollbarDestroyed(WebScrollbarImpl* scrollbar)
@@ -74,6 +79,11 @@ void ScrollbarGroup::scrollbarDestroyed(WebScrollbarImpl* scrollbar)
willRemoveVerticalScrollbar(scrollbar->scrollbar());
m_verticalScrollbar = 0;
}
+
+ if (!m_horizontalScrollbar && !m_verticalScrollbar) {
+ m_frameView->removeScrollableArea(this);
+ m_frameView->setNeedsLayout();
+ }
}
void ScrollbarGroup::setLastMousePosition(const IntPoint& point)
@@ -129,6 +139,16 @@ ScrollableArea* ScrollbarGroup::enclosingScrollableArea() const
return 0;
}
+void ScrollbarGroup::setFrameRect(const IntRect& frameRect)
+{
+ m_frameRect = frameRect;
+}
+
+IntRect ScrollbarGroup::scrollableAreaBoundingBox() const
+{
+ return m_frameRect;
+}
+
bool ScrollbarGroup::isScrollCornerVisible() const
{
return false;
diff --git a/Source/WebKit/chromium/src/ScrollbarGroup.h b/Source/WebKit/chromium/src/ScrollbarGroup.h
index 44be2cf51..aeb44052f 100644
--- a/Source/WebKit/chromium/src/ScrollbarGroup.h
+++ b/Source/WebKit/chromium/src/ScrollbarGroup.h
@@ -40,12 +40,13 @@ class WebScrollbarImpl;
class ScrollbarGroup : public WebCore::ScrollableArea {
public:
- explicit ScrollbarGroup(WebCore::FrameView*);
+ ScrollbarGroup(WebCore::FrameView*, const WebCore::IntRect& frameRect);
~ScrollbarGroup();
void scrollbarCreated(WebScrollbarImpl*);
void scrollbarDestroyed(WebScrollbarImpl*);
void setLastMousePosition(const WebCore::IntPoint&);
+ void setFrameRect(const WebCore::IntRect&);
// WebCore::ScrollableArea methods
virtual int scrollSize(WebCore::ScrollbarOrientation) const;
@@ -72,10 +73,12 @@ public:
virtual bool shouldSuspendScrollAnimations() const;
virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
virtual bool isOnActivePage() const;
+ virtual WebCore::IntRect scrollableAreaBoundingBox() const;
private:
WebCore::FrameView* m_frameView;
WebCore::IntPoint m_lastMousePosition;
+ WebCore::IntRect m_frameRect;
WebScrollbarImpl* m_horizontalScrollbar;
WebScrollbarImpl* m_verticalScrollbar;
};
diff --git a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
index e7aae4263..70b800b5c 100644
--- a/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
+++ b/Source/WebKit/chromium/src/SharedWorkerRepository.cpp
@@ -171,8 +171,8 @@ void SharedWorkerScriptLoader::notifyFinished()
InspectorInstrumentation::scriptImported(m_worker->scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
// Pass the script off to the worker, then send a connect event.
m_webWorker->startWorkerContext(m_url, m_name, m_worker->scriptExecutionContext()->userAgent(m_url), m_scriptLoader->script(),
- m_worker->scriptExecutionContext()->contentSecurityPolicy()->policy(),
- static_cast<WebKit::WebContentSecurityPolicyType>(m_worker->scriptExecutionContext()->contentSecurityPolicy()->headerType()),
+ m_worker->scriptExecutionContext()->contentSecurityPolicy()->deprecatedHeader(),
+ static_cast<WebKit::WebContentSecurityPolicyType>(m_worker->scriptExecutionContext()->contentSecurityPolicy()->deprecatedHeaderType()),
m_responseAppCacheID);
sendConnect();
}
diff --git a/Source/WebKit/chromium/src/SocketStreamHandle.cpp b/Source/WebKit/chromium/src/SocketStreamHandle.cpp
index 298e733a4..5eed90011 100644
--- a/Source/WebKit/chromium/src/SocketStreamHandle.cpp
+++ b/Source/WebKit/chromium/src/SocketStreamHandle.cpp
@@ -61,9 +61,12 @@ SocketStreamHandleInternal::~SocketStreamHandleInternal()
void SocketStreamHandleInternal::connect(const KURL& url)
{
- m_socket = adoptPtr(webKitPlatformSupport()->createSocketStreamHandle());
+ m_socket = adoptPtr(WebKit::Platform::current()->createSocketStreamHandle());
LOG(Network, "connect");
ASSERT(m_socket);
+ ASSERT(m_handle);
+ if (m_handle->m_client)
+ m_handle->m_client->willOpenSocketStream(m_handle);
m_socket->connect(url, this);
}
@@ -89,7 +92,8 @@ int SocketStreamHandleInternal::send(const char* data, int len)
void SocketStreamHandleInternal::close()
{
LOG(Network, "close");
- m_socket->close();
+ if (m_socket)
+ m_socket->close();
}
void SocketStreamHandleInternal::didOpenStream(WebSocketStreamHandle* socketHandle, int maxPendingSendAllowed)
diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp
new file mode 100644
index 000000000..2754c415a
--- /dev/null
+++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "SpeechRecognitionClientProxy.h"
+
+#include "SpeechGrammarList.h"
+#include "SpeechRecognition.h"
+#include "SpeechRecognitionError.h"
+#include "SpeechRecognitionResult.h"
+#include "SpeechRecognitionResultList.h"
+#include "WebSpeechGrammar.h"
+#include "WebSpeechRecognitionHandle.h"
+#include "WebSpeechRecognitionParams.h"
+#include "WebSpeechRecognitionResult.h"
+#include "WebSpeechRecognizer.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy()
+{
+}
+
+PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(WebSpeechRecognizer* recognizer)
+{
+ return adoptPtr(new SpeechRecognitionClientProxy(recognizer));
+}
+
+void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous)
+{
+ WebVector<WebSpeechGrammar> webSpeechGrammars(static_cast<size_t>(grammarList->length()));
+ for (unsigned long i = 0; i < grammarList->length(); ++i)
+ webSpeechGrammars[i] = grammarList->item(i);
+
+ m_recognizer->start(WebSpeechRecognitionHandle(recognition), WebSpeechRecognitionParams(webSpeechGrammars, lang, continuous), this);
+}
+
+void SpeechRecognitionClientProxy::stop(SpeechRecognition* recognition)
+{
+ m_recognizer->stop(WebSpeechRecognitionHandle(recognition), this);
+}
+
+void SpeechRecognitionClientProxy::abort(SpeechRecognition* recognition)
+{
+ m_recognizer->abort(WebSpeechRecognitionHandle(recognition), this);
+}
+
+void SpeechRecognitionClientProxy::didStartAudio(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didStartAudio();
+}
+
+void SpeechRecognitionClientProxy::didStartSound(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didStartSound();
+}
+
+void SpeechRecognitionClientProxy::didStartSpeech(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didStartSpeech();
+}
+
+void SpeechRecognitionClientProxy::didEndSpeech(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didEndSpeech();
+}
+
+void SpeechRecognitionClientProxy::didEndSound(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didEndSound();
+}
+
+void SpeechRecognitionClientProxy::didEndAudio(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didEndAudio();
+}
+
+void SpeechRecognitionClientProxy::didReceiveResult(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionResult& result, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+
+ Vector<RefPtr<SpeechRecognitionResult> > resultHistoryVector(resultHistory.size());
+ for (size_t i = 0; i < resultHistory.size(); ++i)
+ resultHistoryVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(resultHistory[i]);
+
+ recognition->didReceiveResult(result, resultIndex, SpeechRecognitionResultList::create(resultHistoryVector));
+
+}
+
+void SpeechRecognitionClientProxy::didReceiveNoMatch(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionResult& result)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didReceiveNoMatch(result);
+}
+
+void SpeechRecognitionClientProxy::didDeleteResult(const WebSpeechRecognitionHandle& handle, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+
+ Vector<RefPtr<SpeechRecognitionResult> > resultHistoryVector(resultHistory.size());
+ for (size_t i = 0; i < resultHistory.size(); ++i)
+ resultHistoryVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(resultHistory[i]);
+
+ recognition->didDeleteResult(resultIndex, SpeechRecognitionResultList::create(resultHistoryVector));
+}
+
+void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, unsigned short code)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ SpeechRecognitionError::Code errorCode = static_cast<SpeechRecognitionError::Code>(code);
+ recognition->didReceiveError(SpeechRecognitionError::create(errorCode, message));
+}
+
+void SpeechRecognitionClientProxy::didStart(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didStart();
+}
+
+void SpeechRecognitionClientProxy::didEnd(const WebSpeechRecognitionHandle& handle)
+{
+ RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
+ recognition->didEnd();
+}
+
+SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer* recognizer)
+ : m_recognizer(recognizer)
+{
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h
new file mode 100644
index 000000000..a35541ea4
--- /dev/null
+++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechRecognitionClientProxy_h
+#define SpeechRecognitionClientProxy_h
+
+#include "PlatformString.h"
+#include "SpeechRecognitionClient.h"
+#include "WebSpeechRecognizerClient.h"
+#include <wtf/Compiler.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+
+class WebSpeechRecognizer;
+class WebString;
+
+class SpeechRecognitionClientProxy : public WebCore::SpeechRecognitionClient, public WebSpeechRecognizerClient {
+public:
+ ~SpeechRecognitionClientProxy();
+
+ // Constructing a proxy object with a 0 WebSpeechRecognizer is safe in
+ // itself, but attempting to call start/stop/abort on it will crash.
+ static PassOwnPtr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*);
+
+ // WebCore::SpeechRecognitionClient:
+ virtual void start(WebCore::SpeechRecognition*, const WebCore::SpeechGrammarList*, const String& lang, bool continuous) OVERRIDE;
+ virtual void stop(WebCore::SpeechRecognition*) OVERRIDE;
+ virtual void abort(WebCore::SpeechRecognition*) OVERRIDE;
+
+ // WebSpeechRecognizerClient:
+ virtual void didStartAudio(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didStartSound(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didStartSpeech(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didEndSpeech(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didEndSound(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didEndAudio(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE;
+ virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE;
+ virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE;
+ virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, unsigned short code) OVERRIDE;
+ virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE;
+ virtual void didEnd(const WebSpeechRecognitionHandle&) OVERRIDE;
+
+private:
+ SpeechRecognitionClientProxy(WebSpeechRecognizer*);
+
+ WebSpeechRecognizer* m_recognizer;
+};
+
+}; // namespace WebKit
+
+#endif // SpeechRecognitionClientProxy_h
diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp
index c707eb05a..11eb7cec3 100644
--- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp
+++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp
@@ -35,8 +35,9 @@
#include "Page.h"
#include "PageGroup.h"
#include "SecurityOrigin.h"
-#include "StorageAreaImpl.h"
+#include "Storage.h"
#include "StorageEvent.h"
+#include "StorageNamespaceProxy.h"
#include "WebFrameImpl.h"
#include "WebPermissionClient.h"
@@ -122,6 +123,7 @@ bool StorageAreaProxy::contains(const String& key, Frame* frame) const
return !getItem(key, frame).isNull();
}
+// FIXME: remove this method and the calls to it from our setters after multi-side patch landing is done.
// Copied from WebCore/storage/StorageEventDispatcher.cpp out of necessity. It's probably best to keep it current.
void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Frame* sourceFrame)
{
@@ -140,6 +142,8 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c
}
for (unsigned i = 0; i < frames.size(); ++i) {
+ // FIXME: maybe only raise if the window has an onstorage listener
+ // attached to avoid creating the Storage instance.
ExceptionCode ec = 0;
Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
if (!ec)
@@ -157,6 +161,8 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c
}
for (unsigned i = 0; i < frames.size(); ++i) {
+ // FIXME: maybe only raise if the window has an onstorage listener
+ // attached to avoid creating the Storage instance.
ExceptionCode ec = 0;
Storage* storage = frames[i]->domWindow()->localStorage(ec);
if (!ec)
@@ -174,4 +180,76 @@ bool StorageAreaProxy::canAccessStorage(Frame* frame) const
return !webView->permissionClient() || webView->permissionClient()->allowStorage(webFrame, m_storageType == LocalStorage);
}
+void StorageAreaProxy::dispatchLocalStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
+ SecurityOrigin* securityOrigin, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
+{
+ // FIXME: Multi-sided patch engineering alert !
+ // step 1: this method gets defined and implemented in webkit/webcore with the early return.
+ // step 2: this method starts getting called by chromium still with the early return.
+ // step 3: This class's setters are modified to no longer raise SessionStorage
+ // events for inprocess changes and this early return is removed.
+ if (originatedInProcess)
+ return;
+
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages();
+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
+ for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalLocalStorage(), sourceAreaInstance)) {
+ // FIXME: maybe only raise if the window has an onstorage listener attached to avoid creating the Storage instance.
+ ExceptionCode ec = 0;
+ Storage* storage = frame->domWindow()->localStorage(ec);
+ if (!ec)
+ frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
+ }
+ }
+ }
+}
+
+static Page* findPageWithSessionStorageNamespace(const String& pageGroupName, const WebKit::WebStorageNamespace& sessionNamespace)
+{
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroupName)->pages();
+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
+ const bool createIfNeeded = true;
+ StorageNamespaceProxy* proxy = static_cast<StorageNamespaceProxy*>((*it)->sessionStorage(createIfNeeded));
+ if (proxy->isSameNamespace(sessionNamespace))
+ return *it;
+ }
+ return 0;
+}
+
+void StorageAreaProxy::dispatchSessionStorageEvent(const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
+ SecurityOrigin* securityOrigin, const KURL& pageURL, const WebKit::WebStorageNamespace& sessionNamespace,
+ WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess)
+{
+ // FIXME: Multi-sided patch engineering alert !
+ // step 1: this method gets defined and implemented in webkit/webcore with the early return.
+ // step 2: this method starts getting called by chromium still with the early return.
+ // step 3: This class's setters are modified to no longer raise SessionStorage
+ // events for inprocess changes and this early return is removed.
+ if (originatedInProcess)
+ return;
+
+ Page* page = findPageWithSessionStorageNamespace(pageGroupName, sessionNamespace);
+ if (!page)
+ return;
+
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(frame->domWindow()->optionalSessionStorage(), sourceAreaInstance)) {
+ // FIXME: maybe only raise if the window has an onstorage listener attached to avoid creating the Storage instance.
+ ExceptionCode ec = 0;
+ Storage* storage = frame->domWindow()->sessionStorage(ec);
+ if (!ec)
+ frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
+ }
+ }
+}
+
+bool StorageAreaProxy::isEventSource(Storage* storage, WebKit::WebStorageArea* sourceAreaInstance)
+{
+ if (!storage)
+ return false;
+ StorageAreaProxy* areaProxy = static_cast<StorageAreaProxy*>(storage->area());
+ return areaProxy->m_storageArea == sourceAreaInstance;
+}
+
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.h b/Source/WebKit/chromium/src/StorageAreaProxy.h
index 2949a5227..ab2357470 100644
--- a/Source/WebKit/chromium/src/StorageAreaProxy.h
+++ b/Source/WebKit/chromium/src/StorageAreaProxy.h
@@ -28,12 +28,18 @@
#include "StorageArea.h"
-namespace WebKit { class WebStorageArea; }
+namespace WebKit {
+class WebStorageArea;
+class WebStorageNamespace;
+}
namespace WebCore {
class Frame;
+class KURL;
+class Page;
class SecurityOrigin;
+class Storage;
class StorageAreaProxy : public StorageArea {
public:
@@ -51,10 +57,20 @@ public:
virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; }
+ static void dispatchLocalStorageEvent(
+ const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
+ SecurityOrigin*, const KURL& pageURL, WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
+ static void dispatchSessionStorageEvent(
+ const String& pageGroupName, const String& key, const String& oldValue, const String& newValue,
+ SecurityOrigin*, const KURL& pageURL, const WebKit::WebStorageNamespace&,
+ WebKit::WebStorageArea* sourceAreaInstance, bool originatedInProcess);
+
private:
void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame);
bool canAccessStorage(Frame*) const;
+ static bool isEventSource(Storage*, WebKit::WebStorageArea* sourceAreaInstance);
+
OwnPtr<WebKit::WebStorageArea> m_storageArea;
StorageType m_storageType;
};
diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherChromium.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherChromium.cpp
deleted file mode 100644
index 0fa899cc4..000000000
--- a/Source/WebKit/chromium/src/StorageEventDispatcherChromium.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "StorageEventDispatcher.h"
-
-#include "SecurityOrigin.h"
-#include "StorageArea.h"
-
-#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
-
-namespace WebCore {
-
-void StorageEventDispatcher::dispatch(const String& key, const String& oldValue,
- const String& newValue, StorageType storageType,
- SecurityOrigin* origin, Frame* sourceFrame)
-{
- ASSERT(!sourceFrame); // Sad, but true.
- WebKit::webKitPlatformSupport()->dispatchStorageEvent(key, oldValue, newValue, origin->toString(), WebKit::WebURL(), storageType == LocalStorage);
-}
-
-} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp
index 7ee3eb2b1..e948b597c 100644
--- a/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp
+++ b/Source/WebKit/chromium/src/StorageEventDispatcherImpl.cpp
@@ -41,6 +41,8 @@
#include "SecurityOrigin.h"
#include "StorageEvent.h"
+// FIXME: delete this almost obsolete file soon
+
namespace WebCore {
StorageEventDispatcherImpl::StorageEventDispatcherImpl(const String& groupName)
diff --git a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp
index 6a5cbd960..5c37e396c 100644
--- a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp
+++ b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp
@@ -82,7 +82,7 @@ PassRefPtr<StorageArea> StorageNamespaceProxy::storageArea(PassRefPtr<SecurityOr
void StorageNamespaceProxy::close()
{
- m_storageNamespace->close();
+ // N/A to the chromium port.
}
void StorageNamespaceProxy::clearOriginForDeletion(SecurityOrigin* origin)
@@ -100,4 +100,9 @@ void StorageNamespaceProxy::sync()
ASSERT_NOT_REACHED();
}
+bool StorageNamespaceProxy::isSameNamespace(const WebKit::WebStorageNamespace& sessionNamespace)
+{
+ return m_storageNamespace->isSameNamespace(sessionNamespace);
+}
+
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/StorageNamespaceProxy.h b/Source/WebKit/chromium/src/StorageNamespaceProxy.h
index 6cced8955..f1b45fc5b 100644
--- a/Source/WebKit/chromium/src/StorageNamespaceProxy.h
+++ b/Source/WebKit/chromium/src/StorageNamespaceProxy.h
@@ -39,13 +39,14 @@ public:
virtual ~StorageNamespaceProxy();
virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>);
virtual PassRefPtr<StorageNamespace> copy();
+
virtual void close();
-
virtual void clearOriginForDeletion(SecurityOrigin*);
virtual void clearAllOriginsForDeletion();
-
virtual void sync();
+ bool isSameNamespace(const WebKit::WebStorageNamespace&);
+
private:
OwnPtr<WebKit::WebStorageNamespace> m_storageNamespace;
StorageType m_storageType;
diff --git a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp
new file mode 100644
index 000000000..e58c022ee
--- /dev/null
+++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp
@@ -0,0 +1,119 @@
+/*
+ * 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 "TextFieldDecoratorImpl.h"
+
+#include "CachedImage.h"
+#include "HTMLInputElement.h"
+#include "Image.h"
+#include "WebInputElement.h"
+#include "WebTextFieldDecoratorClient.h"
+
+namespace WebKit {
+
+using namespace WebCore;
+
+inline TextFieldDecoratorImpl::TextFieldDecoratorImpl(WebTextFieldDecoratorClient* client)
+ : m_client(client)
+{
+ ASSERT(client);
+}
+
+PassOwnPtr<TextFieldDecoratorImpl> TextFieldDecoratorImpl::create(WebTextFieldDecoratorClient* client)
+{
+ return adoptPtr(new TextFieldDecoratorImpl(client));
+}
+
+TextFieldDecoratorImpl::~TextFieldDecoratorImpl()
+{
+}
+
+bool TextFieldDecoratorImpl::willAddDecorationTo(HTMLInputElement* input)
+{
+ ASSERT(input);
+ return m_client->shouldAddDecorationTo(WebInputElement(input));
+}
+
+CachedImage* TextFieldDecoratorImpl::imageForNormalState()
+{
+ if (!m_cachedImageForNormalState) {
+ WebCString imageName = m_client->imageNameForNormalState();
+ ASSERT(!imageName.isEmpty());
+ RefPtr<Image> image = Image::loadPlatformResource(imageName.data());
+ m_cachedImageForNormalState = new CachedImage(image.get());
+ // The CachedImage owns a RefPtr to the Image.
+ }
+ return m_cachedImageForNormalState.get();
+}
+
+CachedImage* TextFieldDecoratorImpl::imageForDisabledState()
+{
+ if (!m_cachedImageForDisabledState) {
+ WebCString imageName = m_client->imageNameForDisabledState();
+ if (imageName.isEmpty())
+ m_cachedImageForDisabledState = imageForNormalState();
+ else {
+ RefPtr<Image> image = Image::loadPlatformResource(imageName.data());
+ m_cachedImageForDisabledState = new CachedImage(image.get());
+ }
+ }
+ return m_cachedImageForDisabledState.get();
+}
+
+CachedImage* TextFieldDecoratorImpl::imageForReadonlyState()
+{
+ if (!m_cachedImageForReadonlyState) {
+ WebCString imageName = m_client->imageNameForReadOnlyState();
+ if (imageName.isEmpty())
+ m_cachedImageForDisabledState = imageForDisabledState();
+ else {
+ RefPtr<Image> image = Image::loadPlatformResource(imageName.data());
+ m_cachedImageForReadonlyState = new CachedImage(image.get());
+ }
+ }
+ return m_cachedImageForReadonlyState.get();
+}
+
+void TextFieldDecoratorImpl::handleClick(HTMLInputElement* input)
+{
+ ASSERT(input);
+ WebInputElement webInput(input);
+ m_client->handleClick(webInput);
+}
+
+void TextFieldDecoratorImpl::willDetach(HTMLInputElement* input)
+{
+ ASSERT(input);
+ WebInputElement webInput(input);
+ m_client->willDetach(webInput);
+}
+
+}
diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h
index f5c3d8ada..667475282 100644
--- a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h
+++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h
@@ -28,46 +28,37 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MediaStreamCenterInternal_h
-#define MediaStreamCenterInternal_h
+#ifndef TextFieldDecoratorImpl_h
+#define TextFieldDecoratorImpl_h
-#if ENABLE(MEDIA_STREAM)
-
-#include "platform/WebMediaStreamCenterClient.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include "CachedResourceHandle.h"
+#include "TextFieldDecorationElement.h"
namespace WebKit {
-class WebMediaStreamCenter;
-}
-namespace WebCore {
+class WebTextFieldDecoratorClient;
-class MediaStreamCenter;
-class MediaStreamComponent;
-class MediaStreamDescriptor;
-class MediaStreamSourcesQueryClient;
-
-class MediaStreamCenterInternal : public WebKit::WebMediaStreamCenterClient {
+class TextFieldDecoratorImpl : public WebCore::TextFieldDecorator {
public:
- explicit MediaStreamCenterInternal(MediaStreamCenter*);
- ~MediaStreamCenterInternal();
+ static PassOwnPtr<TextFieldDecoratorImpl> create(WebTextFieldDecoratorClient*);
+ virtual ~TextFieldDecoratorImpl();
- void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
- void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
- void didStopLocalMediaStream(MediaStreamDescriptor*);
- void didConstructMediaStream(MediaStreamDescriptor*);
+private:
+ virtual bool willAddDecorationTo(WebCore::HTMLInputElement*) OVERRIDE;
+ virtual WebCore::CachedImage* imageForNormalState() OVERRIDE;
+ virtual WebCore::CachedImage* imageForDisabledState() OVERRIDE;
+ virtual WebCore::CachedImage* imageForReadonlyState() OVERRIDE;
+ virtual void handleClick(WebCore::HTMLInputElement*) OVERRIDE;
+ virtual void willDetach(WebCore::HTMLInputElement*) OVERRIDE;
- // From WebKit::WebMediaStreamCenterClient.
- virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&);
+ TextFieldDecoratorImpl(WebTextFieldDecoratorClient*);
-private:
- OwnPtr<WebKit::WebMediaStreamCenter> m_private;
- MediaStreamCenter* m_owner;
+ WebTextFieldDecoratorClient* m_client;
+ WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForNormalState;
+ WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForDisabledState;
+ WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForReadonlyState;
};
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
+}
-#endif // MediaStreamCenterInternal_h
+#endif // TextFieldDecoratorImpl_h
diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp
index 9c0bf58e1..ca8a98dcb 100644
--- a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp
+++ b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp
@@ -58,12 +58,6 @@ void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpReque
if (m_client) {
RefPtr<UserMediaRequest> request = prpRequest;
- // FIXME: Cleanup when the chromium code has switched to the split sources implementation.
- MediaStreamSourceVector combinedSources;
- combinedSources.append(audioSources);
- combinedSources.append(videoSources);
- m_client->requestUserMedia(PassRefPtr<UserMediaRequest>(request.get()), combinedSources);
-
m_client->requestUserMedia(request.release(), audioSources, videoSources);
}
}
diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp
deleted file mode 100644
index fcce939f7..000000000
--- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "VideoFrameChromiumImpl.h"
-
-#include "VideoFrameChromium.h"
-#include "WebVideoFrame.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebVideoFrame* VideoFrameChromiumImpl::toWebVideoFrame(VideoFrameChromium* videoFrame)
-{
- VideoFrameChromiumImpl* wrappedFrame = static_cast<VideoFrameChromiumImpl*>(videoFrame);
- if (wrappedFrame)
- return wrappedFrame->m_webVideoFrame;
- return 0;
-}
-
-VideoFrameChromiumImpl::VideoFrameChromiumImpl(WebVideoFrame* webVideoFrame)
- : m_webVideoFrame(webVideoFrame)
-{
-}
-
-VideoFrameChromium::Format VideoFrameChromiumImpl::format() const
-{
- if (m_webVideoFrame)
- return static_cast<VideoFrameChromium::Format>(m_webVideoFrame->format());
- return Invalid;
-}
-
-unsigned VideoFrameChromiumImpl::width() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->width();
- return 0;
-}
-
-unsigned VideoFrameChromiumImpl::width(unsigned plane) const
-{
- unsigned planeWidth = width();
- if (format() == YV12 && plane != static_cast<unsigned>(yPlane))
- planeWidth /= 2;
- return planeWidth;
-}
-
-unsigned VideoFrameChromiumImpl::height() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->height();
- return 0;
-}
-
-unsigned VideoFrameChromiumImpl::height(unsigned plane) const
-{
- unsigned planeHeight = height();
- if (format() == YV12 && plane != static_cast<unsigned>(yPlane))
- planeHeight /= 2;
- return planeHeight;
-}
-
-unsigned VideoFrameChromiumImpl::planes() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->planes();
- return 0;
-}
-
-int VideoFrameChromiumImpl::stride(unsigned plane) const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->stride(plane);
- return 0;
-}
-
-const void* VideoFrameChromiumImpl::data(unsigned plane) const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->data(plane);
- return 0;
-}
-
-const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const
-{
- return IntSize(stride(plane), height(plane));
-}
-
-bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const
-{
- if (m_webVideoFrame)
- return stride(plane) - width(plane) > 0;
- return false;
-}
-
-unsigned VideoFrameChromiumImpl::textureId() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->textureId();
- return 0;
-}
-
-unsigned VideoFrameChromiumImpl::textureTarget() const
-{
- if (m_webVideoFrame)
- return m_webVideoFrame->textureTarget();
- return 0;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h
deleted file mode 100644
index 67920866f..000000000
--- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef VideoFrameChromiumImpl_h
-#define VideoFrameChromiumImpl_h
-
-#include "VideoFrameChromium.h"
-#include "WebVideoFrame.h"
-
-namespace WebKit {
-
-// A wrapper class for WebKit::WebVideoFrame. Objects can be created in WebKit
-// and used in WebCore because of the VideoFrameChromium interface.
-class VideoFrameChromiumImpl : public WebCore::VideoFrameChromium {
-public:
- // Converts a WebCore::VideoFrameChromium to a WebKit::WebVideoFrame.
- static WebVideoFrame* toWebVideoFrame(WebCore::VideoFrameChromium*);
-
- // Creates a VideoFrameChromiumImpl object to wrap the given WebVideoFrame.
- // The VideoFrameChromiumImpl does not take ownership of the WebVideoFrame
- // and should not free the frame's memory.
- VideoFrameChromiumImpl(WebVideoFrame*);
- virtual Format format() const;
- virtual unsigned width() const;
- virtual unsigned width(unsigned plane) const;
- virtual unsigned height() const;
- virtual unsigned height(unsigned plane) const;
- virtual unsigned planes() const;
- virtual int stride(unsigned plane) const;
- virtual const void* data(unsigned plane) const;
- virtual const WebCore::IntSize requiredTextureSize(unsigned plane) const;
- virtual bool hasPaddingBytes(unsigned plane) const;
- virtual unsigned textureId() const;
- virtual unsigned textureTarget() const;
-
-private:
- WebVideoFrame* m_webVideoFrame;
-};
-
-} // namespace WebKit
-
-#endif
diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp
index 489347bf2..f556dbdf4 100644
--- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp
+++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp
@@ -493,7 +493,7 @@ WebRect WebAccessibilityObject::boundingBoxRect() const
return WebRect();
m_private->updateBackingStore();
- return m_private->boundingBoxRect();
+ return m_private->pixelSnappedBoundingBoxRect();
}
double WebAccessibilityObject::estimatedLoadingProgress() const
diff --git a/Source/WebKit/chromium/src/WebArrayBuffer.cpp b/Source/WebKit/chromium/src/WebArrayBuffer.cpp
index 888c048e4..d43874b63 100644
--- a/Source/WebKit/chromium/src/WebArrayBuffer.cpp
+++ b/Source/WebKit/chromium/src/WebArrayBuffer.cpp
@@ -31,8 +31,8 @@
#include "config.h"
#include "WebArrayBuffer.h"
-#include "ArrayBuffer.h"
#include "V8ArrayBuffer.h"
+#include <wtf/ArrayBuffer.h>
#include <wtf/PassOwnPtr.h>
using namespace WebCore;
@@ -74,6 +74,14 @@ v8::Handle<v8::Value> WebArrayBuffer::toV8Value()
{
return V8ArrayBuffer::wrap(m_private.get());
}
+
+WebArrayBuffer* WebArrayBuffer::createFromV8Value(v8::Handle<v8::Value> value)
+{
+ if (!V8ArrayBuffer::HasInstance(value))
+ return 0;
+ WTF::ArrayBuffer* buffer = V8ArrayBuffer::toNative(value->ToObject());
+ return new WebArrayBuffer(buffer);
+}
#endif
WebArrayBuffer::WebArrayBuffer(const WTF::PassRefPtr<WTF::ArrayBuffer>& blob)
diff --git a/Source/WebKit/chromium/src/WebArrayBufferView.cpp b/Source/WebKit/chromium/src/WebArrayBufferView.cpp
index f7bb5c9da..5d5f573b9 100644
--- a/Source/WebKit/chromium/src/WebArrayBufferView.cpp
+++ b/Source/WebKit/chromium/src/WebArrayBufferView.cpp
@@ -29,7 +29,8 @@
#include "config.h"
#include "platform/WebArrayBufferView.h"
-#include "ArrayBufferView.h"
+#include "V8ArrayBufferView.h"
+#include <wtf/ArrayBufferView.h>
using namespace WTF;
@@ -60,6 +61,16 @@ unsigned WebArrayBufferView::byteLength() const
return m_private->byteLength();
}
+#if WEBKIT_USING_V8
+WebArrayBufferView* WebArrayBufferView::createFromV8Value(v8::Handle<v8::Value> value)
+{
+ if (!WebCore::V8ArrayBufferView::HasInstance(value))
+ return 0;
+ ArrayBufferView* view = WebCore::V8ArrayBufferView::toNative(value->ToObject());
+ return new WebArrayBufferView(view);
+}
+#endif
+
WebArrayBufferView::WebArrayBufferView(const PassRefPtr<ArrayBufferView>& value)
: m_private(value)
{
diff --git a/Source/WebKit/chromium/src/WebAttribute.cpp b/Source/WebKit/chromium/src/WebAttribute.cpp
deleted file mode 100644
index 500fd3556..000000000
--- a/Source/WebKit/chromium/src/WebAttribute.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebAttribute.h"
-
-#include "Attribute.h"
-#include "platform/WebString.h"
-#include <wtf/PassRefPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebAttribute::reset()
-{
- m_private.reset();
-}
-
-void WebAttribute::assign(const WebAttribute& other)
-{
- m_private = other.m_private;
-}
-
-WebAttribute::WebAttribute(const PassRefPtr<Attribute>& other)
- : m_private(other)
-{
-}
-
-WebString WebAttribute::localName() const
-{
- return WebString(m_private->localName());
-}
-
-WebString WebAttribute::value() const
-{
- return WebString(m_private->value());
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebAudioBus.cpp b/Source/WebKit/chromium/src/WebAudioBus.cpp
deleted file mode 100644
index cc447ba20..000000000
--- a/Source/WebKit/chromium/src/WebAudioBus.cpp
+++ /dev/null
@@ -1,132 +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 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 "platform/WebAudioBus.h"
-
-#if ENABLE(WEB_AUDIO)
-#include "AudioBus.h"
-#else
-namespace WebCore {
-class AudioBus {
-};
-} // namespace WebCore
-#endif
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebAudioBusPrivate : public AudioBus {
-};
-
-void WebAudioBus::initialize(unsigned numberOfChannels, size_t length, double sampleRate)
-{
-#if ENABLE(WEB_AUDIO)
- AudioBus* audioBus = new AudioBus(numberOfChannels, length);
- audioBus->setSampleRate(sampleRate);
-
- if (m_private)
- delete m_private;
- m_private = static_cast<WebAudioBusPrivate*>(audioBus);
-#else
- ASSERT_NOT_REACHED();
-#endif
-}
-
-void WebAudioBus::reset()
-{
-#if ENABLE(WEB_AUDIO)
- delete m_private;
- m_private = 0;
-#else
- ASSERT_NOT_REACHED();
-#endif
-}
-
-unsigned WebAudioBus::numberOfChannels() const
-{
-#if ENABLE(WEB_AUDIO)
- if (!m_private)
- return 0;
- return m_private->numberOfChannels();
-#else
- ASSERT_NOT_REACHED();
- return 0;
-#endif
-}
-
-size_t WebAudioBus::length() const
-{
-#if ENABLE(WEB_AUDIO)
- if (!m_private)
- return 0;
- return m_private->length();
-#else
- ASSERT_NOT_REACHED();
- return 0;
-#endif
-}
-
-double WebAudioBus::sampleRate() const
-{
-#if ENABLE(WEB_AUDIO)
- if (!m_private)
- return 0;
- return m_private->sampleRate();
-#else
- ASSERT_NOT_REACHED();
- return 0;
-#endif
-}
-
-float* WebAudioBus::channelData(unsigned channelIndex)
-{
-#if ENABLE(WEB_AUDIO)
- if (!m_private)
- return 0;
- ASSERT(channelIndex < numberOfChannels());
- return m_private->channel(channelIndex)->mutableData();
-#else
- ASSERT_NOT_REACHED();
- return 0;
-#endif
-}
-
-PassOwnPtr<AudioBus> WebAudioBus::release()
-{
-#if ENABLE(WEB_AUDIO)
- OwnPtr<AudioBus> audioBus(adoptPtr(static_cast<AudioBus*>(m_private)));
- m_private = 0;
- return audioBus.release();
-#else
- ASSERT_NOT_REACHED();
- return nullptr;
-#endif
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebBindings.cpp b/Source/WebKit/chromium/src/WebBindings.cpp
index e69100ab1..c4f40df3d 100644
--- a/Source/WebKit/chromium/src/WebBindings.cpp
+++ b/Source/WebKit/chromium/src/WebBindings.cpp
@@ -35,7 +35,7 @@
#include "npruntime_priv.h"
#if USE(V8)
-#include "ArrayBufferView.h"
+#include <wtf/ArrayBufferView.h>
#include "DOMWindow.h"
#include "NPV8Object.h" // for PrivateIdentifier
#include "Range.h"
diff --git a/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp b/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp
index c4f8e69a4..c7ec47149 100644
--- a/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebColorChooserClientImpl.cpp
@@ -29,7 +29,7 @@
#include "Color.h"
#include "ColorChooserClient.h"
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
namespace WebKit {
@@ -57,4 +57,4 @@ void WebColorChooserClientImpl::didEndChooser()
}
-#endif // ENABLE(INPUT_COLOR)
+#endif // ENABLE(INPUT_TYPE_COLOR)
diff --git a/Source/WebKit/chromium/src/WebColorChooserClientImpl.h b/Source/WebKit/chromium/src/WebColorChooserClientImpl.h
index bf735d89d..d5a085da8 100644
--- a/Source/WebKit/chromium/src/WebColorChooserClientImpl.h
+++ b/Source/WebKit/chromium/src/WebColorChooserClientImpl.h
@@ -28,7 +28,7 @@
#include "WebColorChooserClient.h"
-#if ENABLE(INPUT_COLOR)
+#if ENABLE(INPUT_TYPE_COLOR)
namespace WebCore {
class ColorChooserClient;
@@ -50,6 +50,6 @@ private:
}
-#endif // ENABLE(INPUT_COLOR)
+#endif // ENABLE(INPUT_TYPE_COLOR)
#endif // WebColorChooserClientImpl_h
diff --git a/Source/WebKit/chromium/src/WebColorName.cpp b/Source/WebKit/chromium/src/WebColorName.cpp
index 04d8ed8a8..984afe7b2 100644
--- a/Source/WebKit/chromium/src/WebColorName.cpp
+++ b/Source/WebKit/chromium/src/WebColorName.cpp
@@ -34,7 +34,7 @@
#include "CSSValueKeywords.h"
#include "Color.h"
#include "RenderTheme.h"
-#include "UnusedParam.h"
+#include <wtf/UnusedParam.h>
#include <public/WebColor.h>
using namespace::WebCore;
diff --git a/Source/WebKit/chromium/src/WebCompositorImpl.cpp b/Source/WebKit/chromium/src/WebCompositorImpl.cpp
index 07361ed78..91d8b1be6 100644
--- a/Source/WebKit/chromium/src/WebCompositorImpl.cpp
+++ b/Source/WebKit/chromium/src/WebCompositorImpl.cpp
@@ -58,7 +58,7 @@ void WebCompositorImpl::initialize(WebThread* implThread)
ASSERT(!s_initialized);
s_initialized = true;
- s_mainThread = CCThreadImpl::create(webKitPlatformSupport()->currentThread()).leakPtr();
+ s_mainThread = CCThreadImpl::create(WebKit::Platform::current()->currentThread()).leakPtr();
CCProxy::setMainThread(s_mainThread);
if (implThread) {
s_implThread = CCThreadImpl::create(implThread).leakPtr();
diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
index c2dbee3b4..8e0c613a4 100644
--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
@@ -27,12 +27,16 @@
#include "WebCompositorInputHandlerImpl.h"
+#include "PlatformGestureCurveTarget.h"
+#include "TouchpadFlingPlatformGestureCurve.h"
+#include "TraceEvent.h"
#include "WebCompositorImpl.h"
#include "WebCompositorInputHandlerClient.h"
#include "WebInputEvent.h"
#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
+#include "cc/CCActiveGestureAnimation.h"
#include "cc/CCProxy.h"
+#include "platform/WebKitPlatformSupport.h"
#include <wtf/ThreadingPrimitives.h>
using namespace WebCore;
@@ -44,6 +48,42 @@ PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHan
return WebKit::WebCompositorInputHandlerImpl::create(inputHandlerClient);
}
+class PlatformGestureToCCGestureAdapter : public CCGestureCurve, public PlatformGestureCurveTarget {
+public:
+ static PassOwnPtr<CCGestureCurve> create(PassOwnPtr<PlatformGestureCurve> platformCurve)
+ {
+ return adoptPtr(new PlatformGestureToCCGestureAdapter(platformCurve));
+ }
+
+ virtual const char* debugName() const
+ {
+ return m_curve->debugName();
+ }
+
+ virtual bool apply(double time, CCGestureCurveTarget* target)
+ {
+ ASSERT(target);
+ m_target = target;
+ return m_curve->apply(time, this);
+ }
+
+ virtual void scrollBy(const IntPoint& scrollDelta)
+ {
+ ASSERT(m_target);
+ m_target->scrollBy(scrollDelta);
+ }
+
+private:
+ PlatformGestureToCCGestureAdapter(PassOwnPtr<PlatformGestureCurve> curve)
+ : m_curve(curve)
+ , m_target(0)
+ {
+ }
+
+ OwnPtr<PlatformGestureCurve> m_curve;
+ CCGestureCurveTarget* m_target;
+};
+
}
namespace WebKit {
@@ -52,9 +92,9 @@ namespace WebKit {
int WebCompositorInputHandlerImpl::s_nextAvailableIdentifier = 1;
HashSet<WebCompositorInputHandlerImpl*>* WebCompositorInputHandlerImpl::s_compositors = 0;
-WebCompositor* WebCompositorInputHandler::fromIdentifier(int identifier)
+WebCompositorInputHandler* WebCompositorInputHandler::fromIdentifier(int identifier)
{
- return static_cast<WebCompositor*>(WebCompositorInputHandlerImpl::fromIdentifier(identifier));
+ return WebCompositorInputHandlerImpl::fromIdentifier(identifier);
}
PassOwnPtr<WebCompositorInputHandlerImpl> WebCompositorInputHandlerImpl::create(WebCore::CCInputHandlerClient* inputHandlerClient)
@@ -85,7 +125,7 @@ WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl(CCInputHandlerClien
, m_expectScrollUpdateEnd(false)
, m_expectPinchUpdateEnd(false)
#endif
- , m_scrollStarted(false)
+ , m_gestureScrollStarted(false)
{
ASSERT(CCProxy::isImplThread());
@@ -121,23 +161,41 @@ void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event)
ASSERT(CCProxy::isImplThread());
ASSERT(m_client);
+ WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event);
+ switch (disposition) {
+ case DidHandle:
+ m_client->didHandleInputEvent();
+ break;
+ case DidNotHandle:
+ m_client->didNotHandleInputEvent(true /* sendToWidget */);
+ break;
+ case DropEvent:
+ m_client->didNotHandleInputEvent(false /* sendToWidget */);
+ break;
+ }
+}
+
+WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::handleInputEventInternal(const WebInputEvent& event)
+{
if (event.type == WebInputEvent::MouseWheel) {
const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event);
CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y), CCInputHandlerClient::Wheel);
switch (scrollStatus) {
- case CCInputHandlerClient::ScrollStarted:
+ case CCInputHandlerClient::ScrollStarted: {
+ TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInput wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY);
m_inputHandlerClient->scrollBy(IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY));
m_inputHandlerClient->scrollEnd();
- m_client->didHandleInputEvent();
- return;
+ return DidHandle;
+ }
case CCInputHandlerClient::ScrollIgnored:
- m_client->didNotHandleInputEvent(false /* sendToWidget */);
- return;
+ // 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:
- break;
+ return DidNotHandle;
}
} else if (event.type == WebInputEvent::GestureScrollBegin) {
- ASSERT(!m_scrollStarted);
+ ASSERT(!m_gestureScrollStarted);
ASSERT(!m_expectScrollUpdateEnd);
#ifndef NDEBUG
m_expectScrollUpdateEnd = true;
@@ -146,58 +204,92 @@ void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event)
CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture);
switch (scrollStatus) {
case CCInputHandlerClient::ScrollStarted:
- m_scrollStarted = true;
- m_client->didHandleInputEvent();
- return;
- case CCInputHandlerClient::ScrollIgnored:
- m_client->didNotHandleInputEvent(false /* sendToWidget */);
- return;
+ m_gestureScrollStarted = true;
+ return DidHandle;
case CCInputHandlerClient::ScrollFailed:
- break;
+ return DidNotHandle;
+ case CCInputHandlerClient::ScrollIgnored:
+ return DropEvent;
}
} else if (event.type == WebInputEvent::GestureScrollUpdate) {
ASSERT(m_expectScrollUpdateEnd);
- if (m_scrollStarted) {
- const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
- m_inputHandlerClient->scrollBy(IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY));
- m_client->didHandleInputEvent();
- return;
- }
+
+ if (!m_gestureScrollStarted)
+ return DidNotHandle;
+
+ const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
+ m_inputHandlerClient->scrollBy(IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY));
+ return DidHandle;
} else if (event.type == WebInputEvent::GestureScrollEnd) {
ASSERT(m_expectScrollUpdateEnd);
#ifndef NDEBUG
m_expectScrollUpdateEnd = false;
#endif
- if (m_scrollStarted) {
- m_inputHandlerClient->scrollEnd();
- m_client->didHandleInputEvent();
- m_scrollStarted = false;
- return;
- }
+ if (!m_gestureScrollStarted)
+ return DidNotHandle;
+
+ m_inputHandlerClient->scrollEnd();
+ m_gestureScrollStarted = false;
+ return DidHandle;
} else if (event.type == WebInputEvent::GesturePinchBegin) {
ASSERT(!m_expectPinchUpdateEnd);
#ifndef NDEBUG
m_expectPinchUpdateEnd = true;
#endif
m_inputHandlerClient->pinchGestureBegin();
- m_client->didHandleInputEvent();
- return;
+ return DidHandle;
} else if (event.type == WebInputEvent::GesturePinchEnd) {
ASSERT(m_expectPinchUpdateEnd);
#ifndef NDEBUG
m_expectPinchUpdateEnd = false;
#endif
m_inputHandlerClient->pinchGestureEnd();
- m_client->didHandleInputEvent();
- return;
+ return DidHandle;
} else if (event.type == WebInputEvent::GesturePinchUpdate) {
ASSERT(m_expectPinchUpdateEnd);
const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y));
- m_client->didHandleInputEvent();
- return;
+ return DidHandle;
+ } else if (event.type == WebInputEvent::GestureFlingStart) {
+ const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
+ return handleGestureFling(gestureEvent);
+ } else if (event.type == WebInputEvent::GestureFlingCancel) {
+ if (cancelCurrentFling())
+ return DidHandle;
+ } else if (WebInputEvent::isKeyboardEventType(event.type)) {
+ cancelCurrentFling();
+ }
+
+ return DidNotHandle;
+}
+
+WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::handleGestureFling(const WebGestureEvent& gestureEvent)
+{
+ CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Wheel);
+ switch (scrollStatus) {
+ case CCInputHandlerClient::ScrollStarted: {
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started");
+ OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY));
+ m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this);
+ m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.deltaX, gestureEvent.deltaY);
+ m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y);
+ m_wheelFlingParameters.globalPoint = WebPoint(gestureEvent.globalX, gestureEvent.globalY);
+ m_wheelFlingParameters.modifiers = gestureEvent.modifiers;
+ m_inputHandlerClient->scheduleAnimation();
+ return DidHandle;
+ }
+ case CCInputHandlerClient::ScrollFailed: {
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::failed");
+ return DidNotHandle;
+ }
+ case CCInputHandlerClient::ScrollIgnored: {
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::ignored");
+ // We still pass the curve to the main thread if there's nothing scrollable, in case something
+ // registers a handler before the curve is over.
+ return DidNotHandle;
+ }
}
- m_client->didNotHandleInputEvent(true /* sendToWidget */);
+ return DidNotHandle;
}
int WebCompositorInputHandlerImpl::identifier() const
@@ -206,8 +298,67 @@ int WebCompositorInputHandlerImpl::identifier() const
return m_identifier;
}
-void WebCompositorInputHandlerImpl::willDraw(double monotonicTime)
+void WebCompositorInputHandlerImpl::animate(double monotonicTime)
{
+ if (!m_wheelFlingAnimation)
+ return;
+
+ if (!m_wheelFlingParameters.startTime)
+ m_wheelFlingParameters.startTime = monotonicTime;
+
+ if (m_wheelFlingAnimation->animate(monotonicTime))
+ m_inputHandlerClient->scheduleAnimation();
+ else {
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::animate::flingOver");
+ cancelCurrentFling();
+ }
+}
+
+bool WebCompositorInputHandlerImpl::cancelCurrentFling()
+{
+ bool hadFlingAnimation = m_wheelFlingAnimation;
+ TRACE_EVENT_INSTANT1("cc", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation);
+ m_wheelFlingAnimation.clear();
+ m_wheelFlingParameters = WebActiveWheelFlingParameters();
+ return hadFlingAnimation;
+}
+
+void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment)
+{
+ if (increment == IntPoint::zero())
+ return;
+
+ TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x(), "y", increment.y());
+ WebMouseWheelEvent syntheticWheel;
+ syntheticWheel.type = WebInputEvent::MouseWheel;
+ syntheticWheel.deltaX = increment.x();
+ syntheticWheel.deltaY = increment.y();
+ syntheticWheel.hasPreciseScrollingDeltas = true;
+ syntheticWheel.x = m_wheelFlingParameters.point.x;
+ syntheticWheel.y = m_wheelFlingParameters.point.y;
+ syntheticWheel.globalX = m_wheelFlingParameters.globalPoint.x;
+ syntheticWheel.globalY = m_wheelFlingParameters.globalPoint.y;
+ syntheticWheel.modifiers = m_wheelFlingParameters.modifiers;
+
+ WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(syntheticWheel);
+ switch (disposition) {
+ case DidHandle:
+ m_wheelFlingParameters.cumulativeScroll.width += increment.x();
+ m_wheelFlingParameters.cumulativeScroll.height += increment.y();
+ case DropEvent:
+ break;
+ case DidNotHandle:
+ TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::scrollBy::AbortFling");
+ // If we got a DidNotHandle, that means we need to deliver wheels on the main thread.
+ // In this case we need to schedule a commit and transfer the fling curve over to the main
+ // thread and run the rest of the wheels from there.
+ // This can happen when flinging a page that contains a scrollable subarea that we can't
+ // scroll on the thread if the fling starts outside the subarea but then is flung "under" the
+ // pointer.
+ m_client->transferActiveWheelFlingAnimation(m_wheelFlingParameters);
+ cancelCurrentFling();
+ break;
+ }
}
}
diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
index 83b4bd546..64647105b 100644
--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
@@ -26,8 +26,11 @@
#ifndef WebCompositorInputHandlerImpl_h
#define WebCompositorInputHandlerImpl_h
+#include "WebActiveWheelFlingParameters.h"
#include "WebCompositor.h"
#include "WebCompositorInputHandler.h"
+#include "WebInputEvent.h"
+#include "cc/CCGestureCurve.h"
#include "cc/CCInputHandler.h"
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
@@ -38,6 +41,8 @@ class Mutex;
}
namespace WebCore {
+class IntPoint;
+class CCGestureCurveTarget;
class CCInputHandlerClient;
class CCThread;
}
@@ -46,8 +51,7 @@ namespace WebKit {
class WebCompositorInputHandlerClient;
-// Temporarily subclassing from WebCompositor while downstream changes land.
-class WebCompositorInputHandlerImpl : public WebCompositor, public WebCore::CCInputHandler {
+class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebCore::CCInputHandler, public WebCore::CCGestureCurveTarget {
WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl);
public:
static PassOwnPtr<WebCompositorInputHandlerImpl> create(WebCore::CCInputHandlerClient*);
@@ -55,17 +59,34 @@ public:
virtual ~WebCompositorInputHandlerImpl();
- // WebCompositor implementation
+ // WebCompositorInputHandler implementation.
virtual void setClient(WebCompositorInputHandlerClient*);
virtual void handleInputEvent(const WebInputEvent&);
- // WebCore::CCInputHandler implementation
+ // WebCore::CCInputHandler implementation.
virtual int identifier() const;
- virtual void willDraw(double monotonicTime);
+ virtual void animate(double monotonicTime);
+
+ // WebCore::CCGestureCurveTarget implementation.
+ virtual void scrollBy(const WebCore::IntPoint&);
private:
explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*);
+ enum EventDisposition { DidHandle, DidNotHandle, DropEvent };
+ // This function processes the input event and determines the disposition, but does not make
+ // any calls out to the WebCompositorInputHandlerClient. Some input types defer to helpers.
+ EventDisposition handleInputEventInternal(const WebInputEvent&);
+
+ EventDisposition handleGestureFling(const WebGestureEvent&);
+
+ // Returns true if we actually had an active fling to cancel.
+ bool cancelCurrentFling();
+
+ OwnPtr<WebCore::CCActiveGestureAnimation> m_wheelFlingAnimation;
+ // Parameters for the active fling animation, stored in case we need to transfer it out later.
+ WebActiveWheelFlingParameters m_wheelFlingParameters;
+
WebCompositorInputHandlerClient* m_client;
int m_identifier;
WebCore::CCInputHandlerClient* m_inputHandlerClient;
@@ -74,7 +95,7 @@ private:
bool m_expectScrollUpdateEnd;
bool m_expectPinchUpdateEnd;
#endif
- bool m_scrollStarted;
+ bool m_gestureScrollStarted;
static int s_nextAvailableIdentifier;
static HashSet<WebCompositorInputHandlerImpl*>* s_compositors;
diff --git a/Source/WebKit/chromium/src/WebContentLayer.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp
index 7b37333e5..5290e2f35 100644
--- a/Source/WebKit/chromium/src/WebContentLayer.cpp
+++ b/Source/WebKit/chromium/src/WebContentLayer.cpp
@@ -46,16 +46,6 @@ bool WebContentLayer::drawsContent() const
return constUnwrap<WebContentLayerImpl>()->drawsContent();
}
-void WebContentLayer::invalidateRect(const WebFloatRect& dirtyRect)
-{
- unwrap<WebContentLayerImpl>()->setNeedsDisplayRect(dirtyRect);
-}
-
-void WebContentLayer::invalidate()
-{
- unwrap<WebContentLayerImpl>()->setNeedsDisplay();
-}
-
WebContentLayer::WebContentLayer(const PassRefPtr<WebContentLayerImpl>& node)
: WebLayer(node)
{
diff --git a/Source/WebKit/chromium/src/WebData.cpp b/Source/WebKit/chromium/src/WebData.cpp
deleted file mode 100644
index 53f447402..000000000
--- a/Source/WebKit/chromium/src/WebData.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebData.h"
-
-#include "SharedBuffer.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebDataPrivate : public SharedBuffer {
-};
-
-void WebData::reset()
-{
- if (m_private) {
- m_private->deref();
- m_private = 0;
- }
-}
-
-void WebData::assign(const WebData& other)
-{
- WebDataPrivate* p = const_cast<WebDataPrivate*>(other.m_private);
- if (p)
- p->ref();
- assign(p);
-}
-
-void WebData::assign(const char* data, size_t size)
-{
- assign(static_cast<WebDataPrivate*>(
- SharedBuffer::create(data, size).leakRef()));
-}
-
-size_t WebData::size() const
-{
- if (!m_private)
- return 0;
- return const_cast<WebDataPrivate*>(m_private)->size();
-}
-
-const char* WebData::data() const
-{
- if (!m_private)
- return 0;
- return const_cast<WebDataPrivate*>(m_private)->data();
-}
-
-WebData::WebData(const PassRefPtr<SharedBuffer>& buffer)
- : m_private(static_cast<WebDataPrivate*>(buffer.leakRef()))
-{
-}
-
-WebData& WebData::operator=(const PassRefPtr<SharedBuffer>& buffer)
-{
- assign(static_cast<WebDataPrivate*>(buffer.leakRef()));
- return *this;
-}
-
-WebData::operator PassRefPtr<SharedBuffer>() const
-{
- return PassRefPtr<SharedBuffer>(const_cast<WebDataPrivate*>(m_private));
-}
-
-void WebData::assign(WebDataPrivate* p)
-{
- // p is already ref'd for us by the caller
- if (m_private)
- m_private->deref();
- m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebDatabase.cpp b/Source/WebKit/chromium/src/WebDatabase.cpp
index 9ea6ee9b5..d8eb64da4 100644
--- a/Source/WebKit/chromium/src/WebDatabase.cpp
+++ b/Source/WebKit/chromium/src/WebDatabase.cpp
@@ -48,6 +48,7 @@ public:
String displayName() const { return String(); }
unsigned long long estimatedSize() const { return 0; }
SecurityOrigin* securityOrigin() const { return 0; }
+ bool isSyncDatabase() const { return false; }
};
}
#endif // !ENABLE(SQL_DATABASE)
diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 52eb37400..d39ff8af9 100644
--- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -32,6 +32,8 @@
#include "WebDevToolsAgentImpl.h"
#include "ExceptionCode.h"
+#include "Frame.h"
+#include "FrameView.h"
#include "GraphicsContext.h"
#include "InjectedScriptHost.h"
#include "InspectorBackendDispatcher.h"
@@ -45,6 +47,7 @@
#include "PageScriptDebugServer.h"
#include "painting/GraphicsContextBuilder.h"
#include "PlatformString.h"
+#include "RenderView.h"
#include "ResourceError.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
@@ -63,10 +66,19 @@
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include <wtf/CurrentTime.h>
+#include <wtf/MathExtras.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
using namespace WebCore;
+using namespace std;
+
+namespace OverlayZOrders {
+static const int viewportGutter = 97;
+
+// Use 99 as a big z-order number so that highlight is above other overlays.
+static const int highlight = 99;
+}
namespace WebKit {
@@ -173,6 +185,190 @@ private:
OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor;
};
+class DeviceMetricsSupport : public WebPageOverlay {
+public:
+ DeviceMetricsSupport(WebViewImpl* webView)
+ : m_webView(webView)
+ , m_fitWindow(false)
+ , m_originalZoomFactor(0)
+ {
+ m_webView->addPageOverlay(this, OverlayZOrders::viewportGutter);
+ }
+
+ ~DeviceMetricsSupport()
+ {
+ restore();
+ m_webView->removePageOverlay(this);
+ }
+
+ void setDeviceMetrics(int width, int height, float textZoomFactor, bool fitWindow)
+ {
+ WebCore::FrameView* view = frameView();
+ if (!view)
+ return;
+
+ m_emulatedFrameSize = WebSize(width, height);
+ m_fitWindow = fitWindow;
+ m_originalZoomFactor = 0;
+ m_webView->setEmulatedTextZoomFactor(textZoomFactor);
+ applySizeOverrideInternal(view, FitWindowAllowed);
+ autoZoomPageToFitWidth(view->frame());
+
+ m_webView->sendResizeEventAndRepaint();
+ }
+
+ void autoZoomPageToFitWidthOnNavigation(Frame* frame)
+ {
+ FrameView* frameView = frame->view();
+ applySizeOverrideInternal(frameView, FitWindowNotAllowed);
+ m_originalZoomFactor = 0;
+ applySizeOverrideInternal(frameView, FitWindowAllowed);
+ autoZoomPageToFitWidth(frame);
+ }
+
+ void autoZoomPageToFitWidth(Frame* frame)
+ {
+ if (!frame)
+ 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());
+ Document* doc = frame->document();
+ doc->styleResolverChanged(RecalcStyleImmediately);
+ doc->updateLayout();
+ }
+
+ void webViewResized()
+ {
+ if (!m_fitWindow)
+ return;
+
+ applySizeOverrideIfNecessary();
+ autoZoomPageToFitWidth(m_webView->mainFrameImpl()->frame());
+ }
+
+ void applySizeOverrideIfNecessary()
+ {
+ FrameView* view = frameView();
+ if (!view)
+ return;
+
+ applySizeOverrideInternal(view, FitWindowAllowed);
+ }
+
+private:
+ enum FitWindowFlag { FitWindowAllowed, FitWindowNotAllowed };
+
+ void ensureOriginalZoomFactor(FrameView* frameView)
+ {
+ if (m_originalZoomFactor)
+ return;
+
+ 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();
+ if (!denominator)
+ denominator = 1;
+ m_originalZoomFactor = static_cast<double>(scaledEmulatedSize.width) / denominator;
+ }
+
+ void restore()
+ {
+ WebCore::FrameView* view = frameView();
+ if (!view)
+ return;
+
+ m_webView->setZoomLevel(false, 0);
+ m_webView->setEmulatedTextZoomFactor(1);
+ view->setHorizontalScrollbarLock(false);
+ view->setVerticalScrollbarLock(false);
+ view->setScrollbarModes(ScrollbarAuto, ScrollbarAuto, false, false);
+ view->resize(IntSize(m_webView->size()));
+ m_webView->sendResizeEventAndRepaint();
+ }
+
+ WebSize scaledEmulatedFrameSize(FrameView* frameView)
+ {
+ if (!m_fitWindow)
+ return m_emulatedFrameSize;
+
+ WebSize scrollbarDimensions = forcedScrollbarDimensions(frameView);
+
+ int overrideWidth = m_emulatedFrameSize.width;
+ int overrideHeight = m_emulatedFrameSize.height;
+
+ WebSize webViewSize = m_webView->size();
+ int availableViewWidth = max(webViewSize.width - scrollbarDimensions.width, 1);
+ int availableViewHeight = max(webViewSize.height - scrollbarDimensions.height, 1);
+
+ double widthRatio = static_cast<double>(overrideWidth) / availableViewWidth;
+ double heightRatio = static_cast<double>(overrideHeight) / availableViewHeight;
+ double dimensionRatio = max(widthRatio, heightRatio);
+ overrideWidth = static_cast<int>(ceil(static_cast<double>(overrideWidth) / dimensionRatio));
+ overrideHeight = static_cast<int>(ceil(static_cast<double>(overrideHeight) / dimensionRatio));
+
+ return WebSize(overrideWidth, overrideHeight);
+ }
+
+ WebSize forcedScrollbarDimensions(FrameView* frameView)
+ {
+ frameView->setScrollbarModes(ScrollbarAlwaysOn, ScrollbarAlwaysOn, true, true);
+
+ int verticalScrollbarWidth = 0;
+ int horizontalScrollbarHeight = 0;
+ if (Scrollbar* verticalBar = frameView->verticalScrollbar())
+ verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
+ if (Scrollbar* horizontalBar = frameView->horizontalScrollbar())
+ horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
+ return WebSize(verticalScrollbarWidth, horizontalScrollbarHeight);
+ }
+
+ void applySizeOverrideInternal(FrameView* frameView, FitWindowFlag fitWindowFlag)
+ {
+ WebSize scrollbarDimensions = forcedScrollbarDimensions(frameView);
+
+ WebSize effectiveEmulatedSize = (fitWindowFlag == FitWindowAllowed) ? scaledEmulatedFrameSize(frameView) : m_emulatedFrameSize;
+ int overrideWidth = effectiveEmulatedSize.width + scrollbarDimensions.width;
+ int overrideHeight = effectiveEmulatedSize.height + scrollbarDimensions.height;
+
+ if (IntSize(overrideWidth, overrideHeight) != frameView->size())
+ frameView->resize(overrideWidth, overrideHeight);
+
+ Document* doc = frameView->frame()->document();
+ doc->styleResolverChanged(RecalcStyleImmediately);
+ doc->updateLayout();
+ }
+
+ virtual void paintPageOverlay(WebCanvas* canvas)
+ {
+ FrameView* frameView = this->frameView();
+ if (!frameView)
+ return;
+
+ GraphicsContextBuilder builder(canvas);
+ GraphicsContext& gc = builder.context();
+ gc.clipOut(IntRect(IntPoint(), frameView->size()));
+ gc.setFillColor(Color::darkGray, ColorSpaceDeviceRGB);
+ gc.drawRect(IntRect(IntPoint(), m_webView->size()));
+ }
+
+ WebCore::FrameView* frameView()
+ {
+ return m_webView->mainFrameImpl() ? m_webView->mainFrameImpl()->frameView() : 0;
+ }
+
+ WebViewImpl* m_webView;
+ WebSize m_emulatedFrameSize;
+ bool m_fitWindow;
+ double m_originalZoomFactor;
+};
+
+
WebDevToolsAgentImpl::WebDevToolsAgentImpl(
WebViewImpl* webViewImpl,
WebDevToolsAgentClient* client)
@@ -224,13 +420,51 @@ void WebDevToolsAgentImpl::didNavigate()
ClientMessageLoopAdapter::didNavigate();
}
-void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe)
+void WebDevToolsAgentImpl::didCreateScriptContext(WebFrameImpl* webframe, int worldId)
{
- WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame());
- if (proxy && webframe->frame()->script()->canExecuteScripts(NotAboutToExecuteScript))
+ // Skip non main world contexts.
+ if (worldId)
+ return;
+ if (WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame()))
proxy->setContextDebugId(m_hostId);
}
+void WebDevToolsAgentImpl::mainFrameViewCreated(WebFrameImpl* webFrame)
+{
+ if (m_metricsSupport)
+ m_metricsSupport->applySizeOverrideIfNecessary();
+}
+
+bool WebDevToolsAgentImpl::metricsOverridden()
+{
+ return !!m_metricsSupport;
+}
+
+void WebDevToolsAgentImpl::webViewResized()
+{
+ if (m_metricsSupport)
+ m_metricsSupport->webViewResized();
+}
+
+void WebDevToolsAgentImpl::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow)
+{
+ if (!width && !height) {
+ if (m_metricsSupport)
+ m_metricsSupport.clear();
+ return;
+ }
+
+ if (!m_metricsSupport)
+ m_metricsSupport = adoptPtr(new DeviceMetricsSupport(m_webViewImpl));
+ m_metricsSupport->setDeviceMetrics(width, height, fontScaleFactor, fitWindow);
+}
+
+void WebDevToolsAgentImpl::autoZoomPageToFitWidth()
+{
+ if (m_metricsSupport)
+ m_metricsSupport->autoZoomPageToFitWidthOnNavigation(m_webViewImpl->mainFrameImpl()->frame());
+}
+
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
{
inspectorController()->dispatchMessageFromFrontend(message);
@@ -282,8 +516,7 @@ void WebDevToolsAgentImpl::paintPageOverlay(WebCanvas* canvas)
void WebDevToolsAgentImpl::highlight()
{
- // Use 99 as a big z-order number so that highlight is above other overlays.
- m_webViewImpl->addPageOverlay(this, 99);
+ m_webViewImpl->addPageOverlay(this, OverlayZOrders::highlight);
}
void WebDevToolsAgentImpl::hideHighlight()
diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h
index 66fd6c6ee..1c8e025e8 100644
--- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h
+++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h
@@ -35,6 +35,7 @@
#include "WebDevToolsAgentPrivate.h"
#include "WebPageOverlay.h"
+#include "platform/WebSize.h"
#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
@@ -42,6 +43,7 @@
namespace WebCore {
class Document;
class Frame;
+class FrameView;
class GraphicsContext;
class InspectorClient;
class InspectorController;
@@ -50,6 +52,7 @@ class Node;
namespace WebKit {
+class DeviceMetricsSupport;
class WebDevToolsAgentClient;
class WebFrame;
class WebFrameImpl;
@@ -68,7 +71,10 @@ public:
virtual ~WebDevToolsAgentImpl();
// WebDevToolsAgentPrivate implementation.
- virtual void didClearWindowObject(WebFrameImpl* frame);
+ virtual void didCreateScriptContext(WebFrameImpl*, int worldId);
+ virtual void mainFrameViewCreated(WebFrameImpl*);
+ virtual bool metricsOverridden();
+ virtual void webViewResized();
// WebDevToolsAgent implementation.
virtual void attach();
@@ -95,6 +101,9 @@ public:
virtual void clearBrowserCache();
virtual void clearBrowserCookies();
+ virtual void overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow);
+ virtual void autoZoomPageToFitWidth();
+
int hostId() { return m_hostId; }
// WebPageOverlay
@@ -108,6 +117,7 @@ private:
WebDevToolsAgentClient* m_client;
WebViewImpl* m_webViewImpl;
bool m_attached;
+ OwnPtr<DeviceMetricsSupport> m_metricsSupport;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h b/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h
index 7038a5e5c..06f5f1815 100644
--- a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h
+++ b/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h
@@ -35,14 +35,26 @@
namespace WebKit {
class WebFrameImpl;
+struct WebSize;
class WebDevToolsAgentPrivate : public WebDevToolsAgent {
public:
- // Notifications from FrameLoaderClientImpl:
- // The window object for the frame has been cleared of any extra properties
- // that may have been set by script from the previously loaded document.
- virtual void didClearWindowObject(WebFrameImpl*) = 0;
+ // Notification from FrameLoaderClientImpl:
+ // New context has been created for a given world in given frame. Any
+ // processing hat needs to happen before the first script is evaluated
+ // in this context should be done here.
+ virtual void didCreateScriptContext(WebFrameImpl*, int worldId) = 0;
+
+ // A new FrameView has been created for the specified WebFrame using
+ // the Frame::createView() call.
+ virtual void mainFrameViewCreated(WebFrameImpl*) = 0;
+
+ // Returns true if the device metrics override mode is enabled.
+ virtual bool metricsOverridden() = 0;
+
+ // WebViewImpl has been resized.
+ virtual void webViewResized() = 0;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebDocument.cpp b/Source/WebKit/chromium/src/WebDocument.cpp
index 80fbdf1d9..11639566c 100644
--- a/Source/WebKit/chromium/src/WebDocument.cpp
+++ b/Source/WebKit/chromium/src/WebDocument.cpp
@@ -32,6 +32,7 @@
#include "WebDocument.h"
#include "AXObjectCache.h"
+#include "CSSParserMode.h"
#include "CSSStyleSheet.h"
#include "Document.h"
#include "DocumentLoader.h"
@@ -177,9 +178,9 @@ void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLev
{
RefPtr<Document> document = unwrap<Document>();
- RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(document.get());
+ RefPtr<StyleSheetInternal> parsedSheet = StyleSheetInternal::create(document.get());
parsedSheet->setIsUserStyleSheet(level == UserStyleUserLevel);
- parsedSheet->parseString(sourceCode, !document->inQuirksMode());
+ parsedSheet->parseString(sourceCode);
document->addUserSheet(parsedSheet.release());
}
@@ -208,6 +209,11 @@ WebDOMEvent WebDocument::createEvent(const WebString& eventType)
return event;
}
+WebReferrerPolicy WebDocument::referrerPolicy() const
+{
+ return static_cast<WebReferrerPolicy>(constUnwrap<Document>()->referrerPolicy());
+}
+
WebAccessibilityObject WebDocument::accessibilityObject() const
{
const Document* document = constUnwrap<Document>();
diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp
index 322dfbaeb..61d86a388 100644
--- a/Source/WebKit/chromium/src/WebDragData.cpp
+++ b/Source/WebKit/chromium/src/WebDragData.cpp
@@ -33,6 +33,8 @@
#include "ChromiumDataObject.h"
#include "ClipboardMimeTypes.h"
+#include "DataTransferItem.h"
+#include "DraggedIsolatedFileSystem.h"
#include "platform/WebData.h"
#include "platform/WebString.h"
#include "platform/WebURL.h"
@@ -69,57 +71,34 @@ void WebDragData::assign(const WebDragData& other)
WebVector<WebDragData::Item> WebDragData::items() const
{
Vector<Item> itemList;
- const HashSet<String>& types = m_private->types();
- if (types.contains(mimeTypeTextPlain)) {
- Item item;
- item.storageType = Item::StorageTypeString;
- item.stringType = String(mimeTypeTextPlain);
- bool ignored;
- item.stringData = m_private->getData(mimeTypeTextPlain, ignored);
+ for (size_t i = 0; i < m_private->length(); ++i) {
+ ChromiumDataObjectItem* originalItem = m_private->item(i).get();
+ WebDragData::Item item;
+ if (originalItem->kind() == DataTransferItem::kindString) {
+ item.storageType = Item::StorageTypeString;
+ item.stringType = originalItem->type();
+ item.stringData = originalItem->internalGetAsString();
+ } else if (originalItem->kind() == DataTransferItem::kindFile) {
+ if (originalItem->sharedBuffer()) {
+ item.storageType = Item::StorageTypeBinaryData;
+ item.binaryData = originalItem->sharedBuffer();
+ } else if (originalItem->isFilename()) {
+ item.storageType = Item::StorageTypeFilename;
+ RefPtr<WebCore::Blob> blob = originalItem->getAsFile();
+ if (blob->isFile()) {
+ File* file = static_cast<File*>(blob.get());
+ item.filenameData = file->path();
+ item.displayNameData = file->name();
+ } else
+ ASSERT_NOT_REACHED();
+ } else
+ ASSERT_NOT_REACHED();
+ } else
+ ASSERT_NOT_REACHED();
+ item.title = originalItem->title();
+ item.baseURL = originalItem->baseURL();
itemList.append(item);
}
- if (types.contains(mimeTypeTextURIList)) {
- Item item;
- item.storageType = Item::StorageTypeString;
- item.stringType = String(mimeTypeTextURIList);
- bool ignored;
- item.stringData = m_private->getData(mimeTypeURL, ignored);
- item.title = m_private->urlTitle();
- itemList.append(item);
- }
- if (types.contains(mimeTypeTextHTML)) {
- Item item;
- item.storageType = Item::StorageTypeString;
- item.stringType = String(mimeTypeTextHTML);
- bool ignored;
- item.stringData = m_private->getData(mimeTypeTextHTML, ignored);
- item.baseURL = m_private->htmlBaseUrl();
- itemList.append(item);
- }
- if (types.contains(mimeTypeDownloadURL)) {
- Item item;
- item.storageType = Item::StorageTypeString;
- item.stringType = String(mimeTypeDownloadURL);
- bool ignored;
- item.stringData = m_private->getData(mimeTypeDownloadURL, ignored);
- itemList.append(item);
- }
- const HashMap<String, String>& customData = m_private->customData();
- for (HashMap<String, String>::const_iterator it = customData.begin(); it != customData.end(); ++it) {
- Item item;
- item.storageType = Item::StorageTypeString;
- item.stringType = it->first;
- item.stringData = it->second;
- itemList.append(item);
- }
- if (m_private->fileContent()) {
- Item item;
- item.storageType = Item::StorageTypeBinaryData;
- item.binaryData = m_private->fileContent();
- item.title = m_private->fileContentFilename();
- itemList.append(item);
- }
- // We don't handle filenames here, since they are never used for dragging out.
return itemList;
}
@@ -135,14 +114,15 @@ void WebDragData::addItem(const Item& item)
ensureMutable();
switch (item.storageType) {
case Item::StorageTypeString:
- m_private->setData(item.stringType, item.stringData);
if (String(item.stringType) == mimeTypeTextURIList)
- m_private->setUrlTitle(item.title);
+ m_private->setURLAndTitle(item.stringData, item.title);
else if (String(item.stringType) == mimeTypeTextHTML)
- m_private->setHtmlBaseUrl(item.baseURL);
+ m_private->setHTMLAndBaseURL(item.stringData, item.baseURL);
+ else
+ m_private->setData(item.stringType, item.stringData);
return;
case Item::StorageTypeFilename:
- m_private->addFilename(item.filenameData);
+ m_private->addFilename(item.filenameData, item.displayNameData);
return;
case Item::StorageTypeBinaryData:
// This should never happen when dragging in.
@@ -150,6 +130,26 @@ void WebDragData::addItem(const Item& item)
}
}
+WebString WebDragData::filesystemId() const
+{
+#if ENABLE(FILE_SYSTEM)
+ ASSERT(!isNull());
+ DraggedIsolatedFileSystem* filesystem = DraggedIsolatedFileSystem::from(m_private);
+ if (filesystem)
+ return filesystem->filesystemId();
+#endif
+ return WebString();
+}
+
+void WebDragData::setFilesystemId(const WebString& filesystemId)
+{
+#if ENABLE(FILE_SYSTEM)
+ // The ID is an opaque string, given by and validated by chromium port.
+ ensureMutable();
+ DraggedIsolatedFileSystem::provideTo(m_private, DraggedIsolatedFileSystem::supplementName(), DraggedIsolatedFileSystem::create(filesystemId));
+#endif
+}
+
WebDragData::WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data)
: m_private(static_cast<WebDragDataPrivate*>(data.leakRef()))
{
@@ -168,7 +168,6 @@ WebDragData::operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const
void WebDragData::assign(WebDragDataPrivate* p)
{
- ASSERT(!p || p->storageMode() == ChromiumDataObject::Buffered);
// p is already ref'd for us by the caller
if (m_private)
m_private->deref();
diff --git a/Source/WebKit/chromium/src/WebElement.cpp b/Source/WebKit/chromium/src/WebElement.cpp
index e6a1b6e4e..1cef30d60 100644
--- a/Source/WebKit/chromium/src/WebElement.cpp
+++ b/Source/WebKit/chromium/src/WebElement.cpp
@@ -39,7 +39,6 @@
#include "RenderObject.h"
#include <wtf/PassRefPtr.h>
-#include "WebNamedNodeMap.h"
using namespace WebCore;
@@ -83,9 +82,25 @@ bool WebElement::setAttribute(const WebString& attrName, const WebString& attrVa
return !exceptionCode;
}
-WebNamedNodeMap WebElement::attributes() const
+unsigned WebElement::attributeCount() const
{
- return WebNamedNodeMap(m_private->attributes());
+ if (!constUnwrap<Element>()->hasAttributes())
+ return 0;
+ return constUnwrap<Element>()->attributeCount();
+}
+
+WebString WebElement::attributeLocalName(unsigned index) const
+{
+ if (index >= attributeCount())
+ return WebString();
+ return constUnwrap<Element>()->attributeItem(index)->localName();
+}
+
+WebString WebElement::attributeValue(unsigned index) const
+{
+ if (index >= attributeCount())
+ return WebString();
+ return constUnwrap<Element>()->attributeItem(index)->value();
}
WebString WebElement::innerText()
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
index c9ba0bc7b..8f7b58a9d 100644
--- a/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
+++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
@@ -24,67 +24,41 @@
*/
#include "config.h"
-#include "platform/WebExternalTextureLayer.h"
+#include <public/WebExternalTextureLayer.h>
-#include "platform/WebFloatRect.h"
-#include "WebExternalTextureLayerImpl.h"
+#include "TextureLayerChromium.h"
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
+
+using namespace WebCore;
namespace WebKit {
WebExternalTextureLayer WebExternalTextureLayer::create()
{
- return WebExternalTextureLayer(WebExternalTextureLayerImpl::create());
+ RefPtr<TextureLayerChromium> layer = TextureLayerChromium::create(0);
+ layer->setIsDrawable(true);
+ return WebExternalTextureLayer(layer.release());
}
void WebExternalTextureLayer::setTextureId(unsigned id)
{
- unwrap<WebExternalTextureLayerImpl>()->setTextureId(id);
-}
-
-unsigned WebExternalTextureLayer::textureId() const
-{
- return constUnwrap<WebExternalTextureLayerImpl>()->textureId();
+ unwrap<TextureLayerChromium>()->setTextureId(id);
}
void WebExternalTextureLayer::setFlipped(bool flipped)
{
- unwrap<WebExternalTextureLayerImpl>()->setFlipped(flipped);
-}
-
-bool WebExternalTextureLayer::flipped() const
-{
- return constUnwrap<WebExternalTextureLayerImpl>()->flipped();
+ unwrap<TextureLayerChromium>()->setFlipped(flipped);
}
void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
{
- unwrap<WebExternalTextureLayerImpl>()->setUVRect(rect);
-}
-
-WebFloatRect WebExternalTextureLayer::uvRect() const
-{
- return WebFloatRect(constUnwrap<WebExternalTextureLayerImpl>()->uvRect());
-}
-
-void WebExternalTextureLayer::invalidateRect(const WebFloatRect& updateRect)
-{
- unwrap<WebExternalTextureLayerImpl>()->setNeedsDisplayRect(updateRect);
-}
-
-WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node)
- : WebLayer(node)
-{
-}
-
-WebExternalTextureLayer& WebExternalTextureLayer::operator=(const PassRefPtr<WebExternalTextureLayerImpl>& node)
-{
- m_private = node;
- return *this;
+ unwrap<TextureLayerChromium>()->setUVRect(rect);
}
-WebExternalTextureLayer::operator PassRefPtr<WebExternalTextureLayerImpl>() const
+WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
+ : WebLayer(layer)
{
- return static_cast<WebExternalTextureLayerImpl*>(m_private.get());
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp
index d7583c5dd..73452d0d0 100644
--- a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp
@@ -44,14 +44,20 @@ WebFileChooserCompletionImpl::~WebFileChooserCompletionImpl()
void WebFileChooserCompletionImpl::didChooseFile(const WebVector<WebString>& fileNames)
{
- if (fileNames.size() == 1)
- m_fileChooser->chooseFile(fileNames[0]);
- else if (fileNames.size() > 0) {
- Vector<WTF::String> paths;
- for (size_t i = 0; i < fileNames.size(); ++i)
- paths.append(fileNames[i]);
- m_fileChooser->chooseFiles(paths);
- }
+ Vector<WebCore::FileChooserFileInfo> fileInfo;
+ for (size_t i = 0; i < fileNames.size(); ++i)
+ fileInfo.append(WebCore::FileChooserFileInfo(fileNames[i]));
+ m_fileChooser->chooseFiles(fileInfo);
+ // This object is no longer needed.
+ delete this;
+}
+
+void WebFileChooserCompletionImpl::didChooseFile(const WebVector<SelectedFileInfo>& files)
+{
+ Vector<WebCore::FileChooserFileInfo> fileInfo;
+ for (size_t i = 0; i < files.size(); ++i)
+ fileInfo.append(WebCore::FileChooserFileInfo(files[i].path, files[i].displayName));
+ m_fileChooser->chooseFiles(fileInfo);
// This object is no longer needed.
delete this;
}
diff --git a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h
index 06a0577b0..3ac63a5e8 100644
--- a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h
+++ b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h
@@ -49,6 +49,7 @@ public:
WebFileChooserCompletionImpl(PassRefPtr<WebCore::FileChooser> chooser);
~WebFileChooserCompletionImpl();
virtual void didChooseFile(const WebVector<WebString>& fileNames);
+ virtual void didChooseFile(const WebVector<SelectedFileInfo>& files);
private:
RefPtr<WebCore::FileChooser> m_fileChooser;
};
diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
index 984cebfdc..c110e7c22 100644
--- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
@@ -47,11 +47,11 @@ using namespace WebCore;
namespace WebKit {
-WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, AsyncFileSystem::Type type, WebCore::ScriptExecutionContext* context, bool synchronous)
+WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, FileSystemSynchronousType synchronousType)
: m_callbacks(callbacks)
, m_type(type)
, m_context(context)
- , m_synchronous(synchronous)
+ , m_synchronousType(synchronousType)
{
ASSERT(m_callbacks);
}
@@ -92,7 +92,7 @@ void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const
#if ENABLE(WORKERS)
if (m_context && m_context->isWorkerContext()) {
- m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronous));
+ m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronousType));
return;
}
#endif
diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h
index d2be57434..76e8cdf8f 100644
--- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h
+++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h
@@ -31,9 +31,9 @@
#ifndef WebFileSystemCallbacksImpl_h
#define WebFileSystemCallbacksImpl_h
-#include "AsyncFileSystem.h"
-#include "platform/WebFileSystem.h"
+#include "FileSystemType.h"
#include "WebFileSystemCallbacks.h"
+#include "platform/WebFileSystem.h"
#include "platform/WebVector.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -52,7 +52,7 @@ class WebURL;
class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks {
public:
- WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::AsyncFileSystem::Type = WebCore::AsyncFileSystem::Temporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false);
+ WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem);
virtual ~WebFileSystemCallbacksImpl();
virtual void didSucceed();
@@ -65,11 +65,11 @@ private:
OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks;
// Used for openFileSystem callbacks.
- WebCore::AsyncFileSystem::Type m_type;
+ WebCore::FileSystemType m_type;
// Used for worker's openFileSystem callbacks.
WebCore::ScriptExecutionContext* m_context;
- bool m_synchronous;
+ WebCore::FileSystemSynchronousType m_synchronousType;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp
index c92a1f567..f6cf39dbe 100644
--- a/Source/WebKit/chromium/src/WebFontImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFontImpl.cpp
@@ -113,24 +113,19 @@ void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl
gc.restore();
#if defined(WIN32)
- if (canvasIsOpaque && SkColorGetA(color) == 0xFF) {
- SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
- iter.next(); // There is always at least one layer.
- bool multipleLayers = !iter.done();
- if (!multipleLayers) {
- // The text drawing logic on Windows ignores the alpha component
- // intentionally, for performance reasons.
- // (Please see TransparencyAwareFontPainter::initializeForGDI in
- // FontChromiumWin.cpp.)
- const SkBitmap& bitmap = canvas->getTopDevice()->accessBitmap(true);
- IntRect textBounds = estimateTextBounds(run, leftBaseline);
- IntRect destRect = gc.getCTM().mapRect(textBounds);
- destRect.intersect(IntRect(0, 0, bitmap.width(), bitmap.height()));
- for (int y = destRect.y(), maxY = destRect.maxY(); y < maxY; y++) {
- uint32_t* row = bitmap.getAddr32(0, y);
- for (int x = destRect.x(), maxX = destRect.maxX(); x < maxX; x++)
- row[x] |= (0xFF << SK_A32_SHIFT);
- }
+ if (canvasIsOpaque && SkColorGetA(color) == 0xFF && !canvas->isDrawingToLayer()) {
+ // The text drawing logic on Windows ignores the alpha component
+ // intentionally, for performance reasons.
+ // (Please see TransparencyAwareFontPainter::initializeForGDI in
+ // FontChromiumWin.cpp.)
+ const SkBitmap& bitmap = canvas->getTopDevice()->accessBitmap(true);
+ IntRect textBounds = estimateTextBounds(run, leftBaseline);
+ IntRect destRect = gc.getCTM().mapRect(textBounds);
+ destRect.intersect(IntRect(0, 0, bitmap.width(), bitmap.height()));
+ for (int y = destRect.y(), maxY = destRect.maxY(); y < maxY; y++) {
+ uint32_t* row = bitmap.getAddr32(0, y);
+ for (int x = destRect.x(), maxX = destRect.maxX(); x < maxX; x++)
+ row[x] |= (0xFF << SK_A32_SHIFT);
}
}
#endif
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp
index 39897c823..d0e6fe238 100644
--- a/Source/WebKit/chromium/src/WebFrameImpl.cpp
+++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp
@@ -79,13 +79,13 @@
#include "DOMUtilitiesPrivate.h"
#include "DOMWindow.h"
#include "Document.h"
-#include "DocumentFragment.h" // Only needed for ReplaceSelectionCommand.h :(
#include "DocumentLoader.h"
#include "DocumentMarker.h"
#include "DocumentMarkerController.h"
#include "Editor.h"
#include "EventHandler.h"
#include "EventListenerWrapper.h"
+#include "FileSystemType.h"
#include "FocusController.h"
#include "FontCache.h"
#include "FormState.h"
@@ -109,7 +109,6 @@
#include "Node.h"
#include "Page.h"
#include "PageOverlay.h"
-#include "painting/GraphicsContextBuilder.h"
#include "Performance.h"
#include "PlatformSupport.h"
#include "PluginDocument.h"
@@ -120,7 +119,6 @@
#include "RenderTreeAsText.h"
#include "RenderView.h"
#include "RenderWidget.h"
-#include "ReplaceSelectionCommand.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "SchemeRegistry.h"
@@ -142,6 +140,7 @@
#include "WebDOMEvent.h"
#include "WebDOMEventListener.h"
#include "WebDataSourceImpl.h"
+#include "WebDevToolsAgentPrivate.h"
#include "WebDocument.h"
#include "WebFindOptions.h"
#include "WebFormElement.h"
@@ -153,19 +152,21 @@
#include "WebPerformance.h"
#include "WebPlugin.h"
#include "WebPluginContainerImpl.h"
-#include "platform/WebPoint.h"
#include "WebRange.h"
-#include "platform/WebRect.h"
#include "WebScriptSource.h"
#include "WebSecurityOrigin.h"
-#include "platform/WebSize.h"
-#include "platform/WebURLError.h"
-#include "platform/WebVector.h"
#include "WebViewImpl.h"
#include "XPathResult.h"
#include "markup.h"
+#include "painting/GraphicsContextBuilder.h"
+#include "platform/WebPoint.h"
+#include "platform/WebRect.h"
+#include "platform/WebSize.h"
+#include "platform/WebURLError.h"
+#include "platform/WebVector.h"
#include <algorithm>
+#include <public/Platform.h>
#include <wtf/CurrentTime.h>
#if USE(V8)
@@ -827,7 +828,7 @@ void WebFrameImpl::executeScriptInIsolatedWorld(
sourcesIn[i].code, sourcesIn[i].url, position));
}
- m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup);
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0);
}
void WebFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin& securityOrigin)
@@ -894,6 +895,37 @@ v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const WebScriptS
return m_frame->script()->executeScript(ScriptSourceCode(source.code, source.url, position)).v8Value();
}
+void WebFrameImpl::executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results)
+{
+ Vector<ScriptSourceCode> sources;
+
+ for (unsigned i = 0; i < numSources; ++i) {
+ TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first());
+ sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position));
+ }
+
+ if (results) {
+ Vector<ScriptValue> scriptResults;
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults);
+ WebVector<v8::Local<v8::Value> > v8Results(scriptResults.size());
+ for (unsigned i = 0; i < scriptResults.size(); i++)
+ v8Results[i] = v8::Local<v8::Value>::New(scriptResults[i].v8Value());
+ results->swap(v8Results);
+ } else
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0);
+}
+
+// Call the function with the given receiver and arguments, bypassing canExecuteScripts.
+v8::Handle<v8::Value> WebFrameImpl::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function,
+ v8::Handle<v8::Object> receiver,
+ int argc,
+ v8::Handle<v8::Value> argv[])
+{
+ return m_frame->script()->callFunctionEvenIfScriptDisabled(function, receiver, argc, argv).v8Value();
+}
+
// Returns the V8 context for this frame, or an empty handle if there is none.
v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const
{
@@ -907,7 +939,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type,
const WebString& name,
const WebString& path)
{
- return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<AsyncFileSystem::Type>(type), KURL(ParsedURLString, path.utf8().data()))));
+ return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()))));
}
v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type,
@@ -916,7 +948,7 @@ v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type,
const WebString& filePath,
bool isDirectory)
{
- RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<AsyncFileSystem::Type>(type), KURL(ParsedURLString, fileSystemPath.utf8().data())));
+ RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data())));
if (isDirectory)
return toV8(DirectoryEntry::create(fileSystem, filePath));
return toV8(FileEntry::create(fileSystem, filePath));
@@ -1189,7 +1221,7 @@ size_t WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const
IntPoint point = frame()->view()->windowToContents(webPoint);
HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false);
- RefPtr<Range> range = frame()->rangeForPoint(result.point());
+ RefPtr<Range> range = frame()->rangeForPoint(result.roundedPoint());
if (!range)
return notFound;
@@ -1380,6 +1412,13 @@ void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end)
frame()->selection()->setSelection(selection, CharacterGranularity);
}
+void WebFrameImpl::selectRange(const WebRange& webRange)
+{
+ RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange);
+ if (range)
+ frame()->selection()->setSelectedRange(range.get(), WebCore::VP_DEFAULT_AFFINITY, false);
+}
+
VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
{
HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move;
@@ -1974,13 +2013,13 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client)
, m_identifier(generateFrameIdentifier())
, m_inSameDocumentHistoryLoad(false)
{
- PlatformSupport::incrementStatsCounter(webFrameActiveCount);
+ WebKit::Platform::current()->incrementStatsCounter(webFrameActiveCount);
frameCount++;
}
WebFrameImpl::~WebFrameImpl()
{
- PlatformSupport::decrementStatsCounter(webFrameActiveCount);
+ WebKit::Platform::current()->decrementStatsCounter(webFrameActiveCount);
frameCount--;
cancelPendingScopingEffort();
@@ -2045,35 +2084,6 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame(
return childFrame.release();
}
-void WebFrameImpl::layout()
-{
- // layout this frame
- FrameView* view = m_frame->view();
- if (view)
- view->updateLayoutAndStyleIfNeededRecursive();
-}
-
-void WebFrameImpl::paintWithContext(GraphicsContext& gc, const WebRect& rect)
-{
- IntRect dirtyRect(rect);
- gc.save();
- if (m_frame->document() && frameView()) {
- gc.clip(dirtyRect);
- frameView()->paint(&gc, dirtyRect);
- if (viewImpl()->pageOverlays())
- viewImpl()->pageOverlays()->paintWebFrame(gc);
- } else
- gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB);
- gc.restore();
-}
-
-void WebFrameImpl::paint(WebCanvas* canvas, const WebRect& rect)
-{
- if (rect.isEmpty())
- return;
- paintWithContext(GraphicsContextBuilder(canvas).context(), rect);
-}
-
void WebFrameImpl::createFrameView()
{
ASSERT(m_frame); // If m_frame doesn't exist, we probably didn't init properly.
@@ -2083,6 +2093,9 @@ void WebFrameImpl::createFrameView()
m_frame->createView(webView->size(), Color::white, webView->isTransparent(), webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0);
if (webView->shouldAutoResize() && isMainFrame)
m_frame->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize());
+
+ if (isMainFrame && webView->devToolsAgentPrivate())
+ webView->devToolsAgentPrivate()->mainFrameViewCreated(this);
}
WebFrameImpl* WebFrameImpl::fromFrame(Frame* frame)
diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h
index 700f6ea40..c3acc1afb 100644
--- a/Source/WebKit/chromium/src/WebFrameImpl.h
+++ b/Source/WebKit/chromium/src/WebFrameImpl.h
@@ -62,6 +62,8 @@ class WebPluginContainerImpl;
class WebView;
class WebViewImpl;
+template <typename T> class WebVector;
+
// Implementation of WebFrame, note that this is a reference counted object.
class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> {
public:
@@ -110,6 +112,14 @@ public:
#if WEBKIT_USING_V8
virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
const WebScriptSource&);
+ virtual void executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results);
+ virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
+ v8::Handle<v8::Function>,
+ v8::Handle<v8::Object>,
+ int argc,
+ v8::Handle<v8::Value> argv[]);
virtual v8::Local<v8::Context> mainWorldScriptContext() const;
virtual v8::Handle<v8::Value> createFileSystem(WebFileSystem::Type,
const WebString& name,
@@ -165,6 +175,7 @@ public:
virtual WebString selectionAsMarkup() const;
virtual bool selectWordAroundCaret();
virtual void selectRange(const WebPoint& start, const WebPoint& end);
+ virtual void selectRange(const WebRange&);
virtual int printBegin(const WebSize& pageSize,
const WebNode& constrainToNode,
int printerDPI,
@@ -225,9 +236,6 @@ public:
PassRefPtr<WebCore::Frame> createChildFrame(
const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*);
- void layout();
- void paint(WebCanvas*, const WebRect&);
- void paintWithContext(WebCore::GraphicsContext&, const WebRect&);
void createFrameView();
static WebFrameImpl* fromFrame(WebCore::Frame* frame);
diff --git a/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp b/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp
index 0ad47da31..3d9630707 100644
--- a/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp
+++ b/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "WebGeolocationClientMock.h"
-#include "CurrentTime.h"
+#include <wtf/CurrentTime.h>
#include "Geolocation.h"
#include "GeolocationClientMock.h"
#include "GeolocationError.h"
diff --git a/Source/WebKit/chromium/src/WebHTTPBody.cpp b/Source/WebKit/chromium/src/WebHTTPBody.cpp
deleted file mode 100644
index d67a70190..000000000
--- a/Source/WebKit/chromium/src/WebHTTPBody.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebHTTPBody.h"
-
-#include "FormData.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebHTTPBodyPrivate : public FormData {
-};
-
-void WebHTTPBody::initialize()
-{
- assign(static_cast<WebHTTPBodyPrivate*>(FormData::create().leakRef()));
-}
-
-void WebHTTPBody::reset()
-{
- assign(0);
-}
-
-void WebHTTPBody::assign(const WebHTTPBody& other)
-{
- WebHTTPBodyPrivate* p = const_cast<WebHTTPBodyPrivate*>(other.m_private);
- if (p)
- p->ref();
- assign(p);
-}
-
-size_t WebHTTPBody::elementCount() const
-{
- ASSERT(!isNull());
- return m_private->elements().size();
-}
-
-bool WebHTTPBody::elementAt(size_t index, Element& result) const
-{
- ASSERT(!isNull());
-
- if (index >= m_private->elements().size())
- return false;
-
- const FormDataElement& element = m_private->elements()[index];
-
- result.data.reset();
- result.filePath.reset();
- result.fileStart = 0;
- result.fileLength = 0;
- result.modificationTime = 0.0;
- result.blobURL = KURL();
-
- switch (element.m_type) {
- case FormDataElement::data:
- result.type = Element::TypeData;
- result.data.assign(element.m_data.data(), element.m_data.size());
- break;
- case FormDataElement::encodedFile:
- result.type = Element::TypeFile;
- result.filePath = element.m_filename;
-#if ENABLE(BLOB)
- result.fileStart = element.m_fileStart;
- result.fileLength = element.m_fileLength;
- result.modificationTime = element.m_expectedFileModificationTime;
-#endif
- break;
-#if ENABLE(BLOB)
- case FormDataElement::encodedBlob:
- result.type = Element::TypeBlob;
- result.blobURL = element.m_blobURL;
- break;
-#endif
- default:
- ASSERT_NOT_REACHED();
- return false;
- }
-
- return true;
-}
-
-void WebHTTPBody::appendData(const WebData& data)
-{
- ensureMutable();
- // FIXME: FormDataElement::m_data should be a SharedBuffer<char>. Then we
- // could avoid this buffer copy.
- m_private->appendData(data.data(), data.size());
-}
-
-void WebHTTPBody::appendFile(const WebString& filePath)
-{
- ensureMutable();
- m_private->appendFile(filePath);
-}
-
-void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, double modificationTime)
-{
-#if ENABLE(BLOB)
- ensureMutable();
- m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime);
-#endif
-}
-
-void WebHTTPBody::appendBlob(const WebURL& blobURL)
-{
-#if ENABLE(BLOB)
- ensureMutable();
- m_private->appendBlob(blobURL);
-#endif
-}
-
-long long WebHTTPBody::identifier() const
-{
- ASSERT(!isNull());
- return m_private->identifier();
-}
-
-void WebHTTPBody::setIdentifier(long long identifier)
-{
- ensureMutable();
- return m_private->setIdentifier(identifier);
-}
-
-WebHTTPBody::WebHTTPBody(const PassRefPtr<FormData>& data)
- : m_private(static_cast<WebHTTPBodyPrivate*>(data.leakRef()))
-{
-}
-
-WebHTTPBody& WebHTTPBody::operator=(const PassRefPtr<FormData>& data)
-{
- assign(static_cast<WebHTTPBodyPrivate*>(data.leakRef()));
- return *this;
-}
-
-WebHTTPBody::operator PassRefPtr<FormData>() const
-{
- return m_private;
-}
-
-void WebHTTPBody::assign(WebHTTPBodyPrivate* p)
-{
- // p is already ref'd for us by the caller
- if (m_private)
- m_private->deref();
- m_private = p;
-}
-
-void WebHTTPBody::ensureMutable()
-{
- ASSERT(!isNull());
- if (!m_private->hasOneRef())
- assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().leakRef()));
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebHTTPLoadInfo.cpp b/Source/WebKit/chromium/src/WebHTTPLoadInfo.cpp
deleted file mode 100644
index e3dce8c5a..000000000
--- a/Source/WebKit/chromium/src/WebHTTPLoadInfo.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebHTTPLoadInfo.h"
-
-#include "ResourceLoadInfo.h"
-#include "ResourceResponse.h"
-#include "platform/WebHTTPHeaderVisitor.h"
-#include "platform/WebString.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebHTTPLoadInfo::initialize()
-{
- m_private = adoptRef(new ResourceLoadInfo());
-}
-
-void WebHTTPLoadInfo::reset()
-{
- m_private.reset();
-}
-
-void WebHTTPLoadInfo::assign(const WebHTTPLoadInfo& r)
-{
- m_private = r.m_private;
-}
-
-WebHTTPLoadInfo::WebHTTPLoadInfo(WTF::PassRefPtr<WebCore::ResourceLoadInfo> value)
-{
- m_private = value;
-}
-
-WebHTTPLoadInfo::operator WTF::PassRefPtr<WebCore::ResourceLoadInfo>() const
-{
- return m_private.get();
-}
-
-int WebHTTPLoadInfo::httpStatusCode() const
-{
- ASSERT(!m_private.isNull());
- return m_private->httpStatusCode;
-}
-
-void WebHTTPLoadInfo::setHTTPStatusCode(int statusCode)
-{
- ASSERT(!m_private.isNull());
- m_private->httpStatusCode = statusCode;
-}
-
-WebString WebHTTPLoadInfo::httpStatusText() const
-{
- ASSERT(!m_private.isNull());
- return m_private->httpStatusText;
-}
-
-void WebHTTPLoadInfo::setHTTPStatusText(const WebString& statusText)
-{
- ASSERT(!m_private.isNull());
- m_private->httpStatusText = statusText;
-}
-
-long long WebHTTPLoadInfo::encodedDataLength() const
-{
- ASSERT(!m_private.isNull());
- return m_private->encodedDataLength;
-}
-
-void WebHTTPLoadInfo::setEncodedDataLength(long long encodedDataLength)
-{
- ASSERT(!m_private.isNull());
- m_private->encodedDataLength = encodedDataLength;
-}
-
-static void addHeader(HTTPHeaderMap* map, const WebString& name, const WebString& value)
-{
- pair<HTTPHeaderMap::iterator, bool> result = map->add(name, value);
- if (!result.second)
- result.first->second += ", " + String(value);
-}
-
-void WebHTTPLoadInfo::addRequestHeader(const WebString& name, const WebString& value)
-{
- ASSERT(!m_private.isNull());
- addHeader(&m_private->requestHeaders, name, value);
-}
-
-void WebHTTPLoadInfo::addResponseHeader(const WebString& name, const WebString& value)
-{
- ASSERT(!m_private.isNull());
- addHeader(&m_private->responseHeaders, name, value);
-}
-
-WebString WebHTTPLoadInfo::requestHeadersText() const
-{
- ASSERT(!m_private.isNull());
- return m_private->requestHeadersText;
-}
-
-void WebHTTPLoadInfo::setRequestHeadersText(const WebString& headersText)
-{
- ASSERT(!m_private.isNull());
- m_private->requestHeadersText = headersText;
-}
-
-WebString WebHTTPLoadInfo::responseHeadersText() const
-{
- ASSERT(!m_private.isNull());
- return m_private->responseHeadersText;
-}
-
-void WebHTTPLoadInfo::setResponseHeadersText(const WebString& headersText)
-{
- ASSERT(!m_private.isNull());
- m_private->responseHeadersText = headersText;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebHitTestResult.cpp b/Source/WebKit/chromium/src/WebHitTestResult.cpp
new file mode 100644
index 000000000..5f806b80c
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebHitTestResult.cpp
@@ -0,0 +1,84 @@
+/*
+* 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 "WebHitTestResult.h"
+
+#include "Element.h"
+#include "HitTestResult.h"
+#include "KURL.h"
+#include "Node.h"
+#include "RenderObject.h"
+#include "VisiblePosition.h"
+#include "WebNode.h"
+
+#include "platform/WebPoint.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebNode WebHitTestResult::node() const
+{
+ return WebNode(m_private->innerNode());
+}
+
+WebPoint WebHitTestResult::localPoint() const
+{
+ return roundedIntPoint(m_private->localPoint());
+}
+
+WebHitTestResult::WebHitTestResult(const HitTestResult& result)
+{
+ m_private.reset(new HitTestResult(result));
+}
+
+WebHitTestResult& WebHitTestResult::operator=(const HitTestResult& result)
+{
+ m_private.reset(new HitTestResult(result));
+ return *this;
+}
+
+WebHitTestResult::operator HitTestResult() const
+{
+ return *m_private.get();
+}
+
+bool WebHitTestResult::isNull() const
+{
+ return !m_private.get();
+}
+
+void WebHitTestResult::assign(const WebHitTestResult& info)
+{
+ m_private.reset(new HitTestResult(info));
+}
+
+void WebHitTestResult::reset()
+{
+ m_private.reset(0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp
index 66ed709c5..6f10efe9e 100644
--- a/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.cpp
@@ -72,6 +72,11 @@ void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallb
m_idbCursorBackend->update(value, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec);
}
+void WebIDBCursorImpl::advance(unsigned long count, WebIDBCallbacks* callbacks, WebExceptionCode& ec)
+{
+ m_idbCursorBackend->advance(count, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec);
+}
+
void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks, WebExceptionCode& ec)
{
m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(adoptPtr(callbacks)), ec);
diff --git a/Source/WebKit/chromium/src/WebIDBCursorImpl.h b/Source/WebKit/chromium/src/WebIDBCursorImpl.h
index 59fbc3343..418675142 100644
--- a/Source/WebKit/chromium/src/WebIDBCursorImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBCursorImpl.h
@@ -49,6 +49,7 @@ public:
virtual WebIDBKey primaryKey() const;
virtual WebSerializedScriptValue value() const;
virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&);
+ virtual void advance(unsigned long, WebIDBCallbacks*, WebExceptionCode&);
virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&);
virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&);
virtual void prefetchContinue(int numberToFetch, WebIDBCallbacks*, WebExceptionCode&);
diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
index 6f83775be..f73be5705 100644
--- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -53,7 +53,10 @@ public:
virtual WebString version() const;
virtual WebDOMStringList objectStoreNames() const;
- virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&);
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
+ virtual WebIDBObjectStore* createObjectStore(const WebString&, const WebString&, bool, const WebIDBTransaction&, WebExceptionCode&);
+ virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) { return createObjectStore(name, keyPath.string(), autoIncrement, transaction, ec); }
virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&);
virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&);
diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp
index 710e300f9..170939567 100644
--- a/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.cpp
@@ -58,7 +58,14 @@ WebString WebIDBIndexImpl::storeName() const
return m_backend->storeName();
}
-WebString WebIDBIndexImpl::keyPath() const
+WebIDBKeyPath WebIDBIndexImpl::keyPath() const
+{
+ return WebIDBKeyPath(m_backend->keyPath());
+}
+
+// FIXME: Remove this method once callers are updated.
+// http://webkit.org/b/84207
+WebString WebIDBIndexImpl::keyPathString() const
{
return m_backend->keyPath();
}
@@ -88,12 +95,12 @@ void WebIDBIndexImpl::count(const WebIDBKeyRange& keyRange, WebIDBCallbacks* ca
m_backend->count(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBIndexImpl::getObject(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
+void WebIDBIndexImpl::getObject(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
m_backend->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBIndexImpl::getKey(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
+void WebIDBIndexImpl::getKey(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
m_backend->getKey(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
}
diff --git a/Source/WebKit/chromium/src/WebIDBIndexImpl.h b/Source/WebKit/chromium/src/WebIDBIndexImpl.h
index 226feb8e3..d8b1129d0 100644
--- a/Source/WebKit/chromium/src/WebIDBIndexImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBIndexImpl.h
@@ -45,15 +45,18 @@ public:
virtual WebString name() const;
virtual WebString storeName() const;
- virtual WebString keyPath() const;
+ virtual WebIDBKeyPath keyPath() const;
+ // FIXME: Remove this method once callers are updated.
+ // http://webkit.org/b/84207
+ virtual WebString keyPathString() const;
virtual bool unique() const;
virtual bool multiEntry() const;
virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
- virtual void getObject(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
- virtual void getKey(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void getObject(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void getKey(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
private:
WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend;
diff --git a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
index 74f357e40..bcf5dbd0d 100644
--- a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
+++ b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp
@@ -37,20 +37,78 @@ using namespace WebCore;
namespace WebKit {
+WebIDBKeyPath WebIDBKeyPath::create(const WebVector<WebString>&)
+{
+ // FIXME: Array-type key paths not yet supported. http://webkit.org/b/84207
+ WEBKIT_ASSERT_NOT_REACHED();
+ return createNull();
+}
+
WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath)
{
+ if (keyPath.isNull())
+ return createNull();
+
WTF::Vector<WTF::String> idbElements;
IDBKeyPathParseError idbError;
IDBParseKeyPath(keyPath, idbElements, idbError);
return WebIDBKeyPath(idbElements, static_cast<int>(idbError));
}
+WebIDBKeyPath WebIDBKeyPath::createNull()
+{
+ return WebIDBKeyPath(WebString());
+}
+
+WebIDBKeyPath::WebIDBKeyPath(const WebIDBKeyPath& keyPath)
+{
+ assign(keyPath);
+}
+
WebIDBKeyPath::WebIDBKeyPath(const WTF::Vector<WTF::String>& elements, int parseError)
: m_private(new WTF::Vector<WTF::String>(elements))
, m_parseError(parseError)
{
}
+bool WebIDBKeyPath::isValid() const
+{
+ return m_parseError == IDBKeyPathParseErrorNone;
+}
+
+WebIDBKeyPath::Type WebIDBKeyPath::type() const
+{
+ return m_private.get() ? StringType : NullType;
+}
+
+WebString WebIDBKeyPath::string() const
+{
+ if (!m_private.get())
+ return WebString();
+
+ // FIXME: Store the complete string instead of rebuilding it.
+ // http://webkit.org/b/84207
+ WTF::String string("");
+ WTF::Vector<WTF::String>& array = *m_private.get();
+ for (size_t i = 0; i < array.size(); ++i) {
+ if (i)
+ string.append(".");
+ string.append(array[i]);
+ }
+ return WebString(string);
+}
+
+WebIDBKeyPath::WebIDBKeyPath(const WebString& keyPath)
+ : m_parseError(IDBKeyPathParseErrorNone)
+{
+ if (!keyPath.isNull()) {
+ m_private.reset(new WTF::Vector<WTF::String>());
+ IDBKeyPathParseError idbParseError;
+ IDBParseKeyPath(keyPath, *m_private.get(), idbParseError);
+ m_parseError = idbParseError;
+ }
+}
+
int WebIDBKeyPath::parseError() const
{
return m_parseError;
@@ -59,7 +117,10 @@ int WebIDBKeyPath::parseError() const
void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath)
{
m_parseError = keyPath.m_parseError;
- m_private.reset(new WTF::Vector<WTF::String>(keyPath));
+ if (keyPath.m_private.get())
+ m_private.reset(new WTF::Vector<WTF::String>(keyPath));
+ else
+ m_private.reset(0);
}
void WebIDBKeyPath::reset()
@@ -69,6 +130,7 @@ void WebIDBKeyPath::reset()
WebIDBKeyPath::operator const WTF::Vector<WTF::String, 0>&() const
{
+ ASSERT(m_private.get());
return *m_private.get();
}
diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
index 55a6add57..624a4e5b3 100755
--- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
@@ -57,7 +57,14 @@ WebString WebIDBObjectStoreImpl::name() const
return m_objectStore->name();
}
-WebString WebIDBObjectStoreImpl::keyPath() const
+WebIDBKeyPath WebIDBObjectStoreImpl::keyPath() const
+{
+ return WebIDBKeyPath(m_objectStore->keyPath());
+}
+
+// FIXME: Remove this method once callers are updated.
+// http://webkit.org/b/84207
+WebString WebIDBObjectStoreImpl::keyPathString() const
{
return m_objectStore->keyPath();
}
@@ -67,9 +74,9 @@ WebDOMStringList WebIDBObjectStoreImpl::indexNames() const
return m_objectStore->indexNames();
}
-void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
+void WebIDBObjectStoreImpl::get(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->get(key, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
+ m_objectStore->get(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
}
void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
index d2202fc7f..ee3b222ac 100644
--- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
@@ -46,18 +46,22 @@ public:
~WebIDBObjectStoreImpl();
WebString name() const;
- WebString keyPath() const;
+ WebIDBKeyPath keyPath() const;
+ // FIXME: Remove this method once callers are updated.
+ // http://webkit.org/b/84207
+ WebString keyPathString() const;
WebDOMStringList indexNames() const;
- void get(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
void deleteFunction(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
- // FIXME: Remove once callers are updated.
- WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction, WebExceptionCode& ec) { return createIndex(name, keyPath, unique, false, transaction, ec); }
- WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&);
+ // FIXME: Remove WebString keyPath overload once callers are updated.
+ // http://webkit.org/b/84207
+ WebIDBIndex* createIndex(const WebString&, const WebString&, bool, bool, const WebIDBTransaction&, WebExceptionCode&);
+ WebIDBIndex* createIndex(const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) { return createIndex(name, keyPath.string(), unique, multiEntry, transaction, ec); }
WebIDBIndex* index(const WebString& name, WebExceptionCode&);
void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp
index ec6c29060..77db0c877 100644
--- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp
@@ -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
@@ -24,34 +24,30 @@
*/
#include "config.h"
-#include "WebExternalTextureLayerImpl.h"
+#include <public/WebIOSurfaceLayer.h>
-#include "GraphicsContext.h"
-#include "platform/WebCanvas.h"
+#include "IOSurfaceLayerChromium.h"
+#include <public/WebSize.h>
using namespace WebCore;
namespace WebKit {
-PassRefPtr<WebExternalTextureLayerImpl> WebExternalTextureLayerImpl::create()
+WebIOSurfaceLayer WebIOSurfaceLayer::create()
{
- return adoptRef(new WebExternalTextureLayerImpl());
+ RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
+ layer->setIsDrawable(true);
+ return WebIOSurfaceLayer(layer.release());
}
-WebExternalTextureLayerImpl::WebExternalTextureLayerImpl()
- : PluginLayerChromium()
+void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
{
- setFlipped(false);
- setIsDrawable(true);
+ unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size);
}
-WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
+WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer)
+ : WebLayer(layer)
{
}
-bool WebExternalTextureLayerImpl::drawsContent() const
-{
- return !!textureId() && LayerChromium::drawsContent();
-}
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp
index f5d52da80..c0037a0ef 100644
--- a/Source/WebKit/chromium/src/WebInputElement.cpp
+++ b/Source/WebKit/chromium/src/WebInputElement.cpp
@@ -31,9 +31,11 @@
#include "config.h"
#include "WebInputElement.h"
+#include "HTMLDataListElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "TextControlInnerElements.h"
+#include "WebNodeCollection.h"
#include "platform/WebString.h"
#include <wtf/PassRefPtr.h>
@@ -151,6 +153,21 @@ bool WebInputElement::isChecked() const
return constUnwrap<HTMLInputElement>()->checked();
}
+bool WebInputElement::isMultiple() const
+{
+ return constUnwrap<HTMLInputElement>()->multiple();
+}
+
+WebNodeCollection WebInputElement::dataListOptions() const
+{
+#if ENABLE(DATALIST)
+ HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(constUnwrap<HTMLInputElement>()->list());
+ if (dataList)
+ return WebNodeCollection(dataList->options());
+#endif
+ return WebNodeCollection();
+}
+
bool WebInputElement::isSpeechInputEnabled() const
{
#if ENABLE(INPUT_SPEECH)
@@ -218,5 +235,4 @@ WebInputElement* toWebInputElement(WebElement* webElement)
return static_cast<WebInputElement*>(webElement);
}
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp
index 8ca1cffd4..d204dfac2 100644
--- a/Source/WebKit/chromium/src/WebInputEvent.cpp
+++ b/Source/WebKit/chromium/src/WebInputEvent.cpp
@@ -43,6 +43,38 @@ using namespace WebCore;
namespace WebKit {
+class SameSizeAsWebInputEvent {
+ int inputData[5];
+};
+
+class SameSizeAsWebKeyboardEvent : public SameSizeAsWebInputEvent {
+ int keyboardData[12];
+};
+
+class SameSizeAsWebMouseEvent : public SameSizeAsWebInputEvent {
+ int mouseData[10];
+};
+
+class SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent {
+ int mousewheelData[8];
+};
+
+class SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent {
+ int gestureData[8];
+};
+
+class SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent {
+ WebTouchPoint touchPoints[3 * WebTouchEvent::touchesLengthCap];
+ int touchData[3];
+};
+
+COMPILE_ASSERT(sizeof(WebInputEvent) == sizeof(SameSizeAsWebInputEvent), WebInputEvent_has_gaps);
+COMPILE_ASSERT(sizeof(WebKeyboardEvent) == sizeof(SameSizeAsWebKeyboardEvent), WebKeyboardEvent_has_gaps);
+COMPILE_ASSERT(sizeof(WebMouseEvent) == sizeof(SameSizeAsWebMouseEvent), WebMouseEvent_has_gaps);
+COMPILE_ASSERT(sizeof(WebMouseWheelEvent) == sizeof(SameSizeAsWebMouseWheelEvent), WebMouseWheelEvent_has_gaps);
+COMPILE_ASSERT(sizeof(WebGestureEvent) == sizeof(SameSizeAsWebGestureEvent), WebGestureEvent_has_gaps);
+COMPILE_ASSERT(sizeof(WebTouchEvent) == sizeof(SameSizeAsWebTouchEvent), WebTouchEvent_has_gaps);
+
static const char* staticKeyIdentifiers(unsigned short keyCode)
{
switch (keyCode) {
diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp
index 5cf0ccaec..b4055a91e 100644
--- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp
+++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp
@@ -155,11 +155,18 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
case WebInputEvent::GestureDoubleTap:
m_type = PlatformEvent::GestureDoubleTap;
break;
+ case WebInputEvent::GestureLongPress:
+ m_type = PlatformEvent::GestureLongPress;
+ break;
case WebInputEvent::GesturePinchBegin:
+ m_type = PlatformEvent::GesturePinchBegin;
+ break;
case WebInputEvent::GesturePinchEnd:
+ m_type = PlatformEvent::GesturePinchEnd;
+ break;
case WebInputEvent::GesturePinchUpdate:
- // FIXME: Once PlatformGestureEvent is updated to support pinch, this should set m_type to appropriate PlatformEvent type.
- ASSERT_NOT_REACHED();
+ m_type = PlatformEvent::GesturePinchUpdate;
+ break;
default:
ASSERT_NOT_REACHED();
}
@@ -167,6 +174,8 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
m_globalPosition = IntPoint(e.globalX, e.globalY);
m_deltaX = e.deltaX;
m_deltaY = e.deltaY;
+ m_gammaX = e.gammaX;
+ m_gammaY = e.gammaY;
m_timestamp = e.timeStampSeconds;
m_modifiers = 0;
diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp
index 77d766d76..ce4e15bd6 100644
--- a/Source/WebKit/chromium/src/WebIntent.cpp
+++ b/Source/WebKit/chromium/src/WebIntent.cpp
@@ -32,7 +32,9 @@
#include "WebIntent.h"
#include "Intent.h"
+#include "PlatformMessagePortChannel.h"
#include "SerializedScriptValue.h"
+#include <wtf/HashMap.h>
namespace WebKit {
@@ -102,4 +104,56 @@ WebString WebIntent::data() const
#endif
}
+WebURL WebIntent::service() const
+{
+#if ENABLE(WEB_INTENTS)
+ return WebURL(m_private->service());
+#else
+ return WebURL();
+#endif
+}
+
+WebMessagePortChannelArray* WebIntent::messagePortChannelsRelease() const
+{
+ // Note: see PlatformMessagePortChannel::postMessageToRemote.
+ WebMessagePortChannelArray* webChannels = 0;
+ WebCore::MessagePortChannelArray* messagePorts = m_private->messagePorts();
+ if (messagePorts) {
+ webChannels = new WebMessagePortChannelArray(messagePorts->size());
+ for (size_t i = 0; i < messagePorts->size(); ++i) {
+ WebCore::PlatformMessagePortChannel* platformChannel = messagePorts->at(i)->channel();
+ (*webChannels)[i] = platformChannel->webChannelRelease();
+ (*webChannels)[i]->setClient(0);
+ }
+ }
+
+ return webChannels;
+}
+
+WebVector<WebString> WebIntent::extrasNames() const
+{
+#if ENABLE(WEB_INTENTS)
+ size_t numExtras = m_private->extras().size();
+ WebVector<WebString> keyStrings(numExtras);
+ WTF::HashMap<String, String>::const_iterator::Keys keyIter = m_private->extras().begin().keys();
+ for (size_t i = 0; keyIter != m_private->extras().end().keys(); ++keyIter, ++i)
+ keyStrings[i] = *keyIter;
+ return keyStrings;
+#else
+ return WebVector<WebString>();
+#endif
+}
+
+WebString WebIntent::extrasValue(const WebString& name) const
+{
+#if ENABLE(WEB_INTENTS)
+ WTF::HashMap<String, String>::const_iterator val = m_private->extras().find(name);
+ if (val == m_private->extras().end())
+ return WebString();
+ return val->second;
+#else
+ return WebString();
+#endif
+}
+
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp
index 77858c4e7..da54cca50 100644
--- a/Source/WebKit/chromium/src/WebKit.cpp
+++ b/Source/WebKit/chromium/src/WebKit.cpp
@@ -37,23 +37,24 @@
#include "Settings.h"
#include "TextEncoding.h"
#include "V8Binding.h"
+#include "V8RecursionScope.h"
#include "WebKitMutationObserver.h"
-#include "platform/WebKitPlatformSupport.h"
#include "WebMediaPlayerClientImpl.h"
#include "WebSocket.h"
-#include "platform/WebThread.h"
#include "WorkerContextExecutionProxy.h"
+#include "platform/WebKitPlatformSupport.h"
+#include "platform/WebThread.h"
#include "v8.h"
-
-#if OS(DARWIN)
-#include "WebSystemInterface.h"
-#endif
-
+#include <public/Platform.h>
#include <wtf/Assertions.h>
#include <wtf/MainThread.h>
#include <wtf/Threading.h>
#include <wtf/text/AtomicString.h>
+#if OS(DARWIN)
+#include "WebSystemInterface.h"
+#endif
+
namespace WebKit {
#if ENABLE(MUTATION_OBSERVERS)
@@ -88,6 +89,13 @@ static bool generateEntropy(unsigned char* buffer, size_t length)
return false;
}
+#ifndef NDEBUG
+static void assertV8RecursionScope()
+{
+ ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed());
+}
+#endif
+
void initialize(WebKitPlatformSupport* webKitPlatformSupport)
{
initializeWithoutV8(webKitPlatformSupport);
@@ -99,6 +107,9 @@ void initialize(WebKitPlatformSupport* webKitPlatformSupport)
#if ENABLE(MUTATION_OBSERVERS)
// currentThread will always be non-null in production, but can be null in Chromium unit tests.
if (WebThread* currentThread = webKitPlatformSupport->currentThread()) {
+#ifndef NDEBUG
+ v8::V8::AddCallCompletedCallback(&assertV8RecursionScope);
+#endif
ASSERT(!s_endOfTaskRunner);
s_endOfTaskRunner = new EndOfTaskRunner;
currentThread->addTaskObserver(s_endOfTaskRunner);
@@ -118,6 +129,7 @@ void initializeWithoutV8(WebKitPlatformSupport* webKitPlatformSupport)
ASSERT(webKitPlatformSupport);
ASSERT(!s_webKitPlatformSupport);
s_webKitPlatformSupport = webKitPlatformSupport;
+ Platform::initialize(s_webKitPlatformSupport);
WTF::initializeThreading();
WTF::initializeMainThread();
@@ -136,8 +148,13 @@ void initializeWithoutV8(WebKitPlatformSupport* webKitPlatformSupport)
void shutdown()
{
+ // WebKit might have been initialized without V8, so be careful not to invoke
+ // V8 specific functions, if V8 was not properly initialized.
#if ENABLE(MUTATION_OBSERVERS)
if (s_endOfTaskRunner) {
+#ifndef NDEBUG
+ v8::V8::RemoveCallCompletedCallback(&assertV8RecursionScope);
+#endif
ASSERT(s_webKitPlatformSupport->currentThread());
s_webKitPlatformSupport->currentThread()->removeTaskObserver(s_endOfTaskRunner);
delete s_endOfTaskRunner;
@@ -145,6 +162,7 @@ void shutdown()
}
#endif
s_webKitPlatformSupport = 0;
+ Platform::shutdown();
}
WebKitPlatformSupport* webKitPlatformSupport()
diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp
index f31c5a8c3..ecf7452fc 100644
--- a/Source/WebKit/chromium/src/WebLayer.cpp
+++ b/Source/WebKit/chromium/src/WebLayer.cpp
@@ -26,13 +26,15 @@
#include "config.h"
#include "platform/WebLayer.h"
-#include "platform/WebFloatPoint.h"
#include "Color.h"
#include "LayerChromium.h"
#include "SkMatrix44.h"
#include "TransformationMatrix.h"
#include "WebLayerImpl.h"
-#include "platform/WebSize.h"
+#include <public/WebFilterOperations.h>
+#include <public/WebFloatPoint.h>
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
using namespace WebCore;
@@ -94,6 +96,16 @@ bool WebLayer::equals(const WebLayer& n) const
return (m_private.get() == n.m_private.get());
}
+void WebLayer::invalidateRect(const WebFloatRect& dirtyRect)
+{
+ m_private->setNeedsDisplayRect(dirtyRect);
+}
+
+void WebLayer::invalidate()
+{
+ m_private->setNeedsDisplay();
+}
+
WebLayer WebLayer::rootLayer() const
{
return WebLayer(const_cast<LayerChromium*>(m_private->rootLayer()));
@@ -241,6 +253,16 @@ void WebLayer::setDebugBorderWidth(float width)
m_private->setDebugBorderWidth(width);
}
+void WebLayer::setFilters(const WebFilterOperations& filters)
+{
+ m_private->setFilters(filters.toFilterOperations());
+}
+
+void WebLayer::setBackgroundFilters(const WebFilterOperations& filters)
+{
+ m_private->setBackgroundFilters(filters.toFilterOperations());
+}
+
WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
: m_private(node)
{
diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp
index 13721be0c..16e1206ca 100644
--- a/Source/WebKit/chromium/src/WebLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp
@@ -47,8 +47,4 @@ WebLayerImpl::~WebLayerImpl()
{
}
-void WebLayerImpl::paintContents(GraphicsContext&, const IntRect& clip)
-{
-}
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h
index 3884c42bc..7e4e75062 100644
--- a/Source/WebKit/chromium/src/WebLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebLayerImpl.h
@@ -38,7 +38,6 @@ public:
protected:
WebLayerImpl();
virtual ~WebLayerImpl();
- virtual void paintContents(WebCore::GraphicsContext&, const WebCore::IntRect& clip);
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
index 3314dc2f5..6c18f6742 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
@@ -41,7 +41,6 @@ WebLayerTreeView::Settings::operator CCSettings() const
{
CCSettings settings;
settings.acceleratePainting = acceleratePainting;
- settings.compositeOffscreen = compositeOffscreen;
settings.showFPSCounter = showFPSCounter;
settings.showPlatformLayerTree = showPlatformLayerTree;
settings.refreshRate = refreshRate;
@@ -55,23 +54,24 @@ WebLayerTreeView::Settings::operator CCSettings() const
void WebLayerTreeView::reset()
{
- m_private.reset();
+ m_private.reset(0);
}
-void WebLayerTreeView::assign(const WebLayerTreeView& other)
+bool WebLayerTreeView::isNull() const
{
- m_private = other.m_private;
+ return !m_private.get();
}
-bool WebLayerTreeView::equals(const WebLayerTreeView& n) const
+bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
{
- return (m_private.get() == n.m_private.get());
+ // We have to leak the pointer here into a WebPrivateOwnPtr. We free this object in reset().
+ m_private.reset(WebLayerTreeViewImpl::create(client, root, settings).leakPtr());
+ return !isNull();
}
-bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
+void WebLayerTreeView::setSurfaceReady()
{
- m_private = WebLayerTreeViewImpl::create(client, root, settings);
- return !isNull();
+ m_private->setSurfaceReady();
}
void WebLayerTreeView::setRootLayer(WebLayer *root)
@@ -97,6 +97,11 @@ WebSize WebLayerTreeView::viewportSize() const
return WebSize(m_private->viewportSize());
}
+void WebLayerTreeView::setBackgroundColor(WebColor color)
+{
+ m_private->setBackgroundColor(color);
+}
+
void WebLayerTreeView::setVisible(bool visible)
{
m_private->setVisible(visible);
@@ -122,6 +127,11 @@ void WebLayerTreeView::setNeedsRedraw()
m_private->setNeedsRedraw();
}
+bool WebLayerTreeView::commitRequested() const
+{
+ return m_private->commitRequested();
+}
+
void WebLayerTreeView::composite()
{
if (CCProxy::hasImplThread())
diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
index 335879b66..161f9e932 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
@@ -41,13 +41,13 @@ using namespace WebCore;
namespace WebKit {
-PassRefPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
+PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
{
- RefPtr<WebLayerTreeViewImpl> host = adoptRef(new WebLayerTreeViewImpl(client, settings));
+ OwnPtr<WebLayerTreeViewImpl> host = adoptPtr(new WebLayerTreeViewImpl(client, settings));
if (!host->initialize())
- return 0;
+ return nullptr;
host->setRootLayer(root);
- return host;
+ return host.release();
}
WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings)
@@ -60,28 +60,28 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
{
}
-void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime)
+void WebLayerTreeViewImpl::willBeginFrame()
+{
+ m_client->willBeginFrame();
+}
+
+void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime)
{
- if (m_client)
- m_client->updateAnimations(frameBeginTime);
+ m_client->updateAnimations(monotonicFrameBeginTime);
}
void WebLayerTreeViewImpl::layout()
{
- if (m_client)
- m_client->layout();
+ m_client->layout();
}
void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale)
{
- if (m_client)
- m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
+ m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
}
PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext()
{
- if (!m_client)
- return 0;
OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
if (!webContext)
return 0;
@@ -91,26 +91,27 @@ PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext()
void WebLayerTreeViewImpl::didRecreateContext(bool success)
{
- if (m_client)
- m_client->didRebindGraphicsContext(success);
+ m_client->didRebindGraphicsContext(success);
+}
+
+void WebLayerTreeViewImpl::didCommit()
+{
+ m_client->didCommit();
}
void WebLayerTreeViewImpl::didCommitAndDrawFrame()
{
- if (m_client)
- m_client->didCommitAndDrawFrame();
+ m_client->didCommitAndDrawFrame();
}
void WebLayerTreeViewImpl::didCompleteSwapBuffers()
{
- if (m_client)
- m_client->didCompleteSwapBuffers();
+ m_client->didCompleteSwapBuffers();
}
void WebLayerTreeViewImpl::scheduleComposite()
{
- if (m_client)
- m_client->scheduleComposite();
+ m_client->scheduleComposite();
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
index b1b26d0fc..dcd3e2925 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
@@ -28,7 +28,7 @@
#include "platform/WebLayerTreeView.h"
#include "cc/CCLayerTreeHost.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/PassOwnPtr.h>
namespace WebKit {
class WebLayer;
@@ -36,21 +36,24 @@ class WebLayerTreeViewClient;
class WebLayerTreeViewImpl : public WebCore::CCLayerTreeHost, public WebCore::CCLayerTreeHostClient {
public:
- static PassRefPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&);
-
-private:
- WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&);
+ static PassOwnPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&);
virtual ~WebLayerTreeViewImpl();
- virtual void updateAnimations(double frameBeginTime);
- virtual void layout();
- virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale);
- virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
- virtual void didRecreateContext(bool success);
- virtual void didCommitAndDrawFrame();
- virtual void didCompleteSwapBuffers();
+
+ virtual void willBeginFrame() OVERRIDE;
+ virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE;
+ virtual void layout() OVERRIDE;
+ virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE;
+ virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE;
+ virtual void didRecreateContext(bool success) OVERRIDE;
+ virtual void didCommit() OVERRIDE;
+ virtual void didCommitAndDrawFrame() OVERRIDE;
+ virtual void didCompleteSwapBuffers() OVERRIDE;
// Only used in the single threaded path.
- virtual void scheduleComposite();
+ virtual void scheduleComposite() OVERRIDE;
+
+private:
+ WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&);
WebLayerTreeViewClient* m_client;
};
diff --git a/Source/WebKit/chromium/src/WebMediaElement.cpp b/Source/WebKit/chromium/src/WebMediaElement.cpp
deleted file mode 100644
index 4adda1ed9..000000000
--- a/Source/WebKit/chromium/src/WebMediaElement.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebMediaElement.h"
-
-#include "HTMLMediaElement.h"
-#include "MediaPlayer.h"
-#include "WebMediaPlayer.h"
-#include "WebMediaPlayerClientImpl.h"
-#include <wtf/PassRefPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebMediaPlayer* WebMediaElement::player() const
-{
- return WebMediaPlayerClientImpl::fromMediaElement(this)->mediaPlayer();
-}
-
-WebMediaElement::WebMediaElement(const PassRefPtr<HTMLMediaElement>& elem)
- : WebElement(elem)
-{
-}
-
-WebMediaElement& WebMediaElement::operator=(const PassRefPtr<HTMLMediaElement>& elem)
-{
- m_private = elem;
- return *this;
-}
-
-WebMediaElement::operator PassRefPtr<HTMLMediaElement>() const
-{
- return static_cast<HTMLMediaElement*>(m_private.get());
-}
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 74c4a7200..8ba03f04a 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -16,16 +16,14 @@
#include "KURL.h"
#include "MediaPlayer.h"
#include "NotImplemented.h"
+#include "PlatformContextSkia.h"
#include "RenderView.h"
#include "TimeRanges.h"
-#include "VideoFrameChromium.h"
-#include "VideoFrameChromiumImpl.h"
#include "VideoLayerChromium.h"
#include "WebAudioSourceProvider.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"
#include "WebKit.h"
-#include "WebMediaElement.h"
#include "WebMediaPlayer.h"
#include "WebViewImpl.h"
#include "cc/CCProxy.h"
@@ -42,11 +40,6 @@
#include "RenderLayerCompositor.h"
#endif
-// WebCommon.h defines WEBKIT_USING_SKIA so this has to be included last.
-#if WEBKIT_USING_SKIA
-#include "PlatformContextSkia.h"
-#endif
-
#include <wtf/Assertions.h>
#include <wtf/text/CString.h>
@@ -87,12 +80,6 @@ void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar)
}
}
-WebMediaPlayerClientImpl* WebMediaPlayerClientImpl::fromMediaElement(const WebMediaElement* element)
-{
- PlatformMedia pm = element->constUnwrap<HTMLMediaElement>()->platformMedia();
- return static_cast<WebMediaPlayerClientImpl*>(pm.media.chromiumMediaPlayer);
-}
-
WebMediaPlayer* WebMediaPlayerClientImpl::mediaPlayer() const
{
return m_webMediaPlayer.get();
@@ -122,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged()
ASSERT(m_mediaPlayer);
m_mediaPlayer->readyStateChanged();
#if USE(ACCELERATED_COMPOSITING)
- if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
- m_videoLayer = VideoLayerChromium::create(this);
- m_videoLayer->setOpaque(m_opaque);
+ if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
+ m_videoLayer = WebVideoLayer::create(this);
+ m_videoLayer.setOpaque(m_opaque);
}
#endif
}
@@ -151,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint()
{
ASSERT(m_mediaPlayer);
#if USE(ACCELERATED_COMPOSITING)
- if (m_videoLayer && supportsAcceleratedRendering())
- m_videoLayer->setNeedsDisplay();
+ if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
+ m_videoLayer.invalidate();
#endif
m_mediaPlayer->repaint();
}
@@ -179,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque)
{
#if USE(ACCELERATED_COMPOSITING)
m_opaque = opaque;
- if (m_videoLayer)
- m_videoLayer->setOpaque(m_opaque);
+ if (!m_videoLayer.isNull())
+ m_videoLayer.setOpaque(m_opaque);
#endif
}
@@ -228,6 +215,56 @@ WebKit::WebURL WebMediaPlayerClientImpl::sourceURL() const
#endif
}
+void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebString& sessionId)
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->keyAdded(keySystem, sessionId);
+#else
+ UNUSED_PARAM(keySystem);
+ UNUSED_PARAM(sessionId);
+#endif
+}
+
+void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebString& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode)
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->keyError(keySystem, sessionId, static_cast<MediaPlayerClient::MediaKeyErrorCode>(errorCode), systemCode);
+#else
+ UNUSED_PARAM(keySystem);
+ UNUSED_PARAM(sessionId);
+ UNUSED_PARAM(errorCode);
+ UNUSED_PARAM(systemCode);
+#endif
+}
+
+void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength)
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->keyMessage(keySystem, sessionId, message, messageLength);
+#else
+ UNUSED_PARAM(keySystem);
+ UNUSED_PARAM(sessionId);
+ UNUSED_PARAM(message);
+ UNUSED_PARAM(messageLength);
+#endif
+}
+
+void WebMediaPlayerClientImpl::keyNeeded(const WebString& keySystem, const WebString& sessionId, const unsigned char* initData, unsigned initDataLength)
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->keyNeeded(keySystem, sessionId, initData, initDataLength);
+#else
+ UNUSED_PARAM(keySystem);
+ UNUSED_PARAM(sessionId);
+ UNUSED_PARAM(initData);
+ UNUSED_PARAM(initDataLength);
+#endif
+}
+
void WebMediaPlayerClientImpl::disableAcceleratedCompositing()
{
m_supportsAcceleratedCompositing = false;
@@ -278,7 +315,7 @@ void WebMediaPlayerClientImpl::cancelLoad()
PlatformLayer* WebMediaPlayerClientImpl::platformLayer() const
{
ASSERT(m_supportsAcceleratedCompositing);
- return m_videoLayer.get();
+ return m_videoLayer.unwrap<VideoLayerChromium>();
}
#endif
@@ -302,7 +339,38 @@ void WebMediaPlayerClientImpl::pause()
m_webMediaPlayer->pause();
}
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+bool WebMediaPlayerClientImpl::enterFullscreen() const
+{
+ if (m_webMediaPlayer)
+ return m_webMediaPlayer->enterFullscreen();
+ return false;
+}
+
+void WebMediaPlayerClientImpl::exitFullscreen()
+{
+ if (m_webMediaPlayer)
+ m_webMediaPlayer->exitFullscreen();
+}
+#endif
+
#if ENABLE(MEDIA_SOURCE)
+WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type)
+{
+ if (!m_webMediaPlayer)
+ return WebCore::MediaPlayer::NotSupported;
+
+ return static_cast<WebCore::MediaPlayer::AddIdStatus>(m_webMediaPlayer->sourceAddId(id, type));
+}
+
+bool WebMediaPlayerClientImpl::sourceRemoveId(const String& id)
+{
+ if (!m_webMediaPlayer)
+ return false;
+
+ return m_webMediaPlayer->sourceRemoveId(id);
+}
+
bool WebMediaPlayerClientImpl::sourceAppend(const unsigned char* data, unsigned length)
{
if (m_webMediaPlayer)
@@ -317,6 +385,35 @@ void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStre
}
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::generateKeyRequest(const String& keySystem, const unsigned char* initData, unsigned initDataLength)
+{
+ if (!m_webMediaPlayer)
+ return MediaPlayer::InvalidPlayerState;
+
+ WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->generateKeyRequest(keySystem, initData, initDataLength);
+ return static_cast<MediaPlayer::MediaKeyException>(result);
+}
+
+MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::addKey(const String& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const String& sessionId)
+{
+ if (!m_webMediaPlayer)
+ return MediaPlayer::InvalidPlayerState;
+
+ WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->addKey(keySystem, key, keyLength, initData, initDataLength, sessionId);
+ return static_cast<MediaPlayer::MediaKeyException>(result);
+}
+
+MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::cancelKeyRequest(const String& keySystem, const String& sessionId)
+{
+ if (!m_webMediaPlayer)
+ return MediaPlayer::InvalidPlayerState;
+
+ WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->cancelKeyRequest(keySystem, sessionId);
+ return static_cast<MediaPlayer::MediaKeyException>(result);
+}
+#endif
+
void WebMediaPlayerClientImpl::prepareToPlay()
{
if (m_delayingLoad)
@@ -502,20 +599,9 @@ void WebMediaPlayerClientImpl::paintCurrentFrameInContext(GraphicsContext* conte
// Since we're accessing platformContext() directly we have to manually
// check.
if (m_webMediaPlayer && !context->paintingDisabled()) {
-#if WEBKIT_USING_SKIA
PlatformGraphicsContext* platformContext = context->platformContext();
WebCanvas* canvas = platformContext->canvas();
-
- canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha());
-
- m_webMediaPlayer->paint(canvas, rect);
-
- canvas->restore();
-#elif WEBKIT_USING_CG
- m_webMediaPlayer->paint(context->platformContext(), rect);
-#else
- notImplemented();
-#endif
+ m_webMediaPlayer->paint(canvas, rect, platformContext->getNormalizedAlpha());
}
}
@@ -595,40 +681,37 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
{
- return m_videoLayer && m_videoLayer->layerTreeHost();
+ return !m_videoLayer.isNull() && m_videoLayer.active();
}
-void WebMediaPlayerClientImpl::setVideoFrameProviderClient(VideoFrameProvider::Client* client)
+void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
{
MutexLocker locker(m_compositingMutex);
+ if (m_videoFrameProviderClient)
+ m_videoFrameProviderClient->stopUsingProvider();
m_videoFrameProviderClient = client;
if (m_webMediaPlayer)
m_webMediaPlayer->setStreamTextureClient(client ? this : 0);
}
-VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
+WebVideoFrame* WebMediaPlayerClientImpl::getCurrentFrame()
{
MutexLocker locker(m_compositingMutex);
ASSERT(!m_currentVideoFrame);
- if (m_webMediaPlayer) {
- WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame();
- if (webkitVideoFrame)
- m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame));
- }
- return m_currentVideoFrame.get();
+ if (m_webMediaPlayer)
+ m_currentVideoFrame = m_webMediaPlayer->getCurrentFrame();
+ return m_currentVideoFrame;
}
-void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
+void WebMediaPlayerClientImpl::putCurrentFrame(WebVideoFrame* videoFrame)
{
MutexLocker locker(m_compositingMutex);
ASSERT(videoFrame == m_currentVideoFrame);
if (!videoFrame)
return;
- if (m_webMediaPlayer) {
- m_webMediaPlayer->putCurrentFrame(
- VideoFrameChromiumImpl::toWebVideoFrame(videoFrame));
- }
- m_currentVideoFrame.clear();
+ if (m_webMediaPlayer)
+ m_webMediaPlayer->putCurrentFrame(videoFrame);
+ m_currentVideoFrame = 0;
}
#endif
@@ -658,10 +741,18 @@ void WebMediaPlayerClientImpl::getSupportedTypes(HashSet<String>& supportedTypes
notImplemented();
}
+#if ENABLE(ENCRYPTED_MEDIA)
+MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type,
+ const String& codecs,
+ const String& keySystem)
+{
+#else
MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type,
const String& codecs)
{
- WebMimeRegistry::SupportsType supportsType = webKitPlatformSupport()->mimeRegistry()->supportsMediaMIMEType(type, codecs);
+ String keySystem;
+#endif
+ WebMimeRegistry::SupportsType supportsType = WebKit::Platform::current()->mimeRegistry()->supportsMediaMIMEType(type, codecs, keySystem);
switch (supportsType) {
default:
@@ -702,10 +793,10 @@ void WebMediaPlayerClientImpl::didUpdateMatrix(const float* matrix)
WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
: m_mediaPlayer(0)
+ , m_currentVideoFrame(0)
, m_delayingLoad(false)
, m_preload(MediaPlayer::MetaData)
#if USE(ACCELERATED_COMPOSITING)
- , m_videoLayer(0)
, m_supportsAcceleratedCompositing(false)
, m_opaque(false)
, m_videoFrameProviderClient(0)
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
index d85e0d1fc..3afb1f5e5 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -35,12 +35,11 @@
#include "AudioSourceProvider.h"
#include "MediaPlayerPrivate.h"
-#include "VideoFrameChromium.h"
-#include "VideoFrameProvider.h"
-#include "VideoLayerChromium.h"
#include "WebAudioSourceProviderClient.h"
#include "WebMediaPlayerClient.h"
#include "WebStreamTextureClient.h"
+#include <public/WebVideoFrameProvider.h>
+#include <public/WebVideoLayer.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -49,14 +48,13 @@ namespace WebCore { class AudioSourceProviderClient; }
namespace WebKit {
class WebAudioSourceProvider;
-class WebMediaElement;
class WebMediaPlayer;
// This class serves as a bridge between WebCore::MediaPlayer and
// WebKit::WebMediaPlayer.
class WebMediaPlayerClientImpl : public WebCore::MediaPlayerPrivateInterface
#if USE(ACCELERATED_COMPOSITING)
- , public WebCore::VideoFrameProvider
+ , public WebVideoFrameProvider
#endif
, public WebMediaPlayerClient
, public WebStreamTextureClient {
@@ -66,8 +64,6 @@ public:
static void setIsEnabled(bool);
static void registerSelf(WebCore::MediaEngineRegistrar);
- static WebMediaPlayerClientImpl* fromMediaElement(const WebMediaElement* element);
-
// Returns the encapsulated WebKit::WebMediaPlayer.
WebMediaPlayer* mediaPlayer() const;
@@ -89,6 +85,10 @@ public:
virtual WebMediaPlayer::Preload preload() const;
virtual void sourceOpened();
virtual WebKit::WebURL sourceURL() const;
+ virtual void keyAdded(const WebString& keySystem, const WebString& sessionId);
+ 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 void disableAcceleratedCompositing();
// MediaPlayerPrivateInterface methods:
@@ -134,6 +134,10 @@ public:
virtual unsigned droppedFrameCount() const;
virtual unsigned audioDecodedByteCount() const;
virtual unsigned videoDecodedByteCount() const;
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+ virtual bool enterFullscreen() const;
+ virtual void exitFullscreen();
+#endif
#if ENABLE(WEB_AUDIO)
virtual WebCore::AudioSourceProvider* audioSourceProvider();
@@ -142,30 +146,44 @@ public:
#if USE(ACCELERATED_COMPOSITING)
virtual bool supportsAcceleratedRendering() const;
- // VideoFrameProvider methods:
- virtual void setVideoFrameProviderClient(VideoFrameProvider::Client*);
- virtual WebCore::VideoFrameChromium* getCurrentFrame();
- virtual void putCurrentFrame(WebCore::VideoFrameChromium*);
+ // WebVideoFrameProvider methods:
+ virtual void setVideoFrameProviderClient(WebVideoFrameProvider::Client*);
+ virtual WebVideoFrame* getCurrentFrame();
+ virtual void putCurrentFrame(WebVideoFrame*);
#endif
#if ENABLE(MEDIA_SOURCE)
+ virtual WebCore::MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type);
+ virtual bool sourceRemoveId(const String&);
virtual bool sourceAppend(const unsigned char* data, unsigned length);
virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus);
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+ virtual WebCore::MediaPlayer::MediaKeyException generateKeyRequest(const String& keySystem, const unsigned char* initData, unsigned initDataLength) OVERRIDE;
+ virtual WebCore::MediaPlayer::MediaKeyException addKey(const String& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const String& sessionId) OVERRIDE;
+ virtual WebCore::MediaPlayer::MediaKeyException cancelKeyRequest(const String& keySystem, const String& sessionId) OVERRIDE;
+#endif
+
// WebStreamTextureClient methods:
virtual void didReceiveFrame();
virtual void didUpdateMatrix(const float*);
-private:
+protected:
WebMediaPlayerClientImpl();
+private:
void startDelayedLoad();
void loadInternal();
static PassOwnPtr<WebCore::MediaPlayerPrivateInterface> create(WebCore::MediaPlayer*);
static void getSupportedTypes(WTF::HashSet<WTF::String>&);
+#if ENABLE(ENCRYPTED_MEDIA)
+ static WebCore::MediaPlayer::SupportsType supportsType(
+ const WTF::String& type, const WTF::String& codecs, const String& keySystem);
+#else
static WebCore::MediaPlayer::SupportsType supportsType(
const WTF::String& type, const WTF::String& codecs);
+#endif
#if USE(ACCELERATED_COMPOSITING)
bool acceleratedRenderingInUse();
#endif
@@ -173,15 +191,15 @@ private:
Mutex m_compositingMutex; // Guards m_currentVideoFrame and m_videoFrameProviderClient.
WebCore::MediaPlayer* m_mediaPlayer;
OwnPtr<WebMediaPlayer> m_webMediaPlayer;
- OwnPtr<WebCore::VideoFrameChromium> m_currentVideoFrame;
+ WebVideoFrame* m_currentVideoFrame;
String m_url;
bool m_delayingLoad;
WebCore::MediaPlayer::Preload m_preload;
#if USE(ACCELERATED_COMPOSITING)
- RefPtr<WebCore::VideoLayerChromium> m_videoLayer;
+ WebVideoLayer m_videoLayer;
bool m_supportsAcceleratedCompositing;
bool m_opaque;
- VideoFrameProvider::Client* m_videoFrameProviderClient;
+ WebVideoFrameProvider::Client* m_videoFrameProviderClient;
#endif
static bool m_isEnabled;
diff --git a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp
deleted file mode 100644
index 9faa4fd85..000000000
--- a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp
+++ /dev/null
@@ -1,153 +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:
- *
- * * 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(MEDIA_STREAM)
-
-#include "platform/WebMediaStreamDescriptor.h"
-
-#include "MediaStreamComponent.h"
-#include "MediaStreamDescriptor.h"
-#include "MediaStreamSource.h"
-#include "platform/WebMediaStreamComponent.h"
-#include "platform/WebMediaStreamSource.h"
-#include "platform/WebString.h"
-#include <wtf/Vector.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebMediaStreamDescriptor::WebMediaStreamDescriptor(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor)
- : m_private(mediaStreamDescriptor)
-{
-}
-
-WebMediaStreamDescriptor::WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor* mediaStreamDescriptor)
- : m_private(mediaStreamDescriptor)
-{
-}
-
-void WebMediaStreamDescriptor::reset()
-{
- m_private.reset();
-}
-
-WebString WebMediaStreamDescriptor::label() const
-{
- return m_private->label();
-}
-
-// FIXME: Cleanup when the chromium code has switched to the split sources implementation.
-void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSources) const
-{
- size_t numberOfAudioSources = m_private->numberOfAudioComponents();
- size_t numberOfVideoSources = m_private->numberOfVideoComponents();
- WebVector<WebMediaStreamSource> result(numberOfAudioSources + numberOfVideoSources);
- size_t i = 0;
- for (size_t j = 0; j < numberOfAudioSources; ++i, ++j)
- result[i] = m_private->audioComponent(j)->source();
- for (size_t j = 0; j < numberOfVideoSources; ++i, ++j)
- result[i] = m_private->videoComponent(j)->source();
- webSources.swap(result);
-}
-
-void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamComponent>& webSources) const
-{
- size_t numberOfSources = m_private->numberOfAudioComponents();
- WebVector<WebMediaStreamComponent> result(numberOfSources);
- for (size_t i = 0; i < numberOfSources; ++i)
- result[i] = m_private->audioComponent(i);
- webSources.swap(result);
-}
-
-void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamComponent>& webSources) const
-{
- size_t numberOfSources = m_private->numberOfVideoComponents();
- WebVector<WebMediaStreamComponent> result(numberOfSources);
- for (size_t i = 0; i < numberOfSources; ++i)
- result[i] = m_private->videoComponent(i);
- webSources.swap(result);
-}
-
-WebMediaStreamDescriptor& WebMediaStreamDescriptor::operator=(const PassRefPtr<WebCore::MediaStreamDescriptor>& mediaStreamDescriptor)
-{
- m_private = mediaStreamDescriptor;
- return *this;
-}
-
-WebMediaStreamDescriptor::operator PassRefPtr<WebCore::MediaStreamDescriptor>() const
-{
- return m_private.get();
-}
-
-WebMediaStreamDescriptor::operator WebCore::MediaStreamDescriptor*() const
-{
- return m_private.get();
-}
-
-// FIXME: Cleanup when the chromium code has switched to the split sources implementation.
-void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& sources)
-{
- MediaStreamSourceVector audio, video;
- for (size_t i = 0; i < sources.size(); ++i) {
- MediaStreamSource* curr = sources[i];
- if (curr->type() == MediaStreamSource::TypeAudio)
- audio.append(curr);
- else if (curr->type() == MediaStreamSource::TypeVideo)
- video.append(curr);
- }
- m_private = MediaStreamDescriptor::create(label, audio, video);
-}
-
-void WebMediaStreamDescriptor::initialize(const WebString& label, const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources)
-{
- MediaStreamSourceVector audio, video;
- for (size_t i = 0; i < audioSources.size(); ++i) {
- MediaStreamSource* curr = audioSources[i];
- audio.append(curr);
- }
- for (size_t i = 0; i < videoSources.size(); ++i) {
- MediaStreamSource* curr = videoSources[i];
- video.append(curr);
- }
- m_private = MediaStreamDescriptor::create(label, audio, video);
-}
-
-void WebMediaStreamDescriptor::assign(const WebMediaStreamDescriptor& other)
-{
- m_private = other.m_private;
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(MEDIA_STREAM)
-
diff --git a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp b/Source/WebKit/chromium/src/WebMediaStreamSource.cpp
deleted file mode 100644
index a9fac4b06..000000000
--- a/Source/WebKit/chromium/src/WebMediaStreamSource.cpp
+++ /dev/null
@@ -1,102 +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:
- *
- * * 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(MEDIA_STREAM)
-
-#include "platform/WebMediaStreamSource.h"
-
-#include "MediaStreamSource.h"
-#include "platform/WebString.h"
-#include <wtf/Vector.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebMediaStreamSource::WebMediaStreamSource(const PassRefPtr<MediaStreamSource>& mediaStreamSource)
- : m_private(mediaStreamSource)
-{
-}
-
-WebMediaStreamSource& WebMediaStreamSource::operator=(WebCore::MediaStreamSource* mediaStreamSource)
-{
- m_private = mediaStreamSource;
- return *this;
-}
-
-void WebMediaStreamSource::assign(const WebMediaStreamSource& other)
-{
- m_private = other.m_private;
-}
-
-void WebMediaStreamSource::reset()
-{
- m_private.reset();
-}
-
-WebMediaStreamSource::operator PassRefPtr<MediaStreamSource>() const
-{
- return m_private.get();
-}
-
-WebMediaStreamSource::operator MediaStreamSource*() const
-{
- return m_private.get();
-}
-
-void WebMediaStreamSource::initialize(const WebString& id, Type type, const WebString& name)
-{
- m_private = MediaStreamSource::create(id, static_cast<MediaStreamSource::Type>(type), name);
-}
-
-WebString WebMediaStreamSource::id() const
-{
- ASSERT(!m_private.isNull());
- return m_private.get()->id();
-}
-
-WebMediaStreamSource::Type WebMediaStreamSource::type() const
-{
- ASSERT(!m_private.isNull());
- return static_cast<Type>(m_private.get()->type());
-}
-
-WebString WebMediaStreamSource::name() const
-{
- ASSERT(!m_private.isNull());
- return m_private.get()->name();
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(MEDIA_STREAM)
-
diff --git a/Source/WebKit/chromium/src/WebNamedNodeMap.cpp b/Source/WebKit/chromium/src/WebNamedNodeMap.cpp
deleted file mode 100644
index ba5f29625..000000000
--- a/Source/WebKit/chromium/src/WebNamedNodeMap.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebNamedNodeMap.h"
-
-#include "Element.h"
-#include "NamedNodeMap.h"
-#include "Node.h"
-#include "WebAttribute.h"
-#include "WebNode.h"
-#include <wtf/PassRefPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebNamedNodeMap::reset()
-{
- m_private.reset();
-}
-
-void WebNamedNodeMap::assign(const WebNamedNodeMap& other)
-{
- m_private = other.m_private;
-}
-
-WebNamedNodeMap::WebNamedNodeMap(const PassRefPtr<NamedNodeMap>& other)
- : m_private(other)
-{
-}
-
-unsigned WebNamedNodeMap::length() const
-{
- return m_private->length();
-}
-
-WebAttribute WebNamedNodeMap::attributeItem(unsigned index) const
-{
- return WebAttribute(m_private->element()->attributeItem(index));
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebNotification.cpp b/Source/WebKit/chromium/src/WebNotification.cpp
index 849dc4f67..f6e981d3c 100644
--- a/Source/WebKit/chromium/src/WebNotification.cpp
+++ b/Source/WebKit/chromium/src/WebNotification.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "WebNotification.h"
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
#include "Event.h"
#include "Notification.h"
@@ -88,13 +88,13 @@ WebURL WebNotification::iconURL() const
WebString WebNotification::title() const
{
ASSERT(!isHTML());
- return m_private->contents().title;
+ return m_private->title();
}
WebString WebNotification::body() const
{
ASSERT(!isHTML());
- return m_private->contents().body;
+ return m_private->body();
}
WebTextDirection WebNotification::direction() const
@@ -106,7 +106,7 @@ WebTextDirection WebNotification::direction() const
WebString WebNotification::replaceId() const
{
- return m_private->replaceId();
+ return m_private->tag();
}
void WebNotification::detachPresenter()
@@ -116,7 +116,10 @@ void WebNotification::detachPresenter()
void WebNotification::dispatchDisplayEvent()
{
+#if ENABLE(LEGACY_NOTIFICATIONS)
dispatchEvent("display");
+#endif
+ dispatchEvent("show");
}
void WebNotification::dispatchErrorEvent(const WebKit::WebString& /* errorMessage */)
@@ -174,4 +177,4 @@ void WebNotification::assign(WebNotificationPrivate* p)
} // namespace WebKit
-#endif // ENABLE(NOTIFICATIONS)
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
index bc810c7b1..1ad417bad 100644
--- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,21 +29,299 @@
*/
#include "config.h"
+#include "WebPagePopupImpl.h"
+#include "Chrome.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"
+#include "WebWidgetClient.h"
+
+using namespace WebCore;
+using namespace std;
namespace WebKit {
+#if ENABLE(PAGE_POPUP)
+
+class PagePopupChromeClient : public EmptyChromeClient {
+ WTF_MAKE_NONCOPYABLE(PagePopupChromeClient);
+ WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ explicit PagePopupChromeClient(WebPagePopupImpl* popup)
+ : m_popup(popup)
+ {
+ ASSERT(m_popup->widgetClient());
+ }
+
+private:
+ virtual void closeWindowSoon() OVERRIDE
+ {
+ m_popup->closePopup();
+ }
+
+ virtual FloatRect windowRect() OVERRIDE
+ {
+ return FloatRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectInScreen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.height);
+ }
+
+ virtual void setWindowRect(const FloatRect& rect) OVERRIDE
+ {
+ IntRect intRect(rect);
+ const WebRect currentRect = m_popup->m_windowRectInScreen;
+ if (intRect.x() == currentRect.x && intRect.y() == currentRect.y && m_popup->m_isPutAboveOrigin)
+ intRect.setY(currentRect.y + currentRect.height - intRect.height());
+ m_popup->m_windowRectInScreen = intRect;
+ m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen);
+ }
+
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String&) OVERRIDE
+ {
+#ifndef NDEBUG
+ fprintf(stderr, "CONSOLE MESSSAGE:%u: %s\n", lineNumber, message.utf8().data());
+#else
+ UNUSED_PARAM(message);
+ UNUSED_PARAM(lineNumber);
+#endif
+ }
+
+ virtual void invalidateContentsAndRootView(const IntRect& paintRect, bool) OVERRIDE
+ {
+ if (paintRect.isEmpty())
+ return;
+ m_popup->widgetClient()->didInvalidateRect(paintRect);
+ }
+
+ virtual void scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect) OVERRIDE
+ {
+ m_popup->widgetClient()->didScrollRect(scrollDelta.width(), scrollDelta.height(), intersection(scrollRect, clipRect));
+ }
+
+ virtual void invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) OVERRIDE
+ {
+ invalidateContentsAndRootView(updateRect, immediate);
+ }
+
+ virtual void scheduleAnimation() OVERRIDE
+ {
+ m_popup->widgetClient()->scheduleAnimation();
+ }
+
+ virtual void* webView() const OVERRIDE
+ {
+ return m_popup->m_webView;
+ }
+
+ WebPagePopupImpl* m_popup;
+};
+
// WebPagePopupImpl ----------------------------------------------------------------
-// FIXME: WebPagePopupImpl implementation will be written here.
+WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client)
+ : m_widgetClient(client)
+ , m_isPutAboveOrigin(false)
+{
+ ASSERT(client);
+}
+
+WebPagePopupImpl::~WebPagePopupImpl()
+{
+ ASSERT(!m_page);
+}
+
+bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, const IntRect& originBoundsInRootView)
+{
+ ASSERT(webView);
+ ASSERT(popupClient);
+ m_webView = webView;
+ m_popupClient = popupClient;
+
+ WebSize rootViewSize = webView->size();
+ IntSize popupSize = popupClient->contentSize();
+ IntRect popupBoundsInRootView(IntPoint(max(0, originBoundsInRootView.x()), max(0, originBoundsInRootView.maxY())), popupSize);
+ if (popupBoundsInRootView.maxY() > rootViewSize.height) {
+ popupBoundsInRootView.setY(max(0, originBoundsInRootView.y() - popupSize.height()));
+ m_isPutAboveOrigin = true;
+ }
+ if (popupBoundsInRootView.maxX() > rootViewSize.width)
+ popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width()));
+ IntRect boundsInScreen = webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView);
+
+ m_widgetClient->setWindowRect(boundsInScreen);
+ m_windowRectInScreen = boundsInScreen;
+ if (!initPage())
+ return false;
+ m_widgetClient->show(WebNavigationPolicy());
+
+ setFocus(true);
+
+ return true;
+}
+
+bool WebPagePopupImpl::initPage()
+{
+ Page::PageClients pageClients;
+ fillWithEmptyClients(pageClients);
+ m_chromeClient = adoptPtr(new PagePopupChromeClient(this));
+ pageClients.chromeClient = m_chromeClient.get();
+
+ m_page = adoptPtr(new Page(pageClients));
+ m_page->settings()->setScriptEnabled(true);
+ m_page->settings()->setAllowScriptsToCloseWindows(true);
+
+ static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient;
+ RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient);
+ frame->setView(FrameView::create(frame.get()));
+ frame->init();
+ frame->view()->resize(m_popupClient->contentSize());
+ frame->view()->setTransparent(false);
+
+ DocumentWriter* writer = frame->loader()->activeDocumentLoader()->writer();
+ writer->setMIMEType("text/html");
+ writer->setEncoding("UTF-8", false);
+ writer->begin();
+ m_popupClient->writeDocument(*writer);
+ writer->end();
+
+ frame->script()->installFunctionsForPagePopup(frame.get(), m_popupClient);
+ return true;
+}
+
+WebSize WebPagePopupImpl::size()
+{
+ return m_popupClient->contentSize();
+}
+
+void WebPagePopupImpl::animate(double)
+{
+ PageWidgetDelegate::animate(m_page.get(), monotonicallyIncreasingTime());
+}
+
+void WebPagePopupImpl::setCompositorSurfaceReady()
+{
+}
+
+void WebPagePopupImpl::composite(bool)
+{
+}
+
+void WebPagePopupImpl::layout()
+{
+ PageWidgetDelegate::layout(m_page.get());
+}
+
+void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect)
+{
+ PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect);
+}
+
+void WebPagePopupImpl::resize(const WebSize& newSize)
+{
+ if (m_page)
+ m_page->mainFrame()->view()->resize(newSize);
+ m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.height));
+}
+
+bool WebPagePopupImpl::handleKeyEvent(const WebKeyboardEvent&)
+{
+ // The main WebView receives key events and forward them to this via handleKeyEvent().
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+bool WebPagePopupImpl::handleCharEvent(const WebKeyboardEvent&)
+{
+ // The main WebView receives key events and forward them to this via handleKeyEvent().
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+#if ENABLE(GESTURE_EVENTS)
+bool WebPagePopupImpl::handleGestureEvent(const WebGestureEvent& event)
+{
+ if (!m_page || !m_page->mainFrame() || !m_page->mainFrame()->view())
+ return false;
+ Frame& frame = *m_page->mainFrame();
+ return frame.eventHandler()->handleGestureEvent(PlatformGestureEventBuilder(frame.view(), event));
+}
+#endif
+
+bool WebPagePopupImpl::handleInputEvent(const WebInputEvent& event)
+{
+ return PageWidgetDelegate::handleInputEvent(m_page.get(), *this, event);
+}
+
+bool WebPagePopupImpl::handleKeyEvent(const PlatformKeyboardEvent& event)
+{
+ if (!m_page->mainFrame() || !m_page->mainFrame()->view())
+ return false;
+ return m_page->mainFrame()->eventHandler()->keyEvent(event);
+}
+
+void WebPagePopupImpl::setFocus(bool enable)
+{
+ if (!m_page)
+ return;
+ m_page->focusController()->setFocused(enable);
+ if (enable)
+ m_page->focusController()->setActive(true);
+}
+
+void WebPagePopupImpl::close()
+{
+ m_page.clear();
+ m_widgetClient = 0;
+ deref();
+}
+
+void WebPagePopupImpl::closePopup()
+{
+ 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();
+ }
+
+ m_popupClient->didClosePopup();
+}
+
+#endif // ENABLE(PAGE_POPUP)
// WebPagePopup ----------------------------------------------------------------
-WebPagePopup* WebPagePopup::create(WebWidgetClient*)
+WebPagePopup* WebPagePopup::create(WebWidgetClient* client)
{
- // FIXME: Returns a WebPagePopupImpl object.
+#if ENABLE(PAGE_POPUP)
+ if (!client)
+ CRASH();
+ // A WebPagePopupImpl 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
+ // WebPagePopupImpl 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 WebPagePopupImpl(client)).leakRef();
+#else
+ UNUSED_PARAM(client);
return 0;
+#endif
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h
new file mode 100644
index 000000000..2e1c8c3f3
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h
@@ -0,0 +1,104 @@
+/*
+ * 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 WebPagePopupImpl_h
+#define WebPagePopupImpl_h
+
+#if ENABLE(PAGE_POPUP)
+
+#include "PagePopup.h"
+#include "PageWidgetDelegate.h"
+#include "WebPagePopup.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+class Page;
+class PagePopupClient;
+class PlatformKeyboardEvent;
+}
+
+namespace WebKit {
+
+class PagePopupChromeClient;
+class WebViewImpl;
+
+class WebPagePopupImpl : public WebPagePopup,
+ public PageWidgetEventHandler,
+ public WebCore::PagePopup,
+ public RefCounted<WebPagePopupImpl> {
+ WTF_MAKE_NONCOPYABLE(WebPagePopupImpl);
+ WTF_MAKE_FAST_ALLOCATED;
+
+public:
+ virtual ~WebPagePopupImpl();
+ bool init(WebViewImpl*, WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView);
+ bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&);
+ void closePopup();
+ WebWidgetClient* widgetClient() const { return m_widgetClient; }
+
+private:
+ // WebWidget functions
+ virtual WebSize size() OVERRIDE;
+ virtual void animate(double) OVERRIDE;
+ virtual void setCompositorSurfaceReady() OVERRIDE;
+ virtual void composite(bool) OVERRIDE;
+ virtual void layout() OVERRIDE;
+ virtual void paint(WebCanvas*, const WebRect&) OVERRIDE;
+ virtual void resize(const WebSize&) OVERRIDE;
+ virtual void close() OVERRIDE;
+ virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE;
+ virtual void setFocus(bool) OVERRIDE;
+
+ // PageWidgetEventHandler functions
+ virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE;
+ virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE;
+#if ENABLE(GESTURE_EVENTS)
+ virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE;
+#endif
+
+ explicit WebPagePopupImpl(WebWidgetClient*);
+ bool initPage();
+
+ WebWidgetClient* m_widgetClient;
+ WebRect m_windowRectInScreen;
+ WebViewImpl* m_webView;
+ OwnPtr<WebCore::Page> m_page;
+ OwnPtr<PagePopupChromeClient> m_chromeClient;
+ WebCore::PagePopupClient* m_popupClient;
+ bool m_isPutAboveOrigin;
+
+ friend class WebPagePopup;
+ friend class PagePopupChromeClient;
+};
+
+} // namespace WebKit
+#endif // ENABLE(PAGE_POPUP)
+#endif // WebPagePopupImpl_h
diff --git a/Source/WebKit/chromium/src/WebPageSerializer.cpp b/Source/WebKit/chromium/src/WebPageSerializer.cpp
index 1ad70b1b4..6adac2d6b 100644
--- a/Source/WebKit/chromium/src/WebPageSerializer.cpp
+++ b/Source/WebKit/chromium/src/WebPageSerializer.cpp
@@ -41,19 +41,18 @@
#include "KURL.h"
#include "MHTMLArchive.h"
#include "PageSerializer.h"
-#include "Vector.h"
-
#include "platform/WebCString.h"
+#include "platform/WebString.h"
+#include "platform/WebURL.h"
+#include "platform/WebVector.h"
#include "WebFrame.h"
#include "WebFrameImpl.h"
#include "WebPageSerializerClient.h"
#include "WebPageSerializerImpl.h"
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
-#include "platform/WebVector.h"
#include "WebView.h"
#include "WebViewImpl.h"
+#include <wtf/Vector.h>
#include <wtf/text/StringConcatenate.h>
using namespace WebCore;
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
index a71703b15..a4a585b96 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
@@ -33,7 +33,6 @@
#include "Chrome.h"
#include "ChromeClientImpl.h"
-#include "PluginLayerChromium.h"
#include "ScrollbarGroup.h"
#include "platform/WebClipboard.h"
#include "WebCursorInfo.h"
@@ -328,23 +327,31 @@ void WebPluginContainerImpl::reportGeometry()
m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
- if (m_scrollbarGroup)
+ if (m_scrollbarGroup) {
m_scrollbarGroup->scrollAnimator()->contentsResized();
+ m_scrollbarGroup->setFrameRect(frameRect());
+ }
}
-void WebPluginContainerImpl::setBackingTextureId(unsigned id)
+void WebPluginContainerImpl::setBackingTextureId(unsigned textureId)
{
#if USE(ACCELERATED_COMPOSITING)
- unsigned currId = m_platformLayer->textureId();
- if (currId == id)
+ if (m_textureId == textureId)
return;
- m_platformLayer->setTextureId(id);
+ ASSERT(m_ioSurfaceLayer.isNull());
+
+ if (m_textureLayer.isNull())
+ m_textureLayer = WebExternalTextureLayer::create();
+ m_textureLayer.setTextureId(textureId);
+
// If anyone of the IDs is zero we need to switch between hardware
// and software compositing. This is done by triggering a style recalc
// on the container element.
- if (!(currId * id))
+ if (!m_textureId || !textureId)
m_element->setNeedsStyleRecalc(WebCore::SyntheticStyleChange);
+
+ m_textureId = textureId;
#endif
}
@@ -352,26 +359,34 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
int height,
uint32_t ioSurfaceId)
{
-#if OS(DARWIN) && USE(ACCELERATED_COMPOSITING)
- uint32_t currentId = m_platformLayer->getIOSurfaceId();
- if (ioSurfaceId == currentId)
+#if USE(ACCELERATED_COMPOSITING)
+ if (ioSurfaceId == m_ioSurfaceId)
return;
- m_platformLayer->setIOSurfaceProperties(width, height, ioSurfaceId);
+ ASSERT(m_textureLayer.isNull());
+
+ if (m_ioSurfaceLayer.isNull())
+ m_ioSurfaceLayer = WebIOSurfaceLayer::create();
+ m_ioSurfaceLayer.setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
// If anyone of the IDs is zero we need to switch between hardware
// and software compositing. This is done by triggering a style recalc
// on the container element.
- if (!(ioSurfaceId * currentId))
+ if (!ioSurfaceId || !m_ioSurfaceId)
m_element->setNeedsStyleRecalc(WebCore::SyntheticStyleChange);
+
+ m_ioSurfaceId = ioSurfaceId;
#endif
}
void WebPluginContainerImpl::commitBackingTexture()
{
#if USE(ACCELERATED_COMPOSITING)
- if (m_platformLayer)
- m_platformLayer->setNeedsDisplay();
+ if (!m_textureLayer.isNull())
+ m_textureLayer.invalidate();
+
+ if (!m_ioSurfaceLayer.isNull())
+ m_ioSurfaceLayer.invalidate();
#endif
}
@@ -438,8 +453,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
void WebPluginContainerImpl::setOpaque(bool opaque)
{
#if USE(ACCELERATED_COMPOSITING)
- if (m_platformLayer)
- m_platformLayer->setOpaque(opaque);
+ if (!m_textureLayer.isNull())
+ m_textureLayer.setOpaque(opaque);
+
+ if (!m_ioSurfaceLayer.isNull())
+ m_ioSurfaceLayer.setOpaque(opaque);
#endif
}
@@ -451,10 +469,10 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect)
// hitTestResultAtPoint() takes a padding rectangle.
// FIXME: We'll be off by 1 when the width or height is even.
- IntRect windowRect = convertToContainingWindow(static_cast<IntRect>(rect));
- LayoutPoint center = windowRect.center();
+ IntRect documentRect(x() + rect.x, y() + rect.y, rect.width, rect.height);
+ LayoutPoint center = documentRect.center();
// Make the rect we're checking (the point surrounded by padding rects) contained inside the requested rect. (Note that -1/2 is 0.)
- LayoutSize padding((windowRect.width() - 1) / 2, (windowRect.height() - 1) / 2);
+ LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2);
HitTestResult result =
page->mainFrame()->eventHandler()->hitTestResultAtPoint(center, false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active, padding);
const HitTestResult::NodeSet& nodes = result.rectBasedTestResult();
@@ -514,15 +532,18 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
#if USE(ACCELERATED_COMPOSITING)
WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const
{
- return (m_platformLayer->textureId() || m_platformLayer->getIOSurfaceId()) ? m_platformLayer.get() : 0;
+ if (m_textureId)
+ return m_textureLayer.unwrap<LayerChromium>();
+ if (m_ioSurfaceId)
+ return m_ioSurfaceLayer.unwrap<LayerChromium>();
+ return 0;
}
#endif
-
ScrollbarGroup* WebPluginContainerImpl::scrollbarGroup()
{
if (!m_scrollbarGroup)
- m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view()));
+ m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view(), frameRect()));
return m_scrollbarGroup.get();
}
@@ -555,7 +576,8 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme
, m_element(element)
, m_webPlugin(webPlugin)
#if USE(ACCELERATED_COMPOSITING)
- , m_platformLayer(PluginLayerChromium::create())
+ , m_textureId(0)
+ , m_ioSurfaceId(0)
#endif
{
}
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
index 9d970f2f8..04878455c 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
@@ -35,6 +35,8 @@
#include "WebPluginContainer.h"
#include "Widget.h"
+#include <public/WebExternalTextureLayer.h>
+#include <public/WebIOSurfaceLayer.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -48,7 +50,6 @@ class IntRect;
class KeyboardEvent;
class LayerChromium;
class MouseEvent;
-class PluginLayerChromium;
class ResourceError;
class ResourceResponse;
class WheelEvent;
@@ -173,7 +174,13 @@ private:
Vector<WebPluginLoadObserver*> m_pluginLoadObservers;
#if USE(ACCELERATED_COMPOSITING)
- RefPtr<WebCore::PluginLayerChromium> m_platformLayer;
+ // A composited plugin will either have no composited layer, a texture layer, or an IOSurface layer.
+ // It will never have both a texture and IOSurface output.
+ unsigned m_textureId;
+ WebExternalTextureLayer m_textureLayer;
+
+ unsigned m_ioSurfaceId;
+ WebIOSurfaceLayer m_ioSurfaceLayer;
#endif
// The associated scrollbar group object, created lazily. Used for Pepper
diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
index 3f328f55b..1f0b7668a 100644
--- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
@@ -207,6 +207,11 @@ void WebPopupMenuImpl::themeChanged()
notImplemented();
}
+void WebPopupMenuImpl::setCompositorSurfaceReady()
+{
+ notImplemented();
+}
+
void WebPopupMenuImpl::composite(bool)
{
notImplemented();
@@ -269,18 +274,16 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent)
case WebInputEvent::GestureTap:
case WebInputEvent::GestureTapDown:
case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GestureLongPress:
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate:
return handleGestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent));
case WebInputEvent::Undefined:
case WebInputEvent::MouseEnter:
case WebInputEvent::ContextMenu:
return false;
-
- case WebInputEvent::GesturePinchBegin:
- case WebInputEvent::GesturePinchEnd:
- case WebInputEvent::GesturePinchUpdate:
- // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll.
- return false;
}
return false;
}
diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h
index a3fddb6d0..c22a0bbec 100644
--- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h
+++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h
@@ -75,6 +75,7 @@ public:
virtual void layout() OVERRIDE;
virtual void paint(WebCanvas*, const WebRect&) OVERRIDE;
virtual void themeChanged() OVERRIDE;
+ virtual void setCompositorSurfaceReady() OVERRIDE;
virtual void composite(bool finish) OVERRIDE;
virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE;
virtual void mouseCaptureLost() OVERRIDE;
diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp
index 05a421251..be24dd793 100644
--- a/Source/WebKit/chromium/src/WebRange.cpp
+++ b/Source/WebKit/chromium/src/WebRange.cpp
@@ -33,10 +33,12 @@
#include "Document.h"
#include "Frame.h"
+#include "FrameView.h"
#include "Range.h"
#include "TextIterator.h"
#include "WebFrameImpl.h"
#include "WebNode.h"
+#include "platform/WebFloatQuad.h"
#include "platform/WebString.h"
#include <wtf/PassRefPtr.h>
@@ -99,6 +101,27 @@ WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length)
return TextIterator::rangeFromLocationAndLength(scope, start, length);
}
+WebVector<WebFloatQuad> WebRange::textQuads() const
+{
+ if (isNull())
+ return WebVector<WebFloatQuad>();
+
+ Frame* frame = m_private->ownerDocument() ? m_private->ownerDocument()->frame() : 0;
+ if (!frame)
+ return WebVector<WebFloatQuad>();
+
+ Vector<FloatQuad> quads;
+ m_private->textQuads(quads);
+ for (unsigned i = 0; i < quads.size(); ++i) {
+ quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p1())));
+ quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p2())));
+ quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p3())));
+ quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p4())));
+ }
+
+ return quads;
+}
+
WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range)
: m_private(static_cast<WebRangePrivate*>(range.leakRef()))
{
diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
index d297a828c..f6478e4ba 100644
--- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
+++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
@@ -116,14 +116,14 @@ bool WebRuntimeFeatures::isSocketsEnabled()
void WebRuntimeFeatures::enableNotifications(bool enable)
{
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
RuntimeEnabledFeatures::setWebkitNotificationsEnabled(enable);
#endif
}
bool WebRuntimeFeatures::isNotificationsEnabled()
{
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
return RuntimeEnabledFeatures::webkitNotificationsEnabled();
#else
return false;
@@ -358,6 +358,24 @@ bool WebRuntimeFeatures::isMediaStreamEnabled()
#endif
}
+void WebRuntimeFeatures::enablePeerConnection(bool enable)
+{
+#if ENABLE(MEDIA_STREAM)
+ RuntimeEnabledFeatures::setPeerConnectionEnabled(enable);
+#else
+ UNUSED_PARAM(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isPeerConnectionEnabled()
+{
+#if ENABLE(MEDIA_STREAM)
+ return RuntimeEnabledFeatures::peerConnectionEnabled();
+#else
+ return false;
+#endif
+}
+
void WebRuntimeFeatures::enableFullScreenAPI(bool enable)
{
#if ENABLE(FULLSCREEN_API)
@@ -397,7 +415,7 @@ bool WebRuntimeFeatures::isPointerLockEnabled()
void WebRuntimeFeatures::enableMediaSource(bool enable)
{
#if ENABLE(MEDIA_SOURCE)
- RuntimeEnabledFeatures::setWebkitMediaSourceEnabled(enable);
+ RuntimeEnabledFeatures::setMediaSourceEnabled(enable);
#else
UNUSED_PARAM(enable);
#endif
@@ -406,7 +424,25 @@ void WebRuntimeFeatures::enableMediaSource(bool enable)
bool WebRuntimeFeatures::isMediaSourceEnabled()
{
#if ENABLE(MEDIA_SOURCE)
- return RuntimeEnabledFeatures::webkitMediaSourceEnabled();
+ return RuntimeEnabledFeatures::mediaSourceEnabled();
+#else
+ return false;
+#endif
+}
+
+void WebRuntimeFeatures::enableEncryptedMedia(bool enable)
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ RuntimeEnabledFeatures::setEncryptedMediaEnabled(enable);
+#else
+ UNUSED_PARAM(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isEncryptedMediaEnabled()
+{
+#if ENABLE(ENCRYPTED_MEDIA)
+ return RuntimeEnabledFeatures::encryptedMediaEnabled();
#else
return false;
#endif
@@ -484,5 +520,22 @@ bool WebRuntimeFeatures::isStyleScopedEnabled()
#endif
}
+void WebRuntimeFeatures::enableInputTypeDate(bool enable)
+{
+#if ENABLE(INPUT_TYPE_DATE)
+ RuntimeEnabledFeatures::setInputTypeDateEnabled(enable);
+#else
+ UNUSED_PARAM(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isInputTypeDateEnabled()
+{
+#if ENABLE(INPUT_TYPE_DATE)
+ return RuntimeEnabledFeatures::inputTypeDateEnabled();
+#else
+ return false;
+#endif
+}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebURL.cpp b/Source/WebKit/chromium/src/WebScopedMicrotaskSuppression.cpp
index 4beaf2ed9..7d165c189 100644
--- a/Source/WebKit/chromium/src/WebURL.cpp
+++ b/Source/WebKit/chromium/src/WebScopedMicrotaskSuppression.cpp
@@ -29,30 +29,29 @@
*/
#include "config.h"
-#include "platform/WebURL.h"
+#include "WebScopedMicrotaskSuppression.h"
-#include "KURL.h"
+#include "V8RecursionScope.h"
+#include <wtf/OwnPtr.h>
namespace WebKit {
-WebURL::WebURL(const WebCore::KURL& url)
- : m_spec(url.utf8String())
- , m_parsed(url.parsed())
- , m_isValid(url.isValid())
-{
-}
+#ifndef NDEBUG
+class WebScopedMicrotaskSuppression::Impl : public WebCore::V8RecursionScope::MicrotaskSuppression { };
+#endif
-WebURL& WebURL::operator=(const WebCore::KURL& url)
+void WebScopedMicrotaskSuppression::initialize()
{
- m_spec = url.utf8String();
- m_parsed = url.parsed();
- m_isValid = url.isValid();
- return *this;
+#ifndef NDEBUG
+ m_impl.reset(new Impl());
+#endif
}
-WebURL::operator WebCore::KURL() const
+void WebScopedMicrotaskSuppression::reset()
{
- return WebCore::KURL(m_spec, m_parsed, m_isValid);
+#ifndef NDEBUG
+ m_impl.reset(0);
+#endif
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp
index 01162779e..a14a36dcd 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::registerURLSchemeAsEmptyDocument(const WebString& scheme)
+{
+ SchemeRegistry::registerURLSchemeAsEmptyDocument(scheme);
+}
+
void WebSecurityPolicy::addOriginAccessWhitelistEntry(
const WebURL& sourceOrigin,
const WebString& destinationProtocol,
@@ -102,7 +107,7 @@ bool WebSecurityPolicy::shouldHideReferrer(const WebURL& url, const WebString& r
WebString WebSecurityPolicy::generateReferrerHeader(WebReferrerPolicy referrerPolicy, const WebURL& url, const WebString& referrer)
{
- return SecurityPolicy::generateReferrerHeader(static_cast<SecurityPolicy::ReferrerPolicy>(referrerPolicy), url, referrer);
+ return SecurityPolicy::generateReferrerHeader(static_cast<ReferrerPolicy>(referrerPolicy), url, referrer);
}
void WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs(const WebString& scheme)
diff --git a/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp b/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp
index 644bcf77b..e8f96e568 100644
--- a/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp
+++ b/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp
@@ -32,10 +32,10 @@
#if ENABLE(MEDIA_STREAM)
-#include "platform/WebMediaStreamComponent.h"
+#include "platform/WebSessionDescriptionDescriptor.h"
-#include "MediaStreamComponent.h"
-#include "platform/WebMediaStreamSource.h"
+#include "SessionDescriptionDescriptor.h"
+#include "platform/WebICECandidateDescriptor.h"
#include "platform/WebString.h"
#include <wtf/Vector.h>
@@ -43,42 +43,47 @@ using namespace WebCore;
namespace WebKit {
-WebMediaStreamComponent::WebMediaStreamComponent(WebCore::MediaStreamComponent* mediaStreamComponent)
- : m_private(mediaStreamComponent)
+WebSessionDescriptionDescriptor::WebSessionDescriptionDescriptor(const PassRefPtr<SessionDescriptionDescriptor>& sessionDescription)
+ : m_private(sessionDescription)
{
}
-WebMediaStreamComponent& WebMediaStreamComponent::operator=(WebCore::MediaStreamComponent* mediaStreamComponent)
+void WebSessionDescriptionDescriptor::assign(const WebSessionDescriptionDescriptor& other)
{
- m_private = mediaStreamComponent;
- return *this;
+ m_private = other.m_private;
}
-void WebMediaStreamComponent::reset()
+void WebSessionDescriptionDescriptor::reset()
{
m_private.reset();
}
-WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>() const
+WebSessionDescriptionDescriptor::operator WTF::PassRefPtr<WebCore::SessionDescriptionDescriptor>()
{
return m_private.get();
}
-WebMediaStreamComponent::operator MediaStreamComponent*() const
+void WebSessionDescriptionDescriptor::initialize(const WebString& sdp)
{
- return m_private.get();
+ m_private = SessionDescriptionDescriptor::create(sdp);
+}
+
+size_t WebSessionDescriptionDescriptor::numberOfAddedCandidates() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private.get()->numberOfAddedCandidates();
}
-bool WebMediaStreamComponent::isEnabled() const
+WebICECandidateDescriptor WebSessionDescriptionDescriptor::candidate(size_t index) const
{
ASSERT(!m_private.isNull());
- return m_private.get()->enabled();
+ return m_private.get()->candidate(index);
}
-WebMediaStreamSource WebMediaStreamComponent::source() const
+WebString WebSessionDescriptionDescriptor::initialSDP() const
{
ASSERT(!m_private.isNull());
- return WebMediaStreamSource(m_private.get()->source());
+ return m_private.get()->initialSDP();
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
index 3b3a84f98..190981988 100644
--- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -47,9 +47,9 @@ namespace WebKit {
WebSettingsImpl::WebSettingsImpl(Settings* settings)
: m_settings(settings)
- , m_compositeToTextureEnabled(false)
, m_showFPSCounter(false)
, m_showPlatformLayerTree(false)
+ , m_viewportEnabled(false)
{
ASSERT(settings);
}
@@ -298,6 +298,11 @@ void WebSettingsImpl::setExperimentalCSSRegionsEnabled(bool enabled)
m_settings->setCSSRegionsEnabled(enabled);
}
+void WebSettingsImpl::setExperimentalCSSCustomFilterEnabled(bool enabled)
+{
+ m_settings->setCSSCustomFilterEnabled(enabled);
+}
+
void WebSettingsImpl::setOpenGLMultisamplingEnabled(bool enabled)
{
m_settings->setOpenGLMultisamplingEnabled(enabled);
@@ -349,11 +354,6 @@ void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled)
m_settings->setMockScrollbarsEnabled(enabled);
}
-void WebSettingsImpl::setCompositeToTextureEnabled(bool enabled)
-{
- m_compositeToTextureEnabled = enabled;
-}
-
void WebSettingsImpl::setAcceleratedCompositingFor3DTransformsEnabled(bool enabled)
{
m_settings->setAcceleratedCompositingFor3DTransformsEnabled(enabled);
@@ -492,6 +492,15 @@ void WebSettingsImpl::setEnableScrollAnimator(bool enabled)
#endif
}
+bool WebSettingsImpl::scrollAnimatorEnabled() const
+{
+#if ENABLE(SMOOTH_SCROLLING)
+ return m_settings->scrollAnimatorEnabled();
+#else
+ return false;
+#endif
+}
+
void WebSettingsImpl::setHixie76WebSocketProtocolEnabled(bool enabled)
{
#if ENABLE(WEB_SOCKETS)
@@ -553,4 +562,9 @@ void WebSettingsImpl::setThreadedAnimationEnabled(bool enabled)
m_settings->setThreadedAnimationEnabled(enabled);
}
+void WebSettingsImpl::setViewportEnabled(bool enabled)
+{
+ m_viewportEnabled = enabled;
+}
+
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h
index 7024b5164..3ea9dce38 100644
--- a/Source/WebKit/chromium/src/WebSettingsImpl.h
+++ b/Source/WebKit/chromium/src/WebSettingsImpl.h
@@ -90,6 +90,7 @@ public:
virtual void setWebAudioEnabled(bool);
virtual void setExperimentalWebGLEnabled(bool);
virtual void setExperimentalCSSRegionsEnabled(bool);
+ virtual void setExperimentalCSSCustomFilterEnabled(bool);
virtual void setOpenGLMultisamplingEnabled(bool);
virtual void setPrivilegedWebGLExtensionsEnabled(bool);
virtual void setWebGLErrorsToConsoleEnabled(bool);
@@ -102,8 +103,6 @@ public:
virtual void setAcceleratedCompositingEnabled(bool);
virtual void setForceCompositingMode(bool);
virtual void setMockScrollbarsEnabled(bool);
- virtual void setCompositeToTextureEnabled(bool);
- virtual bool compositeToTextureEnabled() const { return m_compositeToTextureEnabled; }
virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool);
virtual void setAcceleratedCompositingForVideoEnabled(bool);
virtual void setAcceleratedCompositingForPluginsEnabled(bool);
@@ -130,6 +129,7 @@ public:
virtual void setPasswordEchoDurationInSeconds(double);
virtual void setShouldPrintBackgrounds(bool);
virtual void setEnableScrollAnimator(bool);
+ virtual bool scrollAnimatorEnabled() const;
virtual void setHixie76WebSocketProtocolEnabled(bool);
virtual void setVisualWordMovementEnabled(bool);
virtual void setShouldDisplaySubtitles(bool);
@@ -139,12 +139,14 @@ public:
virtual void setPerTilePaintingEnabled(bool);
virtual void setPartialSwapEnabled(bool);
virtual void setThreadedAnimationEnabled(bool);
+ virtual void setViewportEnabled(bool);
+ virtual bool viewportEnabled() const { return m_viewportEnabled; }
private:
WebCore::Settings* m_settings;
- bool m_compositeToTextureEnabled;
bool m_showFPSCounter;
bool m_showPlatformLayerTree;
+ bool m_viewportEnabled;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
index 3fa19d25d..301c75e36 100644
--- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
@@ -320,10 +320,11 @@ void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Ta
m_loadingDocument->postTask(task);
}
-void WebSharedWorkerImpl::postTaskForModeToWorkerContext(
+bool WebSharedWorkerImpl::postTaskForModeToWorkerContext(
PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
{
m_workerThread->runLoop().postTaskForMode(task, mode);
+ return true;
}
diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h
index b98a2c9d7..4041592b5 100644
--- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h
+++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h
@@ -86,7 +86,7 @@ public:
// WebCore::WorkerLoaderProxy methods:
virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>);
- virtual void postTaskForModeToWorkerContext(
+ virtual bool postTaskForModeToWorkerContext(
PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WTF::String& mode);
// WebFrameClient methods to support resource loading thru the 'shadow page'.
diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp
index 30a6033d3..179303ad9 100644
--- a/Source/WebKit/chromium/src/WebSocketImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "WebSocketImpl.h"
-#include "ArrayBuffer.h"
+#include <wtf/ArrayBuffer.h>
#include "Document.h"
#include "KURL.h"
#if ENABLE(WEB_SOCKETS)
diff --git a/Source/WebKit/chromium/src/WebSpeechGrammar.cpp b/Source/WebKit/chromium/src/WebSpeechGrammar.cpp
new file mode 100644
index 000000000..b28509de8
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebSpeechGrammar.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "WebSpeechGrammar.h"
+
+#include "SpeechGrammar.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+void WebSpeechGrammar::reset()
+{
+ m_private.reset();
+}
+
+WebSpeechGrammar::WebSpeechGrammar(const PassRefPtr<WebCore::SpeechGrammar>& value)
+ : m_private(value)
+{
+}
+
+WebSpeechGrammar& WebSpeechGrammar::operator=(const WTF::PassRefPtr<WebCore::SpeechGrammar>& value)
+{
+ m_private = value;
+ return *this;
+}
+
+WebURL WebSpeechGrammar::src() const
+{
+ WEBKIT_ASSERT(m_private.get());
+ return m_private->src();
+}
+
+float WebSpeechGrammar::weight() const
+{
+ WEBKIT_ASSERT(m_private.get());
+ return m_private->weight();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSpeechRecognitionHandle.cpp b/Source/WebKit/chromium/src/WebSpeechRecognitionHandle.cpp
new file mode 100644
index 000000000..a555673c2
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebSpeechRecognitionHandle.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "WebSpeechRecognitionHandle.h"
+
+#include "SpeechRecognition.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebSpeechRecognitionHandle::reset()
+{
+ m_private.reset();
+}
+
+void WebSpeechRecognitionHandle::assign(const WebSpeechRecognitionHandle& other)
+{
+ m_private = other.m_private;
+}
+
+bool WebSpeechRecognitionHandle::equals(const WebSpeechRecognitionHandle& other) const
+{
+ return (m_private.get() == other.m_private.get());
+}
+
+bool WebSpeechRecognitionHandle::lessThan(const WebSpeechRecognitionHandle& other) const
+{
+ return (m_private.get() < other.m_private.get());
+}
+
+WebSpeechRecognitionHandle::WebSpeechRecognitionHandle(const PassRefPtr<SpeechRecognition>& speechRecognition)
+ : m_private(speechRecognition)
+{
+}
+
+WebSpeechRecognitionHandle& WebSpeechRecognitionHandle::operator=(const PassRefPtr<SpeechRecognition>& speechRecognition)
+{
+ m_private = speechRecognition;
+ return *this;
+}
+
+WebSpeechRecognitionHandle::operator PassRefPtr<SpeechRecognition>() const
+{
+ return m_private.get();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSpeechRecognitionResult.cpp b/Source/WebKit/chromium/src/WebSpeechRecognitionResult.cpp
new file mode 100644
index 000000000..b546f88d1
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebSpeechRecognitionResult.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "WebSpeechRecognitionResult.h"
+
+#include "SpeechRecognitionAlternative.h"
+#include "SpeechRecognitionResult.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+void WebSpeechRecognitionResult::assign(const WebSpeechRecognitionResult& other)
+{
+ m_private = other.m_private;
+}
+
+void WebSpeechRecognitionResult::assign(const WebVector<WebString>& transcripts, const WebVector<float>& confidences, bool final)
+{
+ ASSERT(transcripts.size() == confidences.size());
+
+ Vector<RefPtr<WebCore::SpeechRecognitionAlternative> > alternatives(transcripts.size());
+ for (size_t i = 0; i < transcripts.size(); ++i)
+ alternatives[i] = WebCore::SpeechRecognitionAlternative::create(transcripts[i], confidences[i]);
+
+ m_private = WebCore::SpeechRecognitionResult::create(alternatives, final);
+}
+
+void WebSpeechRecognitionResult::reset()
+{
+ m_private.reset();
+}
+
+WebSpeechRecognitionResult::operator PassRefPtr<WebCore::SpeechRecognitionResult>() const
+{
+ return m_private.get();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebStorageAreaImpl.cpp b/Source/WebKit/chromium/src/WebStorageAreaImpl.cpp
deleted file mode 100644
index 7f0a83a16..000000000
--- a/Source/WebKit/chromium/src/WebStorageAreaImpl.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebStorageAreaImpl.h"
-
-#include "ExceptionCode.h"
-
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
-
-namespace WebKit {
-
-const WebURL* WebStorageAreaImpl::storageEventURL = 0;
-
-WebStorageAreaImpl::WebStorageAreaImpl(PassRefPtr<WebCore::StorageArea> storageArea)
- : m_storageArea(storageArea)
-{
-}
-
-WebStorageAreaImpl::~WebStorageAreaImpl()
-{
-}
-
-unsigned WebStorageAreaImpl::length()
-{
- return m_storageArea->length(0);
-}
-
-WebString WebStorageAreaImpl::key(unsigned index)
-{
- return m_storageArea->key(index, 0);
-}
-
-WebString WebStorageAreaImpl::getItem(const WebString& key)
-{
- return m_storageArea->getItem(key, 0);
-}
-
-void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, Result& result, WebString& oldValue)
-{
- int exceptionCode = 0;
-
- ScopedStorageEventURL scope(url);
- oldValue = m_storageArea->setItem(key, value, exceptionCode, 0);
-
- if (exceptionCode) {
- ASSERT(exceptionCode == WebCore::QUOTA_EXCEEDED_ERR);
- result = ResultBlockedByQuota;
- } else
- result = ResultOK;
-}
-
-void WebStorageAreaImpl::removeItem(const WebString& key, const WebURL& url, WebString& oldValue)
-{
- ScopedStorageEventURL scope(url);
- oldValue = m_storageArea->removeItem(key, 0);
-}
-
-void WebStorageAreaImpl::clear(const WebURL& url, bool& somethingCleared)
-{
- ScopedStorageEventURL scope(url);
- somethingCleared = m_storageArea->clear(0);
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebStorageAreaImpl.h b/Source/WebKit/chromium/src/WebStorageAreaImpl.h
deleted file mode 100644
index b973188b8..000000000
--- a/Source/WebKit/chromium/src/WebStorageAreaImpl.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebStorageAreaImpl_h
-#define WebStorageAreaImpl_h
-
-#include "StorageAreaImpl.h"
-#include "WebStorageArea.h"
-
-namespace WebKit {
-
-class WebStorageAreaImpl : public WebStorageArea {
-public:
- WebStorageAreaImpl(PassRefPtr<WebCore::StorageArea> storageArea);
- virtual ~WebStorageAreaImpl();
- virtual unsigned length();
- virtual WebString key(unsigned index);
- virtual WebString getItem(const WebString& key);
- virtual void setItem(const WebString& key, const WebString& value, const WebURL&, Result&, WebString& oldValue);
- virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue);
- virtual void clear(const WebURL& url, bool& somethingCleared);
-
- // For storage events in single-process mode and test shell.
- static const WebURL* currentStorageEventURL() { return storageEventURL; }
-
-private:
- class ScopedStorageEventURL {
- public:
- ScopedStorageEventURL(const WebURL& url)
- {
- // FIXME: Once storage events are fired async in WebKit (as they should
- // be) this can be ASSERTed to be 0 rather than saved.
- m_existingStorageEventURL = storageEventURL;
- storageEventURL = &url;
- }
- ~ScopedStorageEventURL()
- {
- storageEventURL = m_existingStorageEventURL;
- }
-
- private:
- const WebURL* m_existingStorageEventURL;
- };
-
- static const WebURL* storageEventURL;
-
- RefPtr<WebCore::StorageArea> m_storageArea;
-};
-
-} // namespace WebKit
-
-#endif // WebStorageAreaImpl_h
diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
index f1548cd66..c8036aa74 100644
--- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
+++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
@@ -33,8 +33,8 @@
#include "KURL.h"
#include "SecurityOrigin.h"
+#include "StorageAreaProxy.h"
-#include "WebStorageAreaImpl.h"
#include "platform/WebURL.h"
#include <wtf/PassOwnPtr.h>
@@ -42,6 +42,33 @@ namespace WebKit {
extern const char* pageGroupName;
+void WebStorageEventDispatcher::dispatchLocalStorageEvent(
+ const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebURL& origin,
+ const WebURL& pageURL, WebStorageArea* sourceAreaInstance,
+ bool originatedInProcess)
+{
+ RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
+ WebCore::StorageAreaProxy::dispatchLocalStorageEvent(
+ pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL,
+ sourceAreaInstance, originatedInProcess);
+}
+
+void WebStorageEventDispatcher::dispatchSessionStorageEvent(
+ const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebURL& origin,
+ const WebURL& pageURL, const WebStorageNamespace& sessionNamespace,
+ WebStorageArea* sourceAreaInstance, bool originatedInProcess)
+{
+ RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::create(origin);
+ WebCore::StorageAreaProxy::dispatchSessionStorageEvent(
+ pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageURL,
+ sessionNamespace, sourceAreaInstance, originatedInProcess);
+}
+
+
+// FIXME: remove the WebStorageEventDispatcherImpl class soon.
+
WebStorageEventDispatcher* WebStorageEventDispatcher::create()
{
return new WebStorageEventDispatcherImpl();
@@ -55,15 +82,11 @@ WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl()
void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue,
const WebString& newValue, const WebString& origin,
- const WebURL& passedInURL, bool isLocalStorage)
+ const WebURL& pageURL, bool isLocalStorage)
{
- // Hack for single-process mode and test shell.
- const WebURL* storageAreaImplURL = WebStorageAreaImpl::currentStorageEventURL();
- const WebURL& url = storageAreaImplURL ? *storageAreaImplURL : passedInURL;
-
WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage;
RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin);
- m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), url, storageType);
+ m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), pageURL, storageType);
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h
index 748963639..b03c6b7a6 100644
--- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h
+++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.h
@@ -37,14 +37,13 @@
namespace WebKit {
+// DEPRECATED - to be removed when removing the instance methods in the public api.
class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher {
public:
WebStorageEventDispatcherImpl();
-
virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
const WebString& newValue, const WebString& origin,
const WebURL&, bool isLocalStorage);
-
private:
OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher;
};
diff --git a/Source/WebKit/chromium/src/WebStorageNamespaceImpl.cpp b/Source/WebKit/chromium/src/WebStorageNamespaceImpl.cpp
deleted file mode 100644
index bb436195a..000000000
--- a/Source/WebKit/chromium/src/WebStorageNamespaceImpl.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebStorageNamespaceImpl.h"
-
-#include "SecurityOrigin.h"
-#include "WebStorageAreaImpl.h"
-#include "platform/WebString.h"
-
-namespace WebKit {
-
-WebStorageNamespace* WebStorageNamespace::createLocalStorageNamespace(const WebString& path, unsigned quota)
-{
- return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::localStorageNamespace(path, quota));
-}
-
-WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace(unsigned quota)
-{
- return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace(quota));
-}
-
-WebStorageNamespaceImpl::WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace)
- : m_storageNamespace(storageNamespace)
-{
-}
-
-WebStorageNamespaceImpl::~WebStorageNamespaceImpl()
-{
-}
-
-WebStorageArea* WebStorageNamespaceImpl::createStorageArea(const WebString& originString)
-{
- RefPtr<WebCore::SecurityOrigin> origin = WebCore::SecurityOrigin::createFromString(originString);
- return new WebStorageAreaImpl(m_storageNamespace->storageArea(origin.release()));
-}
-
-WebStorageNamespace* WebStorageNamespaceImpl::copy()
-{
- return new WebStorageNamespaceImpl(m_storageNamespace->copy());
-}
-
-void WebStorageNamespaceImpl::close()
-{
- m_storageNamespace->close();
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSurroundingText.cpp b/Source/WebKit/chromium/src/WebSurroundingText.cpp
new file mode 100644
index 000000000..26bb39255
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebSurroundingText.cpp
@@ -0,0 +1,90 @@
+/*
+ * 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 "WebSurroundingText.h"
+
+#include "Element.h"
+#include "Node.h"
+#include "Range.h"
+#include "RenderObject.h"
+#include "SurroundingText.h"
+#include "Text.h"
+#include "VisiblePosition.h"
+#include "WebHitTestResult.h"
+
+#include "platform/WebPoint.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebSurroundingText::initialize(const WebHitTestResult& hitTestInfo, size_t maxLength)
+{
+ Node* node = hitTestInfo.node().unwrap<Node>();
+ if (!node || !node->renderer())
+ return;
+
+ VisiblePosition visiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(hitTestInfo.localPoint())));
+ if (visiblePosition.isNull())
+ return;
+
+ m_private.reset(new SurroundingText(visiblePosition, maxLength));
+}
+
+void WebSurroundingText::initialize(WebNode textNode, size_t offset, size_t maxLength)
+{
+ Node* node = textNode.unwrap<Node>();
+ if (!node || !node->isTextNode() || offset >= node->nodeValue().length())
+ return;
+
+ m_private.reset(new SurroundingText(VisiblePosition(Position(toText(node), offset).parentAnchoredEquivalent(), DOWNSTREAM), maxLength));
+}
+
+WebString WebSurroundingText::textContent() const
+{
+ return m_private->content();
+}
+
+size_t WebSurroundingText::hitOffsetInTextContent() const
+{
+ return m_private->positionOffsetInContent();
+}
+
+WebRange WebSurroundingText::rangeFromContentOffsets(size_t startOffsetInContent, size_t endOffsetInContent)
+{
+ return m_private->rangeFromContentOffsets(startOffsetInContent, endOffsetInContent);
+}
+
+bool WebSurroundingText::isNull() const
+{
+ return !m_private.get();
+}
+
+void WebSurroundingText::reset()
+{
+ m_private.reset(0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp
index 0d6e4db78..957663634 100644
--- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp
+++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp
@@ -51,7 +51,13 @@ static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingR
void WebTextCheckingCompletionImpl::didFinishCheckingText(const WebVector<WebTextCheckingResult>& results)
{
- m_spellChecker->didCheck(m_identifier, toCoreResults(results));
+ m_spellChecker->didCheckSucceeded(m_identifier, toCoreResults(results));
+ delete this;
+}
+
+void WebTextCheckingCompletionImpl::didCancelCheckingText()
+{
+ m_spellChecker->didCheckCanceled(m_identifier);
delete this;
}
diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h
index dee114adc..175d25cd4 100644
--- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h
+++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h
@@ -47,6 +47,7 @@ public:
}
virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&);
+ virtual void didCancelCheckingText();
private:
virtual ~WebTextCheckingCompletionImpl() { }
diff --git a/Source/WebKit/chromium/src/WebThreadSafeData.cpp b/Source/WebKit/chromium/src/WebThreadSafeData.cpp
deleted file mode 100755
index 7bad9c134..000000000
--- a/Source/WebKit/chromium/src/WebThreadSafeData.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebThreadSafeData.h"
-
-#include "BlobData.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebThreadSafeData::reset()
-{
- m_private.reset();
-}
-
-void WebThreadSafeData::assign(const WebThreadSafeData& other)
-{
- m_private = other.m_private;
-}
-
-size_t WebThreadSafeData::size() const
-{
- if (m_private.isNull())
- return 0;
- return m_private->length();
-}
-
-const char* WebThreadSafeData::data() const
-{
- if (m_private.isNull())
- return 0;
- return m_private->data();
-}
-
-WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data)
- : m_private(data.leakRef())
-{
-}
-
-WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data)
-{
- m_private = data;
- return *this;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebURLError.cpp b/Source/WebKit/chromium/src/WebURLError.cpp
deleted file mode 100644
index 95236820d..000000000
--- a/Source/WebKit/chromium/src/WebURLError.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebURLError.h"
-
-#include "KURL.h"
-#include "ResourceError.h"
-#include <wtf/text/CString.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebURLError::WebURLError(const ResourceError& error)
-{
- *this = error;
-}
-
-WebURLError& WebURLError::operator=(const ResourceError& error)
-{
- if (error.isNull())
- *this = WebURLError();
- else {
- domain = error.domain();
- reason = error.errorCode();
- unreachableURL = KURL(ParsedURLString, error.failingURL());
- isCancellation = error.isCancellation();
- }
- return *this;
-}
-
-WebURLError::operator ResourceError() const
-{
- if (!reason)
- return ResourceError();
- CString spec = unreachableURL.spec();
- ResourceError resourceError = ResourceError(domain, reason,
- String::fromUTF8(spec.data(),
- spec.length()), String());
- resourceError.setIsCancellation(isCancellation);
- return resourceError;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebURLRequest.cpp b/Source/WebKit/chromium/src/WebURLRequest.cpp
deleted file mode 100644
index cbac8247d..000000000
--- a/Source/WebKit/chromium/src/WebURLRequest.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebURLRequest.h"
-
-#include "ResourceRequest.h"
-
-#include "platform/WebHTTPBody.h"
-#include "platform/WebHTTPHeaderVisitor.h"
-#include "platform/WebURL.h"
-#include "WebURLRequestPrivate.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-namespace {
-
-class ExtraDataContainer : public ResourceRequest::ExtraData {
-public:
- static PassRefPtr<ExtraDataContainer> create(WebURLRequest::ExtraData* extraData) { return adoptRef(new ExtraDataContainer(extraData)); }
-
- virtual ~ExtraDataContainer() { }
-
- WebURLRequest::ExtraData* extraData() const { return m_extraData.get(); }
-
-private:
- explicit ExtraDataContainer(WebURLRequest::ExtraData* extraData)
- : m_extraData(adoptPtr(extraData))
- {
- }
-
- OwnPtr<WebURLRequest::ExtraData> m_extraData;
-};
-
-} // namespace
-
-// The standard implementation of WebURLRequestPrivate, which maintains
-// ownership of a ResourceRequest instance.
-class WebURLRequestPrivateImpl : public WebURLRequestPrivate {
-public:
- WebURLRequestPrivateImpl()
- {
- m_resourceRequest = &m_resourceRequestAllocation;
- }
-
- WebURLRequestPrivateImpl(const WebURLRequestPrivate* p)
- : m_resourceRequestAllocation(*p->m_resourceRequest)
- {
- m_resourceRequest = &m_resourceRequestAllocation;
- m_allowStoredCredentials = p->m_allowStoredCredentials;
- }
-
- virtual void dispose() { delete this; }
-
-private:
- virtual ~WebURLRequestPrivateImpl() { }
-
- ResourceRequest m_resourceRequestAllocation;
-};
-
-void WebURLRequest::initialize()
-{
- assign(new WebURLRequestPrivateImpl());
-}
-
-void WebURLRequest::reset()
-{
- assign(0);
-}
-
-void WebURLRequest::assign(const WebURLRequest& r)
-{
- if (&r != this)
- assign(r.m_private ? new WebURLRequestPrivateImpl(r.m_private) : 0);
-}
-
-bool WebURLRequest::isNull() const
-{
- return !m_private || m_private->m_resourceRequest->isNull();
-}
-
-WebURL WebURLRequest::url() const
-{
- return m_private->m_resourceRequest->url();
-}
-
-void WebURLRequest::setURL(const WebURL& url)
-{
- m_private->m_resourceRequest->setURL(url);
-}
-
-WebURL WebURLRequest::firstPartyForCookies() const
-{
- return m_private->m_resourceRequest->firstPartyForCookies();
-}
-
-void WebURLRequest::setFirstPartyForCookies(const WebURL& firstPartyForCookies)
-{
- m_private->m_resourceRequest->setFirstPartyForCookies(firstPartyForCookies);
-}
-
-bool WebURLRequest::allowCookies() const
-{
- return m_private->m_resourceRequest->allowCookies();
-}
-
-void WebURLRequest::setAllowCookies(bool allowCookies)
-{
- m_private->m_resourceRequest->setAllowCookies(allowCookies);
-}
-
-bool WebURLRequest::allowStoredCredentials() const
-{
- return m_private->m_allowStoredCredentials;
-}
-
-void WebURLRequest::setAllowStoredCredentials(bool allowStoredCredentials)
-{
- m_private->m_allowStoredCredentials = allowStoredCredentials;
-}
-
-WebURLRequest::CachePolicy WebURLRequest::cachePolicy() const
-{
- return static_cast<WebURLRequest::CachePolicy>(
- m_private->m_resourceRequest->cachePolicy());
-}
-
-void WebURLRequest::setCachePolicy(CachePolicy cachePolicy)
-{
- m_private->m_resourceRequest->setCachePolicy(
- static_cast<ResourceRequestCachePolicy>(cachePolicy));
-}
-
-WebString WebURLRequest::httpMethod() const
-{
- return m_private->m_resourceRequest->httpMethod();
-}
-
-void WebURLRequest::setHTTPMethod(const WebString& httpMethod)
-{
- m_private->m_resourceRequest->setHTTPMethod(httpMethod);
-}
-
-WebString WebURLRequest::httpHeaderField(const WebString& name) const
-{
- return m_private->m_resourceRequest->httpHeaderField(name);
-}
-
-void WebURLRequest::setHTTPHeaderField(const WebString& name, const WebString& value)
-{
- m_private->m_resourceRequest->setHTTPHeaderField(name, value);
-}
-
-void WebURLRequest::addHTTPHeaderField(const WebString& name, const WebString& value)
-{
- m_private->m_resourceRequest->addHTTPHeaderField(name, value);
-}
-
-void WebURLRequest::clearHTTPHeaderField(const WebString& name)
-{
- // FIXME: Add a clearHTTPHeaderField method to ResourceRequest.
- const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields();
- const_cast<HTTPHeaderMap*>(&map)->remove(name);
-}
-
-void WebURLRequest::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const
-{
- const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields();
- for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it)
- visitor->visitHeader(it->first, it->second);
-}
-
-WebHTTPBody WebURLRequest::httpBody() const
-{
- return WebHTTPBody(m_private->m_resourceRequest->httpBody());
-}
-
-void WebURLRequest::setHTTPBody(const WebHTTPBody& httpBody)
-{
- m_private->m_resourceRequest->setHTTPBody(httpBody);
-}
-
-bool WebURLRequest::reportUploadProgress() const
-{
- return m_private->m_resourceRequest->reportUploadProgress();
-}
-
-void WebURLRequest::setReportUploadProgress(bool reportUploadProgress)
-{
- m_private->m_resourceRequest->setReportUploadProgress(reportUploadProgress);
-}
-
-bool WebURLRequest::reportLoadTiming() const
-{
- return m_private->m_resourceRequest->reportLoadTiming();
-}
-
-void WebURLRequest::setReportRawHeaders(bool reportRawHeaders)
-{
- m_private->m_resourceRequest->setReportRawHeaders(reportRawHeaders);
-}
-
-bool WebURLRequest::reportRawHeaders() const
-{
- return m_private->m_resourceRequest->reportRawHeaders();
-}
-
-void WebURLRequest::setReportLoadTiming(bool reportLoadTiming)
-{
- m_private->m_resourceRequest->setReportLoadTiming(reportLoadTiming);
-}
-
-WebURLRequest::TargetType WebURLRequest::targetType() const
-{
- // FIXME: Temporary special case until downstream chromium.org knows of the new TargetTypes.
- TargetType targetType = static_cast<TargetType>(m_private->m_resourceRequest->targetType());
- if (targetType == TargetIsTextTrack || targetType == TargetIsUnspecified)
- return TargetIsSubresource;
- return targetType;
-}
-
-bool WebURLRequest::hasUserGesture() const
-{
- return m_private->m_resourceRequest->hasUserGesture();
-}
-
-void WebURLRequest::setHasUserGesture(bool hasUserGesture)
-{
- m_private->m_resourceRequest->setHasUserGesture(hasUserGesture);
-}
-
-void WebURLRequest::setTargetType(TargetType targetType)
-{
- m_private->m_resourceRequest->setTargetType(
- static_cast<ResourceRequest::TargetType>(targetType));
-}
-
-int WebURLRequest::requestorID() const
-{
- return m_private->m_resourceRequest->requestorID();
-}
-
-void WebURLRequest::setRequestorID(int requestorID)
-{
- m_private->m_resourceRequest->setRequestorID(requestorID);
-}
-
-int WebURLRequest::requestorProcessID() const
-{
- return m_private->m_resourceRequest->requestorProcessID();
-}
-
-void WebURLRequest::setRequestorProcessID(int requestorProcessID)
-{
- m_private->m_resourceRequest->setRequestorProcessID(requestorProcessID);
-}
-
-int WebURLRequest::appCacheHostID() const
-{
- return m_private->m_resourceRequest->appCacheHostID();
-}
-
-void WebURLRequest::setAppCacheHostID(int appCacheHostID)
-{
- m_private->m_resourceRequest->setAppCacheHostID(appCacheHostID);
-}
-
-bool WebURLRequest::downloadToFile() const
-{
- return m_private->m_resourceRequest->downloadToFile();
-}
-
-void WebURLRequest::setDownloadToFile(bool downloadToFile)
-{
- m_private->m_resourceRequest->setDownloadToFile(downloadToFile);
-}
-
-WebURLRequest::ExtraData* WebURLRequest::extraData() const
-{
- RefPtr<ResourceRequest::ExtraData> data = m_private->m_resourceRequest->extraData();
- if (!data)
- return 0;
- return static_cast<ExtraDataContainer*>(data.get())->extraData();
-}
-
-void WebURLRequest::setExtraData(WebURLRequest::ExtraData* extraData)
-{
- m_private->m_resourceRequest->setExtraData(ExtraDataContainer::create(extraData));
-}
-
-ResourceRequest& WebURLRequest::toMutableResourceRequest()
-{
- ASSERT(m_private);
- ASSERT(m_private->m_resourceRequest);
-
- return *m_private->m_resourceRequest;
-}
-
-const ResourceRequest& WebURLRequest::toResourceRequest() const
-{
- ASSERT(m_private);
- ASSERT(m_private->m_resourceRequest);
-
- return *m_private->m_resourceRequest;
-}
-
-void WebURLRequest::assign(WebURLRequestPrivate* p)
-{
- // Subclasses may call this directly so a self-assignment check is needed
- // here as well as in the public assign method.
- if (m_private == p)
- return;
- if (m_private)
- m_private->dispose();
- m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebURLResponse.cpp b/Source/WebKit/chromium/src/WebURLResponse.cpp
deleted file mode 100644
index ec212e517..000000000
--- a/Source/WebKit/chromium/src/WebURLResponse.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "platform/WebURLResponse.h"
-
-#include "ResourceResponse.h"
-#include "ResourceLoadTiming.h"
-
-#include "platform/WebHTTPHeaderVisitor.h"
-#include "platform/WebHTTPLoadInfo.h"
-#include "platform/WebString.h"
-#include "platform/WebURL.h"
-#include "platform/WebURLLoadTiming.h"
-#include "WebURLResponsePrivate.h"
-
-#include <wtf/RefPtr.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-namespace {
-
-class ExtraDataContainer : public ResourceResponse::ExtraData {
-public:
- static PassRefPtr<ExtraDataContainer> create(WebURLResponse::ExtraData* extraData) { return adoptRef(new ExtraDataContainer(extraData)); }
-
- virtual ~ExtraDataContainer() { }
-
- WebURLResponse::ExtraData* extraData() const { return m_extraData.get(); }
-
-private:
- explicit ExtraDataContainer(WebURLResponse::ExtraData* extraData)
- : m_extraData(adoptPtr(extraData))
- {
- }
-
- OwnPtr<WebURLResponse::ExtraData> m_extraData;
-};
-
-} // namespace
-
-// The standard implementation of WebURLResponsePrivate, which maintains
-// ownership of a ResourceResponse instance.
-class WebURLResponsePrivateImpl : public WebURLResponsePrivate {
-public:
- WebURLResponsePrivateImpl()
- {
- m_resourceResponse = &m_resourceResponseAllocation;
- }
-
- WebURLResponsePrivateImpl(const WebURLResponsePrivate* p)
- : m_resourceResponseAllocation(*p->m_resourceResponse)
- {
- m_resourceResponse = &m_resourceResponseAllocation;
- }
-
- virtual void dispose() { delete this; }
-
-private:
- virtual ~WebURLResponsePrivateImpl() { }
-
- ResourceResponse m_resourceResponseAllocation;
-};
-
-void WebURLResponse::initialize()
-{
- assign(new WebURLResponsePrivateImpl());
-}
-
-void WebURLResponse::reset()
-{
- assign(0);
-}
-
-void WebURLResponse::assign(const WebURLResponse& r)
-{
- if (&r != this)
- assign(r.m_private ? new WebURLResponsePrivateImpl(r.m_private) : 0);
-}
-
-bool WebURLResponse::isNull() const
-{
- return !m_private || m_private->m_resourceResponse->isNull();
-}
-
-WebURL WebURLResponse::url() const
-{
- return m_private->m_resourceResponse->url();
-}
-
-void WebURLResponse::setURL(const WebURL& url)
-{
- m_private->m_resourceResponse->setURL(url);
-}
-
-unsigned WebURLResponse::connectionID() const
-{
- return m_private->m_resourceResponse->connectionID();
-}
-
-void WebURLResponse::setConnectionID(unsigned connectionID)
-{
- m_private->m_resourceResponse->setConnectionID(connectionID);
-}
-
-bool WebURLResponse::connectionReused() const
-{
- return m_private->m_resourceResponse->connectionReused();
-}
-
-void WebURLResponse::setConnectionReused(bool connectionReused)
-{
- m_private->m_resourceResponse->setConnectionReused(connectionReused);
-}
-
-WebURLLoadTiming WebURLResponse::loadTiming()
-{
- return WebURLLoadTiming(m_private->m_resourceResponse->resourceLoadTiming());
-}
-
-void WebURLResponse::setLoadTiming(const WebURLLoadTiming& timing)
-{
- RefPtr<ResourceLoadTiming> loadTiming = PassRefPtr<ResourceLoadTiming>(timing);
- m_private->m_resourceResponse->setResourceLoadTiming(loadTiming.release());
-}
-
-WebHTTPLoadInfo WebURLResponse::httpLoadInfo()
-{
- return WebHTTPLoadInfo(m_private->m_resourceResponse->resourceLoadInfo());
-}
-
-void WebURLResponse::setHTTPLoadInfo(const WebHTTPLoadInfo& value)
-{
- m_private->m_resourceResponse->setResourceLoadInfo(value);
-}
-
-double WebURLResponse::responseTime() const
-{
- return m_private->m_resourceResponse->responseTime();
-}
-
-void WebURLResponse::setResponseTime(double responseTime)
-{
- m_private->m_resourceResponse->setResponseTime(responseTime);
-}
-
-WebString WebURLResponse::mimeType() const
-{
- return m_private->m_resourceResponse->mimeType();
-}
-
-void WebURLResponse::setMIMEType(const WebString& mimeType)
-{
- m_private->m_resourceResponse->setMimeType(mimeType);
-}
-
-long long WebURLResponse::expectedContentLength() const
-{
- return m_private->m_resourceResponse->expectedContentLength();
-}
-
-void WebURLResponse::setExpectedContentLength(long long expectedContentLength)
-{
- m_private->m_resourceResponse->setExpectedContentLength(expectedContentLength);
-}
-
-WebString WebURLResponse::textEncodingName() const
-{
- return m_private->m_resourceResponse->textEncodingName();
-}
-
-void WebURLResponse::setTextEncodingName(const WebString& textEncodingName)
-{
- m_private->m_resourceResponse->setTextEncodingName(textEncodingName);
-}
-
-WebString WebURLResponse::suggestedFileName() const
-{
- return m_private->m_resourceResponse->suggestedFilename();
-}
-
-void WebURLResponse::setSuggestedFileName(const WebString& suggestedFileName)
-{
- m_private->m_resourceResponse->setSuggestedFilename(suggestedFileName);
-}
-
-int WebURLResponse::httpStatusCode() const
-{
- return m_private->m_resourceResponse->httpStatusCode();
-}
-
-void WebURLResponse::setHTTPStatusCode(int httpStatusCode)
-{
- m_private->m_resourceResponse->setHTTPStatusCode(httpStatusCode);
-}
-
-WebString WebURLResponse::httpStatusText() const
-{
- return m_private->m_resourceResponse->httpStatusText();
-}
-
-void WebURLResponse::setHTTPStatusText(const WebString& httpStatusText)
-{
- m_private->m_resourceResponse->setHTTPStatusText(httpStatusText);
-}
-
-WebString WebURLResponse::httpHeaderField(const WebString& name) const
-{
- return m_private->m_resourceResponse->httpHeaderField(name);
-}
-
-void WebURLResponse::setHTTPHeaderField(const WebString& name, const WebString& value)
-{
- m_private->m_resourceResponse->setHTTPHeaderField(name, value);
-}
-
-void WebURLResponse::addHTTPHeaderField(const WebString& name, const WebString& value)
-{
- if (name.isNull() || value.isNull())
- return;
- // FIXME: Add an addHTTPHeaderField method to ResourceResponse.
- const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields();
- String valueStr(value);
- pair<HTTPHeaderMap::iterator, bool> result =
- const_cast<HTTPHeaderMap*>(&map)->add(name, valueStr);
- if (!result.second)
- result.first->second += ", " + valueStr;
-}
-
-void WebURLResponse::clearHTTPHeaderField(const WebString& name)
-{
- // FIXME: Add a clearHTTPHeaderField method to ResourceResponse.
- const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields();
- const_cast<HTTPHeaderMap*>(&map)->remove(name);
-}
-
-void WebURLResponse::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const
-{
- const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields();
- for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it)
- visitor->visitHeader(it->first, it->second);
-}
-
-double WebURLResponse::lastModifiedDate() const
-{
- return static_cast<double>(m_private->m_resourceResponse->lastModifiedDate());
-}
-
-void WebURLResponse::setLastModifiedDate(double lastModifiedDate)
-{
- m_private->m_resourceResponse->setLastModifiedDate(static_cast<time_t>(lastModifiedDate));
-}
-
-long long WebURLResponse::appCacheID() const
-{
- return m_private->m_resourceResponse->appCacheID();
-}
-
-void WebURLResponse::setAppCacheID(long long appCacheID)
-{
- m_private->m_resourceResponse->setAppCacheID(appCacheID);
-}
-
-WebURL WebURLResponse::appCacheManifestURL() const
-{
- return m_private->m_resourceResponse->appCacheManifestURL();
-}
-
-void WebURLResponse::setAppCacheManifestURL(const WebURL& url)
-{
- m_private->m_resourceResponse->setAppCacheManifestURL(url);
-}
-
-WebCString WebURLResponse::securityInfo() const
-{
- // FIXME: getSecurityInfo is misnamed.
- return m_private->m_resourceResponse->getSecurityInfo();
-}
-
-void WebURLResponse::setSecurityInfo(const WebCString& securityInfo)
-{
- m_private->m_resourceResponse->setSecurityInfo(securityInfo);
-}
-
-ResourceResponse& WebURLResponse::toMutableResourceResponse()
-{
- ASSERT(m_private);
- ASSERT(m_private->m_resourceResponse);
-
- return *m_private->m_resourceResponse;
-}
-
-const ResourceResponse& WebURLResponse::toResourceResponse() const
-{
- ASSERT(m_private);
- ASSERT(m_private->m_resourceResponse);
-
- return *m_private->m_resourceResponse;
-}
-
-bool WebURLResponse::wasCached() const
-{
- return m_private->m_resourceResponse->wasCached();
-}
-
-void WebURLResponse::setWasCached(bool value)
-{
- m_private->m_resourceResponse->setWasCached(value);
-}
-
-bool WebURLResponse::wasFetchedViaSPDY() const
-{
- return m_private->m_resourceResponse->wasFetchedViaSPDY();
-}
-
-void WebURLResponse::setWasFetchedViaSPDY(bool value)
-{
- m_private->m_resourceResponse->setWasFetchedViaSPDY(value);
-}
-
-bool WebURLResponse::wasNpnNegotiated() const
-{
- return m_private->m_resourceResponse->wasNpnNegotiated();
-}
-
-void WebURLResponse::setWasNpnNegotiated(bool value)
-{
- m_private->m_resourceResponse->setWasNpnNegotiated(value);
-}
-
-bool WebURLResponse::wasAlternateProtocolAvailable() const
-{
- return m_private->m_resourceResponse->wasAlternateProtocolAvailable();
-}
-
-void WebURLResponse::setWasAlternateProtocolAvailable(bool value)
-{
- m_private->m_resourceResponse->setWasAlternateProtocolAvailable(value);
-}
-
-bool WebURLResponse::wasFetchedViaProxy() const
-{
- return m_private->m_resourceResponse->wasFetchedViaProxy();
-}
-
-void WebURLResponse::setWasFetchedViaProxy(bool value)
-{
- m_private->m_resourceResponse->setWasFetchedViaProxy(value);
-}
-
-bool WebURLResponse::isMultipartPayload() const
-{
- return m_private->m_resourceResponse->isMultipartPayload();
-}
-
-void WebURLResponse::setIsMultipartPayload(bool value)
-{
- m_private->m_resourceResponse->setIsMultipartPayload(value);
-}
-
-WebString WebURLResponse::downloadFilePath() const
-{
- const File* downloadedFile = m_private->m_resourceResponse->downloadedFile();
- if (downloadedFile)
- return downloadedFile->path();
- return WebString();
-}
-
-void WebURLResponse::setDownloadFilePath(const WebString& downloadFilePath)
-{
- m_private->m_resourceResponse->setDownloadedFile(downloadFilePath.isEmpty() ? 0 : File::create(downloadFilePath));
-}
-
-WebString WebURLResponse::remoteIPAddress() const
-{
- return m_private->m_resourceResponse->remoteIPAddress();
-}
-
-void WebURLResponse::setRemoteIPAddress(const WebString& remoteIPAddress)
-{
- m_private->m_resourceResponse->setRemoteIPAddress(remoteIPAddress);
-}
-
-unsigned short WebURLResponse::remotePort() const
-{
- return m_private->m_resourceResponse->remotePort();
-}
-
-void WebURLResponse::setRemotePort(unsigned short remotePort)
-{
- m_private->m_resourceResponse->setRemotePort(remotePort);
-}
-
-WebURLResponse::ExtraData* WebURLResponse::extraData() const
-{
- RefPtr<ResourceResponse::ExtraData> data = m_private->m_resourceResponse->extraData();
- if (!data)
- return 0;
- return static_cast<ExtraDataContainer*>(data.get())->extraData();
-}
-
-void WebURLResponse::setExtraData(WebURLResponse::ExtraData* extraData)
-{
- m_private->m_resourceResponse->setExtraData(ExtraDataContainer::create(extraData));
-}
-
-void WebURLResponse::assign(WebURLResponsePrivate* p)
-{
- // Subclasses may call this directly so a self-assignment check is needed
- // here as well as in the public assign method.
- if (m_private == p)
- return;
- if (m_private)
- m_private->dispose();
- m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp
index 5a76c83b0..dcd270385 100644
--- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp
+++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp
@@ -70,16 +70,6 @@ bool WebUserMediaRequest::video() const
return m_private->video();
}
-bool WebUserMediaRequest::cameraPreferenceUser() const
-{
- return m_private->cameraPreferenceUser();
-}
-
-bool WebUserMediaRequest::cameraPreferenceEnvironment() const
-{
- return m_private->cameraPreferenceEnvironment();
-}
-
WebSecurityOrigin WebUserMediaRequest::securityOrigin() const
{
ASSERT(m_private->scriptExecutionContext());
@@ -105,24 +95,6 @@ void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>
m_private->succeed(audio, video);
}
-// FIXME: Cleanup when the chromium code has switched to the split sources implementation.
-void WebUserMediaRequest::requestSucceeded(const WebVector<WebMediaStreamSource>& sources)
-{
- if (m_private.isNull())
- return;
-
- MediaStreamSourceVector audio, video;
- for (size_t i = 0; i < sources.size(); ++i) {
- MediaStreamSource* curr = sources[i];
- if (curr->type() == MediaStreamSource::TypeAudio)
- audio.append(curr);
- else if (curr->type() == MediaStreamSource::TypeVideo)
- video.append(curr);
- }
-
- m_private->succeed(audio, video);
-}
-
void WebUserMediaRequest::requestFailed()
{
m_private->fail();
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebVideoLayer.cpp
index 7b73e7080..0f342155d 100644
--- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebVideoLayer.cpp
@@ -23,24 +23,25 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebExternalTextureLayerImpl_h
-#define WebExternalTextureLayerImpl_h
-
-#include "PluginLayerChromium.h"
-#include <wtf/PassRefPtr.h>
+#include "config.h"
+#include "VideoLayerChromium.h"
+#include <public/WebVideoLayer.h>
namespace WebKit {
-class WebExternalTextureLayerImpl : public WebCore::PluginLayerChromium {
-public:
- static PassRefPtr<WebExternalTextureLayerImpl> create();
+WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+ return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
+}
-protected:
- WebExternalTextureLayerImpl();
- virtual ~WebExternalTextureLayerImpl();
- virtual bool drawsContent() const;
-};
+WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
+ : WebLayer(layer)
+{
+}
-} // namespace WebKit
+bool WebVideoLayer::active() const
+{
+ return m_private->layerTreeHost();
+}
-#endif // WebExternalTextureLayerImpl_h
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
index 52a022ce9..4318dc79d 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
@@ -31,13 +31,14 @@
#include "config.h"
#include "WebViewImpl.h"
-#include "AutofillPopupMenuClient.h"
#include "AXObjectCache.h"
+#include "ActivePlatformGestureAnimation.h"
+#include "AutofillPopupMenuClient.h"
#include "BackForwardListChromium.h"
-#include "cc/CCProxy.h"
-#include "CSSStyleSelector.h"
+#include "BatteryClientImpl.h"
#include "CSSValueKeywords.h"
#include "Chrome.h"
+#include "Color.h"
#include "ColorSpace.h"
#include "CompositionUnderlineVectorBuilder.h"
#include "ContextMenu.h"
@@ -63,6 +64,7 @@
#include "FrameTree.h"
#include "FrameView.h"
#include "GeolocationClientProxy.h"
+#include "GeolocationController.h"
#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
@@ -85,6 +87,8 @@
#include "Page.h"
#include "PageGroup.h"
#include "PageGroupLoadDeferrer.h"
+#include "PagePopupClient.h"
+#include "PageWidgetDelegate.h"
#include "Pasteboard.h"
#include "PlatformContextSkia.h"
#include "PlatformKeyboardEvent.h"
@@ -106,46 +110,55 @@
#include "Settings.h"
#include "SharedGraphicsContext3D.h"
#include "SpeechInputClientImpl.h"
+#include "SpeechRecognitionClientProxy.h"
+#include "StyleResolver.h"
+#include "TextFieldDecoratorImpl.h"
#include "TextIterator.h"
#include "Timer.h"
+#include "TouchpadFlingPlatformGestureCurve.h"
#include "TraceEvent.h"
-#include "TypingCommand.h"
#include "UserGestureIndicator.h"
-#include "Vector.h"
#include "WebAccessibilityObject.h"
+#include "WebActiveWheelFlingParameters.h"
#include "WebAutofillClient.h"
#include "WebCompositorImpl.h"
#include "WebDevToolsAgentImpl.h"
#include "WebDevToolsAgentPrivate.h"
-#include "platform/WebDragData.h"
#include "WebFrameImpl.h"
-#include "platform/WebGraphicsContext3D.h"
-#include "platform/WebImage.h"
#include "WebInputElement.h"
#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
#include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "platform/WebLayer.h"
-#include "platform/WebLayerTreeView.h"
#include "WebMediaPlayerAction.h"
#include "WebNode.h"
+#include "WebPagePopupImpl.h"
#include "WebPlugin.h"
#include "WebPluginAction.h"
#include "WebPluginContainerImpl.h"
-#include "platform/WebPoint.h"
#include "WebPopupMenuImpl.h"
#include "WebRange.h"
-#include "platform/WebRect.h"
#include "WebRuntimeFeatures.h"
#include "WebSettingsImpl.h"
+#include "WebViewClient.h"
+#include "WheelEvent.h"
+#include "cc/CCProxy.h"
+#include "painting/GraphicsContextBuilder.h"
+#include "platform/WebDragData.h"
+#include "platform/WebImage.h"
+#include "platform/WebKitPlatformSupport.h"
#include "platform/WebString.h"
#include "platform/WebVector.h"
-#include "WebViewClient.h"
-#include <wtf/ByteArray.h>
+#include <public/Platform.h>
+#include <public/WebFloatPoint.h>
+#include <public/WebGraphicsContext3D.h>
+#include <public/WebLayer.h>
+#include <public/WebLayerTreeView.h>
+#include <public/WebPoint.h>
+#include <public/WebRect.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
#include <wtf/RefPtr.h>
+#include <wtf/Uint8ClampedArray.h>
#if ENABLE(GESTURE_EVENTS)
#include "PlatformGestureEvent.h"
@@ -176,7 +189,7 @@ using namespace std;
// (such as due to a double tap gesture or find in page etc.). These are
// experimentally determined.
static const int touchPointPadding = 32;
-static const float minScaleDifference = 0.01;
+static const float minScaleDifference = 0.01f;
static const float doubleTapZoomContentDefaultMargin = 5;
static const float doubleTapZoomContentMinimumMargin = 2;
@@ -313,6 +326,18 @@ void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient)
m_spellCheckClient = spellCheckClient;
}
+void WebViewImpl::addTextFieldDecoratorClient(WebTextFieldDecoratorClient* client)
+{
+ ASSERT(client);
+ // We limit the number of decorators because it affects performance of text
+ // field creation. If you'd like to add more decorators, consider moving
+ // your decorator or existing decorators to WebCore.
+ const unsigned maximumNumberOfDecorators = 8;
+ if (m_textFieldDecorators.size() >= maximumNumberOfDecorators)
+ CRASH();
+ m_textFieldDecorators.append(TextFieldDecoratorImpl::create(client));
+}
+
WebViewImpl::WebViewImpl(WebViewClient* client)
: m_client(client)
, m_autofillClient(0)
@@ -349,20 +374,30 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_isTransparent(false)
, m_tabsToLinks(false)
, m_dragScrollTimer(adoptPtr(new DragScrollTimer))
+ , m_isCancelingFullScreen(false)
#if USE(ACCELERATED_COMPOSITING)
, m_rootGraphicsLayer(0)
, m_isAcceleratedCompositingActive(false)
, m_compositorCreationFailed(false)
, m_recreatingGraphicsContext(false)
+ , m_compositorSurfaceReady(false)
#endif
#if ENABLE(INPUT_SPEECH)
, m_speechInputClient(SpeechInputClientImpl::create(client))
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ , m_speechRecognitionClient(SpeechRecognitionClientProxy::create(client ? client->speechRecognizer() : 0))
+#endif
, m_deviceOrientationClientProxy(adoptPtr(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0)))
, m_geolocationClientProxy(adoptPtr(new GeolocationClientProxy(client ? client->geolocationClient() : 0)))
+#if ENABLE(BATTERY_STATUS)
+ , m_batteryClient(adoptPtr(new BatteryClientImpl(client ? client->batteryStatusClient() : 0)))
+#endif
+ , m_emulatedTextZoomFactor(1)
#if ENABLE(MEDIA_STREAM)
, m_userMediaClientImpl(this)
#endif
+ , m_flingModifier(0)
{
// WebKit/win/WebView.cpp does the same thing, except they call the
// KJS specific wrapper around this method. We need to have threading
@@ -370,16 +405,12 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
WTF::initializeThreading();
WTF::initializeMainThread();
- // set to impossible point so we always get the first mouse pos
- m_lastMousePosition = WebPoint(-1, -1);
-
Page::PageClients pageClients;
pageClients.chromeClient = &m_chromeClientImpl;
pageClients.contextMenuClient = &m_contextMenuClientImpl;
pageClients.editorClient = &m_editorClientImpl;
pageClients.dragClient = &m_dragClientImpl;
pageClients.inspectorClient = &m_inspectorClientImpl;
- pageClients.geolocationClient = m_geolocationClientProxy.get();
pageClients.backForwardClient = BackForwardListChromium::create(this);
m_page = adoptPtr(new Page(pageClients));
@@ -389,13 +420,21 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
#if ENABLE(INPUT_SPEECH)
provideSpeechInputTo(m_page.get(), m_speechInputClient.get());
#endif
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(SCRIPTED_SPEECH)
+ provideSpeechRecognitionTo(m_page.get(), m_speechRecognitionClient.get());
+#endif
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
provideNotification(m_page.get(), notificationPresenterImpl());
#endif
provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
- m_geolocationClientProxy->setController(m_page->geolocationController());
+ provideGeolocationTo(m_page.get(), m_geolocationClientProxy.get());
+ m_geolocationClientProxy->setController(GeolocationController::from(m_page.get()));
+#if ENABLE(BATTERY_STATUS)
+ provideBatteryTo(m_page.get(), m_batteryClient.get());
+#endif
+
m_page->setGroupName(pageGroupName);
#if ENABLE(PAGE_VISIBILITY_API)
@@ -433,38 +472,14 @@ void WebViewImpl::setTabKeyCyclesThroughElements(bool value)
m_page->setTabKeyCyclesThroughElements(value);
}
-void WebViewImpl::mouseMove(const WebMouseEvent& event)
+void WebViewImpl::handleMouseLeave(Frame& mainFrame, const WebMouseEvent& event)
{
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return;
-
- m_lastMousePosition = WebPoint(event.x, event.y);
-
- // We call mouseMoved here instead of handleMouseMovedEvent because we need
- // our ChromeClientImpl to receive changes to the mouse position and
- // tooltip text, and mouseMoved handles all of that.
- mainFrameImpl()->frame()->eventHandler()->mouseMoved(
- PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
-}
-
-void WebViewImpl::mouseLeave(const WebMouseEvent& event)
-{
- // This event gets sent as the main frame is closing. In that case, just
- // ignore it.
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return;
-
m_client->setMouseOverURL(WebURL());
-
- mainFrameImpl()->frame()->eventHandler()->handleMouseMoveEvent(
- PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
+ PageWidgetEventHandler::handleMouseLeave(mainFrame, event);
}
-void WebViewImpl::mouseDown(const WebMouseEvent& event)
+void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event)
{
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return;
-
// If there is a select popup open, close it as the user is clicking on
// the page (outside of the popup). We also save it so we can prevent a
// click on the select element from immediately reopening the popup.
@@ -488,8 +503,7 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
m_mouseCaptureNode = hitNode;
}
- mainFrameImpl()->frame()->eventHandler()->handleMousePressEvent(
- PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
+ PageWidgetEventHandler::handleMouseDown(mainFrame, event);
if (m_selectPopup && m_selectPopup == selectPopup) {
// That click triggered a select popup which is the same as the one that
@@ -540,11 +554,8 @@ void WebViewImpl::mouseContextMenu(const WebMouseEvent& event)
// implementation...
}
-void WebViewImpl::mouseUp(const WebMouseEvent& event)
+void WebViewImpl::handleMouseUp(Frame& mainFrame, const WebMouseEvent& event)
{
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return;
-
#if OS(UNIX) && !OS(DARWIN)
// If the event was a middle click, attempt to copy text into the focused
// frame. We execute this before we let the page have a go at the event
@@ -582,8 +593,7 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event)
}
#endif
- mainFrameImpl()->frame()->eventHandler()->handleMouseReleaseEvent(
- PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
+ PageWidgetEventHandler::handleMouseUp(mainFrame, event);
#if OS(WINDOWS)
// Dispatch the contextmenu event regardless of if the click was swallowed.
@@ -593,17 +603,89 @@ void WebViewImpl::mouseUp(const WebMouseEvent& event)
#endif
}
-bool WebViewImpl::mouseWheel(const WebMouseWheelEvent& event)
+void WebViewImpl::scrollBy(const WebCore::IntPoint& delta)
{
- PlatformWheelEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
- return mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent);
+ WebMouseWheelEvent syntheticWheel;
+ const float tickDivisor = WebCore::WheelEvent::tickMultiplier;
+
+ syntheticWheel.deltaX = delta.x();
+ syntheticWheel.deltaY = delta.y();
+ syntheticWheel.wheelTicksX = delta.x() / tickDivisor;
+ syntheticWheel.wheelTicksY = delta.y() / tickDivisor;
+ syntheticWheel.hasPreciseScrollingDeltas = true;
+ syntheticWheel.x = m_lastWheelPosition.x;
+ syntheticWheel.y = m_lastWheelPosition.y;
+ syntheticWheel.globalX = m_lastWheelGlobalPosition.x;
+ syntheticWheel.globalY = m_lastWheelGlobalPosition.y;
+ syntheticWheel.modifiers = m_flingModifier;
+
+ if (m_page && m_page->mainFrame() && m_page->mainFrame()->view())
+ handleMouseWheel(*m_page->mainFrame(), syntheticWheel);
}
#if ENABLE(GESTURE_EVENTS)
-bool WebViewImpl::gestureEvent(const WebGestureEvent& event)
+bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
+{
+ switch (event.type) {
+ case WebInputEvent::GestureFlingStart: {
+ m_lastWheelPosition = WebPoint(event.x, event.y);
+ m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY);
+ m_flingModifier = event.modifiers;
+ // FIXME: Make the curve parametrizable from the browser.
+ m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this);
+ scheduleAnimation();
+ return true;
+ }
+ case WebInputEvent::GestureFlingCancel:
+ if (m_gestureAnimation) {
+ m_gestureAnimation.clear();
+ return true;
+ }
+ return false;
+ case WebInputEvent::GestureTap: {
+ PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
+ RefPtr<WebCore::PopupContainer> selectPopup;
+ selectPopup = m_selectPopup;
+ hideSelectPopup();
+ ASSERT(!m_selectPopup);
+ bool gestureHandled = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent);
+ if (m_selectPopup && m_selectPopup == selectPopup) {
+ // That tap triggered a select popup which is the same as the one that
+ // was showing before the tap. It means the user tapped the select
+ // while the popup was showing, and as a result we first closed then
+ // immediately reopened the select popup. It needs to be closed.
+ hideSelectPopup();
+ }
+ return gestureHandled;
+ }
+ case WebInputEvent::GestureScrollBegin:
+ case WebInputEvent::GestureScrollEnd:
+ case WebInputEvent::GestureScrollUpdate:
+ case WebInputEvent::GestureTapDown:
+ case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GestureLongPress:
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate: {
+ PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
+ return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent);
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return false;
+}
+
+void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters& parameters)
{
- PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
- return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent);
+ TRACE_EVENT0("webkit", "WebViewImpl::transferActiveWheelFlingAnimation");
+ ASSERT(!m_gestureAnimation);
+ m_lastWheelPosition = parameters.point;
+ m_lastWheelGlobalPosition = parameters.globalPoint;
+ m_flingModifier = parameters.modifiers;
+ OwnPtr<PlatformGestureCurve> curve = TouchpadFlingPlatformGestureCurve::create(parameters.delta, IntPoint(parameters.cumulativeScroll));
+ m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, parameters.startTime);
+ scheduleAnimation();
}
void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec)
@@ -613,12 +695,16 @@ void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor
}
#endif
-bool WebViewImpl::keyEvent(const WebKeyboardEvent& event)
+bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
{
ASSERT((event.type == WebInputEvent::RawKeyDown)
|| (event.type == WebInputEvent::KeyDown)
|| (event.type == WebInputEvent::KeyUp));
+ // Halt an in-progress fling on a key event.
+ if (m_gestureAnimation)
+ m_gestureAnimation.clear();
+
// Please refer to the comments explaining the m_suppressNextKeypressEvent
// member.
// The m_suppressNextKeypressEvent is set if the KeyDown is handled by
@@ -631,6 +717,16 @@ bool WebViewImpl::keyEvent(const WebKeyboardEvent& event)
// not the page.
if (m_selectPopup)
return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
+#if ENABLE(PAGE_POPUP)
+ if (m_pagePopup) {
+ m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
+ // We need to ignore the next Char event after this otherwise pressing
+ // enter when selecting an item in the popup will go to the page.
+ if (WebInputEvent::RawKeyDown == event.type)
+ m_suppressNextKeypressEvent = true;
+ return true;
+ }
+#endif
// Give Autocomplete a chance to consume the key events it is interested in.
if (autocompleteHandleKeyEvent(event))
@@ -727,7 +823,7 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
return false;
}
-bool WebViewImpl::charEvent(const WebKeyboardEvent& event)
+bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event)
{
ASSERT(event.type == WebInputEvent::Char);
@@ -743,6 +839,10 @@ bool WebViewImpl::charEvent(const WebKeyboardEvent& event)
// not the page.
if (m_selectPopup)
return m_selectPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
+#if ENABLE(PAGE_POPUP)
+ if (m_pagePopup)
+ return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event));
+#endif
Frame* frame = focusedWebCoreFrame();
if (!frame)
@@ -773,18 +873,6 @@ bool WebViewImpl::charEvent(const WebKeyboardEvent& event)
return true;
}
-#if ENABLE(TOUCH_EVENTS)
-bool WebViewImpl::touchEvent(const WebTouchEvent& event)
-{
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return false;
-
- PlatformTouchEventBuilder touchEventBuilder(mainFrameImpl()->frameView(), event);
- bool defaultPrevented = mainFrameImpl()->frame()->eventHandler()->handleTouchEvent(touchEventBuilder);
- return defaultPrevented;
-}
-#endif
-
#if ENABLE(GESTURE_EVENTS)
WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomType)
{
@@ -807,7 +895,7 @@ WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomTy
// Return the bounding box in the window coordinate system.
if (node) {
- IntRect rect = node->Node::getRect();
+ IntRect rect = node->Node::getPixelSnappedRect();
Frame* frame = node->document()->frame();
return frame->view()->contentsToWindow(rect);
}
@@ -1105,6 +1193,42 @@ void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer)
}
}
+#if ENABLE(PAGE_POPUP)
+PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView)
+{
+ ASSERT(client);
+ if (hasOpenedPopup())
+ hidePopups();
+ ASSERT(!m_pagePopup);
+
+ WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
+ ASSERT(popupWidget);
+ m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget);
+ if (!m_pagePopup->init(this, client, originBoundsInRootView)) {
+ m_pagePopup->closePopup();
+ m_pagePopup = 0;
+ }
+
+ if (Frame* frame = focusedWebCoreFrame())
+ frame->selection()->setCaretVisible(false);
+ return m_pagePopup.get();
+}
+
+void WebViewImpl::closePagePopup(PagePopup* popup)
+{
+ ASSERT(popup);
+ WebPagePopupImpl* popupImpl = static_cast<WebPagePopupImpl*>(popup);
+ ASSERT(m_pagePopup.get() == popupImpl);
+ if (m_pagePopup.get() != popupImpl)
+ return;
+ m_pagePopup->closePopup();
+ m_pagePopup = 0;
+
+ if (Frame* frame = focusedWebCoreFrame())
+ frame->selection()->pageActivationChanged();
+}
+#endif
+
void WebViewImpl::hideAutofillPopup()
{
if (m_autofillPopupShowing) {
@@ -1171,8 +1295,14 @@ void WebViewImpl::resize(const WebSize& newSize)
return;
m_size = newSize;
- if (mainFrameImpl()->frameView())
- mainFrameImpl()->frameView()->resize(m_size.width, m_size.height);
+ WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
+ if (agentPrivate && agentPrivate->metricsOverridden())
+ agentPrivate->webViewResized();
+ else {
+ WebFrameImpl* webFrame = mainFrameImpl();
+ if (webFrame->frameView())
+ webFrame->frameView()->resize(newSize.width, newSize.height);
+ }
sendResizeEventAndRepaint();
}
@@ -1224,8 +1354,14 @@ void WebViewImpl::willExitFullScreen()
return;
if (Document* doc = m_fullScreenFrame->document()) {
- if (doc->webkitIsFullScreen())
+ if (doc->webkitIsFullScreen()) {
+ // When the client exits from full screen we have to call webkitCancelFullScreen to
+ // notify the document. While doing that, suppress notifications back to the client.
+ m_isCancelingFullScreen = true;
+ doc->webkitCancelFullScreen();
+ m_isCancelingFullScreen = false;
doc->webkitWillExitFullScreenForElement(0);
+ }
}
#endif
}
@@ -1250,61 +1386,71 @@ void WebViewImpl::instrumentBeginFrame()
InspectorInstrumentation::didBeginFrame(m_page.get());
}
-void WebViewImpl::animate(double frameBeginTime)
+void WebViewImpl::instrumentCancelFrame()
+{
+ InspectorInstrumentation::didCancelFrame(m_page.get());
+}
+
+#if ENABLE(BATTERY_STATUS)
+void WebViewImpl::updateBatteryStatus(const WebBatteryStatus& status)
+{
+ m_batteryClient->updateBatteryStatus(status);
+}
+#endif
+
+void WebViewImpl::setCompositorSurfaceReady()
+{
+ m_compositorSurfaceReady = true;
+ if (!m_layerTreeView.isNull())
+ m_layerTreeView.setSurfaceReady();
+}
+
+void WebViewImpl::animate(double)
{
#if ENABLE(REQUEST_ANIMATION_FRAME)
- // FIXME: remove this zero-check once render_widget has been modified to
- // pass in a frameBeginTime.
- if (!frameBeginTime)
- frameBeginTime = currentTime();
+ double monotonicFrameBeginTime = monotonicallyIncreasingTime();
#if USE(ACCELERATED_COMPOSITING)
// In composited mode, we always go through the compositor so it can apply
// appropriate flow-control mechanisms.
if (isAcceleratedCompositingActive())
- m_layerTreeView.updateAnimations(frameBeginTime);
+ m_layerTreeView.updateAnimations(monotonicFrameBeginTime);
else
#endif
- updateAnimations(frameBeginTime);
+ updateAnimations(monotonicFrameBeginTime);
#endif
}
-void WebViewImpl::updateAnimations(double frameBeginTime)
+void WebViewImpl::willBeginFrame()
+{
+ instrumentBeginFrame();
+ m_client->willBeginCompositorFrame();
+}
+
+void WebViewImpl::updateAnimations(double monotonicFrameBeginTime)
{
#if ENABLE(REQUEST_ANIMATION_FRAME)
TRACE_EVENT("WebViewImpl::updateAnimations", this, 0);
- WebFrameImpl* webframe = mainFrameImpl();
- if (!webframe)
- return;
- FrameView* view = webframe->frameView();
- if (!view)
+ // Create synthetic wheel events as necessary for fling.
+ if (m_gestureAnimation) {
+ if (m_gestureAnimation->animate(monotonicFrameBeginTime))
+ scheduleAnimation();
+ else
+ m_gestureAnimation.clear();
+ }
+
+ if (!m_page)
return;
- view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime));
+
+ PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime);
#endif
}
void WebViewImpl::layout()
{
TRACE_EVENT("WebViewImpl::layout", this, 0);
-
- WebFrameImpl* webframe = mainFrameImpl();
- if (webframe) {
- // In order for our child HWNDs (NativeWindowWidgets) to update properly,
- // they need to be told that we are updating the screen. The problem is
- // that the native widgets need to recalculate their clip region and not
- // overlap any of our non-native widgets. To force the resizing, call
- // setFrameRect(). This will be a quick operation for most frames, but
- // the NativeWindowWidgets will update a proper clipping region.
- FrameView* view = webframe->frameView();
- if (view)
- view->setFrameRect(view->frameRect());
-
- // setFrameRect may have the side-effect of causing existing page
- // layout to be invalidated, so layout needs to be called last.
-
- webframe->layout();
- }
+ PageWidgetDelegate::layout(m_page.get());
}
#if USE(ACCELERATED_COMPOSITING)
@@ -1327,7 +1473,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect
IntRect invertRect(rect.x(), bitmapHeight - rect.maxY(), rect.width(), rect.height());
OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size()));
- RefPtr<ByteArray> pixelArray(ByteArray::create(rect.width() * rect.height() * 4));
+ RefPtr<Uint8ClampedArray> pixelArray(Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4));
if (imageBuffer && pixelArray) {
m_layerTreeView.compositeAndReadback(pixelArray->data(), invertRect);
imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint());
@@ -1357,13 +1503,11 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
#endif
} else {
double paintStart = currentTime();
- WebFrameImpl* webframe = mainFrameImpl();
- if (webframe)
- webframe->paint(canvas, rect);
+ PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect);
double paintEnd = currentTime();
double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart);
- PlatformSupport::histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
- PlatformSupport::histogramCustomCounts("Renderer4.SoftwarePaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
+ WebKit::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
+ WebKit::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
}
}
@@ -1403,6 +1547,15 @@ void WebViewImpl::setNeedsRedraw()
#endif
}
+bool WebViewImpl::isInputThrottled() const
+{
+#if USE(ACCELERATED_COMPOSITING)
+ if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive())
+ return m_layerTreeView.commitRequested();
+#endif
+ return false;
+}
+
void WebViewImpl::loseCompositorContext(int numTimes)
{
#if USE(ACCELERATED_COMPOSITING)
@@ -1427,6 +1580,15 @@ void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)
return;
}
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+ if (element && element->isMediaElement()) {
+ HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element);
+ if (mediaElement->player() && mediaElement->player()->enterFullscreen())
+ m_provisionalFullScreenElement = element;
+ return;
+ }
+#endif
+
// We need to transition to fullscreen mode.
if (m_client && m_client->enterFullScreen())
m_provisionalFullScreenElement = element;
@@ -1434,6 +1596,17 @@ void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)
void WebViewImpl::exitFullScreenForElement(WebCore::Element* element)
{
+ // The client is exiting full screen, so don't send a notification.
+ if (m_isCancelingFullScreen)
+ return;
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+ if (element && element->isMediaElement()) {
+ HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(element);
+ if (mediaElement->player())
+ mediaElement->player()->exitFullscreen();
+ return;
+ }
+#endif
if (m_client)
m_client->exitFullScreen();
}
@@ -1504,79 +1677,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
return true;
}
- bool handled = true;
-
- // FIXME: WebKit seems to always return false on mouse events processing
- // methods. For now we'll assume it has processed them (as we are only
- // interested in whether keyboard events are processed).
- switch (inputEvent.type) {
- case WebInputEvent::MouseMove:
- mouseMove(*static_cast<const WebMouseEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::MouseLeave:
- mouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::MouseWheel:
- handled = mouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::MouseDown:
- mouseDown(*static_cast<const WebMouseEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::MouseUp:
- mouseUp(*static_cast<const WebMouseEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::RawKeyDown:
- case WebInputEvent::KeyDown:
- case WebInputEvent::KeyUp:
- handled = keyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent));
- break;
-
- case WebInputEvent::Char:
- handled = charEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent));
- break;
-
-#if ENABLE(GESTURE_EVENTS)
- case WebInputEvent::GestureScrollBegin:
- case WebInputEvent::GestureScrollEnd:
- case WebInputEvent::GestureScrollUpdate:
- case WebInputEvent::GestureFlingStart:
- case WebInputEvent::GestureFlingCancel:
- case WebInputEvent::GestureTap:
- case WebInputEvent::GestureTapDown:
- case WebInputEvent::GestureDoubleTap:
- handled = gestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent));
- break;
-#endif
-
-#if ENABLE(TOUCH_EVENTS)
- case WebInputEvent::TouchStart:
- case WebInputEvent::TouchMove:
- case WebInputEvent::TouchEnd:
- case WebInputEvent::TouchCancel:
- handled = touchEvent(*static_cast<const WebTouchEvent*>(&inputEvent));
- break;
-#endif
-
-#if ENABLE(GESTURE_EVENTS)
- case WebInputEvent::GesturePinchBegin:
- case WebInputEvent::GesturePinchEnd:
- case WebInputEvent::GesturePinchUpdate:
- // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll.
- handled = false;
- break;
-#endif
-
- default:
- handled = false;
- }
-
+ bool handled = PageWidgetDelegate::handleInputEvent(m_page.get(), *this, inputEvent);
m_currentInputEvent = 0;
-
return handled;
}
@@ -1615,8 +1717,7 @@ void WebViewImpl::setFocus(bool enable)
}
m_imeAcceptEvents = true;
} else {
- hideAutofillPopup();
- hideSelectPopup();
+ hidePopups();
// Clear focus on the currently focused frame if any.
if (!m_page)
@@ -2103,9 +2204,9 @@ double WebViewImpl::setZoomLevel(bool textOnly, double zoomLevel)
else {
float zoomFactor = static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel));
if (textOnly)
- frame->setPageAndTextZoomFactors(1, zoomFactor);
+ frame->setPageAndTextZoomFactors(1, zoomFactor * m_emulatedTextZoomFactor);
else
- frame->setPageAndTextZoomFactors(zoomFactor, 1);
+ frame->setPageAndTextZoomFactors(zoomFactor, m_emulatedTextZoomFactor);
}
return m_zoomLevel;
}
@@ -2263,14 +2364,6 @@ void WebViewImpl::disableAutoResizeMode()
configureAutoResizeMode();
}
-void WebViewImpl::enableAutoResizeMode(bool enable, const WebSize& minSize, const WebSize& maxSize)
-{
- if (enable)
- enableAutoResizeMode(minSize, maxSize);
- else
- disableAutoResizeMode();
-}
-
void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScale)
{
m_pageDefinedMinimumPageScaleFactor = minPageScale;
@@ -2658,12 +2751,11 @@ void WebViewImpl::applyAutofillSuggestions(
const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
+ const WebVector<int>& itemIDs,
int separatorIndex)
{
ASSERT(names.size() == labels.size());
- ASSERT(names.size() == uniqueIDs.size());
- ASSERT(separatorIndex < static_cast<int>(names.size()));
+ ASSERT(names.size() == itemIDs.size());
if (names.isEmpty()) {
hideAutofillPopup();
@@ -2688,19 +2780,24 @@ void WebViewImpl::applyAutofillSuggestions(
m_autofillPopupClient = adoptPtr(new AutofillPopupMenuClient);
m_autofillPopupClient->initialize(
- inputElem, names, labels, icons, uniqueIDs, separatorIndex);
+ inputElem, names, labels, icons, itemIDs, separatorIndex);
if (!m_autofillPopup) {
+ PopupContainerSettings popupSettings = autofillPopupSettings;
+ popupSettings.defaultDeviceScaleFactor =
+ m_page->settings()->defaultDeviceScaleFactor();
+ if (!popupSettings.defaultDeviceScaleFactor)
+ popupSettings.defaultDeviceScaleFactor = 1;
m_autofillPopup = PopupContainer::create(m_autofillPopupClient.get(),
PopupContainer::Suggestion,
- autofillPopupSettings);
+ popupSettings);
}
if (m_autofillPopupShowing) {
refreshAutofillPopup();
} else {
- m_autofillPopup->showInRect(focusedNode->getRect(), focusedNode->ownerDocument()->view(), 0);
m_autofillPopupShowing = true;
+ m_autofillPopup->showInRect(focusedNode->getPixelSnappedRect(), focusedNode->ownerDocument()->view(), 0);
}
}
@@ -2708,6 +2805,10 @@ void WebViewImpl::hidePopups()
{
hideSelectPopup();
hideAutofillPopup();
+#if ENABLE(PAGE_POPUP)
+ if (m_pagePopup)
+ closePagePopup(m_pagePopup.get());
+#endif
}
void WebViewImpl::performCustomContextMenuAction(unsigned action)
@@ -2837,6 +2938,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa
m_observedNewNavigation = false;
if (!isNavigationWithinPage)
m_pageScaleFactorIsSet = false;
+
+ m_gestureAnimation.clear();
}
void WebViewImpl::layoutUpdated(WebFrameImpl* webframe)
@@ -2876,6 +2979,14 @@ bool WebViewImpl::useExternalPopupMenus()
return shouldUseExternalPopupMenus;
}
+void WebViewImpl::setEmulatedTextZoomFactor(float textZoomFactor)
+{
+ m_emulatedTextZoomFactor = textZoomFactor;
+ Frame* frame = mainFrameImpl()->frame();
+ if (frame)
+ frame->setPageAndTextZoomFactors(frame->pageZoomFactor(), m_emulatedTextZoomFactor);
+}
+
bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button,
bool ctrl, bool shift,
bool alt, bool meta,
@@ -2952,7 +3063,7 @@ void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer)
}
}
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
NotificationPresenterImpl* WebViewImpl::notificationPresenterImpl()
{
if (!m_notificationPresenter.isInitialized() && m_client)
@@ -2971,16 +3082,11 @@ void WebViewImpl::refreshAutofillPopup()
return;
}
- IntRect oldBounds = m_autofillPopup->frameRect();
- m_autofillPopup->refresh(focusedWebCoreNode()->getRect());
- IntRect newBounds = m_autofillPopup->frameRect();
+ WebRect newWidgetRect = m_autofillPopup->refresh(focusedWebCoreNode()->getPixelSnappedRect());
// Let's resize the backing window if necessary.
- if (oldBounds != newBounds) {
- WebPopupMenuImpl* popupMenu =
- static_cast<WebPopupMenuImpl*>(m_autofillPopup->client());
- if (popupMenu)
- popupMenu->client()->setWindowRect(m_chromeClientImpl.rootViewToScreen(newBounds));
- }
+ WebPopupMenuImpl* popupMenu = static_cast<WebPopupMenuImpl*>(m_autofillPopup->client());
+ if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect)
+ popupMenu->client()->setWindowRect(newWidgetRect);
}
Node* WebViewImpl::focusedWebCoreNode()
@@ -3089,6 +3195,14 @@ NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
return m_nonCompositedContentHost.get();
}
+void WebViewImpl::setBackgroundColor(const WebCore::Color& color)
+{
+ WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore::Color::white;
+ WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb();
+ m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor);
+ m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor);
+}
+
#if ENABLE(REQUEST_ANIMATION_FRAME)
void WebViewImpl::scheduleAnimation()
{
@@ -3121,11 +3235,10 @@ public:
view->paintContents(&context, contentRect);
double paintEnd = currentTime();
double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
- PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
- PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
-
- m_webViewImpl->nonCompositedContentHost()->setBackgroundColor(view->documentBackgroundColor());
+ 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:
@@ -3139,7 +3252,7 @@ private:
void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
{
- PlatformSupport::histogramEnumeration("GPU.setIsAcceleratedCompositingActive", active * 2 + m_isAcceleratedCompositingActive, 4);
+ WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompositingActive", active * 2 + m_isAcceleratedCompositingActive, 4);
if (m_isAcceleratedCompositingActive == active)
return;
@@ -3161,7 +3274,6 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
WebLayerTreeView::Settings layerTreeViewSettings;
layerTreeViewSettings.acceleratePainting = page()->settings()->acceleratedDrawingEnabled();
- layerTreeViewSettings.compositeOffscreen = settings()->compositeToTextureEnabled();
layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter();
layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
@@ -3172,12 +3284,11 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
- if (page() && page()->mainFrame()->view())
- m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->view()->documentBackgroundColor());
-
m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings);
if (!m_layerTreeView.isNull()) {
m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
+ if (m_compositorSurfaceReady)
+ m_layerTreeView.setSurfaceReady();
updateLayerTreeViewport();
m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier());
m_isAcceleratedCompositingActive = true;
@@ -3239,9 +3350,10 @@ void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal
if (!mainFrameImpl() || !mainFrameImpl()->frameView())
return;
- if (pageScaleDelta == 1)
+ if (pageScaleDelta == 1) {
+ TRACE_EVENT_INSTANT2("webkit", "WebViewImpl::applyScrollAndScale::scrollBy", "x", scrollDelta.width, "y", scrollDelta.height);
mainFrameImpl()->frameView()->scrollBy(scrollDelta);
- else {
+ } else {
// The page scale changed, so apply a scale and scroll in a single
// operation. The old scroll offset (and passed-in delta) are
// in the old coordinate space, so we first need to multiply them
@@ -3255,6 +3367,12 @@ void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal
}
}
+void WebViewImpl::didCommit()
+{
+ if (m_client)
+ m_client->didBecomeReadyForAdditionalInput();
+}
+
void WebViewImpl::didCommitAndDrawFrame()
{
if (m_client)
@@ -3310,7 +3428,7 @@ void WebViewImpl::updateLayerTreeViewport()
layerAdjustX = -view->contentsSize().width() + view->visibleContentRect(false).width();
}
m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, pageScaleFactor(), layerAdjustX);
- m_layerTreeView.setViewportSize(visibleRect.size());
+ m_layerTreeView.setViewportSize(size());
m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
}
@@ -3343,7 +3461,7 @@ WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D()
if (!m_page->settings()->acceleratedCompositingEnabled() || !allowsAcceleratedCompositing())
return 0;
- return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get());
+ return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get().get());
}
void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
@@ -3354,14 +3472,15 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
#if ENABLE(PAGE_VISIBILITY_API)
ASSERT(visibilityState == WebPageVisibilityStateVisible
|| visibilityState == WebPageVisibilityStateHidden
- || visibilityState == WebPageVisibilityStatePrerender);
+ || visibilityState == WebPageVisibilityStatePrerender
+ || visibilityState == WebPageVisibilityStatePreview);
m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int>(visibilityState)), isInitialState);
#endif
#if USE(ACCELERATED_COMPOSITING)
- if (isAcceleratedCompositingActive()) {
+ if (!m_layerTreeView.isNull()) {
bool visible = visibilityState == WebPageVisibilityStateVisible;
- if (!visible)
+ if (!visible && isAcceleratedCompositingActive())
m_nonCompositedContentHost->protectVisibleTileTextures();
m_layerTreeView.setVisible(visible);
}
diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h
index 3819ecb65..9383ba28d 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.h
+++ b/Source/WebKit/chromium/src/WebViewImpl.h
@@ -52,12 +52,16 @@
#include "IntRect.h"
#include "NotificationPresenterImpl.h"
#include "PageOverlayList.h"
+#include "PageWidgetDelegate.h"
+#include "PlatformGestureCurveTarget.h"
#include "UserMediaClientImpl.h"
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
+class ActivePlatformGestureAnimation;
class ChromiumDataObject;
+class Color;
class DocumentLoader;
class Frame;
class GraphicsContext3D;
@@ -65,23 +69,29 @@ class HistoryItem;
class HitTestResult;
class KeyboardEvent;
class Page;
+class PagePopup;
+class PagePopupClient;
+class PlatformGestureCurveTarget;
class PlatformKeyboardEvent;
class PopupContainer;
class PopupMenuClient;
class Range;
class RenderTheme;
+class TextFieldDecorator;
class Widget;
}
namespace WebKit {
class AutocompletePopupMenuClient;
class AutofillPopupMenuClient;
+class BatteryClientImpl;
class ContextMenuClientImpl;
class DeviceOrientationClientProxy;
class DragScrollTimer;
class GeolocationClientProxy;
class NonCompositedContentHost;
class SpeechInputClientImpl;
+class SpeechRecognitionClientProxy;
class UserMediaClientImpl;
class WebAccessibilityObject;
class WebCompositorImpl;
@@ -89,6 +99,7 @@ class WebDevToolsAgentClient;
class WebDevToolsAgentPrivate;
class WebFrameImpl;
class WebGestureEvent;
+class WebPagePopupImpl;
class WebImage;
class WebKeyboardEvent;
class WebMouseEvent;
@@ -96,7 +107,7 @@ class WebMouseWheelEvent;
class WebSettingsImpl;
class WebTouchEvent;
-class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl> {
+class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget, public PageWidgetEventHandler {
public:
enum AutoZoomType {
DoubleTap,
@@ -113,12 +124,14 @@ public:
virtual void didEnterFullScreen();
virtual void willExitFullScreen();
virtual void didExitFullScreen();
- virtual void animate(double frameBeginTime);
- virtual void layout(); // Also implements CCLayerTreeHostClient::layout()
+ virtual void setCompositorSurfaceReady();
+ virtual void animate(double);
+ virtual void layout(); // Also implements WebLayerTreeViewClient::layout()
virtual void paint(WebCanvas*, const WebRect&);
virtual void themeChanged();
virtual void composite(bool finish);
virtual void setNeedsRedraw();
+ virtual bool isInputThrottled() const;
virtual bool handleInputEvent(const WebInputEvent&);
virtual void mouseCaptureLost();
virtual void setFocus(bool enable);
@@ -140,6 +153,7 @@ public:
virtual void didLosePointerLock();
virtual void didChangeWindowResizerRect();
virtual void instrumentBeginFrame();
+ virtual void instrumentCancelFrame();
// WebView methods:
virtual void initializeMainFrame(WebFrameClient*);
@@ -147,6 +161,7 @@ public:
virtual void setDevToolsAgentClient(WebDevToolsAgentClient*);
virtual void setPermissionClient(WebPermissionClient*);
virtual void setSpellCheckClient(WebSpellCheckClient*);
+ virtual void addTextFieldDecoratorClient(WebTextFieldDecoratorClient*) OVERRIDE;
virtual WebSettings* settings();
virtual WebString pageEncoding() const;
virtual void setPageEncoding(const WebString& encoding);
@@ -192,10 +207,6 @@ public:
const WebSize& minSize,
const WebSize& maxSize);
virtual void disableAutoResizeMode();
- virtual void enableAutoResizeMode(
- bool enable,
- const WebSize& minSize,
- const WebSize& maxSize);
virtual void performMediaPlayerAction(
const WebMediaPlayerAction& action,
const WebPoint& location);
@@ -239,7 +250,7 @@ public:
const WebVector<WebString>& names,
const WebVector<WebString>& labels,
const WebVector<WebString>& icons,
- const WebVector<int>& uniqueIDs,
+ const WebVector<int>& itemIDs,
int separatorIndex);
virtual void hidePopups();
virtual void setScrollbarColors(unsigned inactiveColor,
@@ -252,12 +263,18 @@ public:
virtual void performCustomContextMenuAction(unsigned action);
virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */);
virtual void removePageOverlay(WebPageOverlay*);
+#if ENABLE(BATTERY_STATUS)
+ virtual void updateBatteryStatus(const WebBatteryStatus&);
+#endif
+ virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
// WebLayerTreeViewClient
- virtual void updateAnimations(double frameBeginTime);
+ virtual void willBeginFrame();
+ virtual void updateAnimations(double monotonicFrameBeginTime);
virtual void applyScrollAndScale(const WebSize&, float);
virtual WebGraphicsContext3D* createContext3D();
virtual void didRebindGraphicsContext(bool);
+ virtual void didCommit();
virtual void didCommitAndDrawFrame();
virtual void didCompleteSwapBuffers();
virtual void scheduleComposite();
@@ -303,6 +320,8 @@ public:
return m_spellCheckClient;
}
+ const Vector<OwnPtr<WebCore::TextFieldDecorator> >& textFieldDecorators() const { return m_textFieldDecorators; }
+
// Returns the page object associated with this view. This may be null when
// the page is shutting down, but will be valid at all other times.
WebCore::Page* page() const
@@ -320,22 +339,16 @@ public:
void observeNewNavigation();
// Event related methods:
- void mouseMove(const WebMouseEvent&);
- void mouseLeave(const WebMouseEvent&);
- void mouseDown(const WebMouseEvent&);
- void mouseUp(const WebMouseEvent&);
void mouseContextMenu(const WebMouseEvent&);
void mouseDoubleClick(const WebMouseEvent&);
- bool mouseWheel(const WebMouseWheelEvent&);
- bool gestureEvent(const WebGestureEvent&);
void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec);
- bool keyEvent(const WebKeyboardEvent&);
- bool charEvent(const WebKeyboardEvent&);
- bool touchEvent(const WebTouchEvent&);
void numberOfWheelEventHandlersChanged(unsigned);
void numberOfTouchEventHandlersChanged(unsigned);
+ // PlatformGestureCurveTarget implementation for wheel fling.
+ virtual void scrollBy(const WebCore::IntPoint&);
+
// Handles context menu events orignated via the the keyboard. These
// include the VK_APPS virtual key and the Shift+F10 combine. Code is
// based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM
@@ -393,6 +406,17 @@ public:
return m_initialNavigationPolicy;
}
+ // Sets the emulated text zoom factor
+ // (may not be 1 in the device metrics emulation mode).
+ void setEmulatedTextZoomFactor(float);
+
+ // Returns the emulated text zoom factor
+ // (which may not be 1 in the device metrics emulation mode).
+ float emulatedTextZoomFactor() const
+ {
+ return m_emulatedTextZoomFactor;
+ }
+
// Determines whether a page should e.g. be opened in a background tab.
// Returns false if it has no opinion, in which case it doesn't set *policy.
static bool navigationPolicyFromMouseEvent(
@@ -415,7 +439,7 @@ public:
m_autofillPopupShowing = false;
}
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
// Returns the provider of desktop notifications.
NotificationPresenterImpl* notificationPresenterImpl();
#endif
@@ -427,6 +451,10 @@ public:
// Notification that a popup was opened/closed.
void popupOpened(WebCore::PopupContainer* popupContainer);
void popupClosed(WebCore::PopupContainer* popupContainer);
+#if ENABLE(PAGE_POPUP)
+ WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView);
+ void closePagePopup(WebCore::PagePopup*);
+#endif
void hideAutofillPopup();
@@ -445,6 +473,7 @@ public:
void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
void invalidateRootLayerRect(const WebCore::IntRect&);
NonCompositedContentHost* nonCompositedContentHost();
+ void setBackgroundColor(const WebCore::Color&);
#endif
#if ENABLE(REQUEST_ANIMATION_FRAME)
void scheduleAnimation();
@@ -464,6 +493,11 @@ public:
virtual void setVisibilityState(WebPageVisibilityState, bool);
WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
+#if ENABLE(PAGE_POPUP)
+ bool hasOpenedPopup() const { return m_selectPopup || m_pagePopup; }
+#else
+ bool hasOpenedPopup() const { return m_selectPopup; }
+#endif
// Returns true if the event leads to scrolling.
static bool mapKeyCodeForScroll(int keyCode,
@@ -485,6 +519,9 @@ public:
void enterFullScreenForElement(WebCore::Element*);
void exitFullScreenForElement(WebCore::Element*);
+ // Exposed for the purpose of overriding device metrics.
+ void sendResizeEventAndRepaint();
+
// Exposed for testing purposes.
bool hasHorizontalScrollbar();
bool hasVerticalScrollbar();
@@ -540,7 +577,6 @@ private:
const WebPoint& screenPoint,
DragAction);
- void sendResizeEventAndRepaint();
void configureAutoResizeMode();
#if USE(ACCELERATED_COMPOSITING)
@@ -564,10 +600,19 @@ private:
void pointerLockMouseEvent(const WebInputEvent&);
#endif
+ // PageWidgetEventHandler functions
+ virtual void handleMouseLeave(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
+ virtual void handleMouseDown(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
+ virtual void handleMouseUp(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
+ virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE;
+ virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE;
+ virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE;
+
WebViewClient* m_client;
WebAutofillClient* m_autofillClient;
WebPermissionClient* m_permissionClient;
WebSpellCheckClient* m_spellCheckClient;
+ Vector<OwnPtr<WebCore::TextFieldDecorator> > m_textFieldDecorators;
ChromeClientImpl m_chromeClientImpl;
ContextMenuClientImpl m_contextMenuClientImpl;
@@ -583,7 +628,6 @@ private:
// The upper bound on the size when auto-resizing.
WebCore::IntSize m_maxAutoSize;
- WebPoint m_lastMousePosition;
OwnPtr<WebCore::Page> m_page;
// This flag is set when a new navigation is detected. It is used to satisfy
@@ -665,6 +709,11 @@ private:
// The popup associated with a select element.
RefPtr<WebCore::PopupContainer> m_selectPopup;
+#if ENABLE(PAGE_POPUP)
+ // The popup associated with an input element.
+ RefPtr<WebPagePopupImpl> m_pagePopup;
+#endif
+
OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent;
OwnPtr<PageOverlayList> m_pageOverlays;
@@ -681,7 +730,7 @@ private:
OwnPtr<SettingsMap> m_inspectorSettingsMap;
OwnPtr<DragScrollTimer> m_dragScrollTimer;
-#if ENABLE(NOTIFICATIONS)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
// The provider of desktop notifications;
NotificationPresenterImpl m_notificationPresenter;
#endif
@@ -694,6 +743,7 @@ private:
// If set, the WebView is in fullscreen mode for an element in this frame.
RefPtr<WebCore::Frame> m_fullScreenFrame;
+ bool m_isCancelingFullScreen;
#if USE(ACCELERATED_COMPOSITING)
WebCore::IntRect m_rootLayerScrollDamage;
@@ -705,22 +755,36 @@ private:
bool m_compositorCreationFailed;
// If true, the graphics context is being restored.
bool m_recreatingGraphicsContext;
+ bool m_compositorSurfaceReady;
#endif
static const WebInputEvent* m_currentInputEvent;
#if ENABLE(INPUT_SPEECH)
OwnPtr<SpeechInputClientImpl> m_speechInputClient;
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ OwnPtr<SpeechRecognitionClientProxy> m_speechRecognitionClient;
+#endif
+
// If we attempt to fetch the on-screen GraphicsContext3D before
// the compositor has been turned on, we need to instantiate it
// early. This member holds on to the GC3D in this case.
OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
+#if ENABLE(BATTERY_STATUS)
+ OwnPtr<BatteryClientImpl> m_batteryClient;
+#endif
+
+ float m_emulatedTextZoomFactor;
#if ENABLE(MEDIA_STREAM)
UserMediaClientImpl m_userMediaClientImpl;
#endif
+ OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation;
+ WebPoint m_lastWheelPosition;
+ WebPoint m_lastWheelGlobalPosition;
+ int m_flingModifier;
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp
index a69f01a5f..aee7b1df4 100644
--- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp
@@ -87,8 +87,8 @@ WorkerContextProxy* WebWorkerClientImpl::createWorkerContextProxy(Worker* worker
void WebWorkerClientImpl::startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
{
RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode,
- m_scriptExecutionContext->contentSecurityPolicy()->policy(),
- m_scriptExecutionContext->contentSecurityPolicy()->headerType());
+ m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeader(),
+ m_scriptExecutionContext->contentSecurityPolicy()->deprecatedHeaderType());
m_proxy->workerThreadCreated(thread);
thread->start();
InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get(), m_proxy, scriptURL);
@@ -149,9 +149,9 @@ void WebWorkerClientImpl::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Ta
m_proxy->postTaskToLoader(task);
}
-void WebWorkerClientImpl::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+bool WebWorkerClientImpl::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
{
- m_proxy->postTaskForModeToWorkerContext(task, mode);
+ return m_proxy->postTaskForModeToWorkerContext(task, mode);
}
void WebWorkerClientImpl::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> value, PassOwnPtr<MessagePortChannelArray> ports)
diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h
index d47744c9c..2a865488d 100644
--- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h
+++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h
@@ -86,7 +86,7 @@ public:
#endif
// WebCore::WorkerLoaderProxy methods:
virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>) OVERRIDE;
- virtual void postTaskForModeToWorkerContext(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode) OVERRIDE;
+ virtual bool postTaskForModeToWorkerContext(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode) OVERRIDE;
// WebCore::WorkerObjectProxy methods:
virtual void postMessageToWorkerObject(PassRefPtr<WebCore::SerializedScriptValue>, PassOwnPtr<WebCore::MessagePortChannelArray>) OVERRIDE;
diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
index 80a26ff03..bcbca5651 100644
--- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
+++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
@@ -57,11 +57,11 @@ namespace WebCore {
static const char fileSystemOperationsMode[] = "fileSystemOperationsMode";
-WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
+WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType)
: AsyncFileSystemChromium(type, rootURL)
, m_scriptExecutionContext(context)
, m_workerContext(static_cast<WorkerContext*>(context))
- , m_synchronous(synchronous)
+ , m_synchronousType(synchronousType)
{
ASSERT(m_scriptExecutionContext->isWorkerContext());
@@ -219,7 +219,7 @@ void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const Stri
PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- ASSERT(!m_synchronous || !m_bridgeForCurrentOperation);
+ ASSERT(m_synchronousType == AsynchronousFileSystem || !m_bridgeForCurrentOperation);
m_modeForCurrentOperation = fileSystemOperationsMode;
m_modeForCurrentOperation.append(String::number(m_workerContext->thread()->runLoop().createUniqueId()));
diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h
index 08918518a..2618c48b9 100644
--- a/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h
+++ b/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h
@@ -34,7 +34,7 @@
#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
#include "AsyncFileSystemChromium.h"
-#include "PlatformString.h"
+#include "FileSystemType.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
@@ -53,9 +53,9 @@ class WorkerContext;
class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium {
public:
- static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
+ static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType)
{
- return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronous));
+ return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronousType));
}
virtual ~WorkerAsyncFileSystemChromium();
@@ -77,7 +77,7 @@ public:
virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
private:
- WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const WebKit::WebURL& rootURL, bool synchronous);
+ WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, FileSystemSynchronousType);
PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
@@ -86,7 +86,7 @@ private:
WorkerContext* m_workerContext;
RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation;
String m_modeForCurrentOperation;
- bool m_synchronous;
+ FileSystemSynchronousType m_synchronousType;
};
} // namespace WebCore
diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp
index 8fd5cfa6d..e87b5aa29 100644
--- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp
+++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp
@@ -146,7 +146,7 @@ private:
// that it only gets deleted on the worker context thread which is verified by ~Observer.
class WorkerFileSystemContextObserver : public WebCore::WorkerContext::Observer {
public:
- static PassOwnPtr<WorkerFileSystemContextObserver> create(WorkerContext* context, WorkerFileSystemCallbacksBridge* bridge)
+ static PassOwnPtr<WorkerFileSystemContextObserver> create(WorkerContext* context, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge)
{
return adoptPtr(new WorkerFileSystemContextObserver(context, bridge));
}
@@ -158,15 +158,13 @@ public:
}
private:
- WorkerFileSystemContextObserver(WorkerContext* context, WorkerFileSystemCallbacksBridge* bridge)
+ WorkerFileSystemContextObserver(WorkerContext* context, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge)
: WebCore::WorkerContext::Observer(context)
, m_bridge(bridge)
{
}
- // Since WorkerFileSystemCallbacksBridge manages the lifetime of this class,
- // m_bridge will be valid throughout its lifetime.
- WorkerFileSystemCallbacksBridge* m_bridge;
+ RefPtr<WorkerFileSystemCallbacksBridge> m_bridge;
};
void WorkerFileSystemCallbacksBridge::stop()
diff --git a/Source/WebKit/chromium/src/WrappedResourceRequest.h b/Source/WebKit/chromium/src/WrappedResourceRequest.h
deleted file mode 100644
index 3de31a21c..000000000
--- a/Source/WebKit/chromium/src/WrappedResourceRequest.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WrappedResourceRequest_h
-#define WrappedResourceRequest_h
-
-#include "platform/WebURLRequest.h"
-#include "WebURLRequestPrivate.h"
-
-namespace WebKit {
-
-class WrappedResourceRequest : public WebURLRequest {
-public:
- ~WrappedResourceRequest()
- {
- reset(); // Need to drop reference to m_handle
- }
-
- WrappedResourceRequest() { }
-
- WrappedResourceRequest(WebCore::ResourceRequest& resourceRequest)
- {
- bind(resourceRequest);
- }
-
- WrappedResourceRequest(const WebCore::ResourceRequest& resourceRequest)
- {
- bind(resourceRequest);
- }
-
- void bind(WebCore::ResourceRequest& resourceRequest)
- {
- m_handle.m_resourceRequest = &resourceRequest;
- assign(&m_handle);
- }
-
- void bind(const WebCore::ResourceRequest& resourceRequest)
- {
- bind(*const_cast<WebCore::ResourceRequest*>(&resourceRequest));
- }
-
-private:
- class Handle : public WebURLRequestPrivate {
- public:
- virtual void dispose() { m_resourceRequest = 0; }
- };
-
- Handle m_handle;
-};
-
-} // namespace WebKit
-
-#endif
diff --git a/Source/WebKit/chromium/src/WrappedResourceResponse.h b/Source/WebKit/chromium/src/WrappedResourceResponse.h
deleted file mode 100644
index 088f87c4b..000000000
--- a/Source/WebKit/chromium/src/WrappedResourceResponse.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WrappedResourceResponse_h
-#define WrappedResourceResponse_h
-
-#include "platform/WebURLResponse.h"
-#include "WebURLResponsePrivate.h"
-
-namespace WebKit {
-
-class WrappedResourceResponse : public WebURLResponse {
-public:
- ~WrappedResourceResponse()
- {
- reset(); // Need to drop reference to m_handle
- }
-
- WrappedResourceResponse() { }
-
- WrappedResourceResponse(WebCore::ResourceResponse& resourceResponse)
- {
- bind(resourceResponse);
- }
-
- WrappedResourceResponse(const WebCore::ResourceResponse& resourceResponse)
- {
- bind(resourceResponse);
- }
-
- void bind(WebCore::ResourceResponse& resourceResponse)
- {
- m_handle.m_resourceResponse = &resourceResponse;
- assign(&m_handle);
- }
-
- void bind(const WebCore::ResourceResponse& resourceResponse)
- {
- bind(*const_cast<WebCore::ResourceResponse*>(&resourceResponse));
- }
-
-private:
- class Handle : public WebURLResponsePrivate {
- public:
- virtual void dispose() { m_resourceResponse = 0; }
- };
-
- Handle m_handle;
-};
-
-} // namespace WebKit
-
-#endif
diff --git a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
index 18e14bfb4..13166f344 100644
--- a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
+++ b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
@@ -70,6 +70,8 @@ WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y,
int windowX, int windowY,
MouseEventType type,
double timeStampSeconds,
+ int modifiers,
+ int clickCount,
WebMouseEvent::Button button)
{
WebMouseEvent result;
@@ -82,7 +84,8 @@ WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y,
result.globalX = windowX;
result.globalY = windowY;
result.timeStampSeconds = timeStampSeconds;
- result.clickCount = 1;
+ result.clickCount = clickCount;
+ result.modifiers = modifiers;
switch (type) {
case MouseEventTypeDown:
diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js
index b8dc8de50..8c7e26ab4 100644
--- a/Source/WebKit/chromium/src/js/Tests.js
+++ b/Source/WebKit/chromium/src/js/Tests.js
@@ -404,7 +404,7 @@ TestSuite.prototype.testNetworkSize = function()
test.releaseControl();
}
- this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishResource", finishResource);
+ this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkRequest", finishResource);
// Reload inspected page to sniff network events
test.evaluateInConsole_("window.location.reload(true);", function(resultText) {});
@@ -427,7 +427,7 @@ TestSuite.prototype.testNetworkSyncSize = function()
test.releaseControl();
}
- this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishResource", finishResource);
+ this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkRequest", finishResource);
// Send synchronous XHR to sniff network events
test.evaluateInConsole_("var xhr = new XMLHttpRequest(); xhr.open(\"GET\", \"chunked\", false); xhr.send(null);", function() {});
@@ -451,7 +451,7 @@ TestSuite.prototype.testNetworkRawHeadersText = function()
test.releaseControl();
}
- this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishResource", finishResource);
+ this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkRequest", finishResource);
// Reload inspected page to sniff network events
test.evaluateInConsole_("window.location.reload(true);", function(resultText) {});
@@ -485,7 +485,7 @@ TestSuite.prototype.testNetworkTiming = function()
test.releaseControl();
}
- this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishResource", finishResource);
+ this.addSniffer(WebInspector.NetworkDispatcher.prototype, "_finishNetworkRequest", finishResource);
// Reload inspected page to sniff network events
test.evaluateInConsole_("window.location.reload(true);", function(resultText) {});
@@ -688,7 +688,7 @@ TestSuite.prototype._scriptsAreParsed = function(expected)
var missing = expected.slice(0);
for (var i = 0; i < uiSourceCodes.length; ++i) {
for (var j = 0; j < missing.length; ++j) {
- if (uiSourceCodes[i].fileName.search(missing[j]) !== -1) {
+ if (uiSourceCodes[i].parsedURL.lastPathComponent.search(missing[j]) !== -1) {
missing.splice(j, 1);
break;
}
diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp
index 2f7e4c73c..a373342ca 100644
--- a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp
+++ b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp
@@ -238,7 +238,7 @@ void PaintAggregator::invalidateRect(const IntRect& rect)
// with all existing paints, which means that tracking the size of
// paintRects at the time when popPendingUpdate() is called may mask
// certain performance problems.
- webKitPlatformSupport()->histogramCustomCounts("MPArch.RW_IntermediatePaintRectCount",
+ WebKit::Platform::current()->histogramCustomCounts("MPArch.RW_IntermediatePaintRectCount",
m_update.paintRects.size(), 1, 100, 50);
}
diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
index a168ebca9..bdf3a3ab4 100644
--- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
+++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
@@ -432,9 +432,40 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess)
EXPECT_TRUE(m_didFinishLoading);
}
-// Test a successful redirect and cross-origin load using CORS.
-// FIXME: Enable this when DocumentThreadableLoader supports cross-origin redirects.
-TEST_F(AssociatedURLLoaderTest, DISABLED_RedirectCrossOriginWithAccessControlSuccess)
+// Test that a cross origin redirect response without CORS headers fails.
+TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure)
+{
+ GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html");
+ char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html"; // Cross-origin
+ GURL redirectURL = GURL(redirect);
+
+ WebURLRequest request;
+ request.initialize();
+ request.setURL(url);
+
+ // Create a redirect response without CORS headers.
+ m_expectedRedirectResponse = WebURLResponse();
+ m_expectedRedirectResponse.initialize();
+ m_expectedRedirectResponse.setMIMEType("text/html");
+ m_expectedRedirectResponse.setHTTPStatusCode(301);
+ m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
+ webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
+
+ WebURLLoaderOptions options;
+ options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl;
+ m_expectedLoader = createAssociatedURLLoader(options);
+ EXPECT_TRUE(m_expectedLoader);
+ m_expectedLoader->loadAsynchronously(request, this);
+ serveRequests();
+ // We should not receive a notification for the redirect or any response.
+ EXPECT_FALSE(m_willSendRequest);
+ EXPECT_FALSE(m_didReceiveResponse);
+ EXPECT_FALSE(m_didReceiveData);
+ EXPECT_FALSE(m_didFail);
+}
+
+// Test that a cross origin redirect response with CORS headers that allow the requesting origin succeeds.
+TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
{
GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html");
char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html"; // Cross-origin
@@ -444,11 +475,13 @@ TEST_F(AssociatedURLLoaderTest, DISABLED_RedirectCrossOriginWithAccessControlSuc
request.initialize();
request.setURL(url);
+ // Create a redirect response that allows the redirect to pass the access control checks.
m_expectedRedirectResponse = WebURLResponse();
m_expectedRedirectResponse.initialize();
m_expectedRedirectResponse.setMIMEType("text/html");
m_expectedRedirectResponse.setHTTPStatusCode(301);
m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect);
+ m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin", "*");
webkit_support::RegisterMockedURL(url, m_expectedRedirectResponse, m_frameFilePath);
m_expectedNewRequest = WebURLRequest();
@@ -467,7 +500,8 @@ TEST_F(AssociatedURLLoaderTest, DISABLED_RedirectCrossOriginWithAccessControlSuc
EXPECT_TRUE(m_expectedLoader);
m_expectedLoader->loadAsynchronously(request, this);
serveRequests();
- EXPECT_TRUE(m_willSendRequest);
+ // We should not receive a notification for the redirect.
+ EXPECT_FALSE(m_willSendRequest);
EXPECT_TRUE(m_didReceiveResponse);
EXPECT_TRUE(m_didReceiveData);
EXPECT_TRUE(m_didFinishLoading);
diff --git a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp
index e14ef9bc0..a1ab770b7 100644
--- a/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp
+++ b/Source/WebKit/chromium/tests/CCActiveAnimationTest.cpp
@@ -80,6 +80,17 @@ TEST(CCActiveAnimationTest, TrimTimeStartTime)
EXPECT_EQ(1, anim->trimTimeToCurrentIteration(6));
}
+TEST(CCActiveAnimationTest, TrimTimeTimeOffset)
+{
+ OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1));
+ anim->setTimeOffset(4);
+ anim->setStartTime(4);
+ EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0));
+ EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5));
+ EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1));
+ EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1));
+}
+
TEST(CCActiveAnimationTest, TrimTimePauseResume)
{
OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1));
@@ -93,6 +104,19 @@ TEST(CCActiveAnimationTest, TrimTimePauseResume)
EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5));
}
+TEST(CCActiveAnimationTest, TrimTimeSuspendResume)
+{
+ OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1));
+ anim->setRunState(CCActiveAnimation::Running, 0);
+ EXPECT_EQ(0, anim->trimTimeToCurrentIteration(0));
+ EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(0.5));
+ anim->suspend(0.5);
+ EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024));
+ anim->resume(1024);
+ EXPECT_EQ(0.5, anim->trimTimeToCurrentIteration(1024));
+ EXPECT_EQ(1, anim->trimTimeToCurrentIteration(1024.5));
+}
+
TEST(CCActiveAnimationTest, IsFinishedAtZeroIterations)
{
OwnPtr<CCActiveAnimation> anim(createActiveAnimation(0));
@@ -160,4 +184,35 @@ TEST(CCActiveAnimationTest, IsFinished)
EXPECT_TRUE(anim->isFinished());
}
+TEST(CCActiveAnimationTest, IsFinishedNeedsSynchronizedStartTime)
+{
+ OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1));
+ anim->setRunState(CCActiveAnimation::Running, 2);
+ EXPECT_FALSE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::Paused, 2);
+ EXPECT_FALSE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::WaitingForNextTick, 2);
+ EXPECT_FALSE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 2);
+ EXPECT_FALSE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::WaitingForStartTime, 2);
+ EXPECT_FALSE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::Finished, 0);
+ EXPECT_TRUE(anim->isFinished());
+ anim->setRunState(CCActiveAnimation::Aborted, 0);
+ EXPECT_TRUE(anim->isFinished());
+}
+
+TEST(CCActiveAnimationTest, RunStateChangesIgnoredWhileSuspended)
+{
+ OwnPtr<CCActiveAnimation> anim(createActiveAnimation(1));
+ anim->suspend(0);
+ EXPECT_EQ(CCActiveAnimation::Paused, anim->runState());
+ anim->setRunState(CCActiveAnimation::Running, 0);
+ EXPECT_EQ(CCActiveAnimation::Paused, anim->runState());
+ anim->resume(0);
+ anim->setRunState(CCActiveAnimation::Running, 0);
+ EXPECT_EQ(CCActiveAnimation::Running, anim->runState());
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
index c9240e31f..36f79818e 100644
--- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
+++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp
@@ -28,14 +28,16 @@
#include "GraphicsLayer.h"
#include "LayerChromium.h"
+#include "TranslateTransformOperation.h"
#include "cc/CCLayerAnimationController.h"
+#include "cc/CCLayerImpl.h"
using namespace WebCore;
namespace {
template <class Target>
-void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity)
+void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
{
WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
if (duration > 0)
@@ -45,11 +47,32 @@ void addOpacityTransition(Target& target, double duration, float startOpacity, f
RefPtr<Animation> animation = Animation::create();
animation->setDuration(duration);
+ if (useTimingFunction)
+ animation->setTimingFunction(LinearTimingFunction::create());
+
IntSize boxSize;
target.addAnimation(values, boxSize, animation.get(), 0, 0, 0);
}
+template <class Target>
+void addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY)
+{
+ static int id = 0;
+ WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
+
+ TransformOperations operations;
+ operations.operations().append(TranslateTransformOperation::create(Length(deltaX, WebCore::Fixed), Length(deltaY, WebCore::Fixed), TransformOperation::TRANSLATE_X));
+ values.insert(new TransformAnimationValue(0, &operations));
+
+ RefPtr<Animation> animation = Animation::create();
+ animation->setDuration(duration);
+
+ IntSize boxSize;
+
+ target.addAnimation(values, boxSize, animation.get(), ++id, 0, 0);
+}
+
} // namespace
namespace WebKitTests {
@@ -106,12 +129,12 @@ float FakeFloatTransition::getValue(double time) const
return (1 - time) * m_from + time * m_to;
}
-FakeLayerAnimationControllerImplClient::FakeLayerAnimationControllerImplClient()
+FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient()
: m_opacity(0)
{
}
-FakeLayerAnimationControllerImplClient::~FakeLayerAnimationControllerImplClient()
+FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient()
{
}
@@ -120,14 +143,34 @@ PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatTransition::clone() const
return adoptPtr(new FakeFloatTransition(*this));
}
-void addOpacityTransitionToController(WebCore::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity)
+void addOpacityTransitionToController(WebCore::CCLayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
+{
+ addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimingFunction);
+}
+
+void addAnimatedTransformToController(WebCore::CCLayerAnimationController& controller, double duration, int deltaX, int deltaY)
+{
+ addAnimatedTransform(controller, duration, deltaX, deltaY);
+}
+
+void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
+{
+ addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFunction);
+}
+
+void addOpacityTransitionToLayer(WebCore::CCLayerImpl& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
+{
+ addOpacityTransition(*layer.layerAnimationController(), duration, startOpacity, endOpacity, useTimingFunction);
+}
+
+void addAnimatedTransformToLayer(WebCore::LayerChromium& layer, double duration, int deltaX, int deltaY)
{
- addOpacityTransition(controller, duration, startOpacity, endOpacity);
+ addAnimatedTransform(layer, duration, deltaX, deltaY);
}
-void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration, float startOpacity, float endOpacity)
+void addAnimatedTransformToLayer(WebCore::CCLayerImpl& layer, double duration, int deltaX, int deltaY)
{
- addOpacityTransition(layer, duration, startOpacity, endOpacity);
+ addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, deltaY);
}
} // namespace WebKitTests
diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
index d13e74ca1..776b75c8d 100644
--- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
+++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.h
@@ -26,12 +26,12 @@
#define CCAnimationTestCommon_h
#include "cc/CCAnimationCurve.h"
-#include "cc/CCLayerAnimationControllerImpl.h"
+#include "cc/CCLayerAnimationController.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
-class CCLayerAnimationController;
+class CCLayerImpl;
class LayerChromium;
}
@@ -42,9 +42,9 @@ public:
FakeFloatAnimationCurve();
virtual ~FakeFloatAnimationCurve();
- virtual double duration() const { return 1; }
- virtual float getValue(double now) const { return 0; }
- virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const;
+ virtual double duration() const OVERRIDE { return 1; }
+ virtual float getValue(double now) const OVERRIDE { return 0; }
+ virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE;
};
class FakeTransformTransition : public WebCore::CCTransformAnimationCurve {
@@ -52,10 +52,10 @@ public:
FakeTransformTransition(double duration);
virtual ~FakeTransformTransition();
- virtual double duration() const { return m_duration; }
- virtual WebCore::TransformationMatrix getValue(double time, const WebCore::IntSize&) const;
+ virtual double duration() const OVERRIDE { return m_duration; }
+ virtual WebCore::TransformationMatrix getValue(double time, const WebCore::IntSize&) const OVERRIDE;
- virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const;
+ virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE;
private:
double m_duration;
@@ -66,10 +66,10 @@ public:
FakeFloatTransition(double duration, float from, float to);
virtual ~FakeFloatTransition();
- virtual double duration() const { return m_duration; }
- virtual float getValue(double time) const;
+ virtual double duration() const OVERRIDE { return m_duration; }
+ virtual float getValue(double time) const OVERRIDE;
- virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const;
+ virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE;
private:
double m_duration;
@@ -77,17 +77,18 @@ private:
float m_to;
};
-class FakeLayerAnimationControllerImplClient : public WebCore::CCLayerAnimationControllerImplClient {
+class FakeLayerAnimationControllerClient : public WebCore::CCLayerAnimationControllerClient {
public:
- FakeLayerAnimationControllerImplClient();
- virtual ~FakeLayerAnimationControllerImplClient();
+ FakeLayerAnimationControllerClient();
+ virtual ~FakeLayerAnimationControllerClient();
- virtual int id() const { return 0; }
- virtual float opacity() const { return m_opacity; }
- virtual void setOpacity(float opacity) { m_opacity = opacity; }
- virtual const WebCore::TransformationMatrix& transform() const { return m_transform; }
- virtual void setTransform(const WebCore::TransformationMatrix& transform) { m_transform = transform; }
- virtual const WebCore::IntSize& bounds() const { return m_bounds; }
+ // CCLayerAnimationControllerClient implementation
+ virtual int id() const OVERRIDE { return 0; }
+ virtual void setOpacityFromAnimation(float opacity) OVERRIDE { m_opacity = opacity; }
+ virtual float opacity() const OVERRIDE { return m_opacity; }
+ virtual void setTransformFromAnimation(const WebCore::TransformationMatrix& transform) OVERRIDE { m_transform = transform; }
+ virtual const WebCore::TransformationMatrix& transform() const OVERRIDE { return m_transform; }
+ virtual const WebCore::IntSize& bounds() const OVERRIDE { return m_bounds; }
private:
float m_opacity;
@@ -95,9 +96,14 @@ private:
WebCore::IntSize m_bounds;
};
-void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity);
+void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
+void addAnimatedTransformToController(WebCore::CCLayerAnimationController&, double duration, int deltaX, int deltaY);
-void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float startOpacity, float endOpacity);
+void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
+void addOpacityTransitionToLayer(WebCore::CCLayerImpl&, double duration, float startOpacity, float endOpacity, bool useTimingFunction);
+
+void addAnimatedTransformToLayer(WebCore::LayerChromium&, double duration, int deltaX, int deltaY);
+void addAnimatedTransformToLayer(WebCore::CCLayerImpl&, double duration, int deltaX, int deltaY);
} // namespace WebKitTests
diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
index 74d635b40..11a88784b 100644
--- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp
@@ -30,6 +30,7 @@
#include "cc/CCLayerImpl.h"
#include "cc/CCLayerSorter.h"
#include "cc/CCLayerTreeHostCommon.h"
+#include "cc/CCMathUtil.h"
#include "cc/CCSingleThreadProxy.h"
#include <gtest/gtest.h>
@@ -70,7 +71,7 @@ void emulateDrawingOneFrame(CCLayerImpl* root)
// Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors.
for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) {
CCRenderSurface* targetSurface = renderSurfaceLayerList[i]->renderSurface();
- targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), renderSurfaceLayerList[i]->maskLayer());
+ targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), targetSurface->surfacePropertyChangedOnlyFromDescendant(), targetSurface->contentRect(), renderSurfaceLayerList[i]->maskLayer(), renderSurfaceLayerList[i]->filters());
}
root->resetAllChangeTrackingForSubtree();
@@ -180,7 +181,7 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface)
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
- EXPECT_EQ(static_cast<size_t>(2), root->renderSurface()->layerList().size());
+ EXPECT_EQ(2u, root->renderSurface()->layerList().size());
EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id());
EXPECT_EQ(2, root->renderSurface()->layerList()[1]->id());
@@ -202,8 +203,8 @@ TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
ASSERT_TRUE(child1->renderSurface());
EXPECT_FALSE(child2->renderSurface());
- EXPECT_EQ(static_cast<size_t>(3), root->renderSurface()->layerList().size());
- EXPECT_EQ(static_cast<size_t>(2), child1->renderSurface()->layerList().size());
+ EXPECT_EQ(3u, root->renderSurface()->layerList().size());
+ EXPECT_EQ(2u, child1->renderSurface()->layerList().size());
// The render surface for child1 only has a contentRect that encloses grandChild1 and grandChild2, because child1 does not draw content.
EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
@@ -254,7 +255,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges)
// Sanity check - we should not have accidentally created a separate render surface for the translucent layer.
ASSERT_FALSE(child->renderSurface());
- ASSERT_EQ(static_cast<size_t>(2), root->renderSurface()->layerList().size());
+ ASSERT_EQ(2u, root->renderSurface()->layerList().size());
// Damage should be the entire child layer in targetSurface space.
FloatRect expectedRect = FloatRect(100, 100, 30, 30);
@@ -315,6 +316,146 @@ TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer)
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
+TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
+{
+ // If a layer has a perspective transform that causes w < 0, then not clipping the
+ // layer can cause an invalid damage rect. This test checks that the w < 0 case is
+ // 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)
+
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+ CCLayerImpl* child = root->children()[0].get();
+
+ TransformationMatrix transform;
+ transform.applyPerspective(1);
+ transform.translate3d(-150, -50, 0);
+ transform.rotate3d(0, 45, 0);
+ transform.translate3d(-50, -50, 0);
+
+ // Set up the child
+ child->setPosition(FloatPoint(0, 0));
+ child->setBounds(IntSize(100, 100));
+ child->setTransform(transform);
+ emulateDrawingOneFrame(root.get());
+
+ // Sanity check that the child layer's bounds would actually get clipped by w < 0,
+ // otherwise this test is not actually testing the intended scenario.
+ FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100)));
+ bool clipped = false;
+ CCMathUtil::mapQuad(transform, testQuad, clipped);
+ EXPECT_TRUE(clipped);
+
+ // Damage the child without moving it.
+ 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);
+}
+
+TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface)
+{
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+ CCLayerImpl* child = root->children()[0].get();
+
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(5, WebCore::Fixed), FilterOperation::BLUR));
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+ root->setFilters(filters);
+
+ // Setting the filter will damage the whole surface.
+ emulateDrawingOneFrame(root.get());
+
+ // Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
+ child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ emulateDrawingOneFrame(root.get());
+
+ // Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
+ FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ FloatRect expectedDamageRect = FloatRect(110, 111, 12, 13);
+ expectedDamageRect.move(-outsetLeft, -outsetTop);
+ expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+}
+
+TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild)
+{
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
+ CCLayerImpl* child1 = root->children()[0].get();
+ CCLayerImpl* child2 = root->children()[1].get();
+
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(2, WebCore::Fixed), FilterOperation::BLUR));
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+ child1->setBackgroundFilters(filters);
+
+ // Setting the filter will damage the whole surface.
+ 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.
+ root->setUpdateRect(FloatRect(297, 297, 2, 2));
+
+ emulateDrawingOneFrame(root.get());
+
+ FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ // Damage position on the surface should be a composition of the damage on the root and on child2.
+ // Damage on the root should be: position of updateRect (297, 297), but expanded by the blur outsets.
+ FloatRect expectedDamageRect = FloatRect(297, 297, 2, 2);
+ expectedDamageRect.move(-outsetLeft, -outsetTop);
+ expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+
+ // CASE 2: Setting the update rect should cause the corresponding damage to
+ // 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.
+ root->setUpdateRect(FloatRect(297, 297, 30, 30));
+
+ emulateDrawingOneFrame(root.get());
+
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ // Damage position on the surface should be a composition of the damage on the root and on child2.
+ // Damage on the root should be: position of updateRect (297, 297), but expanded on the left/top
+ // by the blur outsets.
+ expectedDamageRect = FloatRect(297, 297, 30, 30);
+ expectedDamageRect.move(-outsetLeft, -outsetTop);
+ expectedDamageRect.expand(outsetLeft, outsetTop);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+
+ // CASE 3: Setting this update rect outside the contentBounds of the blurred
+ // child1 will not cause it to be expanded.
+ root->setUpdateRect(FloatRect(30, 30, 2, 2));
+
+ emulateDrawingOneFrame(root.get());
+
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ // Damage on the root should be: position of updateRect (30, 30), not
+ // expanded.
+ expectedDamageRect = FloatRect(30, 30, 2, 2);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+
+ // CASE 4: Setting the update rect on child2, which is above child1, will
+ // not get blurred by child1, so it does not need to get expanded.
+ child2->setUpdateRect(FloatRect(0, 0, 1, 1));
+
+ emulateDrawingOneFrame(root.get());
+
+ rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ // Damage on child2 should be: position of updateRect offset by the child's position (11, 11), and not expanded by anything.
+ expectedDamageRect = FloatRect(11, 11, 1, 1);
+ EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
+}
+
TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
{
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
@@ -334,7 +475,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
emulateDrawingOneFrame(root.get());
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
- ASSERT_EQ(static_cast<size_t>(3), root->renderSurface()->layerList().size());
+ ASSERT_EQ(3u, root->renderSurface()->layerList().size());
FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
@@ -353,6 +494,36 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
}
+TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer)
+{
+ // If child2 is added to the layer tree, but it doesn't have any explicit damage of
+ // its own, it should still indeed damage the target surface.
+
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
+
+ {
+ OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3);
+ child2->setPosition(FloatPoint(400, 380));
+ child2->setAnchorPoint(FloatPoint::zero());
+ child2->setBounds(IntSize(6, 8));
+ child2->setDrawsContent(true);
+ child2->resetAllChangeTrackingForSubtree();
+ // Sanity check the initial conditions of the test, if these asserts trigger, it
+ // means the test no longer actually covers the intended scenario.
+ ASSERT_FALSE(child2->layerPropertyChanged());
+ 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.
+ ASSERT_EQ(3u, root->renderSurface()->layerList().size());
+
+ FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
+}
+
TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers)
{
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
@@ -402,8 +573,8 @@ 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);
- grandChild1->setOpacity(0.7);
- child2->setOpacity(0.7);
+ grandChild1->setOpacity(0.7f);
+ child2->setOpacity(0.7f);
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -485,7 +656,7 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// Sanity check that there is only one surface now.
ASSERT_FALSE(child1->renderSurface());
- ASSERT_EQ(static_cast<size_t>(4), root->renderSurface()->layerList().size());
+ ASSERT_EQ(4u, root->renderSurface()->layerList().size());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
@@ -503,8 +674,8 @@ TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
// Sanity check that there is a new surface now.
ASSERT_TRUE(child1->renderSurface());
- EXPECT_EQ(static_cast<size_t>(3), root->renderSurface()->layerList().size());
- EXPECT_EQ(static_cast<size_t>(2), child1->renderSurface()->layerList().size());
+ EXPECT_EQ(3u, root->renderSurface()->layerList().size());
+ EXPECT_EQ(2u, child1->renderSurface()->layerList().size());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
@@ -746,7 +917,7 @@ 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.6);
+ replicaMaskLayer->setOpacity(0.6f);
emulateDrawingOneFrame(root.get());
FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
@@ -767,7 +938,53 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask)
EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
}
-TEST_F(CCDamageTrackerTest, verifyDamageWhenReset)
+TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
+{
+ OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
+ CCLayerImpl* child1 = root->children()[0].get();
+ CCLayerImpl* grandChild1 = child1->children()[0].get();
+
+ // Verify that the correct replicaOriginTransform is used for the replicaMask; the
+ // incorrect old code incorrectly accounted for the anchor for the replica. A
+ // non-zero anchor point should not affect the replica reflection.
+
+ grandChild1->setAnchorPoint(FloatPoint(1.0, 0.0)); // This is the anchor being tested.
+
+ {
+ OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6);
+ grandChild1Replica->setPosition(FloatPoint::zero());
+ grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
+ TransformationMatrix reflection;
+ reflection.scale3d(-1.0, 1.0, 1.0);
+ grandChild1Replica->setTransform(reflection);
+ grandChild1->setReplicaLayer(grandChild1Replica.release());
+ }
+ CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer();
+
+ // Set up the mask layer on the replica layer
+ {
+ OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7);
+ replicaMaskLayer->setPosition(FloatPoint::zero());
+ replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
+ replicaMaskLayer->setBounds(grandChild1->bounds());
+ grandChild1Replica->setMaskLayer(replicaMaskLayer.release());
+ }
+ CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer();
+
+ emulateDrawingOneFrame(root.get());
+
+ // Sanity check that the appropriate render surfaces were created
+ ASSERT_TRUE(grandChild1->renderSurface());
+
+ // A property change on the replicaMask should damage the reflected region on the target surface.
+ replicaMaskLayer->setOpacity(0.6f);
+ emulateDrawingOneFrame(root.get());
+
+ FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
+}
+
+TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage)
{
OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
CCLayerImpl* child = root->children()[0].get();
@@ -790,4 +1007,21 @@ TEST_F(CCDamageTrackerTest, verifyDamageWhenReset)
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
}
+TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList)
+{
+ // Though it should never happen, its a good idea to verify that the damage tracker
+ // does not crash when it receives an empty layerList.
+
+ OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1);
+ root->createRenderSurface();
+
+ ASSERT_TRUE(root->renderSurface() == root->targetRenderSurface());
+ CCRenderSurface* targetSurface = root->renderSurface();
+ targetSurface->clearLayerList();
+ targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, FilterOperations());
+
+ FloatRect damageRect = targetSurface->damageTracker()->currentDamageRect();
+ EXPECT_TRUE(damageRect.isEmpty());
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp
index 867d56ea8..93e84a4af 100644
--- a/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp
+++ b/Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp
@@ -41,15 +41,15 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
- timer->setMonotonicallyIncreasingTimeMs(0);
+ timer->setMonotonicallyIncreasingTime(0);
timer->setActive(true);
EXPECT_TRUE(timer->active());
EXPECT_TRUE(thread.hasPendingTask());
- timer->setMonotonicallyIncreasingTimeMs(16);
+ timer->setMonotonicallyIncreasingTime(0.016);
thread.runPendingTask();
EXPECT_TRUE(timer->active());
EXPECT_TRUE(client.tickCalled());
@@ -59,7 +59,7 @@ TEST(CCDelayBasedTimeSource, TickNotCalledWithTaskPosted)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
timer->setActive(true);
EXPECT_TRUE(thread.hasPendingTask());
@@ -72,7 +72,7 @@ TEST(CCDelayBasedTimeSource, StartTwiceEnqueuesOneTask)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
timer->setActive(true);
EXPECT_TRUE(thread.hasPendingTask());
@@ -85,7 +85,7 @@ TEST(CCDelayBasedTimeSource, StartWhenRunningDoesntTick)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
timer->setActive(true);
thread.runPendingTask();
@@ -100,19 +100,19 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- double interval = 1000.0 / 60.0;
+ double interval = 1.0 / 60.0;
RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval, &thread);
timer->setClient(&client);
timer->setActive(true);
// Run the first task, as that activates the timer and picks up a timebase.
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
- timer->setMonotonicallyIncreasingTimeMs(interval);
+ timer->setMonotonicallyIncreasingTime(interval);
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
}
// At 60Hz, when the tick returns at slightly after the requested next time, make sure
@@ -121,19 +121,19 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- double interval = 1000.0 / 60.0;
+ double interval = 1.0 / 60.0;
RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval, &thread);
timer->setClient(&client);
timer->setActive(true);
// Run the first task, as that activates the timer and picks up a timebase.
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
- timer->setMonotonicallyIncreasingTimeMs(interval + 0.0001);
+ timer->setMonotonicallyIncreasingTime(interval + 0.0000001);
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
}
// At 60Hz, when the tick returns at exactly 2*interval after the requested next time, make sure
@@ -142,19 +142,19 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- double interval = 1000.0 / 60.0;
+ double interval = 1.0 / 60.0;
RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval, &thread);
timer->setClient(&client);
timer->setActive(true);
// Run the first task, as that activates the timer and picks up a timebase.
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
- timer->setMonotonicallyIncreasingTimeMs(2*interval);
+ timer->setMonotonicallyIncreasingTime(2*interval);
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
}
// At 60Hz, when the tick returns at 2*interval and a bit after the requested next time, make sure
@@ -163,19 +163,19 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- double interval = 1000.0 / 60.0;
+ double interval = 1.0 / 60.0;
RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval, &thread);
timer->setClient(&client);
timer->setActive(true);
// Run the first task, as that activates the timer and picks up a timebase.
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
- timer->setMonotonicallyIncreasingTimeMs(2*interval + 0.0001);
+ timer->setMonotonicallyIncreasingTime(2*interval + 0.0000001);
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
}
// At 60Hz, when the tick returns halfway to the next frame time, make sure
@@ -184,19 +184,19 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- double interval = 1000.0 / 60.0;
+ double interval = 1.0 / 60.0;
RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(interval, &thread);
timer->setClient(&client);
timer->setActive(true);
// Run the first task, as that activates the timer and picks up a timebase.
thread.runPendingTask();
- EXPECT_EQ(16, thread.pendingDelay());
+ EXPECT_EQ(16, thread.pendingDelayMs());
- timer->setMonotonicallyIncreasingTimeMs(interval + interval * 0.5);
+ timer->setMonotonicallyIncreasingTime(interval + interval * 0.5);
thread.runPendingTask();
- EXPECT_EQ(8, thread.pendingDelay());
+ EXPECT_EQ(8, thread.pendingDelayMs());
}
@@ -206,31 +206,31 @@ TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise)
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
timer->setActive(true);
double totalFrameTime = 0;
for (int i = 0; i < numIterations; ++i) {
- long long delay = thread.pendingDelay();
+ long long delayMs = thread.pendingDelayMs();
// accumulate the "delay"
- totalFrameTime += delay;
+ totalFrameTime += delayMs / 1000.0;
// Run the callback exactly when asked
- double now = timer->monotonicallyIncreasingTimeMs() + delay;
- timer->setMonotonicallyIncreasingTimeMs(now);
+ double now = timer->monotonicallyIncreasingTime() + delayMs / 1000.0;
+ timer->setMonotonicallyIncreasingTime(now);
thread.runPendingTask();
}
double averageInterval = totalFrameTime / static_cast<double>(numIterations);
- EXPECT_NEAR(1000.0 / 60.0, averageInterval, 0.1);
+ EXPECT_NEAR(1.0 / 60.0, averageInterval, 0.1);
}
TEST(CCDelayBasedTimeSource, TestDeactivateWhilePending)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
timer->setActive(true); // Should post a task.
timer->setActive(false);
@@ -242,12 +242,12 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
// Should run the activate task, and pick up a new timebase.
timer->setActive(true);
- timer->setMonotonicallyIncreasingTimeMs(0);
+ timer->setMonotonicallyIncreasingTime(0);
thread.runPendingTask();
// Stop the timer
@@ -258,21 +258,21 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime)
// Start the timer again, but before the next tick time the timer previously
// planned on using. That same tick time should still be targeted.
- timer->setMonotonicallyIncreasingTimeMs(4);
+ timer->setMonotonicallyIncreasingTime(0.004);
timer->setActive(true);
- EXPECT_EQ(12, thread.pendingDelay());
+ EXPECT_EQ(12, thread.pendingDelayMs());
}
TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime)
{
FakeCCThread thread;
FakeCCTimeSourceClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
timer->setClient(&client);
// Should run the activate task, and pick up a new timebase.
timer->setActive(true);
- timer->setMonotonicallyIncreasingTimeMs(0);
+ timer->setMonotonicallyIncreasingTime(0);
thread.runPendingTask();
// Stop the timer
@@ -283,9 +283,9 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime)
// Start the timer again, but before the next tick time the timer previously
// planned on using. That same tick time should still be targeted.
- timer->setMonotonicallyIncreasingTimeMs(20);
+ timer->setMonotonicallyIncreasingTime(0.02);
timer->setActive(true);
- EXPECT_EQ(13, thread.pendingDelay());
+ EXPECT_EQ(13, thread.pendingDelayMs());
}
}
diff --git a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp
index ae43d41c1..c9a60cfaa 100644
--- a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp
@@ -39,13 +39,13 @@ class FakeCCFrameRateControllerClient : public WebCore::CCFrameRateControllerCli
public:
FakeCCFrameRateControllerClient() { reset(); }
- void reset() { m_frameBegun = false; }
- bool frameBegun() const { return m_frameBegun; }
+ void reset() { m_vsyncTicked = false; }
+ bool vsyncTicked() const { return m_vsyncTicked; }
- virtual void beginFrame() { m_frameBegun = true; }
+ virtual void vsyncTick() { m_vsyncTicked = true; }
protected:
- bool m_frameBegun;
+ bool m_vsyncTicked;
};
@@ -53,7 +53,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck)
{
FakeCCThread thread;
FakeCCFrameRateControllerClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
CCFrameRateController controller(timeSource);
controller.setClient(&client);
@@ -62,32 +62,32 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck)
double elapsed = 0; // Muck around with time a bit
// Trigger one frame, make sure the vsync callback is called
- elapsed += thread.pendingDelay();
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_TRUE(client.frameBegun());
+ EXPECT_TRUE(client.vsyncTicked());
client.reset();
// Tell the controller we drew
controller.didBeginFrame();
// Tell the controller the frame ended 5ms later
- timeSource->setMonotonicallyIncreasingTimeMs(timeSource->monotonicallyIncreasingTimeMs() + 5);
+ timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005);
controller.didFinishFrame();
// Trigger another frame, make sure vsync runs again
- elapsed += thread.pendingDelay();
- EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTimeMs()); // Sanity check that previous code didn't move time backward.
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_TRUE(client.frameBegun());
+ EXPECT_TRUE(client.vsyncTicked());
}
TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
{
FakeCCThread thread;
FakeCCFrameRateControllerClient client;
- RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(1000.0 / 60.0, &thread);
+ RefPtr<FakeCCDelayBasedTimeSource> timeSource = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
CCFrameRateController controller(timeSource);
controller.setClient(&client);
@@ -97,46 +97,46 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
double elapsed = 0; // Muck around with time a bit
// Trigger one frame, make sure the vsync callback is called
- elapsed += thread.pendingDelay();
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_TRUE(client.frameBegun());
+ EXPECT_TRUE(client.vsyncTicked());
client.reset();
// Tell the controller we drew
controller.didBeginFrame();
// Trigger another frame, make sure vsync callback runs again
- elapsed += thread.pendingDelay();
- EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTimeMs()); // Sanity check that previous code didn't move time backward.
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_TRUE(client.frameBegun());
+ EXPECT_TRUE(client.vsyncTicked());
client.reset();
// Tell the controller we drew, again.
controller.didBeginFrame();
// Trigger another frame. Since two frames are pending, we should not draw.
- elapsed += thread.pendingDelay();
- EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTimeMs()); // Sanity check that previous code didn't move time backward.
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_FALSE(client.frameBegun());
+ EXPECT_FALSE(client.vsyncTicked());
// Tell the controller the first frame ended 5ms later
- timeSource->setMonotonicallyIncreasingTimeMs(timeSource->monotonicallyIncreasingTimeMs() + 5);
+ timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005);
controller.didFinishFrame();
// Tick should not have been called
- EXPECT_FALSE(client.frameBegun());
+ EXPECT_FALSE(client.vsyncTicked());
// Trigger yet another frame. Since one frames is pending, another vsync callback should run.
- elapsed += thread.pendingDelay();
- EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTimeMs()); // Sanity check that previous code didn't move time backward.
- timeSource->setMonotonicallyIncreasingTimeMs(elapsed);
+ elapsed += thread.pendingDelayMs() / 1000.0;
+ EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
+ timeSource->setMonotonicallyIncreasingTime(elapsed);
thread.runPendingTask();
- EXPECT_TRUE(client.frameBegun());
+ EXPECT_TRUE(client.vsyncTicked());
}
}
diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp
deleted file mode 100644
index e1aeccc53..000000000
--- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerImplTest.cpp
+++ /dev/null
@@ -1,396 +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 "CCAnimationTestCommon.h"
-#include "cc/CCLayerAnimationControllerImpl.h"
-#include "cc/CCAnimationCurve.h"
-#include "cc/CCAnimationEvents.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <wtf/Vector.h>
-
-using namespace WebCore;
-using namespace WebKitTests;
-
-namespace {
-
-PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int id, CCActiveAnimation::TargetProperty property)
-{
- return CCActiveAnimation::create(curve, 0, id, property);
-}
-
-// Tests that transitioning opacity from 0 to 1 works as expected.
-TEST(CCLayerAnimationControllerImplTest, TrivialTransition)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
-
- controller->add(toAdd.release());
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1, *events);
- EXPECT_EQ(1, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests that two queued animations affecting the same property run in sequence.
-TEST(CCLayerAnimationControllerImplTest, TrivialQueuing)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5f)), 2, CCActiveAnimation::Opacity));
-
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
- controller->animate(2, *events);
- EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests interrupting a transition with another transition.
-TEST(CCLayerAnimationControllerImplTest, Interrupt)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
-
- OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 1, 0.5f)), 2, CCActiveAnimation::Opacity));
- toAdd->setRunState(CCActiveAnimation::WaitingForNextTick, 0);
- controller->add(toAdd.release());
-
- controller->animate(0.5, *events); // second anim starts NOW.
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
- controller->animate(1.5, *events);
- EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests scheduling two animations to run together when only one property is free.
-TEST(CCLayerAnimationControllerImplTest, ScheduleTogetherWhenAPropertyIsBlocked)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::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->animate(0, *events);
- EXPECT_EQ(0, dummy.opacity());
- EXPECT_TRUE(controller->hasActiveAnimation());
- controller->animate(1, *events);
- // Should not have started the float transition yet.
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- // The the float animation should have started at time 1 and should be done.
- controller->animate(2, *events);
- EXPECT_EQ(1, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests scheduling two animations to run together with different lengths and another
-// animation queued to start when the shorter animation finishes (should wait
-// for both to finish).
-TEST(CCLayerAnimationControllerImplTest, ScheduleTogetherWithAnAnimWaiting)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::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.5f)), 2, CCActiveAnimation::Opacity));
-
- // Anims with id 1 should both start now.
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- // The opacity animation should have finished at time 1, but the group
- // of animations with id 1 don't finish until time 2 because of the length
- // of the transform animation.
- controller->animate(2, *events);
- // Should not have started the float transition yet.
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
-
- // The the second opacity animation should start at time 2 and should be
- // done by time 3
- controller->animate(3, *events);
- EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests scheduling an animation to start in the future.
-TEST(CCLayerAnimationControllerImplTest, ScheduleAnimation)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- 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->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(2, *events);
- EXPECT_EQ(1, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests scheduling an animation to start in the future that's interrupting a running animation.
-TEST(CCLayerAnimationControllerImplTest, ScheduledAnimationInterruptsRunningAnimation)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
-
- OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0.5f, 0)), 2, CCActiveAnimation::Opacity));
- toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0);
- toAdd->setStartTime(1);
- controller->add(toAdd.release());
-
- // First 2s opacity transition should start immediately.
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(0.5, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.5f, dummy.opacity());
- controller->animate(2, *events);
- EXPECT_EQ(0, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Tests scheduling an animation to start in the future that interrupts a running animation
-// and there is yet another animation queued to start later.
-TEST(CCLayerAnimationControllerImplTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 1, CCActiveAnimation::Opacity));
-
- OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0.5f, 0)), 2, CCActiveAnimation::Opacity));
- toAdd->setRunState(CCActiveAnimation::WaitingForStartTime, 0);
- toAdd->setStartTime(1);
- controller->add(toAdd.release());
-
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 0.75f)), 3, CCActiveAnimation::Opacity));
-
- // First 2s opacity transition should start immediately.
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(0.5, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- EXPECT_TRUE(controller->hasActiveAnimation());
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.5f, dummy.opacity());
- controller->animate(3, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(4, *events);
- EXPECT_EQ(0.75f, dummy.opacity());
- EXPECT_FALSE(controller->hasActiveAnimation());
-}
-
-// Test that a looping animation loops and for the correct number of iterations.
-TEST(CCLayerAnimationControllerImplTest, TrivialLooping)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
- toAdd->setIterations(3);
- controller->add(toAdd.release());
-
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1.25, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- controller->animate(1.75, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
- controller->animate(2.25, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- controller->animate(2.75, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
- controller->animate(3, *events);
- EXPECT_FALSE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
-
- // Just be extra sure.
- controller->animate(4, *events);
- EXPECT_EQ(1, dummy.opacity());
-}
-
-// Test that an infinitely looping animation does indeed go until aborted.
-TEST(CCLayerAnimationControllerImplTest, InfiniteLooping)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- 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->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1.25, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- controller->animate(1.75, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
-
- controller->animate(1073741824.25, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.25f, dummy.opacity());
- controller->animate(1073741824.75, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
-
- EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
- controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 0.75f);
- EXPECT_FALSE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
-}
-
-// Test that pausing and resuming work as expected.
-TEST(CCLayerAnimationControllerImplTest, PauseResume)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::create(&dummy));
-
- const int id = 1;
- controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity));
-
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(0.5, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.5f, dummy.opacity());
-
- EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
- controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Paused, 0.5f);
-
- controller->animate(1024, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.5f, dummy.opacity());
-
- EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
- controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Running, 1024);
-
- controller->animate(1024.25, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
- controller->animate(1024.5, *events);
- EXPECT_FALSE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
-}
-
-TEST(CCLayerAnimationControllerImplTest, AbortAGroupedAnimation)
-{
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controller(
- CCLayerAnimationControllerImpl::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.75f)), 2, CCActiveAnimation::Opacity));
-
- controller->animate(0, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0, dummy.opacity());
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(0.5f, dummy.opacity());
-
- EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
- controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 1);
- controller->animate(1, *events);
- EXPECT_TRUE(controller->hasActiveAnimation());
- EXPECT_EQ(1, dummy.opacity());
- controller->animate(2, *events);
- EXPECT_TRUE(!controller->hasActiveAnimation());
- EXPECT_EQ(0.75f, dummy.opacity());
-}
-
-} // namespace
diff --git a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
index c4f103a3c..fa95a2ac5 100644
--- a/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp
@@ -56,7 +56,8 @@ PassOwnPtr<CCActiveAnimation> createActiveAnimation(PassOwnPtr<CCAnimationCurve>
TEST(CCLayerAnimationControllerTest, createOpacityAnimation)
{
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
const double duration = 1;
WebCore::KeyframeValueList values(AnimatedPropertyOpacity);
values.insert(new FloatAnimationValue(0, 0));
@@ -85,9 +86,37 @@ TEST(CCLayerAnimationControllerTest, createOpacityAnimation)
EXPECT_EQ(1, curve->getValue(duration));
}
+TEST(CCLayerAnimationControllerTest, ignoreUnsupportedAnimationDirections)
+{
+ 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;
+
+ animation->setDirection(Animation::AnimationDirectionAlternate);
+ EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0));
+
+ animation->setDirection(Animation::AnimationDirectionAlternateReverse);
+ EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0));
+
+ animation->setDirection(Animation::AnimationDirectionReverse);
+ EXPECT_FALSE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0));
+
+ animation->setDirection(Animation::AnimationDirectionNormal);
+ EXPECT_TRUE(controller->addAnimation(values, boxSize, animation.get(), 0, 0, 0));
+}
+
TEST(CCLayerAnimationControllerTest, createTransformAnimation)
{
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
const double duration = 1;
WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform);
@@ -124,92 +153,504 @@ TEST(CCLayerAnimationControllerTest, createTransformAnimation)
TEST(CCLayerAnimationControllerTest, syncNewAnimation)
{
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controllerImpl(CCLayerAnimationControllerImpl::create(&dummy));
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummyImpl;
+ OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- addOpacityTransitionToController(*controller, 1, 0, 1);
+ addOpacityTransitionToController(*controller, 1, 0, 1, false);
- controller->synchronizeAnimations(controllerImpl.get());
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
}
-TEST(CCLayerAnimationControllerTest, syncAnimationProperties)
+// If an animation is started on the impl thread before it is ticked on the main
+// thread, we must be sure to respect the synchronized start time.
+TEST(CCLayerAnimationControllerTest, doNotClobberStartTimes)
{
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controllerImpl(CCLayerAnimationControllerImpl::create(&dummy));
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummyImpl;
+ OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- addOpacityTransitionToController(*controller, 1, 0, 1);
+ addOpacityTransitionToController(*controller, 1, 0, 1, false);
- controller->synchronizeAnimations(controllerImpl.get());
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
- // Push an animation property change to the impl thread (should not cause an animation to be added).
- controller->pauseAnimation(0, 0);
- controller->synchronizeAnimations(controllerImpl.get());
+ CCAnimationEventsVector events;
+ controllerImpl->animate(1, &events);
- EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- EXPECT_EQ(CCActiveAnimation::Paused, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
+ // Synchronize the start times.
+ EXPECT_EQ(1u, events.size());
+ controller->notifyAnimationStarted(events[0]);
+ EXPECT_EQ(controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime());
+
+ // Start the animation on the main thread. Should not affect the start time.
+ controller->animate(1.5, 0);
+ EXPECT_EQ(controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime(), controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->startTime());
}
-TEST(CCLayerAnimationControllerTest, syncAbortedAnimation)
+TEST(CCLayerAnimationControllerTest, syncPauseAndResume)
{
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controllerImpl(CCLayerAnimationControllerImpl::create(&dummy));
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummyImpl;
+ OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- addOpacityTransitionToController(*controller, 1, 0, 1);
+ addOpacityTransitionToController(*controller, 1, 0, 1, false);
- controller->synchronizeAnimations(controllerImpl.get());
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
- controller->removeAnimation(0);
+ // Start the animations on each controller.
+ CCAnimationEventsVector events;
+ controllerImpl->animate(0, &events);
+ controller->animate(0, 0);
+ EXPECT_EQ(CCActiveAnimation::Running, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
+ EXPECT_EQ(CCActiveAnimation::Running, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
- // Abort an animation from the main thread.
- controller->synchronizeAnimations(controllerImpl.get());
+ // Pause the main-thread animation.
+ controller->suspendAnimations(1);
+ EXPECT_EQ(CCActiveAnimation::Paused, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
- EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
+ // The pause run state change should make it to the impl thread controller.
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
+ EXPECT_EQ(CCActiveAnimation::Paused, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
+
+ // Resume the main-thread animation.
+ controller->resumeAnimations(2);
+ EXPECT_EQ(CCActiveAnimation::Running, controller->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
+
+ // The pause run state change should make it to the impl thread controller.
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
+ EXPECT_EQ(CCActiveAnimation::Running, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
}
-TEST(CCLayerAnimationControllerTest, syncCompletedAnimation)
+
+TEST(CCLayerAnimationControllerTest, doNotSyncFinishedAnimation)
{
- FakeLayerAnimationControllerImplClient dummy;
- OwnPtr<CCLayerAnimationControllerImpl> controllerImpl(CCLayerAnimationControllerImpl::create(&dummy));
- OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummyImpl;
+ OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(CCLayerAnimationController::create(&dummy));
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
- addOpacityTransitionToController(*controller, 1, 0, 1);
+ addOpacityTransitionToController(*controller, 1, 0, 1, false);
- controller->synchronizeAnimations(controllerImpl.get());
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
EXPECT_TRUE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
- // Step through the animation until it is finished. At the next sync, the main thread's animation should be cleared.
- OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
- controllerImpl->animate(0, *events);
- controllerImpl->animate(2, *events);
+ // Notify main thread controller that the animation has started.
+ CCAnimationEvent animationStartedEvent(CCAnimationEvent::Started, 0, 0, CCActiveAnimation::Opacity, 0);
+ controller->notifyAnimationStarted(animationStartedEvent);
+
+ // Force animation to complete on impl thread.
+ controllerImpl->removeAnimation(0);
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
+
+ controller->pushAnimationUpdatesTo(controllerImpl.get());
+
+ // Even though the main thread has a 'new' animation, it should not be pushed because the animation has already completed on the impl thread.
+ EXPECT_FALSE(controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity));
+}
+
+// Tests that transitioning opacity from 0 to 1 works as expected.
+TEST(CCLayerAnimationControllerTest, TrivialTransition)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+
+ controller->add(toAdd.release());
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_EQ(1, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests animations that are waiting for a synchronized start time do not finish.
+TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+ toAdd->setNeedsSynchronizedStartTime(true);
+
+ // We should pause at the first keyframe indefinitely waiting for that animation to start.
+ controller->add(toAdd.release());
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(2, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+
+ // Send the synchronized start time.
+ controller->notifyAnimationStarted(CCAnimationEvent(CCAnimationEvent::Started, 0, 1, CCActiveAnimation::Opacity, 2));
+ controller->animate(5, events.get());
+ EXPECT_EQ(1, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests that two queued animations affecting the same property run in sequence.
+TEST(CCLayerAnimationControllerTest, TrivialQueuing)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ 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->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+ controller->animate(2, events.get());
+ EXPECT_EQ(0.5, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests interrupting a transition with another transition.
+TEST(CCLayerAnimationControllerTest, Interrupt)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+ controller->add(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());
+
+ // Since the animation was in the WaitingForNextTick state, it should start right in
+ // this call to animate.
+ controller->animate(0.5, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+ controller->animate(1.5, events.get());
+ EXPECT_EQ(0.5, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests scheduling two animations to run together when only one property is free.
+TEST(CCLayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
- controller->synchronizeAnimations(controllerImpl.get());
+ 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->animate(0, events.get());
+ EXPECT_EQ(0, dummy.opacity());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ controller->animate(1, events.get());
+ // Should not have started the float transition yet.
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ // The float animation should have started at time 1 and should be done.
+ controller->animate(2, events.get());
+ EXPECT_EQ(1, dummy.opacity());
EXPECT_FALSE(controller->hasActiveAnimation());
}
+// Tests scheduling two animations to run together with different lengths and another
+// animation queued to start when the shorter animation finishes (should wait
+// for both to finish).
+TEST(CCLayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ 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));
+
+ // Animations with id 1 should both start now.
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ // The opacity animation should have finished at time 1, but the group
+ // of animations with id 1 don't finish until time 2 because of the length
+ // of the transform animation.
+ controller->animate(2, events.get());
+ // Should not have started the float transition yet.
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+
+ // The second opacity animation should start at time 2 and should be done by time 3
+ controller->animate(3, events.get());
+ EXPECT_EQ(0.5, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests scheduling an animation to start in the future.
+TEST(CCLayerAnimationControllerTest, ScheduleAnimation)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ 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->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(2, events.get());
+ EXPECT_EQ(1, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests scheduling an animation to start in the future that's interrupting a running animation.
+TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ controller->add(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());
+
+ // First 2s opacity transition should start immediately.
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(0.5, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.5, dummy.opacity());
+ controller->animate(2, events.get());
+ EXPECT_EQ(0, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Tests scheduling an animation to start in the future that interrupts a running animation
+// and there is yet another animation queued to start later.
+TEST(CCLayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ controller->add(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->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 0.75)), 3, CCActiveAnimation::Opacity));
+
+ // First 2s opacity transition should start immediately.
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(0.5, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.5, dummy.opacity());
+ controller->animate(3, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(4, events.get());
+ EXPECT_EQ(0.75, dummy.opacity());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
+// Test that a looping animation loops and for the correct number of iterations.
+TEST(CCLayerAnimationControllerTest, TrivialLooping)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+ toAdd->setIterations(3);
+ controller->add(toAdd.release());
+
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1.25, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ controller->animate(1.75, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+ controller->animate(2.25, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ controller->animate(2.75, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+ controller->animate(3, events.get());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+
+ // Just be extra sure.
+ controller->animate(4, events.get());
+ EXPECT_EQ(1, dummy.opacity());
+}
+
+// Test that an infinitely looping animation does indeed go until aborted.
+TEST(CCLayerAnimationControllerTest, InfiniteLooping)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ 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->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1.25, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ controller->animate(1.75, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+
+ controller->animate(1073741824.25, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.25, dummy.opacity());
+ controller->animate(1073741824.75, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+
+ EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
+ controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 0.75);
+ EXPECT_FALSE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+}
+
+// Test that pausing and resuming work as expected.
+TEST(CCLayerAnimationControllerTest, PauseResume)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ CCLayerAnimationController::create(&dummy));
+
+ const int id = 1;
+ controller->add(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), id, CCActiveAnimation::Opacity));
+
+ controller->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(0.5, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.5, dummy.opacity());
+
+ EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
+ controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Paused, 0.5);
+
+ controller->animate(1024, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.5, dummy.opacity());
+
+ EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
+ controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Running, 1024);
+
+ controller->animate(1024.25, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+ controller->animate(1024.5, events.get());
+ EXPECT_FALSE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+}
+
+TEST(CCLayerAnimationControllerTest, AbortAGroupedAnimation)
+{
+ OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+ FakeLayerAnimationControllerClient dummy;
+ OwnPtr<CCLayerAnimationController> controller(
+ 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->animate(0, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0, dummy.opacity());
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(0.5, dummy.opacity());
+
+ EXPECT_TRUE(controller->getActiveAnimation(id, CCActiveAnimation::Opacity));
+ controller->getActiveAnimation(id, CCActiveAnimation::Opacity)->setRunState(CCActiveAnimation::Aborted, 1);
+ controller->animate(1, events.get());
+ EXPECT_TRUE(controller->hasActiveAnimation());
+ EXPECT_EQ(1, dummy.opacity());
+ controller->animate(2, events.get());
+ EXPECT_TRUE(!controller->hasActiveAnimation());
+ EXPECT_EQ(0.75, dummy.opacity());
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
index 8a9f35dc8..36c1082b7 100644
--- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp
@@ -81,7 +81,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly)
IntSize arbitraryIntSize = IntSize(111, 222);
IntPoint arbitraryIntPoint = IntPoint(333, 444);
IntRect arbitraryIntRect = IntRect(arbitraryIntPoint, arbitraryIntSize);
- FloatRect arbitraryFloatRect = FloatRect(arbitraryFloatPoint, FloatSize(1.234, 5.678));
+ FloatRect arbitraryFloatRect = FloatRect(arbitraryFloatPoint, FloatSize(1.234f, 5.678f));
Color arbitraryColor = Color(10, 20, 30);
TransformationMatrix arbitraryTransform;
arbitraryTransform.scale3d(0.1, 0.2, 0.3);
@@ -112,7 +112,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setDebugBorderWidth(arbitraryNumber));
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setDrawsContent(true));
EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundColor(Color::gray));
- EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundCoversViewport(true));
+ EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->setBackgroundFilters(arbitraryFilters));
// Special case: check that sublayer transform changes all layer's descendants, but not the layer itself.
root->resetAllChangeTrackingForSubtree();
diff --git a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
index 2f5a7a25d..f5eae7f84 100644
--- a/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp
@@ -47,7 +47,7 @@ public:
int m_countRepresentingContributingSurface;
int m_countRepresentingItself;
- virtual bool drawsContent() const { return m_drawsContent; }
+ virtual bool drawsContent() const OVERRIDE { return m_drawsContent; }
void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; }
private:
diff --git a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp
index a533c9373..65db549ba 100644
--- a/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerSorterTest.cpp
@@ -27,6 +27,7 @@
#include "cc/CCLayerSorter.h"
#include "cc/CCLayerImpl.h"
+#include "cc/CCMathUtil.h"
#include "cc/CCSingleThreadProxy.h"
#include <gtest/gtest.h>
@@ -34,81 +35,94 @@ using namespace WebCore;
namespace {
-TEST(CCLayerSorterTest, PointInTriangle)
+// Note: In the following overlap tests, the "camera" is looking down the negative Z axis,
+// meaning that layers with smaller z values (more negative) are further from the camera
+// and therefore must be drawn before layers with higher z values.
+
+TEST(CCLayerSorterTest, BasicOverlap)
{
- FloatPoint a(10.0, 10.0);
- FloatPoint b(30.0, 10.0);
- FloatPoint c(20.0, 20.0);
-
- // Point in the center is in the triangle.
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), a, b, c));
-
- // Permuting the corners doesn't change the result.
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), a, c, b));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), b, a, c));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), b, c, a));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), c, a, b));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 15.0), c, b, a));
-
- // Points on the edges are not in the triangle.
- EXPECT_FALSE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 10.0), a, b, c));
- EXPECT_FALSE(CCLayerSorter::pointInTriangle(FloatPoint(15.0, 15.0), a, b, c));
- EXPECT_FALSE(CCLayerSorter::pointInTriangle(FloatPoint(25.0, 15.0), a, b, c));
-
- // Points just inside the edges are in the triangle.
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(20.0, 10.01), a, b, c));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(15.01, 15.0), a, b, c));
- EXPECT_TRUE(CCLayerSorter::pointInTriangle(FloatPoint(24.99, 15.0), a, b, c));
-
- // Zero-area triangle doesn't intersect any point.
- EXPECT_FALSE(CCLayerSorter::pointInTriangle(FloatPoint(15.0, 10.0), a, b, FloatPoint(20.0, 10.0)));
+ CCLayerSorter::ABCompareResult overlapResult;
+ const float zThreshold = 0.1f;
+ float weight = 0;
+
+ // Trivial test, with one layer directly obscuring the other.
+ TransformationMatrix neg4Translate;
+ neg4Translate.translate3d(0, 0, -4);
+ CCLayerSorter::LayerShape front(2, 2, neg4Translate);
+
+ TransformationMatrix neg5Translate;
+ neg5Translate.translate3d(0, 0, -5);
+ CCLayerSorter::LayerShape back(2, 2, neg5Translate);
+
+ overlapResult = CCLayerSorter::checkOverlap(&front, &back, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult);
+ EXPECT_EQ(1, weight);
+
+ overlapResult = CCLayerSorter::checkOverlap(&back, &front, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult);
+ EXPECT_EQ(1, weight);
+
+ // One layer translated off to the right. No overlap should be detected.
+ TransformationMatrix rightTranslate;
+ rightTranslate.translate3d(10, 0, -5);
+ CCLayerSorter::LayerShape backRight(2, 2, rightTranslate);
+ overlapResult = CCLayerSorter::checkOverlap(&front, &backRight, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::None, overlapResult);
+
+ // When comparing a layer with itself, z difference is always 0.
+ overlapResult = CCLayerSorter::checkOverlap(&front, &front, zThreshold, weight);
+ EXPECT_EQ(0, weight);
}
-TEST(CCLayerSorterTest, CalculateZDiff)
+TEST(CCLayerSorterTest, RightAngleOverlap)
{
- // This should be bigger than the range of z values used.
- const float threshold = 10.0;
+ CCLayerSorter::ABCompareResult overlapResult;
+ const float zThreshold = 0.1f;
+ float weight = 0;
+
+ TransformationMatrix perspectiveMatrix;
+ perspectiveMatrix.applyPerspective(1000);
+
+ // Two layers forming a right angle with a perspective viewing transform.
+ TransformationMatrix leftFaceMatrix;
+ leftFaceMatrix.rotate3d(0, 1, 0, -90).translateRight3d(-1, 0, -5);
+ CCLayerSorter::LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix);
+ TransformationMatrix frontFaceMatrix;
+ frontFaceMatrix.translate3d(0, 0, -4);
+ CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix);
+
+ overlapResult = CCLayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::BBeforeA, overlapResult);
+}
- // Trivial test, with one layer directly obscuring the other.
+TEST(CCLayerSorterTest, IntersectingLayerOverlap)
+{
+ CCLayerSorter::ABCompareResult overlapResult;
+ const float zThreshold = 0.1f;
+ float weight = 0;
+
+ TransformationMatrix perspectiveMatrix;
+ perspectiveMatrix.applyPerspective(1000);
+
+ // Intersecting layers. An explicit order will be returned based on relative z
+ // values at the overlapping features but the weight returned should be zero.
+ TransformationMatrix frontFaceMatrix;
+ frontFaceMatrix.translate3d(0, 0, -4);
+ CCLayerSorter::LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix);
+
+ TransformationMatrix throughMatrix;
+ throughMatrix.rotate3d(0, 1, 0, 45).translateRight3d(0, 0, -4);
+ CCLayerSorter::LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix);
+ overlapResult = CCLayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight);
+ EXPECT_NE(CCLayerSorter::None, overlapResult);
+ EXPECT_EQ(0, weight);
+}
- CCLayerSorter::LayerShape front(
- FloatPoint3D(-1.0, 1.0, 5.0),
- FloatPoint3D(1.0, 1.0, 5.0),
- FloatPoint3D(1.0, -1.0, 5.0),
- FloatPoint3D(-1.0, -1.0, 5.0));
-
- CCLayerSorter::LayerShape back(
- FloatPoint3D(-1.0, 1.0, 4.0),
- FloatPoint3D(1.0, 1.0, 4.0),
- FloatPoint3D(1.0, -1.0, 4.0),
- FloatPoint3D(-1.0, -1.0, 4.0));
-
- EXPECT_GT(CCLayerSorter::calculateZDiff(front, back, threshold), 0.0);
- EXPECT_LT(CCLayerSorter::calculateZDiff(back, front, threshold), 0.0);
-
- // When comparing a layer with itself, zDiff is always 0.
- EXPECT_EQ(CCLayerSorter::calculateZDiff(front, front, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(back, back, threshold), 0.0);
-
- // Same again but with two layers that intersect only at one point (0,0).
- // This *does* count as obscuring, so we should get the same results.
-
- front = CCLayerSorter::LayerShape(
- FloatPoint3D(-1.0, 0.0, 5.0),
- FloatPoint3D(0.0, 0.0, 5.0),
- FloatPoint3D(0.0, -1.0, 5.0),
- FloatPoint3D(-1.0, -1.0, 5.0));
-
- back = CCLayerSorter::LayerShape(
- FloatPoint3D(0.0, 1.0, 4.0),
- FloatPoint3D(1.0, 1.0, 4.0),
- FloatPoint3D(1.0, 0.0, 4.0),
- FloatPoint3D(0.0, 0.0, 4.0));
-
- EXPECT_GT(CCLayerSorter::calculateZDiff(front, back, threshold), 0.0);
- EXPECT_LT(CCLayerSorter::calculateZDiff(back, front, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(front, front, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(back, back, threshold), 0.0);
+TEST(CCLayerSorterTest, LayersAtAngleOverlap)
+{
+ CCLayerSorter::ABCompareResult overlapResult;
+ const float zThreshold = 0.1f;
+ float weight = 0;
// Trickier test with layers at an angle.
//
@@ -120,42 +134,64 @@ TEST(CCLayerSorterTest, CalculateZDiff)
// +z /
//
// C is in front of A and behind B (not what you'd expect by comparing centers).
- // A and B don't overlap, so they're incomparable (zDiff = 0).
-
- const float yHi = 10.0;
- const float yLo = -10.0;
- const float zA = 1.0;
- const float zB = -1.0;
-
- CCLayerSorter::LayerShape layerA(
- FloatPoint3D(-10.0, yHi, zA),
- FloatPoint3D(-2.0, yHi, zA),
- FloatPoint3D(-2.0, yLo, zA),
- FloatPoint3D(-10.0, yLo, zA));
-
- CCLayerSorter::LayerShape layerB(
- FloatPoint3D(2.0, yHi, zB),
- FloatPoint3D(10.0, yHi, zB),
- FloatPoint3D(10.0, yLo, zB),
- FloatPoint3D(2.0, yLo, zB));
-
- CCLayerSorter::LayerShape layerC(
- FloatPoint3D(-5.0, yHi, 5.0),
- FloatPoint3D(5.0, yHi, -5.0),
- FloatPoint3D(5.0, yLo, -5.0),
- FloatPoint3D(-5.0, yLo, 5.0));
-
- EXPECT_EQ(CCLayerSorter::calculateZDiff(layerA, layerA, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(layerA, layerB, threshold), 0.0);
- EXPECT_LT(CCLayerSorter::calculateZDiff(layerA, layerC, threshold), 0.0);
-
- EXPECT_EQ(CCLayerSorter::calculateZDiff(layerB, layerA, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(layerB, layerB, threshold), 0.0);
- EXPECT_GT(CCLayerSorter::calculateZDiff(layerB, layerC, threshold), 0.0);
-
- EXPECT_GT(CCLayerSorter::calculateZDiff(layerC, layerA, threshold), 0.0);
- EXPECT_LT(CCLayerSorter::calculateZDiff(layerC, layerB, threshold), 0.0);
- EXPECT_EQ(CCLayerSorter::calculateZDiff(layerC, layerC, threshold), 0.0);
+ // A and B don't overlap, so they're incomparable.
+
+ TransformationMatrix transformA;
+ transformA.translate3d(-6, 0, 1);
+ CCLayerSorter::LayerShape layerA(8, 20, transformA);
+
+ TransformationMatrix transformB;
+ transformB.translate3d(6, 0, -1);
+ CCLayerSorter::LayerShape layerB(8, 20, transformB);
+
+ TransformationMatrix transformC;
+ transformC.rotate3d(0, 1, 0, 40);
+ CCLayerSorter::LayerShape layerC(8, 20, transformC);
+
+ overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult);
+ overlapResult = CCLayerSorter::checkOverlap(&layerC, &layerB, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult);
+ overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::None, overlapResult);
+}
+
+TEST(CCLayerSorterTest, LayersUnderPathologicalPerspectiveTransform)
+{
+ CCLayerSorter::ABCompareResult overlapResult;
+ const float zThreshold = 0.1f;
+ float weight = 0;
+
+ // On perspective projection, if w becomes negative, the re-projected point will be
+ // invalid and un-usable. Correct code needs to clip away portions of the geometry
+ // where w < 0. If the code uses the invalid value, it will think that a layer has
+ // different bounds than it really does, which can cause things to sort incorrectly.
+
+ TransformationMatrix perspectiveMatrix;
+ perspectiveMatrix.applyPerspective(1);
+
+ TransformationMatrix transformA;
+ transformA.translate3d(-15, 0, -2);
+ CCLayerSorter::LayerShape layerA(10, 10, perspectiveMatrix * transformA);
+
+ // With this sequence of transforms, when layer B is correctly clipped, it will be
+ // visible on the left half of the projection plane, in front of layerA. When it is
+ // not clipped, its bounds will actually incorrectly appear much smaller and the
+ // correct sorting dependency will not be found.
+ TransformationMatrix transformB;
+ transformB.translate3d(0, 0, 0.7);
+ transformB.rotate3d(0, 45, 0);
+ CCLayerSorter::LayerShape layerB(10, 10, perspectiveMatrix * transformB);
+
+ // Sanity check that the test case actually covers the intended scenario, where part
+ // of layer B go behind the w = 0 plane.
+ FloatQuad testQuad = FloatQuad(FloatRect(FloatPoint(-0.5, -0.5), FloatSize(1, 1)));
+ bool clipped = false;
+ CCMathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped);
+ ASSERT_TRUE(clipped);
+
+ overlapResult = CCLayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weight);
+ EXPECT_EQ(CCLayerSorter::ABeforeB, overlapResult);
}
TEST(CCLayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff)
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
index e6206cc58..51a032618 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
@@ -26,14 +26,19 @@
#include "cc/CCLayerTreeHostCommon.h"
+#include "CCAnimationTestCommon.h"
#include "CCLayerTreeTestCommon.h"
#include "LayerChromium.h"
#include "TransformationMatrix.h"
+#include "TranslateTransformOperation.h"
+#include "cc/CCLayerAnimationController.h"
+#include "cc/CCMathUtil.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
namespace {
@@ -76,7 +81,7 @@ public:
{
}
- virtual bool drawsContent() const { return true; }
+ virtual bool drawsContent() const OVERRIDE { return true; }
};
TEST(CCLayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
@@ -308,6 +313,56 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->targetRenderSurface()->originTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->targetRenderSurface()->drawTransform());
+ // The screen space is the same as the target since the child surface draws into the root.
+ EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->targetRenderSurface()->screenSpaceTransform());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyTransformsForReplica)
+{
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromium> childReplica = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ parent->createRenderSurface();
+ parent->addChild(child);
+ child->addChild(grandChild);
+ child->setReplicaLayer(childReplica.get());
+
+ // Child is set up so that a new render surface should be created.
+ child->setOpacity(0.5f);
+
+ TransformationMatrix identityMatrix;
+ TransformationMatrix parentLayerTransform;
+ parentLayerTransform.scale3d(2.0, 2.0, 1.0);
+ TransformationMatrix parentTranslationToAnchor;
+ parentTranslationToAnchor.translate(2.5, 3.0);
+ TransformationMatrix parentSublayerMatrix;
+ parentSublayerMatrix.scale3d(10.0, 10.0, 3.3);
+ TransformationMatrix parentTranslationToCenter;
+ parentTranslationToCenter.translate(5.0, 6.0);
+ TransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
+ * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
+ TransformationMatrix childTranslationToCenter;
+ childTranslationToCenter.translate(8.0, 9.0);
+ TransformationMatrix replicaLayerTransform;
+ replicaLayerTransform.scale3d(3.0, 3.0, 1.0);
+ TransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform;
+
+ // Child's render surface should not exist yet.
+ ASSERT_FALSE(child->renderSurface());
+
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25f, 0.25f), FloatPoint(2.5f, 3.0f), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(-0.5f, -0.5f), IntSize(1, 1), false);
+ setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, FloatPoint(0.0f, 0.0f), FloatPoint(0.0f, 0.0f), IntSize(0, 0), false);
+ executeCalculateDrawTransformsAndVisibility(parent.get());
+
+ // Render surface should have been created now.
+ ASSERT_TRUE(child->renderSurface());
+ ASSERT_EQ(child->renderSurface(), child->targetRenderSurface());
+
+ EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->targetRenderSurface()->replicaOriginTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->targetRenderSurface()->replicaScreenSpaceTransform());
}
TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
@@ -315,6 +370,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// This test creates a more complex tree and verifies it all at once. This covers the following cases:
// - layers that are described w.r.t. a render surface: should have draw transforms described w.r.t. that surface
// - A render surface described w.r.t. an ancestor render surface: should have a draw transform described w.r.t. that ancestor surface
+ // - Replicas of a render surface are described w.r.t. the replica's transform around its anchor, along with the surface itself.
// - Sanity check on recursion: verify transforms of layers described w.r.t. a render surface that is described w.r.t. an ancestor render surface.
// - verifying that each layer has a reference to the correct renderSurface and targetRenderSurface values.
@@ -324,6 +380,8 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
RefPtr<LayerChromium> childOfRoot = LayerChromium::create();
RefPtr<LayerChromium> childOfRS1 = LayerChromium::create();
RefPtr<LayerChromium> childOfRS2 = LayerChromium::create();
+ RefPtr<LayerChromium> replicaOfRS1 = LayerChromium::create();
+ RefPtr<LayerChromium> replicaOfRS2 = LayerChromium::create();
RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create();
RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
@@ -336,6 +394,8 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
childOfRoot->addChild(grandChildOfRoot);
childOfRS1->addChild(grandChildOfRS1);
childOfRS2->addChild(grandChildOfRS2);
+ renderSurface1->setReplicaLayer(replicaOfRS1.get());
+ renderSurface2->setReplicaLayer(replicaOfRS2.get());
// In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
renderSurface1->setOpacity(0.5f);
@@ -344,6 +404,7 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// All layers in the tree are initialized with an anchor at 2.5 and a size of (10,10).
// matrix "A" is the composite layer transform used in all layers, centered about the anchor point
// matrix "B" is the sublayer transform used in all layers, centered about the center position of the layer.
+ // matrix "R" is the composite replica transform used in all replica layers.
//
// x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative).
// y component has a translation by 1.0 for every ancestor, which indicates the "depth" of the layer in the hierarchy.
@@ -355,9 +416,12 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
layerTransform.translate(1.0, 1.0);
TransformationMatrix sublayerTransform;
sublayerTransform.scale3d(10.0, 1.0, 1.0);
+ TransformationMatrix replicaLayerTransform;
+ replicaLayerTransform.scale3d(-2.0, 5.0, 1.0);
TransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse();
TransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse();
+ TransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse();
setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
@@ -368,6 +432,8 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, FloatPoint(), FloatPoint(2.5f, 0.0f), IntSize(), false);
+ setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, FloatPoint(), FloatPoint(2.5f, 0.0f), IntSize(), false);
executeCalculateDrawTransformsAndVisibility(parent.get());
@@ -433,8 +499,14 @@ TEST(CCLayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
//
// Origin transform of render surface 1 is described with respect to root.
EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaOriginTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A, renderSurface1->renderSurface()->screenSpaceTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * R, renderSurface1->renderSurface()->replicaScreenSpaceTransform());
// Origin transform of render surface 2 is described with respect to render surface 2.
EXPECT_TRANSFORMATION_MATRIX_EQ(B * A, renderSurface2->renderSurface()->originTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(B * R, renderSurface2->renderSurface()->replicaOriginTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * A, renderSurface2->renderSurface()->screenSpaceTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(A * B * A * B * R, renderSurface2->renderSurface()->replicaScreenSpaceTransform());
// Sanity check. If these fail there is probably a bug in the test itself.
// It is expected that we correctly set up transforms so that the y-component of the screen-space transform
@@ -457,7 +529,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForClipLayer)
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
- renderSurface1->setOpacity(0.9);
+ renderSurface1->setOpacity(0.9f);
const TransformationMatrix identityMatrix;
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
@@ -550,9 +622,58 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
child->setMasksToBounds(true);
- child->setOpacity(0.4);
- grandChild->setOpacity(0.5);
- greatGrandChild->setOpacity(0.4);
+ child->setOpacity(0.4f);
+ grandChild->setOpacity(0.5f);
+ greatGrandChild->setOpacity(0.4f);
+
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too.
+ parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
+ renderSurfaceLayerList.append(parent.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ ASSERT_EQ(2U, renderSurfaceLayerList.size());
+ EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
+ EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfacesCrashRepro)
+{
+ // This is a similar situation as verifyClipRectCullsRenderSurfaces, except that
+ // it reproduces a crash bug http://code.google.com/p/chromium/issues/detail?id=106734.
+
+ const TransformationMatrix identityMatrix;
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild = LayerChromium::create();
+ RefPtr<LayerChromium> greatGrandChild = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ parent->createRenderSurface();
+ parent->addChild(child);
+ child->addChild(grandChild);
+ grandChild->addChild(greatGrandChild);
+
+ // leafNode1 ensures that parent and child are kept on the renderSurfaceLayerList,
+ // even though grandChild and greatGrandChild should be clipped.
+ child->addChild(leafNode1);
+ greatGrandChild->addChild(leafNode2);
+
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+
+ child->setMasksToBounds(true);
+ child->setOpacity(0.4f);
+ grandChild->setOpacity(0.5f);
+ greatGrandChild->setOpacity(0.4f);
// Contaminate the grandChild and greatGrandChild's clipRect to reproduce the crash
// bug found in http://code.google.com/p/chromium/issues/detail?id=106734. In this
@@ -561,9 +682,6 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
// renderSurface remains on the renderSurfaceLayerList, which violates the assumption
// that an empty renderSurface will always be the last item on the list, which
// ultimately caused the crash.
- //
- // FIXME: it is also useful to test with this commented out. Eventually we should
- // create several test cases that test clipRect/drawableContentRect computation.
child->setClipRect(IntRect(IntPoint::zero(), IntSize(20, 20)));
greatGrandChild->setClipRect(IntRect(IntPoint::zero(), IntSize(1234, 1234)));
@@ -582,6 +700,631 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id());
}
+TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToLayers)
+{
+ // Verify that layers get the appropriate clipRects when their parent masksToBounds is true.
+ //
+ // grandChild1 - completely inside the region; clipRect should be the mask region (larger than this layer's bounds).
+ // grandChild2 - partially clipped but NOT masksToBounds; the clipRect should be the parent's clipRect regardless of the layer's bounds.
+ // grandChild3 - partially clipped and masksToBounds; the clipRect will be the intersection of layerBounds and the mask region.
+ // grandChild4 - outside parent's clipRect, and masksToBounds; the clipRect should be empty.
+ //
+
+ const TransformationMatrix identityMatrix;
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild1 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild2 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild3 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild4 = LayerChromium::create();
+
+ parent->createRenderSurface();
+ parent->addChild(child);
+ child->addChild(grandChild1);
+ child->addChild(grandChild2);
+ child->addChild(grandChild3);
+ child->addChild(grandChild4);
+
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
+
+ child->setMasksToBounds(true);
+ grandChild3->setMasksToBounds(true);
+ grandChild4->setMasksToBounds(true);
+
+ // Force everyone to be a render surface.
+ child->setOpacity(0.4f);
+ grandChild1->setOpacity(0.5f);
+ grandChild2->setOpacity(0.5f);
+ grandChild3->setOpacity(0.5f);
+ grandChild4->setOpacity(0.5f);
+
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too.
+ parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
+ renderSurfaceLayerList.append(parent.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild1->clipRect());
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(20, 20)), grandChild2->clipRect());
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->clipRect());
+ EXPECT_TRUE(grandChild4->clipRect().isEmpty());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
+{
+ // Verify that renderSurfaces (and their layers) get the appropriate clipRects when their parent masksToBounds is true.
+ //
+ // Layers that own renderSurfaces (at least for now) do not inherit any clipRect;
+ // instead the surface will enforce the clip for the entire subtree. They may still
+ // have a clipRect of their own layer bounds, however, if masksToBounds was true.
+ //
+
+ const TransformationMatrix identityMatrix;
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild1 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild2 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild3 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChild4 = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode3 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> leafNode4 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+
+ parent->createRenderSurface();
+ parent->addChild(child);
+ child->addChild(grandChild1);
+ child->addChild(grandChild2);
+ child->addChild(grandChild3);
+ child->addChild(grandChild4);
+
+ // the leaf nodes ensure that these grandChildren become renderSurfaces for this test.
+ grandChild1->addChild(leafNode1);
+ grandChild2->addChild(leafNode2);
+ grandChild3->addChild(leafNode3);
+ grandChild4->addChild(leafNode4);
+
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+
+ child->setMasksToBounds(true);
+ grandChild3->setMasksToBounds(true);
+ grandChild4->setMasksToBounds(true);
+
+ // Force everyone to be a render surface.
+ child->setOpacity(0.4f);
+ grandChild1->setOpacity(0.5f);
+ grandChild2->setOpacity(0.5f);
+ grandChild3->setOpacity(0.5f);
+ grandChild4->setOpacity(0.5f);
+
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ // FIXME: when we fix this "root-layer special case" behavior in CCLayerTreeHost, we will have to fix it here, too.
+ parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
+ renderSurfaceLayerList.append(parent.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ ASSERT_TRUE(grandChild1->renderSurface());
+ ASSERT_TRUE(grandChild2->renderSurface());
+ ASSERT_TRUE(grandChild3->renderSurface());
+ EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface.
+
+ // Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds.
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect());
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect());
+ EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect());
+
+ // Layers do not inherit the clipRect from their owned surfaces, but if masksToBounds is true, they do create their own clipRect.
+ EXPECT_FALSE(grandChild1->usesLayerClipping());
+ EXPECT_FALSE(grandChild2->usesLayerClipping());
+ EXPECT_TRUE(grandChild3->usesLayerClipping());
+ EXPECT_TRUE(grandChild4->usesLayerClipping());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
+{
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromium> renderSurface1 = LayerChromium::create();
+ RefPtr<LayerChromium> renderSurface2 = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRoot = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRS1 = LayerChromium::create();
+ RefPtr<LayerChromium> childOfRS2 = LayerChromium::create();
+ RefPtr<LayerChromium> grandChildOfRoot = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChildOfRS2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ parent->createRenderSurface();
+ parent->addChild(renderSurface1);
+ parent->addChild(childOfRoot);
+ renderSurface1->addChild(childOfRS1);
+ renderSurface1->addChild(renderSurface2);
+ renderSurface2->addChild(childOfRS2);
+ childOfRoot->addChild(grandChildOfRoot);
+ childOfRS1->addChild(grandChildOfRS1);
+ childOfRS2->addChild(grandChildOfRS2);
+
+ // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
+ addOpacityTransitionToController(*renderSurface1->layerAnimationController(), 10, 1, 0, false);
+
+ // Also put an animated opacity on a layer without descendants.
+ addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false);
+
+ TransformationMatrix layerTransform;
+ layerTransform.translate(1.0, 1.0);
+ TransformationMatrix sublayerTransform;
+ sublayerTransform.scale3d(10.0, 1.0, 1.0);
+
+ // In combination with descendantDrawsContent, an animated transform forces the layer to have a new renderSurface.
+ addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0);
+
+ // Also put transform animations on grandChildOfRoot, and grandChildOfRS2
+ addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0);
+
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25f, 0.0f), FloatPoint(2.5f, 0.0f), IntSize(10, 10), false);
+
+ executeCalculateDrawTransformsAndVisibility(parent.get());
+
+ // Only layers that are associated with render surfaces should have an actual renderSurface() value.
+ //
+ ASSERT_TRUE(parent->renderSurface());
+ ASSERT_FALSE(childOfRoot->renderSurface());
+ ASSERT_FALSE(grandChildOfRoot->renderSurface());
+
+ ASSERT_TRUE(renderSurface1->renderSurface());
+ ASSERT_FALSE(childOfRS1->renderSurface());
+ ASSERT_FALSE(grandChildOfRS1->renderSurface());
+
+ ASSERT_TRUE(renderSurface2->renderSurface());
+ ASSERT_FALSE(childOfRS2->renderSurface());
+ ASSERT_FALSE(grandChildOfRS2->renderSurface());
+
+ // Verify all targetRenderSurface accessors
+ //
+ EXPECT_EQ(parent->renderSurface(), parent->targetRenderSurface());
+ EXPECT_EQ(parent->renderSurface(), childOfRoot->targetRenderSurface());
+ EXPECT_EQ(parent->renderSurface(), grandChildOfRoot->targetRenderSurface());
+
+ EXPECT_EQ(renderSurface1->renderSurface(), renderSurface1->targetRenderSurface());
+ EXPECT_EQ(renderSurface1->renderSurface(), childOfRS1->targetRenderSurface());
+ EXPECT_EQ(renderSurface1->renderSurface(), grandChildOfRS1->targetRenderSurface());
+
+ EXPECT_EQ(renderSurface2->renderSurface(), renderSurface2->targetRenderSurface());
+ EXPECT_EQ(renderSurface2->renderSurface(), childOfRS2->targetRenderSurface());
+ EXPECT_EQ(renderSurface2->renderSurface(), grandChildOfRS2->targetRenderSurface());
+
+ // Verify drawOpacityIsAnimating values
+ //
+ EXPECT_FALSE(parent->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRoot->drawOpacityIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->drawOpacityIsAnimating());
+ EXPECT_FALSE(renderSurface1->drawOpacityIsAnimating());
+ EXPECT_TRUE(renderSurface1->renderSurface()->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRS1->drawOpacityIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->drawOpacityIsAnimating());
+ EXPECT_FALSE(renderSurface2->drawOpacityIsAnimating());
+ EXPECT_FALSE(renderSurface2->renderSurface()->drawOpacityIsAnimating());
+ EXPECT_FALSE(childOfRS2->drawOpacityIsAnimating());
+ EXPECT_FALSE(grandChildOfRS2->drawOpacityIsAnimating());
+
+ // Verify drawTransformsAnimatingInTarget values
+ //
+ EXPECT_FALSE(parent->drawTransformIsAnimating());
+ EXPECT_FALSE(childOfRoot->drawTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->renderSurface()->targetSurfaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS1->drawTransformIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->drawTransformIsAnimating());
+ EXPECT_FALSE(renderSurface2->drawTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->renderSurface()->targetSurfaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS2->drawTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRS2->drawTransformIsAnimating());
+
+ // Verify drawTransformsAnimatingInScreen values
+ //
+ EXPECT_FALSE(parent->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(childOfRoot->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRoot->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(renderSurface1->renderSurface()->screenSpaceTransformsAreAnimating());
+ EXPECT_FALSE(childOfRS1->screenSpaceTransformIsAnimating());
+ EXPECT_FALSE(grandChildOfRS1->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(renderSurface2->renderSurface()->screenSpaceTransformsAreAnimating());
+ EXPECT_TRUE(childOfRS2->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(grandChildOfRS2->screenSpaceTransformIsAnimating());
+
+
+ // Sanity check. If these fail there is probably a bug in the test itself.
+ // It is expected that we correctly set up transforms so that the y-component of the screen-space transform
+ // encodes the "depth" of the layer in the tree.
+ EXPECT_FLOAT_EQ(1.0, parent->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(2.0, childOfRoot->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3.0, grandChildOfRoot->screenSpaceTransform().m42());
+
+ EXPECT_FLOAT_EQ(2.0, renderSurface1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3.0, childOfRS1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(4.0, grandChildOfRS1->screenSpaceTransform().m42());
+
+ EXPECT_FLOAT_EQ(3.0, renderSurface2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(4.0, childOfRS2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(5.0, grandChildOfRS2->screenSpaceTransform().m42());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform)
+{
+ // Test the calculateVisibleRect() function works correctly for identity transforms.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // Case 1: Layer is contained within the surface.
+ IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30));
+ IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 2: Layer is outside the surface rect.
+ layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30));
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_TRUE(actual.isEmpty());
+
+ // Case 3: Layer is partially overlapping the surface rect.
+ layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30));
+ expected = IntRect(IntPoint(80, 80), IntSize(20, 20));
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations)
+{
+ // Test the calculateVisibleRect() function works correctly for scaling transforms.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // Case 1: Layer is contained within the surface.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(10, 10);
+ IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 2: Layer is outside the surface rect.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(120, 120);
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_TRUE(actual.isEmpty());
+
+ // Case 3: Layer is partially overlapping the surface rect.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(80, 80);
+ expected = IntRect(IntPoint(0, 0), IntSize(20, 20));
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
+{
+ // Test the calculateVisibleRect() function works correctly for rotations about z-axis (i.e. 2D rotations).
+ // Remember that calculateVisibleRect() should return the visible rect in the layer's space.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // Case 1: Layer is contained within the surface.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(50, 50);
+ layerToSurfaceTransform.rotate(45);
+ IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 2: Layer is outside the surface rect.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(-50, 0);
+ layerToSurfaceTransform.rotate(45);
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_TRUE(actual.isEmpty());
+
+ // Case 3: The layer is rotated about its top-left corner. In surface space, the layer
+ // is oriented diagonally, with the left half outside of the renderSurface. In
+ // this case, the visible rect should still be the entire layer (remember the
+ // visible rect is computed in layer space); both the top-left and
+ // bottom-right corners of the layer are still visible.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.rotate(45);
+ expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 4: The layer is rotated about its top-left corner, and translated upwards. In
+ // surface space, the layer is oriented diagonally, with only the top corner
+ // of the surface overlapping the layer. In layer space, the render surface
+ // overlaps the right side of the layer. The visible rect should be the
+ // layer's right half.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(0, -sqrt(2.0) * 15);
+ layerToSurfaceTransform.rotate(45);
+ expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds.
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
+{
+ // Test that the calculateVisibleRect() function works correctly for 3d transforms.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.rotate3d(0, 45, 0);
+ IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but
+ // shifted to the side so only the right-half the layer would be visible on
+ // the surface.
+ double halfWidthOfRotatedLayer = (100.0 / sqrt(2.0)) * 0.5; // 100.0 is the un-rotated layer width; divided by sqrt(2.0) is the rotated width.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0);
+ layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer
+ expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half of the layer.
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
+{
+ // Test the calculateVisibleRect() function works correctly when the layer has a
+ // perspective projection onto the target surface.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // Case 1: Even though the layer is twice as large as the surface, due to perspective
+ // foreshortening, the layer will fit fully in the surface when its translated
+ // more than the perspective amount.
+ layerToSurfaceTransform.makeIdentity();
+
+ // The following sequence of transforms applies the perspective about the center of the surface.
+ layerToSurfaceTransform.translate(50, 50);
+ layerToSurfaceTransform.applyPerspective(9);
+ layerToSurfaceTransform.translate(-50, -50);
+
+ // This translate places the layer in front of the surface's projection plane.
+ layerToSurfaceTransform.translate3d(0, 0, -27);
+
+ IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+
+ // Case 2: same projection as before, except that the layer is also translated to the
+ // side, so that only the right half of the layer should be visible.
+ //
+ // Explanation of expected result:
+ // The perspective ratio is (z distance between layer and camera origin) / (z distance between projection plane and camera origin) == ((-27 - 9) / 9)
+ // Then, by similar triangles, if we want to move a layer by translating -50 units in projected surface units (so that only half of it is
+ // visible), then we would need to translate by (-36 / 9) * -50 == -200 in the layer's units.
+ //
+ layerToSurfaceTransform.translate3d(-200, 0, 0);
+ expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect.
+ actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehindSurface)
+{
+ // There is currently no explicit concept of an orthographic projection plane in our
+ // code (nor in the CSS spec to my knowledge). Therefore, layers that are technically
+ // behind the surface in an orthographic world should not be clipped when they are
+ // flattened to the surface.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // This sequence of transforms effectively rotates the layer about the y-axis at the
+ // center of the layer.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.translate(50, 0);
+ layerToSurfaceTransform.rotate3d(0, 45, 0);
+ layerToSurfaceTransform.translate(-50, 0);
+
+ IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveIsClipped)
+{
+ // Test the calculateVisibleRect() function works correctly when projecting a surface
+ // onto a layer, but the layer is partially behind the camera (not just behind the
+ // projection plane). In this case, the cartesian coordinates may seem to be valid,
+ // but actually they are not. The visibleRect needs to be properly clipped by the
+ // w = 0 plane in homogeneous coordinates before converting to cartesian coordinates.
+
+ IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2));
+ TransformationMatrix layerToSurfaceTransform;
+
+ // The layer is positioned so that the right half of the layer should be in front of
+ // the camera, while the other half is behind the surface's projection plane. The
+ // following sequence of transforms applies the perspective and rotation about the
+ // center of the layer.
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.applyPerspective(1);
+ layerToSurfaceTransform.translate3d(0, 0, 1);
+ layerToSurfaceTransform.rotate3d(0, 45, 0);
+
+ // Sanity check that this transform does indeed cause w < 0 when applying the
+ // transform, otherwise this code is not testing the intended scenario.
+ bool clipped = false;
+ CCMathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped);
+ ASSERT_TRUE(clipped);
+
+ int expectedXPosition = -10;
+ int expectedWidth = 10;
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_EQ(expectedXPosition, actual.x());
+ EXPECT_EQ(expectedWidth, actual.width());
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
+{
+ // To determine visibleRect in layer space, there needs to be an un-projection from
+ // surface space to layer space. When the original transform was a perspective
+ // projection that was clipped, it returns a rect that encloses the clipped bounds.
+ // Un-projecting this new rect may require clipping again.
+
+ // This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped.
+ IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
+ IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20));
+ TransformationMatrix layerToSurfaceTransform;
+ layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.applyPerspective(1);
+ layerToSurfaceTransform.translate3d(0, 0, -5);
+ layerToSurfaceTransform.rotate3d(0, 45, 0);
+ layerToSurfaceTransform.rotate3d(80, 0, 0);
+
+ // Sanity check that un-projection does indeed cause w < 0, otherwise this code is not
+ // testing the intended scenario.
+ bool clipped = false;
+ FloatRect clippedRect = CCMathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
+ CCMathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped);
+ ASSERT_TRUE(clipped);
+
+ // Only the corner of the layer is not visible on the surface because of being
+ // clipped. But, the net result of rounding visible region to an axis-aligned rect is
+ // that the entire layer should still be considered visible.
+ IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20));
+ IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ EXPECT_INT_RECT_EQ(expected, actual);
+}
+
+TEST(CCLayerTreeHostCommonTest, verifyBackFaceCulling)
+{
+ // Verify that layers are appropriately culled when their back face is showing and they are not double sided.
+ //
+ // Layers that are animating do not get culled on the main thread, as their transforms should be
+ // treated as "unknown" so we can not be sure that their back face is really showing.
+ //
+
+ const TransformationMatrix identityMatrix;
+ RefPtr<LayerChromium> parent = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> animatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> childOfAnimatingSurface = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> animatingChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+ RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
+
+ parent->createRenderSurface();
+ parent->addChild(child);
+ parent->addChild(animatingSurface);
+ animatingSurface->addChild(childOfAnimatingSurface);
+ parent->addChild(animatingChild);
+ parent->addChild(child2);
+
+ // Nothing is double-sided
+ child->setDoubleSided(false);
+ child2->setDoubleSided(false);
+ animatingSurface->setDoubleSided(false);
+ childOfAnimatingSurface->setDoubleSided(false);
+ animatingChild->setDoubleSided(false);
+
+ TransformationMatrix backfaceMatrix;
+ backfaceMatrix.translate(50, 50);
+ backfaceMatrix.rotate3d(0, 1, 0, 180);
+ backfaceMatrix.translate(-50, -50);
+
+ // Having a descendent, and animating transforms, will make the animatingSurface own a render surface.
+ addAnimatedTransformToController(*animatingSurface->layerAnimationController(), 10, 30, 0);
+ // This is just an animating layer, not a surface.
+ addAnimatedTransformToController(*animatingChild->layerAnimationController(), 10, 30, 0);
+
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(childOfAnimatingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ parent->renderSurface()->setContentRect(IntRect(IntPoint(), parent->bounds()));
+ parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
+ renderSurfaceLayerList.append(parent.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ EXPECT_FALSE(child->renderSurface());
+ EXPECT_TRUE(animatingSurface->renderSurface());
+ EXPECT_FALSE(childOfAnimatingSurface->renderSurface());
+ EXPECT_FALSE(animatingChild->renderSurface());
+ EXPECT_FALSE(child2->renderSurface());
+
+ // Verify that the animatingChild and childOfAnimatingSurface were not culled, but that child was.
+ ASSERT_EQ(2u, renderSurfaceLayerList.size());
+ EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
+ EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->id());
+
+ // The non-animating child be culled from the layer list for the parent render surface.
+ ASSERT_EQ(3u, renderSurfaceLayerList[0]->renderSurface()->layerList().size());
+ EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->id());
+ EXPECT_EQ(animatingChild->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[1]->id());
+ EXPECT_EQ(child2->id(), renderSurfaceLayerList[0]->renderSurface()->layerList()[2]->id());
+
+ ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size());
+ EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
+ EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id());
+
+ EXPECT_FALSE(child2->visibleLayerRect().isEmpty());
+
+ // But if the back face is visible, then the visibleLayerRect should be empty.
+ EXPECT_TRUE(animatingChild->visibleLayerRect().isEmpty());
+ EXPECT_TRUE(animatingSurface->visibleLayerRect().isEmpty());
+ // And any layers in the subtree should not be considered visible either.
+ EXPECT_TRUE(childOfAnimatingSurface->visibleLayerRect().isEmpty());
+}
+
// 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 d75c12890..ff2497085 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
@@ -26,16 +26,28 @@
#include "cc/CCLayerTreeHostImpl.h"
+#include "CCAnimationTestCommon.h"
+#include "CCLayerTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
#include "LayerRendererChromium.h"
#include "cc/CCLayerImpl.h"
+#include "cc/CCLayerTilingData.h"
+#include "cc/CCQuadCuller.h"
+#include "cc/CCScrollbarLayerImpl.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 <gtest/gtest.h>
+#include <public/WebVideoFrame.h>
+#include <public/WebVideoFrameProvider.h>
+using namespace CCLayerTestCommon;
using namespace WebCore;
using namespace WebKit;
+using namespace WebKitTests;
namespace {
@@ -49,11 +61,12 @@ public:
m_hostImpl = CCLayerTreeHostImpl::create(settings, this);
}
- virtual void didLoseContextOnImplThread() { }
- virtual void onSwapBuffersCompleteOnImplThread() { }
- virtual void setNeedsRedrawOnImplThread() { m_didRequestRedraw = true; }
- virtual void setNeedsCommitOnImplThread() { m_didRequestCommit = true; }
- virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) { }
+ virtual void didLoseContextOnImplThread() OVERRIDE { }
+ virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
+ virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
+ virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
+ virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { }
+ virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE { }
static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer)
{
@@ -250,7 +263,9 @@ TEST_F(CCLayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50));
root->setPosition(FloatPoint(-25, 0));
m_hostImpl->setRootLayer(root.release());
- m_hostImpl->drawLayers(); // Update draw transforms so we can correctly map points into layer space.
+ 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.
// 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);
@@ -310,7 +325,7 @@ TEST_F(CCLayerTreeHostImplTest, pinchGesture)
scrollLayer->setScrollDelta(IntSize());
scrollLayer->setScrollPosition(IntPoint(50, 50));
- float pageScaleDelta = 0.1;
+ float pageScaleDelta = 0.1f;
m_hostImpl->pinchGestureBegin();
m_hostImpl->pinchGestureUpdate(pageScaleDelta, IntPoint(0, 0));
m_hostImpl->pinchGestureEnd();
@@ -390,7 +405,7 @@ TEST_F(CCLayerTreeHostImplTest, pageScaleAnimation)
}
}
-class DidDrawCheckLayer : public CCLayerImpl {
+class DidDrawCheckLayer : public CCTiledLayerImpl {
public:
static PassOwnPtr<DidDrawCheckLayer> create(int id) { return adoptPtr(new DidDrawCheckLayer(id)); }
@@ -407,9 +422,9 @@ public:
bool didDrawCalled() const { return m_didDrawCalled; }
bool willDrawCalled() const { return m_willDrawCalled; }
-private:
+protected:
explicit DidDrawCheckLayer(int id)
- : CCLayerImpl(id)
+ : CCTiledLayerImpl(id)
, m_didDrawCalled(false)
, m_willDrawCalled(false)
{
@@ -418,6 +433,7 @@ private:
setDrawsContent(true);
}
+private:
bool m_didDrawCalled;
bool m_willDrawCalled;
};
@@ -432,10 +448,14 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ CCLayerTreeHostImpl::FrameData frame;
+
EXPECT_FALSE(root->willDrawCalled());
EXPECT_FALSE(root->didDrawCalled());
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
EXPECT_FALSE(root->willDrawCalled());
EXPECT_FALSE(root->didDrawCalled());
@@ -448,7 +468,9 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_FALSE(root->willDrawCalled());
EXPECT_FALSE(root->didDrawCalled());
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
EXPECT_TRUE(root->willDrawCalled());
EXPECT_TRUE(root->didDrawCalled());
@@ -470,14 +492,17 @@ TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
layer1->addChild(DidDrawCheckLayer::create(2));
DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0].get());
- layer1->setOpacity(0.3);
+ layer1->setOpacity(0.3f);
layer1->setPreserves3D(false);
EXPECT_FALSE(root->didDrawCalled());
EXPECT_FALSE(layer1->didDrawCalled());
EXPECT_FALSE(layer2->didDrawCalled());
- m_hostImpl->drawLayers();
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
EXPECT_TRUE(root->didDrawCalled());
EXPECT_TRUE(layer1->didDrawCalled());
@@ -487,6 +512,71 @@ TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
EXPECT_TRUE(!!layer1->renderSurface());
}
+class MissingTextureAnimatingLayer : public DidDrawCheckLayer {
+public:
+ static PassOwnPtr<MissingTextureAnimatingLayer> create(int id, bool tileMissing, bool skipsDraw, bool animating) { return adoptPtr(new MissingTextureAnimatingLayer(id, tileMissing, skipsDraw, animating)); }
+
+private:
+ explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating)
+ : DidDrawCheckLayer(id)
+ {
+ OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels);
+ tilingData->setBounds(bounds());
+ setTilingData(*tilingData.get());
+ setSkipsDraw(skipsDraw);
+ if (!tileMissing)
+ pushTileProperties(0, 0, 1, IntRect());
+ if (animating)
+ addAnimatedTransformToLayer(*this, 10, 3, 0);
+ }
+};
+
+TEST_F(CCLayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
+{
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setViewportSize(IntSize(10, 10));
+
+ // When the texture is not missing, we draw as usual.
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ root->addChild(MissingTextureAnimatingLayer::create(1, false, false, true));
+
+ CCLayerTreeHostImpl::FrameData frame;
+
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // When a texture is missing and we're not animating, we draw as usual with checkerboarding.
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
+ root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ root->addChild(MissingTextureAnimatingLayer::create(1, true, false, false));
+
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // When a texture is missing and we're animating, we don't want to draw anything.
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
+ 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);
+
+ // When the layer skips draw and we're animating, we still draw the frame.
+ m_hostImpl->setRootLayer(DidDrawCheckLayer::create(0));
+ root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ root->addChild(MissingTextureAnimatingLayer::create(1, false, true, true));
+
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+}
+
class BlendStateTrackerContext: public FakeWebGraphicsContext3D {
public:
BlendStateTrackerContext() : m_blend(false) { }
@@ -513,14 +603,20 @@ class BlendStateCheckLayer : public CCLayerImpl {
public:
static PassOwnPtr<BlendStateCheckLayer> create(int id) { return adoptPtr(new BlendStateCheckLayer(id)); }
- virtual void appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState)
+ virtual void appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) OVERRIDE
{
m_quadsAppended = true;
- Color color = m_opaqueColor ? Color::white : Color(0, 0, 0, 0);
- OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCSolidColorDrawQuad::create(sharedQuadState, IntRect(5, 5, 5, 5), color);
+ IntRect opaqueRect;
+ if (opaque() || m_opaqueContents)
+ opaqueRect = m_quadRect;
+ else
+ opaqueRect = m_opaqueContentRect;
+ OwnPtr<CCDrawQuad> testBlendingDrawQuad = CCTileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, 0, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false);
+ testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect);
EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending());
EXPECT_EQ(m_hasRenderSurface, !!renderSurface());
+ quadList.append(testBlendingDrawQuad.release());
}
void setExpectation(bool blend, bool hasRenderSurface)
@@ -532,7 +628,10 @@ public:
bool quadsAppended() const { return m_quadsAppended; }
- void setOpaqueColor(bool opaqueColor) { m_opaqueColor = opaqueColor; }
+ void setQuadRect(const IntRect& rect) { m_quadRect = rect; }
+ void setQuadVisibleRect(const IntRect& rect) { m_quadVisibleRect = rect; }
+ void setOpaqueContents(bool opaque) { m_opaqueContents = opaque; }
+ void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect; }
private:
explicit BlendStateCheckLayer(int id)
@@ -540,7 +639,9 @@ private:
, m_blend(false)
, m_hasRenderSurface(false)
, m_quadsAppended(false)
- , m_opaqueColor(true)
+ , m_opaqueContents(false)
+ , m_quadRect(5, 5, 5, 5)
+ , m_quadVisibleRect(5, 5, 5, 5)
{
setAnchorPoint(FloatPoint(0, 0));
setBounds(IntSize(10, 10));
@@ -550,7 +651,10 @@ private:
bool m_blend;
bool m_hasRenderSurface;
bool m_quadsAppended;
- bool m_opaqueColor;
+ bool m_opaqueContents;
+ IntRect m_quadRect;
+ IntRect m_opaqueContentRect;
+ IntRect m_quadVisibleRect;
};
// https://bugs.webkit.org/show_bug.cgi?id=75783
@@ -571,78 +675,96 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
root->addChild(BlendStateCheckLayer::create(1));
BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get());
+ CCLayerTreeHostImpl::FrameData frame;
+
// Opaque layer, drawn without blending.
layer1->setOpaque(true);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
- // Layer with translucent content, but solid color is opaque, so drawn without blending.
+ // Layer with translucent content, but opaque content, so drawn without blending.
layer1->setOpaque(false);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Layer with translucent content and painting, so drawn with blending.
layer1->setOpaque(false);
- layer1->setOpaqueColor(false);
+ layer1->setOpaqueContents(false);
layer1->setExpectation(true, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Layer with translucent opacity, drawn with blending.
layer1->setOpaque(true);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setOpacity(0.5);
layer1->setExpectation(true, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Layer with translucent opacity and painting, drawn with blending.
layer1->setOpaque(true);
- layer1->setOpaqueColor(false);
+ layer1->setOpaqueContents(false);
layer1->setOpacity(0.5);
layer1->setExpectation(true, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
layer1->addChild(BlendStateCheckLayer::create(2));
BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get());
// 2 opaque layers, drawn without blending.
layer1->setOpaque(true);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setOpacity(1);
layer1->setExpectation(false, false);
layer2->setOpaque(true);
- layer2->setOpaqueColor(true);
+ layer2->setOpaqueContents(true);
layer2->setOpacity(1);
layer2->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Parent layer with translucent content, drawn with blending.
// Child layer with opaque content, drawn without blending.
layer1->setOpaque(false);
- layer1->setOpaqueColor(false);
+ layer1->setOpaqueContents(false);
layer1->setExpectation(true, false);
layer2->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Parent layer with translucent content but opaque painting, drawn without blending.
// Child layer with opaque content, drawn without blending.
layer1->setOpaque(false);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setExpectation(false, false);
layer2->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Parent layer with translucent opacity and opaque content. Since it has a
// drawing child, it's drawn to a render surface which carries the opacity,
@@ -650,53 +772,196 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Child layer with opaque content, drawn without blending (parent surface
// carries the inherited opacity).
layer1->setOpaque(true);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setOpacity(0.5);
layer1->setExpectation(false, true);
layer2->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// Draw again, but with child non-opaque, to make sure
// layer1 not culled.
layer1->setOpaque(true);
- layer1->setOpaqueColor(true);
+ layer1->setOpaqueContents(true);
layer1->setOpacity(1);
layer1->setExpectation(false, false);
layer2->setOpaque(true);
- layer2->setOpaqueColor(true);
+ layer2->setOpaqueContents(true);
layer2->setOpacity(0.5);
layer2->setExpectation(true, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// A second way of making the child non-opaque.
layer1->setOpaque(true);
layer1->setOpacity(1);
layer1->setExpectation(false, false);
layer2->setOpaque(false);
- layer2->setOpaqueColor(false);
+ layer2->setOpaqueContents(false);
layer2->setOpacity(1);
layer2->setExpectation(true, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
// And when the layer says its not opaque but is painted opaque, it is not blended.
layer1->setOpaque(true);
layer1->setOpacity(1);
layer1->setExpectation(false, false);
layer2->setOpaque(false);
- layer2->setOpaqueColor(true);
+ layer2->setOpaqueContents(true);
layer2->setOpacity(1);
layer2->setExpectation(false, false);
- m_hostImpl->drawLayers();
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // Layer with partially opaque contents, drawn with blending.
+ layer1->setOpaque(false);
+ layer1->setQuadRect(IntRect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(IntRect(5, 5, 5, 5));
+ layer1->setOpaqueContents(false);
+ layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setExpectation(true, false);
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // Layer with partially opaque contents partially culled, drawn with blending.
+ layer1->setOpaque(false);
+ layer1->setQuadRect(IntRect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(IntRect(5, 5, 5, 2));
+ layer1->setOpaqueContents(false);
+ layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setExpectation(true, false);
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // Layer with partially opaque contents culled, drawn with blending.
+ layer1->setOpaque(false);
+ layer1->setQuadRect(IntRect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(IntRect(7, 5, 3, 5));
+ layer1->setOpaqueContents(false);
+ layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setExpectation(true, false);
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
+
+ // Layer with partially opaque contents and translucent contents culled, drawn without blending.
+ layer1->setOpaque(false);
+ layer1->setQuadRect(IntRect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(IntRect(5, 5, 2, 5));
+ layer1->setOpaqueContents(false);
+ layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setExpectation(false, false);
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(layer1->quadsAppended());
+ m_hostImpl->didDrawAllLayers(frame);
+
}
+TEST_F(CCLayerTreeHostImplTest, viewportCovered)
+{
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setBackgroundColor(Color::gray);
+
+ IntSize viewportSize(1000, 1000);
+ m_hostImpl->setViewportSize(viewportSize);
+
+ m_hostImpl->setRootLayer(BlendStateCheckLayer::create(0));
+ BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer());
+ root->setExpectation(false, true);
+ root->setOpaque(true);
+
+ // No gutter rects
+ {
+ IntRect layerRect(0, 0, 1000, 1000);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(0u, numGutterQuads);
+ EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ m_hostImpl->didDrawAllLayers(frame);
+ }
+
+ // Empty visible content area (fullscreen gutter rect)
+ {
+ IntRect layerRect(0, 0, 0, 0);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+ m_hostImpl->didDrawAllLayers(frame);
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(1u, numGutterQuads);
+ EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ m_hostImpl->didDrawAllLayers(frame);
+ }
+
+ // Content area in middle of clip rect (four surrounding gutter rects)
+ {
+ IntRect layerRect(500, 500, 200, 200);
+ root->setPosition(layerRect.location());
+ root->setBounds(layerRect.size());
+ root->setContentBounds(layerRect.size());
+ root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
+ root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ ASSERT_EQ(1u, frame.renderPasses.size());
+
+ size_t numGutterQuads = 0;
+ for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
+ numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == CCDrawQuad::SolidColor) ? 1 : 0;
+ EXPECT_EQ(4u, numGutterQuads);
+ EXPECT_EQ(5u, frame.renderPasses[0]->quadList().size());
+
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(-layerRect.location(), viewportSize));
+ m_hostImpl->didDrawAllLayers(frame);
+ }
+
+}
+
+
class ReshapeTrackerContext: public FakeWebGraphicsContext3D {
public:
ReshapeTrackerContext() : m_reshapeCalled(false) { }
@@ -734,8 +999,11 @@ TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw)
m_hostImpl->setRootLayer(adoptPtr(root));
EXPECT_FALSE(reshapeTracker->reshapeCalled());
- m_hostImpl->drawLayers();
+ CCLayerTreeHostImpl::FrameData frame;
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
EXPECT_TRUE(reshapeTracker->reshapeCalled());
+ m_hostImpl->didDrawAllLayers(frame);
}
class PartialSwapTrackerContext : public FakeWebGraphicsContext3D {
@@ -786,8 +1054,12 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
root->addChild(adoptPtr(child));
layerTreeHostImpl->setRootLayer(adoptPtr(root));
+ CCLayerTreeHostImpl::FrameData frame;
+
// First frame, the entire screen should get swapped.
- layerTreeHostImpl->drawLayers();
+ EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
+ layerTreeHostImpl->drawLayers(frame);
+ layerTreeHostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
IntRect actualSwapRect = partialSwapTracker->partialSwapRect();
IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500));
@@ -801,7 +1073,9 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
// expected damage rect: IntRect(IntPoint::zero(), IntSize(26, 28));
// expected swap rect: vertically flipped, with origin at bottom left corner.
child->setPosition(FloatPoint(0, 0));
- layerTreeHostImpl->drawLayers();
+ EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
+ layerTreeHostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
expectedSwapRect = IntRect(IntPoint(0, 500-28), IntSize(26, 28));
@@ -814,8 +1088,10 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
// expected damage rect: IntRect(IntPoint::zero(), IntSize(500, 500));
// expected swap rect: flipped damage rect, but also clamped to viewport
layerTreeHostImpl->setViewportSize(IntSize(10, 10));
- root->setOpacity(0.7); // this will damage everything
- layerTreeHostImpl->drawLayers();
+ root->setOpacity(0.7f); // this will damage everything
+ EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
+ layerTreeHostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
expectedSwapRect = IntRect(IntPoint::zero(), IntSize(10, 10));
@@ -825,55 +1101,12 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
}
-// Make sure that we reset damage tracking on visibility change because the
-// state of the front buffer that we push to with PostSubBuffer is undefined.
-TEST_F(CCLayerTreeHostImplTest, visibilityChangeResetsDamage)
-{
- PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
-
- // This test creates its own CCLayerTreeHostImpl, so
- // that we can force partial swap enabled.
- CCSettings settings;
- settings.partialSwapEnabled = true;
- OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
- layerTreeHostImpl->initializeLayerRenderer(context);
- layerTreeHostImpl->setViewportSize(IntSize(500, 500));
-
- CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setBounds(IntSize(500, 500));
- root->setDrawsContent(true);
- layerTreeHostImpl->setRootLayer(adoptPtr(root));
-
- // First frame: ignore.
- layerTreeHostImpl->drawLayers();
- layerTreeHostImpl->swapBuffers();
-
- // Second frame: nothing has changed --- so we souldn't push anything with partial swap.
- layerTreeHostImpl->drawLayers();
- layerTreeHostImpl->swapBuffers();
- EXPECT_TRUE(partialSwapTracker->partialSwapRect().isEmpty());
-
- // Third frame: visibility change --- so we should push a full frame with partial swap.
- layerTreeHostImpl->setVisible(false);
- layerTreeHostImpl->setVisible(true);
- layerTreeHostImpl->drawLayers();
- layerTreeHostImpl->swapBuffers();
- IntRect actualSwapRect = partialSwapTracker->partialSwapRect();
- IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500));
- EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
- EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
- EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
- EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
-}
-
// Make sure that context lost notifications are propagated through the tree.
class ContextLostNotificationCheckLayer : public CCLayerImpl {
public:
static PassOwnPtr<ContextLostNotificationCheckLayer> create(int id) { return adoptPtr(new ContextLostNotificationCheckLayer(id)); }
- virtual void didLoseContext()
+ virtual void didLoseContext() OVERRIDE
{
m_didLoseContextCalled = true;
}
@@ -927,4 +1160,218 @@ TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost)
m_hostImpl->finishAllRendering();
}
+class ScrollbarLayerFakePaint : public CCScrollbarLayerImpl {
+public:
+ static PassOwnPtr<ScrollbarLayerFakePaint> create(int id) { return adoptPtr(new ScrollbarLayerFakePaint(id)); }
+
+ virtual void paint(GraphicsContext*) { }
+
+private:
+ ScrollbarLayerFakePaint(int id) : CCScrollbarLayerImpl(id) { }
+};
+
+TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext)
+{
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setViewportSize(IntSize(10, 10));
+
+ 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());
+ }
+}
+
+// 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).
+class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D {
+public:
+ virtual WebGLId createBuffer() { return 2; }
+ virtual WebGLId createFramebuffer() { return 3; }
+ virtual WebGLId createProgram() { return 4; }
+ virtual WebGLId createRenderbuffer() { return 5; }
+ virtual WebGLId createShader(WGC3Denum) { return 6; }
+ virtual WebGLId createTexture() { return 7; }
+
+ virtual void deleteBuffer(WebGLId id)
+ {
+ if (id != 2)
+ ADD_FAILURE() << "Trying to delete buffer id " << id;
+ }
+
+ virtual void deleteFramebuffer(WebGLId id)
+ {
+ if (id != 3)
+ ADD_FAILURE() << "Trying to delete framebuffer id " << id;
+ }
+
+ virtual void deleteProgram(WebGLId id)
+ {
+ if (id != 4)
+ ADD_FAILURE() << "Trying to delete program id " << id;
+ }
+
+ virtual void deleteRenderbuffer(WebGLId id)
+ {
+ if (id != 5)
+ ADD_FAILURE() << "Trying to delete renderbuffer id " << id;
+ }
+
+ virtual void deleteShader(WebGLId id)
+ {
+ if (id != 6)
+ ADD_FAILURE() << "Trying to delete shader id " << id;
+ }
+
+ virtual void deleteTexture(WebGLId id)
+ {
+ if (id != 7)
+ ADD_FAILURE() << "Trying to delete texture id " << id;
+ }
+
+ virtual void bindBuffer(WGC3Denum, WebGLId id)
+ {
+ if (id != 2 && id)
+ ADD_FAILURE() << "Trying to bind buffer id " << id;
+ }
+
+ virtual void bindFramebuffer(WGC3Denum, WebGLId id)
+ {
+ if (id != 3 && id)
+ ADD_FAILURE() << "Trying to bind framebuffer id " << id;
+ }
+
+ virtual void useProgram(WebGLId id)
+ {
+ if (id != 4)
+ ADD_FAILURE() << "Trying to use program id " << id;
+ }
+
+ virtual void bindRenderbuffer(WGC3Denum, WebGLId id)
+ {
+ if (id != 5 && id)
+ ADD_FAILURE() << "Trying to bind renderbuffer id " << id;
+ }
+
+ virtual void attachShader(WebGLId program, WebGLId shader)
+ {
+ if ((program != 4) || (shader != 6))
+ ADD_FAILURE() << "Trying to attach shader id " << shader << " to program id " << program;
+ }
+
+ virtual void bindTexture(WGC3Denum, WebGLId id)
+ {
+ if (id != 7 && id)
+ ADD_FAILURE() << "Trying to bind texture id " << id;
+ }
+
+ static PassRefPtr<GraphicsContext3D> createGraphicsContext()
+ {
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ }
+};
+
+// Fake video frame that represents a 4x4 YUV video frame.
+class FakeVideoFrame: public WebVideoFrame {
+public:
+ FakeVideoFrame() { memset(m_data, 0x80, sizeof(m_data)); }
+ virtual ~FakeVideoFrame() { }
+ virtual Format format() const { return FormatYV12; }
+ virtual unsigned width() const { return 4; }
+ virtual unsigned height() const { return 4; }
+ virtual unsigned planes() const { return 3; }
+ virtual int stride(unsigned plane) const { return 4; }
+ virtual const void* data(unsigned plane) const { return m_data; }
+ virtual unsigned textureId() const { return 0; }
+ virtual unsigned textureTarget() const { return 0; }
+
+private:
+ char m_data[16];
+};
+
+// Fake video frame provider that always provides the same FakeVideoFrame.
+class FakeVideoFrameProvider: public WebVideoFrameProvider {
+public:
+ FakeVideoFrameProvider() : m_client(0) { }
+ virtual ~FakeVideoFrameProvider()
+ {
+ if (m_client)
+ m_client->stopUsingProvider();
+ }
+
+ virtual void setVideoFrameProviderClient(Client* client) { m_client = client; }
+ virtual WebVideoFrame* getCurrentFrame() { return &m_frame; }
+ virtual void putCurrentFrame(WebVideoFrame*) { }
+
+private:
+ FakeVideoFrame m_frame;
+ Client* m_client;
+};
+
+TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
+{
+ m_hostImpl->initializeLayerRenderer(createContext());
+ m_hostImpl->setViewportSize(IntSize(10, 10));
+
+ OwnPtr<CCLayerImpl> rootLayer(CCLayerImpl::create(0));
+ rootLayer->setBounds(IntSize(10, 10));
+ rootLayer->setAnchorPoint(FloatPoint(0, 0));
+
+ OwnPtr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(1);
+ 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(2);
+ 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(3, &provider);
+ videoLayer->setBounds(IntSize(10, 10));
+ videoLayer->setAnchorPoint(FloatPoint(0, 0));
+ videoLayer->setContentBounds(IntSize(10, 10));
+ videoLayer->setDrawsContent(true);
+ rootLayer->addChild(videoLayer.release());
+
+ 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();
+
+ // 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());
+ EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ m_hostImpl->drawLayers(frame);
+ m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->swapBuffers();
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
index 2c4e7ce59..f2382b359 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
@@ -27,12 +27,13 @@
#include "cc/CCLayerTreeHost.h"
#include "CCAnimationTestCommon.h"
+#include "CCOcclusionTrackerTestCommon.h"
+#include "CCTiledLayerTestCommon.h"
#include "CompositorFakeWebGraphicsContext3D.h"
#include "ContentLayerChromium.h"
#include "FilterOperations.h"
#include "GraphicsContext3DPrivate.h"
#include "LayerChromium.h"
-#include "Region.h"
#include "TextureManager.h"
#include "WebCompositor.h"
#include "WebKit.h"
@@ -44,10 +45,10 @@
#include "cc/CCScopedThreadProxy.h"
#include "cc/CCTextureUpdater.h"
#include "cc/CCThreadTask.h"
-#include "platform/WebKitPlatformSupport.h"
#include "platform/WebThread.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include <public/Platform.h>
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
@@ -64,8 +65,10 @@ 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() { }
@@ -74,7 +77,7 @@ public:
// Implementation of CCLayerAnimationDelegate
virtual void notifyAnimationStarted(double time) { }
- virtual void notifyAnimationFinished(int animationId) { }
+ virtual void notifyAnimationFinished(double time) { }
};
// Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
@@ -97,15 +100,23 @@ public:
m_testHooks->commitCompleteOnCCThread(this);
}
- virtual void drawLayers()
+ virtual bool prepareToDraw(FrameData& frame)
{
- CCLayerTreeHostImpl::drawLayers();
+ bool result = CCLayerTreeHostImpl::prepareToDraw(frame);
+ m_testHooks->prepareToDrawOnCCThread(this);
+ return result;
+ }
+
+ virtual void drawLayers(const FrameData& frame)
+ {
+ CCLayerTreeHostImpl::drawLayers(frame);
m_testHooks->drawLayersOnCCThread(this);
}
protected:
virtual void animateLayers(double monotonicTime, double wallClockTime)
{
+ m_testHooks->willAnimateLayers(this, monotonicTime);
CCLayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime);
m_testHooks->animateLayers(this, monotonicTime);
}
@@ -123,13 +134,13 @@ private:
// Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
class MockLayerTreeHost : public CCLayerTreeHost {
public:
- static PassRefPtr<MockLayerTreeHost> create(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
+ 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;
- RefPtr<MockLayerTreeHost> layerTreeHost = adoptRef(new MockLayerTreeHost(testHooks, client, settingsCopy));
+ OwnPtr<MockLayerTreeHost> layerTreeHost(adoptPtr(new MockLayerTreeHost(testHooks, client, settingsCopy)));
bool success = layerTreeHost->initialize();
EXPECT_TRUE(success);
layerTreeHost->setRootLayer(rootLayer);
@@ -203,7 +214,7 @@ private:
}
Vector<WebGLId> m_textures;
- HashSet<WebGLId> m_usedTextures;
+ HashSet<WebGLId, DefaultHash<WebGLId>::Hash, UnsignedWithZeroKeyHashTraits<WebGLId> > m_usedTextures;
};
// Implementation of CCLayerTreeHost callback interface.
@@ -214,22 +225,26 @@ public:
return adoptPtr(new MockLayerTreeHostClient(testHooks));
}
- virtual void updateAnimations(double monotonicTime)
+ virtual void willBeginFrame() OVERRIDE
+ {
+ }
+
+ virtual void updateAnimations(double monotonicTime) OVERRIDE
{
m_testHooks->updateAnimations(monotonicTime);
}
- virtual void layout()
+ virtual void layout() OVERRIDE
{
m_testHooks->layout();
}
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale)
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) OVERRIDE
{
m_testHooks->applyScrollAndScale(scrollDelta, scale);
}
- virtual PassRefPtr<GraphicsContext3D> createContext()
+ virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
{
GraphicsContext3D::Attributes attrs;
WebGraphicsContext3D::Attributes webAttrs;
@@ -239,21 +254,25 @@ public:
return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
}
- virtual void didCommitAndDrawFrame()
+ virtual void didCommit() OVERRIDE
+ {
+ }
+
+ virtual void didCommitAndDrawFrame() OVERRIDE
{
m_testHooks->didCommitAndDrawFrame();
}
- virtual void didCompleteSwapBuffers()
+ virtual void didCompleteSwapBuffers() OVERRIDE
{
}
- virtual void didRecreateContext(bool succeeded)
+ virtual void didRecreateContext(bool succeeded) OVERRIDE
{
m_testHooks->didRecreateContext(succeeded);
}
- virtual void scheduleComposite()
+ virtual void scheduleComposite() OVERRIDE
{
}
@@ -300,6 +319,11 @@ public:
callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsCommit, this);
}
+ void AcquireLayerTextures()
+ {
+ callOnMainThread(CCLayerTreeHostTest::dispatchAcquireLayerTextures, this);
+ }
+
void postSetNeedsRedrawToMainThread()
{
callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsRedraw, this);
@@ -340,7 +364,7 @@ protected:
static void onEndTest(void* self)
{
ASSERT(isMainThread());
- webKitPlatformSupport()->currentThread()->exitRunLoop();
+ WebKit::Platform::current()->currentThread()->exitRunLoop();
}
static void dispatchSetNeedsAnimate(void* self)
@@ -358,7 +382,7 @@ protected:
CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
ASSERT(test);
if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 1);
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
}
static void dispatchAddAnimation(void* self)
@@ -367,7 +391,7 @@ protected:
CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
ASSERT(test);
if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
- addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 1);
+ addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5, true);
}
static void dispatchSetNeedsAnimateAndCommit(void* self)
@@ -390,6 +414,15 @@ protected:
test->m_layerTreeHost->setNeedsCommit();
}
+ static void dispatchAcquireLayerTextures(void* self)
+ {
+ ASSERT(isMainThread());
+ CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+ ASSERT_TRUE(test);
+ if (test->m_layerTreeHost)
+ test->m_layerTreeHost->acquireLayerTextures();
+ }
+
static void dispatchSetNeedsRedraw(void* self)
{
ASSERT(isMainThread());
@@ -464,7 +497,7 @@ protected:
virtual void runTest(bool threaded)
{
if (threaded) {
- m_webThread = adoptPtr(webKitPlatformSupport()->createThread("CCLayerTreeHostTest"));
+ m_webThread = adoptPtr(WebKit::Platform::current()->createThread("CCLayerTreeHostTest"));
WebCompositor::initialize(m_webThread.get());
} else
WebCompositor::initialize(0);
@@ -473,10 +506,10 @@ protected:
m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread());
m_beginTask = new BeginTask(this);
- webKitPlatformSupport()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task
+ WebKit::Platform::current()->currentThread()->postDelayedTask(m_beginTask, 0); // postDelayedTask takes ownership of the task
m_timeoutTask = new TimeoutTask(this);
- webKitPlatformSupport()->currentThread()->postDelayedTask(m_timeoutTask, 5000);
- webKitPlatformSupport()->currentThread()->enterRunLoop();
+ WebKit::Platform::current()->currentThread()->postDelayedTask(m_timeoutTask, 5000);
+ WebKit::Platform::current()->currentThread()->enterRunLoop();
if (m_layerTreeHost && m_layerTreeHost->rootLayer())
m_layerTreeHost->rootLayer()->setLayerTreeHost(0);
@@ -498,7 +531,7 @@ protected:
CCSettings m_settings;
OwnPtr<MockLayerTreeHostClient> m_client;
- RefPtr<CCLayerTreeHost> m_layerTreeHost;
+ OwnPtr<CCLayerTreeHost> m_layerTreeHost;
private:
bool m_beginning;
@@ -520,6 +553,7 @@ void CCLayerTreeHostTest::doBeginTest()
m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);
ASSERT_TRUE(m_layerTreeHost);
rootLayer->setLayerTreeHost(m_layerTreeHost.get());
+ m_layerTreeHost->setSurfaceReady();
m_beginning = true;
beginTest();
@@ -806,6 +840,134 @@ TEST_F(CCLayerTreeHostTestSetNeedsRedraw, runMultiThread)
runTestThreaded();
}
+
+// beginLayerWrite should prevent draws from executing until a commit occurs
+class CCLayerTreeHostTestWriteLayersRedraw : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestWriteLayersRedraw()
+ : m_numCommits(0)
+ , m_numDraws(0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ AcquireLayerTextures();
+ postSetNeedsRedrawToMainThread(); // should be inhibited without blocking
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ EXPECT_EQ(1, impl->sourceFrameNumber());
+ m_numDraws++;
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
+ {
+ m_numCommits++;
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ EXPECT_EQ(0, m_numDraws);
+ EXPECT_EQ(1, m_numCommits);
+ }
+
+private:
+ int m_numCommits;
+ int m_numDraws;
+};
+
+TEST_F(CCLayerTreeHostTestWriteLayersRedraw, runMultiThread)
+{
+ runTestThreaded();
+}
+
+// Verify that when resuming visibility, requesting layer write permission
+// will not deadlock the main thread even though there are not yet any
+// scheduled redraws. This behavior is critical for reliably surviving tab
+// switching. There are no failure conditions to this test, it just passes
+// by not timing out.
+class CCLayerTreeHostTestWriteLayersAfterVisible : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestWriteLayersAfterVisible()
+ : m_numCommits(0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
+ {
+ m_numCommits++;
+ if (m_numCommits == 2)
+ endTest();
+ else {
+ postSetVisibleToMainThread(false);
+ postSetVisibleToMainThread(true);
+ AcquireLayerTextures();
+ postSetNeedsCommitToMainThread();
+ }
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+ int m_numCommits;
+};
+
+TEST_F(CCLayerTreeHostTestWriteLayersAfterVisible, runMultiThread)
+{
+ runTestThreaded();
+}
+
+// A compositeAndReadback while invisible should force a normal commit without assertion.
+class CCLayerTreeHostTestCompositeAndReadbackWhileInvisible : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestCompositeAndReadbackWhileInvisible()
+ : m_numCommits(0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ }
+
+ virtual void didCommitAndDrawFrame()
+ {
+ m_numCommits++;
+ if (m_numCommits == 1) {
+ m_layerTreeHost->setVisible(false);
+ m_layerTreeHost->setNeedsCommit();
+ m_layerTreeHost->setNeedsCommit();
+ OwnArrayPtr<char> pixels(adoptArrayPtr(new char[4]));
+ m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
+ } else
+ endTest();
+
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+ int m_numCommits;
+};
+
+TEST_F(CCLayerTreeHostTestCompositeAndReadbackWhileInvisible, runMultiThread)
+{
+ runTestThreaded();
+}
+
+
// Trigger a frame with setNeedsCommit. Then, inside the resulting animate
// callback, requet another frame using setNeedsAnimate. End the test when
// animate gets called yet-again, indicating that the proxy is correctly
@@ -853,7 +1015,6 @@ public:
CCLayerTreeHostTestAddAnimation()
: m_numAnimates(0)
, m_receivedAnimationStartedNotification(false)
- , m_receivedAnimationFinishedNotification(false)
, m_startTime(0)
, m_firstMonotonicTime(0)
{
@@ -878,7 +1039,6 @@ public:
EXPECT_LT(0, m_firstMonotonicTime);
EXPECT_NE(m_startTime, m_firstMonotonicTime);
EXPECT_TRUE(m_receivedAnimationStartedNotification);
- EXPECT_TRUE(m_receivedAnimationFinishedNotification);
endTest();
}
@@ -888,11 +1048,6 @@ public:
m_startTime = wallClockTime;
}
- virtual void notifyAnimationFinished(int)
- {
- m_receivedAnimationFinishedNotification = true;
- }
-
virtual void afterTest()
{
}
@@ -900,7 +1055,6 @@ public:
private:
int m_numAnimates;
bool m_receivedAnimationStartedNotification;
- bool m_receivedAnimationFinishedNotification;
double m_startTime;
double m_firstMonotonicTime;
};
@@ -947,6 +1101,153 @@ TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread)
runTestThreaded();
}
+// Ensures that animations continue to be ticked when we are backgrounded.
+class CCLayerTreeHostTestAddAnimationWithTimingFunction : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestAddAnimationWithTimingFunction()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddAnimationToMainThread();
+ }
+
+ virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
+ {
+ const CCFloatAnimationCurve* curve = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity)->curve()->toFloatAnimationCurve();
+ float startOpacity = curve->getValue(0);
+ float endOpacity = curve->getValue(curve->duration());
+ float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpacity;
+ double time = curve->duration() * 0.25;
+ // If the linear timing function associated with this animation was not picked up,
+ // then the linearly interpolated opacity would be different because of the
+ // default ease timing function.
+ EXPECT_FLOAT_EQ(linearlyInterpolatedOpacity, curve->getValue(time));
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+};
+
+TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread)
+{
+ runTestThreaded();
+}
+
+// Ensures that when opacity is being animated, this value does not cause the subtree to be skipped.
+class CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ m_layerTreeHost->rootLayer()->setDrawOpacity(1);
+ m_layerTreeHost->setViewportSize(IntSize(10, 10));
+ m_layerTreeHost->rootLayer()->setOpacity(0);
+ postAddAnimationToMainThread();
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
+ {
+ // If the subtree was skipped when preparing to draw, the layer's draw opacity
+ // will not have been updated. It should be set to 0 due to the animation.
+ // Without the animation, the layer will be skipped since it has zero opacity.
+ EXPECT_EQ(0, m_layerTreeHost->rootLayer()->drawOpacity());
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+};
+
+TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
+{
+ runTestThreaded();
+}
+
+// Ensures that main thread animations have their start times synchronized with impl thread animations.
+class CCLayerTreeHostTestSynchronizeAnimationStartTimes : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestSynchronizeAnimationStartTimes()
+ : m_layerTreeHostImpl(0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddAnimationToMainThread();
+ }
+
+ // This is guaranteed to be called before CCLayerTreeHostImpl::animateLayers.
+ virtual void willAnimateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
+ {
+ m_layerTreeHostImpl = layerTreeHostImpl;
+ }
+
+ virtual void notifyAnimationStarted(double time)
+ {
+ EXPECT_TRUE(m_layerTreeHostImpl);
+
+ CCLayerAnimationController* controllerImpl = m_layerTreeHostImpl->rootLayer()->layerAnimationController();
+ CCLayerAnimationController* controller = m_layerTreeHost->rootLayer()->layerAnimationController();
+ CCActiveAnimation* animationImpl = controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity);
+ CCActiveAnimation* animation = controller->getActiveAnimation(0, CCActiveAnimation::Opacity);
+
+ EXPECT_EQ(animationImpl->startTime(), animation->startTime());
+
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+ CCLayerTreeHostImpl* m_layerTreeHostImpl;
+};
+
+TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes, runMultiThread)
+{
+ runTestThreaded();
+}
+
+// Ensures that main thread animations have their start times synchronized with impl thread animations.
+class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestAnimationFinishedEvents()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddInstantAnimationToMainThread();
+ }
+
+ virtual void notifyAnimationFinished(double time)
+ {
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+};
+
+TEST_F(CCLayerTreeHostTestAnimationFinishedEvents, runMultiThread)
+{
+ runTestThreaded();
+}
+
class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTestThreadOnly {
public:
CCLayerTreeHostTestScrollSimple()
@@ -1096,6 +1397,38 @@ TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, DISABLED_runMultiThread)
runTestThreaded();
}
+// This test verifies that properties on the layer tree host are commited to the impl side.
+class CCLayerTreeHostTestCommit : public CCLayerTreeHostTest {
+public:
+
+ CCLayerTreeHostTestCommit() { }
+
+ virtual void beginTest()
+ {
+ m_layerTreeHost->setViewportSize(IntSize(20, 20));
+ m_layerTreeHost->setBackgroundColor(Color::gray);
+ m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5);
+
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ EXPECT_EQ(IntSize(20, 20), impl->viewportSize());
+ EXPECT_EQ(Color::gray, impl->backgroundColor());
+ EXPECT_EQ(5, impl->pageScale());
+
+ endTest();
+ }
+
+ virtual void afterTest() { }
+};
+
+TEST_F(CCLayerTreeHostTestCommit, runTest)
+{
+ runTest(true);
+}
+
// Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to
// CCLayerTreeHostImpl in the MT compositor.
class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest {
@@ -1230,33 +1563,23 @@ public:
int idlePaintContentsCount() { return m_idlePaintContentsCount; }
void resetPaintContentsCount() { m_paintContentsCount = 0; m_idlePaintContentsCount = 0;}
- int updateCount() { return m_updateCount; }
- void resetUpdateCount() { m_updateCount = 0; }
-
- virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
+ virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE
{
- ContentLayerChromium::paintContentsIfDirty(occludedScreenSpace);
+ ContentLayerChromium::update(updater, occlusion);
m_paintContentsCount++;
}
- virtual void idlePaintContentsIfDirty(const Region& occluded)
+ virtual void idleUpdate(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE
{
- ContentLayerChromium::idlePaintContentsIfDirty(occluded);
+ ContentLayerChromium::idleUpdate(updater, occlusion);
m_idlePaintContentsCount++;
}
- virtual void updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater)
- {
- ContentLayerChromium::updateCompositorResources(context, updater);
- m_updateCount++;
- }
-
private:
explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate)
: ContentLayerChromium(delegate)
, m_paintContentsCount(0)
, m_idlePaintContentsCount(0)
- , m_updateCount(0)
{
setBounds(IntSize(10, 10));
setIsDrawable(true);
@@ -1264,7 +1587,6 @@ private:
int m_paintContentsCount;
int m_idlePaintContentsCount;
- int m_updateCount;
};
// Layer opacity change during paint should not prevent compositor resources from being updated during commit.
@@ -1291,17 +1613,12 @@ public:
virtual void afterTest()
{
- // paintContentsIfDirty() should have been called once.
+ // update() should have been called once.
EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount());
- // idlePaintContentsIfDirty() should have been called once
+ // idleUpdate() should have been called once
EXPECT_EQ(1, m_updateCheckLayer->idlePaintContentsCount());
- // updateCompositorResources() should have been called the same
- // amout of times as paintContentsIfDirty().
- EXPECT_EQ(m_updateCheckLayer->paintContentsCount(),
- m_updateCheckLayer->updateCount());
-
// clear m_updateCheckLayer so CCLayerTreeHost dies.
m_updateCheckLayer.clear();
}
@@ -1330,7 +1647,8 @@ public:
IntSize viewportSize(10, 10);
layerTreeHost()->setViewportSize(viewportSize);
- layerTreeHost()->updateLayers();
+ CCTextureUpdater updater;
+ layerTreeHost()->updateLayers(updater);
EXPECT_EQ(viewportSize, layerTreeHost()->viewportSize());
EXPECT_EQ(TextureManager::highLimitBytes(viewportSize), layerTreeHost()->contentsTextureManager()->maxMemoryLimitBytes());
@@ -1457,6 +1775,18 @@ TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread)
runTest(true);
}
+static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+{
+ layer->removeAllChildren();
+ if (parent)
+ parent->addChild(layer);
+ layer->setTransform(transform);
+ layer->setAnchorPoint(anchor);
+ layer->setPosition(position);
+ layer->setBounds(bounds);
+ layer->setOpaque(opaque);
+}
+
class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestAtomicCommitWithPartialUpdate()
@@ -1471,10 +1801,11 @@ public:
virtual void beginTest()
{
m_layerTreeHost->setRootLayer(m_parent);
- m_layerTreeHost->setViewportSize(IntSize(10, 10));
- m_parent->addChild(m_child);
- m_child->setOpacity(0.5);
- m_child->setBounds(IntSize(20, 20));
+ m_layerTreeHost->setViewportSize(IntSize(10, 20));
+
+ TransformationMatrix identityMatrix;
+ setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true);
+ setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false);
postSetNeedsCommitToMainThread();
postSetNeedsRedrawToMainThread();
@@ -1518,15 +1849,31 @@ public:
EXPECT_EQ(3, context->numTextures());
// Number of textures used for commit should still be two.
EXPECT_EQ(2, context->numUsedTextures());
- // First texture should not have been used.
- EXPECT_FALSE(context->usedTexture(context->texture(0)));
- // Second texture should have been used.
- EXPECT_TRUE(context->usedTexture(context->texture(1)));
- // New textures should have been used.
+ // First texture should have been used.
+ EXPECT_TRUE(context->usedTexture(context->texture(0)));
+ // Second texture should not have been used.
+ EXPECT_FALSE(context->usedTexture(context->texture(1)));
+ // Third texture should have been used.
EXPECT_TRUE(context->usedTexture(context->texture(2)));
context->resetUsedTextures();
break;
+ case 3:
+ // Number of textures should be two.
+ EXPECT_EQ(2, context->numTextures());
+ // No textures should be used for commit.
+ EXPECT_EQ(0, context->numUsedTextures());
+
+ context->resetUsedTextures();
+ break;
+ case 4:
+ // Number of textures should be two.
+ EXPECT_EQ(2, context->numTextures());
+ // Number of textures used for commit should be one.
+ EXPECT_EQ(1, context->numUsedTextures());
+
+ context->resetUsedTextures();
+ break;
default:
ASSERT_NOT_REACHED();
break;
@@ -1537,10 +1884,14 @@ public:
{
CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
- // Number of textures used for drawing should always be two.
- EXPECT_EQ(2, context->numUsedTextures());
+ // Number of textures used for drawing should two except for frame 4
+ // where the viewport only contains one layer.
+ if (impl->frameNumber() == 4)
+ EXPECT_EQ(1, context->numUsedTextures());
+ else
+ EXPECT_EQ(2, context->numUsedTextures());
- if (impl->frameNumber() < 3) {
+ if (impl->frameNumber() < 5) {
context->resetUsedTextures();
postSetNeedsAnimateAndCommitToMainThread();
postSetNeedsRedrawToMainThread();
@@ -1561,6 +1912,13 @@ public:
m_parent->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
m_child->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
break;
+ case 3:
+ m_child->setNeedsDisplay();
+ m_layerTreeHost->setViewportSize(IntSize(10, 10));
+ break;
+ case 4:
+ m_layerTreeHost->setViewportSize(IntSize(10, 20));
+ break;
default:
ASSERT_NOT_REACHED();
break;
@@ -1593,12 +1951,14 @@ class TestLayerChromium : public LayerChromium {
public:
static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
- virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
+ virtual void update(CCTextureUpdater&, const CCOcclusionTracker* occlusion) OVERRIDE
{
- m_occludedScreenSpace = occludedScreenSpace;
+ // Gain access to internals of the CCOcclusionTracker.
+ const TestCCOcclusionTracker* testOcclusion = static_cast<const TestCCOcclusionTracker*>(occlusion);
+ m_occludedScreenSpace = testOcclusion ? testOcclusion->occlusionInScreenSpace() : Region();
}
- virtual bool drawsContent() const { return true; }
+ virtual bool drawsContent() const OVERRIDE { return true; }
const Region& occludedScreenSpace() const { return m_occludedScreenSpace; }
void clearOccludedScreenSpace() { m_occludedScreenSpace = Region(); }
@@ -1609,16 +1969,9 @@ private:
Region m_occludedScreenSpace;
};
-static void setLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+static void setTestLayerPropertiesForTesting(TestLayerChromium* layer, LayerChromium* parent, const TransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
{
- layer->removeAllChildren();
- if (parent)
- parent->addChild(layer);
- layer->setTransform(transform);
- layer->setAnchorPoint(anchor);
- layer->setPosition(position);
- layer->setBounds(bounds);
- layer->setOpaque(opaque);
+ setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque);
layer->clearOccludedScreenSpace();
}
@@ -1646,81 +1999,82 @@ public:
// positioned on the screen.
// The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ CCTextureUpdater updater;
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer is opaque, then it adds to the occlusion seen by the rootLayer.
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Add a second child to the root layer and the regions should merge
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), child2->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 20, 70, 80), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
// Move the second child to be sure.
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), child2->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 30, 90, 70), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
@@ -1729,20 +2083,20 @@ public:
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
@@ -1751,62 +2105,62 @@ public:
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), grandChild->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 40, 90, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
child->setMaskLayer(0);
child->setOpacity(0.5);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
child->setMaskLayer(0);
child->setOpacity(0.5);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), grandChild->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 40, 90, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Kill the layerTreeHost immediately.
@@ -1845,10 +2199,10 @@ public:
// If the child layer has a filter that changes alpha values, and is below child2, then child2 should contribute to occlusion on everything,
// and child shouldn't contribute to the rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
{
FilterOperations filters;
@@ -1858,24 +2212,25 @@ public:
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ CCTextureUpdater updater;
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), grandChild->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 40, 90, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree,
// and should not contribute to the rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
{
FilterOperations filters;
@@ -1885,22 +2240,23 @@ public:
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds());
- m_layerTreeHost->updateLayers();
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), child->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 70, 90, 30), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Kill the layerTreeHost immediately.
m_layerTreeHost->setRootLayer(0);
m_layerTreeHost.clear();
+ CCLayerTreeHost::setNeedsFilterContext(false);
endTest();
}
@@ -1928,10 +2284,10 @@ public:
for (int i = 0; i < numSurfaces; ++i) {
layers.append(TestLayerChromium::create());
if (!i) {
- setLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setTestLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
layers.last()->createRenderSurface();
} else {
- setLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(100-i, 100-i), true);
+ setTestLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
layers.last()->setMasksToBounds(true);
layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
}
@@ -1939,16 +2295,17 @@ public:
for (int i = 1; i < numSurfaces; ++i) {
children.append(TestLayerChromium::create());
- setLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setTestLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
}
m_layerTreeHost->setRootLayer(layers[0].get());
m_layerTreeHost->setViewportSize(layers[0]->bounds());
- m_layerTreeHost->updateLayers();
+ CCTextureUpdater updater;
+ m_layerTreeHost->updateLayers(updater);
m_layerTreeHost->commitComplete();
for (int i = 0; i < numSurfaces-1; ++i) {
- IntRect expectedOcclusion(i+1, i+1, 100-i-1, 100-i-1);
+ IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().bounds());
EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
@@ -2036,4 +2393,57 @@ TEST_F(CCLayerTreeHostTestSetRepeatedLostContext, runMultiThread)
runTestThreaded();
}
+class CCLayerTreeHostTestFractionalScroll : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestFractionalScroll()
+ : m_scrollAmount(1.75, 0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ m_layerTreeHost->rootLayer()->setScrollable(true);
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ CCLayerImpl* root = impl->rootLayer();
+ root->setMaxScrollPosition(IntSize(100, 100));
+
+ // Check that a fractional scroll delta is correctly accumulated over multiple commits.
+ if (impl->frameNumber() == 1) {
+ EXPECT_EQ(root->scrollPosition(), IntPoint(0, 0));
+ EXPECT_EQ(root->scrollDelta(), FloatSize(0, 0));
+ postSetNeedsCommitToMainThread();
+ } else if (impl->frameNumber() == 2) {
+ EXPECT_EQ(root->scrollPosition(), flooredIntPoint(m_scrollAmount));
+ EXPECT_EQ(root->scrollDelta(), FloatSize(fmod(m_scrollAmount.width(), 1), 0));
+ postSetNeedsCommitToMainThread();
+ } else if (impl->frameNumber() == 3) {
+ EXPECT_EQ(root->scrollPosition(), flooredIntPoint(m_scrollAmount + m_scrollAmount));
+ EXPECT_EQ(root->scrollDelta(), FloatSize(fmod(2 * m_scrollAmount.width(), 1), 0));
+ endTest();
+ }
+ root->scrollBy(m_scrollAmount);
+ }
+
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale)
+ {
+ IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
+ m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ }
+
+ virtual void afterTest()
+ {
+ }
+private:
+ FloatSize m_scrollAmount;
+};
+
+TEST_F(CCLayerTreeHostTestFractionalScroll, runMultiThread)
+{
+ runTestThreaded();
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h
index 0b83dacab..75e487a4a 100644
--- a/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h
+++ b/Source/WebKit/chromium/tests/CCLayerTreeTestCommon.h
@@ -27,13 +27,19 @@
namespace WebKitTests {
-// This is a macro instead of function so that we get useful line numbers where a test failed.
+// These are macros instead of functions so that we get useful line numbers where a test failed.
#define EXPECT_FLOAT_RECT_EQ(expected, actual) \
EXPECT_FLOAT_EQ((expected).location().x(), (actual).location().x()); \
EXPECT_FLOAT_EQ((expected).location().y(), (actual).location().y()); \
EXPECT_FLOAT_EQ((expected).size().width(), (actual).size().width()); \
EXPECT_FLOAT_EQ((expected).size().height(), (actual).size().height())
+#define EXPECT_INT_RECT_EQ(expected, actual) \
+ EXPECT_EQ((expected).location().x(), (actual).location().x()); \
+ EXPECT_EQ((expected).location().y(), (actual).location().y()); \
+ EXPECT_EQ((expected).size().width(), (actual).size().width()); \
+ EXPECT_EQ((expected).size().height(), (actual).size().height())
+
// This is a macro instead of a function so that we get useful line numbers where a test failed.
// Even though TransformationMatrix values are double precision, there are many other floating-point values used that affect
// the transforms, and so we only expect them to be accurate up to floating-point precision.
diff --git a/Source/WebKit/chromium/tests/CCMathUtilTest.cpp b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp
new file mode 100644
index 000000000..db0a4e53f
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCMathUtilTest.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "cc/CCMathUtil.h"
+
+#include "TransformationMatrix.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+TEST(CCMathUtilTest, verifyBackfaceVisibilityBasicCases)
+{
+ TransformationMatrix transform;
+
+ transform.makeIdentity();
+ EXPECT_FALSE(transform.isBackFaceVisible());
+
+ transform.makeIdentity();
+ transform.rotate3d(0, 80, 0);
+ EXPECT_FALSE(transform.isBackFaceVisible());
+
+ transform.makeIdentity();
+ transform.rotate3d(0, 100, 0);
+ EXPECT_TRUE(transform.isBackFaceVisible());
+
+ // Edge case, 90 degree rotation should return false.
+ transform.makeIdentity();
+ transform.rotate3d(0, 90, 0);
+ EXPECT_FALSE(transform.isBackFaceVisible());
+}
+
+TEST(CCMathUtilTest, verifyBackfaceVisibilityForPerspective)
+{
+ TransformationMatrix layerSpaceToProjectionPlane;
+
+ // This tests if isBackFaceVisible works properly under perspective transforms.
+ // Specifically, layers that may have their back face visible in orthographic
+ // projection, may not actually have back face visible under perspective projection.
+
+ // Case 1: Layer is rotated by slightly more than 90 degrees, at the center of the
+ // prespective projection. In this case, the layer's back-side is visible to
+ // the camera.
+ layerSpaceToProjectionPlane.makeIdentity();
+ layerSpaceToProjectionPlane.applyPerspective(1);
+ layerSpaceToProjectionPlane.translate3d(0, 0, 0);
+ layerSpaceToProjectionPlane.rotate3d(0, 100, 0);
+ EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible());
+
+ // Case 2: Layer is rotated by slightly more than 90 degrees, but shifted off to the
+ // side of the camera. Because of the wide field-of-view, the layer's front
+ // side is still visible.
+ //
+ // |<-- front side of layer is visible to perspective camera
+ // \ | /
+ // \ | /
+ // \| /
+ // | /
+ // |\ /<-- camera field of view
+ // | \ /
+ // back side of layer -->| \ /
+ // \./ <-- camera origin
+ //
+ layerSpaceToProjectionPlane.makeIdentity();
+ layerSpaceToProjectionPlane.applyPerspective(1);
+ layerSpaceToProjectionPlane.translate3d(-10, 0, 0);
+ layerSpaceToProjectionPlane.rotate3d(0, 100, 0);
+ EXPECT_FALSE(layerSpaceToProjectionPlane.isBackFaceVisible());
+
+ // Case 3: Additionally rotating the layer by 180 degrees should of course show the
+ // opposite result of case 2.
+ layerSpaceToProjectionPlane.rotate3d(0, 180, 0);
+ EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible());
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
index 26d52523b..73b4d8273 100644
--- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
@@ -26,16 +26,23 @@
#include "cc/CCOcclusionTracker.h"
+#include "CCAnimationTestCommon.h"
+#include "CCOcclusionTrackerTestCommon.h"
#include "FilterOperations.h"
#include "LayerChromium.h"
#include "Region.h"
#include "TransformationMatrix.h"
+#include "TranslateTransformOperation.h"
+#include "cc/CCLayerAnimationController.h"
+#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTreeHostCommon.h"
+#include "cc/CCSingleThreadProxy.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
#define EXPECT_EQ_RECT(a, b) \
EXPECT_EQ(a.x(), b.x()); \
@@ -45,2168 +52,2890 @@ using namespace WebCore;
namespace {
-class LayerChromiumWithForcedDrawsContent : public LayerChromium {
+class TestContentLayerChromium : public LayerChromium {
public:
- LayerChromiumWithForcedDrawsContent()
+ TestContentLayerChromium()
: LayerChromium()
+ , m_overrideOpaqueContentsRect(false)
{
}
- virtual bool drawsContent() const { return true; }
- virtual Region opaqueContentsRegion() const
+ virtual bool drawsContent() const OVERRIDE { return true; }
+ virtual Region visibleContentOpaqueRegion() const OVERRIDE
{
- return intersection(m_opaquePaintRect, visibleLayerRect());
+ if (m_overrideOpaqueContentsRect)
+ return intersection(m_opaqueContentsRect, visibleLayerRect());
+ return LayerChromium::visibleContentOpaqueRegion();
+ }
+ void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
+ {
+ m_overrideOpaqueContentsRect = true;
+ m_opaqueContentsRect = opaqueContentsRect;
}
-
- void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }
private:
- IntRect m_opaquePaintRect;
+ bool m_overrideOpaqueContentsRect;
+ IntRect m_opaqueContentsRect;
};
-void setLayerPropertiesForTesting(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
-{
- layer->setTransform(transform);
- layer->setSublayerTransform(TransformationMatrix());
- layer->setAnchorPoint(FloatPoint(0, 0));
- layer->setPosition(position);
- layer->setBounds(bounds);
-}
-
-void setLayerPropertiesForTesting(LayerChromiumWithForcedDrawsContent* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque, bool opaqueLayers)
-{
- setLayerPropertiesForTesting(layer, transform, position, bounds);
- if (opaqueLayers)
- layer->setOpaque(opaque);
- else {
- layer->setOpaque(false);
- if (opaque)
- layer->setOpaquePaintRect(IntRect(IntPoint(), bounds));
- else
- layer->setOpaquePaintRect(IntRect());
- }
-}
-
-// A subclass to expose the total current occlusion.
-class TestCCOcclusionTracker : public CCOcclusionTracker {
+class TestContentLayerImpl : public CCLayerImpl {
public:
- TestCCOcclusionTracker(IntRect screenScissorRect)
- : CCOcclusionTracker(screenScissorRect)
- , m_overrideLayerScissorRect(false)
+ TestContentLayerImpl(int id)
+ : CCLayerImpl(id)
+ , m_overrideOpaqueContentsRect(false)
{
+ setDrawsContent(true);
}
- TestCCOcclusionTracker(IntRect screenScissorRect, const CCOcclusionTrackerDamageClient* damageClient)
- : CCOcclusionTracker(screenScissorRect, damageClient)
- , m_overrideLayerScissorRect(false)
+ virtual Region visibleContentOpaqueRegion() const OVERRIDE
+ {
+ if (m_overrideOpaqueContentsRect)
+ return intersection(m_opaqueContentsRect, visibleLayerRect());
+ return CCLayerImpl::visibleContentOpaqueRegion();
+ }
+ void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
{
+ m_overrideOpaqueContentsRect = true;
+ m_opaqueContentsRect = opaqueContentsRect;
}
- Region occlusionInScreenSpace() const { return CCOcclusionTracker::m_stack.last().occlusionInScreen; }
- Region occlusionInTargetSurface() const { return CCOcclusionTracker::m_stack.last().occlusionInTarget; }
+private:
+ bool m_overrideOpaqueContentsRect;
+ IntRect m_opaqueContentsRect;
+};
- void setOcclusionInScreenSpace(const Region& region) { CCOcclusionTracker::m_stack.last().occlusionInScreen = region; }
- void setOcclusionInTargetSurface(const Region& region) { CCOcclusionTracker::m_stack.last().occlusionInTarget = region; }
+template<typename LayerType, typename RenderSurfaceType>
+class TestCCOcclusionTrackerWithScissor : public TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType> {
+public:
+ TestCCOcclusionTrackerWithScissor(IntRect screenScissorRect, bool recordMetricsForFrame = false)
+ : TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
+ , m_overrideLayerScissorRect(false)
+ {
+ }
void setLayerScissorRect(const IntRect& rect) { m_overrideLayerScissorRect = true; m_layerScissorRect = rect;}
void useDefaultLayerScissorRect() { m_overrideLayerScissorRect = false; }
protected:
- virtual IntRect layerScissorRectInTargetSurface(const LayerChromium* layer) const { return m_overrideLayerScissorRect ? m_layerScissorRect : CCOcclusionTracker::layerScissorRectInTargetSurface(layer); }
+ virtual IntRect layerScissorRectInTargetSurface(const LayerType* layer) const { return m_overrideLayerScissorRect ? m_layerScissorRect : CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::layerScissorRectInTargetSurface(layer); }
private:
bool m_overrideLayerScissorRect;
IntRect m_layerScissorRect;
};
-class TestDamageClient : public CCOcclusionTrackerDamageClient {
-public:
- // The interface
- virtual FloatRect damageRect(const RenderSurfaceChromium*) const { return m_damageRect; }
-
- // Testing stuff
- TestDamageClient(const FloatRect& damageRect) : m_damageRect(damageRect) { }
- void setDamageRect(const FloatRect& damageRect) { m_damageRect = damageRect; }
+struct CCOcclusionTrackerTestMainThreadTypes {
+ typedef LayerChromium LayerType;
+ typedef RenderSurfaceChromium RenderSurfaceType;
+ typedef TestContentLayerChromium ContentLayerType;
+ typedef RefPtr<LayerChromium> LayerPtrType;
+ typedef PassRefPtr<LayerChromium> PassLayerPtrType;
+ typedef RefPtr<ContentLayerType> ContentLayerPtrType;
+ typedef PassRefPtr<ContentLayerType> PassContentLayerPtrType;
+ typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator;
+ typedef CCOcclusionTracker OcclusionTrackerType;
+
+ static PassLayerPtrType createLayer() { return LayerChromium::create(); }
+ static PassContentLayerPtrType createContentLayer() { return adoptRef(new ContentLayerType()); }
+};
-private:
- FloatRect m_damageRect;
+struct CCOcclusionTrackerTestImplThreadTypes {
+ typedef CCLayerImpl LayerType;
+ typedef CCRenderSurface RenderSurfaceType;
+ typedef TestContentLayerImpl ContentLayerType;
+ typedef OwnPtr<CCLayerImpl> LayerPtrType;
+ typedef PassOwnPtr<CCLayerImpl> PassLayerPtrType;
+ typedef OwnPtr<ContentLayerType> ContentLayerPtrType;
+ typedef PassOwnPtr<ContentLayerType> PassContentLayerPtrType;
+ typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> LayerIterator;
+ typedef CCOcclusionTrackerImpl OcclusionTrackerType;
+
+ static PassLayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerImplId++); }
+ static PassContentLayerPtrType createContentLayer() { return adoptPtr(new ContentLayerType(nextCCLayerImplId++)); }
+ static int nextCCLayerImplId;
};
-#define TEST_OPAQUE_AND_PAINTED_OPAQUE(FULLTESTNAME, SHORTTESTNAME) \
- TEST(FULLTESTNAME, opaqueLayer) \
- { \
- SHORTTESTNAME(true); \
- } \
- TEST(FULLTESTNAME, opaquePaintRect) \
- { \
- SHORTTESTNAME(false); \
+int CCOcclusionTrackerTestImplThreadTypes::nextCCLayerImplId = 0;
+
+template<typename Types, bool opaqueLayers>
+class CCOcclusionTrackerTest : public testing::Test {
+protected:
+ CCOcclusionTrackerTest()
+ : testing::Test()
+ { }
+
+ virtual void runMyTest() = 0;
+
+ virtual void TearDown()
+ {
+ m_root.clear();
+ m_renderSurfaceLayerListChromium.clear();
+ m_renderSurfaceLayerListImpl.clear();
+ m_replicaLayers.clear();
+ CCLayerTreeHost::setNeedsFilterContext(false);
}
-void layerAddedToOccludedRegion(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(layer);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 70, 70)).isEmpty());
- EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 31, 70, 70)));
- EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 31, 70, 70)));
- EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 31, 70, 70)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegion, layerAddedToOccludedRegion);
-
-void layerAddedToOccludedRegionWithRotation(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(layer);
-
- TransformationMatrix layerTransform;
- layerTransform.translate(250, 250);
- layerTransform.rotate(90);
- layerTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 31, 70, 70)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 70, 70)).isEmpty());
- EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 29, 70, 70)));
- EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 30, 70, 70)));
- EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 31, 70, 70)));
- EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 31, 70, 70)));
- EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 31, 70, 70)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotation, layerAddedToOccludedRegionWithRotation);
-
-void layerAddedToOccludedRegionWithTranslation(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(layer);
-
- TransformationMatrix layerTransform;
- layerTransform.translate(20, 20);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
- EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(50, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(49, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(50, 49, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(51, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(50, 51, 50, 50)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(50, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(49, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(50, 49, 50, 50)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(51, 50, 50, 50)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(50, 51, 50, 50)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 50, 50, 50)).isEmpty());
- EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 50, 50, 50)));
- EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 49, 50, 50)));
- EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(50, 49, 50, 50)));
- EXPECT_EQ_RECT(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 49, 50, 50)));
- EXPECT_EQ_RECT(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 50, 50, 50)));
- EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 51, 50, 50)));
- EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(50, 51, 50, 50)));
- EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 51, 50, 50)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 50, 50, 50)).isEmpty());
- EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 50, 50, 50)));
- EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 49, 50, 50)));
- EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(50, 49, 50, 50)));
- EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(51, 49, 50, 50)));
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(51, 50, 50, 50)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(51, 51, 50, 50)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(50, 51, 50, 50)).isEmpty());
- EXPECT_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent.get(), IntRect(49, 51, 50, 50)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithTranslation, layerAddedToOccludedRegionWithTranslation);
-
-void layerAddedToOccludedRegionWithRotatedSurface(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child);
- child->addChild(layer);
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500));
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true, opaqueLayers);
-
- child->setMasksToBounds(true);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(child->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
-
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 430, 61, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 71)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 61, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 71)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.markOccludedBehindLayer(child.get());
- occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 41, 70, 60)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(31, 40, 70, 60)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 41, 70, 60)));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
-
- /* Justification for the above occlusion from |layer|:
- 100
- +---------------------+ +---------------------+
- | | | |30 Visible region of |layer|: /////
- | 30 | rotate(90) | |
- | 30 + ---------------------------------+ | +---------------------------------+
- 100 | | 10 | | ==> | | |10 |
- | |10+---------------------------------+ | +---------------------------------+ |
- | | | | | | | | |///////////////| 420 | |
- | | | | | | | | |///////////////|60 | |
- | | | | | | | | |///////////////| | |
- +----|--|-------------+ | | +--|--|---------------+ | |
- | | | | 20|10| 70 | |
- | | | | | | | |
- | | | |500 | | | |
- | | | | | | | |
- | | | | | | | |
- | | | | | | | |
- | | | | | | |10|
- +--|-------------------------------+ | | +------------------------------|--+
- | | | 490 |
- +---------------------------------+ +---------------------------------+
- 500 500
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotatedSurface, layerAddedToOccludedRegionWithRotatedSurface);
-
-void layerAddedToOccludedRegionWithSurfaceAlreadyOnStack(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> child2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child);
- child->addChild(layer);
- parent->addChild(child2);
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500));
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true, opaqueLayers);
-
- // |child2| makes |parent|'s surface get considered by CCOcclusionTracker first, instead of |child|'s. This exercises different code in
- // leaveToTargetRenderSurface, as the target surface has already been seen.
- setLayerPropertiesForTesting(child2.get(), identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true, opaqueLayers);
-
- child->setMasksToBounds(true);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(child2.get());
-
- EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- occlusion.enterTargetRenderSurface(child->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
-
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(11, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 431, 60, 70)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(11, 430, 60, 70)));
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 431, 60, 70)));
- occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 430, 60, 70)).isEmpty());
- // This is the little piece not occluded by child2
- EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 70)));
- // This extends past both sides of child2, so it will be the original rect.
- EXPECT_EQ_RECT(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 80)));
- // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side.
- // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect().
- EXPECT_EQ_RECT(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 70)));
- // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left
- // and bottom edges are completely unoccluded for some row/column so we get back the original query rect.
- EXPECT_EQ_RECT(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 80)));
- EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70)));
- EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 430, 60, 70)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 70)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 80)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 70)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(-10, 430, 60, 80)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 429, 60, 70)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70)).isEmpty());
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.markOccludedBehindLayer(child.get());
- // |child2| should get merged with the surface we are leaving now
- occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
-
- Vector<IntRect> screen = occlusion.occlusionInScreenSpace().rects();
- Vector<IntRect> target = occlusion.occlusionInTargetSurface().rects();
-
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_EQ_RECT(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 70, 70)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 60, 10)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 60, 10)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 60, 10)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(31, 30, 60, 10)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 31, 60, 10)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60)));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 30, 60, 10)).isEmpty());
- EXPECT_EQ_RECT(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 30, 60, 10)));
- EXPECT_EQ_RECT(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 29, 60, 10)));
- EXPECT_EQ_RECT(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 30, 60, 10)));
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 31, 60, 10)).isEmpty());
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 40, 70, 60)).isEmpty());
- EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 40, 70, 60)));
- // This rect is mostly occluded by |child2|.
- EXPECT_EQ_RECT(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 39, 70, 60)));
- // This rect extends past top/right ends of |child2|.
- EXPECT_EQ_RECT(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 29, 70, 70)));
- // This rect extends past left/right ends of |child2|.
- EXPECT_EQ_RECT(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(20, 39, 80, 60)));
- EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 40, 70, 60)));
- EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 41, 70, 60)));
-
- /* Justification for the above occlusion from |layer|:
- 100
- +---------------------+ +---------------------+
- | | | |30 Visible region of |layer|: /////
- | 30 | rotate(90) | 30 60 | |child2|: \\\\\
- | 30 + ------------+--------------------+ | 30 +------------+--------------------+
- 100 | | 10 | | | ==> | |\\\\\\\\\\\\| |10 |
- | |10+----------|----------------------+ | +--|\\\\\\\\\\\\|-----------------+ |
- | + ------------+ | | | | | +------------+//| 420 | |
- | | | | | | | | |///////////////|60 | |
- | | | | | | | | |///////////////| | |
- +----|--|-------------+ | | +--|--|---------------+ | |
- | | | | 20|10| 70 | |
- | | | | | | | |
- | | | |500 | | | |
- | | | | | | | |
- | | | | | | | |
- | | | | | | | |
- | | | | | | |10|
- +--|-------------------------------+ | | +------------------------------|--+
- | | | 490 |
- +---------------------------------+ +---------------------------------+
- 500 500
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithSurfaceAlreadyOnStack, layerAddedToOccludedRegionWithSurfaceAlreadyOnStack);
-
-void layerAddedToOccludedRegionWithRotatedOffAxisSurface(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child);
- child->addChild(layer);
-
- // Now rotate the child a little more so it is not axis-aligned. The parent will no longer be occluded by |layer|, but
- // the child's occlusion should be unchanged.
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(95);
- childTransform.translate(-250, -250);
-
- TransformationMatrix layerTransform;
- layerTransform.translate(10, 10);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500));
- setLayerPropertiesForTesting(layer.get(), layerTransform, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers);
-
- child->setMasksToBounds(true);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect());
-
- occlusion.enterTargetRenderSurface(child->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
-
- EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child.get(), clippedLayerInChild));
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(-1, 0);
- EXPECT_FALSE(occlusion.occluded(child.get(), clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(1, 0);
- clippedLayerInChild.move(1, 0);
- EXPECT_FALSE(occlusion.occluded(child.get(), clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(-1, 0);
- clippedLayerInChild.move(0, -1);
- EXPECT_FALSE(occlusion.occluded(child.get(), clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(0, 1);
- clippedLayerInChild.move(0, 1);
- EXPECT_FALSE(occlusion.occluded(child.get(), clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedContentRect(parent.get(), clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(0, -1);
-
- occlusion.markOccludedBehindLayer(child.get());
- occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(75, 55, 1, 1)));
- EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(75, 55, 1, 1)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithRotatedOffAxisSurface, layerAddedToOccludedRegionWithRotatedOffAxisSurface);
-
-void layerAddedToOccludedRegionWithMultipleOpaqueLayers(bool opaqueLayers)
-{
- // This is similar to the previous test but now we make a few opaque layers inside of |child| so that the occluded parts of child are not a simple rect.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child);
- child->addChild(layer1);
- child->addChild(layer2);
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500));
- setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(10, 10), IntSize(500, 440), true, opaqueLayers);
- setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true, opaqueLayers);
-
- child->setMasksToBounds(true);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(child->renderSurface());
- occlusion.markOccludedBehindLayer(layer2.get());
- occlusion.markOccludedBehindLayer(layer1.get());
-
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child.get(), IntRect(10, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(11, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occluded(child.get(), IntRect(10, 431, 60, 70)));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(child.get(), IntRect(10, 430, 60, 70)).isEmpty());
- EXPECT_EQ_RECT(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child.get(), IntRect(9, 430, 60, 70)));
- EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 429, 60, 70)));
- EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child.get(), IntRect(11, 430, 60, 70)));
- EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child.get(), IntRect(10, 431, 60, 70)));
-
- occlusion.markOccludedBehindLayer(child.get());
- occlusion.finishedTargetRenderSurface(child.get(), child->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 39, 70, 60)));
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(30, 40, 70, 60)).isEmpty());
- EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(29, 40, 70, 60)));
- EXPECT_EQ_RECT(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 39, 70, 60)));
- EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent.get(), IntRect(31, 40, 70, 60)));
- EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent.get(), IntRect(30, 41, 70, 60)));
-
- /* Justification for the above occlusion from |layer1| and |layer2|:
-
- +---------------------+
- | |30 Visible region of |layer1|: /////
- | | Visible region of |layer2|: \\\\\
- | +---------------------------------+
- | | |10 |
- | +---------------+-----------------+ |
- | | |\\\\\\\\\\\\|//| 420 | |
- | | |\\\\\\\\\\\\|//|60 | |
- | | |\\\\\\\\\\\\|//| | |
- +--|--|------------|--+ | |
- 20|10| 70 | | |
- | | | | |
- | | | | |
- | | | | |
- | | | | |
- | | | | |
- | | | |10|
- | +------------|-----------------|--+
- | | 490 |
- +---------------+-----------------+
- 60 440
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerAddedToOccludedRegionWithMultipleOpaqueLayers, layerAddedToOccludedRegionWithMultipleOpaqueLayers);
-
-void surfaceOcclusionWithOverlappingSiblingSurfaces(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child1);
- parent->addChild(child2);
- child1->addChild(layer1);
- child2->addChild(layer2);
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child1.get(), childTransform, FloatPoint(30, 30), IntSize(500, 500));
- setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers);
- setLayerPropertiesForTesting(child2.get(), childTransform, FloatPoint(20, 40), IntSize(500, 500));
- setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(0, 0), IntSize(500, 500), true, opaqueLayers);
-
- child1->setMasksToBounds(true);
- child2->setMasksToBounds(true);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(child2->renderSurface());
- occlusion.markOccludedBehindLayer(layer2.get());
-
- EXPECT_EQ_RECT(IntRect(20, 40, 80, 60), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(0, 420, 60, 80), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(0, 420, 60, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-1, 420, 60, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(0, 419, 60, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(0, 420, 61, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(0, 420, 60, 81)));
-
- occlusion.markOccludedBehindLayer(child2.get());
- occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(child1->renderSurface());
- occlusion.markOccludedBehindLayer(layer1.get());
-
- EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child1.get(), IntRect(0, 430, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-1, 430, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(0, 429, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(0, 430, 71, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(0, 430, 70, 71)));
-
- occlusion.markOccludedBehindLayer(child1.get());
- occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 30, 80, 70)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 29, 70, 70)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(20, 40, 80, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(19, 40, 80, 60)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 39, 80, 60)));
-
- /* Justification for the above occlusion:
- 100
- +---------------------+
- | |
- | 30 | child1
- | 30+ ---------------------------------+
- 100 | 40| | child2 |
- |20+----------------------------------+ |
- | | | | | |
- | | | | | |
- | | | | | |
- +--|-|----------------+ | |
- | | | | 500
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | +--------------------------------|-+
- | |
- +----------------------------------+
- 500
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionWithOverlappingSiblingSurfaces, surfaceOcclusionWithOverlappingSiblingSurfaces);
-
-void surfaceOcclusionInScreenSpace(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child1);
- parent->addChild(child2);
- child1->addChild(layer1);
- child2->addChild(layer2);
-
- TransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
-
- // The owning layers have very different bounds from the surfaces that they own.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child1.get(), childTransform, FloatPoint(30, 30), IntSize(10, 10));
- setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers);
- setLayerPropertiesForTesting(child2.get(), childTransform, FloatPoint(20, 40), IntSize(10, 10));
- setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers);
-
- // Make them both render surfaces
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- child1->setFilters(filters);
- child2->setFilters(filters);
-
- child1->setMasksToBounds(false);
- child2->setMasksToBounds(false);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(child2->renderSurface());
- occlusion.markOccludedBehindLayer(layer2.get());
-
- EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-11, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 419, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 80)));
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-11, 420, 70, 80)));
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 419, 70, 80)));
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80)));
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81)));
- occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000));
-
- occlusion.markOccludedBehindLayer(child2.get());
- occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(child1->renderSurface());
- occlusion.markOccludedBehindLayer(layer1.get());
-
- EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child1.get(), IntRect(-10, 430, 80, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-11, 430, 80, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-10, 429, 80, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-10, 430, 81, 70)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(-10, 430, 80, 71)));
-
- occlusion.markOccludedBehindLayer(child1.get());
- occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 20, 80, 80)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(30, 20, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(29, 20, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(30, 19, 70, 80)));
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(20, 30, 80, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(19, 30, 80, 70)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(20, 29, 80, 70)));
-
- /* Justification for the above occlusion:
- 100
- +---------------------+
- | 20 | layer1
- | 30+ ---------------------------------+
- 100 | 30| | layer2 |
- |20+----------------------------------+ |
- | | | | | |
- | | | | | |
- | | | | | |
- +--|-|----------------+ | |
- | | | | 510
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | +--------------------------------|-+
- | |
- +----------------------------------+
- 510
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionInScreenSpace, surfaceOcclusionInScreenSpace);
-
-void surfaceOcclusionInScreenSpaceDifferentTransforms(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromium> child1 = LayerChromium::create();
- RefPtr<LayerChromium> child2 = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer1 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer2 = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(child1);
- parent->addChild(child2);
- child1->addChild(layer1);
- child2->addChild(layer2);
-
- TransformationMatrix child1Transform;
- child1Transform.translate(250, 250);
- child1Transform.rotate(-90);
- child1Transform.translate(-250, -250);
-
- TransformationMatrix child2Transform;
- child2Transform.translate(250, 250);
- child2Transform.rotate(90);
- child2Transform.translate(-250, -250);
-
- // The owning layers have very different bounds from the surfaces that they own.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(child1.get(), child1Transform, FloatPoint(30, 20), IntSize(10, 10));
- setLayerPropertiesForTesting(layer1.get(), identityMatrix, FloatPoint(-10, -20), IntSize(510, 520), true, opaqueLayers);
- setLayerPropertiesForTesting(child2.get(), child2Transform, FloatPoint(20, 40), IntSize(10, 10));
- setLayerPropertiesForTesting(layer2.get(), identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true, opaqueLayers);
-
- // Make them both render surfaces
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- child1->setFilters(filters);
- child2->setFilters(filters);
-
- child1->setMasksToBounds(false);
- child2->setMasksToBounds(false);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(-30, -30, 1000, 1000));
-
- occlusion.enterTargetRenderSurface(child2->renderSurface());
- occlusion.markOccludedBehindLayer(layer2.get());
-
- EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-11, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 419, 70, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 71, 80)));
- EXPECT_FALSE(occlusion.occluded(child2.get(), IntRect(-10, 420, 70, 81)));
-
- occlusion.markOccludedBehindLayer(child2.get());
- occlusion.finishedTargetRenderSurface(child2.get(), child2->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(child1->renderSurface());
- occlusion.markOccludedBehindLayer(layer1.get());
-
- EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(child1.get(), IntRect(420, -20, 80, 90)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(419, -20, 80, 90)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(420, -21, 80, 90)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(420, -19, 80, 90)));
- EXPECT_FALSE(occlusion.occluded(child1.get(), IntRect(421, -20, 80, 90)));
-
- occlusion.markOccludedBehindLayer(child1.get());
- occlusion.finishedTargetRenderSurface(child1.get(), child1->renderSurface());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(10, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(9, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(10, 19, 90, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(11, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(10, 21, 90, 80)));
-
- /* Justification for the above occlusion:
- 100
- +---------------------+
- |20 | layer1
- 10+----------------------------------+
- 100 || 30 | layer2 |
- |20+----------------------------------+
- || | | | |
- || | | | |
- || | | | |
- +|-|------------------+ | |
- | | | | 510
- | | 510 | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | 520 | |
- +----------------------------------+ |
- | |
- +----------------------------------+
- 510
- */
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_surfaceOcclusionInScreenSpaceDifferentTransforms, surfaceOcclusionInScreenSpaceDifferentTransforms);
-
-void occlusionInteractionWithFilters(bool opaqueLayers)
-{
- // This tests that the right transforms are being used.
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> blurLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> opacityLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> opaqueLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(blurLayer);
- parent->addChild(opacityLayer);
- parent->addChild(opaqueLayer);
-
- TransformationMatrix layerTransform;
- layerTransform.translate(250, 250);
- layerTransform.rotate(90);
- layerTransform.translate(-250, -250);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- setLayerPropertiesForTesting(blurLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
- setLayerPropertiesForTesting(opaqueLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
- setLayerPropertiesForTesting(opacityLayer.get(), layerTransform, FloatPoint(30, 30), IntSize(500, 500), true, opaqueLayers);
+ typename Types::ContentLayerType* createRoot(const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ typename Types::ContentLayerPtrType layer(Types::createContentLayer());
+ typename Types::ContentLayerType* layerPtr = layer.get();
+ setProperties(layerPtr, transform, position, bounds);
+
+ ASSERT(!m_root);
+ m_root = layer.release();
+ return layerPtr;
+ }
+
+ typename Types::LayerType* createLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ typename Types::LayerPtrType layer(Types::createLayer());
+ typename Types::LayerType* layerPtr = layer.get();
+ setProperties(layerPtr, transform, position, bounds);
+ parent->addChild(layer.release());
+ return layerPtr;
+ }
+ typename Types::LayerType* createSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
{
+ typename Types::LayerType* layer = createLayer(parent, transform, position, bounds);
FilterOperations filters;
- filters.operations().append(BlurFilterOperation::create(Length(10, WebCore::Percent), FilterOperation::BLUR));
- blurLayer->setFilters(filters);
+ filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
+ layer->setFilters(filters);
+ return layer;
}
+ typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
{
+ typename Types::ContentLayerPtrType layer(Types::createContentLayer());
+ typename Types::ContentLayerType* layerPtr = layer.get();
+ setProperties(layerPtr, transform, position, bounds);
+
+ if (opaqueLayers)
+ layerPtr->setOpaque(opaque);
+ else {
+ layerPtr->setOpaque(false);
+ if (opaque)
+ layerPtr->setOpaqueContentsRect(IntRect(IntPoint(), bounds));
+ else
+ layerPtr->setOpaqueContentsRect(IntRect());
+ }
+
+ parent->addChild(layer.release());
+ return layerPtr;
+ }
+
+ typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ typename Types::ContentLayerPtrType layer(Types::createContentLayer());
+ typename Types::ContentLayerType* layerPtr = layer.get();
+ setProperties(layerPtr, transform, position, bounds);
+ setReplica(owningLayer, layer.release());
+ return layerPtr;
+ }
+
+ typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
+ {
+ typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque);
FilterOperations filters;
filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- opaqueLayer->setFilters(filters);
+ layer->setFilters(filters);
+ return layer;
+ }
+
+ void calcDrawEtc(TestContentLayerImpl* root)
+ {
+ ASSERT(root == m_root.get());
+ Vector<CCLayerImpl*> dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ ASSERT(!root->renderSurface());
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds()));
+ root->setClipRect(IntRect(IntPoint::zero(), root->bounds()));
+ m_renderSurfaceLayerListImpl.append(m_root.get());
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListImpl, dummyLayerList, 0, dummyMaxTextureSize);
+ m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListImpl);
+ }
+
+ void calcDrawEtc(TestContentLayerChromium* root)
+ {
+ ASSERT(root == m_root.get());
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+
+ ASSERT(!root->renderSurface());
+ root->createRenderSurface();
+ root->renderSurface()->setContentRect(IntRect(IntPoint::zero(), root->bounds()));
+ root->setClipRect(IntRect(IntPoint::zero(), root->bounds()));
+ m_renderSurfaceLayerListChromium.append(m_root);
+
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(root, root, identityMatrix, identityMatrix, m_renderSurfaceLayerListChromium, dummyLayerList, dummyMaxTextureSize);
+ m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_renderSurfaceLayerListChromium);
}
+ void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
{
+ ASSERT_EQ(layer, *m_layerIterator);
+ ASSERT_TRUE(m_layerIterator.representsItself());
+ occlusion.enterLayer(m_layerIterator);
+ }
+
+ void leaveLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
+ {
+ ASSERT_EQ(layer, *m_layerIterator);
+ ASSERT_TRUE(m_layerIterator.representsItself());
+ occlusion.leaveLayer(m_layerIterator);
+ ++m_layerIterator;
+ }
+
+ void visitLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
+ {
+ enterLayer(layer, occlusion);
+ leaveLayer(layer, occlusion);
+ }
+
+ void enterContributingSurface(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
+ {
+ ASSERT_EQ(layer, *m_layerIterator);
+ ASSERT_TRUE(m_layerIterator.representsTargetRenderSurface());
+ occlusion.enterLayer(m_layerIterator);
+ occlusion.leaveLayer(m_layerIterator);
+ ++m_layerIterator;
+ ASSERT_TRUE(m_layerIterator.representsContributingRenderSurface());
+ occlusion.enterLayer(m_layerIterator);
+ }
+
+ void leaveContributingSurface(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
+ {
+ ASSERT_EQ(layer, *m_layerIterator);
+ ASSERT_TRUE(m_layerIterator.representsContributingRenderSurface());
+ occlusion.leaveLayer(m_layerIterator);
+ ++m_layerIterator;
+ }
+
+ void visitContributingSurface(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
+ {
+ enterContributingSurface(layer, occlusion);
+ leaveContributingSurface(layer, occlusion);
+ }
+
+ void resetLayerIterator()
+ {
+ m_layerIterator = m_layerIteratorBegin;
+ }
+
+ const TransformationMatrix identityMatrix;
+
+private:
+ void setBaseProperties(typename Types::LayerType* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ layer->setTransform(transform);
+ layer->setSublayerTransform(TransformationMatrix());
+ layer->setAnchorPoint(FloatPoint(0, 0));
+ layer->setPosition(position);
+ layer->setBounds(bounds);
+ }
+
+ void setProperties(LayerChromium* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ setBaseProperties(layer, transform, position, bounds);
+ }
+
+ void setProperties(CCLayerImpl* layer, const TransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ {
+ setBaseProperties(layer, transform, position, bounds);
+
+ layer->setContentBounds(layer->bounds());
+ }
+
+ void setReplica(LayerChromium* owningLayer, PassRefPtr<LayerChromium> layer)
+ {
+ owningLayer->setReplicaLayer(layer.get());
+ m_replicaLayers.append(layer);
+ }
+
+ void setReplica(CCLayerImpl* owningLayer, PassOwnPtr<CCLayerImpl> layer)
+ {
+ owningLayer->setReplicaLayer(layer);
+ }
+
+ // These hold ownership of the layers for the duration of the test.
+ typename Types::LayerPtrType m_root;
+ Vector<RefPtr<LayerChromium> > m_renderSurfaceLayerListChromium;
+ Vector<CCLayerImpl*> m_renderSurfaceLayerListImpl;
+ typename Types::LayerIterator m_layerIteratorBegin;
+ typename Types::LayerIterator m_layerIterator;
+ typename Types::LayerType* m_lastLayerVisited;
+ Vector<RefPtr<LayerChromium> > m_replicaLayers;
+};
+
+#define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
+ class ClassName##MainThreadOpaqueLayers : public ClassName<CCOcclusionTrackerTestMainThreadTypes, true> { \
+ public: \
+ ClassName##MainThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestMainThreadTypes, true>() { } \
+ }; \
+ TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); }
+#define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \
+ class ClassName##MainThreadOpaquePaints : public ClassName<CCOcclusionTrackerTestMainThreadTypes, false> { \
+ public: \
+ ClassName##MainThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestMainThreadTypes, false>() { } \
+ }; \
+ TEST_F(ClassName##MainThreadOpaquePaints, runTest) { runMyTest(); }
+
+#define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \
+ class ClassName##ImplThreadOpaqueLayers : public ClassName<CCOcclusionTrackerTestImplThreadTypes, true> { \
+ DebugScopedSetImplThread impl; \
+ public: \
+ ClassName##ImplThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestImplThreadTypes, true>() { } \
+ }; \
+ TEST_F(ClassName##ImplThreadOpaqueLayers, runTest) { runMyTest(); }
+#define RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) \
+ class ClassName##ImplThreadOpaquePaints : public ClassName<CCOcclusionTrackerTestImplThreadTypes, false> { \
+ DebugScopedSetImplThread impl; \
+ public: \
+ ClassName##ImplThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestImplThreadTypes, false>() { } \
+ }; \
+ TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); }
+
+#define ALL_CCOCCLUSIONTRACKER_TEST(ClassName) \
+ RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
+ RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \
+ RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \
+ RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName)
+
+#define MAIN_THREAD_TEST(ClassName) \
+ RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName)
+
+#define MAIN_AND_IMPL_THREAD_TEST(ClassName) \
+ RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
+ RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName)
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestIdentityTransforms : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70)));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestIdentityTransforms);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix layerTransform;
+ layerTransform.translate(250, 250);
+ layerTransform.rotate(90);
+ layerTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 31, 70, 70)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 70, 70)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70)));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestRotatedChild);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix layerTransform;
+ layerTransform.translate(20, 20);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(51, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 51, 50, 50)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(49, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(50, 49, 50, 50)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(51, 50, 50, 50)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 51, 50, 50)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50)));
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTranslatedChild);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix childTransform;
+ childTransform.translate(250, 250);
+ childTransform.rotate(90);
+ childTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ child->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(layer, occlusion);
+ this->enterContributingSurface(child, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(9, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 429, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 430, 61, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 430, 60, 71)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(9, 430, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 429, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 61, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 71)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->leaveContributingSurface(child, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 41, 70, 60)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(31, 40, 70, 60)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 41, 70, 60)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+
+ /* Justification for the above occlusion from |layer|:
+ 100
+ +---------------------+ +---------------------+
+ | | | |30 Visible region of |layer|: /////
+ | 30 | rotate(90) | |
+ | 30 + ---------------------------------+ | +---------------------------------+
+ 100 | | 10 | | ==> | | |10 |
+ | |10+---------------------------------+ | +---------------------------------+ |
+ | | | | | | | | |///////////////| 420 | |
+ | | | | | | | | |///////////////|60 | |
+ | | | | | | | | |///////////////| | |
+ +----|--|-------------+ | | +--|--|---------------+ | |
+ | | | | 20|10| 70 | |
+ | | | | | | | |
+ | | | |500 | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | |10|
+ +--|-------------------------------+ | | +------------------------------|--+
+ | | | 490 |
+ +---------------------------------+ +---------------------------------+
+ 500 500
+ */
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestChildInRotatedChild);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix childTransform;
+ childTransform.translate(250, 250);
+ childTransform.rotate(90);
+ childTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ child->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
+ // |child2| makes |parent|'s surface get considered by CCOcclusionTracker first, instead of |child|'s. This exercises different code in
+ // leaveToTargetRenderSurface, as the target surface has already been seen.
+ typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
+
+ this->visitLayer(child2, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ this->visitLayer(layer, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ this->enterContributingSurface(child, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(9, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 429, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(11, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(9, 430, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 429, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(11, 430, 60, 70)));
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 431, 60, 70)));
+ occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty());
+ // This is the little piece not occluded by child2
+ EXPECT_EQ_RECT(IntRect(9, 430, 1, 10), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70)));
+ // This extends past both sides of child2, so it will be the original rect.
+ EXPECT_EQ_RECT(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80)));
+ // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side.
+ // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect().
+ EXPECT_EQ_RECT(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70)));
+ // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left
+ // and bottom edges are completely unoccluded for some row/column so we get back the original query rect.
+ EXPECT_EQ_RECT(IntRect(-10, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80)));
+ EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70)));
+ EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70)));
+ EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 80)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70)).isEmpty());
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ // Occlusion in |child2| should get merged with the |child| surface we are leaving now.
+ this->leaveContributingSurface(child, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_EQ_RECT(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)));
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 29, 60, 10)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(31, 30, 60, 10)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 31, 60, 10)));
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10)));
+ EXPECT_EQ_RECT(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10)));
+ EXPECT_EQ_RECT(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10)));
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty());
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60)));
+ // This rect is mostly occluded by |child2|.
+ EXPECT_EQ_RECT(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60)));
+ // This rect extends past top/right ends of |child2|.
+ EXPECT_EQ_RECT(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70)));
+ // This rect extends past left/right ends of |child2|.
+ EXPECT_EQ_RECT(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60)));
+ EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60)));
+ EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60)));
+
+ /* Justification for the above occlusion from |layer|:
+ 100
+ +---------------------+ +---------------------+
+ | | | |30 Visible region of |layer|: /////
+ | 30 | rotate(90) | 30 60 | |child2|: \\\\\
+ | 30 + ------------+--------------------+ | 30 +------------+--------------------+
+ 100 | | 10 | | | ==> | |\\\\\\\\\\\\| |10 |
+ | |10+----------|----------------------+ | +--|\\\\\\\\\\\\|-----------------+ |
+ | + ------------+ | | | | | +------------+//| 420 | |
+ | | | | | | | | |///////////////|60 | |
+ | | | | | | | | |///////////////| | |
+ +----|--|-------------+ | | +--|--|---------------+ | |
+ | | | | 20|10| 70 | |
+ | | | | | | | |
+ | | | |500 | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | |10|
+ +--|-------------------------------+ | | +------------------------------|--+
+ | | | 490 |
+ +---------------------------------+ +---------------------------------+
+ 500 500
+ */
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestVisitTargetTwoTimes);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix childTransform;
+ childTransform.translate(250, 250);
+ childTransform.rotate(95);
+ childTransform.translate(-250, -250);
+
+ TransformationMatrix layerTransform;
+ layerTransform.translate(10, 10);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ child->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect());
+
+ this->visitLayer(layer, occlusion);
+ this->enterContributingSurface(child, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild));
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, clippedLayerInChild).isEmpty());
+ clippedLayerInChild.move(-1, 0);
+ EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild));
+ EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild).isEmpty());
+ clippedLayerInChild.move(1, 0);
+ clippedLayerInChild.move(1, 0);
+ EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild));
+ EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild).isEmpty());
+ clippedLayerInChild.move(-1, 0);
+ clippedLayerInChild.move(0, -1);
+ EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild));
+ EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild).isEmpty());
+ clippedLayerInChild.move(0, 1);
+ clippedLayerInChild.move(0, 1);
+ EXPECT_FALSE(occlusion.occluded(child, clippedLayerInChild));
+ EXPECT_FALSE(occlusion.unoccludedContentRect(child, clippedLayerInChild).isEmpty());
+ clippedLayerInChild.move(0, -1);
+
+ this->leaveContributingSurface(child, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1)));
+ EXPECT_EQ_RECT(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1)));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceRotatedOffAxis);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix childTransform;
+ childTransform.translate(250, 250);
+ childTransform.rotate(90);
+ childTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ child->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(layer2, occlusion);
+ this->visitLayer(layer1, occlusion);
+ this->enterContributingSurface(child, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(9, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 429, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(11, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70)));
+ EXPECT_EQ_RECT(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70)));
+ EXPECT_EQ_RECT(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70)));
+ EXPECT_EQ_RECT(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70)));
+
+ this->leaveContributingSurface(child, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty());
+ EXPECT_EQ_RECT(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_EQ_RECT(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_EQ_RECT(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60)));
+ EXPECT_EQ_RECT(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60)));
+
+ /* Justification for the above occlusion from |layer1| and |layer2|:
+
+ +---------------------+
+ | |30 Visible region of |layer1|: /////
+ | | Visible region of |layer2|: \\\\\
+ | +---------------------------------+
+ | | |10 |
+ | +---------------+-----------------+ |
+ | | |\\\\\\\\\\\\|//| 420 | |
+ | | |\\\\\\\\\\\\|//|60 | |
+ | | |\\\\\\\\\\\\|//| | |
+ +--|--|------------|--+ | |
+ 20|10| 70 | | |
+ | | | | |
+ | | | | |
+ | | | | |
+ | | | | |
+ | | | | |
+ | | | |10|
+ | +------------|-----------------|--+
+ | | 490 |
+ +---------------+-----------------+
+ 60 440
+ */
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix childTransform;
+ childTransform.translate(250, 250);
+ childTransform.rotate(90);
+ childTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), IntSize(10, 10));
+ typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), IntSize(10, 10));
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000));
+
+ this->visitLayer(layer2, occlusion);
+ this->enterContributingSurface(child2, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80)));
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80)));
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80)));
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80)));
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81)));
+ occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000));
+
+ // There is nothing above child2's surface in the z-order.
+ EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80)));
+
+ this->leaveContributingSurface(child2, occlusion);
+ this->visitLayer(layer1, occlusion);
+ this->enterContributingSurface(child1, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(-11, 430, 80, 70)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 429, 80, 70)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 81, 70)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71)));
+
+ // child2's contents will occlude child1 below it.
+ EXPECT_EQ_RECT(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(-10, 430, 80, 70)));
+
+ this->leaveContributingSurface(child1, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80)));
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 20, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 20, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 19, 70, 80)));
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(20, 30, 80, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(19, 30, 80, 70)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 29, 80, 70)));
+
+ /* Justification for the above occlusion:
+ 100
+ +---------------------+
+ | 20 | layer1
+ | 30+ ---------------------------------+
+ 100 | 30| | layer2 |
+ |20+----------------------------------+ |
+ | | | | | |
+ | | | | | |
+ | | | | | |
+ +--|-|----------------+ | |
+ | | | | 510
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | +--------------------------------|-+
+ | |
+ +----------------------------------+
+ 510
+ */
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblings);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix child1Transform;
+ child1Transform.translate(250, 250);
+ child1Transform.rotate(-90);
+ child1Transform.translate(-250, -250);
+
+ TransformationMatrix child2Transform;
+ child2Transform.translate(250, 250);
+ child2Transform.rotate(90);
+ child2Transform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), IntSize(10, 10));
+ typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), IntSize(10, 10), false);
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(-30, -30, 1000, 1000));
+
+ this->visitLayer(layer2, occlusion);
+ this->enterLayer(child2, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-11, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 419, 70, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 71, 80)));
+ EXPECT_FALSE(occlusion.occluded(child2, IntRect(-10, 420, 70, 81)));
+
+ this->leaveLayer(child2, occlusion);
+ this->enterContributingSurface(child2, occlusion);
+
+ // There is nothing above child2's surface in the z-order.
+ EXPECT_EQ_RECT(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2->renderSurface(), false, IntRect(-10, 420, 70, 80)));
+
+ this->leaveContributingSurface(child2, occlusion);
+ this->visitLayer(layer1, occlusion);
+ this->enterContributingSurface(child1, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(419, -20, 80, 90)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -21, 80, 90)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(420, -19, 80, 90)));
+ EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90)));
+
+ // child2's contents will occlude child1 below it.
+ EXPECT_EQ_RECT(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 80, 90)));
+ EXPECT_EQ_RECT(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -10, 80, 90)));
+ EXPECT_EQ_RECT(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1->renderSurface(), false, IntRect(420, -20, 70, 90)));
+
+ this->leaveContributingSurface(child1, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(9, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 19, 90, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(11, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(10, 21, 90, 80)));
+
+ /* Justification for the above occlusion:
+ 100
+ +---------------------+
+ |20 | layer1
+ 10+----------------------------------+
+ 100 || 30 | layer2 |
+ |20+----------------------------------+
+ || | | | |
+ || | | | |
+ || | | | |
+ +|-|------------------+ | |
+ | | | | 510
+ | | 510 | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | 520 | |
+ +----------------------------------+ |
+ | |
+ +----------------------------------+
+ 510
+ */
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix layerTransform;
+ layerTransform.translate(250, 250);
+ layerTransform.rotate(90);
+ layerTransform.translate(-250, -250);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+
FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(10, WebCore::Percent), FilterOperation::BLUR));
+ blurLayer->setFilters(filters);
+
+ filters.operations().clear();
+ filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
+ opaqueLayer->setFilters(filters);
+
+ filters.operations().clear();
filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::OPACITY));
opacityLayer->setFilters(filters);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ // Opacity layer won't contribute to occlusion.
+ this->visitLayer(opacityLayer, occlusion);
+ this->enterContributingSurface(opacityLayer, occlusion);
+
+ EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
+ EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+
+ // And has nothing to contribute to its parent surface.
+ this->leaveContributingSurface(opacityLayer, occlusion);
+ EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
+ EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+
+ // Opaque layer will contribute to occlusion.
+ this->visitLayer(opaqueLayer, occlusion);
+ this->enterContributingSurface(opaqueLayer, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // And it gets translated to the parent surface.
+ this->leaveContributingSurface(opaqueLayer, occlusion);
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The blur layer needs to throw away any occlusion from outside its subtree.
+ this->enterLayer(blurLayer, occlusion);
+ EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
+ EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+
+ // And it won't contribute to occlusion.
+ this->leaveLayer(blurLayer, occlusion);
+ this->enterContributingSurface(blurLayer, occlusion);
+ EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
+ EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+
+ // But the opaque layer's occlusion is preserved on the parent.
+ this->leaveContributingSurface(blurLayer, occlusion);
+ this->enterLayer(parent, occlusion);
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestFilters);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestReplicaDoesOcclude : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
+ this->calcDrawEtc(parent);
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ this->visitLayer(surface, occlusion);
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ this->visitContributingSurface(surface, occlusion);
+ this->enterLayer(parent, occlusion);
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+ // The surface and replica should both be occluding the parent.
+ EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
- // Opacity layer won't contribute to occlusion.
- occlusion.enterTargetRenderSurface(opacityLayer->renderSurface());
- occlusion.markOccludedBehindLayer(opacityLayer.get());
- occlusion.finishedTargetRenderSurface(opacityLayer.get(), opacityLayer->renderSurface());
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaDoesOcclude);
- EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
- EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestReplicaWithClipping : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
+ this->calcDrawEtc(parent);
- // And has nothing to contribute to its parent surface.
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
- EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- // Opaque layer will contribute to occlusion.
- occlusion.enterTargetRenderSurface(opaqueLayer->renderSurface());
- occlusion.markOccludedBehindLayer(opaqueLayer.get());
- occlusion.finishedTargetRenderSurface(opaqueLayer.get(), opaqueLayer->renderSurface());
+ this->visitLayer(surface, occlusion);
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- // And it gets translated to the parent surface.
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ this->visitContributingSurface(surface, occlusion);
+ this->enterLayer(parent, occlusion);
- // The blur layer needs to throw away any occlusion from outside its subtree.
- occlusion.enterTargetRenderSurface(blurLayer->renderSurface());
- EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
- EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+ // The surface and replica should both be occluding the parent.
+ EXPECT_EQ_RECT(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
- // And it won't contribute to occlusion.
- occlusion.markOccludedBehindLayer(blurLayer.get());
- occlusion.finishedTargetRenderSurface(blurLayer.get(), blurLayer->renderSurface());
- EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
- EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping);
- // But the opaque layer's occlusion is preserved on the parent.
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_EQ_RECT(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
- EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
-}
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerScissorRectOutsideChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
+ occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ }
+};
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_occlusionInteractionWithFilters, occlusionInteractionWithFilters);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerScissorRectOutsideChild);
-void layerScissorRectOverTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100));
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
-
- occlusion.useDefaultLayerScissorRect();
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
- occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverTile, layerScissorRectOverTile);
-
-void screenScissorRectOverTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestScreenScissorRectOutsideChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
+
+ occlusion.useDefaultLayerScissorRect();
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ }
+};
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestScreenScissorRectOutsideChild);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerScissorRectOverChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(100, 100, 100, 100));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ }
+};
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerScissorRectOverChild);
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestScreenScissorRectOverChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ }
+};
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestScreenScissorRectOverChild);
- TestCCOcclusionTracker occlusion(IntRect(200, 100, 100, 100));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerScissorRectPartlyOverChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(50, 50, 200, 200));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100)));
+ EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100)));
+ EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100)));
+ }
+};
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerScissorRectPartlyOverChild);
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestScreenScissorRectPartlyOverChild : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100)));
+ EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100)));
+ EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100)));
+ }
+};
- // Occluded since its outside the surface bounds.
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestScreenScissorRectPartlyOverChild);
- // Test without any scissors.
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
- occlusion.useDefaultLayerScissorRect();
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerScissorRectOverNothing : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(500, 500, 100, 100));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100)).isEmpty());
+ }
+};
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerScissorRectOverNothing);
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestScreenScissorRectOverNothing : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100)).isEmpty());
+ }
+};
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestScreenScissorRectOverNothing);
- EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
-}
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterLayer(layer, occlusion);
+
+ // This layer is translated when drawn into its target. So if the scissor rect given from the target surface
+ // is not in that target space, then after translating these query rects into the target, they will fall outside
+ // the scissor and be considered occluded.
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
+ }
+};
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverTile, screenScissorRectOverTile);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin);
-void layerScissorRectOverCulledTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestOpaqueContentsRegionEmpty : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false);
+ this->calcDrawEtc(parent);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterLayer(layer, occlusion);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100)));
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ // Occluded since its outside the surface bounds.
+ EXPECT_TRUE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ // Test without any scissors.
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+ EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100)));
+ occlusion.useDefaultLayerScissorRect();
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ this->leaveLayer(layer, occlusion);
+ this->visitContributingSurface(layer, occlusion);
+ this->enterLayer(parent, occlusion);
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(100, 100, 100, 100));
+ EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty());
+ EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+ }
+};
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionEmpty);
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false);
+ this->calcDrawEtc(parent);
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
+ {
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
+ this->resetLayerIterator();
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
-}
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+ }
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverCulledTile, layerScissorRectOverCulledTile);
+ {
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180));
-void screenScissorRectOverCulledTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+ this->resetLayerIterator();
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+ EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+ }
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ {
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100));
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ this->resetLayerIterator();
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- TestCCOcclusionTracker occlusion(IntRect(100, 100, 100, 100));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)));
+ }
+ }
+};
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty);
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix transform;
+ transform.rotate3d(0, 30, 0);
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
+ this->calcDrawEtc(parent);
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterLayer(layer, occlusion);
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ // The layer is rotated in 3d but without preserving 3d, so it only gets resized.
+ EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200)));
+ }
+};
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
-}
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTest3dTransform);
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverCulledTile, screenScissorRectOverCulledTile);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix transform;
+ transform.translate(150, 150);
+ transform.applyPerspective(400);
+ transform.rotate3d(1, 0, 0, -30);
+ transform.translate(-150, -150);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
+ container->setPreserves3D(true);
+ layer->setPreserves3D(true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterLayer(layer, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200)));
+ }
+};
-void layerScissorRectOverPartialTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(50, 50, 200, 200));
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
- EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)));
- EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverPartialTiles, layerScissorRectOverPartialTiles);
-
-void screenScissorRectOverPartialTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(50, 50, 200, 200));
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
- EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)));
- EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverPartialTiles, screenScissorRectOverPartialTiles);
-
-void layerScissorRectOverNoTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerScissorRect(IntRect(500, 500, 100, 100));
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty());
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectOverNoTiles, layerScissorRectOverNoTiles);
-
-void screenScissorRectOverNoTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestCCOcclusionTracker occlusion(IntRect(500, 500, 100, 100));
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty());
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_screenScissorRectOverNoTiles, screenScissorRectOverNoTiles);
-
-void layerScissorRectForLayerOffOrigin(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+MAIN_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransform);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestPerspectiveTransformBehindCamera : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ // This test is based on the platform/chromium/compositing/3d-corners.html layout test.
+ TransformationMatrix transform;
+ transform.translate(250, 50);
+ transform.applyPerspective(10);
+ transform.translate(-250, -50);
+ transform.translate(250, 50);
+ transform.rotate3d(1, 0, 0, -167);
+ transform.translate(-250, -50);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 100));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(0, 0), IntSize(500, 500), true);
+ container->setPreserves3D(true);
+ layer->setPreserves3D(true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterLayer(layer, occlusion);
+
+ // The bottom 11 pixel rows of this layer remain visible inside the container, after translation to the target surface. When translated back,
+ // this will include many more pixels but must include at least the bottom 11 rows.
+ EXPECT_TRUE(occlusion.unoccludedContentRect(layer, IntRect(0, 0, 500, 500)).contains(IntRect(0, 489, 500, 11)));
+ }
+};
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(100, 100), IntSize(200, 200), true, opaqueLayers);
+MAIN_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransformBehindCamera);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix transform;
+ transform.translate(50, 50);
+ transform.applyPerspective(100);
+ transform.translate3d(0, 0, 110);
+ transform.translate(-50, -50);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+ parent->setPreserves3D(true);
+ layer->setPreserves3D(true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ // The |layer| is entirely behind the camera and should not occlude.
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+ }
+};
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+MAIN_THREAD_TEST(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix transform;
+ transform.translate(50, 50);
+ transform.applyPerspective(100);
+ transform.translate3d(0, 0, 99);
+ transform.translate(-50, -50);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+ parent->setPreserves3D(true);
+ layer->setPreserves3D(true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ // This is very close to the camera, so pixels in its visibleLayerRect will actually go outside of the layer's clipRect.
+ // Ensure that those pixels don't occlude things outside the clipRect.
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+ EXPECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ }
+};
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
+MAIN_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect);
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
+ typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
+ typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
+
+ addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
+ addOpacityTransitionToController(*surface->layerAnimationController(), 10, 0, 1, false);
+ this->calcDrawEtc(parent);
+
+ EXPECT_TRUE(layer->drawOpacityIsAnimating());
+ EXPECT_FALSE(surface->drawOpacityIsAnimating());
+ EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(topmost, occlusion);
+ this->enterLayer(parent2, occlusion);
+ // This occlusion will affect all surfaces.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(parent2, occlusion);
+
+ this->visitLayer(surfaceChild2, occlusion);
+ this->enterLayer(surfaceChild, occlusion);
+ EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(surfaceChild, occlusion);
+ this->enterLayer(surface, occlusion);
+ EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(surface, occlusion);
+
+ this->enterContributingSurface(surface, occlusion);
+ // Occlusion within the surface is lost when leaving the animating surface.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300)));
+ this->leaveContributingSurface(surface, occlusion);
+
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ // Occlusion is not added for the animating |layer|.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ }
+};
- // This layer is translated when drawn into its target. So if the scissor rect given from the target surface
- // is not in that target space, then after translating these query rects into the target, they will fall outside
- // the scissor and be considered occluded.
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-}
+MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity1OnMainThread);
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_layerScissorRectForLayerOffOrigin, layerScissorRectForLayerOffOrigin);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestAnimationOpacity0OnMainThread : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
+ typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
+ typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
+
+ addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
+ addOpacityTransitionToController(*surface->layerAnimationController(), 10, 1, 0, false);
+ this->calcDrawEtc(parent);
+
+ EXPECT_TRUE(layer->drawOpacityIsAnimating());
+ EXPECT_FALSE(surface->drawOpacityIsAnimating());
+ EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(topmost, occlusion);
+ this->enterLayer(parent2, occlusion);
+ // This occlusion will affect all surfaces.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(parent2, occlusion);
+
+ this->visitLayer(surfaceChild2, occlusion);
+ this->enterLayer(surfaceChild, occlusion);
+ EXPECT_EQ_RECT(IntRect(100, 0, 150, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(surfaceChild, occlusion);
+ this->enterLayer(surface, occlusion);
+ EXPECT_EQ_RECT(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(surface, occlusion);
+
+ this->enterContributingSurface(surface, occlusion);
+ // Occlusion within the surface is lost when leaving the animating surface.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300)));
+ this->leaveContributingSurface(surface, occlusion);
+
+ this->visitLayer(layer, occlusion);
+ this->enterLayer(parent, occlusion);
+
+ // Occlusion is not added for the animating |layer|.
+ EXPECT_EQ_RECT(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ }
+};
-void damageRectOverTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity0OnMainThread);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestAnimationTranslateOnMainThread : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
+ typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true);
+
+ addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*surface->layerAnimationController(), 10, 30, 0);
+ addAnimatedTransformToController(*surfaceChild->layerAnimationController(), 10, 30, 0);
+ this->calcDrawEtc(parent);
+
+ EXPECT_TRUE(layer->drawTransformIsAnimating());
+ EXPECT_TRUE(layer->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimating());
+ EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating());
+ // The surface owning layer doesn't animate against its own surface.
+ EXPECT_FALSE(surface->drawTransformIsAnimating());
+ EXPECT_TRUE(surface->screenSpaceTransformIsAnimating());
+ EXPECT_TRUE(surfaceChild->drawTransformIsAnimating());
+ EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating());
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(surface2, occlusion);
+ this->enterContributingSurface(surface2, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
+ this->leaveContributingSurface(surface2, occlusion);
+ this->enterLayer(surfaceChild2, occlusion);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ // surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
+ // It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300)));
+ EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300)));
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ this->leaveLayer(surfaceChild2, occlusion);
+ this->enterLayer(surfaceChild, occlusion);
+ EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300)));
+
+ // The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it
+ // can't be occluded.
+ EXPECT_EQ_RECT(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300)));
+ EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300)));
+
+ this->leaveLayer(surfaceChild, occlusion);
+ this->enterLayer(surface, occlusion);
+ // The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ_RECT(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300)));
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ this->leaveLayer(surface, occlusion);
+ // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300)));
+
+ this->enterContributingSurface(surface, occlusion);
+ // The contributing |surface| is animating so it can't be occluded.
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 300, 300)));
+ this->leaveContributingSurface(surface, occlusion);
+
+ this->enterLayer(layer, occlusion);
+ // The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it.
+ EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ this->leaveLayer(layer, occlusion);
+
+ this->enterLayer(parent, occlusion);
+ // The |layer| is animating in the screen and in its target, so no occlusion is added.
+ EXPECT_EQ_RECT(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300)));
+ }
+};
- TestDamageClient damage(FloatRect(200, 100, 100, 100));
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage);
+MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationTranslateOnMainThread);
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix surfaceTransform;
+ surfaceTransform.translate(300, 300);
+ surfaceTransform.scale(2);
+ surfaceTransform.translate(-150, -150);
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false);
+ typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false);
+ surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
+ surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
+ this->calcDrawEtc(parent);
- // Outside the layer's clip rect.
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
+ this->visitLayer(surface2, occlusion);
+ this->visitContributingSurface(surface2, occlusion);
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ // Clear any stored occlusion.
+ occlusion.setOcclusionInScreenSpace(Region());
+ occlusion.setOcclusionInTargetSurface(Region());
- EXPECT_EQ_RECT(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
-}
+ this->visitLayer(surface, occlusion);
+ this->visitContributingSurface(surface, occlusion);
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverTile, damageRectOverTile);
+ EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
-void damageRectOverCulledTile(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false);
+ surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200));
+ this->calcDrawEtc(parent);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ this->visitLayer(surface, occlusion);
+ this->visitContributingSurface(surface, occlusion);
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping);
- TestDamageClient damage(FloatRect(100, 100, 100, 100));
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestReplicaOccluded : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true);
+ this->calcDrawEtc(parent);
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+ // |topmost| occludes the replica, but not the surface itself.
+ this->visitLayer(topmost, occlusion);
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
+ EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ this->visitLayer(surface, occlusion);
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ this->enterContributingSurface(surface, occlusion);
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
-}
+ // Surface is not occluded so it shouldn't think it is.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100)));
+ }
+};
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverCulledTile, damageRectOverCulledTile);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaOccluded);
-void damageRectOverPartialTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestDamageClient damage(FloatRect(50, 50, 200, 200));
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage);
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_EQ_RECT(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)));
- EXPECT_EQ_RECT(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)));
- EXPECT_EQ_RECT(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)));
- EXPECT_EQ_RECT(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)));
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverPartialTiles, damageRectOverPartialTiles);
-
-void damageRectOverNoTiles(bool opaqueLayers)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> parentLayer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(parentLayer);
- parent->addChild(layer);
-
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- parentLayer->setFilters(filters);
- layer->setFilters(filters);
-
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(parentLayer.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false, opaqueLayers);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true, opaqueLayers);
-
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
-
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
-
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
-
- TestDamageClient damage(FloatRect(500, 500, 100, 100));
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000), &damage);
-
- occlusion.enterTargetRenderSurface(layer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
-
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
- occlusion.enterTargetRenderSurface(parentLayer->renderSurface());
-
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parentLayer.get(), IntRect(200, 200, 100, 100)));
-
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
-
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 300)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 0, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(0, 100, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(200, 100, 100, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent.get(), IntRect(100, 200, 100, 100)).isEmpty());
-}
-
-TEST_OPAQUE_AND_PAINTED_OPAQUE(CCOcclusionTrackerTest_damageRectOverNoTiles, damageRectOverNoTiles);
-
-TEST(CCOcclusionTrackerTest, opaqueContentsRegionEmpty)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(layer);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true);
+ this->calcDrawEtc(parent);
- FilterOperations filters;
- filters.operations().append(BasicComponentTransferFilterOperation::create(0.5, FilterOperation::GRAYSCALE));
- layer->setFilters(filters);
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false, false);
+ // |topmost| occludes the surface, but not the entire surface's replica.
+ this->visitLayer(topmost, occlusion);
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ this->visitLayer(surface, occlusion);
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
+ this->enterContributingSurface(surface, occlusion);
- occlusion.enterTargetRenderSurface(layer->renderSurface());
+ // Surface is occluded, but only the top 10px of the replica.
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100)));
+ }
+};
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(100, 100, 100, 100)));
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded);
- // Occluded since its outside the surface bounds.
- EXPECT_TRUE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
+ typename Types::LayerType* overSurface = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true);
+ typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true);
+ this->calcDrawEtc(parent);
- // Test without any scissors.
- occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- EXPECT_FALSE(occlusion.occluded(layer.get(), IntRect(200, 100, 100, 100)));
- occlusion.useDefaultLayerScissorRect();
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- occlusion.markOccludedBehindLayer(layer.get());
- occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+ // These occlude the surface and replica differently, so we can test each one.
+ this->visitLayer(overReplica, occlusion);
+ this->visitLayer(overSurface, occlusion);
- EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty());
- EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
-}
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
-TEST(CCOcclusionTrackerTest, opaqueContentsRegionNonEmpty)
-{
- const TransformationMatrix identityMatrix;
- RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<LayerChromiumWithForcedDrawsContent> layer = adoptRef(new LayerChromiumWithForcedDrawsContent());
- parent->createRenderSurface();
- parent->addChild(layer);
+ this->visitLayer(surface, occlusion);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- setLayerPropertiesForTesting(layer.get(), identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false, false);
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
- Vector<RefPtr<LayerChromium> > dummyLayerList;
- int dummyMaxTextureSize = 512;
+ this->enterContributingSurface(surface, occlusion);
- parent->renderSurface()->setContentRect(IntRect(IntPoint::zero(), parent->bounds()));
- parent->setClipRect(IntRect(IntPoint::zero(), parent->bounds()));
- renderSurfaceLayerList.append(parent);
+ // Surface and replica are occluded different amounts.
+ EXPECT_EQ_RECT(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), true, IntRect(0, 0, 100, 100)));
+ }
+};
- CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceChildOfSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
{
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- layer->setOpaquePaintRect(IntRect(0, 0, 100, 100));
+ // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
+ typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true);
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
+ this->calcDrawEtc(parent);
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000));
- EXPECT_EQ_RECT(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ // |topmost| occludes everything partially so we know occlusion is happening at all.
+ this->visitLayer(topmost, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ this->visitLayer(surfaceChild, occlusion);
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100)));
+ // surfaceChild increases the occlusion in the screen by a narrow sliver.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ // In its own surface, surfaceChild is at 0,0 as is its occlusion.
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
+ // mask to bounds, so it doesn't have a clipRect of its own. Thus the parent of |surfaceChild| exercises different code paths
+ // as its parent does not have a clipRect.
+
+ this->enterContributingSurface(surfaceChild, occlusion);
+ // The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect
+ // does not get clipped away inappropriately.
+ EXPECT_EQ_RECT(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 50)));
+ this->leaveContributingSurface(surfaceChild, occlusion);
+
+ // When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also.
+ this->enterLayer(surface, occlusion);
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ this->leaveLayer(surface, occlusion);
+
+ this->enterContributingSurface(surface, occlusion);
+ // The surface's parent does have a clipRect as it is the root layer.
+ EXPECT_EQ_RECT(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100)));
}
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
{
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- layer->setOpaquePaintRect(IntRect(20, 20, 180, 180));
+ // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(80, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
+ typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false);
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
+ // |topmost| occludes everything partially so we know occlusion is happening at all.
+ this->visitLayer(topmost, occlusion);
- EXPECT_EQ_RECT(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100)));
+ // surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface.
+ this->visitLayer(surfaceChild, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
+ // mask to bounds, so it doesn't have a clipRect of its own. Thus the parent of |surfaceChild| exercises different code paths
+ // as its parent does not have a clipRect.
+
+ this->enterContributingSurface(surfaceChild, occlusion);
+ // The surfaceChild's parent does not have a clipRect as it owns a render surface.
+ EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild->renderSurface(), false, IntRect(0, 0, 100, 100)));
+ this->leaveContributingSurface(surfaceChild, occlusion);
+
+ this->visitLayer(surface, occlusion);
+ this->enterContributingSurface(surface, occlusion);
+ // The surface's parent does have a clipRect as it is the root layer.
+ EXPECT_EQ_RECT(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface->renderSurface(), false, IntRect(0, 0, 100, 100)));
}
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfClippingSurface);
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
{
- TestCCOcclusionTracker occlusion(IntRect(0, 0, 1000, 1000));
- layer->setOpaquePaintRect(IntRect(150, 150, 100, 100));
+ TransformationMatrix scaleByHalf;
+ scaleByHalf.scale(0.5);
+
+ // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
+ // The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
+ // appears at 50, 50 and the replica at 200, 50.
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
+ typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
+ typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
+ typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
+ typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
+ typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
+
+ // Filters make the layer own a surface.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(10, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface->setBackgroundFilters(filters);
+
+ // Save the distance of influence for the blur effect.
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ // These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
+ // need to see some of the pixels (up to radius far) underneath the occludingLayers.
+ this->visitLayer(occludingLayer5, occlusion);
+ this->visitLayer(occludingLayer4, occlusion);
+ this->visitLayer(occludingLayer3, occlusion);
+ this->visitLayer(occludingLayer2, occlusion);
+ this->visitLayer(occludingLayer1, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // Everything outside the surface/replica is occluded but the surface/replica itself is not.
+ this->enterLayer(filteredSurface, occlusion);
+ EXPECT_EQ_RECT(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100)));
+
+ EXPECT_EQ_RECT(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100)));
+ EXPECT_EQ_RECT(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100)));
+ this->leaveLayer(filteredSurface, occlusion);
+
+ // The filtered layer/replica does not occlude.
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
+ // it needs should be removed some the occluded area so that when we get to the parent they are drawn.
+ this->visitContributingSurface(filteredSurface, occlusion);
+
+ this->enterLayer(parent, occlusion);
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
+
+ IntRect outsetRect;
+ IntRect testRect;
+
+ // Nothing in the blur outsets for the filteredSurface is occluded.
+ outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ testRect = outsetRect;
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+
+ // Stuff outside the blur outsets is still occluded though.
+ testRect = outsetRect;
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.move(-1, 0);
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.move(0, -1);
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+
+ // Nothing in the blur outsets for the filteredSurface's replica is occluded.
+ outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ testRect = outsetRect;
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+
+ // Stuff outside the blur outsets is still occluded though.
+ testRect = outsetRect;
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.move(-1, 0);
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ testRect = outsetRect;
+ testRect.move(0, -1);
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(outsetRect, occlusion.unoccludedContentRect(parent, testRect));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix scaleByHalf;
+ scaleByHalf.scale(0.5);
+
+ // Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them.
+ typename Types::ContentLayerType* root = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(75, 75));
+ typename Types::LayerType* parent = this->createSurface(root, scaleByHalf, FloatPoint(0, 0), IntSize(150, 150));
+ parent->setMasksToBounds(true);
+ typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
+ typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
+ typename Types::LayerType* occludingLayerAbove = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true);
+
+ // Filters make the layers own surfaces.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(3, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface1->setBackgroundFilters(filters);
+ filteredSurface2->setBackgroundFilters(filters);
+
+ // Save the distance of influence for the blur effect.
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
- occlusion.enterTargetRenderSurface(parent->renderSurface());
- occlusion.markOccludedBehindLayer(layer.get());
+ this->calcDrawEtc(root);
- EXPECT_EQ_RECT(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(occludingLayerAbove, occlusion);
+ EXPECT_EQ_RECT(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+
+ this->visitLayer(filteredSurface2, occlusion);
+ this->visitContributingSurface(filteredSurface2, occlusion);
+ this->visitLayer(filteredSurface1, occlusion);
+ this->visitContributingSurface(filteredSurface1, occlusion);
+
+ ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occluded(parent.get(), IntRect(200, 200, 100, 100)));
+ // Test expectations in the target.
+ IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetBottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom) * 2);
+ EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]);
+
+ // Test expectations in the screen. Take the ceiling of half of the outsets.
+ outsetTop = (outsetTop + 1) / 2;
+ outsetRight = (outsetRight + 1) / 2;
+ outsetBottom = (outsetBottom + 1) / 2;
+ outsetLeft = (outsetLeft + 1) / 2;
+ expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetBottom) * 2);
+
+ EXPECT_EQ_RECT(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]);
}
-}
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ // Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ // We stick the filtered surface inside a clipping surface so that we can make sure the clip is honored when exposing pixels for
+ // the background filter.
+ typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70));
+ clippingSurface->setMasksToBounds(true);
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(clippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(150, 0), IntSize());
+ typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
+ typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
+ typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
+ typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
+ typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
+
+ // Filters make the layer own a surface. This filter is large enough that it goes outside the bottom of the clippingSurface.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(12, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface->setBackgroundFilters(filters);
+
+ // Save the distance of influence for the blur effect.
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ // These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
+ // need to see some of the pixels (up to radius far) underneath the occludingLayers.
+ this->visitLayer(occludingLayer5, occlusion);
+ this->visitLayer(occludingLayer4, occlusion);
+ this->visitLayer(occludingLayer3, occlusion);
+ this->visitLayer(occludingLayer2, occlusion);
+ this->visitLayer(occludingLayer1, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // Everything outside the surface/replica is occluded but the surface/replica itself is not.
+ this->enterLayer(filteredSurface, occlusion);
+ EXPECT_EQ_RECT(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50)));
+
+ EXPECT_EQ_RECT(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50)));
+ EXPECT_EQ_RECT(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50)));
+ this->leaveLayer(filteredSurface, occlusion);
+
+ // The filtered layer/replica does not occlude.
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
+ // it needs should be removed some the occluded area so that when we get to the parent they are drawn.
+ this->visitContributingSurface(filteredSurface, occlusion);
+
+ this->enterContributingSurface(clippingSurface, occlusion);
+ EXPECT_EQ_RECT(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
+
+ IntRect outsetRect;
+ IntRect clippedOutsetRect;
+ IntRect testRect;
+
+ // Nothing in the (clipped) blur outsets for the filteredSurface is occluded.
+ outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
+ testRect = outsetRect;
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+
+ // Stuff outside the (clipped) blur outsets is still occluded though.
+ testRect = outsetRect;
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.move(-1, 0);
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.move(0, -1);
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+
+ // Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded.
+ outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
+ testRect = outsetRect;
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+
+ // Stuff outside the (clipped) blur outsets is still occluded though.
+ testRect = outsetRect;
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.move(-1, 0);
+ testRect.expand(1, 0);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ testRect = outsetRect;
+ testRect.move(0, -1);
+ testRect.expand(0, 1);
+ EXPECT_EQ_RECT(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect));
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix scaleByHalf;
+ scaleByHalf.scale(0.5);
+
+ // Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each.
+ // The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
+ // appears at 50, 50 and the replica at 200, 50.
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true);
+ typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true);
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
+
+ // Filters make the layer own a surface.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(3, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface->setBackgroundFilters(filters);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ // The surface has a background blur, so it blurs non-opaque pixels below it.
+ this->visitLayer(filteredSurface, occlusion);
+ this->visitContributingSurface(filteredSurface, occlusion);
+
+ this->visitLayer(behindReplicaLayer, occlusion);
+ this->visitLayer(behindSurfaceLayer, occlusion);
+
+ // The layers behind the surface are not blurred, and their occlusion does not change, until we leave the surface.
+ // So it should not be modified by the filter here.
+ IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30);
+ IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30);
+
+ IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica);
+ EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix scaleByHalf;
+ scaleByHalf.scale(0.5);
+
+ // Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order.
+ // The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
+ // appears at 50, 50 and the replica at 200, 50.
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
+ typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true);
+ typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true);
+
+ // Filters make the layer own a surface.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(3, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface->setBackgroundFilters(filters);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(aboveReplicaLayer, occlusion);
+ this->visitLayer(aboveSurfaceLayer, occlusion);
+
+ // The surface has a background blur, so it blurs non-opaque pixels below it.
+ this->visitLayer(filteredSurface, occlusion);
+ this->visitContributingSurface(filteredSurface, occlusion);
+
+ // The filter is completely occluded, so it should not blur anything and reduce any occlusion.
+ IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50);
+ IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50);
+
+ IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica);
+ EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ TransformationMatrix scaleByHalf;
+ scaleByHalf.scale(0.5);
+
+ // Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order.
+ // The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
+ // appears at 50, 50 and the replica at 200, 50.
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
+ typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true);
+ typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true);
+ typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true);
+ typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true);
+
+ // Filters make the layer own a surface.
+ FilterOperations filters;
+ filters.operations().append(BlurFilterOperation::create(Length(3, WebCore::Fixed), FilterOperation::BLUR));
+ filteredSurface->setBackgroundFilters(filters);
+
+ // Save the distance of influence for the blur effect.
+ int outsetTop, outsetRight, outsetBottom, outsetLeft;
+ filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+
+ this->visitLayer(besideReplicaLayer, occlusion);
+ this->visitLayer(besideSurfaceLayer, occlusion);
+ this->visitLayer(aboveReplicaLayer, occlusion);
+ this->visitLayer(aboveSurfaceLayer, occlusion);
+
+ // The surface has a background blur, so it blurs non-opaque pixels below it.
+ this->visitLayer(filteredSurface, occlusion);
+ this->visitContributingSurface(filteredSurface, occlusion);
+
+ // The filter in the surface and replica are partially unoccluded. Only the unoccluded parts should reduce occlusion.
+ // This means it will push back the occlusion that touches the unoccluded part (occlusionAbove___), but it will not
+ // touch occlusionBeside____ since that is not beside the unoccluded part of the surface, even though it is beside
+ // the occluded part of the surface.
+ IntRect occlusionAboveSurface = IntRect(70 + outsetRight, 50, 30 - outsetRight, 50);
+ IntRect occlusionAboveReplica = IntRect(200, 50, 30 - outsetLeft, 50);
+ IntRect occlusionBesideSurface = IntRect(90, 40, 10, 10);
+ IntRect occlusionBesideReplica = IntRect(200, 40, 10, 10);
+
+ Region expectedOcclusion;
+ expectedOcclusion.unite(occlusionAboveSurface);
+ expectedOcclusion.unite(occlusionAboveReplica);
+ expectedOcclusion.unite(occlusionBesideSurface);
+ expectedOcclusion.unite(occlusionBesideReplica);
+
+ ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetSurface().rects().size());
+ ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenSpace().rects().size());
+
+ for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) {
+ IntRect expectedRect = expectedOcclusion.rects()[i];
+ IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i];
+ IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i];
+ EXPECT_EQ(expectedRect, screenRect);
+ EXPECT_EQ(expectedRect, targetRect);
+ }
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestMinimumTrackingSize : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+ void runMyTest()
+ {
+ IntSize trackingSize(100, 100);
+ IntSize belowTrackingSize(99, 99);
+
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(400, 400));
+ typename Types::LayerType* large = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), trackingSize, true);
+ typename Types::LayerType* small = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
+ this->calcDrawEtc(parent);
+
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
+ occlusion.setMinimumTrackingSize(trackingSize);
+
+ // The small layer is not tracked because it is too small.
+ this->visitLayer(small, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+
+ // The large layer is tracked as it is large enough.
+ this->visitLayer(large, occlusion);
+
+ EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+ EXPECT_EQ_RECT(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+ }
+};
+
+ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize);
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h b/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h
new file mode 100644
index 000000000..fcdc3ed6c
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h
@@ -0,0 +1,57 @@
+/*
+ * 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 CCOcclusionTrackerTestCommon_h
+#define CCOcclusionTrackerTestCommon_h
+
+#include "IntRect.h"
+#include "Region.h"
+#include "RenderSurfaceChromium.h"
+#include "cc/CCOcclusionTracker.h"
+#include "cc/CCRenderSurface.h"
+
+namespace WebKitTests {
+
+// A subclass to expose the total current occlusion.
+template<typename LayerType, typename RenderSurfaceType>
+class TestCCOcclusionTrackerBase : public WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType> {
+public:
+ TestCCOcclusionTrackerBase(WebCore::IntRect screenScissorRect, bool recordMetricsForFrame = false)
+ : WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
+ {
+ }
+
+ WebCore::Region occlusionInScreenSpace() const { return WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; }
+ WebCore::Region occlusionInTargetSurface() const { return WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; }
+
+ void setOcclusionInScreenSpace(const WebCore::Region& region) { WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; }
+ void setOcclusionInTargetSurface(const WebCore::Region& region) { WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; }
+};
+
+typedef TestCCOcclusionTrackerBase<WebCore::LayerChromium, WebCore::RenderSurfaceChromium> TestCCOcclusionTracker;
+typedef TestCCOcclusionTrackerBase<WebCore::CCLayerImpl, WebCore::CCRenderSurface> TestCCOcclusionTrackerImpl;
+
+}
+
+#endif // CCOcclusionTrackerTestCommon_h
diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp
index 42776bc94..991cddc46 100644
--- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp
@@ -26,6 +26,10 @@
#include "cc/CCQuadCuller.h"
+#include "cc/CCOcclusionTracker.h"
+#include "cc/CCOverdrawMetrics.h"
+#include "cc/CCSingleThreadProxy.h"
+#include "cc/CCTiledLayerImpl.h"
#include "cc/CCTileDrawQuad.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -34,89 +38,145 @@ using namespace WebCore;
namespace {
-class CCQuadCullerTest : public testing::Test {
+class TestCCOcclusionTrackerImpl : public CCOcclusionTrackerImpl {
+public:
+ TestCCOcclusionTrackerImpl(const IntRect& scissorRectInScreen, bool recordMetricsForFrame = true)
+ : CCOcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame)
+ , m_scissorRectInScreen(scissorRectInScreen)
+ {
+ }
+
+protected:
+ virtual IntRect layerScissorRectInTargetSurface(const CCLayerImpl* layer) const { return m_scissorRectInScreen; }
+
+private:
+ IntRect m_scissorRectInScreen;
};
-static PassOwnPtr<CCDrawQuad> MakeTileQuad(CCSharedQuadState* state, const IntRect& rect, const IntRect& opaqueRect = IntRect())
+typedef CCLayerIterator<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+
+static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, Vector<CCLayerImpl*>& surfaceLayerList)
{
- return CCTileDrawQuad::create(state, rect, intersection(rect, opaqueRect), 1, IntPoint(1, 1), IntSize(100, 100), 0, false, false, false, false, false);
+ OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0);
+ OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels);
+ tiler->setBounds(layerRect.size());
+ layer->setTilingData(*tiler);
+ layer->setSkipsDraw(false);
+ layer->setDrawTransform(drawTransform);
+ layer->setScreenSpaceTransform(drawTransform);
+ layer->setVisibleLayerRect(layerRect);
+ layer->setDrawOpacity(opacity);
+ layer->setOpaque(opaque);
+
+ int textureId = 1;
+ for (int i = 0; i < tiler->numTilesX(); ++i)
+ for (int j = 0; j < tiler->numTilesY(); ++j) {
+ IntRect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : intersection(tiler->tileBounds(i, j), layerOpaqueRect);
+ layer->pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), tileOpaqueRect);
+ }
+
+ if (!parent) {
+ layer->createRenderSurface();
+ layer->setTargetRenderSurface(layer->renderSurface());
+ surfaceLayerList.append(layer.get());
+ layer->renderSurface()->layerList().append(layer.get());
+ } else {
+ layer->setTargetRenderSurface(parent->targetRenderSurface());
+ parent->renderSurface()->layerList().append(layer.get());
+ }
+
+ return layer.release();
}
-void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQuadList& quadList, const IntRect& opaqueRect = IntRect())
+static void appendQuads(CCQuadList& quadList, Vector<OwnPtr<CCSharedQuadState> >& sharedStateList, CCTiledLayerImpl* layer, CCLayerIteratorType& it, CCOcclusionTrackerImpl& occlusionTracker)
{
- quadList.clear();
-
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 0), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 0), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(0, 100), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 100), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 100), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(0, 200), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(100, 200), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(rootState, IntRect(IntPoint(200, 200), IntSize(100, 100)), opaqueRect));
-
- quadList.append(MakeTileQuad(childState, IntRect(IntPoint(), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(childState, IntRect(IntPoint(100, 0), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(childState, IntRect(IntPoint(0, 100), IntSize(100, 100)), opaqueRect));
- quadList.append(MakeTileQuad(childState, IntRect(IntPoint(100, 100), IntSize(100, 100)), opaqueRect));
+ occlusionTracker.enterLayer(it);
+ CCQuadCuller quadCuller(quadList, layer, &occlusionTracker);
+ OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ sharedStateList.append(sharedQuadState.release());
+ occlusionTracker.leaveLayer(it);
+ ++it;
}
#define DECLARE_AND_INITIALIZE_TEST_QUADS \
+ DebugScopedSetImplThread impl; \
CCQuadList quadList; \
- CCOverdrawCounts overdraw; \
+ Vector<OwnPtr<CCSharedQuadState> > sharedStateList; \
+ Vector<CCLayerImpl*> renderSurfaceLayerList; \
TransformationMatrix childTransform; \
IntSize rootSize = IntSize(300, 300); \
IntRect rootRect = IntRect(IntPoint(), rootSize); \
IntSize childSize = IntSize(200, 200); \
IntRect childRect = IntRect(IntPoint(), childSize);
-TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft)
+TEST(CCQuadCullerTest, verifyNoCulling)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, false, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
+}
+
+TEST(CCQuadCullerTest, verifyCullChildLinesUpTopLeft)
+{
+ DECLARE_AND_INITIALIZE_TEST_QUADS
+
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
+
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 9u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 40000, 1);
}
TEST(CCQuadCullerTest, verifyCullWhenChildOpacityNotOne)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 0.9, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
- EXPECT_EQ(quadList.size(), 13u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 40000, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
TEST(CCQuadCullerTest, verifyCullWhenChildOpaqueFlagFalse)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 13u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 40000, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
TEST(CCQuadCullerTest, verifyCullCenterTileOnly)
@@ -125,32 +185,33 @@ TEST(CCQuadCullerTest, verifyCullCenterTileOnly)
childTransform.translate(50, 50);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 12u);
- IntRect quadVisibleRect1 = quadList[1].get()->quadVisibleRect();
+ IntRect quadVisibleRect1 = quadList[5].get()->quadVisibleRect();
EXPECT_EQ(quadVisibleRect1.height(), 50);
- IntRect quadVisibleRect3 = quadList[3].get()->quadVisibleRect();
+ IntRect quadVisibleRect3 = quadList[7].get()->quadVisibleRect();
EXPECT_EQ(quadVisibleRect3.width(), 50);
- // Next index is 4, not 5, since centre quad culled.
- IntRect quadVisibleRect4 = quadList[4].get()->quadVisibleRect();
+ // Next index is 8, not 9, since centre quad culled.
+ IntRect quadVisibleRect4 = quadList[8].get()->quadVisibleRect();
EXPECT_EQ(quadVisibleRect4.width(), 50);
EXPECT_EQ(quadVisibleRect4.x(), 250);
- IntRect quadVisibleRect6 = quadList[6].get()->quadVisibleRect();
+ IntRect quadVisibleRect6 = quadList[10].get()->quadVisibleRect();
EXPECT_EQ(quadVisibleRect6.height(), 50);
EXPECT_EQ(quadVisibleRect6.y(), 250);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 100000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 30000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 100000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 30000, 1);
}
TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1)
@@ -159,32 +220,33 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize1)
childTransform.translate(100, 100);
- // Create root layer tile with extent (99.1, 99.1) -> (200.9, 200.9) to make
+ // Make the root layer's quad have extent (99.1, 99.1) -> (200.9, 200.9) to make
// sure it doesn't get culled due to transform rounding.
TransformationMatrix rootTransform;
rootTransform.translate(99.1, 99.1);
rootTransform.scale(1.018);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(rootTransform, TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ rootRect = childRect = IntRect(0, 0, 100, 100);
- quadList.append(MakeTileQuad(rootState.get(), IntRect(IntPoint(), IntSize(100, 100))));
- quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100))));
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- EXPECT_EQ(quadList.size(), 2u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 2u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 20363, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 20363, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- // Make the child quad slightly smaller than, and centred over, the root layer tile.
+ // Make the child's quad slightly smaller than, and centred over, the root layer tile.
// Verify the child does not cause the quad below to be culled due to rounding.
childTransform.translate(100.1, 100.1);
childTransform.scale(0.982);
@@ -192,19 +254,20 @@ TEST(CCQuadCullerTest, verifyCullCenterTileNonIntegralSize2)
TransformationMatrix rootTransform;
rootTransform.translate(100, 100);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(rootTransform, TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ rootRect = childRect = IntRect(0, 0, 100, 100);
- quadList.append(MakeTileQuad(rootState.get(), IntRect(IntPoint(), IntSize(100, 100))));
- quadList.append(MakeTileQuad(childState.get(), IntRect(IntPoint(), IntSize(100, 100))));
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- EXPECT_EQ(quadList.size(), 2u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 2u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 19643, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 19643, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight)
@@ -213,16 +276,17 @@ TEST(CCQuadCullerTest, verifyCullChildLinesUpBottomRight)
childTransform.translate(100, 100);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 9u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 40000, 1);
}
TEST(CCQuadCullerTest, verifyCullSubRegion)
@@ -231,17 +295,18 @@ TEST(CCQuadCullerTest, verifyCullSubRegion)
childTransform.translate(50, 50);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 12u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 30000, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 10000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 30000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 10000, 1);
}
TEST(CCQuadCullerTest, verifyCullSubRegion2)
@@ -250,17 +315,18 @@ TEST(CCQuadCullerTest, verifyCullSubRegion2)
childTransform.translate(50, 10);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 12u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 90000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 25000, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 15000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 25000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 15000, 1);
}
TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull)
@@ -269,14 +335,18 @@ TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull)
childTransform.translate(50, 49);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect, renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 13u);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 90000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 30000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 10000, 1);
}
TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
@@ -286,16 +356,17 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
// Use a small rotation so as to not disturb the geometry significantly.
childTransform.rotate(1);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 13u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 130000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 130000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
// This test requires some explanation: here we are rotating the quads to be culled.
@@ -311,74 +382,102 @@ TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled)
TransformationMatrix parentTransform;
parentTransform.rotate(1);
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(parentTransform, TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, false, IntRect(), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 12u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 120000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 10000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 100600, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 29400, 1);
}
TEST(CCQuadCullerTest, verifyCullOutsideScissorOverTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(200, 100, 100, 100), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 1u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 10000, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 120000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 10000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 120000, 1);
}
TEST(CCQuadCullerTest, verifyCullOutsideScissorOverCulledTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(100, 100, 100, 100), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 1u);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 10000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 120000, 1);
}
TEST(CCQuadCullerTest, verifyCullOutsideScissorOverPartialTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(50, 50, 200, 200), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 9u);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 40000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 90000, 1);
}
TEST(CCQuadCullerTest, verifyCullOutsideScissorOverNoTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);
- OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, true);
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100));
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
- setQuads(rootState.get(), childState.get(), quadList);
- EXPECT_EQ(quadList.size(), 13u);
- CCQuadCuller::cullOccludedQuads(quadList, true, IntRect(500, 500, 100, 100), &overdraw);
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
EXPECT_EQ(quadList.size(), 0u);
- EXPECT_NEAR(overdraw.m_pixelsDrawnOpaque, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsDrawnTransparent, 0, 1);
- EXPECT_NEAR(overdraw.m_pixelsCulled, 130000, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 130000, 1);
+}
+
+TEST(CCQuadCullerTest, verifyWithoutMetrics)
+{
+ DECLARE_AND_INITIALIZE_TEST_QUADS
+
+ OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect(), renderSurfaceLayerList);
+ TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false);
+ CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList);
+
+ appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
+ appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
+ EXPECT_EQ(quadList.size(), 9u);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
+ EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
}
diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
index 1201587c7..7dac005d2 100644
--- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
+++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp
@@ -26,7 +26,9 @@
#include "cc/CCRenderSurface.h"
+#include "TransformationMatrix.h"
#include "cc/CCLayerImpl.h"
+#include "cc/CCSharedQuadState.h"
#include "cc/CCSingleThreadProxy.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -89,4 +91,38 @@ TEST(CCRenderSurfaceTest, verifySurfaceChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->setMaskLayer(dummyMask.get()));
}
+TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
+{
+ // This will fake that we are on the correct thread for testing purposes.
+ DebugScopedSetImplThread setImplThread;
+
+ OwnPtr<CCLayerImpl> owningLayer = CCLayerImpl::create(0);
+ owningLayer->createRenderSurface();
+ ASSERT_TRUE(owningLayer->renderSurface());
+ CCRenderSurface* renderSurface = owningLayer->renderSurface();
+
+ IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50));
+ IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40));
+ TransformationMatrix draw;
+ TransformationMatrix origin;
+
+ draw.translate(30, 40);
+
+ renderSurface->setDrawTransform(draw);
+ renderSurface->setOriginTransform(origin);
+ renderSurface->setContentRect(contentRect);
+ renderSurface->setClipRect(clipRect);
+ renderSurface->setDrawOpacity(1);
+
+ OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState();
+
+ EXPECT_TRUE(sharedQuadState->quadTransform().isIdentity());
+ EXPECT_EQ(30, sharedQuadState->layerTransform().m41());
+ EXPECT_EQ(40, sharedQuadState->layerTransform().m42());
+ EXPECT_EQ(contentRect, sharedQuadState->layerRect());
+ EXPECT_EQ(clipRect, sharedQuadState->clipRect());
+ EXPECT_EQ(1, sharedQuadState->opacity());
+ EXPECT_FALSE(sharedQuadState->isOpaque());
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
index 0853e5a36..2731c76fd 100644
--- a/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
+++ b/Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
@@ -52,6 +52,9 @@ public:
void setNeedsCommit(bool b) { m_needsCommit = b; }
bool needsCommit() const { return m_needsCommit; }
+ void setNeedsForcedCommit(bool b) { m_needsForcedCommit = b; }
+ bool needsForcedCommit() const { return m_needsForcedCommit; }
+
void setNeedsRedraw(bool b) { m_needsRedraw = b; }
bool needsRedraw() const { return m_needsRedraw; }
@@ -72,6 +75,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded)
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setCanBeginFrame(true);
state.setNeedsRedraw(false);
state.setNeedsCommit(false);
state.setUpdateMoreResourcesPending(false);
@@ -86,10 +90,30 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded)
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
}
+ // If commit requested but canBeginFrame is still false, do nothing.
+ {
+ StateMachine state;
+ state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setNeedsRedraw(false);
+ state.setNeedsCommit(false);
+ state.setUpdateMoreResourcesPending(false);
+ state.setVisible(true);
+
+ EXPECT_FALSE(state.vsyncCallbackNeeded());
+
+ state.didLeaveVSync();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ EXPECT_FALSE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ }
+
+
// If commit requested, begin a frame
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_IDLE);
+ state.setCanBeginFrame(true);
state.setNeedsRedraw(false);
state.setNeedsCommit(true);
state.setUpdateMoreResourcesPending(false);
@@ -100,6 +124,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded)
// Begin the frame, make sure needsCommit and commitState update correctly.
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME);
EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.commitState());
@@ -116,6 +141,180 @@ TEST(CCSchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw)
EXPECT_TRUE(state.vsyncCallbackNeeded());
}
+TEST(CCSchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+ state.setNeedsRedraw();
+ EXPECT_TRUE(state.redrawPending());
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+
+ // We're drawing now.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ EXPECT_FALSE(state.redrawPending());
+ EXPECT_FALSE(state.commitPending());
+
+ // Failing the draw makes us require a commit.
+ state.didDrawIfPossibleCompleted(false);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_FRAME);
+ EXPECT_TRUE(state.redrawPending());
+ EXPECT_TRUE(state.commitPending());
+}
+
+TEST(CCSchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+ state.setNeedsRedraw();
+ EXPECT_TRUE(state.redrawPending());
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+
+ // We're drawing now.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ EXPECT_FALSE(state.redrawPending());
+ EXPECT_FALSE(state.commitPending());
+
+ // While still in the same vsync callback, set needs redraw again.
+ // This should not redraw.
+ state.setNeedsRedraw();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+
+ // Failing the draw makes us require a commit.
+ state.didDrawIfPossibleCompleted(false);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+ EXPECT_TRUE(state.redrawPending());
+}
+
+TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+
+ // 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.
+ 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());
+
+ // And we should be allowed to draw again.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAllowDrawInSameFrame)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+
+ // 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());
+
+ // Force a draw.
+ state.setNeedsForcedRedraw();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction());
+
+ // Do the forced draw.
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_FORCED);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ EXPECT_FALSE(state.redrawPending());
+ // And the commit is still ongoing.
+ EXPECT_TRUE(state.commitPending());
+
+ // Finish the commit.
+ 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());
+
+ // And we should not be allowed to draw again in the same frame..
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync)
+{
+ CCSchedulerStateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+
+ // Start 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());
+
+ // We should not be trying to draw again now, but we have a commit pending.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+
+ state.didLeaveVSync();
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+ state.didEnterVSync();
+
+ // We should try draw again in the next vsync.
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+}
+
TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame)
{
CCSchedulerStateMachine state;
@@ -123,8 +322,8 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame)
state.setNeedsRedraw();
EXPECT_TRUE(state.vsyncCallbackNeeded());
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
// While still in the same vsync callback, set needs redraw again.
// This should not redraw.
@@ -132,12 +331,14 @@ TEST(CCSchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame)
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
// Move to another frame. This should now draw.
+ state.didDrawIfPossibleCompleted(true);
state.didLeaveVSync();
EXPECT_TRUE(state.vsyncCallbackNeeded());
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ state.didDrawIfPossibleCompleted(true);
EXPECT_FALSE(state.vsyncCallbackNeeded());
}
@@ -156,31 +357,13 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync)
} else
state.setVisible(true);
- // Case 1: needsCommit=false updateMoreResourcesPending=false.
- state.setNeedsCommit(false);
- state.setUpdateMoreResourcesPending(false);
- EXPECT_FALSE(state.vsyncCallbackNeeded());
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
-
- // Case 2: needsCommit=false updateMoreResourcesPending=true.
+ // Case 1: needsCommit=false
state.setNeedsCommit(false);
- state.setUpdateMoreResourcesPending(true);
- if (visible)
- EXPECT_TRUE(state.vsyncCallbackNeeded());
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
- // Case 3: needsCommit=true updateMoreResourcesPending=false.
+ // Case 2: needsCommit=true
state.setNeedsCommit(true);
- state.setUpdateMoreResourcesPending(false);
- EXPECT_FALSE(state.vsyncCallbackNeeded());
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
-
- // Case 4: needsCommit=true updateMoreResourcesPending=true.
- state.setNeedsCommit(true);
- state.setUpdateMoreResourcesPending(true);
- if (visible)
- EXPECT_TRUE(state.vsyncCallbackNeeded());
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
}
}
@@ -189,7 +372,8 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync)
for (unsigned j = 0; j < 2; ++j) {
StateMachine state;
state.setCommitState(allCommitStates[i]);
- if (!j) {
+ bool forcedDraw = j;
+ if (!forcedDraw) {
state.didEnterVSync();
state.setNeedsRedraw(true);
state.setVisible(true);
@@ -198,7 +382,7 @@ TEST(CCSchedulerStateMachineTest, TestNextActionDrawsOnVSync)
CCSchedulerStateMachine::Action expectedAction;
if (allCommitStates[i] != CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT)
- expectedAction = CCSchedulerStateMachine::ACTION_DRAW;
+ expectedAction = forcedDraw ? CCSchedulerStateMachine::ACTION_DRAW_FORCED : CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE;
else
expectedAction = CCSchedulerStateMachine::ACTION_COMMIT;
@@ -246,22 +430,22 @@ TEST(CCSchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible)
// Case 1: needsCommit=false updateMoreResourcesPending=false.
state.setNeedsCommit(false);
state.setUpdateMoreResourcesPending(false);
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
// Case 2: needsCommit=false updateMoreResourcesPending=true.
state.setNeedsCommit(false);
state.setUpdateMoreResourcesPending(true);
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
// Case 3: needsCommit=true updateMoreResourcesPending=false.
state.setNeedsCommit(true);
state.setUpdateMoreResourcesPending(false);
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
// Case 4: needsCommit=true updateMoreResourcesPending=true.
state.setNeedsCommit(true);
state.setUpdateMoreResourcesPending(true);
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
}
}
}
@@ -281,7 +465,7 @@ TEST(CCSchedulerStateMachineTest, TestCanRedraw_StopsDraw)
state.didEnterVSync();
state.setCanDraw(false);
- EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_NE(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
}
}
}
@@ -290,6 +474,7 @@ TEST(CCSchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgr
{
StateMachine state;
state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
+ state.setCanBeginFrame(true);
state.setNeedsCommit(true);
state.setNeedsRedraw(true);
state.setUpdateMoreResourcesPending(false);
@@ -368,6 +553,20 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_NoRedraw_TwoRoundsOfUpdates)
EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
}
+
+TEST(CCSchedulerStateMachineTest, TestVSyncNeededWhenUpdatesPendingButInvisible)
+{
+ StateMachine state;
+ state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES);
+ state.setNeedsRedraw(false);
+ state.setVisible(false);
+ state.setUpdateMoreResourcesPending(true);
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+
+ state.setUpdateMoreResourcesPending(false);
+ EXPECT_TRUE(state.vsyncCallbackNeeded());
+}
+
TEST(CCSchedulerStateMachineTest, TestUpdates_WithRedraw_OneRoundOfUpdates)
{
StateMachine state;
@@ -382,8 +581,9 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_WithRedraw_OneRoundOfUpdates)
// Ensure we draw on the next vsync even though an update is in-progress.
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ state.didDrawIfPossibleCompleted(true);
// Ensure that we once we have drawn, we dont do anything else.
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
@@ -418,6 +618,7 @@ TEST(CCSchedulerStateMachineTest, TestUpdates_WithRedraw_OneRoundOfUpdates)
TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setNeedsCommit(true);
state.setVisible(true);
@@ -447,9 +648,10 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost)
// Commit and make sure we draw on next vsync
state.updateState(CCSchedulerStateMachine::ACTION_COMMIT);
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ state.didDrawIfPossibleCompleted(true);
// Verify that another commit will begin.
state.didLeaveVSync();
@@ -459,6 +661,7 @@ TEST(CCSchedulerStateMachineTest, TestSetNeedsCommitIsNotLost)
TEST(CCSchedulerStateMachineTest, TestFullCycle)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -492,8 +695,9 @@ TEST(CCSchedulerStateMachineTest, TestFullCycle)
// At vsync, draw.
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ state.didDrawIfPossibleCompleted(true);
state.didLeaveVSync();
// Should be synchronized, no draw needed, no action needed.
@@ -505,6 +709,7 @@ TEST(CCSchedulerStateMachineTest, TestFullCycle)
TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -542,8 +747,9 @@ TEST(CCSchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween)
// At vsync, draw.
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
- state.updateState(CCSchedulerStateMachine::ACTION_DRAW);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
+ state.updateState(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE);
+ state.didDrawIfPossibleCompleted(true);
state.didLeaveVSync();
// Should be synchronized, no draw needed, no action needed.
@@ -562,6 +768,7 @@ TEST(CCSchedulerStateMachineTest, TestRequestCommitInvisible)
TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Start clean and set commit.
@@ -607,6 +814,7 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit)
TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.didLoseContext();
@@ -628,6 +836,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle)
TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
state.didLoseContext();
@@ -653,7 +862,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhile
// setCanDraw.
state.setNeedsRedraw(true);
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
state.setCanDraw(false);
EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
state.setCanDraw(true);
@@ -663,6 +872,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhile
TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Get a commit in flight.
@@ -673,7 +883,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
// Set damage and expect a draw.
state.setNeedsRedraw(true);
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
state.updateState(state.nextAction());
state.didLeaveVSync();
@@ -703,6 +913,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgress)
TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested)
{
StateMachine state;
+ state.setCanBeginFrame(true);
state.setVisible(true);
// Get a commit in flight.
@@ -713,7 +924,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother
// Set damage and expect a draw.
state.setNeedsRedraw(true);
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
state.updateState(state.nextAction());
state.didLeaveVSync();
@@ -739,7 +950,7 @@ TEST(CCSchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnother
EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, state.nextAction());
state.updateState(state.nextAction());
// Expect to be told to begin context recreation, independent of vsync state
@@ -761,7 +972,7 @@ TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost)
// Ask a forced redraw and verify it ocurrs.
state.setNeedsForcedRedraw(true);
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction());
state.didLeaveVSync();
// Clear the forced redraw bit.
@@ -774,8 +985,60 @@ TEST(CCSchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost)
// Ask a forced redraw and verify it ocurrs.
state.setNeedsForcedRedraw(true);
state.didEnterVSync();
- EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW, state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_DRAW_FORCED, state.nextAction());
state.didLeaveVSync();
}
+TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit)
+{
+ StateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(false);
+ state.setNeedsCommit(true);
+ state.setNeedsForcedCommit(true);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCommit)
+{
+ StateMachine state;
+ state.setVisible(true);
+ state.setNeedsCommit(true);
+ state.setNeedsForcedCommit(true);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress)
+{
+ StateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(false);
+ state.setCommitState(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS);
+ state.setNeedsCommit(true);
+ state.setNeedsForcedCommit(true);
+
+ state.beginFrameComplete();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction());
+ state.updateState(state.nextAction());
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+ state.beginUpdateMoreResourcesComplete(false);
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
+ state.updateState(state.nextAction());
+
+ EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState());
+
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+}
+
+TEST(CCSchedulerStateMachineTest, TestBeginFrameWhenContextLost)
+{
+ StateMachine state;
+ state.setCanBeginFrame(true);
+ state.setVisible(true);
+ state.setNeedsCommit(true);
+ state.setNeedsForcedCommit(true);
+ state.didLoseContext();
+ EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction());
+}
+
}
diff --git a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp
index 45f61b90b..41250884b 100644
--- a/Source/WebKit/chromium/tests/CCSchedulerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCSchedulerTest.cpp
@@ -45,25 +45,56 @@ public:
m_actions.clear();
m_hasMoreResourceUpdates = false;
m_canDraw = true;
+ m_drawWillHappen = true;
+ m_swapWillHappenIfDrawHappens = true;
+ m_numDraws = 0;
}
void setHasMoreResourceUpdates(bool b) { m_hasMoreResourceUpdates = b; }
void setCanDraw(bool b) { m_canDraw = b; }
+ int numDraws() const { return m_numDraws; }
int numActions() const { return static_cast<int>(m_actions.size()); }
const char* action(int i) const { return m_actions[i]; }
- virtual bool canDraw() { return m_canDraw; }
- virtual bool hasMoreResourceUpdates() const { return m_hasMoreResourceUpdates; }
- virtual void scheduledActionBeginFrame() { m_actions.push_back("scheduledActionBeginFrame"); }
- virtual void scheduledActionDrawAndSwap() { m_actions.push_back("scheduledActionDrawAndSwap"); }
- virtual void scheduledActionUpdateMoreResources() { m_actions.push_back("scheduledActionUpdateMoreResources"); }
- virtual void scheduledActionCommit() { m_actions.push_back("scheduledActionCommit"); }
- virtual void scheduledActionBeginContextRecreation() { m_actions.push_back("scheduledActionBeginContextRecreation"); }
+ bool hasAction(const char* action) const
+ {
+ for (size_t i = 0; i < m_actions.size(); i++)
+ if (!strcmp(m_actions[i], action))
+ return true;
+ return false;
+ }
+
+ virtual bool canDraw() OVERRIDE { return m_canDraw; }
+ virtual bool hasMoreResourceUpdates() const OVERRIDE { return m_hasMoreResourceUpdates; }
+ virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); }
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE
+ {
+ m_actions.push_back("scheduledActionDrawAndSwapIfPossible");
+ m_numDraws++;
+ return CCScheduledActionDrawAndSwapResult(m_drawWillHappen, m_drawWillHappen && m_swapWillHappenIfDrawHappens);
+ }
+
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
+ {
+ m_actions.push_back("scheduledActionDrawAndSwapForced");
+ return CCScheduledActionDrawAndSwapResult(true, m_swapWillHappenIfDrawHappens);
+ }
+
+ virtual void scheduledActionUpdateMoreResources() OVERRIDE { m_actions.push_back("scheduledActionUpdateMoreResources"); }
+ virtual void scheduledActionCommit() OVERRIDE { m_actions.push_back("scheduledActionCommit"); }
+ virtual void scheduledActionBeginContextRecreation() OVERRIDE { m_actions.push_back("scheduledActionBeginContextRecreation"); }
+ virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { m_actions.push_back("scheduledActionAcquireLayerTexturesForMainThread"); }
+
+ void setDrawWillHappen(bool drawWillHappen) { m_drawWillHappen = drawWillHappen; }
+ void setSwapWillHappenIfDrawHappens(bool swapWillHappenIfDrawHappens) { m_swapWillHappenIfDrawHappens = swapWillHappenIfDrawHappens; }
protected:
bool m_hasMoreResourceUpdates;
bool m_canDraw;
+ bool m_drawWillHappen;
+ bool m_swapWillHappenIfDrawHappens;
+ int m_numDraws;
std::vector<const char*> m_actions;
};
@@ -72,6 +103,7 @@ TEST(CCSchedulerTest, RequestCommit)
FakeCCSchedulerClient client;
RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ scheduler->setCanBeginFrame(true);
scheduler->setVisible(true);
// SetNeedsCommit should begin the frame.
@@ -94,7 +126,7 @@ TEST(CCSchedulerTest, RequestCommit)
// Tick should draw.
timeSource->tick();
EXPECT_EQ(1, client.numActions());
- EXPECT_STREQ("scheduledActionDrawAndSwap", client.action(0));
+ EXPECT_STREQ("scheduledActionDrawAndSwapIfPossible", client.action(0));
EXPECT_FALSE(timeSource->active());
client.reset();
@@ -107,6 +139,7 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame)
FakeCCSchedulerClient client;
RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ scheduler->setCanBeginFrame(true);
scheduler->setVisible(true);
// SetNedsCommit should begin the frame.
@@ -131,38 +164,104 @@ TEST(CCSchedulerTest, RequestCommitAfterBeginFrame)
timeSource->tick();
EXPECT_FALSE(timeSource->active());
EXPECT_EQ(2, client.numActions());
- EXPECT_STREQ("scheduledActionDrawAndSwap", client.action(0));
+ EXPECT_STREQ("scheduledActionDrawAndSwapIfPossible", client.action(0));
EXPECT_STREQ("scheduledActionBeginFrame", client.action(1));
client.reset();
}
-class SchedulerClientThatSetNeedsDrawInsideDraw : public CCSchedulerClient {
+TEST(CCSchedulerTest, TextureAcquisitionCollision)
+{
+ FakeCCSchedulerClient client;
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ scheduler->setCanBeginFrame(true);
+ scheduler->setVisible(true);
+
+ scheduler->setNeedsCommit();
+ scheduler->setMainThreadNeedsLayerTextures();
+ EXPECT_EQ(2, client.numActions());
+ EXPECT_STREQ("scheduledActionBeginFrame", client.action(0));
+ EXPECT_STREQ("scheduledActionAcquireLayerTexturesForMainThread", client.action(1));
+ client.reset();
+
+ // Compositor not scheduled to draw because textures are locked by main thread
+ EXPECT_FALSE(timeSource->active());
+
+ // Trigger the commit
+ scheduler->beginFrameComplete();
+ EXPECT_TRUE(timeSource->active());
+ client.reset();
+
+ // Between commit and draw, texture acquisition for main thread delayed,
+ // and main thread blocks.
+ scheduler->setMainThreadNeedsLayerTextures();
+ EXPECT_EQ(0, client.numActions());
+ client.reset();
+
+ // Once compositor draw complete, the delayed texture acquisition fires.
+ timeSource->tick();
+ EXPECT_EQ(3, client.numActions());
+ EXPECT_STREQ("scheduledActionDrawAndSwapIfPossible", client.action(0));
+ EXPECT_STREQ("scheduledActionAcquireLayerTexturesForMainThread", client.action(1));
+ EXPECT_STREQ("scheduledActionBeginFrame", client.action(2));
+ client.reset();
+}
+
+TEST(CCSchedulerTest, VisibilitySwitchWithTextureAcquisition)
+{
+ FakeCCSchedulerClient client;
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ scheduler->setCanBeginFrame(true);
+ scheduler->setVisible(true);
+
+ scheduler->setNeedsCommit();
+ scheduler->beginFrameComplete();
+ scheduler->setMainThreadNeedsLayerTextures();
+ client.reset();
+ // Verify that pending texture acquisition fires when visibility
+ // is lost in order to avoid a deadlock.
+ scheduler->setVisible(false);
+ EXPECT_EQ(1, client.numActions());
+ EXPECT_STREQ("scheduledActionAcquireLayerTexturesForMainThread", client.action(0));
+ client.reset();
+
+ // Regaining visibility with textures acquired by main thread while
+ // compositor is waiting for first draw should result in a request
+ // for a new frame in order to escape a deadlock.
+ scheduler->setVisible(true);
+ EXPECT_EQ(1, client.numActions());
+ EXPECT_STREQ("scheduledActionBeginFrame", client.action(0));
+ client.reset();
+}
+
+class SchedulerClientThatSetNeedsDrawInsideDraw : public FakeCCSchedulerClient {
public:
SchedulerClientThatSetNeedsDrawInsideDraw()
- : m_numDraws(0)
- , m_scheduler(0) { }
+ : m_scheduler(0) { }
void setScheduler(CCScheduler* scheduler) { m_scheduler = scheduler; }
- int numDraws() const { return m_numDraws; }
-
- virtual bool hasMoreResourceUpdates() const { return false; }
- virtual bool canDraw() { return true; }
- virtual void scheduledActionBeginFrame() { }
- virtual void scheduledActionDrawAndSwap()
+ virtual void scheduledActionBeginFrame() OVERRIDE { }
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE
{
// Only setNeedsRedraw the first time this is called
if (!m_numDraws)
m_scheduler->setNeedsRedraw();
- m_numDraws++;
+ return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible();
}
- virtual void scheduledActionUpdateMoreResources() { }
- virtual void scheduledActionCommit() { }
- virtual void scheduledActionBeginContextRecreation() { }
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
+ {
+ ASSERT_NOT_REACHED();
+ return CCScheduledActionDrawAndSwapResult(true, true);
+ }
+
+ virtual void scheduledActionUpdateMoreResources() OVERRIDE { }
+ virtual void scheduledActionCommit() OVERRIDE { }
+ virtual void scheduledActionBeginContextRecreation() OVERRIDE { }
protected:
- int m_numDraws;
CCScheduler* m_scheduler;
};
@@ -176,6 +275,7 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw)
RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
client.setScheduler(scheduler.get());
+ scheduler->setCanBeginFrame(true);
scheduler->setVisible(true);
scheduler->setNeedsRedraw();
@@ -194,33 +294,74 @@ TEST(CCSchedulerTest, RequestRedrawInsideDraw)
EXPECT_FALSE(timeSource->active());
}
-class SchedulerClientThatSetNeedsCommitInsideDraw : public CCSchedulerClient {
+// Test that requesting redraw inside a failed draw doesn't lose the request.
+TEST(CCSchedulerTest, RequestRedrawInsideFailedDraw)
+{
+ SchedulerClientThatSetNeedsDrawInsideDraw client;
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ client.setScheduler(scheduler.get());
+ scheduler->setCanBeginFrame(true);
+ scheduler->setVisible(true);
+ client.setDrawWillHappen(false);
+
+ scheduler->setNeedsRedraw();
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+ EXPECT_EQ(0, client.numDraws());
+
+ // Fail the draw.
+ timeSource->tick();
+ EXPECT_EQ(1, client.numDraws());
+
+ // We have a commit pending and the draw failed, and we didn't lose the redraw request.
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+
+ // Fail the draw again.
+ timeSource->tick();
+ EXPECT_EQ(2, client.numDraws());
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+
+ // Draw successfully.
+ client.setDrawWillHappen(true);
+ timeSource->tick();
+ EXPECT_EQ(3, client.numDraws());
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_FALSE(scheduler->redrawPending());
+ EXPECT_FALSE(timeSource->active());
+}
+
+class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeCCSchedulerClient {
public:
SchedulerClientThatSetNeedsCommitInsideDraw()
- : m_numDraws(0)
- , m_scheduler(0) { }
+ : m_scheduler(0) { }
void setScheduler(CCScheduler* scheduler) { m_scheduler = scheduler; }
- int numDraws() const { return m_numDraws; }
-
- virtual bool hasMoreResourceUpdates() const { return false; }
- virtual bool canDraw() { return true; }
- virtual void scheduledActionBeginFrame() { }
- virtual void scheduledActionDrawAndSwap()
+ virtual void scheduledActionBeginFrame() OVERRIDE { }
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE
{
// Only setNeedsCommit the first time this is called
if (!m_numDraws)
m_scheduler->setNeedsCommit();
- m_numDraws++;
+ return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible();
+ }
+
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
+ {
+ ASSERT_NOT_REACHED();
+ return CCScheduledActionDrawAndSwapResult(true, true);
}
- virtual void scheduledActionUpdateMoreResources() { }
- virtual void scheduledActionCommit() { }
- virtual void scheduledActionBeginContextRecreation() { }
+ virtual void scheduledActionUpdateMoreResources() OVERRIDE { }
+ virtual void scheduledActionCommit() OVERRIDE { }
+ virtual void scheduledActionBeginContextRecreation() OVERRIDE { }
protected:
- int m_numDraws;
CCScheduler* m_scheduler;
};
@@ -232,6 +373,7 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw)
RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
client.setScheduler(scheduler.get());
+ scheduler->setCanBeginFrame(true);
scheduler->setVisible(true);
scheduler->setNeedsRedraw();
@@ -251,4 +393,104 @@ TEST(CCSchedulerTest, RequestCommitInsideDraw)
EXPECT_FALSE(scheduler->redrawPending());
}
+// Tests that when a draw fails then the pending commit should not be dropped.
+TEST(CCSchedulerTest, RequestCommitInsideFailedDraw)
+{
+ SchedulerClientThatSetNeedsDrawInsideDraw client;
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, adoptPtr(new CCFrameRateController(timeSource)));
+ client.setScheduler(scheduler.get());
+ scheduler->setCanBeginFrame(true);
+ scheduler->setVisible(true);
+ client.setDrawWillHappen(false);
+
+ scheduler->setNeedsRedraw();
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+ EXPECT_EQ(0, client.numDraws());
+
+ // Fail the draw.
+ timeSource->tick();
+ EXPECT_EQ(1, client.numDraws());
+
+ // We have a commit pending and the draw failed, and we didn't lose the commit request.
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+
+ // Fail the draw again.
+ timeSource->tick();
+ EXPECT_EQ(2, client.numDraws());
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+
+ // Draw successfully.
+ client.setDrawWillHappen(true);
+ timeSource->tick();
+ EXPECT_EQ(3, client.numDraws());
+ EXPECT_TRUE(scheduler->commitPending());
+ EXPECT_FALSE(scheduler->redrawPending());
+ EXPECT_FALSE(timeSource->active());
+}
+
+TEST(CCSchedulerTest, NoBeginFrameWhenDrawFails)
+{
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ SchedulerClientThatSetNeedsCommitInsideDraw client;
+ OwnPtr<FakeCCFrameRateController> controller = adoptPtr(new FakeCCFrameRateController(timeSource));
+ FakeCCFrameRateController* controllerPtr = controller.get();
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, controller.release());
+ client.setScheduler(scheduler.get());
+ scheduler->setCanBeginFrame(true);
+ scheduler->setVisible(true);
+
+ EXPECT_EQ(0, controllerPtr->numFramesPending());
+
+ scheduler->setNeedsRedraw();
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+ EXPECT_EQ(0, client.numDraws());
+
+ // Draw successfully, this starts a new frame.
+ timeSource->tick();
+ EXPECT_EQ(1, client.numDraws());
+ EXPECT_EQ(1, controllerPtr->numFramesPending());
+ scheduler->didSwapBuffersComplete();
+ EXPECT_EQ(0, controllerPtr->numFramesPending());
+
+ scheduler->setNeedsRedraw();
+ EXPECT_TRUE(scheduler->redrawPending());
+ EXPECT_TRUE(timeSource->active());
+
+ // Fail to draw, this should not start a frame.
+ client.setDrawWillHappen(false);
+ timeSource->tick();
+ EXPECT_EQ(2, client.numDraws());
+ EXPECT_EQ(0, controllerPtr->numFramesPending());
+}
+
+TEST(CCSchedulerTest, NoBeginFrameWhenSwapFailsDuringForcedCommit)
+{
+ RefPtr<FakeCCTimeSource> timeSource = adoptRef(new FakeCCTimeSource());
+ FakeCCSchedulerClient client;
+ OwnPtr<FakeCCFrameRateController> controller = adoptPtr(new FakeCCFrameRateController(timeSource));
+ FakeCCFrameRateController* controllerPtr = controller.get();
+ OwnPtr<CCScheduler> scheduler = CCScheduler::create(&client, controller.release());
+
+ EXPECT_EQ(0, controllerPtr->numFramesPending());
+
+ // Tell the client that it will fail to swap.
+ client.setDrawWillHappen(true);
+ client.setSwapWillHappenIfDrawHappens(false);
+
+ // Get the compositor to do a scheduledActionDrawAndSwapForced.
+ scheduler->setNeedsRedraw();
+ scheduler->setNeedsForcedRedraw();
+ EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced"));
+
+ // We should not have told the frame rate controller that we began a frame.
+ EXPECT_EQ(0, controllerPtr->numFramesPending());
+}
+
}
diff --git a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h
index 9b5e0383e..6257ec888 100644
--- a/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h
+++ b/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h
@@ -26,6 +26,7 @@
#define CCSchedulerTestCommon_h
#include "cc/CCDelayBasedTimeSource.h"
+#include "cc/CCFrameRateController.h"
#include "cc/CCThread.h"
#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
@@ -38,7 +39,7 @@ public:
void reset() { m_tickCalled = false; }
bool tickCalled() const { return m_tickCalled; }
- virtual void onTimerTick() { m_tickCalled = true; }
+ virtual void onTimerTick() OVERRIDE { m_tickCalled = true; }
protected:
bool m_tickCalled;
@@ -61,7 +62,7 @@ public:
task->performTask();
}
- long long pendingDelay() const
+ long long pendingDelayMs() const
{
EXPECT_TRUE(hasPendingTask());
return m_pendingTaskDelay;
@@ -89,9 +90,9 @@ public:
virtual ~FakeCCTimeSource() { }
- virtual void setClient(WebCore::CCTimeSourceClient* client) { m_client = client; }
- virtual void setActive(bool b) { m_active = b; }
- virtual bool active() const { return m_active; }
+ virtual void setClient(WebCore::CCTimeSourceClient* client) OVERRIDE { m_client = client; }
+ virtual void setActive(bool b) OVERRIDE { m_active = b; }
+ virtual bool active() const OVERRIDE { return m_active; }
void tick()
{
@@ -107,20 +108,27 @@ protected:
class FakeCCDelayBasedTimeSource : public WebCore::CCDelayBasedTimeSource {
public:
- static PassRefPtr<FakeCCDelayBasedTimeSource> create(double intervalMs, WebCore::CCThread* thread)
+ static PassRefPtr<FakeCCDelayBasedTimeSource> create(double interval, WebCore::CCThread* thread)
{
- return adoptRef(new FakeCCDelayBasedTimeSource(intervalMs, thread));
+ return adoptRef(new FakeCCDelayBasedTimeSource(interval, thread));
}
- void setMonotonicallyIncreasingTimeMs(double time) { m_monotonicallyIncreasingTimeMs = time; }
- virtual double monotonicallyIncreasingTimeMs() const { return m_monotonicallyIncreasingTimeMs; }
+ void setMonotonicallyIncreasingTime(double time) { m_monotonicallyIncreasingTime = time; }
+ virtual double monotonicallyIncreasingTime() const { return m_monotonicallyIncreasingTime; }
protected:
- FakeCCDelayBasedTimeSource(double intervalMs, WebCore::CCThread* thread)
- : CCDelayBasedTimeSource(intervalMs, thread)
- , m_monotonicallyIncreasingTimeMs(0) { }
+ FakeCCDelayBasedTimeSource(double interval, WebCore::CCThread* thread)
+ : CCDelayBasedTimeSource(interval, thread)
+ , m_monotonicallyIncreasingTime(0) { }
- double m_monotonicallyIncreasingTimeMs;
+ double m_monotonicallyIncreasingTime;
+};
+
+class FakeCCFrameRateController : public WebCore::CCFrameRateController {
+public:
+ FakeCCFrameRateController(PassRefPtr<WebCore::CCTimeSource> timer) : WebCore::CCFrameRateController(timer) { }
+
+ int numFramesPending() const { return m_numFramesPending; }
};
}
diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp
index 02dc908ab..6b7124975 100644
--- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp
@@ -27,6 +27,7 @@
#include "cc/CCSolidColorLayerImpl.h"
#include "CCLayerTestCommon.h"
+#include "MockCCQuadCuller.h"
#include "cc/CCSingleThreadProxy.h"
#include "cc/CCSolidColorDrawQuad.h"
@@ -42,7 +43,7 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
{
DebugScopedSetImplThread scopedImplThread;
- CCQuadList quadList;
+ MockCCQuadCuller quadCuller;
IntSize layerSize = IntSize(800, 600);
IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
@@ -51,9 +52,10 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
layer->setBounds(layerSize);
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quadList, sharedQuadState.get());
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
- verifyQuadsExactlyCoverRect(quadList, visibleLayerRect);
+ verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleLayerRect);
}
TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
@@ -62,7 +64,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
const Color testColor = 0xFFA55AFF;
- CCQuadList quadList;
+ MockCCQuadCuller quadCuller;
IntSize layerSize = IntSize(100, 100);
IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
@@ -72,10 +74,34 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
layer->setBackgroundColor(testColor);
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quadList, sharedQuadState.get());
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
- ASSERT_EQ(quadList.size(), 1U);
- EXPECT_EQ(quadList[0]->toSolidColorDrawQuad()->color(), testColor);
+ ASSERT_EQ(quadCuller.quadList().size(), 1U);
+ EXPECT_EQ(quadCuller.quadList()[0]->toSolidColorDrawQuad()->color(), testColor);
+}
+
+TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad)
+{
+ DebugScopedSetImplThread scopedImplThread;
+
+ const float opacity = 0.5f;
+
+ MockCCQuadCuller quadCuller;
+ IntSize layerSize = IntSize(100, 100);
+ IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
+
+ OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
+ layer->setVisibleLayerRect(visibleLayerRect);
+ layer->setBounds(layerSize);
+ layer->setDrawOpacity(opacity);
+
+ OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+
+ ASSERT_EQ(quadCuller.quadList().size(), 1U);
+ EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity());
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp
index ff7daa3c9..48a46dae1 100644
--- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp
@@ -27,6 +27,7 @@
#include "cc/CCTiledLayerImpl.h"
#include "CCLayerTestCommon.h"
+#include "MockCCQuadCuller.h"
#include "cc/CCSingleThreadProxy.h"
#include "cc/CCTileDrawQuad.h"
#include <gmock/gmock.h>
@@ -69,11 +70,12 @@ TEST(CCTiledLayerImplTest, emptyQuadList)
// Verify default layer does creates quads
{
OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
- CCQuadList quads;
+ MockCCQuadCuller quadCuller;
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quads, sharedQuadState.get());
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
const unsigned numTiles = numTilesX * numTilesY;
- EXPECT_EQ(quads.size(), numTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), numTiles);
}
// Layer with empty visible layer rect produces no quads
@@ -81,10 +83,11 @@ TEST(CCTiledLayerImplTest, emptyQuadList)
OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
layer->setVisibleLayerRect(IntRect());
- CCQuadList quads;
+ MockCCQuadCuller quadCuller;
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), 0u);
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), 0u);
}
// Layer with non-intersecting visible layer rect produces no quads
@@ -94,10 +97,11 @@ TEST(CCTiledLayerImplTest, emptyQuadList)
IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50));
layer->setVisibleLayerRect(outsideBounds);
- CCQuadList quads;
+ MockCCQuadCuller quadCuller;
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), 0u);
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), 0u);
}
// Layer with skips draw produces no quads
@@ -105,10 +109,11 @@ TEST(CCTiledLayerImplTest, emptyQuadList)
OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
layer->setSkipsDraw(true);
- CCQuadList quads;
+ MockCCQuadCuller quadCuller;
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), 0u);
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), 0u);
}
}
@@ -126,12 +131,14 @@ TEST(CCTiledLayerImplTest, checkerboarding)
// No checkerboarding
{
- CCQuadList quads;
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), 4u);
-
- for (size_t i = 0; i < quads.size(); ++i)
- EXPECT_EQ(quads[i]->material(), CCDrawQuad::TiledContent);
+ MockCCQuadCuller quadCuller;
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), 4u);
+ EXPECT_FALSE(hadMissingTiles);
+
+ for (size_t i = 0; i < quadCuller.quadList().size(); ++i)
+ EXPECT_EQ(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent);
}
for (int i = 0; i < numTilesX; ++i)
@@ -140,11 +147,13 @@ TEST(CCTiledLayerImplTest, checkerboarding)
// All checkerboarding
{
- CCQuadList quads;
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), 4u);
- for (size_t i = 0; i < quads.size(); ++i)
- EXPECT_EQ(quads[i]->material(), CCDrawQuad::SolidColor);
+ MockCCQuadCuller quadCuller;
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+ EXPECT_TRUE(hadMissingTiles);
+ EXPECT_EQ(quadCuller.quadList().size(), 4u);
+ for (size_t i = 0; i < quadCuller.quadList().size(); ++i)
+ EXPECT_NE(quadCuller.quadList()[i]->material(), CCDrawQuad::TiledContent);
}
}
@@ -154,8 +163,10 @@ static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSiz
layer->setVisibleLayerRect(visibleLayerRect);
layer->setBounds(layerSize);
+ MockCCQuadCuller quadCuller(quads);
OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- layer->appendQuads(quads, sharedQuadState.get());
+ bool hadMissingTiles = false;
+ layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
return sharedQuadState.release(); // The shared data must be owned as long as the quad list exists.
}
@@ -251,73 +262,4 @@ TEST(CCTiledLayerImplTest, tileOpaqueRectForLayerNoBorders)
}
}
-TEST(CCTiledLayerImplTest, backgroundCoversViewport)
-{
- DebugScopedSetImplThread scopedImplThread;
-
- const IntSize tileSize(10, 10);
- const int numTilesX = 2;
- const int numTilesY = 2;
- const unsigned numTiles = numTilesX * numTilesY;
- const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
- OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels);
- layer->setBackgroundColor(Color::gray);
- layer->setBackgroundCoversViewport(true);
-
- // No gutter rects
- {
- IntRect clipRect = IntRect(IntPoint(), layerSize);
- layer->setClipRect(clipRect);
- layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize));
-
- OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
-
- CCQuadList quads;
- layer->appendQuads(quads, sharedQuadState.get());
- EXPECT_EQ(quads.size(), numTiles);
-
- for (size_t i = 0; i < quads.size(); ++i)
- EXPECT_EQ(quads[i]->material(), CCDrawQuad::TiledContent);
- }
-
- // Empty visible content area (fullscreen gutter rect)
- {
- IntRect clipRect = IntRect(100, 100, 100, 100);
- layer->setClipRect(clipRect);
- layer->setVisibleLayerRect(IntRect());
-
- OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- CCQuadList quads;
- layer->appendQuads(quads, sharedQuadState.get());
-
- for (size_t i = 0; i < quads.size(); ++i)
- EXPECT_EQ(quads[i]->material(), CCDrawQuad::SolidColor);
-
- verifyQuadsExactlyCoverRect(quads, clipRect);
- }
-
- // Content area in middle of clip rect (four surrounding gutter rects)
- {
- IntRect clipRect = IntRect(-50, -50, 100, 100);
- layer->setClipRect(clipRect);
- layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize));
-
- OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
- CCQuadList quads;
- layer->appendQuads(quads, sharedQuadState.get());
-
- unsigned numContentTiles = 0, numGutterTiles = 0;
- for (size_t i = 0; i < quads.size(); ++i) {
- if (quads[i]->material() == CCDrawQuad::TiledContent)
- numContentTiles++;
- else if (quads[i]->material() == CCDrawQuad::SolidColor)
- numGutterTiles++;
- }
- EXPECT_EQ(numContentTiles, numTiles);
- EXPECT_GE(numGutterTiles, 4u);
-
- verifyQuadsExactlyCoverRect(quads, clipRect);
- }
-}
-
} // namespace
diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
new file mode 100644
index 000000000..46d11a96e
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "CCTiledLayerTestCommon.h"
+
+using namespace WebCore;
+
+namespace WebKitTests {
+
+FakeLayerTextureUpdater::Texture::Texture(FakeLayerTextureUpdater* layer, PassOwnPtr<ManagedTexture> texture)
+ : LayerTextureUpdater::Texture(texture)
+ , m_layer(layer)
+{
+}
+
+FakeLayerTextureUpdater::Texture::~Texture()
+{
+}
+
+void FakeLayerTextureUpdater::Texture::updateRect(GraphicsContext3D*, TextureAllocator* allocator, const IntRect&, const IntRect&)
+{
+ if (allocator)
+ texture()->allocate(allocator);
+ m_layer->updateRect();
+}
+
+void FakeLayerTextureUpdater::Texture::prepareRect(const IntRect&)
+{
+ m_layer->prepareRect();
+}
+
+FakeLayerTextureUpdater::FakeLayerTextureUpdater()
+ : m_prepareCount(0)
+ , m_updateCount(0)
+ , m_prepareRectCount(0)
+{
+}
+
+FakeLayerTextureUpdater::~FakeLayerTextureUpdater()
+{
+}
+
+void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect& resultingOpaqueRect)
+{
+ m_prepareCount++;
+ m_lastUpdateRect = contentRect;
+ if (!m_rectToInvalidate.isEmpty()) {
+ m_layer->invalidateRect(m_rectToInvalidate);
+ m_rectToInvalidate = IntRect();
+ m_layer = 0;
+ }
+ resultingOpaqueRect = m_opaquePaintRect;
+}
+
+void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer)
+{
+ m_rectToInvalidate = rect;
+ m_layer = layer;
+}
+
+PassOwnPtr<LayerTextureUpdater::Texture> FakeLayerTextureUpdater::createTexture(TextureManager* manager)
+{
+ return adoptPtr(new Texture(this, ManagedTexture::create(manager)));
+}
+
+FakeCCTiledLayerImpl::FakeCCTiledLayerImpl(int id)
+ : CCTiledLayerImpl(id)
+{
+}
+
+FakeCCTiledLayerImpl::~FakeCCTiledLayerImpl()
+{
+}
+
+FakeTiledLayerChromium::FakeTiledLayerChromium(TextureManager* textureManager)
+ : TiledLayerChromium()
+ , m_fakeTextureUpdater(adoptRef(new FakeLayerTextureUpdater))
+ , m_textureManager(textureManager)
+{
+ setTileSize(tileSize());
+ setTextureFormat(GraphicsContext3D::RGBA);
+ setBorderTexelOption(CCLayerTilingData::NoBorderTexels);
+ setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons.
+}
+
+FakeTiledLayerChromium::~FakeTiledLayerChromium()
+{
+}
+
+void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect)
+{
+ m_lastNeedsDisplayRect = rect;
+ TiledLayerChromium::setNeedsDisplayRect(rect);
+}
+
+void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion)
+{
+ updateLayerRect(updater, visibleLayerRect(), occlusion);
+}
+
+FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(TextureManager* textureManager)
+ : FakeTiledLayerChromium(textureManager)
+{
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
new file mode 100644
index 000000000..c028ea725
--- /dev/null
+++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
@@ -0,0 +1,168 @@
+/*
+ * 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 CCTiledLayerTestCommon_h
+#define CCTiledLayerTestCommon_h
+
+#include "GraphicsContext3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include "LayerTextureUpdater.h"
+#include "Region.h"
+#include "TextureCopier.h"
+#include "TextureManager.h"
+#include "TextureUploader.h"
+#include "TiledLayerChromium.h"
+#include "cc/CCTextureUpdater.h"
+#include "cc/CCTiledLayerImpl.h"
+
+namespace WebKitTests {
+
+class FakeTiledLayerChromium;
+
+class FakeLayerTextureUpdater : public WebCore::LayerTextureUpdater {
+public:
+ class Texture : public WebCore::LayerTextureUpdater::Texture {
+ 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&);
+
+ private:
+ FakeLayerTextureUpdater* m_layer;
+ };
+
+ FakeLayerTextureUpdater();
+ virtual ~FakeLayerTextureUpdater();
+
+ virtual PassOwnPtr<WebCore::LayerTextureUpdater::Texture> createTexture(WebCore::TextureManager*);
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }
+
+ virtual void prepareToUpdate(const WebCore::IntRect& contentRect, const WebCore::IntSize&, int, float, WebCore::IntRect& resultingOpaqueRect);
+ // 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*);
+ // Last rect passed to prepareToUpdate().
+ const WebCore::IntRect& lastUpdateRect() const { return m_lastUpdateRect; }
+
+ // Number of times prepareToUpdate has been invoked.
+ int prepareCount() const { return m_prepareCount; }
+ void clearPrepareCount() { m_prepareCount = 0; }
+
+ // Number of times updateRect has been invoked.
+ int updateCount() const { return m_updateCount; }
+ void clearUpdateCount() { m_updateCount = 0; }
+ void updateRect() { m_updateCount++; }
+
+ // Number of times prepareRect() has been invoked on a texture.
+ int prepareRectCount() const { return m_prepareRectCount; }
+ void clearPrepareRectCount() { m_prepareRectCount = 0; }
+ void prepareRect() { m_prepareRectCount++; }
+
+ void setOpaquePaintRect(const WebCore::IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }
+
+private:
+ int m_prepareCount;
+ int m_updateCount;
+ int m_prepareRectCount;
+ WebCore::IntRect m_rectToInvalidate;
+ WebCore::IntRect m_lastUpdateRect;
+ WebCore::IntRect m_opaquePaintRect;
+ RefPtr<FakeTiledLayerChromium> m_layer;
+};
+
+class FakeCCTiledLayerImpl : public WebCore::CCTiledLayerImpl {
+public:
+ explicit FakeCCTiledLayerImpl(int id);
+ virtual ~FakeCCTiledLayerImpl();
+
+ using WebCore::CCTiledLayerImpl::hasTileAt;
+ using WebCore::CCTiledLayerImpl::hasTextureIdForTileAt;
+};
+
+class FakeTiledLayerChromium : public WebCore::TiledLayerChromium {
+public:
+ explicit FakeTiledLayerChromium(WebCore::TextureManager*);
+ virtual ~FakeTiledLayerChromium();
+
+ static WebCore::IntSize tileSize() { return WebCore::IntSize(100, 100); }
+
+ using WebCore::TiledLayerChromium::invalidateRect;
+ using WebCore::TiledLayerChromium::updateLayerRect;
+ using WebCore::TiledLayerChromium::idleUpdateLayerRect;
+ using WebCore::TiledLayerChromium::needsIdlePaint;
+ using WebCore::TiledLayerChromium::skipsDraw;
+ using WebCore::TiledLayerChromium::numPaintedTiles;
+ using WebCore::TiledLayerChromium::idlePaintRect;
+
+ virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE;
+ const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
+
+ // Updates the visibleLayerRect().
+ virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE;
+
+ virtual WebCore::TextureManager* textureManager() const OVERRIDE { return m_textureManager; }
+ FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); }
+ WebCore::FloatRect updateRect() { return m_updateRect; }
+
+private:
+ virtual WebCore::LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_fakeTextureUpdater.get(); }
+ virtual void createTextureUpdaterIfNeeded() OVERRIDE { }
+
+ RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater;
+ WebCore::TextureManager* m_textureManager;
+ WebCore::FloatRect m_lastNeedsDisplayRect;
+};
+
+class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium {
+public:
+ explicit FakeTiledLayerWithScaledBounds(WebCore::TextureManager*);
+
+ void setContentBounds(const WebCore::IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }
+ virtual WebCore::IntSize contentBounds() const OVERRIDE { return m_forcedContentBounds; }
+
+protected:
+ WebCore::IntSize m_forcedContentBounds;
+};
+
+class FakeTextureAllocator : public WebCore::TextureAllocator {
+public:
+ virtual unsigned createTexture(const WebCore::IntSize&, GC3Denum) { return 1; }
+ virtual void deleteTexture(unsigned, const WebCore::IntSize&, GC3Denum) { }
+};
+
+class FakeTextureCopier : public WebCore::TextureCopier {
+public:
+ virtual void copyTexture(WebCore::GraphicsContext3D*, unsigned, unsigned, const WebCore::IntSize&) { }
+};
+
+class FakeTextureUploader : public WebCore::TextureUploader {
+public:
+ 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); }
+};
+
+}
+#endif // CCTiledLayerTestCommon_h
diff --git a/Source/WebKit/chromium/tests/CCTimerTest.cpp b/Source/WebKit/chromium/tests/CCTimerTest.cpp
index 298b69562..398fca56e 100644
--- a/Source/WebKit/chromium/tests/CCTimerTest.cpp
+++ b/Source/WebKit/chromium/tests/CCTimerTest.cpp
@@ -54,7 +54,7 @@ protected:
TEST_F(CCTimerTest, OneShot)
{
CCTimer timer(&m_thread, this);
- timer.startOneShot(1);
+ timer.startOneShot(0.001);
m_thread.runPendingTask();
EXPECT_TRUE(m_flag);
@@ -64,7 +64,7 @@ TEST_F(CCTimerTest, OneShot)
TEST_F(CCTimerTest, StopManually)
{
CCTimer timer(&m_thread, this);
- timer.startOneShot(1);
+ timer.startOneShot(0.001);
timer.stop();
m_thread.runPendingTask();
@@ -76,7 +76,7 @@ TEST_F(CCTimerTest, StopByScope)
{
{
CCTimer timer(&m_thread, this);
- timer.startOneShot(1);
+ timer.startOneShot(0.001);
}
m_thread.runPendingTask();
diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
index 580f15791..f464dcbbc 100644
--- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
@@ -27,13 +27,19 @@
#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 "cc/CCCanvasLayerImpl.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>
@@ -48,19 +54,27 @@ using testing::Test;
namespace {
-class MockCanvasContext : public FakeWebGraphicsContext3D {
+class FakeCCLayerTreeHost : public CCLayerTreeHost {
public:
- MOCK_METHOD0(createFramebuffer, WebGLId());
- MOCK_METHOD0(createTexture, WebGLId());
+ static PassOwnPtr<FakeCCLayerTreeHost> create()
+ {
+ OwnPtr<FakeCCLayerTreeHost> host(adoptPtr(new FakeCCLayerTreeHost));
+ host->initialize();
+ return host.release();
+ }
- MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
- MOCK_METHOD5(framebufferTexture2D, void(WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint));
+private:
+ FakeCCLayerTreeHost()
+ : CCLayerTreeHost(&m_client, CCSettings())
+ {
+ }
- MOCK_METHOD2(bindTexture, void(WGC3Denum, WebGLId));
- MOCK_METHOD8(copyTexSubImage2D, void(WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei));
+ FakeCCLayerTreeHostClient m_client;
+};
- MOCK_METHOD1(deleteFramebuffer, void(WebGLId));
- MOCK_METHOD1(deleteTexture, void(WebGLId));
+class MockCanvasContext : public FakeWebGraphicsContext3D {
+public:
+ MOCK_METHOD0(flush, void(void));
};
class MockTextureAllocator : public TextureAllocator {
@@ -69,13 +83,21 @@ public:
MOCK_METHOD3(deleteTexture, void(unsigned, const IntSize&, GC3Denum));
};
-} // namespace
+class MockTextureCopier : public TextureCopier {
+public:
+ MOCK_METHOD4(copyTexture, void(GraphicsContext3D*, unsigned, unsigned, const IntSize&));
+};
+
+class MockTextureUploader : public TextureUploader {
+public:
+ MOCK_METHOD5(uploadTexture, void(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect));
+};
-namespace WebCore {
+} // namespace
class Canvas2DLayerChromiumTest : public Test {
protected:
- void fullLifecycleTest(bool threaded)
+ void fullLifecycleTest(bool threaded, bool deferred)
{
GraphicsContext3D::Attributes attrs;
@@ -86,84 +108,95 @@ protected:
MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
MockTextureAllocator allocatorMock;
- CCTextureUpdater updater(&allocatorMock);
+ MockTextureCopier copierMock;
+ MockTextureUploader uploaderMock;
+ CCTextureUpdater updater;
const IntSize size(300, 150);
- const size_t maxTextureSize = size.width() * size.height() * 4;
- OwnPtr<TextureManager> textureManager = TextureManager::create(maxTextureSize, maxTextureSize, maxTextureSize);
+ OwnPtr<WebThread> thread;
if (threaded)
- CCProxy::setImplThread(new FakeCCThread);
+ 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;
- const WebGLId fboId = 3;
{
InSequence sequence;
- // Note that the canvas backing texture is doublebuffered only when using the threaded
- // compositor.
- if (threaded) {
- // Setup Canvas2DLayerChromium (on the main thread).
- EXPECT_CALL(mainMock, createFramebuffer())
- .WillOnce(Return(fboId));
+ // 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(implMock, bindTexture(GraphicsContext3D::TEXTURE_2D, frontTextureId));
- EXPECT_CALL(implMock, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, fboId));
- EXPECT_CALL(implMock, framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, backTextureId, 0));
- EXPECT_CALL(implMock, copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, 300, 150));
- EXPECT_CALL(implMock, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
-
- // Teardown Canvas2DLayerChromium.
- EXPECT_CALL(mainMock, deleteFramebuffer(fboId));
+ 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);
+ RefPtr<Canvas2DLayerChromium> canvas = Canvas2DLayerChromium::create(mainContext.get(), size, deferred ? Deferred : NonDeferred);
canvas->setIsDrawable(true);
- canvas->setTextureManager(textureManager.get());
+ canvas->setLayerTreeHost(layerTreeHost.get());
canvas->setBounds(IntSize(600, 300));
canvas->setTextureId(backTextureId);
canvas->setNeedsDisplay();
EXPECT_TRUE(canvas->needsDisplay());
- Region occludedScreenSpace;
- canvas->paintContentsIfDirty(occludedScreenSpace);
+ canvas->update(updater, 0);
EXPECT_FALSE(canvas->needsDisplay());
{
DebugScopedSetImplThread scopedImplThread;
OwnPtr<CCLayerImpl> layerImpl = canvas->createCCLayerImpl();
- EXPECT_EQ(0u, static_cast<CCCanvasLayerImpl*>(layerImpl.get())->textureId());
+ EXPECT_EQ(0u, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
- canvas->updateCompositorResources(implContext.get(), updater);
+ updater.update(implContext.get(), &allocatorMock, &copierMock, &uploaderMock, 1);
canvas->pushPropertiesTo(layerImpl.get());
- if (threaded)
- EXPECT_EQ(frontTextureId, static_cast<CCCanvasLayerImpl*>(layerImpl.get())->textureId());
+ if (threaded && !deferred)
+ EXPECT_EQ(frontTextureId, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
else
- EXPECT_EQ(backTextureId, static_cast<CCCanvasLayerImpl*>(layerImpl.get())->textureId());
+ EXPECT_EQ(backTextureId, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
}
canvas.clear();
- textureManager->reduceMemoryToLimit(0);
- textureManager->deleteEvictedTextures(&allocatorMock);
+ layerTreeHost->contentsTextureManager()->reduceMemoryToLimit(0);
+ layerTreeHost->contentsTextureManager()->deleteEvictedTextures(&allocatorMock);
+ layerTreeHost.clear();
+ WebCompositor::shutdown();
}
};
+namespace {
+
TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleSingleThread)
{
- fullLifecycleTest(false);
+ fullLifecycleTest(false, false);
}
TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleThreaded)
{
- fullLifecycleTest(true);
+ fullLifecycleTest(true, false);
}
-} // namespace webcore
+TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleSingleThreadDeferred)
+{
+ fullLifecycleTest(false, true);
+}
+
+TEST_F(Canvas2DLayerChromiumTest, testFullLifecycleThreadedDeferred)
+{
+ fullLifecycleTest(true, true);
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/WebGLLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp
index 66ea690fa..27ef49281 100644
--- a/Source/WebKit/chromium/tests/WebGLLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/DrawingBufferChromiumTest.cpp
@@ -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
@@ -24,10 +24,10 @@
#include "config.h"
-#include "WebGLLayerChromium.h"
+#include "DrawingBuffer.h"
#include "CompositorFakeGraphicsContext3D.h"
-#include "DrawingBuffer.h"
+#include "LayerChromium.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -36,7 +36,7 @@ using namespace WebKit;
namespace {
-TEST(WebGLLayerChromiumTest, opaqueFormats)
+TEST(DrawingBufferChromiumTest, opaqueFormats)
{
RefPtr<DrawingBuffer> buffer;
@@ -50,14 +50,14 @@ TEST(WebGLLayerChromiumTest, opaqueFormats)
RefPtr<GraphicsContext3D> opaqueContext = createCompositorMockGraphicsContext3D(opaqueAttrs);
EXPECT_TRUE(opaqueContext);
- buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), false);
+ buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Alpha);
EXPECT_FALSE(buffer->platformLayer()->opaque());
- buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), true);
+ buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Alpha);
EXPECT_FALSE(buffer->platformLayer()->opaque());
- buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), false);
+ buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Opaque);
EXPECT_TRUE(buffer->platformLayer()->opaque());
- buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), true);
+ buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Opaque);
EXPECT_TRUE(buffer->platformLayer()->opaque());
}
diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
index 38876d737..513fd0cbc 100755
--- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
+++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
@@ -34,20 +34,22 @@ namespace WebCore {
class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient {
public:
- virtual void updateAnimations(double frameBeginTime) { }
- virtual void layout() { }
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { }
- virtual PassRefPtr<GraphicsContext3D> createContext()
+ virtual void willBeginFrame() OVERRIDE { }
+ virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { }
+ virtual void layout() OVERRIDE { }
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
+ virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
{
GraphicsContext3D::Attributes attrs;
return createCompositorMockGraphicsContext3D(attrs);
}
- virtual void didRecreateContext(bool success) { }
- virtual void didCommitAndDrawFrame() { }
- virtual void didCompleteSwapBuffers() { }
+ virtual void didRecreateContext(bool success) OVERRIDE { }
+ virtual void didCommit() OVERRIDE { }
+ virtual void didCommitAndDrawFrame() OVERRIDE { }
+ virtual void didCompleteSwapBuffers() OVERRIDE { }
// Used only in the single-threaded path.
- virtual void scheduleComposite() { }
+ virtual void scheduleComposite() OVERRIDE { }
};
}
diff --git a/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h b/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h
index 268dc1da3..191d05f5f 100644
--- a/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h
+++ b/Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h
@@ -63,6 +63,9 @@ public:
virtual void setVisibilityCHROMIUM(bool visible) { }
+ virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { }
+ virtual void ensureFramebufferCHROMIUM() { }
+
virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { }
virtual WebString getRequestableExtensionsCHROMIUM() { return WebString(); }
@@ -155,7 +158,7 @@ public:
}
virtual WebString getShaderInfoLog(WebGLId shader) { return WebString(); }
-
+ virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) { }
virtual WebString getShaderSource(WebGLId shader) { return WebString(); }
virtual WebString getString(WGC3Denum name) { return WebString(); }
virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) { }
@@ -255,6 +258,14 @@ public:
virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat,
WGC3Dint width, WGC3Dint height) { }
+ virtual WebGLId createQueryEXT() { return 1; }
+ virtual void deleteQueryEXT(WebGLId) { }
+ virtual GC3Dboolean isQueryEXT(WebGLId) { return true; }
+ virtual void beginQueryEXT(GC3Denum, WebGLId) { }
+ virtual void endQueryEXT(GC3Denum) { }
+ virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { }
+ virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { }
+
protected:
Attributes m_attrs;
};
diff --git a/Source/WebKit/chromium/tests/FloatQuadTest.cpp b/Source/WebKit/chromium/tests/FloatQuadTest.cpp
index 7633dcf15..6c7091ca4 100644
--- a/Source/WebKit/chromium/tests/FloatQuadTest.cpp
+++ b/Source/WebKit/chromium/tests/FloatQuadTest.cpp
@@ -50,7 +50,7 @@ TEST(FloatQuadTest, IsRectilinearTest)
rectilinearTrans[7].rotate(180);
for (int i = 0; i < numRectilinear; ++i) {
- FloatQuad quad = rectilinearTrans[i].mapQuad(FloatRect(0.01010101, 0.01010101, 100.01010101, 100.01010101));
+ FloatQuad quad = rectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f));
EXPECT_TRUE(quad.isRectilinear());
}
@@ -68,7 +68,7 @@ TEST(FloatQuadTest, IsRectilinearTest)
nonRectilinearTrans[9].skewY(0.00001);
for (int i = 0; i < numNonRectilinear; ++i) {
- FloatQuad quad = nonRectilinearTrans[i].mapQuad(FloatRect(0.01010101, 0.01010101, 100.01010101, 100.01010101));
+ FloatQuad quad = nonRectilinearTrans[i].mapQuad(FloatRect(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f));
EXPECT_FALSE(quad.isRectilinear());
}
}
diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp
index ba6666699..e406413dd 100644
--- a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp
+++ b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "FrameTestHelpers.h"
-#include "StdLibExtras.h"
+#include <wtf/StdLibExtras.h>
#include "WebFrame.h"
#include "WebFrameClient.h"
#include "WebSettings.h"
@@ -48,6 +48,11 @@ namespace FrameTestHelpers {
void registerMockedURLLoad(const std::string& base, const std::string& fileName)
{
+ registerMockedURLLoad(GURL(base + fileName), fileName);
+}
+
+void registerMockedURLLoad(GURL url, const std::string& fileName)
+{
WebURLResponse response;
response.initialize();
response.setMIMEType("text/html");
@@ -56,7 +61,7 @@ void registerMockedURLLoad(const std::string& base, const std::string& fileName)
filePath += "/Source/WebKit/chromium/tests/data/";
filePath += fileName;
- webkit_support::RegisterMockedURL(GURL(base + fileName), response, WebString::fromUTF8(filePath));
+ webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath));
}
void loadFrame(WebFrame* frame, const std::string& url)
diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.h b/Source/WebKit/chromium/tests/FrameTestHelpers.h
index 290acfe13..fc2fa2d36 100644
--- a/Source/WebKit/chromium/tests/FrameTestHelpers.h
+++ b/Source/WebKit/chromium/tests/FrameTestHelpers.h
@@ -33,6 +33,8 @@
#include <string>
+class GURL;
+
namespace WebKit {
class WebFrame;
@@ -43,6 +45,8 @@ class WebViewClient;
namespace FrameTestHelpers {
void registerMockedURLLoad(const std::string& base, const std::string& fileName);
+// Like the previous overload, but it allows more flexibility in the url since it is given by the caller.
+void registerMockedURLLoad(GURL, const std::string& fileName);
void loadFrame(WebFrame*, const std::string& url);
diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
index d8858cc12..a93eac7fa 100644
--- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
@@ -26,13 +26,14 @@
#include "LayerChromium.h"
-#include "cc/CCLayerTreeHost.h"
#include "CCLayerTreeTestCommon.h"
#include "FakeCCLayerTreeHostClient.h"
#include "LayerPainterChromium.h"
#include "NonCompositedContentHost.h"
#include "WebCompositor.h"
+#include "cc/CCLayerImpl.h"
#include "cc/CCLayerTreeHost.h"
+#include "cc/CCSingleThreadProxy.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -77,7 +78,7 @@ protected:
{
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
- m_layerTreeHost = adoptRef(new MockCCLayerTreeHost);
+ m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
}
virtual void TearDown()
@@ -145,7 +146,7 @@ protected:
verifyTestTreeInitialState();
}
- RefPtr<MockCCLayerTreeHost> m_layerTreeHost;
+ OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
};
@@ -504,8 +505,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior)
// All properties need to be set to new values in order for setNeedsCommit to be called.
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPointZ(0.7f));
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(Color(0.4f, 0.4f, 0.4f)));
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundCoversViewport(true));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(Color(0.4f, 0.4f, 0.4f, 1.0f)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get()));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5f));
@@ -521,6 +521,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior)
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setTransform(TransformationMatrix(0, 0, 0, 0, 0, 0)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDoubleSided(false));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDebugName("Test Layer"));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setDrawCheckerboardForMissingTiles(!testLayer->drawCheckerboardForMissingTiles()));
// The above tests should not have caused a change to the needsDisplay flag.
EXPECT_FALSE(testLayer->needsDisplay());
@@ -530,6 +531,29 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior)
EXPECT_TRUE(testLayer->needsDisplay());
}
+TEST_F(LayerChromiumTest, verifyPushPropertiesAccumulatesUpdateRect)
+{
+ DebugScopedSetImplThread setImplThread;
+
+ RefPtr<LayerChromium> testLayer = LayerChromium::create();
+ OwnPtr<CCLayerImpl> implLayer = CCLayerImpl::create(1);
+
+ testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5)));
+ testLayer->pushPropertiesTo(implLayer.get());
+ EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLayer->updateRect());
+
+ // The CCLayerImpl's updateRect should be accumulated here, since we did not do anything to clear it.
+ testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
+ testLayer->pushPropertiesTo(implLayer.get());
+ EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(15, 15)), implLayer->updateRect());
+
+ // If we do clear the CCLayerImpl side, then the next updateRect should be fresh without accumulation.
+ implLayer->resetAllChangeTrackingForSubtree();
+ testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
+ testLayer->pushPropertiesTo(implLayer.get());
+ EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)), implLayer->updateRect());
+}
+
class LayerChromiumWithContentScaling : public LayerChromium {
public:
explicit LayerChromiumWithContentScaling()
@@ -537,12 +561,12 @@ public:
{
}
- virtual bool needsContentsScale() const
+ virtual bool needsContentsScale() const OVERRIDE
{
return true;
}
- virtual void setNeedsDisplayRect(const FloatRect& dirtyRect)
+ virtual void setNeedsDisplayRect(const FloatRect& dirtyRect) OVERRIDE
{
m_lastNeedsDisplayRect = dirtyRect;
LayerChromium::setNeedsDisplayRect(dirtyRect);
@@ -577,9 +601,9 @@ TEST_F(LayerChromiumTest, checkContentsScaleChangeTriggersNeedsDisplay)
class FakeCCLayerTreeHost : public CCLayerTreeHost {
public:
- static PassRefPtr<FakeCCLayerTreeHost> create()
+ static PassOwnPtr<FakeCCLayerTreeHost> create()
{
- RefPtr<FakeCCLayerTreeHost> host = adoptRef(new FakeCCLayerTreeHost);
+ OwnPtr<FakeCCLayerTreeHost> host(adoptPtr(new FakeCCLayerTreeHost));
// The initialize call will fail, since our client doesn't provide a valid GraphicsContext3D, but it doesn't matter in the tests that use this fake so ignore the return value.
host->initialize();
return host.release();
@@ -626,7 +650,7 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree)
assertLayerTreeHostMatchesForSubtree(parent.get(), 0);
- RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
// Setting the root layer should set the host pointer for all layers in the tree.
layerTreeHost->setRootLayer(parent.get());
@@ -645,7 +669,7 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
{
WebKit::WebCompositor::initialize(0);
RefPtr<LayerChromium> parent = LayerChromium::create();
- RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
layerTreeHost->setRootLayer(parent.get());
@@ -687,14 +711,14 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost)
child->setReplicaLayer(replica.get());
replica->setMaskLayer(mask.get());
- RefPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> firstLayerTreeHost(FakeCCLayerTreeHost::create());
firstLayerTreeHost->setRootLayer(parent.get());
assertLayerTreeHostMatchesForSubtree(parent.get(), firstLayerTreeHost.get());
// Now re-root the tree to a new host (simulating what we do on a context lost event).
// This should update the host pointers for all layers in the tree.
- RefPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> secondLayerTreeHost(FakeCCLayerTreeHost::create());
secondLayerTreeHost->setRootLayer(parent.get());
assertLayerTreeHostMatchesForSubtree(parent.get(), secondLayerTreeHost.get());
@@ -719,13 +743,13 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
secondChild->addChild(secondGrandChild);
firstParent->addChild(secondChild);
- RefPtr<FakeCCLayerTreeHost> firstLayerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> firstLayerTreeHost(FakeCCLayerTreeHost::create());
firstLayerTreeHost->setRootLayer(firstParent.get());
assertLayerTreeHostMatchesForSubtree(firstParent.get(), firstLayerTreeHost.get());
// Now reparent the subtree starting at secondChild to a layer in a different tree.
- RefPtr<FakeCCLayerTreeHost> secondLayerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> secondLayerTreeHost(FakeCCLayerTreeHost::create());
secondLayerTreeHost->setRootLayer(secondParent.get());
secondParent->addChild(secondChild);
@@ -758,7 +782,7 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
mask->addChild(maskChild);
replica->addChild(replicaChild);
- RefPtr<FakeCCLayerTreeHost> layerTreeHost = FakeCCLayerTreeHost::create();
+ OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
layerTreeHost->setRootLayer(parent.get());
assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get());
diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
new file mode 100644
index 000000000..ddab17564
--- /dev/null
+++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
@@ -0,0 +1,277 @@
+/*
+ * 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 "LayerRendererChromium.h"
+
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
+#include "cc/CCSingleThreadProxy.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+class FrameCountingMemoryAllocationSettingContext : public FakeWebGraphicsContext3D {
+public:
+ FrameCountingMemoryAllocationSettingContext() : m_frame(0) { }
+
+ // WebGraphicsContext3D methods.
+
+ // This method would normally do a glSwapBuffers under the hood.
+ virtual void prepareTexture() { m_frame++; }
+ virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { m_memoryAllocationChangedCallback = callback; }
+ virtual WebString getString(WebKit::WGC3Denum name)
+ {
+ if (name == GraphicsContext3D::EXTENSIONS)
+ return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_manager GL_CHROMIUM_discard_framebuffer");
+ return WebString();
+ }
+
+ // Methods added for test.
+ int frameCount() { return m_frame; }
+ void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) { m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation); }
+
+private:
+ int m_frame;
+ WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChangedCallback;
+};
+
+class FakeLayerRendererChromiumClient : public LayerRendererChromiumClient {
+public:
+ FakeLayerRendererChromiumClient()
+ : m_setFullRootLayerDamageCount(0)
+ , m_rootLayer(CCLayerImpl::create(1))
+ {
+ m_rootLayer->createRenderSurface();
+ }
+
+ // LayerRendererChromiumClient methods.
+ virtual const IntSize& viewportSize() const OVERRIDE { static IntSize fakeSize; return fakeSize; }
+ virtual const CCSettings& settings() const OVERRIDE { static CCSettings fakeSettings; return fakeSettings; }
+ virtual void didLoseContext() OVERRIDE { }
+ virtual void onSwapBuffersComplete() OVERRIDE { }
+ virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; }
+ virtual void setContentsMemoryAllocationLimitBytes(size_t) OVERRIDE { }
+
+ // Methods added for test.
+ int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; }
+
+ CCLayerImpl* rootLayer() { return m_rootLayer.get(); }
+
+private:
+ int m_setFullRootLayerDamageCount;
+ DebugScopedSetImplThread m_implThread;
+ OwnPtr<CCLayerImpl> m_rootLayer;
+};
+
+class FakeLayerRendererChromium : public LayerRendererChromium {
+public:
+ FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context) { }
+
+ // LayerRendererChromium methods.
+
+ // Changing visibility to public.
+ using LayerRendererChromium::initialize;
+ using LayerRendererChromium::isFramebufferDiscarded;
+};
+
+class LayerRendererChromiumTest : public testing::Test {
+protected:
+ LayerRendererChromiumTest()
+ : m_suggestHaveBackbufferYes(1, true)
+ , m_suggestHaveBackbufferNo(1, false)
+ , m_context(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingMemoryAllocationSettingContext()), GraphicsContext3D::RenderDirectlyToHostWindow))
+ , m_mockContext(*static_cast<FrameCountingMemoryAllocationSettingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get())))
+ , m_layerRendererChromium(&m_mockClient, m_context.release())
+ {
+ }
+
+ virtual void SetUp()
+ {
+ m_layerRendererChromium.initialize();
+ }
+
+ void swapBuffers()
+ {
+ m_layerRendererChromium.swapBuffers(IntRect());
+ }
+
+ WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes;
+ WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo;
+
+ RefPtr<GraphicsContext3D> m_context;
+ FrameCountingMemoryAllocationSettingContext& m_mockContext;
+ FakeLayerRendererChromiumClient m_mockClient;
+ FakeLayerRendererChromium m_layerRendererChromium;
+};
+
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Suggest recreating framebuffer when one already exists.
+// Expected: it does nothing.
+TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing)
+{
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferYes);
+ EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount());
+ EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
+
+ swapBuffers();
+ EXPECT_EQ(1, m_mockContext.frameCount());
+}
+
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Suggest discarding framebuffer when one exists.
+// Expected: it is discarded and damage tracker is reset.
+TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayer)
+{
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
+ EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
+}
+
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Suggest discarding framebuffer when one does not exist.
+// Expected: it does nothing.
+TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing)
+{
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
+ EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
+
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
+ EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
+}
+
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Suggest discarding framebuffer, then try to swapBuffers.
+// Expected: framebuffer is discarded, swaps are ignored, and damage is reset after discard and after each swap.
+TEST_F(LayerRendererChromiumTest, SwapBuffersWhileBackbufferDiscardedShouldIgnoreSwapAndDamageRootLayer)
+{
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
+ EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
+
+ 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());
+}
+
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Begin drawing a frame while a framebuffer is discarded.
+// Expected: will recreate framebuffer.
+TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatredForScopeDuration)
+{
+ m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
+ EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
+
+ m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootLayer()->renderSurface());
+ EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
+
+ swapBuffers();
+ EXPECT_EQ(1, m_mockContext.frameCount());
+}
+
+class ForbidSynchronousCallContext : public FakeWebGraphicsContext3D {
+public:
+ ForbidSynchronousCallContext() { }
+
+ virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) { ADD_FAILURE(); return false; }
+ virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) { ADD_FAILURE(); return false; }
+ virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) { ADD_FAILURE(); }
+ virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) { ADD_FAILURE(); return 0; }
+ virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) { ADD_FAILURE(); }
+ virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); }
+ virtual Attributes getContextAttributes() { ADD_FAILURE(); return m_attrs; }
+ virtual WGC3Denum getError() { ADD_FAILURE(); return 0; }
+ virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) { ADD_FAILURE(); }
+ virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); }
+ virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value)
+ {
+ if (pname == WebCore::GraphicsContext3D::MAX_TEXTURE_SIZE)
+ *value = 1024; // MAX_TEXTURE_SIZE is cached client side, so it's OK to query.
+ else
+ ADD_FAILURE();
+ }
+
+ // We allow querying the shader compilation and program link status in debug mode, but not release.
+ virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value)
+ {
+#ifndef NDEBUG
+ *value = 1;
+#else
+ ADD_FAILURE();
+#endif
+ }
+
+ virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value)
+ {
+#ifndef NDEBUG
+ *value = 1;
+#else
+ ADD_FAILURE();
+#endif
+ }
+
+ virtual WebString getString(WGC3Denum name)
+ {
+ // We allow querying the extension string.
+ // FIXME: It'd be better to check that we only do this before starting any other expensive work (like starting a compilation)
+ if (name != WebCore::GraphicsContext3D::EXTENSIONS)
+ ADD_FAILURE();
+ return WebString();
+ }
+
+ virtual WebString getProgramInfoLog(WebGLId program) { ADD_FAILURE(); return WebString(); }
+ virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); }
+
+ virtual WebString getShaderInfoLog(WebGLId shader) { ADD_FAILURE(); return WebString(); }
+ virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) { ADD_FAILURE(); }
+ virtual WebString getShaderSource(WebGLId shader) { ADD_FAILURE(); return WebString(); }
+ virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) { ADD_FAILURE(); }
+ virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); }
+ virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) { ADD_FAILURE(); }
+ virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) { ADD_FAILURE(); }
+ virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) { ADD_FAILURE(); return 0; }
+ virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) { ADD_FAILURE(); }
+ virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); }
+ virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { ADD_FAILURE(); return 0; }
+};
+
+// 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;
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+
+ EXPECT_TRUE(layerRendererChromium.initialize());
+}
diff --git a/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp
index bdbf7bb09..d1a97bb5b 100644
--- a/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp
+++ b/Source/WebKit/chromium/tests/LayerTextureUpdaterTest.cpp
@@ -79,6 +79,27 @@ struct PaintFillAlpha : public PaintCallback {
}
};
+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()); \
@@ -95,19 +116,19 @@ TEST(LayerTextureUpdaterTest, testOpaqueRectPresentAfterOpaquePaint)
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);
+ 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);
+ 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);
+ updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), opaqueRect);
}
@@ -121,19 +142,19 @@ TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentAfterNonOpaquePaint)
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);
+ 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);
+ 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);
+ updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
}
@@ -148,21 +169,21 @@ TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithOpaquePa
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);
+ 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);
+ 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);
+ updater->prepareToUpdate(IntRect(0, 0, 400, 400), IntSize(400, 400), 0, 1, opaqueRect);
EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), opaqueRect);
}
@@ -177,22 +198,70 @@ TEST(LayerTextureUpdaterTest, testOpaqueRectNotPresentForOpaqueLayerWithNonOpaqu
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);
+ 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);
+ 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);
+ 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/LevelDBTest.cpp b/Source/WebKit/chromium/tests/LevelDBTest.cpp
new file mode 100644
index 000000000..2a00ae686
--- /dev/null
+++ b/Source/WebKit/chromium/tests/LevelDBTest.cpp
@@ -0,0 +1,105 @@
+/*
+ * 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"
+
+#if USE(LEVELDB)
+
+#include "FileSystem.h"
+#include "LevelDBComparator.h"
+#include "LevelDBDatabase.h"
+#include "LevelDBSlice.h"
+#include <gtest/gtest.h>
+#include <webkit/support/webkit_support.h>
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace {
+
+class SimpleComparator : public LevelDBComparator {
+public:
+ virtual int compare(const LevelDBSlice& a, const LevelDBSlice& b) const OVERRIDE
+ {
+ size_t len = std::min(a.end() - a.begin(), b.end() - b.begin());
+ return memcmp(a.begin(), b.begin(), len);
+ }
+ virtual const char* name() const OVERRIDE { return "temp_comparator"; }
+};
+
+Vector<char> encodeString(const std::string& s)
+{
+ Vector<char> ret(s.size());
+ for (size_t i = 0; i < s.size(); ++i)
+ ret.append(s[i]);
+ return ret;
+}
+
+TEST(LevelDBDatabaseTest, CorruptionTest)
+{
+ OwnPtr<webkit_support::ScopedTempDirectory> tempDirectory = adoptPtr(webkit_support::CreateScopedTempDirectory());
+ tempDirectory->CreateUniqueTempDir();
+ const String path = String::fromUTF8(tempDirectory->path().c_str());
+
+ const Vector<char> key = encodeString("key");
+ const Vector<char> putValue = encodeString("value");
+ Vector<char> gotValue;
+ SimpleComparator comparator;
+
+ OwnPtr<LevelDBDatabase> leveldb = LevelDBDatabase::open(path, &comparator);
+ EXPECT_TRUE(leveldb);
+ bool success = leveldb->put(key, putValue);
+ EXPECT_TRUE(success);
+ leveldb.release();
+ EXPECT_FALSE(leveldb);
+
+ leveldb = LevelDBDatabase::open(path, &comparator);
+ EXPECT_TRUE(leveldb);
+ success = leveldb->get(key, gotValue);
+ EXPECT_TRUE(success);
+ EXPECT_EQ(putValue, gotValue);
+ leveldb.release();
+ EXPECT_FALSE(leveldb);
+
+ const String filepath = pathByAppendingComponent(path, "CURRENT");
+ PlatformFileHandle handle = openFile(filepath, OpenForWrite);
+ truncateFile(handle, 0);
+ closeFile(handle);
+
+ leveldb = LevelDBDatabase::open(path, &comparator);
+ EXPECT_FALSE(leveldb);
+
+ bool destroyed = LevelDBDatabase::destroy(path);
+ EXPECT_TRUE(destroyed);
+
+ leveldb = LevelDBDatabase::open(path, &comparator);
+ EXPECT_TRUE(leveldb);
+ success = leveldb->get(key, gotValue);
+ EXPECT_FALSE(success);
+}
+
+} // namespace
+
+#endif // USE(LEVELDB)
diff --git a/Source/WebKit/chromium/tests/LocaleWinTest.cpp b/Source/WebKit/chromium/tests/LocaleWinTest.cpp
new file mode 100644
index 000000000..d64e902a5
--- /dev/null
+++ b/Source/WebKit/chromium/tests/LocaleWinTest.cpp
@@ -0,0 +1,163 @@
+/*
+ * 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 "LocaleWin.h"
+
+#include <gtest/gtest.h>
+#include <wtf/DateMath.h>
+#include <wtf/MathExtras.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+using namespace std;
+
+enum {
+ January = 0, February, March,
+ April, May, June,
+ July, August, September,
+ October, November, December,
+};
+
+static double msForDate(int year, int month, int day)
+{
+ return dateToDaysFrom1970(year, month, day) * msPerDay;
+}
+
+TEST(LocaleWinTest, TestLocalizedDateFormatText)
+{
+ EXPECT_STREQ("year/month/day", LocaleWin::dateFormatText("y/M/d", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("year/month/day", LocaleWin::dateFormatText("yy/MM/dd", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("year/month/day", LocaleWin::dateFormatText("yyy/MMM/ddd", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("year/month/day", LocaleWin::dateFormatText("yyyy/MMMM/dddd", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("/month/day, year", LocaleWin::dateFormatText("/MM/dd, yyyy", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("month/day, year=year.", LocaleWin::dateFormatText("MM/dd, 'year='yyyy.", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("month-day 'year", LocaleWin::dateFormatText("MM-dd ''yyy", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("month-day aaa'bbb year", LocaleWin::dateFormatText("MM-dd 'aaa''bbb' yyy", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("year/month/day/year/month/day", LocaleWin::dateFormatText("yyyy/MMMM/dddd/yyyy/MMMM/dddd", "year", "month", "day").utf8().data());
+ EXPECT_STREQ("YY/mm/DD", LocaleWin::dateFormatText("YY/mm/DD", "year", "month", "day").utf8().data());
+}
+
+TEST(LocaleWinTest, TestFormat)
+{
+ const LCID EnglishUS = 0x0409;
+ OwnPtr<LocaleWin> locale = LocaleWin::create(EnglishUS);
+
+ EXPECT_STREQ("4/7/2", locale->formatDate("M/d/y", 2012, 2012, April, 7).utf8().data());
+ EXPECT_STREQ("4/7/2007", locale->formatDate("M/d/y", 2012, 2007, April, 7).utf8().data());
+ EXPECT_STREQ("4/7/8", locale->formatDate("M/d/y", 2012, 2008, April, 7).utf8().data());
+ EXPECT_STREQ("4/7/7", locale->formatDate("M/d/y", 2012, 2017, April, 7).utf8().data());
+ EXPECT_STREQ("4/7/2018", locale->formatDate("M/d/y", 2012, 2018, April, 7).utf8().data());
+ EXPECT_STREQ("12/31/2062", locale->formatDate("M/d/y", 2012, 2062, December, 31).utf8().data());
+ EXPECT_STREQ("4/7/0002", locale->formatDate("M/d/y", 2012, 2, April, 7).utf8().data());
+
+ EXPECT_STREQ("04/27/12", locale->formatDate("MM/dd/yy", 2012, 2012, April, 27).utf8().data());
+ EXPECT_STREQ("04/07/1962", locale->formatDate("MM/dd/yy", 2012, 1962, April, 7).utf8().data());
+ EXPECT_STREQ("04/07/63", locale->formatDate("MM/dd/yy", 2012, 1963, April, 7).utf8().data());
+ EXPECT_STREQ("01/31/00", locale->formatDate("MM/dd/yy", 2012, 2000, January, 31).utf8().data());
+ EXPECT_STREQ("04/07/62", locale->formatDate("MM/dd/yy", 2012, 2062, April, 7).utf8().data());
+ EXPECT_STREQ("04/07/2063", locale->formatDate("MM/dd/yy", 2012, 2063, April, 7).utf8().data());
+ EXPECT_STREQ("04/07/0001", locale->formatDate("MM/dd/yy", 2012, 1, April, 7).utf8().data());
+
+ EXPECT_STREQ("Jan/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, January, 7).utf8().data());
+ EXPECT_STREQ("Feb/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, February, 7).utf8().data());
+ EXPECT_STREQ("Mar/7/2017", locale->formatDate("MMM/d/yyyy", 2012, 2017, March, 7).utf8().data());
+ EXPECT_STREQ("Apr/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, April, 7).utf8().data());
+ EXPECT_STREQ("May/7/0002", locale->formatDate("MMM/d/yyyy", 2012, 2, May, 7).utf8().data());
+ EXPECT_STREQ("Jun/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, June, 7).utf8().data());
+ EXPECT_STREQ("Jul/7/2017", locale->formatDate("MMM/d/yyyy", 2012, 2017, July, 7).utf8().data());
+ EXPECT_STREQ("Aug/31/2062", locale->formatDate("MMM/d/yyyy", 2012, 2062, August, 31).utf8().data());
+ EXPECT_STREQ("Sep/7/0002", locale->formatDate("MMM/d/yyyy", 2012, 2, September, 7).utf8().data());
+ EXPECT_STREQ("Oct/7/2012", locale->formatDate("MMM/d/yyyy", 2012, 2012, October, 7).utf8().data());
+ EXPECT_STREQ("Nov/7/2008", locale->formatDate("MMM/d/yyyy", 2012, 2008, November, 7).utf8().data());
+ EXPECT_STREQ("Dec/31/2062", locale->formatDate("MMM/d/yyyy", 2012, 2062, December, 31).utf8().data());
+
+ EXPECT_STREQ("January-7-2017", locale->formatDate("MMMM-d-yyyy", 2012, 2017, January, 7).utf8().data());
+ EXPECT_STREQ("February-31-2062", locale->formatDate("MMMM-d-yyyy", 2012, 2062, February, 31).utf8().data());
+ EXPECT_STREQ("March-7-0002", locale->formatDate("MMMM-d-yyyy", 2012, 2, March, 7).utf8().data());
+ EXPECT_STREQ("April-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, April, 7).utf8().data());
+ EXPECT_STREQ("May-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, May, 7).utf8().data());
+ EXPECT_STREQ("June-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, June, 7).utf8().data());
+ EXPECT_STREQ("July-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, July, 7).utf8().data());
+ EXPECT_STREQ("August-7-2017", locale->formatDate("MMMM-d-yyyy", 2012, 2017, August, 7).utf8().data());
+ EXPECT_STREQ("September-31-2062", locale->formatDate("MMMM-d-yyyy", 2012, 2062, September, 31).utf8().data());
+ EXPECT_STREQ("October-7-0002", locale->formatDate("MMMM-d-yyyy", 2012, 2, October, 7).utf8().data());
+ EXPECT_STREQ("November-7-22012", locale->formatDate("MMMM-d-yyyy", 2012, 22012, November, 7).utf8().data());
+ EXPECT_STREQ("December-7-12008", locale->formatDate("MMMM-d-yyyy", 2012, 12008, December, 7).utf8().data());
+
+ EXPECT_STREQ("Jan-1-0001", locale->formatDate("MMM-d-yyyy", 2012, 1, January, 1).utf8().data());
+ EXPECT_STREQ("Sep-13-275760", locale->formatDate("MMM-d-yyyy", 2012, 275760, September, 13).utf8().data());
+
+
+ // For the following test, we'd like to confirm they don't crash and their
+ // results are not important because we can assume invalid arguments are
+ // never passed.
+ EXPECT_STREQ("2012-13-00", locale->formatDate("yyyy-MM-dd", -1, 2012, December + 1, 0).utf8().data());
+ EXPECT_STREQ("-1-00--1", locale->formatDate("y-MM-dd", -1, -1, -1, -1).utf8().data());
+ EXPECT_STREQ("-1-124-33", locale->formatDate("y-MM-dd", 2012, -1, 123, 33).utf8().data());
+
+}
+
+TEST(LocaleWinTest, TestParse)
+{
+ const LCID EnglishUS = 0x0409;
+ OwnPtr<LocaleWin> locale = LocaleWin::create(EnglishUS);
+
+ EXPECT_EQ(msForDate(2012, April, 27), locale->parseDate("MM/dd/yy", 2012, "04/27/12"));
+ EXPECT_EQ(msForDate(2062, April, 27), locale->parseDate("MM/dd/yy", 2012, "04/27/62"));
+ EXPECT_EQ(msForDate(1963, April, 27), locale->parseDate("MM/dd/yy", 2012, "04/27/63"));
+ EXPECT_EQ(msForDate(2012, April, 27), locale->parseDate("MM/dd/yy", 2012, "4/27/2012"));
+ EXPECT_EQ(msForDate(2012, April, 27), locale->parseDate("MM/dd/yy", 2012, "Apr/27/2012"));
+ EXPECT_EQ(msForDate(2, April, 27), locale->parseDate("MM/d/yy", 2012, "April/27/2"));
+ EXPECT_EQ(msForDate(2, April, 27), locale->parseDate("MM/d/yy", 2012, "april/27/2"));
+ EXPECT_TRUE(isnan(locale->parseDate("MM/d/yy", 2012, "april/27")));
+ EXPECT_TRUE(isnan(locale->parseDate("MM/d/yy", 2012, "april/27/")));
+ EXPECT_TRUE(isnan(locale->parseDate("MM/d/yy", 2012, " april/27/")));
+
+ EXPECT_EQ(msForDate(12, April, 7), locale->parseDate("MMM/d/yyyy", 2012, "04/7/12"));
+ EXPECT_EQ(msForDate(62, April, 7), locale->parseDate("MMM/d/yyyy", 2012, "04/07/62"));
+ EXPECT_EQ(msForDate(63, April, 7), locale->parseDate("MMM/d/yyyy", 2012, "04/07/63"));
+ EXPECT_EQ(msForDate(2012, April, 7), locale->parseDate("MMM/d/yyyy", 2012, "4/7/2012"));
+ EXPECT_EQ(msForDate(2012, May, 7), locale->parseDate("MMM/d/yyyy", 2012, "May/007/2012"));
+ EXPECT_EQ(msForDate(2, May, 27), locale->parseDate("MM/d/yyyy", 2012, "May/0027/2"));
+ EXPECT_TRUE(isnan(locale->parseDate("MM/d/yyyy", 2012, "May///0027///2")));
+ EXPECT_TRUE(isnan(locale->parseDate("MM/d/yyyy", 2012, "Mayyyyyy/0027/2")));
+
+ EXPECT_EQ(msForDate(2012, April, 27), locale->parseDate("MMMM/dd/y", 2012, "04/27/2"));
+ EXPECT_EQ(msForDate(2017, April, 27), locale->parseDate("MMMM/dd/y", 2012, "04/27/7"));
+ EXPECT_EQ(msForDate(2008, April, 27), locale->parseDate("MMMM/dd/y", 2012, "04/27/8"));
+ EXPECT_EQ(msForDate(2012, April, 27), locale->parseDate("MMMM/dd/y", 2012, "4/27/2012"));
+ EXPECT_EQ(msForDate(2012, December, 27), locale->parseDate("MMMM/dd/y", 2012, "December/27/2012"));
+ EXPECT_EQ(msForDate(2012, November, 27), locale->parseDate("MMMM/d/y", 2012, "November/27/2"));
+ EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "November 27 2")));
+ EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "November 32 2")));
+ EXPECT_TRUE(isnan(locale->parseDate("MMMM/d/y", 2012, "-1/-1/-1")));
+}
diff --git a/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp b/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp
index 6203d35d7..92f85c6bb 100644
--- a/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp
+++ b/Source/WebKit/chromium/tests/LocalizedNumberICUTest.cpp
@@ -29,8 +29,8 @@
*/
#include "config.h"
-#include "LocalizedNumberICU.h"
+#include "LocaleICU.h"
#include <gtest/gtest.h>
#include <wtf/PassOwnPtr.h>
@@ -38,7 +38,7 @@ using namespace WebCore;
void testNumberIsReversible(const char* localeString, const char* original, const char* shouldHave = 0)
{
- OwnPtr<ICULocale> locale = ICULocale::create(localeString);
+ OwnPtr<LocaleICU> locale = LocaleICU::create(localeString);
String localized = locale->convertToLocalizedNumber(original);
if (shouldHave)
EXPECT_TRUE(localized.contains(shouldHave));
diff --git a/Source/WebKit/chromium/tests/MockCCQuadCuller.h b/Source/WebKit/chromium/tests/MockCCQuadCuller.h
new file mode 100644
index 000000000..d9cd31326
--- /dev/null
+++ b/Source/WebKit/chromium/tests/MockCCQuadCuller.h
@@ -0,0 +1,65 @@
+/*
+ * 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 MockCCQuadCuller_h
+#define MockCCQuadCuller_h
+
+#include "IntRect.h"
+#include "cc/CCDrawQuad.h"
+#include "cc/CCQuadCuller.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class MockCCQuadCuller : public WebCore::CCQuadCuller {
+public:
+ MockCCQuadCuller()
+ : CCQuadCuller(m_quadListStorage, 0, 0)
+ , m_activeQuadList(m_quadListStorage)
+ { }
+
+ explicit MockCCQuadCuller(CCQuadList& externalQuadList)
+ : CCQuadCuller(externalQuadList, 0, 0)
+ , m_activeQuadList(externalQuadList)
+ { }
+
+ virtual bool append(WTF::PassOwnPtr<WebCore::CCDrawQuad> newQuad)
+ {
+ OwnPtr<WebCore::CCDrawQuad> drawQuad = newQuad;
+ if (!drawQuad->quadRect().isEmpty()) {
+ m_activeQuadList.append(drawQuad.release());
+ return true;
+ }
+ return false;
+ }
+
+ const WebCore::CCQuadList& quadList() const { return m_activeQuadList; };
+
+private:
+ WebCore::CCQuadList& m_activeQuadList;
+ WebCore::CCQuadList m_quadListStorage;
+};
+
+} // namespace WebCore
+#endif // MockCCQuadCuller_h
diff --git a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp
index b0d86ddf6..721f1fabb 100644
--- a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp
+++ b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp
@@ -39,9 +39,9 @@ namespace {
#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());
+ EXPECT_EQ(a.width(), b.width()); \
+ EXPECT_EQ(a.height(), b.height());
#define EXPECT_PIXELS_MATCH(bitmap, opaqueRect) \
{ \
@@ -53,6 +53,17 @@ namespace {
} \
}
+#define EXPECT_PIXELS_MATCH_EXACT(bitmap, opaqueRect) \
+{ \
+ SkAutoLockPixels locker(bitmap); \
+ for (int y = 0; y < bitmap.height(); ++y) \
+ for (int x = 0; x < bitmap.width(); ++x) { \
+ int alpha = *bitmap.getAddr32(x, y) >> 24; \
+ bool opaque = opaqueRect.contains(x, y); \
+ EXPECT_EQ(opaque, alpha == 255); \
+ } \
+}
+
TEST(PlatformContextSkiaTest, trackOpaqueTest)
{
SkBitmap bitmap;
@@ -215,9 +226,90 @@ TEST(PlatformContextSkiaTest, trackOpaqueClipTest)
context.save();
context.clipToImageBuffer(alphaImage.get(), FloatRect(30, 30, 10, 10));
context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ context.restore();
EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
- context.restore();
+}
+
+TEST(PlatformContextSkiaTest, trackImageMask)
+{
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400);
+ bitmap.allocPixels();
+ bitmap.eraseColor(0);
+ SkCanvas canvas(bitmap);
+
+ PlatformContextSkia platformContext(&canvas);
+ platformContext.setTrackOpaqueRegion(true);
+ GraphicsContext context(&platformContext);
+
+ Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
+ Color alpha(0.0f, 0.0f, 0.0f, 0.0f);
+
+ // Image masks are done by drawing a bitmap into a transparency layer that uses DstIn to mask
+ // out a transparency layer below that is filled with the mask color. In the end this should
+ // not be marked opaque.
+
+ context.setCompositeOperation(CompositeSourceOver);
+ context.beginTransparencyLayer(1);
+ context.fillRect(FloatRect(10, 10, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ context.setCompositeOperation(CompositeDestinationIn);
+ context.beginTransparencyLayer(1);
+
+ OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
+ alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha, ColorSpaceDeviceRGB);
+
+ context.setCompositeOperation(CompositeSourceOver);
+ context.drawImageBuffer(alphaImage.get(), ColorSpaceDeviceRGB, FloatRect(10, 10, 10, 10));
+
+ context.endTransparencyLayer();
+ context.endTransparencyLayer();
+
+ EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
+}
+
+TEST(PlatformContextSkiaTest, trackImageMaskWithOpaqueRect)
+{
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400);
+ bitmap.allocPixels();
+ bitmap.eraseColor(0);
+ SkCanvas canvas(bitmap);
+
+ PlatformContextSkia platformContext(&canvas);
+ platformContext.setTrackOpaqueRegion(true);
+ GraphicsContext context(&platformContext);
+
+ Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
+ Color alpha(0.0f, 0.0f, 0.0f, 0.0f);
+
+ // Image masks are done by drawing a bitmap into a transparency layer that uses DstIn to mask
+ // out a transparency layer below that is filled with the mask color. In the end this should
+ // not be marked opaque.
+
+ context.setCompositeOperation(CompositeSourceOver);
+ context.beginTransparencyLayer(1);
+ context.fillRect(FloatRect(10, 10, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ context.setCompositeOperation(CompositeDestinationIn);
+ context.beginTransparencyLayer(1);
+
+ OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100));
+ alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha, ColorSpaceDeviceRGB);
+
+ context.setCompositeOperation(CompositeSourceOver);
+ context.drawImageBuffer(alphaImage.get(), ColorSpaceDeviceRGB, FloatRect(10, 10, 10, 10));
+
+ // We can't have an opaque mask actually, but we can pretend here like it would look if we did.
+ context.fillRect(FloatRect(12, 12, 3, 3), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ context.endTransparencyLayer();
+ context.endTransparencyLayer();
+
+ EXPECT_EQ_RECT(IntRect(12, 12, 3, 3), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
}
TEST(PlatformContextSkiaTest, trackOpaqueJoinTest)
@@ -572,113 +664,170 @@ TEST(PlatformContextSkiaTest, trackOpaqueOvalTest)
EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
}
-TEST(PlatformContextSkiaTest, layerTransformTranslateOpaqueTest)
+TEST(PlatformContextSkiaTest, contextTransparencyLayerTest)
{
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400);
bitmap.allocPixels();
bitmap.eraseColor(0);
SkCanvas canvas(bitmap);
- AffineTransform transform;
- transform.translate(10, 10);
PlatformContextSkia platformContext(&canvas);
platformContext.setTrackOpaqueRegion(true);
- platformContext.setOpaqueRegionTransform(transform);
GraphicsContext context(&platformContext);
-
+
Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
-
- context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- EXPECT_EQ_RECT(IntRect(20, 20, 90, 90), platformContext.opaqueRegion().asRect());
- EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect()));
-
- context.clearRect(FloatRect(10, 10, 90, 90));
+
+ context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ EXPECT_EQ_RECT(IntRect(20, 20, 10, 10), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+ context.clearRect(FloatRect(20, 20, 10, 10));
EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
- context.translate(30, 30);
+ context.beginTransparencyLayer(0.5);
+ context.save();
+ context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ context.restore();
+ context.endTransparencyLayer();
+ EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
- context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- EXPECT_EQ_RECT(IntRect(50, 50, 90, 90), platformContext.opaqueRegion().asRect());
- EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect()));
+ context.clearRect(FloatRect(20, 20, 10, 10));
+ EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
- context.clearRect(FloatRect(10, 10, 90, 90));
+ context.beginTransparencyLayer(0.5);
+ context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ context.endTransparencyLayer();
EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
}
-TEST(PlatformContextSkiaTest, layerTransformScaleOpaqueTest)
+TEST(PlatformContextSkiaTest, UnboundedDrawsAreClipped)
{
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400);
bitmap.allocPixels();
bitmap.eraseColor(0);
SkCanvas canvas(bitmap);
- AffineTransform transform;
- transform.scale(2);
PlatformContextSkia platformContext(&canvas);
platformContext.setTrackOpaqueRegion(true);
- platformContext.setOpaqueRegionTransform(transform);
GraphicsContext context(&platformContext);
Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
+ Color alpha(0.0f, 0.0f, 0.0f, 0.0f);
- context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- EXPECT_EQ_RECT(IntRect(40, 40, 20, 20), platformContext.opaqueRegion().asRect());
- EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect()));
+ Path path;
+ context.setShouldAntialias(false);
+ context.setMiterLimit(1);
+ context.setStrokeThickness(5);
+ context.setLineCap(SquareCap);
+ context.setStrokeStyle(SolidStroke);
- context.clearRect(FloatRect(20, 20, 10, 10));
- EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ // Make skia unable to compute fast bounds for our paths.
+ Vector<float> dashArray;
+ dashArray.append(1);
+ dashArray.append(0);
+ context.setLineDash(dashArray, 0);
- context.scale(FloatSize(2, 1));
- context.translate(0, 10);
+ // Make the device opaque in 10,10 40x40.
+ context.fillRect(FloatRect(10, 10, 40, 40), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ EXPECT_EQ_RECT(IntRect(10, 10, 40, 40), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
- context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- EXPECT_EQ_RECT(IntRect(80, 60, 40, 20), platformContext.opaqueRegion().asRect());
- EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect()));
+ // Clip to the left edge of the opaque area.
+ context.clip(IntRect(10, 10, 10, 40));
- context.clearRect(FloatRect(20, 20, 10, 10));
- EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ // Draw a path that gets clipped. This should destroy the opaque area but only inside the clip.
+ context.setCompositeOperation(CompositeSourceOut);
+ context.setFillColor(alpha, ColorSpaceDeviceRGB);
+ path.moveTo(FloatPoint(10, 10));
+ path.addLineTo(FloatPoint(40, 40));
+ context.strokePath(path);
+
+ EXPECT_EQ_RECT(IntRect(20, 10, 30, 40), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
}
-TEST(PlatformContextSkiaTest, contextTransparencyLayerTest)
+TEST(PlatformContextSkiaTest, PreserveOpaqueOnlyMattersForFirstLayer)
{
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400);
bitmap.allocPixels();
bitmap.eraseColor(0);
SkCanvas canvas(bitmap);
- AffineTransform transform;
- transform.scale(2);
PlatformContextSkia platformContext(&canvas);
platformContext.setTrackOpaqueRegion(true);
- platformContext.setOpaqueRegionTransform(transform);
GraphicsContext context(&platformContext);
-
+
Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
-
- context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- EXPECT_EQ_RECT(IntRect(40, 40, 20, 20), platformContext.opaqueRegion().asRect());
- EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect()));
-
- context.clearRect(FloatRect(20, 20, 10, 10));
- EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ Color alpha(0.0f, 0.0f, 0.0f, 0.0f);
+ Path path;
+ context.setShouldAntialias(false);
+ context.setMiterLimit(1);
+ context.setStrokeThickness(5);
+ context.setLineCap(SquareCap);
+ context.setStrokeStyle(SolidStroke);
+
+ // Make skia unable to compute fast bounds for our paths.
+ Vector<float> dashArray;
+ dashArray.append(1);
+ dashArray.append(0);
+ context.setLineDash(dashArray, 0);
+
+ // Make the device opaque in 10,10 40x40.
+ context.fillRect(FloatRect(10, 10, 40, 40), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+ EXPECT_EQ_RECT(IntRect(10, 10, 40, 40), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
+
+ // Begin a layer that preserves opaque.
+ context.setCompositeOperation(CompositeSourceOver);
context.beginTransparencyLayer(0.5);
- context.save();
- context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
- context.restore();
+
+ // Begin a layer that does not preserve opaque.
+ context.setCompositeOperation(CompositeSourceOut);
+ context.beginTransparencyLayer(0.5);
+
+ // This should not destroy the device opaqueness.
+ context.fillRect(FloatRect(10, 10, 40, 40), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ // This should not destroy the device opaqueness either.
+ context.setFillColor(opaque, ColorSpaceDeviceRGB);
+ path.moveTo(FloatPoint(10, 10));
+ path.addLineTo(FloatPoint(40, 40));
+ context.strokePath(path);
+
context.endTransparencyLayer();
- EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ context.endTransparencyLayer();
+ EXPECT_EQ_RECT(IntRect(10, 10, 40, 40), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
- context.clearRect(FloatRect(20, 20, 10, 10));
+ // Now begin a layer that does not preserve opaque and draw through it to the device.
+ context.setCompositeOperation(CompositeSourceOut);
+ context.beginTransparencyLayer(0.5);
+
+ // This should destroy the device opaqueness.
+ context.fillRect(FloatRect(10, 10, 40, 40), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ context.endTransparencyLayer();
EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
+
+ // Now we draw with a path for which it cannot compute fast bounds. This should destroy the entire opaque region.
+ context.setCompositeOperation(CompositeSourceOut);
context.beginTransparencyLayer(0.5);
- context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+
+ // This should nuke the device opaqueness.
+ context.setFillColor(opaque, ColorSpaceDeviceRGB);
+ path.moveTo(FloatPoint(10, 10));
+ path.addLineTo(FloatPoint(40, 40));
+ context.strokePath(path);
+
context.endTransparencyLayer();
EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+ EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp
index 74ca57667..362727c04 100644
--- a/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp
+++ b/Source/WebKit/chromium/tests/PlatformGestureCurveTest.cpp
@@ -29,7 +29,7 @@
#include "ActivePlatformGestureAnimation.h"
#include "PlatformGestureCurveTarget.h"
-#include "TouchFlingPlatformGestureCurve.h"
+#include "TouchpadFlingPlatformGestureCurve.h"
#include "WheelFlingPlatformGestureCurve.h"
#include "cc/CCActiveGestureAnimation.h"
#include "cc/CCGestureCurve.h"
@@ -42,7 +42,7 @@ using namespace WebCore;
class MockPlatformGestureCurveTarget : public PlatformGestureCurveTarget {
public:
- virtual void setScrollIncrement(const IntPoint& delta)
+ virtual void scrollBy(const IntPoint& delta)
{
m_cumulativeDelta = m_cumulativeDelta + delta;
}
@@ -57,7 +57,7 @@ private:
TEST(PlatformGestureCurve, flingCurve)
{
MockPlatformGestureCurveTarget target;
- OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(0, WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target);
+ OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target);
// Note: the expectations below are dependent on the value of sigma hard-coded in the Rayleigh
// curve. If sigma changes, these test expectations will also change.
@@ -69,23 +69,24 @@ TEST(PlatformGestureCurve, flingCurve)
EXPECT_FALSE(animation->animate(1001));
// Since the Rayleigh CDF maxes out at 1, we expect the cumulative scroll increments to
// match the input velocity parameter.
- // Since we can be off by +/-0.5 on each conversion to int for setScrollIncrement,
- // pick the 'nearness' to be within the number of times animate returns true.
EXPECT_NEAR(target.cumulativeDelta().x(), 100, 1);
EXPECT_EQ(target.cumulativeDelta().y(), 0);
+ // Test animation when not starting at t = 0.
double baseTime = 42.42;
- animation = ActivePlatformGestureAnimation::create(baseTime, WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target);
+ animation = ActivePlatformGestureAnimation::create(WheelFlingPlatformGestureCurve::create(FloatPoint(100, 0)), &target);
target.resetCumulativeDelta();
EXPECT_TRUE(animation->animate(baseTime + 0.35));
EXPECT_TRUE(animation->animate(baseTime + 1.35));
- EXPECT_FALSE(animation->animate(baseTime + 1000));
+ EXPECT_TRUE(animation->animate(baseTime + 1000));
+ EXPECT_FALSE(animation->animate(baseTime + 1001));
EXPECT_NEAR(target.cumulativeDelta().x(), 100, 1);
- animation = ActivePlatformGestureAnimation::create(0, WheelFlingPlatformGestureCurve::create(FloatPoint(50, 150)), &target);
+ animation = ActivePlatformGestureAnimation::create(WheelFlingPlatformGestureCurve::create(FloatPoint(50, 150)), &target);
target.resetCumulativeDelta();
+ // Test animation with both horizontal and vertical scroll velocities.
EXPECT_TRUE(animation->animate(0));
EXPECT_TRUE(animation->animate(0.25));
EXPECT_TRUE(animation->animate(0.45));
@@ -98,21 +99,18 @@ TEST(PlatformGestureCurve, flingCurve)
TEST(PlatformGestureCurve, flingCurveTouch)
{
+ double initialVelocity = 5000;
MockPlatformGestureCurveTarget target;
- OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(0, TouchFlingPlatformGestureCurve::create(FloatPoint(1000, 0)), &target);
+ OwnPtr<ActivePlatformGestureAnimation> animation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(initialVelocity, 0)), &target);
- // Note: the expectations below are dependent on the value of sigma hard-coded in the Rayleigh
- // curve. If sigma changes, these test expectations will also change.
+ // Note: the expectations below are dependent on the value of sigma hard-coded in the curve parameters.
+ // If the parameters change, then the tests values/expectations will need to be updated.
EXPECT_TRUE(animation->animate(0));
EXPECT_TRUE(animation->animate(0.25));
EXPECT_TRUE(animation->animate(0.45)); // Use non-uniform tick spacing.
- EXPECT_TRUE(animation->animate(0.75));
- EXPECT_TRUE(animation->animate(0.9));
- EXPECT_TRUE(animation->animate(1000));
- EXPECT_FALSE(animation->animate(1001));
- // Since we can be off by +/-0.5 on each conversion to int for setScrollIncrement,
- // pick the 'nearness' to be within the 5 * number of times animate returns true.
- EXPECT_NEAR(target.cumulativeDelta().x(), 1000, 1);
+ EXPECT_TRUE(animation->animate(1));
+ EXPECT_FALSE(animation->animate(1.5));
+ EXPECT_NEAR(target.cumulativeDelta().x(), 1193, 1);
EXPECT_EQ(target.cumulativeDelta().y(), 0);
}
diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp
index f053ca410..1db65ec6e 100644
--- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp
+++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp
@@ -42,6 +42,7 @@
#include "PopupMenu.h"
#include "PopupMenuClient.h"
#include "PopupMenuChromium.h"
+#include "RuntimeEnabledFeatures.h"
#include "WebDocument.h"
#include "WebElement.h"
#include "WebFrame.h"
@@ -154,7 +155,7 @@ public:
// We need to override this so that the popup menu size is not 0
// (the layout code checks to see if the popup fits on the screen).
virtual WebScreenInfo screenInfo()
- {
+ {
WebScreenInfo screenInfo;
screenInfo.availableRect.height = 2000;
screenInfo.availableRect.width = 2000;
@@ -181,6 +182,10 @@ public:
protected:
virtual void SetUp()
{
+ // When touch is enabled, padding is added to option elements
+ // In these tests, we'll assume touch is disabled.
+ m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled();
+ RuntimeEnabledFeatures::setTouchEnabled(false);
m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient));
m_webView->initializeMainFrame(&m_webFrameClient);
m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient));
@@ -191,6 +196,7 @@ protected:
m_popupMenu = 0;
m_webView->close();
webkit_support::UnregisterAllMockedURLs();
+ RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled);
}
// Returns true if there currently is a select popup in the WebView.
@@ -278,6 +284,7 @@ protected:
TestWebFrameClient m_webFrameClient;
TestPopupMenuClient m_popupMenuClient;
RefPtr<PopupMenu> m_popupMenu;
+ bool m_touchWasEnabled;
std::string baseURL;
};
diff --git a/Source/WebKit/chromium/tests/RegionTest.cpp b/Source/WebKit/chromium/tests/RegionTest.cpp
new file mode 100644
index 000000000..d202ab40c
--- /dev/null
+++ b/Source/WebKit/chromium/tests/RegionTest.cpp
@@ -0,0 +1,127 @@
+/*
+ * 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 "Region.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+#define TEST_INSIDE_RECT(r, x, y, w, h) \
+ EXPECT_TRUE(r.contains(IntPoint(x, y))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w - 1, y))); \
+ EXPECT_TRUE(r.contains(IntPoint(x, y + h - 1))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w - 1, y + h - 1))); \
+ EXPECT_TRUE(r.contains(IntPoint(x, y + h / 2))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w - 1, y + h / 2))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w / 2, y))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w / 2, y + h - 1))); \
+ EXPECT_TRUE(r.contains(IntPoint(x + w / 2, y + h / 2))); \
+
+#define TEST_LEFT_OF_RECT(r, x, y, w, h) \
+ EXPECT_FALSE(r.contains(IntPoint(x - 1, y))); \
+ EXPECT_FALSE(r.contains(IntPoint(x - 1, y + h - 1))); \
+
+#define TEST_RIGHT_OF_RECT(r, x, y, w, h) \
+ EXPECT_FALSE(r.contains(IntPoint(x + w, y))); \
+ EXPECT_FALSE(r.contains(IntPoint(x + w, y + h - 1))); \
+
+#define TEST_TOP_OF_RECT(r, x, y, w, h) \
+ EXPECT_FALSE(r.contains(IntPoint(x, y - 1))); \
+ EXPECT_FALSE(r.contains(IntPoint(x + w - 1, y - 1))); \
+
+#define TEST_BOTTOM_OF_RECT(r, x, y, w, h) \
+ EXPECT_FALSE(r.contains(IntPoint(x, y + h))); \
+ EXPECT_FALSE(r.contains(IntPoint(x + w - 1, y + h))); \
+
+TEST(RegionTest, containsPoint)
+{
+ Region r;
+
+ EXPECT_FALSE(r.contains(IntPoint(0, 0)));
+
+ r.unite(IntRect(35, 35, 1, 1));
+ TEST_INSIDE_RECT(r, 35, 35, 1, 1);
+ TEST_LEFT_OF_RECT(r, 35, 35, 1, 1);
+ TEST_RIGHT_OF_RECT(r, 35, 35, 1, 1);
+ TEST_TOP_OF_RECT(r, 35, 35, 1, 1);
+ TEST_BOTTOM_OF_RECT(r, 35, 35, 1, 1);
+
+ r.unite(IntRect(30, 30, 10, 10));
+ TEST_INSIDE_RECT(r, 30, 30, 10, 10);
+ TEST_LEFT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_TOP_OF_RECT(r, 30, 30, 10, 10);
+ TEST_BOTTOM_OF_RECT(r, 30, 30, 10, 10);
+
+ r.unite(IntRect(31, 40, 10, 10));
+ EXPECT_FALSE(r.contains(IntPoint(30, 40)));
+ EXPECT_TRUE(r.contains(IntPoint(31, 40)));
+ EXPECT_FALSE(r.contains(IntPoint(40, 39)));
+ EXPECT_TRUE(r.contains(IntPoint(40, 40)));
+
+ TEST_INSIDE_RECT(r, 30, 30, 10, 10);
+ TEST_LEFT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_TOP_OF_RECT(r, 30, 30, 10, 10);
+ TEST_INSIDE_RECT(r, 31, 40, 10, 10);
+ TEST_LEFT_OF_RECT(r, 31, 40, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 31, 40, 10, 10);
+ TEST_BOTTOM_OF_RECT(r, 31, 40, 10, 10);
+
+ r.unite(IntRect(42, 40, 10, 10));
+
+ TEST_INSIDE_RECT(r, 42, 40, 10, 10);
+ TEST_LEFT_OF_RECT(r, 42, 40, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 42, 40, 10, 10);
+ TEST_TOP_OF_RECT(r, 42, 40, 10, 10);
+ TEST_BOTTOM_OF_RECT(r, 42, 40, 10, 10);
+
+ TEST_INSIDE_RECT(r, 30, 30, 10, 10);
+ TEST_LEFT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 30, 30, 10, 10);
+ TEST_TOP_OF_RECT(r, 30, 30, 10, 10);
+ TEST_INSIDE_RECT(r, 31, 40, 10, 10);
+ TEST_LEFT_OF_RECT(r, 31, 40, 10, 10);
+ TEST_RIGHT_OF_RECT(r, 31, 40, 10, 10);
+ TEST_BOTTOM_OF_RECT(r, 31, 40, 10, 10);
+}
+
+TEST(RegionTest, emptySpan)
+{
+ Region r;
+ r.unite(IntRect(5, 0, 10, 10));
+ r.unite(IntRect(0, 5, 10, 10));
+ r.subtract(IntRect(7, 7, 10, 0));
+
+ Vector<IntRect> rects = r.rects();
+ for (size_t i = 0; i < rects.size(); ++i)
+ EXPECT_FALSE(rects[i].isEmpty());
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/RenderTableCellTest.cpp b/Source/WebKit/chromium/tests/RenderTableCellTest.cpp
index 049b53534..b4c554a76 100644
--- a/Source/WebKit/chromium/tests/RenderTableCellTest.cpp
+++ b/Source/WebKit/chromium/tests/RenderTableCellTest.cpp
@@ -91,25 +91,12 @@ TEST_F(RenderTableCellDeathTest, CanSetColumn)
EXPECT_EQ(columnIndex, m_cell->col());
}
-TEST_F(RenderTableCellDeathTest, CanSetRow)
-{
- static const unsigned rowIndex = 10;
- m_cell->setRow(rowIndex);
- EXPECT_EQ(rowIndex, m_cell->row());
-}
-
TEST_F(RenderTableCellDeathTest, CanSetColumnToMaxColumnIndex)
{
m_cell->setCol(maxColumnIndex);
EXPECT_EQ(maxColumnIndex, m_cell->col());
}
-TEST_F(RenderTableCellDeathTest, CanSetRowToMaxRowIndex)
-{
- m_cell->setRow(maxRowIndex);
- EXPECT_EQ(maxRowIndex, m_cell->row());
-}
-
// FIXME: Re-enable these tests once ASSERT_DEATH is supported for Android.
// See: https://bugs.webkit.org/show_bug.cgi?id=74089
#if !OS(ANDROID)
@@ -119,21 +106,11 @@ TEST_F(RenderTableCellDeathTest, CrashIfColumnOverflowOnSetting)
ASSERT_DEATH(m_cell->setCol(maxColumnIndex + 1), "");
}
-TEST_F(RenderTableCellDeathTest, CrashIfRowOverflowOnSetting)
-{
- ASSERT_DEATH(m_cell->setRow(maxRowIndex + 1), "");
-}
-
TEST_F(RenderTableCellDeathTest, CrashIfSettingUnsetColumnIndex)
{
ASSERT_DEATH(m_cell->setCol(unsetColumnIndex), "");
}
-TEST_F(RenderTableCellDeathTest, CrashIfSettingUnsetRowIndex)
-{
- ASSERT_DEATH(m_cell->setRow(unsetRowIndex), "");
-}
-
#endif
}
diff --git a/Source/WebKit/chromium/tests/RenderTableRowTest.cpp b/Source/WebKit/chromium/tests/RenderTableRowTest.cpp
new file mode 100644
index 000000000..a5ee2a347
--- /dev/null
+++ b/Source/WebKit/chromium/tests/RenderTableRowTest.cpp
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+// FIXME: If we get the TestWebKitAPI framework to bring a full Frame + DOM stack
+// in a portable way, this test should be shared with all ports!
+
+#include "config.h"
+
+#include "RenderTableRow.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "FrameTestHelpers.h"
+#include "RenderArena.h"
+#include "WebFrame.h"
+#include "WebFrameImpl.h"
+#include "WebView.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebKit;
+
+namespace WebCore {
+
+namespace {
+
+class RenderTableRowDeathTest : public testing::Test {
+ // It's unfortunate that we have to get the whole browser stack to test one RenderObject
+ // but the code needs it.
+ static Frame* frame()
+ {
+ static WebView* webView;
+
+ if (webView)
+ return static_cast<WebFrameImpl*>(webView->mainFrame())->frame();
+
+ webView = FrameTestHelpers::createWebViewAndLoad("about:blank");
+ webView->setFocus(true);
+ return static_cast<WebFrameImpl*>(webView->mainFrame())->frame();
+ }
+
+ static Document* document()
+ {
+ return frame()->document();
+ }
+
+ static RenderArena* arena()
+ {
+ return document()->renderArena();
+ }
+
+ virtual void SetUp()
+ {
+ m_row = new (arena()) RenderTableRow(document());
+ }
+
+ virtual void TearDown()
+ {
+ m_row->destroy();
+ }
+
+protected:
+ RenderTableRow* m_row;
+};
+
+TEST_F(RenderTableRowDeathTest, CanSetRow)
+{
+ static const unsigned rowIndex = 10;
+ m_row->setRowIndex(rowIndex);
+ EXPECT_EQ(rowIndex, m_row->rowIndex());
+}
+
+TEST_F(RenderTableRowDeathTest, CanSetRowToMaxRowIndex)
+{
+ m_row->setRowIndex(maxRowIndex);
+ EXPECT_EQ(maxRowIndex, m_row->rowIndex());
+}
+
+// FIXME: Re-enable these tests once ASSERT_DEATH is supported for Android.
+// See: https://bugs.webkit.org/show_bug.cgi?id=74089
+#if !OS(ANDROID)
+
+TEST_F(RenderTableRowDeathTest, CrashIfRowOverflowOnSetting)
+{
+ ASSERT_DEATH(m_row->setRowIndex(maxRowIndex + 1), "");
+}
+
+TEST_F(RenderTableRowDeathTest, CrashIfSettingUnsetRowIndex)
+{
+ ASSERT_DEATH(m_row->setRowIndex(unsetRowIndex), "");
+}
+
+#endif
+
+}
+
+} // namespace WebCore
diff --git a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
index 9d21b8a9e..0827267ed 100644
--- a/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
+++ b/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp
@@ -125,7 +125,7 @@ TEST(ScrollAnimatorEnabled, Enabled)
scrollAnimatorNone.reset();
scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
- EXPECT_NE(100, scrollAnimatorNone.currentX());
+ EXPECT_EQ(100, scrollAnimatorNone.currentX());
EXPECT_NE(0, scrollAnimatorNone.currentX());
EXPECT_EQ(0, scrollAnimatorNone.currentY());
scrollAnimatorNone.reset();
@@ -692,21 +692,21 @@ TEST_F(ScrollAnimatorNoneTest, ScrollWheelTrace)
ScrollAnimatorNone::Parameters parameters(true, 11 * kTickTime, 0, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0);
// Constructed from an actual scroll wheel trace that exhibited a glitch.
- bool result = updateDataFromParameters(1, 53.33, 1000, 100.5781, &parameters);
+ bool result = updateDataFromParameters(1, 53.33f, 1000, 100.5781f, &parameters);
result = animateScroll(100.5933);
result = result && animateScroll(100.6085);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.6485, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.6485f, &parameters);
result = result && animateScroll(100.6515);
result = result && animateScroll(100.6853);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.6863, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.6863f, &parameters);
result = result && animateScroll(100.7005);
result = result && animateScroll(100.7157);
result = result && animateScroll(100.7312);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.7379, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.7379f, &parameters);
result = result && animateScroll(100.7464);
result = result && animateScroll(100.7617);
result = result && animateScroll(100.7775);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.7779, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.7779f, &parameters);
for (double t = 100.7928; result && t < 200; t += 0.015)
result = result && animateScroll(t);
}
@@ -716,21 +716,21 @@ TEST_F(ScrollAnimatorNoneTest, ScrollWheelTraceSmoothed)
ScrollAnimatorNone::Parameters parameters(true, 11 * kTickTime, 7 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Cubic, 3 * kTickTime, ScrollAnimatorNone::Linear, 0);
// Constructed from an actual scroll wheel trace that exhibited a glitch.
- bool result = updateDataFromParameters(1, 53.33, 1000, 100.5781, &parameters);
+ bool result = updateDataFromParameters(1, 53.33f, 1000, 100.5781f, &parameters);
result = animateScroll(100.5933);
result = result && animateScroll(100.6085);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.6485, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.6485f, &parameters);
result = result && animateScroll(100.6515);
result = result && animateScroll(100.6853);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.6863, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.6863f, &parameters);
result = result && animateScroll(100.7005);
result = result && animateScroll(100.7157);
result = result && animateScroll(100.7312);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.7379, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.7379f, &parameters);
result = result && animateScroll(100.7464);
result = result && animateScroll(100.7617);
result = result && animateScroll(100.7775);
- result = result && updateDataFromParameters(1, 53.33, 1000, 100.7779, &parameters);
+ result = result && updateDataFromParameters(1, 53.33f, 1000, 100.7779f, &parameters);
for (double t = 100.7928; result && t < 200; t += 0.015)
result = result && animateScroll(t);
}
diff --git a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
index 78b96b495..5bf990cde 100644
--- a/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/ScrollbarLayerChromiumTest.cpp
@@ -27,6 +27,7 @@
#include "ScrollbarLayerChromium.h"
#include "Scrollbar.h"
+#include "Settings.h"
#include "TreeSynchronizer.h"
#include "cc/CCScrollbarLayerImpl.h"
#include "cc/CCSingleThreadProxy.h"
@@ -90,6 +91,7 @@ TEST(ScrollbarLayerChromiumTest, resolveScrollLayerPointer)
{
DebugScopedSetImplThread impl;
+ Settings::setMockScrollbarsEnabled(true);
{
RefPtr<MockScrollbar> scrollbar = adoptRef(new MockScrollbar);
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
diff --git a/Source/WebKit/chromium/tests/TextureCopierTest.cpp b/Source/WebKit/chromium/tests/TextureCopierTest.cpp
new file mode 100644
index 000000000..17173c0a5
--- /dev/null
+++ b/Source/WebKit/chromium/tests/TextureCopierTest.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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 "TextureCopier.h"
+
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3DPrivate.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <wtf/RefPtr.h>
+
+using namespace WebCore;
+using namespace WebKit;
+using testing::InSequence;
+using testing::Test;
+using testing::_;
+
+namespace {
+
+class MockContext : public FakeWebGraphicsContext3D {
+public:
+ MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
+ MOCK_METHOD3(texParameteri, void(GC3Denum target, GC3Denum pname, GC3Dint param));
+
+ MOCK_METHOD3(drawArrays, void(GC3Denum mode, GC3Dint first, GC3Dsizei count));
+};
+
+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()));
+
+ {
+ InSequence sequence;
+
+ // Here we check just some essential properties of copyTexture() to avoid mirroring the full implementation.
+ EXPECT_CALL(mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, _));
+
+ // Make sure linear filtering is disabled during the copy.
+ EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST));
+ EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST));
+
+ EXPECT_CALL(mockContext, drawArrays(_, _, _));
+
+ // Linear filtering should be restored.
+ EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+ EXPECT_CALL(mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+
+ // Default framebuffer should be restored
+ EXPECT_CALL(mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
+ }
+
+ int sourceTextureId = 1;
+ int destTextureId = 2;
+ IntSize size(256, 128);
+ OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(context));
+ copier->copyTexture(context.get(), sourceTextureId, destTextureId, size);
+}
+
+} // namespace
diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp
index 3b576af99..d5313f5dc 100644
--- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp
+++ b/Source/WebKit/chromium/tests/TextureManagerTest.cpp
@@ -24,23 +24,18 @@
#include "config.h"
+#include "CCTiledLayerTestCommon.h"
#include "ManagedTexture.h"
#include "TextureManager.h"
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
using namespace WTF;
namespace {
-class FakeTextureAllocator : public TextureAllocator {
-public:
- virtual ~FakeTextureAllocator() { }
- virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; }
- virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { }
-};
-
class TextureManagerTest : public testing::Test {
public:
TextureManagerTest()
diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
index 2523230e0..5b7cb0df7 100644
--- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
@@ -26,18 +26,16 @@
#include "TiledLayerChromium.h"
+#include "CCAnimationTestCommon.h"
#include "CCLayerTreeTestCommon.h"
+#include "CCTiledLayerTestCommon.h"
#include "FakeCCLayerTreeHostClient.h"
-#include "LayerTextureUpdater.h"
-#include "Region.h"
-#include "TextureManager.h"
#include "WebCompositor.h"
#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread
-#include "cc/CCTextureUpdater.h"
-#include "cc/CCTiledLayerImpl.h"
#include <gtest/gtest.h>
using namespace WebCore;
+using namespace WebKitTests;
using namespace WTF;
#define EXPECT_EQ_RECT(a, b) \
@@ -48,208 +46,38 @@ using namespace WTF;
namespace {
-class FakeTextureAllocator : public TextureAllocator {
+class TestCCOcclusionTracker : public CCOcclusionTracker {
public:
- virtual unsigned createTexture(const IntSize&, GC3Denum) { return 0; }
- virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { }
-};
-
-class FakeTiledLayerChromium;
-
-class FakeLayerTextureUpdater : public LayerTextureUpdater {
-public:
- class Texture : public LayerTextureUpdater::Texture {
- public:
- Texture(FakeLayerTextureUpdater* layer, PassOwnPtr<ManagedTexture> texture)
- : LayerTextureUpdater::Texture(texture)
- , m_layer(layer)
- {
- }
- virtual ~Texture() { }
-
- virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect&, const IntRect&) { m_layer->updateRect(); }
- virtual void prepareRect(const IntRect&) { m_layer->prepareRect(); }
-
- private:
- FakeLayerTextureUpdater* m_layer;
- };
-
- FakeLayerTextureUpdater()
- : m_prepareCount(0)
- , m_updateCount(0)
- , m_prepareRectCount(0)
- {
- }
- virtual ~FakeLayerTextureUpdater() { }
-
- // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next
- // call to prepareToUpdate() the rect is reset.
- void setRectToInvalidate(const IntRect&, FakeTiledLayerChromium*);
-
- // Number of times prepareToUpdate has been invoked.
- int prepareCount() const { return m_prepareCount; }
- void clearPrepareCount() { m_prepareCount = 0; }
-
- // Number of times updateRect has been invoked.
- int updateCount() const { return m_updateCount; }
- void clearUpdateCount() { m_updateCount = 0; }
- void updateRect() { m_updateCount++; }
-
- // Number of times prepareRect() has been invoked on a texture.
- int prepareRectCount() const { return m_prepareRectCount; }
- void clearPrepareRectCount() { m_prepareRectCount = 0; }
- void prepareRect() { m_prepareRectCount++; }
-
- void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; }
-
- // Last rect passed to prepareToUpdate().
- const IntRect& lastUpdateRect() const { return m_lastUpdateRect; }
-
- virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(this, ManagedTexture::create(manager))); }
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect);
-
-private:
- int m_prepareCount;
- int m_updateCount;
- int m_prepareRectCount;
- IntRect m_rectToInvalidate;
- IntRect m_lastUpdateRect;
- IntRect m_opaquePaintRect;
- RefPtr<FakeTiledLayerChromium> m_layer;
-};
-
-class FakeCCTiledLayerImpl : public CCTiledLayerImpl {
-public:
- explicit FakeCCTiledLayerImpl(int id)
- : CCTiledLayerImpl(id) { }
- virtual ~FakeCCTiledLayerImpl() { }
-
- bool hasTileAt(int i, int j)
+ TestCCOcclusionTracker()
+ : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true)
+ , m_scissorRectInScreen(IntRect(0, 0, 1000, 1000))
{
- return CCTiledLayerImpl::hasTileAt(i, j);
+ // Pretend we have visited a render surface.
+ m_stack.append(StackObject());
}
-};
-class FakeTiledLayerChromium : public TiledLayerChromium {
-public:
- explicit FakeTiledLayerChromium(TextureManager* textureManager)
- : TiledLayerChromium()
- , m_fakeTextureUpdater(adoptRef(new FakeLayerTextureUpdater))
- , m_textureManager(textureManager)
- {
- setTileSize(IntSize(100, 100));
- setTextureFormat(GraphicsContext3D::RGBA);
- setBorderTexelOption(CCLayerTilingData::NoBorderTexels);
- setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons.
- }
- virtual ~FakeTiledLayerChromium() { }
+ void setOcclusion(const Region& occlusion) { m_stack.last().occlusionInScreen = occlusion; }
- void invalidateRect(const IntRect& rect)
- {
- TiledLayerChromium::invalidateRect(rect);
- }
-
- void prepareToUpdate(const IntRect& rect, const Region& occluded)
- {
- TiledLayerChromium::prepareToUpdate(rect, occluded);
- }
-
- void prepareToUpdateIdle(const IntRect& rect, const Region& occluded)
- {
- TiledLayerChromium::prepareToUpdateIdle(rect, occluded);
- }
-
- bool needsIdlePaint(const IntRect& rect)
- {
- return TiledLayerChromium::needsIdlePaint(rect);
- }
-
- bool skipsDraw() const
- {
- return TiledLayerChromium::skipsDraw();
- }
-
- virtual void setNeedsDisplayRect(const FloatRect& rect)
- {
- m_lastNeedsDisplayRect = rect;
- TiledLayerChromium::setNeedsDisplayRect(rect);
- }
-
- const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
-
- FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpdater.get(); }
-
- virtual TextureManager* textureManager() const { return m_textureManager; }
-
- virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
- {
- prepareToUpdate(visibleLayerRect(), occludedScreenSpace);
- }
+protected:
+ virtual IntRect layerScissorRectInTargetSurface(const LayerChromium* layer) const { return m_scissorRectInScreen; }
private:
- virtual LayerTextureUpdater* textureUpdater() const
- {
- return m_fakeTextureUpdater.get();
- }
-
- virtual void createTextureUpdaterIfNeeded() { }
-
- RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater;
- TextureManager* m_textureManager;
- FloatRect m_lastNeedsDisplayRect;
+ IntRect m_scissorRectInScreen;
};
-class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium {
-public:
- explicit FakeTiledLayerWithScaledBounds(TextureManager* textureManager)
- : FakeTiledLayerChromium(textureManager)
- {
- }
-
- void setContentBounds(const IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }
- virtual IntSize contentBounds() const { return m_forcedContentBounds; }
-
- FloatRect updateRect() { return m_updateRect; }
-
-protected:
- IntSize m_forcedContentBounds;
-};
-
-void FakeLayerTextureUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayerChromium* layer)
-{
- m_rectToInvalidate = rect;
- m_layer = layer;
-}
-
-void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect)
-{
- m_prepareCount++;
- m_lastUpdateRect = contentRect;
- if (!m_rectToInvalidate.isEmpty()) {
- m_layer->invalidateRect(m_rectToInvalidate);
- m_rectToInvalidate = IntRect();
- m_layer = 0;
- }
- *resultingOpaqueRect = m_opaquePaintRect;
-}
-
TEST(TiledLayerChromiumTest, pushDirtyTiles)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- Region noOcclusion;
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
// 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->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
layer->pushPropertiesTo(layerImpl.get());
// We should have both tiles on the impl side.
@@ -261,8 +89,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles)
// Invalidates both tiles...
layer->invalidateRect(IntRect(0, 0, 100, 200));
// ....but then only update one of them.
- layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
layer->pushPropertiesTo(layerImpl.get());
// We should only have the first tile since the other tile was invalidated but not painted.
@@ -276,18 +103,22 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- Region noOcclusion;
+ TestCCOcclusionTracker occluded;
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(IntSize(100, 200));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
+ layer->setVisibleLayerRect(IntRect(0, 0, 100, 200));
layer->invalidateRect(IntRect(0, 0, 100, 200));
- layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded);
layer->pushPropertiesTo(layerImpl.get());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
// We should have both tiles on the impl side.
EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
@@ -297,16 +128,59 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
// Invalidates part of the top tile...
layer->invalidateRect(IntRect(0, 0, 50, 50));
// ....but the area is occluded.
- Region occlusion(IntRect(0, 0, 50, 50));
- layer->prepareToUpdate(IntRect(0, 0, 100, 100), occlusion);
- layer->updateCompositorResources(0, updater);
+ occluded.setOcclusion(IntRect(0, 0, 50, 50));
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);
layer->pushPropertiesTo(layerImpl.get());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 2500, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
// We should still have both tiles, as part of the top tile is still unoccluded.
EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
}
+TEST(TiledLayerChromiumTest, pushDeletedTiles)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ CCTextureUpdater updater;
+ FakeTextureAllocator allocator;
+
+ // 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);
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should have both tiles on the impl side.
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
+
+ textureManager->evictAndDeleteAllTextures(&allocator);
+ textureManager->setMaxMemoryLimitBytes(4*1024*1024);
+ textureManager->setPreferredMemoryLimitBytes(4*1024*1024);
+
+ // This should drop the tiles on the impl thread.
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should now have no textures on the impl thread.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+
+ // This should recreate and update the deleted textures.
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should only have the first tile since the other tile was invalidated but not painted.
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
+}
+
TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
@@ -314,25 +188,22 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
IntSize contentBounds(500, 500);
IntRect contentRect(IntPoint::zero(), contentBounds);
IntRect visibleRect(200, 200, 100, 100);
- Region noOcclusion;
// This invalidates 25 tiles and then paints one visible tile.
layer->setBounds(contentBounds);
layer->setVisibleLayerRect(visibleRect);
layer->invalidateRect(contentRect);
- layer->prepareToUpdate(visibleRect, noOcclusion);
+ layer->updateLayerRect(updater, visibleRect, 0);
// We should need idle-painting for 3x3 tiles in the center.
EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
- layer->updateCompositorResources(0, updater);
layer->pushPropertiesTo(layerImpl.get());
// We should have one tile on the impl side.
@@ -342,10 +213,9 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
// For the next four updates, we should detect we still need idle painting.
for (int i = 0; i < 4; i++) {
- layer->prepareToUpdate(visibleRect, noOcclusion);
+ layer->updateLayerRect(updater, visibleRect, 0);
EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
- layer->prepareToUpdateIdle(visibleRect, noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->idleUpdateLayerRect(updater, visibleRect, 0);
layer->pushPropertiesTo(layerImpl.get());
textureManager->unprotectAllTextures();
}
@@ -365,6 +235,109 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
}
}
+TEST(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(1024*1024, 1024*1024, 1024);
+ DebugScopedSetImplThread implThread;
+ RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ CCTextureUpdater updater;
+ FakeTextureAllocator allocator;
+ FakeTextureCopier copier;
+ FakeTextureUploader uploader;
+
+ // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
+ // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint
+ // layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state.
+
+ // This requires 4*30000 bytes of memory.
+ IntRect layer2Rect(0, 0, 100, 300);
+ layer2->setBounds(layer2Rect.size());
+ layer2->setVisibleLayerRect(layer2Rect);
+ layer2->invalidateRect(layer2Rect);
+
+ // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
+ IntRect layerRect(IntPoint::zero(), IntSize(100, 2400));
+ layer1->setBounds(layerRect.size());
+ layer1->setVisibleLayerRect(layerRect);
+ layer1->invalidateRect(layerRect);
+ layer1->updateLayerRect(updater, layerRect, 0);
+
+ // Paint a single tile in layer2 so that it will idle paint.
+ layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
+
+ // We should need idle-painting for both remaining tiles in layer2.
+ EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect));
+
+ // Commit the frame over to impl.
+ updater.update(0, &allocator, &copier, &uploader, 5000);
+ layer1->pushPropertiesTo(layerImpl1.get());
+ layer2->pushPropertiesTo(layerImpl2.get());
+
+ // Now idle paint layer2. We are going to run out of memory though!
+ layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
+ layer2->idleUpdateLayerRect(updater, layer2Rect, 0);
+
+ // Oh well, commit the frame and push.
+ updater.update(0, &allocator, &copier, &uploader, 5000);
+ layer1->pushPropertiesTo(layerImpl1.get());
+ layer2->pushPropertiesTo(layerImpl2.get());
+
+ // Sanity check, we should have textures for the big layer.
+ EXPECT_TRUE(layerImpl1->hasTextureIdForTileAt(0, 0));
+
+ // We should only have the first tile from layer2 since it failed to idle update.
+ EXPECT_TRUE(layerImpl2->hasTileAt(0, 0));
+ EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
+ EXPECT_FALSE(layerImpl2->hasTileAt(0, 1));
+ EXPECT_FALSE(layerImpl2->hasTileAt(0, 2));
+
+ // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures.
+ textureManager->unprotectAllTextures();
+
+ layer2->updateLayerRect(updater, layer2Rect, 0);
+ layer1->updateLayerRect(updater, IntRect(), 0);
+
+ updater.update(0, &allocator, &copier, &uploader, 5000);
+ layer1->pushPropertiesTo(layerImpl1.get());
+ layer2->pushPropertiesTo(layerImpl2.get());
+
+ EXPECT_TRUE(layerImpl2->hasTileAt(0, 0));
+ EXPECT_TRUE(layerImpl2->hasTileAt(0, 1));
+ EXPECT_TRUE(layerImpl2->hasTileAt(0, 2));
+ EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
+ EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 1));
+ EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 2));
+}
+
+TEST(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ TestCCOcclusionTracker occluded;
+
+ CCTextureUpdater updater;
+
+ // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
+ occluded.setOcclusion(IntRect(0, 0, 100, 100));
+
+ layer->setBounds(IntSize(100, 100));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
+ layer->setVisibleLayerRect(IntRect(0, 0, 100, 100));
+ layer->invalidateRect(IntRect(0, 0, 100, 100));
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);
+ layer->idleUpdateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should have the prepainted tile on the impl side.
+ EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
+}
+
TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
@@ -372,9 +345,7 @@ TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
- Region noOcclusion;
+ CCTextureUpdater updater;
// The tile size is 100x100, so this invalidates and then paints two tiles.
// However, during the paint, we invalidate one of the tiles. This should
@@ -382,8 +353,7 @@ TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
layer->setBounds(IntSize(100, 200));
layer->invalidateRect(IntRect(0, 0, 100, 200));
layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
- layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
layer->pushPropertiesTo(layerImpl.get());
// We should have both tiles on the impl side.
@@ -400,23 +370,18 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
- Region noOcclusion;
+ CCTextureUpdater updater;
layer1->setBounds(IntSize(100, 200));
layer1->invalidateRect(IntRect(0, 0, 100, 200));
layer2->setBounds(IntSize(100, 200));
layer2->invalidateRect(IntRect(0, 0, 100, 200));
- layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+ layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
// Invalidate a tile on layer1
layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
- layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
-
- layer1->updateCompositorResources(0, updater);
- layer2->updateCompositorResources(0, updater);
+ layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
layer1->pushPropertiesTo(layer1Impl.get());
layer2->pushPropertiesTo(layer2Impl.get());
@@ -437,9 +402,7 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
- Region noOcclusion;
+ CCTextureUpdater updater;
layer1->setBounds(IntSize(100, 200));
layer1->invalidateRect(IntRect(0, 0, 100, 200));
@@ -448,12 +411,9 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer
// Invalidate a tile on layer2
layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
- layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+ layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
- layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
-
- layer1->updateCompositorResources(0, updater);
- layer2->updateCompositorResources(0, updater);
+ layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
layer1->pushPropertiesTo(layer1Impl.get());
layer2->pushPropertiesTo(layer2Impl.get());
@@ -471,7 +431,6 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
IntSize contentBounds(300, 300);
IntRect contentRect(IntPoint::zero(), contentBounds);
IntRect visibleRect(100, 100, 100, 100);
- Region noOcclusion;
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
int memoryLimit = 4 * 100 * 100; // 2 tiles, 4 bytes per pixel.
@@ -481,51 +440,243 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
// This invalidates 9 tiles and then paints one visible tile.
layer->setBounds(contentBounds);
layer->setVisibleLayerRect(visibleRect);
layer->invalidateRect(contentRect);
- layer->prepareToUpdate(visibleRect, noOcclusion);
+ layer->updateLayerRect(updater, visibleRect, 0);
// We should need idle-painting for 3x3 tiles surounding visible tile.
EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
- layer->updateCompositorResources(0, updater);
layer->pushPropertiesTo(layerImpl.get());
// We should have one tile on the impl side.
EXPECT_TRUE(layerImpl->hasTileAt(1, 1));
textureManager->unprotectAllTextures();
- layer->prepareToUpdate(visibleRect, noOcclusion);
- layer->prepareToUpdateIdle(visibleRect, noOcclusion);
+ layer->updateLayerRect(updater, visibleRect, 0);
+ layer->idleUpdateLayerRect(updater, visibleRect, 0);
// We shouldn't signal we need another idle paint after we run out of memory.
EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
- layer->updateCompositorResources(0, updater);
layer->pushPropertiesTo(layerImpl.get());
}
+TEST(TiledLayerChromiumTest, idlePaintZeroSizedLayer)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(20000, 10000, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ CCTextureUpdater updater;
+
+ // The layer's bounds are empty.
+ IntRect contentRect;
+
+ layer->setBounds(contentRect.size());
+ layer->setVisibleLayerRect(contentRect);
+ layer->invalidateRect(contentRect);
+ layer->updateLayerRect(updater, contentRect, 0);
+
+ // Empty layers don't have tiles.
+ EXPECT_EQ(0u, layer->numPaintedTiles());
+
+ // Empty layers don't need prepaint.
+ EXPECT_FALSE(layer->needsIdlePaint(contentRect));
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // Empty layers don't have tiles.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+
+ // Non-visible layers don't idle paint.
+ layer->idleUpdateLayerRect(updater, contentRect, 0);
+
+ // Empty layers don't have tiles.
+ EXPECT_EQ(0u, layer->numPaintedTiles());
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // Empty layers don't have tiles.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+}
+
+TEST(TiledLayerChromiumTest, idlePaintZeroSizedAnimatingLayer)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(20000, 10000, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ CCTextureUpdater updater;
+
+ // Pretend the layer is animating.
+ layer->setDrawTransformIsAnimating(true);
+
+ // The layer's bounds are empty.
+ IntRect contentRect;
+
+ layer->setBounds(contentRect.size());
+ layer->setVisibleLayerRect(contentRect);
+ layer->invalidateRect(contentRect);
+ layer->updateLayerRect(updater, contentRect, 0);
+
+ // Empty layers don't have tiles.
+ EXPECT_EQ(0u, layer->numPaintedTiles());
+
+ // Empty layers don't need prepaint.
+ EXPECT_FALSE(layer->needsIdlePaint(contentRect));
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // Empty layers don't have tiles.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+
+ // Non-visible layers don't idle paint.
+ layer->idleUpdateLayerRect(updater, contentRect, 0);
+
+ // Empty layers don't have tiles.
+ EXPECT_EQ(0u, layer->numPaintedTiles());
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // Empty layers don't have tiles.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+}
+
+TEST(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
+{
+ IntSize contentBounds(100, 100);
+ IntRect contentRect(IntPoint::zero(), contentBounds);
+
+ OwnPtr<TextureManager> textureManager = TextureManager::create(20000, 10000, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ CCTextureUpdater updater;
+
+ // Invalidate the layer but make none of it visible, so nothing paints.
+ IntRect visibleRect;
+
+ layer->setBounds(contentBounds);
+ layer->setVisibleLayerRect(visibleRect);
+ layer->invalidateRect(contentRect);
+ layer->updateLayerRect(updater, visibleRect, 0);
+
+ // Non-visible layers don't need idle paint.
+ EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should not have any tiles pushed since the layer is not visible.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+
+ // Non-visible layers don't idle paint.
+ layer->idleUpdateLayerRect(updater, visibleRect, 0);
+
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should not have any tiles pushed since the layer is not visible.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+}
+
+static void idlePaintRepeat(int repeatTimes, FakeTiledLayerChromium* layer, FakeCCTiledLayerImpl* layerImpl, CCTextureUpdater& updater, const IntRect& visibleRect)
+{
+ for (int i = 0; i < repeatTimes; ++i) {
+ layer->updateLayerRect(updater, visibleRect, 0);
+ layer->idleUpdateLayerRect(updater, visibleRect, 0);
+ layer->pushPropertiesTo(layerImpl);
+ }
+}
+
+static void testHaveOuterTiles(FakeCCTiledLayerImpl* layerImpl, int width, int height, int have)
+{
+ for (int i = 0; i < width; ++i) {
+ for (int j = 0; j < height; ++j) {
+ bool hasTile = i < have || j < have || i >= width - have || j >= height - have;
+ EXPECT_EQ(hasTile, layerImpl->hasTileAt(i, j));
+ }
+ }
+}
+
+TEST(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(8000*8000*8, 8000*8000*4, 1024);
+ DebugScopedSetImplThread implThread;
+
+ CCTextureUpdater updater;
+
+ int tileWidth = FakeTiledLayerChromium::tileSize().width();
+ int tileHeight = FakeTiledLayerChromium::tileSize().height();
+ int width[] = { 1, 2, 3, 4, 9, 10, 0 };
+ int height[] = { 1, 2, 3, 4, 9, 10, 0 };
+
+ for (int j = 0; height[j]; ++j) {
+ for (int i = 0; width[i]; ++i) {
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+
+ // Pretend the layer is animating.
+ layer->setDrawTransformIsAnimating(true);
+
+ IntSize contentBounds(width[i] * tileWidth, height[j] * tileHeight);
+ IntRect contentRect(IntPoint::zero(), contentBounds);
+ IntRect visibleRect;
+
+ layer->setBounds(contentBounds);
+ layer->setVisibleLayerRect(visibleRect);
+ layer->invalidateRect(contentRect);
+
+ // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise,
+ // we shoud paint nothing.
+ bool shouldPrepaint = !layer->idlePaintRect(visibleRect).isEmpty();
+
+ // This paints the layer but there's nothing visible so it's a no-op.
+ layer->updateLayerRect(updater, visibleRect, 0);
+ layer->pushPropertiesTo(layerImpl.get());
+
+ // We should not have any tiles pushed yet since the layer is not visible and we've not prepainted.
+ testHaveOuterTiles(layerImpl.get(), width[i], height[j], 0);
+
+ // Normally we don't allow non-visible layers to pre-paint, but if they are animating then we should.
+ EXPECT_EQ(shouldPrepaint, layer->needsIdlePaint(visibleRect));
+
+ // If the layer is to be prepainted at all, then after four updates we should have the outer row/columns painted.
+ idlePaintRepeat(4, layer.get(), layerImpl.get(), updater, visibleRect);
+ testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0);
+
+ // We don't currently idle paint past the outermost tiles.
+ EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
+ idlePaintRepeat(4, layer.get(), layerImpl.get(), updater, visibleRect);
+ testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0);
+ }
+ }
+}
+
TEST(TiledLayerChromiumTest, invalidateFromPrepare)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- Region noOcclusion;
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
+ FakeTextureAllocator fakeAllocator;
+ FakeTextureCopier fakeCopier;
+ FakeTextureUploader fakeUploader;
+ RefPtr<GraphicsContext3D> context = createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes());
// 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->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
+ updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
layer->pushPropertiesTo(layerImpl.get());
// We should have both tiles on the impl side.
@@ -535,20 +686,23 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
textureManager->unprotectAllTextures();
layer->fakeLayerTextureUpdater()->clearPrepareCount();
- // Invoke prepareToUpdate again. As the layer is valid prepareToUpdate shouldn't be invoked on
+ // Invoke updateLayerRect again. As the layer is valid updateLayerRect shouldn't be invoked on
// the LayerTextureUpdater.
- layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
+ updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount());
layer->invalidateRect(IntRect(0, 0, 50, 50));
- // setRectToInvalidate triggers invalidateRect() being invoked from prepareToUpdate.
+ // setRectToInvalidate triggers invalidateRect() being invoked from updateLayerRect.
layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
layer->fakeLayerTextureUpdater()->clearPrepareCount();
- layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
+ updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
layer->fakeLayerTextureUpdater()->clearPrepareCount();
- // The layer should still be invalid as prepareToUpdate invoked invalidate.
- layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+ // 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);
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
}
@@ -559,10 +713,8 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get()));
- Region noOcclusion;
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
IntRect layerBounds(0, 0, 300, 200);
IntRect contentBounds(0, 0, 200, 250);
@@ -574,21 +726,18 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
// On first update, the updateRect includes all tiles, even beyond the boundaries of the layer.
// However, it should still be in layer space, not content space.
layer->invalidateRect(contentBounds);
- layer->prepareToUpdate(contentBounds, noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, contentBounds, 0);
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
layer->invalidateRect(contentBounds);
- layer->prepareToUpdate(contentBounds, noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, contentBounds, 0);
EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
// Partial re-paint should also be represented by the updateRect in layer space, not content space.
IntRect partialDamage(30, 100, 10, 10);
layer->invalidateRect(partialDamage);
- layer->prepareToUpdate(contentBounds, noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, contentBounds, 0);
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
}
@@ -599,9 +748,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
- Region noOcclusion;
+ CCTextureUpdater updater;
// Create a layer with one tile.
layer->setBounds(IntSize(100, 100));
@@ -611,8 +758,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
// Push the tiles to the impl side and check that there is exactly one.
- layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
layer->pushPropertiesTo(layerImpl.get());
EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
@@ -625,8 +771,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
// The impl side should get 2x2 tiles now.
- layer->prepareToUpdate(IntRect(0, 0, 200, 200), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(0, 0, 200, 200), 0);
layer->pushPropertiesTo(layerImpl.get());
EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
@@ -636,8 +781,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
// Invalidate the entire layer again, but do not paint. All tiles should be gone now from the
// impl side.
layer->setNeedsDisplay();
- layer->prepareToUpdate(IntRect(0, 0, 0, 0), noOcclusion);
- layer->updateCompositorResources(0, updater);
+ layer->updateLayerRect(updater, IntRect(1, 0, 0, 1), 0);
layer->pushPropertiesTo(layerImpl.get());
EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
@@ -650,7 +794,7 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
- RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
+ OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCSettings());
// Create two 300 x 300 tiled layers.
IntSize contentBounds(300, 300);
@@ -671,14 +815,12 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
rootLayer->invalidateRect(contentRect);
childLayer->invalidateRect(contentRect);
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
ccLayerTreeHost->setRootLayer(rootLayer);
ccLayerTreeHost->setViewportSize(IntSize(300, 300));
textureManager->setMaxMemoryLimitBytes(memoryLimit);
- ccLayerTreeHost->updateLayers();
- ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater);
+ ccLayerTreeHost->updateLayers(updater);
// We'll skip the root layer.
EXPECT_TRUE(rootLayer->skipsDraw());
@@ -690,7 +832,7 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
// Remove the child layer.
rootLayer->removeAllChildren();
- ccLayerTreeHost->updateLayers();
+ ccLayerTreeHost->updateLayers(updater);
EXPECT_FALSE(rootLayer->skipsDraw());
ccLayerTreeHost->setRootLayer(0);
@@ -702,16 +844,30 @@ TEST(TiledLayerChromiumTest, resizeToSmaller)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region noOcclusion;
+ CCTextureUpdater updater;
layer->setBounds(IntSize(700, 700));
layer->invalidateRect(IntRect(0, 0, 700, 700));
- layer->prepareToUpdate(IntRect(0, 0, 700, 700), noOcclusion);
+ layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0);
layer->setBounds(IntSize(200, 200));
layer->invalidateRect(IntRect(0, 0, 200, 200));
}
+TEST(TiledLayerChromiumTest, hugeLayerUpdateCrash)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ CCTextureUpdater updater;
+
+ int size = 1 << 30;
+ layer->setBounds(IntSize(size, size));
+ layer->invalidateRect(IntRect(0, 0, size, size));
+
+ // Ensure no crash for bounds where size * size would overflow an int.
+ layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0);
+}
+
TEST(TiledLayerChromiumTest, partialUpdates)
{
CCSettings settings;
@@ -719,7 +875,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
- RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
+ OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
// Create one 500 x 300 tiled layer.
IntSize contentBounds(300, 200);
@@ -731,51 +887,92 @@ TEST(TiledLayerChromiumTest, partialUpdates)
layer->setPosition(FloatPoint(150, 150));
layer->invalidateRect(contentRect);
- FakeTextureAllocator textureAllocator;
- CCTextureUpdater updater(&textureAllocator);
+ CCTextureUpdater updater;
+ FakeTextureAllocator allocator;
+ FakeTextureCopier copier;
+ FakeTextureUploader uploader;
ccLayerTreeHost->setRootLayer(layer);
ccLayerTreeHost->setViewportSize(IntSize(300, 200));
// Full update of all 6 tiles.
- ccLayerTreeHost->updateLayers();
- ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater);
- updater.update(0, 4);
- EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_TRUE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
- updater.update(0, 4);
- EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_FALSE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ ccLayerTreeHost->updateLayers(updater);
+ {
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_TRUE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_FALSE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ layer->pushPropertiesTo(layerImpl.get());
+ }
ccLayerTreeHost->commitComplete();
// Full update of 3 tiles and partial update of 3 tiles.
layer->invalidateRect(IntRect(0, 0, 300, 150));
- ccLayerTreeHost->updateLayers();
- ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater);
- updater.update(0, 4);
- EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_TRUE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
- updater.update(0, 4);
- EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_FALSE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ ccLayerTreeHost->updateLayers(updater);
+ {
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_TRUE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_FALSE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ layer->pushPropertiesTo(layerImpl.get());
+ }
ccLayerTreeHost->commitComplete();
// Partial update of 6 tiles.
layer->invalidateRect(IntRect(50, 50, 200, 100));
- ccLayerTreeHost->updateLayers();
- ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater);
- updater.update(0, 4);
- EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_TRUE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
- updater.update(0, 4);
- EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
- EXPECT_FALSE(updater.hasMoreUpdates());
- layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ {
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ ccLayerTreeHost->updateLayers(updater);
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_TRUE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_FALSE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ layer->pushPropertiesTo(layerImpl.get());
+ }
+ ccLayerTreeHost->commitComplete();
+
+ // Checkerboard all tiles.
+ layer->invalidateRect(IntRect(0, 0, 300, 200));
+ {
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ layer->pushPropertiesTo(layerImpl.get());
+ }
+ ccLayerTreeHost->commitComplete();
+
+ // Partail update of 6 checkerboard tiles.
+ layer->invalidateRect(IntRect(50, 50, 200, 100));
+ {
+ DebugScopedSetImplThread implThread;
+ OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+ ccLayerTreeHost->updateLayers(updater);
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_TRUE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ updater.update(0, &allocator, &copier, &uploader, 4);
+ EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
+ EXPECT_FALSE(updater.hasMoreUpdates());
+ layer->fakeLayerTextureUpdater()->clearUpdateCount();
+ layer->pushPropertiesTo(layerImpl.get());
+ }
ccLayerTreeHost->commitComplete();
ccLayerTreeHost->setRootLayer(0);
@@ -787,13 +984,13 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ CCTextureUpdater updater;
// 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->prepareToUpdate(IntRect(0, 0, 100, 200), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount());
}
@@ -801,97 +998,137 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100.
layer->setBounds(IntSize(600, 600));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
- occluded = IntRect(200, 200, 300, 100);
+ occluded.setOcclusion(IntRect(200, 200, 300, 100));
layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1);
+ EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload());
+
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
- occluded = IntRect(250, 200, 300, 100);
+ occluded.setOcclusion(IntRect(250, 200, 300, 100));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000 + 340000, 1);
+ EXPECT_EQ(3 + 2, occluded.overdrawMetrics().tilesCulledForUpload());
+
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
- occluded = IntRect(250, 250, 300, 100);
+ occluded.setOcclusion(IntRect(250, 250, 300, 100));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000 + 340000 + 360000, 1);
+ EXPECT_EQ(3 + 2, occluded.overdrawMetrics().tilesCulledForUpload());
}
TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100.
layer->setBounds(IntSize(600, 600));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
// The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled.
- occluded = IntRect(200, 200, 300, 150);
+ occluded.setOcclusion(IntRect(200, 200, 300, 150));
layer->setVisibleLayerRect(IntRect(0, 0, 600, 360));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
- EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 360), &occluded);
+ EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 210000, 1);
+ EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload());
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
// Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded.
- occluded = IntRect(200, 200, 300, 150);
+ occluded.setOcclusion(IntRect(200, 200, 300, 150));
layer->setVisibleLayerRect(IntRect(0, 0, 600, 350));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
- EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 350), &occluded);
+ EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 210000 + 180000, 1);
+ EXPECT_EQ(3 + 6, occluded.overdrawMetrics().tilesCulledForUpload());
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
// Now the visible region is even smaller than the occlusion, it should have the same result.
- occluded = IntRect(200, 200, 300, 150);
+ occluded.setOcclusion(IntRect(200, 200, 300, 150));
layer->setVisibleLayerRect(IntRect(0, 0, 600, 340));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
- EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 340), &occluded);
+ EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 210000 + 180000 + 180000, 1);
+ EXPECT_EQ(3 + 6 + 6, occluded.overdrawMetrics().tilesCulledForUpload());
+
}
TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100.
layer->setBounds(IntSize(600, 600));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
- occluded = IntRect(200, 200, 300, 100);
+ occluded.setOcclusion(IntRect(200, 200, 300, 100));
layer->setVisibleLayerRect(IntRect(0, 0, 600, 600));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1);
+ EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload());
+
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
- // Repaint without marking it dirty.
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ // Repaint without marking it dirty. The culled tiles remained dirty.
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1);
+ EXPECT_EQ(6, occluded.overdrawMetrics().tilesCulledForUpload());
}
TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100.
@@ -901,19 +1138,25 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
TransformationMatrix screenTransform;
screenTransform.scale(0.5);
layer->setScreenSpaceTransform(screenTransform);
+ layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
- occluded = IntRect(100, 100, 150, 50);
+ occluded.setOcclusion(IntRect(100, 100, 150, 50));
layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1);
+ EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload());
}
TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- Region occluded;
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100.
@@ -922,99 +1165,196 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
// pixels, which means none should be occluded.
layer->setContentsScale(0.5);
layer->setBounds(IntSize(600, 600));
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
- occluded = IntRect(200, 200, 300, 100);
+ occluded.setOcclusion(IntRect(200, 200, 300, 100));
layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
// The content is half the size of the layer (so the number of tiles is fewer).
// In this case, the content is 300x300, and since the tile size is 100, the
// number of tiles 3x3.
EXPECT_EQ(9, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 90000, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
// This makes sure the painting works when the content space is scaled to
// a different layer space. In this case the occluded region catches the
// blown up tiles.
- occluded = IntRect(200, 200, 300, 200);
+ occluded.setOcclusion(IntRect(200, 200, 300, 200));
layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 90000 + 80000, 1);
+ EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload());
+
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
// This makes sure content scaling and transforms work together.
TransformationMatrix screenTransform;
screenTransform.scale(0.5);
layer->setScreenSpaceTransform(screenTransform);
+ layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
- occluded = IntRect(100, 100, 150, 100);
+ occluded.setOcclusion(IntRect(100, 100, 150, 100));
layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
layer->invalidateRect(IntRect(0, 0, 600, 600));
- layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+ layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 90000 + 80000 + 80000, 1);
+ EXPECT_EQ(1 + 1, occluded.overdrawMetrics().tilesCulledForUpload());
}
-TEST(TiledLayerChromiumTest, opaqueContentsRegion)
+TEST(TiledLayerChromiumTest, visibleContentOpaqueRegion)
{
OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
IntRect opaquePaintRect;
Region opaqueContents;
- Region noOcclusion;
IntRect contentBounds = IntRect(0, 0, 100, 200);
IntRect visibleBounds = IntRect(0, 0, 100, 150);
layer->setBounds(contentBounds.size());
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
layer->setVisibleLayerRect(visibleBounds);
layer->setDrawOpacity(1);
- // If the layer doesn't paint opaque content, then the opaqueContentsRegion should be empty.
- layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
+ // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
+ layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
layer->invalidateRect(contentBounds);
- layer->prepareToUpdate(contentBounds, noOcclusion);
- opaqueContents = layer->opaqueContentsRegion();
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
EXPECT_TRUE(opaqueContents.isEmpty());
- // opaqueContentsRegion should match the visible part of what is painted opaque.
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
+ // visibleContentOpaqueRegion should match the visible part of what is painted opaque.
opaquePaintRect = IntRect(10, 10, 90, 190);
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
layer->invalidateRect(contentBounds);
- layer->prepareToUpdate(contentBounds, noOcclusion);
- opaqueContents = layer->opaqueContentsRegion();
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
// If we paint again without invalidating, the same stuff should be opaque.
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
- layer->prepareToUpdate(contentBounds, noOcclusion);
- opaqueContents = layer->opaqueContentsRegion();
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
// If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should
// not be affected.
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
layer->invalidateRect(IntRect(0, 0, 1, 1));
- layer->prepareToUpdate(contentBounds, noOcclusion);
- opaqueContents = layer->opaqueContentsRegion();
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
// If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still
// not be affected.
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
layer->invalidateRect(IntRect(10, 10, 1, 1));
- layer->prepareToUpdate(contentBounds, noOcclusion);
- opaqueContents = layer->opaqueContentsRegion();
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1 + 1, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
+ // No metrics are recorded in prepaint, so the values should not change from above.
+ layer->idleUpdateLayerRect(updater, contentBounds, &occluded);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1 + 1, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+}
+
+TEST(TiledLayerChromiumTest, pixelsPaintedMetrics)
+{
+ OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
+ RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+ TestCCOcclusionTracker occluded;
+ CCTextureUpdater updater;
+
+ // The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
+
+ IntRect opaquePaintRect;
+ Region opaqueContents;
+
+ IntRect contentBounds = IntRect(0, 0, 100, 300);
+ IntRect visibleBounds = IntRect(0, 0, 100, 300);
+
+ layer->setBounds(contentBounds.size());
+ layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
+ layer->setVisibleLayerRect(visibleBounds);
+ layer->setDrawOpacity(1);
+
+ // Invalidates and paints the whole layer.
+ layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
+ layer->invalidateRect(contentBounds);
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
+ EXPECT_TRUE(opaqueContents.isEmpty());
+
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 30000, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 30000, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
+
+ // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle,
+ // even though it is not dirty and will not be uploaded.
+ layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
+ layer->invalidateRect(IntRect(0, 0, 1, 1));
+ layer->invalidateRect(IntRect(50, 200, 10, 10));
+ layer->updateLayerRect(updater, contentBounds, &occluded);
+ opaqueContents = layer->visibleContentOpaqueRegion();
+ EXPECT_TRUE(opaqueContents.isEmpty());
+
+ // The middle tile was painted even though not invalidated.
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 30000 + 60 * 210, 1);
+ // The pixels uploaded will not include the non-invalidated tile in the middle.
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
+ EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 30000 + 1 + 100, 1);
+ EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/TilingDataTest.cpp b/Source/WebKit/chromium/tests/TilingDataTest.cpp
index c29743f86..47c0361ea 100755
--- a/Source/WebKit/chromium/tests/TilingDataTest.cpp
+++ b/Source/WebKit/chromium/tests/TilingDataTest.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "TilingData.h"
+#include <wtf/Assertions.h>
#include <gtest/gtest.h>
@@ -38,385 +39,406 @@ using namespace WebCore;
namespace {
+class TestTiling : public TilingData {
+public:
+ TestTiling(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels)
+ : TilingData(maxTextureSize, totalSizeX, totalSizeY, hasBorderTexels)
+ {
+ }
+
+ // This function only available for testing because of potential overflow.
+ int numTiles() const
+ {
+ int numTiles = numTilesX() * numTilesY();
+
+ // Assert no overflow.
+ EXPECT_GE(numTiles, 0);
+ if (numTiles > 0)
+ EXPECT_EQ(numTiles / numTilesX(), numTilesY());
+
+ return numTiles;
+ }
+};
+
TEST(TilingDataTest, numTiles_NoTiling)
{
- EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles());
- EXPECT_EQ(1, TilingData(16, 15, 15, true).numTiles());
- EXPECT_EQ(1, TilingData(16, 16, 16, true).numTiles());
- EXPECT_EQ(1, TilingData(16, 1, 16, false).numTiles());
- EXPECT_EQ(1, TilingData(15, 15, 15, true).numTiles());
+ EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles());
+ EXPECT_EQ(1, TestTiling(16, 15, 15, true).numTiles());
+ EXPECT_EQ(1, TestTiling(16, 16, 16, true).numTiles());
+ EXPECT_EQ(1, TestTiling(16, 1, 16, false).numTiles());
+ EXPECT_EQ(1, TestTiling(15, 15, 15, true).numTiles());
}
TEST(TilingDataTest, numTiles_TilingNoBorders)
{
- EXPECT_EQ(0, TilingData(0, 0, 0, false).numTiles());
- EXPECT_EQ(0, TilingData(0, 4, 0, false).numTiles());
- EXPECT_EQ(0, TilingData(0, 0, 4, false).numTiles());
- EXPECT_EQ(0, TilingData(4, 4, 0, false).numTiles());
- EXPECT_EQ(0, TilingData(4, 0, 4, false).numTiles());
- EXPECT_EQ(0, TilingData(-8, 1, 1, false).numTiles());
- EXPECT_EQ(0, TilingData(-1, 1, 1, false).numTiles());
- EXPECT_EQ(0, TilingData(0, 1, 1, false).numTiles());
-
- EXPECT_EQ(1, TilingData(1, 1, 1, false).numTiles());
- EXPECT_EQ(2, TilingData(1, 1, 2, false).numTiles());
- EXPECT_EQ(2, TilingData(1, 2, 1, false).numTiles());
- EXPECT_EQ(1, TilingData(2, 1, 1, false).numTiles());
- EXPECT_EQ(1, TilingData(2, 1, 2, false).numTiles());
- EXPECT_EQ(1, TilingData(2, 2, 1, false).numTiles());
- EXPECT_EQ(1, TilingData(2, 2, 2, false).numTiles());
- EXPECT_EQ(1, TilingData(3, 3, 3, false).numTiles());
-
- EXPECT_EQ(1, TilingData(4, 1, 4, false).numTiles());
- EXPECT_EQ(1, TilingData(4, 2, 4, false).numTiles());
- EXPECT_EQ(1, TilingData(4, 3, 4, false).numTiles());
- EXPECT_EQ(1, TilingData(4, 4, 4, false).numTiles());
- EXPECT_EQ(2, TilingData(4, 5, 4, false).numTiles());
- EXPECT_EQ(2, TilingData(4, 6, 4, false).numTiles());
- EXPECT_EQ(2, TilingData(4, 7, 4, false).numTiles());
- EXPECT_EQ(2, TilingData(4, 8, 4, false).numTiles());
- EXPECT_EQ(3, TilingData(4, 9, 4, false).numTiles());
- EXPECT_EQ(3, TilingData(4, 10, 4, false).numTiles());
- EXPECT_EQ(3, TilingData(4, 11, 4, false).numTiles());
-
- EXPECT_EQ(1, TilingData(5, 1, 5, false).numTiles());
- EXPECT_EQ(1, TilingData(5, 2, 5, false).numTiles());
- EXPECT_EQ(1, TilingData(5, 3, 5, false).numTiles());
- EXPECT_EQ(1, TilingData(5, 4, 5, false).numTiles());
- EXPECT_EQ(1, TilingData(5, 5, 5, false).numTiles());
- EXPECT_EQ(2, TilingData(5, 6, 5, false).numTiles());
- EXPECT_EQ(2, TilingData(5, 7, 5, false).numTiles());
- EXPECT_EQ(2, TilingData(5, 8, 5, false).numTiles());
- EXPECT_EQ(2, TilingData(5, 9, 5, false).numTiles());
- EXPECT_EQ(2, TilingData(5, 10, 5, false).numTiles());
- EXPECT_EQ(3, TilingData(5, 11, 5, false).numTiles());
-
- EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles());
- EXPECT_EQ(1, TilingData(17, 16, 16, false).numTiles());
- EXPECT_EQ(4, TilingData(15, 16, 16, false).numTiles());
- EXPECT_EQ(4, TilingData(8, 16, 16, false).numTiles());
- EXPECT_EQ(6, TilingData(8, 17, 16, false).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 0, 0, false).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 4, 0, false).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 0, 4, false).numTiles());
+ EXPECT_EQ(0, TestTiling(4, 4, 0, false).numTiles());
+ EXPECT_EQ(0, TestTiling(4, 0, 4, false).numTiles());
+ EXPECT_EQ(0, TestTiling(-8, 1, 1, false).numTiles());
+ EXPECT_EQ(0, TestTiling(-1, 1, 1, false).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 1, 1, false).numTiles());
+
+ EXPECT_EQ(1, TestTiling(1, 1, 1, false).numTiles());
+ EXPECT_EQ(2, TestTiling(1, 1, 2, false).numTiles());
+ EXPECT_EQ(2, TestTiling(1, 2, 1, false).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 1, 1, false).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 1, 2, false).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 2, 1, false).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 2, 2, false).numTiles());
+ EXPECT_EQ(1, TestTiling(3, 3, 3, false).numTiles());
+
+ EXPECT_EQ(1, TestTiling(4, 1, 4, false).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 2, 4, false).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 3, 4, false).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 4, 4, false).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 5, 4, false).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 6, 4, false).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 7, 4, false).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 8, 4, false).numTiles());
+ EXPECT_EQ(3, TestTiling(4, 9, 4, false).numTiles());
+ EXPECT_EQ(3, TestTiling(4, 10, 4, false).numTiles());
+ EXPECT_EQ(3, TestTiling(4, 11, 4, false).numTiles());
+
+ EXPECT_EQ(1, TestTiling(5, 1, 5, false).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 2, 5, false).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 3, 5, false).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 4, 5, false).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 5, 5, false).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 6, 5, false).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 7, 5, false).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 8, 5, false).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 9, 5, false).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 10, 5, false).numTiles());
+ EXPECT_EQ(3, TestTiling(5, 11, 5, false).numTiles());
+
+ EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles());
+ EXPECT_EQ(1, TestTiling(17, 16, 16, false).numTiles());
+ EXPECT_EQ(4, TestTiling(15, 16, 16, false).numTiles());
+ EXPECT_EQ(4, TestTiling(8, 16, 16, false).numTiles());
+ EXPECT_EQ(6, TestTiling(8, 17, 16, false).numTiles());
}
TEST(TilingDataTest, numTiles_TilingWithBorders)
{
- EXPECT_EQ(0, TilingData(0, 0, 0, true).numTiles());
- EXPECT_EQ(0, TilingData(0, 4, 0, true).numTiles());
- EXPECT_EQ(0, TilingData(0, 0, 4, true).numTiles());
- EXPECT_EQ(0, TilingData(4, 4, 0, true).numTiles());
- EXPECT_EQ(0, TilingData(4, 0, 4, true).numTiles());
- EXPECT_EQ(0, TilingData(-8, 1, 1, true).numTiles());
- EXPECT_EQ(0, TilingData(-1, 1, 1, true).numTiles());
- EXPECT_EQ(0, TilingData(0, 1, 1, true).numTiles());
-
- EXPECT_EQ(1, TilingData(1, 1, 1, true).numTiles());
- EXPECT_EQ(0, TilingData(1, 1, 2, true).numTiles());
- EXPECT_EQ(0, TilingData(1, 2, 1, true).numTiles());
- EXPECT_EQ(1, TilingData(2, 1, 1, true).numTiles());
- EXPECT_EQ(1, TilingData(2, 1, 2, true).numTiles());
- EXPECT_EQ(1, TilingData(2, 2, 1, true).numTiles());
- EXPECT_EQ(1, TilingData(2, 2, 2, true).numTiles());
-
- EXPECT_EQ(1, TilingData(3, 1, 3, true).numTiles());
- EXPECT_EQ(1, TilingData(3, 2, 3, true).numTiles());
- EXPECT_EQ(1, TilingData(3, 3, 3, true).numTiles());
- EXPECT_EQ(2, TilingData(3, 4, 3, true).numTiles());
- EXPECT_EQ(3, TilingData(3, 5, 3, true).numTiles());
- EXPECT_EQ(4, TilingData(3, 6, 3, true).numTiles());
- EXPECT_EQ(5, TilingData(3, 7, 3, true).numTiles());
-
- EXPECT_EQ(1, TilingData(4, 1, 4, true).numTiles());
- EXPECT_EQ(1, TilingData(4, 2, 4, true).numTiles());
- EXPECT_EQ(1, TilingData(4, 3, 4, true).numTiles());
- EXPECT_EQ(1, TilingData(4, 4, 4, true).numTiles());
- EXPECT_EQ(2, TilingData(4, 5, 4, true).numTiles());
- EXPECT_EQ(2, TilingData(4, 6, 4, true).numTiles());
- EXPECT_EQ(3, TilingData(4, 7, 4, true).numTiles());
- EXPECT_EQ(3, TilingData(4, 8, 4, true).numTiles());
- EXPECT_EQ(4, TilingData(4, 9, 4, true).numTiles());
- EXPECT_EQ(4, TilingData(4, 10, 4, true).numTiles());
- EXPECT_EQ(5, TilingData(4, 11, 4, true).numTiles());
-
- EXPECT_EQ(1, TilingData(5, 1, 5, true).numTiles());
- EXPECT_EQ(1, TilingData(5, 2, 5, true).numTiles());
- EXPECT_EQ(1, TilingData(5, 3, 5, true).numTiles());
- EXPECT_EQ(1, TilingData(5, 4, 5, true).numTiles());
- EXPECT_EQ(1, TilingData(5, 5, 5, true).numTiles());
- EXPECT_EQ(2, TilingData(5, 6, 5, true).numTiles());
- EXPECT_EQ(2, TilingData(5, 7, 5, true).numTiles());
- EXPECT_EQ(2, TilingData(5, 8, 5, true).numTiles());
- EXPECT_EQ(3, TilingData(5, 9, 5, true).numTiles());
- EXPECT_EQ(3, TilingData(5, 10, 5, true).numTiles());
- EXPECT_EQ(3, TilingData(5, 11, 5, true).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 0, 0, true).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 4, 0, true).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 0, 4, true).numTiles());
+ EXPECT_EQ(0, TestTiling(4, 4, 0, true).numTiles());
+ EXPECT_EQ(0, TestTiling(4, 0, 4, true).numTiles());
+ EXPECT_EQ(0, TestTiling(-8, 1, 1, true).numTiles());
+ EXPECT_EQ(0, TestTiling(-1, 1, 1, true).numTiles());
+ EXPECT_EQ(0, TestTiling(0, 1, 1, true).numTiles());
+
+ EXPECT_EQ(1, TestTiling(1, 1, 1, true).numTiles());
+ EXPECT_EQ(0, TestTiling(1, 1, 2, true).numTiles());
+ EXPECT_EQ(0, TestTiling(1, 2, 1, true).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 1, 1, true).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 1, 2, true).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 2, 1, true).numTiles());
+ EXPECT_EQ(1, TestTiling(2, 2, 2, true).numTiles());
+
+ EXPECT_EQ(1, TestTiling(3, 1, 3, true).numTiles());
+ EXPECT_EQ(1, TestTiling(3, 2, 3, true).numTiles());
+ EXPECT_EQ(1, TestTiling(3, 3, 3, true).numTiles());
+ EXPECT_EQ(2, TestTiling(3, 4, 3, true).numTiles());
+ EXPECT_EQ(3, TestTiling(3, 5, 3, true).numTiles());
+ EXPECT_EQ(4, TestTiling(3, 6, 3, true).numTiles());
+ EXPECT_EQ(5, TestTiling(3, 7, 3, true).numTiles());
+
+ EXPECT_EQ(1, TestTiling(4, 1, 4, true).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 2, 4, true).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 3, 4, true).numTiles());
+ EXPECT_EQ(1, TestTiling(4, 4, 4, true).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 5, 4, true).numTiles());
+ EXPECT_EQ(2, TestTiling(4, 6, 4, true).numTiles());
+ EXPECT_EQ(3, TestTiling(4, 7, 4, true).numTiles());
+ EXPECT_EQ(3, TestTiling(4, 8, 4, true).numTiles());
+ EXPECT_EQ(4, TestTiling(4, 9, 4, true).numTiles());
+ EXPECT_EQ(4, TestTiling(4, 10, 4, true).numTiles());
+ EXPECT_EQ(5, TestTiling(4, 11, 4, true).numTiles());
+
+ EXPECT_EQ(1, TestTiling(5, 1, 5, true).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 2, 5, true).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 3, 5, true).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 4, 5, true).numTiles());
+ EXPECT_EQ(1, TestTiling(5, 5, 5, true).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 6, 5, true).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 7, 5, true).numTiles());
+ EXPECT_EQ(2, TestTiling(5, 8, 5, true).numTiles());
+ EXPECT_EQ(3, TestTiling(5, 9, 5, true).numTiles());
+ EXPECT_EQ(3, TestTiling(5, 10, 5, true).numTiles());
+ EXPECT_EQ(3, TestTiling(5, 11, 5, true).numTiles());
}
TEST(TilingDataTest, tileXIndexFromSrcCoord)
{
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(3));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(4));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(5));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(6));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(7));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(8));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(9));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(10));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(11));
-
- EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(1, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(2));
- EXPECT_EQ(2, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(3));
- EXPECT_EQ(3, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(4));
- EXPECT_EQ(4, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(5));
- EXPECT_EQ(5, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(6));
- EXPECT_EQ(6, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(7));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(8));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(9));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(10));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(11));
-
- EXPECT_EQ(0, TilingData(1, 1, 1, false).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, false).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, false).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(2));
-
- EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(3));
-
- EXPECT_EQ(0, TilingData(1, 1, 1, true).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, true).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, true).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(2));
-
- EXPECT_EQ(0, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(1));
- EXPECT_EQ(1, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(3));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(3));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(4));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(5));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(6));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(7));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(8));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(9));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(10));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(11));
+
+ EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(2));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(3));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(4));
+ EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(5));
+ EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(6));
+ EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(7));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(8));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(9));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(10));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(11));
+
+ EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(2));
+
+ EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(3));
+
+ EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(2));
+
+ EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(1));
+ EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(3));
}
TEST(TilingDataTest, tileYIndexFromSrcCoord)
{
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(3));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(4));
- EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(5));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(6));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(7));
- EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(8));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(9));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(10));
- EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(11));
-
- EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(1, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(2));
- EXPECT_EQ(2, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(3));
- EXPECT_EQ(3, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(4));
- EXPECT_EQ(4, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(5));
- EXPECT_EQ(5, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(6));
- EXPECT_EQ(6, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(7));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(8));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(9));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(10));
- EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(11));
-
- EXPECT_EQ(0, TilingData(1, 1, 1, false).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, false).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, false).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(2));
-
- EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(3));
-
- EXPECT_EQ(0, TilingData(1, 1, 1, true).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, true).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(2, 2, 2, true).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(2));
-
- EXPECT_EQ(0, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(0));
- EXPECT_EQ(0, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(1));
- EXPECT_EQ(1, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(2));
- EXPECT_EQ(1, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(3));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(3));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(4));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(5));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(6));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(7));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(8));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(9));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(10));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(11));
+
+ EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(2));
+ EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(3));
+ EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(4));
+ EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(5));
+ EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(6));
+ EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(7));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(8));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(9));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(10));
+ EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(11));
+
+ EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(2));
+
+ EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(3));
+
+ EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(2));
+
+ EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(1));
+ EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(2));
+ EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(3));
}
TEST(TilingDataTest, tileSizeX)
{
- EXPECT_EQ(5, TilingData(5, 5, 5, false).tileSizeX(0));
- EXPECT_EQ(5, TilingData(5, 5, 5, true).tileSizeX(0));
-
- EXPECT_EQ(5, TilingData(5, 6, 6, false).tileSizeX(0));
- EXPECT_EQ(1, TilingData(5, 6, 6, false).tileSizeX(1));
- EXPECT_EQ(4, TilingData(5, 6, 6, true).tileSizeX(0));
- EXPECT_EQ(2, TilingData(5, 6, 6, true).tileSizeX(1));
-
- EXPECT_EQ(5, TilingData(5, 8, 8, false).tileSizeX(0));
- EXPECT_EQ(3, TilingData(5, 8, 8, false).tileSizeX(1));
- EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeX(0));
- EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeX(1));
-
- EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(0));
- EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(1));
- EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeX(0));
- EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(1));
- EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(2));
-
- EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeX(2));
- EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeX(2));
+ EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeX(0));
+ EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeX(0));
+
+ EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeX(0));
+ EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeX(1));
+ EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeX(0));
+ EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeX(1));
+
+ EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeX(0));
+ EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeX(1));
+ EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(0));
+ EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeX(1));
+
+ EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(0));
+ EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(1));
+ EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeX(0));
+ EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(1));
+ EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(2));
+
+ EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeX(2));
+ EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeX(2));
}
TEST(TilingDataTest, tileSizeY)
{
- EXPECT_EQ(5, TilingData(5, 5, 5, false).tileSizeY(0));
- EXPECT_EQ(5, TilingData(5, 5, 5, true).tileSizeY(0));
-
- EXPECT_EQ(5, TilingData(5, 6, 6, false).tileSizeY(0));
- EXPECT_EQ(1, TilingData(5, 6, 6, false).tileSizeY(1));
- EXPECT_EQ(4, TilingData(5, 6, 6, true).tileSizeY(0));
- EXPECT_EQ(2, TilingData(5, 6, 6, true).tileSizeY(1));
-
- EXPECT_EQ(5, TilingData(5, 8, 8, false).tileSizeY(0));
- EXPECT_EQ(3, TilingData(5, 8, 8, false).tileSizeY(1));
- EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeY(0));
- EXPECT_EQ(4, TilingData(5, 8, 8, true).tileSizeY(1));
-
- EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(0));
- EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(1));
- EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeY(0));
- EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(1));
- EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(2));
-
- EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeY(2));
- EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeY(2));
+ EXPECT_EQ(5, TestTiling(5, 5, 5, false).tileSizeY(0));
+ EXPECT_EQ(5, TestTiling(5, 5, 5, true).tileSizeY(0));
+
+ EXPECT_EQ(5, TestTiling(5, 6, 6, false).tileSizeY(0));
+ EXPECT_EQ(1, TestTiling(5, 6, 6, false).tileSizeY(1));
+ EXPECT_EQ(4, TestTiling(5, 6, 6, true).tileSizeY(0));
+ EXPECT_EQ(2, TestTiling(5, 6, 6, true).tileSizeY(1));
+
+ EXPECT_EQ(5, TestTiling(5, 8, 8, false).tileSizeY(0));
+ EXPECT_EQ(3, TestTiling(5, 8, 8, false).tileSizeY(1));
+ EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(0));
+ EXPECT_EQ(4, TestTiling(5, 8, 8, true).tileSizeY(1));
+
+ EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(0));
+ EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(1));
+ EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeY(0));
+ EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(1));
+ EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(2));
+
+ EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeY(2));
+ EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeY(2));
}
TEST(TilingDataTest, tileSizeX_and_tilePositionX)
{
// Single tile cases:
- EXPECT_EQ(1, TilingData(3, 1, 1, false).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 1, 1, false).tilePositionX(0));
- EXPECT_EQ(1, TilingData(3, 1, 100, false).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 1, 100, false).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 3, 1, false).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 3, 1, false).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 3, 100, false).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 3, 100, false).tilePositionX(0));
- EXPECT_EQ(1, TilingData(3, 1, 1, true).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 1, 1, true).tilePositionX(0));
- EXPECT_EQ(1, TilingData(3, 1, 100, true).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 1, 100, true).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 3, 1, true).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 3, 1, true).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 3, 100, true).tileSizeX(0));
- EXPECT_EQ(0, TilingData(3, 3, 100, true).tilePositionX(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionX(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 100, false).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 100, false).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 3, 1, false).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 1, false).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 3, 100, false).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 100, false).tilePositionX(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionX(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 100, true).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 100, true).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 3, 1, true).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 1, true).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 3, 100, true).tileSizeX(0));
+ EXPECT_EQ(0, TestTiling(3, 3, 100, true).tilePositionX(0));
// Multiple tiles:
// no border
// positions 0, 3
- EXPECT_EQ(2, TilingData(3, 6, 1, false).numTiles());
- EXPECT_EQ(3, TilingData(3, 6, 1, false).tileSizeX(0));
- EXPECT_EQ(3, TilingData(3, 6, 1, false).tileSizeX(1));
- EXPECT_EQ(0, TilingData(3, 6, 1, false).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 6, 1, false).tilePositionX(1));
- EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(0));
- EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(1));
- EXPECT_EQ(0, TilingData(3, 6, 100, false).tilePositionX(0));
- EXPECT_EQ(3, TilingData(3, 6, 100, false).tilePositionX(1));
+ EXPECT_EQ(2, TestTiling(3, 6, 1, false).numTiles());
+ EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(0));
+ EXPECT_EQ(3, TestTiling(3, 6, 1, false).tileSizeX(1));
+ EXPECT_EQ(0, TestTiling(3, 6, 1, false).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 6, 1, false).tilePositionX(1));
+ EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(0));
+ EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(1));
+ EXPECT_EQ(0, TestTiling(3, 6, 100, false).tilePositionX(0));
+ EXPECT_EQ(3, TestTiling(3, 6, 100, false).tilePositionX(1));
// Multiple tiles:
// with border
// positions 0, 2, 3, 4
- EXPECT_EQ(4, TilingData(3, 6, 1, true).numTiles());
- EXPECT_EQ(2, TilingData(3, 6, 1, true).tileSizeX(0));
- EXPECT_EQ(1, TilingData(3, 6, 1, true).tileSizeX(1));
- EXPECT_EQ(1, TilingData(3, 6, 1, true).tileSizeX(2));
- EXPECT_EQ(2, TilingData(3, 6, 1, true).tileSizeX(3));
- EXPECT_EQ(0, TilingData(3, 6, 1, true).tilePositionX(0));
- EXPECT_EQ(2, TilingData(3, 6, 1, true).tilePositionX(1));
- EXPECT_EQ(3, TilingData(3, 6, 1, true).tilePositionX(2));
- EXPECT_EQ(4, TilingData(3, 6, 1, true).tilePositionX(3));
- EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(0));
- EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(1));
- EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(2));
- EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(3));
- EXPECT_EQ(0, TilingData(3, 6, 100, true).tilePositionX(0));
- EXPECT_EQ(2, TilingData(3, 6, 100, true).tilePositionX(1));
- EXPECT_EQ(3, TilingData(3, 6, 100, true).tilePositionX(2));
- EXPECT_EQ(4, TilingData(3, 6, 100, true).tilePositionX(3));
+ EXPECT_EQ(4, TestTiling(3, 6, 1, true).numTiles());
+ EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(0));
+ EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(1));
+ EXPECT_EQ(1, TestTiling(3, 6, 1, true).tileSizeX(2));
+ EXPECT_EQ(2, TestTiling(3, 6, 1, true).tileSizeX(3));
+ EXPECT_EQ(0, TestTiling(3, 6, 1, true).tilePositionX(0));
+ EXPECT_EQ(2, TestTiling(3, 6, 1, true).tilePositionX(1));
+ EXPECT_EQ(3, TestTiling(3, 6, 1, true).tilePositionX(2));
+ EXPECT_EQ(4, TestTiling(3, 6, 1, true).tilePositionX(3));
+ EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(0));
+ EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(1));
+ EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(2));
+ EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(3));
+ EXPECT_EQ(0, TestTiling(3, 6, 100, true).tilePositionX(0));
+ EXPECT_EQ(2, TestTiling(3, 6, 100, true).tilePositionX(1));
+ EXPECT_EQ(3, TestTiling(3, 6, 100, true).tilePositionX(2));
+ EXPECT_EQ(4, TestTiling(3, 6, 100, true).tilePositionX(3));
}
TEST(TilingDataTest, tileSizeY_and_tilePositionY)
{
// Single tile cases:
- EXPECT_EQ(1, TilingData(3, 1, 1, false).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 1, 1, false).tilePositionY(0));
- EXPECT_EQ(1, TilingData(3, 100, 1, false).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 100, 1, false).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 1, 3, false).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 1, 3, false).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 100, 3, false).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 100, 3, false).tilePositionY(0));
- EXPECT_EQ(1, TilingData(3, 1, 1, true).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 1, 1, true).tilePositionY(0));
- EXPECT_EQ(1, TilingData(3, 100, 1, true).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 100, 1, true).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 1, 3, true).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 1, 3, true).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 100, 3, true).tileSizeY(0));
- EXPECT_EQ(0, TilingData(3, 100, 3, true).tilePositionY(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 1, false).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 1, false).tilePositionY(0));
+ EXPECT_EQ(1, TestTiling(3, 100, 1, false).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 100, 1, false).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 1, 3, false).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 3, false).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 100, 3, false).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 100, 3, false).tilePositionY(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 1, true).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 1, true).tilePositionY(0));
+ EXPECT_EQ(1, TestTiling(3, 100, 1, true).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 100, 1, true).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 1, 3, true).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 1, 3, true).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 100, 3, true).tileSizeY(0));
+ EXPECT_EQ(0, TestTiling(3, 100, 3, true).tilePositionY(0));
// Multiple tiles:
// no border
// positions 0, 3
- EXPECT_EQ(2, TilingData(3, 1, 6, false).numTiles());
- EXPECT_EQ(3, TilingData(3, 1, 6, false).tileSizeY(0));
- EXPECT_EQ(3, TilingData(3, 1, 6, false).tileSizeY(1));
- EXPECT_EQ(0, TilingData(3, 1, 6, false).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 1, 6, false).tilePositionY(1));
- EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(0));
- EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(1));
- EXPECT_EQ(0, TilingData(3, 100, 6, false).tilePositionY(0));
- EXPECT_EQ(3, TilingData(3, 100, 6, false).tilePositionY(1));
+ EXPECT_EQ(2, TestTiling(3, 1, 6, false).numTiles());
+ EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(0));
+ EXPECT_EQ(3, TestTiling(3, 1, 6, false).tileSizeY(1));
+ EXPECT_EQ(0, TestTiling(3, 1, 6, false).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 1, 6, false).tilePositionY(1));
+ EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(0));
+ EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(1));
+ EXPECT_EQ(0, TestTiling(3, 100, 6, false).tilePositionY(0));
+ EXPECT_EQ(3, TestTiling(3, 100, 6, false).tilePositionY(1));
// Multiple tiles:
// with border
// positions 0, 2, 3, 4
- EXPECT_EQ(4, TilingData(3, 1, 6, true).numTiles());
- EXPECT_EQ(2, TilingData(3, 1, 6, true).tileSizeY(0));
- EXPECT_EQ(1, TilingData(3, 1, 6, true).tileSizeY(1));
- EXPECT_EQ(1, TilingData(3, 1, 6, true).tileSizeY(2));
- EXPECT_EQ(2, TilingData(3, 1, 6, true).tileSizeY(3));
- EXPECT_EQ(0, TilingData(3, 1, 6, true).tilePositionY(0));
- EXPECT_EQ(2, TilingData(3, 1, 6, true).tilePositionY(1));
- EXPECT_EQ(3, TilingData(3, 1, 6, true).tilePositionY(2));
- EXPECT_EQ(4, TilingData(3, 1, 6, true).tilePositionY(3));
- EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(0));
- EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(1));
- EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(2));
- EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(3));
- EXPECT_EQ(0, TilingData(3, 100, 6, true).tilePositionY(0));
- EXPECT_EQ(2, TilingData(3, 100, 6, true).tilePositionY(1));
- EXPECT_EQ(3, TilingData(3, 100, 6, true).tilePositionY(2));
- EXPECT_EQ(4, TilingData(3, 100, 6, true).tilePositionY(3));
+ EXPECT_EQ(4, TestTiling(3, 1, 6, true).numTiles());
+ EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(0));
+ EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(1));
+ EXPECT_EQ(1, TestTiling(3, 1, 6, true).tileSizeY(2));
+ EXPECT_EQ(2, TestTiling(3, 1, 6, true).tileSizeY(3));
+ EXPECT_EQ(0, TestTiling(3, 1, 6, true).tilePositionY(0));
+ EXPECT_EQ(2, TestTiling(3, 1, 6, true).tilePositionY(1));
+ EXPECT_EQ(3, TestTiling(3, 1, 6, true).tilePositionY(2));
+ EXPECT_EQ(4, TestTiling(3, 1, 6, true).tilePositionY(3));
+ EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(0));
+ EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(1));
+ EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(2));
+ EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(3));
+ EXPECT_EQ(0, TestTiling(3, 100, 6, true).tilePositionY(0));
+ EXPECT_EQ(2, TestTiling(3, 100, 6, true).tilePositionY(1));
+ EXPECT_EQ(3, TestTiling(3, 100, 6, true).tilePositionY(2));
+ EXPECT_EQ(4, TestTiling(3, 100, 6, true).tilePositionY(3));
}
TEST(TilingDataTest, setTotalSize)
{
- TilingData data(5, 5, 5, false);
+ TestTiling data(5, 5, 5, false);
EXPECT_EQ(5, data.totalSizeX());
EXPECT_EQ(5, data.totalSizeY());
EXPECT_EQ(1, data.numTilesX());
@@ -446,7 +468,7 @@ TEST(TilingDataTest, setTotalSize)
TEST(TilingDataTest, setMaxTextureSizeNoBorders)
{
- TilingData data(8, 16, 32, false);
+ TestTiling data(8, 16, 32, false);
EXPECT_EQ(2, data.numTilesX());
EXPECT_EQ(4, data.numTilesY());
@@ -468,7 +490,7 @@ TEST(TilingDataTest, setMaxTextureSizeNoBorders)
TEST(TilingDataTest, setMaxTextureSizeBorders)
{
- TilingData data(8, 16, 32, true);
+ TestTiling data(8, 16, 32, true);
EXPECT_EQ(3, data.numTilesX());
EXPECT_EQ(5, data.numTilesY());
@@ -491,8 +513,8 @@ TEST(TilingDataTest, setMaxTextureSizeBorders)
TEST(TilingDataTest, assignment)
{
{
- TilingData source(8, 16, 32, true);
- TilingData dest = source;
+ TestTiling source(8, 16, 32, true);
+ TestTiling dest = source;
EXPECT_EQ(source.borderTexels(), dest.borderTexels());
EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize());
EXPECT_EQ(source.numTilesX(), dest.numTilesX());
@@ -501,8 +523,8 @@ TEST(TilingDataTest, assignment)
EXPECT_EQ(source.totalSizeY(), dest.totalSizeY());
}
{
- TilingData source(3, 6, 100, false);
- TilingData dest(source);
+ TestTiling source(3, 6, 100, false);
+ TestTiling dest(source);
EXPECT_EQ(source.borderTexels(), dest.borderTexels());
EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize());
EXPECT_EQ(source.numTilesX(), dest.numTilesX());
@@ -514,7 +536,7 @@ TEST(TilingDataTest, assignment)
TEST(TilingDataTest, setBorderTexels)
{
- TilingData data(8, 16, 32, false);
+ TestTiling data(8, 16, 32, false);
EXPECT_EQ(2, data.numTilesX());
EXPECT_EQ(4, data.numTilesY());
diff --git a/Source/WebKit/chromium/tests/TransparencyWinTest.cpp b/Source/WebKit/chromium/tests/TransparencyWinTest.cpp
index 5052bb166..ae3090d8c 100644
--- a/Source/WebKit/chromium/tests/TransparencyWinTest.cpp
+++ b/Source/WebKit/chromium/tests/TransparencyWinTest.cpp
@@ -395,6 +395,66 @@ TEST(TransparencyWin, TranslateOpaqueCompositeLayer)
EXPECT_EQ(green, getPixelAt(src->context(), 15, 7));
}
+static void testClippedLayerKeepTransform(TransparencyWin::LayerMode layerMode)
+{
+ // Fill with white.
+ OwnPtr<ImageBuffer> src(ImageBuffer::create(IntSize(16, 16), 1, ColorSpaceDeviceRGB));
+ Color white(0xFFFFFFFF);
+ FloatRect fullRect(0, 0, 16, 16);
+ src->context()->fillRect(fullRect, white, ColorSpaceDeviceRGB);
+
+ IntRect clipRect(IntPoint(11, 5), IntSize(1, 1));
+ src->context()->clip(clipRect);
+
+ // Scroll down by 6 (coordinate system goes up).
+ src->context()->save();
+ src->context()->translate(0, -6);
+
+ Color red(0xFFFF0000);
+ Color green(0xFF00FF00);
+ {
+ // The transparency layer after translation will be @ (0, -6) with
+ // a size that would be too large to handle unclipped.
+ TransparencyWin helper;
+ helper.init(src->context(),
+ layerMode,
+ TransparencyWin::KeepTransform,
+ IntRect(0, 0, INT_MAX, INT_MAX));
+
+ // Draw a green pixel at (11, 11). This should be within the clip rect
+ // and at (11, 5) after the transform.
+ FloatRect greenRect(11, 11, 1, 1);
+ helper.context()->fillRect(greenRect, green, ColorSpaceDeviceRGB);
+
+ // Draw a red pixel at (9, 9). This should be outside the clip rect
+ // and not drawn.
+ FloatRect redRect(9, 9, 1, 1);
+ helper.context()->fillRect(redRect, red, ColorSpaceDeviceRGB);
+ helper.composite();
+ }
+
+ src->context()->restore();
+
+ // Verify green pixel got drawn in clip rect and red pixel got clipped.
+ EXPECT_EQ(green, getPixelAt(src->context(), 11, 5));
+ EXPECT_EQ(white, getPixelAt(src->context(), 9, 3));
+}
+
+TEST(TransparencyWin, ClippedKeepTransformNoLayer)
+{
+ testClippedLayerKeepTransform(TransparencyWin::NoLayer);
+}
+
+TEST(TransparencyWin, ClippedKeepTransformOpaqueCompositeLayer)
+{
+ testClippedLayerKeepTransform(TransparencyWin::OpaqueCompositeLayer);
+}
+
+TEST(TransparencyWin, ClippedKeepTransformWhiteLayer)
+{
+ testClippedLayerKeepTransform(TransparencyWin::WhiteLayer);
+}
+
// Same as OpaqueCompositeLayer, but the canvas has a rotation applied. This
// tests that the propert transform is applied to the copied layer.
TEST(TransparencyWin, RotateOpaqueCompositeLayer)
diff --git a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
index eb3850dab..098dd2731 100644
--- a/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
+++ b/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
@@ -28,6 +28,7 @@
#include "CCAnimationTestCommon.h"
#include "LayerChromium.h"
+#include "Region.h"
#include "cc/CCLayerAnimationController.h"
#include "cc/CCLayerImpl.h"
#include "cc/CCProxy.h"
@@ -72,12 +73,12 @@ public:
virtual ~MockLayerChromium() { }
- virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl()
+ virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE
{
return MockCCLayerImpl::create(m_layerId);
}
- virtual void pushPropertiesTo(CCLayerImpl* ccLayer)
+ virtual void pushPropertiesTo(CCLayerImpl* ccLayer) OVERRIDE
{
LayerChromium::pushPropertiesTo(ccLayer);
@@ -96,22 +97,23 @@ private:
class FakeLayerAnimationController : public CCLayerAnimationController {
public:
- static PassOwnPtr<FakeLayerAnimationController> create()
+ static PassOwnPtr<FakeLayerAnimationController> create(CCLayerAnimationControllerClient* client)
{
- return adoptPtr(new FakeLayerAnimationController);
+ return adoptPtr(new FakeLayerAnimationController(client));
}
bool synchronizedAnimations() const { return m_synchronizedAnimations; }
private:
- FakeLayerAnimationController()
- : m_synchronizedAnimations(false)
+ explicit FakeLayerAnimationController(CCLayerAnimationControllerClient* client)
+ : CCLayerAnimationController(client)
+ , m_synchronizedAnimations(false)
{
}
- virtual void synchronizeAnimations(CCLayerAnimationControllerImpl* controllerImpl)
+ virtual void pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl)
{
- CCLayerAnimationController::synchronizeAnimations(controllerImpl);
+ CCLayerAnimationController::pushAnimationUpdatesTo(controllerImpl);
m_synchronizedAnimations = true;
}
@@ -125,6 +127,8 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer)
EXPECT_EQ(layer->id(), ccLayer->id());
+ EXPECT_EQ(layer->nonFastScrollableRegion(), ccLayer->nonFastScrollableRegion());
+
ASSERT_EQ(!!layer->maskLayer(), !!ccLayer->maskLayer());
if (layer->maskLayer())
expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer());
@@ -142,6 +146,17 @@ void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer)
expectTreesAreIdentical(layerChildren[i].get(), ccLayerChildren[i].get());
}
+// Attempts to synchronizes a null tree. This should not crash, and should
+// return a null tree.
+TEST(TreeSynchronizerTest, syncNullTree)
+{
+ DebugScopedSetImplThread impl;
+
+ OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, nullptr);
+
+ EXPECT_TRUE(!ccLayerTreeRoot.get());
+}
+
// Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers.
TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
{
@@ -182,6 +197,34 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
EXPECT_EQ(secondCCLayerId, ccLayerDestructionList[0]);
}
+// Constructs a very simple tree and checks that a stacking-order change is tracked properly.
+TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
+{
+ DebugScopedSetImplThread impl;
+ Vector<int> ccLayerDestructionList;
+
+ // 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());
+ 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());
+
+ // Check that the impl thread properly tracked the change.
+ EXPECT_FALSE(ccLayerTreeRoot->layerPropertyChanged());
+ EXPECT_FALSE(ccLayerTreeRoot->children()[0]->layerPropertyChanged());
+ EXPECT_TRUE(ccLayerTreeRoot->children()[1]->layerPropertyChanged());
+}
+
TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
{
DebugScopedSetImplThread impl;
@@ -190,10 +233,10 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
layerTreeRoot->addChild(LayerChromium::create());
// Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through.
- FloatPoint rootPosition = FloatPoint(2.3, 7.4);
+ FloatPoint rootPosition = FloatPoint(2.3f, 7.4f);
layerTreeRoot->setPosition(rootPosition);
- float firstChildOpacity = 0.25;
+ float firstChildOpacity = 0.25f;
layerTreeRoot->children()[0]->setOpacity(firstChildOpacity);
IntSize secondChildBounds = IntSize(25, 53);
@@ -339,7 +382,8 @@ TEST(TreeSynchronizerTest, synchronizeAnimations)
DebugScopedSetImplThread impl;
RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create();
- layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create());
+ FakeLayerAnimationControllerClient dummy;
+ layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy));
EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations());
diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
index 459255e02..92f006184 100644
--- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
+++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
@@ -30,115 +30,71 @@
#include "WebCompositor.h"
#include "WebCompositorInputHandlerClient.h"
#include "WebInputEvent.h"
+#include "cc/CCActiveGestureAnimation.h"
#include "cc/CCInputHandler.h"
#include "cc/CCSingleThreadProxy.h"
+#include "platform/WebFloatPoint.h"
+#include "platform/WebPoint.h"
+#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
-using WebKit::WebCompositorInputHandler;
-using WebKit::WebCompositorInputHandlerImpl;
+using namespace WebKit;
namespace {
-class MockInputHandlerClient : public WebCore::CCInputHandlerClient {
- WTF_MAKE_NONCOPYABLE(MockInputHandlerClient);
+class MockCCInputHandlerClient : public WebCore::CCInputHandlerClient {
+ WTF_MAKE_NONCOPYABLE(MockCCInputHandlerClient);
public:
- MockInputHandlerClient()
- : m_scrollStatus(ScrollStarted)
- , m_pinchStarted(false)
- , m_pinchEnded(false)
- , m_pinchMagnification(0)
+ MockCCInputHandlerClient()
{
}
- virtual ~MockInputHandlerClient() { }
+ virtual ~MockCCInputHandlerClient() { }
- void setScrollStatus(ScrollStatus status) { m_scrollStatus = status; }
- bool pinchStarted() const { return m_pinchStarted; }
- bool pinchEnded() const { return m_pinchEnded; }
- float pinchMaginifcation() const { return m_pinchMagnification; }
+ MOCK_METHOD0(pinchGestureBegin, void());
+ MOCK_METHOD2(pinchGestureUpdate, void(float magnifyDelta, const WebCore::IntPoint& anchor));
+ MOCK_METHOD0(pinchGestureEnd, void());
- void resetPinch()
- {
- m_pinchStarted = m_pinchEnded = false;
- m_pinchMagnification = 0;
- }
+ MOCK_METHOD0(scheduleAnimation, void());
-private:
- virtual void setNeedsRedraw() OVERRIDE { }
- virtual ScrollStatus scrollBegin(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType) OVERRIDE
- {
- return m_scrollStatus;
- }
- virtual void scrollBy(const WebCore::IntSize&) OVERRIDE { }
- virtual void scrollEnd() OVERRIDE { }
+ MOCK_METHOD2(scrollBegin, ScrollStatus(const WebCore::IntPoint&, WebCore::CCInputHandlerClient::ScrollInputType));
+ MOCK_METHOD1(scrollBy, void(const WebCore::IntSize&));
+ MOCK_METHOD0(scrollEnd, void());
- virtual void pinchGestureBegin() OVERRIDE
- {
- m_pinchStarted = true;
- }
- virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE
- {
- m_pinchMagnification = magnifyDelta;
- }
- virtual void pinchGestureEnd() OVERRIDE
- {
- m_pinchEnded = true;
- }
+private:
virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition,
bool anchorPoint,
float pageScale,
double startTimeMs,
double durationMs) OVERRIDE { }
- ScrollStatus m_scrollStatus;
- bool m_pinchStarted;
- bool m_pinchEnded;
- float m_pinchMagnification;
+ virtual WebCore::CCActiveGestureAnimation* activeGestureAnimation() OVERRIDE { return 0; }
+ virtual void setActiveGestureAnimation(PassOwnPtr<WebCore::CCActiveGestureAnimation>) OVERRIDE { }
};
-class MockWebCompositorInputHandlerClient : public WebKit::WebCompositorInputHandlerClient {
+class MockWebCompositorInputHandlerClient : public WebCompositorInputHandlerClient {
WTF_MAKE_NONCOPYABLE(MockWebCompositorInputHandlerClient);
public:
MockWebCompositorInputHandlerClient()
- : m_handled(false)
- , m_sendToWidget(false)
+ : WebCompositorInputHandlerClient()
{
}
virtual ~MockWebCompositorInputHandlerClient() { }
- void reset()
- {
- m_handled = false;
- m_sendToWidget = false;
- }
-
- bool handled() const { return m_handled; }
- bool sendToWidget() const { return m_sendToWidget; }
+ MOCK_METHOD0(willShutdown, void());
+ MOCK_METHOD0(didHandleInputEvent, void());
+ MOCK_METHOD1(didNotHandleInputEvent, void(bool sendToWidget));
-private:
- virtual void willShutdown() OVERRIDE { }
- virtual void didHandleInputEvent() OVERRIDE
- {
- m_handled = true;
- }
- virtual void didNotHandleInputEvent(bool sendToWidget) OVERRIDE
- {
- m_sendToWidget = sendToWidget;
- }
+ MOCK_METHOD1(transferActiveWheelFlingAnimation, void(const WebActiveWheelFlingParameters&));
- bool m_handled;
- bool m_sendToWidget;
};
TEST(WebCompositorInputHandlerImpl, fromIdentifier)
{
- WebKit::WebCompositor::initialize(0);
-#ifndef NDEBUG
- // WebCompositorInputHandler APIs can only be called from the compositor thread.
+ WebCompositor::initialize(0);
WebCore::DebugScopedSetImplThread alwaysImplThread;
-#endif
// Before creating any WebCompositorInputHandlers, lookups for any value should fail and not crash.
EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(2));
@@ -158,126 +114,452 @@ TEST(WebCompositorInputHandlerImpl, fromIdentifier)
// After the compositor is destroyed, its entry should be removed from the map.
EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(compositorIdentifier));
-
- WebKit::WebCompositor::shutdown();
+ WebCompositor::shutdown();
}
-TEST(WebCompositorInputHandlerImpl, gestureScroll)
+class WebCompositorInputHandlerImplTest : public testing::Test {
+public:
+ WebCompositorInputHandlerImplTest()
+ : m_expectedDisposition(DidHandle)
+ {
+ WebCompositor::initialize(0);
+ m_inputHandler = WebCompositorInputHandlerImpl::create(&m_mockCCInputHandlerClient);
+ m_inputHandler->setClient(&m_mockClient);
+ }
+
+ ~WebCompositorInputHandlerImplTest()
+ {
+ m_inputHandler->setClient(0);
+ m_inputHandler.clear();
+ WebCompositor::shutdown();
+ }
+
+ // This is defined as a macro because when an expectation is not satisfied the only output you get
+ // out of gmock is the line number that set the expectation.
+#define VERIFY_AND_RESET_MOCKS() do \
+ { \
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); \
+ testing::Mock::VerifyAndClearExpectations(&m_mockClient); \
+ switch (m_expectedDisposition) { \
+ case DidHandle: \
+ /* If we expect to handle events, we shouldn't get any didNotHandleInputEvent() calls with any parameter. */ \
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(::testing::_)).Times(0); \
+ EXPECT_CALL(m_mockClient, didHandleInputEvent()); \
+ break; \
+ case DidNotHandle: \
+ /* If we aren't expecting to handle events, we shouldn't call didHandleInputEvent(). */ \
+ EXPECT_CALL(m_mockClient, didHandleInputEvent()).Times(0); \
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(false)).Times(0); \
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(true)); \
+ break; \
+ case DropEvent: \
+ /* If we're expecting to drop, we shouldn't get any didHandle..() or didNotHandleInputEvent(true) calls. */ \
+ EXPECT_CALL(m_mockClient, didHandleInputEvent()).Times(0); \
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(true)).Times(0); \
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(false)); \
+ break; \
+ } \
+ } while (0)
+
+protected:
+ MockCCInputHandlerClient m_mockCCInputHandlerClient;
+ OwnPtr<WebCompositorInputHandlerImpl> m_inputHandler;
+ MockWebCompositorInputHandlerClient m_mockClient;
+ WebGestureEvent gesture;
+
+ enum ExpectedDisposition { DidHandle, DidNotHandle, DropEvent };
+ ExpectedDisposition m_expectedDisposition;
+
+private:
+ WebCore::DebugScopedSetImplThread m_alwaysImplThread;
+};
+
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureScrollStarted)
{
- WebKit::WebCompositor::initialize(0);
-#ifndef NDEBUG
- // WebCompositorInputHandler APIs can only be called from the compositor thread.
- WebCore::DebugScopedSetImplThread alwaysImplThread;
-#endif
+ // We shouldn't send any events to the widget for this gesture.
+ m_expectedDisposition = DidHandle;
+ VERIFY_AND_RESET_MOCKS();
- MockInputHandlerClient mockInputHandler;
- OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler);
- MockWebCompositorInputHandlerClient mockClient;
- inputHandler->setClient(&mockClient);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
- WebKit::WebGestureEvent gesture;
+ gesture.type = WebInputEvent::GestureScrollBegin;
+ m_inputHandler->handleInputEvent(gesture);
- gesture.type = WebKit::WebInputEvent::GestureScrollBegin;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- mockClient.reset();
+ VERIFY_AND_RESET_MOCKS();
- gesture.type = WebKit::WebInputEvent::GestureScrollUpdate;
- gesture.deltaY = 40;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- mockClient.reset();
+ gesture.type = WebInputEvent::GestureScrollUpdate;
+ gesture.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::height, testing::Gt(0))));
+ m_inputHandler->handleInputEvent(gesture);
- gesture.type = WebKit::WebInputEvent::GestureScrollEnd;
+ VERIFY_AND_RESET_MOCKS();
+
+ gesture.type = WebInputEvent::GestureScrollEnd;
gesture.deltaY = 0;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- mockClient.reset();
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd());
+ m_inputHandler->handleInputEvent(gesture);
+}
- mockInputHandler.setScrollStatus(WebCore::CCInputHandlerClient::ScrollFailed);
+TEST_F(WebCompositorInputHandlerImplTest, gestureScrollFailed)
+{
+ // We should send all events to the widget for this gesture.
+ m_expectedDisposition = DidNotHandle;
+ VERIFY_AND_RESET_MOCKS();
- gesture.type = WebKit::WebInputEvent::GestureScrollBegin;
- inputHandler->handleInputEvent(gesture);
- EXPECT_FALSE(mockClient.handled());
- EXPECT_TRUE(mockClient.sendToWidget());
- mockClient.reset();
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(::testing::_, ::testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
- gesture.type = WebKit::WebInputEvent::GestureScrollUpdate;
- gesture.deltaY = 40;
- inputHandler->handleInputEvent(gesture);
- EXPECT_FALSE(mockClient.handled());
- EXPECT_TRUE(mockClient.sendToWidget());
- mockClient.reset();
+ gesture.type = WebInputEvent::GestureScrollBegin;
+ m_inputHandler->handleInputEvent(gesture);
- gesture.type = WebKit::WebInputEvent::GestureScrollEnd;
- gesture.deltaY = 0;
- inputHandler->handleInputEvent(gesture);
- EXPECT_FALSE(mockClient.handled());
- EXPECT_TRUE(mockClient.sendToWidget());
- mockClient.reset();
+ VERIFY_AND_RESET_MOCKS();
+
+ gesture.type = WebInputEvent::GestureScrollUpdate;
+ gesture.deltaY = 40;
+ m_inputHandler->handleInputEvent(gesture);
- inputHandler->setClient(0);
+ VERIFY_AND_RESET_MOCKS();
- WebKit::WebCompositor::shutdown();
+ gesture.type = WebInputEvent::GestureScrollEnd;
+ gesture.deltaY = 0;
+ m_inputHandler->handleInputEvent(gesture);
}
-TEST(WebCompositorInputHandlerImpl, gesturePinch)
+TEST_F(WebCompositorInputHandlerImplTest, gestureScrollIgnored)
{
- WebKit::WebCompositor::initialize(0);
-#ifndef NDEBUG
- // WebCompositorInputHandler APIs can only be called from the compositor thread.
- WebCore::DebugScopedSetImplThread alwaysImplThread;
-#endif
+ // We shouldn't handle the GestureScrollBegin.
+ // Instead, we should get one didNotHandleInputEvent(false) call per handleInputEvent(),
+ // indicating that we could determine that there's nothing that could scroll or otherwise
+ // react to this gesture sequence and thus we should drop the whole gesture sequence on the floor.
+ m_expectedDisposition = DropEvent;
+ VERIFY_AND_RESET_MOCKS();
+
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollIgnored));
+
+ gesture.type = WebInputEvent::GestureScrollBegin;
+ m_inputHandler->handleInputEvent(gesture);
+}
- MockInputHandlerClient mockInputHandler;
- OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler);
- MockWebCompositorInputHandlerClient mockClient;
- inputHandler->setClient(&mockClient);
+TEST_F(WebCompositorInputHandlerImplTest, gesturePinch)
+{
+ // We shouldn't send any events to the widget for this gesture.
+ m_expectedDisposition = DidHandle;
+ VERIFY_AND_RESET_MOCKS();
- WebKit::WebGestureEvent gesture;
+ gesture.type = WebInputEvent::GesturePinchBegin;
+ EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureBegin());
+ m_inputHandler->handleInputEvent(gesture);
- gesture.type = WebKit::WebInputEvent::GesturePinchBegin;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- EXPECT_TRUE(mockInputHandler.pinchStarted());
- mockClient.reset();
- mockInputHandler.resetPinch();
+ VERIFY_AND_RESET_MOCKS();
- gesture.type = WebKit::WebInputEvent::GesturePinchUpdate;
+ gesture.type = WebInputEvent::GesturePinchUpdate;
gesture.deltaX = 1.5;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- EXPECT_FALSE(mockInputHandler.pinchEnded());
- EXPECT_EQ(1.5, mockInputHandler.pinchMaginifcation());
- mockClient.reset();
- mockInputHandler.resetPinch();
-
- gesture.type = WebKit::WebInputEvent::GesturePinchUpdate;
+ gesture.x = 7;
+ gesture.y = 13;
+ EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureUpdate(1.5, WebCore::IntPoint(7, 13)));
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ gesture.type = WebInputEvent::GesturePinchUpdate;
gesture.deltaX = 0.5;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- EXPECT_FALSE(mockInputHandler.pinchEnded());
- EXPECT_EQ(0.5, mockInputHandler.pinchMaginifcation());
- mockClient.reset();
- mockInputHandler.resetPinch();
-
- gesture.type = WebKit::WebInputEvent::GesturePinchEnd;
- inputHandler->handleInputEvent(gesture);
- EXPECT_TRUE(mockClient.handled());
- EXPECT_FALSE(mockClient.sendToWidget());
- EXPECT_TRUE(mockInputHandler.pinchEnded());
- mockClient.reset();
- mockInputHandler.resetPinch();
-
- inputHandler->setClient(0);
-
- WebKit::WebCompositor::shutdown();
+ gesture.x = 9;
+ gesture.y = 6;
+ EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureUpdate(.5, WebCore::IntPoint(9, 6)));
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ gesture.type = WebInputEvent::GesturePinchEnd;
+ EXPECT_CALL(m_mockCCInputHandlerClient, pinchGestureEnd());
+ m_inputHandler->handleInputEvent(gesture);
+}
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingStarted)
+{
+ // We shouldn't send any events to the widget for this gesture.
+ m_expectedDisposition = DidHandle;
+ VERIFY_AND_RESET_MOCKS();
+
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+
+ gesture.type = WebInputEvent::GestureFlingStart;
+ gesture.deltaX = 10;
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Verify that a GestureFlingCancel during an animation cancels it.
+ gesture.type = WebInputEvent::GestureFlingCancel;
+ m_inputHandler->handleInputEvent(gesture);
+}
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingFailed)
+{
+ // 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));
+
+ gesture.type = WebInputEvent::GestureFlingStart;
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Even if we didn't start a fling ourselves, we still need to send the cancel event to the widget.
+ gesture.type = WebInputEvent::GestureFlingCancel;
+ m_inputHandler->handleInputEvent(gesture);
+}
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingIgnored)
+{
+ m_expectedDisposition = DidNotHandle;
+ VERIFY_AND_RESET_MOCKS();
+
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollIgnored));
+
+ gesture.type = WebInputEvent::GestureFlingStart;
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Even if we didn't start a fling ourselves, we still need to send the cancel event to the widget.
+ gesture.type = WebInputEvent::GestureFlingCancel;
+ m_inputHandler->handleInputEvent(gesture);
+}
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates)
+{
+ // We shouldn't send any events to the widget for this gesture.
+ m_expectedDisposition = DidHandle;
+ VERIFY_AND_RESET_MOCKS();
+
+ // On the fling start, we should schedule an animation but not actually start
+ // scrolling.
+ gesture.type = WebInputEvent::GestureFlingStart;
+ WebFloatPoint flingDelta = WebFloatPoint(1000, 0);
+ WebPoint flingPoint = WebPoint(7, 13);
+ WebPoint flingGlobalPoint = WebPoint(17, 23);
+ int modifiers = 7;
+ gesture.deltaX = flingDelta.x;
+ gesture.deltaY = flingDelta.y;
+ gesture.x = flingPoint.x;
+ gesture.y = flingPoint.y;
+ gesture.globalX = flingGlobalPoint.x;
+ gesture.globalY = flingGlobalPoint.y;
+ gesture.modifiers = modifiers;
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ m_inputHandler->handleInputEvent(gesture);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+ // The first animate call should let us pick up an animation start time, but we
+ // shouldn't actually move anywhere just yet. The first frame after the fling start
+ // will typically include the last scroll from the gesture that lead to the scroll
+ // (either wheel or gesture scroll), so there should be no visible hitch.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
+ m_inputHandler->animate(10);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // The second call should start scrolling in the -X direction.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0))));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd());
+ m_inputHandler->animate(10.1);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Let's say on the third call we hit a non-scrollable region. We should abort the fling and not scroll.
+ // We also should pass the current fling parameters out to the client so the rest of the fling can be
+ // transferred to the main thread.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
+
+ // Expected wheel fling animation parameters:
+ // *) flingDelta and flingPoint should match the original GestureFlingStart event
+ // *) startTime should be 10 to match the time parameter of the first animate() call after the GestureFlingStart
+ // *) cumulativeScroll depends on the curve, but since we've animated in the -X direction the X value should be < 0
+ EXPECT_CALL(m_mockClient, transferActiveWheelFlingAnimation(testing::AllOf(
+ testing::Field(&WebActiveWheelFlingParameters::delta, testing::Eq(flingDelta)),
+ testing::Field(&WebActiveWheelFlingParameters::point, testing::Eq(flingPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::globalPoint, testing::Eq(flingGlobalPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::modifiers, testing::Eq(modifiers)),
+ testing::Field(&WebActiveWheelFlingParameters::startTime, testing::Eq(10)),
+ testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll,
+ testing::Field(&WebSize::width, testing::Gt(0))))));
+ m_inputHandler->animate(10.2);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+ testing::Mock::VerifyAndClearExpectations(&m_mockClient);
+
+ // Since we've aborted the fling, the next animation should be a no-op and should not result in another
+ // frame being requested.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()).Times(0);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
+ m_inputHandler->animate(10.3);
+
+ // Since we've transferred the fling to the main thread, we need to pass the next GestureFlingCancel to the main
+ // thread as well.
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(true));
+ gesture.type = WebInputEvent::GestureFlingCancel;
+ m_inputHandler->handleInputEvent(gesture);
+}
+
+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransferResets)
+{
+ // We shouldn't send any events to the widget for this gesture.
+ m_expectedDisposition = DidHandle;
+ VERIFY_AND_RESET_MOCKS();
+
+ // Start a gesture fling in the -X direction with zero Y movement.
+ gesture.type = WebInputEvent::GestureFlingStart;
+ WebFloatPoint flingDelta = WebFloatPoint(1000, 0);
+ WebPoint flingPoint = WebPoint(7, 13);
+ WebPoint flingGlobalPoint = WebPoint(17, 23);
+ int modifiers = 1;
+ gesture.deltaX = flingDelta.x;
+ gesture.deltaY = flingDelta.y;
+ gesture.x = flingPoint.x;
+ gesture.y = flingPoint.y;
+ gesture.globalX = flingGlobalPoint.x;
+ gesture.globalY = flingGlobalPoint.y;
+ gesture.modifiers = modifiers;
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ m_inputHandler->handleInputEvent(gesture);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Start the fling animation at time 10. This shouldn't actually scroll, just establish a start time.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
+ m_inputHandler->animate(10);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // The second call should start scrolling in the -X direction.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0))));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd());
+ m_inputHandler->animate(10.1);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Let's say on the third call we hit a non-scrollable region. We should abort the fling and not scroll.
+ // We also should pass the current fling parameters out to the client so the rest of the fling can be
+ // transferred to the main thread.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
+
+ // Expected wheel fling animation parameters:
+ // *) flingDelta and flingPoint should match the original GestureFlingStart event
+ // *) startTime should be 10 to match the time parameter of the first animate() call after the GestureFlingStart
+ // *) cumulativeScroll depends on the curve, but since we've animated in the -X direction the X value should be < 0
+ EXPECT_CALL(m_mockClient, transferActiveWheelFlingAnimation(testing::AllOf(
+ testing::Field(&WebActiveWheelFlingParameters::delta, testing::Eq(flingDelta)),
+ testing::Field(&WebActiveWheelFlingParameters::point, testing::Eq(flingPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::globalPoint, testing::Eq(flingGlobalPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::modifiers, testing::Eq(modifiers)),
+ testing::Field(&WebActiveWheelFlingParameters::startTime, testing::Eq(10)),
+ testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll,
+ testing::Field(&WebSize::width, testing::Gt(0))))));
+ m_inputHandler->animate(10.2);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+ testing::Mock::VerifyAndClearExpectations(&m_mockClient);
+
+ // Since we've aborted the fling, the next animation should be a no-op and should not result in another
+ // frame being requested.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()).Times(0);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
+ m_inputHandler->animate(10.3);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Since we've transferred the fling to the main thread, we need to pass the next GestureFlingCancel to the main
+ // thread as well.
+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(true));
+ gesture.type = WebInputEvent::GestureFlingCancel;
+ m_inputHandler->handleInputEvent(gesture);
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Start a second gesture fling, this time in the +Y direction with no X.
+ gesture.type = WebInputEvent::GestureFlingStart;
+ flingDelta = WebFloatPoint(0, -1000);
+ flingPoint = WebPoint(95, 87);
+ flingGlobalPoint = WebPoint(32, 71);
+ modifiers = 2;
+ gesture.deltaX = flingDelta.x;
+ gesture.deltaY = flingDelta.y;
+ gesture.x = flingPoint.x;
+ gesture.y = flingPoint.y;
+ gesture.globalX = flingGlobalPoint.x;
+ gesture.globalY = flingGlobalPoint.y;
+ gesture.modifiers = modifiers;
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ m_inputHandler->handleInputEvent(gesture);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Start the second fling animation at time 30.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)).Times(0);
+ m_inputHandler->animate(30);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Tick the second fling once normally.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::height, testing::Gt(0))));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd());
+ m_inputHandler->animate(30.1);
+
+ testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient);
+
+ // Then abort the second fling.
+ EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed));
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0);
+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()).Times(0);
+
+ // We should get parameters from the second fling, nothing from the first fling should "leak".
+ EXPECT_CALL(m_mockClient, transferActiveWheelFlingAnimation(testing::AllOf(
+ testing::Field(&WebActiveWheelFlingParameters::delta, testing::Eq(flingDelta)),
+ testing::Field(&WebActiveWheelFlingParameters::point, testing::Eq(flingPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::globalPoint, testing::Eq(flingGlobalPoint)),
+ testing::Field(&WebActiveWheelFlingParameters::modifiers, testing::Eq(modifiers)),
+ testing::Field(&WebActiveWheelFlingParameters::startTime, testing::Eq(30)),
+ testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll,
+ testing::Field(&WebSize::height, testing::Lt(0))))));
+ m_inputHandler->animate(30.2);
}
}
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp
index 481bd916f..b8bc2e3c4 100644
--- a/Source/WebKit/chromium/tests/WebFrameTest.cpp
+++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp
@@ -42,6 +42,7 @@
#include "WebSearchableFormData.h"
#include "WebSecurityPolicy.h"
#include "WebSettings.h"
+#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "v8.h"
#include <gtest/gtest.h>
@@ -151,8 +152,42 @@ TEST_F(WebFrameTest, ChromePageNoJavascript)
EXPECT_EQ(std::string::npos, content.find("Clobbered"));
}
+#if ENABLE(VIEWPORT)
+
+class FixedLayoutTestWebViewClient : public WebViewClient {
+ public:
+ virtual WebRect windowRect() OVERRIDE { return m_windowRect; }
+ virtual WebScreenInfo screenInfo() OVERRIDE { return m_screenInfo; }
+
+ WebRect m_windowRect;
+ WebScreenInfo m_screenInfo;
+};
+
+TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag)
+{
+ registerMockedHttpURLLoad("no_viewport_tag.html");
+
+ int viewportWidth = 640;
+ int viewportHeight = 480;
+
+ FixedLayoutTestWebViewClient client;
+ client.m_screenInfo.horizontalDPI = 160;
+ 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->resize(WebSize(viewportWidth, viewportHeight));
+ webView->settings()->setViewportEnabled(true);
+ webView->settings()->setDefaultDeviceScaleFactor(2);
+ webView->enableFixedLayoutMode(true);
+ webView->layout();
+
+ EXPECT_EQ(2, webView->deviceScaleFactor());
+}
+#endif
+
#if ENABLE(GESTURE_EVENTS)
-TEST_F(WebFrameTest, DivAutoZoomParamsTest)
+TEST_F(WebFrameTest, FAILS_DivAutoZoomParamsTest)
{
registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html");
@@ -238,7 +273,12 @@ public:
{
// Return a dummy error so the DocumentLoader doesn't assert when
// the reload cancels it.
- return WebURLError(WebCore::ResourceError("", 1, "", "cancelled"));
+ WebURLError webURLError;
+ webURLError.domain = "";
+ webURLError.reason = 1;
+ webURLError.isCancellation = true;
+ webURLError.unreachableURL = WebURL();
+ return webURLError;
}
};
diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp
index 1eed81aea..7c0831f90 100644
--- a/Source/WebKit/chromium/tests/WebLayerTest.cpp
+++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp
@@ -136,7 +136,7 @@ TEST_F(WebLayerTest, Client)
EXPECT_EQ(otherLayer, layer.maskLayer());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- float opacity = 0.123;
+ float opacity = 0.123f;
layer.setOpacity(opacity);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_EQ(opacity, layer.opacity());
@@ -160,18 +160,15 @@ TEST_F(WebLayerTest, Client)
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
textureLayer.setTextureId(3);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(3u, textureLayer.textureId());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
textureLayer.setFlipped(true);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(textureLayer.flipped());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- WebFloatRect uvRect(0.1, 0.1, 0.9, 0.9);
+ WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f);
textureLayer.setUVRect(uvRect);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(textureLayer.flipped());
// Content layer.
diff --git a/Source/WebKit/chromium/tests/WebMediaPlayerClientImplTest.cpp b/Source/WebKit/chromium/tests/WebMediaPlayerClientImplTest.cpp
new file mode 100644
index 000000000..56a1a6e22
--- /dev/null
+++ b/Source/WebKit/chromium/tests/WebMediaPlayerClientImplTest.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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 "WebMediaPlayerClientImpl.h"
+
+#include <gtest/gtest.h>
+#include <wtf/PassOwnPtr.h>
+
+using namespace WebKit;
+
+namespace {
+
+class FakeWebMediaPlayerClientImpl : public WebMediaPlayerClientImpl {
+public:
+ static PassOwnPtr<FakeWebMediaPlayerClientImpl> create() { return adoptPtr(new FakeWebMediaPlayerClientImpl()); }
+
+private:
+ FakeWebMediaPlayerClientImpl() { }
+};
+
+class FakeVideoFrameProviderClient : public WebVideoFrameProvider::Client {
+public:
+ static PassOwnPtr<FakeVideoFrameProviderClient> create(WebVideoFrameProvider* provider)
+ {
+ return adoptPtr(new FakeVideoFrameProviderClient(provider));
+ }
+
+ virtual ~FakeVideoFrameProviderClient()
+ {
+ if (m_provider)
+ m_provider->setVideoFrameProviderClient(0);
+ }
+
+ // WebKit::WebVideoFrameProvider::Client implementation.
+ virtual void didReceiveFrame() { }
+ virtual void didUpdateMatrix(const float*) { }
+ virtual void stopUsingProvider()
+ {
+ m_provider = 0;
+ }
+
+ WebVideoFrameProvider* provider() const { return m_provider; }
+
+private:
+ FakeVideoFrameProviderClient(WebVideoFrameProvider* provider)
+ : m_provider(provider)
+ {
+ m_provider->setVideoFrameProviderClient(this);
+ }
+
+ WebVideoFrameProvider* m_provider;
+};
+
+TEST(WebMediaPlayerClientImplTest, InitialNullVideoClient)
+{
+ // No explict checks in this test; just make sure it doesn't crash.
+ OwnPtr<WebMediaPlayerClientImpl> provider(FakeWebMediaPlayerClientImpl::create());
+ provider->setVideoFrameProviderClient(0);
+}
+
+TEST(WebMediaPlayerClientImplTest, SetAndUnsetVideoClient)
+{
+ OwnPtr<WebMediaPlayerClientImpl> provider(FakeWebMediaPlayerClientImpl::create());
+ OwnPtr<FakeVideoFrameProviderClient> client(FakeVideoFrameProviderClient::create(provider.get()));
+
+ EXPECT_EQ(client->provider(), provider.get());
+
+ provider->setVideoFrameProviderClient(0);
+ ASSERT_FALSE(client->provider());
+}
+
+TEST(WebMediaPlayerClientImplTest, DestroyProvider)
+{
+ OwnPtr<WebMediaPlayerClientImpl> provider(FakeWebMediaPlayerClientImpl::create());
+ OwnPtr<FakeVideoFrameProviderClient> client(FakeVideoFrameProviderClient::create(provider.get()));
+
+ EXPECT_EQ(client->provider(), provider);
+ provider.clear();
+ ASSERT_FALSE(client->provider());
+}
+
+TEST(WebMediaPlayerClientImplTest, SetMultipleVideoClients)
+{
+ OwnPtr<WebMediaPlayerClientImpl> provider(FakeWebMediaPlayerClientImpl::create());
+ OwnPtr<FakeVideoFrameProviderClient> firstClient(FakeVideoFrameProviderClient::create(provider.get()));
+ EXPECT_EQ(firstClient->provider(), provider);
+
+ OwnPtr<FakeVideoFrameProviderClient> secondClient(FakeVideoFrameProviderClient::create(provider.get()));
+ EXPECT_FALSE(firstClient->provider());
+ EXPECT_EQ(secondClient->provider(), provider);
+
+ provider.clear();
+ ASSERT_FALSE(firstClient->provider());
+ ASSERT_FALSE(secondClient->provider());
+}
+
+}
diff --git a/Source/WebKit/chromium/tests/WebSocketDeflaterTest.cpp b/Source/WebKit/chromium/tests/WebSocketDeflaterTest.cpp
index 423a5969f..1d7826a69 100644
--- a/Source/WebKit/chromium/tests/WebSocketDeflaterTest.cpp
+++ b/Source/WebKit/chromium/tests/WebSocketDeflaterTest.cpp
@@ -46,8 +46,8 @@ TEST(WebSocketDeflaterTest, TestCompressHello)
ASSERT_TRUE(deflater->addBytes(inputData, inputLength));
ASSERT_TRUE(deflater->finish());
- const char expectedFirst[] = {0xf2, 0x48, 0xcd, 0xc9, 0xc9, 0x07, 0x00};
- EXPECT_EQ(sizeof(expectedFirst), deflater->size());
+ const char* expectedFirst = "\xf2\x48\xcd\xc9\xc9\x07\x00";
+ EXPECT_EQ(7U, deflater->size());
EXPECT_EQ(0, memcmp(expectedFirst, deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->addBytes(deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->finish());
@@ -59,8 +59,8 @@ TEST(WebSocketDeflaterTest, TestCompressHello)
ASSERT_TRUE(deflater->addBytes(inputData, inputLength));
ASSERT_TRUE(deflater->finish());
- const char expectedSecond[] = {0xf2, 0x00, 0x11, 0x00, 0x00};
- EXPECT_EQ(sizeof(expectedSecond), deflater->size());
+ const char* expectedSecond = "\xf2\x00\x11\x00\x00";
+ EXPECT_EQ(5U, deflater->size());
EXPECT_EQ(0, memcmp(expectedSecond, deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->addBytes(deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->finish());
@@ -93,7 +93,7 @@ TEST(WebSocketDeflaterTest, TestNoContextTakeOver)
ASSERT_TRUE(deflater->initialize());
OwnPtr<WebSocketInflater> inflater = WebSocketInflater::create();
ASSERT_TRUE(inflater->initialize());
- const char expected[] = {0xf2, 0x48, 0xcd, 0xc9, 0xc9, 0x07, 0x00};
+ const char* expected = "\xf2\x48\xcd\xc9\xc9\x07\x00";
const char* inputData = "Hello";
const size_t inputLength = strlen(inputData);
@@ -102,7 +102,7 @@ TEST(WebSocketDeflaterTest, TestNoContextTakeOver)
for (size_t i = 0; i < 2; ++i) {
ASSERT_TRUE(deflater->addBytes(inputData, inputLength));
ASSERT_TRUE(deflater->finish());
- EXPECT_EQ(sizeof(expected), deflater->size());
+ EXPECT_EQ(7U, deflater->size());
EXPECT_EQ(0, memcmp(expected, deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->addBytes(deflater->data(), deflater->size()));
ASSERT_TRUE(inflater->finish());
diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp
index 6580d06eb..00d8a832d 100644
--- a/Source/WebKit/chromium/tests/WebViewTest.cpp
+++ b/Source/WebKit/chromium/tests/WebViewTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,6 +42,7 @@
#include "platform/WebSize.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
+#include <googleurl/src/gurl.h>
#include <gtest/gtest.h>
#include <webkit/support/webkit_support.h>
@@ -49,12 +50,28 @@ using namespace WebKit;
namespace {
+enum HorizontalScrollbarState {
+ NoHorizontalScrollbar,
+ VisibleHorizontalScrollbar,
+};
+
+enum VerticalScrollbarState {
+ NoVerticalScrollbar,
+ VisibleVerticalScrollbar,
+};
+
class TestData {
public:
void setWebView(WebView* webView) { m_webView = static_cast<WebViewImpl*>(webView); }
void setSize(const WebSize& newSize) { m_size = newSize; }
- bool hasHorizontalScrollbar() const { return m_webView->hasHorizontalScrollbar(); }
- bool hasVerticalScrollbar() const { return m_webView->hasVerticalScrollbar(); }
+ HorizontalScrollbarState horizontalScrollbarState() const
+ {
+ return m_webView->hasHorizontalScrollbar() ? VisibleHorizontalScrollbar: NoHorizontalScrollbar;
+ }
+ VerticalScrollbarState verticalScrollbarState() const
+ {
+ return m_webView->hasVerticalScrollbar() ? VisibleVerticalScrollbar : NoVerticalScrollbar;
+ }
int width() const { return m_size.width; }
int height() const { return m_size.height; }
@@ -88,6 +105,11 @@ public:
}
protected:
+ void testAutoResize(const WebSize& minAutoResize, const WebSize& maxAutoResize,
+ const std::string& pageWidth, const std::string& pageHeight,
+ int expectedWidth, int expectedHeight,
+ HorizontalScrollbarState expectedHorizontalState, VerticalScrollbarState expectedVerticalState);
+
std::string m_baseURL;
};
@@ -119,35 +141,108 @@ TEST_F(WebViewTest, FocusIsInactive)
webView->close();
}
-TEST_F(WebViewTest, AutoResizeMinimumSize)
+void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& maxAutoResize,
+ const std::string& pageWidth, const std::string& pageHeight,
+ int expectedWidth, int expectedHeight,
+ HorizontalScrollbarState expectedHorizontalState, VerticalScrollbarState expectedVerticalState)
{
AutoResizeWebViewClient client;
- FrameTestHelpers::registerMockedURLLoad(m_baseURL, "specify_size.html");
- WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "specify_size.html", true, 0, &client);
+ std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight;
+ FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html");
+ WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client);
client.testData().setWebView(webView);
- FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.getElementById('sizer').style.height = '56px';");
- FrameTestHelpers::loadFrame(webView->mainFrame(), "javascript:document.getElementById('sizer').style.width = '91px';");
WebFrameImpl* frame = static_cast<WebFrameImpl*>(webView->mainFrame());
WebCore::FrameView* frameView = frame->frame()->view();
+ frameView->layout();
EXPECT_FALSE(frameView->layoutPending());
EXPECT_FALSE(frameView->needsLayout());
- WebSize minSize(91, 56);
- WebSize maxSize(403, 302);
- webView->enableAutoResizeMode(true, minSize, maxSize);
+ webView->enableAutoResizeMode(minAutoResize, maxAutoResize);
EXPECT_TRUE(frameView->layoutPending());
EXPECT_TRUE(frameView->needsLayout());
frameView->layout();
EXPECT_TRUE(frame->frame()->document()->isHTMLDocument());
- EXPECT_EQ(91, client.testData().width());
- EXPECT_EQ(56, client.testData().height());
- EXPECT_FALSE(client.testData().hasHorizontalScrollbar());
- EXPECT_FALSE(client.testData().hasVerticalScrollbar());
+ EXPECT_EQ(expectedWidth, client.testData().width());
+ EXPECT_EQ(expectedHeight, client.testData().height());
+ EXPECT_EQ(expectedHorizontalState, client.testData().horizontalScrollbarState());
+ EXPECT_EQ(expectedVerticalState, client.testData().verticalScrollbarState());
webView->close();
}
+TEST_F(WebViewTest, AutoResizeMinimumSize)
+{
+ WebSize minAutoResize(91, 56);
+ WebSize maxAutoResize(403, 302);
+ std::string pageWidth = "91px";
+ std::string pageHeight = "56px";
+ int expectedWidth = 91;
+ int expectedHeight = 56;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar);
+}
+
+TEST_F(WebViewTest, AutoResizeHeightOverflowAndFixedWidth)
+{
+ WebSize minAutoResize(90, 95);
+ WebSize maxAutoResize(90, 100);
+ std::string pageWidth = "60px";
+ std::string pageHeight = "200px";
+ int expectedWidth = 90;
+ int expectedHeight = 100;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, NoHorizontalScrollbar, VisibleVerticalScrollbar);
+}
+
+TEST_F(WebViewTest, AutoResizeFixedHeightAndWidthOverflow)
+{
+ WebSize minAutoResize(90, 100);
+ WebSize maxAutoResize(200, 100);
+ std::string pageWidth = "300px";
+ std::string pageHeight = "80px";
+ int expectedWidth = 200;
+ int expectedHeight = 100;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, VisibleHorizontalScrollbar, NoVerticalScrollbar);
+}
+
+TEST_F(WebViewTest, AutoResizeInBetweenSizes)
+{
+ WebSize minAutoResize(90, 95);
+ WebSize maxAutoResize(200, 300);
+ std::string pageWidth = "100px";
+ std::string pageHeight = "200px";
+ int expectedWidth = 100;
+ int expectedHeight = 200;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar);
+}
+
+TEST_F(WebViewTest, AutoResizeOverflowSizes)
+{
+ WebSize minAutoResize(90, 95);
+ WebSize maxAutoResize(200, 300);
+ std::string pageWidth = "300px";
+ std::string pageHeight = "400px";
+ int expectedWidth = 200;
+ int expectedHeight = 300;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, VisibleHorizontalScrollbar, VisibleVerticalScrollbar);
+}
+
+TEST_F(WebViewTest, AutoResizeMaxSize)
+{
+ WebSize minAutoResize(90, 95);
+ WebSize maxAutoResize(200, 300);
+ std::string pageWidth = "200px";
+ std::string pageHeight = "300px";
+ int expectedWidth = 200;
+ int expectedHeight = 300;
+ testAutoResize(minAutoResize, maxAutoResize, pageWidth, pageHeight,
+ expectedWidth, expectedHeight, NoHorizontalScrollbar, NoVerticalScrollbar);
+}
+
}
diff --git a/Source/WebKit/chromium/tests/data/no_viewport_tag.html b/Source/WebKit/chromium/tests/data/no_viewport_tag.html
new file mode 100644
index 000000000..9ba981574
--- /dev/null
+++ b/Source/WebKit/chromium/tests/data/no_viewport_tag.html
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <p> Test </p>
+ </body>
+</html>
diff --git a/Source/WebKit/chromium/tests/data/specify_size.html b/Source/WebKit/chromium/tests/data/specify_size.html
index 7b9695fd2..2041e85db 100644
--- a/Source/WebKit/chromium/tests/data/specify_size.html
+++ b/Source/WebKit/chromium/tests/data/specify_size.html
@@ -1,6 +1,20 @@
<!doctype html>
<html>
<body style='margin:0px'>
-<img id='sizer' src='broken.jpg'/>
+<img id='sizer'/>
+<script>
+// The desired size should be specified in the url in the search portion
+// like this ?widthDimension:heightDimension.
+var unitMatch = '([0-9]+[a-zA-Z]+)';
+var searchParser = new RegExp('\\?' + unitMatch + '(?:\\:' + unitMatch + ')');
+var parsedParameters = searchParser.exec(window.location.search);
+
+// Set the sizes.
+var elementToSize = document.getElementById('sizer');
+var width = parsedParameters[1];
+elementToSize.style.width = width;
+var height = parsedParameters[2];
+elementToSize.style.height = height;
+</script>
</body>
</html>