summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-22 13:36:28 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-22 13:36:28 +0200
commitc311cf639cc1d6570d67b0a80a8ba04dc992a658 (patch)
tree6e16fefc7ece11ce4ec1e475a58a537a7acebaf8
parent5ef7c8a6a70875d4430752d146bdcb069605d71d (diff)
Imported WebKit commit 35255d8c2fd37ba4359e75fe0ebe6aec87687f9c (http://svn.webkit.org/repository/webkit/trunk@126284)
New snapshot that includes MSVC 64-bit build fix
-rw-r--r--ChangeLog40
-rw-r--r--Source/JavaScriptCore/CMakeLists.txt1
-rw-r--r--Source/JavaScriptCore/ChangeLog57
-rw-r--r--Source/JavaScriptCore/GNUmakefile.list.am2
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj8
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj8
-rw-r--r--Source/JavaScriptCore/assembler/AbstractMacroAssembler.h6
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h5
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86.h4
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h4
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h4
-rw-r--r--Source/JavaScriptCore/interpreter/CallFrame.h2
-rw-r--r--Source/JavaScriptCore/interpreter/VMInspector.cpp116
-rw-r--r--Source/JavaScriptCore/interpreter/VMInspector.h50
-rw-r--r--Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp8
-rw-r--r--Source/Platform/ChangeLog162
-rw-r--r--Source/Platform/chromium/public/WebContentLayer.h36
-rw-r--r--Source/Platform/chromium/public/WebExternalTextureLayer.h34
-rw-r--r--Source/Platform/chromium/public/WebIOSurfaceLayer.h18
-rw-r--r--Source/Platform/chromium/public/WebImageLayer.h16
-rw-r--r--Source/Platform/chromium/public/WebLayer.h182
-rw-r--r--Source/Platform/chromium/public/WebScrollableLayer.h (renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h)48
-rw-r--r--Source/Platform/chromium/public/WebScrollbarLayer.h19
-rw-r--r--Source/Platform/chromium/public/WebSolidColorLayer.h17
-rw-r--r--Source/Platform/chromium/public/WebVideoLayer.h17
-rw-r--r--Source/Platform/chromium/src/WebCString.cpp4
-rw-r--r--Source/WTF/ChangeLog107
-rw-r--r--Source/WTF/wtf/ArrayBuffer.h38
-rw-r--r--Source/WTF/wtf/MathExtras.h2
-rw-r--r--Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp4
-rw-r--r--Source/WTF/wtf/ThreadingPthreads.cpp118
-rw-r--r--Source/WTF/wtf/text/CString.cpp39
-rw-r--r--Source/WTF/wtf/text/CString.h20
-rw-r--r--Source/WebCore/CMakeLists.txt1
-rw-r--r--Source/WebCore/ChangeLog2166
-rw-r--r--Source/WebCore/English.lproj/localizedStrings.js6
-rw-r--r--Source/WebCore/GNUmakefile.am1
-rw-r--r--Source/WebCore/GNUmakefile.list.am4
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBCursor.cpp1
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp14
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h3
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp6
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h2
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h2
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBRequest.cpp21
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBRequest.h3
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBTransaction.cpp5
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBTransaction.h1
-rw-r--r--Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp11
-rw-r--r--Source/WebCore/PlatformBlackBerry.cmake9
-rwxr-xr-xSource/WebCore/UseV8.cmake2
-rw-r--r--Source/WebCore/WebCore.gypi7
-rwxr-xr-xSource/WebCore/WebCore.vcproj/WebCore.vcproj60
-rw-r--r--Source/WebCore/WebCore.xcodeproj/project.pbxproj8
-rw-r--r--Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp7
-rw-r--r--Source/WebCore/bindings/cpp/WebDOMCString.cpp2
-rw-r--r--Source/WebCore/bindings/generic/BindingSecurity.cpp7
-rw-r--r--Source/WebCore/bindings/generic/BindingSecurity.h1
-rw-r--r--Source/WebCore/bindings/js/BindingState.cpp5
-rw-r--r--Source/WebCore/bindings/js/BindingState.h2
-rw-r--r--Source/WebCore/bindings/js/DOMTransaction.h4
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.cpp14
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.h3
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowBase.cpp38
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowBase.h11
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowCustom.cpp23
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowCustom.h43
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp22
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptManager.cpp3
-rw-r--r--Source/WebCore/bindings/objc/WebScriptObject.mm7
-rw-r--r--Source/WebCore/bindings/scripts/CodeGeneratorJS.pm18
-rw-r--r--Source/WebCore/bindings/scripts/CodeGeneratorV8.pm2
-rw-r--r--Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp7
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp2
-rw-r--r--Source/WebCore/bindings/v8/BindingState.cpp6
-rw-r--r--Source/WebCore/bindings/v8/BindingState.h5
-rw-r--r--Source/WebCore/bindings/v8/DOMTransaction.cpp33
-rw-r--r--Source/WebCore/bindings/v8/DOMTransaction.h4
-rw-r--r--Source/WebCore/bindings/v8/ScriptController.h2
-rw-r--r--Source/WebCore/bindings/v8/ScriptSourceCode.cpp43
-rw-r--r--Source/WebCore/bindings/v8/ScriptSourceCode.h3
-rw-r--r--Source/WebCore/bindings/v8/V8Binding.cpp161
-rw-r--r--Source/WebCore/bindings/v8/V8Binding.h120
-rw-r--r--Source/WebCore/bindings/v8/V8DOMWindowShell.cpp6
-rw-r--r--Source/WebCore/bindings/v8/V8LazyEventListener.cpp4
-rw-r--r--Source/WebCore/bindings/v8/V8PerIsolateData.cpp16
-rw-r--r--Source/WebCore/bindings/v8/V8PerIsolateData.h11
-rw-r--r--Source/WebCore/bindings/v8/V8Proxy.cpp54
-rw-r--r--Source/WebCore/bindings/v8/V8Proxy.h9
-rw-r--r--Source/WebCore/bindings/v8/V8StringResource.cpp139
-rw-r--r--Source/WebCore/bindings/v8/V8StringResource.h143
-rw-r--r--Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp6
-rw-r--r--Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp14
-rw-r--r--Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.h (renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.h)46
-rw-r--r--Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp1
-rw-r--r--Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h9
-rw-r--r--Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp18
-rw-r--r--Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp2
-rw-r--r--Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp4
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.cpp73
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.h3
-rw-r--r--Source/WebCore/css/CSSCanvasValue.cpp2
-rw-r--r--Source/WebCore/css/CSSCharsetRule.cpp2
-rw-r--r--Source/WebCore/css/CSSFontFaceSrcValue.cpp4
-rw-r--r--Source/WebCore/css/CSSFunctionValue.cpp2
-rw-r--r--Source/WebCore/css/CSSImageSetValue.cpp2
-rw-r--r--Source/WebCore/css/CSSImageValue.cpp2
-rw-r--r--Source/WebCore/css/CSSParser.cpp14
-rw-r--r--Source/WebCore/css/CSSPrimitiveValue.cpp30
-rw-r--r--Source/WebCore/css/CSSStyleSheet.cpp2
-rw-r--r--Source/WebCore/css/CSSValue.cpp2
-rw-r--r--Source/WebCore/css/CSSVariableValue.h4
-rw-r--r--Source/WebCore/css/FontFeatureValue.cpp2
-rw-r--r--Source/WebCore/css/MediaQuery.cpp4
-rw-r--r--Source/WebCore/css/MediaQueryExp.cpp4
-rw-r--r--Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp70
-rw-r--r--Source/WebCore/css/StyleRuleImport.cpp2
-rw-r--r--Source/WebCore/css/StyleSheetContents.cpp4
-rw-r--r--Source/WebCore/css/WebKitCSSKeyframeRule.cpp2
-rw-r--r--Source/WebCore/css/WebKitCSSKeyframesRule.cpp2
-rw-r--r--Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp2
-rw-r--r--Source/WebCore/css/WebKitCSSShaderValue.cpp2
-rw-r--r--Source/WebCore/css/html.css11
-rw-r--r--Source/WebCore/dom/Attribute.h2
-rw-r--r--Source/WebCore/dom/CharacterData.cpp10
-rw-r--r--Source/WebCore/dom/ContainerNode.cpp14
-rw-r--r--Source/WebCore/dom/ContainerNode.h6
-rw-r--r--Source/WebCore/dom/Document.cpp32
-rw-r--r--Source/WebCore/dom/Element.cpp75
-rw-r--r--Source/WebCore/dom/Element.h8
-rw-r--r--Source/WebCore/dom/Element.idl5
-rw-r--r--Source/WebCore/dom/ElementAttributeData.cpp14
-rw-r--r--Source/WebCore/dom/ElementRareData.h6
-rw-r--r--Source/WebCore/dom/ElementShadow.cpp2
-rw-r--r--Source/WebCore/dom/Event.cpp7
-rw-r--r--Source/WebCore/dom/Event.h5
-rw-r--r--Source/WebCore/dom/MemoryInstrumentation.cpp26
-rw-r--r--Source/WebCore/dom/MemoryInstrumentation.h33
-rw-r--r--Source/WebCore/dom/MouseEvent.cpp31
-rw-r--r--Source/WebCore/dom/MouseEvent.h2
-rw-r--r--Source/WebCore/dom/QualifiedName.h8
-rw-r--r--Source/WebCore/dom/SecurityContext.cpp2
-rw-r--r--Source/WebCore/editing/DOMTransactionStep.cpp168
-rw-r--r--Source/WebCore/editing/DOMTransactionStep.h114
-rw-r--r--Source/WebCore/editing/TextIterator.cpp7
-rw-r--r--Source/WebCore/editing/UndoManager.cpp59
-rw-r--r--Source/WebCore/editing/UndoManager.h22
-rw-r--r--Source/WebCore/html/HTMLAttributeNames.in1
-rw-r--r--Source/WebCore/html/HTMLButtonElement.cpp4
-rw-r--r--Source/WebCore/html/HTMLButtonElement.h2
-rw-r--r--Source/WebCore/html/HTMLElement.cpp12
-rwxr-xr-xSource/WebCore/inspector/CodeGeneratorInspector.py28
-rw-r--r--Source/WebCore/inspector/InjectedScriptHost.idl1
-rw-r--r--Source/WebCore/inspector/InjectedScriptSource.js30
-rw-r--r--Source/WebCore/inspector/InjectedScriptWebGLModule.cpp40
-rw-r--r--Source/WebCore/inspector/InjectedScriptWebGLModule.h10
-rw-r--r--Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js491
-rw-r--r--Source/WebCore/inspector/Inspector.json78
-rw-r--r--Source/WebCore/inspector/InspectorConsoleAgent.cpp6
-rw-r--r--Source/WebCore/inspector/InspectorController.cpp2
-rw-r--r--Source/WebCore/inspector/InspectorFileSystemAgent.cpp223
-rw-r--r--Source/WebCore/inspector/InspectorFileSystemAgent.h2
-rw-r--r--Source/WebCore/inspector/InspectorIndexedDBAgent.cpp2
-rw-r--r--Source/WebCore/inspector/InspectorWebGLAgent.cpp53
-rw-r--r--Source/WebCore/inspector/InspectorWebGLAgent.h16
-rwxr-xr-xSource/WebCore/inspector/compile-front-end.py11
-rw-r--r--Source/WebCore/inspector/front-end/DefaultTextEditor.js27
-rw-r--r--Source/WebCore/inspector/front-end/ElementsPanel.js1
-rw-r--r--Source/WebCore/inspector/front-end/FileSystemModel.js9
-rw-r--r--Source/WebCore/inspector/front-end/InspectorFrontendAPI.js16
-rw-r--r--Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js4
-rw-r--r--Source/WebCore/inspector/front-end/InspectorView.js5
-rw-r--r--Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js2
-rw-r--r--Source/WebCore/inspector/front-end/ScriptsPanel.js6
-rw-r--r--Source/WebCore/inspector/front-end/ScriptsSearchScope.js2
-rw-r--r--Source/WebCore/inspector/front-end/Settings.js1
-rw-r--r--Source/WebCore/inspector/front-end/TabbedPane.js84
-rw-r--r--Source/WebCore/inspector/front-end/TimelineModel.js54
-rw-r--r--Source/WebCore/inspector/front-end/TimelinePanel.js28
-rw-r--r--Source/WebCore/inspector/front-end/Toolbar.js18
-rw-r--r--Source/WebCore/inspector/front-end/UIUtils.js45
-rw-r--r--Source/WebCore/inspector/front-end/WebKit.qrc1
-rw-r--r--Source/WebCore/inspector/front-end/breadcrumbList.css108
-rw-r--r--Source/WebCore/inspector/front-end/elementsPanel.css80
-rw-r--r--Source/WebCore/inspector/front-end/externs.js2
-rw-r--r--Source/WebCore/inspector/front-end/inspector.js20
-rw-r--r--Source/WebCore/inspector/front-end/utilities.js65
-rw-r--r--Source/WebCore/loader/DocumentLoader.cpp6
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp8
-rw-r--r--Source/WebCore/loader/ImageLoader.cpp10
-rw-r--r--Source/WebCore/loader/SubstituteData.cpp8
-rw-r--r--Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp2
-rwxr-xr-xSource/WebCore/loader/cache/CachedResource.cpp6
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp2
-rw-r--r--Source/WebCore/loader/cache/CachedScript.cpp2
-rw-r--r--Source/WebCore/loader/cache/CachedShader.cpp2
-rw-r--r--Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp2
-rw-r--r--Source/WebCore/loader/cache/MemoryCache.cpp2
-rw-r--r--Source/WebCore/page/TouchAdjustment.cpp94
-rw-r--r--Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp90
-rw-r--r--Source/WebCore/page/win/EventHandlerWin.cpp6
-rw-r--r--Source/WebCore/platform/graphics/MediaPlayer.cpp21
-rw-r--r--Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp2
-rw-r--r--Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp1
-rw-r--r--Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp29
-rw-r--r--Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h1
-rw-r--r--Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp15
-rw-r--r--Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp11
-rw-r--r--Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp341
-rw-r--r--Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h42
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerChromium.cpp7
-rw-r--r--Source/WebCore/platform/graphics/chromium/LayerChromium.h2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp2
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp1
-rw-r--r--Source/WebCore/platform/graphics/glx/GLContextGLX.cpp2
-rw-r--r--Source/WebCore/platform/graphics/glx/GLContextGLX.h4
-rw-r--r--Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp216
-rw-r--r--Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h71
-rw-r--r--Source/WebCore/platform/network/ResourceRequestBase.cpp4
-rw-r--r--Source/WebCore/platform/network/ResourceResponseBase.cpp2
-rw-r--r--Source/WebCore/platform/network/blackberry/NetworkJob.cpp11
-rw-r--r--Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp8
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSS10Parser.cpp125
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSS10Parser.h41
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSS20Parser.cpp164
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSS20Parser.h42
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp333
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.h78
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.cpp672
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.h75
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp169
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSGenerator.h38
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp138
-rw-r--r--Source/WebCore/platform/network/blackberry/rss/RSSParserBase.h106
-rw-r--r--Source/WebCore/rendering/RenderBox.cpp32
-rw-r--r--Source/WebCore/rendering/RenderBox.h2
-rw-r--r--Source/WebCore/rendering/RenderFlexibleBox.cpp26
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnBlock.cpp1
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnBlock.h4
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnSet.cpp102
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnSet.h8
-rw-r--r--Source/WebCore/rendering/RenderRegion.cpp34
-rw-r--r--Source/WebCore/rendering/RenderRegion.h10
-rw-r--r--Source/WebCore/rendering/RenderRegionSet.cpp6
-rw-r--r--Source/WebCore/rendering/RenderRegionSet.h2
-rw-r--r--Source/WebCore/rendering/RenderTableSection.cpp15
-rw-r--r--Source/WebCore/rendering/RenderTableSection.h2
-rw-r--r--Source/WebCore/rendering/style/StyleRareInheritedData.cpp10
-rw-r--r--Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp4
-rw-r--r--Source/WebCore/svg/SVGPaint.cpp2
-rw-r--r--Source/WebCore/svg/SVGTRefElement.cpp41
-rw-r--r--Source/WebCore/svg/SVGTRefElement.h2
-rw-r--r--Source/WebCore/xml/XMLViewer.css2
-rw-r--r--Source/WebCore/xml/XMLViewer.js1
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp14
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.h4
-rw-r--r--Source/WebKit/blackberry/Api/WebPage_p.h4
-rw-r--r--Source/WebKit/blackberry/ChangeLog128
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp2
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp5
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp90
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h7
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/AboutData.cpp50
-rw-r--r--Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp2
-rw-r--r--Source/WebKit/chromium/ChangeLog715
-rw-r--r--Source/WebKit/chromium/DEPS2
-rw-r--r--Source/WebKit/chromium/WebKit.gypi19
-rw-r--r--Source/WebKit/chromium/public/WebIDBObjectStore.h5
-rw-r--r--Source/WebKit/chromium/public/WebView.h2
-rw-r--r--Source/WebKit/chromium/src/FindInPageCoordinates.cpp57
-rwxr-xr-xSource/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp8
-rw-r--r--Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h2
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.cpp25
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.h4
-rw-r--r--Source/WebKit/chromium/src/WebContentLayer.cpp (renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp)48
-rw-r--r--Source/WebKit/chromium/src/WebContentLayerImpl.cpp47
-rw-r--r--Source/WebKit/chromium/src/WebContentLayerImpl.h18
-rw-r--r--Source/WebKit/chromium/src/WebExternalTextureLayer.cpp (renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp)121
-rw-r--r--Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h64
-rw-r--r--Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h4
-rw-r--r--Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp (renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp)27
-rw-r--r--Source/WebKit/chromium/src/WebImageLayer.cpp (renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h)34
-rw-r--r--Source/WebKit/chromium/src/WebLayer.cpp379
-rw-r--r--Source/WebKit/chromium/src/WebLayerImpl.cpp367
-rw-r--r--Source/WebKit/chromium/src/WebLayerImpl.h78
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeView.cpp3
-rw-r--r--Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp3
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp18
-rw-r--r--Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h2
-rw-r--r--Source/WebKit/chromium/src/WebPluginContainerImpl.cpp36
-rw-r--r--Source/WebKit/chromium/src/WebPluginContainerImpl.h4
-rw-r--r--Source/WebKit/chromium/src/WebScrollableLayer.cpp75
-rw-r--r--Source/WebKit/chromium/src/WebScrollbarLayer.cpp (renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp)31
-rw-r--r--Source/WebKit/chromium/src/WebSolidColorLayer.cpp (renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp)29
-rw-r--r--Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp25
-rw-r--r--Source/WebKit/chromium/src/WebSolidColorLayerImpl.h22
-rw-r--r--Source/WebKit/chromium/src/WebVideoLayer.cpp (renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h)35
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.cpp61
-rw-r--r--Source/WebKit/chromium/src/WebViewImpl.h4
-rw-r--r--Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp6
-rw-r--r--Source/WebKit/chromium/tests/LayerChromiumTest.cpp12
-rw-r--r--Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp31
-rw-r--r--Source/WebKit/chromium/tests/WebFrameTest.cpp36
-rw-r--r--Source/WebKit/chromium/tests/WebLayerTest.cpp65
-rw-r--r--Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp8
-rw-r--r--Source/WebKit/chromium/tests/WebViewTest.cpp39
-rw-r--r--Source/WebKit/chromium/tests/data/find_in_page.html4
-rw-r--r--Source/WebKit/chromium/tests/data/find_in_page_frame.html33
-rw-r--r--Source/WebKit/efl/ChangeLog13
-rw-r--r--Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp2
-rw-r--r--Source/WebKit/gtk/ChangeLog64
-rw-r--r--Source/WebKit/gtk/GNUmakefile.am1
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h40
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp345
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp108
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h1
-rw-r--r--Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp2
-rw-r--r--Source/WebKit/gtk/tests/testatk.c59
-rw-r--r--Source/WebKit/gtk/webkit/webkitwebview.cpp17
-rw-r--r--Source/WebKit/qt/ChangeLog13
-rw-r--r--Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp14
-rw-r--r--Source/WebKit2/ChangeLog92
-rw-r--r--Source/WebKit2/GNUmakefile.am2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.h4
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp59
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h3
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h3
-rw-r--r--Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in7
-rw-r--r--Source/cmake/OptionsEfl.cmake1
-rw-r--r--Source/cmake/OptionsWindows.cmake4
-rw-r--r--Tools/ChangeLog226
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp3
-rw-r--r--Tools/DumpRenderTree/gtk/DumpRenderTree.cpp1
-rw-r--r--Tools/DumpRenderTree/gtk/EventSender.cpp9
-rw-r--r--Tools/Scripts/webkitperl/FeatureList.pm2
-rw-r--r--Tools/Scripts/webkitpy/common/config/committers.py1
-rw-r--r--Tools/Scripts/webkitpy/common/net/resultsjsonparser.py9
-rw-r--r--Tools/Scripts/webkitpy/common/system/platforminfo.py1
-rw-r--r--Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py3
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py65
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py4
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py110
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py81
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/apple.py17
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/builders.py9
-rwxr-xr-xTools/Scripts/webkitpy/layout_tests/port/chromium.py1
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py7
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py4
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/image_diff.py1
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/mac.py36
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py54
-rw-r--r--Tools/Scripts/webkitpy/layout_tests/port/win.py10
-rw-r--r--Tools/Scripts/webkitpy/tool/commands/queues.py2
-rw-r--r--Tools/Scripts/webkitpy/tool/commands/queues_unittest.py2
-rw-r--r--Tools/Scripts/webkitpy/tool/commands/rebaseline.py4
-rw-r--r--Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py7
-rw-r--r--Tools/TestWebKitAPI/CMakeLists.txt1
-rw-r--r--Tools/TestWebKitAPI/GNUmakefile.am1
-rw-r--r--Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj4
-rw-r--r--Tools/TestWebKitAPI/Tests/WTF/CString.cpp109
-rw-r--r--configure.ac6
376 files changed, 11916 insertions, 3102 deletions
diff --git a/ChangeLog b/ChangeLog
index babf3cf67..d39722db4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2012-08-21 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ [EFL] Enable CSS Text Decoration by default
+ https://bugs.webkit.org/show_bug.cgi?id=94483
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ By enabling this feature by default, it will get tested by the bots
+ and we can make sure no regressions will happen.
+
+ * Source/cmake/OptionsEfl.cmake:
+
+2012-08-21 Ulan Degenbaev <ulan@chromium.org>
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer constructed and destructed
+ https://bugs.webkit.org/show_bug.cgi?id=92993
+
+ Reviewed by Kenneth Russell.
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer
+ is constructed and destructed so that V8's garbage collection
+ heuristics can account for the memory held by these objects.
+
+ * ManualTests/typed-array-memory.html: Added.
+
+2012-08-21 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] Using a native window for the WebView breaks GtkOverlay
+ https://bugs.webkit.org/show_bug.cgi?id=90085
+
+ Reviewed by Alejandro G. Castro.
+
+ * configure.ac: Parse xcomposite pkg-config file during configuration.
+
+2012-08-21 Patrick Gansterer <paroga@webkit.org>
+
+ Build fix for WinCE after r115348.
+
+ * Source/cmake/OptionsWindows.cmake: Removed duplicated WEBKIT_OPTION_DEFAULT_PORT_VALUE().
+
2012-08-20 George Staikos <staikos@webkit.org>
[BlackBerry] Enable XHR Response BLOB
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index 317814aa9..9c18f5b03 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -130,6 +130,7 @@ SET(JavaScriptCore_SOURCES
interpreter/CallFrame.cpp
interpreter/Interpreter.cpp
interpreter/RegisterFile.cpp
+ interpreter/VMInspector.cpp
jit/ExecutableAllocator.cpp
jit/HostCallReturnValue.cpp
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 4297df1e5..ac3aae5ff 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,60 @@
+2012-08-21 Mark Lam <mark.lam@apple.com>
+
+ Introducing the VMInspector for VM debugging use.
+ https://bugs.webkit.org/show_bug.cgi?id=94613.
+
+ Reviewed by Filip Pizlo.
+
+ Adding some utility functions for debugging the VM. This code is
+ presently #ifdef'd out by default.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/CallFrame.h:
+ (ExecState):
+ * interpreter/VMInspector.cpp: Added.
+ (JSC):
+ (JSC::VMInspector::getTypeName):
+ (JSC::VMInspector::dumpFrame0):
+ (JSC::VMInspector::dumpFrame):
+ (JSC::VMInspector::countFrames):
+ * interpreter/VMInspector.h: Added.
+ (JSC):
+ (VMInspector):
+
+2012-08-21 Filip Pizlo <fpizlo@apple.com>
+
+ A patchable GetById right after a watchpoint should have the appropriate nop padding
+ https://bugs.webkit.org/show_bug.cgi?id=94635
+
+ Reviewed by Mark Hahnenberg.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::padBeforePatch):
+ (AbstractMacroAssembler):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load32WithCompactAddressOffsetPatch):
+ (JSC::MacroAssemblerARMv7::moveWithPatch):
+ (JSC::MacroAssemblerARMv7::patchableJump):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::moveWithPatch):
+ (JSC::MacroAssemblerX86::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86::storePtrWithPatch):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86Common::load32WithCompactAddressOffsetPatch):
+ (JSC::MacroAssemblerX86Common::loadCompactWithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86Common::store32WithAddressOffsetPatch):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::loadPtrWithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86_64::loadPtrWithCompactAddressOffsetPatch):
+ (JSC::MacroAssemblerX86_64::storePtrWithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86_64::moveWithPatch):
+ * jit/JumpReplacementWatchpoint.cpp:
+ (JSC::JumpReplacementWatchpoint::fireInternal):
+
2012-08-20 Mark Lam <mark.lam@apple.com>
Fix broken non-JIT build.
diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am
index c504962cc..ed79e6873 100644
--- a/Source/JavaScriptCore/GNUmakefile.list.am
+++ b/Source/JavaScriptCore/GNUmakefile.list.am
@@ -362,6 +362,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/interpreter/RegisterFile.cpp \
Source/JavaScriptCore/interpreter/RegisterFile.h \
Source/JavaScriptCore/interpreter/Register.h \
+ Source/JavaScriptCore/interpreter/VMInspector.cpp \
+ Source/JavaScriptCore/interpreter/VMInspector.h \
Source/JavaScriptCore/JavaScriptCorePrefix.h \
Source/JavaScriptCore/jit/CompactJITCodeMap.h \
Source/JavaScriptCore/jit/ExecutableAllocator.cpp \
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index e91baa473..8695a7557 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -2045,6 +2045,14 @@
RelativePath="..\..\interpreter\RegisterFile.h"
>
</File>
+ <File
+ RelativePath="..\..\interpreter\VMInspector.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\VMInspector.h"
+ >
+ </File>
</Filter>
<Filter
Name="bytecompiler"
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index a41fb993b..7dd87fee0 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -712,6 +712,8 @@
E49DC16B12EF293E00184A1F /* SourceProviderCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49DC15512EF277200184A1F /* SourceProviderCache.cpp */; };
E49DC16C12EF294E00184A1F /* SourceProviderCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E49DC15112EF272200184A1F /* SourceProviderCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */ = {isa = PBXBuildFile; fileRef = E49DC14912EF261A00184A1F /* SourceProviderCacheItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */; };
+ FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -1503,6 +1505,8 @@
F692A8850255597D01FF60F7 /* UString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UString.cpp; sourceTree = "<group>"; tabWidth = 8; };
F692A8860255597D01FF60F7 /* UString.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = UString.h; sourceTree = "<group>"; tabWidth = 8; };
F692A8870255597D01FF60F7 /* JSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSValue.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMInspector.cpp; sourceTree = "<group>"; };
+ FE4A331E15BD2E07006F54F3 /* VMInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInspector.h; sourceTree = "<group>"; };
FEB63AA2159B9DA3008932A6 /* Comment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Comment.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -1705,6 +1709,8 @@
1429D77A0ED20D7300B89619 /* interpreter */ = {
isa = PBXGroup;
children = (
+ FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */,
+ FE4A331E15BD2E07006F54F3 /* VMInspector.h */,
0F55F0F114D1063600AC7649 /* AbstractPC.cpp */,
0F55F0F214D1063600AC7649 /* AbstractPC.h */,
A7F8690E0F9584A100558697 /* CachedCall.h */,
@@ -2875,6 +2881,7 @@
0F766D3915AE4A1F008F363E /* StructureStubClearingWatchpoint.h in Headers */,
0F766D4415B2A3C0008F363E /* DFGRegisterSet.h in Headers */,
0F766D4615B3701F008F363E /* DFGScratchRegisterAllocator.h in Headers */,
+ FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */,
0F63943F15C75F19006A597C /* DFGStructureCheckHoistingPhase.h in Headers */,
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */,
@@ -3475,6 +3482,7 @@
0F766D2F15A8DCE0008F363E /* GCAwareJITStubRoutine.cpp in Sources */,
0F766D3415AE2538008F363E /* JumpReplacementWatchpoint.cpp in Sources */,
0F766D3815AE4A1C008F363E /* StructureStubClearingWatchpoint.cpp in Sources */,
+ FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */,
0F63944015C75F1D006A597C /* DFGStructureCheckHoistingPhase.cpp in Sources */,
0F63945415D07055006A597C /* ArrayProfile.cpp in Sources */,
);
diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
index ef1808ffb..e6a9df994 100644
--- a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
+++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
@@ -606,6 +606,12 @@ public:
return Label(this);
}
+ void padBeforePatch()
+ {
+ // Rely on the fact that asking for a label already does the padding.
+ (void)label();
+ }
+
Label watchpointLabel()
{
Label result;
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
index 183e8f980..d2da886c2 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
@@ -646,6 +646,8 @@ public:
DataLabelCompact load32WithCompactAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
+
RegisterID base = address.base;
DataLabelCompact label(this);
@@ -1626,12 +1628,14 @@ public:
ALWAYS_INLINE DataLabel32 moveWithPatch(TrustedImm32 imm, RegisterID dst)
{
+ padBeforePatch();
moveFixedWidthEncoding(imm, dst);
return DataLabel32(this);
}
ALWAYS_INLINE DataLabelPtr moveWithPatch(TrustedImmPtr imm, RegisterID dst)
{
+ padBeforePatch();
moveFixedWidthEncoding(TrustedImm32(imm), dst);
return DataLabelPtr(this);
}
@@ -1659,6 +1663,7 @@ public:
PatchableJump patchableJump()
{
+ padBeforePatch();
m_makeJumpPatchable = true;
Jump result = jump();
m_makeJumpPatchable = false;
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
index da9dd8f2a..d1a4ff3c4 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -175,6 +175,7 @@ public:
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movl_i32r(initialValue.asIntptr(), dest);
return DataLabelPtr(this);
}
@@ -191,6 +192,7 @@ public:
Jump branchPtrWithPatch(RelationalCondition cond, RegisterID left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
{
+ padBeforePatch();
m_assembler.cmpl_ir_force32(initialRightValue.asIntptr(), left);
dataLabel = DataLabelPtr(this);
return Jump(m_assembler.jCC(x86Condition(cond)));
@@ -198,6 +200,7 @@ public:
Jump branchPtrWithPatch(RelationalCondition cond, Address left, DataLabelPtr& dataLabel, TrustedImmPtr initialRightValue = TrustedImmPtr(0))
{
+ padBeforePatch();
m_assembler.cmpl_im_force32(initialRightValue.asIntptr(), left.offset, left.base);
dataLabel = DataLabelPtr(this);
return Jump(m_assembler.jCC(x86Condition(cond)));
@@ -205,6 +208,7 @@ public:
DataLabelPtr storePtrWithPatch(TrustedImmPtr initialValue, ImplicitAddress address)
{
+ padBeforePatch();
m_assembler.movl_i32m(initialValue.asIntptr(), address.offset, address.base);
return DataLabelPtr(this);
}
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
index 115b337f7..905c09426 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
@@ -485,12 +485,14 @@ public:
DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movl_mr_disp32(address.offset, address.base, dest);
return DataLabel32(this);
}
DataLabelCompact load32WithCompactAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movl_mr_disp8(address.offset, address.base, dest);
return DataLabelCompact(this);
}
@@ -503,6 +505,7 @@ public:
DataLabelCompact loadCompactWithAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movl_mr_disp8(address.offset, address.base, dest);
return DataLabelCompact(this);
}
@@ -549,6 +552,7 @@ public:
DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
{
+ padBeforePatch();
m_assembler.movl_rm_disp32(src, address.offset, address.base);
return DataLabel32(this);
}
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
index f5af51323..ac90516f4 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
@@ -304,12 +304,14 @@ public:
DataLabel32 loadPtrWithAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movq_mr_disp32(address.offset, address.base, dest);
return DataLabel32(this);
}
DataLabelCompact loadPtrWithCompactAddressOffsetPatch(Address address, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movq_mr_disp8(address.offset, address.base, dest);
return DataLabelCompact(this);
}
@@ -348,6 +350,7 @@ public:
DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
{
+ padBeforePatch();
m_assembler.movq_rm_disp32(src, address.offset, address.base);
return DataLabel32(this);
}
@@ -518,6 +521,7 @@ public:
DataLabelPtr moveWithPatch(TrustedImmPtr initialValue, RegisterID dest)
{
+ padBeforePatch();
m_assembler.movq_i64r(initialValue.asIntptr(), dest);
return DataLabelPtr(this);
}
diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h
index 0488bb4ea..ea98f6652 100644
--- a/Source/JavaScriptCore/interpreter/CallFrame.h
+++ b/Source/JavaScriptCore/interpreter/CallFrame.h
@@ -272,6 +272,8 @@ namespace JSC {
#endif
ExecState();
~ExecState();
+
+ friend class VMInspector;
};
} // namespace JSC
diff --git a/Source/JavaScriptCore/interpreter/VMInspector.cpp b/Source/JavaScriptCore/interpreter/VMInspector.cpp
new file mode 100644
index 000000000..34bf61535
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/VMInspector.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2012 Apple 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. ``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
+ * 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 "VMInspector.h"
+
+#if ENABLE(VMINSPECTOR)
+
+namespace JSC {
+
+const char* VMInspector::getTypeName(JSValue value)
+{
+ if (value.isInt32())
+ return "<Int32>";
+ if (value.isBoolean())
+ return "<Boolean>";
+ if (value.isNull())
+ return "<Empty>";
+ if (value.isUndefined())
+ return "<Undefined>";
+ if (value.isCell())
+ return "<Cell>";
+ if (value.isEmpty())
+ return "<Empty>";
+ return "";
+}
+
+void VMInspector::dumpFrame0(CallFrame* frame)
+{
+ dumpFrame(frame, 0, 0, 0, 0);
+}
+
+void VMInspector::dumpFrame(CallFrame* frame, const char* prefix,
+ const char* funcName, const char* file, int line)
+{
+ int frameCount = VMInspector::countFrames(frame);
+ if (frameCount < 0)
+ return;
+
+ Instruction* vPC = 0;
+ if (frame->codeBlock())
+ vPC = frame->currentVPC();
+
+ #define CAST reinterpret_cast
+
+ if (prefix)
+ printf("%s ", prefix);
+
+ printf("frame [%d] %p { cb %p:%s, retPC %p:%s, scope %p:%s, callee %p:%s, callerFrame %p:%s, argc %d, vPC %p }",
+ frameCount, frame,
+
+ CAST<void*>(frame[RegisterFile::CodeBlock].payload()),
+ getTypeName(frame[RegisterFile::CodeBlock].jsValue()),
+
+ CAST<void*>(frame[RegisterFile::ReturnPC].payload()),
+ getTypeName(frame[RegisterFile::ReturnPC].jsValue()),
+
+ CAST<void*>(frame[RegisterFile::ScopeChain].payload()),
+ getTypeName(frame[RegisterFile::ScopeChain].jsValue()),
+
+ CAST<void*>(frame[RegisterFile::Callee].payload()),
+ getTypeName(frame[RegisterFile::Callee].jsValue()),
+
+ CAST<void*>(frame[RegisterFile::CallerFrame].payload()),
+ getTypeName(frame[RegisterFile::CallerFrame].jsValue()),
+
+ frame[RegisterFile::ArgumentCount].payload(),
+ vPC);
+
+ if (funcName || file || (line >= 0)) {
+ printf(" @");
+ if (funcName)
+ printf(" %s", funcName);
+ if (file)
+ printf(" %s", file);
+ if (line >= 0)
+ printf(":%d", line);
+ }
+ printf("\n");
+}
+
+int VMInspector::countFrames(CallFrame* frame)
+{
+ int count = -1;
+ while (frame && !frame->hasHostCallFrameFlag()) {
+ count++;
+ frame = frame->callerFrame();
+ }
+ return count;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(VMINSPECTOR)
diff --git a/Source/JavaScriptCore/interpreter/VMInspector.h b/Source/JavaScriptCore/interpreter/VMInspector.h
new file mode 100644
index 000000000..6806cafa1
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/VMInspector.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Apple 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. ``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
+ * 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 VMInspector_h
+#define VMInspector_h
+
+#define ENABLE_VMINSPECTOR 0
+
+#if ENABLE(VMINSPECTOR)
+
+#include "CallFrame.h"
+#include "JSValue.h"
+
+namespace JSC {
+
+class VMInspector {
+public:
+ static JS_EXPORT_PRIVATE const char* getTypeName(JSValue);
+ static JS_EXPORT_PRIVATE void dumpFrame0(CallFrame*);
+ static JS_EXPORT_PRIVATE void dumpFrame(CallFrame*, const char* prefix = 0, const char* funcName = 0, const char* file = 0, int line = -1);
+ static JS_EXPORT_PRIVATE int countFrames(CallFrame*);
+};
+
+} // namespace JSC
+
+#endif // ENABLE(VMINSPECTOR)
+
+#endif // VMInspector.h
diff --git a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp
index 725108dd5..00311dab4 100644
--- a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp
+++ b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp
@@ -43,9 +43,11 @@ void JumpReplacementWatchpoint::correctLabels(LinkBuffer& linkBuffer)
void JumpReplacementWatchpoint::fireInternal()
{
- MacroAssembler::replaceWithJump(
- CodeLocationLabel(bitwise_cast<void*>(m_source)),
- CodeLocationLabel(bitwise_cast<void*>(m_destination)));
+ void* source = bitwise_cast<void*>(m_source);
+ void* destination = bitwise_cast<void*>(m_destination);
+ if (Options::showDisassembly())
+ dataLog("Firing jump replacement watchpoint from %p, to %p.\n", source, destination);
+ MacroAssembler::replaceWithJump(CodeLocationLabel(source), CodeLocationLabel(destination));
if (isOnList())
remove();
}
diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog
index c9e3f90c5..fa415296d 100644
--- a/Source/Platform/ChangeLog
+++ b/Source/Platform/ChangeLog
@@ -1,3 +1,165 @@
+2012-08-21 Benjamin Poulain <bpoulain@apple.com>
+
+ Store CString data in the CStringBuffer to avoid the double indirection
+ https://bugs.webkit.org/show_bug.cgi?id=94562
+
+ Reviewed by Darin Adler.
+
+ * chromium/src/WebCString.cpp:
+ (WebKit::WebCString::length): Update the length() computation following the changes
+ in CStringBuffer.
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126170.
+ http://trac.webkit.org/changeset/126170
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ I spoke too soon
+
+ * chromium/public/WebContentLayer.h:
+ (WebCore):
+ (WebKit):
+ (WebContentLayer):
+ (WebKit::WebContentLayer::WebContentLayer):
+ (WebKit::WebContentLayer::operator=):
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebCore):
+ (WebExternalTextureLayer):
+ (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+ (WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
+ * chromium/public/WebIOSurfaceLayer.h:
+ (WebCore):
+ (WebIOSurfaceLayer):
+ (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+ * chromium/public/WebImageLayer.h:
+ (WebCore):
+ (WebImageLayer):
+ (WebKit::WebImageLayer::WebImageLayer):
+ * chromium/public/WebLayer.h:
+ (WebKit):
+ (WebLayer):
+ (WebKit::WebLayer::WebLayer):
+ (WebKit::WebLayer::~WebLayer):
+ (WebKit::WebLayer::operator=):
+ (WebKit::WebLayer::isNull):
+ (WebKit::WebLayer::to):
+ (WebKit::WebLayer::toConst):
+ (WebKit::WebLayer::unwrap):
+ (WebKit::WebLayer::constUnwrap):
+ (WebKit::operator==):
+ (WebKit::operator!=):
+ * chromium/public/WebScrollableLayer.h: Copied from Source/Platform/chromium/public/WebScrollbarLayer.h.
+ (WebKit):
+ (WebScrollableLayer):
+ (WebKit::WebScrollableLayer::WebScrollableLayer):
+ (WebKit::WebScrollableLayer::~WebScrollableLayer):
+ (WebKit::WebScrollableLayer::operator=):
+ * chromium/public/WebScrollbarLayer.h:
+ (WebCore):
+ (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+ (WebKit::WebScrollbarLayer::operator=):
+ (WebScrollbarLayer):
+ * chromium/public/WebSolidColorLayer.h:
+ (WebKit):
+ (WebSolidColorLayer):
+ * chromium/public/WebVideoLayer.h:
+ (WebCore):
+ (WebVideoLayer):
+ (WebKit::WebVideoLayer::WebVideoLayer):
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126169.
+ http://trac.webkit.org/changeset/126169
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Crashes already fixed downstream
+
+ * chromium/public/WebContentLayer.h:
+ (WebContentLayer):
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebExternalTextureLayer):
+ * chromium/public/WebIOSurfaceLayer.h:
+ (WebIOSurfaceLayer):
+ * chromium/public/WebImageLayer.h:
+ (WebImageLayer):
+ * chromium/public/WebLayer.h:
+ (WebKit):
+ (WebLayer):
+ (WebKit::WebLayer::~WebLayer):
+ * chromium/public/WebScrollableLayer.h: Removed.
+ * chromium/public/WebScrollbarLayer.h:
+ (WebScrollbarLayer):
+ * chromium/public/WebSolidColorLayer.h:
+ (WebKit):
+ (WebSolidColorLayer):
+ (WebKit::WebSolidColorLayer::~WebSolidColorLayer):
+ * chromium/public/WebVideoLayer.h:
+ (WebVideoLayer):
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126076, r126099, and r126106.
+ http://trac.webkit.org/changeset/126076
+ http://trac.webkit.org/changeset/126099
+ http://trac.webkit.org/changeset/126106
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Caused crashes during compositor shutdown in Aura builds of
+ Chromium (Requested by kbr_google on #webkit).
+
+ * chromium/public/WebContentLayer.h:
+ (WebCore):
+ (WebKit):
+ (WebContentLayer):
+ (WebKit::WebContentLayer::WebContentLayer):
+ (WebKit::WebContentLayer::operator=):
+ * chromium/public/WebExternalTextureLayer.h:
+ (WebCore):
+ (WebExternalTextureLayer):
+ (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+ (WebKit::WebExternalTextureLayer::~WebExternalTextureLayer):
+ * chromium/public/WebIOSurfaceLayer.h:
+ (WebCore):
+ (WebIOSurfaceLayer):
+ (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+ * chromium/public/WebImageLayer.h:
+ (WebCore):
+ (WebImageLayer):
+ (WebKit::WebImageLayer::WebImageLayer):
+ * chromium/public/WebLayer.h:
+ (WebKit):
+ (WebLayer):
+ (WebKit::WebLayer::WebLayer):
+ (WebKit::WebLayer::~WebLayer):
+ (WebKit::WebLayer::operator=):
+ (WebKit::WebLayer::isNull):
+ (WebKit::WebLayer::to):
+ (WebKit::WebLayer::toConst):
+ (WebKit::WebLayer::unwrap):
+ (WebKit::WebLayer::constUnwrap):
+ (WebKit::operator==):
+ (WebKit::operator!=):
+ * chromium/public/WebScrollableLayer.h: Copied from Source/Platform/chromium/public/WebScrollbarLayer.h.
+ (WebKit):
+ (WebScrollableLayer):
+ (WebKit::WebScrollableLayer::WebScrollableLayer):
+ (WebKit::WebScrollableLayer::~WebScrollableLayer):
+ (WebKit::WebScrollableLayer::operator=):
+ * chromium/public/WebScrollbarLayer.h:
+ (WebCore):
+ (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+ (WebKit::WebScrollbarLayer::operator=):
+ (WebScrollbarLayer):
+ * chromium/public/WebSolidColorLayer.h:
+ (WebKit):
+ (WebSolidColorLayer):
+ * chromium/public/WebVideoLayer.h:
+ (WebCore):
+ (WebVideoLayer):
+ (WebKit::WebVideoLayer::WebVideoLayer):
+
2012-08-20 James Robinson <jamesr@chromium.org>
[chromium] REGRESSION(126076) Should not touch old GraphicsLayerChromium::m_contentsLayer when setting up a new contents layer
diff --git a/Source/Platform/chromium/public/WebContentLayer.h b/Source/Platform/chromium/public/WebContentLayer.h
index 312107f9c..7336bfabc 100644
--- a/Source/Platform/chromium/public/WebContentLayer.h
+++ b/Source/Platform/chromium/public/WebContentLayer.h
@@ -27,37 +27,55 @@
#define WebContentLayer_h
#include "WebCommon.h"
+#include "WebScrollableLayer.h"
+
+namespace WebCore {
+class ContentLayerChromium;
+}
namespace WebKit {
class WebContentLayerClient;
+class WebContentLayerImpl;
-class WebContentLayer {
+class WebContentLayer : public WebScrollableLayer {
public:
- // The client must outlive the WebContentLayer.
- WEBKIT_EXPORT static WebContentLayer* create(WebContentLayerClient*);
+ WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*);
+ WebContentLayer() { }
+ WebContentLayer(const WebContentLayer& layer) : WebScrollableLayer(layer) { }
virtual ~WebContentLayer() { }
+ WebContentLayer& operator=(const WebContentLayer& layer)
+ {
+ WebLayer::assign(layer);
+ return *this;
+ }
- // The WebContentLayer has ownership of this wrapper.
- virtual WebLayer* layer() = 0;
+ // Called when the WebContentLayerClient is going away and should not be used.
+ WEBKIT_EXPORT void clearClient();
// Set to true if the backside of this layer's contents should be visible when composited.
// Defaults to false.
- virtual void setDoubleSided(bool) = 0;
+ WEBKIT_EXPORT void setDoubleSided(bool);
// Set to apply a scale factor used when painting and drawing this layer's content. Defaults to 1.0.
- virtual void setContentsScale(float) = 0;
+ WEBKIT_EXPORT void setContentsScale(float);
// Set to render text in this layer with LCD antialiasing. Only set if you know that this layer will be
// drawn in a way where this makes sense - i.e. opaque background, not rotated or scaled, etc.
// Defaults to false;
- virtual void setUseLCDText(bool) = 0;
+ WEBKIT_EXPORT void setUseLCDText(bool);
// Set to draw a system-defined checkerboard if the compositor would otherwise draw a tile in this layer
// and the actual contents are unavailable. If false, the compositor will draw the layer's background color
// for these tiles.
// Defaults to false.
- virtual void setDrawCheckerboardForMissingTiles(bool) = 0;
+ WEBKIT_EXPORT void setDrawCheckerboardForMissingTiles(bool);
+
+#if WEBKIT_IMPLEMENTATION
+ WebContentLayer(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
+ WebContentLayer& operator=(const WTF::PassRefPtr<WebCore::ContentLayerChromium>&);
+ operator WTF::PassRefPtr<WebCore::ContentLayerChromium>() const;
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/public/WebExternalTextureLayer.h b/Source/Platform/chromium/public/WebExternalTextureLayer.h
index 92d2c4fee..b19c05f3e 100644
--- a/Source/Platform/chromium/public/WebExternalTextureLayer.h
+++ b/Source/Platform/chromium/public/WebExternalTextureLayer.h
@@ -30,6 +30,10 @@
#include "WebFloatRect.h"
#include "WebLayer.h"
+namespace WebCore {
+class TextureLayerChromium;
+}
+
namespace WebKit {
class WebExternalTextureLayerClient;
@@ -40,43 +44,49 @@ class WebExternalTextureLayerClient;
// When in single-thread mode, this means during WebLayerTreeView::composite().
// When using the threaded compositor, this can mean at an arbitrary time until
// the WebLayerTreeView is destroyed.
-class WebExternalTextureLayer {
+class WebExternalTextureLayer : public WebLayer {
public:
// The owner of this layer may optionally provide a client. This client will
// be called whenever the compositor wishes to produce a new frame and can
// provide a new front buffer texture ID. This is useful if the client wants to
// implement a double-buffering scheme that is synchronized with the compositor, for instance.
- // The client must outlive the WebExternalTextureLayer.
- WEBKIT_EXPORT static WebExternalTextureLayer* create(WebExternalTextureLayerClient* = 0);
+ WEBKIT_EXPORT static WebExternalTextureLayer create(WebExternalTextureLayerClient* = 0);
- virtual ~WebExternalTextureLayer() { }
+ // Indicates that the client for this layer is going away and shouldn't be used.
+ WEBKIT_EXPORT void clearClient();
- virtual WebLayer* layer() = 0;
+ WebExternalTextureLayer() { }
+ virtual ~WebExternalTextureLayer() { }
// Sets the texture id that represents the layer, in the namespace of the
// compositor context.
- virtual void setTextureId(unsigned) = 0;
+ WEBKIT_EXPORT void setTextureId(unsigned);
// Sets whether or not the texture should be flipped in the Y direction when
// rendered.
- virtual void setFlipped(bool) = 0;
+ WEBKIT_EXPORT void setFlipped(bool);
// Sets the rect in UV space of the texture that is mapped to the layer
// bounds.
- virtual void setUVRect(const WebFloatRect&) = 0;
+ WEBKIT_EXPORT void setUVRect(const WebFloatRect&);
// Sets whether every pixel in this layer is opaque. Defaults to false.
- virtual void setOpaque(bool) = 0;
+ WEBKIT_EXPORT void setOpaque(bool);
// Sets whether this layer's texture has premultiplied alpha or not. Defaults to true.
- virtual void setPremultipliedAlpha(bool) = 0;
+ WEBKIT_EXPORT void setPremultipliedAlpha(bool);
// Indicates that the most recently provided texture ID is about to be modified externally.
- virtual void willModifyTexture() = 0;
+ WEBKIT_EXPORT void willModifyTexture();
// Sets whether this context should be rate limited by the compositor. Rate limiting works by blocking
// invalidate() and invalidateRect() calls if the compositor is too many frames behind.
- virtual void setRateLimitContext(bool) = 0;
+ WEBKIT_EXPORT void setRateLimitContext(bool);
+
+private:
+#if WEBKIT_IMPLEMENTATION
+ explicit WebExternalTextureLayer(PassRefPtr<WebCore::TextureLayerChromium>);
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/public/WebIOSurfaceLayer.h b/Source/Platform/chromium/public/WebIOSurfaceLayer.h
index bcf14112a..37a4c6792 100644
--- a/Source/Platform/chromium/public/WebIOSurfaceLayer.h
+++ b/Source/Platform/chromium/public/WebIOSurfaceLayer.h
@@ -30,19 +30,27 @@
#include "WebLayer.h"
#include "WebSize.h"
+namespace WebCore {
+class IOSurfaceLayerChromium;
+}
+
namespace WebKit {
// This class represents a layer that renders an externally managed IOSurface.
-class WebIOSurfaceLayer {
+class WebIOSurfaceLayer : public WebLayer {
public:
- WEBKIT_EXPORT static WebIOSurfaceLayer* create();
+ WEBKIT_EXPORT static WebIOSurfaceLayer create();
+ WebIOSurfaceLayer() { }
virtual ~WebIOSurfaceLayer() { }
- virtual WebLayer* layer() = 0;
-
// Sets the IO surface id that represents this layer's contents.
- virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) = 0;
+ WEBKIT_EXPORT void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize);
+
+private:
+#if WEBKIT_IMPLEMENTATION
+ explicit WebIOSurfaceLayer(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/public/WebImageLayer.h b/Source/Platform/chromium/public/WebImageLayer.h
index c7737f31a..a916835f2 100644
--- a/Source/Platform/chromium/public/WebImageLayer.h
+++ b/Source/Platform/chromium/public/WebImageLayer.h
@@ -30,16 +30,24 @@
#include "WebCommon.h"
#include "WebLayer.h"
+namespace WebCore {
+class ImageLayerChromium;
+}
+
namespace WebKit {
-class WebImageLayer {
+class WebImageLayer : public WebLayer {
public:
- WEBKIT_EXPORT static WebImageLayer* create();
+ WEBKIT_EXPORT static WebImageLayer create();
+ WebImageLayer() { }
virtual ~WebImageLayer() { }
- virtual WebLayer* layer() = 0;
- virtual void setBitmap(SkBitmap) = 0;
+ WEBKIT_EXPORT void setBitmap(SkBitmap);
+
+#if WEBKIT_IMPLEMENTATION
+ explicit WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium>);
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/public/WebLayer.h b/Source/Platform/chromium/public/WebLayer.h
index 60ed69423..6431f848c 100644
--- a/Source/Platform/chromium/public/WebLayer.h
+++ b/Source/Platform/chromium/public/WebLayer.h
@@ -29,13 +29,12 @@
#include "WebAnimation.h"
#include "WebColor.h"
#include "WebCommon.h"
-#include "WebPoint.h"
#include "WebPrivatePtr.h"
-#include "WebRect.h"
#include "WebString.h"
#include "WebVector.h"
class SkMatrix44;
+namespace WebCore { class LayerChromium; }
namespace WebKit {
class WebAnimationDelegate;
@@ -45,69 +44,73 @@ struct WebFloatPoint;
struct WebFloatRect;
struct WebSize;
-class WebLayerImpl;
-
class WebLayer {
public:
-#define WEBLAYER_IS_PURE_VIRTUAL
- WEBKIT_EXPORT static WebLayer* create();
-
- virtual ~WebLayer() { }
-
- // Returns a positive ID that will be unique across all WebLayers allocated in this process.
- virtual int id() const = 0;
+ WEBKIT_EXPORT static WebLayer create();
+
+ WebLayer() { }
+ WebLayer(const WebLayer& layer) { assign(layer); }
+ virtual ~WebLayer() { reset(); }
+ WebLayer& operator=(const WebLayer& layer)
+ {
+ assign(layer);
+ return *this;
+ }
+ bool isNull() const { return m_private.isNull(); }
+ WEBKIT_EXPORT void reset();
+ WEBKIT_EXPORT void assign(const WebLayer&);
+ WEBKIT_EXPORT bool equals(const WebLayer&) const;
// Sets a region of the layer as invalid, i.e. needs to update its content.
- virtual void invalidateRect(const WebFloatRect&) = 0;
+ WEBKIT_EXPORT void invalidateRect(const WebFloatRect&);
// Sets the entire layer as invalid, i.e. needs to update its content.
- virtual void invalidate() = 0;
+ WEBKIT_EXPORT void invalidate();
- // These functions do not take ownership of the WebLayer* parameter.
- virtual void addChild(WebLayer*) = 0;
- virtual void insertChild(WebLayer*, size_t index) = 0;
- virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) = 0;
- virtual void setChildren(const WebVector<WebLayer*>&) = 0;
- virtual void removeFromParent() = 0;
- virtual void removeAllChildren() = 0;
+ WEBKIT_EXPORT void addChild(const WebLayer&);
+ WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index);
+ WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer);
+ WEBKIT_EXPORT void setChildren(const WebVector<WebLayer>&);
+ WEBKIT_EXPORT void removeFromParent();
+ WEBKIT_EXPORT void removeAllChildren();
- virtual void setAnchorPoint(const WebFloatPoint&) = 0;
- virtual WebFloatPoint anchorPoint() const = 0;
+ WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&);
+ WEBKIT_EXPORT WebFloatPoint anchorPoint() const;
- virtual void setAnchorPointZ(float) = 0;
- virtual float anchorPointZ() const = 0;
+ WEBKIT_EXPORT void setAnchorPointZ(float);
+ WEBKIT_EXPORT float anchorPointZ() const;
- virtual void setBounds(const WebSize&) = 0;
- virtual WebSize bounds() const = 0;
+ WEBKIT_EXPORT void setBounds(const WebSize&);
+ WEBKIT_EXPORT WebSize bounds() const;
- virtual void setMasksToBounds(bool) = 0;
- virtual bool masksToBounds() const = 0;
+ WEBKIT_EXPORT void setMasksToBounds(bool);
+ WEBKIT_EXPORT bool masksToBounds() const;
- virtual void setMaskLayer(WebLayer*) = 0;
- virtual void setReplicaLayer(WebLayer*) = 0;
+ WEBKIT_EXPORT void setMaskLayer(const WebLayer&);
+ WEBKIT_EXPORT void setReplicaLayer(const WebLayer&);
- virtual void setOpacity(float) = 0;
- virtual float opacity() const = 0;
+ WEBKIT_EXPORT void setOpacity(float);
+ WEBKIT_EXPORT float opacity() const;
- virtual void setOpaque(bool) = 0;
- virtual bool opaque() const = 0;
+ WEBKIT_EXPORT void setOpaque(bool);
+ WEBKIT_EXPORT bool opaque() const;
- virtual void setPosition(const WebFloatPoint&) = 0;
- virtual WebFloatPoint position() const = 0;
+ WEBKIT_EXPORT void setPosition(const WebFloatPoint&);
+ WEBKIT_EXPORT WebFloatPoint position() const;
- virtual void setSublayerTransform(const SkMatrix44&) = 0;
- virtual void setSublayerTransform(const WebTransformationMatrix&) = 0;
- virtual SkMatrix44 sublayerTransform() const = 0;
+ WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&);
+ WEBKIT_EXPORT void setSublayerTransform(const WebTransformationMatrix&);
+ WEBKIT_EXPORT SkMatrix44 sublayerTransform() const;
- virtual void setTransform(const SkMatrix44&) = 0;
- virtual void setTransform(const WebTransformationMatrix&) = 0;
- virtual SkMatrix44 transform() const = 0;
+ WEBKIT_EXPORT void setTransform(const SkMatrix44&);
+ WEBKIT_EXPORT void setTransform(const WebTransformationMatrix&);
+ WEBKIT_EXPORT SkMatrix44 transform() const;
// Sets whether the layer draws its content when compositing.
- virtual void setDrawsContent(bool) = 0;
- virtual bool drawsContent() const = 0;
+ WEBKIT_EXPORT void setDrawsContent(bool);
+ WEBKIT_EXPORT bool drawsContent() const;
- virtual void setPreserves3D(bool) = 0;
+ WEBKIT_EXPORT void setPreserves3D(bool);
// Mark that this layer should use its parent's transform and double-sided
// properties in determining this layer's backface visibility instead of
@@ -116,68 +119,105 @@ public:
// Note: This API is to work around issues with visibility the handling of
// WebKit layers that have a contents layer (canvas, plugin, WebGL, video,
// etc).
- virtual void setUseParentBackfaceVisibility(bool) = 0;
+ WEBKIT_EXPORT void setUseParentBackfaceVisibility(bool);
- virtual void setBackgroundColor(WebColor) = 0;
+ WEBKIT_EXPORT void setBackgroundColor(WebColor);
// Clear the filters in use by passing in a newly instantiated
// WebFilterOperations object.
- virtual void setFilters(const WebFilterOperations&) = 0;
+ WEBKIT_EXPORT void setFilters(const WebFilterOperations&);
// Apply filters to pixels that show through the background of this layer.
// Note: These filters are only possible on layers that are drawn directly
// to a root render surface with an opaque background. This means if an
// ancestor of the background-filtered layer sets certain properties
// (opacity, transforms), it may conflict and hide the background filters.
- virtual void setBackgroundFilters(const WebFilterOperations&) = 0;
+ WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
- virtual void setDebugBorderColor(const WebColor&) = 0;
- virtual void setDebugBorderWidth(float) = 0;
- virtual void setDebugName(WebString) = 0;
+ WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
+ WEBKIT_EXPORT void setDebugBorderWidth(float);
+ WEBKIT_EXPORT void setDebugName(WebString);
// An animation delegate is notified when animations are started and
// stopped. The WebLayer does not take ownership of the delegate, and it is
// the responsibility of the client to reset the layer's delegate before
// deleting the delegate.
- virtual void setAnimationDelegate(WebAnimationDelegate*) = 0;
+ WEBKIT_EXPORT void setAnimationDelegate(WebAnimationDelegate*);
// Returns false if the animation cannot be added.
- virtual bool addAnimation(WebAnimation*) = 0;
+ WEBKIT_EXPORT bool addAnimation(WebAnimation*);
// Removes all animations with the given id.
- virtual void removeAnimation(int animationId) = 0;
+ WEBKIT_EXPORT void removeAnimation(int animationId);
// Removes all animations with the given id targeting the given property.
- virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) = 0;
+ WEBKIT_EXPORT void removeAnimation(int animationId, WebAnimation::TargetProperty);
// Pauses all animations with the given id.
- virtual void pauseAnimation(int animationId, double timeOffset) = 0;
+ WEBKIT_EXPORT void pauseAnimation(int animationId, double timeOffset);
// The following functions suspend and resume all animations. The given time
// is assumed to use the same time base as monotonicallyIncreasingTime().
- virtual void suspendAnimations(double monotonicTime) = 0;
- virtual void resumeAnimations(double monotonicTime) = 0;
+ WEBKIT_EXPORT void suspendAnimations(double monotonicTime);
+ WEBKIT_EXPORT void resumeAnimations(double monotonicTime);
// Returns true if this layer has any active animations - useful for tests.
- virtual bool hasActiveAnimation() = 0;
+ WEBKIT_EXPORT bool hasActiveAnimation();
// Transfers all animations running on the current layer.
- virtual void transferAnimationsTo(WebLayer*) = 0;
-
- // Scrolling
- virtual void setScrollPosition(WebPoint) = 0;
- virtual void setScrollable(bool) = 0;
- virtual void setHaveWheelEventHandlers(bool) = 0;
- virtual void setShouldScrollOnMainThread(bool) = 0;
- virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) = 0;
- virtual void setIsContainerForFixedPositionLayers(bool) = 0;
- virtual void setFixedToContainerLayer(bool) = 0;
+ WEBKIT_EXPORT void transferAnimationsTo(WebLayer*);
// Forces this layer to use a render surface. There is no benefit in doing
// so, but this is to facilitate benchmarks and tests.
- virtual void setForceRenderSurface(bool) = 0;
+ WEBKIT_EXPORT void setForceRenderSurface(bool);
+
+ // Drops this layer's render surface, if it has one. Used to break cycles in some
+ // cases - if you aren't sure, you don't need to call this.
+ WEBKIT_EXPORT void clearRenderSurface();
+
+ template<typename T> T to()
+ {
+ T res;
+ res.WebLayer::assign(*this);
+ return res;
+ }
+
+ template<typename T> const T toConst() const
+ {
+ T res;
+ res.WebLayer::assign(*this);
+ return res;
+ }
+
+#if WEBKIT_IMPLEMENTATION
+ WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&);
+ WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&);
+ operator WTF::PassRefPtr<WebCore::LayerChromium>() const;
+ template<typename T> T* unwrap() const
+ {
+ return static_cast<T*>(m_private.get());
+ }
+
+ template<typename T> const T* constUnwrap() const
+ {
+ return static_cast<const T*>(m_private.get());
+ }
+#endif
+
+protected:
+ WebPrivatePtr<WebCore::LayerChromium> m_private;
};
+inline bool operator==(const WebLayer& a, const WebLayer& b)
+{
+ return a.equals(b);
+}
+
+inline bool operator!=(const WebLayer& a, const WebLayer& b)
+{
+ return !(a == b);
+}
+
} // namespace WebKit
#endif // WebLayer_h
diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/Platform/chromium/public/WebScrollableLayer.h
index 3dbb02759..ea02f8c73 100644
--- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h
+++ b/Source/Platform/chromium/public/WebScrollableLayer.h
@@ -23,32 +23,42 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebIOSurfaceLayerImpl_h
-#define WebIOSurfaceLayerImpl_h
+#ifndef WebScrollableLayer_h
+#define WebScrollableLayer_h
-#include <public/WebIOSurfaceLayer.h>
-#include <wtf/OwnPtr.h>
-
-namespace WebCore {
-class IOSurfaceLayerChromium;
-}
+#include "WebCommon.h"
+#include "WebLayer.h"
+#include "WebPoint.h"
+#include "WebRect.h"
+#include "WebVector.h"
namespace WebKit {
-class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer {
+class WebScrollableLayer : public WebLayer {
public:
- explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>);
- virtual ~WebIOSurfaceLayerImpl();
+ WebScrollableLayer() { }
+ WebScrollableLayer(const WebScrollableLayer& layer) : WebLayer(layer) { }
+ virtual ~WebScrollableLayer() { }
+ WebScrollableLayer& operator=(const WebScrollableLayer& layer)
+ {
+ WebLayer::assign(layer);
+ return *this;
+ }
- // WebIOSurfaceLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual void setIOSurfaceProperties(unsigned ioSurfaceId, WebSize) OVERRIDE;
+ WEBKIT_EXPORT void setScrollPosition(WebPoint);
+ WEBKIT_EXPORT void setScrollable(bool);
+ WEBKIT_EXPORT void setHaveWheelEventHandlers(bool);
+ WEBKIT_EXPORT void setShouldScrollOnMainThread(bool);
+ WEBKIT_EXPORT void setNonFastScrollableRegion(const WebVector<WebRect>&);
+ WEBKIT_EXPORT void setIsContainerForFixedPositionLayers(bool);
+ WEBKIT_EXPORT void setFixedToContainerLayer(bool);
-private:
- OwnPtr<WebLayerImpl> m_layer;
-};
-}
+#if WEBKIT_IMPLEMENTATION
+ WebScrollableLayer(const WTF::PassRefPtr<WebCore::LayerChromium>& layer) : WebLayer(layer) { }
+#endif
+};
-#endif // WebIOSurfaceLayerImpl_h
+} // namespace WebKit
+#endif // WebScrollableLayer_h
diff --git a/Source/Platform/chromium/public/WebScrollbarLayer.h b/Source/Platform/chromium/public/WebScrollbarLayer.h
index 451a0b9c1..1bfe7d6ab 100644
--- a/Source/Platform/chromium/public/WebScrollbarLayer.h
+++ b/Source/Platform/chromium/public/WebScrollbarLayer.h
@@ -32,20 +32,29 @@
namespace WebCore {
class Scrollbar;
+class ScrollbarLayerChromium;
}
namespace WebKit {
-class WebScrollbarLayer {
+class WebScrollbarLayer : public WebLayer {
public:
+ WebScrollbarLayer() { }
+ WebScrollbarLayer(const WebScrollbarLayer& layer) : WebLayer(layer) { }
virtual ~WebScrollbarLayer() { }
+ WebScrollbarLayer& operator=(const WebScrollbarLayer& layer)
+ {
+ WebLayer::assign(layer);
+ return *this;
+ }
- virtual WebLayer* layer() = 0;
-
- virtual void setScrollLayer(WebLayer*) = 0;
+ WEBKIT_EXPORT void setScrollLayer(const WebLayer);
#if WEBKIT_IMPLEMENTATION
- WEBKIT_EXPORT static WebScrollbarLayer* create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
+ static WebScrollbarLayer create(WebCore::Scrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>);
+ explicit WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
+ WebScrollbarLayer& operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>&);
+ operator WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>() const;
#endif
};
diff --git a/Source/Platform/chromium/public/WebSolidColorLayer.h b/Source/Platform/chromium/public/WebSolidColorLayer.h
index 02e46f047..ad9123d96 100644
--- a/Source/Platform/chromium/public/WebSolidColorLayer.h
+++ b/Source/Platform/chromium/public/WebSolidColorLayer.h
@@ -26,20 +26,21 @@
#ifndef WebSolidColorLayer_h
#define WebSolidColorLayer_h
-#include "WebColor.h"
#include "WebCommon.h"
+#include "WebFloatRect.h"
+#include "WebLayer.h"
namespace WebKit {
-class WebLayer;
+class WebSolidColorLayerImpl;
-class WebSolidColorLayer {
+class WebSolidColorLayer : public WebLayer {
public:
- WEBKIT_EXPORT static WebSolidColorLayer* create();
+ WEBKIT_EXPORT static WebSolidColorLayer create();
+ WEBKIT_EXPORT void setBackgroundColor(const WebColor&);
- virtual ~WebSolidColorLayer() { }
-
- virtual WebLayer* layer() = 0;
- virtual void setBackgroundColor(WebColor) = 0;
+#if WEBKIT_IMPLEMENTATION
+ WebSolidColorLayer(const WTF::PassRefPtr<WebSolidColorLayerImpl>&);
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/public/WebVideoLayer.h b/Source/Platform/chromium/public/WebVideoLayer.h
index 1acfff54a..54da3454b 100644
--- a/Source/Platform/chromium/public/WebVideoLayer.h
+++ b/Source/Platform/chromium/public/WebVideoLayer.h
@@ -29,20 +29,27 @@
#include "WebCommon.h"
#include "WebLayer.h"
+namespace WebCore {
+class VideoLayerChromium;
+}
+
namespace WebKit {
class WebVideoFrameProvider;
-class WebVideoLayer {
+class WebVideoLayer : public WebLayer {
public:
- WEBKIT_EXPORT static WebVideoLayer* create(WebVideoFrameProvider*);
+ WEBKIT_EXPORT static WebVideoLayer create(WebVideoFrameProvider*);
+ WebVideoLayer() { }
virtual ~WebVideoLayer() { }
- virtual WebLayer* layer() = 0;
-
// Returns true if this layer is actively rendering (e.g. currently attached to a WebLayerTreeView).
- virtual bool active() const = 0;
+ WEBKIT_EXPORT bool active() const;
+
+#if WEBKIT_IMPLEMENTATION
+ explicit WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium>);
+#endif
};
} // namespace WebKit
diff --git a/Source/Platform/chromium/src/WebCString.cpp b/Source/Platform/chromium/src/WebCString.cpp
index 9a96ac9cb..eb4243736 100644
--- a/Source/Platform/chromium/src/WebCString.cpp
+++ b/Source/Platform/chromium/src/WebCString.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -77,8 +78,7 @@ size_t WebCString::length() const
{
if (!m_private)
return 0;
- // NOTE: The buffer's length includes the null byte.
- return const_cast<WebCStringPrivate*>(m_private)->length() - 1;
+ return const_cast<WebCStringPrivate*>(m_private)->length();
}
const char* WebCString::data() const
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index e54a38b07..0a9054705 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,110 @@
+2012-08-21 Mark Hahnenberg <mhahnenberg@apple.com>
+
+ WTF Threading leaks kernel objects on platforms that use pthreads
+ https://bugs.webkit.org/show_bug.cgi?id=94636
+
+ Reviewed by Geoffrey Garen.
+
+ Creating lots of Web workers on Mac platforms leaks lots of Mach ports. Eventually, the
+ process can exhaust its allocation of Mach ports from the kernel, which can then cause
+ all sorts of badness, including the inability to allocate new virtual memory from the
+ kernel. ThreadingPthreads.cpp and ThreadIdentifierDataPthreads.cpp need to be refactored
+ so that we do not leak these kernel resources. I would assume that we also leak kernel
+ resources on other pthreads platforms as well.
+
+ * wtf/ThreadIdentifierDataPthreads.cpp:
+ (WTF):
+ (WTF::ThreadIdentifierData::~ThreadIdentifierData): Now calls the event threadDidExit, which
+ handles all relevant tear-down of the thread metadata in the thread map.
+ * wtf/ThreadingPthreads.cpp: Added a new class called PthreadState that encapsulates the
+ state of a thread and the possible transitions between those states.
+ (PthreadState):
+ (WTF::PthreadState::PthreadState):
+ (WTF::PthreadState::joinableState): Returns the current state of the pthread.
+ (WTF::PthreadState::pthreadHandle): Returns the pthread_t for this particular thread. This needs to
+ remain valid even after the thread has exited because somebody could come along at any time in the
+ future and call join on the thread.
+ (WTF::PthreadState::didBecomeDetached): Signals that the thread was detached.
+ (WTF::PthreadState::didExit): Signals that the thread's exit destructor (~ThreadIdentifierData) has run.
+ (WTF::PthreadState::didJoin): Signals that the thread has been joined on successfully.
+ (WTF::PthreadState::hasExited): Returns whether or not the thread's exit destructor has run.
+ (WTF):
+ (WTF::identifierByPthreadHandle): Changed to also check hasExited() on the threads it finds in the map. We
+ should only have one valid pthread_t in the map, but there are other pthread_t's that need to remain in the
+ thread map for when somebody joins on that thread id later.
+ (WTF::establishIdentifierForPthreadHandle): Changed to put the allocate the new PthreadState data structure and
+ put it in the map.
+ (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld):
+ (WTF::wtfThreadEntryPoint):
+ (WTF::waitForThreadCompletion): We now do the relevant cleanup after the specified thread has been
+ successfully joined on depending on if the joined thread has already exited.
+ (WTF::detachThread): Performs relevant cleanup if the thread has already exited. Otherwise signals to the
+ PthreadState that the thread has been detached.
+ (WTF::threadDidExit): Function called by ~ThreadIdentifierData to indicate that the thread has exited.
+ Only cleans up after itself if the thread isn't Joinable (i.e. Joined or Detached).
+
+2012-08-21 Ulan Degenbaev <ulan@chromium.org>
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer constructed and destructed
+ https://bugs.webkit.org/show_bug.cgi?id=92993
+
+ Reviewed by Kenneth Russell.
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer
+ is constructed and destructed so that V8's garbage collection
+ heuristics can account for the memory held by these objects.
+
+ * wtf/ArrayBuffer.h:
+ (WTF):
+ (ArrayBufferDeallocationObserver):
+ (WTF::ArrayBufferContents::ArrayBufferContents):
+ (WTF::ArrayBufferContents::transfer):
+ (ArrayBufferContents):
+ (ArrayBuffer):
+ (WTF::ArrayBuffer::setDeallocationObserver):
+ (WTF::ArrayBufferContents::~ArrayBufferContents):
+
+2012-08-21 Benjamin Poulain <bpoulain@apple.com>
+
+ Store CString data in the CStringBuffer to avoid the double indirection
+ https://bugs.webkit.org/show_bug.cgi?id=94562
+
+ Reviewed by Darin Adler.
+
+ Previously, any non-trivial CString would require two allocations:
+ 1) CStringBuffer (ref-counted container for CString's data).
+ 2) VectorBuffer's m_buffer (the actual char data).
+
+ This patches changes CStringBuffer to hold the data previously owned by
+ WTF::Vector and WTF::VectorBuffer. This makes CString more efficient
+ both in CPU time and memory use.
+
+ * wtf/text/CString.cpp:
+ (WTF::CStringBuffer::createUninitialized): This new method allocate the memory
+ for CStringBuffer and its data. We simply allocate more memory after CStringBuffer
+ to hold the data.
+
+ The extra memory needed to store the terminating zero is now handled by design.
+ (WTF::CString::CString): Move the test for "str" one level up the stack from CString::init().
+ This avoid double checking the pointer when using the other constructor.
+ (WTF::CString::init):
+ (WTF::CString::newUninitialized):
+ (WTF::CString::copyBufferIfNeeded):
+ * wtf/text/CString.h:
+ (WTF::CStringBuffer::data):
+ (WTF::CStringBuffer::length):
+ (CStringBuffer):
+ (WTF::CStringBuffer::CStringBuffer):
+ (WTF::CStringBuffer::mutableData):
+ (WTF::CString::length):
+
+2012-08-21 Patrick Gansterer <paroga@webkit.org>
+
+ Build fix for COMPILER(MSVC) && !CPU(X86) after r126023.
+
+ * wtf/MathExtras.h:
+ (lrint):
+
2012-08-20 Dominik Röttsches <dominik.rottsches@intel.com>
The 2d.imageData.object.round canvas test is failing
diff --git a/Source/WTF/wtf/ArrayBuffer.h b/Source/WTF/wtf/ArrayBuffer.h
index d2c724978..aa59cf733 100644
--- a/Source/WTF/wtf/ArrayBuffer.h
+++ b/Source/WTF/wtf/ArrayBuffer.h
@@ -36,12 +36,25 @@ namespace WTF {
class ArrayBuffer;
class ArrayBufferView;
+#if defined(WTF_USE_V8)
+// The current implementation assumes that the instance of this class is a
+// singleton living for the entire process's lifetime.
+class ArrayBufferDeallocationObserver {
+public:
+ virtual void ArrayBufferDeallocated(unsigned sizeInBytes) = 0;
+};
+#endif
+
+
class ArrayBufferContents {
WTF_MAKE_NONCOPYABLE(ArrayBufferContents);
public:
ArrayBufferContents()
: m_data(0)
, m_sizeInBytes(0)
+#if defined(WTF_USE_V8)
+ , m_deallocationObserver(0)
+#endif
{ }
inline ~ArrayBufferContents();
@@ -53,6 +66,9 @@ private:
ArrayBufferContents(void* data, unsigned sizeInBytes)
: m_data(data)
, m_sizeInBytes(sizeInBytes)
+#if defined(WTF_USE_V8)
+ , m_deallocationObserver(0)
+#endif
{ }
friend class ArrayBuffer;
@@ -70,10 +86,21 @@ private:
other.m_sizeInBytes = m_sizeInBytes;
m_data = 0;
m_sizeInBytes = 0;
+#if defined(WTF_USE_V8)
+ // Notify the current V8 isolate that the buffer is gone.
+ if (m_deallocationObserver)
+ m_deallocationObserver->ArrayBufferDeallocated(other.m_sizeInBytes);
+ ASSERT(!other.m_deallocationObserver);
+ m_deallocationObserver = 0;
+#endif
}
void* m_data;
unsigned m_sizeInBytes;
+
+#if defined(WTF_USE_V8)
+ ArrayBufferDeallocationObserver* m_deallocationObserver;
+#endif
};
class ArrayBuffer : public RefCounted<ArrayBuffer> {
@@ -99,6 +126,13 @@ public:
WTF_EXPORT_PRIVATE bool transfer(ArrayBufferContents&, Vector<RefPtr<ArrayBufferView> >& neuteredViews);
bool isNeutered() { return !m_contents.m_data; }
+#if defined(WTF_USE_V8)
+ void setDeallocationObserver(ArrayBufferDeallocationObserver* deallocationObserver)
+ {
+ m_contents.m_deallocationObserver = deallocationObserver;
+ }
+#endif
+
~ArrayBuffer() { }
private:
@@ -238,6 +272,10 @@ void ArrayBufferContents::tryAllocate(unsigned numElements, unsigned elementByte
ArrayBufferContents::~ArrayBufferContents()
{
+#if defined (WTF_USE_V8)
+ if (m_deallocationObserver)
+ m_deallocationObserver->ArrayBufferDeallocated(m_sizeInBytes);
+#endif
WTF::fastFree(m_data);
}
diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h
index e7d7c00d4..71be89364 100644
--- a/Source/WTF/wtf/MathExtras.h
+++ b/Source/WTF/wtf/MathExtras.h
@@ -213,7 +213,7 @@ inline long int lrint(double flt)
};
#else
#pragma message("Falling back to casting for lrint(), causes rounding inaccuracy in halfway case.")
- intgr = static_cast<int>flt;
+ intgr = static_cast<int>(flt);
#endif
return intgr;
}
diff --git a/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp b/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp
index 0badf939a..4ad20c8bc 100644
--- a/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp
+++ b/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp
@@ -47,11 +47,11 @@ namespace WTF {
pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX;
-void clearPthreadHandleForIdentifier(ThreadIdentifier);
+void threadDidExit(ThreadIdentifier);
ThreadIdentifierData::~ThreadIdentifierData()
{
- clearPthreadHandleForIdentifier(m_identifier);
+ threadDidExit(m_identifier);
}
void ThreadIdentifierData::initializeOnce()
diff --git a/Source/WTF/wtf/ThreadingPthreads.cpp b/Source/WTF/wtf/ThreadingPthreads.cpp
index 921dd3be7..226ecbd48 100644
--- a/Source/WTF/wtf/ThreadingPthreads.cpp
+++ b/Source/WTF/wtf/ThreadingPthreads.cpp
@@ -61,11 +61,47 @@
namespace WTF {
-typedef HashMap<ThreadIdentifier, pthread_t> ThreadMap;
+class PthreadState {
+public:
+ enum JoinableState {
+ Joinable, // The default thread state. The thread can be joined on.
+
+ Joined, // Somebody waited on this thread to exit and this thread finally exited. This state is here because there can be a
+ // period of time between when the thread exits (which causes pthread_join to return and the remainder of waitOnThreadCompletion to run)
+ // and when threadDidExit is called. We need threadDidExit to take charge and delete the thread data since there's
+ // nobody else to pick up the slack in this case (since waitOnThreadCompletion has already returned).
+
+ Detached // The thread has been detached and can no longer be joined on. At this point, the thread must take care of cleaning up after itself.
+ };
+
+ // Currently all threads created by WTF start out as joinable.
+ PthreadState(pthread_t handle)
+ : m_joinableState(Joinable)
+ , m_didExit(false)
+ , m_pthreadHandle(handle)
+ {
+ }
+
+ JoinableState joinableState() { return m_joinableState; }
+ pthread_t pthreadHandle() { return m_pthreadHandle; }
+ void didBecomeDetached() { m_joinableState = Detached; }
+ void didExit() { m_didExit = true; }
+ void didJoin() { m_joinableState = Joined; }
+ bool hasExited() { return m_didExit; }
+
+private:
+ JoinableState m_joinableState;
+ bool m_didExit;
+ pthread_t m_pthreadHandle;
+};
+
+typedef HashMap<ThreadIdentifier, OwnPtr<PthreadState> > ThreadMap;
static Mutex* atomicallyInitializedStaticMutex;
-void clearPthreadHandleForIdentifier(ThreadIdentifier);
+void unsafeThreadWasDetached(ThreadIdentifier);
+void threadDidExit(ThreadIdentifier);
+void threadWasJoined(ThreadIdentifier);
static Mutex& threadMapMutex()
{
@@ -114,7 +150,7 @@ static ThreadIdentifier identifierByPthreadHandle(const pthread_t& pthreadHandle
ThreadMap::iterator i = threadMap().begin();
for (; i != threadMap().end(); ++i) {
- if (pthread_equal(i->second, pthreadHandle))
+ if (pthread_equal(i->second->pthreadHandle(), pthreadHandle) && !i->second->hasExited())
return i->first;
}
@@ -124,30 +160,15 @@ static ThreadIdentifier identifierByPthreadHandle(const pthread_t& pthreadHandle
static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle)
{
ASSERT(!identifierByPthreadHandle(pthreadHandle));
-
MutexLocker locker(threadMapMutex());
-
static ThreadIdentifier identifierCount = 1;
-
- threadMap().add(identifierCount, pthreadHandle);
-
+ threadMap().add(identifierCount, adoptPtr(new PthreadState(pthreadHandle)));
return identifierCount++;
}
-static pthread_t pthreadHandleForIdentifier(ThreadIdentifier id)
+static pthread_t pthreadHandleForIdentifierWithLockAlreadyHeld(ThreadIdentifier id)
{
- MutexLocker locker(threadMapMutex());
-
- return threadMap().get(id);
-}
-
-void clearPthreadHandleForIdentifier(ThreadIdentifier id)
-{
- MutexLocker locker(threadMapMutex());
-
- ASSERT(threadMap().contains(id));
-
- threadMap().remove(id);
+ return threadMap().get(id)->pthreadHandle();
}
static void* wtfThreadEntryPoint(void* param)
@@ -155,7 +176,6 @@ static void* wtfThreadEntryPoint(void* param)
// Balanced by .leakPtr() in createThreadInternal.
OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(param));
invocation->function(invocation->data);
-
return 0;
}
@@ -198,15 +218,34 @@ void initializeCurrentThreadInternal(const char* threadName)
int waitForThreadCompletion(ThreadIdentifier threadID)
{
+ pthread_t pthreadHandle;
ASSERT(threadID);
- pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
- if (!pthreadHandle)
- return 0;
+ {
+ // We don't want to lock across the call to join, since that can block our thread and cause deadlock.
+ MutexLocker locker(threadMapMutex());
+ pthreadHandle = pthreadHandleForIdentifierWithLockAlreadyHeld(threadID);
+ ASSERT(pthreadHandle);
+ }
int joinResult = pthread_join(pthreadHandle, 0);
+
if (joinResult == EDEADLK)
LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+ else if (joinResult)
+ LOG_ERROR("ThreadIdentifier %u was unable to be joined.\n", threadID);
+
+ MutexLocker locker(threadMapMutex());
+ PthreadState* state = threadMap().get(threadID);
+ ASSERT(state);
+ ASSERT(state->joinableState() == PthreadState::Joinable);
+
+ // The thread has already exited, so clean up after it.
+ if (state->hasExited())
+ threadMap().remove(threadID);
+ // The thread hasn't exited yet, so don't clean anything up. Just signal that we've already joined on it so that it will clean up after itself.
+ else
+ state->didJoin();
return joinResult;
}
@@ -215,11 +254,32 @@ void detachThread(ThreadIdentifier threadID)
{
ASSERT(threadID);
- pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
- if (!pthreadHandle)
- return;
+ MutexLocker locker(threadMapMutex());
+ pthread_t pthreadHandle = pthreadHandleForIdentifierWithLockAlreadyHeld(threadID);
+ ASSERT(pthreadHandle);
+
+ int detachResult = pthread_detach(pthreadHandle);
+ if (detachResult)
+ LOG_ERROR("ThreadIdentifier %u was unable to be detached\n", threadID);
+
+ PthreadState* state = threadMap().get(threadID);
+ ASSERT(state);
+ if (state->hasExited())
+ threadMap().remove(threadID);
+ else
+ threadMap().get(threadID)->didBecomeDetached();
+}
+
+void threadDidExit(ThreadIdentifier threadID)
+{
+ MutexLocker locker(threadMapMutex());
+ PthreadState* state = threadMap().get(threadID);
+ ASSERT(state);
+
+ state->didExit();
- pthread_detach(pthreadHandle);
+ if (state->joinableState() != PthreadState::Joinable)
+ threadMap().remove(threadID);
}
void yield()
diff --git a/Source/WTF/wtf/text/CString.cpp b/Source/WTF/wtf/text/CString.cpp
index 981d77a1d..fe1485532 100644
--- a/Source/WTF/wtf/text/CString.cpp
+++ b/Source/WTF/wtf/text/CString.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,6 +31,18 @@ using namespace std;
namespace WTF {
+PassRefPtr<CStringBuffer> CStringBuffer::createUninitialized(size_t length)
+{
+ if (length > (numeric_limits<size_t>::max() - sizeof(CStringBuffer)))
+ CRASH();
+
+ // CStringBuffer already has space for one character, we do not need to add +1 to the length
+ // to store the terminating zero.
+ size_t size = sizeof(CStringBuffer) + length;
+ CStringBuffer* stringBuffer = static_cast<CStringBuffer*>(fastMalloc(size));
+ return adoptRef(new (NotNull, stringBuffer) CStringBuffer(length));
+}
+
CString::CString(const char* str)
{
if (!str)
@@ -41,21 +53,19 @@ CString::CString(const char* str)
CString::CString(const char* str, size_t length)
{
+ if (!str) {
+ ASSERT(!length);
+ return;
+ }
+
init(str, length);
}
void CString::init(const char* str, size_t length)
{
- if (!str)
- return;
+ ASSERT(str);
- // We need to be sure we can add 1 to length without overflowing.
- // Since the passed-in length is the length of an actual existing
- // string, and we know the string doesn't occupy the entire address
- // space, we can assert here and there's no need for a runtime check.
- ASSERT(length < numeric_limits<size_t>::max());
-
- m_buffer = CStringBuffer::create(length + 1);
+ m_buffer = CStringBuffer::createUninitialized(length);
memcpy(m_buffer->mutableData(), str, length);
m_buffer->mutableData()[length] = '\0';
}
@@ -70,11 +80,8 @@ char* CString::mutableData()
CString CString::newUninitialized(size_t length, char*& characterBuffer)
{
- if (length >= numeric_limits<size_t>::max())
- CRASH();
-
CString result;
- result.m_buffer = CStringBuffer::create(length + 1);
+ result.m_buffer = CStringBuffer::createUninitialized(length);
char* bytes = result.m_buffer->mutableData();
bytes[length] = '\0';
characterBuffer = bytes;
@@ -88,8 +95,8 @@ void CString::copyBufferIfNeeded()
RefPtr<CStringBuffer> buffer = m_buffer.release();
size_t length = buffer->length();
- m_buffer = CStringBuffer::create(length);
- memcpy(m_buffer->mutableData(), buffer->data(), length);
+ m_buffer = CStringBuffer::createUninitialized(length);
+ memcpy(m_buffer->mutableData(), buffer->data(), length + 1);
}
bool operator==(const CString& a, const CString& b)
diff --git a/Source/WTF/wtf/text/CString.h b/Source/WTF/wtf/text/CString.h
index 9abfa70f7..a78c2041b 100644
--- a/Source/WTF/wtf/text/CString.h
+++ b/Source/WTF/wtf/text/CString.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,19 +32,23 @@
namespace WTF {
+// CStringBuffer is the ref-counted storage class for the characters in a CString.
+// The data is implicitly allocated 1 character longer than length(), as it is zero-terminated.
class CStringBuffer : public RefCounted<CStringBuffer> {
public:
- const char* data() { return m_vector.data(); }
- size_t length() { return m_vector.size(); }
+ const char* data() { return m_data; }
+ size_t length() { return m_length; }
private:
friend class CString;
- static PassRefPtr<CStringBuffer> create(size_t length) { return adoptRef(new CStringBuffer(length)); }
- CStringBuffer(size_t length) : m_vector(length) { }
- char* mutableData() { return m_vector.data(); }
+ static PassRefPtr<CStringBuffer> createUninitialized(size_t length);
- Vector<char> m_vector;
+ CStringBuffer(size_t length) : m_length(length) { }
+ char* mutableData() { return m_data; }
+
+ const size_t m_length;
+ char m_data[1];
};
// A container for a null-terminated char array supporting copy-on-write
@@ -64,7 +68,7 @@ public:
WTF_EXPORT_PRIVATE char* mutableData();
size_t length() const
{
- return m_buffer ? m_buffer->length() - 1 : 0;
+ return m_buffer ? m_buffer->length() : 0;
}
bool isNull() const { return !m_buffer; }
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 364369fbe..a7ae94f61 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1218,6 +1218,7 @@ SET(WebCore_SOURCES
editing/BreakBlockquoteCommand.cpp
editing/CompositeEditCommand.cpp
editing/CreateLinkCommand.cpp
+ editing/DOMTransactionStep.cpp
editing/DeleteButton.cpp
editing/DeleteButtonController.cpp
editing/DeleteFromTextNodeCommand.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 61a575fa5..62be85eb2 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,2169 @@
+2012-08-22 Allan Sandfeld Jensen <allan.jensen@nokia.com>
+
+ [TouchAdjustment] Adjust to word or selection
+ https://bugs.webkit.org/show_bug.cgi?id=94449
+
+ Reviewed by Antonio Gomes.
+
+ Makes each separate word a separate subtarget when context menu triggers
+ selections, and only the selected part of a partial selected node a
+ target when selections are not overridden.
+
+ Fix of reverted commit r126026, fix misplaced ASSERT.
+
+ Test: touchadjustment/context-menu-text-subtargets.html
+
+ * page/TouchAdjustment.cpp:
+ (TouchAdjustment):
+ (WebCore::TouchAdjustment::providesContextMenuItems):
+ (WebCore::TouchAdjustment::appendQuadsToSubtargetList):
+ (WebCore::TouchAdjustment::appendBasicSubtargetsForNode):
+ (WebCore::TouchAdjustment::appendContextSubtargetsForNode):
+ (WebCore::TouchAdjustment::compileSubtargetList):
+ (WebCore::findBestClickableCandidate):
+ (WebCore::findBestContextMenuCandidate):
+
+2012-08-22 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [WebGL] Generic framework draft for tracking WebGL resources
+ https://bugs.webkit.org/show_bug.cgi?id=90597
+
+ Reviewed by Pavel Feldman.
+
+ Wrap WebGL rendering context methods and collect a trace log if we are in capturing mode.
+ Stubbed code for collecting calls contributing to a WebGL resource state so that we could replay them later.
+
+ Typical scenario:
+ - we wrap a GL context with InjectedScript.wrapWebGLContext() and return a proxy to the inspected page
+ - the proxy saves all calls necessary to do a replay later - only those that modify a resource's state
+ - when we turn on capturing mode (InjectedScript.captureFrame), we save all WebGL calls to a trace log
+
+ * inspector/InjectedScriptSource.js:
+ (.):
+ * inspector/InjectedScriptWebGLModuleSource.js:
+ (.):
+
+2012-08-22 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [WebGL] Add minimum transport protocol from backend to frontend
+ https://bugs.webkit.org/show_bug.cgi?id=88973
+
+ Reviewed by Pavel Feldman.
+
+ Added the following protocol methods to communicate with the WebGL injected
+ module: captureFrame, getTraceLog, dropTraceLog, replayTraceLog.
+
+ * inspector/CodeGeneratorInspector.py:
+ * inspector/InjectedScriptWebGLModule.cpp:
+ (WebCore::InjectedScriptWebGLModule::captureFrame):
+ (WebCore):
+ (WebCore::InjectedScriptWebGLModule::dropTraceLog):
+ (WebCore::InjectedScriptWebGLModule::getTraceLog):
+ (WebCore::InjectedScriptWebGLModule::replayTraceLog):
+ * inspector/InjectedScriptWebGLModule.h:
+ (InjectedScriptWebGLModule):
+ * inspector/Inspector.json:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ * inspector/InspectorWebGLAgent.cpp:
+ (WebCore::InspectorWebGLAgent::InspectorWebGLAgent):
+ (WebCore::InspectorWebGLAgent::dropTraceLog):
+ (WebCore):
+ (WebCore::InspectorWebGLAgent::captureFrame):
+ (WebCore::InspectorWebGLAgent::getTraceLog):
+ (WebCore::InspectorWebGLAgent::replayTraceLog):
+ * inspector/InspectorWebGLAgent.h:
+ (WebCore):
+ (WebCore::InspectorWebGLAgent::create):
+ (InspectorWebGLAgent):
+
+2012-08-22 Hans Wennborg <hans@chromium.org>
+
+ Remove unused field DeleteEntryRequest::m_type
+ https://bugs.webkit.org/show_bug.cgi?id=94680
+
+ Unreviewed build fix.
+
+ Remove this unused field. Clang warns about it and it breaks the
+ Chromium build.
+
+ No change in functionality, no new tests.
+
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore):
+
+2012-08-21 Andrey Kosyakov <caseq@chromium.org>
+
+ Web Inspector: console.time() should use performance.now()
+ https://bugs.webkit.org/show_bug.cgi?id=94263
+
+ Reviewed by Pavel Feldman.
+
+ - use monotonicallyIncreasingTime() instead of currentTime() for measuring time intervals
+ with console.time()/console.timeEnd()
+ - adjust precision to 3 digits after decimal point (i.e. microseconds) when formatting intervals;
+
+ * inspector/InspectorConsoleAgent.cpp:
+ (WebCore::InspectorConsoleAgent::stopTiming):
+
+2012-08-22 Takashi Sakamoto <tasak@google.com>
+
+ Dynamically styling ShadowDom content on a node distributed to another shadow insertion point fails.
+ https://bugs.webkit.org/show_bug.cgi?id=92899
+
+ Reviewed by Hajime Morita.
+
+ Since childNeedsStyleRecalc is not cleared when parent nodes are
+ attached, setNeedsStyleRecalc flag is not reached Document. So,
+ document() doesn't run re-layout.
+
+ Test: fast/dom/shadow/shadowdom-dynamic-styling.html
+
+ * dom/ContainerNode.h:
+ (ContainerNode):
+ (WebCore::ContainerNode::detachAsNode):
+ Removed detachAsNode, because the below change made the method
+ not-used.
+ * dom/Element.cpp:
+ (WebCore::Element::detach):
+ Modify to invoke ContainerNode::detach when any shadow subtree is
+ attached. ContainerNode::detach takes care of childNeedsStyleRecalc
+ flag.
+ * dom/ElementShadow.cpp:
+ (WebCore::ElementShadow::invalidateDistribution):
+ Use SetAttached for lazyAttach instead of DoNotSetAttached, because
+ it is reuired to invoke ContainerNode::detach. If not, attached() is
+ false and reattach() invokes only attach(). This causes to leave
+ shadow host's childNeedsStyleRecalc flag true after
+ Element::recalcStyle.
+
+2012-08-22 Taiju Tsuiki <tzik@chromium.org>
+
+ Web Inspector: Add deleteEntry command and deletionCompleted event to FileSystemAgent
+ https://bugs.webkit.org/show_bug.cgi?id=91831
+
+ Reviewed by Vsevolod Vlasov.
+
+ InspectorAgent-side implementation of deleteEntry command.
+
+ Test will be added after JS-side implementation landed.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore):
+ (WebCore::InspectorFileSystemAgent::requestFileSystemRoot):
+ (WebCore::InspectorFileSystemAgent::requestDirectoryContent):
+ (WebCore::InspectorFileSystemAgent::requestMetadata):
+ (WebCore::InspectorFileSystemAgent::requestFileContent):
+ (WebCore::InspectorFileSystemAgent::deleteEntry):
+ (WebCore::InspectorFileSystemAgent::assertFrontend):
+ * inspector/InspectorFileSystemAgent.h:
+ (InspectorFileSystemAgent):
+ * inspector/front-end/FileSystemModel.js:
+ (WebInspector.FileSystemDispatcher.prototype.fileContentReceived):
+ (WebInspector.FileSystemDispatcher.prototype.deletionCompleted):
+
+2012-08-21 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: TabbedPane: measure tab widths in batches.
+ https://bugs.webkit.org/show_bug.cgi?id=94484
+
+ Reviewed by Vsevolod Vlasov.
+
+ - Introduces global batch update schema
+ - Migrates Toolbar and TabbedPane to the new schema
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ * inspector/front-end/TabbedPane.js:
+ (WebInspector.TabbedPane.prototype.appendTab):
+ (WebInspector.TabbedPane.prototype._updateTabElements):
+ (WebInspector.TabbedPane.prototype._innerUpdateTabElements):
+ (WebInspector.TabbedPane.prototype._updateWidths):
+ (WebInspector.TabbedPane.prototype._measureWidths):
+ (WebInspector.TabbedPaneTab):
+ (WebInspector.TabbedPaneTab.prototype.width):
+ (WebInspector.TabbedPaneTab.prototype.setWidth):
+ * inspector/front-end/Toolbar.js:
+ (WebInspector.Toolbar):
+ (WebInspector.Toolbar.prototype._updateDropdownButtonAndHideDropdown):
+ (WebInspector.Toolbar.prototype._innerUpdateDropdownButtonAndHideDropdown):
+ * inspector/front-end/UIUtils.js:
+ (WebInspector.startBatchUpdate):
+ (WebInspector.invokeOnceAfterBatchUpdate.get if):
+ (WebInspector.invokeOnceAfterBatchUpdate):
+ * inspector/front-end/inspector.js:
+ * inspector/front-end/utilities.js:
+
+2012-08-21 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Move String related code in V8Binding to a separate file
+ https://bugs.webkit.org/show_bug.cgi?id=94571
+
+ Reviewed by Adam Barth.
+
+ This patch moves V8Parameter, V8ParameterBase and String related code
+ in V8Binding to a separate file.
+
+ No tests. No change in behavior.
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/V8Binding.cpp:
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/V8StringResource.cpp: Added.
+ * bindings/v8/V8StringResource.h: Added.
+ (WebCore):
+
+2012-08-21 Sukolsak Sakshuwong <sukolsak@google.com>
+
+ Implement UndoManager's automatic DOM transactions
+ https://bugs.webkit.org/show_bug.cgi?id=91812
+
+ Reviewed by Ryosuke Niwa.
+
+ This patch implements automatic DOM transactions in UndoManager
+ by recording changes in tree structure, attributes, and character data
+ of nodes under undo scope host.
+
+ Tests: editing/undomanager/automatic-transaction-attribute.html
+ editing/undomanager/automatic-transaction-data.html
+ editing/undomanager/automatic-transaction-node.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/DOMTransaction.h:
+ (WebCore::DOMTransaction::addTransactionStep):
+ (DOMTransaction):
+ * bindings/v8/DOMTransaction.cpp:
+ (DOMTransactionScope):
+ (WebCore::DOMTransactionScope::DOMTransactionScope):
+ (WebCore::DOMTransactionScope::~DOMTransactionScope):
+ (WebCore):
+ (WebCore::DOMTransaction::apply):
+ (WebCore::DOMTransaction::unapply):
+ (WebCore::DOMTransaction::reapply):
+ * bindings/v8/DOMTransaction.h:
+ (WebCore::DOMTransaction::addTransactionStep):
+ (DOMTransaction):
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::PropertySetCSSStyleDeclaration::setCssText):
+ (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+ (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
+ (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+ * dom/CharacterData.cpp:
+ (WebCore::CharacterData::setDataAndUpdate):
+ * dom/ContainerNode.cpp:
+ (WebCore::willRemoveChild):
+ (WebCore::willRemoveChildren):
+ (WebCore::updateTreeAfterInsertion):
+ * dom/Element.cpp:
+ (WebCore::Element::willModifyAttribute):
+ * editing/DOMTransactionStep.cpp: Added.
+ (WebCore):
+ (WebCore::NodeInsertingDOMTransactionStep::NodeInsertingDOMTransactionStep):
+ (WebCore::NodeInsertingDOMTransactionStep::create):
+ (WebCore::NodeInsertingDOMTransactionStep::unapply):
+ (WebCore::NodeInsertingDOMTransactionStep::reapply):
+ (WebCore::NodeRemovingDOMTransactionStep::NodeRemovingDOMTransactionStep):
+ (WebCore::NodeRemovingDOMTransactionStep::create):
+ (WebCore::NodeRemovingDOMTransactionStep::unapply):
+ (WebCore::NodeRemovingDOMTransactionStep::reapply):
+ (WebCore::DataReplacingDOMTransactionStep::DataReplacingDOMTransactionStep):
+ (WebCore::DataReplacingDOMTransactionStep::create):
+ (WebCore::DataReplacingDOMTransactionStep::unapply):
+ (WebCore::DataReplacingDOMTransactionStep::reapply):
+ (WebCore::AttrChangingDOMTransactionStep::AttrChangingDOMTransactionStep):
+ (WebCore::AttrChangingDOMTransactionStep::create):
+ (WebCore::AttrChangingDOMTransactionStep::unapply):
+ (WebCore::AttrChangingDOMTransactionStep::reapply):
+ * editing/DOMTransactionStep.h: Added.
+ (WebCore):
+ (DOMTransactionStep):
+ (WebCore::DOMTransactionStep::~DOMTransactionStep):
+ (NodeInsertingDOMTransactionStep):
+ (NodeRemovingDOMTransactionStep):
+ (DataReplacingDOMTransactionStep):
+ (AttrChangingDOMTransactionStep):
+ * editing/UndoManager.cpp:
+ (WebCore):
+ (WebCore::UndoManager::isRecordingAutomaticTransaction):
+ (WebCore::UndoManager::addTransactionStep):
+ * editing/UndoManager.h:
+ (WebCore):
+ (WebCore::UndoManager::setRecordingDOMTransaction):
+ (UndoManager):
+
+2012-08-21 Shezan Baig <sbaig1@bloomberg.net>
+
+ Fix cross-direction stretch for replaced elements in row flexbox
+ https://bugs.webkit.org/show_bug.cgi?id=94237
+
+ Reviewed by Ojan Vafai.
+
+ When stretching, don't take into account the instrinsic size of child
+ replaced elements. Only the fixed size, min size, and max size of the
+ child should be taken into account. The logic that computed this was
+ moved from RenderBox::computeLogicalHeight to a new helper method
+ called logicalHeightConstrainedByMinMax. This helper method is now
+ used from RenderFlexibleBox::applyStretchAlignmentToChild, instead of
+ using RenderBox::computeLogicalHeight.
+
+ A similar change will need to be made for column-flowing flexboxes.
+ This will be addressed in https://webkit.org/b/94604.
+
+ No new tests. The existing css3/flexbox/flexitem.html test was
+ extended to cover this case.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::logicalHeightConstrainedByMinMax): New helper
+ method that is used by RenderBox::computeLogicalHeight and also by
+ RenderFlexibleBox::applyStretchAlignmentToChild.
+ (WebCore):
+ (WebCore::RenderBox::computeLogicalHeight): Updated to use the new
+ logicalHeightConstrainedByMinMax helper method.
+ * rendering/RenderBox.h:
+ (RenderBox):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Use
+ logicalHeightConstrainedByMinMax instead of computeLogicalHeight.
+
+2012-08-21 Hayato Ito <hayato@chromium.org>
+
+ Make an event object clonable to support an event propagation across seamless iframes.
+ https://bugs.webkit.org/show_bug.cgi?id=93678
+
+ Reviewed by Dimitri Glazkov.
+
+ We should clone an event object when a event propagates across
+ seamless iframes. Currently Event and MouseEvent are
+ supported. Support for other kinds of events will be addressed
+ later.
+
+ This is one of the pre-requirements to support an event
+ propagation across seamless iframes.
+
+ No new tests, no behavior change.
+
+ * dom/Event.cpp:
+ (WebCore::Event::cloneFor):
+ (WebCore):
+ * dom/Event.h:
+ (WebCore):
+ (Event):
+ * dom/MouseEvent.cpp:
+ (WebCore::adjustedClinetX):
+ (WebCore):
+ (WebCore::adjustedClinetY):
+ (WebCore::MouseEvent::cloneFor):
+ * dom/MouseEvent.h:
+ (MouseEvent):
+
+2012-08-21 Joshua Bell <jsbell@chromium.org>
+
+ IndexedDB: IDBRequest can be GCd during event dispatch
+ https://bugs.webkit.org/show_bug.cgi?id=94235
+
+ Reviewed by Ojan Vafai.
+
+ Avoid a "race" where GC may attempt to reclaim IDB objects that are marked
+ "done" prior to the completion of the event dispatch. The script runtime
+ may decide to do a GC pass before calling the event handler, releasing the
+ object and turning the dispatch into a no-op.
+
+ This is a partial reversion (with renames, etc) of r123275, r124842,
+ and r121492. Added a new test, although it does not exercise the "race"
+ condition directly.
+
+ Test: storage/indexeddb/pending-activity.html
+ storage/indexeddb/pending-activity-workers.html
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::close): Let the IDBRequest know it this cursor won't
+ make it fire again.
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::IDBRequest): Reintroduce "am I done?" flag.
+ (WebCore::IDBRequest::finishCursor): Cursors may fire events at the same
+ IDBRequest repeatedly, so we need to know when they're are really done.
+ (WebCore):
+ (WebCore::IDBRequest::hasPendingActivity): Test the flag.
+ (WebCore::IDBRequest::dispatchEvent): Set the flag.
+ * Modules/indexeddb/IDBRequest.h:
+ (IDBRequest):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::IDBTransaction): Reintroduce "am I done?" flag.
+ (WebCore::IDBTransaction::hasPendingActivity): Test the flag.
+ (WebCore::IDBTransaction::dispatchEvent): Set the flag.
+ * Modules/indexeddb/IDBTransaction.h:
+
+2012-08-21 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: [regression] Settings panel fails to open.
+ https://bugs.webkit.org/show_bug.cgi?id=94647
+
+ Unreviewed: one line JS front-end fix.
+
+ * inspector/front-end/ScriptsSearchScope.js:
+ * inspector/front-end/Settings.js:
+
+2012-08-21 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Crash in RenderTableSection::setCellLogicalWidths
+ https://bugs.webkit.org/show_bug.cgi?id=94291
+
+ Reviewed by Abhishek Arya.
+
+ This issue was that splitAnonymousBoxesAroundChild would move a table section
+ into a newly created table *without* marking it as needing cell recalc. The table
+ would thus never build its structure to match its sections. The fix is to hop on
+ the new willBeRemovedFromTree signal so that the section invalidates itself properly.
+
+ Test: fast/table/crash-split-table-section-no-cell-recalc.html
+
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::willBeRemovedFromTree):
+ * rendering/RenderTableSection.h:
+ Replaced willBeDestroyed by willBeRemovedFromTree in RenderTableSection. This ensures that it is called
+ when moving sections in the tree to mark them as needing cell recalc.
+
+2012-08-21 Yoshifumi Inoue <yosin@chromium.org>
+
+ [Forms] multiple fields time input UI should not have two focus ring.
+ https://bugs.webkit.org/show_bug.cgi?id=94579
+
+ Reviewed by Hajime Morita.
+
+ This patch adds CSS selectors to override focus style for multiple
+ fields time input UI.
+
+ No new tests. fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic.html
+ is updated for including focus state appearance.
+
+ * css/html.css:
+ (input::-webkit-datetime-edit-ampm-field:focus): Override default focus appearance.
+ (input::-webkit-datetime-edit-hour-field:focus): ditto
+ (input::-webkit-datetime-edit-millisecond-field:focus): ditto
+ (input::-webkit-datetime-edit-minute-field:focus): ditto
+ (input::-webkit-datetime-edit-second-field:focus): ditto
+
+2012-08-21 Adam Barth <abarth@webkit.org>
+
+ V8 shouldn't have its own way of printing cross-origin error messages
+ https://bugs.webkit.org/show_bug.cgi?id=94641
+
+ Reviewed by Eric Seidel.
+
+ V8 used to re-implement (poorly) the code for printing out an error
+ message when a same-origin check failed. This patch deletes that code
+ in favor of just calling the WebCore version of the code. There more to
+ clean up here, but I had to stop before spidering over the whole
+ codebase.
+
+ * bindings/generic/BindingSecurity.cpp:
+ (WebCore::canAccessDocument):
+ * bindings/js/BindingState.cpp:
+ * bindings/js/BindingState.h:
+ * bindings/v8/BindingState.cpp:
+ (WebCore::printErrorMessageForFrame):
+ * bindings/v8/BindingState.h:
+ (WebCore):
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::reportUnsafeJavaScriptAccess):
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+ (V8Proxy):
+
+2012-08-21 Shinya Kawanaka <shinyak@chromium.org>
+
+ A shadow element in ShadowDOM of a button element does not work.
+ https://bugs.webkit.org/show_bug.cgi?id=91486
+
+ Reviewed by Dimitri Glazkov.
+
+ Since a button element is extended from an HTMLFormControlElement, it creates a UserAgentShadowDOM
+ just before adding an AuthorShadowDOM. However, actually a button element does not need any UserAgentShadowDOM.
+ So we have to prevent it from creating UserAgentShadowDOM.
+
+ Test: fast/dom/shadow/shadowdom-for-button.html
+
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::willAddAuthorShadowRoot):
+ (WebCore):
+ * html/HTMLButtonElement.h:
+
+2012-08-21 Sukolsak Sakshuwong <sukolsak@google.com>
+
+ Remove UndoManager's undoscope content attribute
+ https://bugs.webkit.org/show_bug.cgi?id=94637
+
+ Reviewed by Ryosuke Niwa.
+
+ No new tests. Covered by existing tests.
+
+ * bindings/v8/DOMTransaction.cpp:
+ (WebCore::DOMTransaction::callFunction):
+ * dom/Document.cpp:
+ (WebCore::Document::undoManager):
+ * dom/Element.cpp:
+ (WebCore::Element::~Element):
+ (WebCore):
+ * dom/Element.h:
+ (Element):
+ * dom/Element.idl:
+ * dom/ElementRareData.h:
+ (ElementRareData):
+ * editing/UndoManager.cpp:
+ (WebCore::UndoManager::create):
+ (WebCore::UndoManager::UndoManager):
+ (WebCore::UndoManager::disconnect):
+ (WebCore::UndoManager::transact):
+ (WebCore::UndoManager::undo):
+ (WebCore::UndoManager::redo):
+ (WebCore::UndoManager::clearUndo):
+ (WebCore::UndoManager::clearRedo):
+ (WebCore):
+ * editing/UndoManager.h:
+ (WebCore):
+ (UndoManager):
+ (WebCore::UndoManager::document):
+ (WebCore::UndoManager::ownerNode):
+ * html/HTMLAttributeNames.in:
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::parseAttribute):
+ (WebCore::HTMLElement::setContentEditable):
+
+2012-08-21 Joanmarie Diggs <jdiggs@igalia.com>
+
+ [Gtk] No accessible caret-moved events found in certain content
+ https://bugs.webkit.org/show_bug.cgi?id=72811
+
+ Reviewed by Chris Fleizach.
+
+ Part of the bug is due to objects which should claim to implement AtkText
+ failed to do so as a result of containing a mixture of inline and block
+ spans.
+
+ An updated unit test was provided.
+
+ * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
+ (roleIsTextType): New method to check if a role is one expected to have
+ implemented the AtkText interface. Currently that is defined as:
+ - ParagraphRole
+ - HeadingRole
+ - DivRole
+ - CellRole
+ (getInterfaceMaskFromObject): If a role is one of the text type roles,
+ automatically add WAI_TEXT to the accessible object's interface mask.
+
+2012-08-21 Tony Chang <tony@chromium.org>
+
+ Force XML comments to maintain whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=94620
+
+ Reviewed by Pavel Feldman.
+
+ Fix a typo in XMLViewer.css for white-space formatting. This seems
+ like the desired behavior so you can see, e.g., code formatted in an
+ XML comment.
+
+ Covered by existing xmlviewer tests in http/tests/xmlviewer/dumpAsText
+
+ * xml/XMLViewer.css:
+ (.comment): Fix typo.
+ * xml/XMLViewer.js:
+ (createComment): Add style to comment nodes.
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126202.
+ http://trac.webkit.org/changeset/126202
+ https://bugs.webkit.org/show_bug.cgi?id=94657
+
+ Causes assertion failures on Chromium Linux dbg compositing
+ layout tests (Requested by dominicc on #webkit).
+
+ * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+ (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::applyFilters):
+ (WebCore::LayerRendererChromium::drawRenderPassQuad):
+ (WebCore::LayerRendererChromium::drawTileQuad):
+ (WebCore::LayerRendererChromium::drawYUVVideoQuad):
+ (WebCore::LayerRendererChromium::drawTextureQuad):
+ (WebCore::LayerRendererChromium::getFramebufferTexture):
+ (WebCore::LayerRendererChromium::bindFramebufferToTexture):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (LayerRendererChromium):
+ * platform/graphics/chromium/cc/CCResourceProvider.cpp:
+ (WebCore::CCResourceProvider::createResource):
+ (WebCore::CCResourceProvider::createResourceFromExternalTexture):
+ (WebCore::CCResourceProvider::deleteResource):
+ (WebCore::CCResourceProvider::upload):
+ (WebCore::CCResourceProvider::lockForWrite):
+ (WebCore::CCResourceProvider::unlockForWrite):
+ (WebCore::CCResourceProvider::flush):
+ (WebCore::CCResourceProvider::shallowFlushIfSupported):
+ (WebCore::CCResourceProvider::lockForRead):
+ (WebCore::CCResourceProvider::unlockForRead):
+ (WebCore::CCResourceProvider::CCResourceProvider):
+ * platform/graphics/chromium/cc/CCResourceProvider.h:
+ (WebCore):
+ (CCResourceProvider):
+ (WebCore::CCResourceProvider::Resource::Resource):
+ (Resource):
+ (CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::~CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::textureId):
+ (CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::~CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::textureId):
+
+2012-08-21 David Grogan <dgrogan@chromium.org>
+
+ IndexedDB: Fire error at request when abort is called in upgradeneeded
+ https://bugs.webkit.org/show_bug.cgi?id=94402
+
+ Reviewed by Tony Chang.
+
+ Tests - updated intversion-abort-in-initial-upgradeneeded-expected.txt
+
+ * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+ (WebCore::IDBDatabaseBackendImpl::transactionFinishedAndAbortFired):
+ (WebCore::IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired):
+ (WebCore):
+ (WebCore::IDBDatabaseBackendImpl::runIntVersionChangeTransaction):
+ Now that second-half open calls don't get abandoned on the queue, we
+ can ASSERT that there's at most one of them at any time.
+
+ * Modules/indexeddb/IDBDatabaseBackendImpl.h:
+ (IDBDatabaseBackendImpl):
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::dispatchEvent):
+ Move setting m_didFireUpgradeNeededEvent before dispatching the event.
+ If abort is called in the event handler an error event will be
+ enqueued and ASSERT_WITH_MESSAGE(m_readyState == PENDING ||
+ m_didFireUpgradeNeededEvent, ...) needs to pass.
+
+ * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+ (WebCore::IDBTransactionBackendImpl::abort):
+ (WebCore::IDBTransactionBackendImpl::commit):
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126233.
+ http://trac.webkit.org/changeset/126233
+ https://bugs.webkit.org/show_bug.cgi?id=94656
+
+ Broke Chromium Mac build (Requested by dominicc on #webkit).
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/mediaControls.css:
+ (video::-webkit-media-text-track-display):
+ * html/shadow/MediaControlElements.cpp:
+ (RenderTextTrackContainerElement):
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+ * html/track/TextTrack.cpp:
+ * html/track/TextTrack.h:
+ (TextTrack):
+ * html/track/TextTrackCue.cpp:
+ (WebCore::TextTrackCue::TextTrackCue):
+ (WebCore::TextTrackCue::calculateComputedLinePosition):
+ (WebCore::TextTrackCue::calculateDisplayParameters):
+ (WebCore::TextTrackCue::getDisplayTree):
+ (WebCore::TextTrackCue::getPositionCoordinates):
+ * html/track/TextTrackCue.h:
+ (WebCore):
+ (TextTrackCue):
+ * rendering/RenderTextTrackCue.cpp: Removed.
+ * rendering/RenderTextTrackCue.h: Removed.
+
+2012-08-20 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Remove getToStringName() and getToStringTemplate() from V8Binding
+ https://bugs.webkit.org/show_bug.cgi?id=94573
+
+ Reviewed by Adam Barth.
+
+ - Remove V8Binding::getToStringName() and V8Binding::getToStringTemplate().
+
+ - Replace getToStringName() with String::NewSymbol("toString").
+
+ - Fix V8PerIsolateData::getToStringTemplate() so that it caches a persistent
+ handle of a created FunctionTemplate. Before this patch, a FunctionTemplate
+ had been created for each toString().
+
+ No tests. No change in behavior.
+
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::constructorToString):
+ * bindings/v8/V8Binding.h:
+ (WebCore):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateImplementation):
+ * bindings/scripts/test/V8/V8Float64Array.cpp:
+ (WebCore::ConfigureV8Float64ArrayTemplate):
+ * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
+ (WebCore::ConfigureV8TestActiveDOMObjectTemplate):
+ * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
+ (WebCore::ConfigureV8TestCustomNamedGetterTemplate):
+ * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
+ (WebCore::ConfigureV8TestEventConstructorTemplate):
+ * bindings/scripts/test/V8/V8TestEventTarget.cpp:
+ (WebCore::ConfigureV8TestEventTargetTemplate):
+ * bindings/scripts/test/V8/V8TestException.cpp:
+ (WebCore::ConfigureV8TestExceptionTemplate):
+ * bindings/scripts/test/V8/V8TestInterface.cpp:
+ (WebCore::ConfigureV8TestInterfaceTemplate):
+ * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
+ (WebCore::ConfigureV8TestMediaQueryListListenerTemplate):
+ * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+ (WebCore::ConfigureV8TestNamedConstructorTemplate):
+ * bindings/scripts/test/V8/V8TestNode.cpp:
+ (WebCore::ConfigureV8TestNodeTemplate):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::ConfigureV8TestObjTemplate):
+ * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+ (WebCore::ConfigureV8TestSerializedScriptValueInterfaceTemplate):
+ * bindings/v8/V8PerIsolateData.h:
+ (V8PerIsolateData):
+
+2012-08-21 Arvid Nilsson <anilsson@rim.com>
+
+ [BlackBerry] WebGL Aquarium fails to render
+ https://bugs.webkit.org/show_bug.cgi?id=94634
+
+ The aquarium leaves with a glColorMask(false, false, false, true) which
+ caused us to fail to blit the color components of the aquarium to the
+ EGLImage.
+
+ Fixed by setting an appropriate color mask for a blit operation.
+
+ Reviewed by Yong Li.
+
+ No new tests, tested manually.
+
+ * platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp:
+ (WebCore::EGLImageLayerWebKitThread::blitToFrontBuffer):
+
+2012-08-21 Victor Carbune <victor@rosedu.org>
+
+ Display a TextTrackCue when snap-to-lines flag is set
+ https://bugs.webkit.org/show_bug.cgi?id=79751
+
+ Reviewed by Tony Chang.
+
+ This patch implements rendering functionality for a given text track,
+ following closer the exact WebVTT specification. There are two new classes
+ which have been added in order to succesfully cover rendering when of a text
+ track cue.
+
+ RenderTextTrackCue handles the specific rendering algorithm required,
+ by checking for overlaps with other boxes that are in the same
+ container (these can be any other boxes, not necessarily other cues,
+ the video controls, for example).
+
+ TextTrackCueBox extends HTMLDivElement and is an intermediate layer
+ between the renderer class and the actual cue object. Its purpose is
+ to instantiate the particular renderer and cover all the default CSS
+ styling that needs to be applied to the cue.
+
+ The layout is done in two steps:
+ - Step 1: Layout the TextTrackCue with default CSS properties set (this is
+ the TextTrackCueBox decorated with the respective CSS elements)
+ - Step 2: RenderTextTrackCue adjusts the box position depending on the
+ parameters of the TextTrackCue object and the overlaps that may occur with
+ previously positioned cues.
+
+ Tests: media/track/track-cue-rendering-horizontal.html
+ media/track/track-cue-rendering-vertical.html
+
+ * CMakeLists.txt: Updated to include RenderTextTrackCue.
+ * GNUmakefile.list.am: Updated to include RenderTextTrackCue.
+ * Target.pri: Updated to include RenderTextTrackCue.
+ * WebCore.gypi: Updated to include RenderTextTrackCue.
+ * WebCore.vcproj/WebCore.vcproj: Updated to include RenderTextTrackCue.
+ * WebCore.xcodeproj/project.pbxproj: Updated to include RenderTextTrackCue.
+ * css/mediaControls.css: Removed unreliable CSS.
+ (video::-webkit-media-text-track-display): Removed properties.
+ * html/shadow/MediaControlElements.cpp: Updated to not use the new class.
+ (RenderTextTrackContainerElement):
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Simplified
+ the function by moving the check if track is rendered in TextTrack and used
+ the TextTrackCueBox for cues.
+ * html/track/TextTrack.cpp: Added a new method.
+ (WebCore::TextTrack::isRendered): Method that returns whether the track should
+ be rendered or not.
+ (WebCore):
+ * html/track/TextTrack.h: Added the isRendered method.
+ (TextTrack):
+ * html/track/TextTrackCue.cpp: Added several helper methods and
+ the TextTrackCueBox.
+ (WebCore):
+ (WebCore::TextTrackCueBox::TextTrackCueBox): The TextTrackCueBox extends
+ the HTMLDivElement and represents a bridge class between RenderTextTrackCue
+ and TextTrackCue. This is required as the layout is done in two steps, as
+ explained on top of the ChangeLog entry.
+ (WebCore::TextTrackCueBox::getCue): Returns the associated TextTrackCue object.
+ (WebCore::TextTrackCueBox::applyCSSProperties): Applies a part of the default CSS
+ properties, as defined by section 3.5.1 of the WebVTT specification.
+ (WebCore::TextTrackCueBox::shadowPseudoId): Moved the shadow pseudo id.
+ (WebCore::TextTrackCueBox::createRenderer): Creates the particular renderer.
+ (WebCore::TextTrackCue::TextTrackCue): Corrected the internal writing mode map.
+ (WebCore::TextTrackCue::calculateComputedLinePosition): Updated the compute line
+ position algorithm. This requires, however, a method to consider only rendered
+ tracks (and therefore will be addressed completely in subsequent changeset).
+ (WebCore::TextTrackCue::calculateDisplayParameters): Updated and corrected the
+ computed display parameters to match the current specification.
+ (WebCore::TextTrackCue::getDisplayTree): Update to use the TextTrackCueBox class
+ and moved CSS application to the respective class.
+ (WebCore::TextTrackCue::getPositionCoordinates): Added comment to specify in which
+ situation this method is used and change visibility to private.
+ (WebCore::TextTrackCue::getCSSWritingMode): Returns the CSS writing mode corresponding
+ to the cue writing mode.
+ (WebCore::TextTrackCue::getCSSSize): Returns the cue width / height (depending on the
+ writing direction.
+ (WebCore::TextTrackCue::getCSSPosition): Returns the default display position, that is
+ used in the first layout step.
+ * html/track/TextTrackCue.h:
+ (WebCore):
+ (TextTrackCueBox):
+ (WebCore::TextTrackCueBox::create): Initialization method.
+ (TextTrackCue):
+ (WebCore::TextTrackCue::getWritingDirection): Helper method to return the internal
+ values used to represent the writing direction.
+ * rendering/RenderTextTrackCue.cpp: Added.
+ (WebCore):
+ (WebCore::RenderTextTrackCue::RenderTextTrackCue):
+ (WebCore::RenderTextTrackCue::layout): The rendering steps, as mentioned in
+ the WebVTT rendering rules. Currently, this treats only the snap-to-lines set
+ case. It is implemented following closely the spec, and might be subject to
+ change as discussions on various bugs evolve.
+ (WebCore::RenderTextTrackCue::initializeLayoutParameters): Steps 1 - 7.
+ (WebCore::RenderTextTrackCue::placeBoxInDefaultPosition): Steps 8 - 10.
+ (WebCore::RenderTextTrackCue::isOutside): Inline method to check if the cue is outside.
+ (WebCore::RenderTextTrackCue::isOverlapping): Inline method to check if the cue overlaps other boxes.
+ (WebCore::RenderTextTrackCue::shouldSwitchDirection): Step 12.
+ (WebCore::RenderTextTrackCue::moveBoxesByStep): Step 13.
+ (WebCore::RenderTextTrackCue::switchDirection): Steps 15 - 18.
+ (WebCore::RenderTextTrackCue::repositionCueSnapToLinesSet): Cue repositioning
+ for text track cue when the snap to lines flag is set.
+ (WebCore::RenderTextTrackCue::repositionCueSnapToLinesNotSet): Cue repositioning
+ for text track cue when the snap to lines flag is not set. Not implemented yet.
+ * rendering/RenderTextTrackCue.h: Added.
+ (WebCore):
+ (RenderTextTrackCue): Rendering class, handling the display of cues.
+
+2012-08-21 Lianghui Chen <liachen@rim.com>
+
+ [BlackBerry] Add RSS content handling support
+ https://bugs.webkit.org/show_bug.cgi?id=93496
+
+ Reviewed by Rob Buis.
+
+ Add code to filter RSS content, and properly convert them to HTML
+ content so they can display nicely, instead of as plain text.
+
+ Following modules are included:
+
+ RSSFilterStream: the code for detecting RSS content, and controlling
+ the handling of these content.
+
+ RSSParserBase: the base class for the following 3 RSS parser.
+ RSS10Parser: the code for decoding RSS 1.0 content.
+ RSS20Parser: the code for decoding RSS 2.0 content.
+ RSSAtomParser: the code for decoding Atom format RSS content.
+ RSSGenerator: the code for generating HTML content based on RSS feed.
+
+ No new tests as it's not changing how HTML content is handled.
+
+ * PlatformBlackBerry.cmake:
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::initialize):
+ * platform/network/blackberry/rss/RSS10Parser.cpp: Added.
+ (WebCore):
+ (WebCore::RSS10Parser::RSS10Parser):
+ (WebCore::RSS10Parser::parseBuffer):
+ (WebCore::RSS10Parser::parseXmlDoc):
+ (WebCore::RSS10Parser::parseItemBaseAttribute):
+ (WebCore::RSS10Parser::parseItem):
+ (WebCore::RSS10Parser::parseFeed):
+ * platform/network/blackberry/rss/RSS10Parser.h: Added.
+ (WebCore):
+ (RSS10Parser):
+ * platform/network/blackberry/rss/RSS20Parser.cpp: Added.
+ (WebCore):
+ (WebCore::RSS20Parser::RSS20Parser):
+ (WebCore::RSS20Parser::parseBuffer):
+ (WebCore::RSS20Parser::parseXmlDoc):
+ (WebCore::RSS20Parser::parseItemBaseAttribute):
+ (WebCore::RSS20Parser::parseItem):
+ (WebCore::RSS20Parser::parseFeed):
+ (WebCore::RSS20Parser::parseEnclosure):
+ * platform/network/blackberry/rss/RSS20Parser.h: Added.
+ (WebCore):
+ (RSS20Parser):
+ * platform/network/blackberry/rss/RSSAtomParser.cpp: Added.
+ (WebCore):
+ (WebCore::isRelativePath):
+ (WebCore::RSSAtomLink::relType):
+ (WebCore::RSSAtomParser::RSSAtomParser):
+ (WebCore::RSSAtomParser::parseBuffer):
+ (WebCore::RSSAtomParser::parseXmlDoc):
+ (WebCore::RSSAtomParser::parseItemBaseAttribute):
+ (WebCore::RSSAtomParser::parseItem):
+ (WebCore::RSSAtomParser::parseFeed):
+ (WebCore::RSSAtomParser::parseLink):
+ (WebCore::RSSAtomParser::enclosureFromLink):
+ (WebCore::RSSAtomParser::parseContent):
+ (WebCore::RSSAtomParser::parseAuthor):
+ (WebCore::RSSAtomParser::parseCategory):
+ * platform/network/blackberry/rss/RSSAtomParser.h: Added.
+ (WebCore):
+ (RSSAtomLink):
+ (WebCore::RSSAtomLink::RSSAtomLink):
+ (RSSAtomParser):
+ * platform/network/blackberry/rss/RSSFilterStream.cpp: Added.
+ (WebCore):
+ (WebCore::isASCIISpaceLowerByte):
+ (WebCore::stripWhiteSpace):
+ (WebCore::equalIgnoringCase):
+ (WebCore::isAtomMIMEType):
+ (WebCore::isRSSMIMEType):
+ (WebCore::isPotentialRSSMIMEType):
+ (WebCore::isRSSContent):
+ (WebCore::RSSTypeFromContentType):
+ (WebCore::RSSTypeFromContent):
+ (WebCore::createParser):
+ (WebCore::findXMLEncodingPosition):
+ (WebCore::findXMLLanguagePosition):
+ (WebCore::defaultEncodingForLanguage):
+ (WebCore::isTranscodingNeeded):
+ (WebCore::transcode):
+ (WebCore::transcodeContent):
+ (WebCore::RSSFilterStream::RSSFilterStream):
+ (WebCore::RSSFilterStream::notifyStatusReceived):
+ (WebCore::RSSFilterStream::notifyHeadersReceived):
+ (WebCore::RSSFilterStream::notifyDataReceived):
+ (WebCore::RSSFilterStream::notifyClose):
+ (WebCore::RSSFilterStream::convertContentToHtml):
+ (WebCore::RSSFilterStream::handleRSSContent):
+ (WebCore::RSSFilterStream::charset):
+ (WebCore::RSSFilterStream::encoding):
+ (WebCore::RSSFilterStream::saveHeaders):
+ (WebCore::RSSFilterStream::removeHeader):
+ (WebCore::RSSFilterStream::updateHeader):
+ (WebCore::RSSFilterStream::updateRSSHeaders):
+ (WebCore::RSSFilterStream::sendSavedHeaders):
+ (WebCore::RSSFilterStream::appendData):
+ * platform/network/blackberry/rss/RSSFilterStream.h: Added.
+ (WebCore):
+ (RSSFilterStream):
+ * platform/network/blackberry/rss/RSSGenerator.cpp: Added.
+ (WebCore):
+ (WebCore::RSSGenerator::RSSGenerator):
+ (WebCore::RSSGenerator::~RSSGenerator):
+ (WebCore::RSSGenerator::generateHtml):
+ * platform/network/blackberry/rss/RSSGenerator.h: Added.
+ (WebCore):
+ (RSSGenerator):
+ * platform/network/blackberry/rss/RSSParserBase.cpp: Added.
+ (WebCore):
+ (WebCore::RSSEnclosure::RSSEnclosure):
+ (WebCore::RSSEnclosure::typeInEnum):
+ (WebCore::RSSEnclosure::suggestedName):
+ (WebCore::RSSFeed::RSSFeed):
+ (WebCore::RSSFeed::~RSSFeed):
+ (WebCore::RSSFeed::clear):
+ (WebCore::RSSItem::RSSItem):
+ (WebCore::RSSItem::~RSSItem):
+ (WebCore::RSSItem::clear):
+ (WebCore::RSSParserBase::RSSParserBase):
+ (WebCore::RSSParserBase::~RSSParserBase):
+ (WebCore::textFromXMLAttr):
+ (WebCore::textFromXMLNode):
+ * platform/network/blackberry/rss/RSSParserBase.h: Added.
+ (WebCore):
+ (RSSEnclosure):
+ (RSSItemBase):
+ (RSSParserBase):
+
+2012-08-21 Andrew Lo <anlo@rim.com>
+
+ [BlackBerry] requestAnimationFrame: Unscheduled display link frames need to be sent to main thread
+ https://bugs.webkit.org/show_bug.cgi?id=94600
+
+ Reviewed by Rob Buis.
+
+ http://trac.webkit.org/changeset/116792 implements destroying
+ DisplayRefreshMonitor after the number of unscheduled frames exceeds 10.
+
+ Part of that change involves dispatching to the main thread whether
+ the frame was scheduled or not.
+
+ Make the corresponding change for the BlackBerry port that was made for
+ DisplayRefreshMonitorMac.cpp.
+
+ Tests covered by http://trac.webkit.org/changeset/116792
+
+ * platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp:
+ (WebCore::DisplayRefreshMonitor::displayLinkFired):
+
+2012-08-21 Brian Salomon <bsalomon@google.com>
+
+ [Chromium/Skia] Filters should flush the SkCanvas
+ https://bugs.webkit.org/show_bug.cgi?id=94602
+
+ Reviewed by Stephen White.
+
+ Adds a SkCanvas::flush call to FilterBufferState::swap() to ensure the textures are updated before they are consumed by the compositor.
+
+ Covered by existing css3/filters layout tests.
+
+ * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
+
+2012-08-21 Lianghui Chen <liachen@rim.com>
+
+ [BlackBerry] Use new method to create socket handle
+ https://bugs.webkit.org/show_bug.cgi?id=89991
+
+ Reviewed by Rob Buis.
+
+ Update the way to create SocketStream as the platform API has changed.
+
+ No new tests as no change of behaviour, just API change adaptation.
+
+ * platform/network/blackberry/SocketStreamHandleBlackBerry.cpp:
+ (WebCore::SocketStreamHandle::SocketStreamHandle):
+
+2012-08-21 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Move compileScript() from V8Proxy to ScriptSourceCode
+ https://bugs.webkit.org/show_bug.cgi?id=94561
+
+ Reviewed by Adam Barth.
+
+ To kill V8Proxy, this patch moves compileScript() from V8Proxy
+ to ScriptSourceCode. This patch also removes fromWebCoreString().
+
+ No tests. No change in behavior.
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/ScriptController.h:
+ (ScriptController):
+ * bindings/v8/ScriptSourceCode.cpp: Added.
+ (WebCore):
+ (WebCore::ScriptSourceCode::compileScript):
+ * bindings/v8/ScriptSourceCode.h:
+ (ScriptSourceCode):
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::prepareListenerObject):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::evaluate):
+ * bindings/v8/V8Proxy.h:
+ (V8Proxy):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::WorkerContextExecutionProxy::evaluate):
+ (WebCore::WorkerContextExecutionProxy::runScript):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::getEventListenersCallback):
+ * bindings/v8/custom/V8MessageEventCustom.cpp:
+ (WebCore::V8MessageEvent::dataAccessorGetter):
+ * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+ (WebCore::toV8Object):
+ (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback):
+
+2012-08-21 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Move toV8Context() from V8Proxy to V8Binding
+ https://bugs.webkit.org/show_bug.cgi?id=94597
+
+ Reviewed by Adam Barth.
+
+ To kill V8Proxy, we can move toV8Context() from V8Proxy to V8Binding.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::toV8Context):
+ (WebCore):
+ * bindings/v8/V8Binding.h:
+ (WebCore):
+ * bindings/v8/V8Proxy.cpp:
+ * bindings/v8/V8Proxy.h:
+
+2012-08-21 Gabriel Peal <gpeal@google.com>
+
+ Web Inspector: Embeddable Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=91528
+
+ Reviewed by Pavel Feldman.
+
+ Adds functionality to the inspector such that it is better suited to run embedded in another webpage. It adds the ability to prepopulate the timeline panel with an existing recording among other controls.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.dispatchQueryParameters):
+ (InspectorFrontendAPI.loadTimelineFromURL):
+ * inspector/front-end/InspectorFrontendHostStub.js:
+ (.WebInspector.InspectorFrontendHostStub.prototype.hiddenPanels):
+ (.WebInspector.InspectorFrontendHostStub.prototype.loadResourceSynchronously):
+ * inspector/front-end/InspectorView.js:
+ * inspector/front-end/TimelineModel.js:
+ (WebInspector.TimelineModel.prototype.loadFromURL.onDataReceived):
+ (WebInspector.TimelineModel.prototype.loadFromURL.parseAndImportData):
+ (WebInspector.TimelineModel.prototype.loadFromURL.onLoad):
+ (WebInspector.TimelineModel.prototype.loadFromURL):
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel.prototype.loadFromURL):
+ * inspector/front-end/inspector.js:
+ (WebInspector._createPanels):
+ (WebInspector.loaded):
+ * inspector/front-end/utilities.js:
+
+2012-08-21 Robin Cao <robin.cao@torchmobile.com.cn>
+
+ [BlackBerry] Add support for getUserMedia
+ https://bugs.webkit.org/show_bug.cgi?id=94591
+
+ Reviewed by George Staikos.
+
+ Implement getUserMedia feature using the platform API.
+
+ Tests in fast/mediastream cover this.
+
+ PR #153571
+
+ Reviewed internally by George Staikos.
+
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+ (WebCore::toWebMediaStreamSource):
+ (WebCore):
+ (WebCore::toWebMediaStreamDescriptor):
+ (WebCore::MediaPlayerPrivate::lookupMediaStream):
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+ (MediaPlayerPrivate):
+
+2012-08-21 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: remove DOMNodeRemoved listener from the DefaultTextEditor
+ https://bugs.webkit.org/show_bug.cgi?id=94592
+
+ Reviewed by Yury Semikhatsky.
+
+ It seems to be not necessary.
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.TextEditorMainPanel):
+ (WebInspector.TextEditorMainPanel.prototype._handleDOMUpdates):
+ (WebInspector.TextEditorMainChunk):
+ (WebInspector.TextEditorMainChunk.prototype.set expanded):
+
+2012-08-21 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ CodeGeneratorInspector.py: Generate guards for type validators
+ https://bugs.webkit.org/show_bug.cgi?id=94511
+
+ Reviewed by Yury Semikhatsky.
+
+ Fix regression when building debug and one of the generated types is
+ disabled by a compile flag. We should generate guards for these type
+ validators the same way as we are doing on the include headers.
+
+ * inspector/CodeGeneratorInspector.py:
+ (TypeBindings.create_type_declaration_.EnumBinding.get_code_generator.CodeGenerator.generate_type_builder):
+
+2012-08-21 Florin Malita <fmalita@chromium.org>
+
+ ASSERT triggered in SVGTRefTargetEventListener::handleEvent()
+ https://bugs.webkit.org/show_bug.cgi?id=94487
+
+ Reviewed by Nikolas Zimmermann.
+
+ The current way of tracking tref target elements by id can leave stale event listeners
+ under certain circumstances. This patch switches to storing a target RefPtr instead
+ to avoid an id lookup which may not return the original/attached element.
+
+ Test: svg/custom/tref-stale-listener-crash.html
+
+ * svg/SVGTRefElement.cpp:
+ (SVGTRefTargetEventListener):
+ (WebCore::SVGTRefTargetEventListener::isAttached): use m_target instead of an explicit bool.
+ (WebCore::SVGTRefTargetEventListener::SVGTRefTargetEventListener):
+ (WebCore::SVGTRefTargetEventListener::attach): save a target RefPtr instead of an id.
+ (WebCore::SVGTRefTargetEventListener::detach): detach the target element directly without
+ going through a lookup.
+ (WebCore::SVGTRefTargetEventListener::handleEvent):
+ (WebCore::SVGTRefElement::updateReferencedText): use an explicit target pointer instead of
+ the id-based lookup.
+ (WebCore::SVGTRefElement::buildPendingResource):
+ * svg/SVGTRefElement.h:
+ (SVGTRefElement):
+
+2012-08-21 Alexandre Elias <aelias@google.com>
+
+ [chromium] Add software bitmap resources to CCResourceProvider
+ https://bugs.webkit.org/show_bug.cgi?id=93677
+
+ Reviewed by Adrienne Walker.
+
+ This adds the ability to CCResourceProvider to use software bitmaps.
+ They are allocated as plain-old-memory, and exposed as Skia objects.
+
+ We want the ResourceProvider to be able to handle different resource
+ types at the same time. In practice, a default resource type is
+ desired for most uses within a single compositor instance, which is
+ specified by the default resource type. Default resource types are
+ expected to be mostly 1-to-1 with CCRenderer types.
+
+ New tests added by parametrizing existing CCResourceProvider tests.
+
+ * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+ (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::applyFilters):
+ (WebCore::LayerRendererChromium::drawRenderPassQuad):
+ (WebCore::LayerRendererChromium::drawTileQuad):
+ (WebCore::LayerRendererChromium::drawYUVVideoQuad):
+ (WebCore::LayerRendererChromium::drawTextureQuad):
+ (WebCore::LayerRendererChromium::getFramebufferTexture):
+ (WebCore::LayerRendererChromium::bindFramebufferToTexture):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (DrawingFrame):
+ * platform/graphics/chromium/cc/CCResourceProvider.cpp:
+ (WebCore::CCResourceProvider::createResource):
+ (WebCore):
+ (WebCore::CCResourceProvider::createGLTexture):
+ (WebCore::CCResourceProvider::createBitmap):
+ (WebCore::CCResourceProvider::createResourceFromExternalTexture):
+ (WebCore::CCResourceProvider::deleteResource):
+ (WebCore::CCResourceProvider::upload):
+ (WebCore::CCResourceProvider::flush):
+ (WebCore::CCResourceProvider::shallowFlushIfSupported):
+ (WebCore::CCResourceProvider::lockForRead):
+ (WebCore::CCResourceProvider::unlockForRead):
+ (WebCore::CCResourceProvider::lockForWrite):
+ (WebCore::CCResourceProvider::unlockForWrite):
+ (WebCore::CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL):
+ (WebCore::CCResourceProvider::ScopedReadLockGL::~ScopedReadLockGL):
+ (WebCore::CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL):
+ (WebCore::CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL):
+ (WebCore::CCResourceProvider::populateSkBitmapWithResource):
+ (WebCore::CCResourceProvider::ScopedReadLockSoftware::ScopedReadLockSoftware):
+ (WebCore::CCResourceProvider::ScopedReadLockSoftware::~ScopedReadLockSoftware):
+ (WebCore::CCResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware):
+ (WebCore::CCResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware):
+ (WebCore::CCResourceProvider::CCResourceProvider):
+ * platform/graphics/chromium/cc/CCResourceProvider.h:
+ (WebCore):
+ (WebCore::CCResourceProvider::setCreationPolicy):
+ (WebCore::CCResourceProvider::creationPolicy):
+ (CCResourceProvider):
+ (ScopedReadLockGL):
+ (WebCore::CCResourceProvider::ScopedReadLockGL::textureId):
+ (ScopedWriteLockGL):
+ (WebCore::CCResourceProvider::ScopedWriteLockGL::textureId):
+ (ScopedReadLockSoftware):
+ (WebCore::CCResourceProvider::ScopedReadLockSoftware::skBitmap):
+ (ScopedWriteLockSoftware):
+ (WebCore::CCResourceProvider::ScopedWriteLockSoftware::skCanvas):
+ (Resource):
+
+2012-08-21 Tab Atkins <tabatkins@google.com>
+
+ Track -webkit property usage.
+ https://bugs.webkit.org/show_bug.cgi?id=93420
+
+ Reviewed by Ojan Vafai.
+
+ First draft of an attempt to track all usage of -webkit prefixed properties across the web.
+ This attempt is dumb, but should provide useful data as a first-pass.
+ I plan to optimize this for better data collection in the future.
+
+ No tests added, as this is untestable currently.
+ It should have zero effect besides histogramming.
+
+ * css/CSSParser.cpp:
+ (WebCore::cssPropertyID):
+
+2012-08-21 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: remove old update/openCursor glue
+ https://bugs.webkit.org/show_bug.cgi?id=94378
+
+ Reviewed by Tony Chang.
+
+ Remove old openCursor and update methods after landing
+ https://bugs.webkit.org/show_bug.cgi?id=91125 and removing
+ Chromium-side glue.
+
+ No new tests: this code is dead.
+
+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+ * Modules/indexeddb/IDBObjectStoreBackendImpl.h:
+ (IDBObjectStoreBackendImpl):
+ * Modules/indexeddb/IDBObjectStoreBackendInterface.h:
+ * inspector/InspectorIndexedDBAgent.cpp:
+ (WebCore):
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ [chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer
+ https://bugs.webkit.org/show_bug.cgi?id=94631
+
+ Reviewed by Adrienne Walker.
+
+ In the depths of time when dinosaurs roamed the earth, LayerChromium and CCLayerTreeHost were both reference
+ counted and there was a cycle between the root LayerChromium and CCLayerTreeHost. This required all users of
+ CCLayerTreeHost to manually break the cycle by calling setRootLayer(0) before dropping their reference to the
+ host. Nowadays, CCLayerTreeHost has a single owner and LayerChromiums only have a weak pointer to their host
+ so we should just do this cleanup ourselves instead of imposing it on callers.
+
+ Unit test added to LayerChromiumTest.cpp
+
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::~CCLayerTreeHost):
+
+2012-08-21 Ulan Degenbaev <ulan@chromium.org>
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer constructed and destructed
+ https://bugs.webkit.org/show_bug.cgi?id=92993
+
+ Reviewed by Kenneth Russell.
+
+ Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer
+ is constructed and destructed so that V8's garbage collection
+ heuristics can account for the memory held by these objects.
+
+ * WebCore.gypi:
+ * bindings/v8/SerializedScriptValue.cpp:
+ * bindings/v8/custom/V8ArrayBufferCustom.cpp:
+ (WebCore::V8ArrayBufferDeallocationObserver::instance):
+ (WebCore):
+ (WebCore::V8ArrayBuffer::constructorCallback):
+ * bindings/v8/custom/V8ArrayBufferCustom.h: Added.
+ (WebCore):
+ * bindings/v8/custom/V8ArrayBufferViewCustom.cpp:
+ * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+ (WebCore::constructWebGLArray):
+ * dom/MessageEvent.cpp:
+ (WebCore::MessageEvent::MessageEvent):
+ (WebCore::MessageEvent::initMessageEvent):
+
+2012-08-21 Taiju Tsuiki <tzik@chromium.org>
+
+ Web Inspector: Completion events of InspectorFileSystemAgent should be fired asynchronously.
+ https://bugs.webkit.org/show_bug.cgi?id=93933
+
+ Reviewed by Yury Semikhatsky.
+
+ InspectorFileSystemAgent fires completion event too early in error case. It should wait
+ until JS code is ready.
+
+ Test: http/tests/inspector/filesystem/request-directory-content.html
+ http/tests/inspector/filesystem/request-file-content.html
+ http/tests/inspector/filesystem/request-metadata.html
+
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore): Add ReportErrorTask class
+
+2012-08-21 Mike West <mkwst@chromium.org>
+
+ Blocking a resource via Content Security Policy should trigger an Error event.
+ https://bugs.webkit.org/show_bug.cgi?id=89440
+
+ Reviewed by Jochen Eisinger.
+
+ If a CSP directive is violated, CachedResourceLoader will trigger a
+ console error, and return a null image. In that case, we now dispatch
+ an error on the relevant element.
+
+ Adjusted http/tests/security/contentSecurityPolicy/image-blocked.html
+ and http/tests/security/contentSecurityPolicy/register-bypassing-scheme.html
+ to test the new behavior.
+
+ This has the side-effect of also generating errors for images blocked by
+ Chromium's content settings. Adjusted
+ platform/chromium/permissionclient/image-permissions.html to agree with
+ the new behavior.
+
+ * loader/ImageLoader.cpp:
+ (WebCore::ImageLoader::updateFromElement):
+
+2012-08-21 Taiju Tsuiki <tzik@chromium.org>
+
+ Web Inspector: Split out crumb list part of styles from elementsPanel.css
+ https://bugs.webkit.org/show_bug.cgi?id=94301
+
+ Reviewed by Pavel Feldman.
+
+ As a preparation to use BreadcrumbList on FileSystem, introduce breadcrumbList.css and
+ move crumb-related style entries into it from elementsPanel.css.
+
+ No new tests. This change does not make functional change.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/front-end/ElementsPanel.js:
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/breadcrumbList.css: Added.
+ (.crumbs):
+ (.crumbs .crumb):
+ (.crumbs .crumb.collapsed > *):
+ (.crumbs .crumb.collapsed::before):
+ (.crumbs .crumb.compact .extra):
+ (.crumbs .crumb.dimmed):
+ (.crumbs .crumb.start):
+ (.crumbs .crumb.end):
+ (.crumbs .crumb.selected):
+ (.crumbs .crumb.selected:hover):
+ (.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover):
+ (.crumbs .crumb:hover):
+ (.crumbs .crumb.dimmed:hover):
+ (.crumbs .crumb.end:hover):
+ * inspector/front-end/elementsPanel.css:
+
+2012-08-21 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com>
+
+ canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-6.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=50797
+
+ Reviewed by Andreas Kling.
+
+ Add a check in fast-path parseAlphaValue() to return early
+ if the CSS <alphavalue> ended with an invalid digit.
+
+ Test: canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-6.html
+
+ * css/CSSParser.cpp:
+ (WebCore::parseAlphaValue):
+
+2012-08-21 Benjamin Poulain <bpoulain@apple.com>
+
+ Store CString data in the CStringBuffer to avoid the double indirection
+ https://bugs.webkit.org/show_bug.cgi?id=94562
+
+ Reviewed by Darin Adler.
+
+ * bindings/cpp/WebDOMCString.cpp:
+ (WebDOMCString::length): With the patch, CStringBuffer hold the real string length instead of the
+ size of the buffer including the terminating zero. WebDOMCString is updated accordingly.
+
+2012-08-21 Benjamin Poulain <bpoulain@apple.com>
+
+ Create CSS color output string on 8 bits
+ https://bugs.webkit.org/show_bug.cgi?id=94625
+
+ Reviewed by Andreas Kling.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::customCssText):
+ Previously, the output string for a CSS color was computed on 16 bits.
+ This was mainly forced by the use of String::number().
+
+ Since the double to string conversion is done on 8bits anyway, I changed
+ the code to use dtoa's numberToFixedPrecisionString directly instead of
+ String::number().
+ All the other parts were already on 8bits.
+
+2012-08-21 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] Using a native window for the WebView breaks GtkOverlay
+ https://bugs.webkit.org/show_bug.cgi?id=90085
+
+ Reviewed by Alejandro G. Castro.
+
+ No new tests. This will be covered by pixel test for accelerated
+ compositing when they are activated.
+
+ * GNUmakefile.am: Add XComposite libraries to the linker list.
+ * GNUmakefile.list.am: Add RedirectedXCompositeWindow files to the source list.
+ Make a new section for GLX specific files.
+ * platform/graphics/glx/GLContextGLX.cpp:
+ (WebCore::GLContextGLX::sharedDisplay): Expose sharedDisplay as a static method
+ so that it can be called by other X11 specific code.
+ * platform/graphics/glx/GLContextGLX.h: Ditto.
+ * platform/gtk/RedirectedXCompositeWindow.cpp: Added. An implementation of a GL surface
+ that renders to an X-window which redirects to a pixmap.
+ * platform/gtk/RedirectedXCompositeWindow.h: Added.
+
+2012-08-21 David Hyatt <hyatt@apple.com>
+
+ [New Multicolumn] Make column rules paint properly.
+ https://bugs.webkit.org/show_bug.cgi?id=94616
+
+ Reviewed by Simon Fraser.
+
+ Make the new multi-column code paint column rules and also prepare it for painting
+ the actual column contents.
+
+ * rendering/RenderMultiColumnBlock.cpp:
+ (WebCore::RenderMultiColumnBlock::ensureColumnSets):
+ Remove the addRegionToThread call, since this is now done automatically in RenderRegion::insertedIntoTree.
+
+ * rendering/RenderMultiColumnBlock.h:
+ (WebCore::RenderMultiColumnBlock::flowThread):
+ Make public so that RenderMultiColumnSet can access it.
+
+ (RenderMultiColumnBlock):
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::columnGap):
+ Add a column gap fetch method. It's identical to the one on RenderBlock (which will eventually go away
+ when we kill the old multi-column code).
+
+ (WebCore::RenderMultiColumnSet::columnRectAt):
+ Also identical to the RenderBlock version of this method. Gets the rect for the nth column.
+
+ (WebCore::RenderMultiColumnSet::paintReplaced):
+ Subclass paintReplaced in order to do column rules and contents painting.
+
+ (WebCore::RenderMultiColumnSet::paintColumnRules):
+ (WebCore::RenderMultiColumnSet::paintColumnContents):
+ Similar to the methods on RenderBlock. The former paints the rules and the latter paints the contents of
+ the flow thread into the columns.
+
+ * rendering/RenderMultiColumnSet.h:
+ (RenderMultiColumnSet):
+ Add the declarations of all the new methods.
+
+ * rendering/RenderRegion.cpp:
+ (WebCore::RenderRegion::installFlowThread):
+ Added a new virtual function for installing flow threads when they didn't exist at construction time.
+ This only applies to actual CSS Regions, so the subclass of the method in RenderRegionSet just does
+ nothing.
+
+ (WebCore::RenderRegion::attachRegion):
+ Get the named flow thread code out of attachRegion, since it broke multi-column. Moved it into a
+ virtual function, installFlowThread, that is only used by actual CSS regions. Eventually we may
+ want a RenderRegion subclass that represents a region for a named flow thread only, but for now
+ let the code sit in installFlowThread in the base class.
+
+ * rendering/RenderRegion.h:
+ (RenderRegion):
+ Add installFlowThread declaration.
+
+ * rendering/RenderRegionSet.cpp:
+ (WebCore::RenderRegionSet::installFlowThread):
+ installFlowThread for region sets just does nothing, since we don't use named flow threads.
+
+ * rendering/RenderRegionSet.h:
+ (RenderRegionSet):
+ Add the override of installFlowThread.
+
+2012-08-21 Patrick Gansterer <paroga@webkit.org>
+
+ [WIN] Build fix for !ENABLE(DRAG_SUPPORT).
+
+ * page/win/EventHandlerWin.cpp:
+ (WebCore):
+ (WebCore::EventHandler::passMouseMoveEventToSubframe):
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126170.
+ http://trac.webkit.org/changeset/126170
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ I spoke too soon
+
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+ (ScrollingCoordinatorPrivate):
+ (WebCore::createScrollbarLayer):
+ (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::setScrollLayer):
+ (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+ (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+ (WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
+ (WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::prepareForDraw):
+ (WebCore::Canvas2DLayerBridge::layer):
+ (WebCore::Canvas2DLayerBridge::contextAcquired):
+ * platform/graphics/chromium/Canvas2DLayerBridge.h:
+ (Canvas2DLayerBridge):
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (DrawingBufferPrivate):
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::willBeDestroyed):
+ (WebCore):
+ (WebCore::GraphicsLayerChromium::updateNames):
+ (WebCore::GraphicsLayerChromium::removeFromParent):
+ (WebCore::GraphicsLayerChromium::setSize):
+ (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setContentsOpaque):
+ (WebCore::GraphicsLayerChromium::setFilters):
+ (WebCore::GraphicsLayerChromium::setBackgroundFilters):
+ (WebCore::GraphicsLayerChromium::setMaskLayer):
+ (WebCore::GraphicsLayerChromium::setBackfaceVisibility):
+ (WebCore::GraphicsLayerChromium::setOpacity):
+ (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+ (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
+ (WebCore::GraphicsLayerChromium::setContentsToImage):
+ (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+ (WebCore::GraphicsLayerChromium::addAnimation):
+ (WebCore::GraphicsLayerChromium::pauseAnimation):
+ (WebCore::GraphicsLayerChromium::removeAnimation):
+ (WebCore::GraphicsLayerChromium::suspendAnimations):
+ (WebCore::GraphicsLayerChromium::resumeAnimations):
+ (WebCore::GraphicsLayerChromium::addLinkHighlight):
+ (WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
+ (WebCore::GraphicsLayerChromium::setContentsToMedia):
+ (WebCore::GraphicsLayerChromium::primaryLayer):
+ (WebCore::GraphicsLayerChromium::platformLayer):
+ (WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setDebugBorder):
+ (WebCore::GraphicsLayerChromium::updateChildList):
+ (WebCore::GraphicsLayerChromium::updateLayerPosition):
+ (WebCore::GraphicsLayerChromium::updateLayerSize):
+ (WebCore::GraphicsLayerChromium::updateAnchorPoint):
+ (WebCore::GraphicsLayerChromium::updateTransform):
+ (WebCore::GraphicsLayerChromium::updateChildrenTransform):
+ (WebCore::GraphicsLayerChromium::updateMasksToBounds):
+ (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
+ (WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
+ (WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
+ (WebCore::GraphicsLayerChromium::updateContentsRect):
+ (WebCore::GraphicsLayerChromium::updateContentsScale):
+ (WebCore::GraphicsLayerChromium::setupContentsLayer):
+ * platform/graphics/chromium/GraphicsLayerChromium.h:
+ (WebCore::GraphicsLayerChromium::hasContentsLayer):
+ (GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::contentsLayer):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::rootLayer):
+ * platform/graphics/chromium/LayerChromium.h:
+
+2012-08-21 Adam Barth <abarth@webkit.org>
+
+ Update run-bindings-tests results after http://trac.webkit.org/changeset/126165
+
+ * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+ (WebCore::jsTestActiveDOMObjectExcitingAttr):
+ (WebCore::jsTestActiveDOMObjectConstructor):
+ (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
+
+2012-08-21 Vincent Scheib <scheib@chromium.org>
+
+ Add parsing logic for allow-pointer-lock to iframe sandbox attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=94513
+
+ Reviewed by Adam Barth.
+
+ Pointer lock was previously blocked from all sandboxed iframes.
+ Parsing the sandbox="allow-pointer-lock" attribute allows pages
+ to control the feature and enable it in sandboxed iframes.
+
+ Tests: http/tests/pointer-lock/iframe-sandboxed-allow-pointer-lock.html
+ http/tests/pointer-lock/iframe-sandboxed-nested-allow-pointer-lock.html
+ http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock.html
+
+ * dom/SecurityContext.cpp:
+ (WebCore::SecurityContext::parseSandboxPolicy):
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126169.
+ http://trac.webkit.org/changeset/126169
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Crashes already fixed downstream
+
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+ (ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+ (WebCore::scrollableLayerForGraphicsLayer):
+ (WebCore):
+ (WebCore::createScrollbarLayer):
+ (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::setScrollLayer):
+ (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+ (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+ (WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
+ (WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::prepareForDraw):
+ (WebCore::Canvas2DLayerBridge::layer):
+ (WebCore::Canvas2DLayerBridge::contextAcquired):
+ * platform/graphics/chromium/Canvas2DLayerBridge.h:
+ (Canvas2DLayerBridge):
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (DrawingBufferPrivate):
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::updateNames):
+ (WebCore::GraphicsLayerChromium::removeFromParent):
+ (WebCore::GraphicsLayerChromium::setSize):
+ (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setContentsOpaque):
+ (WebCore::GraphicsLayerChromium::setFilters):
+ (WebCore::GraphicsLayerChromium::setBackgroundFilters):
+ (WebCore::GraphicsLayerChromium::setMaskLayer):
+ (WebCore::GraphicsLayerChromium::setBackfaceVisibility):
+ (WebCore::GraphicsLayerChromium::setOpacity):
+ (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+ (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
+ (WebCore::GraphicsLayerChromium::setContentsToImage):
+ (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+ (WebCore):
+ (WebCore::GraphicsLayerChromium::setContentsToMedia):
+ (WebCore::GraphicsLayerChromium::setContentsTo):
+ (WebCore::GraphicsLayerChromium::addAnimation):
+ (WebCore::GraphicsLayerChromium::pauseAnimation):
+ (WebCore::GraphicsLayerChromium::removeAnimation):
+ (WebCore::GraphicsLayerChromium::suspendAnimations):
+ (WebCore::GraphicsLayerChromium::resumeAnimations):
+ (WebCore::GraphicsLayerChromium::addLinkHighlight):
+ (WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
+ (WebCore::GraphicsLayerChromium::platformLayer):
+ (WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setDebugBorder):
+ (WebCore::GraphicsLayerChromium::updateChildList):
+ (WebCore::GraphicsLayerChromium::updateLayerPosition):
+ (WebCore::GraphicsLayerChromium::updateLayerSize):
+ (WebCore::GraphicsLayerChromium::updateAnchorPoint):
+ (WebCore::GraphicsLayerChromium::updateTransform):
+ (WebCore::GraphicsLayerChromium::updateChildrenTransform):
+ (WebCore::GraphicsLayerChromium::updateMasksToBounds):
+ (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
+ (WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
+ (WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
+ (WebCore::GraphicsLayerChromium::updateContentsRect):
+ (WebCore::GraphicsLayerChromium::updateContentsScale):
+ (WebCore::GraphicsLayerChromium::setupContentsLayer):
+ * platform/graphics/chromium/GraphicsLayerChromium.h:
+ (WebCore::GraphicsLayerChromium::hasContentsLayer):
+ (WebCore::GraphicsLayerChromium::contentLayer):
+ (GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::contentsLayer):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::rootLayer):
+ * platform/graphics/chromium/LayerChromium.h:
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126076, r126099, and r126106.
+ http://trac.webkit.org/changeset/126076
+ http://trac.webkit.org/changeset/126099
+ http://trac.webkit.org/changeset/126106
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Caused crashes during compositor shutdown in Aura builds of
+ Chromium (Requested by kbr_google on #webkit).
+
+ * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
+ (WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
+ (WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
+ (WebCore::ScrollingCoordinatorPrivate::hasScrollLayer):
+ (WebCore::ScrollingCoordinatorPrivate::scrollLayer):
+ (ScrollingCoordinatorPrivate):
+ (WebCore::createScrollbarLayer):
+ (WebCore::ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange):
+ (WebCore::ScrollingCoordinator::setScrollLayer):
+ (WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
+ (WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
+ (WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
+ (WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
+ (WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
+ (WebCore::Canvas2DLayerBridge::prepareForDraw):
+ (WebCore::Canvas2DLayerBridge::layer):
+ (WebCore::Canvas2DLayerBridge::contextAcquired):
+ * platform/graphics/chromium/Canvas2DLayerBridge.h:
+ (Canvas2DLayerBridge):
+ * platform/graphics/chromium/DrawingBufferChromium.cpp:
+ (WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
+ (WebCore::DrawingBufferPrivate::layer):
+ (DrawingBufferPrivate):
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::willBeDestroyed):
+ (WebCore):
+ (WebCore::GraphicsLayerChromium::updateNames):
+ (WebCore::GraphicsLayerChromium::removeFromParent):
+ (WebCore::GraphicsLayerChromium::setSize):
+ (WebCore::GraphicsLayerChromium::clearBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setContentsOpaque):
+ (WebCore::GraphicsLayerChromium::setFilters):
+ (WebCore::GraphicsLayerChromium::setBackgroundFilters):
+ (WebCore::GraphicsLayerChromium::setMaskLayer):
+ (WebCore::GraphicsLayerChromium::setBackfaceVisibility):
+ (WebCore::GraphicsLayerChromium::setOpacity):
+ (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+ (WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplay):
+ (WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
+ (WebCore::GraphicsLayerChromium::setContentsToImage):
+ (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+ (WebCore::GraphicsLayerChromium::addAnimation):
+ (WebCore::GraphicsLayerChromium::pauseAnimation):
+ (WebCore::GraphicsLayerChromium::removeAnimation):
+ (WebCore::GraphicsLayerChromium::suspendAnimations):
+ (WebCore::GraphicsLayerChromium::resumeAnimations):
+ (WebCore::GraphicsLayerChromium::addLinkHighlight):
+ (WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
+ (WebCore::GraphicsLayerChromium::setContentsToMedia):
+ (WebCore::GraphicsLayerChromium::primaryLayer):
+ (WebCore::GraphicsLayerChromium::platformLayer):
+ (WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
+ (WebCore::GraphicsLayerChromium::setDebugBorder):
+ (WebCore::GraphicsLayerChromium::updateChildList):
+ (WebCore::GraphicsLayerChromium::updateLayerPosition):
+ (WebCore::GraphicsLayerChromium::updateLayerSize):
+ (WebCore::GraphicsLayerChromium::updateAnchorPoint):
+ (WebCore::GraphicsLayerChromium::updateTransform):
+ (WebCore::GraphicsLayerChromium::updateChildrenTransform):
+ (WebCore::GraphicsLayerChromium::updateMasksToBounds):
+ (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
+ (WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
+ (WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
+ (WebCore::GraphicsLayerChromium::updateContentsRect):
+ (WebCore::GraphicsLayerChromium::updateContentsScale):
+ (WebCore::GraphicsLayerChromium::setupContentsLayer):
+ * platform/graphics/chromium/GraphicsLayerChromium.h:
+ (WebCore::GraphicsLayerChromium::hasContentsLayer):
+ (GraphicsLayerChromium):
+ (WebCore::GraphicsLayerChromium::contentsLayer):
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::rootLayer):
+ * platform/graphics/chromium/LayerChromium.h:
+
+2012-08-21 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: do not use window's eval in InjectedScript
+ https://bugs.webkit.org/show_bug.cgi?id=94610
+
+ Reviewed by Yury Semikhatsky.
+
+ Otherwise, inspector does not work when eval is overriden.
+
+ Test: inspector/console/console-eval-fake.html
+
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::JSInjectedScriptHost::evaluate):
+ (WebCore):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::evaluateCallback):
+ (WebCore):
+ * inspector/InjectedScriptHost.idl:
+ * inspector/InjectedScriptSource.js:
+ (.):
+
+2012-08-21 Adam Barth <abarth@webkit.org>
+
+ Implement JSDOMWindow*::allowsAccessFrom* in terms of BindingSecurity
+ https://bugs.webkit.org/show_bug.cgi?id=93407
+
+ Reviewed by Eric Seidel.
+
+ This patch removes allowsAccessFrom and implements the security checks
+ in terms of shouldAllowAccessToDOMWindow directly.
+
+ * bindings/generic/BindingSecurity.cpp:
+ (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
+ (WebCore):
+ * bindings/generic/BindingSecurity.h:
+ (BindingSecurity):
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::shouldAllowAccessToFrame):
+ (WebCore):
+ (WebCore::shouldAllowAccessToDOMWindow):
+ * bindings/js/JSDOMBinding.h:
+ (WebCore):
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::shouldAllowAccessFrom):
+ (WebCore):
+ * bindings/js/JSDOMWindowBase.h:
+ (JSDOMWindowBase):
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::namedItemGetter):
+ (WebCore::JSDOMWindow::getOwnPropertySlot):
+ (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
+ (WebCore::JSDOMWindow::put):
+ (WebCore::JSDOMWindow::deleteProperty):
+ (WebCore::JSDOMWindow::getPropertyNames):
+ (WebCore::JSDOMWindow::getOwnPropertyNames):
+ (WebCore::JSDOMWindow::defineOwnProperty):
+ (WebCore::JSDOMWindow::setLocation):
+ * bindings/js/JSDOMWindowCustom.h:
+ * bindings/js/JSInjectedScriptManager.cpp:
+ (WebCore::InjectedScriptManager::canAccessInspectedWindow):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject _isSafeScript]):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateGetOwnPropertyDescriptorBody):
+ (GenerateImplementation):
+
+2012-08-21 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/12104508> TextIterator takes O(n^2) to iterate over n empty blocks
+ https://bugs.webkit.org/show_bug.cgi?id=94429
+
+ Reviewed by Sam Weinig.
+
+ No new tests, because behavior is unchanged.
+
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::shouldRepresentNodeOffsetZero): Enhanced the check for nodes that
+ cannot contain VisiblePosition to also check for zero-height blocks.
+
+2012-08-21 'Pavel Feldman' <pfeldman@chromium.org>
+
+ Web Inspector: break on exceptions decoration was lost, restoring.
+
+ Not reviewed - a follow up to 126012.
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._pauseOnExceptionStateChanged.get switch):
+ (WebInspector.ScriptsPanel.prototype._pauseOnExceptionStateChanged):
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126146.
+ http://trac.webkit.org/changeset/126146
+ https://bugs.webkit.org/show_bug.cgi?id=94606
+
+ It made all tests assert (Requested by Ossy on #webkit).
+
+ * bridge/qt/qt_runtime.cpp:
+ (JSC::Bindings::prototypeForSignalsAndSlots):
+ (JSC::Bindings::QtRuntimeMethod::call):
+ (JSC::Bindings::QtRuntimeMethod::jsObjectRef):
+ (JSC::Bindings::QtRuntimeMethod::connectOrDisconnect):
+ * bridge/qt/qt_runtime.h:
+ (QtRuntimeMethod):
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126150.
+ http://trac.webkit.org/changeset/126150
+ https://bugs.webkit.org/show_bug.cgi?id=94605
+
+ Breaks 73 layout tests on chromium.webkit builder (Requested
+ by pfeldman on #webkit).
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/V8Binding.cpp:
+ (StringTraits):
+ (WebCore):
+ (WebCore::v8StringToWebCoreString):
+ (WebCore::int32ToWebCoreStringFast):
+ (WebCore::int32ToWebCoreString):
+ * bindings/v8/V8Binding.h:
+ (WebCore):
+ (V8ParameterBase):
+ (WebCore::V8ParameterBase::operator String):
+ (WebCore::V8ParameterBase::operator AtomicString):
+ (WebCore::V8ParameterBase::V8ParameterBase):
+ (WebCore::V8ParameterBase::prepareBase):
+ (WebCore::V8ParameterBase::object):
+ (WebCore::V8ParameterBase::setString):
+ (WebCore::V8ParameterBase::toString):
+ (WebCore::::prepare):
+ * bindings/v8/V8StringResource.cpp: Removed.
+ * bindings/v8/V8StringResource.h: Removed.
+
+2012-08-21 Philippe Normand <pnormand@igalia.com>
+
+ Early returns in MediaPlayer setters
+ https://bugs.webkit.org/show_bug.cgi?id=87304
+
+ Calls to the MediaPlayerPrivate implementation can be avoided if
+ the value to set and the current value are equal.
+
+ Reviewed by Eric Carlson.
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::loadWithNextMediaEngine): Once a new
+ MediaPlayerPrivate has been created propagate the playback rate
+ value to it, as it is done for some other attributes like preload
+ or preservePitch.
+ (WebCore::MediaPlayer::setVolume): Perform action only if current
+ and new values differ.
+ (WebCore::MediaPlayer::setMuted): Ditto.
+ (WebCore::MediaPlayer::setPreservesPitch): Ditto.
+ (WebCore::MediaPlayer::setSize): Ditto.
+ (WebCore::MediaPlayer::setVisible): Ditto.
+ (WebCore::MediaPlayer::setPreload): Ditto.
+
+2012-08-21 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: NMI: OwnPtr<T> was counted as RefPtr<T>
+ https://bugs.webkit.org/show_bug.cgi?id=94599
+
+ Reviewed by Yury Semikhatsky.
+
+ * dom/MemoryInstrumentation.h:
+ (WebCore::MemoryObjectInfo::MemoryObjectInfo):
+ (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+ (WebCore::MemoryInstrumentation::addObjectImpl):
+
+2012-08-21 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember.
+ https://bugs.webkit.org/show_bug.cgi?id=94580
+
+ Reviewed by Yury Semikhatsky.
+
+ Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet.
+
+ * css/CSSCanvasValue.cpp:
+ (WebCore::CSSCanvasValue::reportDescendantMemoryUsage):
+ * css/CSSCharsetRule.cpp:
+ (WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
+ * css/CSSFontFaceSrcValue.cpp:
+ (WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage):
+ * css/CSSFunctionValue.cpp:
+ (WebCore::CSSFunctionValue::reportDescendantMemoryUsage):
+ * css/CSSImageSetValue.cpp:
+ (WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage):
+ * css/CSSImageValue.cpp:
+ (WebCore::CSSImageValue::reportDescendantMemoryUsage):
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage):
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::reportMemoryUsage):
+ * css/CSSValue.cpp:
+ (WebCore::TextCloneCSSValue::reportDescendantMemoryUsage):
+ * css/CSSVariableValue.h:
+ (WebCore::CSSVariableValue::reportDescendantMemoryUsage):
+ * css/FontFeatureValue.cpp:
+ (WebCore::FontFeatureValue::reportDescendantMemoryUsage):
+ * css/MediaQuery.cpp:
+ (WebCore::MediaQuery::reportMemoryUsage):
+ * css/MediaQueryExp.cpp:
+ (WebCore::MediaQueryExp::reportMemoryUsage):
+ * css/StyleRuleImport.cpp:
+ (WebCore::StyleRuleImport::reportDescendantMemoryUsage):
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::reportMemoryUsage):
+ * css/WebKitCSSKeyframeRule.cpp:
+ (WebCore::StyleKeyframe::reportMemoryUsage):
+ * css/WebKitCSSKeyframesRule.cpp:
+ (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
+ * css/WebKitCSSSVGDocumentValue.cpp:
+ (WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage):
+ * css/WebKitCSSShaderValue.cpp:
+ (WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage):
+ * dom/Attribute.h:
+ (WebCore::Attribute::reportMemoryUsage):
+ * dom/CharacterData.cpp:
+ (WebCore::CharacterData::reportMemoryUsage):
+ * dom/Document.cpp:
+ (WebCore::Document::reportMemoryUsage):
+ * dom/ElementAttributeData.cpp:
+ (WebCore::immutableElementAttributeDataSize):
+ (WebCore):
+ (WebCore::ElementAttributeData::createImmutable):
+ (WebCore::ElementAttributeData::reportMemoryUsage):
+ * dom/Event.cpp:
+ (WebCore::Event::reportMemoryUsage):
+ * dom/MemoryInstrumentation.cpp:
+ (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+ * dom/MemoryInstrumentation.h:
+ (MemoryInstrumentation):
+ * dom/QualifiedName.h:
+ (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::reportMemoryUsage):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::reportMemoryUsage):
+ * loader/SubstituteData.cpp:
+ (WebCore::SubstituteData::reportMemoryUsage):
+ * loader/cache/CachedCSSStyleSheet.cpp:
+ (WebCore::CachedCSSStyleSheet::reportMemoryUsage):
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::reportMemoryUsage):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::reportMemoryUsage):
+ * loader/cache/CachedScript.cpp:
+ (WebCore::CachedScript::reportMemoryUsage):
+ * loader/cache/CachedShader.cpp:
+ (WebCore::CachedShader::reportMemoryUsage):
+ * loader/cache/CachedXSLStyleSheet.cpp:
+ (WebCore::CachedXSLStyleSheet::reportMemoryUsage):
+ * loader/cache/MemoryCache.cpp:
+ (WebCore::MemoryCache::reportMemoryUsage):
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::reportMemoryUsage):
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::ResourceResponseBase::reportMemoryUsage):
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::reportMemoryUsage):
+ * rendering/style/StyleRareNonInheritedData.cpp:
+ (WebCore::StyleRareNonInheritedData::reportMemoryUsage):
+ * svg/SVGPaint.cpp:
+ (WebCore::SVGPaint::reportDescendantMemoryUsage):
+
+2012-08-20 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Move String related code in V8Binding to a separate file
+ https://bugs.webkit.org/show_bug.cgi?id=94571
+
+ Reviewed by Adam Barth.
+
+ This patch moves V8Parameter, V8ParameterBase and String related code
+ in V8Binding to a separate file.
+
+ No tests. No change in behavior.
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/V8Binding.cpp:
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/V8StringResource.cpp: Added.
+ * bindings/v8/V8StringResource.h: Added.
+ (WebCore):
+
2012-08-17 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails
diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js
index 95742fefb..752cb9e70 100644
--- a/Source/WebCore/English.lproj/localizedStrings.js
+++ b/Source/WebCore/English.lproj/localizedStrings.js
@@ -582,9 +582,9 @@ localizedStrings["Load timeline data\u2026"] = "Load Timeline data\u2026";
localizedStrings["Save timeline data\u2026"] = "Save Timeline data\u2026";
localizedStrings["Load timeline data"] = "Load Timeline data";
localizedStrings["Save timeline data"] = "Save Timeline data";
-localizedStrings["Timeline.loadFromFile: An error occurred reading the file \"%s\""] = "Timeline.loadFromFile: An error occurred while reading the file \"%s\"";
-localizedStrings["Timeline.loadFromFile: File \"%s\" is not readable"] = "Timeline.loadFromFile: File \"%s\" is not readable";
-localizedStrings["Timeline.loadFromFile: File \"%s\" not found."] = "Timeline.loadFromFile: File \"%s\" not found.";
+localizedStrings["An error occurred reading the file \"%s\""] = "An error occurred while reading the file \"%s\"";
+localizedStrings["File \"%s\" is not readable"] = "File \"%s\" is not readable";
+localizedStrings["File \"%s\" not found."] = "File \"%s\" not found.";
localizedStrings["Filter out records shorter than %s"] = "Filter out records shorter than %s";
localizedStrings["Show user agent styles"] = "Show user agent styles";
localizedStrings["Show script folders"] = "Show script folders";
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index f9eab2441..394098616 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -1056,6 +1056,7 @@ libWebCoreGtk_la_CPPFLAGS = \
$(LIBXSLT_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(UNICODE_CFLAGS) \
+ $(XCOMPOSITE_CFLAGS) \
$(XRENDER_CFLAGS) \
$(XT_CFLAGS)
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 2bc98797f..b7336ccff 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -2938,6 +2938,8 @@ webcore_sources += \
Source/WebCore/editing/DictationAlternative.h \
Source/WebCore/editing/DictationCommand.cpp \
Source/WebCore/editing/DictationCommand.h \
+ Source/WebCore/editing/DOMTransactionStep.cpp \
+ Source/WebCore/editing/DOMTransactionStep.h \
Source/WebCore/editing/EditAction.h \
Source/WebCore/editing/EditCommand.cpp \
Source/WebCore/editing/EditCommand.h \
@@ -5875,6 +5877,8 @@ webcoregtk_sources += \
Source/WebCore/platform/graphics/cairo/GLContext.cpp \
Source/WebCore/platform/graphics/cairo/GLContext.h \
Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp \
+ Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp \
+ Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h \
Source/WebCore/plugins/gtk/gtk2xtbin.c \
Source/WebCore/plugins/gtk/gtk2xtbin.h \
Source/WebCore/plugins/gtk/PluginPackageGtk.cpp \
diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
index 1539c6287..903dab583 100644
--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
@@ -262,6 +262,7 @@ void IDBCursor::postSuccessHandlerCallback()
void IDBCursor::close()
{
ASSERT(m_request);
+ m_request->finishCursor();
m_request.clear();
}
diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
index 05b257dff..c9d9f01fa 100644
--- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
@@ -320,17 +320,28 @@ void IDBDatabaseBackendImpl::transactionFinished(PassRefPtr<IDBTransactionBacken
}
}
-void IDBDatabaseBackendImpl::transactionFinishedAndEventsFired(PassRefPtr<IDBTransactionBackendImpl> prpTransaction)
+void IDBDatabaseBackendImpl::transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendImpl> prpTransaction)
{
RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction;
if (transaction->mode() == IDBTransaction::VERSION_CHANGE) {
// If this was an open-with-version call, there will be a "second
// half" open call waiting for us in processPendingCalls.
// FIXME: When we no longer support setVersion, assert such a thing.
+ if (m_pendingSecondHalfOpenWithVersionCalls.size() == 1) {
+ RefPtr<PendingOpenWithVersionCall> pendingOpenWithVersionCall = m_pendingSecondHalfOpenWithVersionCalls.takeFirst();
+ pendingOpenWithVersionCall->callbacks()->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Version change transaction was aborted in upgradeneeded event handler."));
+ }
processPendingCalls();
}
}
+void IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired(PassRefPtr<IDBTransactionBackendImpl> prpTransaction)
+{
+ RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction;
+ if (transaction->mode() == IDBTransaction::VERSION_CHANGE)
+ processPendingCalls();
+}
+
int32_t IDBDatabaseBackendImpl::connectionCount()
{
return m_databaseCallbacksSet.size() + m_pendingConnectionCount;
@@ -486,6 +497,7 @@ void IDBDatabaseBackendImpl::runIntVersionChangeTransaction(int64_t requestedVer
ASSERT_NOT_REACHED();
ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;
}
+ ASSERT_WITH_MESSAGE(!m_pendingSecondHalfOpenWithVersionCalls.size(), "m_pendingSecondHalfOpenWithVersionCalls.size = %zu", m_pendingSecondHalfOpenWithVersionCalls.size());
m_pendingSecondHalfOpenWithVersionCalls.append(PendingOpenWithVersionCall::create(callbacks, requestedVersion));
}
diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
index 220de5113..1a6feba4f 100644
--- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
+++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
@@ -72,7 +72,8 @@ public:
IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); }
void transactionStarted(PassRefPtr<IDBTransactionBackendImpl>);
void transactionFinished(PassRefPtr<IDBTransactionBackendImpl>);
- void transactionFinishedAndEventsFired(PassRefPtr<IDBTransactionBackendImpl>);
+ void transactionFinishedAndCompleteFired(PassRefPtr<IDBTransactionBackendImpl>);
+ void transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendImpl>);
private:
IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
index c23a74b60..b6d0ea0a5 100644
--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
@@ -510,12 +510,6 @@ void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, Pas
transaction->didCompleteTaskEvents();
}
-void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
-{
- IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(tmpDirection);
- openCursor(prpRange, direction, prpCallbacks, IDBTransactionBackendInterface::NormalTask, transactionPtr, ec);
-}
-
void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
IDB_TRACE("IDBObjectStoreBackendImpl::openCursor");
diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
index 0a82473ac..2811ca1ba 100644
--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
@@ -79,8 +79,6 @@ public:
virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&);
virtual void deleteIndex(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
- // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium.
- virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
virtual void openCursor(PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface::TaskType, IDBTransactionBackendInterface*, ExceptionCode&);
virtual void count(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h
index 3801e4811..86667ab28 100644
--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h
+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h
@@ -69,8 +69,6 @@ public:
virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&) = 0;
virtual void deleteIndex(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
- // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium.
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
virtual void openCursor(PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface::TaskType, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
virtual void count(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
};
diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
index a63339f2a..5771235f7 100644
--- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
@@ -68,8 +68,10 @@ IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc
, m_requestAborted(false)
, m_source(source)
, m_taskType(taskType)
+ , m_hasPendingActivity(true)
, m_cursorType(IDBCursorBackendInterface::InvalidCursorType)
, m_cursorDirection(IDBCursor::NEXT)
+ , m_cursorFinished(false)
, m_pendingCursor(0)
, m_didFireUpgradeNeededEvent(false)
{
@@ -224,6 +226,11 @@ void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> cursor, PassRefPtr<IDBKey
m_result = IDBAny::create(IDBCursorWithValue::fromCursor(cursor));
}
+void IDBRequest::finishCursor()
+{
+ m_cursorFinished = true;
+}
+
bool IDBRequest::shouldEnqueueEvent() const
{
if (m_contextStopped || !scriptExecutionContext())
@@ -404,7 +411,7 @@ bool IDBRequest::hasPendingActivity() const
// FIXME: In an ideal world, we should return true as long as anyone has a or can
// get a handle to us and we have event listeners. This is order to handle
// user generated events properly.
- return m_readyState == PENDING || ActiveDOMObject::hasPendingActivity();
+ return m_hasPendingActivity || ActiveDOMObject::hasPendingActivity();
}
void IDBRequest::stop()
@@ -438,6 +445,7 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
IDB_TRACE("IDBRequest::dispatchEvent");
ASSERT(m_readyState == PENDING);
ASSERT(!m_contextStopped);
+ ASSERT(m_hasPendingActivity);
ASSERT(m_enqueuedEvents.size());
ASSERT(scriptExecutionContext());
ASSERT(event->target() == this);
@@ -469,6 +477,11 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue.release());
}
+ if (event->type() == eventNames().upgradeneededEvent) {
+ ASSERT(!m_didFireUpgradeNeededEvent);
+ m_didFireUpgradeNeededEvent = true;
+ }
+
// FIXME: When we allow custom event dispatching, this will probably need to change.
ASSERT_WITH_MESSAGE(event->type() == eventNames().successEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().blockedEvent || event->type() == eventNames().upgradeneededEvent, "event type was %s", event->type().string().utf8().data());
const bool setTransactionActive = m_transaction && (event->type() == eventNames().successEvent || event->type() == eventNames().upgradeneededEvent || (event->type() == eventNames().errorEvent && m_errorCode != IDBDatabaseException::IDB_ABORT_ERR));
@@ -483,10 +496,8 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
if (cursorToNotify)
cursorToNotify->postSuccessHandlerCallback();
- if (event->type() == eventNames().upgradeneededEvent) {
- ASSERT(!m_didFireUpgradeNeededEvent);
- m_didFireUpgradeNeededEvent = true;
- }
+ if (m_readyState == DONE && (!cursorToNotify || m_cursorFinished) && event->type() != eventNames().upgradeneededEvent)
+ m_hasPendingActivity = false;
if (m_transaction) {
if (event->type() == eventNames().errorEvent && dontPreventDefault && !m_requestAborted) {
diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h
index 7a12496ac..92d58b748 100644
--- a/Source/WebCore/Modules/indexeddb/IDBRequest.h
+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h
@@ -77,6 +77,7 @@ public:
void markEarlyDeath();
void setCursorDetails(IDBCursorBackendInterface::CursorType, IDBCursor::Direction);
void setPendingCursor(PassRefPtr<IDBCursor>);
+ void finishCursor();
void abort();
// IDBCallbacks
@@ -138,11 +139,13 @@ private:
RefPtr<IDBAny> m_source;
const IDBTransactionBackendInterface::TaskType m_taskType;
+ bool m_hasPendingActivity;
Vector<RefPtr<Event> > m_enqueuedEvents;
// Only used if the result type will be a cursor.
IDBCursorBackendInterface::CursorType m_cursorType;
IDBCursor::Direction m_cursorDirection;
+ bool m_cursorFinished;
RefPtr<IDBCursor> m_pendingCursor;
RefPtr<IDBKey> m_cursorKey;
RefPtr<IDBKey> m_cursorPrimaryKey;
diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
index 50216f6b3..21e5f328e 100644
--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
@@ -94,6 +94,7 @@ IDBTransaction::IDBTransaction(ScriptExecutionContext* context, PassRefPtr<IDBTr
, m_mode(mode)
, m_active(true)
, m_state(Unused)
+ , m_hasPendingActivity(true)
, m_contextStopped(false)
{
ASSERT(m_backend);
@@ -321,7 +322,7 @@ bool IDBTransaction::hasPendingActivity() const
// FIXME: In an ideal world, we should return true as long as anyone has a or can
// get a handle to us or any child request object and any of those have
// event listeners. This is in order to handle user generated events properly.
- return m_state != Finished || ActiveDOMObject::hasPendingActivity();
+ return m_hasPendingActivity || ActiveDOMObject::hasPendingActivity();
}
IDBTransaction::Mode IDBTransaction::stringToMode(const String& modeString, ExceptionCode& ec)
@@ -370,6 +371,7 @@ bool IDBTransaction::dispatchEvent(PassRefPtr<Event> event)
{
IDB_TRACE("IDBTransaction::dispatchEvent");
ASSERT(m_state != Finished);
+ ASSERT(m_hasPendingActivity);
ASSERT(scriptExecutionContext());
ASSERT(event->target() == this);
m_state = Finished;
@@ -392,6 +394,7 @@ bool IDBTransaction::dispatchEvent(PassRefPtr<Event> event)
ASSERT(isVersionChange());
m_openDBRequest->transactionDidFinishAndDispatch();
}
+ m_hasPendingActivity = false;
return returnValue;
}
diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h
index 005e37363..75f5d908e 100644
--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h
+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h
@@ -148,6 +148,7 @@ private:
const Mode m_mode;
bool m_active;
State m_state;
+ bool m_hasPendingActivity;
bool m_contextStopped;
RefPtr<DOMError> m_error;
diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp
index 2a6b82268..cc56d5e05 100644
--- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp
+++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp
@@ -151,6 +151,8 @@ void IDBTransactionBackendImpl::abort()
if (m_callbacks)
m_callbacks->onAbort();
+ m_database->transactionFinishedAndAbortFired(this);
+
m_database = 0;
}
@@ -232,12 +234,13 @@ void IDBTransactionBackendImpl::commit()
m_database->transactionCoordinator()->didFinishTransaction(this);
m_database->transactionFinished(this);
- if (committed)
+ if (committed) {
m_callbacks->onComplete();
- else
+ m_database->transactionFinishedAndCompleteFired(this);
+ } else {
m_callbacks->onAbort();
-
- m_database->transactionFinishedAndEventsFired(this);
+ m_database->transactionFinishedAndAbortFired(this);
+ }
m_database = 0;
}
diff --git a/Source/WebCore/PlatformBlackBerry.cmake b/Source/WebCore/PlatformBlackBerry.cmake
index f45e501c1..e4c97f891 100644
--- a/Source/WebCore/PlatformBlackBerry.cmake
+++ b/Source/WebCore/PlatformBlackBerry.cmake
@@ -6,13 +6,14 @@ LIST(INSERT WebCore_INCLUDE_DIRECTORIES 0
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/bindings/cpp"
"${WEBCORE_DIR}/platform/blackberry/CookieDatabaseBackingStore"
- "${WEBCORE_DIR}/platform/network/blackberry"
"${WEBCORE_DIR}/platform/graphics/blackberry/skia"
"${WEBCORE_DIR}/platform/graphics/harfbuzz"
"${WEBCORE_DIR}/platform/graphics/opentype/"
"${WEBCORE_DIR}/platform/graphics/skia"
"${WEBCORE_DIR}/platform/image-decoders/skia"
"${WEBCORE_DIR}/platform/image-encoders/skia"
+ "${WEBCORE_DIR}/platform/network/blackberry"
+ "${WEBCORE_DIR}/platform/network/blackberry/rss"
)
# Skia sources
@@ -102,6 +103,12 @@ LIST(APPEND WebCore_SOURCES
platform/network/blackberry/ResourceRequestBlackBerry.cpp
platform/network/blackberry/ResourceResponseBlackBerry.cpp
platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
+ platform/network/blackberry/rss/RSSAtomParser.cpp
+ platform/network/blackberry/rss/RSS10Parser.cpp
+ platform/network/blackberry/rss/RSS20Parser.cpp
+ platform/network/blackberry/rss/RSSFilterStream.cpp
+ platform/network/blackberry/rss/RSSGenerator.cpp
+ platform/network/blackberry/rss/RSSParserBase.cpp
)
LIST(APPEND WebCore_USER_AGENT_STYLE_SHEETS
diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake
index 29d7e5872..3def256e9 100755
--- a/Source/WebCore/UseV8.cmake
+++ b/Source/WebCore/UseV8.cmake
@@ -40,6 +40,7 @@ LIST(APPEND WebCore_SOURCES
bindings/v8/ScriptInstance.cpp
bindings/v8/ScriptObject.cpp
bindings/v8/ScriptScope.cpp
+ bindings/v8/ScriptSourceCode.cpp
bindings/v8/ScriptState.cpp
bindings/v8/ScriptValue.cpp
bindings/v8/SerializedScriptValue.cpp
@@ -145,6 +146,7 @@ LIST(APPEND WebCore_SOURCES
bindings/v8/custom/V8SQLTransactionCustom.cpp
bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
bindings/v8/custom/V8StorageCustom.cpp
+ bindings/v8/custom/V8StringResource.cpp
bindings/v8/custom/V8StyleSheetCustom.cpp
bindings/v8/custom/V8StyleSheetListCustom.cpp
bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 952b8001d..b6022e340 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -2230,6 +2230,7 @@
'bindings/v8/ScriptProfiler.h',
'bindings/v8/ScriptScope.cpp',
'bindings/v8/ScriptScope.h',
+ 'bindings/v8/ScriptSourceCode.cpp',
'bindings/v8/ScriptSourceCode.h',
'bindings/v8/ScriptState.cpp',
'bindings/v8/ScriptState.h',
@@ -2288,6 +2289,8 @@
'bindings/v8/V8Proxy.h',
'bindings/v8/V8RecursionScope.cpp',
'bindings/v8/V8RecursionScope.h',
+ 'bindings/v8/V8StringResource.cpp',
+ 'bindings/v8/V8StringResource.h',
'bindings/v8/V8ThrowException.cpp',
'bindings/v8/V8ThrowException.h',
'bindings/v8/V8Utilities.cpp',
@@ -2310,6 +2313,7 @@
'bindings/v8/WorldContextHandle.h',
'bindings/v8/WrapperTypeInfo.h',
'bindings/v8/custom/V8ArrayBufferCustom.cpp',
+ 'bindings/v8/custom/V8ArrayBufferCustom.h',
'bindings/v8/custom/V8ArrayBufferViewCustom.cpp',
'bindings/v8/custom/V8ArrayBufferViewCustom.h',
'bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp',
@@ -2642,6 +2646,8 @@
'editing/CompositeEditCommand.cpp',
'editing/CreateLinkCommand.cpp',
'editing/CreateLinkCommand.h',
+ 'editing/DOMTransactionStep.cpp',
+ 'editing/DOMTransactionStep.h',
'editing/DeleteButton.cpp',
'editing/DeleteButton.h',
'editing/DeleteButtonController.cpp',
@@ -6391,6 +6397,7 @@
],
'webinspector_standalone_css_files': [
'inspector/front-end/auditsPanel.css',
+ 'inspector/front-end/breadcrumbList.css',
'inspector/front-end/cm/codemirror.css',
'inspector/front-end/cmdevtools.css',
'inspector/front-end/dataGrid.css',
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index 46e6aa72b..46a2cbd7a 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -55999,6 +55999,62 @@
>
</File>
<File
+ RelativePath="..\editing\DOMTransactionStep.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\editing\DOMTransactionStep.h"
+ >
+ </File>
+ <File
RelativePath="..\editing\EditAction.h"
>
</File>
@@ -75582,6 +75638,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\breadcrumbList.css"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\BreakpointManager.js"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index b12277159..309c21f65 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1968,6 +1968,8 @@
7B9184D315758E420092AA93 /* UndoManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B9184D015758E420092AA93 /* UndoManager.h */; };
7BB35AEB15CCDDF400F2A643 /* DOMTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7BB35AE915CCDDF400F2A643 /* DOMTransaction.cpp */; };
7BB35AEC15CCDDF400F2A643 /* DOMTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BB35AEA15CCDDF400F2A643 /* DOMTransaction.h */; };
+ 7BD117EB15B8DB0100C974A3 /* DOMTransactionStep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7BD117E915B8DB0100C974A3 /* DOMTransactionStep.cpp */; };
+ 7BD117EC15B8DB0100C974A3 /* DOMTransactionStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BD117EA15B8DB0100C974A3 /* DOMTransactionStep.h */; };
7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */; };
7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E33CD00127F340D00BE8F17 /* PurgePriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */; };
@@ -9145,6 +9147,8 @@
7B9184D115758E420092AA93 /* UndoManager.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UndoManager.idl; sourceTree = "<group>"; };
7BB35AE915CCDDF400F2A643 /* DOMTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTransaction.cpp; sourceTree = "<group>"; };
7BB35AEA15CCDDF400F2A643 /* DOMTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTransaction.h; sourceTree = "<group>"; };
+ 7BD117E915B8DB0100C974A3 /* DOMTransactionStep.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTransactionStep.cpp; sourceTree = "<group>"; };
+ 7BD117EA15B8DB0100C974A3 /* DOMTransactionStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTransactionStep.h; sourceTree = "<group>"; };
7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorOverlay.cpp; sourceTree = "<group>"; };
7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorOverlay.h; sourceTree = "<group>"; };
7C60128060078BB70E367A95 /* DNSResolveQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DNSResolveQueue.cpp; sourceTree = "<group>"; };
@@ -17104,6 +17108,8 @@
CECADFC4153778FF00E37068 /* DictationCommand.cpp */,
CECADFC5153778FF00E37068 /* DictationCommand.h */,
7B8C1FE615CCE3C2004B35DC /* DOMTransaction.idl */,
+ 7BD117E915B8DB0100C974A3 /* DOMTransactionStep.cpp */,
+ 7BD117EA15B8DB0100C974A3 /* DOMTransactionStep.h */,
93309D93099E64910056E581 /* EditAction.h */,
93309D94099E64910056E581 /* EditCommand.cpp */,
93309D95099E64910056E581 /* EditCommand.h */,
@@ -23129,6 +23135,7 @@
05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
7BB35AEC15CCDDF400F2A643 /* DOMTransaction.h in Headers */,
+ 7BD117EC15B8DB0100C974A3 /* DOMTransactionStep.h in Headers */,
BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */,
85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */,
850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */,
@@ -26400,6 +26407,7 @@
188604B30F2E654A000B6443 /* DOMTimer.cpp in Sources */,
76FC2B0B12370DA0006A991A /* DOMTokenList.cpp in Sources */,
7BB35AEB15CCDDF400F2A643 /* DOMTransaction.cpp in Sources */,
+ 7BD117EB15B8DB0100C974A3 /* DOMTransactionStep.cpp in Sources */,
85526CD30AB0B7DA000302EA /* DOMTreeWalker.mm in Sources */,
85C7F4920AAF79DC004014DD /* DOMUIEvent.mm in Sources */,
2E37DFDA12DBAFB800A6B233 /* DOMURL.cpp in Sources */,
diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
index 7f6b89412..4876aaf2a 100644
--- a/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp
@@ -815,6 +815,11 @@ static GType GetAtkInterfaceTypeFromWAIType(WAIType type)
return G_TYPE_INVALID;
}
+static bool roleIsTextType(AccessibilityRole role)
+{
+ return role == ParagraphRole || role == HeadingRole || role == DivRole || role == CellRole;
+}
+
static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
{
guint16 interfaceMask = 0;
@@ -856,7 +861,7 @@ static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject)
} else {
if (role != TableRole) {
interfaceMask |= 1 << WAI_HYPERTEXT;
- if (renderer && renderer->childrenInline())
+ if ((renderer && renderer->childrenInline()) || roleIsTextType(role))
interfaceMask |= 1 << WAI_TEXT;
}
diff --git a/Source/WebCore/bindings/cpp/WebDOMCString.cpp b/Source/WebCore/bindings/cpp/WebDOMCString.cpp
index ab87ac833..9bed7e567 100644
--- a/Source/WebCore/bindings/cpp/WebDOMCString.cpp
+++ b/Source/WebCore/bindings/cpp/WebDOMCString.cpp
@@ -55,7 +55,7 @@ size_t WebDOMCString::length() const
if (!m_private)
return 0;
// NOTE: The buffer's length includes the null byte.
- return const_cast<WebDOMCStringPrivate*>(m_private)->length() - 1;
+ return const_cast<WebDOMCStringPrivate*>(m_private)->length();
}
const char* WebDOMCString::data() const
diff --git a/Source/WebCore/bindings/generic/BindingSecurity.cpp b/Source/WebCore/bindings/generic/BindingSecurity.cpp
index 8dde685b5..e5144e07e 100644
--- a/Source/WebCore/bindings/generic/BindingSecurity.cpp
+++ b/Source/WebCore/bindings/generic/BindingSecurity.cpp
@@ -55,11 +55,16 @@ static bool canAccessDocument(BindingState* state, Document* targetDocument, Sec
return true;
if (reportingOption == ReportSecurityError)
- immediatelyReportUnsafeAccessTo(state, targetDocument);
+ printErrorMessageForFrame(targetDocument->frame(), targetDocument->domWindow()->crossDomainAccessErrorMessage(active));
return false;
}
+bool BindingSecurity::shouldAllowAccessToDOMWindow(BindingState* state, DOMWindow* target, SecurityReportingOption reportingOption)
+{
+ return target && canAccessDocument(state, target->document(), reportingOption);
+}
+
bool BindingSecurity::shouldAllowAccessToFrame(BindingState* state, Frame* target, SecurityReportingOption reportingOption)
{
return target && canAccessDocument(state, target->document(), reportingOption);
diff --git a/Source/WebCore/bindings/generic/BindingSecurity.h b/Source/WebCore/bindings/generic/BindingSecurity.h
index 99d7f0097..eea1668d1 100644
--- a/Source/WebCore/bindings/generic/BindingSecurity.h
+++ b/Source/WebCore/bindings/generic/BindingSecurity.h
@@ -47,6 +47,7 @@ enum SecurityReportingOption {
class BindingSecurity {
public:
static bool shouldAllowAccessToNode(BindingState*, Node*);
+ static bool shouldAllowAccessToDOMWindow(BindingState*, DOMWindow*, SecurityReportingOption = ReportSecurityError);
static bool shouldAllowAccessToFrame(BindingState*, Frame*, SecurityReportingOption = ReportSecurityError);
static bool allowSettingFrameSrcToJavascriptUrl(BindingState*, HTMLFrameElementBase*, const String& value);
};
diff --git a/Source/WebCore/bindings/js/BindingState.cpp b/Source/WebCore/bindings/js/BindingState.cpp
index 72a2a8a13..825468b57 100644
--- a/Source/WebCore/bindings/js/BindingState.cpp
+++ b/Source/WebCore/bindings/js/BindingState.cpp
@@ -47,9 +47,4 @@ DOMWindow* firstDOMWindow(ExecState* exec)
return asJSDOMWindow(exec->dynamicGlobalObject())->impl();
}
-void immediatelyReportUnsafeAccessTo(ExecState* exec, Document* target)
-{
- printErrorMessageForFrame(target->frame(), target->domWindow()->crossDomainAccessErrorMessage(activeDOMWindow(exec)));
-}
-
}
diff --git a/Source/WebCore/bindings/js/BindingState.h b/Source/WebCore/bindings/js/BindingState.h
index de130fe2b..9270604d3 100644
--- a/Source/WebCore/bindings/js/BindingState.h
+++ b/Source/WebCore/bindings/js/BindingState.h
@@ -48,8 +48,6 @@ DOMWindow* firstDOMWindow(BindingState*);
inline Frame* activeFrame(BindingState*) { return 0; }
inline Frame* firstFrame(BindingState*) { return 0; }
-void immediatelyReportUnsafeAccessTo(BindingState*, Document* target);
-
}
#endif
diff --git a/Source/WebCore/bindings/js/DOMTransaction.h b/Source/WebCore/bindings/js/DOMTransaction.h
index de05e3e5e..45125be11 100644
--- a/Source/WebCore/bindings/js/DOMTransaction.h
+++ b/Source/WebCore/bindings/js/DOMTransaction.h
@@ -27,6 +27,7 @@
#if ENABLE(UNDO_MANAGER)
+#include "DOMTransactionStep.h"
#include "UndoStep.h"
#include <wtf/RefPtr.h>
@@ -48,10 +49,13 @@ public:
UndoManager* undoManager() const { return m_undoManager; }
void setUndoManager(UndoManager* undoManager) { m_undoManager = undoManager; }
+ void addTransactionStep(PassRefPtr<DOMTransactionStep> step) { m_transactionSteps.append(step); }
+
private:
DOMTransaction();
UndoManager* m_undoManager;
+ Vector<RefPtr<DOMTransactionStep> > m_transactionSteps;
};
}
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp
index 3ad7c3284..6551d6687 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp
@@ -212,9 +212,9 @@ bool shouldAllowAccessToNode(ExecState* exec, Node* node)
return BindingSecurity::shouldAllowAccessToNode(exec, node);
}
-bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame)
+bool shouldAllowAccessToFrame(ExecState* exec, Frame* target)
{
- return BindingSecurity::shouldAllowAccessToFrame(exec, frame);
+ return BindingSecurity::shouldAllowAccessToFrame(exec, target);
}
bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame, String& message)
@@ -227,6 +227,16 @@ bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame, String& message)
return result;
}
+bool shouldAllowAccessToDOMWindow(ExecState* exec, DOMWindow* target, String& message)
+{
+ if (!target)
+ return false;
+ bool result = BindingSecurity::shouldAllowAccessToDOMWindow(exec, target, DoNotReportSecurityError);
+ // FIXME: The following line of code should move somewhere that it can be shared with immediatelyReportUnsafeAccessTo.
+ message = target->crossDomainAccessErrorMessage(activeDOMWindow(exec));
+ return result;
+}
+
void printErrorMessageForFrame(Frame* frame, const String& message)
{
if (!frame)
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h
index 1c8716e29..0c3d53748 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.h
+++ b/Source/WebCore/bindings/js/JSDOMBinding.h
@@ -401,11 +401,10 @@ enum ParameterDefaultPolicy {
return result;
}
- // FIXME: Implement allowAccessToContext(JSC::ExecState*, ScriptExecutionContext*);
bool shouldAllowAccessToNode(JSC::ExecState*, Node*);
bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*);
bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*, String& message);
- // FIXME: Implement allowAccessToDOMWindow(JSC::ExecState*, DOMWindow*);
+ bool shouldAllowAccessToDOMWindow(BindingState*, DOMWindow*, String& message);
void printErrorMessageForFrame(Frame*, const String& message);
JSC::JSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index 4219f0c1d..d93d746da 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -23,6 +23,7 @@
#include "config.h"
#include "JSDOMWindowBase.h"
+#include "BindingSecurity.h"
#include "Chrome.h"
#include "Console.h"
#include "DOMWindow.h"
@@ -42,9 +43,14 @@ using namespace JSC;
namespace WebCore {
+static bool shouldAllowAccessFrom(const JSGlobalObject* thisObject, ExecState* exec)
+{
+ return BindingSecurity::shouldAllowAccessToDOMWindow(exec, asJSDOMWindow(thisObject)->impl());
+}
+
const ClassInfo JSDOMWindowBase::s_info = { "Window", &JSDOMGlobalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSDOMWindowBase) };
-const GlobalObjectMethodTable JSDOMWindowBase::s_globalObjectMethodTable = { &allowsAccessFrom, &supportsProfiling, &supportsRichSourceInfo, &shouldInterruptScript, &javaScriptExperimentsEnabled };
+const GlobalObjectMethodTable JSDOMWindowBase::s_globalObjectMethodTable = { &shouldAllowAccessFrom, &supportsProfiling, &supportsRichSourceInfo, &shouldInterruptScript, &javaScriptExperimentsEnabled };
JSDOMWindowBase::JSDOMWindowBase(JSGlobalData& globalData, Structure* structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
: JSDOMGlobalObject(globalData, structure, shell->world(), &s_globalObjectMethodTable)
@@ -83,41 +89,11 @@ ScriptExecutionContext* JSDOMWindowBase::scriptExecutionContext() const
return m_impl->document();
}
-String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* other) const
-{
- return m_shell->window()->impl()->crossDomainAccessErrorMessage(asJSDOMWindow(other)->impl());
-}
-
void JSDOMWindowBase::printErrorMessage(const String& message) const
{
printErrorMessageForFrame(impl()->frame(), message);
}
-// This method checks whether accesss to *this* global object is permitted from
-// the given context; this differs from allowsAccessFromPrivate, since that
-// method checks whether the given context is permitted to access the current
-// window the shell is referencing (which may come from a different security
-// origin to this global object).
-bool JSDOMWindowBase::allowsAccessFrom(const JSGlobalObject* thisObject, ExecState* exec)
-{
- JSGlobalObject* otherObject = exec->lexicalGlobalObject();
-
- const JSDOMWindow* originWindow = asJSDOMWindow(otherObject);
- const JSDOMWindow* targetWindow = asJSDOMWindow(thisObject);
-
- if (originWindow == targetWindow)
- return true;
-
- const SecurityOrigin* originSecurityOrigin = originWindow->impl()->document()->securityOrigin();
- const SecurityOrigin* targetSecurityOrigin = targetWindow->impl()->document()->securityOrigin();
-
- if (originSecurityOrigin->canAccess(targetSecurityOrigin))
- return true;
-
- targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(otherObject));
- return false;
-}
-
bool JSDOMWindowBase::supportsProfiling(const JSGlobalObject* object)
{
#if !ENABLE(JAVASCRIPT_DEBUGGER) || !ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.h b/Source/WebCore/bindings/js/JSDOMWindowBase.h
index c1df14e62..02ef43d2d 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.h
@@ -64,16 +64,8 @@ namespace WebCore {
static bool supportsRichSourceInfo(const JSC::JSGlobalObject*);
static bool shouldInterruptScript(const JSC::JSGlobalObject*);
static bool javaScriptExperimentsEnabled(const JSC::JSGlobalObject*);
- static bool allowsAccessFrom(const JSC::JSGlobalObject*, JSC::ExecState*);
-
- bool allowsAccessFrom(JSC::ExecState*) const;
- bool allowsAccessFromNoErrorMessage(JSC::ExecState*) const;
- bool allowsAccessFrom(JSC::ExecState*, String& message) const;
void printErrorMessage(const String&) const;
- // Don't call this version of allowsAccessFrom -- it's a slightly incorrect implementation used only by WebScriptObject
- bool allowsAccessFrom(const JSC::JSGlobalObject*) const;
-
static JSC::JSObject* toThisObject(JSC::JSCell*, JSC::ExecState*);
JSDOMWindowShell* shell() const;
@@ -82,9 +74,6 @@ namespace WebCore {
private:
RefPtr<DOMWindow> m_impl;
JSDOMWindowShell* m_shell;
-
- bool allowsAccessFromPrivate(const JSC::JSGlobalObject*) const;
- String crossDomainAccessErrorMessage(const JSC::JSGlobalObject*) const;
};
// Returns a JSDOMWindow or jsNull()
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 2d75ac08c..39beae5da 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "JSDOMWindowCustom.h"
+#include "BindingSecurity.h"
#include "Frame.h"
#include "HTMLCollection.h"
#include "HTMLDocument.h"
@@ -112,7 +113,7 @@ static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, PropertyName p
JSDOMWindowBase* thisObj = jsCast<JSDOMWindow*>(asObject(slotBase));
Document* document = thisObj->impl()->frame()->document();
- ASSERT(thisObj->allowsAccessFrom(exec));
+ ASSERT(BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObj->impl()));
ASSERT(document);
ASSERT(document->isHTMLDocument());
@@ -158,7 +159,7 @@ bool JSDOMWindow::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName
// because we always allow access to some function, just different ones depending whether access
// is allowed.
String errorMessage;
- bool allowsAccess = thisObject->allowsAccessFrom(exec, errorMessage);
+ bool allowsAccess = shouldAllowAccessToDOMWindow(exec, thisObject->impl(), errorMessage);
// Look for overrides before looking at any of our own properties, but ignore overrides completely
// if this is cross-domain access.
@@ -166,7 +167,7 @@ bool JSDOMWindow::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName
return true;
// We need this code here because otherwise JSDOMWindowBase will stop the search before we even get to the
- // prototype due to the blanket same origin (allowsAccessFrom) check at the end of getOwnPropertySlot.
+ // prototype due to the blanket same origin (shouldAllowAccessToDOMWindow) check at the end of getOwnPropertySlot.
// Also, it's important to get the implementation straight out of the DOMWindow prototype regardless of
// what prototype is actually set on this object.
entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
@@ -272,7 +273,7 @@ bool JSDOMWindow::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, Pr
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Never allow cross-domain getOwnPropertyDescriptor
- if (!thisObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return false;
const HashEntry* entry;
@@ -349,7 +350,7 @@ void JSDOMWindow::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
// Optimization: access JavaScript global variables directly before involving the DOM.
if (thisObject->JSGlobalObject::hasOwnPropertyForWrite(exec, propertyName)) {
- if (thisObject->allowsAccessFrom(exec))
+ if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
JSGlobalObject::put(thisObject, exec, propertyName, value, slot);
return;
}
@@ -357,7 +358,7 @@ void JSDOMWindow::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
if (lookupPut<JSDOMWindow>(exec, propertyName, value, s_info.propHashTable(exec), thisObject))
return;
- if (thisObject->allowsAccessFrom(exec))
+ if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
Base::put(thisObject, exec, propertyName, value, slot);
}
@@ -365,7 +366,7 @@ bool JSDOMWindow::deleteProperty(JSCell* cell, ExecState* exec, PropertyName pro
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
// Only allow deleting properties by frames in the same origin.
- if (!thisObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return false;
return Base::deleteProperty(thisObject, exec, propertyName);
}
@@ -374,7 +375,7 @@ void JSDOMWindow::getPropertyNames(JSObject* object, ExecState* exec, PropertyNa
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow the window to enumerated by frames in the same origin.
- if (!thisObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return;
Base::getPropertyNames(thisObject, exec, propertyNames, mode);
}
@@ -383,7 +384,7 @@ void JSDOMWindow::getOwnPropertyNames(JSObject* object, ExecState* exec, Propert
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow the window to enumerated by frames in the same origin.
- if (!thisObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return;
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
@@ -392,7 +393,7 @@ bool JSDOMWindow::defineOwnProperty(JSC::JSObject* object, JSC::ExecState* exec,
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow defining properties in this way by frames in the same origin, as it allows setters to be introduced.
- if (!thisObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return false;
// Don't allow shadowing location using accessor properties.
@@ -412,7 +413,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
if (Frame* activeFrame = activeDOMWindow(exec)->frame()) {
if (Settings* settings = activeFrame->settings()) {
if (settings->usesDashboardBackwardCompatibilityMode() && !activeFrame->tree()->parent()) {
- if (allowsAccessFrom(exec))
+ if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, impl()))
putDirect(exec->globalData(), Identifier(exec, "location"), value);
return;
}
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.h b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
index ab563bf03..77546b014 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
@@ -36,49 +36,6 @@ inline const JSDOMWindow* asJSDOMWindow(const JSC::JSGlobalObject* globalObject)
return static_cast<const JSDOMWindow*>(globalObject);
}
-inline bool JSDOMWindowBase::allowsAccessFrom(const JSGlobalObject* other) const
-{
- if (allowsAccessFromPrivate(other))
- return true;
- printErrorMessage(crossDomainAccessErrorMessage(other));
- return false;
-}
-
-inline bool JSDOMWindowBase::allowsAccessFrom(JSC::ExecState* exec) const
-{
- if (allowsAccessFromPrivate(exec->lexicalGlobalObject()))
- return true;
- printErrorMessage(crossDomainAccessErrorMessage(exec->lexicalGlobalObject()));
- return false;
-}
-
-inline bool JSDOMWindowBase::allowsAccessFromNoErrorMessage(JSC::ExecState* exec) const
-{
- return allowsAccessFromPrivate(exec->lexicalGlobalObject());
-}
-
-inline bool JSDOMWindowBase::allowsAccessFrom(JSC::ExecState* exec, String& message) const
-{
- if (allowsAccessFromPrivate(exec->lexicalGlobalObject()))
- return true;
- message = crossDomainAccessErrorMessage(exec->lexicalGlobalObject());
- return false;
-}
-
-ALWAYS_INLINE bool JSDOMWindowBase::allowsAccessFromPrivate(const JSGlobalObject* other) const
-{
- const JSDOMWindow* originWindow = asJSDOMWindow(other);
- const JSDOMWindow* targetWindow = m_shell->window();
-
- if (originWindow == targetWindow)
- return true;
-
- const SecurityOrigin* originSecurityOrigin = originWindow->impl()->document()->securityOrigin();
- const SecurityOrigin* targetSecurityOrigin = targetWindow->impl()->document()->securityOrigin();
-
- return originSecurityOrigin->canAccess(targetSecurityOrigin);
-}
-
}
#endif // JSDOMWindowCustom_h
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index f0d93abda..141375078 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -275,6 +275,28 @@ JSValue JSInjectedScriptHost::storageId(ExecState* exec)
return jsUndefined();
}
+JSValue JSInjectedScriptHost::evaluate(ExecState* exec)
+{
+ JSValue expression = exec->argument(0);
+ if (!expression.isString())
+ return throwError(exec, createError(exec, "String argument expected."));
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ JSFunction* evalFunction = globalObject->evalFunction();
+ CallData callData;
+ CallType callType = evalFunction->methodTable()->getCallData(evalFunction, callData);
+ if (callType == CallTypeNone)
+ return jsUndefined();
+ MarkedArgumentBuffer args;
+ args.append(expression);
+
+ bool wasEvalEnabled = globalObject->evalEnabled();
+ globalObject->setEvalEnabled(true);
+ JSValue result = JSC::call(exec, evalFunction, callType, callData, exec->globalThisValue(), args);
+ globalObject->setEvalEnabled(wasEvalEnabled);
+
+ return result;
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
index b23774474..e63f4974c 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
@@ -36,6 +36,7 @@
#include "InjectedScriptManager.h"
+#include "BindingSecurity.h"
#include "ExceptionCode.h"
#include "JSDOMWindow.h"
#include "JSDOMWindowCustom.h"
@@ -85,7 +86,7 @@ bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState)
JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
if (!inspectedWindow)
return false;
- return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState);
+ return BindingSecurity::shouldAllowAccessToDOMWindow(scriptState, inspectedWindow->impl(), DoNotReportSecurityError);
}
} // namespace WebCore
diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm
index 1a51b81a2..c1c198d65 100644
--- a/Source/WebCore/bindings/objc/WebScriptObject.mm
+++ b/Source/WebCore/bindings/objc/WebScriptObject.mm
@@ -26,6 +26,7 @@
#import "config.h"
#import "WebScriptObjectPrivate.h"
+#import "BindingSecurity.h"
#import "BridgeJSC.h"
#import "Console.h"
#import "DOMInternal.h"
@@ -241,7 +242,11 @@ static void _didExecute(WebScriptObject *obj)
if (!_private->originRootObject->isValid())
return false;
- return jsCast<JSDOMWindowBase*>(root->globalObject())->allowsAccessFrom(_private->originRootObject->globalObject());
+ // It's not actually correct to call shouldAllowAccessToFrame in this way because
+ // JSDOMWindowBase* isn't the right object to represent the currently executing
+ // JavaScript. Instead, we should use ExecState, like we do elsewhere.
+ JSDOMWindowBase* target = jsCast<JSDOMWindowBase*>(root->globalObject());
+ return BindingSecurity::shouldAllowAccessToDOMWindow(_private->originRootObject->globalObject()->globalExec(), target->impl());
}
- (oneway void)release
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 4480575a7..997be4137 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -475,7 +475,8 @@ sub GenerateGetOwnPropertyDescriptorBody
my @getOwnPropertyDescriptorImpl = ();
if ($dataNode->extendedAttributes->{"CheckSecurity"}) {
if ($interfaceName eq "DOMWindow") {
- push(@implContent, " if (!thisObject->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast<$className*>(thisObject)->impl()))\n");
} else {
push(@implContent, " if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame()))\n");
}
@@ -1768,7 +1769,8 @@ sub GenerateImplementation
if ($dataNode->extendedAttributes->{"CheckSecurity"} &&
!$attribute->signature->extendedAttributes->{"DoNotCheckSecurity"} &&
!$attribute->signature->extendedAttributes->{"DoNotCheckSecurityOnGetter"}) {
- push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))\n");
push(@implContent, " return jsUndefined();\n");
}
@@ -1883,7 +1885,8 @@ sub GenerateImplementation
push(@implContent, " ${className}* domObject = jsCast<$className*>(asObject(slotBase));\n");
if ($dataNode->extendedAttributes->{"CheckSecurity"}) {
- push(@implContent, " if (!domObject->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject->impl()))\n");
push(@implContent, " return jsUndefined();\n");
}
@@ -1958,7 +1961,8 @@ sub GenerateImplementation
if ($dataNode->extendedAttributes->{"CheckSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckSecurity"}) {
if ($interfaceName eq "DOMWindow") {
- push(@implContent, " if (!jsCast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast<$className*>(thisObject)->impl()))\n");
} else {
push(@implContent, " if (!shouldAllowAccessToFrame(exec, jsCast<$className*>(thisObject)->impl()->frame()))\n");
}
@@ -2087,7 +2091,8 @@ sub GenerateImplementation
push(@implContent, "{\n");
if ($dataNode->extendedAttributes->{"CheckSecurity"}) {
if ($interfaceName eq "DOMWindow") {
- push(@implContent, " if (!jsCast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast<$className*>(thisObject)->impl()))\n");
} else {
push(@implContent, " if (!shouldAllowAccessToFrame(exec, jsCast<$className*>(thisObject)->impl()->frame()))\n");
}
@@ -2194,7 +2199,8 @@ sub GenerateImplementation
if ($dataNode->extendedAttributes->{"CheckSecurity"} and
!$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) {
- push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n");
+ $implIncludes{"BindingSecurity.h"} = 1;
+ push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))\n");
push(@implContent, " return JSValue::encode(jsUndefined());\n");
}
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 2c170e2c9..300a365be 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -2961,7 +2961,7 @@ END
push(@implContent, <<END);
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
index c495501fe..f710be169 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "JSTestActiveDOMObject.h"
+#include "BindingSecurity.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSNode.h"
@@ -153,7 +154,7 @@ bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState
JSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(slotBase));
- if (!castedThis->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))
return jsUndefined();
UNUSED_PARAM(exec);
TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl());
@@ -165,7 +166,7 @@ JSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSValue slotBase, Pro
JSValue jsTestActiveDOMObjectConstructor(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestActiveDOMObject* domObject = jsCast<JSTestActiveDOMObject*>(asObject(slotBase));
- if (!domObject->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject->impl()))
return jsUndefined();
return JSTestActiveDOMObject::getConstructor(exec, domObject->globalObject());
}
@@ -182,7 +183,7 @@ EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunct
return throwVMTypeError(exec);
JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info);
- if (!castedThis->allowsAccessFrom(exec))
+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))
return JSValue::encode(jsUndefined());
TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl());
if (exec->argumentCount() < 1)
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
index 534a8decb..d033908e8 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
@@ -110,7 +110,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8Float64ArrayTemplate(v8::
proto->Set(v8::String::NewSymbol("foo"), v8::FunctionTemplate::New(Float64ArrayV8Internal::fooCallback, v8Undefined(), fooSignature));
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
index 86b1fd2c8..653eb1e42 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
@@ -140,7 +140,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestActiveDOMObjectTempla
proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObjectV8Internal::postMessageAttrGetter, TestActiveDOMObjectV8Internal::TestActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete));
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
index 888cae832..0f9e64ac7 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
@@ -73,7 +73,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestCustomNamedGetterTemp
desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestCustomNamedGetter::namedPropertyGetter, 0, 0, 0, 0);
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
index 2376913a9..32e13aa03 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
@@ -110,7 +110,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventConstructorTempl
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
index cd2076c40..427f1d533 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
@@ -134,7 +134,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventTargetTemplate(v
proto->Set(v8::String::NewSymbol("dispatchEvent"), v8::FunctionTemplate::New(TestEventTargetV8Internal::dispatchEventCallback, v8Undefined(), dispatchEventSignature));
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
index 9bb99ac3e..99eb522fa 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
@@ -64,7 +64,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestExceptionTemplate(v8:
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
index aaacc81c1..96cfd7a79 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
@@ -303,7 +303,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8:
V8DOMConfiguration::batchConfigureConstants(desc, proto, TestInterfaceConsts, WTF_ARRAY_LENGTH(TestInterfaceConsts));
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
index 4d3d95be0..2ede10bda 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
@@ -73,7 +73,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListene
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
index 78bd8d592..29892806b 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
@@ -114,7 +114,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNamedConstructorTempl
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
index 7b380a00a..c2a109f05 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
@@ -73,7 +73,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNodeTemplate(v8::Pers
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index edce97e7a..a8b18c832 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -2254,7 +2254,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
V8DOMConfiguration::batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
index 71f0a378b..0f7b87b12 100644
--- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
+++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
@@ -256,7 +256,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValue
// Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
+ desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
diff --git a/Source/WebCore/bindings/v8/BindingState.cpp b/Source/WebCore/bindings/v8/BindingState.cpp
index a8e3e6933..c59bb8915 100644
--- a/Source/WebCore/bindings/v8/BindingState.cpp
+++ b/Source/WebCore/bindings/v8/BindingState.cpp
@@ -98,9 +98,11 @@ Document* currentDocument(BindingState*)
return current->document();
}
-void immediatelyReportUnsafeAccessTo(BindingState*, Document* targetDocument)
+void printErrorMessageForFrame(Frame* frame, const String& message)
{
- V8Proxy::reportUnsafeAccessTo(targetDocument);
+ if (!frame)
+ return;
+ frame->document()->domWindow()->printErrorMessage(message);
}
}
diff --git a/Source/WebCore/bindings/v8/BindingState.h b/Source/WebCore/bindings/v8/BindingState.h
index e2531ade4..9564224ea 100644
--- a/Source/WebCore/bindings/v8/BindingState.h
+++ b/Source/WebCore/bindings/v8/BindingState.h
@@ -31,6 +31,8 @@
#ifndef BindingState_h
#define BindingState_h
+#include <wtf/text/WTFString.h>
+
namespace WebCore {
class DOMWindow;
@@ -55,7 +57,8 @@ Frame* firstFrame(BindingState*);
Frame* currentFrame(BindingState*);
Document* currentDocument(BindingState*);
-void immediatelyReportUnsafeAccessTo(BindingState*, Document* targetDocument);
+// FIXME: This function is redundant with the copy in JSDOMBinding.cpp.
+void printErrorMessageForFrame(Frame*, const String& message);
}
diff --git a/Source/WebCore/bindings/v8/DOMTransaction.cpp b/Source/WebCore/bindings/v8/DOMTransaction.cpp
index 08919c267..d6e36ad1b 100644
--- a/Source/WebCore/bindings/v8/DOMTransaction.cpp
+++ b/Source/WebCore/bindings/v8/DOMTransaction.cpp
@@ -35,6 +35,19 @@
namespace WebCore {
+class DOMTransactionScope {
+public:
+ DOMTransactionScope(DOMTransaction* transaction)
+ {
+ UndoManager::setRecordingDOMTransaction(transaction);
+ }
+
+ ~DOMTransactionScope()
+ {
+ UndoManager::setRecordingDOMTransaction(0);
+ }
+};
+
DOMTransaction::DOMTransaction(const WorldContextHandle& worldContext)
: m_worldContext(worldContext)
, m_undoManager(0)
@@ -51,12 +64,20 @@ void DOMTransaction::apply()
m_isAutomatic = !getFunction("executeAutomatic").IsEmpty();
if (!m_isAutomatic)
callFunction("execute");
+ else {
+ DOMTransactionScope scope(this);
+ callFunction("executeAutomatic");
+ }
}
void DOMTransaction::unapply()
{
if (!m_isAutomatic)
callFunction("undo");
+ else {
+ for (size_t i = m_transactionSteps.size(); i > 0; --i)
+ m_transactionSteps[i - 1]->unapply();
+ }
if (m_undoManager)
m_undoManager->registerRedoStep(this);
@@ -66,6 +87,10 @@ void DOMTransaction::reapply()
{
if (!m_isAutomatic)
callFunction("redo");
+ else {
+ for (size_t i = 0; i < m_transactionSteps.size(); ++i)
+ m_transactionSteps[i]->reapply();
+ }
if (m_undoManager)
m_undoManager->registerUndoStep(this);
@@ -90,14 +115,10 @@ v8::Handle<v8::Function> DOMTransaction::getFunction(const char* propertyName)
void DOMTransaction::callFunction(const char* propertyName)
{
- if (!m_undoManager || !m_undoManager->undoScopeHost())
- return;
-
- Document* document = m_undoManager->undoScopeHost()->document();
- if (!document)
+ if (!m_undoManager || !m_undoManager->document())
return;
- Frame* frame = document->frame();
+ Frame* frame = m_undoManager->document()->frame();
if (!frame || !frame->script()->canExecuteScripts(AboutToExecuteScript))
return;
diff --git a/Source/WebCore/bindings/v8/DOMTransaction.h b/Source/WebCore/bindings/v8/DOMTransaction.h
index a967c5a58..88fb30db8 100644
--- a/Source/WebCore/bindings/v8/DOMTransaction.h
+++ b/Source/WebCore/bindings/v8/DOMTransaction.h
@@ -27,6 +27,7 @@
#if ENABLE(UNDO_MANAGER)
+#include "DOMTransactionStep.h"
#include "UndoStep.h"
#include "WorldContextHandle.h"
#include <wtf/RefPtr.h>
@@ -49,6 +50,8 @@ public:
UndoManager* undoManager() const { return m_undoManager; }
void setUndoManager(UndoManager* undoManager) { m_undoManager = undoManager; }
+ void addTransactionStep(PassRefPtr<DOMTransactionStep> step) { m_transactionSteps.append(step); }
+
private:
DOMTransaction(const WorldContextHandle&);
v8::Handle<v8::Function> getFunction(const char*);
@@ -57,6 +60,7 @@ private:
WorldContextHandle m_worldContext;
UndoManager* m_undoManager;
bool m_isAutomatic;
+ Vector<RefPtr<DOMTransactionStep> > m_transactionSteps;
};
}
diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h
index da6ef92db..d67836030 100644
--- a/Source/WebCore/bindings/v8/ScriptController.h
+++ b/Source/WebCore/bindings/v8/ScriptController.h
@@ -89,8 +89,6 @@ public:
static void initializeThreading();
// Evaluate a script file in the environment of this proxy.
- // If succeeded, 'succ' is set to true and result is returned
- // as a string.
ScriptValue evaluate(const ScriptSourceCode&);
// Evaluate JavaScript in a new isolated world. The script gets its own
diff --git a/Source/WebCore/bindings/v8/ScriptSourceCode.cpp b/Source/WebCore/bindings/v8/ScriptSourceCode.cpp
new file mode 100644
index 000000000..a478e6817
--- /dev/null
+++ b/Source/WebCore/bindings/v8/ScriptSourceCode.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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:
+ * 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 "ScriptSourceCode.h"
+
+#include "V8Binding.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Script> ScriptSourceCode::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptData)
+{
+ v8::Handle<v8::String> name = v8String(fileName);
+ v8::Handle<v8::Integer> line = v8Integer(scriptStartPosition.m_line.zeroBasedInt());
+ v8::Handle<v8::Integer> column = v8Integer(scriptStartPosition.m_column.zeroBasedInt());
+ v8::ScriptOrigin origin(name, line, column);
+ v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData);
+ return script;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/ScriptSourceCode.h b/Source/WebCore/bindings/v8/ScriptSourceCode.h
index 0c68a1561..a6543ca81 100644
--- a/Source/WebCore/bindings/v8/ScriptSourceCode.h
+++ b/Source/WebCore/bindings/v8/ScriptSourceCode.h
@@ -35,6 +35,7 @@
#include "CachedScript.h"
#include "KURL.h"
#include "PlatformString.h"
+#include <v8.h>
#include <wtf/text/TextPosition.h>
namespace WebCore {
@@ -72,6 +73,8 @@ public:
int startLine() const { return m_startPosition.m_line.oneBasedInt(); }
const TextPosition& startPosition() const { return m_startPosition; }
+ static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String>, const String&, const TextPosition&, v8::ScriptData* = 0);
+
private:
String m_source;
CachedResourceHandle<CachedScript> m_cachedScript;
diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp
index 649ceb9c1..83f126cb9 100644
--- a/Source/WebCore/bindings/v8/V8Binding.cpp
+++ b/Source/WebCore/bindings/v8/V8Binding.cpp
@@ -43,6 +43,8 @@
#include "V8DOMWindow.h"
#include "V8Element.h"
#include "V8ObjectConstructor.h"
+#include "WorkerContext.h"
+#include "WorkerContextExecutionProxy.h"
#include <wtf/MathExtras.h>
#include <wtf/MainThread.h>
@@ -204,118 +206,6 @@ uint32_t toUInt32(v8::Handle<v8::Value> value, bool& ok)
return uintValue->Value();
}
-template <class S> struct StringTraits
-{
- static S fromStringResource(WebCoreStringResource* resource);
-
- static S fromV8String(v8::Handle<v8::String> v8String, int length);
-};
-
-template<>
-struct StringTraits<String>
-{
- static String fromStringResource(WebCoreStringResource* resource)
- {
- return resource->webcoreString();
- }
-
- static String fromV8String(v8::Handle<v8::String> v8String, int length)
- {
- ASSERT(v8String->Length() == length);
- // NOTE: as of now, String(const UChar*, int) performs String::createUninitialized
- // anyway, so no need to optimize like we do for AtomicString below.
- UChar* buffer;
- String result = String::createUninitialized(length, buffer);
- v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
- return result;
- }
-};
-
-template<>
-struct StringTraits<AtomicString>
-{
- static AtomicString fromStringResource(WebCoreStringResource* resource)
- {
- return resource->atomicString();
- }
-
- static AtomicString fromV8String(v8::Handle<v8::String> v8String, int length)
- {
- ASSERT(v8String->Length() == length);
- static const int inlineBufferSize = 16;
- if (length <= inlineBufferSize) {
- UChar inlineBuffer[inlineBufferSize];
- v8String->Write(reinterpret_cast<uint16_t*>(inlineBuffer), 0, length);
- return AtomicString(inlineBuffer, length);
- }
- UChar* buffer;
- String tmp = String::createUninitialized(length, buffer);
- v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
- return AtomicString(tmp);
- }
-};
-
-template <typename StringType>
-StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external)
-{
- WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String);
- if (stringResource)
- return StringTraits<StringType>::fromStringResource(stringResource);
-
- int length = v8String->Length();
- if (!length) {
- // Avoid trying to morph empty strings, as they do not have enough room to contain the external reference.
- return StringImpl::empty();
- }
-
- StringType result(StringTraits<StringType>::fromV8String(v8String, length));
-
- if (external == Externalize && v8String->CanMakeExternal()) {
- stringResource = new WebCoreStringResource(result);
- if (!v8String->MakeExternal(stringResource)) {
- // In case of a failure delete the external resource as it was not used.
- delete stringResource;
- }
- }
- return result;
-}
-
-// Explicitly instantiate the above template with the expected parameterizations,
-// to ensure the compiler generates the code; otherwise link errors can result in GCC 4.4.
-template String v8StringToWebCoreString<String>(v8::Handle<v8::String>, ExternalMode);
-template AtomicString v8StringToWebCoreString<AtomicString>(v8::Handle<v8::String>, ExternalMode);
-
-// Fast but non thread-safe version.
-String int32ToWebCoreStringFast(int value)
-{
- // Caching of small strings below is not thread safe: newly constructed AtomicString
- // are not safely published.
- ASSERT(isMainThread());
-
- // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
- const int kLowNumbers = 100;
- DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
- String webCoreString;
- if (0 <= value && value <= kLowNumbers) {
- webCoreString = lowNumbers[value];
- if (!webCoreString) {
- AtomicString valueString = AtomicString(String::number(value));
- lowNumbers[value] = valueString;
- webCoreString = valueString;
- }
- } else
- webCoreString = String::number(value);
- return webCoreString;
-}
-
-String int32ToWebCoreString(int value)
-{
- // If we are on the main thread (this should always true for non-workers), call the faster one.
- if (isMainThread())
- return int32ToWebCoreStringFast(value);
- return String::number(value);
-}
-
v8::Persistent<v8::FunctionTemplate> createRawTemplate()
{
v8::HandleScope scope;
@@ -323,39 +213,6 @@ v8::Persistent<v8::FunctionTemplate> createRawTemplate()
return v8::Persistent<v8::FunctionTemplate>::New(result);
}
-v8::Persistent<v8::String> getToStringName()
-{
- v8::Persistent<v8::String>& toStringName = V8PerIsolateData::current()->toStringName();
- if (toStringName.IsEmpty())
- toStringName = v8::Persistent<v8::String>::New(v8::String::New("toString"));
- return *toStringName;
-
-}
-
-static v8::Handle<v8::Value> constructorToString(const v8::Arguments& args)
-{
- // The DOM constructors' toString functions grab the current toString
- // for Functions by taking the toString function of itself and then
- // calling it with the constructor as its receiver. This means that
- // changes to the Function prototype chain or toString function are
- // reflected when printing DOM constructors. The only wart is that
- // changes to a DOM constructor's toString's toString will cause the
- // toString of the DOM constructor itself to change. This is extremely
- // obscure and unlikely to be a problem.
- v8::Handle<v8::Value> value = args.Callee()->Get(getToStringName());
- if (!value->IsFunction())
- return v8::String::New("");
- return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0);
-}
-
-v8::Persistent<v8::FunctionTemplate> getToStringTemplate()
-{
- v8::Persistent<v8::FunctionTemplate>& toStringTemplate = V8PerIsolateData::current()->toStringTemplate();
- if (toStringTemplate.IsEmpty())
- toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(constructorToString));
- return toStringTemplate;
-}
-
void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Binding);
@@ -403,6 +260,20 @@ Frame* toFrameIfNotDetached(v8::Handle<v8::Context> context)
return 0;
}
+v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext)
+{
+ if (context->isDocument()) {
+ if (Frame* frame = static_cast<Document*>(context)->frame())
+ return worldContext.adjustedContext(frame->script());
+#if ENABLE(WORKERS)
+ } else if (context->isWorkerContext()) {
+ if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
+ return proxy->context();
+#endif
+ }
+ return v8::Local<v8::Context>();
+}
+
V8PerContextData* perContextDataForCurrentWorld(Frame* frame)
{
V8IsolatedContext* isolatedContext;
diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h
index a4c5f0b5d..5bb4c0154 100644
--- a/Source/WebCore/bindings/v8/V8Binding.h
+++ b/Source/WebCore/bindings/v8/V8Binding.h
@@ -41,6 +41,7 @@
#include "V8ObjectConstructor.h"
#include "V8PerIsolateData.h"
#include "V8Proxy.h"
+#include "V8StringResource.h"
#include "V8ThrowException.h"
#include "V8ValueCache.h"
#include <wtf/Noncopyable.h>
@@ -76,14 +77,6 @@ namespace WebCore {
return isolate ? v8::Null(isolate) : v8::Null();
}
- enum ExternalMode {
- Externalize,
- DoNotExternalize
- };
-
- template <typename StringType>
- StringType v8StringToWebCoreString(v8::Handle<v8::String>, ExternalMode);
-
// Convert v8 types to a WTF::String. If the V8 string is not already
// an external string then it is transformed into an external string at this
// point to avoid repeated conversions.
@@ -282,13 +275,6 @@ namespace WebCore {
return static_cast<long long>(value->IntegerValue());
}
- // The string returned by this function is still owned by the argument
- // and will be deallocated when the argument is deallocated.
- inline const uint16_t* fromWebCoreString(const String& str)
- {
- return reinterpret_cast<const uint16_t*>(str.characters());
- }
-
inline bool isUndefinedOrNull(v8::Handle<v8::Value> value)
{
return value->IsNull() || value->IsUndefined();
@@ -361,16 +347,14 @@ namespace WebCore {
v8::Persistent<v8::FunctionTemplate> createRawTemplate();
- v8::Persistent<v8::String> getToStringName();
- v8::Persistent<v8::FunctionTemplate> getToStringTemplate();
-
- String int32ToWebCoreString(int value);
-
PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>);
// Returns the window object associated with a context.
DOMWindow* toDOMWindow(v8::Handle<v8::Context>);
+ // Returns the context associated with a ScriptExecutionContext.
+ v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle&);
+
// Returns the frame object of the window object associated with
// a context, if the window is currently being displayed in the Frame.
Frame* toFrameIfNotDetached(v8::Handle<v8::Context>);
@@ -384,102 +368,6 @@ namespace WebCore {
void crashIfV8IsDead();
- class V8ParameterBase {
- public:
- operator String() { return toString<String>(); }
- operator AtomicString() { return toString<AtomicString>(); }
-
- protected:
- V8ParameterBase(v8::Local<v8::Value> object) : m_v8Object(object), m_mode(Externalize), m_string() { }
-
- bool prepareBase()
- {
- if (m_v8Object.IsEmpty())
- return true;
-
- if (LIKELY(m_v8Object->IsString()))
- return true;
-
- if (LIKELY(m_v8Object->IsInt32())) {
- setString(int32ToWebCoreString(m_v8Object->Int32Value()));
- return true;
- }
-
- m_mode = DoNotExternalize;
- v8::TryCatch block;
- m_v8Object = m_v8Object->ToString();
- // Handle the case where an exception is thrown as part of invoking toString on the object.
- if (block.HasCaught()) {
- block.ReThrow();
- return false;
- }
- return true;
- }
-
- v8::Local<v8::Value> object() { return m_v8Object; }
-
- void setString(const String& string)
- {
- m_string = string;
- m_v8Object.Clear(); // To signal that String is ready.
- }
-
- private:
- v8::Local<v8::Value> m_v8Object;
- ExternalMode m_mode;
- String m_string;
-
- template <class StringType>
- StringType toString()
- {
- if (LIKELY(!m_v8Object.IsEmpty()))
- return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
-
- return StringType(m_string);
- }
- };
-
- // V8Parameter is an adapter class that converts V8 values to Strings
- // or AtomicStrings as appropriate, using multiple typecast operators.
- enum V8ParameterMode {
- DefaultMode,
- WithNullCheck,
- WithUndefinedOrNullCheck
- };
- template <V8ParameterMode MODE = DefaultMode>
- class V8Parameter: public V8ParameterBase {
- public:
- V8Parameter(v8::Local<v8::Value> object) : V8ParameterBase(object) { }
- V8Parameter(v8::Local<v8::Value> object, bool) : V8ParameterBase(object) { prepare(); }
-
- bool prepare();
- };
-
- template<> inline bool V8Parameter<DefaultMode>::prepare()
- {
- return V8ParameterBase::prepareBase();
- }
-
- template<> inline bool V8Parameter<WithNullCheck>::prepare()
- {
- if (object().IsEmpty() || object()->IsNull()) {
- setString(String());
- return true;
- }
-
- return V8ParameterBase::prepareBase();
- }
-
- template<> inline bool V8Parameter<WithUndefinedOrNullCheck>::prepare()
- {
- if (object().IsEmpty() || object()->IsNull() || object()->IsUndefined()) {
- setString(String());
- return true;
- }
-
- return V8ParameterBase::prepareBase();
- }
-
} // namespace WebCore
#endif // V8Binding_h
diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
index 378ff2d5b..80204668f 100644
--- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -153,8 +153,10 @@ static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
{
Frame* target = getTargetFrame(host, data);
- if (target)
- V8Proxy::reportUnsafeAccessTo(target->document());
+ if (!target)
+ return;
+ DOMWindow* targetWindow = target->document()->domWindow();
+ targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(activeDOMWindow(BindingState::instance())));
}
PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame)
diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
index f10714669..91f782888 100644
--- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
+++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp
@@ -158,7 +158,7 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context)
code.append("\n};}}}})");
v8::Handle<v8::String> codeExternalString = v8ExternalString(code);
- v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_position);
+ v8::Handle<v8::Script> script = ScriptSourceCode::compileScript(codeExternalString, m_sourceURL, m_position);
if (script.IsEmpty())
return;
@@ -231,7 +231,7 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context)
wrappedFunction->Set(v8::String::NewSymbol("toString"), toStringFunction);
}
- wrappedFunction->SetName(v8::String::New(fromWebCoreString(m_functionName), m_functionName.length()));
+ wrappedFunction->SetName(v8String(m_functionName));
// FIXME: Remove the following comment-outs.
// See https://bugs.webkit.org/show_bug.cgi?id=85152 for more details.
diff --git a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
index 16e4b0ede..183c312ec 100644
--- a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
+++ b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
@@ -106,4 +106,20 @@ void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor)
}
#endif
+v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Arguments& args)
+{
+ // The DOM constructors' toString functions grab the current toString
+ // for Functions by taking the toString function of itself and then
+ // calling it with the constructor as its receiver. This means that
+ // changes to the Function prototype chain or toString function are
+ // reflected when printing DOM constructors. The only wart is that
+ // changes to a DOM constructor's toString's toString will cause the
+ // toString of the DOM constructor itself to change. This is extremely
+ // obscure and unlikely to be a problem.
+ v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toString"));
+ if (!value->IsFunction())
+ return v8::String::New("");
+ return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0);
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/V8PerIsolateData.h b/Source/WebCore/bindings/v8/V8PerIsolateData.h
index 72da77e42..ceb2ee842 100644
--- a/Source/WebCore/bindings/v8/V8PerIsolateData.h
+++ b/Source/WebCore/bindings/v8/V8PerIsolateData.h
@@ -69,8 +69,13 @@ public:
TemplateMap& rawTemplateMap() { return m_rawTemplates; }
TemplateMap& templateMap() { return m_templates; }
- v8::Persistent<v8::String>& toStringName() { return m_toStringName; }
- v8::Persistent<v8::FunctionTemplate>& toStringTemplate() { return m_toStringTemplate; }
+
+ v8::Persistent<v8::FunctionTemplate>& toStringTemplate()
+ {
+ if (m_toStringTemplate.IsEmpty())
+ m_toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(constructorOfToString));
+ return m_toStringTemplate;
+ }
v8::Persistent<v8::FunctionTemplate>& lazyEventListenerToStringTemplate()
{
@@ -130,10 +135,10 @@ public:
private:
explicit V8PerIsolateData(v8::Isolate*);
~V8PerIsolateData();
+ static v8::Handle<v8::Value> constructorOfToString(const v8::Arguments&);
TemplateMap m_rawTemplates;
TemplateMap m_templates;
- v8::Persistent<v8::String> m_toStringName;
v8::Persistent<v8::FunctionTemplate> m_toStringTemplate;
v8::Persistent<v8::FunctionTemplate> m_lazyEventListenerToStringTemplate;
OwnPtr<StringCache> m_stringCache;
diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp
index b1a0fa0a4..0c025c176 100644
--- a/Source/WebCore/bindings/v8/V8Proxy.cpp
+++ b/Source/WebCore/bindings/v8/V8Proxy.cpp
@@ -77,33 +77,6 @@
namespace WebCore {
-void V8Proxy::reportUnsafeAccessTo(Document* targetDocument)
-{
- if (!targetDocument)
- return;
-
- // FIXME: We should pass both the active and target documents in as arguments.
- Frame* source = firstFrame(BindingState::instance());
- if (!source)
- return;
-
- Document* sourceDocument = source->document();
- if (!sourceDocument)
- return; // Ignore error if the source document is gone.
-
- // FIXME: This error message should contain more specifics of why the same
- // origin check has failed.
- String str = "Unsafe JavaScript attempt to access frame with URL " + targetDocument->url().string() +
- " from frame with URL " + sourceDocument->url().string() + ". Domains, protocols and ports must match.\n";
-
- RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
-
- // NOTE: Safari prints the message in the target page, but it seems like
- // it should be in the source page. Even for delayed messages, we put it in
- // the source page.
- sourceDocument->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, str, stackTrace.release());
-}
-
// FIXME: This will be soon removed when we move runScript() to ScriptController.
static v8::Local<v8::Value> handleMaxRecursionDepthExceeded()
{
@@ -121,17 +94,6 @@ V8Proxy::~V8Proxy()
windowShell()->destroyGlobal();
}
-v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptData)
-{
- const uint16_t* fileNameString = fromWebCoreString(fileName);
- v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length());
- v8::Handle<v8::Integer> line = v8Integer(scriptStartPosition.m_line.zeroBasedInt());
- v8::Handle<v8::Integer> column = v8Integer(scriptStartPosition.m_column.zeroBasedInt());
- v8::ScriptOrigin origin(name, line, column);
- v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData);
- return script;
-}
-
PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript)
{
// A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from
@@ -180,7 +142,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
// NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
// 1, whereas v8 starts at 0.
- v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startPosition(), scriptData.get());
+ v8::Handle<v8::Script> script = ScriptSourceCode::compileScript(code, source.url(), source.startPosition(), scriptData.get());
#if PLATFORM(CHROMIUM)
TRACE_EVENT_END0("v8", "v8.compile");
TRACE_EVENT0("v8", "v8.run");
@@ -286,18 +248,4 @@ bool V8Proxy::matchesCurrentContext()
return context == context->GetCurrent();
}
-v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext)
-{
- if (context->isDocument()) {
- if (Frame* frame = static_cast<Document*>(context)->frame())
- return worldContext.adjustedContext(frame->script());
-#if ENABLE(WORKERS)
- } else if (context->isWorkerContext()) {
- if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy())
- return proxy->context();
-#endif
- }
- return v8::Local<v8::Context>();
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h
index 1e3d67b46..a62a60862 100644
--- a/Source/WebCore/bindings/v8/V8Proxy.h
+++ b/Source/WebCore/bindings/v8/V8Proxy.h
@@ -97,15 +97,10 @@ namespace WebCore {
// Run an already compiled script.
v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
- // Call the function as constructor with the given arguments.
- v8::Local<v8::Value> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
-
// Returns V8 Context of a frame. If none exists, creates
// a new context. It is potentially slow and consumes memory.
static v8::Local<v8::Context> context(Frame*);
- static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* = 0);
-
v8::Local<v8::Context> context();
v8::Local<v8::Context> isolatedWorldContext(int worldId);
bool matchesCurrentContext();
@@ -115,8 +110,6 @@ namespace WebCore {
// will be moved to ScriptController.
V8DOMWindowShell* windowShell() const;
- static void reportUnsafeAccessTo(Document* targetDocument);
-
// FIXME: Move m_isolatedWorlds to ScriptController and remove this getter.
IsolatedWorldMap& isolatedWorlds() { return m_isolatedWorlds; }
@@ -135,8 +128,6 @@ namespace WebCore {
IsolatedWorldSecurityOriginMap m_isolatedWorldSecurityOrigins;
};
-
- v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext);
}
#endif // V8Proxy_h
diff --git a/Source/WebCore/bindings/v8/V8StringResource.cpp b/Source/WebCore/bindings/v8/V8StringResource.cpp
new file mode 100644
index 000000000..c7c964df1
--- /dev/null
+++ b/Source/WebCore/bindings/v8/V8StringResource.cpp
@@ -0,0 +1,139 @@
+/*
+ * 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:
+ * 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 "V8StringResource.h"
+
+#include "V8Binding.h"
+
+namespace WebCore {
+
+template <class S> struct StringTraits {
+ static S fromStringResource(WebCoreStringResource*);
+ static S fromV8String(v8::Handle<v8::String>, int);
+};
+
+template<>
+struct StringTraits<String> {
+ static String fromStringResource(WebCoreStringResource* resource)
+ {
+ return resource->webcoreString();
+ }
+
+ static String fromV8String(v8::Handle<v8::String> v8String, int length)
+ {
+ ASSERT(v8String->Length() == length);
+ // NOTE: as of now, String(const UChar*, int) performs String::createUninitialized
+ // anyway, so no need to optimize like we do for AtomicString below.
+ UChar* buffer;
+ String result = String::createUninitialized(length, buffer);
+ v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
+ return result;
+ }
+};
+
+template<>
+struct StringTraits<AtomicString> {
+ static AtomicString fromStringResource(WebCoreStringResource* resource)
+ {
+ return resource->atomicString();
+ }
+
+ static AtomicString fromV8String(v8::Handle<v8::String> v8String, int length)
+ {
+ ASSERT(v8String->Length() == length);
+ static const int inlineBufferSize = 16;
+ if (length <= inlineBufferSize) {
+ UChar inlineBuffer[inlineBufferSize];
+ v8String->Write(reinterpret_cast<uint16_t*>(inlineBuffer), 0, length);
+ return AtomicString(inlineBuffer, length);
+ }
+ UChar* buffer;
+ String string = String::createUninitialized(length, buffer);
+ v8String->Write(reinterpret_cast<uint16_t*>(buffer), 0, length);
+ return AtomicString(string);
+ }
+};
+
+template <typename StringType>
+StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external)
+{
+ WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String);
+ if (stringResource)
+ return StringTraits<StringType>::fromStringResource(stringResource);
+
+ int length = v8String->Length();
+ if (!length)
+ return String("");
+
+ StringType result(StringTraits<StringType>::fromV8String(v8String, length));
+
+ if (external == Externalize && v8String->CanMakeExternal()) {
+ stringResource = new WebCoreStringResource(result);
+ if (!v8String->MakeExternal(stringResource)) {
+ // In case of a failure delete the external resource as it was not used.
+ delete stringResource;
+ }
+ }
+ return result;
+}
+
+// Explicitly instantiate the above template with the expected parameterizations,
+// to ensure the compiler generates the code; otherwise link errors can result in GCC 4.4.
+template String v8StringToWebCoreString<String>(v8::Handle<v8::String>, ExternalMode);
+template AtomicString v8StringToWebCoreString<AtomicString>(v8::Handle<v8::String>, ExternalMode);
+
+// Fast but non thread-safe version.
+String int32ToWebCoreStringFast(int value)
+{
+ // Caching of small strings below is not thread safe: newly constructed AtomicString
+ // are not safely published.
+ ASSERT(isMainThread());
+
+ // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
+ const int kLowNumbers = 100;
+ DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
+ String webCoreString;
+ if (0 <= value && value <= kLowNumbers) {
+ webCoreString = lowNumbers[value];
+ if (!webCoreString) {
+ AtomicString valueString = AtomicString(String::number(value));
+ lowNumbers[value] = valueString;
+ webCoreString = valueString;
+ }
+ } else
+ webCoreString = String::number(value);
+ return webCoreString;
+}
+
+String int32ToWebCoreString(int value)
+{
+ // If we are on the main thread (this should always true for non-workers), call the faster one.
+ if (isMainThread())
+ return int32ToWebCoreStringFast(value);
+ return String::number(value);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/V8StringResource.h b/Source/WebCore/bindings/v8/V8StringResource.h
new file mode 100644
index 000000000..55cdba6e2
--- /dev/null
+++ b/Source/WebCore/bindings/v8/V8StringResource.h
@@ -0,0 +1,143 @@
+/*
+ * 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:
+ * 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 V8StringResource_h
+#define V8StringResource_h
+
+#include <v8.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+enum ExternalMode {
+ Externalize,
+ DoNotExternalize
+};
+
+template <typename StringType>
+StringType v8StringToWebCoreString(v8::Handle<v8::String>, ExternalMode);
+String int32ToWebCoreString(int value);
+
+class V8ParameterBase {
+public:
+ operator String() { return toString<String>(); }
+ operator AtomicString() { return toString<AtomicString>(); }
+
+protected:
+ V8ParameterBase(v8::Local<v8::Value> object) : m_v8Object(object), m_mode(Externalize), m_string() { }
+
+ bool prepareBase()
+ {
+ if (m_v8Object.IsEmpty())
+ return true;
+
+ if (LIKELY(m_v8Object->IsString()))
+ return true;
+
+ if (LIKELY(m_v8Object->IsInt32())) {
+ setString(int32ToWebCoreString(m_v8Object->Int32Value()));
+ return true;
+ }
+
+ m_mode = DoNotExternalize;
+ v8::TryCatch block;
+ m_v8Object = m_v8Object->ToString();
+ // Handle the case where an exception is thrown as part of invoking toString on the object.
+ if (block.HasCaught()) {
+ block.ReThrow();
+ return false;
+ }
+ return true;
+ }
+
+ v8::Local<v8::Value> object() { return m_v8Object; }
+
+ void setString(const String& string)
+ {
+ m_string = string;
+ m_v8Object.Clear(); // To signal that String is ready.
+ }
+
+private:
+ v8::Local<v8::Value> m_v8Object;
+ ExternalMode m_mode;
+ String m_string;
+
+ template <class StringType>
+ StringType toString()
+ {
+ if (LIKELY(!m_v8Object.IsEmpty()))
+ return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
+
+ return StringType(m_string);
+ }
+};
+
+// V8Parameter is an adapter class that converts V8 values to Strings
+// or AtomicStrings as appropriate, using multiple typecast operators.
+enum V8ParameterMode {
+ DefaultMode,
+ WithNullCheck,
+ WithUndefinedOrNullCheck
+};
+
+template <V8ParameterMode MODE = DefaultMode>
+class V8Parameter: public V8ParameterBase {
+public:
+ V8Parameter(v8::Local<v8::Value> object) : V8ParameterBase(object) { }
+ V8Parameter(v8::Local<v8::Value> object, bool) : V8ParameterBase(object) { prepare(); }
+
+ bool prepare();
+};
+
+template<> inline bool V8Parameter<DefaultMode>::prepare()
+{
+ return V8ParameterBase::prepareBase();
+}
+
+template<> inline bool V8Parameter<WithNullCheck>::prepare()
+{
+ if (object().IsEmpty() || object()->IsNull()) {
+ setString(String());
+ return true;
+ }
+
+ return V8ParameterBase::prepareBase();
+}
+
+template<> inline bool V8Parameter<WithUndefinedOrNullCheck>::prepare()
+{
+ if (object().IsEmpty() || object()->IsNull() || object()->IsUndefined()) {
+ setString(String());
+ return true;
+ }
+
+ return V8ParameterBase::prepareBase();
+}
+
+} // namespace WebCore
+
+#endif // V8StringResource_h
diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index 07a36796b..b0f051e8f 100644
--- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -38,6 +38,7 @@
#include "DedicatedWorkerContext.h"
#include "Event.h"
#include "ScriptCallStack.h"
+#include "ScriptSourceCode.h"
#include "SharedWorker.h"
#include "SharedWorkerContext.h"
#include "V8Binding.h"
@@ -46,7 +47,6 @@
#include "V8DedicatedWorkerContext.h"
#include "V8ObjectConstructor.h"
#include "V8PerContextData.h"
-#include "V8Proxy.h"
#include "V8RecursionScope.h"
#include "V8SharedWorkerContext.h"
#include "Worker.h"
@@ -213,7 +213,7 @@ ScriptValue WorkerContextExecutionProxy::evaluate(const String& script, const St
v8::TryCatch exceptionCatcher;
v8::Local<v8::String> scriptString = v8ExternalString(script);
- v8::Handle<v8::Script> compiledScript = V8Proxy::compileScript(scriptString, fileName, scriptStartPosition);
+ v8::Handle<v8::Script> compiledScript = ScriptSourceCode::compileScript(scriptString, fileName, scriptStartPosition);
v8::Local<v8::Value> result = runScript(compiledScript);
if (!exceptionCatcher.CanContinue()) {
@@ -250,7 +250,7 @@ v8::Local<v8::Value> WorkerContextExecutionProxy::runScript(v8::Handle<v8::Scrip
// Compute the source string and prevent against infinite recursion.
if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) {
v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
- script = V8Proxy::compileScript(code, "", TextPosition::minimumPosition());
+ script = ScriptSourceCode::compileScript(code, "", TextPosition::minimumPosition());
}
if (handleOutOfMemory())
diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
index adbeacdf8..672c2ab9d 100644
--- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp
@@ -29,15 +29,25 @@
*/
#include "config.h"
+#include "V8ArrayBufferCustom.h"
+
#include <wtf/ArrayBuffer.h>
+#include <wtf/StdLibExtras.h>
#include "ExceptionCode.h"
-#include "V8Binding.h"
#include "V8ArrayBuffer.h"
+#include "V8Binding.h"
#include "V8Proxy.h"
namespace WebCore {
+V8ArrayBufferDeallocationObserver* V8ArrayBufferDeallocationObserver::instance()
+{
+ DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver, ());
+ return &deallocationObserver;
+}
+
+
v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.ArrayBuffer.Constructor");
@@ -71,6 +81,8 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar
buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1);
if (!buffer.get())
return throwError(RangeError, "ArrayBuffer size is not a small enough positive integer.", args.GetIsolate());
+ buffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(buffer->byteLength());
// Transform the holder into a wrapper object for the array.
v8::Handle<v8::Object> wrapper = args.Holder();
V8DOMWrapper::setDOMWrapper(wrapper, &info, buffer.get());
diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.h
index 720f79c55..6f0fe8c10 100644
--- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h
+++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.h
@@ -4,52 +4,42 @@
* 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
+ * 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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * 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.
+ * 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 WebScrollbarLayerImpl_h
-#define WebScrollbarLayerImpl_h
+#ifndef V8ArrayBufferCustom_h
+#define V8ArrayBufferCustom_h
-#include <public/WebScrollbarLayer.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include <v8.h>
+#include <wtf/ArrayBuffer.h>
namespace WebCore {
-class ScrollbarLayerChromium;
-}
-namespace WebKit {
-class WebLayerImpl;
-
-class WebScrollbarLayerImpl : public WebScrollbarLayer {
+class V8ArrayBufferDeallocationObserver: public WTF::ArrayBufferDeallocationObserver {
public:
- explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>);
- virtual ~WebScrollbarLayerImpl();
-
- // WebScrollbarLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual void setScrollLayer(WebLayer*) OVERRIDE;
-
-private:
- OwnPtr<WebLayerImpl> m_layer;
+ virtual void ArrayBufferDeallocated(unsigned sizeInBytes)
+ {
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(-static_cast<int>(sizeInBytes));
+ }
+ static V8ArrayBufferDeallocationObserver* instance();
};
}
-#endif // WebScrollbarLayerImpl_h
+#endif // V8ArrayBufferCustom_h
diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
index 8c73f4888..7cef2c73d 100644
--- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
index 93b242a05..12be5b309 100644
--- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -35,6 +35,7 @@
#include "ExceptionCode.h"
#include "V8ArrayBuffer.h"
+#include "V8ArrayBufferCustom.h"
#include "V8Binding.h"
#include "V8Proxy.h"
@@ -147,6 +148,9 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
if (!array.get())
return throwError(RangeError, tooLargeSize, args.GetIsolate());
+ array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength());
+
memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(ElementType));
return wrapArrayBufferView(args, type, array, arrayType, true);
@@ -182,6 +186,11 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
if (!array.get())
return throwError(RangeError, tooLargeSize, args.GetIsolate());
+ if (doInstantiation) {
+ array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength());
+ }
+
// Transform the holder into a wrapper object for the array.
V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 4dd181b88..0fe290b3a 100644
--- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -253,7 +253,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::getEventListenersCallback(const v8::
if (!listeners->Length())
continue;
AtomicString eventType = listenersArray[i].eventType;
- result->Set(v8::String::New(fromWebCoreString(eventType), eventType.length()), listeners);
+ result->Set(v8String(eventType), listeners);
}
return result;
@@ -299,6 +299,22 @@ v8::Handle<v8::Value> V8InjectedScriptHost::storageIdCallback(const v8::Argument
return v8::Undefined();
}
+v8::Handle<v8::Value> V8InjectedScriptHost::evaluateCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.evaluate()");
+ if (args.Length() < 1)
+ return v8::ThrowException(v8::Exception::Error(v8::String::New("One argument expected.")));
+
+ v8::Handle<v8::String> expression = args[0]->ToString();
+ if (expression.IsEmpty())
+ return v8::ThrowException(v8::Exception::Error(v8::String::New("The argument must be a string.")));
+
+ v8::Handle<v8::Script> script = v8::Script::Compile(expression);
+ if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it.
+ return v8::Handle<v8::Value>();
+ return script->Run();
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
index 2c0209a46..922abb153 100644
--- a/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -68,7 +68,7 @@ v8::Handle<v8::Value> V8MessageEvent::dataAccessorGetter(v8::Local<v8::String> n
case MessageEvent::DataTypeString: {
String stringValue = event->dataAsString();
- result = v8::String::New(fromWebCoreString(stringValue), stringValue.length());
+ result = v8String(stringValue);
break;
}
diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 3904ba16a..70d780d39 100644
--- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -134,7 +134,7 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info, v8::Isolate* i
case WebGLGetInfo::kTypeNull:
return v8::Null(isolate);
case WebGLGetInfo::kTypeString:
- return v8::String::New(fromWebCoreString(info.getString()), info.getString().length());
+ return v8String(info.getString());
case WebGLGetInfo::kTypeUnsignedInt:
return v8UnsignedInteger(info.getUnsignedInt(), isolate);
case WebGLGetInfo::kTypeWebGLBuffer:
@@ -397,7 +397,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(co
Vector<String> value = imp->getSupportedExtensions();
v8::Local<v8::Array> array = v8::Array::New(value.size());
for (size_t ii = 0; ii < value.size(); ++ii)
- array->Set(v8Integer(ii, args.GetIsolate()), v8::String::New(fromWebCoreString(value[ii]), value[ii].length()));
+ array->Set(v8Integer(ii, args.GetIsolate()), v8String(value[ii]));
return array;
}
diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp
index 4592dfb6e..50f6db645 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.cpp
+++ b/Source/WebCore/bridge/qt/qt_runtime.cpp
@@ -1282,8 +1282,8 @@ static int findSignalIndex(const QMetaObject* meta, int initialIndex, QByteArray
static JSClassRef prototypeForSignalsAndSlots()
{
static JSClassDefinition classDef = {
- 0, kJSClassAttributeNoAutomaticPrototype, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, QtRuntimeMethod::call, 0, 0, 0
};
static JSClassRef cls = JSClassCreate(&classDef);
return cls;
@@ -1307,7 +1307,7 @@ QtRuntimeMethod::~QtRuntimeMethod()
JSValueRef QtRuntimeMethod::call(JSContextRef context, JSObjectRef function, JSObjectRef /*thisObject*/, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
- QtRuntimeMethod* d = toRuntimeMethod(context, function);
+ QtRuntimeMethod* d = reinterpret_cast<QtRuntimeMethod*>(JSObjectGetPrivate(function));
if (!d) {
setException(context, exception, QStringLiteral("cannot call function of deleted runtime method"));
return JSValueMakeUndefined(context);
@@ -1353,53 +1353,50 @@ JSObjectRef QtRuntimeMethod::jsObjectRef(JSContextRef context, JSValueRef* excep
if (JSObjectRef cachedWrapper = m_instance->m_cachedMethods.get(this))
return cachedWrapper;
- static JSStringRef connectStr = JSStringCreateWithUTF8CString("connect");
- static JSStringRef disconnectStr = JSStringCreateWithUTF8CString("disconnect");
- JSRetainPtr<JSStringRef> actualNameStr(Adopt, JSStringCreateWithUTF8CString(m_identifier.constData()));
-
- JSObjectRef object = JSObjectMakeFunctionWithCallback(context, actualNameStr.get(), call);
+ static const JSClassDefinition classDefForConnect = {
+ 0, 0, "connect", 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, connect, 0, 0, 0
+ };
- JSObjectRef generalFunctionProto = JSValueToObject(context, JSObjectGetPrototype(context, object), 0);
- JSObjectRef runtimeMethodProto = JSObjectMake(context, prototypeForSignalsAndSlots(), this);
- JSObjectSetPrototype(context, runtimeMethodProto, generalFunctionProto);
+ static const JSClassDefinition classDefForDisconnect = {
+ 0, 0, "disconnect", 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, disconnect, 0, 0, 0
+ };
- JSObjectSetPrototype(context, object, runtimeMethodProto);
+ static JSClassRef classRefConnect = JSClassCreate(&classDefForConnect);
+ static JSClassRef classRefDisconnect = JSClassCreate(&classDefForDisconnect);
+ bool isSignal = m_flags & MethodIsSignal;
+ JSObjectRef object = JSObjectMake(context, prototypeForSignalsAndSlots(), this);
+ JSObjectRef connectFunction = JSObjectMake(context, classRefConnect, this);
+ JSObjectRef disconnectFunction = JSObjectMake(context, classRefDisconnect, this);
+ JSPropertyAttributes attributes = kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete;
- JSObjectRef connectFunction = JSObjectMakeFunctionWithCallback(context, connectStr, connect);
- JSObjectSetPrototype(context, connectFunction, runtimeMethodProto);
+ static JSStringRef connectStr = JSStringCreateWithUTF8CString("connect");
+ static JSStringRef disconnectStr = JSStringCreateWithUTF8CString("disconnect");
+ static JSStringRef lengthStr = JSStringCreateWithUTF8CString("length");
+ static JSStringRef nameStr = JSStringCreateWithUTF8CString("name");
+ JSRetainPtr<JSStringRef> actualNameStr(Adopt, JSStringCreateWithUTF8CString(m_identifier.constData()));
- JSObjectRef disconnectFunction = JSObjectMakeFunctionWithCallback(context, disconnectStr, disconnect);
- JSObjectSetPrototype(context, disconnectFunction, runtimeMethodProto);
+ JSObjectSetProperty(context, connectFunction, lengthStr, JSValueMakeNumber(context, isSignal ? 1 : 0), attributes, exception);
+ JSObjectSetProperty(context, connectFunction, nameStr, JSValueMakeString(context, connectStr), attributes, exception);
+ JSObjectSetProperty(context, disconnectFunction, lengthStr, JSValueMakeNumber(context, isSignal ? 1 : 0), attributes, exception);
+ JSObjectSetProperty(context, disconnectFunction, nameStr, JSValueMakeString(context, disconnectStr), attributes, exception);
- const JSPropertyAttributes attributes = kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete;
JSObjectSetProperty(context, object, connectStr, connectFunction, attributes, exception);
JSObjectSetProperty(context, object, disconnectStr, disconnectFunction, attributes, exception);
+ JSObjectSetProperty(context, object, lengthStr, JSValueMakeNumber(context, 0), attributes, exception);
+ JSObjectSetProperty(context, object, nameStr, JSValueMakeString(context, actualNameStr.get()), attributes, exception);
m_instance->m_cachedMethods.set(context, this, object);
return object;
}
-QtRuntimeMethod* QtRuntimeMethod::toRuntimeMethod(JSContextRef context, JSObjectRef object)
-{
- JSObjectRef proto = JSValueToObject(context, JSObjectGetPrototype(context, object), 0);
- if (!proto)
- return 0;
- if (!JSValueIsObjectOfClass(context, proto, prototypeForSignalsAndSlots()))
- return 0;
- return static_cast<QtRuntimeMethod*>(JSObjectGetPrivate(proto));
-}
-
JSValueRef QtRuntimeMethod::connectOrDisconnect(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception, bool connect)
{
- QtRuntimeMethod* d = toRuntimeMethod(context, thisObject);
+ QtRuntimeMethod* d = static_cast<QtRuntimeMethod*>(JSObjectGetPrivate(thisObject));
if (!d)
- d = toRuntimeMethod(context, function);
- if (!d) {
- QString errorStr = QStringLiteral("QtMetaMethod.%1: Cannot connect to/from deleted QObject").arg(connect ? QStringLiteral("connect") : QStringLiteral("disconnect"));
- setException(context, exception, errorStr);
- return JSValueMakeUndefined(context);
- }
+ d = static_cast<QtRuntimeMethod*>(JSObjectGetPrivate(function));
QString functionName = connect ? QStringLiteral("connect") : QStringLiteral("disconnect");
@@ -1435,9 +1432,11 @@ JSValueRef QtRuntimeMethod::connectOrDisconnect(JSContextRef context, JSObjectRe
// object.signal.connect(someFunction);
if (JSObjectIsFunction(context, targetFunction)) {
- // object.signal.connect(otherObject.slot);
- if (QtRuntimeMethod* targetMethod = toRuntimeMethod(context, targetFunction))
- targetObject = toRef(QtInstance::getQtInstance(targetMethod->m_object.data(), d->m_instance->rootObject(), QtInstance::QtOwnership)->createRuntimeObject(toJS(context)));
+ if (JSValueIsObjectOfClass(context, targetFunction, prototypeForSignalsAndSlots())) {
+ // object.signal.connect(otherObject.slot);
+ if (QtRuntimeMethod* targetMethod = static_cast<QtRuntimeMethod*>(JSObjectGetPrivate(targetFunction)))
+ targetObject = toRef(QtInstance::getQtInstance(targetMethod->m_object.data(), d->m_instance->rootObject(), QtInstance::QtOwnership)->createRuntimeObject(toJS(context)));
+ }
} else
targetFunction = 0;
} else {
diff --git a/Source/WebCore/bridge/qt/qt_runtime.h b/Source/WebCore/bridge/qt/qt_runtime.h
index 2450fc56e..a91e4f513 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.h
+++ b/Source/WebCore/bridge/qt/qt_runtime.h
@@ -114,7 +114,8 @@ public:
const QByteArray& name() { return m_identifier; }
private:
- static QtRuntimeMethod* toRuntimeMethod(JSContextRef, JSObjectRef);
+ static const JSStaticFunction connectFunction;
+ static const JSStaticFunction disconnectFunction;
static JSValueRef connectOrDisconnect(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception, bool connect);
QPointer<QObject> m_object;
diff --git a/Source/WebCore/css/CSSCanvasValue.cpp b/Source/WebCore/css/CSSCanvasValue.cpp
index 4925b3938..63777bb4d 100644
--- a/Source/WebCore/css/CSSCanvasValue.cpp
+++ b/Source/WebCore/css/CSSCanvasValue.cpp
@@ -97,7 +97,7 @@ void CSSCanvasValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectI
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo);
- info.addMember(m_name);
+ info.addInstrumentedMember(m_name);
info.addInstrumentedMember(m_element);
}
diff --git a/Source/WebCore/css/CSSCharsetRule.cpp b/Source/WebCore/css/CSSCharsetRule.cpp
index b7d201c86..a3c3e1b9a 100644
--- a/Source/WebCore/css/CSSCharsetRule.cpp
+++ b/Source/WebCore/css/CSSCharsetRule.cpp
@@ -40,7 +40,7 @@ void CSSCharsetRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectI
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
- info.addMember(m_encoding);
+ info.addInstrumentedMember(m_encoding);
}
} // namespace WebCore
diff --git a/Source/WebCore/css/CSSFontFaceSrcValue.cpp b/Source/WebCore/css/CSSFontFaceSrcValue.cpp
index a00115db1..db4eb9b36 100644
--- a/Source/WebCore/css/CSSFontFaceSrcValue.cpp
+++ b/Source/WebCore/css/CSSFontFaceSrcValue.cpp
@@ -100,8 +100,8 @@ CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
void CSSFontFaceSrcValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_resource);
- info.addMember(m_format);
+ info.addInstrumentedMember(m_resource);
+ info.addInstrumentedMember(m_format);
// FIXME: add m_cachedFont when MemoryCache is instrumented.
#if ENABLE(SVG_FONTS)
info.addInstrumentedMember(m_svgFontFaceElement);
diff --git a/Source/WebCore/css/CSSFunctionValue.cpp b/Source/WebCore/css/CSSFunctionValue.cpp
index 628a989ba..9f8f24f30 100644
--- a/Source/WebCore/css/CSSFunctionValue.cpp
+++ b/Source/WebCore/css/CSSFunctionValue.cpp
@@ -53,7 +53,7 @@ String CSSFunctionValue::customCssText() const
void CSSFunctionValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_name);
+ info.addInstrumentedMember(m_name);
info.addInstrumentedMember(m_args);
}
diff --git a/Source/WebCore/css/CSSImageSetValue.cpp b/Source/WebCore/css/CSSImageSetValue.cpp
index c3163f55c..28451a254 100644
--- a/Source/WebCore/css/CSSImageSetValue.cpp
+++ b/Source/WebCore/css/CSSImageSetValue.cpp
@@ -174,7 +174,7 @@ void CSSImageSetValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjec
void CSSImageSetValue::ImageWithScale::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(imageURL);
+ info.addInstrumentedMember(imageURL);
}
} // namespace WebCore
diff --git a/Source/WebCore/css/CSSImageValue.cpp b/Source/WebCore/css/CSSImageValue.cpp
index 542192d5d..b7f4d73cd 100644
--- a/Source/WebCore/css/CSSImageValue.cpp
+++ b/Source/WebCore/css/CSSImageValue.cpp
@@ -129,7 +129,7 @@ PassRefPtr<CSSValue> CSSImageValue::cloneForCSSOM() const
void CSSImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_url);
+ info.addInstrumentedMember(m_url);
// No need to report m_image as it is counted as part of RenderArena.
}
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index 4a2e38bb9..ec0f1c204 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -62,6 +62,7 @@
#include "FontValue.h"
#include "HTMLParserIdioms.h"
#include "HashTools.h"
+#include "HistogramSupport.h"
#include "MediaList.h"
#include "MediaQueryExp.h"
#include "Page.h"
@@ -5335,7 +5336,7 @@ static inline bool parseAlphaValue(const UChar*& string, const UChar* end, const
if (length < 2)
return false;
- if (string[length - 1] != terminator)
+ if (string[length - 1] != terminator || !isASCIIDigit(string[length - 2]))
return false;
if (string[0] != '0' && string[0] != '1' && string[0] != '.') {
@@ -10124,7 +10125,16 @@ static CSSPropertyID cssPropertyID(const UChar* propertyName, unsigned length)
}
const Property* hashTableEntry = findProperty(name, length);
- return hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid;
+ const CSSPropertyID propertyID = hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid;
+
+ // 600 is comfortably larger than numCSSProperties to allow for growth
+ static const int CSSPropertyHistogramSize = 600;
+ COMPILE_ASSERT(CSSPropertyHistogramSize > numCSSProperties, number_of_css_properties_exceed_CSSPropertyHistogramSize);
+
+ if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid)
+ HistogramSupport::histogramEnumeration("CSS.PrefixUsage", max(1, propertyID - firstCSSProperty), CSSPropertyHistogramSize);
+
+ return propertyID;
}
CSSPropertyID cssPropertyID(const String& string)
diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp
index bbd6700d3..7d1ca2974 100644
--- a/Source/WebCore/css/CSSPrimitiveValue.cpp
+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -1001,32 +1001,32 @@ String CSSPrimitiveValue::customCssText() const
}
case CSS_RGBCOLOR:
case CSS_PARSER_HEXCOLOR: {
- DEFINE_STATIC_LOCAL(const String, commaSpace, (", "));
- DEFINE_STATIC_LOCAL(const String, rgbParen, ("rgb("));
- DEFINE_STATIC_LOCAL(const String, rgbaParen, ("rgba("));
-
RGBA32 rgbColor = m_value.rgbcolor;
if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR)
Color::parseHexColor(m_value.string, rgbColor);
Color color(rgbColor);
- Vector<UChar> result;
+ Vector<LChar> result;
result.reserveInitialCapacity(32);
- if (color.hasAlpha())
- append(result, rgbaParen);
+ bool colorHasAlpha = color.hasAlpha();
+ if (colorHasAlpha)
+ result.append("rgba(", 5);
else
- append(result, rgbParen);
+ result.append("rgb(", 4);
appendNumber(result, static_cast<unsigned char>(color.red()));
- append(result, commaSpace);
+ result.append(", ", 2);
appendNumber(result, static_cast<unsigned char>(color.green()));
- append(result, commaSpace);
+ result.append(", ", 2);
appendNumber(result, static_cast<unsigned char>(color.blue()));
- if (color.hasAlpha()) {
- append(result, commaSpace);
- append(result, String::number(color.alpha() / 255.0f));
+ if (colorHasAlpha) {
+ result.append(", ", 2);
+
+ NumberToStringBuffer buffer;
+ const char* alphaString = numberToFixedPrecisionString(color.alpha() / 255.0f, 6, buffer, true);
+ result.append(alphaString, strlen(alphaString));
}
result.append(')');
@@ -1252,7 +1252,7 @@ void CSSPrimitiveValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObje
case CSS_VARIABLE_NAME:
#endif
// FIXME: detect other cases when m_value is StringImpl*
- info.addMember(m_value.string);
+ info.addInstrumentedMember(m_value.string);
break;
case CSS_COUNTER:
info.addMember(m_value.counter);
diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp
index f16f8bbb3..ec0ebe6fa 100644
--- a/Source/WebCore/css/CSSStyleSheet.cpp
+++ b/Source/WebCore/css/CSSStyleSheet.cpp
@@ -181,7 +181,7 @@ void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
info.addInstrumentedMember(m_contents);
- info.addMember(m_title);
+ info.addInstrumentedMember(m_title);
info.addInstrumentedMember(m_mediaQueries);
info.addInstrumentedMember(m_ownerNode);
info.addInstrumentedMember(m_ownerRule);
diff --git a/Source/WebCore/css/CSSValue.cpp b/Source/WebCore/css/CSSValue.cpp
index da1ac3314..ee0a18cf5 100644
--- a/Source/WebCore/css/CSSValue.cpp
+++ b/Source/WebCore/css/CSSValue.cpp
@@ -82,7 +82,7 @@ public:
void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_cssText);
+ info.addInstrumentedMember(m_cssText);
}
private:
diff --git a/Source/WebCore/css/CSSVariableValue.h b/Source/WebCore/css/CSSVariableValue.h
index e0b97d3ff..3020e1e1b 100644
--- a/Source/WebCore/css/CSSVariableValue.h
+++ b/Source/WebCore/css/CSSVariableValue.h
@@ -51,8 +51,8 @@ public:
void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_name);
- info.addMember(m_value);
+ info.addInstrumentedMember(m_name);
+ info.addInstrumentedMember(m_value);
}
private:
diff --git a/Source/WebCore/css/FontFeatureValue.cpp b/Source/WebCore/css/FontFeatureValue.cpp
index 491b192e6..413eaa4a2 100644
--- a/Source/WebCore/css/FontFeatureValue.cpp
+++ b/Source/WebCore/css/FontFeatureValue.cpp
@@ -53,7 +53,7 @@ String FontFeatureValue::customCssText() const
void FontFeatureValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_tag);
+ info.addInstrumentedMember(m_tag);
}
}
diff --git a/Source/WebCore/css/MediaQuery.cpp b/Source/WebCore/css/MediaQuery.cpp
index 1aabd69d4..44c32c142 100644
--- a/Source/WebCore/css/MediaQuery.cpp
+++ b/Source/WebCore/css/MediaQuery.cpp
@@ -137,9 +137,9 @@ String MediaQuery::cssText() const
void MediaQuery::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_mediaType);
+ info.addInstrumentedMember(m_mediaType);
info.addInstrumentedVectorPtr(m_expressions);
- info.addMember(m_serializationCache);
+ info.addInstrumentedMember(m_serializationCache);
}
} //namespace
diff --git a/Source/WebCore/css/MediaQueryExp.cpp b/Source/WebCore/css/MediaQueryExp.cpp
index 3c778956c..4b91997d7 100644
--- a/Source/WebCore/css/MediaQueryExp.cpp
+++ b/Source/WebCore/css/MediaQueryExp.cpp
@@ -112,8 +112,8 @@ String MediaQueryExp::serialize() const
void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_mediaFeature);
- info.addMember(m_serializationCache);
+ info.addInstrumentedMember(m_mediaFeature);
+ info.addInstrumentedMember(m_serializationCache);
info.addInstrumentedMember(m_value);
}
diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
index dee9ad345..5fc2d3803 100644
--- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
@@ -31,6 +31,7 @@
#include "MutationRecord.h"
#include "StylePropertySet.h"
#include "StyledElement.h"
+#include "UndoManager.h"
using namespace std;
@@ -53,15 +54,38 @@ public:
ASSERT(!s_currentDecl);
s_currentDecl = decl;
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
if (!s_currentDecl->parentElement())
return;
+
+ bool shouldReadOldValue = false;
+
+#if ENABLE(MUTATION_OBSERVERS)
m_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(s_currentDecl->parentElement(), HTMLNames::styleAttr);
- if (!m_mutationRecipients)
- return;
+ if (m_mutationRecipients && m_mutationRecipients->isOldValueRequested())
+ shouldReadOldValue = true;
+#endif
+#if ENABLE(UNDO_MANAGER)
+ m_isRecordingAutomaticTransaction = UndoManager::isRecordingAutomaticTransaction(s_currentDecl->parentElement());
+ if (m_isRecordingAutomaticTransaction)
+ shouldReadOldValue = true;
+#endif
+
+ AtomicString oldValue;
+ if (shouldReadOldValue)
+ oldValue = s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr);
+
+#if ENABLE(MUTATION_OBSERVERS)
+ if (m_mutationRecipients) {
+ AtomicString requestedOldValue = m_mutationRecipients->isOldValueRequested() ? oldValue : nullAtom;
+ m_mutation = MutationRecord::createAttributes(s_currentDecl->parentElement(), HTMLNames::styleAttr, requestedOldValue);
+ }
+#endif
+#if ENABLE(UNDO_MANAGER)
+ if (m_isRecordingAutomaticTransaction)
+ m_oldValue = oldValue;
+#endif
- AtomicString oldValue = m_mutationRecipients->isOldValueRequested() ? s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr) : nullAtom;
- m_mutation = MutationRecord::createAttributes(s_currentDecl->parentElement(), HTMLNames::styleAttr, oldValue);
#endif
}
@@ -74,6 +98,14 @@ public:
#if ENABLE(MUTATION_OBSERVERS)
if (m_mutation && s_shouldDeliver)
m_mutationRecipients->enqueueMutationRecord(m_mutation);
+#endif
+#if ENABLE(UNDO_MANAGER)
+ if (m_isRecordingAutomaticTransaction && s_shouldDeliver) {
+ UndoManager::addTransactionStep(AttrChangingDOMTransactionStep::create(
+ s_currentDecl->parentElement(), HTMLNames::styleAttr, m_oldValue, s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr)));
+ }
+#endif
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
s_shouldDeliver = false;
#endif
if (!s_shouldNotifyInspector) {
@@ -88,7 +120,7 @@ public:
InspectorInstrumentation::didInvalidateStyleAttr(localCopyStyleDecl->parentElement()->document(), localCopyStyleDecl->parentElement());
}
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
void enqueueMutationRecord()
{
s_shouldDeliver = true;
@@ -104,18 +136,24 @@ private:
static unsigned s_scopeCount;
static PropertySetCSSStyleDeclaration* s_currentDecl;
static bool s_shouldNotifyInspector;
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
static bool s_shouldDeliver;
+#endif
+#if ENABLE(MUTATION_OBSERVERS)
OwnPtr<MutationObserverInterestGroup> m_mutationRecipients;
RefPtr<MutationRecord> m_mutation;
#endif
+#if ENABLE(UNDO_MANAGER)
+ bool m_isRecordingAutomaticTransaction;
+ AtomicString m_oldValue;
+#endif
};
unsigned StyleAttributeMutationScope::s_scopeCount = 0;
PropertySetCSSStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0;
bool StyleAttributeMutationScope::s_shouldNotifyInspector = false;
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
bool StyleAttributeMutationScope::s_shouldDeliver = false;
#endif
@@ -158,7 +196,7 @@ String PropertySetCSSStyleDeclaration::cssText() const
void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec)
{
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
StyleAttributeMutationScope mutationScope(this);
#endif
willMutate();
@@ -169,7 +207,7 @@ void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCod
didMutate(PropertyChanged);
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
mutationScope.enqueueMutationRecord();
#endif
}
@@ -219,7 +257,7 @@ bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyNa
void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
{
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
StyleAttributeMutationScope mutationScope(this);
#endif
CSSPropertyID propertyID = cssPropertyID(propertyName);
@@ -238,7 +276,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con
if (changed) {
// CSS DOM requires raising SYNTAX_ERR of parsing failed, but this is too dangerous for compatibility,
// see <http://bugs.webkit.org/show_bug.cgi?id=7296>.
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
mutationScope.enqueueMutationRecord();
#endif
}
@@ -246,7 +284,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con
String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec)
{
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
StyleAttributeMutationScope mutationScope(this);
#endif
CSSPropertyID propertyID = cssPropertyID(propertyName);
@@ -262,7 +300,7 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName
didMutate(changed ? PropertyChanged : NoChanges);
if (changed) {
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
mutationScope.enqueueMutationRecord();
#endif
}
@@ -281,7 +319,7 @@ String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID pr
void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec)
{
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
StyleAttributeMutationScope mutationScope(this);
#endif
willMutate();
@@ -292,7 +330,7 @@ void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI
didMutate(changed ? PropertyChanged : NoChanges);
if (changed) {
-#if ENABLE(MUTATION_OBSERVERS)
+#if ENABLE(MUTATION_OBSERVERS) || ENABLE(UNDO_MANAGER)
mutationScope.enqueueMutationRecord();
#endif
}
diff --git a/Source/WebCore/css/StyleRuleImport.cpp b/Source/WebCore/css/StyleRuleImport.cpp
index 24942521d..382313e67 100644
--- a/Source/WebCore/css/StyleRuleImport.cpp
+++ b/Source/WebCore/css/StyleRuleImport.cpp
@@ -134,7 +134,7 @@ void StyleRuleImport::requestStyleSheet()
void StyleRuleImport::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_strHref);
+ info.addInstrumentedMember(m_strHref);
info.addInstrumentedMember(m_mediaQueries);
info.addInstrumentedMember(m_styleSheet);
}
diff --git a/Source/WebCore/css/StyleSheetContents.cpp b/Source/WebCore/css/StyleSheetContents.cpp
index 96b4e54fa..cc3cec52a 100644
--- a/Source/WebCore/css/StyleSheetContents.cpp
+++ b/Source/WebCore/css/StyleSheetContents.cpp
@@ -486,8 +486,8 @@ void StyleSheetContents::removedFromMemoryCache()
void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_originalURL);
- info.addMember(m_encodingFromCharsetRule);
+ info.addInstrumentedMember(m_originalURL);
+ info.addInstrumentedMember(m_encodingFromCharsetRule);
info.addVector(m_importRules);
info.addInstrumentedVector(m_childRules);
info.addHashMap(m_namespaces);
diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp
index 5c093022c..80069326f 100644
--- a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp
+++ b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp
@@ -90,7 +90,7 @@ void StyleKeyframe::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
info.addInstrumentedMember(m_properties);
- info.addMember(m_key);
+ info.addInstrumentedMember(m_key);
}
WebKitCSSKeyframeRule::WebKitCSSKeyframeRule(StyleKeyframe* keyframe, WebKitCSSKeyframesRule* parent)
diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
index 383068da6..ca47f79bd 100644
--- a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
+++ b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
@@ -91,7 +91,7 @@ void StyleRuleKeyframes::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObj
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
info.addInstrumentedVector(m_keyframes);
- info.addMember(m_name);
+ info.addInstrumentedMember(m_name);
}
WebKitCSSKeyframesRule::WebKitCSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSheet* parent)
diff --git a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
index 3e16bbd32..d2fbdf18c 100644
--- a/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
+++ b/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
@@ -67,7 +67,7 @@ String WebKitCSSSVGDocumentValue::customCssText() const
void WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_url);
+ info.addInstrumentedMember(m_url);
// FIXME: add m_document when cached resources are instrumented.
}
diff --git a/Source/WebCore/css/WebKitCSSShaderValue.cpp b/Source/WebCore/css/WebKitCSSShaderValue.cpp
index 482a36089..b89b1834e 100644
--- a/Source/WebCore/css/WebKitCSSShaderValue.cpp
+++ b/Source/WebCore/css/WebKitCSSShaderValue.cpp
@@ -83,7 +83,7 @@ String WebKitCSSShaderValue::customCssText() const
void WebKitCSSShaderValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_url);
+ info.addInstrumentedMember(m_url);
}
} // namespace WebCore
diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css
index d60ca0ed5..c213d38d6 100644
--- a/Source/WebCore/css/html.css
+++ b/Source/WebCore/css/html.css
@@ -530,6 +530,17 @@ input::-webkit-datetime-edit-second-field {
padding: 0.15em;
}
+/* Remove focus ring from fields and use highlight color */
+input::-webkit-datetime-edit-ampm-field:focus,
+input::-webkit-datetime-edit-hour-field:focus,
+input::-webkit-datetime-edit-millisecond-fiel:focus,
+input::-webkit-datetime-edit-minute-field:focus,
+input::-webkit-datetime-edit-second-field:focus {
+ background-color: highlight;
+ color: highlighttext;
+ outline: none;
+}
+
/* This selector is used when step >= 60 second but format contains second field. */
input::-webkit-datetime-edit-second-field[readonly] {
color: GrayText;
diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h
index 7174bbaad..81a0bbda7 100644
--- a/Source/WebCore/dom/Attribute.h
+++ b/Source/WebCore/dom/Attribute.h
@@ -71,7 +71,7 @@ public:
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
info.addInstrumentedMember(m_name);
- info.addMember(m_value);
+ info.addInstrumentedMember(m_value);
}
private:
diff --git a/Source/WebCore/dom/CharacterData.cpp b/Source/WebCore/dom/CharacterData.cpp
index 91f5ac70f..b613ab97c 100644
--- a/Source/WebCore/dom/CharacterData.cpp
+++ b/Source/WebCore/dom/CharacterData.cpp
@@ -33,6 +33,7 @@
#include "NodeRenderingContext.h"
#include "RenderText.h"
#include "TextBreakIterator.h"
+#include "UndoManager.h"
using namespace std;
@@ -96,7 +97,7 @@ void CharacterData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
Node::reportMemoryUsage(memoryObjectInfo);
- info.addMember(m_data);
+ info.addInstrumentedMember(m_data);
}
void CharacterData::appendData(const String& data, ExceptionCode&)
@@ -183,6 +184,13 @@ void CharacterData::setNodeValue(const String& nodeValue, ExceptionCode& ec)
void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength)
{
+#if ENABLE(UNDO_MANAGER)
+ if (UndoManager::isRecordingAutomaticTransaction(this)) {
+ const String& replacingData = newData.substring(offsetOfReplacedData, newLength);
+ const String& replacedData = m_data.substring(offsetOfReplacedData, oldLength);
+ UndoManager::addTransactionStep(DataReplacingDOMTransactionStep::create(this, offsetOfReplacedData, oldLength, replacingData, replacedData));
+ }
+#endif
String oldData = m_data;
m_data = newData;
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp
index add53ce9a..adafeb617 100644
--- a/Source/WebCore/dom/ContainerNode.cpp
+++ b/Source/WebCore/dom/ContainerNode.cpp
@@ -40,6 +40,7 @@
#include "RenderBox.h"
#include "RenderTheme.h"
#include "RootInlineBox.h"
+#include "UndoManager.h"
#include <wtf/CurrentTime.h>
#include <wtf/Vector.h>
@@ -327,6 +328,10 @@ static void willRemoveChild(Node* child)
ChildListMutationScope(child->parentNode()).willRemoveChild(child);
child->notifyMutationObserversNodeWillDetach();
#endif
+#if ENABLE(UNDO_MANAGER)
+ if (UndoManager::isRecordingAutomaticTransaction(child->parentNode()))
+ UndoManager::addTransactionStep(NodeRemovingDOMTransactionStep::create(child->parentNode(), child));
+#endif
dispatchChildRemovalEvents(child);
child->document()->nodeWillBeRemoved(child); // e.g. mutation event listener can create a new range.
@@ -351,6 +356,10 @@ static void willRemoveChildren(ContainerNode* container)
mutation.willRemoveChild(child);
child->notifyMutationObserversNodeWillDetach();
#endif
+#if ENABLE(UNDO_MANAGER)
+ if (UndoManager::isRecordingAutomaticTransaction(container))
+ UndoManager::addTransactionStep(NodeRemovingDOMTransactionStep::create(container, child));
+#endif
// fire removed from document mutation events.
dispatchChildRemovalEvents(child);
@@ -979,6 +988,11 @@ static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, bool sh
ChildListMutationScope(parent).childAdded(child);
#endif
+#if ENABLE(UNDO_MANAGER)
+ if (UndoManager::isRecordingAutomaticTransaction(parent))
+ UndoManager::addTransactionStep(NodeInsertingDOMTransactionStep::create(parent, child));
+#endif
+
parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);
ChildNodeInsertionNotifier(parent).notify(child);
diff --git a/Source/WebCore/dom/ContainerNode.h b/Source/WebCore/dom/ContainerNode.h
index c19ae0bec..8b924773e 100644
--- a/Source/WebCore/dom/ContainerNode.h
+++ b/Source/WebCore/dom/ContainerNode.h
@@ -92,7 +92,6 @@ public:
void attachChildren();
void attachChildrenIfNeeded();
void attachChildrenLazily();
- void detachAsNode();
void detachChildren();
void detachChildrenIfNeeded();
@@ -188,11 +187,6 @@ inline void ContainerNode::attachChildrenLazily()
child->lazyAttach();
}
-inline void ContainerNode::detachAsNode()
-{
- Node::detach();
-}
-
inline void ContainerNode::detachChildrenIfNeeded()
{
for (Node* child = firstChild(); child; child = child->nextSibling()) {
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index b0f387a25..b495e22f7 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -6109,14 +6109,14 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addInstrumentedMember(m_styleResolver);
ContainerNode::reportMemoryUsage(memoryObjectInfo);
info.addVector(m_customFonts);
- info.addMember(m_url);
- info.addMember(m_baseURL);
- info.addMember(m_baseURLOverride);
- info.addMember(m_baseElementURL);
- info.addMember(m_cookieURL);
- info.addMember(m_firstPartyForCookies);
- info.addMember(m_documentURI);
- info.addMember(m_baseTarget);
+ info.addInstrumentedMember(m_url);
+ info.addInstrumentedMember(m_baseURL);
+ info.addInstrumentedMember(m_baseURLOverride);
+ info.addInstrumentedMember(m_baseElementURL);
+ info.addInstrumentedMember(m_cookieURL);
+ info.addInstrumentedMember(m_firstPartyForCookies);
+ info.addInstrumentedMember(m_documentURI);
+ info.addInstrumentedMember(m_baseTarget);
info.addInstrumentedMember(m_frame);
info.addInstrumentedMember(m_cachedResourceLoader);
info.addInstrumentedMember(m_elemSheet);
@@ -6128,13 +6128,13 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addHashSet(m_nodeIterators);
info.addHashSet(m_ranges);
info.addListHashSet(m_styleSheetCandidateNodes);
- info.addMember(m_preferredStylesheetSet);
- info.addMember(m_selectedStylesheetSet);
- info.addMember(m_title.string());
- info.addMember(m_rawTitle.string());
- info.addMember(m_xmlEncoding);
- info.addMember(m_xmlVersion);
- info.addMember(m_contentLanguage);
+ info.addInstrumentedMember(m_preferredStylesheetSet);
+ info.addInstrumentedMember(m_selectedStylesheetSet);
+ info.addInstrumentedMember(m_title.string());
+ info.addInstrumentedMember(m_rawTitle.string());
+ info.addInstrumentedMember(m_xmlEncoding);
+ info.addInstrumentedMember(m_xmlVersion);
+ info.addInstrumentedMember(m_contentLanguage);
info.addHashMap(m_documentNamedItemCollections);
info.addHashMap(m_windowNamedItemCollections);
#if ENABLE(DASHBOARD_SUPPORT)
@@ -6155,7 +6155,7 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
PassRefPtr<UndoManager> Document::undoManager()
{
if (!m_undoManager)
- m_undoManager = UndoManager::create(this, this);
+ m_undoManager = UndoManager::create(this);
return m_undoManager;
}
#endif
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 53d6a2982..743e12278 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -70,6 +70,7 @@
#include "StyleResolver.h"
#include "Text.h"
#include "TextIterator.h"
+#include "UndoManager.h"
#include "VoidCallback.h"
#include "WebKitAnimationList.h"
#include "XMLNSNames.h"
@@ -146,13 +147,6 @@ Element::~Element()
ASSERT(m_attributeData);
m_attributeData->detachAttrObjectsFromElement(this);
}
-
-#if ENABLE(UNDO_MANAGER)
- if (hasRareData() && elementRareData()->m_undoManager) {
- elementRareData()->m_undoManager->disconnect();
- elementRareData()->m_undoManager.clear();
- }
-#endif
}
inline ElementRareData* Element::elementRareData() const
@@ -1005,9 +999,8 @@ void Element::detach()
if (ElementShadow* shadow = this->shadow()) {
detachChildrenIfNeeded();
shadow->detach();
- detachAsNode();
- } else
- ContainerNode::detach();
+ }
+ ContainerNode::detach();
RenderWidget::resumeWidgetHierarchyUpdates();
}
@@ -2055,6 +2048,11 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
#endif
+#if ENABLE(UNDO_MANAGER)
+ if (UndoManager::isRecordingAutomaticTransaction(this))
+ UndoManager::addTransactionStep(AttrChangingDOMTransactionStep::create(this, name, oldValue, newValue));
+#endif
+
#if ENABLE(INSPECTOR)
InspectorInstrumentation::willModifyDOMAttr(document(), this, oldValue, newValue);
#endif
@@ -2222,61 +2220,4 @@ void Element::createMutableAttributeData()
m_attributeData = m_attributeData->makeMutable();
}
-#if ENABLE(UNDO_MANAGER)
-bool Element::undoScope() const
-{
- return hasRareData() && elementRareData()->m_undoScope;
-}
-
-void Element::setUndoScope(bool undoScope)
-{
- ElementRareData* data = ensureElementRareData();
- data->m_undoScope = undoScope;
- if (!undoScope)
- disconnectUndoManager();
-}
-
-PassRefPtr<UndoManager> Element::undoManager()
-{
- if (!undoScope() || (isContentEditable() && !isRootEditableElement())) {
- disconnectUndoManager();
- return 0;
- }
- ElementRareData* data = ensureElementRareData();
- if (!data->m_undoManager)
- data->m_undoManager = UndoManager::create(document(), this);
- return data->m_undoManager;
-}
-
-void Element::disconnectUndoManager()
-{
- if (!hasRareData())
- return;
- ElementRareData* data = elementRareData();
- UndoManager* undoManager = data->m_undoManager.get();
- if (!undoManager)
- return;
- undoManager->disconnect();
- data->m_undoManager.clear();
-}
-
-void Element::disconnectUndoManagersInSubtree()
-{
- Node* node = firstChild();
- while (node) {
- if (node->isElementNode()) {
- Element* element = toElement(node);
- if (element->hasRareData() && element->elementRareData()->m_undoManager) {
- if (!node->isContentEditable()) {
- node = node->traverseNextSibling(this);
- continue;
- }
- element->disconnectUndoManager();
- }
- }
- node = node->traverseNextNode(this);
- }
-}
-#endif
-
} // namespace WebCore
diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h
index d9385486f..97a16f636 100644
--- a/Source/WebCore/dom/Element.h
+++ b/Source/WebCore/dom/Element.h
@@ -440,14 +440,6 @@ public:
info.addInstrumentedMember(m_attributeData);
}
-#if ENABLE(UNDO_MANAGER)
- bool undoScope() const;
- void setUndoScope(bool);
- PassRefPtr<UndoManager> undoManager();
- void disconnectUndoManager();
- void disconnectUndoManagersInSubtree();
-#endif
-
protected:
Element(const QualifiedName& tagName, Document* document, ConstructionType type)
: ContainerNode(document, type)
diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl
index 3bdd03bef..fb60c7315 100644
--- a/Source/WebCore/dom/Element.idl
+++ b/Source/WebCore/dom/Element.idl
@@ -145,11 +145,6 @@ module core {
// CSS Regions API
readonly attribute DOMString webkitRegionOverset;
-#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- readonly attribute [Conditional=UNDO_MANAGER] UndoManager undoManager;
- attribute [Conditional=UNDO_MANAGER, Reflect] boolean undoScope;
-#endif
-
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
// Event handler DOM attributes
attribute [NotEnumerable] EventListener onabort;
diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp
index b743c5e3b..7d89c8848 100644
--- a/Source/WebCore/dom/ElementAttributeData.cpp
+++ b/Source/WebCore/dom/ElementAttributeData.cpp
@@ -33,9 +33,14 @@
namespace WebCore {
+static size_t immutableElementAttributeDataSize(unsigned count)
+{
+ return sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * count;
+}
+
PassOwnPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes)
{
- void* slot = WTF::fastMalloc(sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * attributes.size());
+ void* slot = WTF::fastMalloc(immutableElementAttributeDataSize(attributes.size()));
return adoptPtr(new (slot) ElementAttributeData(attributes));
}
@@ -286,15 +291,14 @@ void ElementAttributeData::detachAttrObjectsFromElement(Element* element) const
void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
- MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+ size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : immutableElementAttributeDataSize(m_arraySize);
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM, actualSize);
info.addInstrumentedMember(m_inlineStyleDecl);
info.addInstrumentedMember(m_attributeStyle);
info.addMember(m_classNames);
- info.addMember(m_idForStyleResolution);
+ info.addInstrumentedMember(m_idForStyleResolution);
if (m_isMutable)
info.addVectorPtr(m_mutableAttributeVector);
- else
- info.addRawBuffer(m_attributes, m_arraySize * sizeof(Attribute));
for (unsigned i = 0, len = length(); i < len; i++)
info.addInstrumentedMember(*attributeItem(i));
}
diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h
index 666cc4607..07394ebd1 100644
--- a/Source/WebCore/dom/ElementRareData.h
+++ b/Source/WebCore/dom/ElementRareData.h
@@ -29,7 +29,6 @@
#include "HTMLCollection.h"
#include "NamedNodeMap.h"
#include "NodeRareData.h"
-#include "UndoManager.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
@@ -119,11 +118,6 @@ public:
#if ENABLE(FULLSCREEN_API)
bool m_containsFullScreenElement;
#endif
-
-#if ENABLE(UNDO_MANAGER)
- RefPtr<UndoManager> m_undoManager;
- bool m_undoScope;
-#endif
};
inline IntSize defaultMinimumSizeForResizing()
diff --git a/Source/WebCore/dom/ElementShadow.cpp b/Source/WebCore/dom/ElementShadow.cpp
index a68ef3575..017be4b58 100644
--- a/Source/WebCore/dom/ElementShadow.cpp
+++ b/Source/WebCore/dom/ElementShadow.cpp
@@ -206,7 +206,7 @@ void ElementShadow::invalidateDistribution(Element* host)
if (needsReattach && host->attached()) {
host->detach();
- host->lazyAttach(Node::DoNotSetAttached);
+ host->lazyAttach();
}
if (needsInvalidation)
diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp
index 08e644ff6..f19cbdda7 100644
--- a/Source/WebCore/dom/Event.cpp
+++ b/Source/WebCore/dom/Event.cpp
@@ -158,12 +158,17 @@ void Event::storeResult(const String&)
void Event::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
- info.addMember(m_type);
+ info.addInstrumentedMember(m_type);
info.addMember(m_currentTarget);
info.addMember(m_target);
info.addInstrumentedMember(m_underlyingEvent);
}
+PassRefPtr<Event> Event::cloneFor(HTMLIFrameElement*) const
+{
+ return Event::create(type(), bubbles(), cancelable());
+}
+
void Event::setTarget(PassRefPtr<EventTarget> target)
{
if (m_target == target)
diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h
index e72342315..5c7d7c753 100644
--- a/Source/WebCore/dom/Event.h
+++ b/Source/WebCore/dom/Event.h
@@ -31,9 +31,10 @@
namespace WebCore {
- class MemoryInstrumentation;
class EventTarget;
class EventDispatcher;
+ class HTMLIFrameElement;
+ class MemoryInstrumentation;
struct EventInit {
EventInit();
@@ -155,6 +156,8 @@ namespace WebCore {
virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+ virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const;
+
protected:
Event();
Event(const AtomicString& type, bool canBubble, bool cancelable);
diff --git a/Source/WebCore/dom/MemoryInstrumentation.cpp b/Source/WebCore/dom/MemoryInstrumentation.cpp
index a9fefcaca..f924c876d 100644
--- a/Source/WebCore/dom/MemoryInstrumentation.cpp
+++ b/Source/WebCore/dom/MemoryInstrumentation.cpp
@@ -37,30 +37,36 @@
namespace WebCore {
-void MemoryInstrumentation::addObject(const String& string, ObjectType objectType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const String* const& string, ObjectType objectType, OwningType owningType)
{
- addObject(string.impl(), objectType);
+ if (!string || visited(string))
+ return;
+ if (owningType == byPointer)
+ countObjectSize(objectType, sizeof(String));
+ addInstrumentedObjectImpl(string->impl(), objectType, byPointer);
}
-void MemoryInstrumentation::addObject(const StringImpl* stringImpl, ObjectType objectType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const StringImpl* const& stringImpl, ObjectType objectType, OwningType)
{
if (!stringImpl || visited(stringImpl))
return;
countObjectSize(objectType, stringImpl->sizeInBytes());
}
-void MemoryInstrumentation::addObject(const KURL& url, ObjectType objectType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const KURL* const& url, ObjectType objectType, OwningType owningType)
{
- if (visited(&url))
+ if (!url || visited(url))
return;
- addObject(url.string(), objectType);
- if (url.innerURL())
- addObject(url.innerURL(), objectType);
+ if (owningType == byPointer)
+ countObjectSize(objectType, sizeof(KURL));
+ addInstrumentedObject(url->string(), objectType);
+ if (url->innerURL())
+ addInstrumentedObject(url->innerURL(), objectType);
}
-void MemoryInstrumentation::addInstrumentedObjectImpl(const AtomicString* const& string, ObjectType objectType, OwningType)
+void MemoryInstrumentation::addInstrumentedObjectImpl(const AtomicString* const& atomicString, ObjectType objectType, OwningType owningType)
{
- addObject(static_cast<const String&>(*string), objectType);
+ addInstrumentedObjectImpl(reinterpret_cast<const String* const>(atomicString), objectType, owningType);
}
} // namespace WebCore
diff --git a/Source/WebCore/dom/MemoryInstrumentation.h b/Source/WebCore/dom/MemoryInstrumentation.h
index c0c2d375a..35cb6cb7a 100644
--- a/Source/WebCore/dom/MemoryInstrumentation.h
+++ b/Source/WebCore/dom/MemoryInstrumentation.h
@@ -102,9 +102,7 @@ private:
{
OwningTraits<T>::addObject(this, t, ownerObjectType);
}
- void addObject(const String&, ObjectType);
- void addObject(const StringImpl*, ObjectType);
- void addObject(const KURL&, ObjectType);
+
template <typename T> void addInstrumentedObject(const T& t, ObjectType ownerObjectType) { OwningTraits<T>::addInstrumentedObject(this, t, ownerObjectType); }
template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false);
@@ -137,10 +135,10 @@ private:
static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, ObjectType ownerObjectType) { instrumentation->addObjectImpl(t, ownerObjectType, byPointer); }
};
- // FIXME: get rid of addObject(String)
- void addInstrumentedObjectImpl(const String* const& string, ObjectType objectType, OwningType) { addObject(*string, objectType); }
- void addInstrumentedObjectImpl(const StringImpl* const& string, ObjectType objectType, OwningType) { addObject(string, objectType); }
+ void addInstrumentedObjectImpl(const String* const&, ObjectType, OwningType);
+ void addInstrumentedObjectImpl(const StringImpl* const&, ObjectType, OwningType);
void addInstrumentedObjectImpl(const AtomicString* const&, ObjectType, OwningType);
+ void addInstrumentedObjectImpl(const KURL* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const T* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
@@ -150,6 +148,12 @@ private:
template <typename T> void addObjectImpl(const DataRef<T>* const&, ObjectType, OwningType);
template <typename T> void addObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
template <typename T> void addObjectImpl(const RefPtr<T>* const&, ObjectType, OwningType);
+
+ // Link time guards for special cases.
+ void addObjectImpl(const String* const&, ObjectType, OwningType);
+ void addObjectImpl(const StringImpl* const&, ObjectType, OwningType);
+ void addObjectImpl(const AtomicString* const&, ObjectType, OwningType);
+ void addObjectImpl(const KURL* const&, ObjectType, OwningType);
};
class MemoryObjectInfo {
@@ -210,11 +214,6 @@ public:
template <typename VectorType> void addVectorPtr(const VectorType* const vector) { m_memoryInstrumentation->addVector(*vector, m_objectType, false); }
void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
- void addMember(const String& string) { m_memoryInstrumentation->addObject(string, m_objectType); }
- void addMember(const AtomicString& string) { m_memoryInstrumentation->addObject((const String&)string, m_objectType); }
- void addMember(const StringImpl* string) { m_memoryInstrumentation->addObject(string, m_objectType); }
- void addMember(const KURL& url) { m_memoryInstrumentation->addObject(url, m_objectType); }
-
private:
MemoryObjectInfo* m_memoryObjectInfo;
MemoryInstrumentation* m_memoryInstrumentation;
@@ -238,7 +237,7 @@ template <typename T>
void MemoryInstrumentation::addInstrumentedObjectImpl(const DataRef<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(DataRef<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -246,7 +245,7 @@ template <typename T>
void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(OwnPtr<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -254,7 +253,7 @@ template <typename T>
void MemoryInstrumentation::addInstrumentedObjectImpl(const RefPtr<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(RefPtr<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -262,7 +261,7 @@ template <typename T>
void MemoryInstrumentation::addObjectImpl(const DataRef<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(DataRef<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -270,7 +269,7 @@ template <typename T>
void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(RefPtr<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -278,7 +277,7 @@ template <typename T>
void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, ObjectType ownerObjectType, OwningType owningType)
{
if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(RefPtr<T>));
+ countObjectSize(ownerObjectType, sizeof(*object));
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
diff --git a/Source/WebCore/dom/MouseEvent.cpp b/Source/WebCore/dom/MouseEvent.cpp
index 9edda71ea..9e92c2713 100644
--- a/Source/WebCore/dom/MouseEvent.cpp
+++ b/Source/WebCore/dom/MouseEvent.cpp
@@ -27,6 +27,7 @@
#include "EventNames.h"
#include "Frame.h"
#include "FrameView.h"
+#include "HTMLIFrameElement.h"
#include "PlatformMouseEvent.h"
namespace WebCore {
@@ -147,6 +148,36 @@ Node* MouseEvent::fromElement() const
return target() ? target()->toNode() : 0;
}
+// FIXME: Fix positioning. e.g. We need to consider border/padding.
+// https://bugs.webkit.org/show_bug.cgi?id=93696
+inline static int adjustedClientX(int innerClientX, HTMLIFrameElement* iframe, FrameView* frameView)
+{
+ return iframe->offsetLeft() - frameView->scrollX() + innerClientX;
+}
+
+inline static int adjustedClientY(int innerClientY, HTMLIFrameElement* iframe, FrameView* frameView)
+{
+ return iframe->offsetTop() - frameView->scrollY() + innerClientY;
+}
+
+PassRefPtr<Event> MouseEvent::cloneFor(HTMLIFrameElement* iframe) const
+{
+ ASSERT(iframe);
+ RefPtr<MouseEvent> clonedMouseEvent = MouseEvent::create();
+ Frame* frame = iframe->document()->frame();
+ FrameView* frameView = frame ? frame->view() : 0;
+ clonedMouseEvent->initMouseEvent(type(), bubbles(), cancelable(),
+ iframe->document()->defaultView(),
+ detail(), screenX(), screenY(),
+ frameView ? adjustedClientX(clientX(), iframe, frameView) : 0,
+ frameView ? adjustedClientY(clientY(), iframe, frameView) : 0,
+ ctrlKey(), altKey(), shiftKey(), metaKey(),
+ button(),
+ // Nullifies relatedTarget.
+ 0);
+ return clonedMouseEvent.release();
+}
+
PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent)
{
return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent));
diff --git a/Source/WebCore/dom/MouseEvent.h b/Source/WebCore/dom/MouseEvent.h
index 0863893ce..a1c7922b9 100644
--- a/Source/WebCore/dom/MouseEvent.h
+++ b/Source/WebCore/dom/MouseEvent.h
@@ -83,6 +83,8 @@ class PlatformMouseEvent;
virtual bool isDragEvent() const;
virtual int which() const;
+ virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const OVERRIDE;
+
protected:
MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
int detail, int screenX, int screenY, int pageX, int pageY,
diff --git a/Source/WebCore/dom/QualifiedName.h b/Source/WebCore/dom/QualifiedName.h
index a62d4c2da..d1f52697f 100644
--- a/Source/WebCore/dom/QualifiedName.h
+++ b/Source/WebCore/dom/QualifiedName.h
@@ -53,10 +53,10 @@ public:
void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
- info.addMember(m_prefix);
- info.addMember(m_localName);
- info.addMember(m_namespace);
- info.addMember(m_localNameUpper);
+ info.addInstrumentedMember(m_prefix);
+ info.addInstrumentedMember(m_localName);
+ info.addInstrumentedMember(m_namespace);
+ info.addInstrumentedMember(m_localNameUpper);
}
private:
QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI)
diff --git a/Source/WebCore/dom/SecurityContext.cpp b/Source/WebCore/dom/SecurityContext.cpp
index 8002201c1..d32ab798f 100644
--- a/Source/WebCore/dom/SecurityContext.cpp
+++ b/Source/WebCore/dom/SecurityContext.cpp
@@ -112,6 +112,8 @@ SandboxFlags SecurityContext::parseSandboxPolicy(const String& policy)
flags &= ~SandboxTopNavigation;
else if (equalIgnoringCase(sandboxToken, "allow-popups"))
flags &= ~SandboxPopups;
+ else if (equalIgnoringCase(sandboxToken, "allow-pointer-lock"))
+ flags &= ~SandboxPointerLock;
start = end + 1;
}
diff --git a/Source/WebCore/editing/DOMTransactionStep.cpp b/Source/WebCore/editing/DOMTransactionStep.cpp
new file mode 100644
index 000000000..3fb83028b
--- /dev/null
+++ b/Source/WebCore/editing/DOMTransactionStep.cpp
@@ -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 GOOGLE 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 GOOGLE 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"
+
+#if ENABLE(UNDO_MANAGER)
+
+#include "DOMTransactionStep.h"
+
+#include "CharacterData.h"
+#include "ContainerNode.h"
+#include "Element.h"
+#include "ExceptionCode.h"
+#include "Node.h"
+
+namespace WebCore {
+
+NodeInsertingDOMTransactionStep::NodeInsertingDOMTransactionStep(Node* node, Node* child)
+ : m_node(node)
+ , m_refChild(child->nextSibling())
+ , m_child(child)
+{
+}
+
+PassRefPtr<NodeInsertingDOMTransactionStep> NodeInsertingDOMTransactionStep::create(Node* node, Node* child)
+{
+ return adoptRef(new NodeInsertingDOMTransactionStep(node, child));
+}
+
+void NodeInsertingDOMTransactionStep::unapply()
+{
+ if (m_child && m_child->parentNode() != m_node.get())
+ return;
+ if (m_refChild && m_refChild->parentNode() != m_node.get())
+ return;
+ if (m_refChild && m_refChild->previousSibling() != m_child.get())
+ return;
+
+ ExceptionCode ec;
+ m_node->removeChild(m_child.get(), ec);
+}
+
+void NodeInsertingDOMTransactionStep::reapply()
+{
+ if (m_child && m_child->parentNode())
+ return;
+ if (m_refChild && m_refChild->parentNode() != m_node.get())
+ return;
+
+ ExceptionCode ec;
+ m_node->insertBefore(m_child, m_refChild.get(), ec);
+}
+
+NodeRemovingDOMTransactionStep::NodeRemovingDOMTransactionStep(Node* node, Node* child)
+ : m_node(node)
+ , m_refChild(child->nextSibling())
+ , m_child(child)
+{
+}
+
+PassRefPtr<NodeRemovingDOMTransactionStep> NodeRemovingDOMTransactionStep::create(Node* node, Node* child)
+{
+ return adoptRef(new NodeRemovingDOMTransactionStep(node, child));
+}
+
+void NodeRemovingDOMTransactionStep::unapply()
+{
+ if (m_child && m_child->parentNode())
+ return;
+ if (m_refChild && m_refChild->parentNode() != m_node.get())
+ return;
+
+ ExceptionCode ec;
+ m_node->insertBefore(m_child, m_refChild.get(), ec);
+}
+
+void NodeRemovingDOMTransactionStep::reapply()
+{
+ if (m_child && m_child->parentNode() != m_node.get())
+ return;
+ if (m_refChild && m_refChild->parentNode() != m_node.get())
+ return;
+ if (m_refChild && m_refChild->previousSibling() != m_child.get())
+ return;
+
+ ExceptionCode ec;
+ m_node->removeChild(m_child.get(), ec);
+}
+
+DataReplacingDOMTransactionStep::DataReplacingDOMTransactionStep(CharacterData* node, unsigned offset, unsigned count, const String& data, const String& replacedData)
+ : m_node(node)
+ , m_offset(offset)
+ , m_count(count)
+ , m_data(data)
+ , m_replacedData(replacedData)
+{
+}
+
+PassRefPtr<DataReplacingDOMTransactionStep> DataReplacingDOMTransactionStep::create(CharacterData* node, unsigned offset, unsigned count, const String& data, const String& replacedData)
+{
+ return adoptRef(new DataReplacingDOMTransactionStep(node, offset, count, data, replacedData));
+}
+
+void DataReplacingDOMTransactionStep::unapply()
+{
+ if (m_node->length() < m_offset)
+ return;
+
+ ExceptionCode ec;
+ m_node->replaceData(m_offset, m_data.length(), m_replacedData, ec);
+}
+
+void DataReplacingDOMTransactionStep::reapply()
+{
+ if (m_node->length() < m_offset)
+ return;
+
+ ExceptionCode ec;
+ m_node->replaceData(m_offset, m_count, m_data, ec);
+}
+
+AttrChangingDOMTransactionStep::AttrChangingDOMTransactionStep(Element* element, const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
+ : m_element(element)
+ , m_name(name)
+ , m_oldValue(oldValue)
+ , m_newValue(newValue)
+{
+}
+
+PassRefPtr<AttrChangingDOMTransactionStep> AttrChangingDOMTransactionStep::create(Element* element, const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
+{
+ return adoptRef(new AttrChangingDOMTransactionStep(element, name, oldValue, newValue));
+}
+
+void AttrChangingDOMTransactionStep::unapply()
+{
+ m_element->setAttribute(m_name, m_oldValue);
+}
+
+void AttrChangingDOMTransactionStep::reapply()
+{
+ m_element->setAttribute(m_name, m_newValue);
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/editing/DOMTransactionStep.h b/Source/WebCore/editing/DOMTransactionStep.h
new file mode 100644
index 000000000..459ed5d8f
--- /dev/null
+++ b/Source/WebCore/editing/DOMTransactionStep.h
@@ -0,0 +1,114 @@
+/*
+ * 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 GOOGLE 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 GOOGLE 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 DOMTransactionStep_h
+#define DOMTransactionStep_h
+
+#if ENABLE(UNDO_MANAGER)
+
+#include "PlatformString.h"
+#include "QualifiedName.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CharacterData;
+class Element;
+class Node;
+
+class DOMTransactionStep : public RefCounted<DOMTransactionStep> {
+public:
+ virtual ~DOMTransactionStep() { }
+
+ virtual void unapply() = 0;
+ virtual void reapply() = 0;
+};
+
+class NodeInsertingDOMTransactionStep : public DOMTransactionStep {
+public:
+ static PassRefPtr<NodeInsertingDOMTransactionStep> create(Node*, Node* child);
+ virtual void unapply() OVERRIDE;
+ virtual void reapply() OVERRIDE;
+
+private:
+ NodeInsertingDOMTransactionStep(Node*, Node* child);
+
+ RefPtr<Node> m_node;
+ RefPtr<Node> m_refChild;
+ RefPtr<Node> m_child;
+};
+
+class NodeRemovingDOMTransactionStep : public DOMTransactionStep {
+public:
+ static PassRefPtr<NodeRemovingDOMTransactionStep> create(Node*, Node* child);
+ virtual void unapply() OVERRIDE;
+ virtual void reapply() OVERRIDE;
+
+private:
+ NodeRemovingDOMTransactionStep(Node*, Node* child);
+
+ RefPtr<Node> m_node;
+ RefPtr<Node> m_refChild;
+ RefPtr<Node> m_child;
+};
+
+class DataReplacingDOMTransactionStep : public DOMTransactionStep {
+public:
+ static PassRefPtr<DataReplacingDOMTransactionStep> create(CharacterData*, unsigned offset, unsigned count, const String& data, const String& replacedData);
+ virtual void unapply() OVERRIDE;
+ virtual void reapply() OVERRIDE;
+
+private:
+ DataReplacingDOMTransactionStep(CharacterData*, unsigned offset, unsigned count, const String& data, const String& replacedData);
+
+ RefPtr<CharacterData> m_node;
+ unsigned m_offset;
+ unsigned m_count;
+ String m_data;
+ String m_replacedData;
+};
+
+class AttrChangingDOMTransactionStep : public DOMTransactionStep {
+public:
+ static PassRefPtr<AttrChangingDOMTransactionStep> create(Element*, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
+ virtual void unapply() OVERRIDE;
+ virtual void reapply() OVERRIDE;
+
+private:
+ AttrChangingDOMTransactionStep(Element*, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
+
+ RefPtr<Element> m_element;
+ QualifiedName m_name;
+ AtomicString m_oldValue;
+ AtomicString m_newValue;
+};
+
+}
+
+#endif
+
+#endif
diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp
index 7ca3dbeea..87c10b31b 100644
--- a/Source/WebCore/editing/TextIterator.cpp
+++ b/Source/WebCore/editing/TextIterator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2005 Alexey Proskuryakov.
*
* Redistribution and use in source and binary forms, with or without
@@ -893,9 +893,10 @@ bool TextIterator::shouldRepresentNodeOffsetZero()
// If this node is unrendered or invisible the VisiblePosition checks below won't have much meaning.
// Additionally, if the range we are iterating over contains huge sections of unrendered content,
// we would create VisiblePositions on every call to this function without this check.
- if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE)
+ if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE
+ || (m_node->renderer()->isBlockFlow() && !toRenderBlock(m_node->renderer())->height() && !m_node->hasTagName(bodyTag)))
return false;
-
+
// The startPos.isNotNull() check is needed because the start could be before the body,
// and in that case we'll get null. We don't want to put in newlines at the start in that case.
// The currPos.isNotNull() check is needed because positions in non-HTML content
diff --git a/Source/WebCore/editing/UndoManager.cpp b/Source/WebCore/editing/UndoManager.cpp
index 49106fd08..e506424f3 100644
--- a/Source/WebCore/editing/UndoManager.cpp
+++ b/Source/WebCore/editing/UndoManager.cpp
@@ -29,25 +29,27 @@
*/
#include "config.h"
-#include "UndoManager.h"
#if ENABLE(UNDO_MANAGER)
-#include "DOMTransaction.h"
-#include "Element.h"
+#include "UndoManager.h"
+
+#include "ExceptionCode.h"
namespace WebCore {
-PassRefPtr<UndoManager> UndoManager::create(ScriptExecutionContext* context, Node* host)
+DOMTransaction* UndoManager::s_recordingDOMTransaction = 0;
+
+PassRefPtr<UndoManager> UndoManager::create(Document* document)
{
- RefPtr<UndoManager> undoManager = adoptRef(new UndoManager(context, host));
+ RefPtr<UndoManager> undoManager = adoptRef(new UndoManager(document));
undoManager->suspendIfNeeded();
return undoManager.release();
}
-UndoManager::UndoManager(ScriptExecutionContext* context, Node* host)
- : ActiveDOMObject(context, this)
- , m_undoScopeHost(host)
+UndoManager::UndoManager(Document* document)
+ : ActiveDOMObject(document, this)
+ , m_document(document)
, m_isInProgress(false)
{
}
@@ -67,7 +69,7 @@ static void clearStack(UndoManagerStack& stack)
void UndoManager::disconnect()
{
- m_undoScopeHost = 0;
+ m_document = 0;
clearStack(m_undoStack);
clearStack(m_redoStack);
}
@@ -89,7 +91,7 @@ static inline PassOwnPtr<UndoManagerEntry> createUndoManagerEntry()
void UndoManager::transact(PassRefPtr<DOMTransaction> transaction, bool merge, ExceptionCode& ec)
{
- if (m_isInProgress || !isConnected()) {
+ if (m_isInProgress || !m_document) {
ec = INVALID_ACCESS_ERR;
return;
}
@@ -101,7 +103,7 @@ void UndoManager::transact(PassRefPtr<DOMTransaction> transaction, bool merge, E
transaction->apply();
m_isInProgress = false;
- if (!m_undoScopeHost)
+ if (!m_document)
return;
if (!merge || m_undoStack.isEmpty())
m_undoStack.append(createUndoManagerEntry());
@@ -110,7 +112,7 @@ void UndoManager::transact(PassRefPtr<DOMTransaction> transaction, bool merge, E
void UndoManager::undo(ExceptionCode& ec)
{
- if (m_isInProgress || !isConnected()) {
+ if (m_isInProgress || !m_document) {
ec = INVALID_ACCESS_ERR;
return;
}
@@ -125,7 +127,7 @@ void UndoManager::undo(ExceptionCode& ec)
entry[i - 1]->unapply();
m_isInProgress = false;
- if (!m_undoScopeHost) {
+ if (!m_document) {
m_inProgressEntry.clear();
return;
}
@@ -135,7 +137,7 @@ void UndoManager::undo(ExceptionCode& ec)
void UndoManager::redo(ExceptionCode& ec)
{
- if (m_isInProgress || !isConnected()) {
+ if (m_isInProgress || !m_document) {
ec = INVALID_ACCESS_ERR;
return;
}
@@ -150,7 +152,7 @@ void UndoManager::redo(ExceptionCode& ec)
entry[i - 1]->reapply();
m_isInProgress = false;
- if (!m_undoScopeHost) {
+ if (!m_document) {
m_inProgressEntry.clear();
return;
}
@@ -182,7 +184,7 @@ void UndoManager::registerRedoStep(PassRefPtr<UndoStep> step)
void UndoManager::clearUndo(ExceptionCode& ec)
{
- if (m_isInProgress || !isConnected()) {
+ if (m_isInProgress || !m_document) {
ec = INVALID_ACCESS_ERR;
return;
}
@@ -191,26 +193,27 @@ void UndoManager::clearUndo(ExceptionCode& ec)
void UndoManager::clearRedo(ExceptionCode& ec)
{
- if (m_isInProgress || !isConnected()) {
+ if (m_isInProgress || !m_document) {
ec = INVALID_ACCESS_ERR;
return;
}
clearStack(m_redoStack);
}
-bool UndoManager::isConnected()
+bool UndoManager::isRecordingAutomaticTransaction(Node* node)
{
- if (!m_undoScopeHost)
- return false;
- if (!m_undoScopeHost->isElementNode())
- return true;
- Element* element = toElement(m_undoScopeHost);
- ASSERT(element->undoScope());
- if (element->isContentEditable() && !element->isRootEditableElement()) {
- element->disconnectUndoManager();
+ // We need to check that transaction still has its undomanager because
+ // transaction can disconnect its undomanager, which will clear the undo/redo stacks.
+ if (!s_recordingDOMTransaction || !s_recordingDOMTransaction->undoManager())
return false;
- }
- return true;
+ Document* document = s_recordingDOMTransaction->undoManager()->document();
+ return document && node->document() == document;
+}
+
+void UndoManager::addTransactionStep(PassRefPtr<DOMTransactionStep> step)
+{
+ ASSERT(s_recordingDOMTransaction);
+ s_recordingDOMTransaction->addTransactionStep(step);
}
}
diff --git a/Source/WebCore/editing/UndoManager.h b/Source/WebCore/editing/UndoManager.h
index abb9930cb..dc5d67c7d 100644
--- a/Source/WebCore/editing/UndoManager.h
+++ b/Source/WebCore/editing/UndoManager.h
@@ -34,6 +34,8 @@
#if ENABLE(UNDO_MANAGER)
#include "ActiveDOMObject.h"
+#include "DOMTransaction.h"
+#include "Document.h"
#include "ExceptionCodePlaceholder.h"
#include "UndoStep.h"
#include <wtf/OwnPtr.h>
@@ -45,15 +47,12 @@
namespace WebCore {
-class DOMTransaction;
-class Node;
-
typedef Vector<RefPtr<UndoStep> > UndoManagerEntry;
typedef Vector<OwnPtr<UndoManagerEntry> > UndoManagerStack;
class UndoManager : public RefCounted<UndoManager>, public ActiveDOMObject {
public:
- static PassRefPtr<UndoManager> create(ScriptExecutionContext*, Node* host);
+ static PassRefPtr<UndoManager> create(Document*);
void disconnect();
virtual void stop() OVERRIDE;
virtual ~UndoManager();
@@ -75,18 +74,23 @@ public:
void registerUndoStep(PassRefPtr<UndoStep>);
void registerRedoStep(PassRefPtr<UndoStep>);
- Node* undoScopeHost() const { return m_undoScopeHost; }
- Node* ownerNode() const { return m_undoScopeHost; }
+ Document* document() const { return m_document; }
+ Node* ownerNode() const { return m_document; }
+
+ static void setRecordingDOMTransaction(DOMTransaction* transaction) { s_recordingDOMTransaction = transaction; }
+ static bool isRecordingAutomaticTransaction(Node*);
+ static void addTransactionStep(PassRefPtr<DOMTransactionStep>);
private:
- explicit UndoManager(ScriptExecutionContext*, Node* host);
- bool isConnected();
+ explicit UndoManager(Document*);
- Node* m_undoScopeHost;
+ Document* m_document;
UndoManagerStack m_undoStack;
UndoManagerStack m_redoStack;
bool m_isInProgress;
OwnPtr<UndoManagerEntry> m_inProgressEntry;
+
+ static DOMTransaction* s_recordingDOMTransaction;
};
}
diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in
index 9bc1fa42b..459078f64 100644
--- a/Source/WebCore/html/HTMLAttributeNames.in
+++ b/Source/WebCore/html/HTMLAttributeNames.in
@@ -319,7 +319,6 @@ topmargin
translate
truespeed
type
-undoscope
usemap
valign
value
diff --git a/Source/WebCore/html/HTMLButtonElement.cpp b/Source/WebCore/html/HTMLButtonElement.cpp
index ecb4a21ba..cbd1f2998 100644
--- a/Source/WebCore/html/HTMLButtonElement.cpp
+++ b/Source/WebCore/html/HTMLButtonElement.cpp
@@ -63,6 +63,10 @@ RenderObject* HTMLButtonElement::createRenderer(RenderArena* arena, RenderStyle*
return new (arena) RenderButton(this);
}
+void HTMLButtonElement::willAddAuthorShadowRoot()
+{
+}
+
const AtomicString& HTMLButtonElement::formControlType() const
{
switch (m_type) {
diff --git a/Source/WebCore/html/HTMLButtonElement.h b/Source/WebCore/html/HTMLButtonElement.h
index 92ca0a3f6..74a5735bb 100644
--- a/Source/WebCore/html/HTMLButtonElement.h
+++ b/Source/WebCore/html/HTMLButtonElement.h
@@ -47,6 +47,8 @@ private:
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void willAddAuthorShadowRoot() OVERRIDE;
+
virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
virtual void defaultEventHandler(Event*);
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index b707ef234..f67abc3fd 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -235,10 +235,6 @@ void HTMLElement::parseAttribute(const Attribute& attribute)
} else if (attribute.name() == itemtypeAttr) {
setItemType(attribute.value());
#endif
-#if ENABLE(UNDO_MANAGER)
- } else if (attribute.name() == undoscopeAttr) {
- setUndoScope(!attribute.isNull());
-#endif
}
// standard events
else if (attribute.name() == onclickAttr) {
@@ -663,14 +659,8 @@ void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
setAttribute(contenteditableAttr, "plaintext-only");
else if (equalIgnoringCase(enabled, "inherit"))
removeAttribute(contenteditableAttr);
- else {
+ else
ec = SYNTAX_ERR;
- return;
- }
-#if ENABLE(UNDO_MANAGER)
- if (isContentEditable())
- disconnectUndoManagersInSubtree();
-#endif
}
bool HTMLElement::draggable() const
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py
index 0921fa9ce..f46ed355f 100755
--- a/Source/WebCore/inspector/CodeGeneratorInspector.py
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -58,7 +59,7 @@ TYPE_NAME_FIX_MAP = {
TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor",
- "Debugger.FunctionDetails", "Debugger.CallFrame",
+ "Debugger.FunctionDetails", "Debugger.CallFrame", "WebGL.TraceLog",
# This should be a temporary hack. TimelineEvent should be created via generated C++ API.
"Timeline.TimelineEvent"])
@@ -909,6 +910,12 @@ class TypeBindings:
writer.append("#endif // %s\n" % VALIDATOR_IFDEF_NAME)
validator_writer = generate_context.validator_writer
+
+ domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name)
+ domain_guard = domain_fixes.get_guard()
+ if domain_guard:
+ domain_guard.generate_open(validator_writer)
+
validator_writer.newline("void %s%s::assertCorrectValue(InspectorValue* value)\n" % (helper.full_name_prefix_for_impl, enum_name))
validator_writer.newline("{\n")
validator_writer.newline(" WTF::String s;\n")
@@ -920,8 +927,12 @@ class TypeBindings:
enum_pos = EnumConstants.add_constant(enum_item)
condition_list.append("s == \"%s\"" % enum_item)
validator_writer.newline(" ASSERT(%s);\n" % join(condition_list, " || "))
- validator_writer.newline("}\n\n\n")
+ validator_writer.newline("}\n")
+ if domain_guard:
+ domain_guard.generate_close(validator_writer)
+
+ validator_writer.newline("\n\n")
writer.newline("}; // struct ")
writer.append(enum_name)
@@ -1288,6 +1299,12 @@ class TypeBindings:
closed_field_set = (context_domain_name + "." + class_name) not in TYPES_WITH_OPEN_FIELD_LIST_SET
validator_writer = generate_context.validator_writer
+
+ domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name)
+ domain_guard = domain_fixes.get_guard()
+ if domain_guard:
+ domain_guard.generate_open(validator_writer)
+
validator_writer.newline("void %s%s::assertCorrectValue(InspectorValue* value)\n" % (helper.full_name_prefix_for_impl, class_name))
validator_writer.newline("{\n")
validator_writer.newline(" RefPtr<InspectorObject> object;\n")
@@ -1319,7 +1336,12 @@ class TypeBindings:
if closed_field_set:
validator_writer.newline(" ASSERT(foundPropertiesCount == object->size());\n")
- validator_writer.newline("}\n\n\n")
+ validator_writer.newline("}\n")
+
+ if domain_guard:
+ domain_guard.generate_close(validator_writer)
+
+ validator_writer.newline("\n\n")
if is_open_type:
cpp_writer = generate_context.cpp_writer
diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl
index 71b88b137..d144dd09a 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.idl
+++ b/Source/WebCore/inspector/InjectedScriptHost.idl
@@ -47,6 +47,7 @@ module core {
[Custom] DOMString databaseId(in DOMObject database);
[Custom] DOMString storageId(in DOMObject storage);
+ [Custom] DOMObject evaluate(in DOMString text);
};
}
diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js
index 069b7c003..56d736691 100644
--- a/Source/WebCore/inspector/InjectedScriptSource.js
+++ b/Source/WebCore/inspector/InjectedScriptSource.js
@@ -174,7 +174,7 @@ InjectedScript.prototype = {
*/
_parseObjectId: function(objectId)
{
- return eval("(" + objectId + ")");
+ return InjectedScriptHost.evaluate("(" + objectId + ")");
},
/**
@@ -197,7 +197,7 @@ InjectedScript.prototype = {
*/
dispatch: function(methodName, args)
{
- var argsArray = eval("(" + args + ")");
+ var argsArray = InjectedScriptHost.evaluate("(" + args + ")");
var result = this[methodName].apply(this, argsArray);
if (typeof result === "undefined") {
inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
@@ -342,7 +342,7 @@ InjectedScript.prototype = {
*/
evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue)
{
- return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI, returnByValue);
+ return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue);
},
/**
@@ -360,7 +360,7 @@ InjectedScript.prototype = {
if (args) {
var resolvedArgs = [];
- args = eval(args);
+ args = InjectedScriptHost.evaluate(args);
for (var i = 0; i < args.length; ++i) {
objectId = args[i].objectId;
if (objectId) {
@@ -382,7 +382,7 @@ InjectedScript.prototype = {
try {
var objectGroup = this._idToObjectGroupName[parsedObjectId.id];
- var func = eval("(" + expression + ")");
+ var func = InjectedScriptHost.evaluate("(" + expression + ")");
if (typeof func !== "function")
return "Given expression does not evaluate to a function";
@@ -515,7 +515,7 @@ InjectedScript.prototype = {
*/
_callFrameForId: function(topCallFrame, callFrameId)
{
- var parsedCallFrameId = eval("(" + callFrameId + ")");
+ var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")");
var ordinal = parsedCallFrameId["ordinal"];
var callFrame = topCallFrame;
while (--ordinal >= 0 && callFrame)
@@ -554,15 +554,29 @@ InjectedScript.prototype = {
return object;
},
+ /**
+ * @param {string} name
+ * @return {Object}
+ */
module: function(name)
{
return this._modules[name];
},
-
+
+ /**
+ * @param {string} name
+ * @param {string} source
+ * @return {Object}
+ */
injectModule: function(name, source)
{
delete this._modules[name];
- var module = eval("(" + source + ")");
+ var moduleFunction = InjectedScriptHost.evaluate("(" + source + ")");
+ if (typeof moduleFunction !== "function") {
+ inspectedWindow.console.error("Web Inspector error: A function was expected for module %s evaluation", name);
+ return null;
+ }
+ var module = moduleFunction.call(inspectedWindow, InjectedScriptHost, inspectedWindow, injectedScriptId);
this._modules[name] = module;
return module;
},
diff --git a/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp b/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp
index 73790dd2f..b53be9214 100644
--- a/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp
+++ b/Source/WebCore/inspector/InjectedScriptWebGLModule.cpp
@@ -72,15 +72,49 @@ ScriptObject InjectedScriptWebGLModule::wrapWebGLContext(const ScriptObject& glC
return ScriptObject(glContext.scriptState(), resultValue);
}
-void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, const String& contextId)
+void InjectedScriptWebGLModule::captureFrame(ErrorString* errorString, String* traceLogId)
{
ScriptFunctionCall function(injectedScriptObject(), "captureFrame");
- function.appendArgument(contextId);
+ RefPtr<InspectorValue> resultValue;
+ makeCall(function, &resultValue);
+ if (!resultValue || resultValue->type() != InspectorValue::TypeString || !resultValue->asString(traceLogId))
+ *errorString = "Internal error: captureFrame";
+}
+
+void InjectedScriptWebGLModule::dropTraceLog(ErrorString* errorString, const String& traceLogId)
+{
+ ScriptFunctionCall function(injectedScriptObject(), "dropTraceLog");
+ function.appendArgument(traceLogId);
bool hadException = false;
callFunctionWithEvalEnabled(function, hadException);
ASSERT(!hadException);
if (hadException)
- *errorString = "Internal error";
+ *errorString = "Internal error: dropTraceLog";
+}
+
+void InjectedScriptWebGLModule::traceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::WebGL::TraceLog>* traceLog)
+{
+ ScriptFunctionCall function(injectedScriptObject(), "traceLog");
+ function.appendArgument(traceLogId);
+ RefPtr<InspectorValue> resultValue;
+ makeCall(function, &resultValue);
+ if (!resultValue || resultValue->type() != InspectorValue::TypeObject) {
+ if (!resultValue->asString(errorString))
+ *errorString = "Internal error: traceLog";
+ return;
+ }
+ *traceLog = TypeBuilder::WebGL::TraceLog::runtimeCast(resultValue);
+}
+
+void InjectedScriptWebGLModule::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, String* result)
+{
+ ScriptFunctionCall function(injectedScriptObject(), "replayTraceLog");
+ function.appendArgument(traceLogId);
+ function.appendArgument(stepNo);
+ RefPtr<InspectorValue> resultValue;
+ makeCall(function, &resultValue);
+ if (!resultValue || resultValue->type() != InspectorValue::TypeString || !resultValue->asString(result))
+ *errorString = "Internal error: replayTraceLog";
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InjectedScriptWebGLModule.h b/Source/WebCore/inspector/InjectedScriptWebGLModule.h
index 50c9e5266..368898f7c 100644
--- a/Source/WebCore/inspector/InjectedScriptWebGLModule.h
+++ b/Source/WebCore/inspector/InjectedScriptWebGLModule.h
@@ -44,15 +44,17 @@ class ScriptObject;
class InjectedScriptWebGLModule : public InjectedScriptModule {
public:
+ InjectedScriptWebGLModule();
+
virtual String source() const;
static InjectedScriptWebGLModule moduleForState(InjectedScriptManager*, ScriptState*);
ScriptObject wrapWebGLContext(const ScriptObject& glContext);
- void captureFrame(ErrorString*, const String& contextId);
-
-private:
- InjectedScriptWebGLModule();
+ void captureFrame(ErrorString*, String*);
+ void dropTraceLog(ErrorString*, const String&);
+ void traceLog(ErrorString*, const String&, RefPtr<TypeBuilder::WebGL::TraceLog>*);
+ void replayTraceLog(ErrorString*, const String&, int, String*);
};
#endif
diff --git a/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js b/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js
index 4484b698c..977872767 100644
--- a/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js
+++ b/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js
@@ -30,104 +30,450 @@
/**
* @param {InjectedScriptHost} InjectedScriptHost
+ * @param {Window} inspectedWindow
+ * @param {number} injectedScriptId
*/
(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
/**
* @constructor
*/
-var InjectedScript = function()
+function Cache()
{
- this._lastBoundObjectId = 0;
- this._idToWrapperProxy = {};
- this._idToRealWebGLContext = {};
- this._capturingFrameInfo = null;
+ this.reset();
}
-InjectedScript.prototype = {
- wrapWebGLContext: function(glContext)
+Cache.prototype = {
+ /**
+ * @return {number}
+ */
+ size: function()
{
- for (var id in this._idToRealWebGLContext) {
- if (this._idToRealWebGLContext[id] === glContext)
- return this._idToWrapperProxy[id];
- }
+ return this._size;
+ },
+
+ reset: function()
+ {
+ this._items = Object.create(null);
+ this._size = 0;
+ },
+
+ /**
+ * @param {number} key
+ * @return {boolean}
+ */
+ has: function(key)
+ {
+ return key in this._items;
+ },
+
+ /**
+ * @param {number} key
+ * @return {Object}
+ */
+ get: function(key)
+ {
+ return this._items[key];
+ },
+
+ /**
+ * @param {number} key
+ * @param {Object} item
+ */
+ put: function(key, item)
+ {
+ if (!this.has(key))
+ ++this._size;
+ this._items[key] = item;
+ }
+}
+
+/**
+ * @constructor
+ * @param {Resource|Object} thisObject
+ * @param {string} functionName
+ * @param {Array|Arguments} args
+ * @param {Resource|*} result
+ */
+function Call(thisObject, functionName, args, result)
+{
+ this._thisObject = thisObject;
+ this._functionName = functionName;
+ this._args = Array.prototype.slice.call(args, 0);
+ this._result = result;
+}
+
+Call.prototype = {
+ /**
+ * @return {Resource}
+ */
+ resource: function()
+ {
+ return Resource.forObject(this._thisObject);
+ },
+
+ /**
+ * @return {string}
+ */
+ functionName: function()
+ {
+ return this._functionName;
+ },
+
+ /**
+ * @return {Array}
+ */
+ args: function()
+ {
+ return this._args;
+ },
+
+ /**
+ * @return {*}
+ */
+ result: function()
+ {
+ return this._result;
+ }
+}
+
+/**
+ * @constructor
+ * @param {Object} wrappedObject
+ */
+function Resource(wrappedObject)
+{
+ this._id = ++Resource._uniqueId;
+ this._resourceManager = null;
+ this.setWrappedObject(wrappedObject);
+}
+
+Resource._uniqueId = 0;
+
+/**
+ * @param {Object} obj
+ * @return {Resource}
+ */
+Resource.forObject = function(obj)
+{
+ if (!obj || obj instanceof Resource)
+ return obj;
+ if (typeof obj === "object")
+ return obj["__resourceObject"];
+ return null;
+}
+
+Resource.prototype = {
+ /**
+ * @return {number}
+ */
+ id: function()
+ {
+ return this._id;
+ },
+
+ /**
+ * @return {Object}
+ */
+ wrappedObject: function()
+ {
+ return this._wrappedObject;
+ },
+
+ /**
+ * @param {Object} value
+ */
+ setWrappedObject: function(value)
+ {
+ console.assert(value && !(value instanceof Resource), "Binding a Resource object to another Resource object?");
+ this._wrappedObject = value;
+ this._bindObjectToResource(value);
+ },
+
+ /**
+ * @return {Object}
+ */
+ proxyObject: function()
+ {
+ // No proxy wrapping by default.
+ return this.wrappedObject();
+ },
+
+ /**
+ * @return {ResourceTrackingManager}
+ */
+ manager: function()
+ {
+ return this._resourceManager;
+ },
+
+ /**
+ * @param {ResourceTrackingManager} value
+ */
+ setManager: function(value)
+ {
+ this._resourceManager = value;
+ },
+
+ /**
+ * @param {Object} object
+ */
+ _bindObjectToResource: function(object)
+ {
+ object["__resourceObject"] = this;
+ }
+}
+
+/**
+ * @constructor
+ * @extends {Resource}
+ * @param {WebGLRenderingContext} glContext
+ */
+function WebGLRenderingContextResource(glContext)
+{
+ Resource.call(this, glContext);
+ this._proxyObject = null;
+}
- var proxy = {};
- var nameProcessed = {};
- nameProcessed.__proto__ = null;
- nameProcessed.constructor = true;
-
- function processName(name) {
- if (nameProcessed[name])
- return;
- nameProcessed[name] = true;
- if (typeof glContext[name] === "function")
- proxy[name] = injectedScript._wrappedFunction.bind(injectedScript, glContext, name);
- else
- Object.defineProperty(proxy, name, {
+WebGLRenderingContextResource.prototype = {
+ /**
+ * @return {Object}
+ */
+ proxyObject: function()
+ {
+ if (!this._proxyObject)
+ this._proxyObject = this._wrapObject();
+ return this._proxyObject;
+ },
+
+ /**
+ * @return {Object}
+ */
+ _wrapObject: function()
+ {
+ var glContext = this.wrappedObject();
+ var proxy = Object.create(glContext.__proto__); // In order to emulate "instanceof".
+
+ var self = this;
+ function processProperty(property)
+ {
+ if (typeof glContext[property] === "function") {
+ // FIXME: override GL calls affecting resources states here.
+ proxy[property] = self._wrapFunction(self, glContext, glContext[property], property);
+ } else if (/^[A-Z0-9_]+$/.test(property)) {
+ // Fast access to enums and constants.
+ proxy[property] = glContext[property];
+ } else {
+ Object.defineProperty(proxy, property, {
get: function()
{
- return glContext[name];
+ return glContext[property];
},
set: function(value)
{
- glContext[name] = value;
+ glContext[property] = value;
}
});
+ }
}
- for (var o = glContext; o; o = o.__proto__)
- Object.getOwnPropertyNames(o).forEach(processName);
+ for (var property in glContext)
+ processProperty(property);
+
+ return proxy;
+ },
+
+ /**
+ * @param {Resource} resource
+ * @param {WebGLRenderingContext} originalObject
+ * @param {Function} originalFunction
+ * @param {string} functionName
+ * @return {*}
+ */
+ _wrapFunction: function(resource, originalObject, originalFunction, functionName)
+ {
+ return function()
+ {
+ var manager = resource.manager();
+ if (!manager || !manager.capturing())
+ return originalFunction.apply(originalObject, arguments);
+ manager.captureArguments(resource, arguments);
+ var result = originalFunction.apply(originalObject, arguments);
+ var call = new Call(resource, functionName, arguments, result);
+ manager.reportCall(call);
+ return result;
+ };
+ }
+}
- // In order to emulate "instanceof".
- proxy.__proto__ = glContext.__proto__;
- proxy.constructor = glContext.constructor;
+WebGLRenderingContextResource.prototype.__proto__ = Resource.prototype;
- var contextId = this._generateObjectId();
- this._idToWrapperProxy[contextId] = proxy;
- this._idToRealWebGLContext[contextId] = glContext;
- InjectedScriptHost.webGLContextCreated(contextId);
+/**
+ * @constructor
+ * @param {WebGLRenderingContext} originalObject
+ * @param {Function} originalFunction
+ * @param {string} functionName
+ * @param {Array} args
+ */
+WebGLRenderingContextResource.WrapFunction = function(originalObject, originalFunction, functionName, args)
+{
+ this._originalObject = originalObject;
+ this._originalFunction = originalFunction;
+ this._functionName = functionName;
+ this._args = args;
+ this._glResource = Resource.forObject(originalObject);
+}
- return proxy;
+WebGLRenderingContextResource.WrapFunction.prototype = {
+ /**
+ * @return {*}
+ */
+ result: function()
+ {
+ if (!this._executed) {
+ this._executed = true;
+ this._result = this._originalFunction.apply(this._originalObject, this._args);
+ }
+ return this._result;
},
- _generateObjectId: function()
+ /**
+ * @return {Call}
+ */
+ call: function()
{
- var id = ++this._lastBoundObjectId;
- var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"webGLId\":" + id + "}";
- return objectId;
+ if (!this._call)
+ this._call = new Call(this._glResource, this._functionName, this._args, this.result());
+ return this._call;
+ }
+}
+
+/**
+ * @constructor
+ */
+function TraceLog()
+{
+ this._calls = [];
+ this._resourceCache = new Cache();
+}
+
+TraceLog.prototype = {
+ /**
+ * @return {number}
+ */
+ size: function()
+ {
+ return this._calls.length;
},
- captureFrame: function(contextId)
+ /**
+ * @param {Resource} resource
+ */
+ captureResource: function(resource)
{
- this._capturingFrameInfo = {
- contextId: contextId,
- capturedCallsNum: 0
- };
+ // FIXME: Capture current resource state to start the replay from.
},
- _stopCapturing: function(info)
+ /**
+ * @param {Call} call
+ */
+ addCall: function(call)
{
- if (this._capturingFrameInfo === info)
- this._capturingFrameInfo = null;
+ // FIXME: Clone call and push the clone.
+ this._calls.push(call);
+ }
+}
+
+/**
+ * @constructor
+ */
+function ResourceTrackingManager()
+{
+ this._capturing = false;
+ this._stopCapturingOnFrameEnd = false;
+ this._lastTraceLog = null;
+}
+
+ResourceTrackingManager.prototype = {
+ /**
+ * @return {boolean}
+ */
+ capturing: function()
+ {
+ return this._capturing;
+ },
+
+ /**
+ * @return {TraceLog}
+ */
+ lastTraceLog: function()
+ {
+ return this._lastTraceLog;
},
- _wrappedFunction: function(glContext, functionName)
+ /**
+ * @param {Resource} resource
+ */
+ registerResource: function(resource)
{
- // Call real WebGL function.
- var args = Array.prototype.slice.call(arguments, 2);
- var result = glContext[functionName].apply(glContext, args);
+ resource.setManager(this);
+ },
+
+ startCapturing: function()
+ {
+ if (!this._capturing)
+ this._lastTraceLog = new TraceLog();
+ this._capturing = true;
+ this._stopCapturingOnFrameEnd = false;
+ },
- if (this._capturingFrameInfo && this._idToRealWebGLContext[this._capturingFrameInfo.contextId] === glContext) {
- var capturedCallsNum = ++this._capturingFrameInfo.capturedCallsNum;
- if (capturedCallsNum === 1)
- this._setZeroTimeouts(this._stopCapturing.bind(this, this._capturingFrameInfo));
- InjectedScriptHost.webGLReportFunctionCall(this._capturingFrameInfo.contextId, functionName, "[" + args.join(", ") + "]", result + "");
+ /**
+ * @param {TraceLog=} traceLog
+ */
+ stopCapturing: function(traceLog)
+ {
+ if (traceLog && this._lastTraceLog !== traceLog)
+ return;
+ this._capturing = false;
+ this._stopCapturingOnFrameEnd = false;
+ },
+
+ captureFrame: function()
+ {
+ this._lastTraceLog = new TraceLog();
+ this._capturing = true;
+ this._stopCapturingOnFrameEnd = true;
+ },
+
+ captureArguments: function(resource, args)
+ {
+ if (!this._capturing)
+ return;
+ this._lastTraceLog.captureResource(resource);
+ for (var i = 0, n = args.length; i < n; ++i) {
+ var res = Resource.forObject(args[i]);
+ if (res)
+ this._lastTraceLog.captureResource(res);
}
+ },
- return result;
+ /**
+ * @param {Call} call
+ */
+ reportCall: function(call)
+ {
+ if (!this._capturing)
+ return;
+ this._lastTraceLog.addCall(call);
+ if (this._stopCapturingOnFrameEnd && this._lastTraceLog.size() === 1) {
+ this._stopCapturingOnFrameEnd = false;
+ this._setZeroTimeouts(this.stopCapturing.bind(this, this._lastTraceLog));
+ }
},
+ /**
+ * @param {Function} callback
+ */
_setZeroTimeouts: function(callback)
{
// We need a fastest async callback, whatever fires first.
@@ -137,7 +483,34 @@ InjectedScript.prototype = {
channel.port2.postMessage("");
inspectedWindow.setTimeout(callback, 0);
}
-};
+}
+
+/**
+ * @constructor
+ */
+var InjectedScript = function()
+{
+ this._manager = new ResourceTrackingManager();
+}
+
+InjectedScript.prototype = {
+ /**
+ * @param {WebGLRenderingContext} glContext
+ * @return {Object}
+ */
+ wrapWebGLContext: function(glContext)
+ {
+ var resource = Resource.forObject(glContext) || new WebGLRenderingContextResource(glContext);
+ this._manager.registerResource(resource);
+ var proxy = resource.proxyObject();
+ return proxy;
+ },
+
+ captureFrame: function()
+ {
+ this._manager.captureFrame();
+ }
+}
var injectedScript = new InjectedScript();
return injectedScript;
diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json
index 4e644dc56..6fed8dc71 100644
--- a/Source/WebCore/inspector/Inspector.json
+++ b/Source/WebCore/inspector/Inspector.json
@@ -1549,6 +1549,16 @@
{ "name": "requestId", "$ref": "RequestId", "description": "Request identifier. Corresponding fileContentReceived event should have same requestId with this." }
],
"description": "Returns content of the file as fileContentReceived event. Result should be sliced into [start, end)."
+ },
+ {
+ "name": "deleteEntry",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "URL of the entry to delete." }
+ ],
+ "returns": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier. Corresponding deletionCompleted event should have same requestId with this." }
+ ],
+ "description": "Deletes specified entry. If the entry is a directory, the agent deletes children recursively."
}
],
"events": [
@@ -1557,7 +1567,7 @@
"parameters": [
{ "name": "requestId", "type": "integer", "description": "Request Identifier that was returned by corresponding requestFileSystemRoot command." },
{ "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value." },
- { "name": "root", "$ref": "FileSystem.Entry", "optional": true, "description": "Contains root of the requested FileSystem if the command completed successfully." }
+ { "name": "root", "$ref": "Entry", "optional": true, "description": "Contains root of the requested FileSystem if the command completed successfully." }
],
"description": "Completion event of requestFileSystemRoot command."
},
@@ -1566,7 +1576,7 @@
"parameters": [
{ "name": "requestId", "type": "integer", "description": "Request Identifier that was returned by corresponding requestDirectoryContent command." },
{ "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value." },
- { "name": "entries", "type": "array", "items": { "$ref": "FileSystem.Entry" }, "optional": true, "description": "Contains all entries on directory if the command completed successfully." }
+ { "name": "entries", "type": "array", "items": { "$ref": "Entry" }, "optional": true, "description": "Contains all entries on directory if the command completed successfully." }
],
"description": "Completion event of requestDirectoryContent command."
},
@@ -1575,7 +1585,7 @@
"parameters": [
{ "name": "requestId", "type": "integer", "description": "Request Identifier that was returned in response to the corresponding requestMetadata command." },
{ "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value." },
- { "name": "metadata", "$ref": "FileSystem.Metadata", "optional": true, "description": "Contains metadata of the entry if the command completed successfully." }
+ { "name": "metadata", "$ref": "Metadata", "optional": true, "description": "Contains metadata of the entry if the command completed successfully." }
],
"description": "Completion event of requestMetadata command."
},
@@ -1588,6 +1598,14 @@
{ "name": "charset", "type": "string", "optional": true, "description": "Charset of the content if it is served as text." }
],
"description": "Completion event of requestFileContent command."
+ },
+ {
+ "name": "deletionCompleted",
+ "parameters": [
+ { "name": "requestId", "type": "integer", "description": "Request Identifier that was returned in response to the corresponding deleteEntry command." },
+ { "name": "errorCode", "type": "integer", "description": "0, if no error. Otherwise errorCode is set to FileError::ErrorCode value." }
+ ],
+ "description": "Completion event of deleteEntry command."
}
]
},
@@ -3117,7 +3135,28 @@
{
"domain": "WebGL",
"hidden": true,
- "types": [],
+ "types": [
+ {
+ "id": "TraceLogId",
+ "type": "string",
+ "description": "Unique object identifier."
+ },
+ {
+ "id": "Call",
+ "type": "object",
+ "properties": [
+ { "name": "functionName", "type": "string" }
+ ]
+ },
+ {
+ "id": "TraceLog",
+ "type": "object",
+ "properties": [
+ { "name": "id", "$ref": "TraceLogId" },
+ { "name": "calls", "type": "array", "items": { "$ref": "Call" }}
+ ]
+ }
+ ],
"commands": [
{
"name": "enable",
@@ -3126,6 +3165,37 @@
{
"name": "disable",
"description": "Disables WebGL inspection."
+ },
+ {
+ "name": "dropTraceLog",
+ "parameters": [
+ { "name": "traceLogId", "$ref": "TraceLogId" }
+ ]
+ },
+ {
+ "name": "captureFrame",
+ "returns": [
+ { "name": "traceLogId", "$ref": "TraceLogId" }
+ ]
+ },
+ {
+ "name": "getTraceLog",
+ "parameters": [
+ { "name": "traceLogId", "$ref": "TraceLogId" }
+ ],
+ "returns": [
+ { "name": "traceLog", "$ref": "TraceLog" }
+ ]
+ },
+ {
+ "name": "replayTraceLog",
+ "parameters": [
+ { "name": "traceLogId", "$ref": "TraceLogId" },
+ { "name": "stepNo", "type": "integer" }
+ ],
+ "returns": [
+ { "name": "screenshotDataUrl", "type": "string" }
+ ]
}
],
"events": []
diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
index ca1918974..c12a56b0d 100644
--- a/Source/WebCore/inspector/InspectorConsoleAgent.cpp
+++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp
@@ -163,7 +163,7 @@ void InspectorConsoleAgent::startTiming(const String& title)
if (title.isNull())
return;
- m_times.add(title, currentTime() * 1000);
+ m_times.add(title, monotonicallyIncreasingTime());
}
void InspectorConsoleAgent::stopTiming(const String& title, PassRefPtr<ScriptCallStack> callStack)
@@ -180,8 +180,8 @@ void InspectorConsoleAgent::stopTiming(const String& title, PassRefPtr<ScriptCal
double startTime = it->second;
m_times.remove(it);
- double elapsed = currentTime() * 1000 - startTime;
- String message = title + String::format(": %.0fms", elapsed);
+ double elapsed = monotonicallyIncreasingTime() - startTime;
+ String message = title + String::format(": %.3fms", elapsed * 1000);
const ScriptCallFrame& lastCaller = callStack->at(0);
addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lastCaller.sourceURL(), lastCaller.lineNumber());
}
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index 5a0f3bf43..c85f4d4ca 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -148,7 +148,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
#endif
#if ENABLE(WEBGL)
- m_agents.append(InspectorWebGLAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()));
+ m_agents.append(InspectorWebGLAgent::create(m_instrumentingAgents.get(), m_state.get(), page, m_injectedScriptManager.get()));
#endif
ASSERT_ARG(inspectorClient, inspectorClient);
diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
index d60b02c44..fb40ed43f 100644
--- a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
+++ b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
@@ -63,6 +63,7 @@
#include "SecurityOrigin.h"
#include "TextEncoding.h"
#include "TextResourceDecoder.h"
+#include "VoidCallback.h"
#include <wtf/text/Base64.h>
using WebCore::TypeBuilder::Array;
@@ -141,10 +142,31 @@ public:
}
};
+class ReportErrorTask : public ScriptExecutionContext::Task {
+public:
+ static PassOwnPtr<ReportErrorTask> create(PassRefPtr<ErrorCallback> errorCallback, FileError::ErrorCode errorCode)
+ {
+ return adoptPtr(new ReportErrorTask(errorCallback, errorCode));
+ }
+
+ virtual void performTask(ScriptExecutionContext*) OVERRIDE
+ {
+ m_errorCallback->handleEvent(FileError::create(m_errorCode).get());
+ }
+
+private:
+ ReportErrorTask(PassRefPtr<ErrorCallback> errorCallback, FileError::ErrorCode errorCode)
+ : m_errorCallback(errorCallback)
+ , m_errorCode(errorCode) { }
+
+ RefPtr<ErrorCallback> m_errorCallback;
+ FileError::ErrorCode m_errorCode;
+};
+
class FileSystemRootRequest : public RefCounted<FileSystemRootRequest> {
WTF_MAKE_NONCOPYABLE(FileSystemRootRequest);
public:
- static PassRefPtr<FileSystemRootRequest> create(PassRefPtr<FrontendProvider> frontendProvider, int requestId, FileSystemType type)
+ static PassRefPtr<FileSystemRootRequest> create(PassRefPtr<FrontendProvider> frontendProvider, int requestId, const String& type)
{
return adoptRef(new FileSystemRootRequest(frontendProvider, requestId, type));
}
@@ -152,7 +174,12 @@ public:
void start(ScriptExecutionContext*);
private:
- bool didHitError(FileError*);
+ bool didHitError(FileError* error)
+ {
+ reportResult(error->code());
+ return true;
+ }
+
bool didGetEntry(Entry*);
void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::FileSystem::Entry> entry = 0)
@@ -163,29 +190,35 @@ private:
m_frontendProvider = 0;
}
- FileSystemRootRequest(PassRefPtr<FrontendProvider> frontendProvider, int requestId, FileSystemType type)
+ FileSystemRootRequest(PassRefPtr<FrontendProvider> frontendProvider, int requestId, const String& type)
: m_frontendProvider(frontendProvider)
, m_requestId(requestId)
, m_type(type) { }
RefPtr<FrontendProvider> m_frontendProvider;
int m_requestId;
- FileSystemType m_type;
+ String m_type;
};
-bool FileSystemRootRequest::didHitError(FileError* error)
-{
- reportResult(error->code());
- return true;
-}
-
void FileSystemRootRequest::start(ScriptExecutionContext* scriptExecutionContext)
{
- RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &FileSystemRootRequest::didGetEntry);
+ ASSERT(scriptExecutionContext);
+
RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileSystemRootRequest::didHitError);
- OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, m_type, "/");
+ FileSystemType type;
+ if (m_type == DOMFileSystemBase::persistentPathPrefix)
+ type = FileSystemTypePersistent;
+ else if (m_type == DOMFileSystemBase::temporaryPathPrefix)
+ type = FileSystemTypeTemporary;
+ else {
+ scriptExecutionContext->postTask(ReportErrorTask::create(errorCallback, FileError::SYNTAX_ERR));
+ return;
+ }
+
+ RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &FileSystemRootRequest::didGetEntry);
+ OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, "/");
- LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, m_type, fileSystemCallbacks.release());
+ LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
}
bool FileSystemRootRequest::didGetEntry(Entry* entry)
@@ -249,15 +282,15 @@ void DirectoryContentRequest::start(ScriptExecutionContext* scriptExecutionConte
{
ASSERT(scriptExecutionContext);
+ RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DirectoryContentRequest::didHitError);
FileSystemType type;
String path;
if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
- reportResult(FileError::SYNTAX_ERR);
+ scriptExecutionContext->postTask(ReportErrorTask::create(errorCallback, FileError::SYNTAX_ERR));
return;
}
RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &DirectoryContentRequest::didGetEntry);
- RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DirectoryContentRequest::didHitError);
OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
@@ -377,12 +410,17 @@ private:
void MetadataRequest::start(ScriptExecutionContext* scriptExecutionContext)
{
- FileSystemType type;
- DOMFileSystemBase::crackFileSystemURL(m_url, type, m_path);
+ ASSERT(scriptExecutionContext);
- RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &MetadataRequest::didGetEntry);
RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &MetadataRequest::didHitError);
+ FileSystemType type;
+ if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, m_path)) {
+ scriptExecutionContext->postTask(ReportErrorTask::create(errorCallback, FileError::SYNTAX_ERR));
+ return;
+ }
+
+ RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &MetadataRequest::didGetEntry);
OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, m_path);
LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
}
@@ -484,15 +522,16 @@ void FileContentRequest::start(ScriptExecutionContext* scriptExecutionContext)
{
ASSERT(scriptExecutionContext);
+ RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileContentRequest::didHitError);
+
FileSystemType type;
String path;
if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
- reportResult(FileError::SYNTAX_ERR);
+ scriptExecutionContext->postTask(ReportErrorTask::create(errorCallback, FileError::SYNTAX_ERR));
return;
}
RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &FileContentRequest::didGetEntry);
- RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileContentRequest::didHitError);
OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
@@ -548,6 +587,93 @@ void FileContentRequest::didRead()
reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset);
}
+class DeleteEntryRequest : public VoidCallback {
+public:
+ static PassRefPtr<DeleteEntryRequest> create(PassRefPtr<FrontendProvider> frontendProvider, int requestId, const KURL& url)
+ {
+ return adoptRef(new DeleteEntryRequest(frontendProvider, requestId, url));
+ }
+
+ virtual ~DeleteEntryRequest()
+ {
+ reportResult(FileError::ABORT_ERR);
+ }
+
+ virtual bool handleEvent() OVERRIDE
+ {
+ return didDeleteEntry();
+ }
+
+ void start(ScriptExecutionContext*);
+
+private:
+ bool didHitError(FileError* error)
+ {
+ reportResult(error->code());
+ return true;
+ }
+
+ bool didGetEntry(Entry*);
+ bool didDeleteEntry();
+
+ void reportResult(FileError::ErrorCode errorCode)
+ {
+ if (!m_frontendProvider || !m_frontendProvider->frontend())
+ return;
+ m_frontendProvider->frontend()->deletionCompleted(m_requestId, static_cast<int>(errorCode));
+ m_frontendProvider = 0;
+ }
+
+ DeleteEntryRequest(PassRefPtr<FrontendProvider> frontendProvider, int requestId, const KURL& url)
+ : m_frontendProvider(frontendProvider)
+ , m_requestId(requestId)
+ , m_url(url) { }
+
+ RefPtr<FrontendProvider> m_frontendProvider;
+ int m_requestId;
+ KURL m_url;
+};
+
+void DeleteEntryRequest::start(ScriptExecutionContext* scriptExecutionContext)
+{
+ ASSERT(scriptExecutionContext);
+
+ RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DeleteEntryRequest::didHitError);
+
+ FileSystemType type;
+ String path;
+ if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
+ scriptExecutionContext->postTask(ReportErrorTask::create(errorCallback, FileError::SYNTAX_ERR));
+ return;
+ }
+
+ if (path == "/") {
+ OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::create(this, errorCallback);
+ LocalFileSystem::localFileSystem().deleteFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+ } else {
+ RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &DeleteEntryRequest::didGetEntry);
+ OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
+ LocalFileSystem::localFileSystem().readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+ }
+}
+
+bool DeleteEntryRequest::didGetEntry(Entry* entry)
+{
+ RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DeleteEntryRequest::didHitError);
+ if (entry->isDirectory()) {
+ DirectoryEntry* directoryEntry = static_cast<DirectoryEntry*>(entry);
+ directoryEntry->removeRecursively(this, errorCallback);
+ } else
+ entry->remove(this, errorCallback);
+ return true;
+}
+
+bool DeleteEntryRequest::didDeleteEntry()
+{
+ reportResult(static_cast<FileError::ErrorCode>(0));
+ return true;
+}
+
} // anonymous namespace
// static
@@ -579,39 +705,23 @@ void InspectorFileSystemAgent::disable(ErrorString*)
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
-void InspectorFileSystemAgent::requestFileSystemRoot(ErrorString* error, const String& origin, const String& typeString, int* requestId)
+void InspectorFileSystemAgent::requestFileSystemRoot(ErrorString* error, const String& origin, const String& type, int* requestId)
{
- if (!m_enabled || !m_frontendProvider) {
- *error = "FileSystem agent is not enabled";
+ if (!assertFrontend(error))
return;
- }
- ASSERT(m_frontendProvider->frontend());
ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(origin).get());
if (!scriptExecutionContext)
return;
- FileSystemType type;
- if (typeString == DOMFileSystemBase::persistentPathPrefix)
- type = FileSystemTypePersistent;
- else if (typeString == DOMFileSystemBase::temporaryPathPrefix)
- type = FileSystemTypeTemporary;
- else {
- *error = "Invalid FileSystem type";
- return;
- }
-
*requestId = m_nextRequestId++;
FileSystemRootRequest::create(m_frontendProvider, *requestId, type)->start(scriptExecutionContext);
}
void InspectorFileSystemAgent::requestDirectoryContent(ErrorString* error, const String& url, int* requestId)
{
- if (!m_enabled || !m_frontendProvider) {
- *error = "FileSystem agent is not enabled";
+ if (!assertFrontend(error))
return;
- }
- ASSERT(m_frontendProvider->frontend());
ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
if (!scriptExecutionContext)
@@ -623,11 +733,8 @@ void InspectorFileSystemAgent::requestDirectoryContent(ErrorString* error, const
void InspectorFileSystemAgent::requestMetadata(ErrorString* error, const String& url, int* requestId)
{
- if (!m_enabled || !m_frontendProvider) {
- *error = "FileSystem agent is not enabled";
+ if (!assertFrontend(error))
return;
- }
- ASSERT(m_frontendProvider->frontend());
ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
if (!scriptExecutionContext)
@@ -639,11 +746,8 @@ void InspectorFileSystemAgent::requestMetadata(ErrorString* error, const String&
void InspectorFileSystemAgent::requestFileContent(ErrorString* error, const String& url, bool readAsText, const int* start, const int* end, const String* charset, int* requestId)
{
- if (!m_enabled || !m_frontendProvider) {
- *error = "FileSystem agent is not enabled";
+ if (!assertFrontend(error))
return;
- }
- ASSERT(m_frontendProvider->frontend());
ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
if (!scriptExecutionContext)
@@ -656,6 +760,21 @@ void InspectorFileSystemAgent::requestFileContent(ErrorString* error, const Stri
FileContentRequest::create(m_frontendProvider, *requestId, url, readAsText, startPosition, endPosition, charset ? *charset : "")->start(scriptExecutionContext);
}
+void InspectorFileSystemAgent::deleteEntry(ErrorString* error, const String& urlString, int* requestId)
+{
+ if (!assertFrontend(error))
+ return;
+
+ KURL url(ParsedURLString, urlString);
+
+ ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::create(url).get());
+ if (!scriptExecutionContext)
+ return;
+
+ *requestId = m_nextRequestId++;
+ DeleteEntryRequest::create(m_frontendProvider, *requestId, url)->start(scriptExecutionContext);
+}
+
void InspectorFileSystemAgent::setFrontend(InspectorFrontend* frontend)
{
ASSERT(frontend);
@@ -689,6 +808,16 @@ InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrume
m_instrumentingAgents->setInspectorFileSystemAgent(this);
}
+bool InspectorFileSystemAgent::assertFrontend(ErrorString* error)
+{
+ if (!m_enabled || !m_frontendProvider) {
+ *error = "FileSystem agent is not enabled.";
+ return false;
+ }
+ ASSERT(m_frontendProvider->frontend());
+ return true;
+}
+
ScriptExecutionContext* InspectorFileSystemAgent::assertScriptExecutionContextForOrigin(ErrorString* error, SecurityOrigin* origin)
{
for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.h b/Source/WebCore/inspector/InspectorFileSystemAgent.h
index f7350d416..f0fca3cae 100644
--- a/Source/WebCore/inspector/InspectorFileSystemAgent.h
+++ b/Source/WebCore/inspector/InspectorFileSystemAgent.h
@@ -59,6 +59,7 @@ public:
virtual void requestDirectoryContent(ErrorString*, const String& url, int* requestId) OVERRIDE;
virtual void requestMetadata(ErrorString*, const String& url, int* requestId) OVERRIDE;
virtual void requestFileContent(ErrorString*, const String& url, bool readAsText, const int* start, const int* end, const String* charset, int* requestId) OVERRIDE;
+ virtual void deleteEntry(ErrorString*, const String& url, int* requestId) OVERRIDE;
virtual void setFrontend(InspectorFrontend*) OVERRIDE;
virtual void clearFrontend() OVERRIDE;
@@ -66,6 +67,7 @@ public:
private:
InspectorFileSystemAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*);
+ bool assertFrontend(ErrorString*);
ScriptExecutionContext* assertScriptExecutionContextForOrigin(ErrorString*, SecurityOrigin*);
InspectorPageAgent* m_pageAgent;
diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
index e15b30d9e..70c2b5997 100644
--- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
+++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
@@ -610,7 +610,7 @@ public:
RefPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::create(m_frontendProvider, m_injectedScript, this, idbTransaction.get(), OpenCursorCallback::ObjectStoreDataCursor, m_requestId, m_skipCount, m_pageSize);
ExceptionCode ec = 0;
- idbObjectStore->openCursor(m_idbKeyRange, IDBCursor::NEXT, openCursorCallback, idbTransaction.get(), ec);
+ idbObjectStore->openCursor(m_idbKeyRange, IDBCursor::NEXT, openCursorCallback, IDBTransactionBackendInterface::NormalTask, idbTransaction.get(), ec);
}
}
diff --git a/Source/WebCore/inspector/InspectorWebGLAgent.cpp b/Source/WebCore/inspector/InspectorWebGLAgent.cpp
index 4dc4d35cf..16ffbcfa4 100644
--- a/Source/WebCore/inspector/InspectorWebGLAgent.cpp
+++ b/Source/WebCore/inspector/InspectorWebGLAgent.cpp
@@ -34,11 +34,13 @@
#include "InspectorWebGLAgent.h"
+#include "InjectedScript.h"
#include "InjectedScriptManager.h"
#include "InjectedScriptWebGLModule.h"
#include "InspectorFrontend.h"
#include "InspectorState.h"
#include "InstrumentingAgents.h"
+#include "Page.h"
#include "ScriptObject.h"
#include "ScriptState.h"
@@ -48,8 +50,9 @@ namespace WebGLAgentState {
static const char webGLAgentEnabled[] = "webGLAgentEnabled";
};
-InspectorWebGLAgent::InspectorWebGLAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)
+InspectorWebGLAgent::InspectorWebGLAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* injectedScriptManager)
: InspectorBaseAgent<InspectorWebGLAgent>("WebGL", instrumentingAgents, state)
+ , m_inspectedPage(page)
, m_injectedScriptManager(injectedScriptManager)
, m_frontend(0)
, m_enabled(false)
@@ -95,6 +98,38 @@ void InspectorWebGLAgent::disable(ErrorString*)
m_state->setBoolean(WebGLAgentState::webGLAgentEnabled, m_enabled);
}
+void InspectorWebGLAgent::dropTraceLog(ErrorString* errorString, const String& traceLogId)
+{
+ InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId);
+ if (!module.hasNoValue())
+ module.dropTraceLog(errorString, traceLogId);
+}
+
+void InspectorWebGLAgent::captureFrame(ErrorString* errorString, String* traceLogId)
+{
+ ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame());
+ InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, scriptState);
+ if (module.hasNoValue()) {
+ *errorString = "Inspected frame has gone";
+ return;
+ }
+ module.captureFrame(errorString, traceLogId);
+}
+
+void InspectorWebGLAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, RefPtr<TypeBuilder::WebGL::TraceLog>& traceLog)
+{
+ InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId);
+ if (!module.hasNoValue())
+ module.traceLog(errorString, traceLogId, &traceLog);
+}
+
+void InspectorWebGLAgent::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, String* result)
+{
+ InjectedScriptWebGLModule module = injectedScriptWebGLModuleForTraceLogId(errorString, traceLogId);
+ if (!module.hasNoValue())
+ module.replayTraceLog(errorString, traceLogId, stepNo, result);
+}
+
ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
if (glContext.hasNoValue()) {
@@ -109,6 +144,22 @@ ScriptObject InspectorWebGLAgent::wrapWebGLRenderingContextForInstrumentation(co
return module.wrapWebGLContext(glContext);
}
+InjectedScriptWebGLModule InspectorWebGLAgent::injectedScriptWebGLModuleForTraceLogId(ErrorString* errorString, const String& traceLogId)
+{
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(traceLogId);
+ if (injectedScript.hasNoValue()) {
+ *errorString = "Inspected frame has gone";
+ return InjectedScriptWebGLModule();
+ }
+ InjectedScriptWebGLModule module = InjectedScriptWebGLModule::moduleForState(m_injectedScriptManager, injectedScript.scriptState());
+ if (module.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ *errorString = "Internal error: no WebGL module";
+ return InjectedScriptWebGLModule();
+ }
+ return module;
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR) && ENABLE(WEBGL)
diff --git a/Source/WebCore/inspector/InspectorWebGLAgent.h b/Source/WebCore/inspector/InspectorWebGLAgent.h
index a91e8b906..1d3771d22 100644
--- a/Source/WebCore/inspector/InspectorWebGLAgent.h
+++ b/Source/WebCore/inspector/InspectorWebGLAgent.h
@@ -35,6 +35,7 @@
#include "InspectorBaseAgent.h"
#include "InspectorFrontend.h"
+#include "InspectorTypeBuilder.h"
#include "PlatformString.h"
#include "ScriptState.h"
#include <wtf/PassOwnPtr.h>
@@ -43,17 +44,19 @@
namespace WebCore {
class InjectedScriptManager;
+class InjectedScriptWebGLModule;
class InspectorState;
class InstrumentingAgents;
+class Page;
class ScriptObject;
typedef String ErrorString;
class InspectorWebGLAgent : public InspectorBaseAgent<InspectorWebGLAgent>, public InspectorBackendDispatcher::WebGLCommandHandler {
public:
- static PassOwnPtr<InspectorWebGLAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager)
+ static PassOwnPtr<InspectorWebGLAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* injectedScriptManager)
{
- return adoptPtr(new InspectorWebGLAgent(instrumentingAgents, state, injectedScriptManager));
+ return adoptPtr(new InspectorWebGLAgent(instrumentingAgents, state, page, injectedScriptManager));
}
~InspectorWebGLAgent();
@@ -68,14 +71,21 @@ public:
// Called from the front-end.
virtual void enable(ErrorString*);
virtual void disable(ErrorString*);
+ virtual void dropTraceLog(ErrorString*, const String&);
+ virtual void captureFrame(ErrorString*, String*);
+ virtual void getTraceLog(ErrorString*, const String&, RefPtr<TypeBuilder::WebGL::TraceLog>&);
+ virtual void replayTraceLog(ErrorString*, const String&, int, String*);
// Called from the injected script.
// Called from InspectorInstrumentation
private:
- InspectorWebGLAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);
+ InspectorWebGLAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScriptManager*);
+ InjectedScriptWebGLModule injectedScriptWebGLModuleForTraceLogId(ErrorString*, const String&);
+
+ Page* m_inspectedPage;
InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::WebGL* m_frontend;
bool m_enabled;
diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py
index cb1dc922e..d956e3dbf 100755
--- a/Source/WebCore/inspector/compile-front-end.py
+++ b/Source/WebCore/inspector/compile-front-end.py
@@ -377,3 +377,14 @@ command += " --js " + inspector_path + "/" + "InjectedScriptSourceTmp.js"
command += "\n"
os.system(command)
os.system("rm " + inspector_path + "/" + "InjectedScriptSourceTmp.js")
+
+print "Compiling InjectedScriptWebGLModuleSource.js..."
+os.system("echo \"var injectedScriptWebGLModuleValue = \" > " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js")
+os.system("cat " + inspector_path + "/" + "InjectedScriptWebGLModuleSource.js" + " >> " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js")
+command = compiler_command
+command += " --externs " + inspector_path + "/" + "InjectedScriptExterns.js" + " \\\n"
+command += " --module " + jsmodule_name_prefix + "injected_script" + ":" + "1" + " \\\n"
+command += " --js " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js" + " \\\n"
+command += "\n"
+os.system(command)
+os.system("rm " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js")
diff --git a/Source/WebCore/inspector/front-end/DefaultTextEditor.js b/Source/WebCore/inspector/front-end/DefaultTextEditor.js
index 2196166ad..917914d9c 100644
--- a/Source/WebCore/inspector/front-end/DefaultTextEditor.js
+++ b/Source/WebCore/inspector/front-end/DefaultTextEditor.js
@@ -1236,11 +1236,6 @@ WebInspector.TextEditorMainPanel = function(textModel, url, syncScrollListener,
this.element.addEventListener("scroll", this._scroll.bind(this), false);
this.element.addEventListener("focus", this._handleElementFocus.bind(this), false);
- // In WebKit the DOMNodeRemoved event is fired AFTER the node is removed, thus it should be
- // attached to all DOM nodes that we want to track. Instead, we attach the DOMNodeRemoved
- // listeners only on the line rows, and use DOMSubtreeModified to track node removals inside
- // the line rows. For more info see: https://bugs.webkit.org/show_bug.cgi?id=55666
- //
// OPTIMIZATION. It is very expensive to listen to the DOM mutation events, thus we remove the
// listeners whenever we do any internal DOM manipulations (such as expand/collapse line rows)
// and set the listeners back when we are finished.
@@ -1653,18 +1648,6 @@ WebInspector.TextEditorMainPanel.prototype = {
}
},
- /**
- * @param {Element} lineRow
- * @param {boolean} enable
- */
- _enableDOMNodeRemovedListener: function(lineRow, enable)
- {
- if (enable)
- lineRow.addEventListener("DOMNodeRemoved", this._handleDOMUpdatesCallback, false);
- else
- lineRow.removeEventListener("DOMNodeRemoved", this._handleDOMUpdatesCallback, false);
- },
-
_buildChunks: function()
{
for (var i = 0; i < this._textModel.linesCount; ++i)
@@ -2173,11 +2156,6 @@ WebInspector.TextEditorMainPanel.prototype = {
}
}
- if (target === lineRow && e.type === "DOMNodeRemoved") {
- // Now this will no longer be valid.
- delete lineRow.lineNumber;
- }
-
if (this._dirtyLines) {
this._dirtyLines.start = Math.min(this._dirtyLines.start, startLine);
this._dirtyLines.end = Math.max(this._dirtyLines.end, endLine);
@@ -2544,7 +2522,6 @@ WebInspector.TextEditorMainChunk = function(chunkedPanel, startLine, endLine)
this.element = document.createElement("div");
this.element.lineNumber = startLine;
this.element.className = "webkit-line-content";
- this._chunkedPanel._enableDOMNodeRemovedListener(this.element, true);
this._startLine = startLine;
endLine = Math.min(this._textModel.linesCount, endLine);
@@ -2651,24 +2628,20 @@ WebInspector.TextEditorMainChunk.prototype = {
var parentElement = this.element.parentElement;
for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
var lineRow = this._createRow(i);
- this._chunkedPanel._enableDOMNodeRemovedListener(lineRow, true);
this._updateElementReadOnlyState(lineRow);
parentElement.insertBefore(lineRow, this.element);
this._expandedLineRows.push(lineRow);
}
- this._chunkedPanel._enableDOMNodeRemovedListener(this.element, false);
parentElement.removeChild(this.element);
this._chunkedPanel._paintLines(this.startLine, this.startLine + this.linesCount);
} else {
var elementInserted = false;
for (var i = 0; i < this._expandedLineRows.length; ++i) {
var lineRow = this._expandedLineRows[i];
- this._chunkedPanel._enableDOMNodeRemovedListener(lineRow, false);
var parentElement = lineRow.parentElement;
if (parentElement) {
if (!elementInserted) {
elementInserted = true;
- this._chunkedPanel._enableDOMNodeRemovedListener(this.element, true);
parentElement.insertBefore(this.element, lineRow);
}
parentElement.removeChild(lineRow);
diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js
index 9746b985a..cdc8f535c 100644
--- a/Source/WebCore/inspector/front-end/ElementsPanel.js
+++ b/Source/WebCore/inspector/front-end/ElementsPanel.js
@@ -40,6 +40,7 @@ importScript("StylesSidebarPane.js");
WebInspector.ElementsPanel = function()
{
WebInspector.Panel.call(this, "elements");
+ this.registerRequiredCSS("breadcrumbList.css");
this.registerRequiredCSS("elementsPanel.css");
this.registerRequiredCSS("textPrompt.css");
this.setHideOnDetach();
diff --git a/Source/WebCore/inspector/front-end/FileSystemModel.js b/Source/WebCore/inspector/front-end/FileSystemModel.js
index 96402bd9b..30edd84e8 100644
--- a/Source/WebCore/inspector/front-end/FileSystemModel.js
+++ b/Source/WebCore/inspector/front-end/FileSystemModel.js
@@ -645,5 +645,14 @@ WebInspector.FileSystemDispatcher.prototype = {
fileContentReceived: function(requestId, errorCode, content, charset)
{
this._agentWrapper._fileContentReceived(requestId, errorCode, content, charset);
+ },
+
+ /**
+ * @param {number} requestId
+ * @param {number} errorCode
+ */
+ deletionCompleted: function(requestId, errorCode)
+ {
+ console.error("Not implemented");
}
}
diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
index 90a254ab5..bab529ef0 100644
--- a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
+++ b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
@@ -52,7 +52,7 @@ InspectorFrontendAPI = {
setTimelineProfilingEnabled: function(enabled)
{
- WebInspector.panel("timeline").setTimelineProfilingEnabled(enabled);
+ WebInspector.showPanel("timeline").setTimelineProfilingEnabled(enabled);
},
isProfilingJavaScript: function()
@@ -133,6 +133,20 @@ InspectorFrontendAPI = {
InspectorFrontendAPI._pendingCommands.push(signature);
},
+ dispatchQueryParameters: function()
+ {
+ if ("dispatch" in WebInspector.queryParamsObject)
+ InspectorFrontendAPI.dispatch(JSON.parse(window.decodeURI(WebInspector.queryParamsObject["dispatch"])));
+ },
+
+ /**
+ * @param {string} url
+ */
+ loadTimelineFromURL: function(url)
+ {
+ WebInspector.showPanel("timeline").loadFromURL(url);
+ },
+
loadCompleted: function()
{
InspectorFrontendAPI._isLoaded = true;
diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
index 0b4eaa621..61d8ae87f 100644
--- a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
+++ b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
@@ -102,7 +102,7 @@ WebInspector.InspectorFrontendHostStub.prototype = {
hiddenPanels: function()
{
- return "";
+ return WebInspector.queryParamsObject["hiddenPanels"] || "";
},
inspectedURLChanged: function(url)
@@ -179,7 +179,7 @@ WebInspector.InspectorFrontendHostStub.prototype = {
loadResourceSynchronously: function(url)
{
- return "";
+ return loadXHR(url);
},
setZoomFactor: function(zoom)
diff --git a/Source/WebCore/inspector/front-end/InspectorView.js b/Source/WebCore/inspector/front-end/InspectorView.js
index d49b04e33..e5799babe 100644
--- a/Source/WebCore/inspector/front-end/InspectorView.js
+++ b/Source/WebCore/inspector/front-end/InspectorView.js
@@ -95,7 +95,10 @@ WebInspector.InspectorView.prototype = {
{
return this._currentPanel;
},
-
+
+ /**
+ * @param {WebInspector.Panel} x
+ */
setCurrentPanel: function(x)
{
if (this._currentPanel === x)
diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
index ae12bae61..fdd730ad3 100644
--- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
+++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
@@ -160,7 +160,7 @@ WebInspector.JavaScriptSourceFrame.prototype = {
_didEditContent: function(error)
{
if (error) {
- WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
+ WebInspector.showErrorMessage(error);
return;
}
if (!this._javaScriptSource.supportsEnabledBreakpointsWhileEditing())
diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js
index e8cacb187..1f688d6d8 100644
--- a/Source/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js
@@ -185,9 +185,11 @@ WebInspector.ScriptsPanel = function(workspaceForTest)
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ExecutionLineChanged, this._executionLineChanged, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this);
+ WebInspector.startBatchUpdate();
var uiSourceCodes = this._workspace.uiSourceCodes();
for (var i = 0; i < uiSourceCodes.length; ++i)
this._addUISourceCode(uiSourceCodes[i]);
+ WebInspector.endBatchUpdate();
this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
@@ -569,7 +571,8 @@ WebInspector.ScriptsPanel.prototype = {
_pauseOnExceptionStateChanged: function()
{
- switch (WebInspector.settings.pauseOnExceptionStateString.get()) {
+ var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionStateString.get();
+ switch (pauseOnExceptionsState) {
case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions:
this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
break;
@@ -580,6 +583,7 @@ WebInspector.ScriptsPanel.prototype = {
this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions.");
break;
}
+ this._pauseOnExceptionButton.state = pauseOnExceptionsState;
},
_updateDebuggerButtons: function()
diff --git a/Source/WebCore/inspector/front-end/ScriptsSearchScope.js b/Source/WebCore/inspector/front-end/ScriptsSearchScope.js
index e30655a6c..c19d1ecf5 100644
--- a/Source/WebCore/inspector/front-end/ScriptsSearchScope.js
+++ b/Source/WebCore/inspector/front-end/ScriptsSearchScope.js
@@ -128,5 +128,3 @@ WebInspector.ScriptsSearchScope.prototype = {
}
WebInspector.ScriptsSearchScope.prototype.__proto__ = WebInspector.SearchScope.prototype;
-
-WebInspector.settings.searchInContentScripts = WebInspector.settings.createSetting("searchInContentScripts", false);
diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js
index 2c8bf6880..cebc91d32 100644
--- a/Source/WebCore/inspector/front-end/Settings.js
+++ b/Source/WebCore/inspector/front-end/Settings.js
@@ -101,6 +101,7 @@ WebInspector.Settings = function()
this.geolocationOverride = this.createSetting("geolocationOverride", "");
this.deviceOrientationOverride = this.createSetting("deviceOrientationOverride", "");
this.showHeapSnapshotObjectsHiddenProperties = this.createSetting("showHeaSnapshotObjectsHiddenProperties", false);
+ this.searchInContentScripts = this.createSetting("searchInContentScripts", false);
// If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
// periodical breakpoints duplication leading to inspector slowness.
diff --git a/Source/WebCore/inspector/front-end/TabbedPane.js b/Source/WebCore/inspector/front-end/TabbedPane.js
index a279a1e3d..3e8e8ab19 100644
--- a/Source/WebCore/inspector/front-end/TabbedPane.js
+++ b/Source/WebCore/inspector/front-end/TabbedPane.js
@@ -101,7 +101,7 @@ WebInspector.TabbedPane.prototype = {
*/
appendTab: function(id, tabTitle, view, tabTooltip, userGesture)
{
- var tab = new WebInspector.TabbedPaneTab(this, this._tabsElement, id, tabTitle, this._closeableTabs, view, tabTooltip);
+ var tab = new WebInspector.TabbedPaneTab(this, id, tabTitle, this._closeableTabs, view, tabTooltip);
this._tabsById[id] = tab;
this._tabs.push(tab);
@@ -254,6 +254,11 @@ WebInspector.TabbedPane.prototype = {
_updateTabElements: function()
{
+ WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElements);
+ },
+
+ _innerUpdateTabElements: function()
+ {
if (!this.isShowing())
return;
@@ -265,9 +270,7 @@ WebInspector.TabbedPane.prototype = {
if (!this._measuredDropDownButtonWidth)
this._measureDropDownButton();
- if (this._shrinkableTabs)
- this._updateWidths();
-
+ this._updateWidths();
this._updateTabsDropDown();
},
@@ -374,16 +377,44 @@ WebInspector.TabbedPane.prototype = {
_updateWidths: function()
{
- var measuredWidths = [];
- for (var tabId in this._tabs)
- measuredWidths.push(this._tabs[tabId].measuredWidth);
-
- var maxWidth = this._calculateMaxWidth(measuredWidths, this._totalWidth());
-
+ var measuredWidths = this._measureWidths();
+ var maxWidth = this._shrinkableTabs ? this._calculateMaxWidth(measuredWidths.slice(), this._totalWidth()) : Number.MAX_VALUE;
+
+ var i = 0;
+ for (var tabId in this._tabs) {
+ var tab = this._tabs[tabId];
+ tab.setWidth(Math.min(maxWidth, measuredWidths[i++]));
+ }
+ },
+
+ _measureWidths: function()
+ {
+ // Add all elements to measure into this._tabsElement
+ var measuringTabElements = [];
for (var tabId in this._tabs) {
var tab = this._tabs[tabId];
- tab.width = Math.min(tab.measuredWidth, maxWidth);
+ if (typeof tab._measuredWidth === "number")
+ continue;
+ var measuringTabElement = tab._createTabElement(true);
+ measuringTabElement.__tab = tab;
+ measuringTabElements.push(measuringTabElement);
+ this._tabsElement.appendChild(measuringTabElement);
}
+
+ // Perform measurement
+ for (var i = 0; i < measuringTabElements.length; ++i)
+ measuringTabElements[i].__tab._measuredWidth = measuringTabElements[i].getBoundingClientRect().width;
+
+ // Nuke elements from the UI
+ for (var i = 0; i < measuringTabElements.length; ++i)
+ measuringTabElements[i].parentElement.removeChild(measuringTabElements[i]);
+
+ // Combine the results.
+ var measuredWidths = [];
+ for (var tabId in this._tabs)
+ measuredWidths.push(this._tabs[tabId]._measuredWidth);
+
+ return measuredWidths;
},
/**
@@ -429,7 +460,7 @@ WebInspector.TabbedPane.prototype = {
var totalTabsWidth = 0;
for (var i = 0; i < tabsHistory.length; ++i) {
- totalTabsWidth += tabsHistory[i].width;
+ totalTabsWidth += tabsHistory[i].width();
var minimalRequiredWidth = totalTabsWidth;
if (i !== tabsHistory.length - 1)
minimalRequiredWidth += measuredDropDownButtonWidth;
@@ -510,18 +541,16 @@ WebInspector.TabbedPane.prototype.__proto__ = WebInspector.View.prototype;
/**
* @constructor
* @param {WebInspector.TabbedPane} tabbedPane
- * @param {Element} measureElement
* @param {string} id
* @param {string} title
* @param {boolean} closeable
* @param {WebInspector.View} view
* @param {string=} tooltip
*/
-WebInspector.TabbedPaneTab = function(tabbedPane, measureElement, id, title, closeable, view, tooltip)
+WebInspector.TabbedPaneTab = function(tabbedPane, id, title, closeable, view, tooltip)
{
this._closeable = closeable;
this._tabbedPane = tabbedPane;
- this._measureElement = measureElement;
this._id = id;
this._title = title;
this._tooltip = tooltip;
@@ -599,24 +628,15 @@ WebInspector.TabbedPaneTab.prototype = {
/**
* @return {number}
*/
- get measuredWidth()
+ width: function()
{
- if (typeof(this._measuredWidth) !== "undefined")
- return this._measuredWidth;
-
- this._measure();
- return this._measuredWidth;
+ return this._width;
},
/**
- * @return {number}
+ * @param {number} width
*/
- get width()
- {
- return this._width || this.measuredWidth;
- },
-
- set width(width)
+ setWidth: function(width)
{
this.tabElement.style.width = width + "px";
this._width = width;
@@ -657,14 +677,6 @@ WebInspector.TabbedPaneTab.prototype = {
return tabElement;
},
- _measure: function()
- {
- var measuringTabElement = this._createTabElement(true);
- this._measureElement.appendChild(measuringTabElement);
- this._measuredWidth = measuringTabElement.getBoundingClientRect().width;
- this._measureElement.removeChild(measuringTabElement);
- },
-
/**
* @param {Event} event
*/
diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js
index 77a5b39f8..dff3044b2 100644
--- a/Source/WebCore/inspector/front-end/TimelineModel.js
+++ b/Source/WebCore/inspector/front-end/TimelineModel.js
@@ -197,11 +197,16 @@ WebInspector.TimelineModel.prototype = {
function parseAndImportData(data)
{
- var records = JSON.parse(data);
- parsingProgress.done();
- this.reset();
- processingProgress.setTotalWork(records.length);
- this._loadNextChunk(processingProgress, records, 1);
+ try {
+ var records = JSON.parse(data);
+ parsingProgress.done();
+ this.reset();
+ processingProgress.setTotalWork(records.length);
+ this._loadNextChunk(processingProgress, records, 1);
+ } catch (e) {
+ WebInspector.showErrorMessage("Malformed timeline data.");
+ progress.done();
+ }
}
function onLoad(e)
@@ -216,15 +221,15 @@ WebInspector.TimelineModel.prototype = {
progress.done();
switch(e.target.error.code) {
case e.target.error.NOT_FOUND_ERR:
- WebInspector.log(WebInspector.UIString('Timeline.loadFromFile: File "%s" not found.', file.name));
+ WebInspector.showErrorMessage(WebInspector.UIString("File \"%s\" not found.", file.name));
break;
case e.target.error.NOT_READABLE_ERR:
- WebInspector.log(WebInspector.UIString('Timeline.loadFromFile: File "%s" is not readable', file.name));
+ WebInspector.showErrorMessage(WebInspector.UIString("File \"%s\" is not readable", file.name));
break;
case e.target.error.ABORT_ERR:
break;
default:
- WebInspector.log(WebInspector.UIString('Timeline.loadFromFile: An error occurred while reading the file "%s"', file.name));
+ WebInspector.showErrorMessage(WebInspector.UIString("An error occurred while reading the file \"%s\"", file.name));
}
}
@@ -243,6 +248,39 @@ WebInspector.TimelineModel.prototype = {
reader.readAsText(file);
},
+ /**
+ * @param {string} url
+ */
+ loadFromURL: function(url, progress)
+ {
+ var compositeProgress = new WebInspector.CompositeProgress(progress);
+ var loadingProgress = compositeProgress.createSubProgress(1);
+ var parsingProgress = compositeProgress.createSubProgress(1);
+ var processingProgress = compositeProgress.createSubProgress(1);
+
+ // FIXME: extract parsing routines so that they did not require too many progress objects.
+ function parseAndImportData(data)
+ {
+ try {
+ var records = JSON.parse(data);
+ parsingProgress.done();
+ this.reset();
+ processingProgress.setTotalWork(records.length);
+ this._loadNextChunk(processingProgress, records, 1);
+ } catch (e) {
+ WebInspector.showErrorMessage("Malformed timeline data.");
+ progress.done();
+ }
+ }
+
+ var responseText = loadXHR(url);
+ if (responseText) {
+ loadingProgress.done();
+ parsingProgress.setTotalWork(1);
+ setTimeout(parseAndImportData.bind(this, responseText), 0);
+ }
+ },
+
saveToFile: function()
{
var records = ['[' + JSON.stringify(new String(window.navigator.appVersion))];
diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js
index b6ec0dde9..661d6bb8c 100644
--- a/Source/WebCore/inspector/front-end/TimelinePanel.js
+++ b/Source/WebCore/inspector/front-end/TimelinePanel.js
@@ -349,8 +349,31 @@ WebInspector.TimelinePanel.prototype = {
_loadFromFile: function()
{
- if (this._operationInProgress)
+ var progressIndicator = this._prepareToLoadTimeline();
+ if (!progressIndicator)
+ return;
+ this._model.loadFromFile(this._fileSelectorElement.files[0], progressIndicator);
+ this._createFileSelector();
+ },
+
+ /**
+ * @param {string} url
+ */
+ loadFromURL: function(url)
+ {
+ var progressIndicator = this._prepareToLoadTimeline();
+ if (!progressIndicator)
return;
+ this._model.loadFromURL(url, progressIndicator);
+ },
+
+ /**
+ * @return {?WebInspector.ProgressIndicator}
+ */
+ _prepareToLoadTimeline: function()
+ {
+ if (this._operationInProgress)
+ return null;
if (this.toggleTimelineButton.toggled) {
this.toggleTimelineButton.toggled = false;
this._model.stopRecord();
@@ -358,8 +381,7 @@ WebInspector.TimelinePanel.prototype = {
var progressIndicator = new WebInspector.ProgressIndicator();
progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events.Done, this._setOperationInProgress.bind(this, null));
this._setOperationInProgress(progressIndicator);
- this._model.loadFromFile(this._fileSelectorElement.files[0], progressIndicator);
- this._createFileSelector();
+ return progressIndicator;
},
_rootRecord: function()
diff --git a/Source/WebCore/inspector/front-end/Toolbar.js b/Source/WebCore/inspector/front-end/Toolbar.js
index 9a5e4a258..9b8995c38 100644
--- a/Source/WebCore/inspector/front-end/Toolbar.js
+++ b/Source/WebCore/inspector/front-end/Toolbar.js
@@ -42,20 +42,9 @@ WebInspector.Toolbar = function()
document.getElementById("close-button-left").addEventListener("click", this._onClose, true);
document.getElementById("close-button-right").addEventListener("click", this._onClose, true);
- this._coalescingLevel = 0;
}
WebInspector.Toolbar.prototype = {
- /**
- * @param {boolean} enabled
- */
- setCoalescingUpdate: function(enabled)
- {
- this._coalescingLevel += enabled ? 1 : -1;
- if (!this._coalescingLevel)
- this._updateDropdownButtonAndHideDropdown();
- },
-
resize: function()
{
this._updateDropdownButtonAndHideDropdown();
@@ -179,8 +168,11 @@ WebInspector.Toolbar.prototype = {
_updateDropdownButtonAndHideDropdown: function()
{
- if (this._coalescingLevel)
- return;
+ WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateDropdownButtonAndHideDropdown);
+ },
+
+ _innerUpdateDropdownButtonAndHideDropdown: function()
+ {
this._setDropdownVisible(false);
var toolbar = document.getElementById("toolbar");
diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js
index 44ceb41d9..9af5070e1 100644
--- a/Source/WebCore/inspector/front-end/UIUtils.js
+++ b/Source/WebCore/inspector/front-end/UIUtils.js
@@ -1109,6 +1109,51 @@ WebInspector.populateHrefContextMenu = function(contextMenu, contextNode, event)
return true;
}
+WebInspector._coalescingLevel = 0;
+
+WebInspector.startBatchUpdate = function()
+{
+ if (!WebInspector._coalescingLevel)
+ WebInspector._postUpdateHandlers = new Map();
+ WebInspector._coalescingLevel++;
+}
+
+WebInspector.endBatchUpdate = function()
+{
+ if (--WebInspector._coalescingLevel)
+ return;
+
+ var handlers = WebInspector._postUpdateHandlers;
+ delete WebInspector._postUpdateHandlers;
+
+ var keys = handlers.keys();
+ for (var i = 0; i < keys.length; ++i) {
+ var object = keys[i];
+ var methods = handlers.get(object).keys();
+ for (var j = 0; j < methods.length; ++j)
+ methods[j].call(object);
+ }
+}
+
+/**
+ * @param {Object} object
+ * @param {function()} method
+ */
+WebInspector.invokeOnceAfterBatchUpdate = function(object, method)
+{
+ if (!WebInspector._coalescingLevel) {
+ method.call(object);
+ return;
+ }
+
+ var methods = WebInspector._postUpdateHandlers.get(object);
+ if (!methods) {
+ methods = new Map();
+ WebInspector._postUpdateHandlers.put(object, methods);
+ }
+ methods.put(method);
+}
+
;(function() {
function windowLoaded()
diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc
index dde4e13a0..bd9b15512 100644
--- a/Source/WebCore/inspector/front-end/WebKit.qrc
+++ b/Source/WebCore/inspector/front-end/WebKit.qrc
@@ -207,6 +207,7 @@
<file>Workspace.js</file>
<file>UglifyJS/parse-js.js</file>
<file>auditsPanel.css</file>
+ <file>breadcrumbList.css</file>
<file>dataGrid.css</file>
<file>cmdevtools.css</file>
<file>dialog.css</file>
diff --git a/Source/WebCore/inspector/front-end/breadcrumbList.css b/Source/WebCore/inspector/front-end/breadcrumbList.css
new file mode 100644
index 000000000..752f96906
--- /dev/null
+++ b/Source/WebCore/inspector/front-end/breadcrumbList.css
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * 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.
+ * 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
+ * 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.
+ */
+
+.crumbs {
+ display: inline-block;
+ pointer-events: auto;
+ cursor: default;
+ font-size: 11px;
+ line-height: 19px;
+ text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+ color: rgb(20, 20, 20);
+ margin-left: -1px;
+ margin-top: -1px;
+ padding-right: 12px;
+}
+
+.crumbs .crumb {
+ height: 24px;
+ border-width: 0 12px 0 2px;
+ -webkit-border-image: url(Images/segment.png) 0 12 0 2;
+ margin-right: -12px;
+ padding-left: 18px;
+ padding-right: 2px;
+ white-space: nowrap;
+ line-height: 23px;
+ float: right;
+}
+
+.crumbs .crumb.collapsed > * {
+ display: none;
+}
+
+.crumbs .crumb.collapsed::before {
+ content: "\2026";
+ font-weight: bold;
+}
+
+.crumbs .crumb.compact .extra {
+ display: none;
+}
+
+.crumbs .crumb.dimmed {
+ color: rgba(0, 0, 0, 0.45);
+}
+
+.crumbs .crumb.start {
+ padding-left: 7px;
+}
+
+.crumbs .crumb.end {
+ border-width: 0 2px 0 2px;
+ padding-right: 6px;
+ -webkit-border-image: url(Images/segmentEnd.png) 0 2 0 2;
+}
+
+.crumbs .crumb.selected {
+ -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
+ color: black;
+ text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+}
+
+.crumbs .crumb.selected:hover {
+ -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
+}
+
+.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
+ -webkit-border-image: url(Images/segmentSelectedEnd.png) 0 2 0 2;
+}
+
+.crumbs .crumb:hover {
+ -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
+ color: black;
+}
+
+.crumbs .crumb.dimmed:hover {
+ -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
+ color: rgba(0, 0, 0, 0.75);
+}
+
+.crumbs .crumb.end:hover {
+ -webkit-border-image: url(Images/segmentHoverEnd.png) 0 2 0 2;
+}
diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css
index 7389a8dab..eb102cbde 100644
--- a/Source/WebCore/inspector/front-end/elementsPanel.css
+++ b/Source/WebCore/inspector/front-end/elementsPanel.css
@@ -59,86 +59,6 @@
-webkit-user-modify: read-write-plaintext-only;
}
-.crumbs {
- display: inline-block;
- pointer-events: auto;
- cursor: default;
- font-size: 11px;
- line-height: 19px;
- text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
- color: rgb(20, 20, 20);
- margin-left: -1px;
- margin-top: -1px;
- padding-right: 12px;
-}
-
-.crumbs .crumb {
- height: 24px;
- border-width: 0 12px 0 2px;
- -webkit-border-image: url(Images/segment.png) 0 12 0 2;
- margin-right: -12px;
- padding-left: 18px;
- padding-right: 2px;
- white-space: nowrap;
- line-height: 23px;
- float: right;
-}
-
-.crumbs .crumb.collapsed > * {
- display: none;
-}
-
-.crumbs .crumb.collapsed::before {
- content: "\2026";
- font-weight: bold;
-}
-
-.crumbs .crumb.compact .extra {
- display: none;
-}
-
-.crumbs .crumb.dimmed {
- color: rgba(0, 0, 0, 0.45);
-}
-
-.crumbs .crumb.start {
- padding-left: 7px;
-}
-
-.crumbs .crumb.end {
- border-width: 0 2px 0 2px;
- padding-right: 6px;
- -webkit-border-image: url(Images/segmentEnd.png) 0 2 0 2;
-}
-
-.crumbs .crumb.selected {
- -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
- color: black;
- text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-}
-
-.crumbs .crumb.selected:hover {
- -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
-}
-
-.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
- -webkit-border-image: url(Images/segmentSelectedEnd.png) 0 2 0 2;
-}
-
-.crumbs .crumb:hover {
- -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
- color: black;
-}
-
-.crumbs .crumb.dimmed:hover {
- -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
- color: rgba(0, 0, 0, 0.75);
-}
-
-.crumbs .crumb.end:hover {
- -webkit-border-image: url(Images/segmentHoverEnd.png) 0 2 0 2;
-}
-
.metrics {
padding: 8px;
font-size: 10px;
diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js
index ac508bf70..92b877ed1 100644
--- a/Source/WebCore/inspector/front-end/externs.js
+++ b/Source/WebCore/inspector/front-end/externs.js
@@ -142,6 +142,8 @@ WebInspector.closeViewInDrawer = function() {}
*/
WebInspector.log = function(message, messageLevel, showConsole) {}
+WebInspector.showErrorMessage = function(error) {}
+
WebInspector.addMainEventListeners = function(doc) {}
WebInspector.openResource = function(url, external) {}
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index 91ee54f03..5160cec8a 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -56,7 +56,7 @@ var WebInspector = {
return panelDescriptors;
}
var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
- var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
+ var hiddenPanels = InspectorFrontendHost.hiddenPanels();
for (var i = 0; i < allDescriptors.length; ++i) {
if (hiddenPanels.indexOf(allDescriptors[i].name) === -1)
panelDescriptors.push(allDescriptors[i]);
@@ -433,7 +433,14 @@ WebInspector.loaded = function()
}
return;
}
+
WebInspector.doLoadedDone();
+
+ // In case of loading as a web page with no bindings / harness, kick off initialization manually.
+ if (InspectorFrontendHost.isStub) {
+ InspectorFrontendAPI.dispatchQueryParameters();
+ WebInspector._doLoadedDoneWithCapabilities();
+ }
}
WebInspector.doLoadedDone = function()
@@ -458,8 +465,6 @@ WebInspector.doLoadedDone = function()
PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null));
PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", null));
PageAgent.canOverrideDeviceOrientation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceOrientation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
- if ("debugLoad" in WebInspector.queryParamsObject)
- WebInspector._doLoadedDoneWithCapabilities();
}
WebInspector._doLoadedDoneWithCapabilities = function()
@@ -522,11 +527,11 @@ WebInspector._doLoadedDoneWithCapabilities = function()
WebInspector._installDockToRight();
this.toolbar = new WebInspector.Toolbar();
- this.toolbar.setCoalescingUpdate(true);
+ WebInspector.startBatchUpdate();
var panelDescriptors = this._panelDescriptors();
for (var i = 0; i < panelDescriptors.length; ++i)
WebInspector.inspectorView.addPanel(panelDescriptors[i]);
- this.toolbar.setCoalescingUpdate(false);
+ WebInspector.endBatchUpdate();
this.addMainEventListeners(document);
WebInspector.registerLinkifierPlugin(this._profilesLinkifier.bind(this));
@@ -993,6 +998,11 @@ WebInspector.log = function(message, messageLevel, showConsole)
logMessage(message);
}
+WebInspector.showErrorMessage = function(error)
+{
+ WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
+}
+
WebInspector.inspect = function(payload, hints)
{
var object = WebInspector.RemoteObject.fromPayload(payload);
diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js
index f215ce157..bba9a95a4 100644
--- a/Source/WebCore/inspector/front-end/utilities.js
+++ b/Source/WebCore/inspector/front-end/utilities.js
@@ -690,42 +690,91 @@ Map.prototype = {
objectIdentifier = ++Map._lastObjectIdentifier;
key.__identifier = objectIdentifier;
}
- this._map[objectIdentifier] = value;
+ this._map[objectIdentifier] = [key, value];
},
/**
* @param {Object} key
- * @return {Object} value
*/
remove: function(key)
{
var result = this._map[key.__identifier];
delete this._map[key.__identifier];
- return result;
+ return result ? result[1] : undefined;
},
-
+
+ /**
+ * @return {Array.<Object>}
+ */
+ keys: function()
+ {
+ return this._list(0);
+ },
+
values: function()
{
+ return this._list(1);
+ },
+
+ /**
+ * @param {number} index
+ */
+ _list: function(index)
+ {
var result = [];
for (var objectIdentifier in this._map)
- result.push(this._map[objectIdentifier]);
+ result.push(this._map[objectIdentifier][index]);
return result;
},
-
+
/**
* @param {Object} key
*/
get: function(key)
{
- return this._map[key.__identifier];
+ var entry = this._map[key.__identifier];
+ return entry ? entry[1] : undefined;
},
clear: function()
{
this._map = {};
}
-};
+}
+/**
+ * @param {string} url
+ * @param {boolean=} async
+ * @param {function(?string)=} callback
+ * @return {?string}
+ */
+function loadXHR(url, async, callback)
+{
+ function onReadyStateChanged()
+ {
+ if (xhr.readyState !== XMLHttpRequest.DONE)
+ return;
+
+ if (xhr.status === 200) {
+ callback(xhr.responseText);
+ return;
+ }
+
+ callback(null);
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", url, async);
+ if (async)
+ xhr.onreadystatechange = onReadyStateChanged;
+ xhr.send(null);
+ if (!async) {
+ if (xhr.status === 200)
+ return xhr.responseText;
+ return null;
+ }
+ return null;
+}
/**
* @constructor
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index 3be9bb653..ea69bf52f 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -364,8 +364,8 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addInstrumentedHashSet(m_multipartSubresourceLoaders);
info.addInstrumentedHashSet(m_plugInStreamLoaders);
info.addInstrumentedMember(m_substituteData);
- info.addMember(m_pageTitle.string());
- info.addMember(m_overrideEncoding);
+ info.addInstrumentedMember(m_pageTitle.string());
+ info.addInstrumentedMember(m_overrideEncoding);
info.addVector(m_responses);
info.addInstrumentedMember(m_originalRequest);
info.addInstrumentedMember(m_originalRequestCopy);
@@ -376,7 +376,7 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addHashMap(m_pendingSubstituteResources);
info.addInstrumentedHashSet(m_resourcesClientKnowsAbout);
info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
- info.addMember(m_clientRedirectSourceForHistory);
+ info.addInstrumentedMember(m_clientRedirectSourceForHistory);
info.addInstrumentedMember(m_mainResourceData);
}
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 23e9b6cc9..ca9ff0947 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -3236,10 +3236,10 @@ NetworkingContext* FrameLoader::networkingContext() const
void FrameLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
- info.addInstrumentedMember(m_documentLoader.get());
- info.addInstrumentedMember(m_provisionalDocumentLoader.get());
- info.addInstrumentedMember(m_policyDocumentLoader.get());
- info.addMember(m_outgoingReferrer);
+ info.addInstrumentedMember(m_documentLoader);
+ info.addInstrumentedMember(m_provisionalDocumentLoader);
+ info.addInstrumentedMember(m_policyDocumentLoader);
+ info.addInstrumentedMember(m_outgoingReferrer);
info.addInstrumentedHashSet(m_openedFrames);
}
diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp
index e897f8a4e..8745346da 100644
--- a/Source/WebCore/loader/ImageLoader.cpp
+++ b/Source/WebCore/loader/ImageLoader.cpp
@@ -197,8 +197,14 @@ void ImageLoader::updateFromElement()
newImage = document()->cachedResourceLoader()->requestImage(request);
// If we do not have an image here, it means that a cross-site
- // violation occurred.
- m_failedLoadURL = !newImage ? attr : AtomicString();
+ // violation occurred, or that the image was blocked via Content
+ // Security Policy. Either way, trigger an error event.
+ if (!newImage) {
+ m_failedLoadURL = attr;
+ m_hasPendingErrorEvent = true;
+ errorEventSender().dispatchEventSoon(this);
+ } else
+ m_failedLoadURL = AtomicString();
} else if (!attr.isNull()) {
// Fire an error event if the url is empty.
// FIXME: Should we fire this event asynchronoulsy via errorEventSender()?
diff --git a/Source/WebCore/loader/SubstituteData.cpp b/Source/WebCore/loader/SubstituteData.cpp
index 806bd1d8e..a269c3498 100644
--- a/Source/WebCore/loader/SubstituteData.cpp
+++ b/Source/WebCore/loader/SubstituteData.cpp
@@ -39,10 +39,10 @@ void SubstituteData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
info.addInstrumentedMember(m_content);
- info.addMember(m_mimeType);
- info.addMember(m_textEncoding);
- info.addMember(m_failingURL);
- info.addMember(m_responseURL);
+ info.addInstrumentedMember(m_mimeType);
+ info.addInstrumentedMember(m_textEncoding);
+ info.addInstrumentedMember(m_failingURL);
+ info.addInstrumentedMember(m_responseURL);
}
}
diff --git a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
index 7e44ebc28..498d2fa57 100644
--- a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
+++ b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
@@ -208,7 +208,7 @@ void CachedCSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
CachedResource::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_decoder);
info.addInstrumentedMember(m_parsedStyleSheetCache);
- info.addMember(m_decodedSheetText);
+ info.addInstrumentedMember(m_decodedSheetText);
}
}
diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp
index c619ddad6..d7abcae84 100755
--- a/Source/WebCore/loader/cache/CachedResource.cpp
+++ b/Source/WebCore/loader/cache/CachedResource.cpp
@@ -806,11 +806,11 @@ void CachedResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResource);
info.addMember(m_resourceRequest);
info.addHashSet(m_clients);
- info.addMember(m_accept);
+ info.addInstrumentedMember(m_accept);
info.addInstrumentedMember(m_loader);
- info.addMember(m_response);
+ info.addInstrumentedMember(m_response);
info.addInstrumentedMember(m_data);
- info.addMember(m_cachedMetadata.get());
+ info.addMember(m_cachedMetadata);
info.addInstrumentedMember(m_nextInAllResourcesList);
info.addInstrumentedMember(m_prevInAllResourcesList);
info.addInstrumentedMember(m_nextInLiveResourcesList);
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 7b5646538..b258c057f 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -883,7 +883,7 @@ void CachedResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
info.addHashMap(m_documentResources);
for (DocumentResourceMap::const_iterator i = m_documentResources.begin(); i != m_documentResources.end(); ++i) {
- info.addMember(i->first);
+ info.addInstrumentedMember(i->first);
info.addInstrumentedMember(i->second);
}
info.addHashSet(m_validatedURLs);
diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp
index 7e7f26905..12c9fe573 100644
--- a/Source/WebCore/loader/cache/CachedScript.cpp
+++ b/Source/WebCore/loader/cache/CachedScript.cpp
@@ -131,7 +131,7 @@ void CachedScript::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceScript);
CachedResource::reportMemoryUsage(memoryObjectInfo);
- info.addMember(m_script);
+ info.addInstrumentedMember(m_script);
info.addMember(m_decoder);
#if USE(JSC)
info.addMember(m_sourceProviderCache);
diff --git a/Source/WebCore/loader/cache/CachedShader.cpp b/Source/WebCore/loader/cache/CachedShader.cpp
index 72eb5c053..a31abd050 100644
--- a/Source/WebCore/loader/cache/CachedShader.cpp
+++ b/Source/WebCore/loader/cache/CachedShader.cpp
@@ -73,7 +73,7 @@ void CachedShader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceShader);
CachedResource::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_decoder);
- info.addMember(m_shaderString);
+ info.addInstrumentedMember(m_shaderString);
}
} // namespace WebCore
diff --git a/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp b/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
index d14d5f2a3..0e771618b 100644
--- a/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
+++ b/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
@@ -101,7 +101,7 @@ void CachedXSLStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceXSLT);
CachedResource::reportMemoryUsage(memoryObjectInfo);
- info.addMember(m_sheet);
+ info.addInstrumentedMember(m_sheet);
info.addMember(m_decoder);
}
diff --git a/Source/WebCore/loader/cache/MemoryCache.cpp b/Source/WebCore/loader/cache/MemoryCache.cpp
index 50f45cd12..66111d73f 100644
--- a/Source/WebCore/loader/cache/MemoryCache.cpp
+++ b/Source/WebCore/loader/cache/MemoryCache.cpp
@@ -721,7 +721,7 @@ void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addHashMap(m_resources);
CachedResourceMap::const_iterator e = m_resources.end();
for (CachedResourceMap::const_iterator i = m_resources.begin(); i != e; ++i) {
- info.addMember(i->first);
+ info.addInstrumentedMember(i->first);
info.addInstrumentedMember(i->second);
}
info.addVector(m_allResources);
diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp
index 42fe2c135..ddf2ab563 100644
--- a/Source/WebCore/page/TouchAdjustment.cpp
+++ b/Source/WebCore/page/TouchAdjustment.cpp
@@ -35,7 +35,10 @@
#include "RenderBox.h"
#include "RenderObject.h"
#include "RenderStyle.h"
+#include "RenderText.h"
#include "ShadowRoot.h"
+#include "Text.h"
+#include "TextBreakIterator.h"
namespace WebCore {
@@ -62,6 +65,7 @@ private:
typedef Vector<SubtargetGeometry> SubtargetGeometryList;
typedef bool (*NodeFilter)(Node*);
+typedef void (*AppendSubtargetsForNode)(Node*, SubtargetGeometryList&);
typedef float (*DistanceFunction)(const IntPoint&, const IntRect&, const SubtargetGeometry&);
// Takes non-const Node* because isContentEditable is a non-const function.
@@ -101,20 +105,26 @@ bool providesContextMenuItems(Node* node)
if (node->renderer()->isMedia())
return true;
if (node->renderer()->canBeSelectionLeaf()) {
- // If the context menu gesture will trigger a selection all selectable nodes are targets.
- // FIXME: To improve the adjusted point, each individual word should be a separate subtarget,
- // see for example FatFingers::checkForText() in WebKit/blackberry.
+ // If the context menu gesture will trigger a selection all selectable nodes are valid targets.
if (node->renderer()->frame()->editor()->behavior().shouldSelectOnContextualMenuClick())
return true;
- // FIXME: A selected text might only be partially selected, and we should only append
- // the selected subtargets of it in appendSubtargetsForNodeToList().
+ // Only the selected part of the renderer is a valid target, but this will be corrected in
+ // appendContextSubtargetsForNode.
if (node->renderer()->selectionState() != RenderObject::SelectionNone)
return true;
}
return false;
}
-static inline void appendSubtargetsForNodeToList(Node* node, SubtargetGeometryList& subtargets)
+static inline void appendQuadsToSubtargetList(Vector<FloatQuad>& quads, Node* node, SubtargetGeometryList& subtargets)
+{
+ Vector<FloatQuad>::const_iterator it = quads.begin();
+ const Vector<FloatQuad>::const_iterator end = quads.end();
+ for (; it != end; ++it)
+ subtargets.append(SubtargetGeometry(node, *it));
+}
+
+static inline void appendBasicSubtargetsForNode(Node* node, SubtargetGeometryList& subtargets)
{
// Since the node is a result of a hit test, we are already ensured it has a renderer.
ASSERT(node->renderer());
@@ -122,10 +132,66 @@ static inline void appendSubtargetsForNodeToList(Node* node, SubtargetGeometryLi
Vector<FloatQuad> quads;
node->renderer()->absoluteQuads(quads);
- Vector<FloatQuad>::const_iterator it = quads.begin();
- const Vector<FloatQuad>::const_iterator end = quads.end();
- for (; it != end; ++it)
- subtargets.append(SubtargetGeometry(node, *it));
+ appendQuadsToSubtargetList(quads, node, subtargets);
+}
+
+static inline void appendContextSubtargetsForNode(Node* node, SubtargetGeometryList& subtargets)
+{
+ // This is a variant of appendBasicSubtargetsForNode that adds special subtargets for
+ // selected or auto-selectable parts of text nodes.
+ ASSERT(node->renderer());
+
+ if (!node->isTextNode())
+ return appendBasicSubtargetsForNode(node, subtargets);
+
+ Text* textNode = static_cast<WebCore::Text*>(node);
+ RenderText* textRenderer = static_cast<RenderText*>(textNode->renderer());
+
+ if (textRenderer->frame()->editor()->behavior().shouldSelectOnContextualMenuClick()) {
+ // Make subtargets out of every word.
+ String textValue = textNode->data();
+ TextBreakIterator* wordIterator = wordBreakIterator(textValue.characters(), textValue.length());
+ int lastOffset = textBreakFirst(wordIterator);
+ if (lastOffset == -1)
+ return;
+ int offset;
+ while ((offset = textBreakNext(wordIterator)) != -1) {
+ if (isWordTextBreak(wordIterator)) {
+ Vector<FloatQuad> quads;
+ textRenderer->absoluteQuadsForRange(quads, lastOffset, offset);
+ appendQuadsToSubtargetList(quads, textNode, subtargets);
+ }
+ lastOffset = offset;
+ }
+ } else {
+ if (textRenderer->selectionState() == RenderObject::SelectionNone)
+ return appendBasicSubtargetsForNode(node, subtargets);
+ // If selected, make subtargets out of only the selected part of the text.
+ int startPos, endPos;
+ switch (textRenderer->selectionState()) {
+ case RenderObject::SelectionInside:
+ startPos = 0;
+ endPos = textRenderer->textLength();
+ break;
+ case RenderObject::SelectionStart:
+ textRenderer->selectionStartEnd(startPos, endPos);
+ endPos = textRenderer->textLength();
+ break;
+ case RenderObject::SelectionEnd:
+ textRenderer->selectionStartEnd(startPos, endPos);
+ startPos = 0;
+ break;
+ case RenderObject::SelectionBoth:
+ textRenderer->selectionStartEnd(startPos, endPos);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ Vector<FloatQuad> quads;
+ textRenderer->absoluteQuadsForRange(quads, startPos, endPos);
+ appendQuadsToSubtargetList(quads, textNode, subtargets);
+ }
}
static inline void appendZoomableSubtargets(Node* node, SubtargetGeometryList& subtargets)
@@ -148,7 +214,7 @@ static inline void appendZoomableSubtargets(Node* node, SubtargetGeometryList& s
}
// Compiles a list of subtargets of all the relevant target nodes.
-void compileSubtargetList(const NodeList& intersectedNodes, SubtargetGeometryList& subtargets, NodeFilter nodeFilter)
+void compileSubtargetList(const NodeList& intersectedNodes, SubtargetGeometryList& subtargets, NodeFilter nodeFilter, AppendSubtargetsForNode appendSubtargetsForNode)
{
// Find candidates responding to tap gesture events in O(n) time.
HashMap<Node*, Node*> responderMap;
@@ -201,7 +267,7 @@ void compileSubtargetList(const NodeList& intersectedNodes, SubtargetGeometryLis
ASSERT(respondingNode);
if (ancestorsToRespondersSet.contains(respondingNode))
continue;
- appendSubtargetsForNodeToList(candidate, subtargets);
+ appendSubtargetsForNode(candidate, subtargets);
}
}
@@ -408,7 +474,7 @@ bool findBestClickableCandidate(Node*& targetNode, IntPoint &targetPoint, const
{
IntRect targetArea;
TouchAdjustment::SubtargetGeometryList subtargets;
- TouchAdjustment::compileSubtargetList(nodeList, subtargets, TouchAdjustment::nodeRespondsToTapGesture);
+ TouchAdjustment::compileSubtargetList(nodeList, subtargets, TouchAdjustment::nodeRespondsToTapGesture, TouchAdjustment::appendBasicSubtargetsForNode);
return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::hybridDistanceFunction);
}
@@ -416,7 +482,7 @@ bool findBestContextMenuCandidate(Node*& targetNode, IntPoint &targetPoint, cons
{
IntRect targetArea;
TouchAdjustment::SubtargetGeometryList subtargets;
- TouchAdjustment::compileSubtargetList(nodeList, subtargets, TouchAdjustment::providesContextMenuItems);
+ TouchAdjustment::compileSubtargetList(nodeList, subtargets, TouchAdjustment::providesContextMenuItems, TouchAdjustment::appendContextSubtargetsForNode);
return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::hybridDistanceFunction);
}
diff --git a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp b/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
index e256bde1a..1db759404 100644
--- a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
+++ b/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
@@ -29,12 +29,12 @@
#include "Frame.h"
#include "FrameView.h"
-#include "Page.h"
#include "Region.h"
#include "RenderLayerCompositor.h"
#include "RenderView.h"
#include "ScrollbarThemeComposite.h"
#include "WebScrollbarThemeGeometryNative.h"
+#include <public/WebScrollableLayer.h>
#include <public/WebScrollbar.h>
#include <public/WebScrollbarLayer.h>
#include <public/WebScrollbarThemeGeometry.h>
@@ -42,6 +42,7 @@
using WebKit::WebLayer;
using WebKit::WebRect;
+using WebKit::WebScrollableLayer;
using WebKit::WebScrollbarLayer;
using WebKit::WebVector;
@@ -50,39 +51,36 @@ namespace WebCore {
class ScrollingCoordinatorPrivate {
WTF_MAKE_NONCOPYABLE(ScrollingCoordinatorPrivate);
public:
- ScrollingCoordinatorPrivate()
- : m_scrollLayer(0)
- {
- }
-
+ ScrollingCoordinatorPrivate() { }
~ScrollingCoordinatorPrivate() { }
- void setScrollLayer(WebLayer* layer)
+ void setScrollLayer(WebScrollableLayer layer)
{
m_scrollLayer = layer;
- if (m_horizontalScrollbarLayer)
- m_horizontalScrollbarLayer->setScrollLayer(layer);
- if (m_verticalScrollbarLayer)
- m_verticalScrollbarLayer->setScrollLayer(layer);
+ if (!m_horizontalScrollbarLayer.isNull())
+ m_horizontalScrollbarLayer.setScrollLayer(layer);
+ if (!m_verticalScrollbarLayer.isNull())
+ m_verticalScrollbarLayer.setScrollLayer(layer);
}
- void setHorizontalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
+ void setHorizontalScrollbarLayer(WebScrollbarLayer layer)
{
m_horizontalScrollbarLayer = layer;
}
- void setVerticalScrollbarLayer(PassOwnPtr<WebScrollbarLayer> layer)
+ void setVerticalScrollbarLayer(WebScrollbarLayer layer)
{
m_verticalScrollbarLayer = layer;
}
- WebLayer* scrollLayer() const { return m_scrollLayer; }
+ bool hasScrollLayer() const { return !m_scrollLayer.isNull(); }
+ WebScrollableLayer scrollLayer() const { return m_scrollLayer; }
private:
- WebLayer* m_scrollLayer;
- OwnPtr<WebScrollbarLayer> m_horizontalScrollbarLayer;
- OwnPtr<WebScrollbarLayer> m_verticalScrollbarLayer;
+ WebScrollableLayer m_scrollLayer;
+ WebScrollbarLayer m_horizontalScrollbarLayer;
+ WebScrollbarLayer m_verticalScrollbarLayer;
};
PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page)
@@ -114,20 +112,15 @@ static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView)
#endif
}
-static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer)
-{
- return layer->platformLayer();
-}
-
-static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
+static WebScrollbarLayer createScrollbarLayer(Scrollbar* scrollbar, WebScrollableLayer scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView)
{
ASSERT(scrollbar);
ASSERT(scrollbarGraphicsLayer);
- if (!scrollLayer) {
+ if (scrollLayer.isNull()) {
// FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves.
- scrollLayer = scrollableLayerForGraphicsLayer(scrollLayerForFrameView(frameView));
- ASSERT(scrollLayer);
+ scrollLayer = scrollLayerForFrameView(frameView)->platformLayer()->to<WebScrollableLayer>();
+ ASSERT(!scrollLayer.isNull());
}
// Root layer non-overlay scrollbars should be marked opaque to disable
@@ -145,7 +138,7 @@ static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar,
if (!platformSupported || scrollbar->isCustomScrollbar()) {
scrollbarGraphicsLayer->setContentsToMedia(0);
scrollbarGraphicsLayer->setDrawsContent(true);
- return nullptr;
+ return WebScrollbarLayer();
}
// All Chromium scrollbar themes derive from ScrollbarThemeComposite.
@@ -153,14 +146,14 @@ static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar,
WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar);
OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite));
- OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebScrollbarLayer::create(scrollbar, painter, geometry.release()));
- scrollbarLayer->setScrollLayer(scrollLayer);
+ WebScrollbarLayer scrollbarLayer = WebScrollbarLayer::create(scrollbar, painter, geometry.release());
+ scrollbarLayer.setScrollLayer(scrollLayer);
- scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer());
+ scrollbarGraphicsLayer->setContentsToMedia(&scrollbarLayer);
scrollbarGraphicsLayer->setDrawsContent(false);
- scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque());
+ scrollbarLayer.setOpaque(scrollbarGraphicsLayer->contentsOpaque());
- return scrollbarLayer.release();
+ return scrollbarLayer;
}
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer)
@@ -168,7 +161,6 @@ void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*
if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
return;
- setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView));
}
@@ -177,25 +169,25 @@ void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* f
if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView))
return;
- setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView));
}
void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer)
{
- m_private->setScrollLayer(scrollLayer ? scrollableLayerForGraphicsLayer(scrollLayer) : 0);
+ WebScrollableLayer layer;
+ if (scrollLayer)
+ layer = scrollLayer->platformLayer()->to<WebScrollableLayer>();
+ m_private->setScrollLayer(layer);
}
void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region)
{
- // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
- setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
- if (m_private->scrollLayer()) {
+ if (m_private->hasScrollLayer()) {
Vector<IntRect> rects = region.rects();
WebVector<WebRect> webRects(rects.size());
for (size_t i = 0; i < rects.size(); ++i)
webRects[i] = rects[i];
- m_private->scrollLayer()->setNonFastScrollableRegion(webRects);
+ m_private->scrollLayer().setNonFastScrollableRegion(webRects);
}
}
@@ -206,18 +198,14 @@ void ScrollingCoordinator::setScrollParameters(const ScrollParameters&)
void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
{
- // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
- setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
- if (m_private->scrollLayer())
- m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
+ if (m_private->hasScrollLayer())
+ m_private->scrollLayer().setHaveWheelEventHandlers(wheelEventHandlerCount > 0);
}
void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(bool should)
{
- // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves.
- setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view()));
- if (m_private->scrollLayer())
- m_private->scrollLayer()->setShouldScrollOnMainThread(should);
+ if (m_private->hasScrollLayer())
+ m_private->scrollLayer().setShouldScrollOnMainThread(should);
}
bool ScrollingCoordinator::supportsFixedPositionLayers() const
@@ -227,14 +215,14 @@ bool ScrollingCoordinator::supportsFixedPositionLayers() const
void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable)
{
- if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
- scrollableLayer->setIsContainerForFixedPositionLayers(enable);
+ if (WebLayer* platformLayer = layer->platformLayer())
+ platformLayer->to<WebScrollableLayer>().setIsContainerForFixedPositionLayers(enable);
}
void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable)
{
- if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer))
- scrollableLayer->setFixedToContainerLayer(enable);
+ if (WebLayer* platformLayer = layer->platformLayer())
+ platformLayer->to<WebScrollableLayer>().setFixedToContainerLayer(enable);
}
}
diff --git a/Source/WebCore/page/win/EventHandlerWin.cpp b/Source/WebCore/page/win/EventHandlerWin.cpp
index 9393efa55..e391b7765 100644
--- a/Source/WebCore/page/win/EventHandlerWin.cpp
+++ b/Source/WebCore/page/win/EventHandlerWin.cpp
@@ -51,7 +51,9 @@
namespace WebCore {
+#if ENABLE(DRAG_SUPPORT)
const double EventHandler::TextDragDelay = 0.0;
+#endif
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
{
@@ -61,8 +63,10 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
{
+#if ENABLE(DRAG_SUPPORT)
if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe)
return false;
+#endif
subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
return true;
}
@@ -91,6 +95,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
return event.didActivateWebView();
}
+#if ENABLE(DRAG_SUPPORT)
PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
#if OS(WINCE)
@@ -101,6 +106,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
return ClipboardWin::create(Clipboard::DragAndDrop, dataObject.get(), ClipboardWritable, m_frame);
#endif
}
+#endif
void EventHandler::focusDocumentView()
{
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp
index 42e308bb5..312233573 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp
@@ -406,6 +406,7 @@ void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
m_private->setPrivateBrowsingMode(m_privateBrowsing);
m_private->setPreload(m_preload);
m_private->setPreservesPitch(preservesPitch());
+ m_private->setRate(m_rate);
if (m_shouldPrepareToRender)
m_private->prepareForRendering();
}
@@ -619,6 +620,9 @@ float MediaPlayer::volume() const
void MediaPlayer::setVolume(float volume)
{
+ if (volume == m_volume)
+ return;
+
m_volume = volume;
if (m_private->supportsMuting() || !m_muted)
@@ -632,6 +636,9 @@ bool MediaPlayer::muted() const
void MediaPlayer::setMuted(bool muted)
{
+ if (muted == m_muted)
+ return;
+
m_muted = muted;
if (m_private->supportsMuting())
@@ -668,6 +675,9 @@ bool MediaPlayer::preservesPitch() const
void MediaPlayer::setPreservesPitch(bool preservesPitch)
{
+ if (preservesPitch == m_preservesPitch)
+ return;
+
m_preservesPitch = preservesPitch;
m_private->setPreservesPitch(preservesPitch);
}
@@ -693,7 +703,10 @@ bool MediaPlayer::didLoadingProgress()
}
void MediaPlayer::setSize(const IntSize& size)
-{
+{
+ if (size == m_size)
+ return;
+
m_size = size;
m_private->setSize(size);
}
@@ -705,6 +718,9 @@ bool MediaPlayer::visible() const
void MediaPlayer::setVisible(bool b)
{
+ if (b == m_visible)
+ return;
+
m_visible = b;
m_private->setVisible(b);
}
@@ -716,6 +732,9 @@ MediaPlayer::Preload MediaPlayer::preload() const
void MediaPlayer::setPreload(MediaPlayer::Preload preload)
{
+ if (preload == m_preload)
+ return;
+
m_preload = preload;
m_private->setPreload(preload);
}
diff --git a/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp
index 19d2673d6..b85afc345 100644
--- a/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp
+++ b/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp
@@ -77,7 +77,7 @@ void DisplayRefreshMonitor::displayLinkFired()
if (!m_mutex.tryLock())
return;
- if (!m_scheduled || !m_previousFrameDone) {
+ if (!m_previousFrameDone) {
m_mutex.unlock();
return;
}
diff --git a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp
index 34b5037fa..8c5b72458 100644
--- a/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp
+++ b/Source/WebCore/platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp
@@ -257,6 +257,7 @@ void EGLImageLayerWebKitThread::blitToFrontBuffer(unsigned backBufferTexture)
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glUseProgram(m_shader);
glBindTexture(GL_TEXTURE_2D, backBufferTexture);
+ glColorMask(true, true, true, true);
{
GLES2ContextState::VertexAttributeStateSaver vertexAttribStateSaver;
diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
index dc445a51a..425681805 100644
--- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
+++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
@@ -30,6 +30,8 @@
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
#include "HostWindow.h"
+#include "MediaStreamDescriptor.h"
+#include "MediaStreamRegistry.h"
#include "NotImplemented.h"
#include "PlatformContextSkia.h"
#include "ProtectionSpace.h"
@@ -783,6 +785,33 @@ int MediaPlayerPrivate::showErrorDialog(PlatformPlayer::Error type)
return rc;
}
+static WebMediaStreamSource toWebMediaStreamSource(MediaStreamSource* src)
+{
+ return WebMediaStreamSource(src->id().utf8().data(), static_cast<WebMediaStreamSource::Type>(src->type()), src->name().utf8().data());
+}
+
+static WebMediaStreamDescriptor toWebMediaStreamDescriptor(MediaStreamDescriptor* d)
+{
+ vector<WebMediaStreamSource> audioSources;
+ for (size_t i = 0; i < d->numberOfAudioComponents(); i++)
+ audioSources.push_back(toWebMediaStreamSource(d->audioComponent(i)->source()));
+
+ vector<WebMediaStreamSource> videoSources;
+ for (size_t i = 0; i < d->numberOfVideoComponents(); i++)
+ videoSources.push_back(toWebMediaStreamSource(d->videoComponent(i)->source()));
+
+ return WebMediaStreamDescriptor(d->label().utf8().data(), audioSources, videoSources);
+}
+
+WebMediaStreamDescriptor MediaPlayerPrivate::lookupMediaStream(const string& url)
+{
+ MediaStreamDescriptor* descriptor = MediaStreamRegistry::registry().lookupMediaStreamDescriptor(String::fromUTF8(url.c_str()));
+ if (!descriptor)
+ return WebMediaStreamDescriptor();
+
+ return toWebMediaStreamDescriptor(descriptor);
+}
+
FrameView* MediaPlayerPrivate::frameView() const
{
// We previously used m_webCorePlayer->frameView(), but this method returns
diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
index 63bfdd481..c378bf68a 100644
--- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
+++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
@@ -138,6 +138,7 @@ public:
virtual bool isTabVisible() const;
virtual int showErrorDialog(BlackBerry::Platform::PlatformPlayer::Error);
virtual BlackBerry::Platform::Graphics::Window* platformWindow();
+ virtual BlackBerry::Platform::WebMediaStreamDescriptor lookupMediaStream(const std::string& url);
private:
MediaPlayerPrivate(MediaPlayer*);
diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
index 10654312c..db517cad2 100644
--- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
+++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
@@ -69,21 +69,22 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context,
grContext->resetContext();
}
- m_layer = adoptPtr(WebExternalTextureLayer::create(this));
- m_layer->setTextureId(textureId);
- m_layer->setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
+ m_layer = WebExternalTextureLayer::create(this);
+ m_layer.setTextureId(textureId);
+ m_layer.setRateLimitContext(!WebKit::WebCompositor::threadingEnabled() || m_useDoubleBuffering);
}
Canvas2DLayerBridge::~Canvas2DLayerBridge()
{
if (SkDeferredCanvas* deferred = deferredCanvas())
deferred->setNotificationClient(0);
- m_layer->setTextureId(0);
+ m_layer.setTextureId(0);
if (m_useDoubleBuffering) {
m_context->makeContextCurrent();
GLC(m_context.get(), m_context->deleteTexture(m_frontBufferTexture));
m_context->flush();
}
+ m_layer.clearClient();
}
SkDeferredCanvas* Canvas2DLayerBridge::deferredCanvas()
@@ -97,7 +98,7 @@ void Canvas2DLayerBridge::prepareForDraw()
{
ASSERT(deferredCanvas());
if (!m_useDoubleBuffering)
- m_layer->willModifyTexture();
+ m_layer.willModifyTexture();
m_context->makeContextCurrent();
}
@@ -147,13 +148,13 @@ WebGraphicsContext3D* Canvas2DLayerBridge::context()
WebKit::WebLayer* Canvas2DLayerBridge::layer()
{
- return m_layer->layer();
+ return &m_layer;
}
void Canvas2DLayerBridge::contextAcquired()
{
if (m_deferralMode == NonDeferred && !m_useDoubleBuffering)
- m_layer->willModifyTexture();
+ m_layer.willModifyTexture();
}
unsigned Canvas2DLayerBridge::backBufferTexture()
diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
index 27b1ea659..409d207c5 100644
--- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
+++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
@@ -76,7 +76,7 @@ private:
unsigned m_backBufferTexture;
IntSize m_size;
SkCanvas* m_canvas;
- OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
+ WebKit::WebExternalTextureLayer m_layer;
RefPtr<GraphicsContext3D> m_context;
};
diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index 6102a3e6f..1d167a556 100644
--- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -156,15 +156,16 @@ class DrawingBufferPrivate : public WebKit::WebExternalTextureLayerClient {
public:
explicit DrawingBufferPrivate(DrawingBuffer* drawingBuffer)
: m_drawingBuffer(drawingBuffer)
- , m_layer(adoptPtr(WebKit::WebExternalTextureLayer::create(this)))
+ , m_layer(WebKit::WebExternalTextureLayer::create(this))
{
GraphicsContext3D::Attributes attributes = m_drawingBuffer->graphicsContext3D()->getContextAttributes();
- m_layer->setOpaque(!attributes.alpha);
- m_layer->setPremultipliedAlpha(attributes.premultipliedAlpha);
+ m_layer.setOpaque(!attributes.alpha);
+ m_layer.setPremultipliedAlpha(attributes.premultipliedAlpha);
}
virtual ~DrawingBufferPrivate()
{
+ m_layer.clearClient();
}
virtual unsigned prepareTexture(WebKit::WebTextureUpdater& updater) OVERRIDE
@@ -186,11 +187,11 @@ public:
return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_drawingBuffer->graphicsContext3D());
}
- WebKit::WebLayer* layer() { return m_layer->layer(); }
+ WebKit::WebLayer* layer() { return &m_layer; }
private:
DrawingBuffer* m_drawingBuffer;
- OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
+ WebKit::WebExternalTextureLayer m_layer;
};
#if USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
index 27d51e968..fb0900bbc 100644
--- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
@@ -83,16 +83,14 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
: GraphicsLayer(client)
- , m_contentsLayer(0)
- , m_contentsLayerId(0)
, m_contentsLayerPurpose(NoContentsLayer)
, m_contentsLayerHasBackgroundColor(false)
, m_inSetChildren(false)
, m_pageScaleChanged(false)
{
m_opaqueRectTrackingContentLayerDelegate = adoptPtr(new OpaqueRectTrackingContentLayerDelegate(this));
- m_layer = adoptPtr(WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get()));
- m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
+ m_layer = WebContentLayer::create(m_opaqueRectTrackingContentLayerDelegate.get());
+ m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
if (client)
deviceOrPageScaleFactorChanged();
updateDebugIndicators();
@@ -100,9 +98,34 @@ GraphicsLayerChromium::GraphicsLayerChromium(GraphicsLayerClient* client)
GraphicsLayerChromium::~GraphicsLayerChromium()
{
+ // Do cleanup while we can still safely call methods on the derived class.
willBeDestroyed();
}
+void GraphicsLayerChromium::willBeDestroyed()
+{
+ if (!m_layer.isNull()) {
+ m_layer.clearClient();
+ m_layer.clearRenderSurface();
+ m_layer.setAnimationDelegate(0);
+ }
+
+ if (!m_contentsLayer.isNull()) {
+ m_contentsLayer.clearRenderSurface();
+ m_contentsLayer.setAnimationDelegate(0);
+ }
+
+ if (!m_transformLayer.isNull()) {
+ m_transformLayer.clearRenderSurface();
+ m_transformLayer.setAnimationDelegate(0);
+ }
+
+ if (m_linkHighlight)
+ m_linkHighlight.clear();
+
+ GraphicsLayer::willBeDestroyed();
+}
+
void GraphicsLayerChromium::setName(const String& inName)
{
m_nameBase = inName;
@@ -113,16 +136,21 @@ void GraphicsLayerChromium::setName(const String& inName)
void GraphicsLayerChromium::updateNames()
{
- String debugName = "Layer for " + m_nameBase;
- m_layer->layer()->setDebugName(debugName);
-
- if (m_transformLayer) {
+ if (!m_layer.isNull()) {
+ String debugName = "Layer for " + m_nameBase;
+ m_layer.setDebugName(debugName);
+ }
+ if (!m_transformLayer.isNull()) {
String debugName = "TransformLayer for " + m_nameBase;
- m_transformLayer->setDebugName(debugName);
+ m_transformLayer.setDebugName(debugName);
}
- if (m_contentsLayer) {
+ if (!m_contentsLayer.isNull()) {
String debugName = "ContentsLayer for " + m_nameBase;
- m_contentsLayer->setDebugName(debugName);
+ m_contentsLayer.setDebugName(debugName);
+ }
+ if (m_linkHighlight) {
+ String debugName = "LinkHighlight for " + m_nameBase;
+ m_linkHighlight->contentLayer()->setDebugName(debugName);
}
}
@@ -175,7 +203,7 @@ bool GraphicsLayerChromium::replaceChild(GraphicsLayer* oldChild, GraphicsLayer*
void GraphicsLayerChromium::removeFromParent()
{
GraphicsLayer::removeFromParent();
- platformLayer()->removeFromParent();
+ primaryLayer().removeFromParent();
}
void GraphicsLayerChromium::setPosition(const FloatPoint& point)
@@ -205,8 +233,8 @@ void GraphicsLayerChromium::setSize(const FloatSize& size)
GraphicsLayer::setSize(clampedSize);
updateLayerSize();
- if (m_pageScaleChanged)
- m_layer->layer()->invalidate();
+ if (m_pageScaleChanged && !m_layer.isNull())
+ m_layer.invalidate();
m_pageScaleChanged = false;
}
@@ -273,13 +301,13 @@ void GraphicsLayerChromium::setBackgroundColor(const Color& color)
void GraphicsLayerChromium::clearBackgroundColor()
{
GraphicsLayer::clearBackgroundColor();
- m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
+ m_contentsLayer.setBackgroundColor(static_cast<RGBA32>(0));
}
void GraphicsLayerChromium::setContentsOpaque(bool opaque)
{
GraphicsLayer::setContentsOpaque(opaque);
- m_layer->layer()->setOpaque(m_contentsOpaque);
+ m_layer.setOpaque(m_contentsOpaque);
}
static bool copyWebCoreFilterOperationsToWebFilterOperations(const FilterOperations& filters, WebFilterOperations& webFilters)
@@ -363,11 +391,11 @@ bool GraphicsLayerChromium::setFilters(const FilterOperations& filters)
if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
// Make sure the filters are removed from the platform layer, as they are
// going to fallback to software mode.
- m_layer->layer()->setFilters(WebFilterOperations());
+ m_layer.setFilters(WebFilterOperations());
GraphicsLayer::setFilters(FilterOperations());
return false;
}
- m_layer->layer()->setFilters(webFilters);
+ m_layer.setFilters(webFilters);
return GraphicsLayer::setFilters(filters);
}
@@ -376,7 +404,7 @@ void GraphicsLayerChromium::setBackgroundFilters(const FilterOperations& filters
WebFilterOperations webFilters;
if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
return;
- m_layer->layer()->setBackgroundFilters(webFilters);
+ m_layer.setBackgroundFilters(webFilters);
}
void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
@@ -386,21 +414,23 @@ void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
GraphicsLayer::setMaskLayer(maskLayer);
- WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0;
- m_layer->layer()->setMaskLayer(maskWebLayer);
+ WebLayer maskWebLayer;
+ if (m_maskLayer)
+ maskWebLayer = *m_maskLayer->platformLayer();
+ m_layer.setMaskLayer(maskWebLayer);
}
void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
{
GraphicsLayer::setBackfaceVisibility(visible);
- m_layer->setDoubleSided(m_backfaceVisibility);
+ m_layer.setDoubleSided(m_backfaceVisibility);
}
void GraphicsLayerChromium::setOpacity(float opacity)
{
float clampedOpacity = max(min(opacity, 1.0f), 0.0f);
GraphicsLayer::setOpacity(clampedOpacity);
- platformLayer()->setOpacity(opacity);
+ primaryLayer().setOpacity(opacity);
}
void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
@@ -408,27 +438,29 @@ void GraphicsLayerChromium::setReplicatedByLayer(GraphicsLayer* layer)
GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
GraphicsLayer::setReplicatedByLayer(layer);
- WebLayer* webReplicaLayer = layerChromium ? layerChromium->platformLayer() : 0;
- platformLayer()->setReplicaLayer(webReplicaLayer);
+ WebLayer webReplicaLayer;
+ if (layerChromium)
+ webReplicaLayer = layerChromium->primaryLayer();
+ primaryLayer().setReplicaLayer(webReplicaLayer);
}
void GraphicsLayerChromium::setContentsNeedsDisplay()
{
- if (m_contentsLayer)
- m_contentsLayer->invalidate();
+ if (!m_contentsLayer.isNull())
+ m_contentsLayer.invalidate();
}
void GraphicsLayerChromium::setNeedsDisplay()
{
if (drawsContent())
- m_layer->layer()->invalidate();
+ m_layer.invalidate();
}
void GraphicsLayerChromium::setNeedsDisplayInRect(const FloatRect& rect)
{
if (drawsContent())
- m_layer->layer()->invalidateRect(rect);
+ m_layer.invalidateRect(rect);
}
void GraphicsLayerChromium::setContentsRect(const IntRect& rect)
@@ -444,56 +476,46 @@ void GraphicsLayerChromium::setContentsToImage(Image* image)
{
bool childrenChanged = false;
if (image) {
- if (m_contentsLayerPurpose != ContentsLayerForImage) {
- m_imageLayer = adoptPtr(WebImageLayer::create());
- setupContentsLayer(m_imageLayer->layer());
+ if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
+ WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
+ setupContentsLayer(imageLayer);
m_contentsLayerPurpose = ContentsLayerForImage;
childrenChanged = true;
}
+ WebKit::WebImageLayer imageLayer = m_contentsLayer.to<WebKit::WebImageLayer>();
NativeImageSkia* nativeImage = image->nativeImageForCurrentFrame();
- m_imageLayer->setBitmap(nativeImage->bitmap());
- m_imageLayer->layer()->setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
+ imageLayer.setBitmap(nativeImage->bitmap());
+ imageLayer.setOpaque(image->isBitmapImage() && !image->currentFrameHasAlpha());
updateContentsRect();
} else {
- if (m_imageLayer) {
+ if (!m_contentsLayer.isNull()) {
childrenChanged = true;
- m_imageLayer.clear();
+ // The old contents layer will be removed via updateChildList.
+ m_contentsLayer.reset();
}
- // The old contents layer will be removed via updateChildList.
- m_contentsLayer = 0;
}
if (childrenChanged)
updateChildList();
}
-void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* layer)
-{
- setContentsTo(ContentsLayerForCanvas, layer);
-}
-
-void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
-{
- setContentsTo(ContentsLayerForVideo, layer);
-}
-
-void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::WebLayer* layer)
+void GraphicsLayerChromium::setContentsToCanvas(PlatformLayer* platformLayer)
{
bool childrenChanged = false;
- if (layer) {
- if (m_contentsLayerId != layer->id()) {
- setupContentsLayer(layer);
- m_contentsLayerPurpose = purpose;
+ if (platformLayer) {
+ if (m_contentsLayer != *platformLayer) {
+ setupContentsLayer(*platformLayer);
+ m_contentsLayerPurpose = ContentsLayerForCanvas;
childrenChanged = true;
}
updateContentsRect();
} else {
- if (m_contentsLayer) {
+ if (!m_contentsLayer.isNull()) {
childrenChanged = true;
// The old contents layer will be removed via updateChildList.
- m_contentsLayer = 0;
+ m_contentsLayer.reset();
}
}
@@ -503,7 +525,7 @@ void GraphicsLayerChromium::setContentsTo(ContentsLayerPurpose purpose, WebKit::
bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const Animation* animation, const String& animationName, double timeOffset)
{
- platformLayer()->setAnimationDelegate(this);
+ primaryLayer().setAnimationDelegate(this);
int animationId = mapAnimationNameToId(animationName);
int groupId = AnimationIdVendor::getNextGroupId();
@@ -512,8 +534,8 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
if (toAdd) {
// Remove any existing animations with the same animation id and target property.
- platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
- return platformLayer()->addAnimation(toAdd.get());
+ primaryLayer().removeAnimation(animationId, toAdd->targetProperty());
+ return primaryLayer().addAnimation(toAdd.get());
}
return false;
@@ -521,12 +543,12 @@ bool GraphicsLayerChromium::addAnimation(const KeyframeValueList& values, const
void GraphicsLayerChromium::pauseAnimation(const String& animationName, double timeOffset)
{
- platformLayer()->pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
+ primaryLayer().pauseAnimation(mapAnimationNameToId(animationName), timeOffset);
}
void GraphicsLayerChromium::removeAnimation(const String& animationName)
{
- platformLayer()->removeAnimation(mapAnimationNameToId(animationName));
+ primaryLayer().removeAnimation(mapAnimationNameToId(animationName));
}
void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
@@ -534,54 +556,88 @@ void GraphicsLayerChromium::suspendAnimations(double wallClockTime)
// |wallClockTime| is in the wrong time base. Need to convert here.
// FIXME: find a more reliable way to do this.
double monotonicTime = wallClockTime + monotonicallyIncreasingTime() - currentTime();
- platformLayer()->suspendAnimations(monotonicTime);
+ primaryLayer().suspendAnimations(monotonicTime);
}
void GraphicsLayerChromium::resumeAnimations()
{
- platformLayer()->resumeAnimations(monotonicallyIncreasingTime());
+ primaryLayer().resumeAnimations(monotonicallyIncreasingTime());
}
-void GraphicsLayerChromium::addLinkHighlight(const Path&)
+void GraphicsLayerChromium::addLinkHighlight(const Path& path)
{
+ m_linkHighlight = LinkHighlight::create(this, path, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId());
+ updateChildList();
}
void GraphicsLayerChromium::didFinishLinkHighlight()
{
+ if (m_linkHighlight)
+ m_linkHighlight->contentLayer()->removeFromParent();
+
+ m_linkHighlight.clear();
+}
+
+void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
+{
+ bool childrenChanged = false;
+ if (layer) {
+ if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForVideo) {
+ setupContentsLayer(*layer);
+ m_contentsLayerPurpose = ContentsLayerForVideo;
+ childrenChanged = true;
+ }
+ updateContentsRect();
+ } else {
+ if (!m_contentsLayer.isNull()) {
+ childrenChanged = true;
+
+ // The old contents layer will be removed via updateChildList.
+ m_contentsLayer.reset();
+ }
+ }
+
+ if (childrenChanged)
+ updateChildList();
+}
+
+WebKit::WebLayer GraphicsLayerChromium::primaryLayer() const
+{
+ return m_transformLayer.isNull() ? m_layer : m_transformLayer;
}
PlatformLayer* GraphicsLayerChromium::platformLayer() const
{
- return m_transformLayer ? m_transformLayer.get() : m_layer->layer();
+ return const_cast<PlatformLayer*>(m_transformLayer.isNull() ? &m_layer : &m_transformLayer);
}
void GraphicsLayerChromium::setDebugBackgroundColor(const Color& color)
{
if (color.isValid())
- m_layer->layer()->setBackgroundColor(color.rgb());
+ m_layer.setBackgroundColor(color.rgb());
else
- m_layer->layer()->setBackgroundColor(static_cast<RGBA32>(0));
+ m_layer.setBackgroundColor(static_cast<RGBA32>(0));
}
void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth)
{
if (color.isValid()) {
- m_layer->layer()->setDebugBorderColor(color.rgb());
- m_layer->layer()->setDebugBorderWidth(borderWidth);
+ m_layer.setDebugBorderColor(color.rgb());
+ m_layer.setDebugBorderWidth(borderWidth);
} else {
- m_layer->layer()->setDebugBorderColor(static_cast<RGBA32>(0));
- m_layer->layer()->setDebugBorderWidth(0);
+ m_layer.setDebugBorderColor(static_cast<RGBA32>(0));
+ m_layer.setDebugBorderWidth(0);
}
}
void GraphicsLayerChromium::updateChildList()
{
- Vector<WebLayer*> newChildren;
+ Vector<WebLayer> newChildren;
- if (m_transformLayer) {
+ if (!m_transformLayer.isNull()) {
// Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
- newChildren.append(m_layer->layer());
- } else if (m_contentsLayer) {
+ newChildren.append(m_layer);
+ } else if (!m_contentsLayer.isNull()) {
// FIXME: add the contents layer in the correct order with negative z-order children.
// This does not cause visible rendering issues because currently contents layers are only used
// for replaced elements that don't have children.
@@ -593,76 +649,79 @@ void GraphicsLayerChromium::updateChildList()
for (size_t i = 0; i < numChildren; ++i) {
GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
- newChildren.append(curChild->platformLayer());
+ newChildren.append(curChild->primaryLayer());
}
+ if (m_linkHighlight)
+ newChildren.append(m_linkHighlight->contentLayer());
+
for (size_t i = 0; i < newChildren.size(); ++i)
- newChildren[i]->removeFromParent();
+ newChildren[i].removeFromParent();
- WebVector<WebLayer*> newWebChildren;
+ WebVector<WebLayer> newWebChildren;
newWebChildren.assign(newChildren.data(), newChildren.size());
- if (m_transformLayer) {
- m_transformLayer->setChildren(newWebChildren);
+ if (!m_transformLayer.isNull()) {
+ m_transformLayer.setChildren(newWebChildren);
- if (m_contentsLayer) {
+ if (!m_contentsLayer.isNull()) {
// If we have a transform layer, then the contents layer is parented in the
// primary layer (which is itself a child of the transform layer).
- m_layer->layer()->removeAllChildren();
- m_layer->layer()->addChild(m_contentsLayer);
+ m_layer.removeAllChildren();
+ m_layer.addChild(m_contentsLayer);
}
} else
- m_layer->layer()->setChildren(newWebChildren);
+ m_layer.setChildren(newWebChildren);
}
void GraphicsLayerChromium::updateLayerPosition()
{
- platformLayer()->setPosition(m_position);
+ primaryLayer().setPosition(m_position);
}
void GraphicsLayerChromium::updateLayerSize()
{
IntSize layerSize(m_size.width(), m_size.height());
- if (m_transformLayer) {
- m_transformLayer->setBounds(layerSize);
- m_layer->layer()->setPosition(FloatPoint());
+ if (!m_transformLayer.isNull()) {
+ m_transformLayer.setBounds(layerSize);
+ m_layer.setPosition(FloatPoint());
}
- m_layer->layer()->setBounds(layerSize);
+ m_layer.setBounds(layerSize);
- // Note that we don't resize m_contentsLayer-> It's up the caller to do that.
+ // Note that we don't resize m_contentsLayer. It's up the caller to do that.
}
void GraphicsLayerChromium::updateAnchorPoint()
{
- platformLayer()->setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
- platformLayer()->setAnchorPointZ(m_anchorPoint.z());
+ primaryLayer().setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
+ primaryLayer().setAnchorPointZ(m_anchorPoint.z());
}
void GraphicsLayerChromium::updateTransform()
{
- platformLayer()->setTransform(WebTransformationMatrix(m_transform));
+ primaryLayer().setTransform(WebTransformationMatrix(m_transform));
}
void GraphicsLayerChromium::updateChildrenTransform()
{
- platformLayer()->setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
+ primaryLayer().setSublayerTransform(WebTransformationMatrix(m_childrenTransform));
}
void GraphicsLayerChromium::updateMasksToBounds()
{
- m_layer->layer()->setMasksToBounds(m_masksToBounds);
+ m_layer.setMasksToBounds(m_masksToBounds);
updateDebugIndicators();
}
void GraphicsLayerChromium::updateLayerPreserves3D()
{
- if (m_preserves3D && !m_transformLayer) {
+ if (m_preserves3D && m_transformLayer.isNull()) {
// Create the transform layer.
- m_transformLayer = adoptPtr(WebLayer::create());
- m_transformLayer->setPreserves3D(true);
- m_transformLayer->setAnimationDelegate(this);
- m_layer->layer()->transferAnimationsTo(m_transformLayer.get());
+ m_transformLayer = WebLayer::create();
+ m_transformLayer.setPreserves3D(true);
+ m_transformLayer.setAnimationDelegate(this);
+ m_layer.transferAnimationsTo(&m_transformLayer);
// Copy the position from this layer.
updateLayerPosition();
@@ -671,34 +730,34 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
updateTransform();
updateChildrenTransform();
- m_layer->layer()->setPosition(FloatPoint::zero());
+ m_layer.setPosition(FloatPoint::zero());
- m_layer->layer()->setAnchorPoint(FloatPoint(0.5f, 0.5f));
- m_layer->layer()->setTransform(SkMatrix44());
+ m_layer.setAnchorPoint(FloatPoint(0.5f, 0.5f));
+ m_layer.setTransform(SkMatrix44());
// Set the old layer to opacity of 1. Further down we will set the opacity on the transform layer.
- m_layer->layer()->setOpacity(1);
+ m_layer.setOpacity(1);
- m_layer->setContentsScale(contentsScale());
+ m_layer.setContentsScale(contentsScale());
// Move this layer to be a child of the transform layer.
if (parent())
- parent()->platformLayer()->replaceChild(m_layer->layer(), m_transformLayer.get());
- m_transformLayer->addChild(m_layer->layer());
+ parent()->platformLayer()->replaceChild(m_layer, m_transformLayer);
+ m_transformLayer.addChild(m_layer);
updateChildList();
- } else if (m_preserves3D && !m_transformLayer) {
+ } else if (!m_preserves3D && !m_transformLayer.isNull()) {
// Relace the transformLayer in the parent with this layer.
- m_layer->layer()->removeFromParent();
+ m_layer.removeFromParent();
if (parent())
- parent()->platformLayer()->replaceChild(m_transformLayer.get(), m_layer->layer());
+ parent()->platformLayer()->replaceChild(m_transformLayer, m_layer);
- m_layer->layer()->setAnimationDelegate(this);
- m_transformLayer->transferAnimationsTo(m_layer->layer());
+ m_layer.setAnimationDelegate(this);
+ m_transformLayer.transferAnimationsTo(&m_layer);
// Release the transform layer.
- m_transformLayer->setAnimationDelegate(0);
- m_transformLayer.clear();
+ m_transformLayer.setAnimationDelegate(0);
+ m_transformLayer.reset();
updateLayerPosition();
updateLayerSize();
@@ -709,39 +768,39 @@ void GraphicsLayerChromium::updateLayerPreserves3D()
updateChildList();
}
- m_layer->layer()->setPreserves3D(m_preserves3D);
- platformLayer()->setOpacity(m_opacity);
+ m_layer.setPreserves3D(m_preserves3D);
+ primaryLayer().setOpacity(m_opacity);
updateNames();
}
void GraphicsLayerChromium::updateLayerIsDrawable()
{
// For the rest of the accelerated compositor code, there is no reason to make a
- // distinction between drawsContent and contentsVisible. So, for m_layer->layer(), these two
+ // distinction between drawsContent and contentsVisible. So, for m_layer, these two
// flags are combined here. m_contentsLayer shouldn't receive the drawsContent flag
// so it is only given contentsVisible.
- m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
+ m_layer.setDrawsContent(m_drawsContent && m_contentsVisible);
- if (m_contentsLayer)
- m_contentsLayer->setDrawsContent(m_contentsVisible);
+ if (!m_contentsLayer.isNull())
+ m_contentsLayer.setDrawsContent(m_contentsVisible);
if (m_drawsContent)
- m_layer->layer()->invalidate();
+ m_layer.invalidate();
updateDebugIndicators();
}
void GraphicsLayerChromium::updateLayerBackgroundColor()
{
- if (!m_contentsLayer)
+ if (m_contentsLayer.isNull())
return;
// We never create the contents layer just for background color yet.
if (m_backgroundColorSet)
- m_contentsLayer->setBackgroundColor(m_backgroundColor.rgb());
+ m_contentsLayer.setBackgroundColor(m_backgroundColor.rgb());
else
- m_contentsLayer->setBackgroundColor(static_cast<RGBA32>(0));
+ m_contentsLayer.setBackgroundColor(static_cast<RGBA32>(0));
}
void GraphicsLayerChromium::updateContentsVideo()
@@ -751,42 +810,50 @@ void GraphicsLayerChromium::updateContentsVideo()
void GraphicsLayerChromium::updateContentsRect()
{
- if (!m_contentsLayer)
+ if (m_contentsLayer.isNull())
return;
- m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
- m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
+ m_contentsLayer.setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
+ m_contentsLayer.setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
}
void GraphicsLayerChromium::updateContentsScale()
{
// If page scale is already applied then there's no need to apply it again.
- if (appliesPageScale())
+ if (appliesPageScale() || m_layer.isNull())
return;
- m_layer->setContentsScale(contentsScale());
+ m_layer.setContentsScale(contentsScale());
}
-void GraphicsLayerChromium::setupContentsLayer(WebLayer* contentsLayer)
+void GraphicsLayerChromium::setupContentsLayer(WebLayer contentsLayer)
{
+ if (contentsLayer == m_contentsLayer)
+ return;
+
+ if (!m_contentsLayer.isNull()) {
+ m_contentsLayer.setUseParentBackfaceVisibility(false);
+ m_contentsLayer.removeFromParent();
+ m_contentsLayer.reset();
+ }
+
m_contentsLayer = contentsLayer;
- m_contentsLayerId = m_contentsLayer->id();
- if (m_contentsLayer) {
- m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
- m_contentsLayer->setUseParentBackfaceVisibility(true);
+ if (!m_contentsLayer.isNull()) {
+ m_contentsLayer.setAnchorPoint(FloatPoint(0, 0));
+ m_contentsLayer.setUseParentBackfaceVisibility(true);
// It is necessary to call setDrawsContent as soon as we receive the new contentsLayer, for
// the correctness of early exit conditions in setDrawsContent() and setContentsVisible().
- m_contentsLayer->setDrawsContent(m_contentsVisible);
+ m_contentsLayer.setDrawsContent(m_contentsVisible);
// Insert the content layer first. Video elements require this, because they have
// shadow content that must display in front of the video.
- m_layer->layer()->insertChild(m_contentsLayer, 0);
+ m_layer.insertChild(m_contentsLayer, 0);
if (showDebugBorders()) {
- m_contentsLayer->setDebugBorderColor(Color(0, 0, 128, 180).rgb());
- m_contentsLayer->setDebugBorderWidth(1);
+ m_contentsLayer.setDebugBorderColor(Color(0, 0, 128, 180).rgb());
+ m_contentsLayer.setDebugBorderWidth(1);
}
}
updateDebugIndicators();
diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
index 5f48a0878..aa64ead6d 100644
--- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
@@ -39,7 +39,6 @@
#include <public/WebAnimationDelegate.h>
#include <public/WebContentLayer.h>
-#include <public/WebImageLayer.h>
#include <public/WebLayer.h>
#include <wtf/HashMap.h>
@@ -102,7 +101,7 @@ public:
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsToCanvas(PlatformLayer*);
- virtual bool hasContentsLayer() const { return m_contentsLayer; }
+ virtual bool hasContentsLayer() const { return !m_contentsLayer.isNull(); }
virtual bool addAnimation(const KeyframeValueList&, const IntSize& boxSize, const Animation*, const String&, double timeOffset);
virtual void pauseAnimation(const String& animationName, double timeOffset);
@@ -126,13 +125,15 @@ public:
virtual void notifyAnimationStarted(double startTime) OVERRIDE;
virtual void notifyAnimationFinished(double finishTime) OVERRIDE;
- WebKit::WebContentLayer* contentLayer() const { return m_layer.get(); }
-
// Exposed for tests.
- WebKit::WebLayer* contentsLayer() const { return m_contentsLayer; }
+ WebKit::WebLayer contentsLayer() const { return m_contentsLayer; }
float contentsScale() const;
private:
+ virtual void willBeDestroyed();
+
+ WebKit::WebLayer primaryLayer() const;
+
void updateNames();
void updateChildList();
void updateLayerPosition();
@@ -150,37 +151,32 @@ private:
void updateContentsRect();
void updateContentsScale();
- enum ContentsLayerPurpose {
- NoContentsLayer = 0,
- ContentsLayerForImage,
- ContentsLayerForVideo,
- ContentsLayerForCanvas,
- };
-
- void setContentsTo(ContentsLayerPurpose, WebKit::WebLayer*);
- void setupContentsLayer(WebKit::WebLayer*);
+ void setupContentsLayer(WebKit::WebLayer);
int mapAnimationNameToId(const String& animationName);
String m_nameBase;
- OwnPtr<WebKit::WebContentLayer> m_layer;
- OwnPtr<WebKit::WebLayer> m_transformLayer;
- OwnPtr<WebKit::WebImageLayer> m_imageLayer;
- WebKit::WebLayer* m_contentsLayer;
- // We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the
- // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point,
- // we stash an ID away when we know m_contentsLayer is alive and use that for comparisons from that point
- // on.
- int m_contentsLayerId;
+ WebKit::WebContentLayer m_layer;
+ WebKit::WebLayer m_transformLayer;
+ WebKit::WebLayer m_contentsLayer;
OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLayerDelegate;
+ enum ContentsLayerPurpose {
+ NoContentsLayer = 0,
+ ContentsLayerForImage,
+ ContentsLayerForVideo,
+ ContentsLayerForCanvas,
+ };
+
ContentsLayerPurpose m_contentsLayerPurpose;
bool m_contentsLayerHasBackgroundColor : 1;
bool m_inSetChildren;
bool m_pageScaleChanged;
+ RefPtr<LinkHighlight> m_linkHighlight;
+
typedef HashMap<String, int> AnimationIdMap;
AnimationIdMap m_animationIdMap;
};
diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
index 4e7fa74f5..30c81b65c 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -234,11 +234,10 @@ void LayerChromium::setBounds(const IntSize& size)
setNeedsCommit();
}
-LayerChromium* LayerChromium::rootLayer()
+const LayerChromium* LayerChromium::rootLayer() const
{
- LayerChromium* layer = this;
- while (layer->parent())
- layer = layer->parent();
+ const LayerChromium* layer = this;
+ for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
return layer;
}
diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h
index 2e541ee7b..ec14a51a7 100644
--- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -95,7 +95,7 @@ public:
// The root layer is a special case -- it operates in physical pixels.
virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE { return m_transform; }
- LayerChromium* rootLayer();
+ const LayerChromium* rootLayer() const;
LayerChromium* parent() const;
void addChild(PassRefPtr<LayerChromium>);
void insertChild(PassRefPtr<LayerChromium>, size_t index);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
index ebd733902..2e3a7deb3 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
@@ -113,6 +113,8 @@ bool CCLayerTreeHost::initialize()
CCLayerTreeHost::~CCLayerTreeHost()
{
+ if (m_rootLayer)
+ m_rootLayer->setLayerTreeHost(0);
ASSERT(CCProxy::isMainThread());
TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost");
ASSERT(m_proxy);
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
index bc3e5db14..1d4278ec8 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
@@ -304,6 +304,7 @@ public:
void swap()
{
+ m_canvas->flush();
m_canvas.reset(0);
m_device.reset(0);
diff --git a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
index 9496fc91a..9540b86a0 100644
--- a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
+++ b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
@@ -31,7 +31,7 @@ namespace WebCore {
// because it might lead to crashes in some drivers (fglrx). We use a shared display
// pointer here.
static Display* gSharedDisplay = 0;
-static Display* sharedDisplay()
+Display* GLContextGLX::sharedDisplay()
{
if (!gSharedDisplay)
gSharedDisplay = XOpenDisplay(0);
diff --git a/Source/WebCore/platform/graphics/glx/GLContextGLX.h b/Source/WebCore/platform/graphics/glx/GLContextGLX.h
index 5e8c61ce4..b3b18c156 100644
--- a/Source/WebCore/platform/graphics/glx/GLContextGLX.h
+++ b/Source/WebCore/platform/graphics/glx/GLContextGLX.h
@@ -39,7 +39,7 @@ namespace WebCore {
class GLContextGLX : public GLContext {
WTF_MAKE_NONCOPYABLE(GLContextGLX);
public:
- static PassOwnPtr<GLContextGLX> createContext(XID, GLContext* sharingContext = 0);
+ static PassOwnPtr<GLContextGLX> createContext(XID window, GLContext* sharingContext);
static PassOwnPtr<GLContextGLX> createWindowContext(XID window, GLContext* sharingContext);
virtual ~GLContextGLX();
@@ -48,6 +48,8 @@ public:
virtual bool canRenderToDefaultFramebuffer();
virtual IntSize defaultFrameBufferSize();
+ static Display* sharedDisplay();
+
#if USE(3D_GRAPHICS)
virtual PlatformGraphicsContext3D platformContext();
#endif
diff --git a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp
new file mode 100644
index 000000000..ae1d262d7
--- /dev/null
+++ b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "RedirectedXCompositeWindow.h"
+
+#include "GLContextGLX.h"
+#include <GL/glx.h>
+#include <X11/extensions/Xcomposite.h>
+#include <cairo-xlib.h>
+#include <gdk/gdkx.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+namespace WebCore {
+
+PassOwnPtr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(const IntSize& size)
+{
+ return adoptPtr(new RedirectedXCompositeWindow(size));
+}
+
+RedirectedXCompositeWindow::RedirectedXCompositeWindow(const IntSize& size)
+ : m_window(0)
+ , m_parentWindow(0)
+ , m_pixmap(0)
+ , m_surface(0)
+ , m_pendingResizeSourceId(0)
+ , m_needsNewPixmapAfterResize(false)
+{
+ Display* display = GLContextGLX::sharedDisplay();
+
+ // This is based on code from Chromium: src/content/common/gpu/image_transport_surface_linux.cc
+ XSetWindowAttributes windowAttributes;
+ windowAttributes.override_redirect = True;
+ m_parentWindow = XCreateWindow(display,
+ RootWindow(display, DefaultScreen(display)),
+ -100, -100, 1, 1,
+ 0,
+ CopyFromParent,
+ InputOutput,
+ CopyFromParent,
+ CWOverrideRedirect,
+ &windowAttributes);
+ XMapWindow(display, m_parentWindow);
+
+ windowAttributes.event_mask = StructureNotifyMask;
+ windowAttributes.override_redirect = False;
+ m_window = XCreateWindow(display,
+ m_parentWindow,
+ 0, 0, size.width(), size.height(),
+ 0,
+ CopyFromParent,
+ InputOutput,
+ CopyFromParent,
+ CWEventMask,
+ &windowAttributes);
+ XMapWindow(display, m_window);
+
+ while (1) {
+ XEvent event;
+ XWindowEvent(display, m_window, StructureNotifyMask, &event);
+ if (event.type == MapNotify && event.xmap.window == m_window)
+ break;
+ }
+ XSelectInput(display, m_window, NoEventMask);
+
+ XCompositeRedirectWindow(display, m_window, CompositeRedirectManual);
+
+ resize(size);
+ resizeLater(); // Force update of the usable area.
+}
+
+RedirectedXCompositeWindow::~RedirectedXCompositeWindow()
+{
+ Display* display = GLContextGLX::sharedDisplay();
+ if (m_window)
+ XDestroyWindow(display, m_window);
+ if (m_parentWindow)
+ XDestroyWindow(display, m_parentWindow);
+ cleanupPixmapAndPixmapSurface();
+
+ if (m_pendingResizeSourceId)
+ g_source_remove(m_pendingResizeSourceId);
+}
+
+gboolean RedirectedXCompositeWindow::resizeLaterCallback(RedirectedXCompositeWindow* window)
+{
+ window->resizeLater();
+ return FALSE;
+}
+
+void RedirectedXCompositeWindow::resizeLater()
+{
+ m_usableSize = m_size;
+ m_pendingResizeSourceId = 0;
+}
+
+void RedirectedXCompositeWindow::resize(const IntSize& size)
+{
+ // When enlarging a redirected window, for the first render, the newly exposed areas seem
+ // to contain uninitialized memory on Intel drivers. To avoid rendering artifacts while
+ // resizing, we wait to render those new areas until after a short timeout. Thus, the
+ // "usable size" of the window is smaller than the actual size of the window for the first
+ // render.
+ m_usableSize = size.shrunkTo(m_usableSize);
+ if (m_usableSize.width() < size.width() || m_usableSize.height() < size.height()) { // The window is growing.
+ // We're being very conservative here. Instead of risking drawing artifacts while doing continuous
+ // opaque resizing, we err on the side of having more undrawn areas.
+ if (m_pendingResizeSourceId)
+ g_source_remove(m_pendingResizeSourceId);
+ m_pendingResizeSourceId = g_timeout_add(0, reinterpret_cast<GSourceFunc>(resizeLaterCallback), this);
+ }
+
+ Display* display = GLContextGLX::sharedDisplay();
+ XResizeWindow(display, m_window, size.width(), size.height());
+ glXWaitX();
+
+ // This swap is based on code in Chromium. It tries to work-around a bug in the Intel drivers
+ // where a swap is necessary to ensure the front and back buffers are properly resized.
+ if (context() == GLContext::getCurrent())
+ context()->swapBuffers();
+
+ m_size = size;
+ m_needsNewPixmapAfterResize = true;
+}
+
+GLContext* RedirectedXCompositeWindow::context()
+{
+ if (m_context)
+ return m_context.get();
+
+ ASSERT(m_window);
+ m_context = GLContext::createContextForWindow(m_window, GLContext::sharingContext());
+ return m_context.get();
+}
+
+void RedirectedXCompositeWindow::cleanupPixmapAndPixmapSurface()
+{
+ if (!m_pixmap)
+ return;
+
+ XFreePixmap(cairo_xlib_surface_get_display(m_surface.get()), m_pixmap);
+ m_pixmap = 0;
+ m_surface = nullptr;
+}
+
+cairo_surface_t* RedirectedXCompositeWindow::cairoSurfaceForWidget(GtkWidget* widget)
+{
+ if (!m_needsNewPixmapAfterResize && m_surface)
+ return m_surface.get();
+
+ m_needsNewPixmapAfterResize = false;
+
+ // It's important that the new pixmap be created with the same Display pointer as the target
+ // widget or else drawing speed can be 100x slower.
+ Display* newPixmapDisplay = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(widget));
+ Pixmap newPixmap = XCompositeNameWindowPixmap(newPixmapDisplay, m_window);
+ if (!newPixmap) {
+ cleanupPixmapAndPixmapSurface();
+ return 0;
+ }
+
+ XWindowAttributes windowAttributes;
+ if (!XGetWindowAttributes(newPixmapDisplay, m_window, &windowAttributes)) {
+ cleanupPixmapAndPixmapSurface();
+ XFreePixmap(newPixmapDisplay, newPixmap);
+ return 0;
+ }
+
+ RefPtr<cairo_surface_t> newSurface = adoptRef(cairo_xlib_surface_create(newPixmapDisplay, newPixmap,
+ windowAttributes.visual,
+ m_size.width(), m_size.height()));
+
+ // Nvidia drivers seem to prepare their redirected window pixmap asynchronously, so for a few fractions
+ // of a second after each resize, while doing continuous resizing (which constantly destroys and creates
+ // pixmap window-backings), the pixmap memory is uninitialized. To work around this issue, paint the old
+ // pixmap to the new one to properly initialize it.
+ if (m_surface) {
+ RefPtr<cairo_t> cr = adoptRef(cairo_create(newSurface.get()));
+ cairo_set_source_rgb(cr.get(), 1, 1, 1);
+ cairo_paint(cr.get());
+ cairo_set_source_surface(cr.get(), m_surface.get(), 0, 0);
+ cairo_paint(cr.get());
+ }
+
+ cleanupPixmapAndPixmapSurface();
+ m_pixmap = newPixmap;
+ m_surface = newSurface;
+
+ return m_surface.get();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h
new file mode 100644
index 000000000..39ec7edb2
--- /dev/null
+++ b/Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012, Igalia S.L.
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 RedirectedXCompositeWindow_h
+#define RedirectedXCompositeWindow_h
+
+#include "GLContextGLX.h"
+#include "IntSize.h"
+#include "RefPtrCairo.h"
+
+typedef unsigned long Pixmap;
+typedef unsigned long Window;
+
+namespace WebCore {
+
+class RedirectedXCompositeWindow {
+public:
+ static PassOwnPtr<RedirectedXCompositeWindow> create(const IntSize&);
+ virtual ~RedirectedXCompositeWindow();
+
+ const IntSize& usableSize() { return m_usableSize; }
+ const IntSize& size() { return m_size; }
+
+ void resize(const IntSize& newSize);
+ GLContext* context();
+ cairo_surface_t* cairoSurfaceForWidget(GtkWidget*);
+
+private:
+ RedirectedXCompositeWindow(const IntSize&);
+
+ static gboolean resizeLaterCallback(RedirectedXCompositeWindow*);
+ void resizeLater();
+ void cleanupPixmapAndPixmapSurface();
+
+ IntSize m_size;
+ IntSize m_usableSize;
+ Window m_window;
+ Window m_parentWindow;
+ Pixmap m_pixmap;
+ OwnPtr<GLContext> m_context;
+ RefPtr<cairo_surface_t> m_surface;
+ unsigned int m_pendingResizeSourceId;
+ bool m_needsNewPixmapAfterResize;
+};
+
+} // namespace WebCore
+
+#endif // RedirectedXCompositeWindow_h
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp
index a829078ae..64ebc18c8 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.cpp
+++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp
@@ -447,8 +447,8 @@ bool ResourceRequestBase::isConditional() const
void ResourceRequestBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
- info.addMember(m_url);
- info.addMember(m_firstPartyForCookies);
+ info.addInstrumentedMember(m_url);
+ info.addInstrumentedMember(m_firstPartyForCookies);
info.addInstrumentedMember(m_httpMethod);
info.addHashMap(m_httpHeaderFields);
info.addInstrumentedMapEntries(m_httpHeaderFields);
diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp
index fa05381cd..e8d7ca433 100644
--- a/Source/WebCore/platform/network/ResourceResponseBase.cpp
+++ b/Source/WebCore/platform/network/ResourceResponseBase.cpp
@@ -571,7 +571,7 @@ void ResourceResponseBase::lazyInit(InitLevel initLevel) const
void ResourceResponseBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
- info.addMember(m_url);
+ info.addInstrumentedMember(m_url);
info.addInstrumentedMember(m_mimeType);
info.addInstrumentedMember(m_textEncodingName);
info.addInstrumentedMember(m_suggestedFilename);
diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
index 3d803a252..45ae8af39 100644
--- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
+++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
@@ -31,6 +31,7 @@
#include "MIMETypeRegistry.h"
#include "NetworkManager.h"
#include "Page.h"
+#include "RSSFilterStream.h"
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
#include "ResourceRequest.h"
@@ -133,6 +134,16 @@ bool NetworkJob::initialize(int playerId,
BlackBerry::Platform::FilterStream* wrappedStream = m_streamFactory->createNetworkStream(request, m_playerId);
if (!wrappedStream)
return false;
+
+ BlackBerry::Platform::NetworkRequest::TargetType targetType = request.getTargetType();
+ if ((targetType == BlackBerry::Platform::NetworkRequest::TargetIsMainFrame
+ || targetType == BlackBerry::Platform::NetworkRequest::TargetIsSubframe)
+ && !m_isOverrideContentType) {
+ RSSFilterStream* filter = new RSSFilterStream();
+ filter->setWrappedStream(wrappedStream);
+ wrappedStream = filter;
+ }
+
setWrappedStream(wrappedStream);
return true;
diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
index 55a295fe4..f7d708a68 100644
--- a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
+++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
@@ -65,17 +65,15 @@ SocketStreamHandle::SocketStreamHandle(const String& groupName, const KURL& url,
// Create a platform socket stream
BlackBerry::Platform::NetworkStreamFactory* factory = page->chrome()->platformPageClient()->networkStreamFactory();
ASSERT(factory);
- m_socketStream = adoptPtr(factory->createSocketStream(playerId));
- ASSERT(m_socketStream);
- m_socketStream->setListener(this);
// Open the socket
BlackBerry::Platform::NetworkRequest request;
ReadOnlyLatin1String latin1URL(url.string());
request.setRequestUrl(latin1URL.data(), latin1URL.length(), "CONNECT", 7);
+ m_socketStream = adoptPtr(factory->createNetworkStream(request, playerId));
+ ASSERT(m_socketStream);
- m_socketStream->setRequest(request);
-
+ m_socketStream->setListener(this);
m_socketStream->streamOpen();
}
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.cpp b/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.cpp
new file mode 100644
index 000000000..53923302d
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSS10Parser.h"
+
+#include "BlackBerryPlatformAssert.h"
+#include "libxml/parser.h"
+#include "libxml/xmlwriter.h"
+
+namespace WebCore {
+
+RSS10Parser::RSS10Parser()
+{
+}
+
+bool RSS10Parser::parseBuffer(const char* buffer, int length, const char* url, const char* encoding)
+{
+ return parseXmlDoc(xmlReadMemory(buffer, length, url, encoding, XML_PARSE_NOBLANKS | XML_PARSE_NONET));
+}
+
+bool RSS10Parser::parseXmlDoc(xmlDocPtr doc)
+{
+ if (!doc)
+ return false;
+
+ xmlNode* node = xmlDocGetRootElement(doc);
+ if (!node) {
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+
+ if (name == "RDF") {
+ xmlNode* childnode = node->children;
+ for (; childnode; childnode = childnode->next) {
+ if (childnode->type == XML_ELEMENT_NODE) {
+ name = String(reinterpret_cast<const char*>(childnode->name));
+ name.makeLower();
+ if (name == "channel") {
+ BLACKBERRY_ASSERT(!m_root);
+ if (!m_root)
+ m_root = parseFeed(childnode->children);
+ } else if (name == "item") {
+ BLACKBERRY_ASSERT(m_root);
+ if (m_root) {
+ RSSItem* item = parseItem(childnode->children);
+ if (item)
+ m_root->m_items.append(item);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ xmlFreeDoc(doc);
+
+ return m_root;
+}
+
+bool RSS10Parser::parseItemBaseAttribute(RSSItemBase* item, const String& name, xmlNode* node)
+{
+ if (name == "link")
+ item->m_link = textFromXMLNode(node);
+ else if (name == "title")
+ item->m_title = textFromXMLNode(node);
+ else if (name == "description")
+ item->m_description = textFromXMLNode(node);
+ else
+ return false;
+
+ return true;
+}
+
+RSSItem* RSS10Parser::parseItem(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSItem* item = new RSSItem();
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ parseItemBaseAttribute(item, name, node);
+ }
+
+ return item;
+}
+
+RSSFeed* RSS10Parser::parseFeed(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSFeed* feed = new RSSFeed();
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ parseItemBaseAttribute(feed, name, node);
+ }
+
+ return feed;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.h b/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.h
new file mode 100644
index 000000000..396641d3c
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSS10Parser.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RSS10Parser_h
+#define RSS10Parser_h
+
+#include "RSSParserBase.h"
+
+namespace WebCore {
+
+class RSS10Parser : public RSSParserBase {
+public:
+ RSS10Parser();
+
+ bool parseBuffer(const char* buffer, int length, const char* url, const char* encoding);
+
+private:
+ bool parseXmlDoc(xmlDocPtr);
+ bool parseItemBaseAttribute(RSSItemBase*, const String& name, xmlNode*);
+ RSSItem* parseItem(xmlNode*);
+ RSSFeed* parseFeed(xmlNode*);
+};
+
+} // namespace WebCore
+
+#endif // RSS10Parser_h
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.cpp b/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.cpp
new file mode 100644
index 000000000..778e4dc98
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSS20Parser.h"
+
+#include "BlackBerryPlatformAssert.h"
+#include "libxml/parser.h"
+#include "libxml/xmlwriter.h"
+
+namespace WebCore {
+
+RSS20Parser::RSS20Parser()
+{
+}
+
+bool RSS20Parser::parseBuffer(const char* buffer, int length, const char* url, const char* encoding)
+{
+ return parseXmlDoc(xmlReadMemory(buffer, length, url, encoding, XML_PARSE_NOBLANKS | XML_PARSE_NONET));
+}
+
+bool RSS20Parser::parseXmlDoc(xmlDocPtr doc)
+{
+ if (!doc)
+ return false;
+
+ xmlNode* node = xmlDocGetRootElement(doc);
+ if (!node) {
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (name == "rss") {
+ xmlNode* channel = node->children;
+ if (channel->type == XML_ELEMENT_NODE) {
+ name = reinterpret_cast<const char*>(channel->name);
+ name.makeLower();
+ if (name == "channel")
+ m_root = parseFeed(channel->children);
+ }
+ break;
+ }
+ }
+
+ xmlFreeDoc(doc);
+
+ return m_root;
+}
+
+bool RSS20Parser::parseItemBaseAttribute(RSSItemBase* item, const String& name, xmlNode* node)
+{
+ if (name == "link")
+ item->m_link = textFromXMLNode(node);
+ else if (name == "title")
+ item->m_title = textFromXMLNode(node);
+ else if (name == "description")
+ item->m_description = textFromXMLNode(node);
+ else if (name == "pubdate")
+ item->m_pubDate = textFromXMLNode(node);
+ else
+ return false;
+
+ return true;
+}
+
+RSSItem* RSS20Parser::parseItem(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSItem* item = new RSSItem();
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (parseItemBaseAttribute(item, name, node))
+ continue;
+
+ if (name == "author")
+ item->m_author = textFromXMLNode(node);
+ else if (name == "creator") {
+ if (item->m_author.isEmpty())
+ item->m_author = textFromXMLNode(node);
+ } else if (name == "category")
+ item->m_categories.append(textFromXMLNode(node));
+ else if (name == "comments")
+ item->m_comments = textFromXMLNode(node);
+ else if (name == "enclosure") {
+ // Right now we assume there is only one enclosure per item, and we handle only
+ // the first enclosure if there are multiple ones.
+ // Reference: http://www.rssboard.org/rss-profile#element-channel-item-enclosure
+ if (!item->m_enclosure)
+ item->m_enclosure = parseEnclosure(node);
+ }
+ }
+
+ return item;
+}
+
+RSSFeed* RSS20Parser::parseFeed(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSFeed* feed = new RSSFeed();
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (parseItemBaseAttribute(feed, name, node))
+ continue;
+
+ if (name == "item")
+ feed->m_items.append(parseItem(node->children));
+ else if (name == "language")
+ feed->m_language = textFromXMLNode(node);
+ else if (name == "ttl")
+ feed->m_ttl = textFromXMLNode(node);
+ }
+
+ return feed;
+}
+
+RSSEnclosure* RSS20Parser::parseEnclosure(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSEnclosure* enclosure = new RSSEnclosure();
+
+ for (xmlAttr* attr = node->properties; attr; attr = attr->next) {
+ String name(reinterpret_cast<const char*>(attr->name));
+ name.makeLower();
+
+ if (name == "url")
+ enclosure->m_url = textFromXMLAttr(attr);
+ else if (name == "type")
+ enclosure->m_type = textFromXMLAttr(attr);
+ else if (name == "length")
+ enclosure->m_length = textFromXMLAttr(attr);
+ }
+
+ return enclosure;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.h b/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.h
new file mode 100644
index 000000000..6adad1864
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSS20Parser.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RSS20Parser_h
+#define RSS20Parser_h
+
+#include "RSSParserBase.h"
+
+namespace WebCore {
+
+class RSS20Parser : public RSSParserBase {
+public:
+ RSS20Parser();
+
+ bool parseBuffer(const char* buffer, int length, const char* url, const char* encoding);
+
+private:
+ bool parseXmlDoc(xmlDocPtr);
+ bool parseItemBaseAttribute(RSSItemBase*, const String& name, xmlNode*);
+ RSSItem* parseItem(xmlNode*);
+ RSSFeed* parseFeed(xmlNode*);
+ RSSEnclosure* parseEnclosure(xmlNode*);
+};
+
+} // namespace WebCore
+
+#endif // RSS20Parser_h
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp
new file mode 100644
index 000000000..6af6bc421
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.cpp
@@ -0,0 +1,333 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSSAtomParser.h"
+
+#include "BlackBerryPlatformAssert.h"
+#include "libxml/parser.h"
+#include "libxml/xmlwriter.h"
+
+namespace WebCore {
+
+static inline bool isRelativePath(const String& path)
+{
+ return !(path.startsWith("/") || path.find(":/") != WTF::notFound);
+}
+
+RSSAtomLink::Type RSSAtomLink::relType()
+{
+ if (m_typeInEnum != TypeUnknown)
+ return m_typeInEnum;
+
+ if (m_rel.isEmpty())
+ m_typeInEnum = TypeAlternate;
+ else {
+ String lowrel = m_rel.lower();
+ if (lowrel == "alternate")
+ m_typeInEnum = TypeAlternate;
+ else if (lowrel == "enclosure")
+ m_typeInEnum = TypeEnclosure;
+ else if (lowrel == "related")
+ m_typeInEnum = TypeRelated;
+ else if (lowrel == "self")
+ m_typeInEnum = TypeSelf;
+ else if (lowrel == "via")
+ m_typeInEnum = TypeVia;
+ else
+ m_typeInEnum = TypeUnsupported;
+ }
+
+ return m_typeInEnum;
+}
+
+RSSAtomParser::RSSAtomParser()
+{
+}
+
+bool RSSAtomParser::parseBuffer(const char* buffer, int length, const char* url, const char* encoding)
+{
+ m_url = KURL(blankURL(), url);
+ return parseXmlDoc(xmlReadMemory(buffer, length, url, encoding, XML_PARSE_NOBLANKS | XML_PARSE_NONET));
+}
+
+bool RSSAtomParser::parseXmlDoc(xmlDocPtr doc)
+{
+ if (!doc)
+ return false;
+
+ xmlNode* node = xmlDocGetRootElement(doc);
+ if (!node) {
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (name == "feed") {
+ m_root = parseFeed(node->children);
+ break;
+ }
+ }
+
+ xmlFreeDoc(doc);
+ return m_root;
+}
+
+bool RSSAtomParser::parseItemBaseAttribute(RSSItemBase* item, const String& name, xmlNode* node, const String& base)
+{
+ if (name == "title")
+ item->m_title = textFromXMLNode(node);
+ else if (name == "id")
+ item->m_id = textFromXMLNode(node);
+ else if (name == "author")
+ item->m_author = parseAuthor(node);
+ else if (name == "updated")
+ item->m_updated = textFromXMLNode(node);
+ else if (name == "content")
+ item->m_description = parseContent(base, node);
+ else if (name == "published")
+ item->m_pubDate = textFromXMLNode(node);
+ else
+ return false;
+
+ return true;
+}
+
+RSSItem* RSSAtomParser::parseItem(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSItem* item = new RSSItem();
+
+ String base;
+ for (xmlAttr* attr = node->properties; attr; attr = attr->next) {
+ String name(reinterpret_cast<const char*>(attr->name));
+ name.makeLower();
+ if (name == "base")
+ base = textFromXMLAttr(attr);
+ }
+
+ node = node->children;
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (parseItemBaseAttribute(item, name, node, base))
+ continue;
+
+ if (name == "link") {
+ RSSAtomLink* link = parseLink(node);
+ if (isRelativePath(link->m_href))
+ link->m_href = base + "/" + link->m_href;
+
+ switch (link->relType()) {
+ case RSSAtomLink::TypeAlternate:
+ item->m_link = link->m_href;
+ break;
+ case RSSAtomLink::TypeEnclosure:
+ BLACKBERRY_ASSERT(!item->m_enclosure);
+ if (!item->m_enclosure)
+ item->m_enclosure = enclosureFromLink(link);
+ break;
+ default:
+ break;
+ }
+ delete link;
+ } else if (name == "category")
+ item->m_categories.append(parseCategory(node));
+ }
+
+ return item;
+}
+
+RSSFeed* RSSAtomParser::parseFeed(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSFeed* feed = new RSSFeed();
+
+ for (; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (parseItemBaseAttribute(feed, name, node, emptyString()))
+ continue;
+
+ if (name == "entry")
+ feed->m_items.append(parseItem(node));
+ else if (name == "link") {
+ RSSAtomLink* link = parseLink(node);
+ if (link->relType() == RSSAtomLink::TypeAlternate)
+ feed->m_link = link->m_href;
+ delete link;
+ }
+ }
+
+ return feed;
+}
+
+RSSAtomLink* RSSAtomParser::parseLink(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ RSSAtomLink* link = new RSSAtomLink();
+
+ for (xmlAttr* attr = node->properties; attr; attr = attr->next) {
+ String name(reinterpret_cast<const char*>(attr->name));
+ name.makeLower();
+
+ if (name == "href")
+ link->m_href = textFromXMLAttr(attr);
+ else if (name == "rel")
+ link->m_rel = textFromXMLAttr(attr);
+ else if (name == "type")
+ link->m_type = textFromXMLAttr(attr);
+ else if (name == "hreflang")
+ link->m_hreflang = textFromXMLAttr(attr);
+ else if (name == "title")
+ link->m_title = textFromXMLAttr(attr);
+ else if (name == "length")
+ link->m_length = textFromXMLAttr(attr);
+ }
+
+ return link;
+}
+
+RSSEnclosure* RSSAtomParser::enclosureFromLink(RSSAtomLink* link)
+{
+ BLACKBERRY_ASSERT(link);
+ BLACKBERRY_ASSERT(link->relType() == RSSAtomLink::TypeEnclosure);
+
+ RSSEnclosure* enclosure = new RSSEnclosure();
+
+ enclosure->m_url = link->m_href;
+ enclosure->m_type = link->m_type;
+ enclosure->m_length = link->m_length;
+
+ return enclosure;
+}
+
+String RSSAtomParser::parseContent(const String& base, xmlNode* node)
+{
+ // See: http://tools.ietf.org/html/rfc4287#page-16
+
+ BLACKBERRY_ASSERT(node);
+ String content;
+ String type = "default";
+ String src;
+ for (xmlAttr* attr = node->properties; attr; attr = attr->next) {
+ String name(reinterpret_cast<const char*>(attr->name));
+ name.makeLower();
+
+ if (name == "type")
+ type = textFromXMLAttr(attr);
+ else if (name == "src")
+ src = textFromXMLAttr(attr);
+ }
+
+ if (!src.isEmpty()) {
+ if (isRelativePath(src))
+ src = base + "/" + src;
+ content += "<a href=\"";
+ content += src + "\">" + src + "</a>";
+ return content;
+ }
+
+ if (type == "text" || type.startsWith("text/"))
+ content = textFromXMLNode(node);
+ else if (type == "html")
+ content = textFromXMLNode(node);
+ else if (type == "xhtml") {
+ xmlBufferPtr buffer = xmlBufferCreate();
+ xmlNode * cur = node->children;
+ if (cur && cur->type == XML_ELEMENT_NODE) {
+ // Encoding of buffer is utf-8.
+ xmlNodeDump(buffer, cur->doc, cur, 0, 0);
+ if (!base.isEmpty()) {
+ content += "<base href='";
+ content += m_url.baseAsString();
+ content += "/";
+ content += base;
+ content += "/' />";
+ }
+ content += (const char*)xmlBufferContent(buffer);
+ }
+ xmlBufferFree(buffer);
+ } else if (type.endsWith("+xml") || type.endsWith("/xml"))
+ // FIXME: see atom spec 4.1.3.3.4.
+ content = textFromXMLNode(node);
+ else
+ content = textFromXMLNode(node);
+
+ return content;
+}
+
+String RSSAtomParser::parseAuthor(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ String username;
+ String email;
+
+ for (node = node->children; node; node = node->next) {
+ String name(reinterpret_cast<const char*>(node->name));
+ name.makeLower();
+
+ if (name == "name")
+ username = textFromXMLNode(node);
+ else if (name == "email")
+ email = textFromXMLNode(node);
+ }
+
+ if (!email.isEmpty()) {
+ username += " (";
+ username += email;
+ username += ")";
+ }
+
+ return username;
+}
+
+String RSSAtomParser::parseCategory(xmlNode* node)
+{
+ BLACKBERRY_ASSERT(node);
+
+ String category;
+
+ for (xmlAttr* attr = node->properties; attr; attr = attr->next) {
+ String name(reinterpret_cast<const char*>(attr->name));
+ name.makeLower();
+
+ // If there's a label, we use it, if not, use term attribute, as label is
+ // optional, but term is mandatory.
+ if (name == "label") {
+ category = textFromXMLAttr(attr);
+ break;
+ }
+
+ if (name == "term")
+ category = textFromXMLAttr(attr);
+ }
+
+ return category;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.h b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.h
new file mode 100644
index 000000000..865f50f24
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSAtomParser.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RSSAtomParser_h
+#define RSSAtomParser_h
+
+#include "KURL.h"
+#include "RSSParserBase.h"
+
+namespace WebCore {
+
+class RSSAtomLink {
+public:
+ enum Type {
+ TypeUnknown,
+ TypeAlternate,
+ TypeRelated,
+ TypeSelf,
+ TypeEnclosure,
+ TypeVia,
+ TypeUnsupported
+ };
+
+ RSSAtomLink()
+ : m_typeInEnum(TypeUnknown)
+ { }
+
+ Type relType();
+
+ String m_rel;
+ String m_href;
+ String m_hreflang;
+ String m_type;
+ String m_title;
+ String m_length;
+
+private:
+ Type m_typeInEnum;
+};
+
+class RSSAtomParser : public RSSParserBase {
+public:
+ RSSAtomParser();
+
+ bool parseBuffer(const char* buffer, int length, const char* url, const char* encoding);
+
+private:
+ bool parseXmlDoc(xmlDocPtr);
+ bool parseItemBaseAttribute(RSSItemBase*, const String& name, xmlNode*, const String& base);
+ RSSItem* parseItem(xmlNode*);
+ RSSFeed* parseFeed(xmlNode*);
+ RSSAtomLink* parseLink(xmlNode*);
+ RSSEnclosure* enclosureFromLink(RSSAtomLink*);
+
+ String parseContent(const String& base, xmlNode*);
+ String parseAuthor(xmlNode*);
+ String parseCategory(xmlNode*);
+ KURL m_url;
+};
+
+} // namespace WebCore
+
+#endif // RSSAtomParser_h
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.cpp
new file mode 100644
index 000000000..58915bd13
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.cpp
@@ -0,0 +1,672 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSSFilterStream.h"
+
+#include "RSS10Parser.h"
+#include "RSS20Parser.h"
+#include "RSSAtomParser.h"
+#include "RSSGenerator.h"
+#include "TextCodecICU.h"
+
+#include <BlackBerryPlatformAssert.h>
+#include <BlackBerryPlatformLog.h>
+#include <ScopePointer.h>
+#include <network/NetworkRequest.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+using BlackBerry::Platform::LogLevelCritical;
+using BlackBerry::Platform::LogLevelInfo;
+using BlackBerry::Platform::LogLevelWarn;
+using BlackBerry::Platform::NetworkRequest;
+
+namespace WebCore {
+
+static const char* const s_utf8EncodingName = "UTF-8";
+static const char* const s_latin1EncodingName = "ISO-8859-1";
+static const char* const s_gbkEncodingName = "GBK";
+
+static const char* const s_contentEncodingHeaderKey = "Content-Encoding";
+static const char* const s_contentLengthHeaderKey = "Content-Length";
+static const char* const s_contentTypeHeaderKey = "Content-Type";
+
+static const char* const s_atom10VersionKey = "xmlns";
+static const char* const s_atom10VersionValue = "http://www.w3.org/2005/Atom";
+static const char* const s_rss10VersionKey = "xmlns";
+static const char* const s_rss10VersionValue = "http://purl.org/rss/1.0/";
+static const char* const s_rss20VersionKey = "version";
+static const char* const s_rss20VersionValue = "2.0";
+static const char* const s_rssXmlVersionKey = "version";
+static const char* const s_rssXmlVersionValue = "1.0";
+
+static int isASCIISpaceLowerByte(int ch)
+{
+ return isASCIISpace<int>(ch & 0xff);
+}
+
+static std::string& stripWhiteSpace(std::string& str)
+{
+ str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun<int, int>(isASCIISpaceLowerByte))));
+ str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun<int, int>(isASCIISpaceLowerByte))).base(), str.end());
+ return str;
+}
+
+static inline bool equalIgnoringCase(const std::string& first, const char* second)
+{
+ return !strcasecmp(first.c_str(), second);
+}
+
+static inline bool isAtomMIMEType(const std::string& mimeType)
+{
+ return equalIgnoringCase(mimeType, "application/atom+xml");
+}
+
+static inline bool isRSSMIMEType(const std::string& mimeType)
+{
+ return equalIgnoringCase(mimeType, "application/rss+xml");
+}
+
+static inline bool isPotentialRSSMIMEType(const std::string& mimeType)
+{
+ return !strncmp(mimeType.data(), "text/xml", 8) || !strncmp(mimeType.data(), "application/xml", 15);
+}
+
+static inline bool isRSSContent(RSSFilterStream::ResourceType type)
+{
+ return type == RSSFilterStream::TypeRSS10
+ || type == RSSFilterStream::TypeRSS20
+ || type == RSSFilterStream::TypeRSSAtom;
+}
+
+static RSSFilterStream::ResourceType RSSTypeFromContentType(const std::string& contentType)
+{
+ if (contentType.empty())
+ return RSSFilterStream::TypeUnknown;
+
+ std::string mimeType;
+ std::string version;
+ bool isRSS = false;
+
+ // The contentType can contain both a mime type and version attributes
+ // If we already know the type is Atom, we don't need either of these, so skip it
+ for (size_t start = 0, delimiter = 0; delimiter != std::string::npos; start = delimiter + 1) {
+ delimiter = contentType.find(';', start);
+
+ std::string component = contentType.substr(start, delimiter == std::string::npos ? delimiter : delimiter - start);
+
+ if (mimeType.empty()) {
+ if (isAtomMIMEType(component))
+ return RSSFilterStream::TypeRSSAtom;
+
+ if (isRSSMIMEType(component)) {
+ // definitely not a version attribute, skip to next token
+ mimeType = component;
+ isRSS = true;
+ continue;
+ }
+ }
+
+ size_t equalsign = component.find('=');
+ if (equalsign != std::string::npos && equalIgnoringCase(component.substr(0, equalsign), "version"))
+ version = component.substr(equalsign + 1);
+
+ // Check if we now have found both MIME type and version
+ if (!mimeType.empty() && !version.empty())
+ break;
+ }
+
+ if (isRSS) {
+ if (!version.compare("1.0"))
+ return RSSFilterStream::TypeRSS10;
+
+ return RSSFilterStream::TypeRSS20;
+ }
+
+ return RSSFilterStream::TypeUnknown;
+}
+
+static RSSFilterStream::ResourceType RSSTypeFromContent(const char* str, int strLen)
+{
+ // Locate xml signature.
+ const char* pos = str;
+
+ // Locate the RSS tags.
+ while (true) {
+ pos = strchr(pos, '<');
+ if (!pos || (pos - str >= strLen)) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): can not find any start tag");
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ ++pos;
+
+ if (!strncasecmp(pos, "rss", 3)) {
+ if (isSpaceOrNewline(*(pos + 3))) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): found RSS 2.0 tag");
+ return RSSFilterStream::TypeRSS20;
+ }
+
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): wrong RSS 2.0 tag: %.*s", 32, pos);
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ if (!strncasecmp(pos, "feed", 4)) {
+ if (isSpaceOrNewline(*(pos + 4))) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): found Atom 1.0 tag");
+ return RSSFilterStream::TypeRSSAtom;
+ }
+
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): wrong Atom 1.0 tag: %.*s", 32, pos);
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ if (!strncasecmp(pos, "rdf:RDF", 7)) {
+ if (isSpaceOrNewline(*(pos + 7))) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): found RSS 1.0 tag");
+ return RSSFilterStream::TypeRSS10;
+ }
+
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): wrong RSS 1.0 tag: %.*s", 32, pos);
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ if (!strncasecmp(pos, "?xml", 4)) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): found another xml tag");
+ // This is another xml info, skip it.
+ pos += 4;
+ pos = strstr(pos, "?>");
+
+ if (!pos || (pos - str >= strLen)) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): extra xml tag too long");
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ pos += 2;
+ continue;
+ }
+
+ if (!strncasecmp(pos, "!--", 3)) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): found comments");
+ // This is comments, skip it.
+ pos += 3;
+ pos = strstr(pos, "-->");
+
+ if (!pos || (pos - str >= strLen)) {
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): comments too long");
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ pos += 3;
+ continue;
+ }
+
+ BBLOG(LogLevelInfo, "RSSTypeFromContent(): non rss type (%.*s) found", 32, pos);
+ return RSSFilterStream::TypeUnknown;
+ }
+
+ return RSSFilterStream::TypeUnknown;
+}
+
+static PassOwnPtr<RSSParserBase> createParser(RSSFilterStream::ResourceType type)
+{
+ BLACKBERRY_ASSERT(isRSSContent(type));
+
+ switch (type) {
+ case RSSFilterStream::TypeRSSAtom:
+ return adoptPtr(new RSSAtomParser());
+ case RSSFilterStream::TypeRSS10:
+ return adoptPtr(new RSS10Parser());
+ case RSSFilterStream::TypeRSS20:
+ return adoptPtr(new RSS20Parser());
+ default:
+ // The following code is just for compiler, it should never reach here.
+ return adoptPtr(new RSS20Parser());
+ }
+}
+
+static bool findXMLEncodingPosition(const char* str, const char*& encodingStart, const char*& encodingEnd)
+{
+ encodingStart = strstr(str, "<?xml ");
+ if (!encodingStart)
+ return false;
+
+ encodingStart += 6; // Length of "<?xml ".
+ char* endPos = strstr(const_cast<char*>(encodingStart), "?>");
+ if (!endPos)
+ return false;
+
+ encodingStart = strstr(const_cast<char*>(encodingStart), "encoding");
+
+ if (!encodingStart || encodingStart > endPos)
+ return false;
+
+ encodingStart += 8;
+
+ while (encodingStart < endPos && *encodingStart <= ' ')
+ ++encodingStart;
+
+ if (encodingStart == endPos || *encodingStart != '=')
+ return false;
+
+ ++encodingStart;
+
+ while (encodingStart < endPos && *encodingStart <= ' ')
+ ++encodingStart;
+
+ if (encodingStart == endPos)
+ return false;
+
+ char quote = *encodingStart;
+ if (quote != '\"' && quote != '\'')
+ return false;
+
+ ++encodingStart;
+ encodingEnd = strchr(const_cast<char*>(encodingStart), quote);
+
+ if (!encodingEnd || encodingEnd == encodingStart || encodingEnd > endPos)
+ return false;
+
+ return true;
+}
+
+static bool findXMLLanguagePosition(const char* str, const char*& langStart, const char*& langEnd)
+{
+ langStart = strstr(const_cast<char*>(str), "<language>");
+ if (!langStart)
+ return false;
+
+ langStart += 10; // Length of "<language>".
+ char* endPos = strstr(const_cast<char*>(langStart), "</language>");
+ if (!endPos)
+ return false;
+
+ while (langStart < endPos && *langStart <= ' ')
+ ++langStart;
+
+ if (langStart == endPos)
+ return false;
+
+ langEnd = endPos - 1;
+
+ while (langEnd > langStart && *langEnd <= ' ')
+ --langEnd;
+
+ ++langEnd;
+ return true;
+}
+
+static const char* defaultEncodingForLanguage(const char* language)
+{
+ if (!strcasecmp(language, "en")
+ || !strcasecmp(language, "en-US"))
+ return s_latin1EncodingName;
+ if (!strcasecmp(language, "zh-cn"))
+ return s_gbkEncodingName;
+
+ return 0;
+}
+
+static bool isTranscodingNeeded(const std::string& encoding)
+{
+ // When there's no encoding information, or the encoding can not be found in all encodings
+ // supported in our phone, we will try to transcode the content anyway, supposed to ASCII.
+
+ if (encoding.empty())
+ return true;
+
+ return TextEncoding(s_utf8EncodingName) != TextEncoding(encoding.c_str());
+}
+
+enum TranscodeResult {
+ Success,
+ SourceEncodingUnsupported,
+ SourceBroken,
+ TargetEncodingUnsupported,
+ TargetBufferInsufficient
+};
+
+static TranscodeResult transcode(const char* sourceEncoding,
+ const char* targetEncoding,
+ const char*& sourceStart,
+ int sourceLength,
+ char*& targetStart,
+ unsigned int targetLength)
+{
+ TextEncoding textEncodingSource(sourceEncoding);
+ if (!textEncodingSource.isValid())
+ return SourceEncodingUnsupported;
+
+ TextEncoding textEncodingTarget(targetEncoding);
+ if (!textEncodingTarget.isValid())
+ return TargetEncodingUnsupported;
+
+ bool sawError = false;
+ String ucs2 = TextCodecICU(textEncodingSource).decode(sourceStart, sourceLength, true, true, sawError);
+
+ if (sawError)
+ return SourceBroken;
+
+ CString encoded = TextCodecICU(textEncodingTarget).encode(ucs2.characters(), ucs2.length(), WebCore::EntitiesForUnencodables);
+ if (encoded.length() > targetLength)
+ return TargetBufferInsufficient;
+
+ strncpy(targetStart, encoded.data(), encoded.length());
+ targetStart += encoded.length();
+
+ return Success;
+}
+
+static bool transcodeContent(const std::string& content, const std::string& encoding, std::string& result)
+{
+ unsigned utf8length = content.size() * 3 / 2; // Use maximum number utf-8 length.
+ ScopeArray<char> buffer(new char[utf8length + 1]);
+
+ std::string xmlHeaderString;
+
+ const char* start = content.c_str();
+ const char* xmlStart = strstr(start, "<?xml ");
+ const char* xmlEnd;
+ if (xmlStart) {
+ xmlEnd = strstr(xmlStart, "?>");
+ if (!xmlEnd)
+ return false;
+ xmlEnd += 2; // Length of "?>".
+
+ const char* encodingStart;
+ const char* encodingEnd;
+ if (findXMLEncodingPosition(start, encodingStart, encodingEnd)) {
+ xmlHeaderString.assign(start, encodingStart - start);
+ xmlHeaderString.append(s_utf8EncodingName);
+ xmlHeaderString.append(encodingEnd, xmlEnd - encodingEnd);
+ } else {
+ xmlHeaderString.assign(start, (xmlEnd - 2) - start);
+ xmlHeaderString.append(" encoding=\"UTF-8\"?>");
+ }
+ } else {
+ xmlEnd = start;
+ xmlHeaderString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ }
+
+ const char* contentStart = xmlEnd;
+ char* bufferStart = &buffer[0];
+
+ TranscodeResult transcodeResult = transcode(encoding.c_str(), s_utf8EncodingName, contentStart, content.length() - (xmlEnd - xmlStart), bufferStart, utf8length);
+
+ // If the encoding is not supported, or if we failed to transcode the content, we will just
+ // encode the content to ASCII content, and replacing any non-ASCII character with a question
+ // mark. This will be better than displaying the raw text, as the raw text can not be displayed
+ // correctly anyway, as their encoding is not supported.
+
+ if (Success != transcodeResult) {
+ int i = 0;
+ for (; contentStart < start + content.size() ; ++contentStart, ++i) {
+ if (isASCIIPrintable(*contentStart))
+ buffer[i] = *contentStart;
+ else
+ buffer[i] = '?';
+ }
+
+ buffer[i] = 0;
+ } else
+ *bufferStart = 0;
+
+ result.assign(xmlHeaderString);
+ result.append(&buffer[0]);
+
+ return true;
+}
+
+RSSFilterStream::RSSFilterStream()
+ : FilterStream()
+ , m_resourceType(TypeUnknown)
+ , m_contentTypeIndex(-1)
+ , m_charsetChecked(false)
+ , m_encodingChecked(false)
+{
+}
+
+void RSSFilterStream::notifyStatusReceived(int status, const char* message)
+{
+ // Non-HTTP errors have no data to display, and redirects will never be displayed,
+ // so no need to check if they have RSS data
+ // HTTP errors may have data, and in theory it could be RSS data (although it's highly
+ // unlikely) so better to keep checking them.
+ if (status < 0 || (300 <= status && status < 400 && status != 304)) {
+ m_resourceType = TypeNotRSS;
+ // It is possible we will get 2 status code.
+ sendSavedHeaders();
+ }
+
+ FilterStream::notifyStatusReceived(status, message);
+}
+
+void RSSFilterStream::notifyHeadersReceived(NetworkRequest::HeaderList& headers)
+{
+ if (!isRSSContent(m_resourceType)) {
+ NetworkRequest::HeaderList::const_iterator end = headers.end();
+ NetworkRequest::HeaderList::const_iterator iter = headers.begin();
+ for (; iter != end; ++iter) {
+ if (equalIgnoringCase(iter->first, s_contentTypeHeaderKey)) {
+ if (iter->second.find("xml") != std::string::npos) {
+ m_contentTypeIndex = std::distance(NetworkRequest::HeaderList::const_iterator(headers.begin()), iter);
+ ResourceType type = RSSTypeFromContentType(iter->second);
+ if (isRSSContent(type))
+ m_resourceType = type;
+ else if (!isPotentialRSSMIMEType(iter->second))
+ m_resourceType = TypeNotRSS;
+ }
+ break;
+ }
+ }
+ }
+
+ if (m_contentTypeIndex < 0)
+ m_resourceType = TypeNotRSS;
+
+ if (m_resourceType == TypeNotRSS) {
+ sendSavedHeaders();
+ FilterStream::notifyHeadersReceived(headers);
+ } else
+ saveHeaders(headers);
+}
+
+void RSSFilterStream::notifyDataReceived(BlackBerry::Platform::NetworkBuffer* buffer)
+{
+ // Here we assume the first packet of data is enough for us to sniff the content type.
+ // If someday some decent real life web site void this assumption, we should re-implement
+ // this code. But for now it should be just fine.
+ if (m_resourceType == TypeUnknown)
+ m_resourceType = RSSTypeFromContent(BlackBerry::Platform::networkBufferData(buffer), BlackBerry::Platform::networkBufferDataLength(buffer));
+
+ // If we don't know the resource type at this stage, then it is not a RSS content.
+ if (m_resourceType == TypeUnknown)
+ m_resourceType = TypeNotRSS;
+
+ if (isRSSContent(m_resourceType))
+ appendData(buffer);
+ else {
+ sendSavedHeaders();
+ FilterStream::notifyDataReceived(buffer);
+ }
+}
+
+void RSSFilterStream::notifyClose(int status)
+{
+ if (isRSSContent(m_resourceType))
+ handleRSSContent();
+ else
+ FilterStream::notifyClose(status);
+}
+
+bool RSSFilterStream::convertContentToHtml(std::string& result)
+{
+ bool success = false;
+ const std::string& base = url();
+ const std::string& enc = encoding();
+
+ OwnPtr<RSSParserBase> parser = createParser(m_resourceType);
+
+ if (isTranscodingNeeded(enc)) {
+ std::string transcodedContent;
+ if (transcodeContent(m_content, enc, transcodedContent))
+ success = parser->parseBuffer(transcodedContent.data(), transcodedContent.length(), base.c_str(), s_utf8EncodingName);
+ } else
+ success = parser->parseBuffer(m_content.data(), m_content.length(), base.c_str(), s_utf8EncodingName);
+
+ if (!success)
+ return false;
+
+ OwnPtr<RSSGenerator> generator = adoptPtr(new RSSGenerator());
+ String html = generator->generateHtml(parser->m_root);
+ result = html.utf8(true).data();
+
+ return true;
+}
+
+void RSSFilterStream::handleRSSContent()
+{
+ BLACKBERRY_ASSERT(isRSSContent(m_resourceType));
+
+ BlackBerry::Platform::NetworkBuffer* buffer;
+ std::string html;
+ if (!convertContentToHtml(html))
+ buffer = BlackBerry::Platform::createNetworkBufferWithData(m_content.c_str(), m_content.size());
+ else {
+ updateRSSHeaders(html.size());
+ buffer = BlackBerry::Platform::createNetworkBufferWithData(html.c_str(), html.size());
+ }
+
+ sendSavedHeaders();
+ FilterStream::notifyDataReceived(buffer);
+ BlackBerry::Platform::releaseNetworkBuffer(buffer);
+ FilterStream::notifyClose(FilterStream::StatusSuccess);
+}
+
+const std::string& RSSFilterStream::charset()
+{
+ BLACKBERRY_ASSERT(m_contentTypeIndex >= 0);
+
+ if (m_charsetChecked)
+ return m_charset;
+
+ m_charsetChecked = true;
+
+ static const char* charsetPrefix = "charset=";
+ static const int charsetPrefixLen = strlen(charsetPrefix);
+ size_t pos = (m_headers.at(m_contentTypeIndex).second).find(charsetPrefix);
+ if (pos != std::string::npos) {
+ m_charset = m_headers.at(m_contentTypeIndex).second.substr(pos + charsetPrefixLen);
+ stripWhiteSpace(m_charset);
+ }
+
+ return m_charset;
+}
+
+const std::string& RSSFilterStream::encoding()
+{
+ if (m_encodingChecked)
+ return m_encoding;
+
+ m_encodingChecked = true;
+ const std::string& str = charset();
+
+ if (!str.empty()) {
+ m_encoding = str;
+ return m_encoding;
+ }
+
+ const char* start = m_content.c_str();
+ const char* encodingStart = 0;
+ const char* encodingEnd = 0;
+ if (findXMLEncodingPosition(start, encodingStart, encodingEnd)) {
+ m_encoding = std::string(encodingStart, encodingEnd - encodingStart);
+ return m_encoding;
+ }
+
+ if (findXMLLanguagePosition(start, encodingStart, encodingEnd)) {
+ std::string languageString(encodingStart, encodingEnd - encodingStart);
+ const char* defaultEncoding = defaultEncodingForLanguage(languageString.c_str());
+ if (defaultEncoding) {
+ m_encoding = defaultEncoding;
+ return m_encoding;
+ }
+ }
+
+ return m_encoding;
+}
+
+void RSSFilterStream::saveHeaders(const BlackBerry::Platform::NetworkRequest::HeaderList& headers)
+{
+ m_headers = headers;
+}
+
+void RSSFilterStream::removeHeader(const std::string& key)
+{
+ NetworkRequest::HeaderList::iterator end = m_headers.end();
+ for (NetworkRequest::HeaderList::iterator iter = m_headers.begin(); iter != end; ++iter) {
+ if (!strcasecmp(iter->first.c_str(), key.c_str())) {
+ m_headers.erase(iter);
+ return;
+ }
+ }
+}
+
+void RSSFilterStream::updateHeader(const std::string& key, const std::string& value)
+{
+ NetworkRequest::HeaderList::iterator iter = m_headers.begin();
+ NetworkRequest::HeaderList::iterator end = m_headers.end();
+ for (; iter != end; ++iter) {
+ if (!strcasecmp(iter->first.c_str(), key.c_str())) {
+ iter->second = value;
+ return;
+ }
+ }
+
+ m_headers.insert(iter, std::make_pair(key, value));
+}
+
+void RSSFilterStream::updateRSSHeaders(size_t size)
+{
+ removeHeader(s_contentEncodingHeaderKey);
+ updateHeader(s_contentTypeHeaderKey, "text/html; charset=utf-8");
+
+ char buffer[16];
+ snprintf(buffer, 16, "%d", size);
+ updateHeader(s_contentLengthHeaderKey, std::string(buffer, 16));
+}
+
+void RSSFilterStream::sendSavedHeaders()
+{
+ if (!m_headers.empty()) {
+ FilterStream::notifyHeadersReceived(m_headers);
+ m_contentTypeIndex = -1;
+ m_headers.clear();
+ }
+}
+
+void RSSFilterStream::appendData(BlackBerry::Platform::NetworkBuffer* buffer)
+{
+ m_content.append(networkBufferData(buffer), networkBufferDataLength(buffer));
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.h b/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.h
new file mode 100644
index 000000000..6c3e848e4
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSFilterStream.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RSSFilterStream_h
+#define RSSFilterStream_h
+
+#include <network/FilterStream.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+
+namespace WebCore {
+
+class RSSFilterStream : public BlackBerry::Platform::FilterStream {
+public:
+ enum ResourceType {
+ TypeUnknown,
+ TypeNotRSS,
+ TypeRSS10,
+ TypeRSS20,
+ TypeRSSAtom
+ };
+
+ RSSFilterStream();
+
+ virtual void notifyStatusReceived(int status, const char* message);
+ virtual void notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::HeaderList&);
+ virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer*);
+ virtual void notifyClose(int status);
+
+private:
+ bool convertContentToHtml(std::string& result);
+ void handleRSSContent();
+
+ const std::string& charset();
+ const std::string& encoding();
+
+ void saveHeaders(const BlackBerry::Platform::NetworkRequest::HeaderList&);
+ void removeHeader(const std::string& key);
+ void updateHeader(const std::string& key, const std::string& value);
+ void updateRSSHeaders(size_t);
+ void sendSavedHeaders();
+
+ void appendData(BlackBerry::Platform::NetworkBuffer*);
+
+ BlackBerry::Platform::NetworkRequest::HeaderList m_headers;
+ std::string m_content;
+ std::string m_charset;
+ std::string m_encoding;
+
+ ResourceType m_resourceType;
+ int m_contentTypeIndex;
+
+ bool m_charsetChecked;
+ bool m_encodingChecked;
+};
+
+} // namespace WebCore
+
+#endif // RSSFilterStream_h
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp
new file mode 100644
index 000000000..6f1f842a4
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSSGenerator.h"
+
+#include "LocalizeResource.h"
+#include "RSSParserBase.h"
+
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+static const char* s_defaultFeedTitle = i18n("Untitled Feed");
+static const char* s_defaultEntryTitle = i18n("Untitled Entry");
+
+RSSGenerator::RSSGenerator()
+{
+}
+
+RSSGenerator::~RSSGenerator()
+{
+}
+
+String RSSGenerator::generateHtml(RSSFeed* feed)
+{
+ String rc;
+ rc += "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />";
+ rc += "<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable= no\">";
+ rc += "<title>";
+
+ if (!feed->m_title.isEmpty())
+ rc += feed->m_title;
+ else if (!feed->m_link.isEmpty())
+ rc += feed->m_link;
+ else
+ rc += s_defaultFeedTitle;
+
+ rc += "</title></head><body>";
+
+ rc += "<h2>";
+ if (!feed->m_link.isEmpty()) {
+ rc += "<a href=\"";
+ rc += feed->m_link;
+ rc += "\">";
+ }
+ if (!feed->m_title.isEmpty())
+ rc += feed->m_title;
+ else
+ rc += s_defaultFeedTitle;
+
+ if (!feed->m_link.isEmpty())
+ rc += "</a>";
+
+ rc += "</h2>";
+
+ if (!feed->m_description.isEmpty()) {
+ rc += "<p>";
+ rc += feed->m_description;
+ rc += "</p>";
+ }
+
+ for (unsigned i = 0; i < feed->m_items.size(); ++i) {
+ RSSItem* item = feed->m_items[i];
+ String articleName;
+ rc += "<div id=\"";
+ rc += articleName;
+ rc += "\" class=\"article\">\n<a href=\"";
+ if (!item->m_link.isEmpty())
+ rc += item->m_link.utf8(true).data();
+ rc += "\"><b>";
+ if (!item->m_title.isEmpty())
+ rc += item->m_title.utf8(true).data();
+ else
+ rc += s_defaultEntryTitle;
+ rc += "</b></a>\n<br />";
+
+ if (!item->m_author.isEmpty()) {
+ rc += i18n("By");
+ rc += " <b>";
+ rc += item->m_author.utf8(true).data();
+ rc += "</b> ";
+ } else {
+ if (!feed->m_author.isEmpty()) {
+ rc += i18n("By");
+ rc += " <b>";
+ rc += feed->m_author.utf8(true).data();
+ rc += "</b> ";
+ }
+ }
+
+ if (!item->m_categories.isEmpty()) {
+ if (!item->m_author.isEmpty())
+ rc += i18n("under ");
+ else
+ rc += i18n("Under ");
+
+ for (unsigned i = 0; i < item->m_categories.size() ; ++i) {
+ rc += "<b>";
+ rc += item->m_categories[i].utf8(true).data();
+ rc += "</b>";
+
+ if (i < item->m_categories.size() - 1)
+ rc += ", ";
+ }
+ }
+
+ rc += "<br />";
+ if (!item->m_pubDate.isEmpty())
+ rc += item->m_pubDate.utf8(true).data();
+
+ rc += "<br />";
+ if (!item->m_description.isEmpty())
+ rc += item->m_description.utf8(true).data();
+ rc += "<br />";
+
+ if (item->m_enclosure) {
+ rc += "<br />";
+ rc += "<a href=\"";
+ rc += item->m_enclosure->m_url;
+ rc += "\">";
+ rc += i18n("Embedded ");
+
+ RSSEnclosure::Type type = item->m_enclosure->typeInEnum();
+ switch (type) {
+ case RSSEnclosure::TypeImage:
+ rc += i18n("Image");
+ break;
+ case RSSEnclosure::TypeAudio:
+ rc += i18n("Audio");
+ break;
+ case RSSEnclosure::TypeVideo:
+ rc += i18n("Video");
+ break;
+ case RSSEnclosure::TypeApplication:
+ default:
+ rc += i18n("Unknown Content");
+ break;
+ }
+
+ rc += i18n(" Source: ");
+ rc += item->m_enclosure->suggestedName();
+ rc += "</a><br /><br />";
+ }
+
+ rc += "<br /></div>\n";
+ }
+
+ rc += "</body></html>\n";
+
+ return rc;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.h b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.h
new file mode 100644
index 000000000..d78625ba5
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSGenerator.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef RSSGenerator_h
+#define RSSGenerator_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RSSFeed;
+
+class RSSGenerator {
+public:
+ RSSGenerator();
+ ~RSSGenerator();
+
+ String generateHtml(RSSFeed*);
+};
+
+} // namespace WebCore
+
+#endif // RSSGenerator_h
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp
new file mode 100644
index 000000000..e0a9d1af4
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "RSSParserBase.h"
+
+#include "libxml/parser.h"
+#include "libxml/xmlwriter.h"
+
+namespace WebCore {
+
+RSSEnclosure::RSSEnclosure()
+ : m_typeInEnum(TypeUnknown)
+{ }
+
+RSSEnclosure::Type RSSEnclosure::typeInEnum()
+{
+ if (TypeUnknown != m_typeInEnum)
+ return m_typeInEnum;
+
+ size_t div = m_type.find('/');
+ if (WTF::notFound == div || !div) {
+ m_typeInEnum = TypeUnsupported;
+ return m_typeInEnum;
+ }
+
+ String base = m_type.substring(0, div).lower();
+ if (base == "image")
+ m_typeInEnum = TypeImage;
+ else if (base == "audio")
+ m_typeInEnum = TypeAudio;
+ else if (base == "video")
+ m_typeInEnum = TypeVideo;
+ else if (base == "application")
+ m_typeInEnum = TypeApplication;
+ else
+ m_typeInEnum = TypeUnsupported;
+
+ return m_typeInEnum;
+}
+
+String RSSEnclosure::suggestedName() const
+{
+ size_t start = m_url.reverseFind('/');
+ if (WTF::notFound == start)
+ start = 0;
+ else
+ ++start;
+
+ return m_url.substring(start);
+}
+
+RSSFeed::RSSFeed()
+{
+}
+
+RSSFeed::~RSSFeed()
+{
+ clear();
+}
+
+void RSSFeed::clear()
+{
+ deleteAllValues(m_items);
+ m_items.clear();
+}
+
+RSSItem::RSSItem()
+ : m_enclosure(0)
+{
+}
+
+RSSItem::~RSSItem()
+{
+ clear();
+}
+
+void RSSItem::clear()
+{
+ delete m_enclosure;
+}
+
+RSSParserBase::RSSParserBase()
+ : m_root(0)
+{
+}
+
+RSSParserBase::~RSSParserBase()
+{
+ delete m_root;
+}
+
+String textFromXMLAttr(xmlAttr* attr)
+{
+ if (!attr)
+ return emptyString();
+
+ String text;
+
+ for (xmlNode* node = attr->children; node; node = node->next) {
+ if (node->type == XML_TEXT_NODE)
+ text += reinterpret_cast<const char*>(node->content);
+ }
+
+ return text.stripWhiteSpace();
+}
+
+String textFromXMLNode(xmlNode* node)
+{
+ if (!node)
+ return emptyString();
+
+ String text;
+
+ for (node = node->children; node; node = node->next) {
+ if ((node->type == XML_TEXT_NODE) || (node->type == XML_CDATA_SECTION_NODE))
+ text += reinterpret_cast<const char*>(node->content);
+ }
+
+ return text.stripWhiteSpace();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.h b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.h
new file mode 100644
index 000000000..fcb5adc0f
--- /dev/null
+++ b/Source/WebCore/platform/network/blackberry/rss/RSSParserBase.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef RSSParserBase_h
+#define RSSParserBase_h
+
+#include <libxml/tree.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RSSItem;
+
+class RSSEnclosure {
+public:
+ enum Type {
+ TypeUnknown,
+ TypeImage,
+ TypeAudio,
+ TypeVideo,
+ TypeApplication,
+ TypeUnsupported
+ };
+
+ RSSEnclosure();
+
+ Type typeInEnum();
+ String suggestedName() const;
+
+ String m_url;
+ String m_type;
+ String m_length;
+
+private:
+ Type m_typeInEnum;
+};
+
+class RSSItemBase {
+public:
+ String m_title;
+ String m_link;
+ String m_description;
+ String m_updated;
+ String m_author;
+ String m_pubDate;
+ String m_id;
+};
+
+class RSSFeed: public RSSItemBase {
+public:
+ RSSFeed();
+ ~RSSFeed();
+
+ void clear();
+
+ String m_language;
+ String m_ttl;
+
+ Vector<RSSItem*> m_items;
+};
+
+class RSSItem: public RSSItemBase {
+public:
+ RSSItem();
+ ~RSSItem();
+
+ void clear();
+
+ String m_comments;
+ Vector<String> m_categories;
+ RSSEnclosure* m_enclosure;
+};
+
+class RSSParserBase {
+public:
+ RSSParserBase();
+ virtual ~RSSParserBase();
+
+ virtual bool parseBuffer(const char* buffer, int length, const char* url, const char* encoding) = 0;
+
+ RSSFeed* m_root;
+};
+
+String textFromXMLAttr(xmlAttr*);
+String textFromXMLNode(xmlNode*);
+
+} // namespace WebCore
+
+#endif // RSSParserBase_h
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp
index 8d45f3ff8..a0056e03b 100644
--- a/Source/WebCore/rendering/RenderBox.cpp
+++ b/Source/WebCore/rendering/RenderBox.cpp
@@ -433,6 +433,21 @@ void RenderBox::updateLayerTransform()
layer()->updateTransform();
}
+LayoutUnit RenderBox::logicalHeightConstrainedByMinMax(LayoutUnit availableHeight)
+{
+ RenderStyle* styleToUse = style();
+ LayoutUnit result = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight());
+ if (result == -1)
+ result = availableHeight;
+ LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset.
+ LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? result : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight());
+ if (maxH == -1)
+ maxH = result;
+ result = min(maxH, result);
+ result = max(minH, result);
+ return result;
+}
+
IntRect RenderBox::absoluteContentBox() const
{
// This is wrong with transforms and flipped writing modes.
@@ -1979,13 +1994,12 @@ void RenderBox::computeLogicalHeight()
// grab our cached flexible height.
// FIXME: Account for block-flow in flexible boxes.
// https://bugs.webkit.org/show_bug.cgi?id=46418
- RenderStyle* styleToUse = style();
if (hasOverrideHeight() && parent()->isFlexibleBoxIncludingDeprecated())
h = Length(overrideLogicalContentHeight(), Fixed);
else if (treatAsReplaced)
h = Length(computeReplacedLogicalHeight(), Fixed);
else {
- h = styleToUse->logicalHeight();
+ h = style()->logicalHeight();
checkMinMaxHeight = true;
}
@@ -1999,17 +2013,9 @@ void RenderBox::computeLogicalHeight()
}
LayoutUnit heightResult;
- if (checkMinMaxHeight) {
- heightResult = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight());
- if (heightResult == -1)
- heightResult = logicalHeight();
- LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset.
- LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight());
- if (maxH == -1)
- maxH = heightResult;
- heightResult = min(maxH, heightResult);
- heightResult = max(minH, heightResult);
- } else {
+ if (checkMinMaxHeight)
+ heightResult = logicalHeightConstrainedByMinMax(logicalHeight());
+ else {
// The only times we don't check min/max height are when a fixed length has
// been given as an override. Just use that. The value has already been adjusted
// for box-sizing.
diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h
index 89ba90740..00b05f4e1 100644
--- a/Source/WebCore/rendering/RenderBox.h
+++ b/Source/WebCore/rendering/RenderBox.h
@@ -75,6 +75,8 @@ public:
LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }
LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); }
+ LayoutUnit logicalHeightConstrainedByMinMax(LayoutUnit);
+
int pixelSnappedLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); }
int pixelSnappedLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedWidth() : pixelSnappedHeight(); }
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp
index 5de6425f2..448d4da6d 100644
--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp
@@ -1233,21 +1233,23 @@ void RenderFlexibleBox::alignChildren(OrderIterator& iterator, const WTF::Vector
void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUnit lineCrossAxisExtent)
{
if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) {
- LayoutUnit logicalHeightBefore = child->logicalHeight();
- LayoutUnit stretchedLogicalHeight = child->logicalHeight() + availableAlignmentSpaceForChild(lineCrossAxisExtent, child);
-
- child->setLogicalHeight(stretchedLogicalHeight);
- child->computeLogicalHeight();
-
- // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905.
- if (child->logicalHeight() != logicalHeightBefore) {
- child->setOverrideLogicalContentHeight(child->logicalHeight() - child->borderAndPaddingLogicalHeight());
- child->setLogicalHeight(0);
- child->setChildNeedsLayout(true, MarkOnlyThis);
- child->layoutIfNeeded();
+ // FIXME: If the child has orthogonal flow, then it already has an override height set. How do we stretch?
+ if (!hasOrthogonalFlow(child)) {
+ LayoutUnit stretchedLogicalHeight = child->logicalHeight() + availableAlignmentSpaceForChild(lineCrossAxisExtent, child);
+ LayoutUnit desiredLogicalHeight = child->logicalHeightConstrainedByMinMax(stretchedLogicalHeight);
+
+ // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905.
+ if (desiredLogicalHeight != child->logicalHeight()) {
+ child->setOverrideLogicalContentHeight(desiredLogicalHeight - child->borderAndPaddingLogicalHeight());
+ child->setLogicalHeight(0);
+ child->setChildNeedsLayout(true, MarkOnlyThis);
+ child->layoutIfNeeded();
+ }
}
} else if (isColumnFlow() && child->style()->logicalWidth().isAuto() && isMultiline()) {
// FIXME: Handle min-width and max-width.
+ // FIXME: We only need to relayout here if the width changes.
+ // FIXME: The isMultiline check above may not be necessary if the width has not changed. See https://webkit.org/b/94237
LayoutUnit childWidth = lineCrossAxisExtent - crossAxisMarginExtentForChild(child);
child->setOverrideLogicalContentWidth(std::max(ZERO_LAYOUT_UNIT, childWidth));
child->setChildNeedsLayout(true, MarkOnlyThis);
diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
index 958cc7687..177a1676a 100644
--- a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
@@ -144,7 +144,6 @@ void RenderMultiColumnBlock::ensureColumnSets()
RenderMultiColumnSet* columnSet = new (renderArena()) RenderMultiColumnSet(document(), flowThread());
columnSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
RenderBlock::addChild(columnSet, firstChild());
- flowThread()->addRegionToThread(columnSet);
}
}
diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.h b/Source/WebCore/rendering/RenderMultiColumnBlock.h
index bfbfb380b..bd9f12afe 100644
--- a/Source/WebCore/rendering/RenderMultiColumnBlock.h
+++ b/Source/WebCore/rendering/RenderMultiColumnBlock.h
@@ -43,6 +43,8 @@ public:
LayoutUnit columnWidth() const { return m_columnWidth; }
unsigned columnCount() const { return m_columnCount; }
+ RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; }
+
private:
virtual bool isRenderMultiColumnBlock() const { return true; }
@@ -58,8 +60,6 @@ private:
void ensureColumnSets();
- RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; }
-
RenderMultiColumnFlowThread* m_flowThread;
unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default,
LayoutUnit m_columnWidth; // since a multi-column block that is split across variable width pages or regions will have different column counts and widths in each.
diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp
index b25222415..3ac55cc9e 100644
--- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp
@@ -24,6 +24,8 @@
*/
#include "config.h"
+#include "PaintInfo.h"
+#include "RenderMultiColumnFlowThread.h"
#include "RenderMultiColumnSet.h"
#include "RenderMultiColumnBlock.h"
@@ -60,6 +62,106 @@ void RenderMultiColumnSet::computeLogicalHeight()
setLogicalHeight(columnHeight());
}
+LayoutUnit RenderMultiColumnSet::columnGap() const
+{
+ if (style()->hasNormalColumnGap())
+ return style()->fontDescription().computedPixelSize(); // "1em" is recommended as the normal gap setting. Matches <p> margins.
+ return static_cast<int>(style()->columnGap());
+}
+
+LayoutRect RenderMultiColumnSet::columnRectAt(unsigned index) const
+{
+ LayoutUnit colLogicalWidth = columnWidth();
+ LayoutUnit colLogicalHeight = columnHeight();
+ LayoutUnit colLogicalTop = borderBefore() + paddingBefore();
+ LayoutUnit colLogicalLeft = borderAndPaddingLogicalLeft();
+ int colGap = columnGap();
+ if (style()->isLeftToRightDirection())
+ colLogicalLeft += index * (colLogicalWidth + colGap);
+ else
+ colLogicalLeft += contentLogicalWidth() - colLogicalWidth - index * (colLogicalWidth + colGap);
+
+ if (isHorizontalWritingMode())
+ return LayoutRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);
+ return LayoutRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth);
+}
+
+void RenderMultiColumnSet::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+ // FIXME: RenderRegions are replaced elements right now and so they only paint in the foreground phase.
+ // Columns should technically respect phases and allow for background/float/foreground overlap etc., just like
+ // RenderBlocks do. We can't correct this, however, until RenderRegions are changed to actually be
+ // RenderBlocks. Note this is a pretty minor issue, since the old column implementation clipped columns
+ // anyway, thus making it impossible for them to overlap one another. It's also really unlikely that the columns
+ // would overlap another block.
+ setRegionObjectsRegionStyle();
+ paintColumnRules(paintInfo, paintOffset);
+ paintColumnContents(paintInfo, paintOffset);
+ restoreRegionObjectsOriginalStyle();
+}
+
+void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+ if (paintInfo.context->paintingDisabled())
+ return;
+
+ RenderStyle* blockStyle = toRenderMultiColumnBlock(parent())->style();
+ const Color& ruleColor = blockStyle->visitedDependentColor(CSSPropertyWebkitColumnRuleColor);
+ bool ruleTransparent = blockStyle->columnRuleIsTransparent();
+ EBorderStyle ruleStyle = blockStyle->columnRuleStyle();
+ LayoutUnit ruleThickness = blockStyle->columnRuleWidth();
+ LayoutUnit colGap = columnGap();
+ bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent && ruleThickness <= colGap;
+ if (!renderRule)
+ return;
+
+ unsigned colCount = columnCount();
+
+ bool antialias = shouldAntialiasLines(paintInfo.context);
+
+ bool leftToRight = style()->isLeftToRightDirection();
+ LayoutUnit currLogicalLeftOffset = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth();
+ LayoutUnit ruleAdd = borderAndPaddingLogicalLeft();
+ LayoutUnit ruleLogicalLeft = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth();
+ LayoutUnit inlineDirectionSize = columnWidth();
+ BoxSide boxSide = isHorizontalWritingMode()
+ ? leftToRight ? BSLeft : BSRight
+ : leftToRight ? BSTop : BSBottom;
+
+ for (unsigned i = 0; i < colCount; i++) {
+ // Move to the next position.
+ if (leftToRight) {
+ ruleLogicalLeft += inlineDirectionSize + colGap / 2;
+ currLogicalLeftOffset += inlineDirectionSize + colGap;
+ } else {
+ ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
+ currLogicalLeftOffset -= (inlineDirectionSize + colGap);
+ }
+
+ // Now paint the column rule.
+ if (i < colCount - 1) {
+ LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft();
+ LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth();
+ LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
+ LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness;
+ IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom);
+ drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
+ }
+
+ ruleLogicalLeft = currLogicalLeftOffset;
+ }
+}
+
+void RenderMultiColumnSet::paintColumnContents(PaintInfo& /* paintInfo */, const LayoutPoint& /* paintOffset */)
+{
+ // For each rectangle, set it as the region rectangle and then let flow thread painting do the rest.
+ // We make multiple calls to paintIntoRegion, changing the rectangles each time.
+ if (!columnCount())
+ return;
+
+ // FIXME: Implement.
+}
+
const char* RenderMultiColumnSet::renderName() const
{
return "RenderMultiColumnSet";
diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.h b/Source/WebCore/rendering/RenderMultiColumnSet.h
index bbe46ff02..b9a9da054 100644
--- a/Source/WebCore/rendering/RenderMultiColumnSet.h
+++ b/Source/WebCore/rendering/RenderMultiColumnSet.h
@@ -65,11 +65,19 @@ private:
virtual void computeLogicalWidth() OVERRIDE;
virtual void computeLogicalHeight() OVERRIDE;
+ virtual void paintReplaced(PaintInfo&, const LayoutPoint& paintOffset) OVERRIDE;
+
virtual LayoutUnit logicalWidthForFlowThreadContent() const OVERRIDE { return m_columnWidth; }
virtual LayoutUnit logicalHeightForFlowThreadContent() const OVERRIDE { return m_columnHeight; } // FIXME: Will be wrong once we have multiple sets.
virtual const char* renderName() const;
+ void paintColumnRules(PaintInfo&, const LayoutPoint& paintOffset);
+ void paintColumnContents(PaintInfo&, const LayoutPoint& paintOffset);
+
+ LayoutUnit columnGap() const;
+ LayoutRect columnRectAt( unsigned index) const;
+
unsigned m_columnCount;
LayoutUnit m_columnWidth;
LayoutUnit m_columnHeight;
diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp
index b9b33f397..dbdbe83f7 100644
--- a/Source/WebCore/rendering/RenderRegion.cpp
+++ b/Source/WebCore/rendering/RenderRegion.cpp
@@ -191,18 +191,11 @@ void RenderRegion::layout()
// We'll need to expand RenderBoxRegionInfo to also hold left and right overflow values.
}
-void RenderRegion::attachRegion()
+void RenderRegion::installFlowThread()
{
ASSERT(view());
- ASSERT(!m_flowThread);
- // Initialize the flow thread reference and create the flow thread object if needed.
- // The flow thread lifetime is influenced by the number of regions attached to it,
- // and we are attaching the region to the flow thread.
- m_flowThread = view()->flowThreadController()->ensureRenderFlowThreadWithName(style()->regionThread());
- // A region is valid if it is not part of a circular reference, which is checked below
- // and in RenderNamedFlowThread::addRegionToThread.
- setIsValid(false);
+ m_flowThread = view()->flowThreadController()->ensureRenderFlowThreadWithName(style()->regionThread());
// By now the flow thread should already be added to the rendering tree,
// so we go up the rendering parents and check that this region is not part of the same
@@ -214,15 +207,28 @@ void RenderRegion::attachRegion()
m_parentNamedFlowThread = toRenderNamedFlowThread(parentObject);
// Do not take into account a region that links a flow with itself. The dependency
// cannot change, so it is not worth adding it to the list.
- if (m_flowThread == m_parentNamedFlowThread) {
+ if (m_flowThread == m_parentNamedFlowThread)
m_flowThread = 0;
- // This region is not valid for this flow thread (as being part of a circular dependency).
- setIsValid(false);
- return;
- }
break;
}
}
+}
+
+void RenderRegion::attachRegion()
+{
+ if (documentBeingDestroyed())
+ return;
+
+ // A region starts off invalid.
+ setIsValid(false);
+
+ // Initialize the flow thread reference and create the flow thread object if needed.
+ // The flow thread lifetime is influenced by the number of regions attached to it,
+ // and we are attaching the region to the flow thread.
+ installFlowThread();
+
+ if (!m_flowThread)
+ return;
m_flowThread->addRegionToThread(this);
diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h
index 861afcbe9..93c0fc08b 100644
--- a/Source/WebCore/rendering/RenderRegion.h
+++ b/Source/WebCore/rendering/RenderRegion.h
@@ -97,23 +97,29 @@ public:
virtual LayoutUnit logicalWidthForFlowThreadContent() const;
virtual LayoutUnit logicalHeightForFlowThreadContent() const;
+protected:
+ void setRegionObjectsRegionStyle();
+ void restoreRegionObjectsOriginalStyle();
+
private:
virtual const char* renderName() const { return "RenderRegion"; }
virtual void insertedIntoTree() OVERRIDE;
virtual void willBeRemovedFromTree() OVERRIDE;
+ virtual void installFlowThread();
+
PassRefPtr<RenderStyle> computeStyleInRegion(const RenderObject*);
void computeChildrenStyleInRegion(const RenderObject*);
- void setRegionObjectsRegionStyle();
- void restoreRegionObjectsOriginalStyle();
void setObjectStyleInRegion(RenderObject*, PassRefPtr<RenderStyle>, bool objectRegionStyleCached);
void printRegionObjectsStyles();
void checkRegionStyle();
+protected:
RenderFlowThread* m_flowThread;
+private:
// If this RenderRegion is displayed as part of another named flow,
// we need to create a dependency tree, so that layout of the
// regions is always done before the regions themselves.
diff --git a/Source/WebCore/rendering/RenderRegionSet.cpp b/Source/WebCore/rendering/RenderRegionSet.cpp
index f9699ac13..e9dca62a3 100644
--- a/Source/WebCore/rendering/RenderRegionSet.cpp
+++ b/Source/WebCore/rendering/RenderRegionSet.cpp
@@ -33,4 +33,10 @@ RenderRegionSet::RenderRegionSet(Node* node, RenderFlowThread* flowThread)
{
}
+void RenderRegionSet::installFlowThread()
+{
+ // We don't have to do anything, since we were able to connect the flow thread
+ // in the constructor.
+}
+
}
diff --git a/Source/WebCore/rendering/RenderRegionSet.h b/Source/WebCore/rendering/RenderRegionSet.h
index 3977dbc3b..3771f004e 100644
--- a/Source/WebCore/rendering/RenderRegionSet.h
+++ b/Source/WebCore/rendering/RenderRegionSet.h
@@ -50,6 +50,8 @@ public:
RenderRegionSet(Node*, RenderFlowThread*);
private:
+ virtual void installFlowThread() OVERRIDE;
+
virtual const char* renderName() const = 0;
};
diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp
index d34070cc6..2644a8438 100644
--- a/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/Source/WebCore/rendering/RenderTableSection.cpp
@@ -114,16 +114,13 @@ void RenderTableSection::styleDidChange(StyleDifference diff, const RenderStyle*
table->invalidateCollapsedBorders();
}
-void RenderTableSection::willBeDestroyed()
+void RenderTableSection::willBeRemovedFromTree()
{
- RenderTable* recalcTable = table();
-
- RenderBox::willBeDestroyed();
-
- // recalc cell info because RenderTable has unguarded pointers
- // stored that point to this RenderTableSection.
- if (recalcTable)
- recalcTable->setNeedsSectionRecalc();
+ RenderBox::willBeRemovedFromTree();
+
+ // Preventively invalidate our cells as we may be re-inserted into
+ // a new table which would require us to rebuild our structure.
+ setNeedsCellRecalc();
}
void RenderTableSection::addChild(RenderObject* child, RenderObject* beforeChild)
diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h
index 891038e14..89bff39a0 100644
--- a/Source/WebCore/rendering/RenderTableSection.h
+++ b/Source/WebCore/rendering/RenderTableSection.h
@@ -206,7 +206,7 @@ private:
virtual bool isTableSection() const { return true; }
- virtual void willBeDestroyed();
+ virtual void willBeRemovedFromTree() OVERRIDE;
virtual void layout();
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
index 14cb67d88..62fe5b89f 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
@@ -266,13 +266,13 @@ void StyleRareInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
info.addMember(textShadow);
- info.addMember(highlight);
+ info.addInstrumentedMember(highlight);
info.addMember(cursorData);
- info.addMember(hyphenationString);
- info.addMember(locale);
- info.addMember(textEmphasisCustomMark);
+ info.addInstrumentedMember(hyphenationString);
+ info.addInstrumentedMember(locale);
+ info.addInstrumentedMember(textEmphasisCustomMark);
info.addMember(quotes);
- info.addMember(m_lineGrid);
+ info.addInstrumentedMember(m_lineGrid);
#if ENABLE(CSS_VARIABLES)
info.addMember(m_variables);
#endif
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
index 1e2f4488d..5b800d0ac 100644
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
@@ -323,8 +323,8 @@ void StyleRareNonInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObject
info.addMember(m_transitions);
info.addMember(m_wrapShapeInside);
info.addMember(m_wrapShapeOutside);
- info.addMember(m_flowThread);
- info.addMember(m_regionThread);
+ info.addInstrumentedMember(m_flowThread);
+ info.addInstrumentedMember(m_regionThread);
}
} // namespace WebCore
diff --git a/Source/WebCore/svg/SVGPaint.cpp b/Source/WebCore/svg/SVGPaint.cpp
index 4d84f5221..ba7443583 100644
--- a/Source/WebCore/svg/SVGPaint.cpp
+++ b/Source/WebCore/svg/SVGPaint.cpp
@@ -115,7 +115,7 @@ PassRefPtr<SVGPaint> SVGPaint::cloneForCSSOM() const
void SVGPaint::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
- info.addMember(m_uri);
+ info.addInstrumentedMember(m_uri);
}
}
diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp
index dc023162e..cc3b55488 100644
--- a/Source/WebCore/svg/SVGTRefElement.cpp
+++ b/Source/WebCore/svg/SVGTRefElement.cpp
@@ -69,9 +69,9 @@ public:
? static_cast<const SVGTRefTargetEventListener*>(listener) : 0;
}
- void attach(Element* target, String& targetId);
+ void attach(PassRefPtr<Element> target);
void detach();
- bool isAttached() const { return m_attached; }
+ bool isAttached() const { return m_target.get(); }
private:
SVGTRefTargetEventListener(SVGTRefElement* trefElement);
@@ -80,29 +80,26 @@ private:
virtual bool operator==(const EventListener&) OVERRIDE;
SVGTRefElement* m_trefElement;
- String m_targetId;
- bool m_attached;
+ RefPtr<Element> m_target;
};
SVGTRefTargetEventListener::SVGTRefTargetEventListener(SVGTRefElement* trefElement)
: EventListener(SVGTRefTargetEventListenerType)
, m_trefElement(trefElement)
- , m_attached(false)
+ , m_target(0)
{
ASSERT(m_trefElement);
}
-void SVGTRefTargetEventListener::attach(Element* target, String& targetId)
+void SVGTRefTargetEventListener::attach(PassRefPtr<Element> target)
{
ASSERT(!isAttached());
- ASSERT(target);
+ ASSERT(target.get());
ASSERT(target->inDocument());
- ASSERT(!targetId.isEmpty());
target->addEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
target->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, false);
- m_targetId = targetId;
- m_attached = true;
+ m_target = target;
}
void SVGTRefTargetEventListener::detach()
@@ -110,13 +107,9 @@ void SVGTRefTargetEventListener::detach()
if (!isAttached())
return;
- if (Element* target = m_trefElement->treeScope()->getElementById(m_targetId)) {
- target->removeEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
- target->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, false);
- }
-
- m_targetId = emptyString();
- m_attached = false;
+ m_target->removeEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
+ m_target->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, false);
+ m_target.clear();
}
bool SVGTRefTargetEventListener::operator==(const EventListener& listener)
@@ -131,7 +124,7 @@ void SVGTRefTargetEventListener::handleEvent(ScriptExecutionContext*, Event* eve
ASSERT(isAttached());
if (event->type() == eventNames().DOMSubtreeModifiedEvent && m_trefElement != event->target())
- m_trefElement->updateReferencedText();
+ m_trefElement->updateReferencedText(m_target.get());
else if (event->type() == eventNames().DOMNodeRemovedFromDocumentEvent)
m_trefElement->detachTarget();
}
@@ -183,10 +176,10 @@ void SVGTRefElement::createShadowSubtree()
ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot, ASSERT_NO_EXCEPTION);
}
-void SVGTRefElement::updateReferencedText()
+void SVGTRefElement::updateReferencedText(Element* target)
{
String textContent;
- if (Element* target = SVGURIReference::targetElementFromIRIString(href(), document()))
+ if (target)
textContent = target->textContent();
ASSERT(shadow());
@@ -296,8 +289,8 @@ void SVGTRefElement::buildPendingResource()
return;
String id;
- Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
- if (!target) {
+ RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+ if (!target.get()) {
if (id.isEmpty())
return;
@@ -311,9 +304,9 @@ void SVGTRefElement::buildPendingResource()
// expects every element instance to have an associated shadow tree element - which is not the
// case when we land here from SVGUseElement::buildShadowTree().
if (!isInShadowTree())
- m_targetListener->attach(target, id);
+ m_targetListener->attach(target);
- updateReferencedText();
+ updateReferencedText(target.get());
}
Node::InsertionNotificationRequest SVGTRefElement::insertedInto(ContainerNode* rootParent)
diff --git a/Source/WebCore/svg/SVGTRefElement.h b/Source/WebCore/svg/SVGTRefElement.h
index 3a4601db4..b80cba2a4 100644
--- a/Source/WebCore/svg/SVGTRefElement.h
+++ b/Source/WebCore/svg/SVGTRefElement.h
@@ -53,7 +53,7 @@ private:
virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
virtual void removedFrom(ContainerNode*) OVERRIDE;
- void updateReferencedText();
+ void updateReferencedText(Element*);
void detachTarget();
diff --git a/Source/WebCore/xml/XMLViewer.css b/Source/WebCore/xml/XMLViewer.css
index 2a1d5fdcc..f96b0b1c8 100644
--- a/Source/WebCore/xml/XMLViewer.css
+++ b/Source/WebCore/xml/XMLViewer.css
@@ -51,7 +51,7 @@ div.collapsible > div.hidden {
margin-left: 1em;
}
.comment {
- whitespace: pre;
+ white-space: pre;
}
.button {
diff --git a/Source/WebCore/xml/XMLViewer.js b/Source/WebCore/xml/XMLViewer.js
index 22405e003..86159843c 100644
--- a/Source/WebCore/xml/XMLViewer.js
+++ b/Source/WebCore/xml/XMLViewer.js
@@ -289,6 +289,7 @@ function createExpandButton(str)
function createComment(commentString)
{
var comment = createHTMLElement('span');
+ comment.classList.add('comment');
comment.classList.add('webkit-html-comment');
comment.textContent = commentString;
return comment;
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp
index 137bc23cb..c50c39829 100644
--- a/Source/WebKit/blackberry/Api/WebPage.cpp
+++ b/Source/WebKit/blackberry/Api/WebPage.cpp
@@ -331,6 +331,11 @@ void WebPage::autofillTextField(const string& item)
d->m_autofillManager->autofillTextField(item.c_str());
}
+void WebPage::enableQnxJavaScriptObject(bool enabled)
+{
+ d->m_enableQnxJavaScriptObject = enabled;
+}
+
WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect)
: m_webPage(webPage)
, m_client(client)
@@ -404,6 +409,7 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
, m_fullscreenVideoNode(0)
, m_hasInRegionScrollableAreas(false)
, m_updateDelegatedOverlaysDispatched(false)
+ , m_enableQnxJavaScriptObject(true)
, m_deferredTasksTimer(this, &WebPagePrivate::deferredTasksTimerFired)
, m_selectPopup(0)
, m_autofillManager(AutofillManager::create(this))
@@ -1497,17 +1503,17 @@ bool WebPage::scrollBy(const Platform::IntSize& delta, bool scrollMainFrame)
return b;
}
-void WebPagePrivate::notifyInRegionScrollStatusChanged(bool status)
+void WebPagePrivate::notifyInRegionScrollStopped()
{
- if (!status && m_inRegionScroller->d->hasNode()) {
+ if (m_inRegionScroller->d->hasNode()) {
enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(m_inRegionScroller->d->node());
m_inRegionScroller->d->reset();
}
}
-void WebPage::notifyInRegionScrollStatusChanged(bool status)
+void WebPage::notifyInRegionScrollStopped()
{
- d->notifyInRegionScrollStatusChanged(status);
+ d->notifyInRegionScrollStopped();
}
void WebPagePrivate::enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(Node* scrolledNode)
diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h
index 06aabeb94..dc4cf165d 100644
--- a/Source/WebKit/blackberry/Api/WebPage.h
+++ b/Source/WebKit/blackberry/Api/WebPage.h
@@ -176,7 +176,7 @@ public:
// Scroll position provided should be in transformed coordinates.
void setScrollPosition(const Platform::IntPoint&);
bool scrollBy(const Platform::IntSize&, bool scrollMainFrame = true);
- void notifyInRegionScrollStatusChanged(bool status);
+ void notifyInRegionScrollStopped();
void setScrollOriginPoint(const Platform::IntPoint&);
BackingStore* backingStore() const;
@@ -380,6 +380,8 @@ public:
void autofillTextField(const std::string&);
+ void enableQnxJavaScriptObject(bool);
+
private:
virtual ~WebPage();
diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h
index 04eb1b7fc..2ee4d6a04 100644
--- a/Source/WebKit/blackberry/Api/WebPage_p.h
+++ b/Source/WebKit/blackberry/Api/WebPage_p.h
@@ -150,7 +150,7 @@ public:
bool scrollBy(int deltaX, int deltaY, bool scrollMainFrame = true);
void enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(WebCore::Node*);
- void notifyInRegionScrollStatusChanged(bool status);
+ void notifyInRegionScrollStopped();
void setScrollOriginPoint(const Platform::IntPoint&);
void setHasInRegionScrollableAreas(bool);
@@ -615,6 +615,8 @@ public:
WebCore::KURL m_cachedManualScript;
bool m_cachedFocused;
+ bool m_enableQnxJavaScriptObject;
+
class DeferredTaskBase {
public:
void perform(WebPagePrivate* webPagePrivate)
diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog
index 253f13964..0db79e222 100644
--- a/Source/WebKit/blackberry/ChangeLog
+++ b/Source/WebKit/blackberry/ChangeLog
@@ -1,3 +1,131 @@
+2012-08-21 Benjamin C Meyer <bmeyer@rim.com>
+
+ [BlackBerry] Add option to only add JavaScript object 'qnx' to private webviews
+ https://bugs.webkit.org/show_bug.cgi?id=94621
+
+ Reviewed by Yong Li.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPage::enableQnxJavaScriptObject):
+ (WebKit):
+ (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+ * Api/WebPage.h:
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+ * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+ (WebCore::FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld):
+
+2012-08-21 Robin Cao <robin.cao@torchmobile.com.cn>
+
+ [BlackBerry] Add support for getUserMedia
+ https://bugs.webkit.org/show_bug.cgi?id=94591
+
+ Reviewed by George Staikos.
+
+ Implement getUserMedia feature using the platform API.
+
+ PR #153571
+
+ Reviewed internally by George Staikos.
+
+ * WebCoreSupport/UserMediaClientImpl.cpp:
+ (WebCore):
+ (WebCore::userMediaRequestsMap):
+ (WebCore::toMediaStreamSource):
+ (WebCore::toMediaStreamDescriptor):
+ (WebUserMediaRequestClientImpl):
+ (WebCore::WebUserMediaRequestClientImpl::WebUserMediaRequestClientImpl):
+ (WebCore::WebUserMediaRequestClientImpl::requestSucceeded):
+ (WebCore::WebUserMediaRequestClientImpl::requestFailed):
+ (WebCore::UserMediaClientImpl::UserMediaClientImpl):
+ (WebCore::UserMediaClientImpl::~UserMediaClientImpl):
+ (WebCore::UserMediaClientImpl::requestUserMedia):
+ (WebCore::UserMediaClientImpl::cancelUserMediaRequest):
+ (WebCore::UserMediaClientImpl::webUserMedia):
+ * WebCoreSupport/UserMediaClientImpl.h:
+ (BlackBerry):
+ (Platform):
+ (UserMediaClientImpl):
+
+2012-08-21 Kihong Kwon <kihong.kwon@samsung.com>
+
+ [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=94586
+
+ Reviewed by Kentaro Hara.
+
+ Fix build error in the DeviceOrientationClientBlackBerry.cpp.
+ It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore.
+
+ * WebCoreSupport/DeviceOrientationClientBlackBerry.cpp:
+ (DeviceOrientationClientBlackBerry::lastOrientation):
+
+2012-08-21 Jacky Jiang <zhajiang@rim.com>
+
+ [BlackBerry] about:memory and about:memory-live should show numbers for the chrome process
+ https://bugs.webkit.org/show_bug.cgi?id=94531
+
+ Reviewed by Rob Buis.
+ Patch by Jacky Jiang <zhajiang@rim.com>
+
+ PR: 190504
+ Add total committed memory of chrome process into about:memory and add
+ its peak into about:memory-live.
+
+ Internally reviewed by Yong Li and George Staikos.
+
+ * WebKitSupport/AboutData.cpp:
+ (BlackBerry::WebKit::memoryPage):
+ (BlackBerry::WebKit::MemoryTracker::clear):
+ (MemoryTracker):
+ (BlackBerry::WebKit::MemoryTracker::peakTotalCommittedMemoryOfCurrentProcess):
+ (BlackBerry::WebKit::MemoryTracker::peakTotalCommittedMemoryOfChromeProcess):
+ (BlackBerry::WebKit::MemoryTracker::MemoryTracker):
+ (BlackBerry::WebKit::MemoryTracker::updateMemoryPeaks):
+ (BlackBerry::WebKit::memoryPeaksToHtmlTable):
+
+2012-08-21 Antonio Gomes <agomes@rim.com>
+
+ [BlackBerry] Accelerated In-Region Scrolling does not render correctly on rotation
+ https://bugs.webkit.org/show_bug.cgi?id=94608
+ PR #194754
+
+ Reviewed by Goerge Staikos.
+
+ When one translates/scrolls a HW accelerated scrollable layer, it makes use of
+ the OVERRIDE mechanism. Suppose the following scenario:
+
+ - In landscape, the overflow menu is scrollable. Then the user scrolls it so
+ that is has scroll position of 0, -100.
+ - when he rotates to portrait, the menus fit well to the available space but it
+ still has the OVERRIDE set, so it keeps the layer translated at 0, -100.
+
+ Fix is simple: clear the override when we stop scrolling a HW accelerated layer,
+ when we destroy the objects.
+
+ * WebKitSupport/InRegionScrollableArea.cpp:
+ (BlackBerry::WebKit::InRegionScrollableArea::~InRegionScrollableArea):
+
+2012-08-21 Antonio Gomes <agomes@rim.com>
+
+ [BlackBerry] Properly notify WebKit when Client stops in-region scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=94603
+ PR #195813
+
+ Reviewed by Goerge Staikos.
+
+ Simplify the API to get a notification of when a in-region
+ scrolling has finished.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::notifyInRegionScrollStopped):
+ Removed an unneeded parameter.
+ (BlackBerry::WebKit::WebPage::notifyInRegionScrollStopped):
+ Ditto.
+ * Api/WebPage.h:
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+
2012-08-20 Sean Wang <Xuewen.Wang@torchmobile.com.cn>
[BlackBerry] Select popup shows blank content when its option tags contain '\' characters
diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp
index 2970a4f5b..683647506 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp
+++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp
@@ -62,7 +62,7 @@ void DeviceOrientationClientBlackBerry::stopUpdating()
m_tracker->suspend();
}
-DeviceOrientation* DeviceOrientationClientBlackBerry::lastOrientation() const
+DeviceOrientationData* DeviceOrientationClientBlackBerry::lastOrientation() const
{
return m_currentOrientation.get();
}
diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
index 320c639ec..bbaf2cecb 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
+++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
@@ -903,9 +903,8 @@ void FrameLoaderClientBlackBerry::dispatchDidClearWindowObjectInWorld(DOMWrapper
return;
// Provide the extension object first in case the client or others want to use it.
- // FIXME: Conditionally attach extension object based on some flag or whether or not we
- // are browser or something else.
- attachExtensionObjectToFrame(m_frame, m_webPagePrivate->m_client);
+ if (m_webPagePrivate->m_enableQnxJavaScriptObject)
+ attachExtensionObjectToFrame(m_frame, m_webPagePrivate->m_client);
m_webPagePrivate->m_client->notifyWindowObjectCleared();
diff --git a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp
index 57f0fe79e..a4e45c2e5 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp
+++ b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp
@@ -20,18 +20,89 @@
#include "UserMediaClientImpl.h"
#if ENABLE(MEDIA_STREAM)
+#include "MediaStreamDescriptor.h"
#include "WebPage.h"
+#include <BlackBerryPlatformWebMediaStreamDescriptor.h>
+#include <BlackBerryPlatformWebUserMedia.h>
+#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
+using namespace BlackBerry::Platform;
+
namespace WebCore {
+class WebUserMediaRequestClientImpl;
+
+typedef HashMap<UserMediaRequest*, OwnPtr<WebUserMediaRequestClientImpl> > UserMediaRequestsMap;
+
+static UserMediaRequestsMap& userMediaRequestsMap()
+{
+ DEFINE_STATIC_LOCAL(UserMediaRequestsMap, requests, ());
+ return requests;
+}
+
+static PassRefPtr<MediaStreamSource> toMediaStreamSource(const WebMediaStreamSource& src)
+{
+ return MediaStreamSource::create(String::fromUTF8(src.id().c_str()), static_cast<MediaStreamSource::Type>(src.type()), String::fromUTF8(src.name().c_str()));
+}
+
+static PassRefPtr<MediaStreamDescriptor> toMediaStreamDescriptor(const WebMediaStreamDescriptor& d)
+{
+ MediaStreamSourceVector audioSources;
+ for (size_t i = 0; i < d.audios().size(); i++) {
+ RefPtr<MediaStreamSource> src = toMediaStreamSource(d.audios()[i]);
+ audioSources.append(src.release());
+ }
+
+ MediaStreamSourceVector videoSources;
+ for (size_t i = 0; i < d.videos().size(); i++) {
+ RefPtr<MediaStreamSource> src = toMediaStreamSource(d.videos()[i]);
+ videoSources.append(src.release());
+ }
+
+ return MediaStreamDescriptor::create(String::fromUTF8(d.label().c_str()), audioSources, videoSources);
+}
+
+class WebUserMediaRequestClientImpl : public WebUserMediaRequestClient {
+public:
+ WebUserMediaRequestClientImpl(PassRefPtr<UserMediaRequest> prpRequest)
+ : m_request(prpRequest)
+ {
+ }
+
+ void requestSucceeded(const WebMediaStreamDescriptor& d)
+ {
+ if (m_request) {
+ RefPtr<MediaStreamDescriptor> descriptor = toMediaStreamDescriptor(d);
+ m_request->succeed(descriptor);
+
+ userMediaRequestsMap().remove(m_request.get());
+ }
+ }
+
+ void requestFailed()
+ {
+ if (m_request) {
+ m_request->fail();
+ userMediaRequestsMap().remove(m_request.get());
+ }
+ }
+
+private:
+ RefPtr<UserMediaRequest> m_request;
+};
+
UserMediaClientImpl::UserMediaClientImpl(BlackBerry::WebKit::WebPage*)
+ : m_webUserMedia(0)
{
}
UserMediaClientImpl::~UserMediaClientImpl()
{
+ BlackBerry::Platform::deleteGuardedObject(m_webUserMedia);
}
void UserMediaClientImpl::pageDestroyed()
@@ -40,12 +111,29 @@ void UserMediaClientImpl::pageDestroyed()
void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
{
+ UserMediaRequest* request = prpRequest.get();
+ OwnPtr<WebUserMediaRequestClientImpl> requestClient = adoptPtr(new WebUserMediaRequestClientImpl(prpRequest));
+
+ webUserMedia()->requestUserMedia(WebUserMediaRequest(request->audio(), request->video(), requestClient.get()));
+ userMediaRequestsMap().add(request, requestClient.release());
}
-void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest*)
+void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request)
{
+ UserMediaRequestsMap::iterator it = userMediaRequestsMap().find(request);
+ if (it == userMediaRequestsMap().end())
+ return;
+
+ webUserMedia()->cancelUserMediaRequest(WebUserMediaRequest(request->audio(), request->video(), it->second.get()));
+ userMediaRequestsMap().remove(it);
}
+BlackBerry::Platform::WebUserMedia* UserMediaClientImpl::webUserMedia()
+{
+ if (!m_webUserMedia)
+ m_webUserMedia = new WebUserMedia;
+ return m_webUserMedia;
}
+}
#endif
diff --git a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h
index 6a9a01708..a31233b86 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h
+++ b/Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h
@@ -30,6 +30,10 @@ namespace BlackBerry {
namespace WebKit {
class WebPage;
}
+
+namespace Platform {
+class WebUserMedia;
+}
}
namespace WebCore {
@@ -47,6 +51,9 @@ public:
private:
UserMediaClientImpl();
+ BlackBerry::Platform::WebUserMedia* webUserMedia();
+
+ BlackBerry::Platform::WebUserMedia* m_webUserMedia;
};
}
diff --git a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp
index 1502e3db3..a6772ccb5 100644
--- a/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/AboutData.cpp
@@ -257,7 +257,11 @@ static String memoryPage()
page += numberToHTMLTr("Total used memory (malloc + JSC)", mallocInfo.usmblks + mallocInfo.uordblks + jscMemoryStat.stackBytes + jscMemoryStat.JITBytes + mainHeap.capacity());
- page += numberToHTMLTr("Total committed memory", BlackBerry::Platform::totalCommittedMemory());
+ if (unsigned totalCommittedMemoryOfChromeProcess = BlackBerry::Platform::totalCommittedMemoryOfChromeProcess()) {
+ page += numberToHTMLTr("Total committed memory of tab process", BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess());
+ page += numberToHTMLTr("Total committed memory of chrome process", totalCommittedMemoryOfChromeProcess);
+ } else
+ page += numberToHTMLTr("Total committed memory", BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess());
struct stat processInfo;
if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo))
@@ -316,24 +320,34 @@ public:
void start();
void stop();
bool isActive() const { return m_memoryTrackingTimer.isActive(); }
- void clear() { m_peakTotalUsedMemory = 0; m_peakTotalCommittedMemory = 0; m_peakTotalMappedMemory = 0; }
+ void clear()
+ {
+ m_peakTotalUsedMemory = 0;
+ m_peakTotalCommittedMemoryOfCurrentProcess = 0;
+ m_peakTotalCommittedMemoryOfChromeProcess = 0;
+ m_peakTotalMappedMemory = 0;
+ }
+
void updateMemoryPeaks(Timer<MemoryTracker>*);
unsigned peakTotalUsedMemory() const { return m_peakTotalUsedMemory; }
- unsigned peakTotalCommittedMemory() const {return m_peakTotalCommittedMemory; }
+ unsigned peakTotalCommittedMemoryOfCurrentProcess() const { return m_peakTotalCommittedMemoryOfCurrentProcess; }
+ unsigned peakTotalCommittedMemoryOfChromeProcess() const { return m_peakTotalCommittedMemoryOfChromeProcess; }
unsigned peakTotalMappedMemory() const { return m_peakTotalMappedMemory; }
private:
MemoryTracker();
Timer<MemoryTracker> m_memoryTrackingTimer;
unsigned m_peakTotalUsedMemory;
- unsigned m_peakTotalCommittedMemory;
+ unsigned m_peakTotalCommittedMemoryOfCurrentProcess;
+ unsigned m_peakTotalCommittedMemoryOfChromeProcess;
unsigned m_peakTotalMappedMemory;
};
MemoryTracker::MemoryTracker()
: m_memoryTrackingTimer(this, &MemoryTracker::updateMemoryPeaks)
, m_peakTotalUsedMemory(0)
- , m_peakTotalCommittedMemory(0)
+ , m_peakTotalCommittedMemoryOfCurrentProcess(0)
+ , m_peakTotalCommittedMemoryOfChromeProcess(0)
, m_peakTotalMappedMemory(0)
{
}
@@ -370,9 +384,13 @@ void MemoryTracker::updateMemoryPeaks(Timer<MemoryTracker>*)
if (totalUsedMemory > m_peakTotalUsedMemory)
m_peakTotalUsedMemory = totalUsedMemory;
- unsigned totalCommittedMemory = BlackBerry::Platform::totalCommittedMemory();
- if (totalCommittedMemory > m_peakTotalCommittedMemory)
- m_peakTotalCommittedMemory = totalCommittedMemory;
+ unsigned totalCommittedMemoryOfCurrentProcess = BlackBerry::Platform::totalCommittedMemoryOfCurrentProcess();
+ if (totalCommittedMemoryOfCurrentProcess > m_peakTotalCommittedMemoryOfCurrentProcess)
+ m_peakTotalCommittedMemoryOfCurrentProcess = totalCommittedMemoryOfCurrentProcess;
+
+ unsigned totalCommittedMemoryOfChromeProcess = BlackBerry::Platform::totalCommittedMemoryOfChromeProcess();
+ if (totalCommittedMemoryOfChromeProcess > m_peakTotalCommittedMemoryOfChromeProcess)
+ m_peakTotalCommittedMemoryOfChromeProcess = totalCommittedMemoryOfChromeProcess;
struct stat processInfo;
if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) {
@@ -384,11 +402,17 @@ void MemoryTracker::updateMemoryPeaks(Timer<MemoryTracker>*)
static String memoryPeaksToHtmlTable(MemoryTracker& memoryTracker)
{
- return String("<table class='fixed-table'><col width=75%><col width=25%>")
- + numberToHTMLTr("Total used memory(malloc + JSC):", memoryTracker.peakTotalUsedMemory())
- + numberToHTMLTr("Total committed memory:", memoryTracker.peakTotalCommittedMemory())
- + numberToHTMLTr("Total mapped memory:", memoryTracker.peakTotalMappedMemory())
- + "</table>";
+ String htmlTable = String("<table class='fixed-table'><col width=75%><col width=25%>")
+ + numberToHTMLTr("Total used memory(malloc + JSC):", memoryTracker.peakTotalUsedMemory());
+
+ if (unsigned peakTotalCommittedMemoryOfChromeProcess = memoryTracker.peakTotalCommittedMemoryOfChromeProcess()) {
+ htmlTable += numberToHTMLTr("Total committed memory of tab process:", memoryTracker.peakTotalCommittedMemoryOfCurrentProcess());
+ htmlTable += numberToHTMLTr("Total committed memory of chrome process:", peakTotalCommittedMemoryOfChromeProcess);
+ } else
+ htmlTable += numberToHTMLTr("Total committed memory:", memoryTracker.peakTotalCommittedMemoryOfCurrentProcess());
+
+ htmlTable += numberToHTMLTr("Total mapped memory:", memoryTracker.peakTotalMappedMemory()) + "</table>";
+ return htmlTable;
}
static String memoryLivePage(String memoryLiveCommand)
diff --git a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp
index 18a750a89..44e7b49a9 100644
--- a/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp
+++ b/Source/WebKit/blackberry/WebKitSupport/InRegionScrollableArea.cpp
@@ -42,6 +42,8 @@ InRegionScrollableArea::InRegionScrollableArea()
InRegionScrollableArea::~InRegionScrollableArea()
{
+ if (m_cachedCompositedScrollableLayer)
+ m_cachedCompositedScrollableLayer->clearOverride();
}
InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer)
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 3d42baa97..7804ecd97 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,718 @@
+2012-08-22 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126202.
+ http://trac.webkit.org/changeset/126202
+ https://bugs.webkit.org/show_bug.cgi?id=94657
+
+ Causes assertion failures on Chromium Linux dbg compositing
+ layout tests (Requested by dominicc on #webkit).
+
+ * tests/CCResourceProviderTest.cpp:
+ (WebKit::CCResourceProviderTest::CCResourceProviderTest):
+ (WebKit::CCResourceProviderTest::getResourcePixels):
+ (WebKit::TEST_F):
+
+2012-08-21 Leandro Gracia Gil <leandrogracia@chromium.org>
+
+ [Chromium] Find-in-page coordinates should use containingBlock
+ https://bugs.webkit.org/show_bug.cgi?id=94343
+
+ Reviewed by Julien Chaffraix.
+
+ The current implementation uses the container method to climb the render tree.
+ However, it would be more correct and convenient to use containingBlock instead.
+ Also, this patch introduces new tests for find-in-page coordinates in tables.
+
+ * src/FindInPageCoordinates.cpp:
+ (WebKit::toNormalizedRect): use containingBlock and get rid of the output parameter as it's not required now.
+ (WebKit::findInPageRectFromAbsoluteRect): use containingBlock introduce some simplifications.
+ * tests/WebFrameTest.cpp: add new tests for tables.
+ * tests/data/find_in_page.html:
+ * tests/data/find_in_page_frame.html: new tests for tables.
+
+2012-08-21 Alexandre Elias <aelias@google.com>
+
+ [chromium] Add software bitmap resources to CCResourceProvider
+ https://bugs.webkit.org/show_bug.cgi?id=93677
+
+ Reviewed by Adrienne Walker.
+
+ This adds the ability to CCResourceProvider to use software bitmaps.
+ They are allocated as plain-old-memory, and exposed as Skia objects.
+
+ We want the ResourceProvider to be able to handle different resource
+ types at the same time. In practice, a default resource type is
+ desired for most uses within a single compositor instance, which is
+ specified by the default resource type. Default resource types are
+ expected to be mostly 1-to-1 with CCRenderer types.
+
+ New tests added by parametrizing existing CCResourceProvider tests.
+
+ * tests/CCResourceProviderTest.cpp:
+ (WebKit::CCResourceProviderTest::getResourcePixels):
+
+2012-08-21 Oli Lan <olilan@chromium.org>
+
+ [chromium] Add WebView methods setCompositionFromExistingText and extendSelectionAndDelete.
+ https://bugs.webkit.org/show_bug.cgi?id=93724
+
+ Reviewed by Ryosuke Niwa.
+
+ This adds two new methods to WebViewImpl.
+
+ 1) setCompositionFromExistingText creates a new composition from the existing text
+ in the currently focused input field. The new composition is between the two offsets
+ provided, relative to the rootEditableElement. The current selection is left unchanged.
+
+ 2) extendSelectionAndDelete extends the selection by the specified number of characters
+ before and after, and then deletes the selection. If the selection is just a caret, the effect
+ is to delete the specified number of characters before and after the current editing point.
+
+ These methods will be used e.g. by the Android port to implement IME functionality.
+
+ New tests WebViewTest.ExtendSelectionAndDelete and WebViewTest.SetCompositionFromExistingText
+ test the two new methods.
+
+ * public/WebView.h:
+ (WebView):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setComposingRegion):
+ (WebKit):
+ (WebKit::extendSelectionAndDelete):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/WebViewTest.cpp:
+
+2012-08-21 Alec Flett <alecflett@chromium.org>
+
+ IndexedDB: remove old update/openCursor glue
+ https://bugs.webkit.org/show_bug.cgi?id=94378
+
+ Reviewed by Tony Chang.
+
+ Remove Chromium/WebKit API for old methods that have now been
+ removed from chromium proper.
+
+ * public/WebIDBObjectStore.h:
+ * src/IDBObjectStoreBackendProxy.cpp:
+ * src/IDBObjectStoreBackendProxy.h:
+ (IDBObjectStoreBackendProxy):
+ * src/WebIDBObjectStoreImpl.h:
+ (WebIDBObjectStoreImpl):
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ [chromium] Should be able to destroy a CCLayerTreeHost without manually setting the root layer
+ https://bugs.webkit.org/show_bug.cgi?id=94631
+
+ Reviewed by Adrienne Walker.
+
+ Tests that destroying a CCLayerTreeHost that still points to a non-null root doesn't crash.
+
+ * tests/LayerChromiumTest.cpp:
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126170.
+ http://trac.webkit.org/changeset/126170
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ I spoke too soon
+
+ * WebKit.gypi:
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setScrollLayer):
+ (WebKit::NonCompositedContentHost::setViewport):
+ (WebKit::NonCompositedContentHost::scrollLayer):
+ * src/NonCompositedContentHost.h:
+ * src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebContentLayer::create):
+ (WebKit::WebContentLayer::clearClient):
+ (WebKit::WebContentLayer::setDoubleSided):
+ (WebKit::WebContentLayer::setContentsScale):
+ (WebKit::WebContentLayer::setUseLCDText):
+ (WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles):
+ (WebKit::WebContentLayer::WebContentLayer):
+ (WebKit::WebContentLayer::operator=):
+ (WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>):
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayerImpl::create):
+ (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::paintContents):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp.
+ (WebKit):
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayer::clearClient):
+ (WebKit::WebExternalTextureLayer::setTextureId):
+ (WebKit::WebExternalTextureLayer::setFlipped):
+ (WebKit::WebExternalTextureLayer::setUVRect):
+ (WebKit::WebExternalTextureLayer::setOpaque):
+ (WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
+ (WebKit::WebExternalTextureLayer::willModifyTexture):
+ (WebKit::WebExternalTextureLayer::setRateLimitContext):
+ (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+ * src/WebExternalTextureLayerImpl.h: Removed.
+ * src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebIOSurfaceLayer::create):
+ (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties):
+ (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+ * src/WebIOSurfaceLayerImpl.h: Removed.
+ * src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h.
+ (WebKit):
+ (WebKit::WebImageLayer::create):
+ (WebKit::WebImageLayer::WebImageLayer):
+ (WebKit::WebImageLayer::setBitmap):
+ * src/WebLayer.cpp: Added.
+ (WebKit):
+ (WebKit::WebLayer::create):
+ (WebKit::WebLayer::reset):
+ (WebKit::WebLayer::assign):
+ (WebKit::WebLayer::equals):
+ (WebKit::WebLayer::invalidateRect):
+ (WebKit::WebLayer::invalidate):
+ (WebKit::WebLayer::addChild):
+ (WebKit::WebLayer::insertChild):
+ (WebKit::WebLayer::replaceChild):
+ (WebKit::WebLayer::setChildren):
+ (WebKit::WebLayer::removeFromParent):
+ (WebKit::WebLayer::removeAllChildren):
+ (WebKit::WebLayer::setAnchorPoint):
+ (WebKit::WebLayer::anchorPoint):
+ (WebKit::WebLayer::setAnchorPointZ):
+ (WebKit::WebLayer::anchorPointZ):
+ (WebKit::WebLayer::setBounds):
+ (WebKit::WebLayer::bounds):
+ (WebKit::WebLayer::setMasksToBounds):
+ (WebKit::WebLayer::masksToBounds):
+ (WebKit::WebLayer::setMaskLayer):
+ (WebKit::WebLayer::setReplicaLayer):
+ (WebKit::WebLayer::setOpacity):
+ (WebKit::WebLayer::opacity):
+ (WebKit::WebLayer::setOpaque):
+ (WebKit::WebLayer::opaque):
+ (WebKit::WebLayer::setPosition):
+ (WebKit::WebLayer::position):
+ (WebKit::WebLayer::setSublayerTransform):
+ (WebKit::WebLayer::sublayerTransform):
+ (WebKit::WebLayer::setTransform):
+ (WebKit::WebLayer::transform):
+ (WebKit::WebLayer::setDrawsContent):
+ (WebKit::WebLayer::drawsContent):
+ (WebKit::WebLayer::setPreserves3D):
+ (WebKit::WebLayer::setUseParentBackfaceVisibility):
+ (WebKit::WebLayer::setBackgroundColor):
+ (WebKit::WebLayer::setFilters):
+ (WebKit::WebLayer::setBackgroundFilters):
+ (WebKit::WebLayer::setDebugBorderColor):
+ (WebKit::WebLayer::setDebugBorderWidth):
+ (WebKit::WebLayer::setDebugName):
+ (WebKit::WebLayer::setAnimationDelegate):
+ (WebKit::WebLayer::addAnimation):
+ (WebKit::WebLayer::removeAnimation):
+ (WebKit::WebLayer::pauseAnimation):
+ (WebKit::WebLayer::suspendAnimations):
+ (WebKit::WebLayer::resumeAnimations):
+ (WebKit::WebLayer::hasActiveAnimation):
+ (WebKit::WebLayer::transferAnimationsTo):
+ (WebKit::WebLayer::setForceRenderSurface):
+ (WebKit::WebLayer::clearRenderSurface):
+ (WebKit::WebLayer::WebLayer):
+ (WebKit::WebLayer::operator=):
+ (WebKit::WebLayer::operator PassRefPtr<LayerChromium>):
+ * src/WebLayerImpl.cpp:
+ (WebKit::WebLayerImpl::create):
+ (WebKit::WebLayerImpl::WebLayerImpl):
+ (WebKit::WebLayerImpl::~WebLayerImpl):
+ * src/WebLayerImpl.h:
+ (WebLayerImpl):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setRootLayer):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::create):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+ (WebKit::WebMediaPlayerClientImpl::setOpaque):
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+ * src/WebScrollableLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebScrollableLayer::setScrollPosition):
+ (WebKit::WebScrollableLayer::setScrollable):
+ (WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
+ (WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
+ (WebKit::WebScrollableLayer::setNonFastScrollableRegion):
+ (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers):
+ (WebKit::WebScrollableLayer::setFixedToContainerLayer):
+ * src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebScrollbarLayer::setScrollLayer):
+ (WebKit::WebScrollbarLayer::create):
+ (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+ (WebKit::WebScrollbarLayer::operator=):
+ (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):
+ * src/WebScrollbarLayerImpl.h: Removed.
+ * src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h.
+ (WebKit):
+ (WebKit::WebSolidColorLayer::create):
+ (WebKit::WebSolidColorLayer::WebSolidColorLayer):
+ (WebKit::WebSolidColorLayer::setBackgroundColor):
+ * src/WebSolidColorLayerImpl.cpp:
+ (WebKit::WebSolidColorLayerImpl::create):
+ (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+ * src/WebSolidColorLayerImpl.h:
+ (WebSolidColorLayerImpl):
+ * src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h.
+ (WebKit):
+ (WebKit::WebVideoLayer::create):
+ (WebKit::WebVideoLayer::WebVideoLayer):
+ (WebKit::WebVideoLayer::active):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setRootGraphicsLayer):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit):
+ * src/WebViewImpl.h:
+ * tests/ImageLayerChromiumTest.cpp:
+ (WebCore::TEST):
+ * tests/WebLayerTest.cpp:
+ * tests/WebLayerTreeViewTest.cpp:
+
+2012-08-21 James Robinson <jamesr@chromium.org>
+
+ Unreviewed, rolling out r126169.
+ http://trac.webkit.org/changeset/126169
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Crashes already fixed downstream
+
+ * WebKit.gypi:
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setScrollLayer):
+ (WebKit::NonCompositedContentHost::setViewport):
+ (WebKit::NonCompositedContentHost::scrollLayer):
+ * src/NonCompositedContentHost.h:
+ * src/WebContentLayer.cpp: Removed.
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayer::create):
+ (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::layer):
+ (WebKit):
+ (WebKit::WebContentLayerImpl::setDoubleSided):
+ (WebKit::WebContentLayerImpl::setContentsScale):
+ (WebKit::WebContentLayerImpl::setUseLCDText):
+ (WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles):
+ (WebKit::WebContentLayerImpl::paintContents):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * src/WebExternalTextureLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp.
+ (WebKit):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::layer):
+ (WebKit::WebExternalTextureLayerImpl::setTextureId):
+ (WebKit::WebExternalTextureLayerImpl::setFlipped):
+ (WebKit::WebExternalTextureLayerImpl::setUVRect):
+ (WebKit::WebExternalTextureLayerImpl::setOpaque):
+ (WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha):
+ (WebKit::WebExternalTextureLayerImpl::willModifyTexture):
+ (WebKit::WebExternalTextureLayerImpl::setRateLimitContext):
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebKit::WebExternalTextureLayerImpl::prepareTexture):
+ (WebKit::WebExternalTextureLayerImpl::context):
+ * src/WebExternalTextureLayerImpl.h: Copied from Source/Platform/chromium/public/WebVideoLayer.h.
+ (WebKit):
+ (WebExternalTextureLayerImpl):
+ * src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp.
+ (WebKit):
+ (WebKit::WebIOSurfaceLayer::create):
+ (WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl):
+ (WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl):
+ (WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties):
+ (WebKit::WebIOSurfaceLayerImpl::layer):
+ * src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h.
+ (WebCore):
+ (WebKit):
+ (WebIOSurfaceLayerImpl):
+ * src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp.
+ (WebKit):
+ (WebKit::WebImageLayer::create):
+ (WebKit::WebImageLayerImpl::WebImageLayerImpl):
+ (WebKit::WebImageLayerImpl::~WebImageLayerImpl):
+ (WebKit::WebImageLayerImpl::layer):
+ (WebKit::WebImageLayerImpl::setBitmap):
+ * src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp.
+ (WebCore):
+ (WebKit):
+ (WebImageLayerImpl):
+ * src/WebLayer.cpp: Removed.
+ * src/WebLayerImpl.cpp:
+ (WebKit::WebLayer::create):
+ (WebKit::WebLayerImpl::WebLayerImpl):
+ (WebKit::WebLayerImpl::~WebLayerImpl):
+ (WebKit):
+ (WebKit::WebLayerImpl::id):
+ (WebKit::WebLayerImpl::invalidateRect):
+ (WebKit::WebLayerImpl::invalidate):
+ (WebKit::WebLayerImpl::addChild):
+ (WebKit::WebLayerImpl::insertChild):
+ (WebKit::WebLayerImpl::replaceChild):
+ (WebKit::WebLayerImpl::setChildren):
+ (WebKit::WebLayerImpl::removeFromParent):
+ (WebKit::WebLayerImpl::removeAllChildren):
+ (WebKit::WebLayerImpl::setAnchorPoint):
+ (WebKit::WebLayerImpl::anchorPoint):
+ (WebKit::WebLayerImpl::setAnchorPointZ):
+ (WebKit::WebLayerImpl::anchorPointZ):
+ (WebKit::WebLayerImpl::setBounds):
+ (WebKit::WebLayerImpl::bounds):
+ (WebKit::WebLayerImpl::setMasksToBounds):
+ (WebKit::WebLayerImpl::masksToBounds):
+ (WebKit::WebLayerImpl::setMaskLayer):
+ (WebKit::WebLayerImpl::setReplicaLayer):
+ (WebKit::WebLayerImpl::setOpacity):
+ (WebKit::WebLayerImpl::opacity):
+ (WebKit::WebLayerImpl::setOpaque):
+ (WebKit::WebLayerImpl::opaque):
+ (WebKit::WebLayerImpl::setPosition):
+ (WebKit::WebLayerImpl::position):
+ (WebKit::WebLayerImpl::setSublayerTransform):
+ (WebKit::WebLayerImpl::sublayerTransform):
+ (WebKit::WebLayerImpl::setTransform):
+ (WebKit::WebLayerImpl::transform):
+ (WebKit::WebLayerImpl::setDrawsContent):
+ (WebKit::WebLayerImpl::drawsContent):
+ (WebKit::WebLayerImpl::setPreserves3D):
+ (WebKit::WebLayerImpl::setUseParentBackfaceVisibility):
+ (WebKit::WebLayerImpl::setBackgroundColor):
+ (WebKit::WebLayerImpl::setFilters):
+ (WebKit::WebLayerImpl::setBackgroundFilters):
+ (WebKit::WebLayerImpl::setDebugBorderColor):
+ (WebKit::WebLayerImpl::setDebugBorderWidth):
+ (WebKit::WebLayerImpl::setDebugName):
+ (WebKit::WebLayerImpl::setAnimationDelegate):
+ (WebKit::WebLayerImpl::addAnimation):
+ (WebKit::WebLayerImpl::removeAnimation):
+ (WebKit::WebLayerImpl::pauseAnimation):
+ (WebKit::WebLayerImpl::suspendAnimations):
+ (WebKit::WebLayerImpl::resumeAnimations):
+ (WebKit::WebLayerImpl::hasActiveAnimation):
+ (WebKit::WebLayerImpl::transferAnimationsTo):
+ (WebKit::WebLayerImpl::setForceRenderSurface):
+ (WebKit::WebLayerImpl::setScrollPosition):
+ (WebKit::WebLayerImpl::setScrollable):
+ (WebKit::WebLayerImpl::setHaveWheelEventHandlers):
+ (WebKit::WebLayerImpl::setShouldScrollOnMainThread):
+ (WebKit::WebLayerImpl::setNonFastScrollableRegion):
+ (WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers):
+ (WebKit::WebLayerImpl::setFixedToContainerLayer):
+ (WebKit::WebLayerImpl::layer):
+ * src/WebLayerImpl.h:
+ (WebCore):
+ (WebLayerImpl):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setRootLayer):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::create):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+ (WebKit::WebMediaPlayerClientImpl::setOpaque):
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+ * src/WebScrollableLayer.cpp: Removed.
+ * src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp.
+ (WebKit):
+ (WebKit::WebScrollbarLayer::create):
+ (WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl):
+ (WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl):
+ (WebKit::WebScrollbarLayerImpl::layer):
+ (WebKit::WebScrollbarLayerImpl::setScrollLayer):
+ * src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h.
+ (WebCore):
+ (WebKit):
+ (WebScrollbarLayerImpl):
+ * src/WebSolidColorLayerImpl.cpp:
+ (WebKit::WebSolidColorLayer::create):
+ (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+ (WebKit::WebSolidColorLayerImpl::layer):
+ (WebKit):
+ (WebKit::WebSolidColorLayerImpl::setBackgroundColor):
+ * src/WebSolidColorLayerImpl.h:
+ (WebCore):
+ (WebKit):
+ (WebSolidColorLayerImpl):
+ * src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+ (WebKit):
+ (WebKit::WebVideoLayer::create):
+ (WebKit::WebVideoLayerImpl::WebVideoLayerImpl):
+ (WebKit::WebVideoLayerImpl::~WebVideoLayerImpl):
+ (WebKit::WebVideoLayerImpl::layer):
+ (WebKit::WebVideoLayerImpl::active):
+ * src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp.
+ (WebCore):
+ (WebKit):
+ (WebVideoLayerImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setRootGraphicsLayer):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit):
+ * src/WebViewImpl.h:
+ * tests/ImageLayerChromiumTest.cpp:
+ (WebCore::TEST):
+ * tests/WebLayerTest.cpp:
+ * tests/WebLayerTreeViewTest.cpp:
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126076, r126099, and r126106.
+ http://trac.webkit.org/changeset/126076
+ http://trac.webkit.org/changeset/126099
+ http://trac.webkit.org/changeset/126106
+ https://bugs.webkit.org/show_bug.cgi?id=94614
+
+ Caused crashes during compositor shutdown in Aura builds of
+ Chromium (Requested by kbr_google on #webkit).
+
+ * WebKit.gypi:
+ * src/NonCompositedContentHost.cpp:
+ (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+ (WebKit::NonCompositedContentHost::setScrollLayer):
+ (WebKit::NonCompositedContentHost::setViewport):
+ (WebKit::NonCompositedContentHost::scrollLayer):
+ * src/NonCompositedContentHost.h:
+ * src/WebContentLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebContentLayer::create):
+ (WebKit::WebContentLayer::clearClient):
+ (WebKit::WebContentLayer::setDoubleSided):
+ (WebKit::WebContentLayer::setContentsScale):
+ (WebKit::WebContentLayer::setUseLCDText):
+ (WebKit::WebContentLayer::setDrawCheckerboardForMissingTiles):
+ (WebKit::WebContentLayer::WebContentLayer):
+ (WebKit::WebContentLayer::operator=):
+ (WebKit::WebContentLayer::operator PassRefPtr<ContentLayerChromium>):
+ * src/WebContentLayerImpl.cpp:
+ (WebKit::WebContentLayerImpl::create):
+ (WebKit::WebContentLayerImpl::WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::~WebContentLayerImpl):
+ (WebKit::WebContentLayerImpl::paintContents):
+ * src/WebContentLayerImpl.h:
+ (WebContentLayerImpl):
+ * src/WebExternalTextureLayer.cpp: Renamed from Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp.
+ (WebKit):
+ (WebTextureUpdaterImpl):
+ (WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
+ (WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
+ (WebKit::WebExternalTextureLayer::create):
+ (WebKit::WebExternalTextureLayer::clearClient):
+ (WebKit::WebExternalTextureLayer::setTextureId):
+ (WebKit::WebExternalTextureLayer::setFlipped):
+ (WebKit::WebExternalTextureLayer::setUVRect):
+ (WebKit::WebExternalTextureLayer::setOpaque):
+ (WebKit::WebExternalTextureLayer::setPremultipliedAlpha):
+ (WebKit::WebExternalTextureLayer::willModifyTexture):
+ (WebKit::WebExternalTextureLayer::setRateLimitContext):
+ (WebKit::WebExternalTextureLayer::WebExternalTextureLayer):
+ * src/WebExternalTextureLayerImpl.h: Removed.
+ * src/WebIOSurfaceLayer.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebIOSurfaceLayer::create):
+ (WebKit::WebIOSurfaceLayer::setIOSurfaceProperties):
+ (WebKit::WebIOSurfaceLayer::WebIOSurfaceLayer):
+ * src/WebIOSurfaceLayerImpl.h: Removed.
+ * src/WebImageLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.h.
+ (WebKit):
+ (WebKit::WebImageLayer::create):
+ (WebKit::WebImageLayer::WebImageLayer):
+ (WebKit::WebImageLayer::setBitmap):
+ * src/WebLayer.cpp: Added.
+ (WebKit):
+ (WebKit::WebLayer::create):
+ (WebKit::WebLayer::reset):
+ (WebKit::WebLayer::assign):
+ (WebKit::WebLayer::equals):
+ (WebKit::WebLayer::invalidateRect):
+ (WebKit::WebLayer::invalidate):
+ (WebKit::WebLayer::addChild):
+ (WebKit::WebLayer::insertChild):
+ (WebKit::WebLayer::replaceChild):
+ (WebKit::WebLayer::setChildren):
+ (WebKit::WebLayer::removeFromParent):
+ (WebKit::WebLayer::removeAllChildren):
+ (WebKit::WebLayer::setAnchorPoint):
+ (WebKit::WebLayer::anchorPoint):
+ (WebKit::WebLayer::setAnchorPointZ):
+ (WebKit::WebLayer::anchorPointZ):
+ (WebKit::WebLayer::setBounds):
+ (WebKit::WebLayer::bounds):
+ (WebKit::WebLayer::setMasksToBounds):
+ (WebKit::WebLayer::masksToBounds):
+ (WebKit::WebLayer::setMaskLayer):
+ (WebKit::WebLayer::setReplicaLayer):
+ (WebKit::WebLayer::setOpacity):
+ (WebKit::WebLayer::opacity):
+ (WebKit::WebLayer::setOpaque):
+ (WebKit::WebLayer::opaque):
+ (WebKit::WebLayer::setPosition):
+ (WebKit::WebLayer::position):
+ (WebKit::WebLayer::setSublayerTransform):
+ (WebKit::WebLayer::sublayerTransform):
+ (WebKit::WebLayer::setTransform):
+ (WebKit::WebLayer::transform):
+ (WebKit::WebLayer::setDrawsContent):
+ (WebKit::WebLayer::drawsContent):
+ (WebKit::WebLayer::setPreserves3D):
+ (WebKit::WebLayer::setUseParentBackfaceVisibility):
+ (WebKit::WebLayer::setBackgroundColor):
+ (WebKit::WebLayer::setFilters):
+ (WebKit::WebLayer::setBackgroundFilters):
+ (WebKit::WebLayer::setDebugBorderColor):
+ (WebKit::WebLayer::setDebugBorderWidth):
+ (WebKit::WebLayer::setDebugName):
+ (WebKit::WebLayer::setAnimationDelegate):
+ (WebKit::WebLayer::addAnimation):
+ (WebKit::WebLayer::removeAnimation):
+ (WebKit::WebLayer::pauseAnimation):
+ (WebKit::WebLayer::suspendAnimations):
+ (WebKit::WebLayer::resumeAnimations):
+ (WebKit::WebLayer::hasActiveAnimation):
+ (WebKit::WebLayer::transferAnimationsTo):
+ (WebKit::WebLayer::setForceRenderSurface):
+ (WebKit::WebLayer::clearRenderSurface):
+ (WebKit::WebLayer::WebLayer):
+ (WebKit::WebLayer::operator=):
+ (WebKit::WebLayer::operator PassRefPtr<LayerChromium>):
+ * src/WebLayerImpl.cpp:
+ (WebKit::WebLayerImpl::create):
+ (WebKit::WebLayerImpl::WebLayerImpl):
+ (WebKit::WebLayerImpl::~WebLayerImpl):
+ * src/WebLayerImpl.h:
+ (WebLayerImpl):
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::setRootLayer):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::create):
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::readyStateChanged):
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+ (WebKit::WebMediaPlayerClientImpl::setOpaque):
+ (WebKit::WebMediaPlayerClientImpl::platformLayer):
+ (WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::setBackingTextureId):
+ (WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
+ (WebKit::WebPluginContainerImpl::commitBackingTexture):
+ (WebKit::WebPluginContainerImpl::setOpaque):
+ (WebKit::WebPluginContainerImpl::platformLayer):
+ * src/WebPluginContainerImpl.h:
+ (WebPluginContainerImpl):
+ * src/WebScrollableLayer.cpp: Renamed from Source/WebKit/chromium/src/WebImageLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebScrollableLayer::setScrollPosition):
+ (WebKit::WebScrollableLayer::setScrollable):
+ (WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
+ (WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
+ (WebKit::WebScrollableLayer::setNonFastScrollableRegion):
+ (WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers):
+ (WebKit::WebScrollableLayer::setFixedToContainerLayer):
+ * src/WebScrollbarLayer.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp.
+ (WebKit):
+ (WebKit::WebScrollbarLayer::setScrollLayer):
+ (WebKit::WebScrollbarLayer::create):
+ (WebKit::WebScrollbarLayer::WebScrollbarLayer):
+ (WebKit::WebScrollbarLayer::operator=):
+ (WebKit::WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>):
+ * src/WebScrollbarLayerImpl.h: Removed.
+ * src/WebSolidColorLayer.cpp: Copied from Source/Platform/chromium/public/WebSolidColorLayer.h.
+ (WebKit):
+ (WebKit::WebSolidColorLayer::create):
+ (WebKit::WebSolidColorLayer::WebSolidColorLayer):
+ (WebKit::WebSolidColorLayer::setBackgroundColor):
+ * src/WebSolidColorLayerImpl.cpp:
+ (WebKit::WebSolidColorLayerImpl::create):
+ (WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
+ * src/WebSolidColorLayerImpl.h:
+ (WebSolidColorLayerImpl):
+ * src/WebVideoLayer.cpp: Renamed from Source/WebKit/chromium/src/WebVideoLayerImpl.h.
+ (WebKit):
+ (WebKit::WebVideoLayer::create):
+ (WebKit::WebVideoLayer::WebVideoLayer):
+ (WebKit::WebVideoLayer::active):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::setRootGraphicsLayer):
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+ (WebKit):
+ * src/WebViewImpl.h:
+ * tests/ImageLayerChromiumTest.cpp:
+ (WebCore::TEST):
+ * tests/WebLayerTest.cpp:
+ * tests/WebLayerTreeViewTest.cpp:
+
+2012-08-21 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember.
+ https://bugs.webkit.org/show_bug.cgi?id=94580
+
+ Reviewed by Yury Semikhatsky.
+
+ Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet.
+
+ * tests/MemoryInstrumentationTest.cpp:
+ (WebCore::TEST):
+ (WebCore):
+
+2012-08-21 Peter Beverloo <peter@chromium.org>
+
+ Unreviewed. Rolled DEPS.
+
+ * DEPS:
+
2012-08-20 Kent Tamura <tkent@chromium.org>
[Chromium-win] Use native digits in parsing/formatting dates in the textfield part of input[type=date]
diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS
index eb01ba514..e232a71c2 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': '152373'
+ 'chromium_rev': '152728'
}
deps = {
diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi
index fc86f83b3..7fb0c0f70 100644
--- a/Source/WebKit/chromium/WebKit.gypi
+++ b/Source/WebKit/chromium/WebKit.gypi
@@ -183,27 +183,26 @@
'src/WebAnimationImpl.h',
'src/WebCompositorInputHandlerImpl.cpp',
'src/WebCompositorInputHandlerImpl.h',
+ 'src/WebContentLayer.cpp',
'src/WebContentLayerImpl.cpp',
'src/WebContentLayerImpl.h',
- 'src/WebExternalTextureLayerImpl.cpp',
- 'src/WebExternalTextureLayerImpl.h',
+ 'src/WebExternalTextureLayer.cpp',
'src/WebFloatAnimationCurve.cpp',
- 'src/WebIOSurfaceLayerImpl.cpp',
- 'src/WebIOSurfaceLayerImpl.h',
- 'src/WebImageLayerImpl.cpp',
- 'src/WebImageLayerImpl.h',
+ 'src/WebIOSurfaceLayer.cpp',
+ 'src/WebImageLayer.cpp',
+ 'src/WebLayer.cpp',
'src/WebLayerImpl.cpp',
'src/WebLayerImpl.h',
'src/WebLayerTreeView.cpp',
'src/WebLayerTreeViewImpl.cpp',
'src/WebLayerTreeViewImpl.h',
- 'src/WebScrollbarLayerImpl.cpp',
- 'src/WebScrollbarLayerImpl.h',
+ 'src/WebScrollableLayer.cpp',
+ 'src/WebScrollbarLayer.cpp',
+ 'src/WebSolidColorLayer.cpp',
'src/WebSolidColorLayerImpl.cpp',
'src/WebSolidColorLayerImpl.h',
'src/WebTransformAnimationCurve.cpp',
- 'src/WebVideoLayerImpl.cpp',
- 'src/WebVideoLayerImpl.h',
+ 'src/WebVideoLayer.cpp',
],
'conditions': [
diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h
index 826965c0d..a2b87da81 100644
--- a/Source/WebKit/chromium/public/WebIDBObjectStore.h
+++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h
@@ -72,11 +72,6 @@ public:
return 0;
}
virtual void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
- // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium.
- virtual void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
- {
- openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec);
- }
virtual void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h
index 45d3dd3c3..e95ec6b53 100644
--- a/Source/WebKit/chromium/public/WebView.h
+++ b/Source/WebKit/chromium/public/WebView.h
@@ -460,6 +460,8 @@ public:
virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&) = 0;
virtual bool setEditableSelectionOffsets(int start, int end) = 0;
+ virtual bool setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) = 0;
+ virtual void extendSelectionAndDelete(int before, int after) = 0;
virtual bool isSelectionEditable() const = 0;
diff --git a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp
index b00a30c23..643848868 100644
--- a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp
+++ b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp
@@ -38,6 +38,7 @@
#include "IntPoint.h"
#include "Node.h"
#include "Range.h"
+#include "RenderBlock.h"
#include "RenderBox.h"
#include "RenderObject.h"
#include "RenderPart.h"
@@ -48,39 +49,32 @@ using namespace WebCore;
namespace WebKit {
-static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer, FloatRect& containerBoundingBox)
+static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer)
{
ASSERT(renderer);
- const RenderObject* container = renderer->container();
- if (!container) {
- containerBoundingBox = FloatRect();
+ const RenderBlock* container = renderer->containingBlock();
+ ASSERT(container || renderer->isRenderView());
+ if (!container)
return FloatRect();
- }
-
- FloatRect normalizedRect = absoluteRect;
- FloatRect containerRect = container->absoluteBoundingBoxRect();
- containerBoundingBox = containerRect;
- // For RenderBoxes we want to normalize by the max layout overflow size instead of only the visible bounding box.
+ // We want to normalize by the max layout overflow size instead of only the visible bounding box.
// Quads and their enclosing bounding boxes need to be used in order to keep results transform-friendly.
- if (container->isBox()) {
- const RenderBox* containerBox = toRenderBox(container);
- FloatPoint scrolledOrigin;
+ FloatPoint scrolledOrigin;
- // For overflow:scroll we need to get where the actual origin is independently of the scroll.
- if (container->hasOverflowClip())
- scrolledOrigin = -IntPoint(containerBox->scrolledContentOffset());
+ // For overflow:scroll we need to get where the actual origin is independently of the scroll.
+ if (container->hasOverflowClip())
+ scrolledOrigin = -IntPoint(container->scrolledContentOffset());
- FloatRect overflowRect(scrolledOrigin, containerBox->maxLayoutOverflow());
- containerRect = containerBox->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox();
- }
+ FloatRect overflowRect(scrolledOrigin, container->maxLayoutOverflow());
+ FloatRect containerRect = container->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox();
if (containerRect.isEmpty())
return FloatRect();
// Make the coordinates relative to the container enclosing bounding box.
// Since we work with rects enclosing quad unions this is still transform-friendly.
+ FloatRect normalizedRect = absoluteRect;
normalizedRect.moveBy(-containerRect.location());
// Fixed positions do not make sense in this coordinate system, but need to leave consistent tickmarks.
@@ -89,29 +83,26 @@ static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObj
normalizedRect.move(-toRenderView(container)->frameView()->scrollOffsetForFixedPosition());
normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height());
-
return normalizedRect;
}
-FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const RenderObject* renderer)
+FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const RenderObject* baseRenderer)
{
- if (!renderer || inputRect.isEmpty())
+ if (!baseRenderer || inputRect.isEmpty())
return FloatRect();
- // Normalize the input rect to its container, saving the container bounding box for the incoming loop.
- FloatRect rendererBoundingBox;
- FloatRect normalizedRect = toNormalizedRect(inputRect, renderer, rendererBoundingBox);
- renderer = renderer->container();
+ // Normalize the input rect to its container block.
+ FloatRect normalizedRect = toNormalizedRect(inputRect, baseRenderer);
// Go up across frames.
- while (renderer) {
+ for (const RenderObject* renderer = baseRenderer->containingBlock(); renderer; ) {
// Go up the render tree until we reach the root of the current frame (the RenderView).
- for (const RenderObject* container = renderer->container(); container; renderer = container, container = container->container()) {
+ for (const RenderBlock* container = renderer->containingBlock(); container;
+ renderer = container, container = container->containingBlock()) {
- // Compose the normalized rects. The absolute bounding box of the container is calculated in toNormalizedRect
- // and can be reused for the next iteration of the loop.
- FloatRect normalizedBoxRect = toNormalizedRect(rendererBoundingBox, renderer, rendererBoundingBox);
+ // Compose the normalized rects.
+ FloatRect normalizedBoxRect = toNormalizedRect(renderer->absoluteBoundingBoxRect(), renderer);
normalizedRect.scale(normalizedBoxRect.width(), normalizedBoxRect.height());
normalizedRect.moveBy(normalizedBoxRect.location());
@@ -122,10 +113,6 @@ FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, const Rende
// Jump to the renderer owning the frame, if any.
ASSERT(renderer->isRenderView());
renderer = renderer->frame() ? renderer->frame()->ownerRenderer() : 0;
-
- // Update the absolute coordinates to the new frame.
- if (renderer)
- rendererBoundingBox = renderer->absoluteBoundingBoxRect();
}
return normalizedRect;
diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
index b8fb074ea..b53eb2c3a 100755
--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp
@@ -138,14 +138,6 @@ void IDBObjectStoreBackendProxy::deleteIndex(const String& name, IDBTransactionB
m_webIDBObjectStore->deleteIndex(name, *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, 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->openCursor(range, static_cast<WebIDBCursor::Direction>(direction), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
-}
-
void IDBObjectStoreBackendProxy::openCursor(PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
index fb0f2af37..74cb0bd57 100644
--- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
+++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h
@@ -55,8 +55,6 @@ public:
PassRefPtr<WebCore::IDBIndexBackendInterface> index(const String& name, WebCore::ExceptionCode&);
void deleteIndex(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
- // FIXME: Remove this version of openCursor when TaskType is plumbed through chromium.
- virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void openCursor(PassRefPtr<WebCore::IDBKeyRange>, WebCore::IDBCursor::Direction, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface::TaskType, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
virtual void count(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
index 4df4204b3..65dac62ca 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
@@ -30,7 +30,6 @@
#include "FloatPoint.h"
#include "FloatRect.h"
#include "GraphicsLayer.h"
-#include "GraphicsLayerChromium.h"
#include "PlatformContextSkia.h"
#include "WebViewImpl.h"
#include <public/WebContentLayer.h>
@@ -49,11 +48,11 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView)
m_graphicsLayer->setName("non-composited content");
#endif
m_graphicsLayer->setDrawsContent(true);
- WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer();
- layer->setUseLCDText(true);
- layer->layer()->setOpaque(true);
+ WebContentLayer layer = m_graphicsLayer->platformLayer()->to<WebContentLayer>();
+ layer.setUseLCDText(true);
+ layer.setOpaque(true);
#if !OS(ANDROID)
- layer->setDrawCheckerboardForMissingTiles(true);
+ layer.setDrawCheckerboardForMissingTiles(true);
#endif
}
@@ -81,7 +80,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
return;
}
- if (layer->platformLayer() == scrollLayer())
+ if (*layer->platformLayer() == scrollLayer())
return;
layer->addChildAtIndex(m_graphicsLayer.get(), 0);
@@ -96,12 +95,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
bool visibleRectChanged = m_viewportSize != viewportSize;
m_viewportSize = viewportSize;
- WebLayer* layer = scrollLayer();
- layer->setScrollPosition(scrollPosition + scrollOrigin);
- layer->setPosition(WebFloatPoint(-scrollPosition));
+ WebScrollableLayer layer = scrollLayer();
+ layer.setScrollPosition(scrollPosition + scrollOrigin);
+ layer.setPosition(WebFloatPoint(-scrollPosition));
// Due to the possibility of pinch zoom, the noncomposited layer is always
// assumed to be scrollable.
- layer->setScrollable(true);
+ layer.setScrollable(true);
m_deviceScaleFactor = deviceScale;
m_graphicsLayer->deviceOrPageScaleFactorChanged();
m_graphicsLayer->setSize(contentsSize);
@@ -128,11 +127,11 @@ bool NonCompositedContentHost::haveScrollLayer()
return m_graphicsLayer->parent();
}
-WebLayer* NonCompositedContentHost::scrollLayer()
+WebScrollableLayer NonCompositedContentHost::scrollLayer()
{
if (!m_graphicsLayer->parent())
- return 0;
- return m_graphicsLayer->parent()->platformLayer();
+ return WebScrollableLayer();
+ return m_graphicsLayer->parent()->platformLayer()->to<WebScrollableLayer>();
}
void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h
index 08b5f6a41..e60e9ef48 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.h
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h
@@ -29,7 +29,7 @@
#include "GraphicsLayerClient.h"
#include "IntSize.h"
-#include <public/WebLayer.h>
+#include <public/WebScrollableLayer.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -80,7 +80,7 @@ private:
virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; }
bool haveScrollLayer();
- WebLayer* scrollLayer();
+ WebScrollableLayer scrollLayer();
OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
WebViewImpl* m_webView;
diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayer.cpp
index 5bfed6742..efa7465b1 100644
--- a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebContentLayer.cpp
@@ -24,35 +24,59 @@
*/
#include "config.h"
-#include "WebVideoLayerImpl.h"
+#include <public/WebContentLayer.h>
-#include "VideoLayerChromium.h"
-#include "WebLayerImpl.h"
+#include "ContentLayerChromium.h"
+#include "WebContentLayerImpl.h"
+
+using namespace WebCore;
namespace WebKit {
-WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider)
+WebContentLayer WebContentLayer::create(WebContentLayerClient* contentClient)
+{
+ return WebContentLayer(WebContentLayerImpl::create(contentClient));
+}
+
+void WebContentLayer::clearClient()
+{
+ unwrap<ContentLayerChromium>()->clearDelegate();
+}
+
+void WebContentLayer::setDoubleSided(bool doubleSided)
+{
+ m_private->setDoubleSided(doubleSided);
+}
+
+void WebContentLayer::setContentsScale(float scale)
+{
+ m_private->setContentsScale(scale);
+}
+
+void WebContentLayer::setUseLCDText(bool enable)
{
- return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider));
+ m_private->setUseLCDText(enable);
}
-WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer)
- : m_layer(adoptPtr(new WebLayerImpl(layer)))
+void WebContentLayer::setDrawCheckerboardForMissingTiles(bool enable)
{
+ m_private->setDrawCheckerboardForMissingTiles(enable);
}
-WebVideoLayerImpl::~WebVideoLayerImpl()
+WebContentLayer::WebContentLayer(const PassRefPtr<ContentLayerChromium>& node)
+ : WebScrollableLayer(node)
{
}
-WebLayer* WebVideoLayerImpl::layer()
+WebContentLayer& WebContentLayer::operator=(const PassRefPtr<ContentLayerChromium>& node)
{
- return m_layer.get();
+ m_private = node;
+ return *this;
}
-bool WebVideoLayerImpl::active() const
+WebContentLayer::operator PassRefPtr<ContentLayerChromium>() const
{
- return m_layer->layer()->layerTreeHost();
+ return static_cast<ContentLayerChromium*>(m_private.get());
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
index fa21e8974..69da1ea3f 100644
--- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp
@@ -26,66 +26,37 @@
#include "config.h"
#include "WebContentLayerImpl.h"
-#include "SkMatrix44.h"
#include <public/WebContentLayerClient.h>
-#include <public/WebFloatPoint.h>
#include <public/WebFloatRect.h>
#include <public/WebRect.h>
-#include <public/WebSize.h>
using namespace WebCore;
namespace WebKit {
-WebContentLayer* WebContentLayer::create(WebContentLayerClient* client)
+PassRefPtr<WebContentLayerImpl> WebContentLayerImpl::create(WebContentLayerClient* contentClient)
{
- return new WebContentLayerImpl(client);
+ return adoptRef(new WebContentLayerImpl(contentClient));
}
-WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client)
- : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this))))
- , m_client(client)
+WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* contentClient)
+ : ContentLayerChromium(this)
+ , m_contentClient(contentClient)
{
- m_webLayerImpl->layer()->setIsDrawable(true);
+ setIsDrawable(true);
}
WebContentLayerImpl::~WebContentLayerImpl()
{
- static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate();
+ clearDelegate();
}
-WebLayer* WebContentLayerImpl::layer()
-{
- return m_webLayerImpl.get();
-}
-
-void WebContentLayerImpl::setDoubleSided(bool doubleSided)
-{
- m_webLayerImpl->layer()->setDoubleSided(doubleSided);
-}
-
-void WebContentLayerImpl::setContentsScale(float scale)
-{
- m_webLayerImpl->layer()->setContentsScale(scale);
-}
-
-void WebContentLayerImpl::setUseLCDText(bool enable)
-{
- m_webLayerImpl->layer()->setUseLCDText(enable);
-}
-
-void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable)
-{
- m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable);
-}
-
-
void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque)
{
- if (!m_client)
+ if (!m_contentClient)
return;
WebFloatRect webOpaque;
- m_client->paintContents(canvas, WebRect(clip), webOpaque);
+ m_contentClient->paintContents(canvas, WebRect(clip), webOpaque);
opaque = webOpaque;
}
diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h
index 511f8e0ba..97729ea1e 100644
--- a/Source/WebKit/chromium/src/WebContentLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h
@@ -27,33 +27,23 @@
#define WebContentLayerImpl_h
#include "ContentLayerChromium.h"
-#include "WebLayerImpl.h"
-#include <public/WebContentLayer.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
class WebContentLayerClient;
-class WebContentLayerImpl : public WebContentLayer,
- public WebCore::ContentLayerDelegate {
+class WebContentLayerImpl : public WebCore::ContentLayerChromium, public WebCore::ContentLayerDelegate {
public:
- explicit WebContentLayerImpl(WebContentLayerClient*);
-
- // WebContentLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual void setDoubleSided(bool) OVERRIDE;
- virtual void setContentsScale(float) OVERRIDE;
- virtual void setUseLCDText(bool) OVERRIDE;
- virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE;
+ static PassRefPtr<WebContentLayerImpl> create(WebContentLayerClient* contentClient);
protected:
+ explicit WebContentLayerImpl(WebContentLayerClient* contentClient);
virtual ~WebContentLayerImpl();
// ContentLayerDelegate implementation.
virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE;
- OwnPtr<WebLayerImpl> m_webLayerImpl;
- WebContentLayerClient* m_client;
+ WebContentLayerClient* m_contentClient;
bool m_drawsContent;
};
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
index d62166f44..d4aff5721 100644
--- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
@@ -24,11 +24,10 @@
*/
#include "config.h"
-#include "WebExternalTextureLayerImpl.h"
+#include <public/WebExternalTextureLayer.h>
#include "CCTextureUpdateQueue.h"
#include "TextureLayerChromium.h"
-#include "WebLayerImpl.h"
#include <public/WebExternalTextureLayerClient.h>
#include <public/WebFloatRect.h>
#include <public/WebSize.h>
@@ -37,96 +36,96 @@ using namespace WebCore;
namespace WebKit {
-WebExternalTextureLayer* WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
-{
- return new WebExternalTextureLayerImpl(client);
-}
+class WebTextureUpdaterImpl : public WebTextureUpdater {
+public:
+ explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
+ : m_queue(queue)
+ {
+ }
-WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
- : m_client(client)
-{
- RefPtr<TextureLayerChromium> layer;
- if (m_client)
- layer = TextureLayerChromium::create(this);
- else
- layer = TextureLayerChromium::create(0);
- layer->setIsDrawable(true);
- m_layer = adoptPtr(new WebLayerImpl(layer.release()));
-}
+ virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
+ {
+ TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
+ m_queue.appendCopy(copy);
+ }
-WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl()
-{
- static_cast<TextureLayerChromium*>(m_layer->layer())->clearClient();
-}
+private:
+ CCTextureUpdateQueue& m_queue;
+};
+
+class WebExternalTextureLayerImpl : public TextureLayerChromiumClient, public TextureLayerChromium {
+public:
+ explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient* client)
+ : TextureLayerChromium(client ? this : 0)
+ , m_client(client)
+ {
+ }
+
+ virtual unsigned prepareTexture(CCTextureUpdateQueue& queue) OVERRIDE
+ {
+ WebTextureUpdaterImpl updaterImpl(queue);
+ return m_client->prepareTexture(updaterImpl);
+ }
-WebLayer* WebExternalTextureLayerImpl::layer()
+ virtual WebKit::WebGraphicsContext3D* context() OVERRIDE
+ {
+ return m_client->context();
+ }
+
+private:
+ WebExternalTextureLayerClient* m_client;
+};
+
+WebExternalTextureLayer WebExternalTextureLayer::create(WebExternalTextureLayerClient* client)
{
- return m_layer.get();
+ RefPtr<TextureLayerChromium> layer = adoptRef(new WebExternalTextureLayerImpl(client));
+ layer->setIsDrawable(true);
+ return WebExternalTextureLayer(layer.release());
}
-void WebExternalTextureLayerImpl::setTextureId(unsigned id)
+void WebExternalTextureLayer::clearClient()
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setTextureId(id);
+ unwrap<TextureLayerChromium>()->clearClient();
}
-void WebExternalTextureLayerImpl::setFlipped(bool flipped)
+void WebExternalTextureLayer::setTextureId(unsigned id)
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setFlipped(flipped);
+ unwrap<TextureLayerChromium>()->setTextureId(id);
}
-void WebExternalTextureLayerImpl::setUVRect(const WebFloatRect& rect)
+void WebExternalTextureLayer::setFlipped(bool flipped)
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setUVRect(rect);
+ unwrap<TextureLayerChromium>()->setFlipped(flipped);
}
-void WebExternalTextureLayerImpl::setOpaque(bool opaque)
+void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect)
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setOpaque(opaque);
+ unwrap<TextureLayerChromium>()->setUVRect(rect);
}
-void WebExternalTextureLayerImpl::setPremultipliedAlpha(bool premultipliedAlpha)
+void WebExternalTextureLayer::setOpaque(bool opaque)
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setPremultipliedAlpha(premultipliedAlpha);
+ unwrap<TextureLayerChromium>()->setOpaque(opaque);
}
-void WebExternalTextureLayerImpl::willModifyTexture()
+void WebExternalTextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->willModifyTexture();
+ unwrap<TextureLayerChromium>()->setPremultipliedAlpha(premultipliedAlpha);
}
-void WebExternalTextureLayerImpl::setRateLimitContext(bool rateLimit)
+void WebExternalTextureLayer::willModifyTexture()
{
- static_cast<TextureLayerChromium*>(m_layer->layer())->setRateLimitContext(rateLimit);
+ unwrap<TextureLayerChromium>()->willModifyTexture();
}
-class WebTextureUpdaterImpl : public WebTextureUpdater {
-public:
- explicit WebTextureUpdaterImpl(CCTextureUpdateQueue& queue)
- : m_queue(queue)
- {
- }
-
- virtual void appendCopy(unsigned sourceTexture, unsigned destinationTexture, WebSize size) OVERRIDE
- {
- TextureCopier::Parameters copy = { sourceTexture, destinationTexture, size };
- m_queue.appendCopy(copy);
- }
-
-private:
- CCTextureUpdateQueue& m_queue;
-};
-
-unsigned WebExternalTextureLayerImpl::prepareTexture(CCTextureUpdateQueue& queue)
+void WebExternalTextureLayer::setRateLimitContext(bool rateLimit)
{
- ASSERT(m_client);
- WebTextureUpdaterImpl updaterImpl(queue);
- return m_client->prepareTexture(updaterImpl);
+ unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit);
}
-WebGraphicsContext3D* WebExternalTextureLayerImpl::context()
+WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer)
+ : WebLayer(layer)
{
- ASSERT(m_client);
- return m_client->context();
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
deleted file mode 100644
index 5348895bf..000000000
--- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 WebExternalTextureLayerImpl_h
-#define WebExternalTextureLayerImpl_h
-
-#include "TextureLayerChromium.h"
-#include <public/WebExternalTextureLayer.h>
-
-namespace WebKit {
-
-class WebLayerImpl;
-
-class WebExternalTextureLayerImpl : public WebExternalTextureLayer,
- public WebCore::TextureLayerChromiumClient {
-public:
- explicit WebExternalTextureLayerImpl(WebExternalTextureLayerClient*);
- virtual ~WebExternalTextureLayerImpl();
-
- // WebExternalTextureLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual void setTextureId(unsigned) OVERRIDE;
- virtual void setFlipped(bool) OVERRIDE;
- virtual void setUVRect(const WebFloatRect&) OVERRIDE;
- virtual void setOpaque(bool) OVERRIDE;
- virtual void setPremultipliedAlpha(bool) OVERRIDE;
- virtual void willModifyTexture() OVERRIDE;
- virtual void setRateLimitContext(bool) OVERRIDE;
-
- // TextureLayerChromiumClient implementation.
- virtual unsigned prepareTexture(WebCore::CCTextureUpdateQueue&) OVERRIDE;
- virtual WebGraphicsContext3D* context() OVERRIDE;
-
-private:
- WebExternalTextureLayerClient* m_client;
- OwnPtr<WebLayerImpl> m_layer;
-};
-
-}
-
-#endif // WebExternalTextureLayerImpl_h
-
diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
index 95879b5d0..04020e558 100644
--- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
+++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h
@@ -56,10 +56,6 @@ public:
WebIDBIndex* index(const WebString& name, WebExceptionCode&);
void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
- void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
- {
- openCursor(range, static_cast<WebIDBCursor::Direction>(direction), callbacks, WebIDBTransaction::NormalTask, transaction, ec);
- }
void openCursor(const WebIDBKeyRange&, WebIDBCursor::Direction, WebIDBCallbacks*, WebIDBTransaction::TaskType, const WebIDBTransaction&, WebExceptionCode&);
void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp
index bab70c61d..77db0c877 100644
--- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp
@@ -24,39 +24,30 @@
*/
#include "config.h"
-#include "WebIOSurfaceLayerImpl.h"
+#include <public/WebIOSurfaceLayer.h>
#include "IOSurfaceLayerChromium.h"
-#include "WebLayerImpl.h"
+#include <public/WebSize.h>
-using WebCore::IOSurfaceLayerChromium;
+using namespace WebCore;
namespace WebKit {
-WebIOSurfaceLayer* WebIOSurfaceLayer::create()
+WebIOSurfaceLayer WebIOSurfaceLayer::create()
{
RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create();
layer->setIsDrawable(true);
- return new WebIOSurfaceLayerImpl(layer.release());
+ return WebIOSurfaceLayer(layer.release());
}
-WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer)
- : m_layer(adoptPtr(new WebLayerImpl(layer)))
+void WebIOSurfaceLayer::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
{
+ unwrap<IOSurfaceLayerChromium>()->setIOSurfaceProperties(ioSurfaceId, size);
}
-WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl()
+WebIOSurfaceLayer::WebIOSurfaceLayer(PassRefPtr<IOSurfaceLayerChromium> layer)
+ : WebLayer(layer)
{
}
-void WebIOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, WebSize size)
-{
- static_cast<IOSurfaceLayerChromium*>(m_layer->layer())->setIOSurfaceProperties(ioSurfaceId, size);
-}
-
-WebLayer* WebIOSurfaceLayerImpl::layer()
-{
- return m_layer.get();
-}
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.h b/Source/WebKit/chromium/src/WebImageLayer.cpp
index 9a4b8b3eb..f76151530 100644
--- a/Source/WebKit/chromium/src/WebImageLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebImageLayer.cpp
@@ -23,32 +23,26 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebImageLayerImpl_h
-#define WebImageLayerImpl_h
-
+#include "config.h"
#include <public/WebImageLayer.h>
-#include <wtf/OwnPtr.h>
-namespace WebCore {
-class ImageLayerChromium;
-}
+#include "ImageLayerChromium.h"
namespace WebKit {
-class WebLayerImpl;
-
-class WebImageLayerImpl : public WebImageLayer {
-public:
- explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>);
- virtual ~WebImageLayerImpl();
- // WebImageLayer implementation.
- WebLayer* layer() OVERRIDE;
- virtual void setBitmap(SkBitmap) OVERRIDE;
+WebImageLayer WebImageLayer::create()
+{
+ return WebImageLayer(WebCore::ImageLayerChromium::create());
+}
-private:
- OwnPtr<WebLayerImpl> m_layer;
-};
+WebImageLayer::WebImageLayer(PassRefPtr<WebCore::ImageLayerChromium> layer)
+ : WebLayer(layer)
+{
+}
+void WebImageLayer::setBitmap(SkBitmap bitmap)
+{
+ unwrap<WebCore::ImageLayerChromium>()->setBitmap(bitmap);
}
-#endif // WebImageLayerImpl_h
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayer.cpp b/Source/WebKit/chromium/src/WebLayer.cpp
new file mode 100644
index 000000000..37897e6f8
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebLayer.cpp
@@ -0,0 +1,379 @@
+/*
+ * 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 AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <public/WebLayer.h>
+
+#include "LayerChromium.h"
+#include "SkMatrix44.h"
+#include "WebAnimationImpl.h"
+#include "WebLayerImpl.h"
+#include <public/WebFilterOperations.h>
+#include <public/WebFloatPoint.h>
+#include <public/WebFloatRect.h>
+#include <public/WebSize.h>
+#include <public/WebTransformationMatrix.h>
+
+using namespace WebCore;
+using WebKit::WebTransformationMatrix;
+
+namespace {
+
+WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix)
+{
+ double data[16];
+ matrix.asColMajord(data);
+ return WebTransformationMatrix(data[0], data[1], data[2], data[3],
+ data[4], data[5], data[6], data[7],
+ data[8], data[9], data[10], data[11],
+ data[12], data[13], data[14], data[15]);
+}
+
+SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix)
+{
+ SkMatrix44 skMatrix;
+ skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
+ skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
+ skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
+ skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
+ skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
+ skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
+ skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
+ skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
+ skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
+ skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
+ skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
+ skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
+ skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
+ skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
+ skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
+ skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
+ return skMatrix;
+}
+
+} // anonymous namespace
+
+namespace WebKit {
+
+WebLayer WebLayer::create()
+{
+ return WebLayer(WebLayerImpl::create());
+}
+
+void WebLayer::reset()
+{
+ m_private.reset();
+}
+
+void WebLayer::assign(const WebLayer& other)
+{
+ m_private = other.m_private;
+}
+
+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();
+}
+
+void WebLayer::addChild(const WebLayer& child)
+{
+ m_private->addChild(child);
+}
+
+void WebLayer::insertChild(const WebLayer& child, size_t index)
+{
+ m_private->insertChild(child, index);
+}
+
+void WebLayer::replaceChild(const WebLayer& reference, const WebLayer& newLayer)
+{
+ WebLayer ref = reference;
+ m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer);
+}
+
+void WebLayer::setChildren(const WebVector<WebLayer>& webChildren)
+{
+ Vector<RefPtr<LayerChromium> > children(webChildren.size());
+ for (size_t i = 0; i < webChildren.size(); ++i)
+ children[i] = webChildren[i].unwrap<LayerChromium>();
+ m_private->setChildren(children);
+}
+
+void WebLayer::removeFromParent()
+{
+ m_private->removeFromParent();
+}
+
+void WebLayer::removeAllChildren()
+{
+ m_private->removeAllChildren();
+}
+
+void WebLayer::setAnchorPoint(const WebFloatPoint& anchorPoint)
+{
+ m_private->setAnchorPoint(anchorPoint);
+}
+
+WebFloatPoint WebLayer::anchorPoint() const
+{
+ return WebFloatPoint(m_private->anchorPoint());
+}
+
+void WebLayer::setAnchorPointZ(float anchorPointZ)
+{
+ m_private->setAnchorPointZ(anchorPointZ);
+}
+
+float WebLayer::anchorPointZ() const
+{
+ return m_private->anchorPointZ();
+}
+
+void WebLayer::setBounds(const WebSize& size)
+{
+ m_private->setBounds(size);
+}
+
+WebSize WebLayer::bounds() const
+{
+ return WebSize(m_private->bounds());
+}
+
+void WebLayer::setMasksToBounds(bool masksToBounds)
+{
+ m_private->setMasksToBounds(masksToBounds);
+}
+
+bool WebLayer::masksToBounds() const
+{
+ return m_private->masksToBounds();
+}
+
+void WebLayer::setMaskLayer(const WebLayer& maskLayer)
+{
+ WebLayer ref = maskLayer;
+ m_private->setMaskLayer(ref.unwrap<LayerChromium>());
+}
+
+void WebLayer::setReplicaLayer(const WebLayer& replicaLayer)
+{
+ WebLayer ref = replicaLayer;
+ m_private->setReplicaLayer(ref.unwrap<LayerChromium>());
+}
+
+void WebLayer::setOpacity(float opacity)
+{
+ m_private->setOpacity(opacity);
+}
+
+float WebLayer::opacity() const
+{
+ return m_private->opacity();
+}
+
+void WebLayer::setOpaque(bool opaque)
+{
+ m_private->setOpaque(opaque);
+}
+
+bool WebLayer::opaque() const
+{
+ return m_private->opaque();
+}
+
+void WebLayer::setPosition(const WebFloatPoint& position)
+{
+ m_private->setPosition(position);
+}
+
+WebFloatPoint WebLayer::position() const
+{
+ return WebFloatPoint(m_private->position());
+}
+
+void WebLayer::setSublayerTransform(const SkMatrix44& matrix)
+{
+ m_private->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix));
+}
+
+void WebLayer::setSublayerTransform(const WebTransformationMatrix& matrix)
+{
+ m_private->setSublayerTransform(matrix);
+}
+
+SkMatrix44 WebLayer::sublayerTransform() const
+{
+ return skMatrix44FromTransformationMatrix(m_private->sublayerTransform());
+}
+
+void WebLayer::setTransform(const SkMatrix44& matrix)
+{
+ m_private->setTransform(transformationMatrixFromSkMatrix44(matrix));
+}
+
+void WebLayer::setTransform(const WebTransformationMatrix& matrix)
+{
+ m_private->setTransform(matrix);
+}
+
+SkMatrix44 WebLayer::transform() const
+{
+ return skMatrix44FromTransformationMatrix(m_private->transform());
+}
+
+void WebLayer::setDrawsContent(bool drawsContent)
+{
+ m_private->setIsDrawable(drawsContent);
+}
+
+bool WebLayer::drawsContent() const
+{
+ return m_private->drawsContent();
+}
+
+void WebLayer::setPreserves3D(bool preserve3D)
+{
+ m_private->setPreserves3D(preserve3D);
+}
+
+void WebLayer::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility)
+{
+ m_private->setUseParentBackfaceVisibility(useParentBackfaceVisibility);
+}
+
+void WebLayer::setBackgroundColor(WebColor color)
+{
+ m_private->setBackgroundColor(color);
+}
+
+void WebLayer::setFilters(const WebFilterOperations& filters)
+{
+ m_private->setFilters(filters);
+}
+
+void WebLayer::setBackgroundFilters(const WebFilterOperations& filters)
+{
+ m_private->setBackgroundFilters(filters);
+}
+
+void WebLayer::setDebugBorderColor(const WebColor& color)
+{
+ m_private->setDebugBorderColor(color);
+}
+
+void WebLayer::setDebugBorderWidth(float width)
+{
+ m_private->setDebugBorderWidth(width);
+}
+
+void WebLayer::setDebugName(WebString name)
+{
+ m_private->setDebugName(name);
+}
+
+void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate)
+{
+ m_private->setLayerAnimationDelegate(delegate);
+}
+
+bool WebLayer::addAnimation(WebAnimation* animation)
+{
+ return m_private->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation());
+}
+
+void WebLayer::removeAnimation(int animationId)
+{
+ m_private->removeAnimation(animationId);
+}
+
+void WebLayer::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty)
+{
+ m_private->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty));
+}
+
+void WebLayer::pauseAnimation(int animationId, double timeOffset)
+{
+ m_private->pauseAnimation(animationId, timeOffset);
+}
+
+void WebLayer::suspendAnimations(double monotonicTime)
+{
+ m_private->suspendAnimations(monotonicTime);
+}
+
+void WebLayer::resumeAnimations(double monotonicTime)
+{
+ m_private->resumeAnimations(monotonicTime);
+}
+
+bool WebLayer::hasActiveAnimation()
+{
+ return m_private->hasActiveAnimation();
+}
+
+void WebLayer::transferAnimationsTo(WebLayer* other)
+{
+ ASSERT(other);
+ if (other)
+ other->m_private->setLayerAnimationController(m_private->releaseLayerAnimationController());
+}
+
+void WebLayer::setForceRenderSurface(bool forceRenderSurface)
+{
+ m_private->setForceRenderSurface(forceRenderSurface);
+}
+
+void WebLayer::clearRenderSurface()
+{
+ m_private->clearRenderSurface();
+}
+
+WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
+ : m_private(node)
+{
+}
+
+WebLayer& WebLayer::operator=(const PassRefPtr<LayerChromium>& node)
+{
+ m_private = node;
+ return *this;
+}
+
+WebLayer::operator PassRefPtr<LayerChromium>() const
+{
+ return m_private.get();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp
index 40ced485d..16e1206ca 100644
--- a/Source/WebKit/chromium/src/WebLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp
@@ -26,376 +26,25 @@
#include "config.h"
#include "WebLayerImpl.h"
-#include "CCActiveAnimation.h"
-#include "LayerChromium.h"
-#include "SkMatrix44.h"
-#include "WebAnimationImpl.h"
-#include <public/WebFloatPoint.h>
-#include <public/WebFloatRect.h>
-#include <public/WebSize.h>
-#include <public/WebTransformationMatrix.h>
-
-using WebCore::CCActiveAnimation;
-using WebCore::LayerChromium;
+using namespace WebCore;
namespace WebKit {
-namespace {
-
-WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& matrix)
-{
- double data[16];
- matrix.asColMajord(data);
- return WebTransformationMatrix(data[0], data[1], data[2], data[3],
- data[4], data[5], data[6], data[7],
- data[8], data[9], data[10], data[11],
- data[12], data[13], data[14], data[15]);
-}
-
-SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& matrix)
-{
- SkMatrix44 skMatrix;
- skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
- skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
- skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
- skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
- skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
- skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
- skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
- skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
- skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
- skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
- skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
- skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
- skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
- skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
- skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
- skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
- return skMatrix;
-}
-
-} // anonymous namespace
-
-
-WebLayer* WebLayer::create()
+PassRefPtr<WebLayerImpl> WebLayerImpl::create()
{
- return new WebLayerImpl(LayerChromium::create());
+ return adoptRef(new WebLayerImpl());
}
-WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer)
- : m_layer(layer)
+WebLayerImpl::WebLayerImpl()
+ : LayerChromium()
{
+ // Make sure that this layer does not draw content. This way we don't have to override
+ // the base class implementation of drawsContent().
+ ASSERT(!drawsContent());
}
WebLayerImpl::~WebLayerImpl()
{
- m_layer->clearRenderSurface();
- m_layer->setLayerAnimationDelegate(0);
-}
-
-int WebLayerImpl::id() const
-{
- return m_layer->id();
-}
-
-void WebLayerImpl::invalidateRect(const WebFloatRect& rect)
-{
- m_layer->setNeedsDisplayRect(rect);
-}
-
-void WebLayerImpl::invalidate()
-{
- m_layer->setNeedsDisplay();
-}
-
-void WebLayerImpl::addChild(WebLayer* child)
-{
- m_layer->addChild(static_cast<WebLayerImpl*>(child)->layer());
-}
-
-void WebLayerImpl::insertChild(WebLayer* child, size_t index)
-{
- m_layer->insertChild(static_cast<WebLayerImpl*>(child)->layer(), index);
-}
-
-void WebLayerImpl::replaceChild(WebLayer* reference, WebLayer* newLayer)
-{
- m_layer->replaceChild(static_cast<WebLayerImpl*>(reference)->layer(), static_cast<WebLayerImpl*>(newLayer)->layer());
-}
-
-void WebLayerImpl::setChildren(const WebVector<WebLayer*>& webChildren)
-{
- Vector<RefPtr<LayerChromium> > children(webChildren.size());
- for (size_t i = 0; i < webChildren.size(); ++i)
- children[i] = static_cast<WebLayerImpl*>(webChildren[i])->layer();
- m_layer->setChildren(children);
-}
-
-void WebLayerImpl::removeFromParent()
-{
- m_layer->removeFromParent();
-}
-
-void WebLayerImpl::removeAllChildren()
-{
- m_layer->removeAllChildren();
-}
-
-void WebLayerImpl::setAnchorPoint(const WebFloatPoint& anchorPoint)
-{
- m_layer->setAnchorPoint(anchorPoint);
-}
-
-WebFloatPoint WebLayerImpl::anchorPoint() const
-{
- return WebFloatPoint(m_layer->anchorPoint());
-}
-
-void WebLayerImpl::setAnchorPointZ(float anchorPointZ)
-{
- m_layer->setAnchorPointZ(anchorPointZ);
-}
-
-float WebLayerImpl::anchorPointZ() const
-{
- return m_layer->anchorPointZ();
-}
-
-void WebLayerImpl::setBounds(const WebSize& size)
-{
- m_layer->setBounds(size);
-}
-
-WebSize WebLayerImpl::bounds() const
-{
- return WebSize(m_layer->bounds());
-}
-
-void WebLayerImpl::setMasksToBounds(bool masksToBounds)
-{
- m_layer->setMasksToBounds(masksToBounds);
-}
-
-bool WebLayerImpl::masksToBounds() const
-{
- return m_layer->masksToBounds();
-}
-
-void WebLayerImpl::setMaskLayer(WebLayer* maskLayer)
-{
- m_layer->setMaskLayer(maskLayer ? static_cast<WebLayerImpl*>(maskLayer)->layer() : 0);
-}
-
-void WebLayerImpl::setReplicaLayer(WebLayer* replicaLayer)
-{
- m_layer->setReplicaLayer(replicaLayer ? static_cast<WebLayerImpl*>(replicaLayer)->layer() : 0);
-}
-
-void WebLayerImpl::setOpacity(float opacity)
-{
- m_layer->setOpacity(opacity);
-}
-
-float WebLayerImpl::opacity() const
-{
- return m_layer->opacity();
-}
-
-void WebLayerImpl::setOpaque(bool opaque)
-{
- m_layer->setOpaque(opaque);
-}
-
-bool WebLayerImpl::opaque() const
-{
- return m_layer->opaque();
-}
-
-void WebLayerImpl::setPosition(const WebFloatPoint& position)
-{
- m_layer->setPosition(position);
-}
-
-WebFloatPoint WebLayerImpl::position() const
-{
- return WebFloatPoint(m_layer->position());
-}
-
-void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
-{
- m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix));
-}
-
-void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix)
-{
- m_layer->setSublayerTransform(matrix);
-}
-
-SkMatrix44 WebLayerImpl::sublayerTransform() const
-{
- return skMatrix44FromTransformationMatrix(m_layer->sublayerTransform());
-}
-
-void WebLayerImpl::setTransform(const SkMatrix44& matrix)
-{
- m_layer->setTransform(transformationMatrixFromSkMatrix44(matrix));
-}
-
-void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix)
-{
- m_layer->setTransform(matrix);
-}
-
-SkMatrix44 WebLayerImpl::transform() const
-{
- return skMatrix44FromTransformationMatrix(m_layer->transform());
-}
-
-void WebLayerImpl::setDrawsContent(bool drawsContent)
-{
- m_layer->setIsDrawable(drawsContent);
-}
-
-bool WebLayerImpl::drawsContent() const
-{
- return m_layer->drawsContent();
-}
-
-void WebLayerImpl::setPreserves3D(bool preserve3D)
-{
- m_layer->setPreserves3D(preserve3D);
-}
-
-void WebLayerImpl::setUseParentBackfaceVisibility(bool useParentBackfaceVisibility)
-{
- m_layer->setUseParentBackfaceVisibility(useParentBackfaceVisibility);
-}
-
-void WebLayerImpl::setBackgroundColor(WebColor color)
-{
- m_layer->setBackgroundColor(color);
-}
-
-void WebLayerImpl::setFilters(const WebFilterOperations& filters)
-{
- m_layer->setFilters(filters);
-}
-
-void WebLayerImpl::setBackgroundFilters(const WebFilterOperations& filters)
-{
- m_layer->setBackgroundFilters(filters);
-}
-
-void WebLayerImpl::setDebugBorderColor(const WebColor& color)
-{
- m_layer->setDebugBorderColor(color);
-}
-
-void WebLayerImpl::setDebugBorderWidth(float width)
-{
- m_layer->setDebugBorderWidth(width);
-}
-
-void WebLayerImpl::setDebugName(WebString name)
-{
- m_layer->setDebugName(name);
-}
-
-void WebLayerImpl::setAnimationDelegate(WebAnimationDelegate* delegate)
-{
- m_layer->setLayerAnimationDelegate(delegate);
-}
-
-bool WebLayerImpl::addAnimation(WebAnimation* animation)
-{
- return m_layer->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation());
-}
-
-void WebLayerImpl::removeAnimation(int animationId)
-{
- m_layer->removeAnimation(animationId);
-}
-
-void WebLayerImpl::removeAnimation(int animationId, WebAnimation::TargetProperty targetProperty)
-{
- m_layer->layerAnimationController()->removeAnimation(animationId, static_cast<CCActiveAnimation::TargetProperty>(targetProperty));
-}
-
-void WebLayerImpl::pauseAnimation(int animationId, double timeOffset)
-{
- m_layer->pauseAnimation(animationId, timeOffset);
-}
-
-void WebLayerImpl::suspendAnimations(double monotonicTime)
-{
- m_layer->suspendAnimations(monotonicTime);
-}
-
-void WebLayerImpl::resumeAnimations(double monotonicTime)
-{
- m_layer->resumeAnimations(monotonicTime);
-}
-
-bool WebLayerImpl::hasActiveAnimation()
-{
- return m_layer->hasActiveAnimation();
-}
-
-void WebLayerImpl::transferAnimationsTo(WebLayer* other)
-{
- ASSERT(other);
- static_cast<WebLayerImpl*>(other)->m_layer->setLayerAnimationController(m_layer->releaseLayerAnimationController());
-}
-
-void WebLayerImpl::setForceRenderSurface(bool forceRenderSurface)
-{
- m_layer->setForceRenderSurface(forceRenderSurface);
-}
-
-void WebLayerImpl::setScrollPosition(WebPoint position)
-{
- m_layer->setScrollPosition(position);
-}
-
-void WebLayerImpl::setScrollable(bool scrollable)
-{
- m_layer->setScrollable(scrollable);
-}
-
-void WebLayerImpl::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
-{
- m_layer->setHaveWheelEventHandlers(haveWheelEventHandlers);
-}
-
-void WebLayerImpl::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
-{
- m_layer->setShouldScrollOnMainThread(shouldScrollOnMainThread);
-}
-
-void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects)
-{
- WebCore::Region region;
- for (size_t i = 0; i < rects.size(); ++i) {
- WebCore::IntRect rect = rects[i];
- region.unite(rect);
- }
- m_layer->setNonFastScrollableRegion(region);
-
-}
-
-void WebLayerImpl::setIsContainerForFixedPositionLayers(bool enable)
-{
- m_layer->setIsContainerForFixedPositionLayers(enable);
-}
-
-void WebLayerImpl::setFixedToContainerLayer(bool enable)
-{
- m_layer->setFixedToContainerLayer(enable);
-}
-
-LayerChromium* WebLayerImpl::layer() const
-{
- return m_layer.get();
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h
index 7e3b533bc..7e4e75062 100644
--- a/Source/WebKit/chromium/src/WebLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebLayerImpl.h
@@ -26,84 +26,18 @@
#ifndef WebLayerImpl_h
#define WebLayerImpl_h
-#include <public/WebLayer.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-class LayerChromium;
-}
+#include "LayerChromium.h"
+#include <wtf/PassRefPtr.h>
namespace WebKit {
-class WebLayerImpl : public WebLayer {
+class WebLayerImpl : public WebCore::LayerChromium {
public:
- explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>);
- virtual ~WebLayerImpl();
-
- // WebLayer implementation.
- virtual int id() const OVERRIDE;
- virtual void invalidateRect(const WebFloatRect&) OVERRIDE;
- virtual void invalidate() OVERRIDE;
- virtual void addChild(WebLayer*) OVERRIDE;
- virtual void insertChild(WebLayer*, size_t index) OVERRIDE;
- virtual void replaceChild(WebLayer* reference, WebLayer* newLayer) OVERRIDE;
- virtual void setChildren(const WebVector<WebLayer*>&) OVERRIDE;
- virtual void removeFromParent() OVERRIDE;
- virtual void removeAllChildren() OVERRIDE;
- virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE;
- virtual WebFloatPoint anchorPoint() const OVERRIDE;
- virtual void setAnchorPointZ(float) OVERRIDE;
- virtual float anchorPointZ() const OVERRIDE;
- virtual void setBounds(const WebSize&) OVERRIDE;
- virtual WebSize bounds() const OVERRIDE;
- virtual void setMasksToBounds(bool) OVERRIDE;
- virtual bool masksToBounds() const OVERRIDE;
- virtual void setMaskLayer(WebLayer*) OVERRIDE;
- virtual void setReplicaLayer(WebLayer*) OVERRIDE;
- virtual void setOpacity(float) OVERRIDE;
- virtual float opacity() const OVERRIDE;
- virtual void setOpaque(bool) OVERRIDE;
- virtual bool opaque() const OVERRIDE;
- virtual void setPosition(const WebFloatPoint&) OVERRIDE;
- virtual WebFloatPoint position() const OVERRIDE;
- virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE;
- virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE;
- virtual SkMatrix44 sublayerTransform() const OVERRIDE;
- virtual void setTransform(const SkMatrix44&) OVERRIDE;
- virtual void setTransform(const WebTransformationMatrix&) OVERRIDE;
- virtual SkMatrix44 transform() const OVERRIDE;
- virtual void setDrawsContent(bool) OVERRIDE;
- virtual bool drawsContent() const OVERRIDE;
- virtual void setPreserves3D(bool) OVERRIDE;
- virtual void setUseParentBackfaceVisibility(bool) OVERRIDE;
- virtual void setBackgroundColor(WebColor) OVERRIDE;
- virtual void setFilters(const WebFilterOperations&) OVERRIDE;
- virtual void setBackgroundFilters(const WebFilterOperations&) OVERRIDE;
- virtual void setDebugBorderColor(const WebColor&) OVERRIDE;
- virtual void setDebugBorderWidth(float) OVERRIDE;
- virtual void setDebugName(WebString) OVERRIDE;
- virtual void setAnimationDelegate(WebAnimationDelegate*) OVERRIDE;
- virtual bool addAnimation(WebAnimation*) OVERRIDE;
- virtual void removeAnimation(int animationId) OVERRIDE;
- virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) OVERRIDE;
- virtual void pauseAnimation(int animationId, double timeOffset) OVERRIDE;
- virtual void suspendAnimations(double monotonicTime) OVERRIDE;
- virtual void resumeAnimations(double monotonicTime) OVERRIDE;
- virtual bool hasActiveAnimation() OVERRIDE;
- virtual void transferAnimationsTo(WebLayer*) OVERRIDE;
- virtual void setForceRenderSurface(bool) OVERRIDE;
- virtual void setScrollPosition(WebPoint) OVERRIDE;
- virtual void setScrollable(bool) OVERRIDE;
- virtual void setHaveWheelEventHandlers(bool) OVERRIDE;
- virtual void setShouldScrollOnMainThread(bool) OVERRIDE;
- virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE;
- virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE;
- virtual void setFixedToContainerLayer(bool) OVERRIDE;
-
- WebCore::LayerChromium* layer() const;
+ static PassRefPtr<WebLayerImpl> create();
protected:
- RefPtr<WebCore::LayerChromium> m_layer;
+ WebLayerImpl();
+ virtual ~WebLayerImpl();
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
index 7dfbcd129..f397e534a 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp
@@ -31,7 +31,6 @@
#include "CCLayerTreeHost.h"
#include "CCRenderingStats.h"
#include "LayerChromium.h"
-#include "WebLayerImpl.h"
#include "WebLayerTreeViewImpl.h"
#include <public/WebLayer.h>
#include <public/WebPoint.h>
@@ -84,7 +83,7 @@ void WebLayerTreeView::setSurfaceReady()
void WebLayerTreeView::setRootLayer(WebLayer *root)
{
if (root)
- m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer());
+ m_private->layerTreeHost()->setRootLayer(*root);
else
m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>());
}
diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
index 1fd823976..1f1933fc9 100644
--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
@@ -29,7 +29,6 @@
#include "CCLayerTreeHost.h"
#include "CCThreadProxy.h"
#include "LayerChromium.h"
-#include "WebLayerImpl.h"
#include <public/WebGraphicsContext3D.h>
#include <public/WebLayer.h>
#include <public/WebLayerTreeView.h>
@@ -143,7 +142,7 @@ PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewCl
OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings));
if (!impl->layerTreeHost())
return nullptr;
- impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer());
+ impl->layerTreeHost()->setRootLayer(root);
return impl.release();
}
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index cb756233e..4a90a988d 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -109,9 +109,9 @@ void WebMediaPlayerClientImpl::readyStateChanged()
ASSERT(m_mediaPlayer);
m_mediaPlayer->readyStateChanged();
#if USE(ACCELERATED_COMPOSITING)
- if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) {
- m_videoLayer = adoptPtr(WebVideoLayer::create(this));
- m_videoLayer->layer()->setOpaque(m_opaque);
+ if (hasVideo() && supportsAcceleratedRendering() && m_videoLayer.isNull()) {
+ m_videoLayer = WebVideoLayer::create(this);
+ m_videoLayer.setOpaque(m_opaque);
}
#endif
}
@@ -138,8 +138,8 @@ void WebMediaPlayerClientImpl::repaint()
{
ASSERT(m_mediaPlayer);
#if USE(ACCELERATED_COMPOSITING)
- if (m_videoLayer && supportsAcceleratedRendering())
- m_videoLayer->layer()->invalidate();
+ if (!m_videoLayer.isNull() && supportsAcceleratedRendering())
+ m_videoLayer.invalidate();
#endif
m_mediaPlayer->repaint();
}
@@ -166,8 +166,8 @@ void WebMediaPlayerClientImpl::setOpaque(bool opaque)
{
#if USE(ACCELERATED_COMPOSITING)
m_opaque = opaque;
- if (m_videoLayer)
- m_videoLayer->layer()->setOpaque(m_opaque);
+ if (!m_videoLayer.isNull())
+ m_videoLayer.setOpaque(m_opaque);
#endif
}
@@ -343,7 +343,7 @@ void WebMediaPlayerClientImpl::cancelLoad()
WebLayer* WebMediaPlayerClientImpl::platformLayer() const
{
ASSERT(m_supportsAcceleratedCompositing);
- return m_videoLayer ? m_videoLayer->layer() : 0;
+ return const_cast<WebVideoLayer*>(&m_videoLayer);
}
#endif
@@ -745,7 +745,7 @@ bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
{
- return m_videoLayer && m_videoLayer->active();
+ return !m_videoLayer.isNull() && m_videoLayer.active();
}
void WebMediaPlayerClientImpl::setVideoFrameProviderClient(WebVideoFrameProvider::Client* client)
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
index 329fd9ec0..373015eb7 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
@@ -205,7 +205,7 @@ private:
WebCore::MediaPlayer::Preload m_preload;
RefPtr<WebHelperPluginImpl> m_helperPlugin;
#if USE(ACCELERATED_COMPOSITING)
- OwnPtr<WebVideoLayer> m_videoLayer;
+ WebVideoLayer m_videoLayer;
bool m_supportsAcceleratedCompositing;
bool m_opaque;
WebVideoFrameProvider::Client* m_videoFrameProviderClient;
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
index 75a97e0f6..a35a0407f 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
@@ -366,11 +366,11 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId)
if (m_textureId == textureId)
return;
- ASSERT(!m_ioSurfaceLayer);
+ ASSERT(m_ioSurfaceLayer.isNull());
- if (!m_textureLayer)
- m_textureLayer = adoptPtr(WebExternalTextureLayer::create());
- m_textureLayer->setTextureId(textureId);
+ 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
@@ -390,11 +390,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
if (ioSurfaceId == m_ioSurfaceId)
return;
- ASSERT(!m_textureLayer);
+ ASSERT(m_textureLayer.isNull());
- if (!m_ioSurfaceLayer)
- m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create());
- m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height));
+ 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
@@ -409,11 +409,11 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width,
void WebPluginContainerImpl::commitBackingTexture()
{
#if USE(ACCELERATED_COMPOSITING)
- if (m_textureLayer)
- m_textureLayer->layer()->invalidate();
+ if (!m_textureLayer.isNull())
+ m_textureLayer.invalidate();
- if (m_ioSurfaceLayer)
- m_ioSurfaceLayer->layer()->invalidate();
+ if (!m_ioSurfaceLayer.isNull())
+ m_ioSurfaceLayer.invalidate();
#endif
}
@@ -480,11 +480,11 @@ void WebPluginContainerImpl::zoomLevelChanged(double zoomLevel)
void WebPluginContainerImpl::setOpaque(bool opaque)
{
#if USE(ACCELERATED_COMPOSITING)
- if (m_textureLayer)
- m_textureLayer->layer()->setOpaque(opaque);
+ if (!m_textureLayer.isNull())
+ m_textureLayer.setOpaque(opaque);
- if (m_ioSurfaceLayer)
- m_ioSurfaceLayer->layer()->setOpaque(opaque);
+ if (!m_ioSurfaceLayer.isNull())
+ m_ioSurfaceLayer.setOpaque(opaque);
#endif
}
@@ -575,9 +575,9 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
WebLayer* WebPluginContainerImpl::platformLayer() const
{
if (m_textureId)
- return m_textureLayer->layer();
+ return const_cast<WebExternalTextureLayer*>(&m_textureLayer);
if (m_ioSurfaceId)
- return m_ioSurfaceLayer->layer();
+ return const_cast<WebIOSurfaceLayer*>(&m_ioSurfaceLayer);
return 0;
}
#endif
diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
index 998be6e41..074a0ccdc 100644
--- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h
+++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h
@@ -186,10 +186,10 @@ private:
// 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;
- OwnPtr<WebExternalTextureLayer> m_textureLayer;
+ WebExternalTextureLayer m_textureLayer;
unsigned m_ioSurfaceId;
- OwnPtr<WebIOSurfaceLayer> m_ioSurfaceLayer;
+ WebIOSurfaceLayer m_ioSurfaceLayer;
#endif
// The associated scrollbar group object, created lazily. Used for Pepper
diff --git a/Source/WebKit/chromium/src/WebScrollableLayer.cpp b/Source/WebKit/chromium/src/WebScrollableLayer.cpp
new file mode 100644
index 000000000..a20e81d81
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebScrollableLayer.cpp
@@ -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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <public/WebScrollableLayer.h>
+
+#include "LayerChromium.h"
+#include "Region.h"
+
+namespace WebKit {
+
+void WebScrollableLayer::setScrollPosition(WebPoint position)
+{
+ m_private->setScrollPosition(position);
+}
+
+void WebScrollableLayer::setScrollable(bool scrollable)
+{
+ m_private->setScrollable(scrollable);
+}
+
+void WebScrollableLayer::setHaveWheelEventHandlers(bool haveWheelEventHandlers)
+{
+ m_private->setHaveWheelEventHandlers(haveWheelEventHandlers);
+}
+
+void WebScrollableLayer::setShouldScrollOnMainThread(bool shouldScrollOnMainThread)
+{
+ m_private->setShouldScrollOnMainThread(shouldScrollOnMainThread);
+}
+
+void WebScrollableLayer::setNonFastScrollableRegion(const WebVector<WebRect>& rects)
+{
+ WebCore::Region region;
+ for (size_t i = 0; i < rects.size(); ++i) {
+ WebCore::IntRect rect = rects[i];
+ region.unite(rect);
+ }
+ m_private->setNonFastScrollableRegion(region);
+
+}
+
+void WebScrollableLayer::setIsContainerForFixedPositionLayers(bool enable)
+{
+ m_private->setIsContainerForFixedPositionLayers(enable);
+}
+
+void WebScrollableLayer::setFixedToContainerLayer(bool enable)
+{
+ m_private->setFixedToContainerLayer(enable);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp
index ec6e9895d..2bd1b20fb 100644
--- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebScrollbarLayer.cpp
@@ -24,42 +24,39 @@
*/
#include "config.h"
-#include "WebScrollbarLayerImpl.h"
+#include <public/WebScrollbarLayer.h>
#include "ScrollbarLayerChromium.h"
-#include "WebLayerImpl.h"
-using WebCore::Scrollbar;
-using WebCore::ScrollbarLayerChromium;
+using namespace WebCore;
namespace WebKit {
-WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
+void WebScrollbarLayer::setScrollLayer(const WebLayer layer)
{
- return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
+ int id = layer.isNull() ? 0 : layer.constUnwrap<LayerChromium>()->id();
+ unwrap<ScrollbarLayerChromium>()->setScrollLayerId(id);
}
-
-WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer)
- : m_layer(adoptPtr(new WebLayerImpl(layer)))
+WebScrollbarLayer WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry)
{
+ return WebScrollbarLayer(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0));
}
-WebScrollbarLayerImpl::~WebScrollbarLayerImpl()
+WebScrollbarLayer::WebScrollbarLayer(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
+ : WebLayer(layer)
{
}
-WebLayer* WebScrollbarLayerImpl::layer()
+WebScrollbarLayer& WebScrollbarLayer::operator=(const WTF::PassRefPtr<WebCore::ScrollbarLayerChromium>& layer)
{
- return m_layer.get();
+ m_private = layer;
+ return *this;
}
-void WebScrollbarLayerImpl::setScrollLayer(WebLayer* layer)
+WebScrollbarLayer::operator PassRefPtr<ScrollbarLayerChromium>() const
{
- int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
- static_cast<ScrollbarLayerChromium*>(m_layer->layer())->setScrollLayerId(id);
+ return unwrap<ScrollbarLayerChromium>();
}
-
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp
index d93af8045..83914b263 100644
--- a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSolidColorLayer.cpp
@@ -24,37 +24,26 @@
*/
#include "config.h"
-#include "WebImageLayerImpl.h"
+#include <public/WebSolidColorLayer.h>
-#include "ImageLayerChromium.h"
-#include "WebLayerImpl.h"
-
-using WebCore::ImageLayerChromium;
+#include "WebSolidColorLayerImpl.h"
+#include <public/WebFloatRect.h>
namespace WebKit {
-WebImageLayer* WebImageLayer::create()
-{
- return new WebImageLayerImpl(WebCore::ImageLayerChromium::create());
-}
-
-WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer)
- : m_layer(adoptPtr(new WebLayerImpl(layer)))
-{
-}
-
-WebImageLayerImpl::~WebImageLayerImpl()
+WebSolidColorLayer WebSolidColorLayer::create()
{
+ return WebSolidColorLayer(WebSolidColorLayerImpl::create());
}
-WebLayer* WebImageLayerImpl::layer()
+WebSolidColorLayer::WebSolidColorLayer(const PassRefPtr<WebSolidColorLayerImpl>& node)
+ : WebLayer(node)
{
- return m_layer.get();
}
-void WebImageLayerImpl::setBitmap(SkBitmap bitmap)
+void WebSolidColorLayer::setBackgroundColor(const WebColor& color)
{
- static_cast<ImageLayerChromium*>(m_layer->layer())->setBitmap(bitmap);
+ m_private->setBackgroundColor(color);
}
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
index 94404262c..33b1a30e3 100644
--- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
+++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
@@ -26,37 +26,24 @@
#include "config.h"
#include "WebSolidColorLayerImpl.h"
-#include "SolidColorLayerChromium.h"
-#include "WebLayerImpl.h"
-
-using WebCore::SolidColorLayerChromium;
+using namespace WebCore;
namespace WebKit {
-WebSolidColorLayer* WebSolidColorLayer::create()
+PassRefPtr<WebSolidColorLayerImpl> WebSolidColorLayerImpl::create()
{
- return new WebSolidColorLayerImpl(SolidColorLayerChromium::create());
+ return adoptRef(new WebSolidColorLayerImpl());
}
-WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer)
- : m_layer(adoptPtr(new WebLayerImpl(layer)))
+WebSolidColorLayerImpl::WebSolidColorLayerImpl()
+ : SolidColorLayerChromium()
{
- m_layer->layer()->setIsDrawable(true);
+ setIsDrawable(true);
}
WebSolidColorLayerImpl::~WebSolidColorLayerImpl()
{
}
-WebLayer* WebSolidColorLayerImpl::layer()
-{
- return m_layer.get();
-}
-
-void WebSolidColorLayerImpl::setBackgroundColor(WebColor color)
-{
- m_layer->setBackgroundColor(color);
-}
-
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
index 7742ba492..d2673b42b 100644
--- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
@@ -26,28 +26,18 @@
#ifndef WebSolidColorLayerImpl_h
#define WebSolidColorLayerImpl_h
-#include <public/WebSolidColorLayer.h>
-#include <wtf/OwnPtr.h>
+#include "SolidColorLayerChromium.h"
#include <wtf/PassRefPtr.h>
-namespace WebCore {
-class SolidColorLayerChromium;
-}
-
namespace WebKit {
-class WebLayerImpl;
-class WebSolidColorLayerImpl : public WebSolidColorLayer {
+class WebSolidColorLayerImpl : public WebCore::SolidColorLayerChromium {
public:
- explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>);
- virtual ~WebSolidColorLayerImpl();
+ static PassRefPtr<WebSolidColorLayerImpl> create();
- // WebSolidColorLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual void setBackgroundColor(WebColor) OVERRIDE;
-
-private:
- OwnPtr<WebLayerImpl> m_layer;
+protected:
+ WebSolidColorLayerImpl();
+ virtual ~WebSolidColorLayerImpl();
};
} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.h b/Source/WebKit/chromium/src/WebVideoLayer.cpp
index 287e4b5e2..0f342155d 100644
--- a/Source/WebKit/chromium/src/WebVideoLayerImpl.h
+++ b/Source/WebKit/chromium/src/WebVideoLayer.cpp
@@ -23,32 +23,25 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebVideoLayerImpl_h
-#define WebVideoLayerImpl_h
-
+#include "config.h"
+#include "VideoLayerChromium.h"
#include <public/WebVideoLayer.h>
-namespace WebCore {
-class VideoLayerChromium;
-}
-
namespace WebKit {
-class WebLayerImpl;
-
-class WebVideoLayerImpl : public WebVideoLayer {
-public:
- explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>);
- virtual ~WebVideoLayerImpl();
- // WebVideoLayer implementation.
- virtual WebLayer* layer() OVERRIDE;
- virtual bool active() const OVERRIDE;
-
-private:
- OwnPtr<WebLayerImpl> m_layer;
-};
+WebVideoLayer WebVideoLayer::create(WebVideoFrameProvider* provider)
+{
+ return WebVideoLayer(WebCore::VideoLayerChromium::create(provider));
+}
+WebVideoLayer::WebVideoLayer(PassRefPtr<WebCore::VideoLayerChromium> layer)
+ : WebLayer(layer)
+{
}
-#endif // WebVideoLayerImpl_h
+bool WebVideoLayer::active() const
+{
+ return m_private->layerTreeHost();
+}
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
index 97339b342..b18e20944 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
@@ -408,7 +408,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_isCancelingFullScreen(false)
, m_benchmarkSupport(this)
#if USE(ACCELERATED_COMPOSITING)
- , m_rootLayer(0)
, m_rootGraphicsLayer(0)
, m_isAcceleratedCompositingActive(false)
, m_compositorCreationFailed(false)
@@ -2215,6 +2214,58 @@ bool WebViewImpl::setEditableSelectionOffsets(int start, int end)
return editor->setSelectionOffsets(start, end);
}
+bool WebViewImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines)
+{
+ const Frame* focused = focusedWebCoreFrame();
+ if (!focused)
+ return false;
+
+ Editor* editor = focused->editor();
+ if (!editor || !editor->canEdit())
+ return false;
+
+ editor->cancelComposition();
+
+ if (compositionStart == compositionEnd)
+ return true;
+
+ size_t location;
+ size_t length;
+ caretOrSelectionRange(&location, &length);
+ editor->setIgnoreCompositionSelectionChange(true);
+ editor->setSelectionOffsets(compositionStart, compositionEnd);
+ String text = editor->selectedText();
+ focused->document()->execCommand("delete", true);
+ editor->setComposition(text, CompositionUnderlineVectorBuilder(underlines), 0, 0);
+ editor->setSelectionOffsets(location, location + length);
+ editor->setIgnoreCompositionSelectionChange(false);
+
+ return true;
+}
+
+void WebViewImpl::extendSelectionAndDelete(int before, int after)
+{
+ const Frame* focused = focusedWebCoreFrame();
+ if (!focused)
+ return;
+
+ Editor* editor = focused->editor();
+ if (!editor || !editor->canEdit())
+ return;
+
+ FrameSelection* selection = focused->selection();
+ if (!selection)
+ return;
+
+ size_t location;
+ size_t length;
+ RefPtr<Range> range = selection->selection().firstRange();
+ if (range && TextIterator::getLocationAndLengthFromRange(selection->rootEditableElement(), range.get(), location, length)) {
+ editor->setSelectionOffsets(max(static_cast<int>(location) - before, 0), location + length + after);
+ focused->document()->execCommand("delete", true);
+ }
+}
+
bool WebViewImpl::isSelectionEditable() const
{
const Frame* frame = focusedWebCoreFrame();
@@ -3513,7 +3564,6 @@ bool WebViewImpl::allowsAcceleratedCompositing()
void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
{
m_rootGraphicsLayer = layer;
- m_rootLayer = layer ? layer->platformLayer() : 0;
setIsAcceleratedCompositingActive(layer);
if (m_nonCompositedContentHost) {
@@ -3527,8 +3577,11 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
m_nonCompositedContentHost->setScrollLayer(scrollLayer);
}
+ if (layer)
+ m_rootLayer = *layer->platformLayer();
+
if (!m_layerTreeView.isNull())
- m_layerTreeView.setRootLayer(m_rootLayer);
+ m_layerTreeView.setRootLayer(layer ? &m_rootLayer : 0);
IntRect damagedRect(0, 0, m_size.width, m_size.height);
if (!m_isAcceleratedCompositingActive)
@@ -3641,7 +3694,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
m_nonCompositedContentHost->setOpaque(!isTransparent());
- m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings);
+ m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings);
if (!m_layerTreeView.isNull()) {
if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
ASSERT(page()->deviceScaleFactor());
diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h
index 431dad490..b8dcad717 100644
--- a/Source/WebKit/chromium/src/WebViewImpl.h
+++ b/Source/WebKit/chromium/src/WebViewImpl.h
@@ -162,6 +162,8 @@ public:
virtual WebTextInputInfo textInputInfo();
virtual WebTextInputType textInputType();
virtual bool setEditableSelectionOffsets(int start, int end);
+ virtual bool setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines);
+ virtual void extendSelectionAndDelete(int before, int after);
virtual bool isSelectionEditable() const;
virtual WebColor backgroundColor() const;
virtual bool selectionBounds(WebRect& start, WebRect& end) const;
@@ -814,7 +816,7 @@ private:
WebCore::IntRect m_rootLayerScrollDamage;
OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
WebLayerTreeView m_layerTreeView;
- WebLayer* m_rootLayer;
+ WebLayer m_rootLayer;
WebCore::GraphicsLayer* m_rootGraphicsLayer;
bool m_isAcceleratedCompositingActive;
bool m_compositorCreationFailed;
diff --git a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp
index 4948f97cc..a5ca55124 100644
--- a/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp
@@ -122,13 +122,13 @@ TEST(ImageLayerChromiumTest, opaqueImages)
RefPtr<Image> nonOpaqueImage = TestImage::create(IntSize(100, 100), false);
ASSERT_TRUE(nonOpaqueImage.get());
- ASSERT_FALSE(graphicsLayer->contentsLayer());
+ ASSERT_TRUE(graphicsLayer->contentsLayer().isNull());
graphicsLayer->setContentsToImage(opaqueImage.get());
- ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque());
+ ASSERT_TRUE(graphicsLayer->contentsLayer().opaque());
graphicsLayer->setContentsToImage(nonOpaqueImage.get());
- ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque());
+ ASSERT_FALSE(graphicsLayer->contentsLayer().opaque());
}
} // namespace
diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
index b9025b4c8..0e6eb0eb4 100644
--- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
+++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp
@@ -803,6 +803,18 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
WebKit::WebCompositor::shutdown();
}
+TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer)
+{
+ WebKit::WebCompositor::initialize(0);
+ RefPtr<LayerChromium> root = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ root->addChild(child);
+ OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
+ layerTreeHost->setRootLayer(root);
+ layerTreeHost.clear();
+ WebKit::WebCompositor::shutdown();
+}
+
class MockLayerChromium : public LayerChromium {
public:
bool needsDisplay() const { return m_needsDisplay; }
diff --git a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp
index 052936dab..b5b50bf7d 100644
--- a/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp
+++ b/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp
@@ -38,6 +38,9 @@
#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/StringImpl.h>
+#include <wtf/text/WTFString.h>
using namespace WebCore;
@@ -224,5 +227,33 @@ TEST(MemoryInstrumentationTest, visitFirstMemberInNonVirtualClass)
EXPECT_EQ(2, visitedObjects.size());
}
+TEST(MemoryInstrumentationTest, visitStrings)
+{
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ String string("string");
+ impl.addRootObject(string);
+ EXPECT_EQ(string.impl()->sizeInBytes(), impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+ }
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ String string("string");
+ impl.addRootObject(&string);
+ EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(String), impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+ }
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ AtomicString string("string");
+ impl.addRootObject(&string);
+ EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(AtomicString), impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+ }
+}
+
} // namespace
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp
index 8fc74988e..03c201e16 100644
--- a/Source/WebKit/chromium/tests/WebFrameTest.cpp
+++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp
@@ -891,7 +891,7 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
static const char* kFindString = "result";
static const int kFindIdentifier = 12345;
- static const int kNumResults = 10;
+ static const int kNumResults = 16;
WebFindOptions options;
WebString searchText = WebString::fromUTF8(kFindString);
@@ -918,8 +918,8 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
// Check that the find result ordering matches with our expectations.
Range* result = mainFrame->activeMatchFrame()->activeMatch();
ASSERT_TRUE(result);
- result->setEnd(result->endContainer(), result->endOffset() + 2);
- EXPECT_EQ(result->text(), String::format("%s %d", kFindString, resultIndex));
+ result->setEnd(result->endContainer(), result->endOffset() + 3);
+ EXPECT_EQ(result->text(), String::format("%s %02d", kFindString, resultIndex));
// Verify that the expected match rect also matches the currently active match.
// Compare the enclosing rects to prevent precision issues caused by CSS transforms.
@@ -950,6 +950,36 @@ TEST_F(WebFrameTest, FindInPageMatchRects)
EXPECT_TRUE(webMatchRects[7].y < webMatchRects[8].y);
EXPECT_TRUE(webMatchRects[8].y < webMatchRects[9].y);
+ // Results 11, 12, 13 and 14 should be between results 10 and 15, as they are inside the table.
+ EXPECT_TRUE(webMatchRects[11].y > webMatchRects[10].y);
+ EXPECT_TRUE(webMatchRects[12].y > webMatchRects[10].y);
+ EXPECT_TRUE(webMatchRects[13].y > webMatchRects[10].y);
+ EXPECT_TRUE(webMatchRects[14].y > webMatchRects[10].y);
+ EXPECT_TRUE(webMatchRects[11].y < webMatchRects[15].y);
+ EXPECT_TRUE(webMatchRects[12].y < webMatchRects[15].y);
+ EXPECT_TRUE(webMatchRects[13].y < webMatchRects[15].y);
+ EXPECT_TRUE(webMatchRects[14].y < webMatchRects[15].y);
+
+ // Result 11 should be above 12, 13 and 14 as it's in the table header.
+ EXPECT_TRUE(webMatchRects[11].y < webMatchRects[12].y);
+ EXPECT_TRUE(webMatchRects[11].y < webMatchRects[13].y);
+ EXPECT_TRUE(webMatchRects[11].y < webMatchRects[14].y);
+
+ // Result 11 should also be right to 12, 13 and 14 because of the colspan.
+ EXPECT_TRUE(webMatchRects[11].x > webMatchRects[12].x);
+ EXPECT_TRUE(webMatchRects[11].x > webMatchRects[13].x);
+ EXPECT_TRUE(webMatchRects[11].x > webMatchRects[14].x);
+
+ // Result 12 should be left to results 11, 13 and 14 in the table layout.
+ EXPECT_TRUE(webMatchRects[12].x < webMatchRects[11].x);
+ EXPECT_TRUE(webMatchRects[12].x < webMatchRects[13].x);
+ EXPECT_TRUE(webMatchRects[12].x < webMatchRects[14].x);
+
+ // Results 13, 12 and 14 should be one above the other in that order because of the rowspan
+ // and vertical-align: middle by default.
+ EXPECT_TRUE(webMatchRects[13].y < webMatchRects[12].y);
+ EXPECT_TRUE(webMatchRects[12].y < webMatchRects[14].y);
+
// Resizing should update the rects version.
webView->resize(WebSize(800, 600));
webkit_support::RunAllPendingMessages();
diff --git a/Source/WebKit/chromium/tests/WebLayerTest.cpp b/Source/WebKit/chromium/tests/WebLayerTest.cpp
index 9b8e58ca1..667200410 100644
--- a/Source/WebKit/chromium/tests/WebLayerTest.cpp
+++ b/Source/WebKit/chromium/tests/WebLayerTest.cpp
@@ -26,7 +26,6 @@
#include <public/WebLayer.h>
#include "CompositorFakeWebGraphicsContext3D.h"
-#include "WebLayerImpl.h"
#include <public/WebCompositor.h>
#include <public/WebContentLayer.h>
#include <public/WebContentLayerClient.h>
@@ -77,9 +76,9 @@ public:
{
// Initialize without threading support.
WebKit::WebCompositor::initialize(0);
- m_rootLayer = adoptPtr(WebLayer::create());
+ m_rootLayer = WebLayer::create();
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- EXPECT_TRUE(m_view.initialize(&m_client, *m_rootLayer, WebLayerTreeView::Settings()));
+ EXPECT_TRUE(m_view.initialize(&m_client, m_rootLayer, WebLayerTreeView::Settings()));
Mock::VerifyAndClearExpectations(&m_client);
}
@@ -88,14 +87,14 @@ public:
// We may get any number of scheduleComposite calls during shutdown.
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
m_view.setRootLayer(0);
- m_rootLayer.clear();
+ m_rootLayer.reset();
m_view.reset();
WebKit::WebCompositor::shutdown();
}
protected:
MockWebLayerTreeViewClient m_client;
- OwnPtr<WebLayer> m_rootLayer;
+ WebLayer m_rootLayer;
WebLayerTreeView m_view;
};
@@ -105,73 +104,73 @@ TEST_F(WebLayerTest, Client)
{
// Base layer.
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- OwnPtr<WebLayer> layer = adoptPtr(WebLayer::create());
- m_rootLayer->addChild(layer.get());
+ WebLayer layer = WebLayer::create();
+ m_rootLayer.addChild(layer);
Mock::VerifyAndClearExpectations(&m_client);
WebFloatPoint point(3, 4);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setAnchorPoint(point);
+ layer.setAnchorPoint(point);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(point, layer->anchorPoint());
+ EXPECT_EQ(point, layer.anchorPoint());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
float anchorZ = 5;
- layer->setAnchorPointZ(anchorZ);
+ layer.setAnchorPointZ(anchorZ);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(anchorZ, layer->anchorPointZ());
+ EXPECT_EQ(anchorZ, layer.anchorPointZ());
WebSize size(7, 8);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setBounds(size);
+ layer.setBounds(size);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(size, layer->bounds());
+ EXPECT_EQ(size, layer.bounds());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setMasksToBounds(true);
+ layer.setMasksToBounds(true);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(layer->masksToBounds());
+ EXPECT_TRUE(layer.masksToBounds());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- OwnPtr<WebLayer> otherLayer = adoptPtr(WebLayer::create());
- m_rootLayer->addChild(otherLayer.get());
+ WebLayer otherLayer = WebLayer::create();
+ m_rootLayer.addChild(otherLayer);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setMaskLayer(otherLayer.get());
+ layer.setMaskLayer(otherLayer);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
float opacity = 0.123f;
- layer->setOpacity(opacity);
+ layer.setOpacity(opacity);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(opacity, layer->opacity());
+ EXPECT_EQ(opacity, layer.opacity());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setOpaque(true);
+ layer.setOpaque(true);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_TRUE(layer->opaque());
+ EXPECT_TRUE(layer.opaque());
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- layer->setPosition(point);
+ layer.setPosition(point);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_EQ(point, layer->position());
+ EXPECT_EQ(point, layer.position());
// Texture layer.
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create());
- m_rootLayer->addChild(textureLayer->layer());
+ WebExternalTextureLayer textureLayer = WebExternalTextureLayer::create();
+ m_rootLayer.addChild(textureLayer);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- textureLayer->setTextureId(3);
+ textureLayer.setTextureId(3);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- textureLayer->setFlipped(true);
+ textureLayer.setFlipped(true);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
WebFloatRect uvRect(0.1f, 0.1f, 0.9f, 0.9f);
- textureLayer->setUVRect(uvRect);
+ textureLayer.setUVRect(uvRect);
Mock::VerifyAndClearExpectations(&m_client);
@@ -179,14 +178,14 @@ TEST_F(WebLayerTest, Client)
MockWebContentLayerClient contentClient;
EXPECT_CALL(contentClient, paintContents(_, _, _)).Times(AnyNumber());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
- OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&contentClient));
- m_rootLayer->addChild(contentLayer->layer());
+ WebContentLayer contentLayer = WebContentLayer::create(&contentClient);
+ m_rootLayer.addChild(contentLayer);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
- contentLayer->layer()->setDrawsContent(false);
+ contentLayer.setDrawsContent(false);
Mock::VerifyAndClearExpectations(&m_client);
- EXPECT_FALSE(contentLayer->layer()->drawsContent());
+ EXPECT_FALSE(contentLayer.drawsContent());
}
}
diff --git a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp
index 1c1602c23..bec2c6035 100644
--- a/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp
+++ b/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp
@@ -60,8 +60,8 @@ public:
virtual void SetUp()
{
initializeCompositor();
- m_rootLayer = adoptPtr(WebLayer::create());
- EXPECT_TRUE(m_view.initialize(client(), *m_rootLayer, WebLayerTreeView::Settings()));
+ m_rootLayer = WebLayer::create();
+ EXPECT_TRUE(m_view.initialize(client(), m_rootLayer, WebLayerTreeView::Settings()));
m_view.setSurfaceReady();
}
@@ -70,13 +70,13 @@ public:
Mock::VerifyAndClearExpectations(client());
m_view.setRootLayer(0);
- m_rootLayer.clear();
+ m_rootLayer.reset();
m_view.reset();
WebKit::WebCompositor::shutdown();
}
protected:
- OwnPtr<WebLayer> m_rootLayer;
+ WebLayer m_rootLayer;
WebLayerTreeView m_view;
};
diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp
index 3ca1094d0..46c96310d 100644
--- a/Source/WebKit/chromium/tests/WebViewTest.cpp
+++ b/Source/WebKit/chromium/tests/WebViewTest.cpp
@@ -379,4 +379,43 @@ TEST_F(WebViewTest, FormChange)
webView->close();
}
+TEST_F(WebViewTest, ExtendSelectionAndDelete)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));
+ WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html");
+ webView->setInitialFocus(false);
+ webView->setEditableSelectionOffsets(10, 10);
+ webView->extendSelectionAndDelete(5, 8);
+ WebTextInputInfo info = webView->textInputInfo();
+ EXPECT_EQ("01234ijklmnopqrstuvwxyz", std::string(info.value.utf8().data()));
+ EXPECT_EQ(5, info.selectionStart);
+ EXPECT_EQ(5, info.selectionEnd);
+ webView->extendSelectionAndDelete(10, 0);
+ info = webView->textInputInfo();
+ EXPECT_EQ("ijklmnopqrstuvwxyz", std::string(info.value.utf8().data()));
+ webView->close();
+}
+
+TEST_F(WebViewTest, SetCompositionFromExistingText)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html"));
+ WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html");
+ webView->setInitialFocus(false);
+ WebVector<WebCompositionUnderline> emptyUnderlines;
+ webView->setEditableSelectionOffsets(4, 10);
+ webView->setCompositionFromExistingText(8, 12, emptyUnderlines);
+ WebTextInputInfo info = webView->textInputInfo();
+ EXPECT_EQ(4, info.selectionStart);
+ EXPECT_EQ(10, info.selectionEnd);
+ EXPECT_EQ(8, info.compositionStart);
+ EXPECT_EQ(12, info.compositionEnd);
+ webView->setCompositionFromExistingText(0, 0, emptyUnderlines);
+ info = webView->textInputInfo();
+ EXPECT_EQ(4, info.selectionStart);
+ EXPECT_EQ(10, info.selectionEnd);
+ EXPECT_EQ(-1, info.compositionStart);
+ EXPECT_EQ(-1, info.compositionEnd);
+ webView->close();
+}
+
}
diff --git a/Source/WebKit/chromium/tests/data/find_in_page.html b/Source/WebKit/chromium/tests/data/find_in_page.html
index c09c9dd06..643073a16 100644
--- a/Source/WebKit/chromium/tests/data/find_in_page.html
+++ b/Source/WebKit/chromium/tests/data/find_in_page.html
@@ -5,9 +5,9 @@
</head>
<body>
This a find-in-page match rect test.</br>
-result 0</br>
+result 00</br>
<iframe src="find_in_page_frame.html" height="300" scrolling="yes"></iframe>
</br>
-result 1
+result 01
</body>
</html>
diff --git a/Source/WebKit/chromium/tests/data/find_in_page_frame.html b/Source/WebKit/chromium/tests/data/find_in_page_frame.html
index 47d29ae0f..a922a50bc 100644
--- a/Source/WebKit/chromium/tests/data/find_in_page_frame.html
+++ b/Source/WebKit/chromium/tests/data/find_in_page_frame.html
@@ -36,23 +36,40 @@ Foo bar.
</br></br>
</br></br>
</br></br>
-result 2
+result 02
<div class="transform">
-result 3
+result 03
</div>
-result 4
+result 04
<div class="fixed">
-result 5
+result 05
</div>
-result 6
+result 06
<div class="scroll">
-result 7
+result 07
Foo bar.
</br></br>
</br></br>
</br></br>
-result 8
+result 08
</div>
-result 9
+result 09
+</br></br>
+result 10
+<table border="1" cellpadding="10" cellspacing="10">
+<tr>
+ <th>Foo</th>
+ <th>Bar</th>
+ <th>result 11</th>
+</tr>
+<tr>
+ <td rowspan="2">result 12</td>
+ <td colspan="2">result 13</td>
+</tr>
+<tr>
+ <td colspan="2">result 14</td>
+</tr>
+</table>
+result 15
</body>
</html>
diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog
index d5b2ddf4e..a22e49348 100644
--- a/Source/WebKit/efl/ChangeLog
+++ b/Source/WebKit/efl/ChangeLog
@@ -1,3 +1,16 @@
+2012-08-21 Kihong Kwon <kihong.kwon@samsung.com>
+
+ [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=94586
+
+ Reviewed by Kentaro Hara.
+
+ Fix build error in the DeviceOrientationClientEfl.cpp.
+ It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore.
+
+ * WebCoreSupport/DeviceOrientationClientEfl.cpp:
+ (WebCore::DeviceOrientationClientEfl::lastOrientation):
+
2012-08-20 Thiago Marcos P. Santos <thiago.santos@intel.com>
Regression(r124945): Build is broken when touch events is disabled
diff --git a/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp
index e3af685f1..639a823c1 100644
--- a/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp
+++ b/Source/WebKit/efl/WebCoreSupport/DeviceOrientationClientEfl.cpp
@@ -62,7 +62,7 @@ void DeviceOrientationClientEfl::stopUpdating()
notImplemented();
}
-DeviceOrientation* DeviceOrientationClientEfl::lastOrientation() const
+DeviceOrientationData* DeviceOrientationClientEfl::lastOrientation() const
{
notImplemented();
return 0;
diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog
index 511a0871a..2ef791908 100644
--- a/Source/WebKit/gtk/ChangeLog
+++ b/Source/WebKit/gtk/ChangeLog
@@ -1,3 +1,67 @@
+2012-08-21 Joanmarie Diggs <jdiggs@igalia.com>
+ [Gtk] No accessible caret-moved events found in certain content
+ https://bugs.webkit.org/show_bug.cgi?id=72811
+
+ Reviewed by Chris Fleizach.
+
+ Part of the bug is due to objects which should claim to implement AtkText
+ failed to do so as a result of containing a mixture of inline and block
+ spans.
+
+ An updated unit test was provided.
+
+ * tests/testatk.c:
+ (testWebkitAtkCaretOffsets): Added instances of objects containing a
+ mixture of inline and block spans and tested that they implement AtkText
+ and contain the right textual contents.
+
+2012-08-21 Kihong Kwon <kihong.kwon@samsung.com>
+
+ [EFL][GTK][BlackBerry] Fix build error in the DeviceOrientationClient
+ https://bugs.webkit.org/show_bug.cgi?id=94586
+
+ Reviewed by Kentaro Hara.
+
+ Fix build error in the DeviceOrientationClientGtk.cpp.
+ It is occured because DeviceOrientation is changed to DeviceOrientationData in the WebCore.
+
+ * WebCoreSupport/DeviceOrientationClientGtk.cpp:
+ (WebKit::DeviceOrientationClientGtk::lastOrientation):
+
+2012-08-21 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] Using a native window for the WebView breaks GtkOverlay
+ https://bugs.webkit.org/show_bug.cgi?id=90085
+
+ Reviewed by Alejandro G. Castro.
+
+ Rewrite AcceleratedCompositingContext for TextureMapperGL to be more similar to
+ the WebKit2 LayerTreeHost and switch from rendering directly to the widget window
+ to a window redirected to a pixmap via XComposite. The AcceleratedCompositingContext
+ now handles painting the non-composited content itself and no longer relies on the
+ ChromeClient backing store.
+
+ This fixes issues with using GtkOverlay WebKitWebView as well as making it possible
+ to run pixel tests with accelerated compositing turned on.
+
+ * WebCoreSupport/AcceleratedCompositingContext.h:
+ (AcceleratedCompositingContext):
+ * WebCoreSupport/AcceleratedCompositingContextGL.cpp:
+ Rename some methods to make them more similar to LayerTreeHost. Now we wait to render
+ the OpenGL context to the window until the widget's draw signal. Escape out of all
+ methods early if accelerated compositing is disabled.
+ * WebCoreSupport/ChromeClientGtk.cpp: Always check if accelerated compositing is on
+ before calling into AcceleratedCompositingContext methods. When AC is on, never paint
+ the backing store, deferring immediately to the AcceleratedCompositingContext. When
+ AC is turned on the backing store now shrinks to a small size to save memory.
+ * webkit/webkitwebview.cpp:
+ (resizeWebViewFromAllocation): ChromeClient is now responsible for talking to the
+ AcceleratedCompositingContext directly.
+ (webkit_web_view_size_allocate): Exit early if the allocation is not a resize. This
+ makes some deeper logic a bit simpler and avoids accidentally doing too much work for
+ widget movement.
+ (webkit_web_view_realize): We no longer need a native window.
+
2012-08-15 Joanmarie Diggs <jdiggs@igalia.com>
[Gtk] atk_text_set_caret_offset() fails for table cells
diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am
index 215576e51..00473f9d5 100644
--- a/Source/WebKit/gtk/GNUmakefile.am
+++ b/Source/WebKit/gtk/GNUmakefile.am
@@ -101,6 +101,7 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA
$(PNG_LIBS) \
$(SQLITE3_LIBS) \
$(UNICODE_LIBS) \
+ $(XCOMPOSITE_LIBS) \
$(XRENDER_LIBS) \
$(XT_LIBS) \
$(WINMM_LIBS) \
diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
index 24a614db4..45ef470b6 100644
--- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
+++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
@@ -28,10 +28,12 @@
#include <wtf/PassOwnPtr.h>
#if USE(TEXTURE_MAPPER)
+#include "TextureMapperLayer.h"
+#endif
+
#if USE(TEXTURE_MAPPER_GL)
#include "GLContext.h"
-#endif
-#include "TextureMapperLayer.h"
+#include "RedirectedXCompositeWindow.h"
#endif
#if USE(ACCELERATED_COMPOSITING)
@@ -47,11 +49,9 @@ public:
}
virtual ~AcceleratedCompositingContext();
- void attachRootGraphicsLayer(WebCore::GraphicsLayer*);
- void scheduleRootLayerRepaint(const WebCore::IntRect&);
- void markForSync();
- void syncLayersTimeout();
- void syncLayersNow();
+ void setRootCompositingLayer(WebCore::GraphicsLayer*);
+ void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
+ void scheduleLayerFlush();
void resizeRootLayer(const WebCore::IntSize&);
bool renderLayersToWindow(cairo_t*, const WebCore::IntRect& clipRect);
bool enabled();
@@ -63,21 +63,37 @@ public:
virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const;
virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const;
+ void initialize();
+ void compositeLayersToContext();
+ void flushAndRenderLayers();
+ bool flushPendingLayerChanges();
+ void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+
private:
WebKitWebView* m_webView;
- unsigned int m_syncTimerCallbackId;
+ unsigned int m_layerFlushTimerCallbackId;
#if USE(CLUTTER)
WebCore::GraphicsLayer* m_rootGraphicsLayer;
GtkWidget* m_rootLayerEmbedder;
+#elif USE(TEXTURE_MAPPER_GL)
+ OwnPtr<WebCore::RedirectedXCompositeWindow> m_redirectedWindow;
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+ OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+ OwnPtr<WebCore::TextureMapper> m_textureMapper;
+ double m_lastFlushTime;
+ double m_redrawPendingTime;
+ bool m_needsExtraFlush;
+
+ void layerFlushTimerFired();
+ void stopAnyPendingLayerFlush();
+ static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*);
+ WebCore::GLContext* prepareForRendering();
+ void clearEverywhere();
#elif USE(TEXTURE_MAPPER)
WebCore::TextureMapperLayer* m_rootTextureMapperLayer;
OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
OwnPtr<WebCore::TextureMapper> m_textureMapper;
-#if USE(TEXTURE_MAPPER_GL)
- WebCore::GLContext* glContext();
- OwnPtr<WebCore::GLContext> m_context;
-#endif
#endif
AcceleratedCompositingContext(WebKitWebView*);
diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
index 64eb90175..29ba349d8 100644
--- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
@@ -27,6 +27,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "PlatformContextCairo.h"
+#include "Settings.h"
#include "TextureMapperGL.h"
#include "TextureMapperLayer.h"
#include "webkitwebviewprivate.h"
@@ -35,13 +36,12 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if defined(GDK_WINDOWING_X11)
-#define Region XRegion
-#define Font XFont
-#define Cursor XCursor
-#define Screen XScreen
-#include <gdk/gdkx.h>
-#endif
+const double gFramesPerSecond = 60;
+
+// There seems to be a delicate balance between the main loop being flooded
+// with motion events (that force flushes) and starving the main loop of events
+// with flush callbacks. This delay is entirely empirical.
+const double gScheduleDelay = (1.0 / (gFramesPerSecond / 3.0));
using namespace WebCore;
@@ -49,150 +49,322 @@ namespace WebKit {
AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView)
: m_webView(webView)
- , m_syncTimerCallbackId(0)
- , m_rootTextureMapperLayer(0)
+ , m_layerFlushTimerCallbackId(0)
+ , m_redirectedWindow(RedirectedXCompositeWindow::create(IntSize(1, 1)))
+ , m_lastFlushTime(0)
+ , m_redrawPendingTime(0)
+ , m_needsExtraFlush(false)
+{
+}
+
+static IntSize getWebViewSize(WebKitWebView* webView)
{
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation);
+ return IntSize(allocation.width, allocation.height);
+}
+
+void AcceleratedCompositingContext::initialize()
+{
+ if (m_rootLayer)
+ return;
+
+ m_rootLayer = GraphicsLayer::create(this);
+ m_rootLayer->setDrawsContent(false);
+
+ IntSize pageSize = getWebViewSize(m_webView);
+ m_rootLayer->setSize(pageSize);
+
+ // The non-composited contents are a child of the root layer.
+ m_nonCompositedContentLayer = GraphicsLayer::create(this);
+ m_nonCompositedContentLayer->setDrawsContent(true);
+ m_nonCompositedContentLayer->setContentsOpaque(!m_webView->priv->transparent);
+ m_nonCompositedContentLayer->setSize(pageSize);
+ if (core(m_webView)->settings()->acceleratedDrawingEnabled())
+ m_nonCompositedContentLayer->setAcceleratesDrawing(true);
+
+#ifndef NDEBUG
+ m_rootLayer->setName("Root layer");
+ m_nonCompositedContentLayer->setName("Non-composited content");
+#endif
+
+ m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+ m_nonCompositedContentLayer->setNeedsDisplay();
+
+ // The creation of the TextureMapper needs an active OpenGL context.
+ GLContext* context = m_redirectedWindow->context();
+ context->makeContextCurrent();
+ m_textureMapper = TextureMapperGL::create();
+
+ toTextureMapperLayer(m_rootLayer.get())->setTextureMapper(m_textureMapper.get());
+
+ scheduleLayerFlush();
}
AcceleratedCompositingContext::~AcceleratedCompositingContext()
{
- if (m_syncTimerCallbackId)
- g_source_remove(m_syncTimerCallbackId);
+ stopAnyPendingLayerFlush();
+}
+
+void AcceleratedCompositingContext::stopAnyPendingLayerFlush()
+{
+ if (!m_layerFlushTimerCallbackId)
+ return;
+ g_source_remove(m_layerFlushTimerCallbackId);
+ m_layerFlushTimerCallbackId = 0;
}
bool AcceleratedCompositingContext::enabled()
{
- return m_rootTextureMapperLayer && m_textureMapper;
+ return m_rootLayer && m_textureMapper;
}
-GLContext* AcceleratedCompositingContext::glContext()
+bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* cr, const IntRect& clipRect)
{
- if (m_context)
- return m_context.get();
+ m_redrawPendingTime = 0;
-#if defined(GDK_WINDOWING_X11)
- // FIXME: Gracefully account for situations where we do not have a realized window.
- GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(m_webView));
- if (gdkWindow && gdk_window_has_native(gdkWindow))
- m_context = GLContext::createContextForWindow(GDK_WINDOW_XID(gdkWindow), GLContext::sharingContext());
-#endif
+ if (!enabled())
+ return false;
+
+ // It's important to paint a white background (if the WebView isn't transparent), because when growing
+ // the redirected window, the usable size of the window may be smaller than the allocation of our widget.
+ // We don't want to show artifacts in that case.
+ IntSize usableWindowSize = m_redirectedWindow->usableSize();
+ if (usableWindowSize != m_redirectedWindow->size()) {
+ if (!m_webView->priv->transparent) {
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ } else
+ cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint(cr);
+ }
- return m_context.get();
+ cairo_surface_t* windowSurface = m_redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(m_webView));
+ if (!windowSurface)
+ return true;
+
+ cairo_rectangle(cr, clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height());
+ cairo_set_source_surface(cr, windowSurface, 0, 0);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ cairo_fill(cr);
+
+ if (!m_layerFlushTimerCallbackId && toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() || m_needsExtraFlush) {
+ m_needsExtraFlush = false;
+ double nextFlush = max((1 / gFramesPerSecond) - (currentTime() - m_lastFlushTime), 0.0);
+ m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000 * nextFlush, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
+ }
+
+ return true;
}
-bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t*, const IntRect& clipRect)
+GLContext* AcceleratedCompositingContext::prepareForRendering()
{
if (!enabled())
- return false;
+ return 0;
- GLContext* context = glContext();
+ GLContext* context = m_redirectedWindow->context();
if (!context)
- return false;
+ return 0;
if (!context->makeContextCurrent())
- return false;
+ return 0;
- GtkAllocation allocation;
- gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
- glViewport(0, 0, allocation.width, allocation.height);
+ return context;
+}
+
+void AcceleratedCompositingContext::compositeLayersToContext()
+{
+ GLContext* context = prepareForRendering();
+ if (!context)
+ return;
+
+ const IntSize& windowSize = m_redirectedWindow->size();
+ glViewport(0, 0, windowSize.width(), windowSize.height());
m_textureMapper->beginPainting();
- m_rootTextureMapperLayer->paint();
+ toTextureMapperLayer(m_rootLayer.get())->paint();
m_textureMapper->endPainting();
context->swapBuffers();
- return true;
+
+ // FIXME: It seems that when using double-buffering (and on some drivers single-buffering)
+ // and XComposite window redirection, two swap buffers are required to force the pixmap
+ // to update. This isn't a problem during animations, because swapBuffer is continuously
+ // called. For non-animation situations we use this terrible hack until we can get to the
+ // bottom of the issue.
+ if (!toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) {
+ context->swapBuffers();
+ context->swapBuffers();
+ }
}
-void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer)
+void AcceleratedCompositingContext::clearEverywhere()
{
- if (!graphicsLayer) {
- m_rootGraphicsLayer.clear();
- m_rootTextureMapperLayer = 0;
- m_context.clear();
+ GLContext* context = prepareForRendering();
+ if (!context)
return;
+
+ const IntSize& windowSize = m_redirectedWindow->size();
+ glViewport(0, 0, windowSize.width(), windowSize.height());
+ glClearColor(1, 1, 1, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ context->swapBuffers();
+
+ // FIXME: It seems that when using double-buffering (and on some drivers single-buffering)
+ // and XComposite window redirection, two swap buffers are required to force the pixmap
+ // to update. This isn't a problem during animations, because swapBuffer is continuously
+ // called. For non-animation situations we use this terrible hack until we can get to the
+ // bottom of the issue.
+ if (!toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) {
+ context->swapBuffers();
+ context->swapBuffers();
}
+}
- m_rootGraphicsLayer = GraphicsLayer::create(this);
- m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get());
- m_rootGraphicsLayer->addChild(graphicsLayer);
- m_rootGraphicsLayer->setDrawsContent(true);
- m_rootGraphicsLayer->setMasksToBounds(false);
- m_rootGraphicsLayer->setNeedsDisplay();
- m_rootGraphicsLayer->setSize(core(m_webView)->mainFrame()->view()->frameRect().size());
+void AcceleratedCompositingContext::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ // Clearing everywhere when turning on or off the layer tree prevents us from flashing
+ // old content before the first flush.
+ clearEverywhere();
- GLContext* context = glContext();
- if (!context)
- return;
+ if (!graphicsLayer) {
+ stopAnyPendingLayerFlush();
- // The context needs to be active when creating the texture mapper. It's fine to
- // avoid calling swapBuffers here, because it will just initialize shaders.
- if (!context->makeContextCurrent())
+ // Shrink the offscreen window to save memory while accelerated compositing is turned off.
+ m_redirectedWindow->resize(IntSize(1, 1));
+ m_rootLayer = nullptr;
+ m_nonCompositedContentLayer = nullptr;
+ m_textureMapper = nullptr;
return;
+ }
- GtkAllocation allocation;
- gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
- glViewport(0, 0, allocation.width, allocation.height);
+ if (graphicsLayer && !enabled())
+ m_redirectedWindow->resize(getWebViewSize(m_webView));
- m_textureMapper = TextureMapperGL::create();
- m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get());
- m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+ // Add the accelerated layer tree hierarchy.
+ initialize();
+ m_nonCompositedContentLayer->removeAllChildren();
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
+
+ stopAnyPendingLayerFlush();
+
+ // FIXME: Two flushes seem necessary to get the proper rendering in some cases. It's unclear
+ // if this is a bug with the RedirectedXComposite window or with this class.
+ m_needsExtraFlush = true;
+ scheduleLayerFlush();
+
+ m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 500, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
}
-void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect)
+void AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay(const IntRect& rect)
{
- if (!m_rootGraphicsLayer)
+ if (!m_rootLayer)
return;
if (rect.isEmpty()) {
- m_rootGraphicsLayer->setNeedsDisplay();
+ m_rootLayer->setNeedsDisplay();
return;
}
- m_rootGraphicsLayer->setNeedsDisplayInRect(rect);
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
+ scheduleLayerFlush();
}
-void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size)
+void AcceleratedCompositingContext::resizeRootLayer(const IntSize& newSize)
{
- if (!m_rootGraphicsLayer)
+ if (!enabled())
return;
- m_rootGraphicsLayer->setSize(size);
- m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+
+ if (m_rootLayer->size() == newSize)
+ return;
+
+ m_redirectedWindow->resize(newSize);
+ m_rootLayer->setSize(newSize);
+
+ // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
+ // for those newly exposed areas.
+ FloatSize oldSize = m_nonCompositedContentLayer->size();
+ m_nonCompositedContentLayer->setSize(newSize);
+
+ if (newSize.width() > oldSize.width()) {
+ float height = std::min(static_cast<float>(newSize.height()), oldSize.height());
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));
+ }
+
+ if (newSize.height() > oldSize.height())
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));
+
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(IntRect(IntPoint(), newSize));
+ flushAndRenderLayers();
+}
+
+void AcceleratedCompositingContext::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
+{
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(scrollRect);
+ scheduleLayerFlush();
}
-static gboolean syncLayersTimeoutCallback(AcceleratedCompositingContext* context)
+gboolean AcceleratedCompositingContext::layerFlushTimerFiredCallback(AcceleratedCompositingContext* context)
{
- context->syncLayersTimeout();
+ context->layerFlushTimerFired();
return FALSE;
}
-void AcceleratedCompositingContext::markForSync()
+void AcceleratedCompositingContext::scheduleLayerFlush()
{
- if (m_syncTimerCallbackId)
+ if (!enabled())
return;
- // We use a GLib timer because otherwise GTK+ event handling during
- // dragging can starve WebCore timers, which have a lower priority.
- m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0);
+ if (m_layerFlushTimerCallbackId)
+ return;
+
+ // We use a GLib timer because otherwise GTK+ event handling during dragging can
+ // starve WebCore timers, which have a lower priority.
+ double nextFlush = max(gScheduleDelay - (currentTime() - m_lastFlushTime), 0.0);
+ m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
}
-void AcceleratedCompositingContext::syncLayersNow()
+bool AcceleratedCompositingContext::flushPendingLayerChanges()
{
- if (m_rootGraphicsLayer)
- m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
-
- core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
+ m_rootLayer->syncCompositingStateForThisLayerOnly();
+ m_nonCompositedContentLayer->syncCompositingStateForThisLayerOnly();
+ return core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes();
}
-void AcceleratedCompositingContext::syncLayersTimeout()
+void AcceleratedCompositingContext::flushAndRenderLayers()
{
- m_syncTimerCallbackId = 0;
- syncLayersNow();
- if (!m_rootGraphicsLayer)
+ if (!enabled())
+ return;
+
+ Frame* frame = core(m_webView)->mainFrame();
+ if (!frame || !frame->contentRenderer() || !frame->view())
return;
+ frame->view()->updateLayoutAndStyleIfNeededRecursive();
- if (toTextureMapperLayer(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations())
- m_syncTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 1000.0 / 60.0, reinterpret_cast<GSourceFunc>(syncLayersTimeoutCallback), this, 0);
+ GLContext* context = m_redirectedWindow->context();
+ if (context && !context->makeContextCurrent())
+ return;
+
+ if (!flushPendingLayerChanges())
+ return;
- renderLayersToWindow(0, IntRect());
+ m_lastFlushTime = currentTime();
+ compositeLayersToContext();
+
+ gtk_widget_queue_draw(GTK_WIDGET(m_webView));
+
+ // If it's been a long time since we've actually painted, which means that events might
+ // be starving the main loop, we should force a draw now. This seems to prevent display
+ // lag on http://2012.beercamp.com.
+ if (m_redrawPendingTime && currentTime() - m_redrawPendingTime > gScheduleDelay)
+ gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_webView)), FALSE);
+ else if (!m_redrawPendingTime)
+ m_redrawPendingTime = currentTime();
+}
+
+void AcceleratedCompositingContext::layerFlushTimerFired()
+{
+ m_layerFlushTimerCallbackId = 0;
+ flushAndRenderLayers();
}
void AcceleratedCompositingContext::notifyAnimationStarted(const GraphicsLayer*, double time)
@@ -206,9 +378,10 @@ void AcceleratedCompositingContext::notifySyncRequired(const GraphicsLayer*)
void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& rectToPaint)
{
- cairo_t* cr = context.platformContext()->cr();
- copyRectFromCairoSurfaceToContext(m_webView->priv->backingStore->cairoSurface(), cr,
- IntSize(), rectToPaint);
+ context.save();
+ context.clip(rectToPaint);
+ core(m_webView)->mainFrame()->view()->paint(&context, rectToPaint);
+ context.restore();
}
bool AcceleratedCompositingContext::showDebugBorders(const GraphicsLayer*) const
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 41c840924..740e3bbca 100644
--- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -142,17 +142,18 @@ void ChromeClient::setWindowRect(const FloatRect& rect)
}
}
-FloatRect ChromeClient::pageRect()
+static IntRect getWebViewRect(WebKitWebView* webView)
{
GtkAllocation allocation;
-#if GTK_CHECK_VERSION(2, 18, 0)
- gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation);
-#else
- allocation = GTK_WIDGET(m_webView)->allocation;
-#endif
+ gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation);
return IntRect(allocation.x, allocation.y, allocation.width, allocation.height);
}
+FloatRect ChromeClient::pageRect()
+{
+ return getWebViewRect(m_webView);
+}
+
void ChromeClient::focus()
{
gtk_widget_grab_focus(GTK_WIDGET(m_webView));
@@ -419,10 +420,20 @@ static void clearEverywhereInBackingStore(WebKitWebView* webView, cairo_t* cr)
void ChromeClient::widgetSizeChanged(const IntSize& oldWidgetSize, IntSize newSize)
{
- WidgetBackingStore* backingStore = m_webView->priv->backingStore.get();
+#if USE(ACCELERATED_COMPOSITING)
+ AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get();
+ if (compositingContext->enabled()) {
+ m_webView->priv->acceleratedCompositingContext->resizeRootLayer(newSize);
+ return;
+ }
+#endif
// Grow the backing store by at least 1.5 times the current size. This prevents
// lots of unnecessary allocations during an opaque resize.
+ WidgetBackingStore* backingStore = m_webView->priv->backingStore.get();
+ if (backingStore && oldWidgetSize == newSize)
+ return;
+
if (backingStore) {
const IntSize& oldSize = backingStore->size();
if (newSize.width() > oldSize.width())
@@ -526,20 +537,6 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegio
gc.restore();
}
-void ChromeClient::invalidateWidgetRect(const IntRect& rect)
-{
-#if USE(ACCELERATED_COMPOSITING)
- AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
- if (acContext->enabled()) {
- acContext->scheduleRootLayerRepaint(rect);
- return;
- }
-#endif
- gtk_widget_queue_draw_area(GTK_WIDGET(m_webView),
- rect.x(), rect.y(),
- rect.width(), rect.height());
-}
-
void ChromeClient::performAllPendingScrolls()
{
if (!m_webView->priv->backingStore)
@@ -549,7 +546,7 @@ void ChromeClient::performAllPendingScrolls()
for (size_t i = 0; i < m_rectsToScroll.size(); i++) {
IntRect& scrollRect = m_rectsToScroll[i];
m_webView->priv->backingStore->scroll(scrollRect, m_scrollOffsets[i]);
- invalidateWidgetRect(scrollRect);
+ gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), scrollRect.x(), scrollRect.y(), scrollRect.width(), scrollRect.height());
}
m_rectsToScroll.clear();
@@ -585,12 +582,7 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
}
const IntRect& rect = m_dirtyRegion.bounds();
- invalidateWidgetRect(rect);
-
-#if USE(ACCELERATED_COMPOSITING)
- m_webView->priv->acceleratedCompositingContext->syncLayersNow();
- m_webView->priv->acceleratedCompositingContext->renderLayersToWindow(0, rect);
-#endif
+ gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());
m_dirtyRegion = Region();
m_lastDisplayTime = currentTime();
@@ -606,6 +598,11 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
void ChromeClient::forcePaint()
{
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_webView->priv->acceleratedCompositingContext->enabled())
+ return;
+#endif
+
m_forcePaint = true;
paint(0);
m_forcePaint = false;
@@ -617,6 +614,14 @@ void ChromeClient::invalidateRootView(const IntRect&, bool immediate)
void ChromeClient::invalidateContentsAndRootView(const IntRect& updateRect, bool immediate)
{
+#if USE(ACCELERATED_COMPOSITING)
+ AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
+ if (acContext->enabled()) {
+ acContext->setNonCompositedContentsNeedDisplay(updateRect);
+ return;
+ }
+#endif
+
if (updateRect.isEmpty())
return;
m_dirtyRegion.unite(updateRect);
@@ -625,12 +630,34 @@ void ChromeClient::invalidateContentsAndRootView(const IntRect& updateRect, bool
void ChromeClient::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
{
- invalidateContentsAndRootView(updateRect, immediate);
m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
+
+#if USE(ACCELERATED_COMPOSITING)
+ AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
+ if (acContext->enabled()) {
+ acContext->setNonCompositedContentsNeedDisplay(updateRect);
+ return;
+ }
+#endif
+
+ invalidateContentsAndRootView(updateRect, immediate);
}
void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, const IntRect& clipRect)
{
+ m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
+
+#if USE(ACCELERATED_COMPOSITING)
+ AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get();
+ if (compositingContext->enabled()) {
+ ASSERT(!rectToScroll.isEmpty());
+ ASSERT(!delta.isEmpty());
+
+ compositingContext->scrollNonCompositedContents(rectToScroll, delta);
+ return;
+ }
+#endif
+
m_rectsToScroll.append(rectToScroll);
m_scrollOffsets.append(delta);
@@ -657,8 +684,6 @@ void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, con
m_dirtyRegion.unite(scrollRepaintRegion);
m_displayTimer.startOneShot(0);
-
- m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
}
IntRect ChromeClient::rootViewToScreen(const IntRect& rect) const
@@ -966,17 +991,32 @@ void ChromeClient::exitFullScreenForElement(WebCore::Element*)
#if USE(ACCELERATED_COMPOSITING)
void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer)
{
- m_webView->priv->acceleratedCompositingContext->attachRootGraphicsLayer(rootLayer);
+ AcceleratedCompositingContext* context = m_webView->priv->acceleratedCompositingContext.get();
+ bool turningOffCompositing = !rootLayer && context->enabled();
+ bool turningOnCompositing = rootLayer && !context->enabled();
+
+ context->setRootCompositingLayer(rootLayer);
+
+ if (turningOnCompositing) {
+ m_displayTimer.stop();
+ m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), IntSize(1, 1));
+ }
+
+ if (turningOffCompositing) {
+ m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), getWebViewRect(m_webView).size());
+ RefPtr<cairo_t> cr = adoptRef(cairo_create(m_webView->priv->backingStore->cairoSurface()));
+ clearEverywhereInBackingStore(m_webView, cr.get());
+ }
}
void ChromeClient::setNeedsOneShotDrawingSynchronization()
{
- m_webView->priv->acceleratedCompositingContext->markForSync();
+ m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush();
}
void ChromeClient::scheduleCompositingLayerSync()
{
- m_webView->priv->acceleratedCompositingContext->markForSync();
+ m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush();
}
ChromeClient::CompositingTriggerFlags ChromeClient::allowedCompositingTriggers() const
diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
index e5e2fa1eb..284bdaa36 100644
--- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
+++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
@@ -179,7 +179,6 @@ namespace WebKit {
double m_lastDisplayTime;
unsigned int m_repaintSoonSourceId;
- void invalidateWidgetRect(const IntRect&);
#if ENABLE(FULLSCREEN_API)
RefPtr<Element> m_fullScreenElement;
#endif
diff --git a/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp
index 6e000d2d4..36d303b27 100644
--- a/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/DeviceOrientationClientGtk.cpp
@@ -58,7 +58,7 @@ void DeviceOrientationClientGtk::stopUpdating()
notImplemented();
}
-DeviceOrientation* DeviceOrientationClientGtk::lastOrientation() const
+WebCore::DeviceOrientationData* DeviceOrientationClientGtk::lastOrientation() const
{
notImplemented();
return 0;
diff --git a/Source/WebKit/gtk/tests/testatk.c b/Source/WebKit/gtk/tests/testatk.c
index 2463c74a5..759da1771 100644
--- a/Source/WebKit/gtk/tests/testatk.c
+++ b/Source/WebKit/gtk/tests/testatk.c
@@ -65,7 +65,7 @@ static const char* linksWithInlineImages = "<html><head><style>a.http:before {co
static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>";
-static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>with a link</a> in the middle</p><ol><li>A list item</li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text'' name='foo'' value='foo bar baz' /><table><tr><td>a table cell</td></tr></table></body></html>";
+static const char* textForCaretBrowsing = "<html><body><h1>A text header</h1><p>A paragraph <a href='http://foo.bar.baz/'>with a link</a> in the middle</p><ol><li>A list item</li><li><span style='display:block;'>Block span in a list item</span><span>Inline span in a list item</span></li><li><a href='foo'><span style='display:block;'>Block span in a link in a list item</span><span>Inline span in a link in a list item</span></a></li></ol><select><option selected value='foo'>An option in a combo box</option></select><input type='text' name='foo' value='foo bar baz' /><table><tr><td>a table cell</td><td></td><td><a href='foo'><span style='display:block;'>Block span in a link in a table cell</span><span>Inline span in a link in a table cell</span></a></td><td><span style='display:block;'>Block span in a table cell</span><span>Inline span in a table cell</span></td></tr></table><h4><a href='foo'><span style='display:block;'>Block span in a link in a heading</span><span>Inline span in a link in a heading</span></h4><h4><span style='display:block;'>Block span in a heading</span><span>Inline span in a heading</span></h4></body></html>";
static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p><ol><li>A list item</li></ol><select></body></html>";
@@ -336,7 +336,7 @@ static void testWebkitAtkCaretOffsets()
AtkObject* list = atk_object_ref_accessible_child(object, 2);
g_assert(ATK_OBJECT(list));
g_assert(atk_object_get_role(list) == ATK_ROLE_LIST);
- g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 1);
+ g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 3);
AtkObject* listItem = atk_object_ref_accessible_child(list, 0);
g_assert(ATK_IS_TEXT(listItem));
@@ -344,6 +344,18 @@ static void testWebkitAtkCaretOffsets()
g_assert_cmpstr(text, ==, "1. A list item");
g_free (text);
+ listItem = atk_object_ref_accessible_child(list, 1);
+ g_assert(ATK_IS_TEXT(listItem));
+ text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
+ g_assert_cmpstr(text, ==, "2. Block span in a list item\nInline span in a list item");
+ g_free (text);
+
+ listItem = atk_object_ref_accessible_child(list, 2);
+ g_assert(ATK_IS_TEXT(listItem));
+ text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
+ g_assert_cmpstr(text, ==, "3. Block span in a link in a list item\nInline span in a link in a list item");
+ g_free (text);
+
/* It's not possible to place the caret inside an item's marker. */
result = atk_text_set_caret_offset(ATK_TEXT(listItem), 1);
g_assert_cmpint(result, ==, FALSE);
@@ -360,10 +372,12 @@ static void testWebkitAtkCaretOffsets()
AtkObject* comboBox = atk_object_ref_accessible_child(panel, 0);
g_assert(ATK_IS_OBJECT(comboBox));
+ g_assert(!ATK_IS_TEXT(comboBox));
g_assert(atk_object_get_role(comboBox) == ATK_ROLE_COMBO_BOX);
AtkObject* menuPopup = atk_object_ref_accessible_child(comboBox, 0);
g_assert(ATK_IS_OBJECT(menuPopup));
+ g_assert(!ATK_IS_TEXT(menuPopup));
g_assert(atk_object_get_role(menuPopup) == ATK_ROLE_MENU);
AtkObject* comboBoxOption = atk_object_ref_accessible_child(menuPopup, 0);
@@ -372,6 +386,7 @@ static void testWebkitAtkCaretOffsets()
g_assert(ATK_IS_TEXT(comboBoxOption));
text = atk_text_get_text(ATK_TEXT(comboBoxOption), 0, -1);
g_assert_cmpstr(text, ==, "An option in a combo box");
+ g_free(text);
/* It's not possible to place the caret inside an option for a combobox. */
result = atk_text_set_caret_offset(ATK_TEXT(comboBoxOption), 1);
@@ -383,6 +398,7 @@ static void testWebkitAtkCaretOffsets()
g_assert(ATK_IS_TEXT(textEntry));
text = atk_text_get_text(ATK_TEXT(textEntry), 0, -1);
g_assert_cmpstr(text, ==, "foo bar baz");
+ g_free(text);
result = atk_text_set_caret_offset(ATK_TEXT(textEntry), 5);
g_assert_cmpint(result, ==, TRUE);
@@ -391,8 +407,9 @@ static void testWebkitAtkCaretOffsets()
AtkObject* table = atk_object_ref_accessible_child(object, 4);
g_assert(ATK_IS_OBJECT(table));
+ g_assert(!ATK_IS_TEXT(table));
g_assert(atk_object_get_role(table) == ATK_ROLE_TABLE);
- g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 1);
+ g_assert_cmpint(atk_object_get_n_accessible_children(table), ==, 4);
AtkObject* tableCell = atk_object_ref_accessible_child(table, 0);
g_assert(ATK_IS_TEXT(tableCell));
@@ -406,6 +423,42 @@ static void testWebkitAtkCaretOffsets()
offset = atk_text_get_caret_offset(ATK_TEXT(tableCell));
g_assert_cmpint(offset, ==, 2);
+ /* Even empty table cells should implement AtkText, but report an empty string */
+ tableCell = atk_object_ref_accessible_child(table, 1);
+ g_assert(ATK_IS_TEXT(tableCell));
+ g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+ text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+ g_assert_cmpstr(text, ==, "");
+ g_free(text);
+
+ tableCell = atk_object_ref_accessible_child(table, 2);
+ g_assert(ATK_IS_TEXT(tableCell));
+ g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+ text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+ g_assert_cmpstr(text, ==, "Block span in a link in a table cell\nInline span in a link in a table cell");
+ g_free(text);
+
+ tableCell = atk_object_ref_accessible_child(table, 3);
+ g_assert(ATK_IS_TEXT(tableCell));
+ g_assert(atk_object_get_role(tableCell) == ATK_ROLE_TABLE_CELL);
+ text = atk_text_get_text(ATK_TEXT(tableCell), 0, -1);
+ g_assert_cmpstr(text, ==, "Block span in a table cell\nInline span in a table cell");
+ g_free(text);
+
+ header = atk_object_ref_accessible_child(object, 5);
+ g_assert(ATK_IS_TEXT(header));
+ g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
+ text = atk_text_get_text(ATK_TEXT(header), 0, -1);
+ g_assert_cmpstr(text, ==, "Block span in a link in a heading\nInline span in a link in a heading");
+ g_free(text);
+
+ header = atk_object_ref_accessible_child(object, 6);
+ g_assert(ATK_IS_TEXT(header));
+ g_assert(atk_object_get_role(header) == ATK_ROLE_HEADING);
+ text = atk_text_get_text(ATK_TEXT(header), 0, -1);
+ g_assert_cmpstr(text, ==, "Block span in a heading\nInline span in a heading");
+ g_free(text);
+
g_free(textCaretMovedResult);
g_object_unref(header);
diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp
index 971780637..a5368944d 100644
--- a/Source/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp
@@ -679,8 +679,10 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
#if USE(TEXTURE_MAPPER)
- if (priv->acceleratedCompositingContext->renderLayersToWindow(cr, clipRect))
+ if (priv->acceleratedCompositingContext->renderLayersToWindow(cr, clipRect)) {
+ GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
return FALSE;
+ }
#endif
cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr);
@@ -875,15 +877,16 @@ static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* a
WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
-
-#if USE(ACCELERATED_COMPOSITING)
- webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
-#endif
}
static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
{
+ GtkAllocation oldAllocation;
+ gtk_widget_get_allocation(widget, &oldAllocation);
+
GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
+ if (allocation->width == oldAllocation.width && allocation->height == oldAllocation.height)
+ return;
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
if (!gtk_widget_get_mapped(widget)) {
@@ -1003,10 +1006,6 @@ static void webkit_web_view_realize(GtkWidget* widget)
#endif
GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
-#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
- WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
- priv->hasNativeWindow = gdk_window_ensure_native(window);
-#endif
gtk_widget_set_window(widget, window);
gdk_window_set_user_data(window, widget);
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index 48445e27d..2b5ceb307 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,16 @@
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126146.
+ http://trac.webkit.org/changeset/126146
+ https://bugs.webkit.org/show_bug.cgi?id=94606
+
+ It made all tests assert (Requested by Ossy on #webkit).
+
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge::objectDeleted):
+ (tst_QObjectBridge::introspectQtMethods_data):
+ (tst_QObjectBridge::introspectQtMethods):
+
2012-08-17 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] REGRESSION(r125428): fast/profiler/nested-start-and-stop-profiler.html fails
diff --git a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
index 13d98af93..2ce791d89 100644
--- a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
+++ b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
@@ -1879,7 +1879,7 @@ void tst_QObjectBridge::objectDeleted()
evalJS("bar.intProperty = 123;");
QCOMPARE(qobj->intProperty(), 123);
qobj->resetQtFunctionInvoked();
- evalJS("bar.myInvokable.call(bar);");
+ evalJS("bar.myInvokable(bar);");
QCOMPARE(qobj->qtFunctionInvoked(), 0);
// do this, to ensure that we cache that it implements call
@@ -2148,15 +2148,15 @@ void tst_QObjectBridge::introspectQtMethods_data()
QTest::addColumn<QStringList>("expectedPropertyNames");
QTest::newRow("myObject.mySignal")
- << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "name");
+ << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "length" << "name");
QTest::newRow("myObject.mySlot")
- << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "name");
+ << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "length" << "name");
QTest::newRow("myObject.myInvokable")
- << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "name");
+ << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "length" << "name");
QTest::newRow("myObject.mySignal.connect")
- << "myObject.mySignal" << "connect" << (QStringList() << "name");
+ << "myObject.mySignal" << "connect" << (QStringList() << "length" << "name");
QTest::newRow("myObject.mySignal.disconnect")
- << "myObject.mySignal" << "disconnect" << (QStringList() << "name");
+ << "myObject.mySignal" << "disconnect" << (QStringList() << "length" << "name");
}
void tst_QObjectBridge::introspectQtMethods()
@@ -2177,7 +2177,7 @@ void tst_QObjectBridge::introspectQtMethods()
QCOMPARE(evalJS("descriptor.set"), sUndefined);
QCOMPARE(evalJS(QString::fromLatin1("descriptor.value === %0['%1']").arg(methodLookup).arg(name)), sTrue);
QCOMPARE(evalJS(QString::fromLatin1("descriptor.enumerable")), sFalse);
- QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sFalse);
+ QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sTrue);
}
QVERIFY(evalJSV("var props=[]; for (var p in myObject.deleteLater) {props.push(p);}; props.sort()").toStringList().isEmpty());
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 1ed41a373..d147a0461 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,95 @@
+2012-08-22 Luiz Agostini <luiz.agostini@nokia.com>
+
+ [Qt] Avoid using WebKit macros in qrawwebview_p.h
+ https://bugs.webkit.org/show_bug.cgi?id=94648
+
+ Reviewed by Noam Rosenthal.
+
+ ENABLE(FEATURE) should not be used in qrawwebview_p.h because it is an API header file.
+
+ * UIProcess/API/qt/raw/qrawwebview.cpp:
+ (QRawWebView::sendTouchEvent):
+ * UIProcess/API/qt/raw/qrawwebview_p.h:
+
+2012-08-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r126216.
+ http://trac.webkit.org/changeset/126216
+ https://bugs.webkit.org/show_bug.cgi?id=94661
+
+ "Broke many Mac-WK2 tests" (Requested by bradee-oh on
+ #webkit).
+
+ * WebProcess/com.apple.WebProcess.sb.in:
+
+2012-08-21 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com>
+
+ [GTK] [WK2] Memory leaks in TestWebKitFindController
+ https://bugs.webkit.org/show_bug.cgi?id=94627
+
+ Reviewed by Martin Robinson.
+
+ Fix memory leaks in TestWebKitFindController by using adoptGRef
+ instead of just getting new reference of GdkPixbuf.
+
+ * UIProcess/API/gtk/tests/TestWebKitFindController.cpp:
+ (testFindControllerHide):
+
+2012-08-21 Alexey Proskuryakov <ap@apple.com>
+
+ <rdar://problem/11241850> Block access to xpcd in WebProcess.sb
+
+ Reviewed by Sam Weinig and Jon Honeycutt.
+
+ * WebProcess/com.apple.WebProcess.sb.in:
+
+2012-08-21 Alexey Proskuryakov <ap@apple.com>
+
+ <rdar://problem/8900275> Remove PubSub access from WebProcess, since it is no longer necessary
+
+ Reviewed by Mark Rowe.
+
+ * WebProcess/com.apple.WebProcess.sb.in:
+
+2012-08-21 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ [EFL] Some public API functions don't have their symbols exported
+ https://bugs.webkit.org/show_bug.cgi?id=94589
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added missing export symbol macro to these public API functions.
+
+ * UIProcess/API/efl/ewk_view.h:
+
+2012-08-21 Martin Robinson <mrobinson@igalia.com>
+
+ [GTK] Using a native window for the WebView breaks GtkOverlay
+ https://bugs.webkit.org/show_bug.cgi?id=90085
+
+ Reviewed by Alejandro G. Castro.
+
+ Add XComposite libraries to the linker list for WebKit2.
+
+ * GNUmakefile.am: Add XComposite
+
+2012-08-21 Jesse van den Kieboom <jessevdk@gnome.org> and Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add destroy notify for register_uri_scheme
+ https://bugs.webkit.org/show_bug.cgi?id=94315
+
+ Reviewed by Philippe Normand.
+
+ For introspection to work correctly, a destroy notify needs to be
+ added to register_uri_scheme so that bindings know when to
+ finalize the user_data.
+
+ * UIProcess/API/gtk/WebKitWebContext.cpp:
+ (webkit_web_context_register_uri_scheme):
+ (webkitWebContextReceivedURIRequest):
+ * UIProcess/API/gtk/WebKitWebContext.h:
+ * UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:
+
2012-08-21 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed build fix for newer Qt 5: QT += qmltest does not imply QT += testlib anymore, but
diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am
index 3edce0aa2..ba0ac6955 100644
--- a/Source/WebKit2/GNUmakefile.am
+++ b/Source/WebKit2/GNUmakefile.am
@@ -108,6 +108,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP
$(GTK_UNIX_PRINTING_CFLAGS) \
$(LIBSOUP_CFLAGS) \
$(UNICODE_CFLAGS) \
+ $(XCOMPOSITE_CFLAGS) \
$(XT_CFLAGS)
libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CXXFLAGS = \
@@ -180,6 +181,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIB
$(SQLITE3_LIBS) \
$(UNICODE_LIBS) \
$(XRENDER_LIBS) \
+ $(XCOMPOSITE_LIBS) \
$(XT_LIBS) \
$(ZLIB_LIBS)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
index 6064cf855..afa45846f 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
@@ -273,7 +273,7 @@ EAPI Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class *api);
*
* @return view object on success or @c NULL on failure
*/
-Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context);
+EAPI Evas_Object *ewk_view_smart_add(Evas *e, Evas_Smart *smart, Ewk_Context *context);
/**
* Creates a new EFL WebKit view object.
@@ -475,7 +475,7 @@ Eina_Bool ewk_view_scale_set(Evas_Object *o, double scaleFactor, int x, int y);
*
* @return current scale factor in use on success or @c -1.0 on failure
*/
-double ewk_view_scale_get(const Evas_Object *o);
+EAPI double ewk_view_scale_get(const Evas_Object *o);
/**
* Queries the ratio between the CSS units and device pixels when the content is unscaled.
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index 620c9a876..211133f0a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -35,6 +35,8 @@
#include <WebCore/Language.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
@@ -47,23 +49,46 @@ enum {
LAST_SIGNAL
};
-struct WebKitURISchemeHandler {
+class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> {
+public:
WebKitURISchemeHandler()
- : callback(0)
- , userData(0)
+ : m_callback(0)
+ , m_userData(0)
+ , m_destroyNotify(0)
{
}
- WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData)
- : callback(callback)
- , userData(userData)
+ WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify)
+ : m_callback(callback)
+ , m_userData(userData)
+ , m_destroyNotify(destroyNotify)
{
}
- WebKitURISchemeRequestCallback callback;
- void* userData;
+ ~WebKitURISchemeHandler()
+ {
+ if (m_destroyNotify)
+ m_destroyNotify(m_userData);
+ }
+
+ bool hasCallback()
+ {
+ return m_callback;
+ }
+
+ void performCallback(WebKitURISchemeRequest* request)
+ {
+ ASSERT(m_callback);
+
+ m_callback(request, m_userData);
+ }
+
+private:
+ WebKitURISchemeRequestCallback m_callback;
+ void* m_userData;
+ GDestroyNotify m_destroyNotify;
};
-typedef HashMap<String, WebKitURISchemeHandler> URISchemeHandlerMap;
+typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap;
typedef HashMap<uint64_t, GRefPtr<WebKitURISchemeRequest> > URISchemeRequestMap;
struct _WebKitWebContextPrivate {
@@ -379,8 +404,9 @@ GList* webkit_web_context_get_plugins_finish(WebKitWebContext* context, GAsyncRe
* webkit_web_context_register_uri_scheme:
* @context: a #WebKitWebContext
* @scheme: the network scheme to register
- * @callback: a #WebKitURISchemeRequestCallback
+ * @callback: (scope async): a #WebKitURISchemeRequestCallback
* @user_data: data to pass to callback function
+ * @user_data_destroy_func: destroy notify for @user_data
*
* Register @scheme in @context, so that when an URI request with @scheme is made in the
* #WebKitWebContext, the #WebKitURISchemeRequestCallback registered will be called with a
@@ -417,13 +443,14 @@ GList* webkit_web_context_get_plugins_finish(WebKitWebContext* context, GAsyncRe
* }
* </programlisting></informalexample>
*/
-void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const char* scheme, WebKitURISchemeRequestCallback callback, gpointer userData)
+void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const char* scheme, WebKitURISchemeRequestCallback callback, gpointer userData, GDestroyNotify destroyNotify)
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
g_return_if_fail(scheme);
g_return_if_fail(callback);
- context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), WebKitURISchemeHandler(callback, userData));
+ RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData, destroyNotify));
+ context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get());
WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme));
WKSoupRequestManagerRegisterURIScheme(context->priv->requestManager.get(), wkScheme.get());
}
@@ -579,12 +606,14 @@ WKSoupRequestManagerRef webkitWebContextGetRequestManager(WebKitWebContext* cont
void webkitWebContextReceivedURIRequest(WebKitWebContext* context, WebKitURISchemeRequest* request)
{
- WebKitURISchemeHandler handler = context->priv->uriSchemeHandlers.get(webkit_uri_scheme_request_get_scheme(request));
- if (!handler.callback)
+ String scheme(String::fromUTF8(webkit_uri_scheme_request_get_scheme(request)));
+ RefPtr<WebKitURISchemeHandler> handler = context->priv->uriSchemeHandlers.get(scheme);
+ ASSERT(handler.get());
+ if (!handler->hasCallback())
return;
context->priv->uriSchemeRequests.set(webkitURISchemeRequestGetID(request), request);
- handler.callback(request, handler.userData);
+ handler->performCallback(request);
}
void webkitWebContextDidFailToLoadURIRequest(WebKitWebContext* context, uint64_t requestID)
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
index 5af7f2414..3c97c71cb 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
@@ -131,7 +131,8 @@ WEBKIT_API void
webkit_web_context_register_uri_scheme (WebKitWebContext *context,
const gchar *scheme,
WebKitURISchemeRequestCallback callback,
- gpointer user_data);
+ gpointer user_data,
+ GDestroyNotify user_data_destroy_func);
WEBKIT_API gboolean
webkit_web_context_get_spell_checking_enabled (WebKitWebContext *context);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
index a2af7bd8d..90159b87f 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitFindController.cpp
@@ -312,7 +312,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer)
g_assert(webViewGdkWindow);
test->waitUntilWebViewDrawSignal();
- GRefPtr<GdkPixbuf> originalPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth);
+ GRefPtr<GdkPixbuf> originalPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth));
g_assert(originalPixbuf);
test->find("testing", WEBKIT_FIND_OPTIONS_NONE, 1);
@@ -320,7 +320,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer)
g_assert(test->m_textFound);
test->waitUntilWebViewDrawSignal();
- GRefPtr<GdkPixbuf> highlightPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth);
+ GRefPtr<GdkPixbuf> highlightPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth));
g_assert(highlightPixbuf);
g_assert(!gdkPixbufEqual(originalPixbuf.get(), highlightPixbuf.get()));
@@ -329,7 +329,7 @@ static void testFindControllerHide(FindControllerTest* test, gconstpointer)
webkit_web_view_execute_editing_command(test->m_webView, "Unselect");
test->waitUntilWebViewDrawSignal();
- GRefPtr<GdkPixbuf> unhighlightPixbuf = gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth);
+ GRefPtr<GdkPixbuf> unhighlightPixbuf = adoptGRef(gdk_pixbuf_get_from_window(webViewGdkWindow, 0, 0, allocatedHeight, allocatedWidth));
g_assert(unhighlightPixbuf);
g_assert(gdkPixbufEqual(originalPixbuf.get(), unhighlightPixbuf.get()));
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
index cde0bc34a..27f6a5447 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp
@@ -165,7 +165,7 @@ public:
void registerURISchemeHandler(const char* scheme, const char* reply, int replyLength, const char* mimeType, bool replyWithPath = false)
{
m_handlersMap.set(String::fromUTF8(scheme), URISchemeHandler(reply, replyLength, mimeType, replyWithPath));
- webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this);
+ webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this, 0);
}
GRefPtr<WebKitURISchemeRequest> m_uriSchemeRequest;
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
index 0aed5d948..6250348a6 100644
--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
@@ -380,9 +380,9 @@ void QRawWebView::sendWheelEvent(QWheelEvent* event)
d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform()));
}
-#if ENABLE(TOUCH_EVENTS)
void QRawWebView::sendTouchEvent(QTouchEvent* event)
{
+#if ENABLE(TOUCH_EVENTS)
d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform()));
-}
#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h
index 4608ff9d7..f8f15b06d 100644
--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h
@@ -30,7 +30,6 @@
#include <WebKit2/WKContext.h>
#include <WebKit2/WKPage.h>
#include <WebKit2/WKPageGroup.h>
-#include <wtf/Platform.h>
QT_BEGIN_NAMESPACE
class QRect;
@@ -95,9 +94,7 @@ public:
void sendKeyEvent(QKeyEvent*);
void sendMouseEvent(QMouseEvent*, int clickCount = 0);
void sendWheelEvent(QWheelEvent*);
-#if ENABLE(TOUCH_EVENTS)
void sendTouchEvent(QTouchEvent*);
-#endif
private:
QRawWebViewPrivate* d;
diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
index c501e8f5b..d19525890 100644
--- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
+++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in
@@ -183,13 +183,6 @@
(literal "/private/var/run/mDNSResponder")
(remote tcp))
-;; FIXME: Once <rdar://problem/8900275> has been fixed, these rules can be removed.
-(allow mach-lookup (global-name "com.apple.pubsub.ipc"))
-(allow network-outbound (regex #"^/private/tmp/launch-[^/]+/Render"))
-(allow file-read*
- (home-literal "/Library/Preferences/com.apple.Safari.RSS.plist")
- (home-literal "/Library/Preferences/com.apple.Syndication.plist"))
-
;; FIXME should be removed when <rdar://problem/9347205> + related radar in Safari is fixed
(allow mach-lookup
(global-name "org.h5l.kcm")
diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake
index 23e769bdf..581f4ab89 100644
--- a/Source/cmake/OptionsEfl.cmake
+++ b/Source/cmake/OptionsEfl.cmake
@@ -64,6 +64,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ANIMATION_API ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT_DECORATION ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_VARIABLES ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER ON)
diff --git a/Source/cmake/OptionsWindows.cmake b/Source/cmake/OptionsWindows.cmake
index 05681e82e..8f6256c0b 100644
--- a/Source/cmake/OptionsWindows.cmake
+++ b/Source/cmake/OptionsWindows.cmake
@@ -20,7 +20,3 @@ IF (MSVC)
ENDIF ()
STRING(REPLACE "/ENTRY:mainACRTStartup" "/ENTRY:WinMainCRTStartup" CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
-
-WEBKIT_OPTION_BEGIN()
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT ON)
-WEBKIT_OPTION_END()
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index a3cb05bd9..4ba5645cf 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,229 @@
+2012-08-22 Dominik Röttsches <dominik.rottsches@intel.com>
+
+ Unreviewed, adding myself to committers.py.
+
+ * Scripts/webkitpy/common/config/committers.py:
+
+2012-08-21 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com>
+
+ [GTK] contextClick and getMenuItemTitle callbacks are leaky in DRT's EventSender
+ https://bugs.webkit.org/show_bug.cgi?id=94669
+
+ Reviewed by Carlos Garcia Campos.
+
+ Fix memory leaks in DRT's EventSender code.
+
+ * DumpRenderTree/gtk/EventSender.cpp:
+ (getMenuItemTitleCallback): Use JSRetainPtr and don't leak.
+ (contextClickCallback): Use GOwnPtr to manage memory of a
+ newly-allocated list automatically.
+
+2012-08-21 Dirk Pranke <dpranke@chromium.org>
+
+ Add mountain lion to perf-tests, layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=94553
+
+ Reviewed by Adam Barth.
+
+ This patch adds support for the 'mac-mountainlion' platform and
+ stamps out the last references to 'mac-leopard' as a supported
+ name.
+
+ This patch does a small amount of refactoring to try and make
+ things a little clearer how we treat the "most recent version"
+ specially for baselines and skipped files, and so you only
+ should have to touch the VERSION_FALLBACK_ORDER constants on the
+ ports, but unfortunately changing this list changes a bunch of
+ the unit tests which are doing exact matches for correctness, so
+ you have to touch more than a couple files :(. There's probably
+ still more refactoring that can be done so that we don't have to
+ do all of this functional testing to feel completely correct.
+
+ * Scripts/webkitpy/common/system/platforminfo.py:
+ (PlatformInfo._determine_mac_version):
+ * Scripts/webkitpy/common/system/platforminfo_unittest.py:
+ (TestPlatformInfo.test_os_version):
+ * Scripts/webkitpy/layout_tests/port/apple.py:
+ (ApplePort.__init__):
+ (ApplePort):
+ (ApplePort._skipped_file_search_paths):
+ (ApplePort._generate_all_test_configurations):
+ * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+ (ChromiumMacPort):
+ * Scripts/webkitpy/layout_tests/port/factory_unittest.py:
+ (FactoryTest.test_mac):
+ * Scripts/webkitpy/layout_tests/port/mac.py:
+ (MacPort):
+ (MacPort._build_driver_flags):
+ (MacPort.should_retry_crashes):
+ (MacPort.default_baseline_search_path):
+ (MacPort.operating_system):
+ (MacPort.default_child_processes):
+ * Scripts/webkitpy/layout_tests/port/mac_unittest.py:
+ (MacTest):
+ (MacTest.test_skipped_file_search_paths):
+ (test_versions):
+ (test_baseline_search_path):
+ * Scripts/webkitpy/layout_tests/port/win.py:
+ (WinPort):
+ (WinPort.default_baseline_search_path):
+
+2012-08-21 Zan Dobersek <zandobersek@gmail.com>
+
+ [GTK] fast/xmlhttprequest/xmlhttprequest-nonexistent-file.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=94617
+
+ Reviewed by Martin Robinson.
+
+ Set the 'enable-file-access-from-file-uris' setting to true when
+ resetting default values. The other ports do this as well, giving
+ documents with local security origin permission to load other
+ local resources.
+
+ * DumpRenderTree/gtk/DumpRenderTree.cpp:
+ (resetDefaultsToConsistentValues):
+
+2012-08-21 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] DRT produces wrong back-forward list
+ https://bugs.webkit.org/show_bug.cgi?id=94575
+
+ Reviewed by Adam Barth.
+
+ DRT clears its history state before running every tests. However
+ HistoryController in WebCore isn't reset. So, it is possible that
+ 'isNewNavigation' flag is false even though the navigation should be
+ handled as "new" for DRT.
+
+ This change might fix a problem of
+ fast/forms/select/select-state-restore.html (Bug 90207).
+
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::updateForCommittedLoad):
+ Treat the first page load (m_pageID == -1) as new navigation except for about:blank.
+ Without this change, a navigation entry for this loading won't be recorded.
+
+2012-08-21 Thiago Marcos P. Santos <thiago.santos@intel.com>
+
+ [EFL] Enable CSS Text Decoration by default
+ https://bugs.webkit.org/show_bug.cgi?id=94483
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * Scripts/webkitperl/FeatureList.pm:
+
+2012-08-21 Benjamin Poulain <bpoulain@apple.com>
+
+ Store CString data in the CStringBuffer to avoid the double indirection
+ https://bugs.webkit.org/show_bug.cgi?id=94562
+
+ Reviewed by Darin Adler.
+
+ Add test coverage for WTF::CString.
+
+ * TestWebKitAPI/CMakeLists.txt:
+ * TestWebKitAPI/GNUmakefile.am:
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/CString.cpp:
+
+2012-08-21 Dirk Pranke <dpranke@chromium.org>
+
+ Text Autosizing: ::first-letter pseudo-element is incorrectly sized
+ https://bugs.webkit.org/show_bug.cgi?id=94540
+
+ Reviewed by Ojan Vafai.
+
+ Revert the changes in bugs 94517 and 94396 so that we are
+ actually looking for stderr output from ImageDiff and doing
+ image compares on ref tests on the wk2 ports again.
+
+ Also, do an actual diff_image() call if the hash checks fail on
+ reftests, and only fail the test if we get real diffs (or don't,
+ for mismatches).
+
+ Lastly, clean up the log messages to be more helpful.
+
+ * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+ (SingleTestRunner._compare_image):
+ (SingleTestRunner._compare_output_with_reference):
+ * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+ (write_test_result):
+
+2012-08-21 Dirk Pranke <dpranke@chromium.org>
+
+ _compare_image() swaps actual and expected images by mistake
+ https://bugs.webkit.org/show_bug.cgi?id=94567
+
+ Reviewed by Ojan Vafai.
+
+ Re-work the code so that we consistently pass (expected, actual)
+ across all of the compare/diff routines.
+
+ * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+ (SingleTestRunner._run_compare_test):
+ (SingleTestRunner._compare_output):
+ (SingleTestRunner._compare_text):
+ (SingleTestRunner._compare_audio):
+ (SingleTestRunner._compare_image):
+ (SingleTestRunner._run_reftest):
+ (SingleTestRunner._compare_output_with_reference):
+ * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+ (write_test_result):
+
+2012-08-21 Adam Barth <abarth@webkit.org>
+
+ Unreviewed. Move the commit-queue to building release only. Previously,
+ we built debug too, but for some reason the debug build doesn't work on
+ the bots. We can re-enable debug builds once we fix the underlying
+ problem.
+
+ * Scripts/webkitpy/tool/commands/queues.py:
+ (CommitQueue.build_style):
+ * Scripts/webkitpy/tool/commands/queues_unittest.py:
+
+2012-08-21 Ryosuke Niwa <rniwa@webkit.org>
+
+ TestExpectationsParser doesn't warn about test files that don't exist.
+ https://bugs.webkit.org/show_bug.cgi?id=94632
+
+ Reviewed by Dirk Pranke.
+
+ Exit early and warn when the test file doesn't exist as well when a test directory doesn't exist.
+
+ * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+ (TestExpectationParser._parse_line):
+ (TestExpectationParser._check_test_exists):
+ * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+ (test_parse_warning):
+
+2012-08-20 Ryosuke Niwa <rniwa@webkit.org>
+
+ Move free functions in test_expectations to TestExpectations class
+ https://bugs.webkit.org/show_bug.cgi?id=94557
+
+ Reviewed by Dirk Pranke.
+
+ Moved test_result_was_expected, test_remove_pixel_failures, and test_suffixes_for_expectations into TestExpectations
+ to allow further refactoring.
+
+ * Scripts/webkitpy/common/net/resultsjsonparser.py:
+ (JSONTestResult.did_run_as_expected):
+ (JSONTestResult._tokenize):
+ * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+ (TestExpectations):
+ (TestExpectations.result_was_expected):
+ (TestExpectations.remove_pixel_failures):
+ (TestExpectations.has_pixel_failures):
+ (TestExpectations.suffixes_for_expectations):
+ (TestExpectations.matches_an_expected_result):
+ * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+ (MockBugManager.create_bug):
+ (test_result_was_expected):
+ (test_remove_pixel_failures):
+ (test_suffixes_for_expectations):
+ * Scripts/webkitpy/tool/commands/rebaseline.py:
+ (RebaselineExpectations._tests_to_rebaseline):
+
2012-08-21 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed build fix for newer Qt 5: The meaning of private_includes changed to be fully
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index a67d1e304..3ab8a8639 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -1672,8 +1672,9 @@ void WebViewHost::updateForCommittedLoad(WebFrame* frame, bool isNewNavigation)
{
// Code duplicated from RenderView::DidCommitLoadForFrame.
TestShellExtraData* extraData = static_cast<TestShellExtraData*>(frame->dataSource()->extraData());
+ bool nonBlankPageAfterReset = m_pageId == -1 && strcmp(frame->dataSource()->request().url().spec().data(), "about:blank");
- if (isNewNavigation) {
+ if (isNewNavigation || nonBlankPageAfterReset) {
// New navigation.
updateSessionHistory(frame);
m_pageId = nextPageID++;
diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
index 75986d82e..73873cd2c 100644
--- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -450,6 +450,7 @@ static void resetDefaultsToConsistentValues()
"javascript-can-open-windows-automatically", TRUE,
"enable-offline-web-application-cache", TRUE,
"enable-universal-access-from-file-uris", TRUE,
+ "enable-file-access-from-file-uris", TRUE,
"enable-scripts", TRUE,
"enable-dom-paste", TRUE,
"default-font-family", "Times",
diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp
index 4cc2ab34b..d78db9370 100644
--- a/Tools/DumpRenderTree/gtk/EventSender.cpp
+++ b/Tools/DumpRenderTree/gtk/EventSender.cpp
@@ -157,7 +157,8 @@ static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef obj
else
label = gtk_menu_item_get_label(GTK_MENU_ITEM(widget));
- return JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data()));
+ JSRetainPtr<JSStringRef> itemText(Adopt, JSStringCreateWithUTF8CString(label.data()));
+ return JSValueMakeString(context, itemText.get());
}
static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
@@ -216,10 +217,10 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio
WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
GtkMenu* gtkMenu = webkit_web_view_get_context_menu(view);
if (gtkMenu) {
- GList* items = gtk_container_get_children(GTK_CONTAINER(gtkMenu));
- JSValueRef arrayValues[g_list_length(items)];
+ GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(gtkMenu)));
+ JSValueRef arrayValues[g_list_length(items.get())];
int index = 0;
- for (GList* item = g_list_first(items); item; item = g_list_next(item)) {
+ for (GList* item = g_list_first(items.get()); item; item = g_list_next(item)) {
arrayValues[index] = JSObjectMake(context, getMenuItemClass(), item->data);
index++;
}
diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm
index 4ed314e4f..a181d8599 100644
--- a/Tools/Scripts/webkitperl/FeatureList.pm
+++ b/Tools/Scripts/webkitperl/FeatureList.pm
@@ -172,7 +172,7 @@ my @features = (
define => "ENABLE_CSS3_FLEXBOX", default => 1, value => \$css3FlexboxSupport },
{ option => "css3-text-decoration", desc => "Toggle CSS3 Text Decoration support",
- define => "ENABLE_CSS3_TEXT_DECORATION", default => 0, value => \$css3TextDecorationSupport },
+ define => "ENABLE_CSS3_TEXT_DECORATION", default => isEfl(), value => \$css3TextDecorationSupport },
{ option => "css-hierarchies", desc => "Toggle CSS Hierarchy support",
define => "ENABLE_CSS_HIERARCHIES", default => 0, value => \$cssHierarchiesSupport },
diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py
index 4c2216289..693b47ed4 100644
--- a/Tools/Scripts/webkitpy/common/config/committers.py
+++ b/Tools/Scripts/webkitpy/common/config/committers.py
@@ -239,6 +239,7 @@ committers_unable_to_review = [
Committer("Dmitry Lomov", ["dslomov@google.com", "dslomov@chromium.org"], "dslomov"),
Committer("Dominic Cooney", ["dominicc@chromium.org", "dominicc@google.com"], "dominicc"),
Committer("Dominic Mazzoni", ["dmazzoni@google.com", "dmazzoni@chromium.org"], "dmazzoni"),
+ Committer(u"Dominik R\u00f6ttsches", ["dominik.rottsches@intel.com", "d-r@roettsches.de"], "drott"),
Committer("Drew Wilson", "atwilson@chromium.org", "atwilson"),
Committer("Eli Fidler", ["eli@staikos.net", "efidler@rim.com"], "efidler"),
Committer("Elliot Poger", "epoger@chromium.org", "epoger"),
diff --git a/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py b/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py
index 99e8528de..d30ad55aa 100644
--- a/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py
+++ b/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py
@@ -34,6 +34,7 @@ from webkitpy.common.system.deprecated_logging import log
# FIXME: common should never import from new-run-webkit-tests, one of these files needs to move.
from webkitpy.layout_tests.layout_package import json_results_generator
from webkitpy.layout_tests.models import test_expectations, test_results, test_failures
+from webkitpy.layout_tests.models.test_expectations import TestExpectations
# These are helper functions for navigating the results json structure.
@@ -72,15 +73,15 @@ class JSONTestResult(object):
expected_results = self._expected_as_tokens()
# FIXME: We should only call remove_pixel_failures when this JSONResult
# came from a test run without pixel tests!
- if not test_expectations.has_pixel_failures(actual_results):
- expected_results = test_expectations.remove_pixel_failures(expected_results)
+ if not TestExpectations.has_pixel_failures(actual_results):
+ expected_results = TestExpectations.remove_pixel_failures(expected_results)
for actual_result in actual_results:
- if not test_expectations.result_was_expected(actual_result, expected_results, False, False):
+ if not TestExpectations.result_was_expected(actual_result, expected_results, False, False):
return False
return True
def _tokenize(self, results_string):
- tokens = map(test_expectations.TestExpectations.expectation_from_string, results_string.split(' '))
+ tokens = map(TestExpectations.expectation_from_string, results_string.split(' '))
if None in tokens:
log("Unrecognized result in %s" % results_string)
return set(tokens)
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo.py b/Tools/Scripts/webkitpy/common/system/platforminfo.py
index 74cff5412..a9717cc84 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo.py
@@ -103,6 +103,7 @@ class PlatformInfo(object):
'5': 'leopard',
'6': 'snowleopard',
'7': 'lion',
+ '8': 'mountainlion',
}
assert release_version >= min(version_strings.keys())
return version_strings.get(release_version, 'future')
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
index 8fc961b08..445ef5f7d 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
@@ -133,7 +133,8 @@ class TestPlatformInfo(unittest.TestCase):
self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.5.1')).os_version, 'leopard')
self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.6.1')).os_version, 'snowleopard')
self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.7.1')).os_version, 'lion')
- self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.8.0')).os_version, 'future')
+ self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.8.1')).os_version, 'mountainlion')
+ self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.9.0')).os_version, 'future')
self.assertEquals(self.make_info(fake_sys('linux2')).os_version, 'lucid')
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py b/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
index 7379d97c3..ae3470a5d 100644
--- a/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
@@ -110,7 +110,7 @@ class SingleTestRunner(object):
expected_driver_output.strip_metrics()
driver_output.strip_metrics()
- test_result = self._compare_output(driver_output, expected_driver_output)
+ test_result = self._compare_output(expected_driver_output, driver_output)
if self._options.new_test_results:
self._add_missing_baselines(test_result, driver_output)
test_result_writer.write_test_result(self._filesystem, self._port, self._test_name, driver_output, expected_driver_output, test_result.failures)
@@ -209,7 +209,7 @@ class SingleTestRunner(object):
_log.debug(" %s" % line)
return failures
- def _compare_output(self, driver_output, expected_driver_output):
+ def _compare_output(self, expected_driver_output, driver_output):
failures = []
failures.extend(self._handle_error(driver_output))
@@ -218,26 +218,26 @@ class SingleTestRunner(object):
# In case of timeouts, we continue since we still want to see the text and image output.
return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr())
- failures.extend(self._compare_text(driver_output.text, expected_driver_output.text))
- failures.extend(self._compare_audio(driver_output.audio, expected_driver_output.audio))
+ failures.extend(self._compare_text(expected_driver_output.text, driver_output.text))
+ failures.extend(self._compare_audio(expected_driver_output.audio, driver_output.audio))
if self._should_run_pixel_test:
- failures.extend(self._compare_image(driver_output, expected_driver_output))
+ failures.extend(self._compare_image(expected_driver_output, driver_output))
return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr())
- def _compare_text(self, actual_text, expected_text):
+ def _compare_text(self, expected_text, actual_text):
failures = []
if (expected_text and actual_text and
# Assuming expected_text is already normalized.
- self._port.do_text_results_differ(self._get_normalized_output_text(actual_text), expected_text)):
+ self._port.do_text_results_differ(expected_text, self._get_normalized_output_text(actual_text))):
failures.append(test_failures.FailureTextMismatch())
elif actual_text and not expected_text:
failures.append(test_failures.FailureMissingResult())
return failures
- def _compare_audio(self, actual_audio, expected_audio):
+ def _compare_audio(self, expected_audio, actual_audio):
failures = []
if (expected_audio and actual_audio and
- self._port.do_audio_results_differ(actual_audio, expected_audio)):
+ self._port.do_audio_results_differ(expected_audio, actual_audio)):
failures.append(test_failures.FailureAudioMismatch())
elif actual_audio and not expected_audio:
failures.append(test_failures.FailureMissingAudio())
@@ -254,7 +254,7 @@ class SingleTestRunner(object):
# FIXME: This function also creates the image diff. Maybe that work should
# be handled elsewhere?
- def _compare_image(self, driver_output, expected_driver_output):
+ def _compare_image(self, expected_driver_output, driver_output):
failures = []
# If we didn't produce a hash file, this test must be text-only.
if driver_output.image_hash is None:
@@ -264,12 +264,9 @@ class SingleTestRunner(object):
elif not expected_driver_output.image_hash:
failures.append(test_failures.FailureMissingImageHash())
elif driver_output.image_hash != expected_driver_output.image_hash:
- diff_result = self._port.diff_image(driver_output.image, expected_driver_output.image)
+ diff_result = self._port.diff_image(expected_driver_output.image, driver_output.image)
err_str = diff_result[2]
- # FIXME: see https://bugs.webkit.org/show_bug.cgi?id=94277 and
- # https://bugs.webkit.org/show_bug.cgi?id=81962; ImageDiff doesn't
- # seem to be working with WTR properly and tons of tests are failing.
- if err_str and not self._options.webkit_test_runner:
+ if err_str:
_log.warning(' %s : %s' % (self._test_name, err_str))
failures.append(test_failures.FailureImageHashMismatch())
driver_output.error = (driver_output.error or '') + err_str
@@ -279,7 +276,7 @@ class SingleTestRunner(object):
failures.append(test_failures.FailureImageHashMismatch(diff_result[1]))
else:
# See https://bugs.webkit.org/show_bug.cgi?id=69444 for why this isn't a full failure.
- _log.warning(' %s -> pixel hash failed (but pixel test still passes)' % self._test_name)
+ _log.warning(' %s -> pixel hash failed (but diff passed)' % self._test_name)
return failures
def _run_reftest(self):
@@ -298,7 +295,7 @@ class SingleTestRunner(object):
for expectation, reference_filename in putAllMismatchBeforeMatch(self._reference_files):
reference_test_name = self._port.relative_test_filename(reference_filename)
reference_output = self._driver.run_test(DriverInput(reference_test_name, self._timeout, test_output.image_hash, should_run_pixel_test=True), self._stop_when_done)
- test_result = self._compare_output_with_reference(test_output, reference_output, reference_filename, expectation == '!=')
+ test_result = self._compare_output_with_reference(reference_output, test_output, reference_filename, expectation == '!=')
if (expectation == '!=' and test_result.failures) or (expectation == '==' and not test_result.failures):
break
@@ -308,31 +305,33 @@ class SingleTestRunner(object):
test_result_writer.write_test_result(self._filesystem, self._port, self._test_name, test_output, reference_output, test_result.failures)
return TestResult(self._test_name, test_result.failures, total_test_time + test_result.test_run_time, test_result.has_stderr)
- def _compare_output_with_reference(self, driver_output1, driver_output2, reference_filename, mismatch):
- total_test_time = driver_output1.test_time + driver_output2.test_time
- has_stderr = driver_output1.has_stderr() or driver_output2.has_stderr()
+ def _compare_output_with_reference(self, reference_driver_output, actual_driver_output, reference_filename, mismatch):
+ total_test_time = reference_driver_output.test_time + actual_driver_output.test_time
+ has_stderr = reference_driver_output.has_stderr() or actual_driver_output.has_stderr()
failures = []
- failures.extend(self._handle_error(driver_output1))
+ failures.extend(self._handle_error(actual_driver_output))
if failures:
# Don't continue any more if we already have crash or timeout.
return TestResult(self._test_name, failures, total_test_time, has_stderr)
- failures.extend(self._handle_error(driver_output2, reference_filename=reference_filename))
+ failures.extend(self._handle_error(reference_driver_output, reference_filename=reference_filename))
if failures:
return TestResult(self._test_name, failures, total_test_time, has_stderr)
- if self._options.webkit_test_runner and not self._options.pixel_tests:
- # don't check pixel results for WTR/WK2; they're broken.
- return TestResult(self._test_name, failures, total_test_time, has_stderr)
-
- if not driver_output1.image_hash and not driver_output2.image_hash:
+ if not reference_driver_output.image_hash and not actual_driver_output.image_hash:
failures.append(test_failures.FailureReftestNoImagesGenerated(reference_filename))
elif mismatch:
- if driver_output1.image_hash == driver_output2.image_hash:
- failures.append(test_failures.FailureReftestMismatchDidNotOccur(reference_filename))
- elif driver_output1.image_hash != driver_output2.image_hash:
- failures.append(test_failures.FailureReftestMismatch(reference_filename))
+ if reference_driver_output.image_hash == actual_driver_output.image_hash:
+ diff_result = self._port.diff_image(reference_driver_output.image, actual_driver_output.image)
+ if not diff_result[0]:
+ failures.append(test_failures.FailureReftestMismatchDidNotOccur(reference_filename))
+ else:
+ _log.warning(" %s -> ref test hashes matched but diff failed" % self._test_name)
- # recompute in case we added to stderr during diff_image
- has_stderr = driver_output1.has_stderr() or driver_output2.has_stderr()
+ elif reference_driver_output.image_hash != actual_driver_output.image_hash:
+ diff_result = self._port.diff_image(reference_driver_output.image, actual_driver_output.image)
+ if diff_result[0]:
+ failures.append(test_failures.FailureReftestMismatch(reference_filename))
+ else:
+ _log.warning(" %s -> ref test hashes didn't match but diff passed" % self._test_name)
return TestResult(self._test_name, failures, total_test_time, has_stderr)
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py b/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py
index 67f42e3b6..be178ab32 100644
--- a/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py
@@ -69,12 +69,12 @@ def write_test_result(filesystem, port, test_name, driver_output,
# FIXME: This work should be done earlier in the pipeline (e.g., when we compare images for non-ref tests).
# FIXME: We should always have 2 images here.
if driver_output.image and expected_driver_output.image:
- diff_image, diff_percent, err_str = port.diff_image(driver_output.image, expected_driver_output.image, tolerance=0)
+ diff_image, diff_percent, err_str = port.diff_image(expected_driver_output.image, driver_output.image, tolerance=0)
if diff_image:
writer.write_image_diff_files(diff_image)
failure.diff_percent = diff_percent
else:
- _log.warn('Can not get image diff. ImageDiff program might not work correctly.')
+ _log.warn('ref test mismatch did not produce an image diff.')
writer.write_reftest(failure.reference_filename)
elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur):
writer.write_image_files(driver_output.image, expected_image=None)
diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
index d3015dbdd..6b949397b 100644
--- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
+++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
@@ -45,57 +45,10 @@ _log = logging.getLogger(__name__)
(PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, SKIP, WONTFIX,
SLOW, REBASELINE, MISSING, FLAKY, NOW, NONE) = range(16)
-
-def result_was_expected(result, expected_results, test_needs_rebaselining, test_is_skipped):
- """Returns whether we got a result we were expecting.
- Args:
- result: actual result of a test execution
- expected_results: set of results listed in test_expectations
- test_needs_rebaselining: whether test was marked as REBASELINE
- test_is_skipped: whether test was marked as SKIP"""
- if result in expected_results:
- return True
- if result == MISSING and test_needs_rebaselining:
- return True
- if result == SKIP and test_is_skipped:
- return True
- return False
-
-
-def remove_pixel_failures(expected_results):
- """Returns a copy of the expected results for a test, except that we
- drop any pixel failures and return the remaining expectations. For example,
- if we're not running pixel tests, then tests expected to fail as IMAGE
- will PASS."""
- expected_results = expected_results.copy()
- if IMAGE in expected_results:
- expected_results.remove(IMAGE)
- expected_results.add(PASS)
- if IMAGE_PLUS_TEXT in expected_results:
- expected_results.remove(IMAGE_PLUS_TEXT)
- expected_results.add(TEXT)
- return expected_results
-
-
-def has_pixel_failures(actual_results):
- return IMAGE in actual_results or IMAGE_PLUS_TEXT in actual_results
-
-
# FIXME: Perhas these two routines should be part of the Port instead?
BASELINE_SUFFIX_LIST = ('png', 'wav', 'txt')
-def suffixes_for_expectations(expectations):
- suffixes = set()
- if expectations.intersection(set([TEXT, IMAGE_PLUS_TEXT])):
- suffixes.add('txt')
- if expectations.intersection(set([IMAGE, IMAGE_PLUS_TEXT])):
- suffixes.add('png')
- if AUDIO in expectations:
- suffixes.add('wav')
- return set(suffixes)
-
-
class ParseError(Exception):
def __init__(self, warnings):
super(ParseError, self).__init__()
@@ -235,10 +188,10 @@ class TestExpectationParser(object):
if not expectation_line.name:
return
- expectation_line.is_file = self._port.test_isfile(expectation_line.name)
- if not expectation_line.is_file and self._check_path_does_not_exist(expectation_line):
+ if not self._check_test_exists(expectation_line):
return
+ expectation_line.is_file = self._port.test_isfile(expectation_line.name)
if expectation_line.is_file:
expectation_line.path = expectation_line.name
else:
@@ -292,18 +245,17 @@ class TestExpectationParser(object):
result.add(expectation)
expectation_line.parsed_expectations = result
- def _check_path_does_not_exist(self, expectation_line):
+ def _check_test_exists(self, expectation_line):
# WebKit's way of skipping tests is to add a -disabled suffix.
# So we should consider the path existing if the path or the
# -disabled version exists.
- if (not self._port.test_exists(expectation_line.name)
- and not self._port.test_exists(expectation_line.name + '-disabled')):
+ if not self._port.test_exists(expectation_line.name) and not self._port.test_exists(expectation_line.name + '-disabled'):
# Log a warning here since you hit this case any
# time you update TestExpectations without syncing
# the LayoutTests directory
expectation_line.warnings.append('Path does not exist.')
- return True
- return False
+ return False
+ return True
def _collect_matching_tests(self, expectation_line):
"""Convert the test specification to an absolute, normalized
@@ -718,6 +670,52 @@ class TestExpectations(object):
assert(' ' not in string) # This only handles one expectation at a time.
return cls.EXPECTATIONS.get(string.lower())
+ @staticmethod
+ def result_was_expected(result, expected_results, test_needs_rebaselining, test_is_skipped):
+ """Returns whether we got a result we were expecting.
+ Args:
+ result: actual result of a test execution
+ expected_results: set of results listed in test_expectations
+ test_needs_rebaselining: whether test was marked as REBASELINE
+ test_is_skipped: whether test was marked as SKIP"""
+ if result in expected_results:
+ return True
+ if result == MISSING and test_needs_rebaselining:
+ return True
+ if result == SKIP and test_is_skipped:
+ return True
+ return False
+
+ @staticmethod
+ def remove_pixel_failures(expected_results):
+ """Returns a copy of the expected results for a test, except that we
+ drop any pixel failures and return the remaining expectations. For example,
+ if we're not running pixel tests, then tests expected to fail as IMAGE
+ will PASS."""
+ expected_results = expected_results.copy()
+ if IMAGE in expected_results:
+ expected_results.remove(IMAGE)
+ expected_results.add(PASS)
+ if IMAGE_PLUS_TEXT in expected_results:
+ expected_results.remove(IMAGE_PLUS_TEXT)
+ expected_results.add(TEXT)
+ return expected_results
+
+ @staticmethod
+ def has_pixel_failures(actual_results):
+ return IMAGE in actual_results or IMAGE_PLUS_TEXT in actual_results
+
+ @staticmethod
+ def suffixes_for_expectations(expectations):
+ suffixes = set()
+ if expectations.intersection(set([TEXT, IMAGE_PLUS_TEXT])):
+ suffixes.add('txt')
+ if expectations.intersection(set([IMAGE, IMAGE_PLUS_TEXT])):
+ suffixes.add('png')
+ if AUDIO in expectations:
+ suffixes.add('wav')
+ return set(suffixes)
+
def __init__(self, port, tests=None, is_lint_mode=False, include_overrides=True):
self._full_test_list = tests
self._test_config = port.test_configuration()
@@ -788,8 +786,8 @@ class TestExpectations(object):
def matches_an_expected_result(self, test, result, pixel_tests_are_enabled):
expected_results = self._model.get_expectations(test)
if not pixel_tests_are_enabled:
- expected_results = remove_pixel_failures(expected_results)
- return result_was_expected(result,
+ expected_results = self.remove_pixel_failures(expected_results)
+ return self.result_was_expected(result,
expected_results,
self.is_rebaselining(test),
self._model.has_modifier(test, SKIP))
diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
index 9fc118360..5abb21302 100644
--- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
@@ -50,47 +50,6 @@ class MockBugManager(object):
return "BUG_NEWLY_CREATED"
-class FunctionsTest(unittest.TestCase):
- def test_result_was_expected(self):
- # test basics
- self.assertEquals(result_was_expected(PASS, set([PASS]),
- False, False), True)
- self.assertEquals(result_was_expected(TEXT, set([PASS]),
- False, False), False)
-
- # test handling of SKIPped tests and results
- self.assertEquals(result_was_expected(SKIP, set([CRASH]),
- False, True), True)
- self.assertEquals(result_was_expected(SKIP, set([CRASH]),
- False, False), False)
-
- # test handling of MISSING results and the REBASELINE modifier
- self.assertEquals(result_was_expected(MISSING, set([PASS]),
- True, False), True)
- self.assertEquals(result_was_expected(MISSING, set([PASS]),
- False, False), False)
-
- def test_remove_pixel_failures(self):
- self.assertEquals(remove_pixel_failures(set([TEXT])),
- set([TEXT]))
- self.assertEquals(remove_pixel_failures(set([PASS])),
- set([PASS]))
- self.assertEquals(remove_pixel_failures(set([IMAGE])),
- set([PASS]))
- self.assertEquals(remove_pixel_failures(set([IMAGE_PLUS_TEXT])),
- set([TEXT]))
- self.assertEquals(remove_pixel_failures(set([PASS, IMAGE, CRASH])),
- set([PASS, CRASH]))
-
- def test_suffixes_for_expectations(self):
- self.assertEquals(suffixes_for_expectations(set([TEXT])), set(['txt']))
- self.assertEquals(suffixes_for_expectations(set([IMAGE_PLUS_TEXT])), set(['txt', 'png']))
- self.assertEquals(suffixes_for_expectations(set([IMAGE])), set(['png']))
- self.assertEquals(suffixes_for_expectations(set([AUDIO])), set(['wav']))
- self.assertEquals(suffixes_for_expectations(set([TEXT, IMAGE, CRASH])), set(['txt', 'png']))
- self.assertEquals(suffixes_for_expectations(set()), set())
-
-
class Base(unittest.TestCase):
# Note that all of these tests are written assuming the configuration
# being tested is Windows XP, Release build.
@@ -137,6 +96,34 @@ BUG_TEST WONTFIX MAC : failures/expected/image.html = IMAGE
def assert_bad_expectations(self, expectations, overrides=None):
self.assertRaises(ParseError, self.parse_exp, expectations, is_lint_mode=True, overrides=overrides)
+ def test_result_was_expected(self):
+ # test basics
+ self.assertEquals(TestExpectations.result_was_expected(PASS, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), True)
+ self.assertEquals(TestExpectations.result_was_expected(TEXT, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False)
+
+ # test handling of SKIPped tests and results
+ self.assertEquals(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=True), True)
+ self.assertEquals(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=False), False)
+
+ # test handling of MISSING results and the REBASELINE modifier
+ self.assertEquals(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=True, test_is_skipped=False), True)
+ self.assertEquals(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False)
+
+ def test_remove_pixel_failures(self):
+ self.assertEquals(TestExpectations.remove_pixel_failures(set([TEXT])), set([TEXT]))
+ self.assertEquals(TestExpectations.remove_pixel_failures(set([PASS])), set([PASS]))
+ self.assertEquals(TestExpectations.remove_pixel_failures(set([IMAGE])), set([PASS]))
+ self.assertEquals(TestExpectations.remove_pixel_failures(set([IMAGE_PLUS_TEXT])), set([TEXT]))
+ self.assertEquals(TestExpectations.remove_pixel_failures(set([PASS, IMAGE, CRASH])), set([PASS, CRASH]))
+
+ def test_suffixes_for_expectations(self):
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set([TEXT])), set(['txt']))
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set([IMAGE_PLUS_TEXT])), set(['txt', 'png']))
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set([IMAGE])), set(['png']))
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set([AUDIO])), set(['wav']))
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set([TEXT, IMAGE, CRASH])), set(['txt', 'png']))
+ self.assertEquals(TestExpectations.suffixes_for_expectations(set()), set())
+
class BasicTests(Base):
def test_basic(self):
@@ -200,13 +187,19 @@ BUGX WONTFIX : failures/expected = IMAGE
def test_parse_warning(self):
try:
- self.parse_exp("""FOO : failures/expected/text.html = TEXT
-SKIP : failures/expected/image.html""", is_lint_mode=True)
+ filesystem = self._port.host.filesystem
+ filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'disabled-test.html-disabled'), 'content')
+ self.get_test('disabled-test.html-disabled'),
+ self.parse_exp("FOO : failures/expected/text.html = TEXT\n"
+ "SKIP : failures/expected/image.html\n"
+ "BUGRNIWA : non-existent-test.html = TEXT\n"
+ "BUGRNIWA : disabled-test.html-disabled = IMAGE", is_lint_mode=True)
self.assertFalse(True, "ParseError wasn't raised")
except ParseError, e:
warnings = ("expectations:1 Test lacks BUG modifier. failures/expected/text.html\n"
"expectations:1 Unrecognized modifier 'foo' failures/expected/text.html\n"
- "expectations:2 Missing expectations SKIP : failures/expected/image.html")
+ "expectations:2 Missing expectations SKIP : failures/expected/image.html\n"
+ "expectations:3 Path does not exist. non-existent-test.html")
self.assertEqual(str(e), warnings)
try:
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/apple.py b/Tools/Scripts/webkitpy/layout_tests/port/apple.py
index 28ecc6380..58b5b64b6 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/apple.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/apple.py
@@ -76,8 +76,14 @@ class ApplePort(Port):
allowed_port_names = self.VERSION_FALLBACK_ORDER + [self.operating_system() + "-future"]
port_name = port_name.replace('-wk2', '')
- assert port_name in allowed_port_names, "%s is not in %s" % (port_name, allowed_port_names)
self._version = self._strip_port_name_prefix(port_name)
+ assert port_name in allowed_port_names, "%s is not in %s" % (port_name, allowed_port_names)
+
+ def _skipped_file_search_paths(self):
+ # We don't have a dedicated Skipped file for the most recent version of the port;
+ # we just use the one in platform/{mac,win}
+ most_recent_name = self.VERSION_FALLBACK_ORDER[-1]
+ return set(filter(lambda name: name != most_recent_name, super(ApplePort, self)._skipped_file_search_paths()))
# FIXME: A more sophisticated version of this function should move to WebKitPort and replace all calls to name().
# This is also a misleading name, since 'mac-future' gets remapped to 'mac'.
@@ -87,14 +93,7 @@ class ApplePort(Port):
def _generate_all_test_configurations(self):
configurations = []
for port_name in self.VERSION_FALLBACK_ORDER:
- if '-' in port_name:
- version = self._strip_port_name_prefix(port_name)
- else:
- # The version for the "base" port is currently defined as "future"
- # since TestConfiguration doesn't allow None as a valid version.
- version = self.FUTURE_VERSION
-
for build_type in self.ALL_BUILD_TYPES:
for architecture in self.ARCHITECTURES:
- configurations.append(TestConfiguration(version=version, architecture=architecture, build_type=build_type))
+ configurations.append(TestConfiguration(version=self._strip_port_name_prefix(port_name), architecture=architecture, build_type=build_type))
return configurations
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/Tools/Scripts/webkitpy/layout_tests/port/builders.py
index 21fcc9801..3d03fc7af 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/builders.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/builders.py
@@ -49,9 +49,12 @@ _exact_matches = {
"Webkit Mac10.7": {"port_name": "chromium-mac-lion", "specifiers": set(["lion"])},
# These builders are on build.webkit.org.
- # FIXME: Remove rebaseline_override_dir once there is an Apple buildbot that corresponds to platform/mac (i.e. a Mountain Lion bot).
- "Apple Lion Release WK1 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion"]), "rebaseline_override_dir": "mac"},
- "Apple Lion Debug WK1 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion", "debug"]), "rebaseline_override_dir": "mac"},
+ "Apple MountainLion Release WK1 (Tests)": {"port_name": "mac-mountainlion", "specifiers": set(["mountainlion"]), "rebaseline_override_dir": "mac"},
+ "Apple MountainLion Debug WK1 (Tests)": {"port_name": "mac-mountainlion", "specifiers": set(["mountainlion", "debug"]), "rebaseline_override_dir": "mac"},
+ "Apple MountainLion Release WK2 (Tests)": {"port_name": "mac-mountainlion", "specifiers": set(["mountainlion", "wk2"]), "rebaseline_override_dir": "mac"},
+ "Apple MountainLion Debug WK2 (Tests)": {"port_name": "mac-mountainlion", "specifiers": set(["mountainlion", "wk2", "debug"]), "rebaseline_override_dir": "mac"},
+ "Apple Lion Release WK1 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion"])},
+ "Apple Lion Debug WK1 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion", "debug"])},
"Apple Lion Release WK2 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion", "wk2"])},
"Apple Lion Debug WK2 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion", "wk2", "debug"])},
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
index 38ce4b198..2ff21cc5d 100755
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -216,6 +216,7 @@ class ChromiumPort(Port):
native_diff_filename = self._convert_path(diff_filename)
executable = self._path_to_image_diff()
+ # Note that although we are handed 'old', 'new', image_diff wants 'new', 'old'.
comand = [executable, '--diff', native_actual_filename, native_expected_filename, native_diff_filename]
result = None
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index baea0639b..554feca23 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -39,7 +39,7 @@ _log = logging.getLogger(__name__)
class ChromiumMacPort(chromium.ChromiumPort):
- SUPPORTED_OS_VERSIONS = ('snowleopard', 'lion', 'future')
+ SUPPORTED_OS_VERSIONS = ('snowleopard', 'lion', 'mountainlion', 'future')
port_name = 'chromium-mac'
FALLBACK_PATHS = {
@@ -54,6 +54,11 @@ class ChromiumMacPort(chromium.ChromiumPort):
'chromium',
'mac',
],
+ 'mountainlion': [ # FIXME: we don't treat ML different from Lion yet.
+ 'chromium-mac',
+ 'chromium',
+ 'mac',
+ ],
'future': [
'chromium-mac',
'chromium',
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
index 776433f80..cba5d2b39 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
@@ -56,8 +56,8 @@ class FactoryTest(unittest.TestCase):
self.assertTrue(isinstance(port, cls))
def test_mac(self):
- self.assert_port(port_name='mac-leopard', cls=mac.MacPort)
- self.assert_port(port_name='mac-leopard-wk2', cls=mac.MacPort)
+ self.assert_port(port_name='mac-lion', cls=mac.MacPort)
+ self.assert_port(port_name='mac-lion-wk2', cls=mac.MacPort)
self.assert_port(port_name='mac', os_name='mac', os_version='lion', cls=mac.MacPort)
self.assert_port(port_name=None, os_name='mac', os_version='lion', cls=mac.MacPort)
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/image_diff.py b/Tools/Scripts/webkitpy/layout_tests/port/image_diff.py
index 08202ace5..72d061ffc 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/image_diff.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/image_diff.py
@@ -57,6 +57,7 @@ class ImageDiffer(object):
if not self._process:
self._start(tolerance)
+ # Note that although we are handed 'old', 'new', ImageDiff wants 'new', 'old'.
self._process.write('Content-Length: %d\n%sContent-Length: %d\n%s' % (
len(actual_contents), actual_contents,
len(expected_contents), expected_contents))
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/Tools/Scripts/webkitpy/layout_tests/port/mac.py
index d0caa5b22..deee3d1be 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/mac.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -46,9 +46,7 @@ _log = logging.getLogger(__name__)
class MacPort(ApplePort):
port_name = "mac"
- # This is a list of all supported OS-VERSION pairs for the AppleMac port
- # and the order of fallback between them. Matches ORWT.
- VERSION_FALLBACK_ORDER = ["mac-leopard", "mac-snowleopard", "mac-lion", "mac"]
+ VERSION_FALLBACK_ORDER = ['mac-snowleopard', 'mac-lion', 'mac-mountainlion']
ARCHITECTURES = ['x86_64', 'x86']
@@ -73,25 +71,15 @@ class MacPort(ApplePort):
def _build_driver_flags(self):
return ['ARCHS=i386'] if self.architecture() == 'x86' else []
- def _most_recent_version(self):
- # This represents the most recently-shipping version of the operating system.
- return self.VERSION_FALLBACK_ORDER[-2]
-
def should_retry_crashes(self):
# On Apple Mac, we retry crashes due to https://bugs.webkit.org/show_bug.cgi?id=82233
return True
- def baseline_path(self):
- if self.name() == self._most_recent_version():
- # Baselines for the most recently shiping version should go into 'mac', not 'mac-foo'.
- if self.get_option('webkit_test_runner'):
- return self._webkit_baseline_path('mac-wk2')
- return self._webkit_baseline_path('mac')
- return ApplePort.baseline_path(self)
-
def default_baseline_search_path(self):
- fallback_index = self.VERSION_FALLBACK_ORDER.index(self._port_name_with_version())
- fallback_names = list(self.VERSION_FALLBACK_ORDER[fallback_index:])
+ if self._name.endswith(self.FUTURE_VERSION):
+ fallback_names = [self.port_name]
+ else:
+ fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(self._name):-1] + [self.port_name]
if self.get_option('webkit_test_runner'):
fallback_names.insert(0, self._wk2_port_name())
# Note we do not add 'wk2' here, even though it's included in _skipped_search_paths().
@@ -110,22 +98,10 @@ class MacPort(ApplePort):
def operating_system(self):
return 'mac'
- # Belongs on a Platform object.
- def is_leopard(self):
- return self._version == "leopard"
-
- # Belongs on a Platform object.
- def is_snowleopard(self):
- return self._version == "snowleopard"
-
- # Belongs on a Platform object.
- def is_lion(self):
- return self._version == "lion"
-
def default_child_processes(self):
# FIXME: The Printer isn't initialized when this is called, so using _log would just show an unitialized logger error.
- if self.is_snowleopard():
+ if self._version == "snowleopard":
print >> sys.stderr, "Cannot run tests in parallel on Snow Leopard due to rdar://problem/10621525."
return 1
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
index bc7b0df44..e75aeeff7 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
@@ -37,8 +37,8 @@ from webkitpy.common.system.systemhost_mock import MockSystemHost
class MacTest(port_testcase.PortTestCase):
os_name = 'mac'
- os_version = 'leopard'
- port_name = 'mac-leopard'
+ os_version = 'lion'
+ port_name = 'mac-lion'
port_maker = MacPort
def assert_skipped_file_search_paths(self, port_name, expected_paths, use_webkit2=False):
@@ -50,16 +50,15 @@ class MacTest(port_testcase.PortTestCase):
self.assertEquals(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000)
def test_skipped_file_search_paths(self):
+ # We should have two skipped files - platform+version and platform; however, we don't
+ # have platform+version for either the most recent version or mac-future.
self.assert_skipped_file_search_paths('mac-snowleopard', set(['mac-snowleopard', 'mac']))
- self.assert_skipped_file_search_paths('mac-leopard', set(['mac-leopard', 'mac']))
self.assert_skipped_file_search_paths('mac-lion', set(['mac-lion', 'mac']))
-
- # Note that there is no platform/mac-future/Skipped.
+ self.assert_skipped_file_search_paths('mac-mountainlion', set(['mac']))
self.assert_skipped_file_search_paths('mac-future', set(['mac']))
self.assert_skipped_file_search_paths('mac-snowleopard', set(['mac-snowleopard', 'mac', 'mac-wk2', 'wk2']), use_webkit2=True)
- self.assert_skipped_file_search_paths('mac-leopard', set(['mac-leopard', 'mac', 'mac-wk2', 'wk2']), use_webkit2=True)
- self.assert_skipped_file_search_paths('mac-lion', set(['mac-lion', 'mac', 'mac-wk2', 'wk2']), use_webkit2=True)
+ self.assert_skipped_file_search_paths('mac-lion', set(['mac', 'mac-lion', 'mac-wk2', 'wk2']), use_webkit2=True)
self.assert_skipped_file_search_paths('mac-future', set(['mac', 'mac-wk2', 'wk2']), use_webkit2=True)
@@ -110,41 +109,22 @@ java/
self.assertTrue(port.version())
def test_versions(self):
- self.assert_name('mac', 'leopard', 'mac-leopard')
- self.assert_name('mac-leopard', 'tiger', 'mac-leopard')
- self.assert_name('mac-leopard', 'leopard', 'mac-leopard')
- self.assert_name('mac-leopard', 'snowleopard', 'mac-leopard')
-
+ # Note: these tests don't need to be exhaustive as long as we get path coverage.
self.assert_name('mac', 'snowleopard', 'mac-snowleopard')
- self.assert_name('mac-snowleopard', 'tiger', 'mac-snowleopard')
self.assert_name('mac-snowleopard', 'leopard', 'mac-snowleopard')
- self.assert_name('mac-snowleopard', 'snowleopard', 'mac-snowleopard')
+ self.assert_name('mac-snowleopard', 'lion', 'mac-snowleopard')
self.assert_name('mac', 'lion', 'mac-lion')
self.assert_name('mac-lion', 'lion', 'mac-lion')
+ self.assert_name('mac', 'mountainlion', 'mac-mountainlion')
+ self.assert_name('mac-mountainlion', 'lion', 'mac-mountainlion')
+
self.assert_name('mac', 'future', 'mac-future')
self.assert_name('mac-future', 'future', 'mac-future')
self.assertRaises(AssertionError, self.assert_name, 'mac-tiger', 'leopard', 'mac-leopard')
-
- def test_is_version_methods(self):
- leopard_port = self.make_port(port_name='mac-leopard')
- self.assertTrue(leopard_port.is_leopard())
- self.assertFalse(leopard_port.is_snowleopard())
- self.assertFalse(leopard_port.is_lion())
-
- snowleopard_port = self.make_port(port_name='mac-snowleopard')
- self.assertFalse(snowleopard_port.is_leopard())
- self.assertTrue(snowleopard_port.is_snowleopard())
- self.assertFalse(snowleopard_port.is_lion())
-
- lion_port = self.make_port(port_name='mac-lion')
- self.assertFalse(lion_port.is_leopard())
- self.assertFalse(lion_port.is_snowleopard())
- self.assertTrue(lion_port.is_lion())
-
def test_setup_environ_for_server(self):
port = self.make_port(options=MockOptions(leaks=True, guard_malloc=True))
env = port.setup_environ_for_server(port.driver_name())
@@ -158,18 +138,14 @@ java/
self.assertEquals(port.baseline_search_path(), absolute_search_paths)
def test_baseline_search_path(self):
- self._assert_search_path('mac-leopard', 'mac-leopard', ['mac-leopard', 'mac-snowleopard', 'mac-lion', 'mac'])
+ # Note that we don't need total coverage here, just path coverage, since this is all data driven.
self._assert_search_path('mac-snowleopard', 'mac-snowleopard', ['mac-snowleopard', 'mac-lion', 'mac'])
-
- # Note that mac-lion writes baselines into mac, not mac-lion! (but it will read from mac-lion)
- self._assert_search_path('mac-lion', 'mac', ['mac-lion', 'mac'])
-
- # Note that there is no 'mac-future'; it uses the 'mac' directory as well.
+ self._assert_search_path('mac-lion', 'mac-lion', ['mac-lion', 'mac'])
+ self._assert_search_path('mac-mountainlion', 'mac', ['mac'])
self._assert_search_path('mac-future', 'mac', ['mac'])
-
- self._assert_search_path('mac-leopard', 'mac-wk2', ['mac-wk2', 'mac-leopard', 'mac-snowleopard', 'mac-lion', 'mac'], use_webkit2=True)
self._assert_search_path('mac-snowleopard', 'mac-wk2', ['mac-wk2', 'mac-snowleopard', 'mac-lion', 'mac'], use_webkit2=True)
self._assert_search_path('mac-lion', 'mac-wk2', ['mac-wk2', 'mac-lion', 'mac'], use_webkit2=True)
+ self._assert_search_path('mac-mountainlion', 'mac-wk2', ['mac-wk2', 'mac'], use_webkit2=True)
self._assert_search_path('mac-future', 'mac-wk2', ['mac-wk2', 'mac'], use_webkit2=True)
def test_show_results_html_file(self):
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/win.py b/Tools/Scripts/webkitpy/layout_tests/port/win.py
index 28465bff3..ff473fec2 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/win.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/win.py
@@ -42,9 +42,7 @@ _log = logging.getLogger(__name__)
class WinPort(ApplePort):
port_name = "win"
- # This is a list of all supported OS-VERSION pairs for the AppleWin port
- # and the order of fallback between them. Matches ORWT.
- VERSION_FALLBACK_ORDER = ["win-xp", "win-vista", "win-7sp0", "win"]
+ VERSION_FALLBACK_ORDER = ["win-xp", "win-vista", "win-7sp0", "win-win7"]
ARCHITECTURES = ['x86']
@@ -63,8 +61,10 @@ class WinPort(ApplePort):
return expected_text != actual_text
def default_baseline_search_path(self):
- fallback_index = self.VERSION_FALLBACK_ORDER.index(self._port_name_with_version())
- fallback_names = list(self.VERSION_FALLBACK_ORDER[fallback_index:])
+ if self._name.endswith(self.FUTURE_VERSION):
+ fallback_names = [self.port_name]
+ else:
+ fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(self._name):-1] + [self.port_name]
# FIXME: The AppleWin port falls back to AppleMac for some results. Eventually we'll have a shared 'apple' port.
if self.get_option('webkit_test_runner'):
fallback_names.insert(0, 'win-wk2')
diff --git a/Tools/Scripts/webkitpy/tool/commands/queues.py b/Tools/Scripts/webkitpy/tool/commands/queues.py
index e8db17c7b..475e505d0 100644
--- a/Tools/Scripts/webkitpy/tool/commands/queues.py
+++ b/Tools/Scripts/webkitpy/tool/commands/queues.py
@@ -332,7 +332,7 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD
return self._layout_test_results_reader.archive(patch)
def build_style(self):
- return "both"
+ return "release"
def refetch_patch(self, patch):
return self._tool.bugs.fetch_attachment(patch.id())
diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py
index 450a912e0..345f206fc 100644
--- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -324,7 +324,7 @@ MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachm
MOCK: update_status: commit-queue Applied patch
MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'validate-changelog', '--non-interactive', 10000, '--port=%(port_name)s'], cwd=/mock-checkout
MOCK: update_status: commit-queue ChangeLog validated
-MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both', '--port=%(port_name)s'], cwd=/mock-checkout
+MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=%(port_name)s'], cwd=/mock-checkout
MOCK: update_status: commit-queue Built patch
MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive', '--port=%(port_name)s'], cwd=/mock-checkout
MOCK: update_status: commit-queue Passed tests
diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index 7ccbf565a..63de323d1 100644
--- a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -44,7 +44,7 @@ from webkitpy.common.system.user import User
from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
from webkitpy.layout_tests.models import test_failures
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
-from webkitpy.layout_tests.models.test_expectations import TestExpectations, suffixes_for_expectations, BASELINE_SUFFIX_LIST
+from webkitpy.layout_tests.models.test_expectations import TestExpectations, BASELINE_SUFFIX_LIST
from webkitpy.layout_tests.port import builders
from webkitpy.tool.grammar import pluralize
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
@@ -333,7 +333,7 @@ class RebaselineExpectations(AbstractParallelRebaselineCommand):
tests_to_rebaseline = {}
expectations = TestExpectations(port, include_overrides=True)
for test in expectations.get_rebaselining_failures():
- tests_to_rebaseline[test] = suffixes_for_expectations(expectations.get_expectations(test))
+ tests_to_rebaseline[test] = TestExpectations.suffixes_for_expectations(expectations.get_expectations(test))
return tests_to_rebaseline
def _add_tests_to_rebaseline_for_port(self, port_name):
diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 93bd5c500..cea6e2e99 100644
--- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -49,7 +49,7 @@ class TestRebaseline(unittest.TestCase):
command.bind_to_tool(tool)
self.assertEqual(command._baseline_directory("Apple Win XP Debug (Tests)"), "/mock-checkout/LayoutTests/platform/win-xp")
self.assertEqual(command._baseline_directory("Apple Win 7 Release (Tests)"), "/mock-checkout/LayoutTests/platform/win")
- self.assertEqual(command._baseline_directory("Apple Lion Release WK1 (Tests)"), "/mock-checkout/LayoutTests/platform/mac")
+ self.assertEqual(command._baseline_directory("Apple Lion Release WK1 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-lion")
self.assertEqual(command._baseline_directory("Apple Lion Release WK2 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-wk2")
self.assertEqual(command._baseline_directory("GTK Linux 32-bit Release"), "/mock-checkout/LayoutTests/platform/gtk")
self.assertEqual(command._baseline_directory("EFL Linux 64-bit Debug"), "/mock-checkout/LayoutTests/platform/efl")
@@ -272,6 +272,9 @@ Retrieving results for gtk from GTK Linux 64-bit Release.
Retrieving results for mac-lion from Apple Lion Release WK1 (Tests).
userscripts/another-test.html (txt)
userscripts/images.svg (png)
+Retrieving results for mac-mountainlion from Apple MountainLion Release WK1 (Tests).
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for qt-linux from Qt Linux Release.
userscripts/another-test.html (txt)
userscripts/images.svg (png)
@@ -280,7 +283,7 @@ Retrieving results for win-7sp0 from Apple Win 7 Release (Tests).
userscripts/images.svg (png)
"""
- expected_stdout = """[(['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux 32', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Qt Linux Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux 32', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Qt Linux Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout')]
+ expected_stdout = """[(['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux 32', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Qt Linux Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple MountainLion Release WK1 (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux 32', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Qt Linux Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple MountainLion Release WK1 (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout')]
"""
expected_stderr = """MOCK run_command: ['qmake', '-v'], cwd=None
diff --git a/Tools/TestWebKitAPI/CMakeLists.txt b/Tools/TestWebKitAPI/CMakeLists.txt
index d116b5c0e..fffbb31bb 100644
--- a/Tools/TestWebKitAPI/CMakeLists.txt
+++ b/Tools/TestWebKitAPI/CMakeLists.txt
@@ -67,6 +67,7 @@ ADD_EXECUTABLE(test_wtf
${test_main_SOURCES}
${TESTWEBKITAPI_DIR}/TestsController.cpp
${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
+ ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
diff --git a/Tools/TestWebKitAPI/GNUmakefile.am b/Tools/TestWebKitAPI/GNUmakefile.am
index 255a83856..0c575d809 100644
--- a/Tools/TestWebKitAPI/GNUmakefile.am
+++ b/Tools/TestWebKitAPI/GNUmakefile.am
@@ -51,6 +51,7 @@ Programs_TestWebKitAPI_TestWTF_LDFLAGS = \
Programs_TestWebKitAPI_TestWTF_SOURCES = \
Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp \
+ Tools/TestWebKitAPI/Tests/WTF/CString.cpp \
Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp \
Tools/TestWebKitAPI/Tests/WTF/Functional.cpp \
Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp \
diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index e98410d31..65fe48c67 100644
--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -23,6 +23,7 @@
1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; };
265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */; };
+ 26A2C72F15E2E73C005B1A14 /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A2C72E15E2E73C005B1A14 /* CString.cpp */; };
26B2DFF915BDE599004F691D /* HashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B2DFF815BDE599004F691D /* HashSet.cpp */; };
26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */; };
26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
@@ -253,6 +254,7 @@
1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; };
261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.mm; sourceTree = "<group>"; };
265AF54F15D1E48A00B0CB4A /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WTFString.cpp; path = WTF/WTFString.cpp; sourceTree = "<group>"; };
+ 26A2C72E15E2E73C005B1A14 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = WTF/CString.cpp; sourceTree = "<group>"; };
26B2DFF815BDE599004F691D /* HashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HashSet.cpp; path = WTF/HashSet.cpp; sourceTree = "<group>"; };
26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CancelLoadFromResourceLoadDelegate.mm; sourceTree = "<group>"; };
26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CancelLoadFromResourceLoadDelegate.html; sourceTree = "<group>"; };
@@ -628,6 +630,7 @@
BC029B1A1486B23800817DA9 /* ns */,
C0991C4F143C7D68007998F2 /* cf */,
26F1B44215CA434F00D1E4BF /* AtomicString.cpp */,
+ 26A2C72E15E2E73C005B1A14 /* CString.cpp */,
CD5497B315857F0C00B5BC30 /* MediaTime.cpp */,
0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */,
0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */,
@@ -871,6 +874,7 @@
buildActionMask = 2147483647;
files = (
26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */,
+ 26A2C72F15E2E73C005B1A14 /* CString.cpp in Sources */,
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */,
BC131A9B1171316900B69727 /* main.mm in Sources */,
BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WTF/CString.cpp b/Tools/TestWebKitAPI/Tests/WTF/CString.cpp
new file mode 100644
index 000000000..1f47cb292
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WTF/CString.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 Apple 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 <wtf/text/CString.h>
+
+TEST(WTF, CStringNullStringConstructor)
+{
+ CString string;
+ ASSERT_TRUE(string.isNull());
+ ASSERT_EQ(string.data(), static_cast<const char*>(0));
+ ASSERT_EQ(string.length(), static_cast<size_t>(0));
+
+ CString stringFromCharPointer(static_cast<const char*>(0));
+ ASSERT_TRUE(stringFromCharPointer.isNull());
+ ASSERT_EQ(stringFromCharPointer.data(), static_cast<const char*>(0));
+ ASSERT_EQ(stringFromCharPointer.length(), static_cast<size_t>(0));
+
+ CString stringFromCharAndLength(static_cast<const char*>(0), 0);
+ ASSERT_TRUE(stringFromCharAndLength.isNull());
+ ASSERT_EQ(stringFromCharAndLength.data(), static_cast<const char*>(0));
+ ASSERT_EQ(stringFromCharAndLength.length(), static_cast<size_t>(0));
+}
+
+TEST(WTF, CStringEmptyEmptyConstructor)
+{
+ const char* emptyString = "";
+ CString string(emptyString);
+ ASSERT_FALSE(string.isNull());
+ ASSERT_EQ(string.length(), static_cast<size_t>(0));
+ ASSERT_EQ(string.data()[0], 0);
+
+ CString stringWithLength(emptyString, 0);
+ ASSERT_FALSE(stringWithLength.isNull());
+ ASSERT_EQ(stringWithLength.length(), static_cast<size_t>(0));
+ ASSERT_EQ(stringWithLength.data()[0], 0);
+}
+
+TEST(WTF, CStringEmptyRegularConstructor)
+{
+ const char* referenceString = "WebKit";
+
+ CString string(referenceString);
+ ASSERT_FALSE(string.isNull());
+ ASSERT_EQ(string.length(), strlen(referenceString));
+ ASSERT_STREQ(referenceString, string.data());
+
+ CString stringWithLength(referenceString, 6);
+ ASSERT_FALSE(stringWithLength.isNull());
+ ASSERT_EQ(stringWithLength.length(), strlen(referenceString));
+ ASSERT_STREQ(referenceString, stringWithLength.data());
+}
+
+TEST(WTF, CStringUninitializedConstructor)
+{
+ char* buffer;
+ CString emptyString = CString::newUninitialized(0, buffer);
+ ASSERT_FALSE(emptyString.isNull());
+ ASSERT_EQ(buffer, emptyString.data());
+ ASSERT_EQ(buffer[0], 0);
+
+ const size_t length = 25;
+ CString uninitializedString = CString::newUninitialized(length, buffer);
+ ASSERT_FALSE(uninitializedString.isNull());
+ ASSERT_EQ(buffer, uninitializedString.data());
+ ASSERT_EQ(uninitializedString.data()[length], 0);
+}
+
+TEST(WTF, CStringZeroTerminated)
+{
+ const char* referenceString = "WebKit";
+ CString stringWithLength(referenceString, 3);
+ ASSERT_EQ(stringWithLength.data()[3], 0);
+}
+
+TEST(WTF, CStringCopyOnWrite)
+{
+ const char* initialString = "Webkit";
+ CString string(initialString);
+ CString copy = string;
+
+ string.mutableData()[3] = 'K';
+ ASSERT_TRUE(string != copy);
+ ASSERT_STREQ(string.data(), "WebKit");
+ ASSERT_STREQ(copy.data(), initialString);
+}
diff --git a/configure.ac b/configure.ac
index 78f2067e6..28f9af88b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -565,6 +565,12 @@ AC_ARG_WITH(acceleration_backend,
])
AC_MSG_RESULT([$with_acceleration_backend])
+if test "$with_acceleration_backend" = "opengl"; then
+ PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite]);
+ AC_SUBST(XCOMPOSITE_CFLAGS)
+ AC_SUBST(XCOMPOSITE_LIBS)
+fi
+
# OpenGL is turned on by default (along with WebGL and accelerated compositing), but if
# Clutter is chosen as the accelerated drawing backend, we want to disable it. COGL does
# not play well with OpenGL.